blob_id
stringlengths 40
40
| directory_id
stringlengths 40
40
| path
stringlengths 3
616
| content_id
stringlengths 40
40
| detected_licenses
sequencelengths 0
112
| license_type
stringclasses 2
values | repo_name
stringlengths 5
115
| snapshot_id
stringlengths 40
40
| revision_id
stringlengths 40
40
| branch_name
stringclasses 777
values | visit_date
timestamp[us]date 2015-08-06 10:31:46
2023-09-06 10:44:38
| revision_date
timestamp[us]date 1970-01-01 02:38:32
2037-05-03 13:00:00
| committer_date
timestamp[us]date 1970-01-01 02:38:32
2023-09-06 01:08:06
| github_id
int64 4.92k
681M
⌀ | star_events_count
int64 0
209k
| fork_events_count
int64 0
110k
| gha_license_id
stringclasses 22
values | gha_event_created_at
timestamp[us]date 2012-06-04 01:52:49
2023-09-14 21:59:50
⌀ | gha_created_at
timestamp[us]date 2008-05-22 07:58:19
2023-08-21 12:35:19
⌀ | gha_language
stringclasses 149
values | src_encoding
stringclasses 26
values | language
stringclasses 1
value | is_vendor
bool 2
classes | is_generated
bool 2
classes | length_bytes
int64 3
10.2M
| extension
stringclasses 188
values | content
stringlengths 3
10.2M
| authors
sequencelengths 1
1
| author_id
stringlengths 1
132
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
e792e19c6c071844b8e14e4097606cc35d55f43f | 4f8a363ad77ffa2772d1916673a390719729ff0f | /example/example.py | afc0c571b7435400d8452ab1ee83c2922e2697b0 | [
"MIT"
] | permissive | HannahVMeyer/bgen-reader-py | c9453063a612c2bc7690c97809a1e746f61b8ebc | 2bbdfbec30df98550d53a13d253fb580bc401690 | refs/heads/master | 2020-03-23T07:10:46.479208 | 2018-07-16T12:49:23 | 2018-07-16T12:49:23 | 141,252,940 | 0 | 0 | null | 2018-07-17T07:58:06 | 2018-07-17T07:58:06 | null | UTF-8 | Python | false | false | 288 | py | from bgen_reader import read_bgen
if __name__ == "__main__":
bgen = read_bgen("example.bgen", verbose=False)
print(bgen["variants"].head())
print(bgen["samples"].head())
print(len(bgen["genotype"]))
p = bgen["genotype"][0].compute()
print(p)
print(p.shape)
| [
"[email protected]"
] | |
051b4d205eb8834085b0c4a3388e32cdf989b777 | 2affcf450f0bab36b74dd7c8b29522ad38955155 | /pyspedas/geotail/load.py | f27b097b0e3fde3d8f21e205f9036251f591478f | [
"MIT"
] | permissive | nargesahmadi/pyspedas | 1148de83641196681ad65b54e43df0d0c185baf2 | 73ebdabcdef0f6e1087a2a5eb18c3e2384c4fb54 | refs/heads/master | 2022-02-16T18:51:35.204137 | 2022-01-10T23:25:20 | 2022-01-10T23:25:20 | 174,030,853 | 0 | 0 | MIT | 2019-03-05T22:34:32 | 2019-03-05T22:34:24 | Python | UTF-8 | Python | false | false | 2,604 | py | from pyspedas.utilities.dailynames import dailynames
from pyspedas.utilities.download import download
from pyspedas.analysis.time_clip import time_clip as tclip
from pytplot import cdf_to_tplot
from .config import CONFIG
def load(trange=['2013-11-5', '2013-11-6'],
instrument='mgf',
datatype='k0',
suffix='',
get_support_data=False,
varformat=None,
varnames=[],
downloadonly=False,
notplot=False,
no_update=False,
time_clip=False):
"""
This function loads data from the Geotail mission; this function is not meant
to be called directly; instead, see the wrappers:
pyspedas.geotail.mgf
pyspedas.geotail.efd
pyspedas.geotail.lep
pyspedas.geotail.cpi
pyspedas.geotail.epi
pyspedas.geotail.pwi
"""
if instrument == 'mgf':
if datatype == 'k0':
pathformat = 'mgf/mgf_k0/%Y/ge_'+datatype+'_mgf_%Y%m%d_v??.cdf'
elif datatype == 'eda3sec' or datatype == 'edb3sec':
pathformat = 'mgf/'+datatype+'_mgf/%Y/ge_'+datatype+'_mgf_%Y%m%d_v??.cdf'
elif instrument == 'efd':
pathformat = instrument+'/'+instrument+'_'+datatype+'/%Y/ge_'+datatype+'_'+instrument+'_%Y%m%d_v??.cdf'
elif instrument == 'lep':
if datatype == 'k0':
pathformat = 'lep/lep_k0/%Y/ge_'+datatype+'_lep_%Y%m%d_v??.cdf'
elif instrument == 'cpi':
pathformat = instrument+'/'+instrument+'_'+datatype+'/%Y/ge_'+datatype+'_'+instrument+'_%Y%m%d_v??.cdf'
elif instrument == 'epi':
pathformat = 'epic/'+instrument+'_'+datatype+'/%Y/ge_'+datatype+'_'+instrument+'_%Y%m%d_v??.cdf'
elif instrument == 'pwi':
pathformat = instrument+'/'+instrument+'_'+datatype+'/%Y/ge_'+datatype+'_'+instrument+'_%Y%m%d_v??.cdf'
# find the full remote path names using the trange
remote_names = dailynames(file_format=pathformat, trange=trange)
out_files = []
files = download(remote_file=remote_names, remote_path=CONFIG['remote_data_dir'], local_path=CONFIG['local_data_dir'], no_download=no_update)
if files is not None:
for file in files:
out_files.append(file)
out_files = sorted(out_files)
if downloadonly:
return out_files
tvars = cdf_to_tplot(out_files, suffix=suffix, get_support_data=get_support_data, varformat=varformat, varnames=varnames, notplot=notplot)
if notplot:
return tvars
if time_clip:
for new_var in tvars:
tclip(new_var, trange[0], trange[1], suffix='')
return tvars
| [
"[email protected]"
] | |
fbfcbd44389dbd78a51781844533eaeed2c8f870 | 248c535f3612c646bccadecafdca649fd788bb1f | /.history/config_20210927032451.py | 7b5c4e98fe697e4cbf006fd39bb5fbefa8c893f3 | [
"MIT"
] | permissive | GraceOswal/pitch-perfect | 3b923e4de5fff1a405dcb54374a1ba0522232025 | d781c6e0f55c11f2a5e5dceb952f6b2de3c47c3b | refs/heads/master | 2023-08-16T01:42:18.742154 | 2021-10-01T06:59:11 | 2021-10-01T06:59:11 | 410,224,294 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 105 | py | import os
from dotenv import load_dotenv as ld
ld()
class Config:
debug = True
SECRET_KEY = O
| [
"[email protected]"
] | |
6b396ca0c75e591c9c9ba4624a333c13ce6f7238 | 36cebe3f80c547aa43c8c015484d37cd8e70722b | /dingtalk/callback/__init__.py | bd11949f57e96341f0ec3b7a894c6ea0882f23cc | [
"Apache-2.0"
] | permissive | 007gzs/dingtalk-python | 7e62f4a722484f9a98a22fc1ad21edebb6b7fddc | d9bc5d1294fc000cc7339b4b82c212c63a419cc6 | refs/heads/master | 2020-03-14T22:17:34.191090 | 2018-04-26T02:18:13 | 2018-04-26T02:18:13 | 131,817,956 | 1 | 0 | null | 2018-05-02T08:00:54 | 2018-05-02T08:00:53 | null | UTF-8 | Python | false | false | 6,837 | py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time: 2018/3/1 上午11:20
# @Author: BlackMatrix
# @Site: https://github.com/blackmatrix7
# @File: __init__.py
# @Software: PyCharm
from .crypto import *
from .callback import *
from functools import partial
from ..exceptions import DingTalkExceptions
from ..foundation import dingtalk_method, get_timestamp
__author__ = 'blackmatrix'
METHODS = {}
method = partial(dingtalk_method, methods=METHODS)
class CallBack:
def __init__(self, auth, aes_key, token, callback_url, corp_id, noncestr):
self.auth = auth
self.methods = METHODS
self.aes_key = aes_key
self.token = token
self.callback_url = callback_url
self.corp_id = corp_id
self.noncestr = noncestr
@property
def timestamp(self):
return get_timestamp()
def encrypt(self, plaintext, buf=None):
"""
钉钉加密数据
:param plaintext: 明文
:param buf:
:return:
"""
if self.aes_key is None:
raise RuntimeError('加密解密前需要在初始化DingTalk App时传入aes_key')
from dingtalk.callback.crypto import encrypt
ciphertext = encrypt(aes_key=self.aes_key, plaintext=plaintext, key=self.corp_id, buf=buf)
return ciphertext
def decrypt(self, ciphertext: str):
"""
钉钉解密数据
:param ciphertext: 密文
:return:
"""
if self.aes_key is None:
raise RuntimeError('加密解密前需要在初始化DingTalk App时传入aes_key')
from dingtalk.callback.crypto import decrypt
msg, key, buf = decrypt(self.aes_key, ciphertext)
return msg, key, buf
def encrypt_text(self, plaintext: str):
"""
对纯文本进行加密
:param plaintext: 明文
:return:
"""
if self.aes_key is None:
raise RuntimeError('加密解密前需要在初始化DingTalk App时传入aes_key')
from dingtalk.callback.crypto import encrypt_text
ciphertext = encrypt_text(aes_key=self.aes_key, plaintext=plaintext)
return ciphertext
def decrypt_text(self, ciphertext: str):
"""
对纯文本进行解密
:param ciphertext: 密文
:return:
"""
if self.aes_key is None:
raise RuntimeError('加密解密前需要在初始化DingTalk App时传入aes_key')
from dingtalk.callback.crypto import decrypt_text
temp = decrypt_text(self.aes_key, ciphertext)
return temp
def register_callback(self, callback_tag):
"""
向钉钉注册回调接口,只能注册一次,后续需要修改,请调用更新回调接口
注册回调前需要在初始化DingTalk App时传入aes_key和callback_url
其中callback_url必须返回经过加密的字符串“success”的json数据
可以使用return_success()方法直接返回一个符合要求的json格式。
:param callback_tag:
:return:
"""
if self.aes_key is None or self.callback_url is None:
raise RuntimeError('注册回调前需要在初始化DingTalk App时传入aes_key和callback_url')
data = register_callback(self.auth.access_token, self.token, callback_tag, self.aes_key, self.callback_url)
return data
def update_callback(self, callback_tag):
"""
向钉钉更新回调接口
只能在注册回调接口后使用
:param callback_tag:
:return:
"""
if self.aes_key is None or self.callback_url is None:
raise RuntimeError('更新回调前需要在初始化DingTalk App时传入aes_key和callback_url')
data = update_callback(self.auth.access_token, self.token, callback_tag, self.aes_key, self.callback_url)
return data
def get_call_back_failed_result(self):
"""
获取处理失败的钉钉回调
:return:
"""
data = get_callback_failed_result(self.auth.access_token)
return data['failed_list']
def generate_callback_signature(self, data, timestamp, nonce):
"""
创建回调函数的签名,可以用于验证钉钉回调时,传入的签名是否合法
:param data:
:param timestamp:
:param nonce:
:return:
"""
from .crypto import generate_callback_signature
sign = generate_callback_signature(self.token, data, timestamp, nonce)
return sign
def check_callback_signature(self, signature, ciphertext, timestamp, nonce):
"""
验证钉钉回调接口的签名
算法请访问
https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7386797.0.0.EkauZY&source=search&treeId=366&articleId=107524&docType=1
:param signature: 需要验证的签名
:param ciphertext: 加密后的数据
:param timestamp: 时间戳
:param nonce: 随机字符串
:return:
"""
from .crypto import check_callback_signature
return check_callback_signature(self.token, ciphertext, signature, timestamp, nonce)
def return_success(self):
"""
钉钉回调需要返回含有success的json,提供一个方法,快速返回一个符合钉钉要求的success json
:return:
"""
# 加密success数据
encrypt_str = self.encrypt('success').decode()
# 创建时间戳
timestamp = str(self.timestamp)
# 获取随机字符串
nonce = self.noncestr
# 创建签名
signature = self.generate_callback_signature(encrypt_str, timestamp, nonce)
# 返回结果
return {'msg_signature': signature, 'timeStamp': timestamp, 'nonce': nonce, 'encrypt': encrypt_str}
def check_url(self, ding_nonce, ding_sign, ding_timestamp, ding_encrypt):
"""
一个钉钉注册回调的check_url方法
文档:
https://open-doc.dingtalk.com/docs/doc.htm?spm=a219a.7629140.0.0.x75fVY&treeId=385&articleId=104975&docType=1#s12
:param ding_nonce: 钉钉返回的随机字符串
:param ding_sign: 钉钉返回的签名
:param ding_timestamp: 钉钉返回的时间戳
:param ding_encrypt: 钉钉返回的加密后数据
:return: 返回带success的json
"""
# 验证签名
if self.check_callback_signature(ding_sign, ding_encrypt, ding_timestamp, ding_nonce) is False:
raise DingTalkExceptions.sign_err
# 签名验证成功后,解密数据
ding_data, corp_id, buf = self.decrypt(ding_encrypt)
assert ding_data and corp_id and buf
# 返回结果
result = self.return_success()
return result
if __name__ == '__main__':
pass
| [
"[email protected]"
] | |
9ae7ef98bcee9e4b2d7db1dc46125c4be3eda2a4 | b1571f4ee376d789b8094777fd81c4fb47a89cf1 | /AtCoder/練習/others/sumitrust2019/D1.py | d4afae0be30a66063c7a97e2992736d77893989d | [] | no_license | hiroyaonoe/Competitive-programming | e49e43f8853602ba73e658cab423bd91ebbe9286 | 2949e10eec3a38498bedb57ea41a2491916bab1c | refs/heads/master | 2021-06-23T21:56:33.232931 | 2021-05-30T15:27:31 | 2021-05-30T15:27:31 | 225,863,783 | 2 | 0 | null | 2020-06-14T17:54:28 | 2019-12-04T12:37:24 | Python | UTF-8 | Python | false | false | 319 | py | n=int(input())
s=list(map(int,list(input())))
ans=0
for i in range(10):
try:
ss=s[s.index(i)+1:]
for j in range(10):
try:
sss=ss[ss.index(j)+1:]
for k in range(10):
if k in sss:ans+=1
except:pass
except:pass
print(ans) | [
"[email protected]"
] | |
59f8182ce946966628f9ed37706d098e615c12dc | 53fab060fa262e5d5026e0807d93c75fb81e67b9 | /backup/user_048/ch25_2020_03_31_22_53_41_450736.py | 44e131685efa1784e312a6679f408074c7a2fedb | [] | no_license | gabriellaec/desoft-analise-exercicios | b77c6999424c5ce7e44086a12589a0ad43d6adca | 01940ab0897aa6005764fc220b900e4d6161d36b | refs/heads/main | 2023-01-31T17:19:42.050628 | 2020-12-16T05:21:31 | 2020-12-16T05:21:31 | 306,735,108 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 211 | py | v=float(input("qual a velocidade"))
o=float(input("qual o angulo"))
g=9.8
import math
d=((v**2)*math.sin(2*o))/g
if d<98:
print('Muito perto')
elif 102<d:
print('Muito longe')
else:
print('Acertou!') | [
"[email protected]"
] | |
92c29e1e0f95c6c8c50f1bb43c30c205f4387ff9 | 69d407235771f364277f78aeb3a03896804cb690 | /astrobf/run/run_mask.py | 029b428e4d2404ca033b7017c4f8c8dc2fb933f6 | [] | no_license | Hoseung/astroBF | 1bb16de1c867b943751ff0d73dfabc5ab7e723c6 | e04efff26e99886c8b7eba42a897277318338d61 | refs/heads/main | 2023-07-17T12:27:10.184080 | 2021-09-01T05:42:05 | 2021-09-01T05:42:05 | 313,825,096 | 0 | 0 | null | 2021-07-22T15:16:58 | 2020-11-18T04:44:01 | Jupyter Notebook | UTF-8 | Python | false | false | 3,500 | py | import matplotlib.pyplot as plt
import numpy as np
import pickle
import sys, math
from glob import glob
from astropy.io import fits
import astrobf
from astrobf.utils import mask_utils
from astrobf.utils.mask_utils import *
import re
def extract_gid(g_path):
import re
return int(re.split('(\d+)',g_path.split('/')[-2])[1])
def chunks(lst, n):
for i in range(0, len(lst), n):
yield lst[i:i + n]
dataset = ['EFIFI','Nair'][1]
basedir = ['../../bf_data/EFIGI_catalog/','./'][1]
fitsdir = basedir + ['fits_temp_Jan_19/','fits_temp_Dec_28/', 'fits_temp_Feb_3/'][2]
out_dir = basedir+'out1/'
#wdir = '../../OBSdata/efigi-1.6/ima_r/'
fns_g = glob(fitsdir+"*/*g.fits")
fns_r = glob(fitsdir+"*/*r.fits")
fns_i = glob(fitsdir+"*/*i.fits")
fns_g.sort()
fns_r.sort()
fns_i.sort()
gids = [extract_gid(fn) for fn in fns_r]
sub_rows = 3
eps = 1e-5
do_charm=False
FeatureVectors=[]
plt.ioff()
print("# files", len(fns_r))
for ichunk, sub in enumerate(chunks(fns_r, sub_rows**2)):
if ichunk < 597: # 300 / 500
continue
fig, axs = plt.subplots(sub_rows, sub_rows)
fig.set_size_inches(12,12)
try:
axs = axs.ravel()
except:
axs = [axs]
for ax, fn in zip(axs, sub):
#try:
if True:
img_name = fn.split("/")[-2]
int_name = int(re.split('(\d+)',img_name)[1])
#if int_name < 50229:
# continue
if dataset=="Nair": img_name = img_name.split('.')[0]
hdulist = fits.open(fn)
# Ensure pixel values are positive
hdulist[0].data -= (hdulist[0].data.min() - eps)
#hdulist[0].data[hdulist[0].data < 10*eps] = eps
mask, img, mask_new = mask_utils.gmm_mask(hdulist,
max_n_comp=20,
sig_factor=2.0,
verbose=False,
do_plot=False,
npix_min=50)
pickle.dump(mask_new, open(out_dir+f"{img_name}_mask.pickle", "wb"))
# Feature Vectors
img[~mask] = 0
ax.imshow(np.log10(img))
#ax.imshow(mask, alpha=0.5)
#mask_new = mask_hull(mask, ax)
ax.text(0.05,0.05, img_name, transform=ax.transAxes)
if do_charm:
# Each 'matrix' is distinct instance??
# And numpy_matrix is pointing to matrix..?
matrix = PyImageMatrix()
matrix.allocate(img.shape[1], img.shape[0])
numpy_matrix = matrix.as_ndarray()
numpy_matrix[:] = (img-img.min())/img.ptp()*255
# Need to scale to ...?
fv = FeatureVector(name='FromNumpyMatrix', long=True, original_px_plane=matrix )# Why not numpy_matrix??
# fv == None for now.
fv.GenerateFeatures(quiet=False, write_to_disk=True)
FeatureVectors.append({img_name:fv.values})
stamp = gen_stamp(img, pad=10, aspect_ratio="no", eps=eps)
stamp -= (stamp.min() - eps)
else:
stamp = gen_stamp(img, pad=10, aspect_ratio="no", eps=eps)
stamp -= (stamp.min() - eps)
#except:
print("ERROR")
continue
plt.tight_layout()
plt.savefig(out_dir+f"{ichunk}.png", dpi=144)
plt.close()
print(f'{ichunk}-th chunk done')
| [
"[email protected]"
] | |
d7b5fb914f9642a2d6865e592d26e4871af30805 | 52346de88a47f70ed63335b21ff12748bbbb5cba | /modules/tools/sensor_calibration/sensor_msg_extractor.py | e5393e63fd2d40f25fbec1cb642a465101fcbab4 | [
"Apache-2.0"
] | permissive | lgsvl/apollo-5.0 | 064537e31c5d229c0712bfcd4109af71dbf1d09d | 105f7fd19220dc4c04be1e075b1a5d932eaa2f3f | refs/heads/simulator | 2022-03-08T09:18:02.378176 | 2021-10-01T22:07:57 | 2021-10-01T22:07:57 | 203,249,539 | 86 | 115 | Apache-2.0 | 2022-02-11T02:55:46 | 2019-08-19T21:00:15 | C++ | UTF-8 | Python | false | false | 9,839 | py | #!/usr/bin/env python
###############################################################################
# Copyright 2019 The Apollo Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
###############################################################################
"""
This is a bunch of classes to manage cyber record channel extractor.
"""
import os
import sys
import struct
import numpy as np
import cv2
import pypcd
from modules.drivers.proto import sensor_image_pb2
from modules.drivers.proto import pointcloud_pb2
from modules.localization.proto import gps_pb2
from data_file_object import *
class SensorMessageParser(object):
"""Wrapper for cyber channel message extractor"""
# Initalizing extractor
def __init__(self, output_path, instance_saving=True):
"""
instance_saving:
True for large channel message, e.g., Camera/lidar/Radar;
False for small channel message, e.g., GNSS topics
"""
self._msg_parser = None
self._timestamps = []
self._proto_parser = None
self._init_parser()
self._parsed_data = None
self._output_path = output_path
self._timestamp_file = os.path.join(self._output_path, "timestamps.txt")
self._instance_saving = instance_saving
#initalizing msg and proto parser
def _init_parser(self):
raise NotImplementedError
def parse_sensor_message(self, msg):
raise NotImplementedError
def save_messages_to_file(self):
return True
def get_msg_count(self):
return len(self._timestamps)
def get_timestamps(self):
return self._timestamps
def save_timestamps_to_file(self):
timestamp_file_obj = TimestampFileObject(self._timestamp_file,
operation='write',
file_type='txt')
timestamp_file_obj.save_to_file(self._timestamps)
return True
class GpsParser(SensorMessageParser):
"""
class to parse GNSS odometry channel.
saving this small topic as a whole.
"""
def __init__(self, output_path, instance_saving=False):
super(GpsParser, self).__init__(output_path, instance_saving)
if not self._instance_saving:
self._parsed_data = []
self._odomotry_output_file =\
os.path.join(self._output_path, "Odometry.bin")
def _init_parser(self):
self._msg_parser = gps_pb2.Gps()
def parse_sensor_message(self, msg):
""" parse Gps information from GNSS odometry channel"""
gps = self._msg_parser
gps.ParseFromString(msg.message)
# all double, except point_type is int32
ts = gps.header.timestamp_sec
self._timestamps.append(ts)
point_type = 0
qw = gps.localization.orientation.qw
qx = gps.localization.orientation.qx
qy = gps.localization.orientation.qy
qz = gps.localization.orientation.qz
x = gps.localization.position.x
y = gps.localization.position.y
z = gps.localization.position.z
# save 9 values as a tuple, for eaisier struct packing during storage
if self._instance_saving:
raise ValueError("Gps odometry should be saved in a file")
else:
self._parsed_data.append((ts, point_type, qw, qx, qy, qz, x, y, z))
return True
def save_messages_to_file(self):
"""save list of parsed Odometry messages to file"""
odometry_file_obj = OdometryFileObject(file_path=self._odomotry_output_file,
operation='write',
file_type='binary')
odometry_file_obj.save_to_file(self._parsed_data)
return True
class PointCloudParser(SensorMessageParser):
"""
class to parse apollo/$(lidar)/PointCloud2 channels.
saving seperately each parsed msg
"""
def __init__(self, output_path, instance_saving=True):
super(PointCloudParser, self).__init__(output_path, instance_saving)
def convert_xyzit_pb_to_array(self, xyz_i_t, data_type):
arr = np.zeros(len(xyz_i_t), dtype=data_type)
for i, point in enumerate(xyz_i_t):
# change timestamp to timestamp_sec
arr[i] = (point.x, point.y, point.z,
point.intensity, point.timestamp/1e9)
return arr
def make_xyzit_point_cloud(self, xyz_i_t):
"""
Make a pointcloud object from PointXYZIT message, as Pointcloud.proto.
message PointXYZIT {
optional float x = 1 [default = nan];
optional float y = 2 [default = nan];
optional float z = 3 [default = nan];
optional uint32 intensity = 4 [default = 0];
optional uint64 timestamp = 5 [default = 0];
}
"""
md = {'version': .7,
'fields': ['x', 'y', 'z', 'intensity', 'timestamp'],
'count': [1, 1, 1, 1, 1],
'width': len(xyz_i_t),
'height': 1,
'viewpoint': [0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0],
'points': len(xyz_i_t),
'type': ['F', 'F', 'F', 'U', 'F'],
'size': [4, 4, 4, 4, 8],
'data': 'binary_compressed'}
typenames = []
for t, s in zip(md['type'], md['size']):
np_type = pypcd.pcd_type_to_numpy_type[(t, s)]
typenames.append(np_type)
np_dtype = np.dtype(zip(md['fields'], typenames))
pc_data = self.convert_xyzit_pb_to_array(xyz_i_t, data_type=np_dtype)
pc = pypcd.PointCloud(md, pc_data)
return pc
def save_pointcloud_meta_to_file(self, pc_meta, pcd_file):
pypcd.save_point_cloud_bin_compressed(pc_meta, pcd_file)
def _init_parser(self):
self._msg_parser = pointcloud_pb2.PointCloud()
def parse_sensor_message(self, msg):
"""
Transform protobuf PointXYZIT to standard PCL bin_compressed_file(*.pcd).
"""
pointcloud = self._msg_parser
pointcloud.ParseFromString(msg.message)
self._timestamps.append(pointcloud.measurement_time)
# self._timestamps.append(pointcloud.header.timestamp_sec)
self._parsed_data = self.make_xyzit_point_cloud(pointcloud.point)
if self._instance_saving:
file_name = "%06d.pcd" % self.get_msg_count()
output_file = os.path.join(self._output_path, file_name)
self.save_pointcloud_meta_to_file(pc_meta=self._parsed_data, pcd_file=output_file)
else:
raise ValueError("not implement multiple message concatenation for PointCloud2 topic")
# TODO(gchen-Apollo): add saint check
return True
class ImageParser(SensorMessageParser):
"""
class to parse apollo/$(camera)/image channels.
saving seperately each parsed msg
"""
def __init__(self, output_path, instance_saving=True):
super(ImageParser, self).__init__(output_path, instance_saving)
def _init_parser(self):
self._msg_parser = sensor_image_pb2.Image()
def parse_sensor_message(self, msg):
image = self._msg_parser
image.ParseFromString(msg.message)
self._timestamps.append(image.header.timestamp_sec)
# Save image according to cyber format, defined in sensor camera proto.
# height = 4, image height, that is, number of rows.
# width = 5, image width, that is, number of columns.
# encoding = 6, as string, type is 'rgb8', 'bgr8' or 'gray'.
# step = 7, full row length in bytes.
# data = 8, actual matrix data in bytes, size is (step * rows).
# type = CV_8UC1 if image step is equal to width as gray, CV_8UC3
# if step * 3 is equal to width.
if image.encoding == 'rgb8' or image.encoding == 'bgr8':
if image.step != image.width * 3:
print('Image.step %d does not equal to Image.width %d * 3 for color image.'
% (image.step, image.width))
return False
elif image.encoding == 'gray' or image.encoding == 'y':
if image.step != image.width:
print('Image.step %d does not equal to Image.width %d or gray image.'
% (image.step, image.width))
return False
else:
print('Unsupported image encoding type: %s.' % image.encoding)
return False
channel_num = image.step / image.width
self._parsed_data = np.fromstring(image.data, dtype=np.uint8).reshape(
(image.height, image.width, channel_num))
if self._instance_saving:
file_name = "%06d.png" % self.get_msg_count()
output_file = os.path.join(self._output_path, file_name)
self.save_image_mat_to_file(image_file=output_file)
else:
raise ValueError("not implement multiple message concatenation for Image topic")
return True
def save_image_mat_to_file(self, image_file):
# Save image in BGR oder
image_mat = self._parsed_data
if self._msg_parser.encoding == 'rgb8':
cv2.imwrite(image_file, cv2.cvtColor(image_mat, cv2.COLOR_RGB2BGR))
else:
cv2.imwrite(image_file, image_mat)
| [
"[email protected]"
] | |
655f4b04f3649777766dc6c14c92519d68e90fda | c059c075c4b31d8aa62174734ba78991c4894b26 | /django_fulcrum/__init__.py | 94e2165eca15bc4fc23d3533bea4f7d3c5330386 | [
"Apache-2.0"
] | permissive | ProminentEdge/django-fulcrum | cd9830e56b354986296070e06c20a6544f768807 | af25cca9bc1940f8548ea11174232dadccfcb156 | refs/heads/master | 2021-01-22T05:38:07.368133 | 2017-03-29T12:48:29 | 2017-03-29T12:48:29 | 81,682,887 | 0 | 1 | null | 2017-02-11T21:16:06 | 2017-02-11T21:16:06 | null | UTF-8 | Python | false | false | 672 | py | # Copyright 2016, RadiantBlue Technologies, Inc.
#
# 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.
default_app_config = 'django_fulcrum.apps.DjangoFulcrumConfig'
| [
"[email protected]"
] | |
5ca45df187f441cfea8b0fc1bfeb5024e3f5924a | 4fc9cb4cf01e41c4ed3de89f13d213e95c87dd33 | /angr/procedures/definitions/win32_user32.py | c90a516fc39d8fe72055e94205bd1428b1b90718 | [
"BSD-2-Clause"
] | permissive | mborgerson/angr | ea5daf28576c3d31b542a0e229139ab2494326e9 | 8296578e92a15584205bfb2f7add13dd0fb36d56 | refs/heads/master | 2023-07-24T22:41:25.607215 | 2022-10-19T19:46:12 | 2022-10-20T18:13:31 | 227,243,942 | 1 | 2 | BSD-2-Clause | 2021-04-07T22:09:51 | 2019-12-11T00:47:55 | Python | UTF-8 | Python | false | false | 406,278 | py | # pylint:disable=line-too-long
import logging
from ...sim_type import SimTypeFunction, SimTypeShort, SimTypeInt, SimTypeLong, SimTypeLongLong, SimTypeDouble, SimTypeFloat, SimTypePointer, SimTypeChar, SimStruct, SimTypeFixedSizeArray, SimTypeBottom, SimUnion, SimTypeBool
from ...calling_conventions import SimCCStdcall, SimCCMicrosoftAMD64
from .. import SIM_PROCEDURES as P
from . import SimLibrary
_l = logging.getLogger(name=__name__)
lib = SimLibrary()
lib.set_default_cc('X86', SimCCStdcall)
lib.set_default_cc('AMD64', SimCCMicrosoftAMD64)
import archinfo
from ...calling_conventions import SimCCCdecl
lib.add('wsprintfA', P['libc']['sprintf'], cc=SimCCCdecl(archinfo.ArchX86()))
lib.set_library_names("user32.dll")
prototypes = \
{
#
'GetAutoRotationState': SimTypeFunction([SimTypePointer(SimTypeInt(signed=False, label="AR_STATE"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pState"]),
#
'GetDisplayAutoRotationPreferences': SimTypeFunction([SimTypePointer(SimTypeInt(signed=False, label="ORIENTATION_PREFERENCE"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pOrientation"]),
#
'SetDisplayAutoRotationPreferences': SimTypeFunction([SimTypeInt(signed=False, label="ORIENTATION_PREFERENCE")], SimTypeInt(signed=True, label="Int32"), arg_names=["orientation"]),
#
'DrawEdge': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="DRAWEDGE_FLAGS"), SimTypeInt(signed=False, label="DRAW_EDGE_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "qrc", "edge", "grfFlags"]),
#
'DrawFrameControl': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="DFC_TYPE"), SimTypeInt(signed=False, label="DFCS_STATE")], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "param2", "param3"]),
#
'DrawCaption': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="DRAW_CAPTION_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "hdc", "lprect", "flags"]),
#
'DrawAnimatedRects': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "idAni", "lprcFrom", "lprcTo"]),
#
'DrawTextA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="DRAW_TEXT_FORMAT")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "lpchText", "cchText", "lprc", "format"]),
#
'DrawTextW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="DRAW_TEXT_FORMAT")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "lpchText", "cchText", "lprc", "format"]),
#
'DrawTextExA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="DRAW_TEXT_FORMAT"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "iTabLength": SimTypeInt(signed=True, label="Int32"), "iLeftMargin": SimTypeInt(signed=True, label="Int32"), "iRightMargin": SimTypeInt(signed=True, label="Int32"), "uiLengthDrawn": SimTypeInt(signed=False, label="UInt32")}, name="DRAWTEXTPARAMS", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "lpchText", "cchText", "lprc", "format", "lpdtp"]),
#
'DrawTextExW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="DRAW_TEXT_FORMAT"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "iTabLength": SimTypeInt(signed=True, label="Int32"), "iLeftMargin": SimTypeInt(signed=True, label="Int32"), "iRightMargin": SimTypeInt(signed=True, label="Int32"), "uiLengthDrawn": SimTypeInt(signed=False, label="UInt32")}, name="DRAWTEXTPARAMS", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "lpchText", "cchText", "lprc", "format", "lpdtp"]),
#
'GrayStringA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "param2"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDC", "hBrush", "lpOutputFunc", "lpData", "nCount", "X", "Y", "nWidth", "nHeight"]),
#
'GrayStringW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "param2"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDC", "hBrush", "lpOutputFunc", "lpData", "nCount", "X", "Y", "nWidth", "nHeight"]),
#
'DrawStateA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "lData", "wData", "cx", "cy"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="DRAWSTATE_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "hbrFore", "qfnCallBack", "lData", "wData", "x", "y", "cx", "cy", "uFlags"]),
#
'DrawStateW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "lData", "wData", "cx", "cy"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="DRAWSTATE_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "hbrFore", "qfnCallBack", "lData", "wData", "x", "y", "cx", "cy", "uFlags"]),
#
'TabbedTextOutA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int32"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "x", "y", "lpString", "chCount", "nTabPositions", "lpnTabStopPositions", "nTabOrigin"]),
#
'TabbedTextOutW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int32"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "x", "y", "lpString", "chCount", "nTabPositions", "lpnTabStopPositions", "nTabOrigin"]),
#
'GetTabbedTextExtentA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int32"), label="LPArray", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hdc", "lpString", "chCount", "nTabPositions", "lpnTabStopPositions"]),
#
'GetTabbedTextExtentW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int32"), label="LPArray", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hdc", "lpString", "chCount", "nTabPositions", "lpnTabStopPositions"]),
#
'UpdateWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'PaintDesktop': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc"]),
#
'WindowFromDC': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hDC"]),
#
'GetDC': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd"]),
#
'GetDCEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_DCX_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "hrgnClip", "flags"]),
#
'GetWindowDC': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd"]),
#
'ReleaseDC': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hDC"]),
#
'BeginPaint': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hdc": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "fErase": SimTypeInt(signed=True, label="Int32"), "rcPaint": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "fRestore": SimTypeInt(signed=True, label="Int32"), "fIncUpdate": SimTypeInt(signed=True, label="Int32"), "rgbReserved": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32)}, name="PAINTSTRUCT", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "lpPaint"]),
#
'EndPaint': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hdc": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "fErase": SimTypeInt(signed=True, label="Int32"), "rcPaint": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "fRestore": SimTypeInt(signed=True, label="Int32"), "fIncUpdate": SimTypeInt(signed=True, label="Int32"), "rgbReserved": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32)}, name="PAINTSTRUCT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpPaint"]),
#
'GetUpdateRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpRect", "bErase"]),
#
'GetUpdateRgn': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hRgn", "bErase"]),
#
'SetWindowRgn': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hRgn", "bRedraw"]),
#
'GetWindowRgn': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hRgn"]),
#
'GetWindowRgnBox': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lprc"]),
#
'ExcludeUpdateRgn': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDC", "hWnd"]),
#
'InvalidateRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpRect", "bErase"]),
#
'ValidateRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpRect"]),
#
'InvalidateRgn': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hRgn", "bErase"]),
#
'ValidateRgn': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hRgn"]),
#
'RedrawWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="REDRAW_WINDOW_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lprcUpdate", "hrgnUpdate", "flags"]),
#
'LockWindowUpdate': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndLock"]),
#
'ClientToScreen': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpPoint"]),
#
'ScreenToClient': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpPoint"]),
#
'MapWindowPoints': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndFrom", "hWndTo", "lpPoints", "cPoints"]),
#
'GetSysColorBrush': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["nIndex"]),
#
'DrawFocusRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDC", "lprc"]),
#
'FillRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDC", "lprc", "hbr"]),
#
'FrameRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDC", "lprc", "hbr"]),
#
'InvertRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDC", "lprc"]),
#
'SetRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lprc", "xLeft", "yTop", "xRight", "yBottom"]),
#
'SetRectEmpty': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lprc"]),
#
'CopyRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lprcDst", "lprcSrc"]),
#
'InflateRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lprc", "dx", "dy"]),
#
'IntersectRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lprcDst", "lprcSrc1", "lprcSrc2"]),
#
'UnionRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lprcDst", "lprcSrc1", "lprcSrc2"]),
#
'SubtractRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lprcDst", "lprcSrc1", "lprcSrc2"]),
#
'OffsetRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lprc", "dx", "dy"]),
#
'IsRectEmpty': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lprc"]),
#
'EqualRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lprc1", "lprc2"]),
#
'PtInRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)], SimTypeInt(signed=True, label="Int32"), arg_names=["lprc", "pt"]),
#
'LoadBitmapA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpBitmapName"]),
#
'LoadBitmapW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpBitmapName"]),
#
'ChangeDisplaySettingsA': SimTypeFunction([SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEA", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="CDS_TYPE")], SimTypeInt(signed=False, label="DISP_CHANGE"), arg_names=["lpDevMode", "dwFlags"]),
#
'ChangeDisplaySettingsW': SimTypeFunction([SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEW", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="CDS_TYPE")], SimTypeInt(signed=False, label="DISP_CHANGE"), arg_names=["lpDevMode", "dwFlags"]),
#
'ChangeDisplaySettingsExA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEA", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="CDS_TYPE"), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypeInt(signed=False, label="DISP_CHANGE"), arg_names=["lpszDeviceName", "lpDevMode", "hwnd", "dwflags", "lParam"]),
#
'ChangeDisplaySettingsExW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEW", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="CDS_TYPE"), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypeInt(signed=False, label="DISP_CHANGE"), arg_names=["lpszDeviceName", "lpDevMode", "hwnd", "dwflags", "lParam"]),
#
'EnumDisplaySettingsA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="ENUM_DISPLAY_SETTINGS_MODE"), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpszDeviceName", "iModeNum", "lpDevMode"]),
#
'EnumDisplaySettingsW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="ENUM_DISPLAY_SETTINGS_MODE"), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpszDeviceName", "iModeNum", "lpDevMode"]),
#
'EnumDisplaySettingsExA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="ENUM_DISPLAY_SETTINGS_MODE"), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEA", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpszDeviceName", "iModeNum", "lpDevMode", "dwFlags"]),
#
'EnumDisplaySettingsExW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="ENUM_DISPLAY_SETTINGS_MODE"), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEW", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpszDeviceName", "iModeNum", "lpDevMode", "dwFlags"]),
#
'EnumDisplayDevicesA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"cb": SimTypeInt(signed=False, label="UInt32"), "DeviceName": SimTypeFixedSizeArray(SimTypeBottom(label="CHAR"), 32), "DeviceString": SimTypeFixedSizeArray(SimTypeBottom(label="CHAR"), 128), "StateFlags": SimTypeInt(signed=False, label="UInt32"), "DeviceID": SimTypeFixedSizeArray(SimTypeBottom(label="CHAR"), 128), "DeviceKey": SimTypeFixedSizeArray(SimTypeBottom(label="CHAR"), 128)}, name="DISPLAY_DEVICEA", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpDevice", "iDevNum", "lpDisplayDevice", "dwFlags"]),
#
'EnumDisplayDevicesW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"cb": SimTypeInt(signed=False, label="UInt32"), "DeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "DeviceString": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 128), "StateFlags": SimTypeInt(signed=False, label="UInt32"), "DeviceID": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 128), "DeviceKey": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 128)}, name="DISPLAY_DEVICEW", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpDevice", "iDevNum", "lpDisplayDevice", "dwFlags"]),
#
'MonitorFromPoint': SimTypeFunction([SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), SimTypeInt(signed=False, label="MONITOR_FROM_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["pt", "dwFlags"]),
#
'MonitorFromRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="MONITOR_FROM_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lprc", "dwFlags"]),
#
'MonitorFromWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="MONITOR_FROM_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hwnd", "dwFlags"]),
#
'GetMonitorInfoA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "rcMonitor": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rcWork": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "dwFlags": SimTypeInt(signed=False, label="UInt32")}, name="MONITORINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMonitor", "lpmi"]),
#
'GetMonitorInfoW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "rcMonitor": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rcWork": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "dwFlags": SimTypeInt(signed=False, label="UInt32")}, name="MONITORINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMonitor", "lpmi"]),
#
'EnumDisplayMonitors': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "lprcClip", "lpfnEnum", "dwData"]),
#
'SetUserObjectSecurity': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="OBJECT_SECURITY_INFORMATION"), offset=0), SimTypePointer(SimStruct({"Revision": SimTypeChar(label="Byte"), "Sbz1": SimTypeChar(label="Byte"), "Control": SimTypeShort(signed=False, label="UInt16"), "Owner": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "Group": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "Sacl": SimTypePointer(SimStruct({"AclRevision": SimTypeChar(label="Byte"), "Sbz1": SimTypeChar(label="Byte"), "AclSize": SimTypeShort(signed=False, label="UInt16"), "AceCount": SimTypeShort(signed=False, label="UInt16"), "Sbz2": SimTypeShort(signed=False, label="UInt16")}, name="ACL", pack=False, align=None), offset=0), "Dacl": SimTypePointer(SimStruct({"AclRevision": SimTypeChar(label="Byte"), "Sbz1": SimTypeChar(label="Byte"), "AclSize": SimTypeShort(signed=False, label="UInt16"), "AceCount": SimTypeShort(signed=False, label="UInt16"), "Sbz2": SimTypeShort(signed=False, label="UInt16")}, name="ACL", pack=False, align=None), offset=0)}, name="SECURITY_DESCRIPTOR", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hObj", "pSIRequested", "pSID"]),
#
'GetUserObjectSecurity': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"Revision": SimTypeChar(label="Byte"), "Sbz1": SimTypeChar(label="Byte"), "Control": SimTypeShort(signed=False, label="UInt16"), "Owner": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "Group": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "Sacl": SimTypePointer(SimStruct({"AclRevision": SimTypeChar(label="Byte"), "Sbz1": SimTypeChar(label="Byte"), "AclSize": SimTypeShort(signed=False, label="UInt16"), "AceCount": SimTypeShort(signed=False, label="UInt16"), "Sbz2": SimTypeShort(signed=False, label="UInt16")}, name="ACL", pack=False, align=None), offset=0), "Dacl": SimTypePointer(SimStruct({"AclRevision": SimTypeChar(label="Byte"), "Sbz1": SimTypeChar(label="Byte"), "AclSize": SimTypeShort(signed=False, label="UInt16"), "AceCount": SimTypeShort(signed=False, label="UInt16"), "Sbz2": SimTypeShort(signed=False, label="UInt16")}, name="ACL", pack=False, align=None), offset=0)}, name="SECURITY_DESCRIPTOR", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hObj", "pSIRequested", "pSID", "nLength", "lpnLengthNeeded"]),
#
'PrintWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="PRINT_WINDOW_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "hdcBlt", "nFlags"]),
#
'DdeSetQualityOfService': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"Length": SimTypeInt(signed=False, label="UInt32"), "ImpersonationLevel": SimTypeInt(signed=False, label="SECURITY_IMPERSONATION_LEVEL"), "ContextTrackingMode": SimTypeChar(label="Byte"), "EffectiveOnly": SimTypeChar(label="Byte")}, name="SECURITY_QUALITY_OF_SERVICE", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"Length": SimTypeInt(signed=False, label="UInt32"), "ImpersonationLevel": SimTypeInt(signed=False, label="SECURITY_IMPERSONATION_LEVEL"), "ContextTrackingMode": SimTypeChar(label="Byte"), "EffectiveOnly": SimTypeChar(label="Byte")}, name="SECURITY_QUALITY_OF_SERVICE", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwndClient", "pqosNew", "pqosPrev"]),
#
'ImpersonateDdeClientWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndClient", "hWndServer"]),
#
'PackDDElParam': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["msg", "uiLo", "uiHi"]),
#
'UnpackDDElParam': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), offset=0), SimTypePointer(SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["msg", "lParam", "puiLo", "puiHi"]),
#
'FreeDDElParam': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["msg", "lParam"]),
#
'ReuseDDElParam': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lParam", "msgIn", "msgOut", "uiLo", "uiHi"]),
#
'DdeInitializeA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["wType", "wFmt", "hConv", "hsz1", "hsz2", "hData", "dwData1", "dwData2"]), offset=0), SimTypeInt(signed=False, label="DDE_INITIALIZE_COMMAND"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["pidInst", "pfnCallback", "afCmd", "ulRes"]),
#
'DdeInitializeW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["wType", "wFmt", "hConv", "hsz1", "hsz2", "hData", "dwData1", "dwData2"]), offset=0), SimTypeInt(signed=False, label="DDE_INITIALIZE_COMMAND"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["pidInst", "pfnCallback", "afCmd", "ulRes"]),
#
'DdeUninitialize': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["idInst"]),
#
'DdeConnectList': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cb": SimTypeInt(signed=False, label="UInt32"), "wFlags": SimTypeInt(signed=False, label="UInt32"), "wCountryID": SimTypeInt(signed=False, label="UInt32"), "iCodePage": SimTypeInt(signed=True, label="Int32"), "dwLangID": SimTypeInt(signed=False, label="UInt32"), "dwSecurity": SimTypeInt(signed=False, label="UInt32"), "qos": SimStruct({"Length": SimTypeInt(signed=False, label="UInt32"), "ImpersonationLevel": SimTypeInt(signed=False, label="SECURITY_IMPERSONATION_LEVEL"), "ContextTrackingMode": SimTypeChar(label="Byte"), "EffectiveOnly": SimTypeChar(label="Byte")}, name="SECURITY_QUALITY_OF_SERVICE", pack=False, align=None)}, name="CONVCONTEXT", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["idInst", "hszService", "hszTopic", "hConvList", "pCC"]),
#
'DdeQueryNextServer': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hConvList", "hConvPrev"]),
#
'DdeDisconnectList': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hConvList"]),
#
'DdeConnect': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cb": SimTypeInt(signed=False, label="UInt32"), "wFlags": SimTypeInt(signed=False, label="UInt32"), "wCountryID": SimTypeInt(signed=False, label="UInt32"), "iCodePage": SimTypeInt(signed=True, label="Int32"), "dwLangID": SimTypeInt(signed=False, label="UInt32"), "dwSecurity": SimTypeInt(signed=False, label="UInt32"), "qos": SimStruct({"Length": SimTypeInt(signed=False, label="UInt32"), "ImpersonationLevel": SimTypeInt(signed=False, label="SECURITY_IMPERSONATION_LEVEL"), "ContextTrackingMode": SimTypeChar(label="Byte"), "EffectiveOnly": SimTypeChar(label="Byte")}, name="SECURITY_QUALITY_OF_SERVICE", pack=False, align=None)}, name="CONVCONTEXT", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["idInst", "hszService", "hszTopic", "pCC"]),
#
'DdeDisconnect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hConv"]),
#
'DdeReconnect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hConv"]),
#
'DdeQueryConvInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"cb": SimTypeInt(signed=False, label="UInt32"), "hUser": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "hConvPartner": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hszSvcPartner": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hszServiceReq": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hszTopic": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hszItem": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "wFmt": SimTypeInt(signed=False, label="UInt32"), "wType": SimTypeInt(signed=False, label="DDE_CLIENT_TRANSACTION_TYPE"), "wStatus": SimTypeInt(signed=False, label="CONVINFO_STATUS"), "wConvst": SimTypeInt(signed=False, label="CONVINFO_CONVERSATION_STATE"), "wLastError": SimTypeInt(signed=False, label="UInt32"), "hConvList": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ConvCtxt": SimStruct({"cb": SimTypeInt(signed=False, label="UInt32"), "wFlags": SimTypeInt(signed=False, label="UInt32"), "wCountryID": SimTypeInt(signed=False, label="UInt32"), "iCodePage": SimTypeInt(signed=True, label="Int32"), "dwLangID": SimTypeInt(signed=False, label="UInt32"), "dwSecurity": SimTypeInt(signed=False, label="UInt32"), "qos": SimStruct({"Length": SimTypeInt(signed=False, label="UInt32"), "ImpersonationLevel": SimTypeInt(signed=False, label="SECURITY_IMPERSONATION_LEVEL"), "ContextTrackingMode": SimTypeChar(label="Byte"), "EffectiveOnly": SimTypeChar(label="Byte")}, name="SECURITY_QUALITY_OF_SERVICE", pack=False, align=None)}, name="CONVCONTEXT", pack=False, align=None), "hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndPartner": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="CONVINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hConv", "idTransaction", "pConvInfo"]),
#
'DdeSetUserHandle': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hConv", "id", "hUser"]),
#
'DdeAbandonTransaction': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["idInst", "hConv", "idTransaction"]),
#
'DdePostAdvise': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["idInst", "hszTopic", "hszItem"]),
#
'DdeEnableCallback': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="DDE_ENABLE_CALLBACK_CMD")], SimTypeInt(signed=True, label="Int32"), arg_names=["idInst", "hConv", "wCmd"]),
#
'DdeImpersonateClient': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hConv"]),
#
'DdeNameService': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="DDE_NAME_SERVICE_CMD")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["idInst", "hsz1", "hsz2", "afCmd"]),
#
'DdeClientTransaction': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="DDE_CLIENT_TRANSACTION_TYPE"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["pData", "cbData", "hConv", "hszItem", "wFmt", "wType", "dwTimeout", "pdwResult"]),
#
'DdeCreateDataHandle': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["idInst", "pSrc", "cb", "cbOff", "hszItem", "wFmt", "afCmd"]),
#
'DdeAddData': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hData", "pSrc", "cb", "cbOff"]),
#
'DdeGetData': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hData", "pDst", "cbMax", "cbOff"]),
#
'DdeAccessData': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypePointer(SimTypeChar(label="Byte"), offset=0), arg_names=["hData", "pcbDataSize"]),
#
'DdeUnaccessData': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hData"]),
#
'DdeFreeDataHandle': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hData"]),
#
'DdeGetLastError': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["idInst"]),
#
'DdeCreateStringHandleA': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["idInst", "psz", "iCodePage"]),
#
'DdeCreateStringHandleW': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["idInst", "psz", "iCodePage"]),
#
'DdeQueryStringA': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["idInst", "hsz", "psz", "cchMax", "iCodePage"]),
#
'DdeQueryStringW': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["idInst", "hsz", "psz", "cchMax", "iCodePage"]),
#
'DdeFreeStringHandle': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["idInst", "hsz"]),
#
'DdeKeepStringHandle': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["idInst", "hsz"]),
#
'DdeCmpStringHandles': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hsz1", "hsz2"]),
#
'OpenClipboard': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndNewOwner"]),
#
'CloseClipboard': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'GetClipboardSequenceNumber': SimTypeFunction([], SimTypeInt(signed=False, label="UInt32")),
#
'GetClipboardOwner': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'SetClipboardViewer': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWndNewViewer"]),
#
'GetClipboardViewer': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'ChangeClipboardChain': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndRemove", "hWndNewNext"]),
#
'SetClipboardData': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["uFormat", "hMem"]),
#
'GetClipboardData': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["uFormat"]),
#
'RegisterClipboardFormatA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["lpszFormat"]),
#
'RegisterClipboardFormatW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["lpszFormat"]),
#
'CountClipboardFormats': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'EnumClipboardFormats': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["format"]),
#
'GetClipboardFormatNameA': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["format", "lpszFormatName", "cchMaxCount"]),
#
'GetClipboardFormatNameW': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["format", "lpszFormatName", "cchMaxCount"]),
#
'EmptyClipboard': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'IsClipboardFormatAvailable': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["format"]),
#
'GetPriorityClipboardFormat': SimTypeFunction([SimTypePointer(SimTypeInt(signed=False, label="UInt32"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["paFormatPriorityList", "cFormats"]),
#
'GetOpenClipboardWindow': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'AddClipboardFormatListener': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd"]),
#
'RemoveClipboardFormatListener': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd"]),
#
'GetUpdatedClipboardFormats': SimTypeFunction([SimTypePointer(SimTypeInt(signed=False, label="UInt32"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpuiFormats", "cFormats", "pcFormatsOut"]),
#
'MessageBeep': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["uType"]),
#
'SetLastErrorEx': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeBottom(label="Void"), arg_names=["dwErrCode", "dwType"]),
#
'UserHandleGrantAccess': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hUserHandle", "hJob", "bGrant"]),
#
'RegisterPowerSettingNotification': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeBottom(label="Guid"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hRecipient", "PowerSettingGuid", "Flags"]),
#
'UnregisterPowerSettingNotification': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["Handle"]),
#
'RegisterSuspendResumeNotification': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hRecipient", "Flags"]),
#
'UnregisterSuspendResumeNotification': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["Handle"]),
#
'ExitWindowsEx': SimTypeFunction([SimTypeInt(signed=False, label="EXIT_WINDOWS_FLAGS"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["uFlags", "dwReason"]),
#
'LockWorkStation': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'ShutdownBlockReasonCreate': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "pwszReason"]),
#
'ShutdownBlockReasonQuery': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "pwszBuff", "pcchBuff"]),
#
'ShutdownBlockReasonDestroy': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'CreateDesktopA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEA", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"nLength": SimTypeInt(signed=False, label="UInt32"), "lpSecurityDescriptor": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "bInheritHandle": SimTypeInt(signed=True, label="Int32")}, name="SECURITY_ATTRIBUTES", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpszDesktop", "lpszDevice", "pDevmode", "dwFlags", "dwDesiredAccess", "lpsa"]),
#
'CreateDesktopW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEW", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"nLength": SimTypeInt(signed=False, label="UInt32"), "lpSecurityDescriptor": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "bInheritHandle": SimTypeInt(signed=True, label="Int32")}, name="SECURITY_ATTRIBUTES", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpszDesktop", "lpszDevice", "pDevmode", "dwFlags", "dwDesiredAccess", "lpsa"]),
#
'CreateDesktopExA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEA", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"nLength": SimTypeInt(signed=False, label="UInt32"), "lpSecurityDescriptor": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "bInheritHandle": SimTypeInt(signed=True, label="Int32")}, name="SECURITY_ATTRIBUTES", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpszDesktop", "lpszDevice", "pDevmode", "dwFlags", "dwDesiredAccess", "lpsa", "ulHeapSize", "pvoid"]),
#
'CreateDesktopExW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"dmDeviceName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmSpecVersion": SimTypeShort(signed=False, label="UInt16"), "dmDriverVersion": SimTypeShort(signed=False, label="UInt16"), "dmSize": SimTypeShort(signed=False, label="UInt16"), "dmDriverExtra": SimTypeShort(signed=False, label="UInt16"), "dmFields": SimTypeInt(signed=False, label="UInt32"), "Anonymous1": SimUnion({"Anonymous1": SimStruct({"dmOrientation": SimTypeShort(signed=True, label="Int16"), "dmPaperSize": SimTypeShort(signed=True, label="Int16"), "dmPaperLength": SimTypeShort(signed=True, label="Int16"), "dmPaperWidth": SimTypeShort(signed=True, label="Int16"), "dmScale": SimTypeShort(signed=True, label="Int16"), "dmCopies": SimTypeShort(signed=True, label="Int16"), "dmDefaultSource": SimTypeShort(signed=True, label="Int16"), "dmPrintQuality": SimTypeShort(signed=True, label="Int16")}, name="_Anonymous1_e__Struct", pack=False, align=None), "Anonymous2": SimStruct({"dmPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "dmDisplayOrientation": SimTypeInt(signed=False, label="UInt32"), "dmDisplayFixedOutput": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous2_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "dmColor": SimTypeShort(signed=True, label="Int16"), "dmDuplex": SimTypeShort(signed=True, label="Int16"), "dmYResolution": SimTypeShort(signed=True, label="Int16"), "dmTTOption": SimTypeShort(signed=True, label="Int16"), "dmCollate": SimTypeShort(signed=True, label="Int16"), "dmFormName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 32), "dmLogPixels": SimTypeShort(signed=False, label="UInt16"), "dmBitsPerPel": SimTypeInt(signed=False, label="UInt32"), "dmPelsWidth": SimTypeInt(signed=False, label="UInt32"), "dmPelsHeight": SimTypeInt(signed=False, label="UInt32"), "Anonymous2": SimUnion({"dmDisplayFlags": SimTypeInt(signed=False, label="UInt32"), "dmNup": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "dmDisplayFrequency": SimTypeInt(signed=False, label="UInt32"), "dmICMMethod": SimTypeInt(signed=False, label="UInt32"), "dmICMIntent": SimTypeInt(signed=False, label="UInt32"), "dmMediaType": SimTypeInt(signed=False, label="UInt32"), "dmDitherType": SimTypeInt(signed=False, label="UInt32"), "dmReserved1": SimTypeInt(signed=False, label="UInt32"), "dmReserved2": SimTypeInt(signed=False, label="UInt32"), "dmPanningWidth": SimTypeInt(signed=False, label="UInt32"), "dmPanningHeight": SimTypeInt(signed=False, label="UInt32")}, name="DEVMODEW", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"nLength": SimTypeInt(signed=False, label="UInt32"), "lpSecurityDescriptor": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "bInheritHandle": SimTypeInt(signed=True, label="Int32")}, name="SECURITY_ATTRIBUTES", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpszDesktop", "lpszDevice", "pDevmode", "dwFlags", "dwDesiredAccess", "lpsa", "ulHeapSize", "pvoid"]),
#
'OpenDesktopA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpszDesktop", "dwFlags", "fInherit", "dwDesiredAccess"]),
#
'OpenDesktopW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpszDesktop", "dwFlags", "fInherit", "dwDesiredAccess"]),
#
'OpenInputDesktop': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["dwFlags", "fInherit", "dwDesiredAccess"]),
#
'EnumDesktopsA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwinsta", "lpEnumFunc", "lParam"]),
#
'EnumDesktopsW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwinsta", "lpEnumFunc", "lParam"]),
#
'EnumDesktopWindows': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDesktop", "lpfn", "lParam"]),
#
'SwitchDesktop': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDesktop"]),
#
'SetThreadDesktop': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDesktop"]),
#
'CloseDesktop': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDesktop"]),
#
'GetThreadDesktop': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["dwThreadId"]),
#
'CreateWindowStationA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"nLength": SimTypeInt(signed=False, label="UInt32"), "lpSecurityDescriptor": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "bInheritHandle": SimTypeInt(signed=True, label="Int32")}, name="SECURITY_ATTRIBUTES", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpwinsta", "dwFlags", "dwDesiredAccess", "lpsa"]),
#
'CreateWindowStationW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"nLength": SimTypeInt(signed=False, label="UInt32"), "lpSecurityDescriptor": SimTypePointer(SimTypeBottom(label="Void"), offset=0), "bInheritHandle": SimTypeInt(signed=True, label="Int32")}, name="SECURITY_ATTRIBUTES", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpwinsta", "dwFlags", "dwDesiredAccess", "lpsa"]),
#
'OpenWindowStationA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpszWinSta", "fInherit", "dwDesiredAccess"]),
#
'OpenWindowStationW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpszWinSta", "fInherit", "dwDesiredAccess"]),
#
'EnumWindowStationsA': SimTypeFunction([SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpEnumFunc", "lParam"]),
#
'EnumWindowStationsW': SimTypeFunction([SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpEnumFunc", "lParam"]),
#
'CloseWindowStation': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWinSta"]),
#
'SetProcessWindowStation': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWinSta"]),
#
'GetProcessWindowStation': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'GetUserObjectInformationA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="USER_OBJECT_INFORMATION_INDEX"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hObj", "nIndex", "pvInfo", "nLength", "lpnLengthNeeded"]),
#
'GetUserObjectInformationW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="USER_OBJECT_INFORMATION_INDEX"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hObj", "nIndex", "pvInfo", "nLength", "lpnLengthNeeded"]),
#
'SetUserObjectInformationA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hObj", "nIndex", "pvInfo", "nLength"]),
#
'SetUserObjectInformationW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hObj", "nIndex", "pvInfo", "nLength"]),
#
'RegisterDeviceNotificationA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="POWER_SETTING_REGISTER_NOTIFICATION_FLAGS")], SimTypePointer(SimTypeBottom(label="Void"), offset=0), arg_names=["hRecipient", "NotificationFilter", "Flags"]),
#
'RegisterDeviceNotificationW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="POWER_SETTING_REGISTER_NOTIFICATION_FLAGS")], SimTypePointer(SimTypeBottom(label="Void"), offset=0), arg_names=["hRecipient", "NotificationFilter", "Flags"]),
#
'UnregisterDeviceNotification': SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["Handle"]),
#
'AttachThreadInput': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["idAttach", "idAttachTo", "fAttach"]),
#
'WaitForInputIdle': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hProcess", "dwMilliseconds"]),
#
'MsgWaitForMultipleObjects': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="QUEUE_STATUS_FLAGS")], SimTypeInt(signed=False, label="UInt32"), arg_names=["nCount", "pHandles", "fWaitAll", "dwMilliseconds", "dwWakeMask"]),
#
'MsgWaitForMultipleObjectsEx': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="QUEUE_STATUS_FLAGS"), SimTypeInt(signed=False, label="MSG_WAIT_FOR_MULTIPLE_OBJECTS_EX_FLAGS")], SimTypeInt(signed=False, label="UInt32"), arg_names=["nCount", "pHandles", "dwMilliseconds", "dwWakeMask", "dwFlags"]),
#
'GetGuiResources': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_GUI_RESOURCES_FLAGS")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hProcess", "uiFlags"]),
#
'IsImmersiveProcess': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hProcess"]),
#
'SetProcessRestrictionExemption': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["fEnableExemption"]),
#
'SendIMEMessageExA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1"]),
#
'SendIMEMessageExW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1"]),
#
'IMPGetIMEA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hWnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "InstDate": SimStruct({"year": SimTypeShort(signed=False, label="UInt16"), "month": SimTypeShort(signed=False, label="UInt16"), "day": SimTypeShort(signed=False, label="UInt16"), "hour": SimTypeShort(signed=False, label="UInt16"), "min": SimTypeShort(signed=False, label="UInt16"), "sec": SimTypeShort(signed=False, label="UInt16")}, name="DATETIME", pack=False, align=None), "wVersion": SimTypeInt(signed=False, label="UInt32"), "szDescription": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 50), "szName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 80), "szOptions": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 30)}, name="IMEPROA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'IMPGetIMEW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hWnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "InstDate": SimStruct({"year": SimTypeShort(signed=False, label="UInt16"), "month": SimTypeShort(signed=False, label="UInt16"), "day": SimTypeShort(signed=False, label="UInt16"), "hour": SimTypeShort(signed=False, label="UInt16"), "min": SimTypeShort(signed=False, label="UInt16"), "sec": SimTypeShort(signed=False, label="UInt16")}, name="DATETIME", pack=False, align=None), "wVersion": SimTypeInt(signed=False, label="UInt32"), "szDescription": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 50), "szName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 80), "szOptions": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 30)}, name="IMEPROW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'IMPQueryIMEA': SimTypeFunction([SimTypePointer(SimStruct({"hWnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "InstDate": SimStruct({"year": SimTypeShort(signed=False, label="UInt16"), "month": SimTypeShort(signed=False, label="UInt16"), "day": SimTypeShort(signed=False, label="UInt16"), "hour": SimTypeShort(signed=False, label="UInt16"), "min": SimTypeShort(signed=False, label="UInt16"), "sec": SimTypeShort(signed=False, label="UInt16")}, name="DATETIME", pack=False, align=None), "wVersion": SimTypeInt(signed=False, label="UInt32"), "szDescription": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 50), "szName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 80), "szOptions": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 30)}, name="IMEPROA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0"]),
#
'IMPQueryIMEW': SimTypeFunction([SimTypePointer(SimStruct({"hWnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "InstDate": SimStruct({"year": SimTypeShort(signed=False, label="UInt16"), "month": SimTypeShort(signed=False, label="UInt16"), "day": SimTypeShort(signed=False, label="UInt16"), "hour": SimTypeShort(signed=False, label="UInt16"), "min": SimTypeShort(signed=False, label="UInt16"), "sec": SimTypeShort(signed=False, label="UInt16")}, name="DATETIME", pack=False, align=None), "wVersion": SimTypeInt(signed=False, label="UInt32"), "szDescription": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 50), "szName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 80), "szOptions": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 30)}, name="IMEPROW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0"]),
#
'IMPSetIMEA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hWnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "InstDate": SimStruct({"year": SimTypeShort(signed=False, label="UInt16"), "month": SimTypeShort(signed=False, label="UInt16"), "day": SimTypeShort(signed=False, label="UInt16"), "hour": SimTypeShort(signed=False, label="UInt16"), "min": SimTypeShort(signed=False, label="UInt16"), "sec": SimTypeShort(signed=False, label="UInt16")}, name="DATETIME", pack=False, align=None), "wVersion": SimTypeInt(signed=False, label="UInt32"), "szDescription": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 50), "szName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 80), "szOptions": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 30)}, name="IMEPROA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'IMPSetIMEW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hWnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "InstDate": SimStruct({"year": SimTypeShort(signed=False, label="UInt16"), "month": SimTypeShort(signed=False, label="UInt16"), "day": SimTypeShort(signed=False, label="UInt16"), "hour": SimTypeShort(signed=False, label="UInt16"), "min": SimTypeShort(signed=False, label="UInt16"), "sec": SimTypeShort(signed=False, label="UInt16")}, name="DATETIME", pack=False, align=None), "wVersion": SimTypeInt(signed=False, label="UInt32"), "szDescription": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 50), "szName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 80), "szOptions": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 30)}, name="IMEPROW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'WINNLSGetIMEHotkey': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["param0"]),
#
'WINNLSEnableIME': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'WINNLSGetEnableStatus': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0"]),
#
'RegisterPointerInputTarget': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="POINTER_INPUT_TYPE")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "pointerType"]),
#
'UnregisterPointerInputTarget': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="POINTER_INPUT_TYPE")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "pointerType"]),
#
'RegisterPointerInputTargetEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="POINTER_INPUT_TYPE"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "pointerType", "fObserve"]),
#
'UnregisterPointerInputTargetEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="POINTER_INPUT_TYPE")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "pointerType"]),
#
'NotifyWinEvent': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeBottom(label="Void"), arg_names=["event", "hwnd", "idObject", "idChild"]),
#
'SetWinEventHook': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeBottom(label="Void"), arg_names=["hWinEventHook", "event", "hwnd", "idObject", "idChild", "idEventThread", "dwmsEventTime"]), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["eventMin", "eventMax", "hmodWinEventProc", "pfnWinEventProc", "idProcess", "idThread", "dwFlags"]),
#
'IsWinEventHookInstalled': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["event"]),
#
'UnhookWinEvent': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWinEventHook"]),
#
'CheckDlgButton': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="DLG_BUTTON_CHECK_STATE")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "nIDButton", "uCheck"]),
#
'CheckRadioButton': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "nIDFirstButton", "nIDLastButton", "nIDCheckButton"]),
#
'IsDlgButtonChecked': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hDlg", "nIDButton"]),
#
'IsCharLowerW': SimTypeFunction([SimTypeChar(label="Char")], SimTypeInt(signed=True, label="Int32"), arg_names=["ch"]),
#
'InitializeTouchInjection': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="TOUCH_FEEDBACK_MODE")], SimTypeInt(signed=True, label="Int32"), arg_names=["maxCount", "dwMode"]),
#
'InjectTouchInput': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"pointerInfo": SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), "touchFlags": SimTypeInt(signed=False, label="UInt32"), "touchMask": SimTypeInt(signed=False, label="UInt32"), "rcContact": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rcContactRaw": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "orientation": SimTypeInt(signed=False, label="UInt32"), "pressure": SimTypeInt(signed=False, label="UInt32")}, name="POINTER_TOUCH_INFO", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["count", "contacts"]),
#
'CreateSyntheticPointerDevice': SimTypeFunction([SimTypeInt(signed=False, label="POINTER_INPUT_TYPE"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="POINTER_FEEDBACK_MODE")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["pointerType", "maxCount", "mode"]),
#
'InjectSyntheticPointerInput': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"type": SimTypeBottom(label="POINTER_INPUT_TYPE"), "Anonymous": SimUnion({"touchInfo": SimTypeBottom(label="POINTER_TOUCH_INFO"), "penInfo": SimTypeBottom(label="POINTER_PEN_INFO")}, name="<anon>", label="None")}, name="POINTER_TYPE_INFO", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["device", "pointerInfo", "count"]),
#
'DestroySyntheticPointerDevice': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeBottom(label="Void"), arg_names=["device"]),
#
'RegisterTouchHitTestingWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "value"]),
#
'EvaluateProximityToRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"pointerId": SimTypeInt(signed=False, label="UInt32"), "point": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "boundingBox": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "nonOccludedBoundingBox": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "orientation": SimTypeInt(signed=False, label="UInt32")}, name="TOUCH_HIT_TESTING_INPUT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"score": SimTypeShort(signed=False, label="UInt16"), "adjustedPoint": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="TOUCH_HIT_TESTING_PROXIMITY_EVALUATION", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["controlBoundingBox", "pHitTestingInput", "pProximityEval"]),
#
'EvaluateProximityToPolygon': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), label="LPArray", offset=0), SimTypePointer(SimStruct({"pointerId": SimTypeInt(signed=False, label="UInt32"), "point": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "boundingBox": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "nonOccludedBoundingBox": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "orientation": SimTypeInt(signed=False, label="UInt32")}, name="TOUCH_HIT_TESTING_INPUT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"score": SimTypeShort(signed=False, label="UInt16"), "adjustedPoint": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="TOUCH_HIT_TESTING_PROXIMITY_EVALUATION", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["numVertices", "controlPolygon", "pHitTestingInput", "pProximityEval"]),
#
'PackTouchHitTestingProximityEvaluation': SimTypeFunction([SimTypePointer(SimStruct({"pointerId": SimTypeInt(signed=False, label="UInt32"), "point": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "boundingBox": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "nonOccludedBoundingBox": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "orientation": SimTypeInt(signed=False, label="UInt32")}, name="TOUCH_HIT_TESTING_INPUT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"score": SimTypeShort(signed=False, label="UInt16"), "adjustedPoint": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="TOUCH_HIT_TESTING_PROXIMITY_EVALUATION", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["pHitTestingInput", "pProximityEval"]),
#
'GetWindowFeedbackSetting': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="FEEDBACK_TYPE"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "feedback", "dwFlags", "pSize", "config"]),
#
'SetWindowFeedbackSetting': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="FEEDBACK_TYPE"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "feedback", "dwFlags", "size", "configuration"]),
#
'ScrollWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "XAmount", "YAmount", "lpRect", "lpClipRect"]),
#
'ScrollDC': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDC", "dx", "dy", "lprcScroll", "lprcClip", "hrgnUpdate", "lprcUpdate"]),
#
'ScrollWindowEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="SHOW_WINDOW_CMD")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "dx", "dy", "prcScroll", "prcClip", "hrgnUpdate", "prcUpdate", "flags"]),
#
'SetScrollPos': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SCROLLBAR_CONSTANTS"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nBar", "nPos", "bRedraw"]),
#
'GetScrollPos': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SCROLLBAR_CONSTANTS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nBar"]),
#
'SetScrollRange': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SCROLLBAR_CONSTANTS"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nBar", "nMinPos", "nMaxPos", "bRedraw"]),
#
'GetScrollRange': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SCROLLBAR_CONSTANTS"), SimTypePointer(SimTypeInt(signed=True, label="Int32"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nBar", "lpMinPos", "lpMaxPos"]),
#
'ShowScrollBar': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SCROLLBAR_CONSTANTS"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "wBar", "bShow"]),
#
'EnableScrollBar': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SCROLLBAR_CONSTANTS"), SimTypeInt(signed=False, label="ENABLE_SCROLL_BAR_ARROWS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "wSBflags", "wArrows"]),
#
'DlgDirListA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="DLG_DIR_LIST_FILE_TYPE")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "lpPathSpec", "nIDListBox", "nIDStaticPath", "uFileType"]),
#
'DlgDirListW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="DLG_DIR_LIST_FILE_TYPE")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "lpPathSpec", "nIDListBox", "nIDStaticPath", "uFileType"]),
#
'DlgDirSelectExA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwndDlg", "lpString", "chCount", "idListBox"]),
#
'DlgDirSelectExW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwndDlg", "lpString", "chCount", "idListBox"]),
#
'DlgDirListComboBoxA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="DLG_DIR_LIST_FILE_TYPE")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "lpPathSpec", "nIDComboBox", "nIDStaticPath", "uFiletype"]),
#
'DlgDirListComboBoxW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="DLG_DIR_LIST_FILE_TYPE")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "lpPathSpec", "nIDComboBox", "nIDStaticPath", "uFiletype"]),
#
'DlgDirSelectComboBoxExA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwndDlg", "lpString", "cchOut", "idComboBox"]),
#
'DlgDirSelectComboBoxExW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwndDlg", "lpString", "cchOut", "idComboBox"]),
#
'SetScrollInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SCROLLBAR_CONSTANTS"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="SCROLLINFO_MASK"), "nMin": SimTypeInt(signed=True, label="Int32"), "nMax": SimTypeInt(signed=True, label="Int32"), "nPage": SimTypeInt(signed=False, label="UInt32"), "nPos": SimTypeInt(signed=True, label="Int32"), "nTrackPos": SimTypeInt(signed=True, label="Int32")}, name="SCROLLINFO", pack=False, align=None), offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "nBar", "lpsi", "redraw"]),
#
'GetScrollInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SCROLLBAR_CONSTANTS"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="SCROLLINFO_MASK"), "nMin": SimTypeInt(signed=True, label="Int32"), "nMax": SimTypeInt(signed=True, label="Int32"), "nPage": SimTypeInt(signed=False, label="UInt32"), "nPos": SimTypeInt(signed=True, label="Int32"), "nTrackPos": SimTypeInt(signed=True, label="Int32")}, name="SCROLLINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "nBar", "lpsi"]),
#
'GetScrollBarInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="OBJECT_IDENTIFIER"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "rcScrollBar": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "dxyLineButton": SimTypeInt(signed=True, label="Int32"), "xyThumbTop": SimTypeInt(signed=True, label="Int32"), "xyThumbBottom": SimTypeInt(signed=True, label="Int32"), "reserved": SimTypeInt(signed=True, label="Int32"), "rgstate": SimTypeFixedSizeArray(SimTypeInt(signed=False, label="UInt32"), 6)}, name="SCROLLBARINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "idObject", "psbi"]),
#
'GetComboBoxInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "rcItem": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rcButton": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "stateButton": SimTypeInt(signed=False, label="COMBOBOXINFO_BUTTON_STATE"), "hwndCombo": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndItem": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndList": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="COMBOBOXINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwndCombo", "pcbi"]),
#
'GetListBoxInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hwnd"]),
#
'GetPointerDevices': SimTypeFunction([SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"displayOrientation": SimTypeInt(signed=False, label="UInt32"), "device": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "pointerDeviceType": SimTypeInt(signed=False, label="POINTER_DEVICE_TYPE"), "monitor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "startingCursorId": SimTypeInt(signed=False, label="UInt32"), "maxActiveContacts": SimTypeShort(signed=False, label="UInt16"), "productString": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 520)}, name="POINTER_DEVICE_INFO", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["deviceCount", "pointerDevices"]),
#
'GetPointerDevice': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"displayOrientation": SimTypeInt(signed=False, label="UInt32"), "device": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "pointerDeviceType": SimTypeInt(signed=False, label="POINTER_DEVICE_TYPE"), "monitor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "startingCursorId": SimTypeInt(signed=False, label="UInt32"), "maxActiveContacts": SimTypeShort(signed=False, label="UInt16"), "productString": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 520)}, name="POINTER_DEVICE_INFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["device", "pointerDevice"]),
#
'GetPointerDeviceProperties': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"logicalMin": SimTypeInt(signed=True, label="Int32"), "logicalMax": SimTypeInt(signed=True, label="Int32"), "physicalMin": SimTypeInt(signed=True, label="Int32"), "physicalMax": SimTypeInt(signed=True, label="Int32"), "unit": SimTypeInt(signed=False, label="UInt32"), "unitExponent": SimTypeInt(signed=False, label="UInt32"), "usagePageId": SimTypeShort(signed=False, label="UInt16"), "usageId": SimTypeShort(signed=False, label="UInt16")}, name="POINTER_DEVICE_PROPERTY", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["device", "propertyCount", "pointerProperties"]),
#
'RegisterPointerDeviceNotifications': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["window", "notifyRange"]),
#
'GetPointerDeviceRects': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["device", "pointerDeviceRect", "displayRect"]),
#
'GetPointerDeviceCursors': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"cursorId": SimTypeInt(signed=False, label="UInt32"), "cursor": SimTypeInt(signed=False, label="POINTER_DEVICE_CURSOR_TYPE")}, name="POINTER_DEVICE_CURSOR_INFO", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["device", "cursorCount", "deviceCursors"]),
#
'GetRawPointerDeviceData': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"logicalMin": SimTypeInt(signed=True, label="Int32"), "logicalMax": SimTypeInt(signed=True, label="Int32"), "physicalMin": SimTypeInt(signed=True, label="Int32"), "physicalMax": SimTypeInt(signed=True, label="Int32"), "unit": SimTypeInt(signed=False, label="UInt32"), "unitExponent": SimTypeInt(signed=False, label="UInt32"), "usagePageId": SimTypeShort(signed=False, label="UInt16"), "usageId": SimTypeShort(signed=False, label="UInt16")}, name="POINTER_DEVICE_PROPERTY", pack=False, align=None), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "historyCount", "propertiesCount", "pProperties", "pValues"]),
#
'GetCurrentInputMessageSource': SimTypeFunction([SimTypePointer(SimStruct({"deviceType": SimTypeInt(signed=False, label="INPUT_MESSAGE_DEVICE_TYPE"), "originId": SimTypeInt(signed=False, label="INPUT_MESSAGE_ORIGIN_ID")}, name="INPUT_MESSAGE_SOURCE", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["inputMessageSource"]),
#
'GetCIMSSM': SimTypeFunction([SimTypePointer(SimStruct({"deviceType": SimTypeInt(signed=False, label="INPUT_MESSAGE_DEVICE_TYPE"), "originId": SimTypeInt(signed=False, label="INPUT_MESSAGE_ORIGIN_ID")}, name="INPUT_MESSAGE_SOURCE", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["inputMessageSource"]),
#
'GetDisplayConfigBufferSizes': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["flags", "numPathArrayElements", "numModeInfoArrayElements"]),
#
'SetDisplayConfig': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"sourceInfo": SimStruct({"adapterId": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None), "id": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimUnion({"modeInfoIdx": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimStruct({"_bitfield": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "statusFlags": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_PATH_SOURCE_INFO", pack=False, align=None), "targetInfo": SimStruct({"adapterId": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None), "id": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimUnion({"modeInfoIdx": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimStruct({"_bitfield": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "outputTechnology": SimTypeInt(signed=False, label="DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY"), "rotation": SimTypeInt(signed=False, label="DISPLAYCONFIG_ROTATION"), "scaling": SimTypeInt(signed=False, label="DISPLAYCONFIG_SCALING"), "refreshRate": SimStruct({"Numerator": SimTypeInt(signed=False, label="UInt32"), "Denominator": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_RATIONAL", pack=False, align=None), "scanLineOrdering": SimTypeInt(signed=False, label="DISPLAYCONFIG_SCANLINE_ORDERING"), "targetAvailable": SimTypeInt(signed=True, label="Int32"), "statusFlags": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_PATH_TARGET_INFO", pack=False, align=None), "flags": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_PATH_INFO", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"infoType": SimTypeInt(signed=False, label="DISPLAYCONFIG_MODE_INFO_TYPE"), "id": SimTypeInt(signed=False, label="UInt32"), "adapterId": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None), "Anonymous": SimUnion({"targetMode": SimStruct({"targetVideoSignalInfo": SimStruct({"pixelRate": SimTypeLongLong(signed=False, label="UInt64"), "hSyncFreq": SimStruct({"Numerator": SimTypeInt(signed=False, label="UInt32"), "Denominator": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_RATIONAL", pack=False, align=None), "vSyncFreq": SimStruct({"Numerator": SimTypeInt(signed=False, label="UInt32"), "Denominator": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_RATIONAL", pack=False, align=None), "activeSize": SimStruct({"cx": SimTypeInt(signed=False, label="UInt32"), "cy": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_2DREGION", pack=False, align=None), "totalSize": SimStruct({"cx": SimTypeInt(signed=False, label="UInt32"), "cy": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_2DREGION", pack=False, align=None), "Anonymous": SimUnion({"AdditionalSignalInfo": SimStruct({"_bitfield": SimTypeInt(signed=False, label="UInt32")}, name="_AdditionalSignalInfo_e__Struct", pack=False, align=None), "videoStandard": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "scanLineOrdering": SimTypeInt(signed=False, label="DISPLAYCONFIG_SCANLINE_ORDERING")}, name="DISPLAYCONFIG_VIDEO_SIGNAL_INFO", pack=False, align=None)}, name="DISPLAYCONFIG_TARGET_MODE", pack=False, align=None), "sourceMode": SimStruct({"width": SimTypeInt(signed=False, label="UInt32"), "height": SimTypeInt(signed=False, label="UInt32"), "pixelFormat": SimTypeInt(signed=False, label="DISPLAYCONFIG_PIXELFORMAT"), "position": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None)}, name="DISPLAYCONFIG_SOURCE_MODE", pack=False, align=None), "desktopImageInfo": SimStruct({"PathSourceSize": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "DesktopImageRegion": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECTL", pack=False, align=None), "DesktopImageClip": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECTL", pack=False, align=None)}, name="DISPLAYCONFIG_DESKTOP_IMAGE_INFO", pack=False, align=None)}, name="<anon>", label="None")}, name="DISPLAYCONFIG_MODE_INFO", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["numPathArrayElements", "pathArray", "numModeInfoArrayElements", "modeInfoArray", "flags"]),
#
'QueryDisplayConfig': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"sourceInfo": SimStruct({"adapterId": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None), "id": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimUnion({"modeInfoIdx": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimStruct({"_bitfield": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "statusFlags": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_PATH_SOURCE_INFO", pack=False, align=None), "targetInfo": SimStruct({"adapterId": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None), "id": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimUnion({"modeInfoIdx": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimStruct({"_bitfield": SimTypeInt(signed=False, label="UInt32")}, name="_Anonymous_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "outputTechnology": SimTypeInt(signed=False, label="DISPLAYCONFIG_VIDEO_OUTPUT_TECHNOLOGY"), "rotation": SimTypeInt(signed=False, label="DISPLAYCONFIG_ROTATION"), "scaling": SimTypeInt(signed=False, label="DISPLAYCONFIG_SCALING"), "refreshRate": SimStruct({"Numerator": SimTypeInt(signed=False, label="UInt32"), "Denominator": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_RATIONAL", pack=False, align=None), "scanLineOrdering": SimTypeInt(signed=False, label="DISPLAYCONFIG_SCANLINE_ORDERING"), "targetAvailable": SimTypeInt(signed=True, label="Int32"), "statusFlags": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_PATH_TARGET_INFO", pack=False, align=None), "flags": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_PATH_INFO", pack=False, align=None), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"infoType": SimTypeInt(signed=False, label="DISPLAYCONFIG_MODE_INFO_TYPE"), "id": SimTypeInt(signed=False, label="UInt32"), "adapterId": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None), "Anonymous": SimUnion({"targetMode": SimStruct({"targetVideoSignalInfo": SimStruct({"pixelRate": SimTypeLongLong(signed=False, label="UInt64"), "hSyncFreq": SimStruct({"Numerator": SimTypeInt(signed=False, label="UInt32"), "Denominator": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_RATIONAL", pack=False, align=None), "vSyncFreq": SimStruct({"Numerator": SimTypeInt(signed=False, label="UInt32"), "Denominator": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_RATIONAL", pack=False, align=None), "activeSize": SimStruct({"cx": SimTypeInt(signed=False, label="UInt32"), "cy": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_2DREGION", pack=False, align=None), "totalSize": SimStruct({"cx": SimTypeInt(signed=False, label="UInt32"), "cy": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_2DREGION", pack=False, align=None), "Anonymous": SimUnion({"AdditionalSignalInfo": SimStruct({"_bitfield": SimTypeInt(signed=False, label="UInt32")}, name="_AdditionalSignalInfo_e__Struct", pack=False, align=None), "videoStandard": SimTypeInt(signed=False, label="UInt32")}, name="<anon>", label="None"), "scanLineOrdering": SimTypeInt(signed=False, label="DISPLAYCONFIG_SCANLINE_ORDERING")}, name="DISPLAYCONFIG_VIDEO_SIGNAL_INFO", pack=False, align=None)}, name="DISPLAYCONFIG_TARGET_MODE", pack=False, align=None), "sourceMode": SimStruct({"width": SimTypeInt(signed=False, label="UInt32"), "height": SimTypeInt(signed=False, label="UInt32"), "pixelFormat": SimTypeInt(signed=False, label="DISPLAYCONFIG_PIXELFORMAT"), "position": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None)}, name="DISPLAYCONFIG_SOURCE_MODE", pack=False, align=None), "desktopImageInfo": SimStruct({"PathSourceSize": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINTL", pack=False, align=None), "DesktopImageRegion": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECTL", pack=False, align=None), "DesktopImageClip": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECTL", pack=False, align=None)}, name="DISPLAYCONFIG_DESKTOP_IMAGE_INFO", pack=False, align=None)}, name="<anon>", label="None")}, name="DISPLAYCONFIG_MODE_INFO", pack=False, align=None), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="DISPLAYCONFIG_TOPOLOGY_ID"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["flags", "numPathArrayElements", "pathArray", "numModeInfoArrayElements", "modeInfoArray", "currentTopologyId"]),
#
'DisplayConfigGetDeviceInfo': SimTypeFunction([SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="DISPLAYCONFIG_DEVICE_INFO_TYPE"), "size": SimTypeInt(signed=False, label="UInt32"), "adapterId": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None), "id": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_DEVICE_INFO_HEADER", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["requestPacket"]),
#
'DisplayConfigSetDeviceInfo': SimTypeFunction([SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="DISPLAYCONFIG_DEVICE_INFO_TYPE"), "size": SimTypeInt(signed=False, label="UInt32"), "adapterId": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None), "id": SimTypeInt(signed=False, label="UInt32")}, name="DISPLAYCONFIG_DEVICE_INFO_HEADER", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["setPacket"]),
#
'SetDialogControlDpiChangeBehavior': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS"), SimTypeInt(signed=False, label="DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "mask", "values"]),
#
'GetDialogControlDpiChangeBehavior': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="DIALOG_CONTROL_DPI_CHANGE_BEHAVIORS"), arg_names=["hWnd"]),
#
'SetDialogDpiChangeBehavior': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="DIALOG_DPI_CHANGE_BEHAVIORS"), SimTypeInt(signed=False, label="DIALOG_DPI_CHANGE_BEHAVIORS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "mask", "values"]),
#
'GetDialogDpiChangeBehavior': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="DIALOG_DPI_CHANGE_BEHAVIORS"), arg_names=["hDlg"]),
#
'GetSystemMetricsForDpi': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["nIndex", "dpi"]),
#
'AdjustWindowRectExForDpi': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpRect", "dwStyle", "bMenu", "dwExStyle", "dpi"]),
#
'LogicalToPhysicalPointForPerMonitorDPI': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpPoint"]),
#
'PhysicalToLogicalPointForPerMonitorDPI': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpPoint"]),
#
'SystemParametersInfoForDpi': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["uiAction", "uiParam", "pvParam", "fWinIni", "dpi"]),
#
'SetThreadDpiAwarenessContext': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["dpiContext"]),
#
'GetThreadDpiAwarenessContext': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'GetWindowDpiAwarenessContext': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hwnd"]),
#
'GetAwarenessFromDpiAwarenessContext': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="DPI_AWARENESS"), arg_names=["value"]),
#
'GetDpiFromDpiAwarenessContext': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["value"]),
#
'AreDpiAwarenessContextsEqual': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["dpiContextA", "dpiContextB"]),
#
'IsValidDpiAwarenessContext': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["value"]),
#
'GetDpiForWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hwnd"]),
#
'GetDpiForSystem': SimTypeFunction([], SimTypeInt(signed=False, label="UInt32")),
#
'GetSystemDpiForProcess': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hProcess"]),
#
'EnableNonClientDpiScaling': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd"]),
#
'SetProcessDpiAwarenessContext': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["value"]),
#
'SetThreadDpiHostingBehavior': SimTypeFunction([SimTypeInt(signed=False, label="DPI_HOSTING_BEHAVIOR")], SimTypeInt(signed=False, label="DPI_HOSTING_BEHAVIOR"), arg_names=["value"]),
#
'GetThreadDpiHostingBehavior': SimTypeFunction([], SimTypeInt(signed=False, label="DPI_HOSTING_BEHAVIOR")),
#
'GetWindowDpiHostingBehavior': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="DPI_HOSTING_BEHAVIOR"), arg_names=["hwnd"]),
#
'LoadKeyboardLayoutA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="ACTIVATE_KEYBOARD_LAYOUT_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["pwszKLID", "Flags"]),
#
'LoadKeyboardLayoutW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="ACTIVATE_KEYBOARD_LAYOUT_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["pwszKLID", "Flags"]),
#
'ActivateKeyboardLayout': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="ACTIVATE_KEYBOARD_LAYOUT_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hkl", "Flags"]),
#
'ToUnicodeEx': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["wVirtKey", "wScanCode", "lpKeyState", "pwszBuff", "cchBuff", "wFlags", "dwhkl"]),
#
'UnloadKeyboardLayout': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hkl"]),
#
'GetKeyboardLayoutNameA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pwszKLID"]),
#
'GetKeyboardLayoutNameW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pwszKLID"]),
#
'GetKeyboardLayoutList': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["nBuff", "lpList"]),
#
'GetKeyboardLayout': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["idThread"]),
#
'GetMouseMovePointsEx': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32"), "time": SimTypeInt(signed=False, label="UInt32"), "dwExtraInfo": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)}, name="MOUSEMOVEPOINT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32"), "time": SimTypeInt(signed=False, label="UInt32"), "dwExtraInfo": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)}, name="MOUSEMOVEPOINT", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="GET_MOUSE_MOVE_POINTS_EX_RESOLUTION")], SimTypeInt(signed=True, label="Int32"), arg_names=["cbSize", "lppt", "lpptBuf", "nBufPoints", "resolution"]),
#
'TrackMouseEvent': SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "dwFlags": SimTypeInt(signed=False, label="TRACKMOUSEEVENT_FLAGS"), "hwndTrack": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwHoverTime": SimTypeInt(signed=False, label="UInt32")}, name="TRACKMOUSEEVENT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpEventTrack"]),
#
'RegisterHotKey': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="HOT_KEY_MODIFIERS"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "id", "fsModifiers", "vk"]),
#
'UnregisterHotKey': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "id"]),
#
'SwapMouseButton': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["fSwap"]),
#
'GetDoubleClickTime': SimTypeFunction([], SimTypeInt(signed=False, label="UInt32")),
#
'SetDoubleClickTime': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["param0"]),
#
'SetFocus': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd"]),
#
'GetActiveWindow': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'GetFocus': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'GetKBCodePage': SimTypeFunction([], SimTypeInt(signed=False, label="UInt32")),
#
'GetKeyState': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeShort(signed=True, label="Int16"), arg_names=["nVirtKey"]),
#
'GetAsyncKeyState': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeShort(signed=True, label="Int16"), arg_names=["vKey"]),
#
'GetKeyboardState': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpKeyState"]),
#
'SetKeyboardState': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpKeyState"]),
#
'GetKeyNameTextA': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lParam", "lpString", "cchSize"]),
#
'GetKeyNameTextW': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lParam", "lpString", "cchSize"]),
#
'GetKeyboardType': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["nTypeFlag"]),
#
'ToAscii': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypePointer(SimTypeShort(signed=False, label="UInt16"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["uVirtKey", "uScanCode", "lpKeyState", "lpChar", "uFlags"]),
#
'ToAsciiEx': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypePointer(SimTypeShort(signed=False, label="UInt16"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["uVirtKey", "uScanCode", "lpKeyState", "lpChar", "uFlags", "dwhkl"]),
#
'ToUnicode': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["wVirtKey", "wScanCode", "lpKeyState", "pwszBuff", "cchBuff", "wFlags"]),
#
'OemKeyScan': SimTypeFunction([SimTypeShort(signed=False, label="UInt16")], SimTypeInt(signed=False, label="UInt32"), arg_names=["wOemChar"]),
#
'VkKeyScanA': SimTypeFunction([SimTypeChar(label="Byte")], SimTypeShort(signed=True, label="Int16"), arg_names=["ch"]),
#
'VkKeyScanW': SimTypeFunction([SimTypeChar(label="Char")], SimTypeShort(signed=True, label="Int16"), arg_names=["ch"]),
#
'VkKeyScanExA': SimTypeFunction([SimTypeChar(label="Byte"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeShort(signed=True, label="Int16"), arg_names=["ch", "dwhkl"]),
#
'VkKeyScanExW': SimTypeFunction([SimTypeChar(label="Char"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeShort(signed=True, label="Int16"), arg_names=["ch", "dwhkl"]),
#
'keybd_event': SimTypeFunction([SimTypeChar(label="Byte"), SimTypeChar(label="Byte"), SimTypeInt(signed=False, label="KEYBD_EVENT_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeBottom(label="Void"), arg_names=["bVk", "bScan", "dwFlags", "dwExtraInfo"]),
#
'mouse_event': SimTypeFunction([SimTypeInt(signed=False, label="MOUSE_EVENT_FLAGS"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeBottom(label="Void"), arg_names=["dwFlags", "dx", "dy", "dwData", "dwExtraInfo"]),
#
'SendInput': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"type": SimTypeInt(signed=False, label="INPUT_TYPE"), "Anonymous": SimUnion({"mi": SimStruct({"dx": SimTypeInt(signed=True, label="Int32"), "dy": SimTypeInt(signed=True, label="Int32"), "mouseData": SimTypeInt(signed=False, label="UInt32"), "dwFlags": SimTypeInt(signed=False, label="MOUSE_EVENT_FLAGS"), "time": SimTypeInt(signed=False, label="UInt32"), "dwExtraInfo": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)}, name="MOUSEINPUT", pack=False, align=None), "ki": SimStruct({"wVk": SimTypeInt(signed=False, label="VIRTUAL_KEY"), "wScan": SimTypeShort(signed=False, label="UInt16"), "dwFlags": SimTypeInt(signed=False, label="KEYBD_EVENT_FLAGS"), "time": SimTypeInt(signed=False, label="UInt32"), "dwExtraInfo": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)}, name="KEYBDINPUT", pack=False, align=None), "hi": SimStruct({"uMsg": SimTypeInt(signed=False, label="UInt32"), "wParamL": SimTypeShort(signed=False, label="UInt16"), "wParamH": SimTypeShort(signed=False, label="UInt16")}, name="HARDWAREINPUT", pack=False, align=None)}, name="<anon>", label="None")}, name="INPUT", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["cInputs", "pInputs", "cbSize"]),
#
'GetLastInputInfo': SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "dwTime": SimTypeInt(signed=False, label="UInt32")}, name="LASTINPUTINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["plii"]),
#
'MapVirtualKeyA': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["uCode", "uMapType"]),
#
'MapVirtualKeyW': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["uCode", "uMapType"]),
#
'MapVirtualKeyExA': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["uCode", "uMapType", "dwhkl"]),
#
'MapVirtualKeyExW': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["uCode", "uMapType", "dwhkl"]),
#
'GetCapture': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'SetCapture': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd"]),
#
'ReleaseCapture': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'EnableWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "bEnable"]),
#
'IsWindowEnabled': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'DragDetect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "pt"]),
#
'SetActiveWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd"]),
#
'BlockInput': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["fBlockIt"]),
#
'GetRawInputData': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="RAW_INPUT_DATA_COMMAND_FLAGS"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hRawInput", "uiCommand", "pData", "pcbSize", "cbSizeHeader"]),
#
'GetRawInputDeviceInfoA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="RAW_INPUT_DEVICE_INFO_COMMAND"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hDevice", "uiCommand", "pData", "pcbSize"]),
#
'GetRawInputDeviceInfoW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="RAW_INPUT_DEVICE_INFO_COMMAND"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hDevice", "uiCommand", "pData", "pcbSize"]),
#
'GetRawInputBuffer': SimTypeFunction([SimTypePointer(SimStruct({"header": SimStruct({"dwType": SimTypeInt(signed=False, label="UInt32"), "dwSize": SimTypeInt(signed=False, label="UInt32"), "hDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)}, name="RAWINPUTHEADER", pack=False, align=None), "data": SimUnion({"mouse": SimStruct({"usFlags": SimTypeShort(signed=False, label="UInt16"), "Anonymous": SimUnion({"ulButtons": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimStruct({"usButtonFlags": SimTypeShort(signed=False, label="UInt16"), "usButtonData": SimTypeShort(signed=False, label="UInt16")}, name="_Anonymous_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "ulRawButtons": SimTypeInt(signed=False, label="UInt32"), "lLastX": SimTypeInt(signed=True, label="Int32"), "lLastY": SimTypeInt(signed=True, label="Int32"), "ulExtraInformation": SimTypeInt(signed=False, label="UInt32")}, name="RAWMOUSE", pack=False, align=None), "keyboard": SimStruct({"MakeCode": SimTypeShort(signed=False, label="UInt16"), "Flags": SimTypeShort(signed=False, label="UInt16"), "Reserved": SimTypeShort(signed=False, label="UInt16"), "VKey": SimTypeShort(signed=False, label="UInt16"), "Message": SimTypeInt(signed=False, label="UInt32"), "ExtraInformation": SimTypeInt(signed=False, label="UInt32")}, name="RAWKEYBOARD", pack=False, align=None), "hid": SimStruct({"dwSizeHid": SimTypeInt(signed=False, label="UInt32"), "dwCount": SimTypeInt(signed=False, label="UInt32"), "bRawData": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="RAWHID", pack=False, align=None)}, name="<anon>", label="None")}, name="RAWINPUT", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["pData", "pcbSize", "cbSizeHeader"]),
#
'RegisterRawInputDevices': SimTypeFunction([SimTypePointer(SimStruct({"usUsagePage": SimTypeShort(signed=False, label="UInt16"), "usUsage": SimTypeShort(signed=False, label="UInt16"), "dwFlags": SimTypeInt(signed=False, label="RAWINPUTDEVICE_FLAGS"), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="RAWINPUTDEVICE", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["pRawInputDevices", "uiNumDevices", "cbSize"]),
#
'GetRegisteredRawInputDevices': SimTypeFunction([SimTypePointer(SimStruct({"usUsagePage": SimTypeShort(signed=False, label="UInt16"), "usUsage": SimTypeShort(signed=False, label="UInt16"), "dwFlags": SimTypeInt(signed=False, label="RAWINPUTDEVICE_FLAGS"), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="RAWINPUTDEVICE", pack=False, align=None), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["pRawInputDevices", "puiNumDevices", "cbSize"]),
#
'GetRawInputDeviceList': SimTypeFunction([SimTypePointer(SimStruct({"hDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwType": SimTypeInt(signed=False, label="RID_DEVICE_INFO_TYPE")}, name="RAWINPUTDEVICELIST", pack=False, align=None), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["pRawInputDeviceList", "puiNumDevices", "cbSize"]),
#
'DefRawInputProc': SimTypeFunction([SimTypePointer(SimTypePointer(SimStruct({"header": SimStruct({"dwType": SimTypeInt(signed=False, label="UInt32"), "dwSize": SimTypeInt(signed=False, label="UInt32"), "hDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)}, name="RAWINPUTHEADER", pack=False, align=None), "data": SimUnion({"mouse": SimStruct({"usFlags": SimTypeShort(signed=False, label="UInt16"), "Anonymous": SimUnion({"ulButtons": SimTypeInt(signed=False, label="UInt32"), "Anonymous": SimStruct({"usButtonFlags": SimTypeShort(signed=False, label="UInt16"), "usButtonData": SimTypeShort(signed=False, label="UInt16")}, name="_Anonymous_e__Struct", pack=False, align=None)}, name="<anon>", label="None"), "ulRawButtons": SimTypeInt(signed=False, label="UInt32"), "lLastX": SimTypeInt(signed=True, label="Int32"), "lLastY": SimTypeInt(signed=True, label="Int32"), "ulExtraInformation": SimTypeInt(signed=False, label="UInt32")}, name="RAWMOUSE", pack=False, align=None), "keyboard": SimStruct({"MakeCode": SimTypeShort(signed=False, label="UInt16"), "Flags": SimTypeShort(signed=False, label="UInt16"), "Reserved": SimTypeShort(signed=False, label="UInt16"), "VKey": SimTypeShort(signed=False, label="UInt16"), "Message": SimTypeInt(signed=False, label="UInt32"), "ExtraInformation": SimTypeInt(signed=False, label="UInt32")}, name="RAWKEYBOARD", pack=False, align=None), "hid": SimStruct({"dwSizeHid": SimTypeInt(signed=False, label="UInt32"), "dwCount": SimTypeInt(signed=False, label="UInt32"), "bRawData": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="RAWHID", pack=False, align=None)}, name="<anon>", label="None")}, name="RAWINPUT", pack=False, align=None), offset=0), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["paRawInput", "nInput", "cbSizeHeader"]),
#
'GetUnpredictedMessagePos': SimTypeFunction([], SimTypeInt(signed=False, label="UInt32")),
#
'GetPointerType': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="POINTER_INPUT_TYPE"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "pointerType"]),
#
'GetPointerCursorId': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "cursorId"]),
#
'GetPointerInfo': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "pointerInfo"]),
#
'GetPointerInfoHistory': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "entriesCount", "pointerInfo"]),
#
'GetPointerFrameInfo': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "pointerCount", "pointerInfo"]),
#
'GetPointerFrameInfoHistory': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "entriesCount", "pointerCount", "pointerInfo"]),
#
'GetPointerTouchInfo': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"pointerInfo": SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), "touchFlags": SimTypeInt(signed=False, label="UInt32"), "touchMask": SimTypeInt(signed=False, label="UInt32"), "rcContact": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rcContactRaw": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "orientation": SimTypeInt(signed=False, label="UInt32"), "pressure": SimTypeInt(signed=False, label="UInt32")}, name="POINTER_TOUCH_INFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "touchInfo"]),
#
'GetPointerTouchInfoHistory': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"pointerInfo": SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), "touchFlags": SimTypeInt(signed=False, label="UInt32"), "touchMask": SimTypeInt(signed=False, label="UInt32"), "rcContact": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rcContactRaw": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "orientation": SimTypeInt(signed=False, label="UInt32"), "pressure": SimTypeInt(signed=False, label="UInt32")}, name="POINTER_TOUCH_INFO", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "entriesCount", "touchInfo"]),
#
'GetPointerFrameTouchInfo': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"pointerInfo": SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), "touchFlags": SimTypeInt(signed=False, label="UInt32"), "touchMask": SimTypeInt(signed=False, label="UInt32"), "rcContact": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rcContactRaw": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "orientation": SimTypeInt(signed=False, label="UInt32"), "pressure": SimTypeInt(signed=False, label="UInt32")}, name="POINTER_TOUCH_INFO", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "pointerCount", "touchInfo"]),
#
'GetPointerFrameTouchInfoHistory': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"pointerInfo": SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), "touchFlags": SimTypeInt(signed=False, label="UInt32"), "touchMask": SimTypeInt(signed=False, label="UInt32"), "rcContact": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rcContactRaw": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "orientation": SimTypeInt(signed=False, label="UInt32"), "pressure": SimTypeInt(signed=False, label="UInt32")}, name="POINTER_TOUCH_INFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "entriesCount", "pointerCount", "touchInfo"]),
#
'GetPointerPenInfo': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"pointerInfo": SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), "penFlags": SimTypeInt(signed=False, label="UInt32"), "penMask": SimTypeInt(signed=False, label="UInt32"), "pressure": SimTypeInt(signed=False, label="UInt32"), "rotation": SimTypeInt(signed=False, label="UInt32"), "tiltX": SimTypeInt(signed=True, label="Int32"), "tiltY": SimTypeInt(signed=True, label="Int32")}, name="POINTER_PEN_INFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "penInfo"]),
#
'GetPointerPenInfoHistory': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"pointerInfo": SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), "penFlags": SimTypeInt(signed=False, label="UInt32"), "penMask": SimTypeInt(signed=False, label="UInt32"), "pressure": SimTypeInt(signed=False, label="UInt32"), "rotation": SimTypeInt(signed=False, label="UInt32"), "tiltX": SimTypeInt(signed=True, label="Int32"), "tiltY": SimTypeInt(signed=True, label="Int32")}, name="POINTER_PEN_INFO", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "entriesCount", "penInfo"]),
#
'GetPointerFramePenInfo': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"pointerInfo": SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), "penFlags": SimTypeInt(signed=False, label="UInt32"), "penMask": SimTypeInt(signed=False, label="UInt32"), "pressure": SimTypeInt(signed=False, label="UInt32"), "rotation": SimTypeInt(signed=False, label="UInt32"), "tiltX": SimTypeInt(signed=True, label="Int32"), "tiltY": SimTypeInt(signed=True, label="Int32")}, name="POINTER_PEN_INFO", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "pointerCount", "penInfo"]),
#
'GetPointerFramePenInfoHistory': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"pointerInfo": SimStruct({"pointerType": SimTypeBottom(label="POINTER_INPUT_TYPE"), "pointerId": SimTypeInt(signed=False, label="UInt32"), "frameId": SimTypeInt(signed=False, label="UInt32"), "pointerFlags": SimTypeInt(signed=False, label="POINTER_FLAGS"), "sourceDevice": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptPixelLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocation": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptPixelLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptHimetricLocationRaw": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "dwTime": SimTypeInt(signed=False, label="UInt32"), "historyCount": SimTypeInt(signed=False, label="UInt32"), "InputData": SimTypeInt(signed=True, label="Int32"), "dwKeyStates": SimTypeInt(signed=False, label="UInt32"), "PerformanceCount": SimTypeLongLong(signed=False, label="UInt64"), "ButtonChangeType": SimTypeInt(signed=False, label="POINTER_BUTTON_CHANGE_TYPE")}, name="POINTER_INFO", pack=False, align=None), "penFlags": SimTypeInt(signed=False, label="UInt32"), "penMask": SimTypeInt(signed=False, label="UInt32"), "pressure": SimTypeInt(signed=False, label="UInt32"), "rotation": SimTypeInt(signed=False, label="UInt32"), "tiltX": SimTypeInt(signed=True, label="Int32"), "tiltY": SimTypeInt(signed=True, label="Int32")}, name="POINTER_PEN_INFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "entriesCount", "pointerCount", "penInfo"]),
#
'SkipPointerFrameMessages': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId"]),
#
'EnableMouseInPointer': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["fEnable"]),
#
'IsMouseInPointerEnabled': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'GetPointerInputTransform': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"Anonymous": SimUnion({"Anonymous": SimStruct({"_11": SimTypeFloat(size=32), "_12": SimTypeFloat(size=32), "_13": SimTypeFloat(size=32), "_14": SimTypeFloat(size=32), "_21": SimTypeFloat(size=32), "_22": SimTypeFloat(size=32), "_23": SimTypeFloat(size=32), "_24": SimTypeFloat(size=32), "_31": SimTypeFloat(size=32), "_32": SimTypeFloat(size=32), "_33": SimTypeFloat(size=32), "_34": SimTypeFloat(size=32), "_41": SimTypeFloat(size=32), "_42": SimTypeFloat(size=32), "_43": SimTypeFloat(size=32), "_44": SimTypeFloat(size=32)}, name="_Anonymous_e__Struct", pack=False, align=None), "m": SimTypeFixedSizeArray(SimTypeFloat(size=32), 16)}, name="<anon>", label="None")}, name="INPUT_TRANSFORM", pack=False, align=None), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pointerId", "historyCount", "inputTransform"]),
#
'SetWindowContextHelpId': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'GetWindowContextHelpId': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["param0"]),
#
'SetMenuContextHelpId': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'GetMenuContextHelpId': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["param0"]),
#
'WinHelpA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndMain", "lpszHelp", "uCommand", "dwData"]),
#
'WinHelpW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndMain", "lpszHelp", "uCommand", "dwData"]),
#
'GetTouchInputInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32"), "hSource": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwID": SimTypeInt(signed=False, label="UInt32"), "dwFlags": SimTypeInt(signed=False, label="TOUCHEVENTF_FLAGS"), "dwMask": SimTypeInt(signed=False, label="TOUCHINPUTMASKF_MASK"), "dwTime": SimTypeInt(signed=False, label="UInt32"), "dwExtraInfo": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "cxContact": SimTypeInt(signed=False, label="UInt32"), "cyContact": SimTypeInt(signed=False, label="UInt32")}, name="TOUCHINPUT", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hTouchInput", "cInputs", "pInputs", "cbSize"]),
#
'CloseTouchInputHandle': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hTouchInput"]),
#
'RegisterTouchWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="REGISTER_TOUCH_WINDOW_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "ulFlags"]),
#
'UnregisterTouchWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd"]),
#
'IsTouchWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "pulFlags"]),
#
'GetGestureInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "dwFlags": SimTypeInt(signed=False, label="UInt32"), "dwID": SimTypeInt(signed=False, label="UInt32"), "hwndTarget": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptsLocation": SimStruct({"x": SimTypeShort(signed=True, label="Int16"), "y": SimTypeShort(signed=True, label="Int16")}, name="POINTS", pack=False, align=None), "dwInstanceID": SimTypeInt(signed=False, label="UInt32"), "dwSequenceID": SimTypeInt(signed=False, label="UInt32"), "ullArguments": SimTypeLongLong(signed=False, label="UInt64"), "cbExtraArgs": SimTypeInt(signed=False, label="UInt32")}, name="GESTUREINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hGestureInfo", "pGestureInfo"]),
#
'GetGestureExtraArgs': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hGestureInfo", "cbExtraArgs", "pExtraArgs"]),
#
'CloseGestureInfoHandle': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hGestureInfo"]),
#
'SetGestureConfig': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"dwID": SimTypeInt(signed=False, label="GESTURECONFIG_ID"), "dwWant": SimTypeInt(signed=False, label="UInt32"), "dwBlock": SimTypeInt(signed=False, label="UInt32")}, name="GESTURECONFIG", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "dwReserved", "cIDs", "pGestureConfig", "cbSize"]),
#
'GetGestureConfig': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimStruct({"dwID": SimTypeInt(signed=False, label="GESTURECONFIG_ID"), "dwWant": SimTypeInt(signed=False, label="UInt32"), "dwBlock": SimTypeInt(signed=False, label="UInt32")}, name="GESTURECONFIG", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "dwReserved", "dwFlags", "pcIDs", "pGestureConfig", "cbSize"]),
#
'GetWindowLongPtrA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="WINDOW_LONG_PTR_INDEX")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "nIndex"]),
#
'GetWindowLongPtrW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="WINDOW_LONG_PTR_INDEX")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "nIndex"]),
#
'SetWindowLongPtrA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="WINDOW_LONG_PTR_INDEX"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "nIndex", "dwNewLong"]),
#
'SetWindowLongPtrW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="WINDOW_LONG_PTR_INDEX"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "nIndex", "dwNewLong"]),
#
'GetClassLongPtrA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_CLASS_LONG_INDEX")], SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), arg_names=["hWnd", "nIndex"]),
#
'GetClassLongPtrW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_CLASS_LONG_INDEX")], SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), arg_names=["hWnd", "nIndex"]),
#
'SetClassLongPtrA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_CLASS_LONG_INDEX"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), arg_names=["hWnd", "nIndex", "dwNewLong"]),
#
'SetClassLongPtrW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_CLASS_LONG_INDEX"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), arg_names=["hWnd", "nIndex", "dwNewLong"]),
#
'LoadStringA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hInstance", "uID", "lpBuffer", "cchBufferMax"]),
#
'LoadStringW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hInstance", "uID", "lpBuffer", "cchBufferMax"]),
#
'wvsprintfA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="SByte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "arglist"]),
#
'wvsprintfW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="SByte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "arglist"]),
#
'wsprintfA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'wsprintfW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'IsHungAppWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd"]),
#
'DisableProcessWindowsGhosting': SimTypeFunction([], SimTypeBottom(label="Void")),
#
'RegisterWindowMessageA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["lpString"]),
#
'RegisterWindowMessageW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["lpString"]),
#
'GetMessageA': SimTypeFunction([SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpMsg", "hWnd", "wMsgFilterMin", "wMsgFilterMax"]),
#
'GetMessageW': SimTypeFunction([SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpMsg", "hWnd", "wMsgFilterMin", "wMsgFilterMax"]),
#
'TranslateMessage': SimTypeFunction([SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpMsg"]),
#
'DispatchMessageA': SimTypeFunction([SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpMsg"]),
#
'DispatchMessageW': SimTypeFunction([SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpMsg"]),
#
'SetMessageQueue': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["cMessagesMax"]),
#
'PeekMessageA': SimTypeFunction([SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="PEEK_MESSAGE_REMOVE_TYPE")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpMsg", "hWnd", "wMsgFilterMin", "wMsgFilterMax", "wRemoveMsg"]),
#
'PeekMessageW': SimTypeFunction([SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="PEEK_MESSAGE_REMOVE_TYPE")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpMsg", "hWnd", "wMsgFilterMin", "wMsgFilterMax", "wRemoveMsg"]),
#
'GetMessagePos': SimTypeFunction([], SimTypeInt(signed=False, label="UInt32")),
#
'GetMessageTime': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'GetMessageExtraInfo': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'IsWow64Message': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'SetMessageExtraInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lParam"]),
#
'SendMessageA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "Msg", "wParam", "lParam"]),
#
'SendMessageW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "Msg", "wParam", "lParam"]),
#
'SendMessageTimeoutA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SEND_MESSAGE_TIMEOUT_FLAGS"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "Msg", "wParam", "lParam", "fuFlags", "uTimeout", "lpdwResult"]),
#
'SendMessageTimeoutW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SEND_MESSAGE_TIMEOUT_FLAGS"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "Msg", "wParam", "lParam", "fuFlags", "uTimeout", "lpdwResult"]),
#
'SendNotifyMessageA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "Msg", "wParam", "lParam"]),
#
'SendNotifyMessageW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "Msg", "wParam", "lParam"]),
#
'SendMessageCallbackA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeBottom(label="Void"), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "Msg", "wParam", "lParam", "lpResultCallBack", "dwData"]),
#
'SendMessageCallbackW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeBottom(label="Void"), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "Msg", "wParam", "lParam", "lpResultCallBack", "dwData"]),
#
'BroadcastSystemMessageExA': SimTypeFunction([SimTypeInt(signed=False, label="BROADCAST_SYSTEM_MESSAGE_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="BROADCAST_SYSTEM_MESSAGE_INFO"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "hdesk": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "luid": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None)}, name="BSMINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["flags", "lpInfo", "Msg", "wParam", "lParam", "pbsmInfo"]),
#
'BroadcastSystemMessageExW': SimTypeFunction([SimTypeInt(signed=False, label="BROADCAST_SYSTEM_MESSAGE_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="BROADCAST_SYSTEM_MESSAGE_INFO"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "hdesk": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "luid": SimStruct({"LowPart": SimTypeInt(signed=False, label="UInt32"), "HighPart": SimTypeInt(signed=True, label="Int32")}, name="LUID", pack=False, align=None)}, name="BSMINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["flags", "lpInfo", "Msg", "wParam", "lParam", "pbsmInfo"]),
#
'BroadcastSystemMessageA': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["flags", "lpInfo", "Msg", "wParam", "lParam"]),
#
'BroadcastSystemMessageW': SimTypeFunction([SimTypeInt(signed=False, label="BROADCAST_SYSTEM_MESSAGE_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="BROADCAST_SYSTEM_MESSAGE_INFO"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["flags", "lpInfo", "Msg", "wParam", "lParam"]),
#
'PostMessageA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "Msg", "wParam", "lParam"]),
#
'PostMessageW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "Msg", "wParam", "lParam"]),
#
'PostThreadMessageA': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["idThread", "Msg", "wParam", "lParam"]),
#
'PostThreadMessageW': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["idThread", "Msg", "wParam", "lParam"]),
#
'ReplyMessage': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lResult"]),
#
'WaitMessage': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'DefWindowProcA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "Msg", "wParam", "lParam"]),
#
'DefWindowProcW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "Msg", "wParam", "lParam"]),
#
'PostQuitMessage': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeBottom(label="Void"), arg_names=["nExitCode"]),
#
'CallWindowProcA': SimTypeFunction([SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpPrevWndFunc", "hWnd", "Msg", "wParam", "lParam"]),
#
'CallWindowProcW': SimTypeFunction([SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpPrevWndFunc", "hWnd", "Msg", "wParam", "lParam"]),
#
'InSendMessage': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'InSendMessageEx': SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["lpReserved"]),
#
'RegisterClassA': SimTypeFunction([SimTypePointer(SimStruct({"style": SimTypeInt(signed=False, label="WNDCLASS_STYLES"), "lpfnWndProc": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), "cbClsExtra": SimTypeInt(signed=True, label="Int32"), "cbWndExtra": SimTypeInt(signed=True, label="Int32"), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hIcon": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hCursor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbrBackground": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszMenuName": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "lpszClassName": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WNDCLASSA", pack=False, align=None), offset=0)], SimTypeShort(signed=False, label="UInt16"), arg_names=["lpWndClass"]),
#
'RegisterClassW': SimTypeFunction([SimTypePointer(SimStruct({"style": SimTypeInt(signed=False, label="WNDCLASS_STYLES"), "lpfnWndProc": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), "cbClsExtra": SimTypeInt(signed=True, label="Int32"), "cbWndExtra": SimTypeInt(signed=True, label="Int32"), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hIcon": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hCursor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbrBackground": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszMenuName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "lpszClassName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WNDCLASSW", pack=False, align=None), offset=0)], SimTypeShort(signed=False, label="UInt16"), arg_names=["lpWndClass"]),
#
'UnregisterClassA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpClassName", "hInstance"]),
#
'UnregisterClassW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpClassName", "hInstance"]),
#
'GetClassInfoA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimStruct({"style": SimTypeInt(signed=False, label="WNDCLASS_STYLES"), "lpfnWndProc": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), "cbClsExtra": SimTypeInt(signed=True, label="Int32"), "cbWndExtra": SimTypeInt(signed=True, label="Int32"), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hIcon": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hCursor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbrBackground": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszMenuName": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "lpszClassName": SimTypePointer(SimTypeChar(label="Byte"), offset=0)}, name="WNDCLASSA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hInstance", "lpClassName", "lpWndClass"]),
#
'GetClassInfoW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"style": SimTypeInt(signed=False, label="WNDCLASS_STYLES"), "lpfnWndProc": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), "cbClsExtra": SimTypeInt(signed=True, label="Int32"), "cbWndExtra": SimTypeInt(signed=True, label="Int32"), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hIcon": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hCursor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbrBackground": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszMenuName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "lpszClassName": SimTypePointer(SimTypeChar(label="Char"), offset=0)}, name="WNDCLASSW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hInstance", "lpClassName", "lpWndClass"]),
#
'RegisterClassExA': SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "style": SimTypeInt(signed=False, label="WNDCLASS_STYLES"), "lpfnWndProc": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), "cbClsExtra": SimTypeInt(signed=True, label="Int32"), "cbWndExtra": SimTypeInt(signed=True, label="Int32"), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hIcon": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hCursor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbrBackground": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszMenuName": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "lpszClassName": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "hIconSm": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="WNDCLASSEXA", pack=False, align=None), offset=0)], SimTypeShort(signed=False, label="UInt16"), arg_names=["param0"]),
#
'RegisterClassExW': SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "style": SimTypeInt(signed=False, label="WNDCLASS_STYLES"), "lpfnWndProc": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), "cbClsExtra": SimTypeInt(signed=True, label="Int32"), "cbWndExtra": SimTypeInt(signed=True, label="Int32"), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hIcon": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hCursor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbrBackground": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszMenuName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "lpszClassName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "hIconSm": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="WNDCLASSEXW", pack=False, align=None), offset=0)], SimTypeShort(signed=False, label="UInt16"), arg_names=["param0"]),
#
'GetClassInfoExA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "style": SimTypeInt(signed=False, label="WNDCLASS_STYLES"), "lpfnWndProc": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), "cbClsExtra": SimTypeInt(signed=True, label="Int32"), "cbWndExtra": SimTypeInt(signed=True, label="Int32"), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hIcon": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hCursor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbrBackground": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszMenuName": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "lpszClassName": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "hIconSm": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="WNDCLASSEXA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hInstance", "lpszClass", "lpwcx"]),
#
'GetClassInfoExW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "style": SimTypeInt(signed=False, label="WNDCLASS_STYLES"), "lpfnWndProc": SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), "cbClsExtra": SimTypeInt(signed=True, label="Int32"), "cbWndExtra": SimTypeInt(signed=True, label="Int32"), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hIcon": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hCursor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbrBackground": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszMenuName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "lpszClassName": SimTypePointer(SimTypeChar(label="Char"), offset=0), "hIconSm": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="WNDCLASSEXW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hInstance", "lpszClass", "lpwcx"]),
#
'CreateWindowExA': SimTypeFunction([SimTypeInt(signed=False, label="WINDOW_EX_STYLE"), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="WINDOW_STYLE"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["dwExStyle", "lpClassName", "lpWindowName", "dwStyle", "X", "Y", "nWidth", "nHeight", "hWndParent", "hMenu", "hInstance", "lpParam"]),
#
'CreateWindowExW': SimTypeFunction([SimTypeInt(signed=False, label="WINDOW_EX_STYLE"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="WINDOW_STYLE"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["dwExStyle", "lpClassName", "lpWindowName", "dwStyle", "X", "Y", "nWidth", "nHeight", "hWndParent", "hMenu", "hInstance", "lpParam"]),
#
'IsWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'IsMenu': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu"]),
#
'IsChild': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndParent", "hWnd"]),
#
'DestroyWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'ShowWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SHOW_WINDOW_CMD")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nCmdShow"]),
#
'AnimateWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="ANIMATE_WINDOW_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "dwTime", "dwFlags"]),
#
'UpdateLayeredWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"cx": SimTypeInt(signed=True, label="Int32"), "cy": SimTypeInt(signed=True, label="Int32")}, name="SIZE", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"BlendOp": SimTypeChar(label="Byte"), "BlendFlags": SimTypeChar(label="Byte"), "SourceConstantAlpha": SimTypeChar(label="Byte"), "AlphaFormat": SimTypeChar(label="Byte")}, name="BLENDFUNCTION", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UPDATE_LAYERED_WINDOW_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hdcDst", "pptDst", "psize", "hdcSrc", "pptSrc", "crKey", "pblend", "dwFlags"]),
#
'UpdateLayeredWindowIndirect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "hdcDst": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "pptDst": SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0), "psize": SimTypePointer(SimStruct({"cx": SimTypeInt(signed=True, label="Int32"), "cy": SimTypeInt(signed=True, label="Int32")}, name="SIZE", pack=False, align=None), offset=0), "hdcSrc": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "pptSrc": SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0), "crKey": SimTypeInt(signed=False, label="UInt32"), "pblend": SimTypePointer(SimStruct({"BlendOp": SimTypeChar(label="Byte"), "BlendFlags": SimTypeChar(label="Byte"), "SourceConstantAlpha": SimTypeChar(label="Byte"), "AlphaFormat": SimTypeChar(label="Byte")}, name="BLENDFUNCTION", pack=False, align=None), offset=0), "dwFlags": SimTypeInt(signed=False, label="UPDATE_LAYERED_WINDOW_FLAGS"), "prcDirty": SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)}, name="UPDATELAYEREDWINDOWINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "pULWInfo"]),
#
'GetLayeredWindowAttributes': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeInt(signed=False, label="LAYERED_WINDOW_ATTRIBUTES_FLAGS"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "pcrKey", "pbAlpha", "pdwFlags"]),
#
'SetLayeredWindowAttributes': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeChar(label="Byte"), SimTypeInt(signed=False, label="LAYERED_WINDOW_ATTRIBUTES_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "crKey", "bAlpha", "dwFlags"]),
#
'ShowWindowAsync': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SHOW_WINDOW_CMD")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nCmdShow"]),
#
'FlashWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "bInvert"]),
#
'FlashWindowEx': SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwFlags": SimTypeInt(signed=False, label="FLASHWINFO_FLAGS"), "uCount": SimTypeInt(signed=False, label="UInt32"), "dwTimeout": SimTypeInt(signed=False, label="UInt32")}, name="FLASHWINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pfwi"]),
#
'ShowOwnedPopups': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "fShow"]),
#
'OpenIcon': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'CloseWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'MoveWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "X", "Y", "nWidth", "nHeight", "bRepaint"]),
#
'SetWindowPos': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="SET_WINDOW_POS_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hWndInsertAfter", "X", "Y", "cx", "cy", "uFlags"]),
#
'GetWindowPlacement': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"length": SimTypeInt(signed=False, label="UInt32"), "flags": SimTypeInt(signed=False, label="WINDOWPLACEMENT_FLAGS"), "showCmd": SimTypeInt(signed=False, label="SHOW_WINDOW_CMD"), "ptMinPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptMaxPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "rcNormalPosition": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None)}, name="WINDOWPLACEMENT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpwndpl"]),
#
'SetWindowPlacement': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"length": SimTypeInt(signed=False, label="UInt32"), "flags": SimTypeInt(signed=False, label="WINDOWPLACEMENT_FLAGS"), "showCmd": SimTypeInt(signed=False, label="SHOW_WINDOW_CMD"), "ptMinPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "ptMaxPosition": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), "rcNormalPosition": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None)}, name="WINDOWPLACEMENT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpwndpl"]),
#
'GetWindowDisplayAffinity': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "pdwAffinity"]),
#
'SetWindowDisplayAffinity': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="WINDOW_DISPLAY_AFFINITY")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "dwAffinity"]),
#
'BeginDeferWindowPos': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["nNumWindows"]),
#
'DeferWindowPos': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="SET_WINDOW_POS_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWinPosInfo", "hWnd", "hWndInsertAfter", "x", "y", "cx", "cy", "uFlags"]),
#
'EndDeferWindowPos': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWinPosInfo"]),
#
'IsWindowVisible': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'IsIconic': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'AnyPopup': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'BringWindowToTop': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'IsZoomed': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'CreateDialogParamA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpTemplateName", "hWndParent", "lpDialogFunc", "dwInitParam"]),
#
'CreateDialogParamW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpTemplateName", "hWndParent", "lpDialogFunc", "dwInitParam"]),
#
'CreateDialogIndirectParamA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"style": SimTypeInt(signed=False, label="UInt32"), "dwExtendedStyle": SimTypeInt(signed=False, label="UInt32"), "cdit": SimTypeShort(signed=False, label="UInt16"), "x": SimTypeShort(signed=True, label="Int16"), "y": SimTypeShort(signed=True, label="Int16"), "cx": SimTypeShort(signed=True, label="Int16"), "cy": SimTypeShort(signed=True, label="Int16")}, name="DLGTEMPLATE", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpTemplate", "hWndParent", "lpDialogFunc", "dwInitParam"]),
#
'CreateDialogIndirectParamW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"style": SimTypeInt(signed=False, label="UInt32"), "dwExtendedStyle": SimTypeInt(signed=False, label="UInt32"), "cdit": SimTypeShort(signed=False, label="UInt16"), "x": SimTypeShort(signed=True, label="Int16"), "y": SimTypeShort(signed=True, label="Int16"), "cx": SimTypeShort(signed=True, label="Int16"), "cy": SimTypeShort(signed=True, label="Int16")}, name="DLGTEMPLATE", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpTemplate", "hWndParent", "lpDialogFunc", "dwInitParam"]),
#
'DialogBoxParamA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpTemplateName", "hWndParent", "lpDialogFunc", "dwInitParam"]),
#
'DialogBoxParamW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpTemplateName", "hWndParent", "lpDialogFunc", "dwInitParam"]),
#
'DialogBoxIndirectParamA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"style": SimTypeInt(signed=False, label="UInt32"), "dwExtendedStyle": SimTypeInt(signed=False, label="UInt32"), "cdit": SimTypeShort(signed=False, label="UInt16"), "x": SimTypeShort(signed=True, label="Int16"), "y": SimTypeShort(signed=True, label="Int16"), "cx": SimTypeShort(signed=True, label="Int16"), "cy": SimTypeShort(signed=True, label="Int16")}, name="DLGTEMPLATE", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "hDialogTemplate", "hWndParent", "lpDialogFunc", "dwInitParam"]),
#
'DialogBoxIndirectParamW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"style": SimTypeInt(signed=False, label="UInt32"), "dwExtendedStyle": SimTypeInt(signed=False, label="UInt32"), "cdit": SimTypeShort(signed=False, label="UInt16"), "x": SimTypeShort(signed=True, label="Int16"), "y": SimTypeShort(signed=True, label="Int16"), "cx": SimTypeShort(signed=True, label="Int16"), "cy": SimTypeShort(signed=True, label="Int16")}, name="DLGTEMPLATE", pack=False, align=None), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "hDialogTemplate", "hWndParent", "lpDialogFunc", "dwInitParam"]),
#
'EndDialog': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "nResult"]),
#
'GetDlgItem': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hDlg", "nIDDlgItem"]),
#
'SetDlgItemInt': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "nIDDlgItem", "uValue", "bSigned"]),
#
'GetDlgItemInt': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int32"), offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hDlg", "nIDDlgItem", "lpTranslated", "bSigned"]),
#
'SetDlgItemTextA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "nIDDlgItem", "lpString"]),
#
'SetDlgItemTextW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "nIDDlgItem", "lpString"]),
#
'GetDlgItemTextA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hDlg", "nIDDlgItem", "lpString", "cchMax"]),
#
'GetDlgItemTextW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hDlg", "nIDDlgItem", "lpString", "cchMax"]),
#
'SendDlgItemMessageA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hDlg", "nIDDlgItem", "Msg", "wParam", "lParam"]),
#
'SendDlgItemMessageW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hDlg", "nIDDlgItem", "Msg", "wParam", "lParam"]),
#
'GetNextDlgGroupItem': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hDlg", "hCtl", "bPrevious"]),
#
'GetNextDlgTabItem': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hDlg", "hCtl", "bPrevious"]),
#
'GetDlgCtrlID': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'GetDialogBaseUnits': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'DefDlgProcA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hDlg", "Msg", "wParam", "lParam"]),
#
'DefDlgProcW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hDlg", "Msg", "wParam", "lParam"]),
#
'CallMsgFilterA': SimTypeFunction([SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpMsg", "nCode"]),
#
'CallMsgFilterW': SimTypeFunction([SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpMsg", "nCode"]),
#
'CharToOemA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pSrc", "pDst"]),
#
'CharToOemW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pSrc", "pDst"]),
#
'OemToCharA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pSrc", "pDst"]),
#
'OemToCharW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pSrc", "pDst"]),
#
'CharToOemBuffA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpszSrc", "lpszDst", "cchDstLength"]),
#
'CharToOemBuffW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpszSrc", "lpszDst", "cchDstLength"]),
#
'OemToCharBuffA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpszSrc", "lpszDst", "cchDstLength"]),
#
'OemToCharBuffW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpszSrc", "lpszDst", "cchDstLength"]),
#
'CharUpperA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeChar(label="Byte"), offset=0), arg_names=["lpsz"]),
#
'CharUpperW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeChar(label="Char"), offset=0), arg_names=["lpsz"]),
#
'CharUpperBuffA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["lpsz", "cchLength"]),
#
'CharUpperBuffW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["lpsz", "cchLength"]),
#
'CharLowerA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeChar(label="Byte"), offset=0), arg_names=["lpsz"]),
#
'CharLowerW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeChar(label="Char"), offset=0), arg_names=["lpsz"]),
#
'CharLowerBuffA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["lpsz", "cchLength"]),
#
'CharLowerBuffW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["lpsz", "cchLength"]),
#
'CharNextA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeChar(label="Byte"), offset=0), arg_names=["lpsz"]),
#
'CharNextW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeChar(label="Char"), offset=0), arg_names=["lpsz"]),
#
'CharPrevA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeChar(label="Byte"), offset=0), arg_names=["lpszStart", "lpszCurrent"]),
#
'CharPrevW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeChar(label="Char"), offset=0), arg_names=["lpszStart", "lpszCurrent"]),
#
'CharNextExA': SimTypeFunction([SimTypeShort(signed=False, label="UInt16"), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeChar(label="Byte"), offset=0), arg_names=["CodePage", "lpCurrentChar", "dwFlags"]),
#
'CharPrevExA': SimTypeFunction([SimTypeShort(signed=False, label="UInt16"), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeChar(label="Byte"), offset=0), arg_names=["CodePage", "lpStart", "lpCurrentChar", "dwFlags"]),
#
'IsCharAlphaA': SimTypeFunction([SimTypeChar(label="Byte")], SimTypeInt(signed=True, label="Int32"), arg_names=["ch"]),
#
'IsCharAlphaW': SimTypeFunction([SimTypeChar(label="Char")], SimTypeInt(signed=True, label="Int32"), arg_names=["ch"]),
#
'IsCharAlphaNumericA': SimTypeFunction([SimTypeChar(label="Byte")], SimTypeInt(signed=True, label="Int32"), arg_names=["ch"]),
#
'IsCharAlphaNumericW': SimTypeFunction([SimTypeChar(label="Char")], SimTypeInt(signed=True, label="Int32"), arg_names=["ch"]),
#
'IsCharUpperA': SimTypeFunction([SimTypeChar(label="Byte")], SimTypeInt(signed=True, label="Int32"), arg_names=["ch"]),
#
'IsCharUpperW': SimTypeFunction([SimTypeChar(label="Char")], SimTypeInt(signed=True, label="Int32"), arg_names=["ch"]),
#
'IsCharLowerA': SimTypeFunction([SimTypeChar(label="Byte")], SimTypeInt(signed=True, label="Int32"), arg_names=["ch"]),
#
'GetInputState': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'GetQueueStatus': SimTypeFunction([SimTypeInt(signed=False, label="QUEUE_STATUS_FLAGS")], SimTypeInt(signed=False, label="UInt32"), arg_names=["flags"]),
#
'SetTimer': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeBottom(label="Void"), arg_names=["param0", "param1", "param2", "param3"]), offset=0)], SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), arg_names=["hWnd", "nIDEvent", "uElapse", "lpTimerFunc"]),
#
'SetCoalescableTimer': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeBottom(label="Void"), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), arg_names=["hWnd", "nIDEvent", "uElapse", "lpTimerFunc", "uToleranceDelay"]),
#
'KillTimer': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "uIDEvent"]),
#
'IsWindowUnicode': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'LoadAcceleratorsA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpTableName"]),
#
'LoadAcceleratorsW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpTableName"]),
#
'CreateAcceleratorTableA': SimTypeFunction([SimTypePointer(SimStruct({"fVirt": SimTypeChar(label="Byte"), "key": SimTypeShort(signed=False, label="UInt16"), "cmd": SimTypeShort(signed=False, label="UInt16")}, name="ACCEL", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["paccel", "cAccel"]),
#
'CreateAcceleratorTableW': SimTypeFunction([SimTypePointer(SimStruct({"fVirt": SimTypeChar(label="Byte"), "key": SimTypeShort(signed=False, label="UInt16"), "cmd": SimTypeShort(signed=False, label="UInt16")}, name="ACCEL", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["paccel", "cAccel"]),
#
'DestroyAcceleratorTable': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hAccel"]),
#
'CopyAcceleratorTableA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"fVirt": SimTypeChar(label="Byte"), "key": SimTypeShort(signed=False, label="UInt16"), "cmd": SimTypeShort(signed=False, label="UInt16")}, name="ACCEL", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hAccelSrc", "lpAccelDst", "cAccelEntries"]),
#
'CopyAcceleratorTableW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"fVirt": SimTypeChar(label="Byte"), "key": SimTypeShort(signed=False, label="UInt16"), "cmd": SimTypeShort(signed=False, label="UInt16")}, name="ACCEL", pack=False, align=None), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hAccelSrc", "lpAccelDst", "cAccelEntries"]),
#
'TranslateAcceleratorA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hAccTable", "lpMsg"]),
#
'TranslateAcceleratorW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hAccTable", "lpMsg"]),
#
'GetSystemMetrics': SimTypeFunction([SimTypeInt(signed=False, label="SYSTEM_METRICS_INDEX")], SimTypeInt(signed=True, label="Int32"), arg_names=["nIndex"]),
#
'LoadMenuA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpMenuName"]),
#
'LoadMenuW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpMenuName"]),
#
'LoadMenuIndirectA': SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpMenuTemplate"]),
#
'LoadMenuIndirectW': SimTypeFunction([SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpMenuTemplate"]),
#
'GetMenu': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd"]),
#
'SetMenu': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hMenu"]),
#
'ChangeMenuA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "cmd", "lpszNewItem", "cmdInsert", "flags"]),
#
'ChangeMenuW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "cmd", "lpszNewItem", "cmdInsert", "flags"]),
#
'HiliteMenuItem': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hMenu", "uIDHiliteItem", "uHilite"]),
#
'GetMenuStringA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uIDItem", "lpString", "cchMax", "flags"]),
#
'GetMenuStringW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uIDItem", "lpString", "cchMax", "flags"]),
#
'GetMenuState': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hMenu", "uId", "uFlags"]),
#
'DrawMenuBar': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'GetSystemMenu': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "bRevert"]),
#
'CreateMenu': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'CreatePopupMenu': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'DestroyMenu': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu"]),
#
'CheckMenuItem': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hMenu", "uIDCheckItem", "uCheck"]),
#
'EnableMenuItem': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uIDEnableItem", "uEnable"]),
#
'GetSubMenu': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hMenu", "nPos"]),
#
'GetMenuItemID': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hMenu", "nPos"]),
#
'GetMenuItemCount': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu"]),
#
'InsertMenuA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uPosition", "uFlags", "uIDNewItem", "lpNewItem"]),
#
'InsertMenuW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uPosition", "uFlags", "uIDNewItem", "lpNewItem"]),
#
'AppendMenuA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uFlags", "uIDNewItem", "lpNewItem"]),
#
'AppendMenuW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uFlags", "uIDNewItem", "lpNewItem"]),
#
'ModifyMenuA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMnu", "uPosition", "uFlags", "uIDNewItem", "lpNewItem"]),
#
'ModifyMenuW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMnu", "uPosition", "uFlags", "uIDNewItem", "lpNewItem"]),
#
'RemoveMenu': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uPosition", "uFlags"]),
#
'DeleteMenu': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uPosition", "uFlags"]),
#
'SetMenuItemBitmaps': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="MENU_ITEM_FLAGS"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uPosition", "uFlags", "hBitmapUnchecked", "hBitmapChecked"]),
#
'GetMenuCheckMarkDimensions': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'TrackPopupMenu': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="TRACK_POPUP_MENU_FLAGS"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uFlags", "x", "y", "nReserved", "hWnd", "prcRect"]),
#
'TrackPopupMenuEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "rcExclude": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None)}, name="TPMPARAMS", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uFlags", "x", "y", "hwnd", "lptpm"]),
#
'CalculatePopupWindowPosition': SimTypeFunction([SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"cx": SimTypeInt(signed=True, label="Int32"), "cy": SimTypeInt(signed=True, label="Int32")}, name="SIZE", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["anchorPoint", "windowSize", "flags", "excludeRect", "popupWindowPosition"]),
#
'GetMenuInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="MENUINFO_MASK"), "dwStyle": SimTypeInt(signed=False, label="MENUINFO_STYLE"), "cyMax": SimTypeInt(signed=False, label="UInt32"), "hbrBack": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwContextHelpID": SimTypeInt(signed=False, label="UInt32"), "dwMenuData": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)}, name="MENUINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'SetMenuInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="MENUINFO_MASK"), "dwStyle": SimTypeInt(signed=False, label="MENUINFO_STYLE"), "cyMax": SimTypeInt(signed=False, label="UInt32"), "hbrBack": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwContextHelpID": SimTypeInt(signed=False, label="UInt32"), "dwMenuData": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)}, name="MENUINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]),
#
'EndMenu': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'InsertMenuItemA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="MENU_ITEM_MASK"), "fType": SimTypeInt(signed=False, label="MENU_ITEM_TYPE"), "fState": SimTypeInt(signed=False, label="MENU_ITEM_STATE"), "wID": SimTypeInt(signed=False, label="UInt32"), "hSubMenu": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpChecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpUnchecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwItemData": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "dwTypeData": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "cch": SimTypeInt(signed=False, label="UInt32"), "hbmpItem": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="MENUITEMINFOA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hmenu", "item", "fByPosition", "lpmi"]),
#
'InsertMenuItemW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="MENU_ITEM_MASK"), "fType": SimTypeInt(signed=False, label="MENU_ITEM_TYPE"), "fState": SimTypeInt(signed=False, label="MENU_ITEM_STATE"), "wID": SimTypeInt(signed=False, label="UInt32"), "hSubMenu": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpChecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpUnchecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwItemData": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "dwTypeData": SimTypePointer(SimTypeChar(label="Char"), offset=0), "cch": SimTypeInt(signed=False, label="UInt32"), "hbmpItem": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="MENUITEMINFOW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hmenu", "item", "fByPosition", "lpmi"]),
#
'GetMenuItemInfoA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="MENU_ITEM_MASK"), "fType": SimTypeInt(signed=False, label="MENU_ITEM_TYPE"), "fState": SimTypeInt(signed=False, label="MENU_ITEM_STATE"), "wID": SimTypeInt(signed=False, label="UInt32"), "hSubMenu": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpChecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpUnchecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwItemData": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "dwTypeData": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "cch": SimTypeInt(signed=False, label="UInt32"), "hbmpItem": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="MENUITEMINFOA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hmenu", "item", "fByPosition", "lpmii"]),
#
'GetMenuItemInfoW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="MENU_ITEM_MASK"), "fType": SimTypeInt(signed=False, label="MENU_ITEM_TYPE"), "fState": SimTypeInt(signed=False, label="MENU_ITEM_STATE"), "wID": SimTypeInt(signed=False, label="UInt32"), "hSubMenu": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpChecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpUnchecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwItemData": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "dwTypeData": SimTypePointer(SimTypeChar(label="Char"), offset=0), "cch": SimTypeInt(signed=False, label="UInt32"), "hbmpItem": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="MENUITEMINFOW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hmenu", "item", "fByPosition", "lpmii"]),
#
'SetMenuItemInfoA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="MENU_ITEM_MASK"), "fType": SimTypeInt(signed=False, label="MENU_ITEM_TYPE"), "fState": SimTypeInt(signed=False, label="MENU_ITEM_STATE"), "wID": SimTypeInt(signed=False, label="UInt32"), "hSubMenu": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpChecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpUnchecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwItemData": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "dwTypeData": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "cch": SimTypeInt(signed=False, label="UInt32"), "hbmpItem": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="MENUITEMINFOA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hmenu", "item", "fByPositon", "lpmii"]),
#
'SetMenuItemInfoW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fMask": SimTypeInt(signed=False, label="MENU_ITEM_MASK"), "fType": SimTypeInt(signed=False, label="MENU_ITEM_TYPE"), "fState": SimTypeInt(signed=False, label="MENU_ITEM_STATE"), "wID": SimTypeInt(signed=False, label="UInt32"), "hSubMenu": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpChecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmpUnchecked": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwItemData": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "dwTypeData": SimTypePointer(SimTypeChar(label="Char"), offset=0), "cch": SimTypeInt(signed=False, label="UInt32"), "hbmpItem": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="MENUITEMINFOW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hmenu", "item", "fByPositon", "lpmii"]),
#
'GetMenuDefaultItem': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="GET_MENU_DEFAULT_ITEM_FLAGS")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hMenu", "fByPos", "gmdiFlags"]),
#
'SetMenuDefaultItem': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hMenu", "uItem", "fByPos"]),
#
'GetMenuItemRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hMenu", "uItem", "lprcItem"]),
#
'MenuItemFromPoint': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hMenu", "ptScreen"]),
#
'DragObject': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hwndParent", "hwndFrom", "fmt", "data", "hcur"]),
#
'DrawIcon': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDC", "X", "Y", "hIcon"]),
#
'GetForegroundWindow': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'SwitchToThisWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeBottom(label="Void"), arg_names=["hwnd", "fUnknown"]),
#
'SetForegroundWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'AllowSetForegroundWindow': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["dwProcessId"]),
#
'LockSetForegroundWindow': SimTypeFunction([SimTypeInt(signed=False, label="FOREGROUND_WINDOW_LOCK_CODE")], SimTypeInt(signed=True, label="Int32"), arg_names=["uLockCode"]),
#
'SetPropA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpString", "hData"]),
#
'SetPropW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpString", "hData"]),
#
'GetPropA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "lpString"]),
#
'GetPropW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "lpString"]),
#
'RemovePropA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "lpString"]),
#
'RemovePropW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "lpString"]),
#
'EnumPropsExA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpEnumFunc", "lParam"]),
#
'EnumPropsExW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "param2", "param3"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpEnumFunc", "lParam"]),
#
'EnumPropsA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "param2"]), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpEnumFunc"]),
#
'EnumPropsW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1", "param2"]), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpEnumFunc"]),
#
'SetWindowTextA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpString"]),
#
'SetWindowTextW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpString"]),
#
'GetWindowTextA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpString", "nMaxCount"]),
#
'GetWindowTextW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpString", "nMaxCount"]),
#
'GetWindowTextLengthA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'GetWindowTextLengthW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'GetClientRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpRect"]),
#
'GetWindowRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpRect"]),
#
'AdjustWindowRect': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="WINDOW_STYLE"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpRect", "dwStyle", "bMenu"]),
#
'AdjustWindowRectEx': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="WINDOW_STYLE"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="WINDOW_EX_STYLE")], SimTypeInt(signed=True, label="Int32"), arg_names=["lpRect", "dwStyle", "bMenu", "dwExStyle"]),
#
'MessageBoxA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="MESSAGEBOX_STYLE")], SimTypeInt(signed=False, label="MESSAGEBOX_RESULT"), arg_names=["hWnd", "lpText", "lpCaption", "uType"]),
#
'MessageBoxW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="MESSAGEBOX_STYLE")], SimTypeInt(signed=False, label="MESSAGEBOX_RESULT"), arg_names=["hWnd", "lpText", "lpCaption", "uType"]),
#
'MessageBoxExA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="MESSAGEBOX_STYLE"), SimTypeShort(signed=False, label="UInt16")], SimTypeInt(signed=False, label="MESSAGEBOX_RESULT"), arg_names=["hWnd", "lpText", "lpCaption", "uType", "wLanguageId"]),
#
'MessageBoxExW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="MESSAGEBOX_STYLE"), SimTypeShort(signed=False, label="UInt16")], SimTypeInt(signed=False, label="MESSAGEBOX_RESULT"), arg_names=["hWnd", "lpText", "lpCaption", "uType", "wLanguageId"]),
#
'MessageBoxIndirectA': SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "hwndOwner": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszText": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "lpszCaption": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "dwStyle": SimTypeInt(signed=False, label="MESSAGEBOX_STYLE"), "lpszIcon": SimTypePointer(SimTypeChar(label="Byte"), offset=0), "dwContextHelpId": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lpfnMsgBoxCallback": SimTypePointer(SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "iContextType": SimTypeInt(signed=True, label="Int32"), "iCtrlId": SimTypeInt(signed=True, label="Int32"), "hItemHandle": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwContextId": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "MousePos": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="HELPINFO", pack=False, align=None), offset=0)], SimTypeBottom(label="Void"), arg_names=["lpHelpInfo"]), offset=0), "dwLanguageId": SimTypeInt(signed=False, label="UInt32")}, name="MSGBOXPARAMSA", pack=False, align=None), offset=0)], SimTypeInt(signed=False, label="MESSAGEBOX_RESULT"), arg_names=["lpmbp"]),
#
'MessageBoxIndirectW': SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "hwndOwner": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hInstance": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "lpszText": SimTypePointer(SimTypeChar(label="Char"), offset=0), "lpszCaption": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dwStyle": SimTypeInt(signed=False, label="MESSAGEBOX_STYLE"), "lpszIcon": SimTypePointer(SimTypeChar(label="Char"), offset=0), "dwContextHelpId": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lpfnMsgBoxCallback": SimTypePointer(SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "iContextType": SimTypeInt(signed=True, label="Int32"), "iCtrlId": SimTypeInt(signed=True, label="Int32"), "hItemHandle": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "dwContextId": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "MousePos": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="HELPINFO", pack=False, align=None), offset=0)], SimTypeBottom(label="Void"), arg_names=["lpHelpInfo"]), offset=0), "dwLanguageId": SimTypeInt(signed=False, label="UInt32")}, name="MSGBOXPARAMSW", pack=False, align=None), offset=0)], SimTypeInt(signed=False, label="MESSAGEBOX_RESULT"), arg_names=["lpmbp"]),
#
'ShowCursor': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["bShow"]),
#
'SetCursorPos': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["X", "Y"]),
#
'SetPhysicalCursorPos': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["X", "Y"]),
#
'SetCursor': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hCursor"]),
#
'GetCursorPos': SimTypeFunction([SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpPoint"]),
#
'GetPhysicalCursorPos': SimTypeFunction([SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpPoint"]),
#
'GetClipCursor': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpRect"]),
#
'GetCursor': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'CreateCaret': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "hBitmap", "nWidth", "nHeight"]),
#
'GetCaretBlinkTime': SimTypeFunction([], SimTypeInt(signed=False, label="UInt32")),
#
'SetCaretBlinkTime': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["uMSeconds"]),
#
'DestroyCaret': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'HideCaret': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'ShowCaret': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd"]),
#
'SetCaretPos': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["X", "Y"]),
#
'GetCaretPos': SimTypeFunction([SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpPoint"]),
#
'LogicalToPhysicalPoint': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpPoint"]),
#
'PhysicalToLogicalPoint': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpPoint"]),
#
'WindowFromPoint': SimTypeFunction([SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["Point"]),
#
'WindowFromPhysicalPoint': SimTypeFunction([SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["Point"]),
#
'ChildWindowFromPoint': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWndParent", "Point"]),
#
'ClipCursor': SimTypeFunction([SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpRect"]),
#
'ChildWindowFromPointEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None), SimTypeInt(signed=False, label="CWP_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hwnd", "pt", "flags"]),
#
'GetSysColor': SimTypeFunction([SimTypeInt(signed=False, label="SYS_COLOR_INDEX")], SimTypeInt(signed=False, label="UInt32"), arg_names=["nIndex"]),
#
'SetSysColors': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int32"), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), label="LPArray", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["cElements", "lpaElements", "lpaRgbValues"]),
#
'GetWindowWord': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeShort(signed=False, label="UInt16"), arg_names=["hWnd", "nIndex"]),
#
'SetWindowWord': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeShort(signed=False, label="UInt16")], SimTypeShort(signed=False, label="UInt16"), arg_names=["hWnd", "nIndex", "wNewWord"]),
#
'GetWindowLongA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="WINDOW_LONG_PTR_INDEX")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nIndex"]),
#
'GetWindowLongW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="WINDOW_LONG_PTR_INDEX")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nIndex"]),
#
'SetWindowLongA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="WINDOW_LONG_PTR_INDEX"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nIndex", "dwNewLong"]),
#
'SetWindowLongW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="WINDOW_LONG_PTR_INDEX"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "nIndex", "dwNewLong"]),
#
'GetClassWord': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeShort(signed=False, label="UInt16"), arg_names=["hWnd", "nIndex"]),
#
'SetClassWord': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeShort(signed=False, label="UInt16")], SimTypeShort(signed=False, label="UInt16"), arg_names=["hWnd", "nIndex", "wNewWord"]),
#
'GetClassLongA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_CLASS_LONG_INDEX")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hWnd", "nIndex"]),
#
'GetClassLongW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_CLASS_LONG_INDEX")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hWnd", "nIndex"]),
#
'SetClassLongA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_CLASS_LONG_INDEX"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hWnd", "nIndex", "dwNewLong"]),
#
'SetClassLongW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_CLASS_LONG_INDEX"), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hWnd", "nIndex", "dwNewLong"]),
#
'GetProcessDefaultLayout': SimTypeFunction([SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pdwDefaultLayout"]),
#
'SetProcessDefaultLayout': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["dwDefaultLayout"]),
#
'GetDesktopWindow': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'GetParent': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd"]),
#
'SetParent': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWndChild", "hWndNewParent"]),
#
'EnumChildWindows': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndParent", "lpEnumFunc", "lParam"]),
#
'FindWindowA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpClassName", "lpWindowName"]),
#
'FindWindowW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpClassName", "lpWindowName"]),
#
'FindWindowExA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWndParent", "hWndChildAfter", "lpszClass", "lpszWindow"]),
#
'FindWindowExW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWndParent", "hWndChildAfter", "lpszClass", "lpszWindow"]),
#
'GetShellWindow': SimTypeFunction([], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)),
#
'RegisterShellHookWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd"]),
#
'DeregisterShellHookWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd"]),
#
'EnumWindows': SimTypeFunction([SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["lpEnumFunc", "lParam"]),
#
'EnumThreadWindows': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["param0", "param1"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["dwThreadId", "lpfn", "lParam"]),
#
'GetClassNameA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpClassName", "nMaxCount"]),
#
'GetClassNameW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "lpClassName", "nMaxCount"]),
#
'GetTopWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd"]),
#
'GetWindowThreadProcessId': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hWnd", "lpdwProcessId"]),
#
'IsGUIThread': SimTypeFunction([SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["bConvert"]),
#
'GetLastActivePopup': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd"]),
#
'GetWindow': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_WINDOW_CMD")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "uCmd"]),
#
'SetWindowsHookA': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["code", "wParam", "lParam"]), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["nFilterType", "pfnFilterProc"]),
#
'SetWindowsHookW': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["code", "wParam", "lParam"]), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["nFilterType", "pfnFilterProc"]),
#
'UnhookWindowsHook': SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["code", "wParam", "lParam"]), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["nCode", "pfnFilterProc"]),
#
'SetWindowsHookExA': SimTypeFunction([SimTypeInt(signed=False, label="WINDOWS_HOOK_ID"), SimTypePointer(SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["code", "wParam", "lParam"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["idHook", "lpfn", "hmod", "dwThreadId"]),
#
'SetWindowsHookExW': SimTypeFunction([SimTypeInt(signed=False, label="WINDOWS_HOOK_ID"), SimTypePointer(SimTypeFunction([SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["code", "wParam", "lParam"]), offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["idHook", "lpfn", "hmod", "dwThreadId"]),
#
'UnhookWindowsHookEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hhk"]),
#
'CallNextHookEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hhk", "nCode", "wParam", "lParam"]),
#
'CheckMenuRadioItem': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hmenu", "first", "last", "check", "flags"]),
#
'LoadCursorA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpCursorName"]),
#
'LoadCursorW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpCursorName"]),
#
'LoadCursorFromFileA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpFileName"]),
#
'LoadCursorFromFileW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpFileName"]),
#
'CreateCursor': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypePointer(SimTypeBottom(label="Void"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInst", "xHotSpot", "yHotSpot", "nWidth", "nHeight", "pvANDPlane", "pvXORPlane"]),
#
'DestroyCursor': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hCursor"]),
#
'SetSystemCursor': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="SYSTEM_CURSOR_ID")], SimTypeInt(signed=True, label="Int32"), arg_names=["hcur", "id"]),
#
'LoadIconA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpIconName"]),
#
'LoadIconW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "lpIconName"]),
#
'PrivateExtractIconsA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["szFileName", "nIconIndex", "cxIcon", "cyIcon", "phicon", "piconid", "nIcons", "flags"]),
#
'PrivateExtractIconsW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), label="LPArray", offset=0), SimTypePointer(SimTypeInt(signed=False, label="UInt32"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["szFileName", "nIconIndex", "cxIcon", "cyIcon", "phicon", "piconid", "nIcons", "flags"]),
#
'CreateIcon': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeChar(label="Byte"), SimTypeChar(label="Byte"), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInstance", "nWidth", "nHeight", "cPlanes", "cBitsPixel", "lpbANDbits", "lpbXORbits"]),
#
'DestroyIcon': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hIcon"]),
#
'LookupIconIdFromDirectory': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["presbits", "fIcon"]),
#
'LookupIconIdFromDirectoryEx': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="IMAGE_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["presbits", "fIcon", "cxDesired", "cyDesired", "Flags"]),
#
'CreateIconFromResource': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["presbits", "dwResSize", "fIcon", "dwVer"]),
#
'CreateIconFromResourceEx': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="IMAGE_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["presbits", "dwResSize", "fIcon", "dwVer", "cxDesired", "cyDesired", "Flags"]),
#
'LoadImageA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="GDI_IMAGE_TYPE"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="IMAGE_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInst", "name", "type", "cx", "cy", "fuLoad"]),
#
'LoadImageW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="GDI_IMAGE_TYPE"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="IMAGE_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hInst", "name", "type", "cx", "cy", "fuLoad"]),
#
'CopyImage': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GDI_IMAGE_TYPE"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="IMAGE_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["h", "type", "cx", "cy", "flags"]),
#
'DrawIconEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="DI_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["hdc", "xLeft", "yTop", "hIcon", "cxWidth", "cyWidth", "istepIfAniCur", "hbrFlickerFreeDraw", "diFlags"]),
#
'CreateIconIndirect': SimTypeFunction([SimTypePointer(SimStruct({"fIcon": SimTypeInt(signed=True, label="Int32"), "xHotspot": SimTypeInt(signed=False, label="UInt32"), "yHotspot": SimTypeInt(signed=False, label="UInt32"), "hbmMask": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmColor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="ICONINFO", pack=False, align=None), offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["piconinfo"]),
#
'CopyIcon': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hIcon"]),
#
'GetIconInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"fIcon": SimTypeInt(signed=True, label="Int32"), "xHotspot": SimTypeInt(signed=False, label="UInt32"), "yHotspot": SimTypeInt(signed=False, label="UInt32"), "hbmMask": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmColor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)}, name="ICONINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hIcon", "piconinfo"]),
#
'GetIconInfoExA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fIcon": SimTypeInt(signed=True, label="Int32"), "xHotspot": SimTypeInt(signed=False, label="UInt32"), "yHotspot": SimTypeInt(signed=False, label="UInt32"), "hbmMask": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmColor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "wResID": SimTypeShort(signed=False, label="UInt16"), "szModName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 260), "szResName": SimTypeFixedSizeArray(SimTypeChar(label="Byte"), 260)}, name="ICONINFOEXA", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hicon", "piconinfo"]),
#
'GetIconInfoExW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "fIcon": SimTypeInt(signed=True, label="Int32"), "xHotspot": SimTypeInt(signed=False, label="UInt32"), "yHotspot": SimTypeInt(signed=False, label="UInt32"), "hbmMask": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hbmColor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "wResID": SimTypeShort(signed=False, label="UInt16"), "szModName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 260), "szResName": SimTypeFixedSizeArray(SimTypeChar(label="Char"), 260)}, name="ICONINFOEXW", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hicon", "piconinfo"]),
#
'IsDialogMessageA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "lpMsg"]),
#
'IsDialogMessageW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "lpMsg"]),
#
'MapDialogRect': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hDlg", "lpRect"]),
#
'DefFrameProcA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "hWndMDIClient", "uMsg", "wParam", "lParam"]),
#
'DefFrameProcW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "hWndMDIClient", "uMsg", "wParam", "lParam"]),
#
'DefMDIChildProcA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "uMsg", "wParam", "lParam"]),
#
'DefMDIChildProcW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hWnd", "uMsg", "wParam", "lParam"]),
#
'TranslateMDISysAccel': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"hwnd": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "message": SimTypeInt(signed=False, label="UInt32"), "wParam": SimTypePointer(SimTypeInt(signed=False, label="UInt"), label="UIntPtr", offset=0), "lParam": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "time": SimTypeInt(signed=False, label="UInt32"), "pt": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="MSG", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hWndClient", "lpMsg"]),
#
'ArrangeIconicWindows': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=False, label="UInt32"), arg_names=["hWnd"]),
#
'CreateMDIWindowA': SimTypeFunction([SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypePointer(SimTypeChar(label="Byte"), offset=0), SimTypeInt(signed=False, label="WINDOW_STYLE"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpClassName", "lpWindowName", "dwStyle", "X", "Y", "nWidth", "nHeight", "hWndParent", "hInstance", "lParam"]),
#
'CreateMDIWindowW': SimTypeFunction([SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypePointer(SimTypeChar(label="Char"), offset=0), SimTypeInt(signed=False, label="WINDOW_STYLE"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["lpClassName", "lpWindowName", "dwStyle", "X", "Y", "nWidth", "nHeight", "hWndParent", "hInstance", "lParam"]),
#
'TileWindows': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="TILE_WINDOWS_HOW"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), label="LPArray", offset=0)], SimTypeShort(signed=False, label="UInt16"), arg_names=["hwndParent", "wHow", "lpRect", "cKids", "lpKids"]),
#
'CascadeWindows': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="CASCADE_WINDOWS_HOW"), SimTypePointer(SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), label="LPArray", offset=0)], SimTypeShort(signed=False, label="UInt16"), arg_names=["hwndParent", "wHow", "lpRect", "cKids", "lpKids"]),
#
'SystemParametersInfoA': SimTypeFunction([SimTypeInt(signed=False, label="SYSTEM_PARAMETERS_INFO_ACTION"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["uiAction", "uiParam", "pvParam", "fWinIni"]),
#
'SystemParametersInfoW': SimTypeFunction([SimTypeInt(signed=False, label="SYSTEM_PARAMETERS_INFO_ACTION"), SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimTypeBottom(label="Void"), offset=0), SimTypeInt(signed=False, label="SYSTEM_PARAMETERS_INFO_UPDATE_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["uiAction", "uiParam", "pvParam", "fWinIni"]),
#
'SoundSentry': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'SetDebugErrorLevel': SimTypeFunction([SimTypeInt(signed=False, label="UInt32")], SimTypeBottom(label="Void"), arg_names=["dwLevel"]),
#
'InternalGetWindowText': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=True, label="Int32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hWnd", "pString", "cchMaxCount"]),
#
'CancelShutdown': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'GetGUIThreadInfo': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "flags": SimTypeInt(signed=False, label="GUITHREADINFO_FLAGS"), "hwndActive": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndFocus": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndCapture": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndMenuOwner": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndMoveSize": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndCaret": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "rcCaret": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None)}, name="GUITHREADINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["idThread", "pgui"]),
#
'SetProcessDPIAware': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'IsProcessDPIAware': SimTypeFunction([], SimTypeInt(signed=True, label="Int32")),
#
'InheritWindowMonitor': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "hwndInherit"]),
#
'GetDpiAwarenessContextForProcess': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hProcess"]),
#
'GetWindowModuleFileNameA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hwnd", "pszFileName", "cchFileNameMax"]),
#
'GetWindowModuleFileNameW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hwnd", "pszFileName", "cchFileNameMax"]),
#
'GetCursorInfo': SimTypeFunction([SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "flags": SimTypeInt(signed=False, label="CURSORINFO_FLAGS"), "hCursor": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "ptScreenPos": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="CURSORINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["pci"]),
#
'GetWindowInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "rcWindow": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rcClient": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "dwStyle": SimTypeInt(signed=False, label="UInt32"), "dwExStyle": SimTypeInt(signed=False, label="UInt32"), "dwWindowStatus": SimTypeInt(signed=False, label="UInt32"), "cxWindowBorders": SimTypeInt(signed=False, label="UInt32"), "cyWindowBorders": SimTypeInt(signed=False, label="UInt32"), "atomWindowType": SimTypeShort(signed=False, label="UInt16"), "wCreatorVersion": SimTypeShort(signed=False, label="UInt16")}, name="WINDOWINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "pwi"]),
#
'GetTitleBarInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "rcTitleBar": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "rgstate": SimTypeFixedSizeArray(SimTypeInt(signed=False, label="UInt32"), 6)}, name="TITLEBARINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "pti"]),
#
'GetMenuBarInfo': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="OBJECT_IDENTIFIER"), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "rcBar": SimStruct({"left": SimTypeInt(signed=True, label="Int32"), "top": SimTypeInt(signed=True, label="Int32"), "right": SimTypeInt(signed=True, label="Int32"), "bottom": SimTypeInt(signed=True, label="Int32")}, name="RECT", pack=False, align=None), "hMenu": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "hwndMenu": SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), "_bitfield": SimTypeInt(signed=True, label="Int32")}, name="MENUBARINFO", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "idObject", "idItem", "pmbi"]),
#
'GetAncestor': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="GET_ANCESTOR_FLAGS")], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hwnd", "gaFlags"]),
#
'RealChildWindowFromPoint': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)], SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), arg_names=["hwndParent", "ptParentClientCoords"]),
#
'RealGetWindowClassA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hwnd", "ptszClassName", "cchClassNameMax"]),
#
'RealGetWindowClassW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=False, label="UInt32"), arg_names=["hwnd", "ptszClassName", "cchClassNameMax"]),
#
'GetAltTabInfoA': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "cItems": SimTypeInt(signed=True, label="Int32"), "cColumns": SimTypeInt(signed=True, label="Int32"), "cRows": SimTypeInt(signed=True, label="Int32"), "iColFocus": SimTypeInt(signed=True, label="Int32"), "iRowFocus": SimTypeInt(signed=True, label="Int32"), "cxItem": SimTypeInt(signed=True, label="Int32"), "cyItem": SimTypeInt(signed=True, label="Int32"), "ptStart": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="ALTTABINFO", pack=False, align=None), offset=0), SimTypePointer(SimTypeChar(label="Byte"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "iItem", "pati", "pszItemText", "cchItemText"]),
#
'GetAltTabInfoW': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=True, label="Int32"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "cItems": SimTypeInt(signed=True, label="Int32"), "cColumns": SimTypeInt(signed=True, label="Int32"), "cRows": SimTypeInt(signed=True, label="Int32"), "iColFocus": SimTypeInt(signed=True, label="Int32"), "iRowFocus": SimTypeInt(signed=True, label="Int32"), "cxItem": SimTypeInt(signed=True, label="Int32"), "cyItem": SimTypeInt(signed=True, label="Int32"), "ptStart": SimStruct({"x": SimTypeInt(signed=True, label="Int32"), "y": SimTypeInt(signed=True, label="Int32")}, name="POINT", pack=False, align=None)}, name="ALTTABINFO", pack=False, align=None), offset=0), SimTypePointer(SimTypeChar(label="Char"), label="LPArray", offset=0), SimTypeInt(signed=False, label="UInt32")], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "iItem", "pati", "pszItemText", "cchItemText"]),
#
'ChangeWindowMessageFilter': SimTypeFunction([SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="CHANGE_WINDOW_MESSAGE_FILTER_FLAGS")], SimTypeInt(signed=True, label="Int32"), arg_names=["message", "dwFlag"]),
#
'ChangeWindowMessageFilterEx': SimTypeFunction([SimTypePointer(SimTypeInt(signed=True, label="Int"), label="IntPtr", offset=0), SimTypeInt(signed=False, label="UInt32"), SimTypeInt(signed=False, label="WINDOW_MESSAGE_FILTER_ACTION"), SimTypePointer(SimStruct({"cbSize": SimTypeInt(signed=False, label="UInt32"), "ExtStatus": SimTypeInt(signed=False, label="MSGFLTINFO_STATUS")}, name="CHANGEFILTERSTRUCT", pack=False, align=None), offset=0)], SimTypeInt(signed=True, label="Int32"), arg_names=["hwnd", "message", "action", "pChangeFilterStruct"]),
}
lib.set_prototypes(prototypes)
| [
"[email protected]"
] | |
1f18bb4f0f316c64abea5e788982bfbf7ef4a0b5 | 54f63580a298ffa63520771c734f5b6dd15894bc | /edabit/4_Hard/Next_Prime.py | 1db7b12fc4d3d66d64f66a33297fbc19c046eedb | [] | no_license | CKMaxwell/Python_online_challenge | 048d24128b588d1af3db03379fb462cf7ea908a9 | f13444612d93cf98aff760a6ff01d82a18082725 | refs/heads/master | 2023-01-03T20:19:27.001425 | 2020-10-26T18:25:07 | 2020-10-26T18:25:07 | 287,968,703 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 396 | py | # 20201005 - Next Prime
def next_prime(num):
def prime(current):
check = True
for i in range(2, current//2):
if current % i == 0:
check = False
return check
if prime(num) == True:
return num
else:
while True:
num += 1
if prime(num) == True:
return num
print(next_prime(24)) | [
"[email protected]"
] | |
622309d302fd71704671b8141ad4a809f708f03b | 2293c76c3d18e2fcd44ded90bd40113d26285663 | /pyeccodes/defs/mars/grib_oper_4i_def.py | c153a52e4f1916249797f9519a5d607539773564 | [
"Apache-2.0"
] | permissive | ecmwf/pyeccodes | b1f121dbddf68d176a03805ed5144ba0b37ac211 | dce2c72d3adcc0cb801731366be53327ce13a00b | refs/heads/master | 2022-04-23T10:37:40.524078 | 2020-04-18T06:30:29 | 2020-04-18T06:30:29 | 255,554,540 | 9 | 3 | null | null | null | null | UTF-8 | Python | false | false | 97 | py | import pyeccodes.accessors as _
def load(h):
h.alias('mars.iteration', 'iterationNumber')
| [
"[email protected]"
] | |
dc3186d2a2455dc2d0a0a9cff49870a71018fe2c | fb86f0dca6e525b8a8ddb63f10b8d220ddd7f7fe | /test/functional/rpc_users.py | e0e558491976166d2bcf20a7ad60b036f1e5687b | [
"MIT"
] | permissive | ORO-mlm/UNO-Core | 14fcdb3c2db4bde256e48ea661ada61579ccf403 | d6e6769ce57466cfc9e7cab681eab880cdb8e3e8 | refs/heads/main | 2023-06-16T08:21:00.808606 | 2021-07-12T07:08:35 | 2021-07-12T07:08:35 | 383,350,655 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,951 | py | #!/usr/bin/env python3
# Copyright (c) 2015-2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test multiple RPC users."""
from test_framework.test_framework import UnoTestFramework
from test_framework.util import str_to_b64str, assert_equal
import os
import http.client
import urllib.parse
class HTTPBasicsTest (UnoTestFramework):
def set_test_params(self):
self.num_nodes = 2
def setup_chain(self):
super().setup_chain()
#Append rpcauth to uno.conf before initialization
rpcauth = "rpcauth=rt:93648e835a54c573682c2eb19f882535$7681e9c5b74bdd85e78166031d2058e1069b3ed7ed967c93fc63abba06f31144"
rpcauth2 = "rpcauth=rt2:f8607b1a88861fac29dfccf9b52ff9f$ff36a0c23c8c62b4846112e50fa888416e94c17bfd4c42f88fd8f55ec6a3137e"
rpcuser = "rpcuser=rpcuser�"
rpcpassword = "rpcpassword=rpcpassword�"
with open(os.path.join(self.options.tmpdir+"/node0", "uno.conf"), 'a', encoding='utf8') as f:
f.write(rpcauth+"\n")
f.write(rpcauth2+"\n")
with open(os.path.join(self.options.tmpdir+"/node1", "uno.conf"), 'a', encoding='utf8') as f:
f.write(rpcuser+"\n")
f.write(rpcpassword+"\n")
def run_test(self):
##################################################
# Check correctness of the rpcauth config option #
##################################################
url = urllib.parse.urlparse(self.nodes[0].url)
#Old authpair
authpair = url.username + ':' + url.password
#New authpair generated via share/rpcuser tool
password = "cA773lm788buwYe4g4WT+05pKyNruVKjQ25x3n0DQcM="
#Second authpair with different username
password2 = "8/F3uMDw4KSEbw96U3CA1C4X05dkHDN2BPFjTgZW4KI="
authpairnew = "rt:"+password
headers = {"Authorization": "Basic " + str_to_b64str(authpair)}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
resp = conn.getresponse()
assert_equal(resp.status, 200)
conn.close()
#Use new authpair to confirm both work
headers = {"Authorization": "Basic " + str_to_b64str(authpairnew)}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
resp = conn.getresponse()
assert_equal(resp.status, 200)
conn.close()
#Wrong login name with rt's password
authpairnew = "rtwrong:"+password
headers = {"Authorization": "Basic " + str_to_b64str(authpairnew)}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
resp = conn.getresponse()
assert_equal(resp.status, 401)
conn.close()
#Wrong password for rt
authpairnew = "rt:"+password+"wrong"
headers = {"Authorization": "Basic " + str_to_b64str(authpairnew)}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
resp = conn.getresponse()
assert_equal(resp.status, 401)
conn.close()
#Correct for rt2
authpairnew = "rt2:"+password2
headers = {"Authorization": "Basic " + str_to_b64str(authpairnew)}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
resp = conn.getresponse()
assert_equal(resp.status, 200)
conn.close()
#Wrong password for rt2
authpairnew = "rt2:"+password2+"wrong"
headers = {"Authorization": "Basic " + str_to_b64str(authpairnew)}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
resp = conn.getresponse()
assert_equal(resp.status, 401)
conn.close()
###############################################################
# Check correctness of the rpcuser/rpcpassword config options #
###############################################################
url = urllib.parse.urlparse(self.nodes[1].url)
# rpcuser and rpcpassword authpair
rpcuserauthpair = "rpcuser�:rpcpassword�"
headers = {"Authorization": "Basic " + str_to_b64str(rpcuserauthpair)}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
resp = conn.getresponse()
assert_equal(resp.status, 200)
conn.close()
#Wrong login name with rpcuser's password
rpcuserauthpair = "rpcuserwrong:rpcpassword"
headers = {"Authorization": "Basic " + str_to_b64str(rpcuserauthpair)}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
resp = conn.getresponse()
assert_equal(resp.status, 401)
conn.close()
#Wrong password for rpcuser
rpcuserauthpair = "rpcuser:rpcpasswordwrong"
headers = {"Authorization": "Basic " + str_to_b64str(rpcuserauthpair)}
conn = http.client.HTTPConnection(url.hostname, url.port)
conn.connect()
conn.request('POST', '/', '{"method": "getbestblockhash"}', headers)
resp = conn.getresponse()
assert_equal(resp.status, 401)
conn.close()
if __name__ == '__main__':
HTTPBasicsTest ().main ()
| [
"[email protected]"
] | |
c0e2d24a1bc7297c88a9beb74ab0133e4e5aac89 | 9556f7e1d81a305d71a66b9768eba199e396d733 | /CloudVerify/hz_topic/plot.py | 447e8168a5f86e890edab291b63a8088f90bc23a | [] | no_license | gitgaoqian/Python | 301a2823b50ec754a2c1a3f47c39ae8b0b8e6890 | 164f5271044b235d256a9bbe0a34caacf1e81fc8 | refs/heads/master | 2023-01-08T21:23:59.640828 | 2020-11-01T13:06:21 | 2020-11-01T13:06:21 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,121 | py | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 17 20:41:36 2018
@author: ros
"""
import matplotlib.pyplot as plt
def load_data(fileName):
inFile = open(fileName, 'r')
t=[]
rate=[]
num=1
for line in inFile:
t.append(num) #第一部分,即文件中的第一列数据逐一添加到list X 中
rate.append(float(line.strip('\n'))) #第二部分,即文件中的第二列数据逐一添加到list y 中
num=num+1
return (t, rate) # X,y组成一个元组,这样可以通过函数一次性返回
def main():
filename='/home/ros/image1.txt'
[x,y]=load_data(filename)
plt.figure()
plt.plot(x,y,color='b', linewidth=1.5, linestyle='--',label='/camera/left/image_raw')
filename='/home/ros/image1.txt'
[x,y]=load_data(filename)
plt.plot(x,y,color='r', linewidth=1.5, linestyle='--', label='/camera/scan')
plt.xlabel('t')
plt.xlim(0,175)
plt.ylabel('rate')
plt.ylim((0, 12))
plt.title("The rate of topic")
plt.legend(loc='upper right')
plt.savefig(filename+'.pdf')
plt.show()
if __name__ == '__main__':
main()
| [
"[email protected]"
] | |
ed902afbfae4296e1b7fd7cc37f83453df65e33c | 0937646b6ce9249a8d193987f308ce398dc28bd1 | /statistics.py | 4a51b15c3db32e5303a16077cf08ea2c86d4f3e8 | [] | no_license | barry800414/JobTitleNLP | 98622d02b25b1418f28698f7d772c8de96642032 | b379c2052447e6483d17f5db51fb918b37ac7a52 | refs/heads/master | 2021-06-08T19:36:39.044757 | 2016-10-21T03:11:10 | 2016-10-21T03:11:10 | 66,043,111 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 917 | py |
import sys, json
from collections import defaultdict
from getCat import *
with open('jobs.min.json', 'r') as f:
data = json.load(f)
with open('104RawCategory.json', 'r') as f:
rawCat = json.load(f)
to2 = getL3ToL2(rawCat)
to1 = getL2ToL1(rawCat)
L3Cnt = dict()
L2Cnt = defaultdict(int)
L1Cnt = defaultdict(int)
for L3 in data.keys():
L3Cnt[L3] = len(data[L3])
L2Cnt[to2[L3]] += L3Cnt[L3]
L1Cnt[to1[to2[L3]]] += L3Cnt[L3]
with open('L1.csv', 'w') as f:
for name, cnt in sorted(list(L1Cnt.items()), key=lambda x:x[1], reverse=True):
print(name, cnt, sep=',', file=f)
with open('L2.csv', 'w') as f:
for name, cnt in sorted(list(L2Cnt.items()), key=lambda x:x[1], reverse=True):
print(name, cnt, sep=',', file=f)
with open('L3.csv', 'w') as f:
for name, cnt in sorted(list(L3Cnt.items()), key=lambda x:x[1], reverse=True):
print(name, cnt, sep=',', file=f) | [
"[email protected]"
] | |
4581ca0ff8deedc11195f9b9e61bd3b02094bc6a | f4dcb14111539e9a22300256fd6f8fefc61f2d50 | /src/flua/Compiler/Output/cpp/CPPNamespace.py | dc0efdf08384a361bdec9fa561fa5145d8bb7ac0 | [] | no_license | GWRon/flua | 276c3ea4ce1cfcf68a1000fb44512460b5161c4e | 1cf051f1d5aec3ba4da48442a0d7257d399e5b36 | refs/heads/master | 2021-01-15T17:37:03.914965 | 2012-10-24T12:57:27 | 2012-10-24T12:57:27 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,462 | py | ####################################################################
# Header
####################################################################
# File: Namespace class
# Author: Eduard Urbach
####################################################################
# License
####################################################################
# (C) 2012 Eduard Urbach
#
# This file is part of Blitzprog.
#
# Blitzprog is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Blitzprog is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Blitzprog. If not, see <http://www.gnu.org/licenses/>.
####################################################################
# Imports
####################################################################
from flua.Compiler.Output import *
####################################################################
# Classes
####################################################################
class CPPNamespace(BaseNamespace):
def __init__(self, name):
super().__init__(name)
| [
"[email protected]"
] | |
ec65f29f39de790b1e38281d3dde053db6f88073 | 4ed5069638a0e684e8e813e4ef34dcfd1b68cd74 | /boj/python/9012.py | 23dfb7c5b49336d327f0b59ebfdff9939db6a327 | [] | no_license | youngerous/algorithm | 11dafe9c54edf83646c915c59b1d7d4d18569005 | fe599d958fdf51b956d2250088a3d5f1c5b22854 | refs/heads/master | 2022-01-27T02:12:49.237009 | 2022-01-16T12:29:40 | 2022-01-16T12:29:40 | 133,662,997 | 1 | 1 | null | null | null | null | UTF-8 | Python | false | false | 501 | py | from sys import stdin
input = stdin.readline
N = int(input())
for _ in range(N):
ps = input().strip()
if ps.count("(") != ps.count(")"):
print("NO")
continue
# 처음부터 stack을 int 0으로 할당하면 시간을 더 줄일 수 있을 것
stack = []
try:
for each in ps:
stack.append(each) if each == "(" else stack.pop()
except Exception as e:
print("NO")
continue
print("YES") if len(stack) == 0 else print("NO")
| [
"[email protected]"
] | |
56de0b2bcdbe8b60bea7a9548e1e13342bb60ec4 | 5d7a3dc27540e04e5cb9c8f4742830c7fca188f0 | /StudentsWork/John_Chan/nvramscrub.py | bf6352993ad50cc77eaa86d8f332f5335355b2ff | [] | no_license | PythonCHB/PythonIntroClass | 1986e553390c6f3504e279cda23744ceacc3a292 | b49d41bd04696d45ef4394b489de408cbd3b3d32 | refs/heads/master | 2020-12-24T17:35:31.408292 | 2014-10-16T18:09:21 | 2014-10-16T18:09:21 | 4,633,372 | 9 | 2 | null | null | null | null | UTF-8 | Python | false | false | 10,182 | py | import isi.app.lib.procs as procs
import isi.hw.hal as hal
import isi.hw.version as hwver
import isi.hw.check.lib.filenames as files
import isi.hw.check.lib.log as loglib
import isi.hw.check.lib.misc as misc
import isi.hw.check.lib.nvram as nvram
import isi.hw.check.lib.ramdisk as ramdisk
import isi.hw.check.lib.syslog as sysloglib
# jcc start
import sys
import signal
import time
import isi.hw.check.mfg.consts as consts
start_time = time.time()
abs_starttime = start_time
consts_nvramscrub = consts.nvramscrub_target_run_time()['long'] # jcc
#import pdb; pdb.set_trace() #jcc
target_run_time = int ( consts_nvramscrub['target_run_time'] ) # jcc
# jcc end
pass_str = 'nvram scrub passed'
default_reps = 10
# maxtime?
def run(reps = None, sections = 125, checkpoint = 0):
log = loglib.get_logger()
ramdir = ramdisk.disk_dir()
nvramdev = hal.getNvramDevicePath()
randfile = '/dev/random'
blocksize = 1024 * 1024 # see dd cmd, bs=1024k
nvramsize = nvram.get_nvram_size()
expd_nvramsizes = nvram.get_nvram_sizes()
if not nvramdev:
log.fail("No nvram device available for test", 0)
return
if not expd_nvramsizes:
log.fail("No official nvram specs for hardware family '%s'" %
hwver.hwgenName(hwver.hwgen), 0)
return
# Validate or prompt for reps
if reps != None:
try:
reps = int(reps)
if reps <= 0:
raise ValueError()
except ValueError:
log.fail('Invalid reps parameter (%s)' % reps)
return # hard fail
else:
while 1:
reps = log.prompt('Iteration count (%d): ' %
default_reps)
if reps == '':
reps = default_reps
try:
reps = int(reps)
if reps <= 0:
raise ValueError()
log.out('')
break
except ValueError:
log.out('Invalid iteration count; please enter a positive ' +
'integer')
# Init the ram disk (moved from isi_mfg_check script)
# XXX This ramdisk lib is crap, and needs serious attention
ramdisk.init()
log.out('')
# clear ECC counts to 0 before test
if nvram.pre_test_clear_ecc_errors():
return # hard fail
log.out('')
# Open the nvram log file for appending. After writing to it, be
# sure to flush it before any calls to 'echo xyz >> loglib.nvram_log()',
# otherwise output can get out of sync.
try:
nvramlog = open(loglib.nvram_log(), 'a')
except IOError:
log.fail('Unable to open nvram log file for appending: %s' %
loglib.nvram_log(), 0)
return # hard fail
def nvramlogwrite(output):
if isinstance(output, basestring):
output = [output]
for out in output:
nvramlog.write("%s\n" % out)
nvramlog.flush()
def testString(iter, sec=None):
test = "Test %d of %d" % (iter+1, reps)
if not sec is None:
test += ": sec %d:" % (sec)
return test
def ddexec(iter, sec, ddcmd):
cmd = 'dd if=%s of=%s bs=1024k count=4' % (ddcmd['if'], ddcmd['of'])
if ddcmd['option']:
cmd += ' %s' % ddcmd['option']
# Note previously this cmd was piped: 1>/dev/null 2>/dev/null
(error, output) = procs.get_cmd_output(cmd)
try:
outerr = output[0]
except:
outerr = ''
if error:
out_str = ('%s: dd from %s to %s failed: %s' %
(testString(iter,sec), ddcmd['src'], ddcmd['dest'],
outerr))
log.fail(out_str, 0)
# Push dd output to logfile
output.insert(0, out_str)
nvramlogwrite(output)
return error
def checkjournal(iter, start=True):
# Uses: nvramlog, log, reps, checkpoint
error = 0
if iter >= checkpoint or iter == -1:
if iter == -1:
test = 'Pre-Test'
out_str = ('%s -- checking journal' % test)
else:
test = testString(iter)
out_str = ('%s -- checking journal (%s)' %
(test, start and "start" or "end"))
log.out(out_str)
nvramlogwrite(out_str)
cmd = files.commands['checkjournal']
def echo_func(x):
nvramlog.write('%s\n' % x)
nvramlog.flush()
(error, output) = procs.proc_cmd_output(cmd, echo_func)
nvramlog.flush()
if not error:
volt_fails = nvram.extract_voltage_failures(output)
if error or volt_fails:
error = 1
out_str = '%s: Journal check failed' % test
#procs.get_cmd_output('echo %s >> %s' %
# (out_str, loglib.nvram_log()))
#nvramlog.flush()
nvramlogwrite(out_str)
log.fail('%s; see %s file for details' %
(out_str, loglib.nvram_log()), 0)
return error
nvramlogwrite([
"nvramscrub: reps=%s, sections=%s, checkpoint=%s" %
(reps, sections, checkpoint),
"nvramscrub: ramdir=%s nvramdev=%s randfile=%s" %
(ramdir, nvramdev, randfile),
"",
])
fail_count = 0
# Tag the syslog with a marker to wrap the test; used for
# extract_syslog_entries reporting, see end of test.
syslog_marker = sysloglib.init_syslog_marker('nvramscrub')
# Do an initial sanity checkjournal, first
if checkjournal(iter=-1):
fail_count += 1
log.fail('Pre-Test NVRAM checkjournal errors detected', 0)
log.out('')
# We have a protection limit on dd offsets to prevent dd errors:
# /dev/mnv0: end of device
# We rely on reported nvram size from hwver; This is checked
# independently by safe.id.nvram, but go ahead and report a failure here
# (once!) if testing would exceed this limit AND reported size mismatch
# the expected safe.id.nvram values.
out_str = 'Pre-Test -- checking NVRAM size limits'
log.out(out_str)
nvramlogwrite(out_str)
# max(s in sections loop) = sections-1, but r=s+1, so max(r)=sections
start_max = blocksize * (sections*4)
if start_max >= nvramsize:
# If reported nvramsize is less than expected, report failure
if start_max < min(expd_nvramsizes):
out_strs = ['- Unable to test at max dd skip offset %dB:' %
start_max,
'- Detected NVRAM size %dB, Expected %s' %
(nvramsize, misc.should_be(map(lambda s: '%dB' % s,
expd_nvramsizes)))]
for out_str in out_strs:
log.fail(out_str, 0)
nvramlogwrite(out_str)
fail_count += 1
abs_starttime = time.time() #jcc
# Run the test loop
log.out('[nvramscrub] start: target_run_time=%s seconds' % ( target_run_time ))
#print "jcc nvramscrub: start_time '" + str( time.time() ) + "' seconds"
for i in range(reps):
failed = False
r = 0
log.out('%s -- scrubbing journal' % testString(i))
# jcc start
time_now = time.time() - abs_starttime
time_remain = target_run_time - time_now
if ( time_now < target_run_time ):
# #print "jcc lcdscrub: remaining_time '" + str( time_remain ) + "' seconds"
pass
else:
log.out('[nvramsrub] end: target_run_time=%s seconds is reached, exited' % (target_run_time))
if fail_count > 0:
log.fail('Test failed')
else:
log.out('All tests succeeded')
return
if checkjournal(i, start=True):
failed = True
for s in range(sections):
r += 1
start = blocksize * (r*4)
if start >= nvramsize:
# Don't dd, will get error: /dev/mnv0: end of device
continue
writefile = '%s/randfilewrite%d%d' % (ramdir, i, s)
readfile = '%s/randfileread%d%d' % (ramdir, i, s)
ddcommands = [
{ 'src': randfile, 'dest': 'ramdisk',
'if': randfile, 'of': writefile, 'option': None,
},
{ 'src': 'ramdisk', 'dest': 'nvram',
'if': writefile, 'of': nvramdev, 'option': "seek=%d" % (r*4),
},
{ 'src': 'nvram', 'dest': 'ramdisk',
'if': nvramdev, 'of': readfile, 'option': "skip=%d" % (r*4),
},
]
for ddcmd in ddcommands:
error = ddexec(i, s, ddcmd)
if error:
failed = True
break
# Compare results, if successful dd's above
if not error:
cmd = 'diff %s %s' % (readfile, writefile)
(error, output) = procs.get_cmd_output(cmd)
if error:
failed = True
out_str = '%s: dd result diff failed:' % testString(i,s)
log.fail(out_str, 0)
# Push failure message to logfile
nvramlogwrite(out_str)
# Cleanup ramdisk - Always
procs.get_cmd_output('rm -f %s %s 1> /dev/null 2> /dev/null' %
(readfile, writefile))
if checkjournal(i, start=False):
failed = True
if failed:
fail_count += 1
if fail_count > 0:
log.fail('%d of %d tests failed' % (fail_count, reps), 0)
# Check NVRAM for ECC errors
if nvram.post_test_check_ecc_errors():
fail_count += 1
# Check syslog for NVRAM ECC errors
if nvram.check_nvram_syslog_errors(marker=syslog_marker):
fail_count += 1
log.out('')
if fail_count > 0:
log.fail('Test failed')
else:
log.out('All tests succeeded')
| [
"[email protected]"
] | |
692841366fdad59ec8bf6e644ed7a843673fbc53 | 4c61f3bc0620758224bca72d4edec2707b41ecf0 | /tests/test_victorspx.py | a586ffc0109f6fa13675f07e23206ea903e99df4 | [
"LicenseRef-scancode-unknown-license-reference",
"Apache-2.0"
] | permissive | CrispyBacon1999/robotpy-ctre | 6b5ec68606e5b9094669e468fb4f01cd27f05c9d | b57346dda3de46c6f3bf25dddfe166fbf192846f | refs/heads/master | 2020-12-11T11:47:28.578527 | 2020-01-02T00:35:29 | 2020-01-02T00:35:29 | 233,840,408 | 0 | 0 | NOASSERTION | 2020-01-14T12:50:12 | 2020-01-14T12:50:11 | null | UTF-8 | Python | false | false | 424 | py | import pytest
@pytest.fixture(scope="function")
def victor(ctre):
return ctre.WPI_VictorSPX(1)
@pytest.fixture(scope="function")
def cdata(victor, hal_data):
return hal_data["CAN"][1]
def test_victor_init(ctre, hal_data):
assert 1 not in hal_data["CAN"]
ctre.WPI_VictorSPX(1)
assert 1 in hal_data["CAN"]
assert hal_data["CAN"][1]["type"] == "victorspx"
# Victor tests are covered by TalonSRX
| [
"[email protected]"
] | |
a3cd45f7e1323072104c4dc2f72039b303b36d0c | 7ee3aefd7e9d934b18c615b18f50fa25badc8f2a | /tests/test_items.py | c34804df473c9117934e2ab0c1281b1e865249b8 | [
"BSD-2-Clause"
] | permissive | dmcgee/exchangelib | d2074e394bcf91165d2d3c0fe83011da105635f4 | b2f7006835393132bdf2cfb416ba44f847c8bbf2 | refs/heads/master | 2020-12-04T06:34:03.377437 | 2020-01-03T14:17:33 | 2020-01-03T14:18:02 | 231,658,419 | 0 | 0 | BSD-2-Clause | 2020-01-03T20:15:41 | 2020-01-03T20:15:40 | null | UTF-8 | Python | false | false | 120,893 | py | # coding=utf-8
import datetime
from decimal import Decimal
from email.mime.multipart import MIMEMultipart
from email.mime.text import MIMEText
from keyword import kwlist
import time
import unittest
import unittest.util
from dateutil.relativedelta import relativedelta
from exchangelib.account import SAVE_ONLY, SEND_ONLY, SEND_AND_SAVE_COPY
from exchangelib.attachments import ItemAttachment
from exchangelib.errors import ErrorItemNotFound, ErrorInvalidOperation, ErrorInvalidChangeKey, \
ErrorUnsupportedPathForQuery, ErrorInvalidValueForProperty, ErrorPropertyUpdate, ErrorInvalidPropertySet, \
ErrorInvalidIdMalformed
from exchangelib.ewsdatetime import EWSDateTime, EWSDate, EWSTimeZone, UTC, UTC_NOW
from exchangelib.extended_properties import ExtendedProperty, ExternId
from exchangelib.fields import TextField, BodyField, ExtendedPropertyField, FieldPath, CultureField, IdField, \
CharField, ChoiceField, AttachmentField, BooleanField, MONDAY, WEDNESDAY
from exchangelib.folders import Calendar, Inbox, Tasks, Contacts, Folder, FolderCollection
from exchangelib.indexed_properties import EmailAddress, PhysicalAddress, SingleFieldIndexedElement, \
MultiFieldIndexedElement
from exchangelib.items import Item, CalendarItem, Message, Contact, Task, DistributionList, Persona, BaseItem
from exchangelib.properties import Mailbox, Member, Attendee
from exchangelib.queryset import QuerySet, DoesNotExist, MultipleObjectsReturned
from exchangelib.recurrence import Recurrence, WeeklyPattern, FirstOccurrence, LastOccurrence
from exchangelib.restriction import Restriction, Q
from exchangelib.services import GetPersona
from exchangelib.util import value_to_xml_text
from exchangelib.version import Build, EXCHANGE_2007, EXCHANGE_2013
from .common import EWSTest, TimedTestCase, get_random_string, get_random_datetime_range, get_random_date, \
get_random_email, get_random_decimal, get_random_choice, mock_version
class ItemTest(TimedTestCase):
def test_task_validation(self):
tz = EWSTimeZone.timezone('Europe/Copenhagen')
task = Task(due_date=tz.localize(EWSDateTime(2017, 1, 1)), start_date=tz.localize(EWSDateTime(2017, 2, 1)))
task.clean()
# We reset due date if it's before start date
self.assertEqual(task.due_date, tz.localize(EWSDateTime(2017, 2, 1)))
self.assertEqual(task.due_date, task.start_date)
task = Task(complete_date=tz.localize(EWSDateTime(2099, 1, 1)), status=Task.NOT_STARTED)
task.clean()
# We reset status if complete_date is set
self.assertEqual(task.status, Task.COMPLETED)
# We also reset complete date to now() if it's in the future
self.assertEqual(task.complete_date.date(), UTC_NOW().date())
task = Task(complete_date=tz.localize(EWSDateTime(2017, 1, 1)), start_date=tz.localize(EWSDateTime(2017, 2, 1)))
task.clean()
# We also reset complete date to start_date if it's before start_date
self.assertEqual(task.complete_date, task.start_date)
task = Task(percent_complete=Decimal('50.0'), status=Task.COMPLETED)
task.clean()
# We reset percent_complete to 100.0 if state is completed
self.assertEqual(task.percent_complete, Decimal(100))
task = Task(percent_complete=Decimal('50.0'), status=Task.NOT_STARTED)
task.clean()
# We reset percent_complete to 0.0 if state is not_started
self.assertEqual(task.percent_complete, Decimal(0))
class BaseItemTest(EWSTest):
TEST_FOLDER = None
FOLDER_CLASS = None
ITEM_CLASS = None
@classmethod
def setUpClass(cls):
if cls is BaseItemTest:
raise unittest.SkipTest("Skip BaseItemTest, it's only for inheritance")
super(BaseItemTest, cls).setUpClass()
def setUp(self):
super(BaseItemTest, self).setUp()
self.test_folder = getattr(self.account, self.TEST_FOLDER)
self.assertEqual(type(self.test_folder), self.FOLDER_CLASS)
self.assertEqual(self.test_folder.DISTINGUISHED_FOLDER_ID, self.TEST_FOLDER)
self.test_folder.filter(categories__contains=self.categories).delete()
def tearDown(self):
self.test_folder.filter(categories__contains=self.categories).delete()
# Delete all delivery receipts
self.test_folder.filter(subject__startswith='Delivered: Subject: ').delete()
super(BaseItemTest, self).tearDown()
def get_random_insert_kwargs(self):
insert_kwargs = {}
for f in self.ITEM_CLASS.FIELDS:
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if f.is_read_only:
# These cannot be created
continue
if f.name == 'mime_content':
# This needs special formatting. See separate test_mime_content() test
continue
if f.name == 'attachments':
# Testing attachments is heavy. Leave this to specific tests
insert_kwargs[f.name] = []
continue
if f.name == 'resources':
# The test server doesn't have any resources
insert_kwargs[f.name] = []
continue
if f.name == 'optional_attendees':
# 'optional_attendees' and 'required_attendees' are mutually exclusive
insert_kwargs[f.name] = None
continue
if f.name == 'start':
start = get_random_date()
insert_kwargs[f.name], insert_kwargs['end'] = \
get_random_datetime_range(start_date=start, end_date=start, tz=self.account.default_timezone)
insert_kwargs['recurrence'] = self.random_val(self.ITEM_CLASS.get_field_by_fieldname('recurrence'))
insert_kwargs['recurrence'].boundary.start = insert_kwargs[f.name].date()
continue
if f.name == 'end':
continue
if f.name == 'recurrence':
continue
if f.name == 'due_date':
# start_date must be before due_date
insert_kwargs['start_date'], insert_kwargs[f.name] = \
get_random_datetime_range(tz=self.account.default_timezone)
continue
if f.name == 'start_date':
continue
if f.name == 'status':
# Start with an incomplete task
status = get_random_choice(set(f.supported_choices(version=self.account.version)) - {Task.COMPLETED})
insert_kwargs[f.name] = status
if status == Task.NOT_STARTED:
insert_kwargs['percent_complete'] = Decimal(0)
else:
insert_kwargs['percent_complete'] = get_random_decimal(1, 99)
continue
if f.name == 'percent_complete':
continue
insert_kwargs[f.name] = self.random_val(f)
return insert_kwargs
def get_random_update_kwargs(self, item, insert_kwargs):
update_kwargs = {}
now = UTC_NOW()
for f in self.ITEM_CLASS.FIELDS:
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if f.is_read_only:
# These cannot be changed
continue
if not item.is_draft and f.is_read_only_after_send:
# These cannot be changed when the item is no longer a draft
continue
if f.name == 'message_id' and f.is_read_only_after_send:
# Cannot be updated, regardless of draft status
continue
if f.name == 'attachments':
# Testing attachments is heavy. Leave this to specific tests
update_kwargs[f.name] = []
continue
if f.name == 'resources':
# The test server doesn't have any resources
update_kwargs[f.name] = []
continue
if isinstance(f, AttachmentField):
# Attachments are handled separately
continue
if f.name == 'start':
start = get_random_date(start_date=insert_kwargs['end'].date())
update_kwargs[f.name], update_kwargs['end'] = \
get_random_datetime_range(start_date=start, end_date=start, tz=self.account.default_timezone)
update_kwargs['recurrence'] = self.random_val(self.ITEM_CLASS.get_field_by_fieldname('recurrence'))
update_kwargs['recurrence'].boundary.start = update_kwargs[f.name].date()
continue
if f.name == 'end':
continue
if f.name == 'recurrence':
continue
if f.name == 'due_date':
# start_date must be before due_date, and before complete_date which must be in the past
update_kwargs['start_date'], update_kwargs[f.name] = \
get_random_datetime_range(end_date=now.date(), tz=self.account.default_timezone)
continue
if f.name == 'start_date':
continue
if f.name == 'status':
# Update task to a completed state. complete_date must be a date in the past, and < than start_date
update_kwargs[f.name] = Task.COMPLETED
update_kwargs['percent_complete'] = Decimal(100)
continue
if f.name == 'percent_complete':
continue
if f.name == 'reminder_is_set':
if self.ITEM_CLASS == Task:
# Task type doesn't allow updating 'reminder_is_set' to True
update_kwargs[f.name] = False
else:
update_kwargs[f.name] = not insert_kwargs[f.name]
continue
if isinstance(f, BooleanField):
update_kwargs[f.name] = not insert_kwargs[f.name]
continue
if f.value_cls in (Mailbox, Attendee):
if insert_kwargs[f.name] is None:
update_kwargs[f.name] = self.random_val(f)
else:
update_kwargs[f.name] = None
continue
update_kwargs[f.name] = self.random_val(f)
if update_kwargs.get('is_all_day', False):
# For is_all_day items, EWS will remove the time part of start and end values
update_kwargs['start'] = update_kwargs['start'].replace(hour=0, minute=0, second=0, microsecond=0)
update_kwargs['end'] = \
update_kwargs['end'].replace(hour=0, minute=0, second=0, microsecond=0) + datetime.timedelta(days=1)
if self.ITEM_CLASS == CalendarItem:
# EWS always sets due date to 'start'
update_kwargs['reminder_due_by'] = update_kwargs['start']
return update_kwargs
def get_test_item(self, folder=None, categories=None):
item_kwargs = self.get_random_insert_kwargs()
item_kwargs['categories'] = categories or self.categories
return self.ITEM_CLASS(folder=folder or self.test_folder, **item_kwargs)
class ItemQuerySetTest(BaseItemTest):
TEST_FOLDER = 'inbox'
FOLDER_CLASS = Inbox
ITEM_CLASS = Message
def test_querysets(self):
test_items = []
for i in range(4):
item = self.get_test_item()
item.subject = 'Item %s' % i
item.save()
test_items.append(item)
qs = QuerySet(
folder_collection=FolderCollection(account=self.account, folders=[self.test_folder])
).filter(categories__contains=self.categories)
test_cat = self.categories[0]
self.assertEqual(
set((i.subject, i.categories[0]) for i in qs),
{('Item 0', test_cat), ('Item 1', test_cat), ('Item 2', test_cat), ('Item 3', test_cat)}
)
self.assertEqual(
[(i.subject, i.categories[0]) for i in qs.none()],
[]
)
self.assertEqual(
[(i.subject, i.categories[0]) for i in qs.filter(subject__startswith='Item 2')],
[('Item 2', test_cat)]
)
self.assertEqual(
set((i.subject, i.categories[0]) for i in qs.exclude(subject__startswith='Item 2')),
{('Item 0', test_cat), ('Item 1', test_cat), ('Item 3', test_cat)}
)
self.assertEqual(
set((i.subject, i.categories) for i in qs.only('subject')),
{('Item 0', None), ('Item 1', None), ('Item 2', None), ('Item 3', None)}
)
self.assertEqual(
[(i.subject, i.categories[0]) for i in qs.order_by('subject')],
[('Item 0', test_cat), ('Item 1', test_cat), ('Item 2', test_cat), ('Item 3', test_cat)]
)
self.assertEqual( # Test '-some_field' syntax for reverse sorting
[(i.subject, i.categories[0]) for i in qs.order_by('-subject')],
[('Item 3', test_cat), ('Item 2', test_cat), ('Item 1', test_cat), ('Item 0', test_cat)]
)
self.assertEqual( # Test ordering on a field that we don't need to fetch
[(i.subject, i.categories[0]) for i in qs.order_by('-subject').only('categories')],
[(None, test_cat), (None, test_cat), (None, test_cat), (None, test_cat)]
)
self.assertEqual(
[(i.subject, i.categories[0]) for i in qs.order_by('subject').reverse()],
[('Item 3', test_cat), ('Item 2', test_cat), ('Item 1', test_cat), ('Item 0', test_cat)]
)
with self.assertRaises(ValueError):
list(qs.values([]))
self.assertEqual(
[i for i in qs.order_by('subject').values('subject')],
[{'subject': 'Item 0'}, {'subject': 'Item 1'}, {'subject': 'Item 2'}, {'subject': 'Item 3'}]
)
# Test .values() in combinations of 'id' and 'changekey', which are handled specially
self.assertEqual(
list(qs.order_by('subject').values('id')),
[{'id': i.id} for i in test_items]
)
self.assertEqual(
list(qs.order_by('subject').values('changekey')),
[{'changekey': i.changekey} for i in test_items]
)
self.assertEqual(
list(qs.order_by('subject').values('id', 'changekey')),
[{k: getattr(i, k) for k in ('id', 'changekey')} for i in test_items]
)
self.assertEqual(
set(i for i in qs.values_list('subject')),
{('Item 0',), ('Item 1',), ('Item 2',), ('Item 3',)}
)
# Test .values_list() in combinations of 'id' and 'changekey', which are handled specially
self.assertEqual(
list(qs.order_by('subject').values_list('id')),
[(i.id,) for i in test_items]
)
self.assertEqual(
list(qs.order_by('subject').values_list('changekey')),
[(i.changekey,) for i in test_items]
)
self.assertEqual(
list(qs.order_by('subject').values_list('id', 'changekey')),
[(i.id, i.changekey) for i in test_items]
)
self.assertEqual(
set(i.subject for i in qs.only('subject')),
{'Item 0', 'Item 1', 'Item 2', 'Item 3'}
)
# Test .only() in combinations of 'id' and 'changekey', which are handled specially
self.assertEqual(
list((i.id,) for i in qs.order_by('subject').only('id')),
[(i.id,) for i in test_items]
)
self.assertEqual(
list((i.changekey,) for i in qs.order_by('subject').only('changekey')),
[(i.changekey,) for i in test_items]
)
self.assertEqual(
list((i.id, i.changekey) for i in qs.order_by('subject').only('id', 'changekey')),
[(i.id, i.changekey) for i in test_items]
)
with self.assertRaises(ValueError):
list(qs.values_list('id', 'changekey', flat=True))
with self.assertRaises(AttributeError):
list(qs.values_list('id', xxx=True))
self.assertEqual(
list(qs.order_by('subject').values_list('id', flat=True)),
[i.id for i in test_items]
)
self.assertEqual(
list(qs.order_by('subject').values_list('changekey', flat=True)),
[i.changekey for i in test_items]
)
self.assertEqual(
set(i for i in qs.values_list('subject', flat=True)),
{'Item 0', 'Item 1', 'Item 2', 'Item 3'}
)
self.assertEqual(
qs.values_list('subject', flat=True).get(subject='Item 2'),
'Item 2'
)
self.assertEqual(
set((i.subject, i.categories[0]) for i in qs.exclude(subject__startswith='Item 2')),
{('Item 0', test_cat), ('Item 1', test_cat), ('Item 3', test_cat)}
)
# Test that we can sort on a field that we don't want
self.assertEqual(
[i.categories[0] for i in qs.only('categories').order_by('subject')],
[test_cat, test_cat, test_cat, test_cat]
)
# Test iterator
self.assertEqual(
set((i.subject, i.categories[0]) for i in qs.iterator()),
{('Item 0', test_cat), ('Item 1', test_cat), ('Item 2', test_cat), ('Item 3', test_cat)}
)
# Test that iterator() preserves the result format
self.assertEqual(
set((i[0], i[1][0]) for i in qs.values_list('subject', 'categories').iterator()),
{('Item 0', test_cat), ('Item 1', test_cat), ('Item 2', test_cat), ('Item 3', test_cat)}
)
self.assertEqual(qs.get(subject='Item 3').subject, 'Item 3')
with self.assertRaises(DoesNotExist):
qs.get(subject='Item XXX')
with self.assertRaises(MultipleObjectsReturned):
qs.get(subject__startswith='Item')
# len() and count()
self.assertEqual(len(qs), 4)
self.assertEqual(qs.count(), 4)
# Indexing and slicing
self.assertTrue(isinstance(qs[0], self.ITEM_CLASS))
self.assertEqual(len(list(qs[1:3])), 2)
self.assertEqual(len(qs), 4)
with self.assertRaises(IndexError):
print(qs[99999])
# Exists
self.assertEqual(qs.exists(), True)
self.assertEqual(qs.filter(subject='Test XXX').exists(), False)
self.assertEqual(
qs.filter(subject__startswith='Item').delete(),
[True, True, True, True]
)
def test_queryset_failure(self):
qs = QuerySet(
folder_collection=FolderCollection(account=self.account, folders=[self.test_folder])
).filter(categories__contains=self.categories)
with self.assertRaises(ValueError):
qs.order_by('XXX')
with self.assertRaises(ValueError):
qs.values('XXX')
with self.assertRaises(ValueError):
qs.values_list('XXX')
with self.assertRaises(ValueError):
qs.only('XXX')
with self.assertRaises(ValueError):
qs.reverse() # We can't reverse when we haven't defined an order yet
def test_cached_queryset_corner_cases(self):
test_items = []
for i in range(4):
item = self.get_test_item()
item.subject = 'Item %s' % i
item.save()
test_items.append(item)
qs = QuerySet(
folder_collection=FolderCollection(account=self.account, folders=[self.test_folder])
).filter(categories__contains=self.categories).order_by('subject')
for _ in qs:
# Build up the cache
pass
self.assertEqual(len(qs._cache), 4)
with self.assertRaises(MultipleObjectsReturned):
qs.get() # Get with a full cache
self.assertEqual(qs[2].subject, 'Item 2') # Index with a full cache
self.assertEqual(qs[-2].subject, 'Item 2') # Negative index with a full cache
qs.delete() # Delete with a full cache
self.assertEqual(qs.count(), 0) # QuerySet is empty after delete
self.assertEqual(list(qs.none()), [])
def test_queryset_get_by_id(self):
item = self.get_test_item().save()
with self.assertRaises(ValueError):
list(self.test_folder.filter(id__in=[item.id]))
with self.assertRaises(ValueError):
list(self.test_folder.get(id=item.id, changekey=item.changekey, subject='XXX'))
with self.assertRaises(ValueError):
list(self.test_folder.get(id=None, changekey=item.changekey))
# Test a simple get()
get_item = self.test_folder.get(id=item.id, changekey=item.changekey)
self.assertEqual(item.id, get_item.id)
self.assertEqual(item.changekey, get_item.changekey)
self.assertEqual(item.subject, get_item.subject)
self.assertEqual(item.body, get_item.body)
# Test get() with ID only
get_item = self.test_folder.get(id=item.id)
self.assertEqual(item.id, get_item.id)
self.assertEqual(item.changekey, get_item.changekey)
self.assertEqual(item.subject, get_item.subject)
self.assertEqual(item.body, get_item.body)
get_item = self.test_folder.get(id=item.id, changekey=None)
self.assertEqual(item.id, get_item.id)
self.assertEqual(item.changekey, get_item.changekey)
self.assertEqual(item.subject, get_item.subject)
self.assertEqual(item.body, get_item.body)
# Test a get() from queryset
get_item = self.test_folder.all().get(id=item.id, changekey=item.changekey)
self.assertEqual(item.id, get_item.id)
self.assertEqual(item.changekey, get_item.changekey)
self.assertEqual(item.subject, get_item.subject)
self.assertEqual(item.body, get_item.body)
# Test a get() with only()
get_item = self.test_folder.all().only('subject').get(id=item.id, changekey=item.changekey)
self.assertEqual(item.id, get_item.id)
self.assertEqual(item.changekey, get_item.changekey)
self.assertEqual(item.subject, get_item.subject)
self.assertIsNone(get_item.body)
def test_paging(self):
# Test that paging services work correctly. Default EWS paging size is 1000 items. Our default is 100 items.
items = []
for _ in range(11):
i = self.get_test_item()
del i.attachments[:]
items.append(i)
self.test_folder.bulk_create(items=items)
ids = self.test_folder.filter(categories__contains=self.categories).values_list('id', 'changekey')
ids.page_size = 10
self.bulk_delete(ids.iterator())
def test_slicing(self):
# Test that slicing works correctly
items = []
for i in range(4):
item = self.get_test_item()
item.subject = 'Subj %s' % i
del item.attachments[:]
items.append(item)
ids = self.test_folder.bulk_create(items=items)
qs = self.test_folder.filter(categories__contains=self.categories).only('subject').order_by('subject')
# Test positive index
self.assertEqual(
qs._copy_self()[0].subject,
'Subj 0'
)
# Test positive index
self.assertEqual(
qs._copy_self()[3].subject,
'Subj 3'
)
# Test negative index
self.assertEqual(
qs._copy_self()[-2].subject,
'Subj 2'
)
# Test positive slice
self.assertEqual(
[i.subject for i in qs._copy_self()[0:2]],
['Subj 0', 'Subj 1']
)
# Test positive slice
self.assertEqual(
[i.subject for i in qs._copy_self()[2:4]],
['Subj 2', 'Subj 3']
)
# Test positive open slice
self.assertEqual(
[i.subject for i in qs._copy_self()[:2]],
['Subj 0', 'Subj 1']
)
# Test positive open slice
self.assertEqual(
[i.subject for i in qs._copy_self()[2:]],
['Subj 2', 'Subj 3']
)
# Test negative slice
self.assertEqual(
[i.subject for i in qs._copy_self()[-3:-1]],
['Subj 1', 'Subj 2']
)
# Test negative slice
self.assertEqual(
[i.subject for i in qs._copy_self()[1:-1]],
['Subj 1', 'Subj 2']
)
# Test negative open slice
self.assertEqual(
[i.subject for i in qs._copy_self()[:-2]],
['Subj 0', 'Subj 1']
)
# Test negative open slice
self.assertEqual(
[i.subject for i in qs._copy_self()[-2:]],
['Subj 2', 'Subj 3']
)
# Test positive slice with step
self.assertEqual(
[i.subject for i in qs._copy_self()[0:4:2]],
['Subj 0', 'Subj 2']
)
# Test negative slice with step
self.assertEqual(
[i.subject for i in qs._copy_self()[4:0:-2]],
['Subj 3', 'Subj 1']
)
self.bulk_delete(ids)
def test_delete_via_queryset(self):
self.get_test_item().save()
qs = self.test_folder.filter(categories__contains=self.categories)
self.assertEqual(qs.count(), 1)
qs.delete()
self.assertEqual(qs.count(), 0)
def test_send_via_queryset(self):
self.get_test_item().save()
qs = self.test_folder.filter(categories__contains=self.categories)
to_folder = self.account.sent
to_folder_qs = to_folder.filter(categories__contains=self.categories)
self.assertEqual(qs.count(), 1)
self.assertEqual(to_folder_qs.count(), 0)
qs.send(copy_to_folder=to_folder)
time.sleep(5) # Requests are supposed to be transactional, but apparently not...
self.assertEqual(qs.count(), 0)
self.assertEqual(to_folder_qs.count(), 1)
def test_send_with_no_copy_via_queryset(self):
self.get_test_item().save()
qs = self.test_folder.filter(categories__contains=self.categories)
to_folder = self.account.sent
to_folder_qs = to_folder.filter(categories__contains=self.categories)
self.assertEqual(qs.count(), 1)
self.assertEqual(to_folder_qs.count(), 0)
qs.send(save_copy=False)
time.sleep(5) # Requests are supposed to be transactional, but apparently not...
self.assertEqual(qs.count(), 0)
self.assertEqual(to_folder_qs.count(), 0)
def test_copy_via_queryset(self):
self.get_test_item().save()
qs = self.test_folder.filter(categories__contains=self.categories)
to_folder = self.account.trash
to_folder_qs = to_folder.filter(categories__contains=self.categories)
self.assertEqual(qs.count(), 1)
self.assertEqual(to_folder_qs.count(), 0)
qs.copy(to_folder=to_folder)
self.assertEqual(qs.count(), 1)
self.assertEqual(to_folder_qs.count(), 1)
def test_move_via_queryset(self):
self.get_test_item().save()
qs = self.test_folder.filter(categories__contains=self.categories)
to_folder = self.account.trash
to_folder_qs = to_folder.filter(categories__contains=self.categories)
self.assertEqual(qs.count(), 1)
self.assertEqual(to_folder_qs.count(), 0)
qs.move(to_folder=to_folder)
self.assertEqual(qs.count(), 0)
self.assertEqual(to_folder_qs.count(), 1)
class ItemHelperTest(BaseItemTest):
TEST_FOLDER = 'inbox'
FOLDER_CLASS = Inbox
ITEM_CLASS = Message
def test_save_with_update_fields(self):
# Create a test item
insert_kwargs = self.get_random_insert_kwargs()
if 'is_all_day' in insert_kwargs:
insert_kwargs['is_all_day'] = False
item = self.ITEM_CLASS(account=self.account, folder=self.test_folder, **insert_kwargs)
with self.assertRaises(ValueError):
item.save(update_fields=['subject']) # update_fields does not work on item creation
item.save()
item.subject = 'XXX'
item.body = 'YYY'
item.save(update_fields=['subject'])
item.refresh()
self.assertEqual(item.subject, 'XXX')
self.assertNotEqual(item.body, 'YYY')
# Test invalid 'update_fields' input
with self.assertRaises(ValueError) as e:
item.save(update_fields=['xxx'])
self.assertEqual(
e.exception.args[0],
"Field name(s) 'xxx' are not valid for a '%s' item" % self.ITEM_CLASS.__name__
)
with self.assertRaises(ValueError) as e:
item.save(update_fields='subject')
self.assertEqual(
e.exception.args[0],
"Field name(s) 's', 'u', 'b', 'j', 'e', 'c', 't' are not valid for a '%s' item" % self.ITEM_CLASS.__name__
)
self.bulk_delete([item])
def test_soft_delete(self):
# First, empty trash bin
self.account.trash.filter(categories__contains=self.categories).delete()
self.account.recoverable_items_deletions.filter(categories__contains=self.categories).delete()
item = self.get_test_item().save()
item_id = (item.id, item.changekey)
# Soft delete
item.soft_delete()
for e in self.account.fetch(ids=[item_id]):
# It's gone from the test folder
self.assertIsInstance(e, ErrorItemNotFound)
# Really gone, not just changed ItemId
self.assertEqual(len(self.test_folder.filter(categories__contains=item.categories)), 0)
self.assertEqual(len(self.account.trash.filter(categories__contains=item.categories)), 0)
# But we can find it in the recoverable items folder
self.assertEqual(len(self.account.recoverable_items_deletions.filter(categories__contains=item.categories)), 1)
def test_move_to_trash(self):
# First, empty trash bin
self.account.trash.filter(categories__contains=self.categories).delete()
item = self.get_test_item().save()
item_id = (item.id, item.changekey)
# Move to trash
item.move_to_trash()
for e in self.account.fetch(ids=[item_id]):
# Not in the test folder anymore
self.assertIsInstance(e, ErrorItemNotFound)
# Really gone, not just changed ItemId
self.assertEqual(len(self.test_folder.filter(categories__contains=item.categories)), 0)
# Test that the item moved to trash
item = self.account.trash.get(categories__contains=item.categories)
moved_item = list(self.account.fetch(ids=[item]))[0]
# The item was copied, so the ItemId has changed. Let's compare the subject instead
self.assertEqual(item.subject, moved_item.subject)
def test_copy(self):
# First, empty trash bin
self.account.trash.filter(categories__contains=self.categories).delete()
item = self.get_test_item().save()
# Copy to trash. We use trash because it can contain all item types.
copy_item_id, copy_changekey = item.copy(to_folder=self.account.trash)
# Test that the item still exists in the folder
self.assertEqual(len(self.test_folder.filter(categories__contains=item.categories)), 1)
# Test that the copied item exists in trash
copied_item = self.account.trash.get(categories__contains=item.categories)
self.assertNotEqual(item.id, copied_item.id)
self.assertNotEqual(item.changekey, copied_item.changekey)
self.assertEqual(copy_item_id, copied_item.id)
self.assertEqual(copy_changekey, copied_item.changekey)
def test_move(self):
# First, empty trash bin
self.account.trash.filter(categories__contains=self.categories).delete()
item = self.get_test_item().save()
item_id = (item.id, item.changekey)
# Move to trash. We use trash because it can contain all item types. This changes the ItemId
item.move(to_folder=self.account.trash)
for e in self.account.fetch(ids=[item_id]):
# original item ID no longer exists
self.assertIsInstance(e, ErrorItemNotFound)
# Test that the item moved to trash
self.assertEqual(len(self.test_folder.filter(categories__contains=item.categories)), 0)
moved_item = self.account.trash.get(categories__contains=item.categories)
self.assertEqual(item.id, moved_item.id)
self.assertEqual(item.changekey, moved_item.changekey)
def test_refresh(self):
# Test that we can refresh items, and that refresh fails if the item no longer exists on the server
item = self.get_test_item().save()
orig_subject = item.subject
item.subject = 'XXX'
item.refresh()
self.assertEqual(item.subject, orig_subject)
item.delete()
with self.assertRaises(ValueError):
# Item no longer has an ID
item.refresh()
class BulkMethodTest(BaseItemTest):
TEST_FOLDER = 'inbox'
FOLDER_CLASS = Inbox
ITEM_CLASS = Message
def test_fetch(self):
item = self.get_test_item()
self.test_folder.bulk_create(items=[item, item])
ids = self.test_folder.filter(categories__contains=item.categories)
items = list(self.account.fetch(ids=ids))
for item in items:
self.assertIsInstance(item, self.ITEM_CLASS)
self.assertEqual(len(items), 2)
items = list(self.account.fetch(ids=ids, only_fields=['subject']))
self.assertEqual(len(items), 2)
items = list(self.account.fetch(ids=ids, only_fields=[FieldPath.from_string('subject', self.test_folder)]))
self.assertEqual(len(items), 2)
self.bulk_delete(ids)
def test_empty_args(self):
# We allow empty sequences for these methods
self.assertEqual(self.test_folder.bulk_create(items=[]), [])
self.assertEqual(list(self.account.fetch(ids=[])), [])
self.assertEqual(self.account.bulk_create(folder=self.test_folder, items=[]), [])
self.assertEqual(self.account.bulk_update(items=[]), [])
self.assertEqual(self.account.bulk_delete(ids=[]), [])
self.assertEqual(self.account.bulk_send(ids=[]), [])
self.assertEqual(self.account.bulk_copy(ids=[], to_folder=self.account.trash), [])
self.assertEqual(self.account.bulk_move(ids=[], to_folder=self.account.trash), [])
self.assertEqual(self.account.upload(data=[]), [])
self.assertEqual(self.account.export(items=[]), [])
def test_qs_args(self):
# We allow querysets for these methods
qs = self.test_folder.none()
self.assertEqual(list(self.account.fetch(ids=qs)), [])
with self.assertRaises(ValueError):
# bulk_update() does not allow queryset input
self.assertEqual(self.account.bulk_update(items=qs), [])
self.assertEqual(self.account.bulk_delete(ids=qs), [])
self.assertEqual(self.account.bulk_send(ids=qs), [])
self.assertEqual(self.account.bulk_copy(ids=qs, to_folder=self.account.trash), [])
self.assertEqual(self.account.bulk_move(ids=qs, to_folder=self.account.trash), [])
with self.assertRaises(ValueError):
# upload() does not allow queryset input
self.assertEqual(self.account.upload(data=qs), [])
self.assertEqual(self.account.export(items=qs), [])
def test_no_kwargs(self):
self.assertEqual(self.test_folder.bulk_create([]), [])
self.assertEqual(list(self.account.fetch([])), [])
self.assertEqual(self.account.bulk_create(self.test_folder, []), [])
self.assertEqual(self.account.bulk_update([]), [])
self.assertEqual(self.account.bulk_delete([]), [])
self.assertEqual(self.account.bulk_send([]), [])
self.assertEqual(self.account.bulk_copy([], to_folder=self.account.trash), [])
self.assertEqual(self.account.bulk_move([], to_folder=self.account.trash), [])
self.assertEqual(self.account.upload([]), [])
self.assertEqual(self.account.export([]), [])
def test_invalid_bulk_args(self):
# Test bulk_create
with self.assertRaises(ValueError):
# Folder must belong to account
self.account.bulk_create(folder=Folder(root=None), items=[])
with self.assertRaises(AttributeError):
# Must have folder on save
self.account.bulk_create(folder=None, items=[], message_disposition=SAVE_ONLY)
# Test that we can send_and_save with a default folder
self.account.bulk_create(folder=None, items=[], message_disposition=SEND_AND_SAVE_COPY)
with self.assertRaises(AttributeError):
# Must not have folder on send-only
self.account.bulk_create(folder=self.test_folder, items=[], message_disposition=SEND_ONLY)
# Test bulk_update
with self.assertRaises(ValueError):
# Cannot update in send-only mode
self.account.bulk_update(items=[], message_disposition=SEND_ONLY)
def test_bulk_failure(self):
# Test that bulk_* can handle EWS errors and return the errors in order without losing non-failure results
items1 = [self.get_test_item().save() for _ in range(3)]
items1[1].changekey = 'XXX'
for i, res in enumerate(self.account.bulk_delete(items1)):
if i == 1:
self.assertIsInstance(res, ErrorInvalidChangeKey)
else:
self.assertEqual(res, True)
items2 = [self.get_test_item().save() for _ in range(3)]
items2[1].id = 'AAAA=='
for i, res in enumerate(self.account.bulk_delete(items2)):
if i == 1:
self.assertIsInstance(res, ErrorInvalidIdMalformed)
else:
self.assertEqual(res, True)
items3 = [self.get_test_item().save() for _ in range(3)]
items3[1].id = items1[0].id
for i, res in enumerate(self.account.fetch(items3)):
if i == 1:
self.assertIsInstance(res, ErrorItemNotFound)
else:
self.assertIsInstance(res, Item)
class CommonItemTest(BaseItemTest):
@classmethod
def setUpClass(cls):
if cls is CommonItemTest:
raise unittest.SkipTest("Skip CommonItemTest, it's only for inheritance")
super(CommonItemTest, cls).setUpClass()
def test_field_names(self):
# Test that fieldnames don't clash with Python keywords
for f in self.ITEM_CLASS.FIELDS:
self.assertNotIn(f.name, kwlist)
def test_magic(self):
item = self.get_test_item()
self.assertIn('subject=', str(item))
self.assertIn(item.__class__.__name__, repr(item))
def test_validation(self):
item = self.get_test_item()
item.clean()
for f in self.ITEM_CLASS.FIELDS:
# Test field max_length
if isinstance(f, CharField) and f.max_length:
with self.assertRaises(ValueError):
setattr(item, f.name, 'a' * (f.max_length + 1))
item.clean()
setattr(item, f.name, 'a')
def test_invalid_direct_args(self):
with self.assertRaises(ValueError):
item = self.get_test_item()
item.account = None
item.save() # Must have account on save
with self.assertRaises(ValueError):
item = self.get_test_item()
item.id = 'XXX' # Fake a saved item
item.account = None
item.save() # Must have account on update
with self.assertRaises(ValueError):
item = self.get_test_item()
item.save(update_fields=['foo', 'bar']) # update_fields is only valid on update
if self.ITEM_CLASS == Message:
with self.assertRaises(ValueError):
item = self.get_test_item()
item.account = None
item.send() # Must have account on send
with self.assertRaises(ErrorItemNotFound):
item = self.get_test_item()
item.save()
item_id, changekey = item.id, item.changekey
item.delete()
item.id, item.changekey = item_id, changekey
item.send() # Item disappeared
with self.assertRaises(AttributeError):
item = self.get_test_item()
item.send(copy_to_folder=self.account.trash, save_copy=False) # Inconsistent args
with self.assertRaises(ValueError):
item = self.get_test_item()
item.account = None
item.refresh() # Must have account on refresh
with self.assertRaises(ValueError):
item = self.get_test_item()
item.refresh() # Refresh an item that has not been saved
with self.assertRaises(ErrorItemNotFound):
item = self.get_test_item()
item.save()
item_id, changekey = item.id, item.changekey
item.delete()
item.id, item.changekey = item_id, changekey
item.refresh() # Refresh an item that doesn't exist
with self.assertRaises(ValueError):
item = self.get_test_item()
item.account = None
item.copy(to_folder=self.test_folder) # Must have an account on copy
with self.assertRaises(ValueError):
item = self.get_test_item()
item.copy(to_folder=self.test_folder) # Must be an existing item
with self.assertRaises(ErrorItemNotFound):
item = self.get_test_item()
item.save()
item_id, changekey = item.id, item.changekey
item.delete()
item.id, item.changekey = item_id, changekey
item.copy(to_folder=self.test_folder) # Item disappeared
with self.assertRaises(ValueError):
item = self.get_test_item()
item.account = None
item.move(to_folder=self.test_folder) # Must have an account on move
with self.assertRaises(ValueError):
item = self.get_test_item()
item.move(to_folder=self.test_folder) # Must be an existing item
with self.assertRaises(ErrorItemNotFound):
item = self.get_test_item()
item.save()
item_id, changekey = item.id, item.changekey
item.delete()
item.id, item.changekey = item_id, changekey
item.move(to_folder=self.test_folder) # Item disappeared
with self.assertRaises(ValueError):
item = self.get_test_item()
item.account = None
item.delete() # Must have an account
with self.assertRaises(ValueError):
item = self.get_test_item()
item.delete() # Must be an existing item
with self.assertRaises(ErrorItemNotFound):
item = self.get_test_item()
item.save()
item_id, changekey = item.id, item.changekey
item.delete()
item.id, item.changekey = item_id, changekey
item.delete() # Item disappeared
def test_unsupported_fields(self):
# Create a field that is not supported by any current versions. Test that we fail when using this field
class UnsupportedProp(ExtendedProperty):
property_set_id = 'deadcafe-beef-beef-beef-deadcafebeef'
property_name = 'Unsupported Property'
property_type = 'String'
attr_name = 'unsupported_property'
self.ITEM_CLASS.register(attr_name=attr_name, attr_cls=UnsupportedProp)
try:
for f in self.ITEM_CLASS.FIELDS:
if f.name == attr_name:
f.supported_from = Build(99, 99, 99, 99)
with self.assertRaises(ValueError):
self.test_folder.get(**{attr_name: 'XXX'})
with self.assertRaises(ValueError):
list(self.test_folder.filter(**{attr_name: 'XXX'}))
with self.assertRaises(ValueError):
list(self.test_folder.all().only(attr_name))
with self.assertRaises(ValueError):
list(self.test_folder.all().values(attr_name))
with self.assertRaises(ValueError):
list(self.test_folder.all().values_list(attr_name))
finally:
self.ITEM_CLASS.deregister(attr_name=attr_name)
def test_queryset_nonsearchable_fields(self):
for f in self.ITEM_CLASS.FIELDS:
if f.is_searchable or isinstance(f, IdField) or not f.supports_version(self.account.version):
continue
if f.name in ('percent_complete', 'allow_new_time_proposal'):
# These fields don't raise an error when used in a filter, but also don't match anything in a filter
continue
try:
filter_val = f.clean(self.random_val(f))
filter_kwargs = {'%s__in' % f.name: filter_val} if f.is_list else {f.name: filter_val}
# We raise ValueError when searching on an is_searchable=False field
with self.assertRaises(ValueError):
list(self.test_folder.filter(**filter_kwargs))
# Make sure the is_searchable=False setting is correct by searching anyway and testing that this
# fails server-side. This only works for values that we are actually able to convert to a search
# string.
try:
value_to_xml_text(filter_val)
except NotImplementedError:
continue
f.is_searchable = True
if f.name in ('reminder_due_by',):
# Filtering is accepted but doesn't work
self.assertEqual(
len(self.test_folder.filter(**filter_kwargs)),
0
)
else:
with self.assertRaises((ErrorUnsupportedPathForQuery, ErrorInvalidValueForProperty)):
list(self.test_folder.filter(**filter_kwargs))
finally:
f.is_searchable = False
def test_order_by(self):
# Test order_by() on normal field
test_items = []
for i in range(4):
item = self.get_test_item()
item.subject = 'Subj %s' % i
test_items.append(item)
self.test_folder.bulk_create(items=test_items)
qs = QuerySet(
folder_collection=FolderCollection(account=self.account, folders=[self.test_folder])
).filter(categories__contains=self.categories)
self.assertEqual(
[i for i in qs.order_by('subject').values_list('subject', flat=True)],
['Subj 0', 'Subj 1', 'Subj 2', 'Subj 3']
)
self.assertEqual(
[i for i in qs.order_by('-subject').values_list('subject', flat=True)],
['Subj 3', 'Subj 2', 'Subj 1', 'Subj 0']
)
self.bulk_delete(qs)
try:
self.ITEM_CLASS.register('extern_id', ExternId)
# Test order_by() on ExtendedProperty
test_items = []
for i in range(4):
item = self.get_test_item()
item.extern_id = 'ID %s' % i
test_items.append(item)
self.test_folder.bulk_create(items=test_items)
qs = QuerySet(
folder_collection=FolderCollection(account=self.account, folders=[self.test_folder])
).filter(categories__contains=self.categories)
self.assertEqual(
[i for i in qs.order_by('extern_id').values_list('extern_id', flat=True)],
['ID 0', 'ID 1', 'ID 2', 'ID 3']
)
self.assertEqual(
[i for i in qs.order_by('-extern_id').values_list('extern_id', flat=True)],
['ID 3', 'ID 2', 'ID 1', 'ID 0']
)
finally:
self.ITEM_CLASS.deregister('extern_id')
self.bulk_delete(qs)
# Test order_by() on IndexedField (simple and multi-subfield). Only Contact items have these
if self.ITEM_CLASS == Contact:
test_items = []
label = self.random_val(EmailAddress.get_field_by_fieldname('label'))
for i in range(4):
item = self.get_test_item()
item.email_addresses = [EmailAddress(email='%[email protected]' % i, label=label)]
test_items.append(item)
self.test_folder.bulk_create(items=test_items)
qs = QuerySet(
folder_collection=FolderCollection(account=self.account, folders=[self.test_folder])
).filter(categories__contains=self.categories)
self.assertEqual(
[i[0].email for i in qs.order_by('email_addresses__%s' % label)
.values_list('email_addresses', flat=True)],
['[email protected]', '[email protected]', '[email protected]', '[email protected]']
)
self.assertEqual(
[i[0].email for i in qs.order_by('-email_addresses__%s' % label)
.values_list('email_addresses', flat=True)],
['[email protected]', '[email protected]', '[email protected]', '[email protected]']
)
self.bulk_delete(qs)
test_items = []
label = self.random_val(PhysicalAddress.get_field_by_fieldname('label'))
for i in range(4):
item = self.get_test_item()
item.physical_addresses = [PhysicalAddress(street='Elm St %s' % i, label=label)]
test_items.append(item)
self.test_folder.bulk_create(items=test_items)
qs = QuerySet(
folder_collection=FolderCollection(account=self.account, folders=[self.test_folder])
).filter(categories__contains=self.categories)
self.assertEqual(
[i[0].street for i in qs.order_by('physical_addresses__%s__street' % label)
.values_list('physical_addresses', flat=True)],
['Elm St 0', 'Elm St 1', 'Elm St 2', 'Elm St 3']
)
self.assertEqual(
[i[0].street for i in qs.order_by('-physical_addresses__%s__street' % label)
.values_list('physical_addresses', flat=True)],
['Elm St 3', 'Elm St 2', 'Elm St 1', 'Elm St 0']
)
self.bulk_delete(qs)
# Test sorting on multiple fields
try:
self.ITEM_CLASS.register('extern_id', ExternId)
test_items = []
for i in range(2):
for j in range(2):
item = self.get_test_item()
item.subject = 'Subj %s' % i
item.extern_id = 'ID %s' % j
test_items.append(item)
self.test_folder.bulk_create(items=test_items)
qs = QuerySet(
folder_collection=FolderCollection(account=self.account, folders=[self.test_folder])
).filter(categories__contains=self.categories)
self.assertEqual(
[i for i in qs.order_by('subject', 'extern_id').values('subject', 'extern_id')],
[{'subject': 'Subj 0', 'extern_id': 'ID 0'},
{'subject': 'Subj 0', 'extern_id': 'ID 1'},
{'subject': 'Subj 1', 'extern_id': 'ID 0'},
{'subject': 'Subj 1', 'extern_id': 'ID 1'}]
)
self.assertEqual(
[i for i in qs.order_by('-subject', 'extern_id').values('subject', 'extern_id')],
[{'subject': 'Subj 1', 'extern_id': 'ID 0'},
{'subject': 'Subj 1', 'extern_id': 'ID 1'},
{'subject': 'Subj 0', 'extern_id': 'ID 0'},
{'subject': 'Subj 0', 'extern_id': 'ID 1'}]
)
self.assertEqual(
[i for i in qs.order_by('subject', '-extern_id').values('subject', 'extern_id')],
[{'subject': 'Subj 0', 'extern_id': 'ID 1'},
{'subject': 'Subj 0', 'extern_id': 'ID 0'},
{'subject': 'Subj 1', 'extern_id': 'ID 1'},
{'subject': 'Subj 1', 'extern_id': 'ID 0'}]
)
self.assertEqual(
[i for i in qs.order_by('-subject', '-extern_id').values('subject', 'extern_id')],
[{'subject': 'Subj 1', 'extern_id': 'ID 1'},
{'subject': 'Subj 1', 'extern_id': 'ID 0'},
{'subject': 'Subj 0', 'extern_id': 'ID 1'},
{'subject': 'Subj 0', 'extern_id': 'ID 0'}]
)
finally:
self.ITEM_CLASS.deregister('extern_id')
def test_finditems(self):
now = UTC_NOW()
# Test argument types
item = self.get_test_item()
ids = self.test_folder.bulk_create(items=[item])
# No arguments. There may be leftover items in the folder, so just make sure there's at least one.
self.assertGreaterEqual(
len(self.test_folder.filter()),
1
)
# Q object
self.assertEqual(
len(self.test_folder.filter(Q(subject=item.subject))),
1
)
# Multiple Q objects
self.assertEqual(
len(self.test_folder.filter(Q(subject=item.subject), ~Q(subject=item.subject[:-3] + 'XXX'))),
1
)
# Multiple Q object and kwargs
self.assertEqual(
len(self.test_folder.filter(Q(subject=item.subject), categories__contains=item.categories)),
1
)
self.bulk_delete(ids)
# Test categories which are handled specially - only '__contains' and '__in' lookups are supported
item = self.get_test_item(categories=['TestA', 'TestB'])
ids = self.test_folder.bulk_create(items=[item])
common_qs = self.test_folder.filter(subject=item.subject) # Guard against other simultaneous runs
self.assertEqual(
len(common_qs.filter(categories__contains='ci6xahH1')), # Plain string
0
)
self.assertEqual(
len(common_qs.filter(categories__contains=['ci6xahH1'])), # Same, but as list
0
)
self.assertEqual(
len(common_qs.filter(categories__contains=['TestA', 'TestC'])), # One wrong category
0
)
self.assertEqual(
len(common_qs.filter(categories__contains=['TESTA'])), # Test case insensitivity
1
)
self.assertEqual(
len(common_qs.filter(categories__contains=['testa'])), # Test case insensitivity
1
)
self.assertEqual(
len(common_qs.filter(categories__contains=['TestA'])), # Partial
1
)
self.assertEqual(
len(common_qs.filter(categories__contains=item.categories)), # Exact match
1
)
with self.assertRaises(ValueError):
len(common_qs.filter(categories__in='ci6xahH1')) # Plain string is not supported
self.assertEqual(
len(common_qs.filter(categories__in=['ci6xahH1'])), # Same, but as list
0
)
self.assertEqual(
len(common_qs.filter(categories__in=['TestA', 'TestC'])), # One wrong category
1
)
self.assertEqual(
len(common_qs.filter(categories__in=['TestA'])), # Partial
1
)
self.assertEqual(
len(common_qs.filter(categories__in=item.categories)), # Exact match
1
)
self.bulk_delete(ids)
common_qs = self.test_folder.filter(categories__contains=self.categories)
one_hour = datetime.timedelta(hours=1)
two_hours = datetime.timedelta(hours=2)
# Test 'exists'
ids = self.test_folder.bulk_create(items=[self.get_test_item()])
self.assertEqual(
len(common_qs.filter(datetime_created__exists=True)),
1
)
self.assertEqual(
len(common_qs.filter(datetime_created__exists=False)),
0
)
self.bulk_delete(ids)
# Test 'range'
ids = self.test_folder.bulk_create(items=[self.get_test_item()])
self.assertEqual(
len(common_qs.filter(datetime_created__range=(now + one_hour, now + two_hours))),
0
)
self.assertEqual(
len(common_qs.filter(datetime_created__range=(now - one_hour, now + one_hour))),
1
)
self.bulk_delete(ids)
# Test '>'
ids = self.test_folder.bulk_create(items=[self.get_test_item()])
self.assertEqual(
len(common_qs.filter(datetime_created__gt=now + one_hour)),
0
)
self.assertEqual(
len(common_qs.filter(datetime_created__gt=now - one_hour)),
1
)
self.bulk_delete(ids)
# Test '>='
ids = self.test_folder.bulk_create(items=[self.get_test_item()])
self.assertEqual(
len(common_qs.filter(datetime_created__gte=now + one_hour)),
0
)
self.assertEqual(
len(common_qs.filter(datetime_created__gte=now - one_hour)),
1
)
self.bulk_delete(ids)
# Test '<'
ids = self.test_folder.bulk_create(items=[self.get_test_item()])
self.assertEqual(
len(common_qs.filter(datetime_created__lt=now - one_hour)),
0
)
self.assertEqual(
len(common_qs.filter(datetime_created__lt=now + one_hour)),
1
)
self.bulk_delete(ids)
# Test '<='
ids = self.test_folder.bulk_create(items=[self.get_test_item()])
self.assertEqual(
len(common_qs.filter(datetime_created__lte=now - one_hour)),
0
)
self.assertEqual(
len(common_qs.filter(datetime_created__lte=now + one_hour)),
1
)
self.bulk_delete(ids)
# Test '='
item = self.get_test_item()
ids = self.test_folder.bulk_create(items=[item])
self.assertEqual(
len(common_qs.filter(subject=item.subject[:-3] + 'XXX')),
0
)
self.assertEqual(
len(common_qs.filter(subject=item.subject)),
1
)
self.bulk_delete(ids)
# Test '!='
item = self.get_test_item()
ids = self.test_folder.bulk_create(items=[item])
self.assertEqual(
len(common_qs.filter(subject__not=item.subject)),
0
)
self.assertEqual(
len(common_qs.filter(subject__not=item.subject[:-3] + 'XXX')),
1
)
self.bulk_delete(ids)
# Test 'exact'
item = self.get_test_item()
item.subject = 'aA' + item.subject[2:]
ids = self.test_folder.bulk_create(items=[item])
self.assertEqual(
len(common_qs.filter(subject__exact=item.subject[:-3] + 'XXX')),
0
)
self.assertEqual(
len(common_qs.filter(subject__exact=item.subject.lower())),
0
)
self.assertEqual(
len(common_qs.filter(subject__exact=item.subject.upper())),
0
)
self.assertEqual(
len(common_qs.filter(subject__exact=item.subject)),
1
)
self.bulk_delete(ids)
# Test 'iexact'
item = self.get_test_item()
item.subject = 'aA' + item.subject[2:]
ids = self.test_folder.bulk_create(items=[item])
self.assertEqual(
len(common_qs.filter(subject__iexact=item.subject[:-3] + 'XXX')),
0
)
self.assertIn(
len(common_qs.filter(subject__iexact=item.subject.lower())),
(0, 1) # iexact search is broken on some EWS versions
)
self.assertIn(
len(common_qs.filter(subject__iexact=item.subject.upper())),
(0, 1) # iexact search is broken on some EWS versions
)
self.assertEqual(
len(common_qs.filter(subject__iexact=item.subject)),
1
)
self.bulk_delete(ids)
# Test 'contains'
item = self.get_test_item()
item.subject = item.subject[2:8] + 'aA' + item.subject[8:]
ids = self.test_folder.bulk_create(items=[item])
self.assertEqual(
len(common_qs.filter(subject__contains=item.subject[2:14] + 'XXX')),
0
)
self.assertEqual(
len(common_qs.filter(subject__contains=item.subject[2:14].lower())),
0
)
self.assertEqual(
len(common_qs.filter(subject__contains=item.subject[2:14].upper())),
0
)
self.assertEqual(
len(common_qs.filter(subject__contains=item.subject[2:14])),
1
)
self.bulk_delete(ids)
# Test 'icontains'
item = self.get_test_item()
item.subject = item.subject[2:8] + 'aA' + item.subject[8:]
ids = self.test_folder.bulk_create(items=[item])
self.assertEqual(
len(common_qs.filter(subject__icontains=item.subject[2:14] + 'XXX')),
0
)
self.assertIn(
len(common_qs.filter(subject__icontains=item.subject[2:14].lower())),
(0, 1) # icontains search is broken on some EWS versions
)
self.assertIn(
len(common_qs.filter(subject__icontains=item.subject[2:14].upper())),
(0, 1) # icontains search is broken on some EWS versions
)
self.assertEqual(
len(common_qs.filter(subject__icontains=item.subject[2:14])),
1
)
self.bulk_delete(ids)
# Test 'startswith'
item = self.get_test_item()
item.subject = 'aA' + item.subject[2:]
ids = self.test_folder.bulk_create(items=[item])
self.assertEqual(
len(common_qs.filter(subject__startswith='XXX' + item.subject[:12])),
0
)
self.assertEqual(
len(common_qs.filter(subject__startswith=item.subject[:12].lower())),
0
)
self.assertEqual(
len(common_qs.filter(subject__startswith=item.subject[:12].upper())),
0
)
self.assertEqual(
len(common_qs.filter(subject__startswith=item.subject[:12])),
1
)
self.bulk_delete(ids)
# Test 'istartswith'
item = self.get_test_item()
item.subject = 'aA' + item.subject[2:]
ids = self.test_folder.bulk_create(items=[item])
self.assertEqual(
len(common_qs.filter(subject__istartswith='XXX' + item.subject[:12])),
0
)
self.assertIn(
len(common_qs.filter(subject__istartswith=item.subject[:12].lower())),
(0, 1) # istartswith search is broken on some EWS versions
)
self.assertIn(
len(common_qs.filter(subject__istartswith=item.subject[:12].upper())),
(0, 1) # istartswith search is broken on some EWS versions
)
self.assertEqual(
len(common_qs.filter(subject__istartswith=item.subject[:12])),
1
)
self.bulk_delete(ids)
def test_filter_with_querystring(self):
# QueryString is only supported from Exchange 2010
with self.assertRaises(NotImplementedError):
Q('Subject:XXX').to_xml(self.test_folder, version=mock_version(build=EXCHANGE_2007),
applies_to=Restriction.ITEMS)
# We don't allow QueryString in combination with other restrictions
with self.assertRaises(ValueError):
self.test_folder.filter('Subject:XXX', foo='bar')
with self.assertRaises(ValueError):
self.test_folder.filter('Subject:XXX').filter(foo='bar')
with self.assertRaises(ValueError):
self.test_folder.filter(foo='bar').filter('Subject:XXX')
item = self.get_test_item()
item.subject = get_random_string(length=8, spaces=False, special=False)
item.save()
# For some reason, the querystring search doesn't work instantly. We may have to wait for up to 60 seconds.
# I'm too impatient for that, so also allow empty results. This makes the test almost worthless but I blame EWS.
self.assertIn(
len(self.test_folder.filter('Subject:%s' % item.subject)),
(0, 1)
)
item.delete()
def test_filter_on_all_fields(self):
# Test that we can filter on all field names
# TODO: Test filtering on subfields of IndexedField
item = self.get_test_item()
if hasattr(item, 'is_all_day'):
item.is_all_day = False # Make sure start- and end dates don't change
ids = self.test_folder.bulk_create(items=[item])
common_qs = self.test_folder.filter(categories__contains=self.categories)
for f in self.ITEM_CLASS.FIELDS:
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if not f.is_searchable:
# Cannot be used in a QuerySet
continue
val = getattr(item, f.name)
if val is None:
# We cannot filter on None values
continue
if self.ITEM_CLASS == Contact and f.name in ('body', 'display_name'):
# filtering 'body' or 'display_name' on Contact items doesn't work at all. Error in EWS?
continue
if f.is_list:
# Filter multi-value fields with =, __in and __contains
if issubclass(f.value_cls, MultiFieldIndexedElement):
# For these, we need to filter on the subfield
filter_kwargs = []
for v in val:
for subfield in f.value_cls.supported_fields(version=self.account.version):
field_path = FieldPath(field=f, label=v.label, subfield=subfield)
path, subval = field_path.path, field_path.get_value(item)
if subval is None:
continue
filter_kwargs.extend([
{path: subval}, {'%s__in' % path: [subval]}, {'%s__contains' % path: [subval]}
])
elif issubclass(f.value_cls, SingleFieldIndexedElement):
# For these, we may filter by item or subfield value
filter_kwargs = []
for v in val:
for subfield in f.value_cls.supported_fields(version=self.account.version):
field_path = FieldPath(field=f, label=v.label, subfield=subfield)
path, subval = field_path.path, field_path.get_value(item)
if subval is None:
continue
filter_kwargs.extend([
{f.name: v}, {path: subval},
{'%s__in' % path: [subval]}, {'%s__contains' % path: [subval]}
])
else:
filter_kwargs = [{'%s__in' % f.name: val}, {'%s__contains' % f.name: val}]
else:
# Filter all others with =, __in and __contains. We could have more filters here, but these should
# always match.
filter_kwargs = [{f.name: val}, {'%s__in' % f.name: [val]}]
if isinstance(f, TextField) and not isinstance(f, (ChoiceField, BodyField)):
# Choice fields cannot be filtered using __contains. BodyField often works in practice but often
# fails with generated test data. Ugh.
filter_kwargs.append({'%s__contains' % f.name: val[2:10]})
for kw in filter_kwargs:
self.assertEqual(len(common_qs.filter(**kw)), 1, (f.name, val, kw))
self.bulk_delete(ids)
def test_text_field_settings(self):
# Test that the max_length and is_complex field settings are correctly set for text fields
item = self.get_test_item().save()
for f in self.ITEM_CLASS.FIELDS:
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if not isinstance(f, TextField):
continue
if isinstance(f, ChoiceField):
# This one can't contain random values
continue
if isinstance(f, CultureField):
# This one can't contain random values
continue
if f.is_read_only:
continue
if f.name == 'categories':
# We're filtering on this one, so leave it alone
continue
old_max_length = getattr(f, 'max_length', None)
old_is_complex = f.is_complex
try:
# Set a string long enough to not be handled by FindItems
f.max_length = 4000
if f.is_list:
setattr(item, f.name, [get_random_string(f.max_length) for _ in range(len(getattr(item, f.name)))])
else:
setattr(item, f.name, get_random_string(f.max_length))
try:
item.save(update_fields=[f.name])
except ErrorPropertyUpdate:
# Some fields throw this error when updated to a huge value
self.assertIn(f.name, ['given_name', 'middle_name', 'surname'])
continue
except ErrorInvalidPropertySet:
# Some fields can not be updated after save
self.assertTrue(f.is_read_only_after_send)
continue
# is_complex=True forces the query to use GetItems which will always get the full value
f.is_complex = True
new_full_item = self.test_folder.all().only(f.name).get(categories__contains=self.categories)
new_full = getattr(new_full_item, f.name)
if old_max_length:
if f.is_list:
for s in new_full:
self.assertLessEqual(len(s), old_max_length, (f.name, len(s), old_max_length))
else:
self.assertLessEqual(len(new_full), old_max_length, (f.name, len(new_full), old_max_length))
# is_complex=False forces the query to use FindItems which will only get the short value
f.is_complex = False
new_short_item = self.test_folder.all().only(f.name).get(categories__contains=self.categories)
new_short = getattr(new_short_item, f.name)
if not old_is_complex:
self.assertEqual(new_short, new_full, (f.name, new_short, new_full))
finally:
if old_max_length:
f.max_length = old_max_length
else:
delattr(f, 'max_length')
f.is_complex = old_is_complex
def test_complex_fields(self):
# Test that complex fields can be fetched using only(). This is a test for #141.
insert_kwargs = self.get_random_insert_kwargs()
if 'is_all_day' in insert_kwargs:
insert_kwargs['is_all_day'] = False
item = self.ITEM_CLASS(account=self.account, folder=self.test_folder, **insert_kwargs).save()
for f in self.ITEM_CLASS.FIELDS:
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if f.name in ('optional_attendees', 'required_attendees', 'resources'):
continue
if f.is_read_only:
continue
if f.name == 'reminder_due_by':
# EWS sets a default value if it is not set on insert. Ignore
continue
if f.name == 'mime_content':
# This will change depending on other contents fields
continue
old = getattr(item, f.name)
# Test field as single element in only()
for fresh_item in self.test_folder.filter(categories__contains=item.categories).only(f.name):
new = getattr(fresh_item, f.name)
if f.is_list:
old, new = set(old or ()), set(new or ())
self.assertEqual(old, new, (f.name, old, new))
# Test field as one of the elements in only()
for fresh_item in self.test_folder.filter(categories__contains=item.categories).only('subject', f.name):
new = getattr(fresh_item, f.name)
if f.is_list:
old, new = set(old or ()), set(new or ())
self.assertEqual(old, new, (f.name, old, new))
self.bulk_delete([item])
def test_text_body(self):
if self.account.version.build < EXCHANGE_2013:
raise self.skipTest('Exchange version too old')
item = self.get_test_item()
item.body = 'X' * 500 # Make body longer than the normal 256 char text field limit
item.save()
fresh_item = self.test_folder.filter(categories__contains=item.categories).only('text_body')[0]
self.assertEqual(fresh_item.text_body, item.body)
item.delete()
def test_only_fields(self):
item = self.get_test_item()
self.test_folder.bulk_create(items=[item, item])
items = self.test_folder.filter(categories__contains=item.categories)
for item in items:
self.assertIsInstance(item, self.ITEM_CLASS)
for f in self.ITEM_CLASS.FIELDS:
self.assertTrue(hasattr(item, f.name))
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if f.name in ('optional_attendees', 'required_attendees', 'resources'):
continue
if f.name == 'reminder_due_by' and not item.reminder_is_set:
# We delete the due date if reminder is not set
continue
elif f.is_read_only:
continue
self.assertIsNotNone(getattr(item, f.name), (f, getattr(item, f.name)))
self.assertEqual(len(items), 2)
only_fields = ('subject', 'body', 'categories')
items = self.test_folder.filter(categories__contains=item.categories).only(*only_fields)
for item in items:
self.assertIsInstance(item, self.ITEM_CLASS)
for f in self.ITEM_CLASS.FIELDS:
self.assertTrue(hasattr(item, f.name))
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if f.name in only_fields:
self.assertIsNotNone(getattr(item, f.name), (f.name, getattr(item, f.name)))
elif f.is_required:
v = getattr(item, f.name)
if f.name == 'attachments':
self.assertEqual(v, [], (f.name, v))
elif f.default is None:
self.assertIsNone(v, (f.name, v))
else:
self.assertEqual(v, f.default, (f.name, v))
self.assertEqual(len(items), 2)
self.bulk_delete(items)
def test_save_and_delete(self):
# Test that we can create, update and delete single items using methods directly on the item.
# For CalendarItem instances, the 'is_all_day' attribute affects the 'start' and 'end' values. Changing from
# 'false' to 'true' removes the time part of these datetimes.
insert_kwargs = self.get_random_insert_kwargs()
if 'is_all_day' in insert_kwargs:
insert_kwargs['is_all_day'] = False
item = self.ITEM_CLASS(account=self.account, folder=self.test_folder, **insert_kwargs)
self.assertIsNone(item.id)
self.assertIsNone(item.changekey)
# Create
item.save()
self.assertIsNotNone(item.id)
self.assertIsNotNone(item.changekey)
for k, v in insert_kwargs.items():
self.assertEqual(getattr(item, k), v, (k, getattr(item, k), v))
# Test that whatever we have locally also matches whatever is in the DB
fresh_item = list(self.account.fetch(ids=[item]))[0]
for f in item.FIELDS:
old, new = getattr(item, f.name), getattr(fresh_item, f.name)
if f.is_read_only and old is None:
# Some fields are automatically set server-side
continue
if f.name == 'reminder_due_by':
# EWS sets a default value if it is not set on insert. Ignore
continue
if f.name == 'mime_content':
# This will change depending on other contents fields
continue
if f.is_list:
old, new = set(old or ()), set(new or ())
self.assertEqual(old, new, (f.name, old, new))
# Update
update_kwargs = self.get_random_update_kwargs(item=item, insert_kwargs=insert_kwargs)
for k, v in update_kwargs.items():
setattr(item, k, v)
item.save()
for k, v in update_kwargs.items():
self.assertEqual(getattr(item, k), v, (k, getattr(item, k), v))
# Test that whatever we have locally also matches whatever is in the DB
fresh_item = list(self.account.fetch(ids=[item]))[0]
for f in item.FIELDS:
old, new = getattr(item, f.name), getattr(fresh_item, f.name)
if f.is_read_only and old is None:
# Some fields are automatically updated server-side
continue
if f.name == 'mime_content':
# This will change depending on other contents fields
continue
if f.name == 'reminder_due_by':
if new is None:
# EWS does not always return a value if reminder_is_set is False.
continue
if old is not None:
# EWS sometimes randomly sets the new reminder due date to one month before or after we
# wanted it, and sometimes 30 days before or after. But only sometimes...
old_date = old.astimezone(self.account.default_timezone).date()
new_date = new.astimezone(self.account.default_timezone).date()
if relativedelta(month=1) + new_date == old_date:
item.reminder_due_by = new
continue
if relativedelta(month=1) + old_date == new_date:
item.reminder_due_by = new
continue
elif abs(old_date - new_date) == datetime.timedelta(days=30):
item.reminder_due_by = new
continue
if f.is_list:
old, new = set(old or ()), set(new or ())
self.assertEqual(old, new, (f.name, old, new))
# Hard delete
item_id = (item.id, item.changekey)
item.delete()
for e in self.account.fetch(ids=[item_id]):
# It's gone from the account
self.assertIsInstance(e, ErrorItemNotFound)
# Really gone, not just changed ItemId
items = self.test_folder.filter(categories__contains=item.categories)
self.assertEqual(len(items), 0)
def test_item(self):
# Test insert
# For CalendarItem instances, the 'is_all_day' attribute affects the 'start' and 'end' values. Changing from
# 'false' to 'true' removes the time part of these datetimes.
insert_kwargs = self.get_random_insert_kwargs()
if 'is_all_day' in insert_kwargs:
insert_kwargs['is_all_day'] = False
item = self.ITEM_CLASS(**insert_kwargs)
# Test with generator as argument
insert_ids = self.test_folder.bulk_create(items=(i for i in [item]))
self.assertEqual(len(insert_ids), 1)
self.assertIsInstance(insert_ids[0], BaseItem)
find_ids = self.test_folder.filter(categories__contains=item.categories).values_list('id', 'changekey')
self.assertEqual(len(find_ids), 1)
self.assertEqual(len(find_ids[0]), 2, find_ids[0])
self.assertEqual(insert_ids, list(find_ids))
# Test with generator as argument
item = list(self.account.fetch(ids=(i for i in find_ids)))[0]
for f in self.ITEM_CLASS.FIELDS:
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if f.is_read_only:
continue
if f.name == 'reminder_due_by':
# EWS sets a default value if it is not set on insert. Ignore
continue
if f.name == 'mime_content':
# This will change depending on other contents fields
continue
old, new = getattr(item, f.name), insert_kwargs[f.name]
if f.is_list:
old, new = set(old or ()), set(new or ())
self.assertEqual(old, new, (f.name, old, new))
# Test update
update_kwargs = self.get_random_update_kwargs(item=item, insert_kwargs=insert_kwargs)
if self.ITEM_CLASS in (Contact, DistributionList):
# Contact and DistributionList don't support mime_type updates at all
update_kwargs.pop('mime_content', None)
update_fieldnames = [f for f in update_kwargs.keys() if f != 'attachments']
for k, v in update_kwargs.items():
setattr(item, k, v)
# Test with generator as argument
update_ids = self.account.bulk_update(items=(i for i in [(item, update_fieldnames)]))
self.assertEqual(len(update_ids), 1)
self.assertEqual(len(update_ids[0]), 2, update_ids)
self.assertEqual(insert_ids[0].id, update_ids[0][0]) # ID should be the same
self.assertNotEqual(insert_ids[0].changekey, update_ids[0][1]) # Changekey should change when item is updated
item = list(self.account.fetch(update_ids))[0]
for f in self.ITEM_CLASS.FIELDS:
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if f.is_read_only or f.is_read_only_after_send:
# These cannot be changed
continue
if f.name == 'mime_content':
# This will change depending on other contents fields
continue
old, new = getattr(item, f.name), update_kwargs[f.name]
if f.name == 'reminder_due_by':
if old is None:
# EWS does not always return a value if reminder_is_set is False. Set one now
item.reminder_due_by = new
continue
elif old is not None and new is not None:
# EWS sometimes randomly sets the new reminder due date to one month before or after we
# wanted it, and sometimes 30 days before or after. But only sometimes...
old_date = old.astimezone(self.account.default_timezone).date()
new_date = new.astimezone(self.account.default_timezone).date()
if relativedelta(month=1) + new_date == old_date:
item.reminder_due_by = new
continue
if relativedelta(month=1) + old_date == new_date:
item.reminder_due_by = new
continue
elif abs(old_date - new_date) == datetime.timedelta(days=30):
item.reminder_due_by = new
continue
if f.is_list:
old, new = set(old or ()), set(new or ())
self.assertEqual(old, new, (f.name, old, new))
# Test wiping or removing fields
wipe_kwargs = {}
for f in self.ITEM_CLASS.FIELDS:
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if f.is_required or f.is_required_after_save:
# These cannot be deleted
continue
if f.is_read_only or f.is_read_only_after_send:
# These cannot be changed
continue
wipe_kwargs[f.name] = None
for k, v in wipe_kwargs.items():
setattr(item, k, v)
wipe_ids = self.account.bulk_update([(item, update_fieldnames), ])
self.assertEqual(len(wipe_ids), 1)
self.assertEqual(len(wipe_ids[0]), 2, wipe_ids)
self.assertEqual(insert_ids[0].id, wipe_ids[0][0]) # ID should be the same
self.assertNotEqual(insert_ids[0].changekey,
wipe_ids[0][1]) # Changekey should not be the same when item is updated
item = list(self.account.fetch(wipe_ids))[0]
for f in self.ITEM_CLASS.FIELDS:
if not f.supports_version(self.account.version):
# Cannot be used with this EWS version
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if f.is_required or f.is_required_after_save:
continue
if f.is_read_only or f.is_read_only_after_send:
continue
old, new = getattr(item, f.name), wipe_kwargs[f.name]
if f.is_list:
old, new = set(old or ()), set(new or ())
self.assertEqual(old, new, (f.name, old, new))
try:
self.ITEM_CLASS.register('extern_id', ExternId)
# Test extern_id = None, which deletes the extended property entirely
extern_id = None
item.extern_id = extern_id
wipe2_ids = self.account.bulk_update([(item, ['extern_id']), ])
self.assertEqual(len(wipe2_ids), 1)
self.assertEqual(len(wipe2_ids[0]), 2, wipe2_ids)
self.assertEqual(insert_ids[0].id, wipe2_ids[0][0]) # ID should be the same
self.assertNotEqual(insert_ids[0].changekey, wipe2_ids[0][1]) # Changekey should change when item is updated
item = list(self.account.fetch(wipe2_ids))[0]
self.assertEqual(item.extern_id, extern_id)
finally:
self.ITEM_CLASS.deregister('extern_id')
# Remove test item. Test with generator as argument
self.bulk_delete(ids=(i for i in wipe2_ids))
def test_export_and_upload(self):
# 15 new items which we will attempt to export and re-upload
items = [self.get_test_item().save() for _ in range(15)]
ids = [(i.id, i.changekey) for i in items]
# re-fetch items because there will be some extra fields added by the server
items = list(self.account.fetch(items))
# Try exporting and making sure we get the right response
export_results = self.account.export(items)
self.assertEqual(len(items), len(export_results))
for result in export_results:
self.assertIsInstance(result, str)
# Try reuploading our results
upload_results = self.account.upload([(self.test_folder, data) for data in export_results])
self.assertEqual(len(items), len(upload_results), (items, upload_results))
for result in upload_results:
# Must be a completely new ItemId
self.assertIsInstance(result, tuple)
self.assertNotIn(result, ids)
# Check the items uploaded are the same as the original items
def to_dict(item):
dict_item = {}
# fieldnames is everything except the ID so we'll use it to compare
for f in item.FIELDS:
# datetime_created and last_modified_time aren't copied, but instead are added to the new item after
# uploading. This means mime_content and size can also change. Items also get new IDs on upload. And
# meeting_count values are dependent on contents of current calendar. Form query strings contain the
# item ID and will also change.
if f.name in {'id', 'changekey', 'first_occurrence', 'last_occurrence', 'datetime_created',
'last_modified_time', 'mime_content', 'size', 'conversation_id',
'adjacent_meeting_count', 'conflicting_meeting_count',
'web_client_read_form_query_string', 'web_client_edit_form_query_string'}:
continue
dict_item[f.name] = getattr(item, f.name)
if f.name == 'attachments':
# Attachments get new IDs on upload. Wipe them here so we can compare the other fields
for a in dict_item[f.name]:
a.attachment_id = None
return dict_item
uploaded_items = sorted([to_dict(item) for item in self.account.fetch(upload_results)],
key=lambda i: i['subject'])
original_items = sorted([to_dict(item) for item in items], key=lambda i: i['subject'])
self.assertListEqual(original_items, uploaded_items)
# Clean up after ourselves
self.bulk_delete(ids=upload_results)
self.bulk_delete(ids=ids)
def test_export_with_error(self):
# 15 new items which we will attempt to export and re-upload
items = [self.get_test_item().save() for _ in range(15)]
# Use id tuples for export here because deleting an item clears it's
# id.
ids = [(item.id, item.changekey) for item in items]
# Delete one of the items, this will cause an error
items[3].delete()
export_results = self.account.export(ids)
self.assertEqual(len(items), len(export_results))
for idx, result in enumerate(export_results):
if idx == 3:
# If it is the one returning the error
self.assertIsInstance(result, ErrorItemNotFound)
else:
self.assertIsInstance(result, str)
# Clean up after yourself
del ids[3] # Sending the deleted one through will cause an error
self.bulk_delete(ids)
def test_item_attachments(self):
item = self.get_test_item(folder=self.test_folder)
item.attachments = []
attached_item1 = self.get_test_item(folder=self.test_folder)
attached_item1.attachments = []
if hasattr(attached_item1, 'is_all_day'):
attached_item1.is_all_day = False
attached_item1.save()
attachment1 = ItemAttachment(name='attachment1', item=attached_item1)
item.attach(attachment1)
self.assertEqual(len(item.attachments), 1)
item.save()
fresh_item = list(self.account.fetch(ids=[item]))[0]
self.assertEqual(len(fresh_item.attachments), 1)
fresh_attachments = sorted(fresh_item.attachments, key=lambda a: a.name)
self.assertEqual(fresh_attachments[0].name, 'attachment1')
self.assertIsInstance(fresh_attachments[0].item, self.ITEM_CLASS)
for f in self.ITEM_CLASS.FIELDS:
# Normalize some values we don't control
if f.is_read_only:
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if isinstance(f, ExtendedPropertyField):
# Attachments don't have these values. It may be possible to request it if we can find the FieldURI
continue
if f.name == 'is_read':
# This is always true for item attachments?
continue
if f.name == 'reminder_due_by':
# EWS sets a default value if it is not set on insert. Ignore
continue
if f.name == 'mime_content':
# This will change depending on other contents fields
continue
old_val = getattr(attached_item1, f.name)
new_val = getattr(fresh_attachments[0].item, f.name)
if f.is_list:
old_val, new_val = set(old_val or ()), set(new_val or ())
self.assertEqual(old_val, new_val, (f.name, old_val, new_val))
# Test attach on saved object
attached_item2 = self.get_test_item(folder=self.test_folder)
attached_item2.attachments = []
if hasattr(attached_item2, 'is_all_day'):
attached_item2.is_all_day = False
attached_item2.save()
attachment2 = ItemAttachment(name='attachment2', item=attached_item2)
item.attach(attachment2)
self.assertEqual(len(item.attachments), 2)
fresh_item = list(self.account.fetch(ids=[item]))[0]
self.assertEqual(len(fresh_item.attachments), 2)
fresh_attachments = sorted(fresh_item.attachments, key=lambda a: a.name)
self.assertEqual(fresh_attachments[0].name, 'attachment1')
self.assertIsInstance(fresh_attachments[0].item, self.ITEM_CLASS)
for f in self.ITEM_CLASS.FIELDS:
# Normalize some values we don't control
if f.is_read_only:
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if isinstance(f, ExtendedPropertyField):
# Attachments don't have these values. It may be possible to request it if we can find the FieldURI
continue
if f.name == 'reminder_due_by':
# EWS sets a default value if it is not set on insert. Ignore
continue
if f.name == 'is_read':
# This is always true for item attachments?
continue
if f.name == 'mime_content':
# This will change depending on other contents fields
continue
old_val = getattr(attached_item1, f.name)
new_val = getattr(fresh_attachments[0].item, f.name)
if f.is_list:
old_val, new_val = set(old_val or ()), set(new_val or ())
self.assertEqual(old_val, new_val, (f.name, old_val, new_val))
self.assertEqual(fresh_attachments[1].name, 'attachment2')
self.assertIsInstance(fresh_attachments[1].item, self.ITEM_CLASS)
for f in self.ITEM_CLASS.FIELDS:
# Normalize some values we don't control
if f.is_read_only:
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if isinstance(f, ExtendedPropertyField):
# Attachments don't have these values. It may be possible to request it if we can find the FieldURI
continue
if f.name == 'reminder_due_by':
# EWS sets a default value if it is not set on insert. Ignore
continue
if f.name == 'is_read':
# This is always true for item attachments?
continue
if f.name == 'mime_content':
# This will change depending on other contents fields
continue
old_val = getattr(attached_item2, f.name)
new_val = getattr(fresh_attachments[1].item, f.name)
if f.is_list:
old_val, new_val = set(old_val or ()), set(new_val or ())
self.assertEqual(old_val, new_val, (f.name, old_val, new_val))
# Test detach
item.detach(attachment2)
self.assertTrue(attachment2.attachment_id is None)
self.assertTrue(attachment2.parent_item is None)
fresh_item = list(self.account.fetch(ids=[item]))[0]
self.assertEqual(len(fresh_item.attachments), 1)
fresh_attachments = sorted(fresh_item.attachments, key=lambda a: a.name)
for f in self.ITEM_CLASS.FIELDS:
# Normalize some values we don't control
if f.is_read_only:
continue
if self.ITEM_CLASS == CalendarItem and f in CalendarItem.timezone_fields():
# Timezone fields will (and must) be populated automatically from the timestamp
continue
if isinstance(f, ExtendedPropertyField):
# Attachments don't have these values. It may be possible to request it if we can find the FieldURI
continue
if f.name == 'reminder_due_by':
# EWS sets a default value if it is not set on insert. Ignore
continue
if f.name == 'is_read':
# This is always true for item attachments?
continue
if f.name == 'mime_content':
# This will change depending on other contents fields
continue
old_val = getattr(attached_item1, f.name)
new_val = getattr(fresh_attachments[0].item, f.name)
if f.is_list:
old_val, new_val = set(old_val or ()), set(new_val or ())
self.assertEqual(old_val, new_val, (f.name, old_val, new_val))
# Test attach with non-saved item
attached_item3 = self.get_test_item(folder=self.test_folder)
attached_item3.attachments = []
if hasattr(attached_item3, 'is_all_day'):
attached_item3.is_all_day = False
attachment3 = ItemAttachment(name='attachment2', item=attached_item3)
item.attach(attachment3)
item.detach(attachment3)
class CalendarTest(CommonItemTest):
TEST_FOLDER = 'calendar'
FOLDER_CLASS = Calendar
ITEM_CLASS = CalendarItem
def test_updating_timestamps(self):
# Test that we can update an item without changing anything, and maintain the hidden timezone fields as local
# timezones, and that returned timestamps are in UTC.
item = self.get_test_item()
item.reminder_is_set = True
item.is_all_day = False
item.save()
for i in self.account.calendar.filter(categories__contains=self.categories).only('start', 'end', 'categories'):
self.assertEqual(i.start, item.start)
self.assertEqual(i.start.tzinfo, UTC)
self.assertEqual(i.end, item.end)
self.assertEqual(i.end.tzinfo, UTC)
self.assertEqual(i._start_timezone, self.account.default_timezone)
self.assertEqual(i._end_timezone, self.account.default_timezone)
i.save(update_fields=['start', 'end'])
self.assertEqual(i.start, item.start)
self.assertEqual(i.start.tzinfo, UTC)
self.assertEqual(i.end, item.end)
self.assertEqual(i.end.tzinfo, UTC)
self.assertEqual(i._start_timezone, self.account.default_timezone)
self.assertEqual(i._end_timezone, self.account.default_timezone)
for i in self.account.calendar.filter(categories__contains=self.categories).only('start', 'end', 'categories'):
self.assertEqual(i.start, item.start)
self.assertEqual(i.start.tzinfo, UTC)
self.assertEqual(i.end, item.end)
self.assertEqual(i.end.tzinfo, UTC)
self.assertEqual(i._start_timezone, self.account.default_timezone)
self.assertEqual(i._end_timezone, self.account.default_timezone)
i.delete()
def test_update_to_non_utc_datetime(self):
# Test updating with non-UTC datetime values. This is a separate code path in UpdateItem code
item = self.get_test_item()
item.reminder_is_set = True
item.is_all_day = False
item.save()
# Update start, end and recurrence with timezoned datetimes. For some reason, EWS throws
# 'ErrorOccurrenceTimeSpanTooBig' is we go back in time.
start = get_random_date(start_date=item.start.date() + datetime.timedelta(days=1))
dt_start, dt_end = [dt.astimezone(self.account.default_timezone) for dt in
get_random_datetime_range(start_date=start, end_date=start, tz=self.account.default_timezone)]
item.start, item.end = dt_start, dt_end
item.recurrence.boundary.start = dt_start.date()
item.save()
item.refresh()
self.assertEqual(item.start, dt_start)
self.assertEqual(item.end, dt_end)
def test_all_day_datetimes(self):
# Test that start and end datetimes for all-day items are returned in the datetime of the account.
start = get_random_date()
start_dt, end_dt = get_random_datetime_range(
start_date=start,
end_date=start + datetime.timedelta(days=365),
tz=self.account.default_timezone
)
item = self.ITEM_CLASS(folder=self.test_folder, start=start_dt, end=end_dt, is_all_day=True,
categories=self.categories)
item.save()
item = self.test_folder.all().only('start', 'end').get(id=item.id, changekey=item.changekey)
self.assertEqual(item.start.astimezone(self.account.default_timezone).time(), datetime.time(0, 0))
self.assertEqual(item.end.astimezone(self.account.default_timezone).time(), datetime.time(0, 0))
item.delete()
def test_view(self):
item1 = self.ITEM_CLASS(
account=self.account,
folder=self.test_folder,
subject=get_random_string(16),
start=self.account.default_timezone.localize(EWSDateTime(2016, 1, 1, 8)),
end=self.account.default_timezone.localize(EWSDateTime(2016, 1, 1, 10)),
categories=self.categories,
)
item2 = self.ITEM_CLASS(
account=self.account,
folder=self.test_folder,
subject=get_random_string(16),
start=self.account.default_timezone.localize(EWSDateTime(2016, 2, 1, 8)),
end=self.account.default_timezone.localize(EWSDateTime(2016, 2, 1, 10)),
categories=self.categories,
)
self.test_folder.bulk_create(items=[item1, item2])
# Test missing args
with self.assertRaises(TypeError):
self.test_folder.view()
# Test bad args
with self.assertRaises(ValueError):
list(self.test_folder.view(start=item1.end, end=item1.start))
with self.assertRaises(TypeError):
list(self.test_folder.view(start='xxx', end=item1.end))
with self.assertRaises(ValueError):
list(self.test_folder.view(start=item1.start, end=item1.end, max_items=0))
def match_cat(i):
return set(i.categories) == set(self.categories)
# Test dates
self.assertEqual(
len([i for i in self.test_folder.view(start=item1.start, end=item1.end) if match_cat(i)]),
1
)
self.assertEqual(
len([i for i in self.test_folder.view(start=item1.start, end=item2.end) if match_cat(i)]),
2
)
# Edge cases. Get view from end of item1 to start of item2. Should logically return 0 items, but Exchange wants
# it differently and returns item1 even though there is no overlap.
self.assertEqual(
len([i for i in self.test_folder.view(start=item1.end, end=item2.start) if match_cat(i)]),
1
)
self.assertEqual(
len([i for i in self.test_folder.view(start=item1.start, end=item2.start) if match_cat(i)]),
1
)
# Test max_items
self.assertEqual(
len([i for i in self.test_folder.view(start=item1.start, end=item2.end, max_items=9999) if match_cat(i)]),
2
)
self.assertEqual(
len(self.test_folder.view(start=item1.start, end=item2.end, max_items=1)),
1
)
# Test chaining
qs = self.test_folder.view(start=item1.start, end=item2.end)
self.assertTrue(qs.count() >= 2)
with self.assertRaises(ErrorInvalidOperation):
qs.filter(subject=item1.subject).count() # EWS does not allow restrictions
self.assertListEqual(
[i for i in qs.order_by('subject').values('subject') if i['subject'] in (item1.subject, item2.subject)],
[{'subject': s} for s in sorted([item1.subject, item2.subject])]
)
def test_recurring_items(self):
tz = self.account.default_timezone
item = CalendarItem(
folder=self.test_folder,
start=tz.localize(EWSDateTime(2017, 9, 4, 11)),
end=tz.localize(EWSDateTime(2017, 9, 4, 13)),
subject='Hello Recurrence',
recurrence=Recurrence(
pattern=WeeklyPattern(interval=3, weekdays=[MONDAY, WEDNESDAY]),
start=EWSDate(2017, 9, 4),
number=7
),
categories=self.categories,
).save()
# Occurrence data for the master item
fresh_item = self.test_folder.get(id=item.id, changekey=item.changekey)
self.assertEqual(
str(fresh_item.recurrence),
'Pattern: Occurs on weekdays Monday, Wednesday of every 3 week(s) where the first day of the week is '
'Monday, Boundary: NumberedPattern(start=EWSDate(2017, 9, 4), number=7)'
)
self.assertIsInstance(fresh_item.first_occurrence, FirstOccurrence)
self.assertEqual(fresh_item.first_occurrence.start, tz.localize(EWSDateTime(2017, 9, 4, 11)))
self.assertEqual(fresh_item.first_occurrence.end, tz.localize(EWSDateTime(2017, 9, 4, 13)))
self.assertIsInstance(fresh_item.last_occurrence, LastOccurrence)
self.assertEqual(fresh_item.last_occurrence.start, tz.localize(EWSDateTime(2017, 11, 6, 11)))
self.assertEqual(fresh_item.last_occurrence.end, tz.localize(EWSDateTime(2017, 11, 6, 13)))
self.assertEqual(fresh_item.modified_occurrences, None)
self.assertEqual(fresh_item.deleted_occurrences, None)
# All occurrences expanded
all_start_times = []
for i in self.test_folder.view(
start=tz.localize(EWSDateTime(2017, 9, 1)),
end=tz.localize(EWSDateTime(2017, 12, 1))
).only('start', 'categories').order_by('start'):
if i.categories != self.categories:
continue
all_start_times.append(i.start)
self.assertListEqual(
all_start_times,
[
tz.localize(EWSDateTime(2017, 9, 4, 11)),
tz.localize(EWSDateTime(2017, 9, 6, 11)),
tz.localize(EWSDateTime(2017, 9, 25, 11)),
tz.localize(EWSDateTime(2017, 9, 27, 11)),
tz.localize(EWSDateTime(2017, 10, 16, 11)),
tz.localize(EWSDateTime(2017, 10, 18, 11)),
tz.localize(EWSDateTime(2017, 11, 6, 11)),
]
)
# Test updating and deleting
i = 0
for occurrence in self.test_folder.view(
start=tz.localize(EWSDateTime(2017, 9, 1)),
end=tz.localize(EWSDateTime(2017, 12, 1)),
).order_by('start'):
if occurrence.categories != self.categories:
continue
if i % 2:
# Delete every other occurrence (items 1, 3 and 5)
occurrence.delete()
else:
# Update every other occurrence (items 0, 2, 4 and 6)
occurrence.refresh() # changekey is sometimes updated. Possible due to neighbour occurrences changing?
# We receive timestamps as UTC but want to write them back as local timezone
occurrence.start = occurrence.start.astimezone(tz)
occurrence.start += datetime.timedelta(minutes=30)
occurrence.end = occurrence.end.astimezone(tz)
occurrence.end += datetime.timedelta(minutes=30)
occurrence.subject = 'Changed Occurrence'
occurrence.save()
i += 1
# We should only get half the items of before, and start times should be shifted 30 minutes
updated_start_times = []
for i in self.test_folder.view(
start=tz.localize(EWSDateTime(2017, 9, 1)),
end=tz.localize(EWSDateTime(2017, 12, 1))
).only('start', 'subject', 'categories').order_by('start'):
if i.categories != self.categories:
continue
updated_start_times.append(i.start)
self.assertEqual(i.subject, 'Changed Occurrence')
self.assertListEqual(
updated_start_times,
[
tz.localize(EWSDateTime(2017, 9, 4, 11, 30)),
tz.localize(EWSDateTime(2017, 9, 25, 11, 30)),
tz.localize(EWSDateTime(2017, 10, 16, 11, 30)),
tz.localize(EWSDateTime(2017, 11, 6, 11, 30)),
]
)
# Test that the master item sees the deletes and updates
fresh_item = self.test_folder.get(id=item.id, changekey=item.changekey)
self.assertEqual(len(fresh_item.modified_occurrences), 4)
self.assertEqual(len(fresh_item.deleted_occurrences), 3)
class MessagesTest(CommonItemTest):
# Just test one of the Message-type folders
TEST_FOLDER = 'inbox'
FOLDER_CLASS = Inbox
ITEM_CLASS = Message
INCOMING_MESSAGE_TIMEOUT = 20
def get_incoming_message(self, subject):
t1 = time.time()
while True:
t2 = time.time()
if t2 - t1 > self.INCOMING_MESSAGE_TIMEOUT:
raise self.skipTest('Too bad. Gave up in %s waiting for the incoming message to show up' % self.id())
try:
return self.account.inbox.get(subject=subject)
except DoesNotExist:
time.sleep(5)
def test_send(self):
# Test that we can send (only) Message items
item = self.get_test_item()
item.folder = None
item.send()
self.assertIsNone(item.id)
self.assertIsNone(item.changekey)
self.assertEqual(len(self.test_folder.filter(categories__contains=item.categories)), 0)
def test_send_and_save(self):
# Test that we can send_and_save Message items
item = self.get_test_item()
item.send_and_save()
self.assertIsNone(item.id)
self.assertIsNone(item.changekey)
time.sleep(5) # Requests are supposed to be transactional, but apparently not...
# Also, the sent item may be followed by an automatic message with the same category
self.assertGreaterEqual(len(self.test_folder.filter(categories__contains=item.categories)), 1)
# Test update, although it makes little sense
item = self.get_test_item()
item.save()
item.send_and_save()
time.sleep(5) # Requests are supposed to be transactional, but apparently not...
# Also, the sent item may be followed by an automatic message with the same category
self.assertGreaterEqual(len(self.test_folder.filter(categories__contains=item.categories)), 1)
def test_send_draft(self):
item = self.get_test_item()
item.folder = self.account.drafts
item.is_draft = True
item.save() # Save a draft
item.send() # Send the draft
self.assertIsNone(item.id)
self.assertIsNone(item.changekey)
self.assertIsNone(item.folder)
self.assertEqual(len(self.test_folder.filter(categories__contains=item.categories)), 0)
def test_send_and_copy_to_folder(self):
item = self.get_test_item()
item.send(save_copy=True, copy_to_folder=self.account.sent) # Send the draft and save to the sent folder
self.assertIsNone(item.id)
self.assertIsNone(item.changekey)
self.assertEqual(item.folder, self.account.sent)
time.sleep(5) # Requests are supposed to be transactional, but apparently not...
self.assertEqual(len(self.account.sent.filter(categories__contains=item.categories)), 1)
def test_bulk_send(self):
with self.assertRaises(AttributeError):
self.account.bulk_send(ids=[], save_copy=False, copy_to_folder=self.account.trash)
item = self.get_test_item()
item.save()
for res in self.account.bulk_send(ids=[item]):
self.assertEqual(res, True)
time.sleep(10) # Requests are supposed to be transactional, but apparently not...
# By default, sent items are placed in the sent folder
ids = self.account.sent.filter(categories__contains=item.categories).values_list('id', 'changekey')
self.assertEqual(len(ids), 1)
self.bulk_delete(ids)
def test_reply(self):
# Test that we can reply to a Message item. EWS only allows items that have been sent to receive a reply
item = self.get_test_item()
item.folder = None
item.send() # get_test_item() sets the to_recipients to the test account
sent_item = self.get_incoming_message(item.subject)
new_subject = ('Re: %s' % sent_item.subject)[:255]
sent_item.reply(subject=new_subject, body='Hello reply', to_recipients=[item.author])
reply = self.get_incoming_message(new_subject)
self.account.bulk_delete([sent_item, reply])
def test_reply_all(self):
# Test that we can reply-all a Message item. EWS only allows items that have been sent to receive a reply
item = self.get_test_item(folder=None)
item.folder = None
item.send()
sent_item = self.get_incoming_message(item.subject)
new_subject = ('Re: %s' % sent_item.subject)[:255]
sent_item.reply_all(subject=new_subject, body='Hello reply')
reply = self.get_incoming_message(new_subject)
self.account.bulk_delete([sent_item, reply])
def test_forward(self):
# Test that we can forward a Message item. EWS only allows items that have been sent to receive a reply
item = self.get_test_item(folder=None)
item.folder = None
item.send()
sent_item = self.get_incoming_message(item.subject)
new_subject = ('Re: %s' % sent_item.subject)[:255]
sent_item.forward(subject=new_subject, body='Hello reply', to_recipients=[item.author])
reply = self.get_incoming_message(new_subject)
reply2 = sent_item.create_forward(subject=new_subject, body='Hello reply', to_recipients=[item.author])
reply2 = reply2.save(self.account.drafts)
self.assertIsInstance(reply2, Message)
self.account.bulk_delete([sent_item, reply, reply2])
def test_mime_content(self):
# Tests the 'mime_content' field
subject = get_random_string(16)
msg = MIMEMultipart()
msg['From'] = self.account.primary_smtp_address
msg['To'] = self.account.primary_smtp_address
msg['Subject'] = subject
body = 'MIME test mail'
msg.attach(MIMEText(body, 'plain', _charset='utf-8'))
mime_content = msg.as_string()
item = self.ITEM_CLASS(
folder=self.test_folder,
to_recipients=[self.account.primary_smtp_address],
mime_content=mime_content
).save()
self.assertEqual(self.test_folder.get(subject=subject).body, body)
item.delete()
class TasksTest(CommonItemTest):
TEST_FOLDER = 'tasks'
FOLDER_CLASS = Tasks
ITEM_CLASS = Task
def test_complete(self):
item = self.get_test_item().save()
item.refresh()
self.assertNotEqual(item.status, Task.COMPLETED)
self.assertNotEqual(item.percent_complete, Decimal(100))
item.complete()
item.refresh()
self.assertEqual(item.status, Task.COMPLETED)
self.assertEqual(item.percent_complete, Decimal(100))
class ContactsTest(CommonItemTest):
TEST_FOLDER = 'contacts'
FOLDER_CLASS = Contacts
ITEM_CLASS = Contact
def test_order_by_failure(self):
# Test error handling on indexed properties with labels and subfields
qs = QuerySet(
folder_collection=FolderCollection(account=self.account, folders=[self.test_folder])
).filter(categories__contains=self.categories)
with self.assertRaises(ValueError):
qs.order_by('email_addresses') # Must have label
with self.assertRaises(ValueError):
qs.order_by('email_addresses__FOO') # Must have a valid label
with self.assertRaises(ValueError):
qs.order_by('email_addresses__EmailAddress1__FOO') # Must not have a subfield
with self.assertRaises(ValueError):
qs.order_by('physical_addresses__Business') # Must have a subfield
with self.assertRaises(ValueError):
qs.order_by('physical_addresses__Business__FOO') # Must have a valid subfield
def test_distribution_lists(self):
dl = DistributionList(folder=self.test_folder, display_name=get_random_string(255), categories=self.categories)
dl.save()
new_dl = self.test_folder.get(categories__contains=dl.categories)
self.assertEqual(new_dl.display_name, dl.display_name)
self.assertEqual(new_dl.members, None)
dl.refresh()
dl.members = set(
# We set mailbox_type to OneOff because otherwise the email address must be an actual account
Member(mailbox=Mailbox(email_address=get_random_email(), mailbox_type='OneOff')) for _ in range(4)
)
dl.save()
new_dl = self.test_folder.get(categories__contains=dl.categories)
self.assertEqual({m.mailbox.email_address for m in new_dl.members}, dl.members)
dl.delete()
def test_find_people(self):
# The test server may not have any contacts. Just test that the FindPeople service and helpers work
self.assertGreaterEqual(len(list(self.test_folder.people())), 0)
self.assertGreaterEqual(
len(list(
self.test_folder.people().only('display_name').filter(display_name='john').order_by('display_name')
)),
0
)
def test_get_persona(self):
# The test server may not have any personas. Just test that the service response with something we can parse
persona = Persona(id='AAA=', changekey='xxx')
try:
GetPersona(protocol=self.account.protocol).call(persona=persona)
except ErrorInvalidIdMalformed:
pass
| [
"[email protected]"
] | |
e99d44683d10030de32eea47d3b31d3a6ce832c4 | 1ec89e2731d84f4fc4210060212ea80b002db277 | /pysph/examples/ghia_cavity_data.py | 0c9ded4878f9770d5ce8010d28b8f98994555831 | [
"BSD-3-Clause"
] | permissive | fight1314/pysph | 15600a3053f5bac41bf9c862914e870d93454e20 | 9bfa8d65cee39fbd470b8231e38e972df199a4da | refs/heads/master | 2020-07-21T20:44:26.866017 | 2019-09-04T20:16:53 | 2019-09-04T20:16:53 | 206,971,679 | 3 | 0 | NOASSERTION | 2019-09-07T13:24:51 | 2019-09-07T13:24:51 | null | UTF-8 | Python | false | false | 3,655 | py | """This module provides a few convenient functions for
the Lid Driven Cavity solutions in the paper:
"High-Re solutions for incompressible flow using the Navier-Stokes
equations and a multigrid method", U Ghia, K.N Ghia, C.T Shin,
JCP, Volume 48, Issue 3, December 1982, Pages 387-411.
"""
import numpy as np
from io import StringIO
RE = [100, 400, 1000, 3200, 5000, 7500, 10000]
# u velocity along vertical line through center (Table I)
table1 = u"""
1.0000 1.0000 1.00000 1.00000 1.00000 1.00000 1.00000 1.00000
0.9766 0.84123 0.75837 0.65928 0.53236 0.48223 0.47244 0.47221
0.9688 0.78871 0.68439 0.57492 0.48296 0.46120 0.47048 0.47783
0.9609 0.73722 0.61756 0.51117 0.46547 0.45992 0.47323 0.48070
0.9531 0.68717 0.55892 0.46604 0.46101 0.46036 0.47167 0.47804
0.8516 0.23151 0.29093 0.33304 0.34682 0.33556 0.34228 0.34635
0.7344 0.00332 0.16256 0.18719 0.19791 0.20087 0.2059 0.20673
0.6172 -0.13641 0.02135 0.05702 0.07156 0.08183 0.08342 0.08344
0.5000 -0.20581 -0.11477 -0.06080 -0.04272 -0.03039 -0.03800 0.03111
0.4531 -0.21090 -0.17119 -0.10648 -0.86636 -0.07404 -0.07503 -0.07540
0.2813 -0.15662 -0.32726 -0.27805 -0.24427 -0.22855 -0.23176 -0.23186
0.1719 -0.10150 -0.24299 -0.38289 -0.34323 -0.33050 -0.32393 -0.32709
0.1016 -0.06434 -0.14612 -0.29730 -0.41933 -0.40435 -0.38324 -0.38000
0.0703 -0.04775 -0.10338 -0.22220 -0.37827 -0.43643 -0.43025 -0.41657
0.0625 -0.04192 -0.09266 -0.20196 -0.35344 -0.42901 -0.43590 -0.42537
0.0547 -0.03717 -0.08186 -0.18109 -0.32407 -0.41165 -0.43154 -0.42735
0.0000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
"""
# v velocity along horizontal line through center (Table II)
table2 = u"""
1.0000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
0.9688 -0.05906 -0.12146 -0.21388 -0.39017 -0.49774 -0.53858 -0.54302
0.9609 -0.07391 -0.15663 -0.27669 -0.47425 -0.55069 -0.55216 -0.52987
0.9531 -0.08864 -0.19254 -0.33714 -0.52357 -0.55408 -0.52347 -0.49099
0.9453 -0.10313 -0.22847 -0.39188 -0.54053 -0.52876 -0.48590 -0.45863
0.9063 -0.16914 -0.23827 -0.51550 -0.44307 -0.41442 -0.41050 -0.41496
0.8594 -0.22445 -0.44993 -0.42665 -0.37401 -0.36214 -0.36213 -0.36737
0.8047 -0.24533 -0.38598 -0.31966 -0.31184 -0.30018 -0.30448 -0.30719
0.5000 0.05454 0.05188 0.02526 0.00999 0.00945 0.00824 0.00831
0.2344 0.17527 0.30174 0.32235 0.28188 0.27280 0.27348 0.27224
0.2266 0.17507 0.30203 0.33075 0.29030 0.28066 0.28117 0.28003
0.1563 0.16077 0.28124 0.37095 0.37119 0.35368 0.35060 0.35070
0.0938 0.12317 0.22965 0.32627 0.42768 0.42951 0.41824 0.41487
0.0781 0.10890 0.20920 0.30353 0.41906 0.43648 0.43564 0.43124
0.0703 0.10091 0.19713 0.29012 0.40917 0.43329 0.44030 0.43733
0.0625 0.09233 0.18360 0.27485 0.39560 0.42447 0.43979 0.43983
0.0000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000
"""
def _get_data(table):
data = np.loadtxt(StringIO(table))
y = data[:,0]
result = {}
for i, r in enumerate(RE):
result[r] = data[:,i+1]
return y, result
def get_u_vs_y():
"""Return the data from table 1, this returns an array y and a
dictionary, with the keys as the available Reynolds numbers.
"""
return _get_data(table1)
def get_v_vs_x():
"""Return the data from table 2, this returns an array x and a
dictionary, with the keys as the available Reynolds numbers.
"""
return _get_data(table2)
| [
"[email protected]"
] | |
7661ea76c637070772b50453020cc582db68ef5b | b4ce39af031a93354ade80d4206c26992159d7c7 | /Tutorials/Scope/Converting Local To Global.py | e434a4d9f566cf4f6e62207fb845331355581d81 | [] | no_license | Bibin22/pythonpgms | 4e19c7c62bc9c892db3fd8298c806f9fdfb86832 | e297d5a99db2f1c57e7fc94724af78138057439d | refs/heads/master | 2023-06-15T00:51:14.074564 | 2021-07-12T17:44:47 | 2021-07-12T17:44:47 | 315,982,691 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 108 | py | a = 10
def fname():
global a
a = 15
print('Inside the function', a)
fname()
print('Outside', a) | [
"[email protected]"
] | |
a411c7c8ec083f0a3500bac6c9f4fbebb6cbf0d4 | afdf82890966bd3061db0a2478ad600fb8528475 | /Chapter4/garbage.py | 3ae8e92079e19f310faffcd854cd780535b234ba | [] | no_license | humuhimi/wkwk_nlp | 7cd6653d7cdb2b8f171447c2628b8a517dd65d13 | 48a6ef3745bf2c97c5581034bf85450be5783664 | refs/heads/master | 2022-01-11T09:15:06.378166 | 2019-07-03T08:43:49 | 2019-07-03T08:43:49 | 191,727,302 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 962 | py | # ストップワードの除去:使用頻度の高い言葉を処理対象外にする
import MeCab
# mecab-ipadic-NEologd辞書指定してオブジェクト生成
tagger = MeCab.Tagger()
tagger.parse("")
# 形態素解析の結果をリストで取得、単語ごとにリストの要素に入ってる
node = tagger.parseToNode("機械学習をマスターしたい。")
result = []
#助詞や助動詞は拾わない
while node is not None:
# 品詞情報取得
# Node.featureのフォーマット:品詞,品詞細分類1,品詞細分類2,品詞細分類3,活用形,活用型,原形,読み,発音
hinshi = node.feature.split(",")[0]
if hinshi in ["名詞"]:
# 表層形の取得、単語の文字が入ってる
result.append(node.surface)
elif hinshi in["動詞","形容詞"]:
# 形態素情報から原形情報取得
result.append(node.feature.split(",")[6])
node = node.next
print(result)
| [
"[email protected]"
] | |
cdb0d8b6cd08ee4eb88fdc17d0efedfad34bbef7 | 9743d5fd24822f79c156ad112229e25adb9ed6f6 | /xai/brain/wordbase/nouns/_angina.py | a3b48acb4bd4e8c024e14b432ddc21b2b819b361 | [
"MIT"
] | permissive | cash2one/xai | de7adad1758f50dd6786bf0111e71a903f039b64 | e76f12c9f4dcf3ac1c7c08b0cc8844c0b0a104b6 | refs/heads/master | 2021-01-19T12:33:54.964379 | 2017-01-28T02:00:50 | 2017-01-28T02:00:50 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 420 | py |
#calss header
class _ANGINA():
def __init__(self,):
self.name = "ANGINA"
self.definitions = [u'a condition that causes strong chest pains because blood containing oxygen is prevented from reaching the heart muscle by blocked arteries: ']
self.parents = []
self.childen = []
self.properties = []
self.jsondata = {}
self.specie = 'nouns'
def run(self, obj1 = [], obj2 = []):
return self.jsondata
| [
"[email protected]"
] | |
74d6da60d8fb42c6a20f8541c42289571346ac04 | 942b0a9a24efa9dfc49ff4743180d9a412070359 | /LEARNING/IMPORT/3_RemoteLoad/base.py | 1150d0f6700110235ce38cf885994b3e832de242 | [] | no_license | atomicoo/python-tutorials | c48cd0e4b2b6e70ba177e40ea847c7b398139b62 | e630c9bb3bcddda874a4c0a5b02c7e4d47e1eb7e | refs/heads/master | 2023-02-02T09:46:21.147516 | 2020-12-17T03:59:06 | 2020-12-17T03:59:06 | 317,762,439 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,842 | py | import sys
from importlib import abc
from importlib.machinery import ModuleSpec
import imp
from urllib.request import urlopen
# Debugging
import logging
logging.basicConfig(format='%(asctime)s - %(pathname)s[line:%(lineno)d] - %(levelname)s: %(message)s',
level=logging.DEBUG)
logger = logging.getLogger(__name__)
def load_module(url):
logger.debug("Load module: get source from %s", url)
u = urlopen(url)
s = u.read().decode('utf-8')
logger.debug("Load module: create module %s", url)
m = sys.modules.setdefault(url, imp.new_module(url))
c = compile(s, url, 'exec')
m.__file__ = url
m.__package__ = ''
logger.debug("Load module: exec code object %s", c)
exec(c, m.__dict__)
return m
class UrlMetaFinder(abc.MetaPathFinder):
def __init__(self, baseurl):
self._baseurl = baseurl
def find_module(self, fullname, path=None):
logger.debug("Find module: fullname=%s, path=%s", fullname, path)
if path is None:
baseurl = self._baseurl
else:
if not path.startswith(self._baseurl):
return None
baseurl = path
try:
logger.debug("Find module: module %s found", fullname)
loader = UrlMetaLoader(baseurl)
return loader
except Exception:
logger.debug("Find module: module %s not found", fullname)
return None
# def find_spec(self, fullname, path=None, target=None):
# if path is None:
# baseurl = self._baseurl
# else:
# if not path.startswith(self._baseurl):
# return None
# baseurl = path
# try:
# loader = UrlMetaLoader(baseurl)
# return ModuleSpec(fullname, loader, is_package=loader.is_package(fullname))
# except Exception:
# return None
class UrlMetaLoader(abc.SourceLoader):
def __init__(self, baseurl):
self._baseurl = baseurl
# def load_module(self, fullname):
# c = self.get_code(fullname)
# m = sys.modules.setdefault(fullname, imp.new_module(fullname))
# m.__file__ = self.get_filename(fullname)
# m.__loader__ = self
# m.__package__ = fullname
# exec(c, m.__dict__)
# return None
def get_code(self, fullname):
u = urlopen(self.get_filename(fullname))
return u.read()
# def execute_module(self, module):
# pass
def get_data(self):
pass
def get_filename(self, fullname):
return self._baseurl + fullname + '.py'
def install_meta(address):
finder = UrlMetaFinder(address)
sys.meta_path.append(finder)
logger.debug('%s installed on sys.meta_path', finder)
if __name__ == '__main__':
print("Base Url Import.")
| [
"[email protected]"
] | |
a5cf496490118bc838a7e7ce72e2a774864993cf | 20aadf6ec9fd64d1d6dffff56b05853e0ab26b1f | /l5/L5_pbm9.py | d4eb630c9efd666ed8dafec822a97ccc812ed104 | [] | no_license | feminas-k/MITx---6.00.1x | 9a8e81630be784e5aaa890d811674962c66d56eb | 1ddf24c25220f8b5f78d36e2a3342b6babb40669 | refs/heads/master | 2021-01-19T00:59:57.434511 | 2016-06-13T18:13:17 | 2016-06-13T18:13:17 | 61,058,244 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 404 | py | def semordnilap(str1, str2):
'''
str1: a string
str2: a string
returns: True if str1 and str2 are semordnilap;
False otherwise.
'''
if len(str1) != len(str2):
return False
if len (str1)==1:
return str1 == str2
if str1[0]== str2[-1]:
return semordnilap(str1[1:],str2[:-1])
else:
return False
| [
"[email protected]"
] | |
e59e2f20fba580c5a353b118da2c2220bc2a4e2a | 9adc810b07f7172a7d0341f0b38088b4f5829cf4 | /rlkit/torch/dqn/double_dqn.py | 74b2f68bcafd5be7ce67a3fd89c50b4e34968553 | [
"MIT"
] | permissive | Asap7772/railrl_evalsawyer | 7ee9358b5277b9ddf2468f0c6d28beb92a5a0879 | baba8ce634d32a48c7dfe4dc03b123e18e96e0a3 | refs/heads/main | 2023-05-29T10:00:50.126508 | 2021-06-18T03:08:12 | 2021-06-18T03:08:12 | 375,810,557 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,826 | py | import numpy as np
import torch
import rlkit.torch.pytorch_util as ptu
from rlkit.misc.eval_util import create_stats_ordered_dict
from rlkit.torch.dqn.dqn import DQNTrainer
class DoubleDQNTrainer(DQNTrainer):
def train_from_torch(self, batch):
rewards = batch['rewards']
terminals = batch['terminals']
obs = batch['observations']
actions = batch['actions']
next_obs = batch['next_observations']
"""
Compute loss
"""
best_action_idxs = self.qf(next_obs).max(
1, keepdim=True
)[1]
target_q_values = self.target_qf(next_obs).gather(
1, best_action_idxs
).detach()
y_target = rewards + (1. - terminals) * self.discount * target_q_values
y_target = y_target.detach()
# actions is a one-hot vector
y_pred = torch.sum(self.qf(obs) * actions, dim=1, keepdim=True)
qf_loss = self.qf_criterion(y_pred, y_target)
"""
Update networks
"""
self.qf_optimizer.zero_grad()
qf_loss.backward()
self.qf_optimizer.step()
"""
Soft target network updates
"""
if self._n_train_steps_total % self.target_update_period == 0:
ptu.soft_update_from_to(
self.qf, self.target_qf, self.soft_target_tau
)
"""
Save some statistics for eval using just one batch.
"""
if self._need_to_update_eval_statistics:
self._need_to_update_eval_statistics = False
self.eval_statistics['QF Loss'] = np.mean(ptu.get_numpy(qf_loss))
self.eval_statistics.update(create_stats_ordered_dict(
'Y Predictions',
ptu.get_numpy(y_pred),
))
self._n_train_steps_total += 1
| [
"[email protected]"
] | |
1e38f163e306125853c3aa311d95f7dac5c202c5 | 18aee5d93a63eab684fe69e3aa0abd1372dd5d08 | /paddle/fluid/eager/auto_code_generator/generator/codegen_utils.py | 0ec006555e47f33e8f74624ace796dde354801f3 | [
"Apache-2.0"
] | permissive | Shixiaowei02/Paddle | 8d049f4f29e281de2fb1ffcd143997c88078eadb | 3d4d995f26c48f7792b325806ec3d110fc59f6fc | refs/heads/develop | 2023-06-26T06:25:48.074273 | 2023-06-14T06:40:21 | 2023-06-14T06:40:21 | 174,320,213 | 2 | 1 | Apache-2.0 | 2022-12-28T05:14:30 | 2019-03-07T10:09:34 | C++ | UTF-8 | Python | false | false | 18,349 | py | # Copyright (c) 2022 PaddlePaddle Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import re
import yaml
####################
# Global Variables #
####################
ops_to_fill_zero_for_empty_grads = {
"split_grad",
"split_with_num_grad",
"rnn_grad",
"matmul_double_grad",
"matmul_triple_grad",
"sigmoid_double_grad",
"sigmoid_triple_grad",
"add_double_grad",
"add_triple_grad",
"multiply_grad",
"multiply_double_grad",
"multiply_triple_grad",
"conv2d_grad_grad",
"conv2d_transpose_double_grad",
"batch_norm_double_grad",
"tanh_grad",
"tanh_double_grad",
"tanh_triple_grad",
"sin_double_grad",
"sin_triple_grad",
"cos_double_grad",
"cos_triple_grad",
"subtract_double_grad",
"divide_double_grad",
"log_double_grad",
"elu_double_grad",
"leaky_relu_double_grad",
"sqrt_double_grad",
"rsqrt_double_grad",
"square_double_grad",
"celu_double_grad",
"pad_double_grad",
"pad3d_double_grad",
"squeeze_double_grad",
"unsqueeze_double_grad",
"instance_norm_double_grad",
"conv3d_double_grad",
"depthwise_conv2d_grad_grad",
"concat_double_grad",
"expand_grad",
"argsort_grad",
"eigh_grad",
"add_grad",
"subtract_grad",
"multiply_grad",
"divide_grad",
"matmul_grad",
"unbind_grad",
}
# For API dispatch used at python-level
# { op_name : [arg_name, ...] }
core_ops_returns_info = {}
core_ops_args_info = {}
core_ops_args_type_info = {}
yaml_types_mapping = {
'int': 'int',
'int32_t': 'int32_t',
'int64_t': 'int64_t',
'size_t': 'size_t',
'float': 'float',
'double': 'double',
'bool': 'bool',
'str': 'std::string',
'str[]': 'std::vector<std::string>',
'float[]': 'std::vector<float>',
'bool[]': 'std::vector<bool>',
'Place': 'paddle::Place',
'DataLayout': 'phi::DataLayout',
'DataType': 'phi::DataType',
'int64_t[]': 'std::vector<int64_t>',
'int[]': 'std::vector<int>',
'Tensor': 'Tensor',
'Tensor[]': 'std::vector<Tensor>',
'Tensor[Tensor[]]': 'std::vector<std::vector<Tensor>>',
'Scalar': 'paddle::experimental::Scalar',
'Scalar(int)': 'paddle::experimental::Scalar',
'Scalar(int64_t)': 'paddle::experimental::Scalar',
'Scalar(float)': 'paddle::experimental::Scalar',
'Scalar(double)': 'paddle::experimental::Scalar',
'Scalar[]': 'std::vector<phi::Scalar>',
'IntArray': 'paddle::experimental::IntArray',
}
#########################
# File Reader Helpers #
#########################
def AssertMessage(lhs_str, rhs_str):
return f"lhs: {lhs_str}, rhs: {rhs_str}"
def ReadFwdFile(filepath):
f = open(filepath, 'r')
# empty file loaded by yaml is None
contents = yaml.load(f, Loader=yaml.FullLoader)
f.close()
# not all fused ops supoort dygraph
if filepath.endswith("fused_ops.yaml") is True:
new_apis = [
api
for api in contents
if "support_dygraph_mode" in api
and api["support_dygraph_mode"] is True
]
contents = new_apis
return contents if contents is not None else []
def ReadBwdFile(filepath):
f = open(filepath, 'r')
contents = yaml.load(f, Loader=yaml.FullLoader)
# not all fused ops supoort dygraph
if filepath.endswith("fused_backward.yaml") is True:
new_apis = [
api
for api in contents
if "support_dygraph_mode" in api
and api["support_dygraph_mode"] is True
]
contents = new_apis
ret = {}
if contents is not None:
for content in contents:
assert 'backward_op' in content.keys(), AssertMessage(
'backward_op', content.keys()
)
if 'backward_op' in content.keys():
api_name = content['backward_op']
ret[api_name] = content
f.close()
return ret
##############################
# Generic Helper Functions #
##############################
def FindGradName(string):
return string + "_grad"
def FindForwardName(string):
if not string.endswith("_grad"):
return None
return string[:-5]
def IsGradName(string):
return string.endswith("_grad")
def IsPlainTensorType(string):
plain_tensor_types = ['Tensor&', 'Tensor', 'const Tensor&', 'const Tensor']
if string in plain_tensor_types:
return True
return False
def IsVectorTensorType(string):
vector_tensor_types = [
'std::vector<std::vector<Tensor>>',
'std::vector<Tensor>',
]
if string in vector_tensor_types:
return True
return False
def GetSavedName(string):
return string + "_"
def GetConstReference(string):
ret = string
if not string.startswith("const "):
ret = "const " + string
if not string.endswith("&"):
ret += "&"
return ret
def RemoveConstAndReference(string):
ret = string
if string.startswith("const "):
ret = ret[6:]
if string.endswith("&"):
ret = ret[:-1]
return ret
def GetGradNodeName(string):
def str2Hump(text):
arr = filter(None, text.split('_'))
res = ''
for i in arr:
res = res + i[0].upper() + i[1:]
return res
string = str2Hump(string)
if string.rfind("Grad") == (len(string) - 4):
string = string[:-4]
return f"{string}GradNode"
def GetDygraphForwardFunctionName(string):
return f"{string}_ad_func"
def GetDygraphLogName(string):
def str2Hump(text):
arr = filter(None, text.split('_'))
res = ''
for i in arr:
res = res + i.lower()
return res
string = str2Hump(string)
return string
def GetIntermediateAPIFunctionName(string):
return string + "_intermediate"
def GetAutoGradMetaName(string):
return f"{string}_autograd_meta"
def GetAutoGradMetaVectorName(string):
return f"{string}_autograd_meta_vec"
def RemoveSpecialSymbolsInName(string):
# Remove any name after '@'
ret = string.split("@")[0]
return ret
def RecoverBaseNameOfInplaceFunction(function_name):
return function_name[:-1]
def GetInplacedFunctionName(function_name):
inplace_func_name = function_name
if inplace_func_name[-1] != '_':
inplace_func_name += '_'
return inplace_func_name
def GetForwardFunctionName(string):
return f"{string}_ad_func"
def GetIndent(num):
tab = " "
return "".join([tab for i in range(num)])
##################
# Yaml Parsers #
##################
def ParseYamlArgs(string):
# Example: const Tensor& x, const Tensor& y, bool transpose_x, bool transpose_y
# inputs_list = [ [arg_name, arg_type, orig_position], ...]
inputs_list = []
# attrs_list = [ [arg_name, arg_type, default_value, orig_position], ...]
attrs_list = []
patten = re.compile(r',(?![^{]*\})') # support int[] a={1,3}
args = re.split(patten, string.strip())
args = [x.strip() for x in args]
atype = r'((const )?\S+) '
aname = r'(.*)'
pattern = f'{atype}{aname}'
for i in range(len(args)):
arg = args[i]
m = re.search(pattern, arg)
arg_type = m.group(1).strip()
arg_name = m.group(3).split("=")[0].strip()
default_value = (
m.group(3).split("=")[1].strip()
if len(m.group(3).split("=")) > 1
else None
)
assert (
arg_type in yaml_types_mapping.keys()
), f"The argument type {arg_type} in yaml config is not supported in yaml_types_mapping."
if arg_type in ["DataLayout"] and default_value is not None:
default_value = f"paddle::experimental::{default_value}"
if arg_type in ["DataType"] and default_value is not None:
default_value = f"phi::{default_value}"
arg_type = yaml_types_mapping[arg_type]
arg_name = RemoveSpecialSymbolsInName(arg_name)
if "Tensor" in arg_type:
assert default_value is None
inputs_list.append([arg_name, arg_type, i])
else:
attrs_list.append([arg_name, arg_type, default_value, i])
return inputs_list, attrs_list
def ParseYamlReturns(string):
# Example0: Tensor(out), Tensor(out1)
# Example1: Tensor, Tensor
# Example2: Tensor[](out), Tensor
# list = [ [ret_name, ret_type, orig_position], ...]
returns_list = []
returns = [x.strip() for x in string.strip().split(",")]
for i in range(len(returns)):
ret = returns[i].split("{")[0].strip()
ret_name = ""
if "(" in ret and ")" in ret:
# Remove trailing ')'
ret = ret[:-1]
ret_type = ret.split("(")[0].strip()
ret_name = ret.split("(")[1].strip()
else:
ret_type = ret.strip()
assert (
ret_type in yaml_types_mapping.keys()
), f"The return type {ret_type} in yaml config is not supported in yaml_types_mapping."
ret_type = yaml_types_mapping[ret_type]
assert "Tensor" in ret_type, AssertMessage("Tensor", ret_type)
ret_name = RemoveSpecialSymbolsInName(ret_name)
returns_list.append([ret_name, ret_type, i])
return returns_list
def ParseYamlForwardFromBackward(string):
# Example: matmul (const Tensor& x, const Tensor& y, bool transpose_x, bool transpose_y) -> Tensor(out)
fname = r'(.*?)'
wspace = r'\s*'
fargs = r'(.*?)'
frets = r'(.*)'
pattern = (
fr'{fname}{wspace}\({wspace}{fargs}{wspace}\){wspace}->{wspace}{frets}'
)
m = re.search(pattern, string)
function_name = m.group(1)
function_args = m.group(2)
function_returns = m.group(3)
forward_inputs_list, forward_attrs_list = ParseYamlArgs(function_args)
forward_returns_list = ParseYamlReturns(function_returns)
return forward_inputs_list, forward_attrs_list, forward_returns_list
def ParseYamlForward(args_str, returns_str):
# args Example: (const Tensor& x, const Tensor& y, bool transpose_x = false, bool transpose_y = false)
# returns Example: Tensor, Tensor
fargs = r'(.*?)'
wspace = r'\s*'
args_pattern = fr'^\({fargs}\)$'
args_str = re.search(args_pattern, args_str.strip()).group(1)
inputs_list, attrs_list = ParseYamlArgs(args_str)
returns_list = ParseYamlReturns(returns_str)
return inputs_list, attrs_list, returns_list
def ParseYamlBackward(args_str, returns_str):
# args Example: (const Tensor& x, const Tensor& y, const Tensor& out_grad, bool transpose_x=false, bool transpose_y=false)
# returns Example: Tensor(x_grad), Tensor(y_grad)
fargs = r'(.*?)'
wspace = r'\s*'
args_pattern = fr'\({fargs}\)'
args_str = re.search(args_pattern, args_str).group(1)
inputs_list, attrs_list = ParseYamlArgs(args_str)
returns_list = ParseYamlReturns(returns_str)
return inputs_list, attrs_list, returns_list
def ParseYamlInplaceInfo(string):
# inplace_map_str: "(x -> out0), (y -> out2)"
inplace_map = {}
for pair in string.split(","):
pair = pair.strip()
if pair.startswith("("):
pair = pair[1:]
if pair.endswith(")"):
pair = pair[:-1]
key = pair.split("->")[0].strip()
val = pair.split("->")[1].strip()
inplace_map[key] = val
return inplace_map
def ParseYamlCompositeInfo(string):
# example: composite: fun(args1, args2, ...)
fname = r'(.*?)'
wspace = r'\s*'
fargs = r'(.*?)'
pattern = fr'{fname}{wspace}\({wspace}{fargs}{wspace}\)'
m = re.search(pattern, string)
composite_fun_info = {}
composite_fun_info.update({"name": m.group(1)})
func_args = m.group(2).split(",")
for fun_arg in func_args:
if "args" in composite_fun_info:
composite_fun_info["args"].append(fun_arg.strip())
else:
composite_fun_info.update({"args": [fun_arg.strip()]})
return composite_fun_info
####################
# Generator Base #
####################
class FunctionGeneratorBase:
def __init__(self, forward_api_contents, namespace):
self.forward_api_contents = forward_api_contents
self.namespace = namespace
self.is_forward_only = (
False if 'backward' in forward_api_contents.keys() else True
)
self.forward_api_name = ""
self.orig_forward_inputs_list = (
[]
) # [ [arg_name, arg_type, orig_position], ...]
self.orig_forward_attrs_list = (
[]
) # [ [attr_name, attr_type, default_value, orig_position], ...]
self.orig_forward_returns_list = (
[]
) # [ [ret_name, ret_type, orig_position], ...]
# Processed Forward Data
self.forward_inputs_position_map = (
{}
) # { "name" : [type, fwd_position] }
self.forward_outputs_position_map = (
{}
) # { "name" : [type, fwd_position] }
# Special Op Attributes
self.optional_inputs = [] # [name, ...]
self.no_need_buffers = [] # [name, ...]
self.composite_func_info = (
{}
) # {name: func_name, args: [input_name, ...]}
self.intermediate_outputs = [] # [name, ...]
self.forward_inplace_map = {} # {name : name, ...}
def ParseForwardInplaceInfo(self):
forward_api_contents = self.forward_api_contents
if 'inplace' not in forward_api_contents.keys():
return
inplace_map_str = forward_api_contents['inplace']
self.forward_inplace_map = ParseYamlInplaceInfo(inplace_map_str)
def ParseNoNeedBuffer(self):
grad_api_contents = self.grad_api_contents
if 'no_need_buffer' in grad_api_contents.keys():
no_need_buffer_str = grad_api_contents['no_need_buffer']
for name in no_need_buffer_str.split(","):
name = name.strip()
name = RemoveSpecialSymbolsInName(name)
self.no_need_buffers.append(name.strip())
def ParseComposite(self):
grad_api_contents = self.grad_api_contents
if 'composite' in grad_api_contents.keys():
composite_str = grad_api_contents['composite']
self.composite_func_info = ParseYamlCompositeInfo(composite_str)
def ParseDispensable(self):
forward_api_contents = self.forward_api_contents
if 'optional' in forward_api_contents.keys():
optional_inputs_str = forward_api_contents['optional']
for name in optional_inputs_str.split(","):
name = name.strip()
name = RemoveSpecialSymbolsInName(name)
self.optional_inputs.append(name)
def ParseIntermediate(self):
forward_api_contents = self.forward_api_contents
if 'intermediate' in forward_api_contents.keys():
intermediate_str = forward_api_contents['intermediate']
for name in intermediate_str.split(","):
name = name.strip()
name = RemoveSpecialSymbolsInName(name)
self.intermediate_outputs.append(name)
def CollectOriginalForwardInfo(self):
forward_api_contents = self.forward_api_contents
self.forward_api_name = forward_api_contents['op']
forward_args_str = forward_api_contents['args']
forward_returns_str = forward_api_contents['output']
assert (
'op' in forward_api_contents.keys()
), "Unable to find \"op\" in forward_api_contents keys"
assert (
'args' in forward_api_contents.keys()
), "Unable to find \"args\" in forward_api_contents keys"
assert (
'output' in forward_api_contents.keys()
), "Unable to find \"output\" in forward_api_contents keys"
# Collect Original Forward Inputs/Outputs and then perform validation checks
(
self.orig_forward_inputs_list,
self.orig_forward_attrs_list,
self.orig_forward_returns_list,
) = ParseYamlForward(forward_args_str, forward_returns_str)
def DetermineForwardPositionMap(
self, forward_inputs_list, forward_returns_list
):
for i in range(len(forward_inputs_list)):
forward_input = forward_inputs_list[i]
input_name = forward_input[0]
input_type = forward_input[1]
input_pos = forward_input[2]
self.forward_inputs_position_map[input_name] = [
input_type,
input_pos,
]
for i in range(len(forward_returns_list)):
forward_return = forward_returns_list[i]
if len(forward_return[0]) == 0:
if len(forward_returns_list) == 1:
return_name = "out"
else:
return_name = f"out_{i + 1}"
else:
return_name = forward_return[0]
return_type = forward_return[1]
return_pos = forward_return[2]
self.forward_outputs_position_map[return_name] = [
return_type,
return_pos,
]
class GeneratorBase:
def __init__(self, api_yaml_path):
self.namespace = ""
self.api_yaml_path = api_yaml_path
self.forward_api_list = []
def ParseForwardYamlContents(self):
api_yaml_path = self.api_yaml_path
self.forward_api_list = ReadFwdFile(api_yaml_path)
def InferNameSpace(self):
api_yaml_path = self.api_yaml_path
if re.search(r"sparse[a-zA-Z0-9_]*\.yaml", api_yaml_path):
self.namespace = "sparse::"
elif re.search(r"strings[a-zA-Z0-9_]*\.yaml", api_yaml_path):
self.namespace = "strings::"
| [
"[email protected]"
] | |
bd36f5a224dff4b96b3c92eab002514c9b2bacca | 95495baeb47fd40b9a7ecb372b79d3847aa7a139 | /swagger_client/models/application_tag.py | bc362cac4bddba8e4eb3ab58a96ff3a308710541 | [] | no_license | pt1988/fmc-api | b1d8ff110e12c13aa94d737f3fae9174578b019c | 075f229585fcf9bd9486600200ff9efea5371912 | refs/heads/main | 2023-01-07T09:22:07.685524 | 2020-10-30T03:21:24 | 2020-10-30T03:21:24 | 308,226,669 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 8,524 | py | # coding: utf-8
"""
Cisco Firepower Management Center Open API Specification
**Specifies the REST URLs and methods supported in the Cisco Firepower Management Center API. Refer to the version specific [REST API Quick Start Guide](https://www.cisco.com/c/en/us/support/security/defense-center/products-programming-reference-guides-list.html) for additional information.** # noqa: E501
OpenAPI spec version: 1.0.0
Contact: [email protected]
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
import pprint
import re # noqa: F401
import six
class ApplicationTag(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 = {
'metadata': 'IMetadata',
'name': 'str',
'overridable': 'bool',
'description': 'str',
'links': 'ILinks',
'id': 'str',
'overrides': 'IOverride',
'type': 'str',
'version': 'str'
}
attribute_map = {
'metadata': 'metadata',
'name': 'name',
'overridable': 'overridable',
'description': 'description',
'links': 'links',
'id': 'id',
'overrides': 'overrides',
'type': 'type',
'version': 'version'
}
def __init__(self, metadata=None, name=None, overridable=None, description=None, links=None, id=None, overrides=None, type=None, version=None): # noqa: E501
"""ApplicationTag - a model defined in Swagger""" # noqa: E501
self._metadata = None
self._name = None
self._overridable = None
self._description = None
self._links = None
self._id = None
self._overrides = None
self._type = None
self._version = None
self.discriminator = None
if metadata is not None:
self.metadata = metadata
if name is not None:
self.name = name
if overridable is not None:
self.overridable = overridable
if description is not None:
self.description = description
if links is not None:
self.links = links
if id is not None:
self.id = id
if overrides is not None:
self.overrides = overrides
if type is not None:
self.type = type
if version is not None:
self.version = version
@property
def metadata(self):
"""Gets the metadata of this ApplicationTag. # noqa: E501
:return: The metadata of this ApplicationTag. # noqa: E501
:rtype: IMetadata
"""
return self._metadata
@metadata.setter
def metadata(self, metadata):
"""Sets the metadata of this ApplicationTag.
:param metadata: The metadata of this ApplicationTag. # noqa: E501
:type: IMetadata
"""
self._metadata = metadata
@property
def name(self):
"""Gets the name of this ApplicationTag. # noqa: E501
:return: The name of this ApplicationTag. # noqa: E501
:rtype: str
"""
return self._name
@name.setter
def name(self, name):
"""Sets the name of this ApplicationTag.
:param name: The name of this ApplicationTag. # noqa: E501
:type: str
"""
self._name = name
@property
def overridable(self):
"""Gets the overridable of this ApplicationTag. # noqa: E501
:return: The overridable of this ApplicationTag. # noqa: E501
:rtype: bool
"""
return self._overridable
@overridable.setter
def overridable(self, overridable):
"""Sets the overridable of this ApplicationTag.
:param overridable: The overridable of this ApplicationTag. # noqa: E501
:type: bool
"""
self._overridable = overridable
@property
def description(self):
"""Gets the description of this ApplicationTag. # noqa: E501
:return: The description of this ApplicationTag. # noqa: E501
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this ApplicationTag.
:param description: The description of this ApplicationTag. # noqa: E501
:type: str
"""
self._description = description
@property
def links(self):
"""Gets the links of this ApplicationTag. # noqa: E501
:return: The links of this ApplicationTag. # noqa: E501
:rtype: ILinks
"""
return self._links
@links.setter
def links(self, links):
"""Sets the links of this ApplicationTag.
:param links: The links of this ApplicationTag. # noqa: E501
:type: ILinks
"""
self._links = links
@property
def id(self):
"""Gets the id of this ApplicationTag. # noqa: E501
:return: The id of this ApplicationTag. # noqa: E501
:rtype: str
"""
return self._id
@id.setter
def id(self, id):
"""Sets the id of this ApplicationTag.
:param id: The id of this ApplicationTag. # noqa: E501
:type: str
"""
self._id = id
@property
def overrides(self):
"""Gets the overrides of this ApplicationTag. # noqa: E501
:return: The overrides of this ApplicationTag. # noqa: E501
:rtype: IOverride
"""
return self._overrides
@overrides.setter
def overrides(self, overrides):
"""Sets the overrides of this ApplicationTag.
:param overrides: The overrides of this ApplicationTag. # noqa: E501
:type: IOverride
"""
self._overrides = overrides
@property
def type(self):
"""Gets the type of this ApplicationTag. # noqa: E501
:return: The type of this ApplicationTag. # noqa: E501
:rtype: str
"""
return self._type
@type.setter
def type(self, type):
"""Sets the type of this ApplicationTag.
:param type: The type of this ApplicationTag. # noqa: E501
:type: str
"""
self._type = type
@property
def version(self):
"""Gets the version of this ApplicationTag. # noqa: E501
:return: The version of this ApplicationTag. # noqa: E501
:rtype: str
"""
return self._version
@version.setter
def version(self, version):
"""Sets the version of this ApplicationTag.
:param version: The version of this ApplicationTag. # noqa: E501
:type: str
"""
self._version = version
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(ApplicationTag, 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, ApplicationTag):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
"""Returns true if both objects are not equal"""
return not self == other
| [
"[email protected]"
] | |
d213cd9894b49709b6f412912e23fb194187d63a | c4b636a2fffbf8ef3096e4de9de61b30ea3df72a | /hackerrank/find_tortosian_angle.py | d30648b1f4f0359a1f1c8378e6b8211b53386bd0 | [
"MIT"
] | permissive | FelixTheC/hackerrank_exercises | f63fbbc55a783ee4cecfa04302301a0fb66d45fe | 24eedbedebd122c53fd2cb6018cc3535d0d4c6a0 | refs/heads/master | 2021-01-04T22:10:47.538372 | 2020-11-01T15:57:20 | 2020-11-01T15:57:20 | 240,779,506 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,223 | py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
@created: 07.07.20
@author: felix
"""
import math
class Points:
__slots__ = ['x', 'y', 'z']
def __init__(self, x, y, z):
self.x, self.y, self.z = x, y, z
def __sub__(self, other):
return Points(self.x - other.x,
self.y - other.y,
self.z - other.z)
def dot(self, other):
return (self.x * other.x) + (self.y * other.y) + (self.z * other.z)
def cross(self, other):
return Points((self.y * other.z) - (self.z * other.y),
(self.z * other.x) - (self.x * other.z),
(self.x * other.y) - (self.y * other.x))
def absolute(self):
return pow((self.x ** 2 + self.y ** 2 + self.z ** 2), 0.5)
def __repr__(self):
return f'Point({self.x}, {self.y}, {self.z})'
if __name__ == '__main__':
points = [list(map(float, input().split())) for i in range(4)]
a, b, c, d = Points(*points[0]), Points(*points[1]), Points(*points[2]), Points(*points[3])
x = (b - a).cross(c - b)
y = (c - b).cross(d - c)
angle = math.acos(x.dot(y) / (x.absolute() * y.absolute()))
print(f'{math.degrees(angle):.2f}')
| [
"[email protected]"
] | |
0d1dcd325910aa6bea587ec4fd7d586ad4913797 | 088f692b5981e0f0ff99191f482de3a783ff2260 | /fcc_adtracker/fccpublicfiles/migrations/0028_auto__add_field_state_summary_total_files_entered__add_field_state_sum.py | 4b474d4360d97a101aabce7a9cd2ca52aebac303 | [] | no_license | sunlightlabs/fcc_political_ads | ec0de992a8e15822e3b44bf0897f0568f3880328 | 81a1bb410f5c71b39e31383020e554aafa70f222 | refs/heads/master | 2021-01-02T09:53:38.758905 | 2016-09-13T20:51:15 | 2016-09-13T20:51:15 | 4,089,192 | 2 | 6 | null | null | null | null | UTF-8 | Python | false | false | 45,114 | py | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'state_summary.total_files_entered'
db.add_column('fccpublicfiles_state_summary', 'total_files_entered',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'state_summary.tot_spending_from_entry'
db.add_column('fccpublicfiles_state_summary', 'tot_spending_from_entry',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'state_summary.tot_est_low'
db.add_column('fccpublicfiles_state_summary', 'tot_est_low',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'state_summary.tot_est_ave'
db.add_column('fccpublicfiles_state_summary', 'tot_est_ave',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'state_summary.tot_est_high'
db.add_column('fccpublicfiles_state_summary', 'tot_est_high',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'state_summary.percent_estimated'
db.add_column('fccpublicfiles_state_summary', 'percent_estimated',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'dma_summary.total_files_entered'
db.add_column('fccpublicfiles_dma_summary', 'total_files_entered',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'dma_summary.tot_spending_from_entry'
db.add_column('fccpublicfiles_dma_summary', 'tot_spending_from_entry',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'dma_summary.tot_est_low'
db.add_column('fccpublicfiles_dma_summary', 'tot_est_low',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'dma_summary.tot_est_ave'
db.add_column('fccpublicfiles_dma_summary', 'tot_est_ave',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'dma_summary.tot_est_high'
db.add_column('fccpublicfiles_dma_summary', 'tot_est_high',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
# Adding field 'dma_summary.percent_estimated'
db.add_column('fccpublicfiles_dma_summary', 'percent_estimated',
self.gf('django.db.models.fields.PositiveIntegerField')(null=True, blank=True),
keep_default=False)
def backwards(self, orm):
# Deleting field 'state_summary.total_files_entered'
db.delete_column('fccpublicfiles_state_summary', 'total_files_entered')
# Deleting field 'state_summary.tot_spending_from_entry'
db.delete_column('fccpublicfiles_state_summary', 'tot_spending_from_entry')
# Deleting field 'state_summary.tot_est_low'
db.delete_column('fccpublicfiles_state_summary', 'tot_est_low')
# Deleting field 'state_summary.tot_est_ave'
db.delete_column('fccpublicfiles_state_summary', 'tot_est_ave')
# Deleting field 'state_summary.tot_est_high'
db.delete_column('fccpublicfiles_state_summary', 'tot_est_high')
# Deleting field 'state_summary.percent_estimated'
db.delete_column('fccpublicfiles_state_summary', 'percent_estimated')
# Deleting field 'dma_summary.total_files_entered'
db.delete_column('fccpublicfiles_dma_summary', 'total_files_entered')
# Deleting field 'dma_summary.tot_spending_from_entry'
db.delete_column('fccpublicfiles_dma_summary', 'tot_spending_from_entry')
# Deleting field 'dma_summary.tot_est_low'
db.delete_column('fccpublicfiles_dma_summary', 'tot_est_low')
# Deleting field 'dma_summary.tot_est_ave'
db.delete_column('fccpublicfiles_dma_summary', 'tot_est_ave')
# Deleting field 'dma_summary.tot_est_high'
db.delete_column('fccpublicfiles_dma_summary', 'tot_est_high')
# Deleting field 'dma_summary.percent_estimated'
db.delete_column('fccpublicfiles_dma_summary', 'percent_estimated')
models = {
'auth.group': {
'Meta': {'object_name': 'Group'},
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '80'}),
'permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'})
},
'auth.permission': {
'Meta': {'ordering': "('content_type__app_label', 'content_type__model', 'codename')", 'unique_together': "(('content_type', 'codename'),)", 'object_name': 'Permission'},
'codename': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'content_type': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['contenttypes.ContentType']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '50'})
},
'auth.user': {
'Meta': {'object_name': 'User'},
'date_joined': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'email': ('django.db.models.fields.EmailField', [], {'max_length': '75', 'blank': 'True'}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'groups': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Group']", 'symmetrical': 'False', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_active': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_staff': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_superuser': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'last_login': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '30', 'blank': 'True'}),
'password': ('django.db.models.fields.CharField', [], {'max_length': '128'}),
'user_permissions': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['auth.Permission']", 'symmetrical': 'False', 'blank': 'True'}),
'username': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'})
},
'broadcasters.broadcaster': {
'Meta': {'ordering': "('community_state', 'community_city', 'callsign')", 'object_name': 'Broadcaster'},
'callsign': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '12'}),
'channel': ('django.db.models.fields.PositiveSmallIntegerField', [], {'null': 'True', 'blank': 'True'}),
'community_city': ('django.db.models.fields.CharField', [], {'max_length': '20', 'null': 'True', 'blank': 'True'}),
'community_state': ('django.contrib.localflavor.us.models.USStateField', [], {'max_length': '2', 'null': 'True', 'blank': 'True'}),
'dma_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'facility_id': ('django.db.models.fields.PositiveIntegerField', [], {'unique': 'True', 'null': 'True', 'blank': 'True'}),
'facility_type': ('django.db.models.fields.CharField', [], {'max_length': '3', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'network_affiliate': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'nielsen_dma': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'})
},
'contenttypes.contenttype': {
'Meta': {'ordering': "('name',)", 'unique_together': "(('app_label', 'model'),)", 'object_name': 'ContentType', 'db_table': "'django_content_type'"},
'app_label': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'model': ('django.db.models.fields.CharField', [], {'max_length': '100'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '100'})
},
'doccloud.document': {
'Meta': {'ordering': "['created_at']", 'object_name': 'Document'},
'access_level': ('django.db.models.fields.CharField', [], {'default': "'private'", 'max_length': '32'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime.now', 'db_index': 'True', 'blank': 'True'}),
'dc_properties': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['doccloud.DocumentCloudProperties']", 'null': 'True', 'blank': 'True'}),
'description': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'file': ('django.db.models.fields.files.FileField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'slug': ('django_extensions.db.fields.AutoSlugField', [], {'allow_duplicates': 'False', 'max_length': '50', 'separator': "u'-'", 'blank': 'True', 'populate_from': "('title',)", 'overwrite': 'False'}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'db_index': 'True', 'blank': 'True'}),
'user': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['auth.User']", 'null': 'True', 'blank': 'True'})
},
'doccloud.documentcloudproperties': {
'Meta': {'object_name': 'DocumentCloudProperties'},
'dc_id': ('django.db.models.fields.CharField', [], {'max_length': '300'}),
'dc_url': ('django.db.models.fields.URLField', [], {'max_length': '200'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})
},
'fccpublicfiles.dma_summary': {
'Meta': {'object_name': 'dma_summary'},
'dma_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'dma_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'fcc_dma_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'house_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'local_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'num_broadcasters': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'outside_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'percent_estimated': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'pres_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'rank1011': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'rank1112': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_house_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_outside_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_pres_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_sen_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'sen_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'state_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tot_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tot_est_ave': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tot_est_high': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tot_est_low': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tot_spending_from_entry': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'total_files_entered': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'})
},
'fccpublicfiles.genericpublicdocument': {
'Meta': {'object_name': 'GenericPublicDocument'},
'approved_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'approved_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_genericpublicdocument_approved'", 'null': 'True', 'to': "orm['auth.User']"}),
'broadcasters': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['broadcasters.Broadcaster']", 'null': 'True', 'symmetrical': 'False'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_genericpublicdocument_created'", 'null': 'True', 'to': "orm['auth.User']"}),
'documentcloud_doc': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['doccloud.Document']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_visible': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'updated_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_genericpublicdocument_updated'", 'null': 'True', 'to': "orm['auth.User']"})
},
'fccpublicfiles.organization': {
'Meta': {'ordering': "('name',)", 'object_name': 'Organization'},
'addresses': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'to': "orm['locations.Address']", 'null': 'True', 'blank': 'True'}),
'approved_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'approved_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_organization_approved'", 'null': 'True', 'to': "orm['auth.User']"}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_organization_created'", 'null': 'True', 'to': "orm['auth.User']"}),
'employees': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['fccpublicfiles.Person']", 'through': "orm['fccpublicfiles.Role']", 'symmetrical': 'False'}),
'fec_id': ('django.db.models.fields.CharField', [], {'max_length': '9', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'organization_type': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'related_advertiser': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fccpublicfiles.TV_Advertiser']", 'null': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'updated_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_organization_updated'", 'null': 'True', 'to': "orm['auth.User']"})
},
'fccpublicfiles.person': {
'Meta': {'ordering': "('last_name', 'first_name')", 'object_name': 'Person'},
'approved_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'approved_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_person_approved'", 'null': 'True', 'to': "orm['auth.User']"}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_person_created'", 'null': 'True', 'to': "orm['auth.User']"}),
'first_name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'last_name': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
'middle_name': ('django.db.models.fields.CharField', [], {'max_length': '40', 'null': 'True', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'suffix': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'updated_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_person_updated'", 'null': 'True', 'to': "orm['auth.User']"})
},
'fccpublicfiles.politicalbuy': {
'Meta': {'object_name': 'PoliticalBuy'},
'advertiser': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'advertiser_politicalbuys'", 'null': 'True', 'to': "orm['fccpublicfiles.Organization']"}),
'advertiser_signatory': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fccpublicfiles.Person']", 'null': 'True', 'blank': 'True'}),
'approved_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'approved_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_politicalbuy_approved'", 'null': 'True', 'to': "orm['auth.User']"}),
'bought_by': ('django.db.models.fields.related.ForeignKey', [], {'blank': 'True', 'related_name': "'mediabuyer_politicalbuys'", 'null': 'True', 'to': "orm['fccpublicfiles.Organization']"}),
'broadcasters': ('django.db.models.fields.related.ManyToManyField', [], {'to': "orm['broadcasters.Broadcaster']", 'null': 'True', 'symmetrical': 'False'}),
'candidate_type': ('django.db.models.fields.CharField', [], {'max_length': '31', 'null': 'True', 'blank': 'True'}),
'community_state': ('django.db.models.fields.CharField', [], {'max_length': '7', 'null': 'True', 'blank': 'True'}),
'contract_end_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today', 'null': 'True', 'blank': 'True'}),
'contract_number': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'contract_start_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today', 'null': 'True', 'blank': 'True'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_politicalbuy_created'", 'null': 'True', 'to': "orm['auth.User']"}),
'data_entry_notes': ('django.db.models.fields.TextField', [], {'null': 'True', 'blank': 'True'}),
'dma_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'documentcloud_doc': ('django.db.models.fields.related.ForeignKey', [], {'default': 'None', 'to': "orm['doccloud.Document']", 'null': 'True'}),
'fcc_folder_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ignore_post_save': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
'is_FCC_doc': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
'is_complete': ('django.db.models.fields.BooleanField', [], {'default': 'False'}),
'is_invalid': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'is_summarized': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
'lowest_unit_price': ('django.db.models.fields.NullBooleanField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'nielsen_dma': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'num_spots_raw': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True'}),
'related_FCC_file': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['scraper.PDF_File']", 'null': 'True', 'blank': 'True'}),
'total_spent_raw': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '19', 'decimal_places': '2'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'updated_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_politicalbuy_updated'", 'null': 'True', 'to': "orm['auth.User']"}),
'upload_time': ('django.db.models.fields.DateField', [], {'default': 'datetime.date.today', 'null': 'True', 'blank': 'True'}),
'uuid_key': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '36', 'blank': 'True'})
},
'fccpublicfiles.politicalspot': {
'Meta': {'object_name': 'PoliticalSpot'},
'airing_days': ('weekday_field.fields.WeekdayField', [], {'max_length': '14', 'blank': 'True'}),
'airing_end_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'airing_start_date': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),
'approved_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'approved_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_politicalspot_approved'", 'null': 'True', 'to': "orm['auth.User']"}),
'broadcast_length': ('timedelta.fields.TimedeltaField', [], {'null': 'True', 'blank': 'True'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_politicalspot_created'", 'null': 'True', 'to': "orm['auth.User']"}),
'document': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fccpublicfiles.PoliticalBuy']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'num_spots': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),
'preemptable': ('django.db.models.fields.NullBooleanField', [], {'default': 'None', 'null': 'True', 'blank': 'True'}),
'rate': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '9', 'decimal_places': '2', 'blank': 'True'}),
'show_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
'timeslot_begin': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'timeslot_end': ('django.db.models.fields.TimeField', [], {'null': 'True', 'blank': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'updated_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_politicalspot_updated'", 'null': 'True', 'to': "orm['auth.User']"})
},
'fccpublicfiles.role': {
'Meta': {'object_name': 'Role'},
'approved_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'approved_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_role_approved'", 'null': 'True', 'to': "orm['auth.User']"}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_role_created'", 'null': 'True', 'to': "orm['auth.User']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'organization': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fccpublicfiles.Organization']"}),
'person': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fccpublicfiles.Person']"}),
'title': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'updated_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'fccpublicfiles_role_updated'", 'null': 'True', 'to': "orm['auth.User']"})
},
'fccpublicfiles.state_summary': {
'Meta': {'object_name': 'state_summary'},
'house_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'local_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'num_broadcasters': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'outside_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'percent_estimated': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'pres_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_house_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_outside_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_pres_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_sen_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'sen_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'state_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'state_id': ('django.db.models.fields.CharField', [], {'max_length': '2', 'null': 'True', 'blank': 'True'}),
'tot_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tot_est_ave': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tot_est_high': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tot_est_low': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'tot_spending_from_entry': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'total_files_entered': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'})
},
'fccpublicfiles.tv_advertiser': {
'Meta': {'object_name': 'TV_Advertiser'},
'ad_hawk_url': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'advertiser_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'candidate': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fecdata.Candidate']", 'null': 'True'}),
'candidate_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'committee_name': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'ftum_url': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'ie_url': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'is_in_adhawk': ('django.db.models.fields.NullBooleanField', [], {'null': 'True', 'blank': 'True'}),
'num_broadcasters': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'num_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'num_dmas': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'num_recent_broadcasters': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'num_recent_buys': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'num_recent_dmas': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'num_recent_state': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'num_states': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'primary_committee': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'primary committee'", 'null': 'True', 'to': "orm['fecdata.Committee']"}),
'recent_amount_guess': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_amount_guess_high': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'recent_amount_guess_low': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'secondary_committees': ('django.db.models.fields.related.ManyToManyField', [], {'symmetrical': 'False', 'related_name': "'secondary committees'", 'null': 'True', 'to': "orm['fecdata.Committee']"}),
'total_amount_guess': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'total_amount_guess_high': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'total_amount_guess_low': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'})
},
'fccpublicfiles.tv_advertiser_alias': {
'Meta': {'object_name': 'TV_Advertiser_Alias'},
'advertiser_name_clean': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'advertiser_name_raw': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'parent': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fccpublicfiles.TV_Advertiser']", 'null': 'True'})
},
'fecdata.candidate': {
'Meta': {'object_name': 'Candidate'},
'campaign_com_fec_id': ('django.db.models.fields.CharField', [], {'max_length': '9', 'blank': 'True'}),
'candidate_status': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'cycle': ('django.db.models.fields.CharField', [], {'max_length': '4'}),
'district': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'fec_id': ('django.db.models.fields.CharField', [], {'max_length': '9', 'blank': 'True'}),
'fec_name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'office': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'party': ('django.db.models.fields.CharField', [], {'max_length': '3', 'blank': 'True'}),
'seat_status': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'state_address': ('django.db.models.fields.CharField', [], {'max_length': '2', 'blank': 'True'}),
'state_race': ('django.db.models.fields.CharField', [], {'max_length': '2', 'null': 'True', 'blank': 'True'})
},
'fecdata.committee': {
'Meta': {'object_name': 'Committee'},
'candidate_id': ('django.db.models.fields.CharField', [], {'max_length': '9', 'blank': 'True'}),
'candidate_office': ('django.db.models.fields.CharField', [], {'max_length': '1', 'blank': 'True'}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '18', 'null': 'True', 'blank': 'True'}),
'connected_org_name': ('django.db.models.fields.CharField', [], {'max_length': '65', 'blank': 'True'}),
'ctype': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True'}),
'designation': ('django.db.models.fields.CharField', [], {'max_length': '1', 'null': 'True'}),
'fec_id': ('django.db.models.fields.CharField', [], {'max_length': '9', 'blank': 'True'}),
'filing_frequency': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'interest_group_cat': ('django.db.models.fields.CharField', [], {'max_length': '1'}),
'is_hybrid': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
'is_nonprofit': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
'is_superpac': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
'name': ('django.db.models.fields.CharField', [], {'max_length': '255'}),
'party': ('django.db.models.fields.CharField', [], {'max_length': '3', 'blank': 'True'}),
'related_candidate': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['fecdata.Candidate']", 'null': 'True'}),
'slug': ('django.db.models.fields.SlugField', [], {'max_length': '100'}),
'state_race': ('django.db.models.fields.CharField', [], {'max_length': '2', 'null': 'True', 'blank': 'True'}),
'street_1': ('django.db.models.fields.CharField', [], {'max_length': '34', 'null': 'True', 'blank': 'True'}),
'street_2': ('django.db.models.fields.CharField', [], {'max_length': '34', 'null': 'True', 'blank': 'True'}),
'tax_status': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'}),
'treasurer': ('django.db.models.fields.CharField', [], {'max_length': '38', 'null': 'True', 'blank': 'True'}),
'zip_code': ('django.db.models.fields.CharField', [], {'max_length': '9', 'null': 'True', 'blank': 'True'})
},
'locations.address': {
'Meta': {'unique_together': "(('address1', 'address2', 'city', 'state', 'zipcode'),)", 'object_name': 'Address'},
'address1': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'address2': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),
'approved_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'approved_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'locations_address_approved'", 'null': 'True', 'to': "orm['auth.User']"}),
'city': ('django.db.models.fields.CharField', [], {'max_length': '50'}),
'created_at': ('django.db.models.fields.DateTimeField', [], {'auto_now_add': 'True', 'blank': 'True'}),
'created_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'locations_address_created'", 'null': 'True', 'to': "orm['auth.User']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'is_public': ('django.db.models.fields.BooleanField', [], {'default': 'True'}),
'lat': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'lng': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),
'notes': ('django.db.models.fields.TextField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'state': ('django.contrib.localflavor.us.models.USStateField', [], {'max_length': '2'}),
'updated_at': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'updated_by': ('django.db.models.fields.related.ForeignKey', [], {'related_name': "'locations_address_updated'", 'null': 'True', 'to': "orm['auth.User']"}),
'zipcode': ('django.db.models.fields.CharField', [], {'max_length': '10', 'null': 'True', 'blank': 'True'})
},
'scraper.folder': {
'Meta': {'object_name': 'Folder'},
'broadcaster': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['broadcasters.Broadcaster']", 'null': 'True', 'blank': 'True'}),
'callsign': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
'facility_id': ('django.db.models.fields.PositiveIntegerField', [], {'unique': 'True', 'null': 'True', 'blank': 'True'}),
'folder_class': ('django.db.models.fields.CharField', [], {'max_length': '63', 'null': 'True', 'blank': 'True'}),
'folder_name': ('django.db.models.fields.CharField', [], {'max_length': '63', 'null': 'True', 'blank': 'True'}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'raw_url': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '511'}),
'related_candidate_id': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'related_pac_id': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'scrape_time': ('django.db.models.fields.DateTimeField', [], {'auto_now': 'True', 'null': 'True', 'blank': 'True'}),
'size': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})
},
'scraper.pdf_file': {
'Meta': {'object_name': 'PDF_File'},
'ad_type': ('django.db.models.fields.CharField', [], {'max_length': '31', 'null': 'True', 'blank': 'True'}),
'callsign': ('django.db.models.fields.CharField', [], {'max_length': '12'}),
'community_state': ('django.db.models.fields.CharField', [], {'max_length': '7', 'null': 'True', 'blank': 'True'}),
'dc_slug': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'dc_title': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'dma_id': ('django.db.models.fields.PositiveIntegerField', [], {'null': 'True', 'blank': 'True'}),
'facility_id': ('django.db.models.fields.PositiveIntegerField', [], {'unique': 'True', 'null': 'True', 'blank': 'True'}),
'federal_district': ('django.db.models.fields.CharField', [], {'max_length': '31', 'null': 'True', 'blank': 'True'}),
'federal_office': ('django.db.models.fields.CharField', [], {'max_length': '31', 'null': 'True', 'blank': 'True'}),
'folder': ('django.db.models.fields.related.ForeignKey', [], {'to': "orm['scraper.Folder']"}),
'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
'in_document_cloud': ('django.db.models.fields.NullBooleanField', [], {'default': 'False', 'null': 'True', 'blank': 'True'}),
'nielsen_dma': ('django.db.models.fields.CharField', [], {'max_length': '60', 'null': 'True', 'blank': 'True'}),
'raw_name_guess': ('django.db.models.fields.CharField', [], {'max_length': '255', 'null': 'True', 'blank': 'True'}),
'raw_url': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '511'}),
'related_candidate_id': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'related_pac_id': ('django.db.models.fields.CharField', [], {'max_length': '15', 'null': 'True', 'blank': 'True'}),
'size': ('django.db.models.fields.CharField', [], {'max_length': '31', 'null': 'True', 'blank': 'True'}),
'upload_time': ('django.db.models.fields.DateTimeField', [], {'null': 'True', 'blank': 'True'})
}
}
complete_apps = ['fccpublicfiles'] | [
"[email protected]"
] | |
3ac7de780e04dfd3fb4a83d22d22c72c9b191128 | 2e3f09aa3ad09a33cb9133133a2e7aa92578de00 | /GenPIDMatching/test/test_wETL_cfg.py | 5cb68687b035b0a716ba5b46670157d97bb36f40 | [] | no_license | yszhang95/MTDHIAnalysis | 238f470e941d3d5a5a5c91f5e3d496323dc7a1db | de1e76a2a6d9cc43df992bd3e598f82c77aeebc2 | refs/heads/master | 2020-04-19T00:54:11.669859 | 2018-12-03T12:12:37 | 2018-12-03T12:12:37 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,637 | py | import FWCore.ParameterSet.Config as cms
process = cms.Process("mtdhi")
# initialize MessageLogger and output report
process.load("FWCore.MessageLogger.MessageLogger_cfi")
process.MessageLogger.cerr.FwkReport.reportEvery = cms.untracked.int32(1)
process.options = cms.untracked.PSet( wantSummary =
cms.untracked.bool(True) )
process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(5)
)
process.source = cms.Source("PoolSource",
fileNames = cms.untracked.vstring(
'file:/eos/cms/store/group/phys_heavyions/flowcorr/step1.root',
#'root://xrootd.cmsaf.mit.edu//store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_1.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_2.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_3.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_4.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_5.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_6.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_7.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_8.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_9.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_10.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_11.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_12.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_13.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_14.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_15.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_16.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_17.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_18.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_19.root',
#'/store/user/davidlw/Hydjet_Quenched_MinBias_5020GeV_PhaseII/GEN_SIM_102X_test_v2/180924_215458/0000/step1_20.root',
),
#secondaryFileNames = cms.untracked.vstring(
#)
)
process.TFileService = cms.Service("TFileService",
fileName =
cms.string('mtdhi_wETL.root')
)
process.load("MTDHIAnalysis.GenPIDMatching.genpidmatching_cfi")
process.mtdhiana.isETL = cms.untracked.bool(True)
process.mtdhiana_20ps_3sigma = process.mtdhiana.clone()
process.mtdhiana_30ps_3sigma = process.mtdhiana.clone()
process.mtdhiana_50ps_3sigma = process.mtdhiana.clone()
process.mtdhiana_70ps_3sigma = process.mtdhiana.clone()
process.mtdhiana_20ps_2sigma = process.mtdhiana.clone()
process.mtdhiana_20ps_2sigma.nSigmaT = cms.untracked.double(2.0)
process.mtdhiana_30ps_2sigma = process.mtdhiana_20ps_2sigma.clone()
process.mtdhiana_50ps_2sigma = process.mtdhiana_20ps_2sigma.clone()
process.mtdhiana_70ps_2sigma = process.mtdhiana_20ps_2sigma.clone()
process.mtdhiana_20ps_1sigma = process.mtdhiana.clone()
process.mtdhiana_20ps_1sigma.nSigmaT = cms.untracked.double(1.0)
process.mtdhiana_30ps_1sigma = process.mtdhiana_20ps_1sigma.clone()
process.mtdhiana_50ps_1sigma = process.mtdhiana_20ps_1sigma.clone()
process.mtdhiana_70ps_1sigma = process.mtdhiana_20ps_1sigma.clone()
process.mtdhiana_20ps_3sigma.sigmaT = cms.untracked.double(0.02)
process.mtdhiana_30ps_3sigma.sigmaT = cms.untracked.double(0.03)
process.mtdhiana_50ps_3sigma.sigmaT = cms.untracked.double(0.05)
process.mtdhiana_70ps_3sigma.sigmaT = cms.untracked.double(0.07)
process.mtdhiana_20ps_2sigma.sigmaT = cms.untracked.double(0.02)
process.mtdhiana_30ps_2sigma.sigmaT = cms.untracked.double(0.03)
process.mtdhiana_50ps_2sigma.sigmaT = cms.untracked.double(0.05)
process.mtdhiana_70ps_2sigma.sigmaT = cms.untracked.double(0.07)
process.mtdhiana_20ps_1sigma.sigmaT = cms.untracked.double(0.02)
process.mtdhiana_30ps_1sigma.sigmaT = cms.untracked.double(0.03)
process.mtdhiana_50ps_1sigma.sigmaT = cms.untracked.double(0.05)
process.mtdhiana_70ps_1sigma.sigmaT = cms.untracked.double(0.07)
#process.p = cms.Path(process.mtdhiana_20ps_1sigma)
#process.p1 = cms.Path(process.mtdhiana_30ps_1sigma)
#process.p2 = cms.Path(process.mtdhiana_50ps_1sigma)
#process.p3 = cms.Path(process.mtdhiana_70ps_1sigma)
#process.p4 = cms.Path(process.mtdhiana_20ps_2sigma)
#process.p5 = cms.Path(process.mtdhiana_30ps_2sigma)
#process.p6 = cms.Path(process.mtdhiana_50ps_2sigma)
#process.p7 = cms.Path(process.mtdhiana_70ps_2sigma)
process.p8 = cms.Path(process.mtdhiana_20ps_3sigma)
process.p9 = cms.Path(process.mtdhiana_30ps_3sigma)
process.p10 = cms.Path(process.mtdhiana_50ps_3sigma)
process.p11 = cms.Path(process.mtdhiana_70ps_3sigma)
| [
"[email protected]"
] | |
3291bf56514aaf9d24dd01745b5735be76b4a58e | 6b2a8dd202fdce77c971c412717e305e1caaac51 | /solutions_5738606668808192_1/Python/thomasahle/c.py | eef8d580501ceb9469eb0cf84e9016a7098c1326 | [] | no_license | alexandraback/datacollection | 0bc67a9ace00abbc843f4912562f3a064992e0e9 | 076a7bc7693f3abf07bfdbdac838cb4ef65ccfcf | refs/heads/master | 2021-01-24T18:27:24.417992 | 2017-05-23T09:23:38 | 2017-05-23T09:23:38 | 84,313,442 | 2 | 4 | null | null | null | null | UTF-8 | Python | false | false | 1,164 | py | import sys
read = lambda t=int: list(map(t,sys.stdin.readline().split()))
#def isweakprime(n):
# return all(n%q!=0 for q in [2,3,5,7,11])
#def isprime(n):
# return all(n%q!=0 for q in range(2,int(n**.5)+1))
#def brute(n):
# for i in range(2**(n-2)):
# j = 1<<(n-1) | i<<1 | 1
# bs = [sum(b**i for i in range(n) if j&1<<i) for b in range(2,11)]
# if not any(isweakprime(b) for b in bs):
# yield j
#
#import itertools
#for n in range(2,33):
# print('====', n, '====')
# it = brute(n)
# example = list(itertools.islice(it,500))
# print('\n'.join(map(bin, example)))
# count = sum(1 for _ in it) + len(example)
# print('total', count, '({})'.format(count/2**(n-2)))
T, = read()
for testCase in range(T):
n, j = read()
print('Case #{}:'.format(testCase+1))
for i in range(2**(n-2)):
coin = 1<<(n-1) | i<<1 | 1
bs = [sum(b**i for i in range(n) if coin&1<<i) for b in range(2,11)]
ds = [[d for d in [2,3,5,7,11] if b%d==0] for b in bs]
if all(ds):
#print(bs)
#print(ds)
print(bin(coin)[2:], ' '.join(str(d[0]) for d in ds))
j -= 1
if j == 0: break
| [
"[email protected]"
] | |
2200a43585376dd23f9cbc67bb71411c8aebf3b8 | ca7aa979e7059467e158830b76673f5b77a0f5a3 | /Python_codes/p02272/s422945045.py | 66f42ba322c67f725b33af923bcbd37a20695982 | [] | no_license | Aasthaengg/IBMdataset | 7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901 | f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8 | refs/heads/main | 2023-04-22T10:22:44.763102 | 2021-05-13T17:27:22 | 2021-05-13T17:27:22 | 367,112,348 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 645 | py | def mergeSort(A,left,right,B):
if left + 1 < right:
mid = (left+right)//2
mergeSort(A,left,mid,B)
mergeSort(A,mid,right,B)
merge(A,left,mid,right,B)
def merge(A,left,mid,right,B):
L = A[left:mid]
R = A[mid:right]
L.append(1000000000)
R.append(1000000000)
i = 0
j = 0
for k in range(left,right):
B.append(1)
if L[i] < R[j]:
A[k] = L[i]
i += 1
else:
A[k] = R[j]
j += 1
n = int(input())
nums = list(map(int,input().split(" ")))
B = []
mergeSort(nums,0,n,B)
print(' '.join(map(str,nums)))
print(str(len(B)))
| [
"[email protected]"
] | |
3a0f72906def2d13f98d888604882f44568b1c56 | 66c3ff83c3e3e63bf8642742356f6c1817a30eca | /.vim/tmp/neocomplete/buffer_cache/=+home=+dante=+proyectos=+django-1.9=+veterinaria=+django_apps=+clinica=+models.py | 25bd9104cfe86222f0a9f578ff0fbef6985e82a0 | [] | no_license | pacifi/vim | 0a708e8bc741b4510a8da37da0d0e1eabb05ec83 | 22e706704357b961acb584e74689c7080e86a800 | refs/heads/master | 2021-05-20T17:18:10.481921 | 2020-08-06T12:38:58 | 2020-08-06T12:38:58 | 30,074,530 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,836 | py | {'usr', 'bin', 'env', 'python3', 'coding', 'utf', 'from', '__future__', 'import', 'unicode_literals', 'uuid', 'django', 'db', 'models', 'core', 'urlresolvers', 'reverse', 'utils', 'translation', 'ugettext_lazy', 'as', '_', 'signals', 'pre_save', 'text', 'slugify', 'django_apps', 'compras', 'TimeBuy', 'persona', 'Cliente', 'class', 'Mascota', 'propietario', 'ForeignKey', 'verbose_name', 'Owner', 'ficha', 'CharField', 'Index', 'card', 'max_length', 'editable', 'False', 'nombre', 'Name', 'slug', 'SlugField', 'unique', 'True', 'raza', 'Race', 'color', 'Color', 'especie', 'Especie', 'edad', 'PositiveIntegerField', 'Age', 'peso', 'Weight', 'avatar', 'ImageField', 'Image', 'upload_to', 'descripcion', 'TextField', 'Description', 'ANAMNESIS', 'ambiental', 'Environmental', 'alimento', 'Food', 'bano', 'Bath', 'def', '__str__', 'self', 'return', 'get_absolute_url', 'clinica', 'detalle_mascota', 'kwargs', 'mascota_slug', 'save', 'args', 'no', 'objects', 'count', 'if', 'None', 'format', 'else', 'super', 'Meta', 'ordering', 'verbose_name_plural', 'Ficha', 'Cl', 'nica', 'de', 'Mascotas', 'create_slug', 'instance', 'new_slug', 'is', 'not', 'qs', 'filter', 'order_by', 'id', 'exists', 's', 'first', 'pre_save_post_receiver', 'sender', 'connect', 'Vacuna', 'Model', 'DATOS', 'DE', 'VACUNA', 'mascota', 'vacuna', 'Vaccine', 'fechav', 'DateField', 'Date', 'Desparacitar', 'DESPARACITACIONES', 'producto', 'Product', 'fechap', 'pesop', 'EstadoMascota', 'motivov', 'Motivo', 'creacion', 'auto_now_add', 'fr', 'Fris', 'n', 'Rojo', 'fc', 'Frecuencia', 'Cardiaca', 'fp', 'FP', 't', 'T', 'exampiel', 'Skin', 'test', 'examucvis', 'Examination', 'of', 'visible', 'mucous', 'ganpal', 'Palpable', 'nodes', 'apetito', 'Appetite', 'defec', 'Defecation', 'sed', 'Thirst', 'miccion', 'Urinate', 'detalle_seguimiento', 'seguimiento_pk', 'pk', 'Estados'}
| [
"[email protected]"
] | |
7862f8b3d8719a8e3d7345b5a55b8d124eabfb15 | 1902858ae52dcaff33ad6056670d2df933744122 | /Sample_Python_File.py | 5ea4ff989e81614a62b7c184e148129e9c2b5b8f | [] | no_license | gsudarshan1990/codilitypython | 220dabe82917cdab955c9bf7446c7752d5b9474d | 73d601291c86824925daf52c4fee369765a0d176 | refs/heads/master | 2022-11-29T02:11:14.901476 | 2020-08-17T06:01:14 | 2020-08-17T06:01:14 | 288,095,600 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,264 | py | print("Hello World")
string1 = 'Good morning'
print(string1[:3])
print(string1[4:])
message='A kong string with a silly typo'
new_message=message[:2]+'l'+message[3:]
print(new_message)
pets="Dogs & Cats"
print(pets.index('&'))
email="[email protected]"
old_domain = "gmail.com"
new_domain = "yahoo.com"
def replace(email,old_domain,new_domain):
with_symbol="@"+old_domain
for with_symbol in email:
index=email.index('@')
new_email=email[:index]+new_domain
return new_email
print(replace(email,old_domain,new_domain))
string2=" ".join(["This","is","joined"])
print(string2)
print("...".join(["This","is","a","string","joined","by","three","dots"]))
string3="This is the string splitted based on the split method"
print(string3.split())
print(string3.count('s'))
print(string3.endswith('method'))
name="Manny"
lucky_number=len(name)*3
print("Your name is {} and your lucky number is {}".format(name,lucky_number))
print("Your name is {name} and your lucky number is {number}".format(name=name,number=lucky_number))
print("Your name is {0} and your lucky number {1}".format(name,lucky_number))
price =7.5
with_tax = price*3.33
print(price,with_tax)
print("base price {:.2f} and tax is {:>50.2f}".format(price,with_tax))
list1=['Now','we','are','cooking']
print(type(list1))
print(len(list1))
print(list1)
print(list1[0])
print(list1[1])
fruits=["Pineapple","Apples","Grapes","Oranges"]
fruits.append("Jack Fruit")
fruits.insert(0,"Kiwi")
fruits.insert(len(fruits)+10,"peach")
print(fruits)
fruits.remove("Grapes")
print(fruits)
print(fruits.pop(2))
print(fruits)
fruits[2]='Strawberry'
print(fruits)
animals=['lion','monkey','zebra','dolphin']
len_chars=0
for animal in animals:
len_chars+=len(animal)
print("Total length:{} and average:{}".format(len_chars,len_chars/len(animals)))
names=['laxman','rama','hanuman','sita']
for index,person in enumerate(names):
print('{}-{}'.format(index+1,person))
email_list=[('laxman','[email protected]'),('rama','[email protected]')]
def re_order(people):
for name,email in people:
print("{}<{}>".format(name,email))
re_order(email_list)
multiples=[]
for x in range(71):
if x%7 == 0:
multiples.append(x)
print(multiples)
multiples=[]
for x in range(1,11):
multiples.append(x*7)
print(multiples)
multiples=[x*7 for x in range(1,11)]
print(multiples)
programs=["Python","Java","C","C++","COBOL","VB"]
length_program=[len(x) for x in programs]
print(length_program)
multiples_of_three=[x for x in range(0,101) if x%3 == 0]
print(multiples_of_three)
file_count={"jpeg":20,"csv":24,"exe":33,"txt":52,"py":100}
print(file_count)
print(file_count["jpeg"])
print("jpeg" in file_count)
file_count["cfg"] =12
print(file_count)
file_count["csv"]=17
print(file_count)
del file_count["csv"]
print(file_count)
for key in file_count:
print(key)
for key,value in file_count.items():
print("There are {} and {} ".format(value,key))
for key in file_count.keys():
print(key)
for value in file_count.values():
print(value)
def count_letters(text):
result = {}
for letter in text:
if letter not in result:
result[letter]=0
result[letter]+=1
print(result)
count_letters("Hello")
| [
"[email protected]"
] | |
1e2ddbfb4d384d155cac17158825e2a855f673cc | 536538af28cfe40e10ff1ce469cd0f81e8b3a8fe | /longest_increasing_path_in_a_matrix.py | 55beead6cedf6fdd763cbdc064334a7ba3d1b00f | [] | no_license | ShunKaiZhang/LeetCode | 7e10bb4927ba8581a3a7dec39171eb821c258c34 | ede2a2e19f27ef4adf6e57d6692216b8990cf62b | refs/heads/master | 2021-09-01T07:41:03.255469 | 2017-12-25T19:22:18 | 2017-12-25T19:22:18 | 104,136,129 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,549 | py | # python3
# Given an integer matrix, find the length of the longest increasing path.
# From each cell, you can either move to four directions: left, right, up or down.
# You may NOT move diagonally or move outside of the boundary (i.e. wrap-around is not allowed).
# Example 1:
# nums = [
# [9,9,4],
# [6,6,8],
# [2,1,1]
# ]
# Return 4
# The longest increasing path is [1, 2, 6, 9].
# Example 2:
# nums = [
# [3,4,5],
# [3,2,6],
# [2,2,1]
# ]
# Return 4
# The longest increasing path is [3, 4, 5, 6]. Moving diagonally is not allowed.
# Solution
class Solution(object):
def search(self, matrix, i, j):
directions = [(1, 0), (-1, 0), (0, 1), (0, -1)]
if not self.res[i][j]:
cur = matrix[i][j]
self.res[i][j] = 1
for it in directions:
if i + it[0] >= 0 and j + it[1] >= 0 and i + it[0] < len(matrix) and j + it[1] < len(
matrix[0]) and cur > matrix[i + it[0]][j + it[1]]:
self.res[i][j] = max(self.res[i][j], 1 + self.search(matrix, i + it[0], j + it[1]))
return self.res[i][j]
def longestIncreasingPath(self, matrix):
"""
:type matrix: List[List[int]]
:rtype: int
"""
if matrix == [] or matrix == [[]]:
return 0
self.res = [[0 for j in range(len(matrix[0]))] for j in range(len(matrix))]
return max(self.search(matrix, i, j) for i in range(len(matrix)) for j in range(len(matrix[0])))
| [
"[email protected]"
] | |
36444e5712a6f02ffbc71f329bf1d966fd9abe0a | ee6ec654937a5f592b373630f58de1a41138ad70 | /nosocod/nodes/node.py | 83d0ba40b2c92132e4cc44d91623886984861afc | [] | no_license | atykhonov/nosocod | eae05b857b5e88f0a590c632d013cb4deea715d4 | 2af67d7280af3344a0b44a8e6ccd1c1fd7a9eb88 | refs/heads/master | 2016-09-16T14:44:33.519300 | 2014-03-10T20:14:51 | 2014-03-10T20:14:51 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,682 | py | class Node(object):
name = ''
value = ''
actions = []
children = []
parent = None
params = []
linked_with = None
anchored = False
def __init__(self, name, value=None):
self.name = name
# TODO do we realy need this if?
if value:
self.value = value
else:
# something is wrong with that value assigning
self.value = name
self.children = []
self.params = []
self.actions = []
def assign_action(self, action):
action.set_node(self)
self.append(action)
def add_node(self, node):
self.children.append(node)
node.parent = self
def get_children(self):
result = self.children
if self.linked_with is not None:
result = self.linked_with.get_children()
return result
def has_children(self):
return len(self.children) > 0
def add_param(self, param):
self.params.append(param)
def has_params(self):
return len(self.params) > 0
def get_param(self, name):
result = None
for param in self.params:
if param.name == name:
result = param
break
return result
def accept(self, visitor):
if visitor.visitEnter(self):
for child in self.children:
if child.accept(visitor):
break
return visitor.visitLeave(self)
def is_linked(self):
return self.linked_with is not None
def __add__(self, other):
if isinstance(other, (list, tuple)):
self.children.extend(other)
else:
self.children.append(other)
return self
def __sub__(self, other):
for child in self.children:
if child.name == other.name:
self.children.remove(child)
return self
def is_valid(self, value):
result = False
if self.value == value:
result = True
return result
def __str__(self):
return self.name
def __unicode__(self):
return self.name
"""
def get_path(self, with_root=True):
parents = []
parent = self.parent
while parent != None:
parents.append(parent)
parent = parent.parent
parents.sort(reverse=True)
path = ''
for parent in parents:
if not with_root and parent.name == 'root':
continue
path += '/' + parent.name
path += '/' + self.name
return path
def get_relative_path(self, path):
# TODO
pass
"""
| [
"[email protected]"
] | |
9b07f7e39167b54c0126332b3d41fccbbaba53b5 | b175a3abfa14992d9b07d53adc12700ded3b1c02 | /BasicLibs/learnPySpark/ml/random_forest_classifier_example.py | 15bd8a95d0a503d9c4e17628250736e88d0a0344 | [] | no_license | BarryZM/Python-AI | d695a1569e5497da391b578e6638cc11479bfbaa | 251dc4002f9d7e5dd789e62b813651f2006f6ab6 | refs/heads/master | 2023-03-17T15:33:35.530258 | 2020-04-01T10:32:47 | 2020-04-01T10:32:47 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 3,306 | py | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
"""
Random Forest Classifier Example.
"""
from __future__ import print_function
# $example on$
from pyspark.ml import Pipeline
from pyspark.ml.classification import RandomForestClassifier
from pyspark.ml.feature import IndexToString, StringIndexer, VectorIndexer
from pyspark.ml.evaluation import MulticlassClassificationEvaluator
# $example off$
from pyspark.sql import SparkSession
if __name__ == "__main__":
spark = SparkSession\
.builder\
.appName("RandomForestClassifierExample")\
.getOrCreate()
# $example on$
# Load and parse the data file, converting it to a DataFrame.
data = spark.read.format("libsvm").load("file:///Users/hushiwei/PycharmProjects/Python-AI/BasicLibs/learnPySpark/data/mllib/sample_libsvm_data.txt")
# Index labels, adding metadata to the label column.
# Fit on whole dataset to include all labels in index.
labelIndexer = StringIndexer(inputCol="label", outputCol="indexedLabel").fit(data)
# Automatically identify categorical features, and index them.
# Set maxCategories so features with > 4 distinct values are treated as continuous.
featureIndexer =\
VectorIndexer(inputCol="features", outputCol="indexedFeatures", maxCategories=4).fit(data)
# Split the data into training and test sets (30% held out for testing)
(trainingData, testData) = data.randomSplit([0.7, 0.3])
# Train a RandomForest model.
rf = RandomForestClassifier(labelCol="indexedLabel", featuresCol="indexedFeatures", numTrees=10)
# Convert indexed labels back to original labels.
labelConverter = IndexToString(inputCol="prediction", outputCol="predictedLabel",
labels=labelIndexer.labels)
# Chain indexers and forest in a Pipeline
pipeline = Pipeline(stages=[labelIndexer, featureIndexer, rf, labelConverter])
# Train model. This also runs the indexers.
model = pipeline.fit(trainingData)
# Make predictions.
predictions = model.transform(testData)
# Select example rows to display.
predictions.select("predictedLabel", "label", "features").show(5)
# Select (prediction, true label) and compute test error
evaluator = MulticlassClassificationEvaluator(
labelCol="indexedLabel", predictionCol="prediction", metricName="accuracy")
accuracy = evaluator.evaluate(predictions)
print("Test Error = %g" % (1.0 - accuracy))
rfModel = model.stages[2]
print(rfModel) # summary only
# $example off$
spark.stop()
| [
"[email protected]"
] | |
3ac01903d8060933f7d9834e41fe972c9c808112 | 0672d2aaec261a3e9da3c5596f7a578f3b7605b2 | /tests/test_plugins.py | aeffdb8080dcbb760c7a491583542fbe44cceecc | [
"LicenseRef-scancode-warranty-disclaimer",
"Apache-2.0"
] | permissive | elimarkov/coveragepy | dc2f03d68d27badd5a94dc7a5262c68f62a78804 | 4ce893437c9e777216cac981c5909572fa10d9df | refs/heads/master | 2023-03-11T19:26:57.189126 | 2021-03-05T00:37:25 | 2021-03-05T00:37:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 42,370 | py | # Licensed under the Apache License: http://www.apache.org/licenses/LICENSE-2.0
# For details: https://github.com/nedbat/coveragepy/blob/master/NOTICE.txt
"""Tests for plugins."""
import inspect
import os.path
from xml.etree import ElementTree
import pytest
import coverage
from coverage import env
from coverage.backward import StringIO, import_local_file
from coverage.data import line_counts
from coverage.control import Plugins
from coverage.misc import CoverageException
import coverage.plugin
from tests.coveragetest import CoverageTest
from tests.helpers import CheckUniqueFilenames
class FakeConfig(object):
"""A fake config for use in tests."""
def __init__(self, plugin, options):
self.plugin = plugin
self.options = options
self.asked_for = []
def get_plugin_options(self, module):
"""Just return the options for `module` if this is the right module."""
self.asked_for.append(module)
if module == self.plugin:
return self.options
else:
return {}
class LoadPluginsTest(CoverageTest):
"""Test Plugins.load_plugins directly."""
def test_implicit_boolean(self):
self.make_file("plugin1.py", """\
from coverage import CoveragePlugin
class Plugin(CoveragePlugin):
pass
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
config = FakeConfig("plugin1", {})
plugins = Plugins.load_plugins([], config)
assert not plugins
plugins = Plugins.load_plugins(["plugin1"], config)
assert plugins
def test_importing_and_configuring(self):
self.make_file("plugin1.py", """\
from coverage import CoveragePlugin
class Plugin(CoveragePlugin):
def __init__(self, options):
self.options = options
self.this_is = "me"
def coverage_init(reg, options):
reg.add_file_tracer(Plugin(options))
""")
config = FakeConfig("plugin1", {'a': 'hello'})
plugins = list(Plugins.load_plugins(["plugin1"], config))
assert len(plugins) == 1
assert plugins[0].this_is == "me"
assert plugins[0].options == {'a': 'hello'}
assert config.asked_for == ['plugin1']
def test_importing_and_configuring_more_than_one(self):
self.make_file("plugin1.py", """\
from coverage import CoveragePlugin
class Plugin(CoveragePlugin):
def __init__(self, options):
self.options = options
self.this_is = "me"
def coverage_init(reg, options):
reg.add_file_tracer(Plugin(options))
""")
self.make_file("plugin2.py", """\
from coverage import CoveragePlugin
class Plugin(CoveragePlugin):
def __init__(self, options):
self.options = options
def coverage_init(reg, options):
reg.add_file_tracer(Plugin(options))
""")
config = FakeConfig("plugin1", {'a': 'hello'})
plugins = list(Plugins.load_plugins(["plugin1", "plugin2"], config))
assert len(plugins) == 2
assert plugins[0].this_is == "me"
assert plugins[0].options == {'a': 'hello'}
assert plugins[1].options == {}
assert config.asked_for == ['plugin1', 'plugin2']
# The order matters...
config = FakeConfig("plugin1", {'a': 'second'})
plugins = list(Plugins.load_plugins(["plugin2", "plugin1"], config))
assert len(plugins) == 2
assert plugins[0].options == {}
assert plugins[1].this_is == "me"
assert plugins[1].options == {'a': 'second'}
def test_cant_import(self):
with pytest.raises(ImportError, match="No module named '?plugin_not_there'?"):
_ = Plugins.load_plugins(["plugin_not_there"], None)
def test_plugin_must_define_coverage_init(self):
self.make_file("no_plugin.py", """\
from coverage import CoveragePlugin
Nothing = 0
""")
msg_pat = "Plugin module 'no_plugin' didn't define a coverage_init function"
with pytest.raises(CoverageException, match=msg_pat):
list(Plugins.load_plugins(["no_plugin"], None))
class PluginTest(CoverageTest):
"""Test plugins through the Coverage class."""
def test_plugin_imported(self):
# Prove that a plugin will be imported.
self.make_file("my_plugin.py", """\
from coverage import CoveragePlugin
class Plugin(CoveragePlugin):
pass
def coverage_init(reg, options):
reg.add_noop(Plugin())
with open("evidence.out", "w") as f:
f.write("we are here!")
""")
self.assert_doesnt_exist("evidence.out")
cov = coverage.Coverage()
cov.set_option("run:plugins", ["my_plugin"])
cov.start()
cov.stop() # pragma: nested
with open("evidence.out") as f:
assert f.read() == "we are here!"
def test_missing_plugin_raises_import_error(self):
# Prove that a missing plugin will raise an ImportError.
with pytest.raises(ImportError, match="No module named '?does_not_exist_woijwoicweo'?"):
cov = coverage.Coverage()
cov.set_option("run:plugins", ["does_not_exist_woijwoicweo"])
cov.start()
cov.stop()
def test_bad_plugin_isnt_hidden(self):
# Prove that a plugin with an error in it will raise the error.
self.make_file("plugin_over_zero.py", "1/0")
with pytest.raises(ZeroDivisionError):
cov = coverage.Coverage()
cov.set_option("run:plugins", ["plugin_over_zero"])
cov.start()
cov.stop()
def test_plugin_sys_info(self):
self.make_file("plugin_sys_info.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def sys_info(self):
return [("hello", "world")]
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
debug_out = StringIO()
cov = coverage.Coverage(debug=["sys"])
cov._debug_file = debug_out
cov.set_option("run:plugins", ["plugin_sys_info"])
cov.start()
cov.stop() # pragma: nested
out_lines = [line.strip() for line in debug_out.getvalue().splitlines()]
if env.C_TRACER:
assert 'plugins.file_tracers: plugin_sys_info.Plugin' in out_lines
else:
assert 'plugins.file_tracers: plugin_sys_info.Plugin (disabled)' in out_lines
assert 'plugins.configurers: -none-' in out_lines
expected_end = [
"-- sys: plugin_sys_info.Plugin -------------------------------",
"hello: world",
"-- end -------------------------------------------------------",
]
assert expected_end == out_lines[-len(expected_end):]
def test_plugin_with_no_sys_info(self):
self.make_file("plugin_no_sys_info.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
pass
def coverage_init(reg, options):
reg.add_configurer(Plugin())
""")
debug_out = StringIO()
cov = coverage.Coverage(debug=["sys"])
cov._debug_file = debug_out
cov.set_option("run:plugins", ["plugin_no_sys_info"])
cov.start()
cov.stop() # pragma: nested
out_lines = [line.strip() for line in debug_out.getvalue().splitlines()]
assert 'plugins.file_tracers: -none-' in out_lines
assert 'plugins.configurers: plugin_no_sys_info.Plugin' in out_lines
expected_end = [
"-- sys: plugin_no_sys_info.Plugin ----------------------------",
"-- end -------------------------------------------------------",
]
assert expected_end == out_lines[-len(expected_end):]
def test_local_files_are_importable(self):
self.make_file("importing_plugin.py", """\
from coverage import CoveragePlugin
import local_module
class MyPlugin(CoveragePlugin):
pass
def coverage_init(reg, options):
reg.add_noop(MyPlugin())
""")
self.make_file("local_module.py", "CONST = 1")
self.make_file(".coveragerc", """\
[run]
plugins = importing_plugin
""")
self.make_file("main_file.py", "print('MAIN')")
out = self.run_command("coverage run main_file.py")
assert out == "MAIN\n"
out = self.run_command("coverage html")
assert out == ""
@pytest.mark.skipif(env.C_TRACER, reason="This test is only about PyTracer.")
class PluginWarningOnPyTracer(CoverageTest):
"""Test that we get a controlled exception with plugins on PyTracer."""
def test_exception_if_plugins_on_pytracer(self):
self.make_file("simple.py", "a = 1")
cov = coverage.Coverage()
cov.set_option("run:plugins", ["tests.plugin1"])
expected_warnings = [
r"Plugin file tracers \(tests.plugin1.Plugin\) aren't supported with PyTracer",
]
with self.assert_warnings(cov, expected_warnings):
self.start_import_stop(cov, "simple")
@pytest.mark.skipif(not env.C_TRACER, reason="Plugins are only supported with the C tracer.")
class FileTracerTest(CoverageTest):
"""Tests of plugins that implement file_tracer."""
class GoodFileTracerTest(FileTracerTest):
"""Tests of file tracer plugin happy paths."""
def test_plugin1(self):
self.make_file("simple.py", """\
import try_xyz
a = 1
b = 2
""")
self.make_file("try_xyz.py", """\
c = 3
d = 4
""")
cov = coverage.Coverage()
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin1"])
# Import the Python file, executing it.
self.start_import_stop(cov, "simple")
_, statements, missing, _ = cov.analysis("simple.py")
assert statements == [1, 2, 3]
assert missing == []
zzfile = os.path.abspath(os.path.join("/src", "try_ABC.zz"))
_, statements, _, _ = cov.analysis(zzfile)
assert statements == [105, 106, 107, 205, 206, 207]
def make_render_and_caller(self):
"""Make the render.py and caller.py files we need."""
# plugin2 emulates a dynamic tracing plugin: the caller's locals
# are examined to determine the source file and line number.
# The plugin is in tests/plugin2.py.
self.make_file("render.py", """\
def render(filename, linenum):
# This function emulates a template renderer. The plugin
# will examine the `filename` and `linenum` locals to
# determine the source file and line number.
fiddle_around = 1 # not used, just chaff.
return "[{} @ {}]".format(filename, linenum)
def helper(x):
# This function is here just to show that not all code in
# this file will be part of the dynamic tracing.
return x+1
""")
self.make_file("caller.py", """\
import sys
from render import helper, render
assert render("foo_7.html", 4) == "[foo_7.html @ 4]"
# Render foo_7.html again to try the CheckUniqueFilenames asserts.
render("foo_7.html", 4)
assert helper(42) == 43
assert render("bar_4.html", 2) == "[bar_4.html @ 2]"
assert helper(76) == 77
# quux_5.html will be omitted from the results.
assert render("quux_5.html", 3) == "[quux_5.html @ 3]"
# For Python 2, make sure unicode is working.
assert render(u"uni_3.html", 2) == "[uni_3.html @ 2]"
""")
# will try to read the actual source files, so make some
# source files.
def lines(n):
"""Make a string with n lines of text."""
return "".join("line %d\n" % i for i in range(n))
self.make_file("bar_4.html", lines(4))
self.make_file("foo_7.html", lines(7))
def test_plugin2(self):
self.make_render_and_caller()
cov = coverage.Coverage(omit=["*quux*"])
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
# The way plugin2 works, a file named foo_7.html will be claimed to
# have 7 lines in it. If render() was called with line number 4,
# then the plugin will claim that lines 4 and 5 were executed.
_, statements, missing, _ = cov.analysis("foo_7.html")
assert statements == [1, 2, 3, 4, 5, 6, 7]
assert missing == [1, 2, 3, 6, 7]
assert "foo_7.html" in line_counts(cov.get_data())
_, statements, missing, _ = cov.analysis("bar_4.html")
assert statements == [1, 2, 3, 4]
assert missing == [1, 4]
assert "bar_4.html" in line_counts(cov.get_data())
assert "quux_5.html" not in line_counts(cov.get_data())
_, statements, missing, _ = cov.analysis("uni_3.html")
assert statements == [1, 2, 3]
assert missing == [1]
assert "uni_3.html" in line_counts(cov.get_data())
def test_plugin2_with_branch(self):
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
CheckUniqueFilenames.hook(cov, '_should_trace')
CheckUniqueFilenames.hook(cov, '_check_include_omit_etc')
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
# The way plugin2 works, a file named foo_7.html will be claimed to
# have 7 lines in it. If render() was called with line number 4,
# then the plugin will claim that lines 4 and 5 were executed.
analysis = cov._analyze("foo_7.html")
assert analysis.statements == {1, 2, 3, 4, 5, 6, 7}
# Plugins don't do branch coverage yet.
assert analysis.has_arcs() is True
assert analysis.arc_possibilities() == []
assert analysis.missing == {1, 2, 3, 6, 7}
def test_plugin2_with_text_report(self):
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
repout = StringIO()
total = cov.report(file=repout, include=["*.html"], omit=["uni*.html"], show_missing=True)
report = repout.getvalue().splitlines()
expected = [
'Name Stmts Miss Branch BrPart Cover Missing',
'--------------------------------------------------------',
'bar_4.html 4 2 0 0 50% 1, 4',
'foo_7.html 7 5 0 0 29% 1-3, 6-7',
'--------------------------------------------------------',
'TOTAL 11 7 0 0 36%',
]
assert expected == report
assert round(abs(total-36.36), 2) == 0
def test_plugin2_with_html_report(self):
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
total = cov.html_report(include=["*.html"], omit=["uni*.html"])
assert round(abs(total-36.36), 2) == 0
self.assert_exists("htmlcov/index.html")
self.assert_exists("htmlcov/bar_4_html.html")
self.assert_exists("htmlcov/foo_7_html.html")
def test_plugin2_with_xml_report(self):
self.make_render_and_caller()
cov = coverage.Coverage(branch=True, omit=["*quux*"])
cov.set_option("run:plugins", ["tests.plugin2"])
self.start_import_stop(cov, "caller")
total = cov.xml_report(include=["*.html"], omit=["uni*.html"])
assert round(abs(total-36.36), 2) == 0
dom = ElementTree.parse("coverage.xml")
classes = {}
for elt in dom.findall(".//class"):
classes[elt.get('name')] = elt
assert classes['bar_4.html'].attrib == {
'branch-rate': '1',
'complexity': '0',
'filename': 'bar_4.html',
'line-rate': '0.5',
'name': 'bar_4.html',
}
assert classes['foo_7.html'].attrib == {
'branch-rate': '1',
'complexity': '0',
'filename': 'foo_7.html',
'line-rate': '0.2857',
'name': 'foo_7.html',
}
def test_defer_to_python(self):
# A plugin that measures, but then wants built-in python reporting.
self.make_file("fairly_odd_plugin.py", """\
# A plugin that claims all the odd lines are executed, and none of
# the even lines, and then punts reporting off to the built-in
# Python reporting.
import coverage.plugin
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
return OddTracer(filename)
def file_reporter(self, filename):
return "python"
class OddTracer(coverage.plugin.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return self.filename
def line_number_range(self, frame):
lineno = frame.f_lineno
if lineno % 2:
return (lineno, lineno)
else:
return (-1, -1)
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.make_file("unsuspecting.py", """\
a = 1
b = 2
c = 3
d = 4
e = 5
f = 6
""")
cov = coverage.Coverage(include=["unsuspecting.py"])
cov.set_option("run:plugins", ["fairly_odd_plugin"])
self.start_import_stop(cov, "unsuspecting")
repout = StringIO()
total = cov.report(file=repout, show_missing=True)
report = repout.getvalue().splitlines()
expected = [
'Name Stmts Miss Cover Missing',
'-----------------------------------------------',
'unsuspecting.py 6 3 50% 2, 4, 6',
'-----------------------------------------------',
'TOTAL 6 3 50%',
]
assert expected == report
assert total == 50
def test_find_unexecuted(self):
self.make_file("unexecuted_plugin.py", """\
import os
import coverage.plugin
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("foo.py"):
return MyTracer(filename)
def file_reporter(self, filename):
return MyReporter(filename)
def find_executable_files(self, src_dir):
# Check that src_dir is the right value
files = os.listdir(src_dir)
assert "foo.py" in files
assert "unexecuted_plugin.py" in files
return ["chimera.py"]
class MyTracer(coverage.plugin.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return self.filename
def line_number_range(self, frame):
return (999, 999)
class MyReporter(coverage.FileReporter):
def lines(self):
return {99, 999, 9999}
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.make_file("foo.py", "a = 1")
cov = coverage.Coverage(source=['.'])
cov.set_option("run:plugins", ["unexecuted_plugin"])
self.start_import_stop(cov, "foo")
# The file we executed claims to have run line 999.
_, statements, missing, _ = cov.analysis("foo.py")
assert statements == [99, 999, 9999]
assert missing == [99, 9999]
# The completely missing file is in the results.
_, statements, missing, _ = cov.analysis("chimera.py")
assert statements == [99, 999, 9999]
assert missing == [99, 999, 9999]
# But completely new filenames are not in the results.
assert len(cov.get_data().measured_files()) == 3
with pytest.raises(CoverageException):
cov.analysis("fictional.py")
class BadFileTracerTest(FileTracerTest):
"""Test error handling around file tracer plugins."""
def run_plugin(self, module_name):
"""Run a plugin with the given module_name.
Uses a few fixed Python files.
Returns the Coverage object.
"""
self.make_file("simple.py", """\
import other, another
a = other.f(2)
b = other.f(3)
c = another.g(4)
d = another.g(5)
""")
# The names of these files are important: some plugins apply themselves
# to "*other.py".
self.make_file("other.py", """\
def f(x):
return x+1
""")
self.make_file("another.py", """\
def g(x):
return x-1
""")
cov = coverage.Coverage()
cov.set_option("run:plugins", [module_name])
self.start_import_stop(cov, "simple")
cov.save() # pytest-cov does a save after stop, so we'll do it too.
return cov
def run_bad_plugin(self, module_name, plugin_name, our_error=True, excmsg=None, excmsgs=None):
"""Run a file, and see that the plugin failed.
`module_name` and `plugin_name` is the module and name of the plugin to
use.
`our_error` is True if the error reported to the user will be an
explicit error in our test code, marked with an '# Oh noes!' comment.
`excmsg`, if provided, is text that must appear in the stderr.
`excmsgs`, if provided, is a list of messages, one of which must
appear in the stderr.
The plugin will be disabled, and we check that a warning is output
explaining why.
"""
self.run_plugin(module_name)
stderr = self.stderr()
if our_error:
errors = stderr.count("# Oh noes!")
# The exception we're causing should only appear once.
assert errors == 1
# There should be a warning explaining what's happening, but only one.
# The message can be in two forms:
# Disabling plug-in '...' due to previous exception
# or:
# Disabling plug-in '...' due to an exception:
msg = "Disabling plug-in '%s.%s' due to " % (module_name, plugin_name)
warnings = stderr.count(msg)
assert warnings == 1
if excmsg:
assert excmsg in stderr
if excmsgs:
assert any(em in stderr for em in excmsgs), "expected one of %r" % excmsgs
def test_file_tracer_has_no_file_tracer_method(self):
self.make_file("bad_plugin.py", """\
class Plugin(object):
pass
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin("bad_plugin", "Plugin", our_error=False)
def test_file_tracer_has_inherited_sourcefilename_method(self):
self.make_file("bad_plugin.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
# Just grab everything.
return FileTracer()
class FileTracer(coverage.FileTracer):
pass
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsg="Class 'bad_plugin.FileTracer' needs to implement source_filename()",
)
def test_plugin_has_inherited_filereporter_method(self):
self.make_file("bad_plugin.py", """\
import coverage
class Plugin(coverage.CoveragePlugin):
def file_tracer(self, filename):
# Just grab everything.
return FileTracer()
class FileTracer(coverage.FileTracer):
def source_filename(self):
return "foo.xxx"
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
cov = self.run_plugin("bad_plugin")
expected_msg = "Plugin 'bad_plugin.Plugin' needs to implement file_reporter()"
with pytest.raises(NotImplementedError, match=expected_msg):
cov.report()
def test_file_tracer_fails(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
17/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin("bad_plugin", "Plugin")
def test_file_tracer_fails_eventually(self):
# Django coverage plugin can report on a few files and then fail.
# https://github.com/nedbat/coveragepy/issues/1011
self.make_file("bad_plugin.py", """\
import os.path
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def __init__(self):
self.calls = 0
def file_tracer(self, filename):
print(filename)
self.calls += 1
if self.calls <= 2:
return FileTracer(filename)
else:
17/0 # Oh noes!
class FileTracer(coverage.FileTracer):
def __init__(self, filename):
self.filename = filename
def source_filename(self):
return os.path.basename(self.filename).replace(".py", ".foo")
def line_number_range(self, frame):
return -1, -1
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin("bad_plugin", "Plugin")
def test_file_tracer_returns_wrong(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return 3.14159
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="'float' object has no attribute",
)
def test_has_dynamic_source_filename_fails(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def has_dynamic_source_filename(self):
23/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin("bad_plugin", "Plugin")
def test_source_filename_fails(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
42/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin("bad_plugin", "Plugin")
def test_source_filename_returns_wrong(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return 17.3
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsgs=[
"expected str, bytes or os.PathLike object, not float",
"'float' object has no attribute",
"object of type 'float' has no len()",
"'float' object is unsubscriptable",
],
)
def test_dynamic_source_filename_fails(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def has_dynamic_source_filename(self):
return True
def dynamic_source_filename(self, filename, frame):
101/0 # Oh noes!
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin("bad_plugin", "Plugin")
def test_line_number_range_raises_error(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
raise Exception("borked!")
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="borked!",
)
def test_line_number_range_returns_non_tuple(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return 42.23
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="line_number_range must return 2-tuple",
)
def test_line_number_range_returns_triple(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return (1, 2, 3)
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False, excmsg="line_number_range must return 2-tuple",
)
def test_line_number_range_returns_pair_of_strings(self):
self.make_file("bad_plugin.py", """\
import coverage.plugin
class Plugin(coverage.plugin.CoveragePlugin):
def file_tracer(self, filename):
if filename.endswith("other.py"):
return BadFileTracer()
class BadFileTracer(coverage.plugin.FileTracer):
def source_filename(self):
return "something.foo"
def line_number_range(self, frame):
return ("5", "7")
def coverage_init(reg, options):
reg.add_file_tracer(Plugin())
""")
self.run_bad_plugin(
"bad_plugin", "Plugin", our_error=False,
excmsgs=[
"an integer is required",
"cannot be interpreted as an integer",
],
)
class ConfigurerPluginTest(CoverageTest):
"""Test configuring plugins."""
run_in_temp_dir = False
def test_configurer_plugin(self):
cov = coverage.Coverage()
cov.set_option("run:plugins", ["tests.plugin_config"])
cov.start()
cov.stop() # pragma: nested
excluded = cov.get_option("report:exclude_lines")
assert "pragma: custom" in excluded
assert "pragma: or whatever" in excluded
class DynamicContextPluginTest(CoverageTest):
"""Tests of plugins that implement `dynamic_context`."""
def make_plugin_capitalized_testnames(self, filename):
"""Create a dynamic context plugin that capitalizes the part after 'test_'."""
self.make_file(filename, """\
from coverage import CoveragePlugin
class Plugin(CoveragePlugin):
def dynamic_context(self, frame):
name = frame.f_code.co_name
if name.startswith(("test_", "doctest_")):
parts = name.split("_", 1)
return "%s:%s" % (parts[0], parts[1].upper())
return None
def coverage_init(reg, options):
reg.add_dynamic_context(Plugin())
""")
def make_plugin_track_render(self, filename):
"""Make a dynamic context plugin that tracks 'render_' functions."""
self.make_file(filename, """\
from coverage import CoveragePlugin
class Plugin(CoveragePlugin):
def dynamic_context(self, frame):
name = frame.f_code.co_name
if name.startswith("render_"):
return 'renderer:' + name[7:]
return None
def coverage_init(reg, options):
reg.add_dynamic_context(Plugin())
""")
def make_test_files(self):
"""Make some files to use while testing dynamic context plugins."""
self.make_file("rendering.py", """\
def html_tag(tag, content):
return '<%s>%s</%s>' % (tag, content, tag)
def render_paragraph(text):
return html_tag('p', text)
def render_span(text):
return html_tag('span', text)
def render_bold(text):
return html_tag('b', text)
""")
self.make_file("testsuite.py", """\
import rendering
def test_html_tag():
assert rendering.html_tag('b', 'hello') == '<b>hello</b>'
def doctest_html_tag():
assert eval('''
rendering.html_tag('i', 'text') == '<i>text</i>'
'''.strip())
def test_renderers():
assert rendering.render_paragraph('hello') == '<p>hello</p>'
assert rendering.render_bold('wide') == '<b>wide</b>'
assert rendering.render_span('world') == '<span>world</span>'
def build_full_html():
html = '<html><body>%s</body></html>' % (
rendering.render_paragraph(
rendering.render_span('hello')))
return html
""")
def run_all_functions(self, cov, suite_name): # pragma: nested
"""Run all functions in `suite_name` under coverage."""
cov.start()
suite = import_local_file(suite_name)
try:
# Call all functions in this module
for name in dir(suite):
variable = getattr(suite, name)
if inspect.isfunction(variable):
variable()
finally:
cov.stop()
def test_plugin_standalone(self):
self.make_plugin_capitalized_testnames('plugin_tests.py')
self.make_test_files()
# Enable dynamic context plugin
cov = coverage.Coverage()
cov.set_option("run:plugins", ['plugin_tests'])
# Run the tests
self.run_all_functions(cov, 'testsuite')
# Labeled coverage is collected
data = cov.get_data()
filenames = self.get_measured_filenames(data)
expected = ['', 'doctest:HTML_TAG', 'test:HTML_TAG', 'test:RENDERERS']
assert expected == sorted(data.measured_contexts())
data.set_query_context("doctest:HTML_TAG")
assert [2] == data.lines(filenames['rendering.py'])
data.set_query_context("test:HTML_TAG")
assert [2] == data.lines(filenames['rendering.py'])
data.set_query_context("test:RENDERERS")
assert [2, 5, 8, 11] == sorted(data.lines(filenames['rendering.py']))
def test_static_context(self):
self.make_plugin_capitalized_testnames('plugin_tests.py')
self.make_test_files()
# Enable dynamic context plugin for coverage with named context
cov = coverage.Coverage(context='mytests')
cov.set_option("run:plugins", ['plugin_tests'])
# Run the tests
self.run_all_functions(cov, 'testsuite')
# Static context prefix is preserved
data = cov.get_data()
expected = [
'mytests',
'mytests|doctest:HTML_TAG',
'mytests|test:HTML_TAG',
'mytests|test:RENDERERS',
]
assert expected == sorted(data.measured_contexts())
def test_plugin_with_test_function(self):
self.make_plugin_capitalized_testnames('plugin_tests.py')
self.make_test_files()
# Enable both a plugin and test_function dynamic context
cov = coverage.Coverage()
cov.set_option("run:plugins", ['plugin_tests'])
cov.set_option("run:dynamic_context", "test_function")
# Run the tests
self.run_all_functions(cov, 'testsuite')
# test_function takes precedence over plugins - only
# functions that are not labeled by test_function are
# labeled by plugin_tests.
data = cov.get_data()
filenames = self.get_measured_filenames(data)
expected = [
'',
'doctest:HTML_TAG',
'testsuite.test_html_tag',
'testsuite.test_renderers',
]
assert expected == sorted(data.measured_contexts())
def assert_context_lines(context, lines):
data.set_query_context(context)
assert lines == sorted(data.lines(filenames['rendering.py']))
assert_context_lines("doctest:HTML_TAG", [2])
assert_context_lines("testsuite.test_html_tag", [2])
assert_context_lines("testsuite.test_renderers", [2, 5, 8, 11])
def test_multiple_plugins(self):
self.make_plugin_capitalized_testnames('plugin_tests.py')
self.make_plugin_track_render('plugin_renderers.py')
self.make_test_files()
# Enable two plugins
cov = coverage.Coverage()
cov.set_option("run:plugins", ['plugin_renderers', 'plugin_tests'])
self.run_all_functions(cov, 'testsuite')
# It is important to note, that line 11 (render_bold function) is never
# labeled as renderer:bold context, because it is only called from
# test_renderers function - so it already falls under test:RENDERERS
# context.
#
# render_paragraph and render_span (lines 5, 8) are directly called by
# testsuite.build_full_html, so they get labeled by renderers plugin.
data = cov.get_data()
filenames = self.get_measured_filenames(data)
expected = [
'',
'doctest:HTML_TAG',
'renderer:paragraph',
'renderer:span',
'test:HTML_TAG',
'test:RENDERERS',
]
assert expected == sorted(data.measured_contexts())
def assert_context_lines(context, lines):
data.set_query_context(context)
assert lines == sorted(data.lines(filenames['rendering.py']))
assert_context_lines("test:HTML_TAG", [2])
assert_context_lines("test:RENDERERS", [2, 5, 8, 11])
assert_context_lines("doctest:HTML_TAG", [2])
assert_context_lines("renderer:paragraph", [2, 5])
assert_context_lines("renderer:span", [2, 8])
| [
"[email protected]"
] | |
c7bdea3d3ab6180d2b789fd140f141eb2e07ac06 | b1fe502cfd4832b9ddc24f5dccc9c5d6f3e1ef4a | /code/emails2.py | 21dd2dcb13da5666f3fdbebe753f99c95384c365 | [] | no_license | hanxiaoshun/steam_cui | 73fa3273fc057811e76ed5a4f0b65b858d5536d7 | 768b660e27806a90bf43351526b88aa36552877b | refs/heads/master | 2023-01-22T08:15:33.851246 | 2020-11-22T23:47:08 | 2020-11-22T23:47:08 | 309,525,747 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 570 | py | # %3A%2F%2F=://
# %2F=/
# %3D= =
# 'https%3A%2F%2Fstore.steampowered.com%2Faccount%2Fnewaccountverification%3F
# stoken
# %3D385313a17af59bf057c9254f1d024ea2c87193ac543cb821540ed83539596a944d188e14361d8315e303d3833e78a6a7
# %3D385313a17af59bf057c9254f1d024ea2c87193ac543cb821540ed83539596a944d188e14361d8315e303d3833e78a6a7
# %26creationid
# %3D5304319067267826436
'https://store.steampowered.com/account/newaccountverification?stoken=385313a17af59bf057c9254f1d024ea2c87193ac543cb821540ed83539596a944d188e14361d8315e303d3833e78a6a7&creationid=5304319067267826436'
| [
"[email protected]"
] | |
5781f23b00e1920d30f18bda54f32ff8f34b8b0d | 7c2e677d931a8eb7d7cffc6d54713411abbe83e4 | /AppBuilder9000/AppBuilder9000/FestivalApp/views.py | 36c0495f856bd4c64a0e3c830e04e4f8a1c47923 | [] | no_license | r3bunker/Python_Live_Project | 19e367b3cf74c2279c287fcd3a8a44a27f24041a | d3e06150d7daea6326cc1a4155309d99e4ff6244 | refs/heads/main | 2023-06-12T23:01:50.440371 | 2021-06-16T20:21:03 | 2021-06-16T20:21:03 | 344,883,966 | 1 | 0 | null | null | null | null | UTF-8 | Python | false | false | 8,444 | py | from django.shortcuts import render, redirect, get_object_or_404
from .models import FestivalReview, USCities
from .forms import ReviewForm
from django.db.models import Q
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
import requests
import json
import os
from django.contrib import messages
from django.http import HttpResponse
from bs4 import BeautifulSoup
# Create your views here.
def festival_home(request):
return render(request, 'FestivalApp/FestivalApp_home.html')
def create_review(request):
form = ReviewForm(data=request.POST or None)
if request.method == 'POST':
if form.is_valid():
print("Valid Form")
form.save()
messages.success(request, 'Review successfully submitted.')
return redirect('FestivalApp:create_review')
else:
print("Invalid Form")
print(form.errors)
context = {'form': form}
return render(request, 'FestivalApp/FestivalApp_create_review.html', context)
def reviews_index(request):
get_reviews = FestivalReview.reviews.all()
# print(len(get_reviews))
# The query variable grabs the string item 'q' from the db based on the search input field in reviews_index page.
query = request.GET.get('q')
if query:
get_reviews = FestivalReview.reviews.filter(
Q(review_date__icontains=query) | Q(festival_title__icontains=query) | Q(rating__icontains=query)
).distinct()
# else:
# messages.error(request, 'Sorry, no reviews for that. Try searching something else.')
paginator = Paginator(get_reviews, 10)
page = request.GET.get('page')
try:
reviews = paginator.page(page)
except PageNotAnInteger:
reviews = paginator.page(1)
except EmptyPage:
reviews = paginator.page(paginator.num_pages)
context = {'FestivalReview_list': reviews,
'get_reviews': get_reviews
}
return render(request, 'FestivalApp/FestivalApp_reviews_index.html', context)
def review_details(request, id):
selected_review = get_object_or_404(FestivalReview, pk=id)
context = {'selected_review': selected_review}
return render(request, 'FestivalApp/FestivalApp_review_details.html', context)
def edit_review(request, id):
review = get_object_or_404(FestivalReview, pk=id)
if request.method == 'POST':
form = ReviewForm(request.POST, instance=review)
if form.is_valid():
review = form.save(commit=False)
review.save()
# The 'id' argument will be passed to the above 'review_details' function.
return redirect('FestivalApp:review_details', id=review.id)
else:
form = ReviewForm(instance=review)
context = {'form': form}
return render(request, 'FestivalApp/FestivalApp_edit_review.html', context)
def delete(request, id):
review = get_object_or_404(FestivalReview, pk=id)
if request.method == 'POST':
review.delete()
return redirect('FestivalApp:reviews_index')
else:
return redirect('FestivalApp:review_details')
def festivals_bs(request):
page = requests.get('https://visitseattle.org/events/?frm=events&s=')
print(page)
soup = BeautifulSoup(page.content, 'html.parser')
#print(soup.prettify())
results = soup.find(class_="search-result-container")
# print(results)
# print(type(results))
result_items = results.find_all(class_="search-result")
festivals_list = []
for i in result_items:
# print("========================")
a_tag = i.find(class_="event-title")
title = a_tag.text
# print(title)
details = []
p_tags = i.find_all("p")
for p in p_tags:
txt = p.text
details.append(txt)
# print(details)
links = []
for h in i.find_all("a"):
link = h.get('href')
links.append(link)
print(links)
festivals = {
"title": title,
"venue": details[0],
"dates": details[1],
"details": links[1],
"website": links[2]
}
# print(festivals)
festivals_list.append(festivals)
print(festivals_list)
context = {"festivals_list": festivals_list}
return render(request, 'FestivalApp/FestivalApp_festivals_bs.html', context)
# Weather API page
def weather_api(request):
seed_cities_database()
query = request.GET.get('q')
if query:
get_city = USCities.cities.filter(
Q(city__icontains=query) | Q(state__icontains=query)
).distinct()
paginator = Paginator(get_city, 10)
page = request.GET.get('page')
try:
city_page = paginator.page(page)
except PageNotAnInteger:
city_page = paginator.page(1)
except EmptyPage:
city_page = paginator.page(paginator.num_pages)
print("inside query")
context = {'city_list': city_page,
'get_city': get_city
}
return render(request, 'FestivalApp/FestivalApp_weather_api.html', context)
print("outside query")
seattle = seattle_weather_api()
context = {'weather_desc': seattle['weather_desc'],
'feels_like_in_Fahrenheit': seattle['feels_like_in_Fahrenheit'],
}
# jprint(weather_desc)
# jprint(feels_like_in_Fahrenheit)
return render(request, 'FestivalApp/FestivalApp_weather_api.html', context)
def seed_cities_database():
with open("FestivalApp/usa_cities.json") as f:
cities_json = json.load(f)
# print(len(USCities.cities.all()))
if len(USCities.cities.all()) < 1:
i = 0
while (i < len(cities_json)):
us_cities = USCities(
city= cities_json[i]['city'],
lat= cities_json[i]['lat'],
lng= cities_json[i]['lng'],
country= cities_json[i]['country'],
state= cities_json[i]['state'],
state_code = cities_json[i]['state_code']
)
us_cities.save()
i += 1
def seattle_weather_api():
# Seattle API call
# This call to the api will appear on the page at all times, rendering dynamically.
api = 'https://api.openweathermap.org/data/2.5/weather'
city_name = 'Seattle'
country = 'us'
weather_city_name = city_name + ',' + country
api_key = '69b5210e5ff559e06318bbd567995023'
weather_URI = api + '?q=' + weather_city_name + '&appid=' + api_key
response = requests.get(weather_URI)
# print(response.status_code)
json_response = response.json()
# print(json_response)
# jprint(json_response)
# extracting the name key/value pair from the JSON object.
# name = response.json()['name']
weather = json_response['weather']
weather_desc = weather[0]['description']
main = json_response['main']
feels_like_in_Kelvin = main['feels_like']
feels_like_in_Fahrenheit = round((feels_like_in_Kelvin - 273.15) * 9 / 5 + 32)
return {'weather_desc': weather_desc, 'feels_like_in_Fahrenheit': feels_like_in_Fahrenheit}
# method to print a formatted string as the JSON output, for readability.
def jprint(obj):
# create a formatted string of the Python JSON object
text = json.dumps(obj, sort_keys=True, indent=4)
print(text)
# def city_index(request, id):
def city_index(request, city, state):
api = 'https://api.openweathermap.org/data/2.5/weather'
city_name = city
state_code = state
print(state)
country = 'us'
weather_city_name = city_name + ',' + state_code + ',' + country
api_key = '69b5210e5ff559e06318bbd567995023'
weather_URI = api + '?q=' + weather_city_name + '&appid=' + api_key
response = requests.get(weather_URI)
json_response = response.json()
print(json_response)
weather = json_response['weather']
city_weather = weather[0]['description']
main = json_response['main']
city_temp_Kelvin = main['feels_like']
city_temp_Fahrenheit = round((city_temp_Kelvin - 273.15) * 9 / 5 + 32)
context = {'city_name': city_name,
'state_code': state_code,
'city_weather': city_weather,
'city_temp_Fahrenheit': city_temp_Fahrenheit,
}
return render(request, 'FestivalApp/FestivalApp_weather_api.html', context)
| [
"[email protected]"
] | |
eea61969e7f6be2c1f7d87af9651d2ae9981a599 | f09dc121f213f2881df3572288b7ee5b39246d73 | /aliyun-python-sdk-objectdet/aliyunsdkobjectdet/request/v20191230/ClassifyVehicleInsuranceRequest.py | 904a71cd6958473b6231aed3ad589f74ad126417 | [
"Apache-2.0"
] | permissive | hetw/aliyun-openapi-python-sdk | 2f31378ad6be0896fb8090423f607e9c7d3ae774 | 7443eacee9fbbaa93c7975c6dbec92d3c364c577 | refs/heads/master | 2023-01-19T22:42:36.214770 | 2020-12-04T10:55:14 | 2020-12-04T10:55:14 | 318,689,093 | 1 | 0 | NOASSERTION | 2020-12-05T03:03:03 | 2020-12-05T03:03:03 | null | UTF-8 | Python | false | false | 1,464 | py | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
#
# http://www.apache.org/licenses/LICENSE-2.0
#
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
from aliyunsdkcore.request import RpcRequest
from aliyunsdkobjectdet.endpoint import endpoint_data
class ClassifyVehicleInsuranceRequest(RpcRequest):
def __init__(self):
RpcRequest.__init__(self, 'objectdet', '2019-12-30', 'ClassifyVehicleInsurance','objectdet')
self.set_method('POST')
if hasattr(self, "endpoint_map"):
setattr(self, "endpoint_map", endpoint_data.getEndpointMap())
if hasattr(self, "endpoint_regional"):
setattr(self, "endpoint_regional", endpoint_data.getEndpointRegional())
def get_ImageURL(self):
return self.get_body_params().get('ImageURL')
def set_ImageURL(self,ImageURL):
self.add_body_params('ImageURL', ImageURL) | [
"[email protected]"
] | |
2792bbe02ccbe16552038a958ca64abd2b9a6c45 | b708cf2c5145d68fbc45c736568fe152e7dec27e | /apps/store/views.py | 8dda31fbfd77fc5dcb60bd45c6728e7a32db3fa1 | [] | no_license | stillnurs/dropshipper-django-vue | 56036ebf705d91aea58492344d57c2d94ee6c368 | becad05d44342598b4c1f8fba7d19bc6223d6c57 | refs/heads/main | 2023-05-03T08:34:35.771909 | 2021-05-23T12:15:15 | 2021-05-23T12:15:15 | 369,894,968 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,720 | py | import random
from datetime import datetime
from django.shortcuts import render, get_object_or_404, redirect
from django.db.models import Q
from apps.cart.cart import Cart
from .models import Product, Category, ProductReview
def search(request):
query = request.GET.get('query')
instock = request.GET.get('instock')
price_from = request.GET.get('price_from', 0)
price_to = request.GET.get('price_to', 100000)
sorting = request.GET.get('sorting', '-date_added')
products = Product.objects.filter(Q(title__icontains=query) | Q(description__icontains=query)).filter(price__gte=price_from).filter(price__lte=price_to)
if instock:
products = products.filter(num_available__gte=1)
context = {
'query': query,
'products': products.order_by(sorting),
'instock': instock,
'price_from': price_from,
'price_to': price_to,
'sorting': sorting
}
return render(request, 'search.html', context)
def product_detail(request, category_slug, slug):
product = get_object_or_404(Product, slug=slug)
product.num_visits = product.num_visits + 1
product.last_visit = datetime.now()
product.save()
# Add review
if request.method == 'POST' and request.user.is_authenticated:
stars = request.POST.get('stars', 3)
content = request.POST.get('content', '')
review = ProductReview.objects.create(product=product, user=request.user, stars=stars, content=content)
return redirect('product_detail', category_slug=category_slug, slug=slug)
#
related_products = list(product.category.products.filter(parent=None).exclude(id=product.id))
if len(related_products) >= 3:
related_products = random.sample(related_products, 3)
if product.parent:
return redirect('product_detail', category_slug=category_slug, slug=product.parent.slug)
imagesstring = "{'thumbnail': '%s', 'image': '%s'}," % (product.thumbnail.url, product.image.url)
for image in product.images.all():
imagesstring = imagesstring + ("{'thumbnail': '%s', 'image': '%s'}," % (image.thumbnail.url, image.image.url))
cart = Cart(request)
product.in_cart = bool(cart.has_product(product.id))
context = {
'product': product,
'imagesstring': imagesstring,
'related_products': related_products
}
return render(request, 'product_detail.html', context)
def category_detail(request, slug):
category = get_object_or_404(Category, slug=slug)
products = category.products.filter(parent=None)
context = {
'category': category,
'products': products
}
return render(request, 'category_detail.html', context) | [
"[email protected]"
] | |
1e83527a90853e686356fcf1282cefab339f8905 | c9e2bb165d0cc60e47f4d658a05bd77bb5f6fa9a | /unittests/test_wsgi_jinja.py | 6d2b9eea3f7bcddd96ac3abda9a6e82dcc56edce | [
"BSD-3-Clause",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | swl10/pyslet | c1eb8a505972e6c16bd01d6f9e7c6cd83f75f123 | b30e9a439f6c0f0e2d01f1ac80986944bed7427b | refs/heads/master | 2021-01-25T09:31:55.480250 | 2018-03-05T18:50:11 | 2018-03-05T18:50:11 | 20,192,341 | 67 | 39 | NOASSERTION | 2020-03-31T05:51:24 | 2014-05-26T16:37:45 | Python | UTF-8 | Python | false | false | 1,661 | py | #! /usr/bin/env python
import logging
import optparse
import os.path
import unittest
from pyslet.wsgi_jinja import JinjaApp
def suite(prefix='test'):
loader = unittest.TestLoader()
loader.testMethodPrefix = prefix
return unittest.TestSuite((
loader.loadTestsFromTestCase(JinjaAppTests),
))
SETTINGS_FILE = os.path.join(
os.path.join(os.path.split(__file__)[0], 'data_jinja'), 'settings.json')
class JinjaAppTests(unittest.TestCase):
def setUp(self): # noqa
self.settings_file = os.path.abspath(SETTINGS_FILE)
def tearDown(self): # noqa
pass
def test_debug_option(self):
class DebugApp(JinjaApp):
settings_file = self.settings_file
p = optparse.OptionParser()
DebugApp.add_options(p)
options, args = p.parse_args([])
self.assertTrue(options.debug is False)
DebugApp.setup(options=options, args=args)
# check setting value
self.assertTrue(DebugApp.debug is False)
class DebugApp(JinjaApp):
settings_file = self.settings_file
options, args = p.parse_args(['-d'])
self.assertTrue(options.debug is True)
DebugApp.setup(options=options, args=args)
self.assertTrue(DebugApp.debug is True)
class DebugApp(JinjaApp):
settings_file = self.settings_file
options, args = p.parse_args(['--debug'])
self.assertTrue(options.debug is True)
DebugApp.setup(options=options, args=args)
self.assertTrue(DebugApp.debug is True)
if __name__ == "__main__":
logging.basicConfig(level=logging.INFO)
unittest.main()
| [
"[email protected]"
] | |
cc2d2b05587e1040aeb998970bdd7ff6b7119cc7 | 6896fce8ee082f9730c056436e49ef0d16a6ea03 | /leetcode/demo.py | 1311c4dfc429fbf3f35519e1f200bd9bb77d8adf | [] | no_license | Sugeei/python-practice | 5022ae7c34bc04972edebc15936248cb9869ec54 | 048df40500a059e4380f3ecc2581de96c9a1fc9b | refs/heads/master | 2022-12-07T06:34:40.740379 | 2022-11-13T11:48:29 | 2022-11-13T11:48:29 | 121,074,877 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 28 | py | print(9%10)
print(int(9/10)) | [
"[email protected]"
] | |
975a54336d40dfe3e284486a8533f9509cd722a5 | 35be0509b6f98030ef5338033468710de1a536a3 | /cinder/cinder/tests/unit/volume/drivers/netapp/eseries/fakes.py | 1dd6ef505f86346c88ff493988d6a87c5636b3b8 | [
"Apache-2.0"
] | permissive | yizhongyin/OpenstackLiberty | 6f2f0ff95bfb4204f3dbc74a1c480922dc387878 | f705e50d88997ef7473c655d99f1e272ef857a82 | refs/heads/master | 2020-12-29T02:44:01.555863 | 2017-03-02T06:43:47 | 2017-03-02T06:43:47 | 49,924,385 | 0 | 1 | null | 2020-07-24T00:49:34 | 2016-01-19T03:45:06 | Python | UTF-8 | Python | false | false | 35,671 | py | # Copyright (c) - 2015, Alex Meade
# Copyright (c) - 2015, Yogesh Kshirsagar
# Copyright (c) - 2015, Michael Price
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
import copy
import json
import mock
from cinder.volume import configuration as conf
from cinder.volume.drivers.netapp.eseries import utils
import cinder.volume.drivers.netapp.options as na_opts
MULTIATTACH_HOST_GROUP = {
'clusterRef': '8500000060080E500023C7340036035F515B78FC',
'label': utils.MULTI_ATTACH_HOST_GROUP_NAME,
}
FOREIGN_HOST_GROUP = {
'clusterRef': '8500000060080E500023C7340036035F515B78FD',
'label': 'FOREIGN HOST GROUP',
}
SSC_POOLS = [
{
"poolId": "0400000060080E5000290D8000009C9955828DD2",
"name": "DDP",
"pool": {
"sequenceNum": 2,
"offline": False,
"raidLevel": "raidDiskPool",
"worldWideName": "60080E5000290D8000009C9955828DD2",
"volumeGroupRef": "0400000060080E5000290D8000009C9955828DD2",
"reserved1": "000000000000000000000000",
"reserved2": "",
"trayLossProtection": False,
"label": "DDP",
"state": "complete",
"spindleSpeedMatch": True,
"spindleSpeed": 7200,
"isInaccessible": False,
"securityType": "none",
"drawerLossProtection": True,
"protectionInformationCapable": False,
"protectionInformationCapabilities": {
"protectionInformationCapable": True,
"protectionType": "type2Protection"
},
"volumeGroupData": {
"type": "diskPool",
"diskPoolData": {
"reconstructionReservedDriveCount": 1,
"reconstructionReservedAmt": "2992518463488",
"reconstructionReservedDriveCountCurrent": 1,
"poolUtilizationWarningThreshold": 100,
"poolUtilizationCriticalThreshold": 100,
"poolUtilizationState": "utilizationOptimal",
"unusableCapacity": "0",
"degradedReconstructPriority": "high",
"criticalReconstructPriority": "highest",
"backgroundOperationPriority": "low",
"allocGranularity": "4294967296"
}
},
"usage": "standard",
"driveBlockFormat": "allNative",
"reservedSpaceAllocated": True,
"usedSpace": "13653701033984",
"totalRaidedSpace": "23459111370752",
"extents": [
{
"sectorOffset": "0",
"rawCapacity": "9805410336768",
"raidLevel": "raidDiskPool",
"volumeGroupRef":
"0400000060080E5000290D8000009C9955828DD2",
"freeExtentRef":
"0301000060080E5000290D8000009C9955828DD2",
"reserved1": "000000000000000000000000",
"reserved2": ""
}
],
"largestFreeExtentSize": "9805410336768",
"raidStatus": "optimal",
"freeSpace": "9805410336768",
"drivePhysicalType": "sas",
"driveMediaType": "hdd",
"normalizedSpindleSpeed": "spindleSpeed7200",
"id": "0400000060080E5000290D8000009C9955828DD2",
"diskPool": True,
"name": "DDP"
},
"flashCacheCapable": True,
"dataAssuranceCapable": True,
"encrypted": False,
"thinProvisioningCapable": True,
"spindleSpeed": "spindleSpeed7200",
"raidLevel": "raidDiskPool",
"availableFreeExtentCapacities": [
"9805410336768"
]
},
{
"poolId": "0400000060080E5000290D8000009CBA55828E96",
"name": "pool_raid1",
"pool": {
"sequenceNum": 6,
"offline": False,
"raidLevel": "raid1",
"worldWideName": "60080E5000290D8000009CBA55828E96",
"volumeGroupRef": "0400000060080E5000290D8000009CBA55828E96",
"reserved1": "000000000000000000000000",
"reserved2": "",
"trayLossProtection": False,
"label": "pool_raid1",
"state": "complete",
"spindleSpeedMatch": True,
"spindleSpeed": 10000,
"isInaccessible": False,
"securityType": "none",
"drawerLossProtection": True,
"protectionInformationCapable": False,
"protectionInformationCapabilities": {
"protectionInformationCapable": True,
"protectionType": "type2Protection"
},
"volumeGroupData": {
"type": "unknown",
"diskPoolData": None
},
"usage": "standard",
"driveBlockFormat": "allNative",
"reservedSpaceAllocated": True,
"usedSpace": "2978559819776",
"totalRaidedSpace": "6662444097536",
"extents": [
{
"sectorOffset": "387891200",
"rawCapacity": "3683884277760",
"raidLevel": "raid1",
"volumeGroupRef":
"0400000060080E5000290D8000009CBA55828E96",
"freeExtentRef":
"030000B360080E5000290D8000009CBA55828E96",
"reserved1": "000000000000000000000000",
"reserved2": ""
}
],
"largestFreeExtentSize": "3683884277760",
"raidStatus": "optimal",
"freeSpace": "3683884277760",
"drivePhysicalType": "sas",
"driveMediaType": "hdd",
"normalizedSpindleSpeed": "spindleSpeed10k",
"id": "0400000060080E5000290D8000009CBA55828E96",
"diskPool": False,
"name": "pool_raid1"
},
"flashCacheCapable": False,
"dataAssuranceCapable": True,
"encrypted": False,
"thinProvisioningCapable": False,
"spindleSpeed": "spindleSpeed10k",
"raidLevel": "raid1",
"availableFreeExtentCapacities": [
"3683884277760"
]
},
{
"poolId": "0400000060080E5000290D8000009CAB55828E51",
"name": "pool_raid6",
"pool": {
"sequenceNum": 3,
"offline": False,
"raidLevel": "raid6",
"worldWideName": "60080E5000290D8000009CAB55828E51",
"volumeGroupRef": "0400000060080E5000290D8000009CAB55828E51",
"reserved1": "000000000000000000000000",
"reserved2": "",
"trayLossProtection": False,
"label": "pool_raid6",
"state": "complete",
"spindleSpeedMatch": True,
"spindleSpeed": 15000,
"isInaccessible": False,
"securityType": "enabled",
"drawerLossProtection": False,
"protectionInformationCapable": False,
"protectionInformationCapabilities": {
"protectionInformationCapable": True,
"protectionType": "type2Protection"
},
"volumeGroupData": {
"type": "unknown",
"diskPoolData": None
},
"usage": "standard",
"driveBlockFormat": "allNative",
"reservedSpaceAllocated": True,
"usedSpace": "16413217521664",
"totalRaidedSpace": "16637410312192",
"extents": [
{
"sectorOffset": "1144950784",
"rawCapacity": "224192790528",
"raidLevel": "raid6",
"volumeGroupRef":
"0400000060080E5000290D8000009CAB55828E51",
"freeExtentRef":
"0300005960080E5000290D8000009CAB55828E51",
"reserved1": "000000000000000000000000",
"reserved2": ""
}
],
"largestFreeExtentSize": "224192790528",
"raidStatus": "optimal",
"freeSpace": "224192790528",
"drivePhysicalType": "sas",
"driveMediaType": "hdd",
"normalizedSpindleSpeed": "spindleSpeed15k",
"id": "0400000060080E5000290D8000009CAB55828E51",
"diskPool": False,
"name": "pool_raid6"
},
"flashCacheCapable": False,
"dataAssuranceCapable": True,
"encrypted": True,
"thinProvisioningCapable": False,
"spindleSpeed": "spindleSpeed15k",
"raidLevel": "raid6",
"availableFreeExtentCapacities": [
"224192790528"
]
}
]
STORAGE_POOLS = [ssc_pool['pool'] for ssc_pool in SSC_POOLS]
VOLUMES = [
{
"offline": False,
"extremeProtection": False,
"volumeHandle": 2,
"raidLevel": "raid0",
"sectorOffset": "0",
"worldWideName": "60080E50002998A00000945355C37C19",
"label": "1",
"blkSize": 512,
"capacity": "10737418240",
"reconPriority": 1,
"segmentSize": 131072,
"action": "initializing",
"cache": {
"cwob": False,
"enterpriseCacheDump": False,
"mirrorActive": True,
"mirrorEnable": True,
"readCacheActive": True,
"readCacheEnable": True,
"writeCacheActive": True,
"writeCacheEnable": True,
"cacheFlushModifier": "flush10Sec",
"readAheadMultiplier": 1
},
"mediaScan": {
"enable": False,
"parityValidationEnable": False
},
"volumeRef": "0200000060080E50002998A00000945355C37C19",
"status": "optimal",
"volumeGroupRef": "0400000060080E50002998A00000945255C37C14",
"currentManager": "070000000000000000000001",
"preferredManager": "070000000000000000000001",
"perms": {
"mapToLUN": True,
"snapShot": True,
"format": True,
"reconfigure": True,
"mirrorPrimary": True,
"mirrorSecondary": True,
"copySource": True,
"copyTarget": True,
"readable": True,
"writable": True,
"rollback": True,
"mirrorSync": True,
"newImage": True,
"allowDVE": True,
"allowDSS": True,
"concatVolumeMember": True,
"flashReadCache": True,
"asyncMirrorPrimary": True,
"asyncMirrorSecondary": True,
"pitGroup": True,
"cacheParametersChangeable": True,
"allowThinManualExpansion": False,
"allowThinGrowthParametersChange": False,
"allowVaulting": False,
"allowRestore": False
},
"mgmtClientAttribute": 0,
"dssPreallocEnabled": True,
"dssMaxSegmentSize": 2097152,
"preReadRedundancyCheckEnabled": False,
"protectionInformationCapable": False,
"protectionType": "type1Protection",
"applicationTagOwned": False,
"untrustworthy": 0,
"volumeUse": "standardVolume",
"volumeFull": False,
"volumeCopyTarget": False,
"volumeCopySource": False,
"pitBaseVolume": False,
"asyncMirrorTarget": False,
"asyncMirrorSource": False,
"remoteMirrorSource": False,
"remoteMirrorTarget": False,
"diskPool": False,
"flashCached": False,
"increasingBy": "0",
"metadata": [],
"dataAssurance": True,
"name": "1",
"id": "0200000060080E50002998A00000945355C37C19",
"wwn": "60080E50002998A00000945355C37C19",
"objectType": "volume",
"mapped": False,
"preferredControllerId": "070000000000000000000001",
"totalSizeInBytes": "10737418240",
"onlineVolumeCopy": False,
"listOfMappings": [],
"currentControllerId": "070000000000000000000001",
"cacheSettings": {
"cwob": False,
"enterpriseCacheDump": False,
"mirrorActive": True,
"mirrorEnable": True,
"readCacheActive": True,
"readCacheEnable": True,
"writeCacheActive": True,
"writeCacheEnable": True,
"cacheFlushModifier": "flush10Sec",
"readAheadMultiplier": 1
},
"thinProvisioned": False
},
{
"volumeHandle": 16385,
"worldWideName": "60080E500029347000001D7B55C3791E",
"label": "2",
"allocationGranularity": 128,
"capacity": "53687091200",
"reconPriority": 1,
"volumeRef": "3A00000060080E500029347000001D7B55C3791E",
"status": "optimal",
"repositoryRef": "3600000060080E500029347000001D7955C3791D",
"currentManager": "070000000000000000000002",
"preferredManager": "070000000000000000000002",
"perms": {
"mapToLUN": True,
"snapShot": False,
"format": True,
"reconfigure": False,
"mirrorPrimary": False,
"mirrorSecondary": False,
"copySource": True,
"copyTarget": False,
"readable": True,
"writable": True,
"rollback": True,
"mirrorSync": True,
"newImage": True,
"allowDVE": True,
"allowDSS": True,
"concatVolumeMember": False,
"flashReadCache": True,
"asyncMirrorPrimary": True,
"asyncMirrorSecondary": True,
"pitGroup": True,
"cacheParametersChangeable": True,
"allowThinManualExpansion": False,
"allowThinGrowthParametersChange": False,
"allowVaulting": False,
"allowRestore": False
},
"mgmtClientAttribute": 0,
"preReadRedundancyCheckEnabled": False,
"protectionType": "type0Protection",
"applicationTagOwned": True,
"maxVirtualCapacity": "69269232549888",
"initialProvisionedCapacity": "4294967296",
"currentProvisionedCapacity": "4294967296",
"provisionedCapacityQuota": "55834574848",
"growthAlertThreshold": 85,
"expansionPolicy": "automatic",
"volumeCache": {
"cwob": False,
"enterpriseCacheDump": False,
"mirrorActive": True,
"mirrorEnable": True,
"readCacheActive": True,
"readCacheEnable": True,
"writeCacheActive": True,
"writeCacheEnable": True,
"cacheFlushModifier": "flush10Sec",
"readAheadMultiplier": 0
},
"offline": False,
"volumeFull": False,
"volumeGroupRef": "0400000060080E50002998A00000945155C37C08",
"blkSize": 512,
"storageVolumeRef": "0200000060080E500029347000001D7855C3791D",
"volumeCopyTarget": False,
"volumeCopySource": False,
"pitBaseVolume": False,
"asyncMirrorTarget": False,
"asyncMirrorSource": False,
"remoteMirrorSource": False,
"remoteMirrorTarget": False,
"flashCached": False,
"mediaScan": {
"enable": False,
"parityValidationEnable": False
},
"metadata": [],
"dataAssurance": False,
"name": "2",
"id": "3A00000060080E500029347000001D7B55C3791E",
"wwn": "60080E500029347000001D7B55C3791E",
"objectType": "thinVolume",
"mapped": False,
"diskPool": True,
"preferredControllerId": "070000000000000000000002",
"totalSizeInBytes": "53687091200",
"onlineVolumeCopy": False,
"listOfMappings": [],
"currentControllerId": "070000000000000000000002",
"segmentSize": 131072,
"cacheSettings": {
"cwob": False,
"enterpriseCacheDump": False,
"mirrorActive": True,
"mirrorEnable": True,
"readCacheActive": True,
"readCacheEnable": True,
"writeCacheActive": True,
"writeCacheEnable": True,
"cacheFlushModifier": "flush10Sec",
"readAheadMultiplier": 0
},
"thinProvisioned": True
}
]
VOLUME = VOLUMES[0]
STORAGE_POOL = {
'label': 'DDP',
'volumeGroupRef': 'fakevolgroupref',
'raidLevel': 'raidDiskPool',
'usedSpace': '16413217521664',
'totalRaidedSpace': '16637410312192',
}
INITIATOR_NAME = 'iqn.1998-01.com.vmware:localhost-28a58148'
INITIATOR_NAME_2 = 'iqn.1998-01.com.vmware:localhost-28a58149'
INITIATOR_NAME_3 = 'iqn.1998-01.com.vmware:localhost-28a58150'
WWPN = '20130080E5322230'
WWPN_2 = '20230080E5322230'
FC_TARGET_WWPNS = [
'500a098280feeba5',
'500a098290feeba5',
'500a098190feeba5',
'500a098180feeba5'
]
FC_I_T_MAP = {
'20230080E5322230': [
'500a098280feeba5',
'500a098290feeba5'
],
'20130080E5322230': [
'500a098190feeba5',
'500a098180feeba5'
]
}
FC_FABRIC_MAP = {
'fabricB': {
'target_port_wwn_list': [
'500a098190feeba5',
'500a098180feeba5'
],
'initiator_port_wwn_list': [
'20130080E5322230'
]
},
'fabricA': {
'target_port_wwn_list': [
'500a098290feeba5',
'500a098280feeba5'
],
'initiator_port_wwn_list': [
'20230080E5322230'
]
}
}
HOST = {
'isSAControlled': False,
'confirmLUNMappingCreation': False,
'label': 'stlrx300s7-55',
'isLargeBlockFormatHost': False,
'clusterRef': '8500000060080E500023C7340036035F515B78FC',
'protectionInformationCapableAccessMethod': False,
'ports': [],
'hostRef': '8400000060080E500023C73400300381515BFBA3',
'hostTypeIndex': 6,
'hostSidePorts': [{
'label': 'NewStore',
'type': 'iscsi',
'address': INITIATOR_NAME}]
}
HOST_2 = {
'isSAControlled': False,
'confirmLUNMappingCreation': False,
'label': 'stlrx300s7-55',
'isLargeBlockFormatHost': False,
'clusterRef': utils.NULL_REF,
'protectionInformationCapableAccessMethod': False,
'ports': [],
'hostRef': '8400000060080E500023C73400300381515BFBA5',
'hostTypeIndex': 6,
'hostSidePorts': [{
'label': 'NewStore', 'type': 'iscsi',
'address': INITIATOR_NAME_2}]
}
# HOST_3 has all lun_ids in use.
HOST_3 = {
'isSAControlled': False,
'confirmLUNMappingCreation': False,
'label': 'stlrx300s7-55',
'isLargeBlockFormatHost': False,
'clusterRef': '8500000060080E500023C73400360351515B78FC',
'protectionInformationCapableAccessMethod': False,
'ports': [],
'hostRef': '8400000060080E501023C73400800381515BFBA5',
'hostTypeIndex': 6,
'hostSidePorts': [{
'label': 'NewStore', 'type': 'iscsi',
'address': INITIATOR_NAME_3}],
}
VOLUME_MAPPING = {
'lunMappingRef': '8800000000000000000000000000000000000000',
'lun': 0,
'ssid': 16384,
'perms': 15,
'volumeRef': VOLUME['volumeRef'],
'type': 'all',
'mapRef': HOST['hostRef']
}
# VOLUME_MAPPING_3 corresponding to HOST_3 has all lun_ids in use.
VOLUME_MAPPING_3 = {
'lunMappingRef': '8800000000000000000000000000000000000000',
'lun': range(255),
'ssid': 16384,
'perms': 15,
'volumeRef': VOLUME['volumeRef'],
'type': 'all',
'mapRef': HOST_3['hostRef'],
}
VOLUME_MAPPING_TO_MULTIATTACH_GROUP = copy.deepcopy(VOLUME_MAPPING)
VOLUME_MAPPING_TO_MULTIATTACH_GROUP.update(
{'mapRef': MULTIATTACH_HOST_GROUP['clusterRef']}
)
STORAGE_SYSTEM = {
'freePoolSpace': 11142431623168,
'driveCount': 24,
'hostSparesUsed': 0, 'id':
'1fa6efb5-f07b-4de4-9f0e-52e5f7ff5d1b',
'hotSpareSizeAsString': '0', 'wwn':
'60080E500023C73400000000515AF323',
'passwordStatus': 'valid',
'parameters': {
'minVolSize': 1048576, 'maxSnapshotsPerBase': 16,
'maxDrives': 192,
'maxVolumes': 512,
'maxVolumesPerGroup': 256,
'maxMirrors': 0,
'maxMappingsPerVolume': 1,
'maxMappableLuns': 256,
'maxVolCopys': 511,
'maxSnapshots': 256
}, 'hotSpareCount': 0,
'hostSpareCountInStandby': 0,
'status': 'needsattn',
'trayCount': 1,
'usedPoolSpaceAsString': '5313000380416',
'ip2': '10.63.165.216',
'ip1': '10.63.165.215',
'freePoolSpaceAsString': '11142431623168',
'types': 'SAS',
'name': 'stle2600-7_8',
'hotSpareSize': 0,
'usedPoolSpace': 5313000380416,
'driveTypes': ['sas'],
'unconfiguredSpaceByDriveType': {},
'unconfiguredSpaceAsStrings': '0',
'model': '2650',
'unconfiguredSpace': 0
}
SNAPSHOT_GROUP = {
'status': 'optimal',
'autoDeleteLimit': 0,
'maxRepositoryCapacity': '-65536',
'rollbackStatus': 'none',
'unusableRepositoryCapacity': '0',
'pitGroupRef':
'3300000060080E500023C7340000098D5294AC9A',
'clusterSize': 65536,
'label': 'C6JICISVHNG2TFZX4XB5ZWL7O',
'maxBaseCapacity': '476187142128128',
'repositoryVolume': '3600000060080E500023BB3400001FA952CEF12C',
'fullWarnThreshold': 99,
'repFullPolicy': 'purgepit',
'action': 'none',
'rollbackPriority': 'medium',
'creationPendingStatus': 'none',
'consistencyGroupRef': '0000000000000000000000000000000000000000',
'volumeHandle': 49153,
'consistencyGroup': False,
'baseVolume': '0200000060080E500023C734000009825294A534'
}
SNAPSHOT_IMAGE = {
'status': 'optimal',
'pitCapacity': '2147483648',
'pitTimestamp': '1389315375',
'pitGroupRef': '3300000060080E500023C7340000098D5294AC9A',
'creationMethod': 'user',
'repositoryCapacityUtilization': '2818048',
'activeCOW': True,
'isRollbackSource': False,
'pitRef': '3400000060080E500023BB3400631F335294A5A8',
'pitSequenceNumber': '19'
}
HARDWARE_INVENTORY = {
'iscsiPorts': [
{
'controllerId':
'070000000000000000000002',
'ipv4Enabled': True,
'ipv4Data': {
'ipv4Address': '0.0.0.0',
'ipv4AddressConfigMethod':
'configStatic',
'ipv4VlanId': {
'isEnabled': False,
'value': 0
},
'ipv4AddressData': {
'ipv4Address': '172.20.123.66',
'ipv4SubnetMask': '255.255.255.0',
'configState': 'configured',
'ipv4GatewayAddress': '0.0.0.0'
}
},
'tcpListenPort': 3260,
'interfaceRef': '2202040000000000000000000000000000000000',
'iqn': 'iqn.1992-01.com.lsi:2365.60080e500023c73400000000515af323'
}
],
'fibrePorts': [
{
"channel": 1,
"loopID": 126,
"speed": 800,
"hardAddress": 6,
"nodeName": "20020080E5322230",
"portName": "20130080E5322230",
"portId": "011700",
"topology": "fabric",
"part": "PM8032 ",
"revision": 8,
"chanMiswire": False,
"esmMiswire": False,
"linkStatus": "up",
"isDegraded": False,
"speedControl": "auto",
"maxSpeed": 800,
"speedNegError": False,
"reserved1": "000000000000000000000000",
"reserved2": "",
"ddsChannelState": 0,
"ddsStateReason": 0,
"ddsStateWho": 0,
"isLocal": True,
"channelPorts": [],
"currentInterfaceSpeed": "speed8gig",
"maximumInterfaceSpeed": "speed8gig",
"interfaceRef": "2202020000000000000000000000000000000000",
"physicalLocation": {
"trayRef": "0000000000000000000000000000000000000000",
"slot": 0,
"locationParent": {
"refType": "generic",
"controllerRef": None,
"symbolRef": "0000000000000000000000000000000000000000",
"typedReference": None
},
"locationPosition": 0
},
"isTrunkCapable": False,
"trunkMiswire": False,
"protectionInformationCapable": True,
"controllerId": "070000000000000000000002",
"interfaceId": "2202020000000000000000000000000000000000",
"addressId": "20130080E5322230",
"niceAddressId": "20:13:00:80:E5:32:22:30"
},
{
"channel": 2,
"loopID": 126,
"speed": 800,
"hardAddress": 7,
"nodeName": "20020080E5322230",
"portName": "20230080E5322230",
"portId": "011700",
"topology": "fabric",
"part": "PM8032 ",
"revision": 8,
"chanMiswire": False,
"esmMiswire": False,
"linkStatus": "up",
"isDegraded": False,
"speedControl": "auto",
"maxSpeed": 800,
"speedNegError": False,
"reserved1": "000000000000000000000000",
"reserved2": "",
"ddsChannelState": 0,
"ddsStateReason": 0,
"ddsStateWho": 0,
"isLocal": True,
"channelPorts": [],
"currentInterfaceSpeed": "speed8gig",
"maximumInterfaceSpeed": "speed8gig",
"interfaceRef": "2202030000000000000000000000000000000000",
"physicalLocation": {
"trayRef": "0000000000000000000000000000000000000000",
"slot": 0,
"locationParent": {
"refType": "generic",
"controllerRef": None,
"symbolRef": "0000000000000000000000000000000000000000",
"typedReference": None
},
"locationPosition": 0
},
"isTrunkCapable": False,
"trunkMiswire": False,
"protectionInformationCapable": True,
"controllerId": "070000000000000000000002",
"interfaceId": "2202030000000000000000000000000000000000",
"addressId": "20230080E5322230",
"niceAddressId": "20:23:00:80:E5:32:22:30"
},
]
}
FAKE_RESOURCE_URL = '/devmgr/v2/devmgr/utils/about'
FAKE_APP_VERSION = '2015.2|2015.2.dev59|vendor|Linux-3.13.0-24-generic'
FAKE_BACKEND = 'eseriesiSCSI'
FAKE_CINDER_HOST = 'ubuntu-1404'
FAKE_SERIAL_NUMBERS = ['021436000943', '021436001321']
FAKE_SERIAL_NUMBER = ['021436001321']
FAKE_DEFAULT_SERIAL_NUMBER = ['unknown', 'unknown']
FAKE_DEFAULT_MODEL = 'unknown'
FAKE_ABOUT_RESPONSE = {
'runningAsProxy': True,
'version': '01.53.9010.0005',
'systemId': 'a89355ab-692c-4d4a-9383-e249095c3c0',
}
FAKE_CONTROLLERS = [
{'serialNumber': FAKE_SERIAL_NUMBERS[0], 'modelName': '2752'},
{'serialNumber': FAKE_SERIAL_NUMBERS[1], 'modelName': '2752'}]
FAKE_SINGLE_CONTROLLER = [{'serialNumber': FAKE_SERIAL_NUMBERS[1]}]
FAKE_KEY = ('openstack-%s-%s-%s' % (FAKE_CINDER_HOST, FAKE_SERIAL_NUMBERS[0],
FAKE_SERIAL_NUMBERS[1]))
FAKE_ASUP_DATA = {
'category': 'provisioning',
'app-version': FAKE_APP_VERSION,
'event-source': 'Cinder driver NetApp_iSCSI_ESeries',
'event-description': 'OpenStack Cinder connected to E-Series proxy',
'system-version': '08.10.15.00',
'computer-name': FAKE_CINDER_HOST,
'model': FAKE_CONTROLLERS[0]['modelName'],
'controller2-serial': FAKE_CONTROLLERS[1]['serialNumber'],
'controller1-serial': FAKE_CONTROLLERS[0]['serialNumber'],
'operating-mode': 'proxy',
}
FAKE_POST_INVOKE_DATA = ('POST', '/key-values/%s' % FAKE_KEY,
json.dumps(FAKE_ASUP_DATA))
VOLUME_COPY_JOB = {
"status": "complete",
"cloneCopy": True,
"pgRef": "3300000060080E500023C73400000ACA52D29454",
"volcopyHandle": 49160,
"idleTargetWriteProt": True,
"copyPriority": "priority2",
"volcopyRef": "1800000060080E500023C73400000ACF52D29466",
"worldWideName": "60080E500023C73400000ACF52D29466",
"copyCompleteTime": "0",
"sourceVolume": "3500000060080E500023C73400000ACE52D29462",
"currentManager": "070000000000000000000002",
"copyStartTime": "1389551671",
"reserved1": "00000000",
"targetVolume": "0200000060080E500023C73400000A8C52D10675",
}
FAKE_ENDPOINT_HTTP = 'http://host:80/endpoint'
FAKE_ENDPOINT_HTTPS = 'https://host:8443/endpoint'
FAKE_INVOC_MSG = 'success'
FAKE_CLIENT_PARAMS = {
'scheme': 'http',
'host': '127.0.0.1',
'port': 8080,
'service_path': '/devmgr/vn',
'username': 'rw',
'password': 'rw',
}
def create_configuration_eseries():
config = conf.Configuration(None)
config.append_config_values(na_opts.netapp_connection_opts)
config.append_config_values(na_opts.netapp_transport_opts)
config.append_config_values(na_opts.netapp_basicauth_opts)
config.append_config_values(na_opts.netapp_provisioning_opts)
config.append_config_values(na_opts.netapp_eseries_opts)
config.netapp_storage_protocol = 'iscsi'
config.netapp_login = 'rw'
config.netapp_password = 'rw'
config.netapp_server_hostname = '127.0.0.1'
config.netapp_transport_type = 'http'
config.netapp_server_port = '8080'
config.netapp_storage_pools = 'DDP'
config.netapp_storage_family = 'eseries'
config.netapp_sa_password = 'saPass'
config.netapp_controller_ips = '10.11.12.13,10.11.12.14'
config.netapp_webservice_path = '/devmgr/v2'
config.netapp_enable_multiattach = False
return config
def deepcopy_return_value_method_decorator(fn):
"""Returns a deepcopy of the returned value of the wrapped function."""
def decorator(*args, **kwargs):
return copy.deepcopy(fn(*args, **kwargs))
return decorator
def deepcopy_return_value_class_decorator(cls):
"""Wraps 'non-protected' methods of a class with decorator.
Wraps all 'non-protected' methods of a class with the
deepcopy_return_value_method_decorator decorator.
"""
class NewClass(cls):
def __getattribute__(self, attr_name):
obj = super(NewClass, self).__getattribute__(attr_name)
if (hasattr(obj, '__call__') and not attr_name.startswith('_')
and not isinstance(obj, mock.Mock)):
return deepcopy_return_value_method_decorator(obj)
return obj
return NewClass
@deepcopy_return_value_class_decorator
class FakeEseriesClient(object):
def __init__(self, *args, **kwargs):
pass
def list_storage_pools(self):
return STORAGE_POOLS
def register_storage_system(self, *args, **kwargs):
return {
'freePoolSpace': '17055871480319',
'driveCount': 24,
'wwn': '60080E500023C73400000000515AF323',
'id': '1',
'hotSpareSizeAsString': '0',
'hostSparesUsed': 0,
'types': '',
'hostSpareCountInStandby': 0,
'status': 'optimal',
'trayCount': 1,
'usedPoolSpaceAsString': '37452115456',
'ip2': '10.63.165.216',
'ip1': '10.63.165.215',
'freePoolSpaceAsString': '17055871480319',
'hotSpareCount': 0,
'hotSpareSize': '0',
'name': 'stle2600-7_8',
'usedPoolSpace': '37452115456',
'driveTypes': ['sas'],
'unconfiguredSpaceByDriveType': {},
'unconfiguredSpaceAsStrings': '0',
'model': '2650',
'unconfiguredSpace': '0'
}
def list_volume(self, volume_id):
return VOLUME
def list_volumes(self):
return [VOLUME]
def delete_volume(self, vol):
pass
def create_host_group(self, name):
return MULTIATTACH_HOST_GROUP
def get_host_group(self, ref):
return MULTIATTACH_HOST_GROUP
def list_host_groups(self):
return [MULTIATTACH_HOST_GROUP]
def get_host_group_by_name(self, name, *args, **kwargs):
host_groups = self.list_host_groups()
return [host_group for host_group in host_groups
if host_group['label'] == name][0]
def set_host_group_for_host(self, *args, **kwargs):
pass
def create_host_with_ports(self, *args, **kwargs):
return HOST
def list_hosts(self):
return [HOST, HOST_2]
def get_host(self, *args, **kwargs):
return HOST
def create_volume_mapping(self, *args, **kwargs):
return VOLUME_MAPPING
def get_volume_mappings(self):
return [VOLUME_MAPPING]
def get_volume_mappings_for_volume(self, volume):
return [VOLUME_MAPPING]
def get_volume_mappings_for_host(self, host_ref):
return [VOLUME_MAPPING]
def get_volume_mappings_for_host_group(self, hg_ref):
return [VOLUME_MAPPING]
def delete_volume_mapping(self):
return
def move_volume_mapping_via_symbol(self, map_ref, to_ref, lun_id):
return {'lun': lun_id}
def list_storage_system(self):
return STORAGE_SYSTEM
def list_storage_systems(self):
return [STORAGE_SYSTEM]
def list_snapshot_groups(self):
return [SNAPSHOT_GROUP]
def list_snapshot_images(self):
return [SNAPSHOT_IMAGE]
def list_host_types(self):
return [
{
'id': '4',
'code': 'AIX',
'name': 'AIX',
'index': 4
},
{
'id': '5',
'code': 'IRX',
'name': 'IRX',
'index': 5
},
{
'id': '6',
'code': 'LnxALUA',
'name': 'LnxALUA',
'index': 6
}
]
def list_hardware_inventory(self):
return HARDWARE_INVENTORY
def get_eseries_api_info(self, verify=False):
return 'Proxy', '1.53.9010.0005'
def set_counter(self, key):
pass
def add_autosupport_data(self, *args):
pass
def get_serial_numbers(self):
pass
def get_model_name(self):
pass
def api_operating_mode(self):
pass
def get_firmware_version(self):
return FAKE_POST_INVOKE_DATA["system-version"]
def create_volume_copy_job(self, *args, **kwargs):
return VOLUME_COPY_JOB
def list_vol_copy_job(self, *args, **kwargs):
return VOLUME_COPY_JOB
def delete_vol_copy_job(self, *args, **kwargs):
pass
def delete_snapshot_volume(self, *args, **kwargs):
pass
def list_target_wwpns(self, *args, **kwargs):
return [WWPN_2]
def update_stored_system_password(self, *args, **kwargs):
pass
| [
"[email protected]"
] | |
66ce0e5e6607fb88403194d1679ab6f2ffdbf620 | 4b198f184cbe79abf0c7f9e53054b19a2100c908 | /tests/test_base.py | 04890bf888e42d74bc966f8c7d586d82af3402b1 | [
"Apache-2.0"
] | permissive | zzzz123321/GerapyAutoExtractor | 03095a693770d0f2a9919272db9134466ac314bc | 8d6f44d3d55a590fe971a68a425f20bc792a3947 | refs/heads/master | 2022-11-15T23:19:20.491401 | 2020-07-10T03:19:16 | 2020-07-10T03:19:16 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 372 | py | import unittest
from os.path import join
class TestBase(unittest.TestCase):
samples_dir = None
def html(self, file_name):
"""
get html content of file
:param file_name:
:return:
"""
file_path = join(self.samples_dir, file_name)
with open(file_path, encoding='utf-8') as f:
return f.read()
| [
"[email protected]"
] | |
694a05ea0a76734cee806539f4d944a677e2ea02 | 24fe1f54fee3a3df952ca26cce839cc18124357a | /servicegraph/lib/python2.7/site-packages/acimodel-4.0_3d-py2.7.egg/cobra/modelimpl/rtctrl/settagdef.py | d227f1c2fb007ad7995a709552fb6968c7f8a4bc | [] | no_license | aperiyed/servicegraph-cloudcenter | 4b8dc9e776f6814cf07fe966fbd4a3481d0f45ff | 9eb7975f2f6835e1c0528563a771526896306392 | refs/heads/master | 2023-05-10T17:27:18.022381 | 2020-01-20T09:18:28 | 2020-01-20T09:18:28 | 235,065,676 | 0 | 0 | null | 2023-05-01T21:19:14 | 2020-01-20T09:36:37 | Python | UTF-8 | Python | false | false | 5,881 | py | # coding=UTF-8
# **********************************************************************
# Copyright (c) 2013-2019 Cisco Systems, Inc. All rights reserved
# written by zen warriors, do not modify!
# **********************************************************************
from cobra.mit.meta import ClassMeta
from cobra.mit.meta import StatsClassMeta
from cobra.mit.meta import CounterMeta
from cobra.mit.meta import PropMeta
from cobra.mit.meta import Category
from cobra.mit.meta import SourceRelationMeta
from cobra.mit.meta import NamedSourceRelationMeta
from cobra.mit.meta import TargetRelationMeta
from cobra.mit.meta import DeploymentPathMeta, DeploymentCategory
from cobra.model.category import MoCategory, PropCategory, CounterCategory
from cobra.mit.mo import Mo
# ##################################################
class SetTagDef(Mo):
"""
The set tag definition.
"""
meta = ClassMeta("cobra.model.rtctrl.SetTagDef")
meta.moClassName = "rtctrlSetTagDef"
meta.rnFormat = "tag"
meta.category = MoCategory.REGULAR
meta.label = "None"
meta.writeAccessMask = 0x1
meta.readAccessMask = 0x1
meta.isDomainable = False
meta.isReadOnly = True
meta.isConfigurable = False
meta.isDeletable = False
meta.isContextRoot = False
meta.childClasses.add("cobra.model.fault.Delegate")
meta.childNamesAndRnPrefix.append(("cobra.model.fault.Delegate", "fd-"))
meta.parentClasses.add("cobra.model.rtctrl.AttrDef")
meta.superClasses.add("cobra.model.pol.Comp")
meta.superClasses.add("cobra.model.rtctrl.ASetRule")
meta.superClasses.add("cobra.model.fabric.L3ProtoComp")
meta.superClasses.add("cobra.model.fabric.ProtoComp")
meta.superClasses.add("cobra.model.pol.Obj")
meta.superClasses.add("cobra.model.naming.NamedObject")
meta.superClasses.add("cobra.model.rtctrl.ASetTag")
meta.rnPrefixes = [
('tag', False),
]
prop = PropMeta("str", "childAction", "childAction", 4, PropCategory.CHILD_ACTION)
prop.label = "None"
prop.isImplicit = True
prop.isAdmin = True
prop._addConstant("deleteAll", "deleteall", 16384)
prop._addConstant("deleteNonPresent", "deletenonpresent", 8192)
prop._addConstant("ignore", "ignore", 4096)
meta.props.add("childAction", prop)
prop = PropMeta("str", "descr", "descr", 5582, PropCategory.REGULAR)
prop.label = "Description"
prop.isConfig = True
prop.isAdmin = True
prop.range = [(0, 128)]
prop.regex = ['[a-zA-Z0-9\\!#$%()*,-./:;@ _{|}~?&+]+']
meta.props.add("descr", prop)
prop = PropMeta("str", "dn", "dn", 1, PropCategory.DN)
prop.label = "None"
prop.isDn = True
prop.isImplicit = True
prop.isAdmin = True
prop.isCreateOnly = True
meta.props.add("dn", prop)
prop = PropMeta("str", "lcOwn", "lcOwn", 9, PropCategory.REGULAR)
prop.label = "None"
prop.isImplicit = True
prop.isAdmin = True
prop.defaultValue = 0
prop.defaultValueStr = "local"
prop._addConstant("implicit", "implicit", 4)
prop._addConstant("local", "local", 0)
prop._addConstant("policy", "policy", 1)
prop._addConstant("replica", "replica", 2)
prop._addConstant("resolveOnBehalf", "resolvedonbehalf", 3)
meta.props.add("lcOwn", prop)
prop = PropMeta("str", "modTs", "modTs", 7, PropCategory.REGULAR)
prop.label = "None"
prop.isImplicit = True
prop.isAdmin = True
prop.defaultValue = 0
prop.defaultValueStr = "never"
prop._addConstant("never", "never", 0)
meta.props.add("modTs", prop)
prop = PropMeta("str", "name", "name", 4991, PropCategory.REGULAR)
prop.label = "Name"
prop.isConfig = True
prop.isAdmin = True
prop.range = [(0, 64)]
prop.regex = ['[a-zA-Z0-9_.:-]+']
meta.props.add("name", prop)
prop = PropMeta("str", "nameAlias", "nameAlias", 28417, PropCategory.REGULAR)
prop.label = "Name alias"
prop.isConfig = True
prop.isAdmin = True
prop.range = [(0, 63)]
prop.regex = ['[a-zA-Z0-9_.-]+']
meta.props.add("nameAlias", prop)
prop = PropMeta("str", "rn", "rn", 2, PropCategory.RN)
prop.label = "None"
prop.isRn = True
prop.isImplicit = True
prop.isAdmin = True
prop.isCreateOnly = True
meta.props.add("rn", prop)
prop = PropMeta("str", "status", "status", 3, PropCategory.STATUS)
prop.label = "None"
prop.isImplicit = True
prop.isAdmin = True
prop._addConstant("created", "created", 2)
prop._addConstant("deleted", "deleted", 8)
prop._addConstant("modified", "modified", 4)
meta.props.add("status", prop)
prop = PropMeta("str", "tag", "tag", 790, PropCategory.REGULAR)
prop.label = "Route Tag"
prop.isConfig = True
prop.isAdmin = True
meta.props.add("tag", prop)
prop = PropMeta("str", "type", "type", 789, PropCategory.REGULAR)
prop.label = "None"
prop.isConfig = True
prop.isAdmin = True
prop.defaultValue = 2
prop.defaultValueStr = "rt-tag"
prop._addConstant("as-path", "as-path", 11)
prop._addConstant("community", "community", 1)
prop._addConstant("dampening-pol", "dampening-type", 10)
prop._addConstant("ip-nh", "ip-nexthop", 8)
prop._addConstant("local-pref", "local-preference", 4)
prop._addConstant("metric", "metric", 5)
prop._addConstant("metric-type", "metric-type", 9)
prop._addConstant("ospf-fwd-addr", "ospf-fowarding-address", 7)
prop._addConstant("ospf-nssa", "ospf-nssa-area", 6)
prop._addConstant("rt-tag", "route-tag", 2)
prop._addConstant("rt-weight", "route-weight", 3)
meta.props.add("type", prop)
def __init__(self, parentMoOrDn, markDirty=True, **creationProps):
namingVals = []
Mo.__init__(self, parentMoOrDn, markDirty, *namingVals, **creationProps)
# End of package file
# ##################################################
| [
"[email protected]"
] | |
a224e09ae49b8d796c3870bb6502820e4dc8fd10 | ab0585893c7ac6ee649de2359f6c4c64bf76dd32 | /venv/lib/python2.7/site-packages/flask_bootstrap/__init__.py | 1581420430d26107f0e6f7c5bdd8e31121a39421 | [] | no_license | bmcharek/flaskapp | fc8fd8c6cedd2af022a97d40f9013b44b9e4af75 | 943a5c05525c189fa86406998c9f2a32243d4e1e | refs/heads/master | 2021-01-19T11:16:09.165869 | 2014-04-24T00:18:18 | 2014-04-24T00:18:18 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,526 | py | #!/usr/bin/env python
# coding=utf8
__version__ = '3.0.2.3'
import re
from flask import Blueprint, current_app, url_for
try:
from wtforms.fields import HiddenField
except ImportError:
def is_hidden_field_filter(field):
raise RuntimeError('WTForms is not installed.')
else:
def is_hidden_field_filter(field):
return isinstance(field, HiddenField)
class CDN(object):
"""Base class for CDN objects."""
def get_resource_url(self, filename):
"""Return resource url for filename."""
raise NotImplementedError
class StaticCDN(object):
"""A CDN that serves content from the local application.
:param static_endpoint: Endpoint to use.
:param rev: If ``True``, honor ``BOOTSTRAP_QUERYSTRING_REVVING``.
"""
def __init__(self, static_endpoint='static', rev=False):
self.static_endpoint = static_endpoint
self.rev = rev
def get_resource_url(self, filename):
extra_args = {}
if self.rev and current_app.config['BOOTSTRAP_QUERYSTRING_REVVING']:
extra_args['bootstrap'] = __version__
return url_for(self.static_endpoint, filename=filename, **extra_args)
class WebCDN(object):
"""Serves files from the Web.
:param baseurl: The baseurl. Filenames are simply appended to this URL.
"""
def __init__(self, baseurl):
self.baseurl = baseurl
def get_resource_url(self, filename):
return self.baseurl + filename
class ConditionalCDN(object):
"""Serves files from one CDN or another, depending on whether a
configuration value is set.
:param confvar: Configuration variable to use.
:param primary: CDN to use if the configuration variable is ``True``.
:param fallback: CDN to use otherwise.
"""
def __init__(self, confvar, primary, fallback):
self.confvar = confvar
self.primary = primary
self.fallback = fallback
def get_resource_url(self, filename):
if current_app.config[self.confvar]:
return self.primary.get_resource_url(filename)
return self.fallback.get_resource_url(filename)
def bootstrap_find_resource(filename, cdn, use_minified=None, local=True):
"""Resource finding function, also available in templates.
Tries to find a resource, will force SSL depending on
``BOOTSTRAP_CDN_FORCE_SSL`` settings.
:param filename: File to find a URL for.
:param cdn: Name of the CDN to use.
:param use_minified': If set to ``True``/``False``, use/don't use
minified. If ``None``, honors
``BOOTSTRAP_USE_MINIFIED``.
:param local: If ``True``, uses the ``local``-CDN when
``BOOTSTRAP_SERVE_LOCAL`` is enabled. If ``False``, uses
the ``static``-CDN instead.
:return: A URL.
"""
config = current_app.config
if None == use_minified:
use_minified = config['BOOTSTRAP_USE_MINIFIED']
if use_minified:
filename = '%s.min.%s' % tuple(filename.rsplit('.', 1))
cdns = current_app.extensions['bootstrap']['cdns']
resource_url = cdns[cdn].get_resource_url(filename)
if resource_url.startswith('//') and config['BOOTSTRAP_CDN_FORCE_SSL']:
resource_url = 'https:%s' % resource_url
return resource_url
class Bootstrap(object):
def __init__(self, app=None):
if app is not None:
self.init_app(app)
def init_app(self, app):
BOOTSTRAP_VERSION = re.sub(r'^(\d+\.\d+\.\d+).*', r'\1', __version__)
JQUERY_VERSION = '2.0.3'
HTML5SHIV_VERSION = '3.7'
RESPONDJS_VERSION = '1.3.0'
app.config.setdefault('BOOTSTRAP_USE_MINIFIED', True)
app.config.setdefault('BOOTSTRAP_CDN_FORCE_SSL', False)
app.config.setdefault('BOOTSTRAP_QUERYSTRING_REVVING', True)
app.config.setdefault('BOOTSTRAP_SERVE_LOCAL', False)
blueprint = Blueprint(
'bootstrap',
__name__,
template_folder='templates',
static_folder='static',
static_url_path=app.static_url_path + '/bootstrap')
app.register_blueprint(blueprint)
app.jinja_env.globals['bootstrap_is_hidden_field'] =\
is_hidden_field_filter
app.jinja_env.globals['bootstrap_find_resource'] =\
bootstrap_find_resource
if not hasattr(app, 'extensions'):
app.extensions = {}
local = StaticCDN('bootstrap.static', rev=True)
static = StaticCDN()
def lwrap(cdn, primary=static):
return ConditionalCDN('BOOTSTRAP_SERVE_LOCAL', primary, cdn)
bootstrap = lwrap(
WebCDN('//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/%s/'
% BOOTSTRAP_VERSION),
local)
jquery = lwrap(
WebCDN('//cdnjs.cloudflare.com/ajax/libs/jquery/%s/'
% JQUERY_VERSION),
local)
html5shiv = lwrap(
WebCDN('//cdnjs.cloudflare.com/ajax/libs/html5shiv/%s/'
% HTML5SHIV_VERSION))
respondjs = lwrap(
WebCDN('//cdnjs.cloudflare.com/ajax/libs/respond.js/%s/'
% RESPONDJS_VERSION))
app.extensions['bootstrap'] = {
'cdns': {
'local': local,
'static': static,
'bootstrap': bootstrap,
'jquery': jquery,
'html5shiv': html5shiv,
'respond.js': respondjs,
},
}
| [
"[email protected]"
] | |
e7959ef076b4880b872bfab62cafa5623aa515bf | 215fd5c4f9893d9f38e4e48199ea16d7d6ef9430 | /3.Binary_Tree_DC/3.11_596_Minimum_Subtree.py | 5b834db4fb3005e8aaca52226012ecd8ff9fec06 | [] | no_license | fztest/Classified | fd01622c097ca21b2e20285b06997ff0e9792dd1 | b046d94657c0d04f3803ca15437dfe9a6f6f3252 | refs/heads/master | 2020-03-25T06:34:07.885108 | 2017-05-04T17:22:36 | 2017-05-04T17:22:36 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,156 | py | """
Description
_________________
Given a binary tree, find the subtree with minimum sum.
Return the root of the subtree.
Example
_________________
Given a binary tree:
1
/ \
-5 2
/ \ / \
0 2 -4 -5
return the node 1.
Appraoch
___________
Same as 589
Complexity
___________
Same as 589
"""
"""
Definition of TreeNode:
class TreeNode:
def __init__(self, val):
this.val = val
this.left, this.right = None, None
"""
class Solution:
# @param {TreeNode} root the root of binary tree
# @return {TreeNode} the root of the minimum subtree
minimum = None
minimum_node = None
def findSubtree(self, root):
# Write your code here
self.traverse_dc(root)
return self.minimum_node
def traverse_dc(self, root):
if root == None:
return 0
left_sum = self.traverse_dc(root.left)
right_sum = self.traverse_dc(root.right)
result_sum = left_sum + right_sum + root.val
if self.minimum is None or result_sum < self.minimum:
self.minimum_node = root
self.minimum = result_sum
return result_sum
| [
"[email protected]"
] | |
567be9d7609520005a28e920c0fe51f55a8a4a0b | 801f367bd19b8f2ab08669fd0a85aad7ace961ac | /dataset/walker_toy_v5/env/walker2d_vanilla.py | cfe02f70b7b9e5235092d44ffd07be1e35e0d731 | [
"MIT"
] | permissive | Wendong-Huo/thesis-bodies | d91b694a6b1b6a911476573ed1ed27eb27fb000d | dceb8a36efd2cefc611f6749a52b56b9d3572f7a | refs/heads/main | 2023-04-17T18:32:38.541537 | 2021-03-12T19:53:23 | 2021-03-12T19:53:23 | 623,471,326 | 1 | 0 | null | 2023-04-04T12:45:48 | 2023-04-04T12:45:47 | null | UTF-8 | Python | false | false | 2,080 | py | # This is not 100% vanilla, because still we need to replace the xml of new body.
#
import numpy as np
import pybullet
from pybullet_envs.gym_locomotion_envs import WalkerBaseBulletEnv, Walker2DBulletEnv
from pybullet_envs.robot_locomotors import WalkerBase, Walker2D
from pybullet_envs.scene_stadium import MultiplayerStadiumScene
import pybullet_data
from pathlib import Path
class _Walker2D(Walker2D):
def __init__(self, xml, param, render=False):
self.param = param
WalkerBase.__init__(self, xml, "torso", action_dim=6, obs_dim=22, power=0.40)
def robot_specific_reset(self, bullet_client):
super().robot_specific_reset(bullet_client)
# power coefficient should be proportional to the min possible volume of that part. (Avoid pybullet fly-away bug.)
self.jdict["thigh_joint"].power_coef = 65
self.jdict["leg_joint"].power_coef = 31
self.jdict["foot_joint"].power_coef = 18
self.jdict["thigh_left_joint"].power_coef = 65
self.jdict["leg_left_joint"].power_coef = 31
self.jdict["foot_left_joint"].power_coef = 18
# I deleted ignore_joints in mujoco xml files, so i need to place the robot at an appropriate initial place manually.
robot_id = self.objects[0] # is the robot pybullet_id
bullet_client.resetBasePositionAndOrientation(
bodyUniqueId=robot_id, posObj=[0, 0, self.param["torso_center_height"] + 0.1],
ornObj=[0, 0, 0, 1]) # Lift the robot higher above ground
class Walker2DEnv(Walker2DBulletEnv):
def __init__(self, xml, param, render=False, max_episode_steps=1000):
self.robot = _Walker2D(xml=xml, param=param)
self.max_episode_steps = max_episode_steps
WalkerBaseBulletEnv.__init__(self, self.robot, render)
def reset(self):
self.step_num = 0
return super().reset()
def step(self, a):
self.step_num += 1
obs, r, done, info = super().step(a)
if self.step_num > self.max_episode_steps:
done = True
return obs, r, done, info
| [
"[email protected]"
] | |
8c7d2605fa31e2598e602df29887780acadec6c4 | 1fe03131ad139e2415fd0c0c73697b4541e5b862 | /.history/src/_fighter_20190422143541.py | e315f2ed7f92c41382f8e6b38aada534afdcad09 | [
"MIT"
] | permissive | vidalmatheus/pyKombat | d83175a7a952663e278a8247d43349f87192fde3 | 6646020c59367ba0424d73a5861e13bbc0daac1f | refs/heads/master | 2021-06-20T09:35:07.950596 | 2020-08-06T14:08:13 | 2020-08-06T14:08:13 | 172,716,161 | 1 | 1 | MIT | 2019-12-25T10:54:10 | 2019-02-26T13:24:31 | Python | UTF-8 | Python | false | false | 37,766 | py |
from pygame_functions import *
import fightScene
import engine
import menu
class Fighter:
fighterNames = ["Sub-Zero", "Scorpion"]
fightMoves = [["w", "s", "a", "d"], ["up", "down", "left", "right"]]
combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]]
danceLimit = 7
walkLimit = 9
jumpLimit = 3
crouchLimit = 3
punchLimit = [3, 11, 3, 5, 3]
kickLimit = [7, 9, 7, 6, 3]
hitLimit = [3, 3, 6, 2, 3, 14, 11, 10]
blockLimit = 3
specialLimit = [4,7]
victoryLimit = 3
fatalityLimit = 20
dizzyLimit = 7
# indexação
# moves
dance = 0
walk = 1
jump = 2
crouch = 3
# punches
Apunch = 4 # soco fraco
Bpunch = 5 # soco forte
Cpunch = 6 # soco agachado fraco
Dpunch = 7 # soco agachado forte: gancho
# kicks
Akick = 8 # chute fraco
Bkick = 9 # chute forte
Ckick = 10 # chute agachado fraco
Dkick = 11 # chute agachado forte: banda
# hits
Ahit = 12 # soco fraco
Bhit = 13 # chute fraco
Chit = 14 # soco forte
Dhit = 15 # chute agrachado fraco
Ehit = 16 # soco agachado fraco
Fhit = 17 # chute forte e soco forte agachado (gancho)
Ghit = 18 # chute agachado forte: banda
#Hhit = 19 # specialMove
#fatalityHit = 20 # fatality hit
# block
Ablock = 19
#Bblock = 13
# special move
special = 20
# fatality
fatality = 24
def __init__(self, id, scenario):
self.fighterId = id
self.name = self.fighterNames[id]
self.move = self.fightMoves[id]
self.combat = self.combatMoves[id]
# Position
self.x = 150+id*500
if scenario == 1:
self.y = 350
elif scenario == 2:
self.y = 370
elif scenario == 3:
self.y = 400
elif scenario == 4:
self.y = 370
elif scenario == 5:
self.y = 380
elif scenario == 6:
self.y = 380
elif scenario == 7:
self.y = 360
elif scenario == 8:
self.y = 395
# Loading sprites
self.spriteList = []
# moves
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/dance.png', self.danceLimit))
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/walk.png', self.walkLimit))
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/jump.png', self.jumpLimit))
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/crouch.png', self.crouchLimit))
# Punch sprites
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Apunch.png', self.punchLimit[0]))
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Bpunch.png', self.punchLimit[1]))
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Cpunch.png', self.punchLimit[2]))
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Dpunch.png', self.punchLimit[3]))
# Kick sprites
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Akick.png', self.kickLimit[0]))
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Bkick.png', self.kickLimit[1]))
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Ckick.png', self.kickLimit[2]))
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Dkick.png', self.kickLimit[3]))
# Hit sprites
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Ahit.png', self.hitLimit[0])) # soco fraco
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Bhit.png', self.hitLimit[1])) # chute fraco
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Chit.png', self.hitLimit[2])) # soco forte
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Dhit.png', self.hitLimit[3])) # chute agrachado fraco
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Ehit.png', self.hitLimit[4])) # soco agachado fraco
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Fhit.png', self.hitLimit[5])) # chute forte e soco forte agachado (gancho)
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Ghit.png', self.hitLimit[6])) # chute agachado forte: banda
#self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Hhit.png', self.hitLimit[7])) # specialMove
# blocking sprites
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Ablock.png', self.blockLimit)) # defesa em pé
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Bblock.png', self.blockLimit)) # defesa agachado
# special sprite ----------------------------------
self.spriteList.append(makeSprite('../res/Char/'+str(self.name)+'/Special.png', self.specialLimit[self.fighterId])) # Especial
self.act()
def act(self):
# Combat control
combat = False
block = False
alive = False
fatality = False
dizzyCounter = 1
dizzyCounterAux = 1
fatalityCounter = 8
fatalityCounterAux = 1
# Control reflection var
reflection = False
# Dance vars
self.dancing = True
self.frame_dance = 0
self.dance_step = 1
# Walk vars
self.frame_walk = 0
self.walking = False # Variável de status
# Jump vars
self.jumpHeight = 10 # Altura do pulo
self.jumpCounter = 1 # Contador correspodente à subida e descida do pulo
self.jumping = False # Variável de status
self.frame_jumping = 0
self.jump_step = 1
self.end_jump = True
# Crouch vars
self.crouching = False # Variável de status
self.frame_crouching = 0
self.crouch_step = 1
# Punch vars
self.Apunching = False
self.frame_Apunching = 0
self.Apunch_step = 1
self.end_Apunch = True
self.Bpunching = False
self.frame_Bpunching = 0
self.Bpunch_step = 1
self.end_Bpunch = True
self.Cpunching = False
self.frame_Cpunching = 0
self.Cpunch_step = 1
self.end_Cpunch = True
self.Dpunching = False
self.frame_Dpunching = 0
self.Dpunch_step = 1
self.end_Dpunch = True
# Kick vars
self.Akicking = False
self.frame_Akicking = 0
self.Akick_step = 1
self.end_Akick = True
self.Bkicking = False
self.frame_Bkicking = 0
self.Bkick_step = 1
self.end_Bkick = True
self.Ckicking = False
self.frame_Ckicking = 0
self.Ckick_step = 1
self.end_Ckick = True
self.Dkicking = False
self.frame_Dkicking = 0
self.Dkick_step = 1
self.end_Dkick = True
# Blocking vars
self.Ablocking = False
self.frame_Ablocking = 0
self.Ablock_step = 1
self.Bblocking = False
self.frame_Bblocking = 0
self.Bblock_step = 1
# Special vars
self.specialMove = False
self.end_special = True
self.frame_special = 0
self.special_step = 1
# Hit vars
self.hit = False
self.downHit = False
self.hitName = ""
self.Ahitting = False
self.Bhitting = False
self.Chitting = False
self.Dhitting = False
self.Ehitting = False
self.Fhitting = False
self.Ghitting = False
self.Hhitting = False
self.frame_Ahit = 0
self.frame_Bhit = 0
self.frame_Chit = 0
self.frame_Dhit = 0
self.frame_Ehit = 0
self.frame_Fhit = 0
self.frame_Ghit = 0
self.frame_Hhit = 0
self.hit_step = 1
# Life Vars
X_inicio = 37
X_atual = X_inicio
X_fim = X_inicio + 327
self.posFighter()
def fight(self, time, nextFrame):
frame_step = 60
if not self.jumping:
# fightMoves = [ ["w", "s", "a", "d"], ["up", "down", "left", "right"] ] -> jump
if keyPressed(self.move[0]) and not self.hit:
self.jumping = True
self.end_jump = False
self.curr_sprite = self.spriteList[self.jump]
# fightMoves = [ ["w", "s", "a", "d"], ["up", "down", "left", "right"] ] -> right
elif keyPressed(self.move[3]) and not self.hit:
self.curr_sprite = self.spriteList[self.walk]
self.walking = self.setState()
self.setEndState()
self.x += 6
moveSprite(self.spriteList[self.walk], self.x, self.y, True)
self.setSprite(self.spriteList[self.walk])
changeSpriteImage(self.spriteList[self.walk], self.frame_walk)
if time > nextFrame:
# There are 9 frames of animation in each direction
self.frame_walk = (self.frame_walk+1) % self.walkLimit
# so the modulus 9 allows it to loop
nextFrame += frame_step
# fightMoves = [ ["w", "s", "a", "d"], ["up", "down", "left", "right"] ] -> left
elif keyPressed(self.move[2]) and not self.hit:# SEGUNDA MUDANÇA and not self.jumping:
self.curr_sprite = self.spriteList[self.walk]
self.walking = self.setState()
self.setEndState()
self.x -= 6
moveSprite(self.spriteList[self.walk], self.x, self.y, True)
self.setSprite(self.spriteList[self.walk])
changeSpriteImage(self.spriteList[self.walk], self.walkLimit-1-self.frame_walk)
if time > nextFrame:
# There are 9 frames of animation in each direction
self.frame_walk = (self.frame_walk+1) % self.walkLimit
nextFrame += frame_step
# fightMoves = [ ["w", "s", "a", "d"], ["up", "down", "left", "right"] ] -> crouch
elif (keyPressed(self.move[1]) and not self.hit) or self.downHit:
if self.end_Cpunch and self.end_Dpunch and self.end_Ckick and self.end_Dkick and not self.hit and not self.downHit:
self.curr_sprite = self.spriteList[self.crouch]
self.crouching = self.setState()
self.setEndState()
if time > nextFrame:
if self.end_Cpunch and self.end_Dpunch and self.end_Ckick and self.end_Dkick and not self.hit and not self.downHit:
moveSprite(self.spriteList[self.crouch], self.x, self.y, True)
self.setSprite(self.spriteList[self.crouch])
changeSpriteImage(self.spriteList[self.crouch], self.frame_crouching)
self.frame_crouching = (self.frame_crouching+self.crouch_step) % self.crouchLimit
if self.frame_crouching == self.crouchLimit - 2:
self.crouch_step = 0
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> crouch and jab
if ( (keyPressed(self.combat[0]) and self.end_Cpunch) or (not self.end_Cpunch) ) and (not self.hit) and not self.downHit:
self.curr_sprite = self.spriteList[self.Cpunch]
self.Cpunching = self.setState()
self.setEndState()
self.end_Cpunch = False
if time > nextFrame:
moveSprite(self.spriteList[self.Cpunch], self.x, self.y, True)
self.setSprite(self.spriteList[self.Cpunch])
changeSpriteImage(self.spriteList[self.Cpunch], self.frame_Cpunching)
self.frame_Cpunching = (self.frame_Cpunching+self.Cpunch_step) % (self.punchLimit[2]+1)
if (self.frame_Cpunching == self.punchLimit[2]-1):
self.Cpunch_step = -1
if (self.frame_Cpunching == self.punchLimit[2]):
self.frame_Cpunching = 0
self.Cpunch_step = 1
self.end_Cpunch = True
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> crouch and strong punch
elif ( (keyPressed(self.combat[1]) and self.end_Dpunch) or ( not self.end_Dpunch) ) and (not self.hit) and not self.downHit:
self.curr_sprite = self.spriteList[self.Dpunch]
self.Dpunching = self.setState()
self.setEndState()
self.end_Dpunch = False
if time > nextFrame:
moveSprite(self.spriteList[self.Dpunch], self.x, self.y, True)
self.setSprite(self.spriteList[self.Dpunch])
changeSpriteImage(self.spriteList[self.Dpunch], self.frame_Dpunching)
self.frame_Dpunching = (self.frame_Dpunching+self.Dpunch_step) % (self.punchLimit[3]+1)
if (self.frame_Dpunching == self.punchLimit[3]-1):
self.Dpunch_step = -1
if (self.frame_Dpunching == self.punchLimit[3]):
self.frame_Dpunching = 0
self.Dpunch_step = 1
self.end_Dpunch = True
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> crouch and kick
elif ( (keyPressed(self.combat[2]) and self.end_Ckick) or ( not self.end_Ckick) ) and (not self.hit) and not self.downHit:
self.curr_sprite = self.spriteList[self.Ckick]
self.Ckicking = self.setState()
self.end_Ckick = self.setEndState()
if time > nextFrame:
moveSprite(self.spriteList[self.Ckick], self.x, self.y, True)
self.setSprite(self.spriteList[self.Ckick])
changeSpriteImage(self.spriteList[self.Ckick], self.frame_Ckicking)
self.frame_Ckicking = (self.frame_Ckicking+self.Ckick_step) % (self.kickLimit[2]+1)
if (self.frame_Ckicking == self.kickLimit[2]-1):
self.Ckick_step = -1
if (self.frame_Ckicking == self.kickLimit[2]):
self.frame_Ckicking = 0
self.Ckick_step = 1
self.end_Ckick = True
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> Crouch and strong kick
elif ( (keyPressed(self.combat[3]) and self.end_Dkick) or ( not self.end_Dkick) ) and (not self.hit) and not self.downHit:
self.curr_sprite = self.spriteList[self.Dkick]
self.Dkicking = self.setState()
self.end_Dkick = self.setEndState()
if time > nextFrame:
moveSprite(self.spriteList[self.Dkick], self.x, self.y, True)
self.setSprite(self.spriteList[self.Dkick])
changeSpriteImage(self.spriteList[self.Dkick], self.frame_Dkicking)
self.frame_Dkicking = (self.frame_Dkicking+self.Dkick_step) % self.kickLimit[3]
if (self.frame_Dkicking == 0):
self.end_Dkick = True
#--------------Hit em agachado--------------------
#Hhit = 19 # specialMove
#BblockHit = 21 hit agachado
#Ehit = 16 # chute ou soco agachado fraco
elif self.downHit and self.hitName == "Ehit":
self.curr_sprite = self.spriteList[self.Ehit]
self.Ehitting = self.setState()
self.crouching = True
moveSprite(self.spriteList[self.Ehit], self.x, self.y, True)
self.setSprite(self.spriteList[self.Ehit])
changeSpriteImage(self.spriteList[self.Ehit], self.frame_Ehit)
if time > nextFrame:
self.frame_Ehit = (self.frame_Ehit+self.hit_step) % self.hitLimit[4]
if (self.frame_Ehit == self.hitLimit[4] - 1):
self.hit_step = -1
if (self.frame_Ehit == 0):
self.hit_step = 1
self.downHit = False
#BblockHit = 21 hit agachado
elif self.downHit and self.hit and self.hitName == "Bblocking":
self.curr_sprite = self.spriteList[self.Bblock]
self.Bblocking = self.setState()
if time > nextFrame:
moveSprite(self.spriteList[self.Bblock], self.x, self.y, True)
self.setSprite(self.spriteList[self.Bblock])
changeSpriteImage(self.spriteList[self.Bblock], self.frame_Bblocking)
self.frame_Bblocking = (self.frame_Bblocking+self.hit_step) % self.blockLimit
if self.frame_Bblocking == self.blockLimit - 1:
self.hit_step = -1
if self.frame_Bblocking == 1:
self.hit_step = 1
self.hit = False
nextFrame += 1*frame_step
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> jab
elif ((keyPressed(self.combat[0]) and self.end_Apunch) or ( not self.end_Apunch) ) and (not self.hit) :
print("flag!")
self.curr_sprite = self.spriteList[self.Apunch]
self.Apunching = self.setState()
self.setEndState()
self.end_Apunch = False
if time > nextFrame:
moveSprite(self.spriteList[self.Apunch], self.x, self.y, True)
self.setSprite(self.spriteList[self.Apunch])
changeSpriteImage(self.spriteList[self.Apunch], self.frame_Apunching)
self.frame_Apunching = (self.frame_Apunching+self.Apunch_step) % (self.punchLimit[0]+1)
if (self.frame_Apunching == self.punchLimit[0]-1):
self.Apunch_step = -1
if (self.frame_Apunching == self.punchLimit[0]):
self.frame_Apunching = 0
self.Apunch_step = 1
self.end_Apunch = True
nextFrame += 1*frame_step
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> strong punch
elif ( (keyPressed(self.combat[1]) and self.end_Bpunch) or ( not self.end_Bpunch) ) and (not self.hit) :
self.curr_sprite = self.spriteList[self.Bpunch]
self.Bpunching = self.setState()
self.end_Bpunch = self.setEndState()
if time > nextFrame:
moveSprite(self.spriteList[self.Bpunch], self.x, self.y, True)
self.setSprite(self.spriteList[self.Bpunch])
changeSpriteImage(self.spriteList[self.Bpunch], self.frame_Bpunching)
self.frame_Bpunching = (self.frame_Bpunching+self.Bpunch_step) % self.punchLimit[1]
if (self.frame_Bpunching == 0):
self.end_Bpunch = True
nextFrame += 1*frame_step
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> kick
elif ( (keyPressed(self.combat[2]) and self.end_Akick) or ( not self.end_Akick) ) and (not self.hit):
self.curr_sprite = self.spriteList[self.Akick]
self.Akicking = self.setState()
self.end_Akick = self.setEndState()
if time > nextFrame:
moveSprite(self.spriteList[self.Akick], self.x, self.y, True)
self.setSprite(self.spriteList[self.Akick])
changeSpriteImage(self.spriteList[self.Akick], self.frame_Akicking)
self.frame_Akicking = (self.frame_Akicking+self.Akick_step) % (self.kickLimit[0]+1)
if (self.frame_Akicking == self.kickLimit[0]-1):
self.Akick_step = -1
if (self.frame_Akicking == self.kickLimit[0]):
self.frame_Akicking = 0
self.Akick_step = 1
self.end_Akick = True
nextFrame += 1*frame_step
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> strong kick
elif ( (keyPressed(self.combat[3]) and self.end_Bkick) or ( not self.end_Bkick) ) and (not self.hit):
self.curr_sprite = self.spriteList[self.Bkick]
self.Bkicking = self.setState()
self.end_Bkick = self.setEndState()
if time > nextFrame:
moveSprite(self.spriteList[self.Bkick], self.x, self.y, True)
self.setSprite(self.spriteList[self.Bkick])
changeSpriteImage(self.spriteList[self.Bkick], self.frame_Bkicking)
self.frame_Bkicking = (self.frame_Bkicking+self.Bkick_step) % self.kickLimit[1]
if (self.frame_Bkicking == 0):
self.end_Bkick = True
nextFrame += 1*frame_step
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> defesa em pé
elif keyPressed(self.combat[5]) and not self.hit:
self.curr_sprite = self.spriteList[self.Ablock]
self.Ablocking = self.setState()
self.setEndState()
if time > nextFrame:
moveSprite(self.spriteList[self.Ablock], self.x, self.y, True)
self.setSprite(self.spriteList[self.Ablock])
changeSpriteImage(self.spriteList[self.Ablock], self.frame_Ablocking)
self.frame_Ablocking = (self.frame_Ablocking+self.Ablock_step) % self.blockLimit
if self.frame_Ablocking == self.blockLimit - 2:
self.Ablock_step = 0
nextFrame += 1*frame_step
# combatMoves = [["j","n","k","m","l","u","f"],["1","4","2","5","3","0","6"]] -> special move
elif ((keyPressed(self.combat[4]) and self.end_special) or ( not self.end_special) ) and (not self.hit):
print("SpecialMove")
self.curr_sprite = self.spriteList[self.special]
self.specialMove = self.setState()
self.setEndState()
self.end_special = False
if time > nextFrame:
moveSprite(self.spriteList[self.special], self.x, self.y, True)
self.setSprite(self.spriteList[self.special])
changeSpriteImage(self.spriteList[self.special], self.frame_special)
self.frame_special = (self.frame_special+self.special_step) % (self.specialLimit[self.fighterId]+1)
if (self.frame_special == self.specialLimit[self.fighterId]-1):
self.special_step = -1
if (self.frame_special == self.specialLimit[self.fighterId]):
self.frame_special = 0
self.special_step = 1
self.end_special = True
nextFrame += 1*frame_step
# just dance :)
elif not self.hit:
# reset block (hold type)
self.frame_Ablocking = 0
self.Ablock_step = 1
# reset down (hold type)
self.frame_crouching = 0
self.crouch_step = 1
# reset other movement
self.frame_walk = self.frame_jumping = 0
# reset combat frames
self.frame_Apunching = self.frame_Bpunching = self.frame_Cpunching = self.frame_Dpunching = self.frame_Akicking = self.frame_Bkicking = self.frame_Ckicking = self.frame_Dkicking = 0
self.setEndState()
# start to dance
self.curr_sprite = self.spriteList[self.dance]
self.dancing = self.setState()
if time > nextFrame:
moveSprite(self.spriteList[self.dance], self.x, self.y, True)
self.setSprite(self.spriteList[self.dance])
changeSpriteImage(self.spriteList[self.dance], self.frame_dance)
self.frame_dance = (self.frame_dance+self.dance_step) % self.danceLimit
if (self.frame_dance == self.danceLimit-1):
self.dance_step = -1
if (self.frame_dance == 0):
self.dance_step = 1
nextFrame += frame_step
#--------------Hit em pé--------------------
#Hhit = 19 # specialMove
#BblockHit = 21 hit agachado
# Ouch! Punch on a face (Ahit = 12 # soco fraco)
elif self.hit and self.hitName == "Apunching":
self.curr_sprite = self.spriteList[self.Ahit]
self.Ahitting = self.setState()
moveSprite(self.spriteList[self.Ahit], self.x, self.y, True)
self.setSprite(self.spriteList[self.Ahit])
changeSpriteImage(self.spriteList[self.Ahit], self.frame_Ahit)
if time > nextFrame:
self.frame_Ahit = (self.frame_Ahit+self.hit_step) % self.hitLimit[0]
if (self.frame_Ahit == self.hitLimit[0] - 1):
self.hit_step = -1
if (self.frame_Ahit == 0):
self.hit_step = 1
self.hit = False
nextFrame += 1.2*frame_step
# Ouch! kick on a face (Bhit = 13 # chute fraco)
elif self.hit and self.hitName == "Akicking":
self.curr_sprite = self.spriteList[self.Bhit]
self.Bhitting = self.setState()
if self.fighterId == 0:
self.x -=0.8
else: self.x +=0.8
moveSprite(self.spriteList[self.Bhit], self.x, self.y, True)
self.setSprite(self.spriteList[self.Bhit])
changeSpriteImage(self.spriteList[self.Bhit], self.frame_Bhit)
if time > nextFrame:
# There are 8 frames of animation in each direction
self.frame_Bhit = (self.frame_Bhit+self.hit_step) % self.hitLimit[1]
if (self.frame_Bhit == self.hitLimit[1] - 1):
self.hit_step = -1
if (self.frame_Bhit == 0):
self.hit_step = 1
self.hit = False
nextFrame += 1.2*frame_step
# Ouch! combo punch (Chit = 14 # soco forte)
elif self.hit and self.hitName == "Bpunching":
self.curr_sprite = self.spriteList[self.Chit]
self.Chitting = self.setState()
if self.fighterId == 0:
self.x -=2
else: self.x +=2
moveSprite(self.spriteList[self.Chit], self.x, self.y, True)
self.setSprite(self.spriteList[self.Chit])
changeSpriteImage(self.spriteList[self.Chit], self.frame_Chit)
if time > nextFrame:
self.frame_Chit = (self.frame_Chit+self.hit_step) % self.hitLimit[2]
if (self.frame_Chit == self.hitLimit[2] - 1):
self.hit_step = -1
if (self.frame_Chit == 0):
self.hit_step = 1
self.hit = False
nextFrame += 1.2*frame_step
#Dhit = 15 # soco agrachado fraco
elif self.hit and self.hitName == "Cpunching":
self.curr_sprite = self.spriteList[self.Dhit]
self.Dhitting = self.setState()
moveSprite(self.spriteList[self.Dhit], self.x, self.y, True)
self.setSprite(self.spriteList[self.Dhit])
changeSpriteImage(self.spriteList[self.Dhit], self.frame_Dhit)
if time > nextFrame:
self.frame_Dhit = (self.frame_Dhit+self.hit_step) % self.hitLimit[3]
if (self.frame_Dhit == self.hitLimit[3] - 1):
self.hit_step = -1
if (self.frame_Dhit == 0):
self.hit_step = 1
self.hit = False
nextFrame += 1.2*frame_step
#Fhit = 17 # chute forte e soco forte agachado (gancho)
elif self.hit and self.hitName == "Bkicking":
self.curr_sprite = self.spriteList[self.Fhit]
self.Fhitting = self.setState()
if self.frame_Fhit <= 6:
if self.fighterId == 0:
self.x -=5
else: self.x +=5
moveSprite(self.spriteList[self.Fhit], self.x, self.y, True)
self.setSprite(self.spriteList[self.Fhit])
changeSpriteImage(self.spriteList[self.Fhit], self.frame_Fhit)
if time > nextFrame:
self.frame_Fhit = (self.frame_Fhit+self.hit_step) % self.hitLimit[5]
if (self.frame_Fhit == self.hitLimit[5] - 1):
self.hit = False
nextFrame += 1.2*frame_step
#Ghit = 18 # chute agachado forte: banda
elif self.hit and self.hitName == "Dkicking":
self.curr_sprite = self.spriteList[self.Ghit]
self.Ghitting = self.setState()
moveSprite(self.spriteList[self.Ghit], self.x, self.y, True)
self.setSprite(self.spriteList[self.Ghit])
changeSpriteImage(self.spriteList[self.Ghit], self.frame_Ghit)
if time > nextFrame:
self.frame_Ghit = (self.frame_Ghit+self.hit_step) % self.hitLimit[6]
if (self.frame_Ghit == self.hitLimit[6] - 1):
self.hit = False
nextFrame += 1.2*frame_step
#blockHit! Defesa em pé.
elif self.hit and self.hitName == "Ablocking":
self.curr_sprite = self.spriteList[self.Ablock]
self.Ablocking = self.setState()
if time > nextFrame:
moveSprite(self.spriteList[self.Ablock], self.x, self.y, True)
self.setSprite(self.spriteList[self.Ablock])
changeSpriteImage(self.spriteList[self.Ablock], self.frame_Ablocking)
self.frame_Ablocking = (self.frame_Ablocking+self.hit_step) % self.blockLimit
if self.frame_Ablocking == self.blockLimit - 1:
self.hit_step = -1
if self.frame_Ablocking == 1:
self.hit_step = 1
self.hit = False
nextFrame += 1*frame_step
else:
# fightMoves = [ ["w", "s", "a", "d"], ["up", "down", "left", "right"] ] -> jump
if time > nextFrame:
if keyPressed(self.move[2]):
self.x -= 15
if keyPressed(self.move[3]):
self.x += 15
moveSprite(self.spriteList[self.jump], self.x, self.y, True)
self.setSprite(self.spriteList[self.jump])
self.y -= (self.jumpHeight-self.jumpCounter)*7
changeSpriteImage(self.spriteList[self.jump], self.frame_jumping)
if (self.jumpCounter < self.jumpHeight -1 or self.jumpCounter > self.jumpHeight +1): # subindo ou descendo
self.frame_jumping = 1
if (self.jumpHeight - 1 <= self.jumpCounter <= self.jumpHeight + 1): # quase parado
self.frame_jumping = 2
if (self.jumpCounter == 2*self.jumpHeight-1):
self.frame_jumping = 0
self.jumpCounter = -1
if clock() > nextFrame:
self.setSprite(self.spriteList[self.jump])
changeSpriteImage(self.spriteList[self.jump], self.frame_jumping)
moveSprite(self.spriteList[self.jump], self.x, self.y, True)
self.end_jump = self.setState()# MUDANÇA
self.jumping = self.setEndState() #MUDANÇA
self.jumpCounter += 2
nextFrame += 1*frame_step
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
tick(120)
return nextFrame
def getX(self):
return self.x
def getY(self):
return self.y
def setX(self,X):
self.x = X
moveSprite(self.curr_sprite,self.x,self.y,True)
def setY(self,Y):
self.y = Y
moveSprite(self.curr_sprite,self.x,self.y,True)
def isWalking(self):
return self.walking
def isCrouching(self):
return self.crouching
def isDancing(self):
return self.dancing
def isApunching(self):
return self.Apunching
def isBpunching(self):
return self.Bpunching
def isCpunching(self):
return self.Cpunching
def isDpunching(self):
return self.Dpunching
def isAkicking(self):
return self.Akicking
def isBkicking(self):
return self.Bkicking
def isCkicking(self):
return self.Ckicking
def isDkicking(self):
return self.Dkicking
def isAblocking(self):
return self.Ablocking
def isHit(self):
return self.hit
def killPlayer(self):
for i in range(0,len(self.spriteList)):
killSprite(self.spriteList[i])
def currentSprite(self):
return self.curr_sprite
def takeHit(self,by):
self.hit = True
self.hitName = by
def takeDownHit(self,by):
self.downHit = True
print("flag")
self.hitName = by
def stopHit(self):
self.hit = False
self.hitName = ""
def setState(self):
# moves
self.walking = False
self.dancing = False
self.jumping = False
self.crouching = False
# punches
self.Apunching = False
self.Bpunching = False
self.Cpunching = False
self.Dpunching = False
# kicks
self.Akicking = False
self.Bkicking = False
self.Ckicking = False
self.Dkicking = False
# punch hits
self.Ahitting = False
self.Bhitting = False
self.Chitting = False
self.Dhitting = False
self.Ehitting = False
self.Fhitting = False
self.Ghitting = False
self.Hhitting = False
# blocks
self.Ablocking = False
self.Bblocking = False
# special move
self.specialMove = False
# fatality
self.fatality = False
# actual states
return True
def setEndState(self):
self.end_jump = True
self.end_Apunch = True
self.end_Bpunch = True
self.end_Cpunch = True
self.end_Dpunch = True
self.end_Akick = True
self.end_Bkick = True
self.end_Ckick = True
self.end_Dkick = True
self.end_special = True
return False
def setSprite(self,sprite):
for i in range(0,len(self.spriteList)):
if (not sprite == self.spriteList[i]):
hideSprite(self.spriteList[i])
showSprite(sprite)
def posFighter(self):
for i in range(0,len(self.spriteList)):
moveSprite(self.spriteList[i], self.x, self.y, True) | [
"[email protected]"
] | |
a27ba69e22d7c99a3f4b8a8a2405a4b121524190 | 3f6c16ea158a8fb4318b8f069156f1c8d5cff576 | /.PyCharm2019.1/system/python_stubs/1707563220/select.py | 3a54915c6abc1d9f4af9edb7ddb5279eedcc7d7d | [] | no_license | sarthak-patidar/dotfiles | 08494170d2c0fedc0bbe719cc7c60263ce6fd095 | b62cd46f3491fd3f50c704f0255730af682d1f80 | refs/heads/master | 2020-06-28T23:42:17.236273 | 2019-10-01T13:56:27 | 2019-10-01T13:56:27 | 200,369,900 | 0 | 0 | null | 2019-08-03T12:56:33 | 2019-08-03T11:53:29 | Shell | UTF-8 | Python | false | false | 9,841 | py | # encoding: utf-8
# module select
# from /usr/lib/python3.6/lib-dynload/_asyncio.cpython-36m-x86_64-linux-gnu.so
# by generator 1.147
"""
This module supports asynchronous I/O on multiple file descriptors.
*** IMPORTANT NOTICE ***
On Windows, only sockets are supported; on Unix, all file descriptors.
"""
# no imports
# Variables with simple values
EPOLLERR = 8
EPOLLET = 2147483648
EPOLLEXCLUSIVE = 268435456
EPOLLHUP = 16
EPOLLIN = 1
EPOLLMSG = 1024
EPOLLONESHOT = 1073741824
EPOLLOUT = 4
EPOLLPRI = 2
EPOLLRDBAND = 128
EPOLLRDHUP = 8192
EPOLLRDNORM = 64
EPOLLWRBAND = 512
EPOLLWRNORM = 256
EPOLL_CLOEXEC = 524288
PIPE_BUF = 4096
POLLERR = 8
POLLHUP = 16
POLLIN = 1
POLLMSG = 1024
POLLNVAL = 32
POLLOUT = 4
POLLPRI = 2
POLLRDBAND = 128
POLLRDHUP = 8192
POLLRDNORM = 64
POLLWRBAND = 512
POLLWRNORM = 256
# functions
def poll(*args, **kwargs): # real signature unknown
"""
Returns a polling object, which supports registering and
unregistering file descriptors, and then polling them for I/O events.
"""
pass
def select(rlist, wlist, xlist, timeout=None): # real signature unknown; restored from __doc__
"""
select(rlist, wlist, xlist[, timeout]) -> (rlist, wlist, xlist)
Wait until one or more file descriptors are ready for some kind of I/O.
The first three arguments are sequences of file descriptors to be waited for:
rlist -- wait until ready for reading
wlist -- wait until ready for writing
xlist -- wait for an ``exceptional condition''
If only one kind of condition is required, pass [] for the other lists.
A file descriptor is either a socket or file object, or a small integer
gotten from a fileno() method call on one of those.
The optional 4th argument specifies a timeout in seconds; it may be
a floating point number to specify fractions of seconds. If it is absent
or None, the call will never time out.
The return value is a tuple of three lists corresponding to the first three
arguments; each contains the subset of the corresponding file descriptors
that are ready.
*** IMPORTANT NOTICE ***
On Windows, only sockets are supported; on Unix, all file
descriptors can be used.
"""
pass
# classes
class epoll(object):
"""
select.epoll(sizehint=-1, flags=0)
Returns an epolling object
sizehint must be a positive integer or -1 for the default size. The
sizehint is used to optimize internal data structures. It doesn't limit
the maximum number of monitored events.
"""
def close(self): # real signature unknown; restored from __doc__
"""
close() -> None
Close the epoll control file descriptor. Further operations on the epoll
object will raise an exception.
"""
pass
def fileno(self): # real signature unknown; restored from __doc__
"""
fileno() -> int
Return the epoll control file descriptor.
"""
return 0
@classmethod
def fromfd(cls, fd): # real signature unknown; restored from __doc__
"""
fromfd(fd) -> epoll
Create an epoll object from a given control fd.
"""
return epoll
def modify(self, fd, eventmask): # real signature unknown; restored from __doc__
"""
modify(fd, eventmask) -> None
fd is the target file descriptor of the operation
events is a bit set composed of the various EPOLL constants
"""
pass
def poll(self, timeout=-1, maxevents=-1): # real signature unknown; restored from __doc__
"""
poll([timeout=-1[, maxevents=-1]]) -> [(fd, events), (...)]
Wait for events on the epoll file descriptor for a maximum time of timeout
in seconds (as float). -1 makes poll wait indefinitely.
Up to maxevents are returned to the caller.
"""
pass
def register(self, fd, eventmask=None): # real signature unknown; restored from __doc__
"""
register(fd[, eventmask]) -> None
Registers a new fd or raises an OSError if the fd is already registered.
fd is the target file descriptor of the operation.
events is a bit set composed of the various EPOLL constants; the default
is EPOLLIN | EPOLLOUT | EPOLLPRI.
The epoll interface supports all file descriptors that support poll.
"""
pass
def unregister(self, fd): # real signature unknown; restored from __doc__
"""
unregister(fd) -> None
fd is the target file descriptor of the operation.
"""
pass
def __enter__(self, *args, **kwargs): # real signature unknown
pass
def __exit__(self, *args, **kwargs): # real signature unknown
pass
def __getattribute__(self, *args, **kwargs): # real signature unknown
""" Return getattr(self, name). """
pass
def __init__(self, sizehint=-1, flags=0): # real signature unknown; restored from __doc__
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
""" Create and return a new object. See help(type) for accurate signature. """
pass
closed = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""True if the epoll handler is closed"""
class error(Exception):
""" Base class for I/O related errors. """
def __init__(self, *args, **kwargs): # real signature unknown
pass
@staticmethod # known case of __new__
def __new__(*args, **kwargs): # real signature unknown
""" Create and return a new object. See help(type) for accurate signature. """
pass
def __reduce__(self, *args, **kwargs): # real signature unknown
pass
def __str__(self, *args, **kwargs): # real signature unknown
""" Return str(self). """
pass
characters_written = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
errno = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""POSIX exception code"""
filename = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""exception filename"""
filename2 = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""second exception filename"""
strerror = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""exception strerror"""
class __loader__(object):
"""
Meta path import for built-in modules.
All methods are either class or static methods to avoid the need to
instantiate the class.
"""
@classmethod
def create_module(cls, *args, **kwargs): # real signature unknown
""" Create a built-in module """
pass
@classmethod
def exec_module(cls, *args, **kwargs): # real signature unknown
""" Exec a built-in module """
pass
@classmethod
def find_module(cls, *args, **kwargs): # real signature unknown
"""
Find the built-in module.
If 'path' is ever specified then the search is considered a failure.
This method is deprecated. Use find_spec() instead.
"""
pass
@classmethod
def find_spec(cls, *args, **kwargs): # real signature unknown
pass
@classmethod
def get_code(cls, *args, **kwargs): # real signature unknown
""" Return None as built-in modules do not have code objects. """
pass
@classmethod
def get_source(cls, *args, **kwargs): # real signature unknown
""" Return None as built-in modules do not have source code. """
pass
@classmethod
def is_package(cls, *args, **kwargs): # real signature unknown
""" Return False as built-in modules are never packages. """
pass
@classmethod
def load_module(cls, *args, **kwargs): # real signature unknown
"""
Load the specified module into sys.modules and return it.
This method is deprecated. Use loader.exec_module instead.
"""
pass
def module_repr(module): # reliably restored by inspect
"""
Return repr for the module.
The method is deprecated. The import machinery does the job itself.
"""
pass
def __init__(self, *args, **kwargs): # real signature unknown
pass
__weakref__ = property(lambda self: object(), lambda self, v: None, lambda self: None) # default
"""list of weak references to the object (if defined)"""
__dict__ = None # (!) real value is "mappingproxy({'__module__': '_frozen_importlib', '__doc__': 'Meta path import for built-in modules.\\n\\n All methods are either class or static methods to avoid the need to\\n instantiate the class.\\n\\n ', 'module_repr': <staticmethod object at 0x7f9465730048>, 'find_spec': <classmethod object at 0x7f9465730080>, 'find_module': <classmethod object at 0x7f94657300b8>, 'create_module': <classmethod object at 0x7f94657300f0>, 'exec_module': <classmethod object at 0x7f9465730128>, 'get_code': <classmethod object at 0x7f9465730198>, 'get_source': <classmethod object at 0x7f9465730208>, 'is_package': <classmethod object at 0x7f9465730278>, 'load_module': <classmethod object at 0x7f94657302b0>, '__dict__': <attribute '__dict__' of 'BuiltinImporter' objects>, '__weakref__': <attribute '__weakref__' of 'BuiltinImporter' objects>})"
# variables with complex values
__spec__ = None # (!) real value is "ModuleSpec(name='select', loader=<class '_frozen_importlib.BuiltinImporter'>, origin='built-in')"
| [
"[email protected]"
] | |
b1706d90df624d71e0582505bf071f5ee0114199 | 1ef536d93c6616f9793e57a9ebc6b44248d50202 | /check_managementtttt/check_managementtttt/models/report_check_cash_payment_receipt.py | 68d6f94e2bc4753e85a4150adf9e14ffc5d38c3c | [] | no_license | mohamed4185/Express | 157f21f8eba2b76042f4dbe09e4071e4411342ac | 604aa39a68bfb41165549d605d40a27b9251d742 | refs/heads/master | 2022-04-12T17:04:05.407820 | 2020-03-09T14:02:17 | 2020-03-09T14:02:17 | 246,014,712 | 1 | 3 | null | null | null | null | UTF-8 | Python | false | false | 839 | py | # -*- coding: utf-8 -*-
import datetime
from odoo import tools
from odoo import models, fields, api
import logging
_logger = logging.getLogger(__name__)
class receipt_cash_check(models.AbstractModel):
_name = 'report.check_managementtttt.receipt_check_cash_payment'
@api.model
def _get_report_values(self, docids, data=None):
_logger.info('docids')
_logger.info(docids)
report_obj = self.env['ir.actions.report']
report = report_obj._get_report_from_name('check_managementtttt.receipt_check_cash_payment')
docargs = {
'doc_ids': docids,
'doc_model': 'normal.payments',
'docs': self.env['normal.payments'].browse(docids),
#'payment_info':self._payment_info,
#'convert':self._convert,
}
return docargs
| [
"[email protected]"
] | |
0d82031e876cc589dc3a35e3b6c95624c3a3dd6c | 1207e317fa2837fa4cdb49150b9b2ca99dada2f3 | /sdfs/newReporting/dashboard/migrations/0010_auto_20191217_1714.py | 4123d095b20050153016a3357a6e69aa24865d6f | [] | no_license | ericniyon/all_in_one_repo | d14cb715776f5c23851d23930145fcb707aaca1d | 9080315fbe9e8226a21bf35c49ff7662b4b095b4 | refs/heads/master | 2022-12-16T17:04:48.602534 | 2020-01-12T00:40:54 | 2020-01-12T00:40:54 | 233,317,032 | 0 | 0 | null | 2022-12-08T01:50:51 | 2020-01-12T00:30:03 | Python | UTF-8 | Python | false | false | 511 | py | # Generated by Django 2.2.2 on 2019-12-17 15:14
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('dashboard', '0009_auto_20191217_1434'),
]
operations = [
migrations.AlterField(
model_name='umuryango',
name='kpi',
field=models.ForeignKey(default=None, on_delete=django.db.models.deletion.CASCADE, related_name='kpi_name', to='dashboard.KPI'),
),
]
| [
"[email protected]"
] | |
ff59d6e66a856d739eb56ea53d9d8223bfe43bf7 | 163bbb4e0920dedd5941e3edfb2d8706ba75627d | /Code/CodeRecords/2127/60833/274342.py | 5e551b298d0556ce07128eab0c947da0b1d6fb95 | [] | no_license | AdamZhouSE/pythonHomework | a25c120b03a158d60aaa9fdc5fb203b1bb377a19 | ffc5606817a666aa6241cfab27364326f5c066ff | refs/heads/master | 2022-11-24T08:05:22.122011 | 2020-07-28T16:21:24 | 2020-07-28T16:21:24 | 259,576,640 | 2 | 1 | null | null | null | null | UTF-8 | Python | false | false | 184 | py | lines = []
while True:
try:
lines.append(input())
except:
break
dishu=int(lines.pop(0))
zhishu=int(lines.pop(0).replace(",",""))
mi=dishu**zhishu
print(mi%1337) | [
"[email protected]"
] | |
5202b14467cdb9567b35f0d1c4849e1aba84e860 | caba6ab9fc9a4528e58930adc7e0eb44a096bec4 | /product/migrations/0011_auto_20190801_1647.py | 53ea336dd7405720fd222573449c2ab507674993 | [] | no_license | prabaldeshar/productwebsite | 9159edacfb9c8ac5b9fbe50bd700f2a35e0553c7 | f36fd52ec1b239f65c941bd0b5af44f1f8530231 | refs/heads/master | 2020-06-29T19:10:38.478856 | 2019-08-17T04:06:22 | 2019-08-17T04:06:22 | 200,599,983 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 363 | py | # Generated by Django 2.2.2 on 2019-08-01 11:02
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('product', '0010_comment_rating'),
]
operations = [
migrations.RenameField(
model_name='comment',
old_name='rating',
new_name='polaratiy',
),
]
| [
"[email protected]"
] | |
4f4340a42ad423c4e6730bf0066a175e8764d45a | b683c8f1942a1ab35062620c6013b1e223c09e92 | /txt-Files/C22-Day-22/Question-92.txt | ec1f12d94f4baed689708e13ca358cf3f73ea0f2 | [] | no_license | nihathalici/Break-The-Ice-With-Python | 601e1c0f040e02fe64103c77795deb2a5d8ff00a | ef5b9dd961e8e0802eee171f2d54cdb92f2fdbe8 | refs/heads/main | 2023-07-18T01:13:27.277935 | 2021-08-27T08:19:44 | 2021-08-27T08:19:44 | 377,414,827 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 367 | txt | """
Question 92
Question
Please write a program which accepts a string from
console and print the characters that have even indexes.
Example: If the following string is given as input to the program:
H1e2l3l4o5w6o7r8l9d
Then, the output of the program should be:
Helloworld
Hints
Use list[::2] to iterate a list by step 2.
"""
s = input()
s = s[::2]
print(s)
| [
"[email protected]"
] | |
ba8bb00ef9370173431788113e4ce73b679b9500 | fa824aa50ea827d95eacadaa939680db3f36138e | /backend/accounts/urls.py | a735642f6a5c1ce21751aae014c2789e3dfc6b5e | [] | no_license | samlex20/djavue-iptv | 606401c262c15793087e36de6d5d504571fb233f | 10bcf515d858e1d32518cf8bee09d10f69df0811 | refs/heads/master | 2023-03-15T01:27:21.329673 | 2021-02-13T15:51:08 | 2021-02-13T15:51:08 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 648 | py | from django.urls import include, path
from rest_framework.routers import DefaultRouter
from .views import UserProfileListCreateView, UserProfileDetailView, UserFavouritesView, UserFavouritesListView
urlpatterns = [
#gets all user profiles and create a new profile
path("all-profiles", UserProfileListCreateView.as_view(), name="all-profiles"),
# retrieves profile details of the currently logged in user
path("profile", UserProfileDetailView.as_view(), name="profile"),
path("favourites/", UserFavouritesView.as_view(), name="favourites"),
path("favourites/ids/", UserFavouritesListView.as_view(), name="favourites-ids"),
] | [
"[email protected]"
] | |
02624e3c9a582e9c59c03d7a00158087380af871 | f60b0c051d8ba5088dc4246679b870f577646bb0 | /58 Wed, 21 Mar 2012 23:59:08.py | ea420daac6eb14e2a31ce05c3584ebc9cd0b4f6d | [] | no_license | joopeed/lp1 | bbd11fe7749356828a16fc45703e010db5d35464 | 117bf769a048ec1dff53f779b26c9e7adec052ba | refs/heads/master | 2021-01-02T22:50:08.600553 | 2014-04-03T21:15:40 | 2014-04-03T21:15:40 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 311 | py | # Date: Wed, 21 Mar 2012 23:59:08 +0000
# Question 58
# JOAO PEDRO FERREIRA 21211940
meses = ["jan","fev","mar","abr",=
"mai","jun","jul","ago","set&q=
uot;,"out","nov","dez"]
for i in range(12):
n,m = map(float,raw_input().split())
lucro = n-m
if lucro <0:
print meses[i],"%.1f" % lucro
| [
"[email protected]"
] | |
c7e6f1e35c1da07a97b1c8c79480961e3759e5d1 | 0951b7ad46683d5fd99ae5611e33117b70d5ba1b | /scg_venv/lib/python3.8/site-packages/plotly/graph_objs/layout/_polar.py | fdc74f39e878cd390d27a87fc98ddfc2d45d899d | [] | no_license | alissonpmedeiros/scg | 035bf833e16e39f56502f2a65633e361c6dc4fa6 | e3e022a14058936619f1d79d11dbbb4f6f48d531 | refs/heads/main | 2023-04-19T05:29:55.828544 | 2022-10-28T08:38:27 | 2022-10-28T08:38:27 | 525,835,696 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 48,791 | py | from plotly.basedatatypes import BaseLayoutHierarchyType as _BaseLayoutHierarchyType
import copy as _copy
class Polar(_BaseLayoutHierarchyType):
# class properties
# --------------------
_parent_path_str = "layout"
_path_str = "layout.polar"
_valid_props = {
"angularaxis",
"bargap",
"barmode",
"bgcolor",
"domain",
"gridshape",
"hole",
"radialaxis",
"sector",
"uirevision",
}
# angularaxis
# -----------
@property
def angularaxis(self):
"""
The 'angularaxis' property is an instance of AngularAxis
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.polar.AngularAxis`
- A dict of string/value properties that will be passed
to the AngularAxis constructor
Supported dict properties:
autotypenumbers
Using "strict" a numeric string in trace data
is not converted to a number. Using *convert
types* a numeric string in trace data may be
treated as a number during automatic axis
`type` detection. Defaults to
layout.autotypenumbers.
categoryarray
Sets the order in which categories on this axis
appear. Only has an effect if `categoryorder`
is set to "array". Used with `categoryorder`.
categoryarraysrc
Sets the source reference on Chart Studio Cloud
for `categoryarray`.
categoryorder
Specifies the ordering logic for the case of
categorical variables. By default, plotly uses
"trace", which specifies the order that is
present in the data supplied. Set
`categoryorder` to *category ascending* or
*category descending* if order should be
determined by the alphanumerical order of the
category names. Set `categoryorder` to "array"
to derive the ordering from the attribute
`categoryarray`. If a category is not found in
the `categoryarray` array, the sorting behavior
for that attribute will be identical to the
"trace" mode. The unspecified categories will
follow the categories in `categoryarray`. Set
`categoryorder` to *total ascending* or *total
descending* if order should be determined by
the numerical order of the values. Similarly,
the order can be determined by the min, max,
sum, mean or median of all the values.
color
Sets default for all colors associated with
this axis all at once: line, font, tick, and
grid colors. Grid color is lightened by
blending this with the plot background
Individual pieces can override this.
direction
Sets the direction corresponding to positive
angles.
dtick
Sets the step in-between ticks on this axis.
Use with `tick0`. Must be a positive number, or
special strings available to "log" and "date"
axes. If the axis `type` is "log", then ticks
are set every 10^(n*dtick) where n is the tick
number. For example, to set a tick mark at 1,
10, 100, 1000, ... set dtick to 1. To set tick
marks at 1, 100, 10000, ... set dtick to 2. To
set tick marks at 1, 5, 25, 125, 625, 3125, ...
set dtick to log_10(5), or 0.69897000433. "log"
has several special values; "L<f>", where `f`
is a positive number, gives ticks linearly
spaced in value (but not position). For example
`tick0` = 0.1, `dtick` = "L0.5" will put ticks
at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10
plus small digits between, use "D1" (all
digits) or "D2" (only 2 and 5). `tick0` is
ignored for "D1" and "D2". If the axis `type`
is "date", then you must convert the time to
milliseconds. For example, to set the interval
between ticks to one day, set `dtick` to
86400000.0. "date" also has special values
"M<n>" gives ticks spaced by a number of
months. `n` must be a positive integer. To set
ticks on the 15th of every third month, set
`tick0` to "2000-01-15" and `dtick` to "M3". To
set ticks every 4 years, set `dtick` to "M48"
exponentformat
Determines a formatting rule for the tick
exponents. For example, consider the number
1,000,000,000. If "none", it appears as
1,000,000,000. If "e", 1e+9. If "E", 1E+9. If
"power", 1x10^9 (with 9 in a super script). If
"SI", 1G. If "B", 1B.
gridcolor
Sets the color of the grid lines.
griddash
Sets the dash style of lines. Set to a dash
type string ("solid", "dot", "dash",
"longdash", "dashdot", or "longdashdot") or a
dash length list in px (eg "5px,10px,2px,2px").
gridwidth
Sets the width (in px) of the grid lines.
hoverformat
Sets the hover text formatting rule using d3
formatting mini-languages which are very
similar to those in Python. For numbers, see: h
ttps://github.com/d3/d3-format/tree/v1.4.5#d3-f
ormat. And for dates see:
https://github.com/d3/d3-time-
format/tree/v2.2.3#locale_format. We add two
items to d3's date formatter: "%h" for half of
the year as a decimal number as well as "%{n}f"
for fractional seconds with n digits. For
example, *2016-10-13 09:15:23.456* with
tickformat "%H~%M~%S.%2f" would display
"09~15~23.46"
layer
Sets the layer on which this axis is displayed.
If *above traces*, this axis is displayed above
all the subplot's traces If *below traces*,
this axis is displayed below all the subplot's
traces, but above the grid lines. Useful when
used together with scatter-like traces with
`cliponaxis` set to False to show markers
and/or text nodes above this axis.
linecolor
Sets the axis line color.
linewidth
Sets the width (in px) of the axis line.
minexponent
Hide SI prefix for 10^n if |n| is below this
number. This only has an effect when
`tickformat` is "SI" or "B".
nticks
Specifies the maximum number of ticks for the
particular axis. The actual number of ticks
will be chosen automatically to be less than or
equal to `nticks`. Has an effect only if
`tickmode` is set to "auto".
period
Set the angular period. Has an effect only when
`angularaxis.type` is "category".
rotation
Sets that start position (in degrees) of the
angular axis By default, polar subplots with
`direction` set to "counterclockwise" get a
`rotation` of 0 which corresponds to due East
(like what mathematicians prefer). In turn,
polar with `direction` set to "clockwise" get a
rotation of 90 which corresponds to due North
(like on a compass),
separatethousands
If "true", even 4-digit integers are separated
showexponent
If "all", all exponents are shown besides their
significands. If "first", only the exponent of
the first tick is shown. If "last", only the
exponent of the last tick is shown. If "none",
no exponents appear.
showgrid
Determines whether or not grid lines are drawn.
If True, the grid lines are drawn at every tick
mark.
showline
Determines whether or not a line bounding this
axis is drawn.
showticklabels
Determines whether or not the tick labels are
drawn.
showtickprefix
If "all", all tick labels are displayed with a
prefix. If "first", only the first tick is
displayed with a prefix. If "last", only the
last tick is displayed with a suffix. If
"none", tick prefixes are hidden.
showticksuffix
Same as `showtickprefix` but for tick suffixes.
thetaunit
Sets the format unit of the formatted "theta"
values. Has an effect only when
`angularaxis.type` is "linear".
tick0
Sets the placement of the first tick on this
axis. Use with `dtick`. If the axis `type` is
"log", then you must take the log of your
starting tick (e.g. to set the starting tick to
100, set the `tick0` to 2) except when
`dtick`=*L<f>* (see `dtick` for more info). If
the axis `type` is "date", it should be a date
string, like date data. If the axis `type` is
"category", it should be a number, using the
scale where each category is assigned a serial
number from zero in the order it appears.
tickangle
Sets the angle of the tick labels with respect
to the horizontal. For example, a `tickangle`
of -90 draws the tick labels vertically.
tickcolor
Sets the tick color.
tickfont
Sets the tick font.
tickformat
Sets the tick label formatting rule using d3
formatting mini-languages which are very
similar to those in Python. For numbers, see: h
ttps://github.com/d3/d3-format/tree/v1.4.5#d3-f
ormat. And for dates see:
https://github.com/d3/d3-time-
format/tree/v2.2.3#locale_format. We add two
items to d3's date formatter: "%h" for half of
the year as a decimal number as well as "%{n}f"
for fractional seconds with n digits. For
example, *2016-10-13 09:15:23.456* with
tickformat "%H~%M~%S.%2f" would display
"09~15~23.46"
tickformatstops
A tuple of :class:`plotly.graph_objects.layout.
polar.angularaxis.Tickformatstop` instances or
dicts with compatible properties
tickformatstopdefaults
When used in a template (as layout.template.lay
out.polar.angularaxis.tickformatstopdefaults),
sets the default property values to use for
elements of
layout.polar.angularaxis.tickformatstops
ticklabelstep
Sets the spacing between tick labels as
compared to the spacing between ticks. A value
of 1 (default) means each tick gets a label. A
value of 2 means shows every 2nd label. A
larger value n means only every nth tick is
labeled. `tick0` determines which labels are
shown. Not implemented for axes with `type`
"log" or "multicategory", or when `tickmode` is
"array".
ticklen
Sets the tick length (in px).
tickmode
Sets the tick mode for this axis. If "auto",
the number of ticks is set via `nticks`. If
"linear", the placement of the ticks is
determined by a starting position `tick0` and a
tick step `dtick` ("linear" is the default
value if `tick0` and `dtick` are provided). If
"array", the placement of the ticks is set via
`tickvals` and the tick text is `ticktext`.
("array" is the default value if `tickvals` is
provided).
tickprefix
Sets a tick label prefix.
ticks
Determines whether ticks are drawn or not. If
"", this axis' ticks are not drawn. If
"outside" ("inside"), this axis' are drawn
outside (inside) the axis lines.
ticksuffix
Sets a tick label suffix.
ticktext
Sets the text displayed at the ticks position
via `tickvals`. Only has an effect if
`tickmode` is set to "array". Used with
`tickvals`.
ticktextsrc
Sets the source reference on Chart Studio Cloud
for `ticktext`.
tickvals
Sets the values at which ticks on this axis
appear. Only has an effect if `tickmode` is set
to "array". Used with `ticktext`.
tickvalssrc
Sets the source reference on Chart Studio Cloud
for `tickvals`.
tickwidth
Sets the tick width (in px).
type
Sets the angular axis type. If "linear", set
`thetaunit` to determine the unit in which axis
value are shown. If *category, use `period` to
set the number of integer coordinates around
polar axis.
uirevision
Controls persistence of user-driven changes in
axis `rotation`. Defaults to
`polar<N>.uirevision`.
visible
A single toggle to hide the axis while
preserving interaction like dragging. Default
is true when a cheater plot is present on the
axis, otherwise false
Returns
-------
plotly.graph_objs.layout.polar.AngularAxis
"""
return self["angularaxis"]
@angularaxis.setter
def angularaxis(self, val):
self["angularaxis"] = val
# bargap
# ------
@property
def bargap(self):
"""
Sets the gap between bars of adjacent location coordinates.
Values are unitless, they represent fractions of the minimum
difference in bar positions in the data.
The 'bargap' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
return self["bargap"]
@bargap.setter
def bargap(self, val):
self["bargap"] = val
# barmode
# -------
@property
def barmode(self):
"""
Determines how bars at the same location coordinate are
displayed on the graph. With "stack", the bars are stacked on
top of one another With "overlay", the bars are plotted over
one another, you might need to an "opacity" to see multiple
bars.
The 'barmode' property is an enumeration that may be specified as:
- One of the following enumeration values:
['stack', 'overlay']
Returns
-------
Any
"""
return self["barmode"]
@barmode.setter
def barmode(self, val):
self["barmode"] = val
# bgcolor
# -------
@property
def bgcolor(self):
"""
Set the background color of the subplot
The 'bgcolor' property is a color and may be specified as:
- A hex string (e.g. '#ff0000')
- An rgb/rgba string (e.g. 'rgb(255,0,0)')
- An hsl/hsla string (e.g. 'hsl(0,100%,50%)')
- An hsv/hsva string (e.g. 'hsv(0,100%,100%)')
- A named CSS color:
aliceblue, antiquewhite, aqua, aquamarine, azure,
beige, bisque, black, blanchedalmond, blue,
blueviolet, brown, burlywood, cadetblue,
chartreuse, chocolate, coral, cornflowerblue,
cornsilk, crimson, cyan, darkblue, darkcyan,
darkgoldenrod, darkgray, darkgrey, darkgreen,
darkkhaki, darkmagenta, darkolivegreen, darkorange,
darkorchid, darkred, darksalmon, darkseagreen,
darkslateblue, darkslategray, darkslategrey,
darkturquoise, darkviolet, deeppink, deepskyblue,
dimgray, dimgrey, dodgerblue, firebrick,
floralwhite, forestgreen, fuchsia, gainsboro,
ghostwhite, gold, goldenrod, gray, grey, green,
greenyellow, honeydew, hotpink, indianred, indigo,
ivory, khaki, lavender, lavenderblush, lawngreen,
lemonchiffon, lightblue, lightcoral, lightcyan,
lightgoldenrodyellow, lightgray, lightgrey,
lightgreen, lightpink, lightsalmon, lightseagreen,
lightskyblue, lightslategray, lightslategrey,
lightsteelblue, lightyellow, lime, limegreen,
linen, magenta, maroon, mediumaquamarine,
mediumblue, mediumorchid, mediumpurple,
mediumseagreen, mediumslateblue, mediumspringgreen,
mediumturquoise, mediumvioletred, midnightblue,
mintcream, mistyrose, moccasin, navajowhite, navy,
oldlace, olive, olivedrab, orange, orangered,
orchid, palegoldenrod, palegreen, paleturquoise,
palevioletred, papayawhip, peachpuff, peru, pink,
plum, powderblue, purple, red, rosybrown,
royalblue, rebeccapurple, saddlebrown, salmon,
sandybrown, seagreen, seashell, sienna, silver,
skyblue, slateblue, slategray, slategrey, snow,
springgreen, steelblue, tan, teal, thistle, tomato,
turquoise, violet, wheat, white, whitesmoke,
yellow, yellowgreen
Returns
-------
str
"""
return self["bgcolor"]
@bgcolor.setter
def bgcolor(self, val):
self["bgcolor"] = val
# domain
# ------
@property
def domain(self):
"""
The 'domain' property is an instance of Domain
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.polar.Domain`
- A dict of string/value properties that will be passed
to the Domain constructor
Supported dict properties:
column
If there is a layout grid, use the domain for
this column in the grid for this polar subplot
.
row
If there is a layout grid, use the domain for
this row in the grid for this polar subplot .
x
Sets the horizontal domain of this polar
subplot (in plot fraction).
y
Sets the vertical domain of this polar subplot
(in plot fraction).
Returns
-------
plotly.graph_objs.layout.polar.Domain
"""
return self["domain"]
@domain.setter
def domain(self, val):
self["domain"] = val
# gridshape
# ---------
@property
def gridshape(self):
"""
Determines if the radial axis grid lines and angular axis line
are drawn as "circular" sectors or as "linear" (polygon)
sectors. Has an effect only when the angular axis has `type`
"category". Note that `radialaxis.angle` is snapped to the
angle of the closest vertex when `gridshape` is "circular" (so
that radial axis scale is the same as the data scale).
The 'gridshape' property is an enumeration that may be specified as:
- One of the following enumeration values:
['circular', 'linear']
Returns
-------
Any
"""
return self["gridshape"]
@gridshape.setter
def gridshape(self, val):
self["gridshape"] = val
# hole
# ----
@property
def hole(self):
"""
Sets the fraction of the radius to cut out of the polar
subplot.
The 'hole' property is a number and may be specified as:
- An int or float in the interval [0, 1]
Returns
-------
int|float
"""
return self["hole"]
@hole.setter
def hole(self, val):
self["hole"] = val
# radialaxis
# ----------
@property
def radialaxis(self):
"""
The 'radialaxis' property is an instance of RadialAxis
that may be specified as:
- An instance of :class:`plotly.graph_objs.layout.polar.RadialAxis`
- A dict of string/value properties that will be passed
to the RadialAxis constructor
Supported dict properties:
angle
Sets the angle (in degrees) from which the
radial axis is drawn. Note that by default,
radial axis line on the theta=0 line
corresponds to a line pointing right (like what
mathematicians prefer). Defaults to the first
`polar.sector` angle.
autorange
Determines whether or not the range of this
axis is computed in relation to the input data.
See `rangemode` for more info. If `range` is
provided, then `autorange` is set to False.
autotypenumbers
Using "strict" a numeric string in trace data
is not converted to a number. Using *convert
types* a numeric string in trace data may be
treated as a number during automatic axis
`type` detection. Defaults to
layout.autotypenumbers.
calendar
Sets the calendar system to use for `range` and
`tick0` if this is a date axis. This does not
set the calendar for interpreting data on this
axis, that's specified in the trace or via the
global `layout.calendar`
categoryarray
Sets the order in which categories on this axis
appear. Only has an effect if `categoryorder`
is set to "array". Used with `categoryorder`.
categoryarraysrc
Sets the source reference on Chart Studio Cloud
for `categoryarray`.
categoryorder
Specifies the ordering logic for the case of
categorical variables. By default, plotly uses
"trace", which specifies the order that is
present in the data supplied. Set
`categoryorder` to *category ascending* or
*category descending* if order should be
determined by the alphanumerical order of the
category names. Set `categoryorder` to "array"
to derive the ordering from the attribute
`categoryarray`. If a category is not found in
the `categoryarray` array, the sorting behavior
for that attribute will be identical to the
"trace" mode. The unspecified categories will
follow the categories in `categoryarray`. Set
`categoryorder` to *total ascending* or *total
descending* if order should be determined by
the numerical order of the values. Similarly,
the order can be determined by the min, max,
sum, mean or median of all the values.
color
Sets default for all colors associated with
this axis all at once: line, font, tick, and
grid colors. Grid color is lightened by
blending this with the plot background
Individual pieces can override this.
dtick
Sets the step in-between ticks on this axis.
Use with `tick0`. Must be a positive number, or
special strings available to "log" and "date"
axes. If the axis `type` is "log", then ticks
are set every 10^(n*dtick) where n is the tick
number. For example, to set a tick mark at 1,
10, 100, 1000, ... set dtick to 1. To set tick
marks at 1, 100, 10000, ... set dtick to 2. To
set tick marks at 1, 5, 25, 125, 625, 3125, ...
set dtick to log_10(5), or 0.69897000433. "log"
has several special values; "L<f>", where `f`
is a positive number, gives ticks linearly
spaced in value (but not position). For example
`tick0` = 0.1, `dtick` = "L0.5" will put ticks
at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10
plus small digits between, use "D1" (all
digits) or "D2" (only 2 and 5). `tick0` is
ignored for "D1" and "D2". If the axis `type`
is "date", then you must convert the time to
milliseconds. For example, to set the interval
between ticks to one day, set `dtick` to
86400000.0. "date" also has special values
"M<n>" gives ticks spaced by a number of
months. `n` must be a positive integer. To set
ticks on the 15th of every third month, set
`tick0` to "2000-01-15" and `dtick` to "M3". To
set ticks every 4 years, set `dtick` to "M48"
exponentformat
Determines a formatting rule for the tick
exponents. For example, consider the number
1,000,000,000. If "none", it appears as
1,000,000,000. If "e", 1e+9. If "E", 1E+9. If
"power", 1x10^9 (with 9 in a super script). If
"SI", 1G. If "B", 1B.
gridcolor
Sets the color of the grid lines.
griddash
Sets the dash style of lines. Set to a dash
type string ("solid", "dot", "dash",
"longdash", "dashdot", or "longdashdot") or a
dash length list in px (eg "5px,10px,2px,2px").
gridwidth
Sets the width (in px) of the grid lines.
hoverformat
Sets the hover text formatting rule using d3
formatting mini-languages which are very
similar to those in Python. For numbers, see: h
ttps://github.com/d3/d3-format/tree/v1.4.5#d3-f
ormat. And for dates see:
https://github.com/d3/d3-time-
format/tree/v2.2.3#locale_format. We add two
items to d3's date formatter: "%h" for half of
the year as a decimal number as well as "%{n}f"
for fractional seconds with n digits. For
example, *2016-10-13 09:15:23.456* with
tickformat "%H~%M~%S.%2f" would display
"09~15~23.46"
layer
Sets the layer on which this axis is displayed.
If *above traces*, this axis is displayed above
all the subplot's traces If *below traces*,
this axis is displayed below all the subplot's
traces, but above the grid lines. Useful when
used together with scatter-like traces with
`cliponaxis` set to False to show markers
and/or text nodes above this axis.
linecolor
Sets the axis line color.
linewidth
Sets the width (in px) of the axis line.
minexponent
Hide SI prefix for 10^n if |n| is below this
number. This only has an effect when
`tickformat` is "SI" or "B".
nticks
Specifies the maximum number of ticks for the
particular axis. The actual number of ticks
will be chosen automatically to be less than or
equal to `nticks`. Has an effect only if
`tickmode` is set to "auto".
range
Sets the range of this axis. If the axis `type`
is "log", then you must take the log of your
desired range (e.g. to set the range from 1 to
100, set the range from 0 to 2). If the axis
`type` is "date", it should be date strings,
like date data, though Date objects and unix
milliseconds will be accepted and converted to
strings. If the axis `type` is "category", it
should be numbers, using the scale where each
category is assigned a serial number from zero
in the order it appears.
rangemode
If *tozero*`, the range extends to 0,
regardless of the input data If "nonnegative",
the range is non-negative, regardless of the
input data. If "normal", the range is computed
in relation to the extrema of the input data
(same behavior as for cartesian axes).
separatethousands
If "true", even 4-digit integers are separated
showexponent
If "all", all exponents are shown besides their
significands. If "first", only the exponent of
the first tick is shown. If "last", only the
exponent of the last tick is shown. If "none",
no exponents appear.
showgrid
Determines whether or not grid lines are drawn.
If True, the grid lines are drawn at every tick
mark.
showline
Determines whether or not a line bounding this
axis is drawn.
showticklabels
Determines whether or not the tick labels are
drawn.
showtickprefix
If "all", all tick labels are displayed with a
prefix. If "first", only the first tick is
displayed with a prefix. If "last", only the
last tick is displayed with a suffix. If
"none", tick prefixes are hidden.
showticksuffix
Same as `showtickprefix` but for tick suffixes.
side
Determines on which side of radial axis line
the tick and tick labels appear.
tick0
Sets the placement of the first tick on this
axis. Use with `dtick`. If the axis `type` is
"log", then you must take the log of your
starting tick (e.g. to set the starting tick to
100, set the `tick0` to 2) except when
`dtick`=*L<f>* (see `dtick` for more info). If
the axis `type` is "date", it should be a date
string, like date data. If the axis `type` is
"category", it should be a number, using the
scale where each category is assigned a serial
number from zero in the order it appears.
tickangle
Sets the angle of the tick labels with respect
to the horizontal. For example, a `tickangle`
of -90 draws the tick labels vertically.
tickcolor
Sets the tick color.
tickfont
Sets the tick font.
tickformat
Sets the tick label formatting rule using d3
formatting mini-languages which are very
similar to those in Python. For numbers, see: h
ttps://github.com/d3/d3-format/tree/v1.4.5#d3-f
ormat. And for dates see:
https://github.com/d3/d3-time-
format/tree/v2.2.3#locale_format. We add two
items to d3's date formatter: "%h" for half of
the year as a decimal number as well as "%{n}f"
for fractional seconds with n digits. For
example, *2016-10-13 09:15:23.456* with
tickformat "%H~%M~%S.%2f" would display
"09~15~23.46"
tickformatstops
A tuple of :class:`plotly.graph_objects.layout.
polar.radialaxis.Tickformatstop` instances or
dicts with compatible properties
tickformatstopdefaults
When used in a template (as layout.template.lay
out.polar.radialaxis.tickformatstopdefaults),
sets the default property values to use for
elements of
layout.polar.radialaxis.tickformatstops
ticklabelstep
Sets the spacing between tick labels as
compared to the spacing between ticks. A value
of 1 (default) means each tick gets a label. A
value of 2 means shows every 2nd label. A
larger value n means only every nth tick is
labeled. `tick0` determines which labels are
shown. Not implemented for axes with `type`
"log" or "multicategory", or when `tickmode` is
"array".
ticklen
Sets the tick length (in px).
tickmode
Sets the tick mode for this axis. If "auto",
the number of ticks is set via `nticks`. If
"linear", the placement of the ticks is
determined by a starting position `tick0` and a
tick step `dtick` ("linear" is the default
value if `tick0` and `dtick` are provided). If
"array", the placement of the ticks is set via
`tickvals` and the tick text is `ticktext`.
("array" is the default value if `tickvals` is
provided).
tickprefix
Sets a tick label prefix.
ticks
Determines whether ticks are drawn or not. If
"", this axis' ticks are not drawn. If
"outside" ("inside"), this axis' are drawn
outside (inside) the axis lines.
ticksuffix
Sets a tick label suffix.
ticktext
Sets the text displayed at the ticks position
via `tickvals`. Only has an effect if
`tickmode` is set to "array". Used with
`tickvals`.
ticktextsrc
Sets the source reference on Chart Studio Cloud
for `ticktext`.
tickvals
Sets the values at which ticks on this axis
appear. Only has an effect if `tickmode` is set
to "array". Used with `ticktext`.
tickvalssrc
Sets the source reference on Chart Studio Cloud
for `tickvals`.
tickwidth
Sets the tick width (in px).
title
:class:`plotly.graph_objects.layout.polar.radia
laxis.Title` instance or dict with compatible
properties
titlefont
Deprecated: Please use
layout.polar.radialaxis.title.font instead.
Sets this axis' title font. Note that the
title's font used to be customized by the now
deprecated `titlefont` attribute.
type
Sets the axis type. By default, plotly attempts
to determined the axis type by looking into the
data of the traces that referenced the axis in
question.
uirevision
Controls persistence of user-driven changes in
axis `range`, `autorange`, `angle`, and `title`
if in `editable: true` configuration. Defaults
to `polar<N>.uirevision`.
visible
A single toggle to hide the axis while
preserving interaction like dragging. Default
is true when a cheater plot is present on the
axis, otherwise false
Returns
-------
plotly.graph_objs.layout.polar.RadialAxis
"""
return self["radialaxis"]
@radialaxis.setter
def radialaxis(self, val):
self["radialaxis"] = val
# sector
# ------
@property
def sector(self):
"""
Sets angular span of this polar subplot with two angles (in
degrees). Sector are assumed to be spanned in the
counterclockwise direction with 0 corresponding to rightmost
limit of the polar subplot.
The 'sector' property is an info array that may be specified as:
* a list or tuple of 2 elements where:
(0) The 'sector[0]' property is a number and may be specified as:
- An int or float
(1) The 'sector[1]' property is a number and may be specified as:
- An int or float
Returns
-------
list
"""
return self["sector"]
@sector.setter
def sector(self, val):
self["sector"] = val
# uirevision
# ----------
@property
def uirevision(self):
"""
Controls persistence of user-driven changes in axis attributes,
if not overridden in the individual axes. Defaults to
`layout.uirevision`.
The 'uirevision' property accepts values of any type
Returns
-------
Any
"""
return self["uirevision"]
@uirevision.setter
def uirevision(self, val):
self["uirevision"] = val
# Self properties description
# ---------------------------
@property
def _prop_descriptions(self):
return """\
angularaxis
:class:`plotly.graph_objects.layout.polar.AngularAxis`
instance or dict with compatible properties
bargap
Sets the gap between bars of adjacent location
coordinates. Values are unitless, they represent
fractions of the minimum difference in bar positions in
the data.
barmode
Determines how bars at the same location coordinate are
displayed on the graph. With "stack", the bars are
stacked on top of one another With "overlay", the bars
are plotted over one another, you might need to an
"opacity" to see multiple bars.
bgcolor
Set the background color of the subplot
domain
:class:`plotly.graph_objects.layout.polar.Domain`
instance or dict with compatible properties
gridshape
Determines if the radial axis grid lines and angular
axis line are drawn as "circular" sectors or as
"linear" (polygon) sectors. Has an effect only when the
angular axis has `type` "category". Note that
`radialaxis.angle` is snapped to the angle of the
closest vertex when `gridshape` is "circular" (so that
radial axis scale is the same as the data scale).
hole
Sets the fraction of the radius to cut out of the polar
subplot.
radialaxis
:class:`plotly.graph_objects.layout.polar.RadialAxis`
instance or dict with compatible properties
sector
Sets angular span of this polar subplot with two angles
(in degrees). Sector are assumed to be spanned in the
counterclockwise direction with 0 corresponding to
rightmost limit of the polar subplot.
uirevision
Controls persistence of user-driven changes in axis
attributes, if not overridden in the individual axes.
Defaults to `layout.uirevision`.
"""
def __init__(
self,
arg=None,
angularaxis=None,
bargap=None,
barmode=None,
bgcolor=None,
domain=None,
gridshape=None,
hole=None,
radialaxis=None,
sector=None,
uirevision=None,
**kwargs,
):
"""
Construct a new Polar object
Parameters
----------
arg
dict of properties compatible with this constructor or
an instance of :class:`plotly.graph_objs.layout.Polar`
angularaxis
:class:`plotly.graph_objects.layout.polar.AngularAxis`
instance or dict with compatible properties
bargap
Sets the gap between bars of adjacent location
coordinates. Values are unitless, they represent
fractions of the minimum difference in bar positions in
the data.
barmode
Determines how bars at the same location coordinate are
displayed on the graph. With "stack", the bars are
stacked on top of one another With "overlay", the bars
are plotted over one another, you might need to an
"opacity" to see multiple bars.
bgcolor
Set the background color of the subplot
domain
:class:`plotly.graph_objects.layout.polar.Domain`
instance or dict with compatible properties
gridshape
Determines if the radial axis grid lines and angular
axis line are drawn as "circular" sectors or as
"linear" (polygon) sectors. Has an effect only when the
angular axis has `type` "category". Note that
`radialaxis.angle` is snapped to the angle of the
closest vertex when `gridshape` is "circular" (so that
radial axis scale is the same as the data scale).
hole
Sets the fraction of the radius to cut out of the polar
subplot.
radialaxis
:class:`plotly.graph_objects.layout.polar.RadialAxis`
instance or dict with compatible properties
sector
Sets angular span of this polar subplot with two angles
(in degrees). Sector are assumed to be spanned in the
counterclockwise direction with 0 corresponding to
rightmost limit of the polar subplot.
uirevision
Controls persistence of user-driven changes in axis
attributes, if not overridden in the individual axes.
Defaults to `layout.uirevision`.
Returns
-------
Polar
"""
super(Polar, self).__init__("polar")
if "_parent" in kwargs:
self._parent = kwargs["_parent"]
return
# Validate arg
# ------------
if arg is None:
arg = {}
elif isinstance(arg, self.__class__):
arg = arg.to_plotly_json()
elif isinstance(arg, dict):
arg = _copy.copy(arg)
else:
raise ValueError(
"""\
The first argument to the plotly.graph_objs.layout.Polar
constructor must be a dict or
an instance of :class:`plotly.graph_objs.layout.Polar`"""
)
# Handle skip_invalid
# -------------------
self._skip_invalid = kwargs.pop("skip_invalid", False)
self._validate = kwargs.pop("_validate", True)
# Populate data dict with properties
# ----------------------------------
_v = arg.pop("angularaxis", None)
_v = angularaxis if angularaxis is not None else _v
if _v is not None:
self["angularaxis"] = _v
_v = arg.pop("bargap", None)
_v = bargap if bargap is not None else _v
if _v is not None:
self["bargap"] = _v
_v = arg.pop("barmode", None)
_v = barmode if barmode is not None else _v
if _v is not None:
self["barmode"] = _v
_v = arg.pop("bgcolor", None)
_v = bgcolor if bgcolor is not None else _v
if _v is not None:
self["bgcolor"] = _v
_v = arg.pop("domain", None)
_v = domain if domain is not None else _v
if _v is not None:
self["domain"] = _v
_v = arg.pop("gridshape", None)
_v = gridshape if gridshape is not None else _v
if _v is not None:
self["gridshape"] = _v
_v = arg.pop("hole", None)
_v = hole if hole is not None else _v
if _v is not None:
self["hole"] = _v
_v = arg.pop("radialaxis", None)
_v = radialaxis if radialaxis is not None else _v
if _v is not None:
self["radialaxis"] = _v
_v = arg.pop("sector", None)
_v = sector if sector is not None else _v
if _v is not None:
self["sector"] = _v
_v = arg.pop("uirevision", None)
_v = uirevision if uirevision is not None else _v
if _v is not None:
self["uirevision"] = _v
# Process unknown kwargs
# ----------------------
self._process_kwargs(**dict(arg, **kwargs))
# Reset skip_invalid
# ------------------
self._skip_invalid = False
| [
"[email protected]"
] | |
3b13b3fa6ada044f550736bff33731b5005c6970 | 59c875269e0865ccdf0ed89f46f5e0cdf2b23d73 | /btree_level_avgs.py | 5f659ca67649fd9306add74e2c8be573131e2980 | [] | no_license | mike-jolliffe/Learning | e964f12e33c2013f04510935477f3b00534fd206 | 308889e57e71c369aa8516fba8a2064f6a26abee | refs/heads/master | 2020-12-06T17:20:21.225587 | 2018-07-31T20:22:23 | 2018-07-31T20:22:23 | 95,589,406 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,722 | py | # Definition for a binary tree node.
class TreeNode:
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution:
# Create dictionary w/key as level, vals as vals
def __init__(self):
self.level_dict = {}
def averageOfLevels(self, root):
"""
Return the average of values at each level of binary tree
:type root: TreeNode
:rtype: List[float]
"""
# Build dict for tracking level values
self.build_leveldict(root, 1)
print(self.level_dict)
# Create list for holding level avgs
level_avgs = []
for level in self.level_dict.values():
# Calculate the average for each level's values
total = sum(level)
level_avgs.append(total / float(len(level)))
return level_avgs
def build_leveldict(self, root, level):
"""
Return dictionary of values by btree level
:type root: TreeNode
:rtype: Dict[int]
"""
# if self.val is None, you are at a leaf node
if root == None:
return None
else:
self.level_dict.setdefault(level, []).append(root.val)
return self.build_leveldict(root.left, level+1), self.build_leveldict(root.right, level+1)
if __name__ == '__main__':
node1 = TreeNode(3)
node1.right = TreeNode(20)
node1.left = TreeNode(9)
node1.right.left = TreeNode(15)
node1.right.right = TreeNode(7)
node2 = TreeNode(5)
node2.left = TreeNode(2)
node2.right = TreeNode(-3)
sol = Solution()
print(sol.averageOfLevels(node1))
sol2 = Solution()
print(sol2.averageOfLevels(node2))
| [
"[email protected]"
] | |
5be6b8178a4dfc8e0e81bb0f031629338ed91631 | 6c4303314d727ff34f6dc65b8df5a44c133b6660 | /bin/add_subproblem_info_to_annotations.py | 986443f94fb774f41bf41c6503543547c01bd59d | [
"BSD-2-Clause"
] | permissive | mtholder/propinquity | 266bfcaad71470a80d31d7eba53930c0a74cfb1a | 22ec326dbdb9d06e665d0b853f8fdb67ddfc593b | refs/heads/master | 2020-04-06T06:10:36.258830 | 2019-02-06T21:25:00 | 2019-02-06T21:25:00 | 52,227,503 | 2 | 0 | null | 2017-03-15T15:19:33 | 2016-02-21T20:54:21 | Python | UTF-8 | Python | false | false | 955 | py | #!/usr/bin/env python
from peyotl import read_as_json
import codecs
import json
import sys
try:
subproblem_ids_file, in_annotations_file, out_annotations_file = sys.argv[1:]
except:
sys.exit('Expecting 3 arguments:\n subproblem_ids_file, in_annotations_file, out_annotations_file')
import os
bin_dir = os.path.abspath(os.path.dirname(sys.argv[0]))
sys.path.append(os.path.join(bin_dir))
from document_outputs import stripped_nonempty_lines
subproblems = []
for s in stripped_nonempty_lines(subproblem_ids_file):
assert s.endswith('.tre')
subproblems.append(s[:-4])
jsonblob = read_as_json(in_annotations_file)
nodes_dict = jsonblob['nodes']
for ott_id in subproblems:
d = nodes_dict.setdefault(ott_id, {})
d['was_constrained'] = True
d['was_uncontested'] = True
with codecs.open(out_annotations_file, 'w', encoding='utf-8') as out_stream:
json.dump(jsonblob, out_stream, indent=2, sort_keys=True, separators=(',', ': '))
| [
"[email protected]"
] | |
439ed1e473b23c914296be1445a3ce4c51ac8f1c | 1e0355b293100873cedfcac789655a35180781db | /BOJ16493.py | 5d1038b921fd6a9bf1a4226731345769f521cd07 | [
"MIT"
] | permissive | INYEONGKIM/BOJ | 47dbf6aeb7a0f1b15208866badedcd161c00ee49 | 5e83d77a92d18b0d20d26645c7cfe4ba3e2d25bc | refs/heads/master | 2021-06-14T13:50:04.124334 | 2021-03-09T14:04:14 | 2021-03-09T14:04:14 | 168,840,573 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 462 | py | __import__('sys').setrecursionlimit(100000)
W,n=map(int,__import__('sys').stdin.readline().split())
weight=[0]*n;value=[0]*n
for i in range(n):
w,v=map(int,__import__('sys').stdin.readline().split())
weight[i]=w;value[i]=v
def knapsack(cap, n):
if cap==0 or n==0:
return 0
if weight[n-1]>cap:
return knapsack(cap, n-1)
else:
return max(value[n-1]+knapsack(cap-weight[n-1],n-1), knapsack(cap,n-1))
print(knapsack(W,n))
| [
"[email protected]"
] | |
241cb32f5ed9618aa63ae1e8fdae43169081b506 | 2e682fd72e3feaa70e3f7bf2a3b83c50d783ec02 | /PyTorch/contrib/cv/semantic_segmentation/MMseg-swin/mmcv/mmcv/device/mlu/data_parallel.py | 26f74dc6b3ca61208125f7dc60216fac588f26d3 | [
"GPL-1.0-or-later",
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"BSD-3-Clause",
"LicenseRef-scancode-generic-cla",
"LicenseRef-scancode-unknown-license-reference"
] | permissive | Ascend/ModelZoo-PyTorch | 4c89414b9e2582cef9926d4670108a090c839d2d | 92acc188d3a0f634de58463b6676e70df83ef808 | refs/heads/master | 2023-07-19T12:40:00.512853 | 2023-07-17T02:48:18 | 2023-07-17T02:48:18 | 483,502,469 | 23 | 6 | Apache-2.0 | 2022-10-15T09:29:12 | 2022-04-20T04:11:18 | Python | UTF-8 | Python | false | false | 4,805 | py | # -*- coding: utf-8 -*-
# BSD 3-Clause License
#
# Copyright (c) 2017
# All rights reserved.
# Copyright 2022 Huawei Technologies Co., Ltd
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ==========================================================================
# -*- coding: utf-8 -*-
# BSD 3-Clause License
#
# Copyright (c) 2017
# All rights reserved.
# Copyright 2022 Huawei Technologies Co., Ltd
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and the following disclaimer.
#
# * Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
#
# * Neither the name of the copyright holder nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ==========================================================================
# Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.parallel import MMDataParallel
from .scatter_gather import scatter_kwargs
class MLUDataParallel(MMDataParallel):
"""The MLUDataParallel module that supports DataContainer.
MLUDataParallel is a class inherited from MMDataParall, which supports
MLU training and inference only.
The main differences with MMDataParallel:
- It only supports single-card of MLU, and only use first card to
run training and inference.
- It uses direct host-to-device copy instead of stream-background
scatter.
.. warning::
MLUDataParallel only supports single MLU training, if you need to
train with multiple MLUs, please use MLUDistributedDataParallel
instead. If you have multiple MLUs, you can set the environment
variable ``MLU_VISIBLE_DEVICES=0`` (or any other card number(s))
to specify the running device.
Args:
module (:class:`nn.Module`): Module to be encapsulated.
dim (int): Dimension used to scatter the data. Defaults to 0.
"""
def __init__(self, *args, dim=0, **kwargs):
super().__init__(*args, dim=dim, **kwargs)
self.device_ids = [0]
self.src_device_obj = torch.device('mlu:0')
def scatter(self, inputs, kwargs, device_ids):
return scatter_kwargs(inputs, kwargs, device_ids, dim=self.dim)
| [
"[email protected]"
] | |
bbb35f150f5524d27d0d698f3a2e83cfd3909e2d | bc3c5bb1bd2b6e86ee545198d18a777e8380de0c | /tests/server/test_initiator.py | 3f573bf076f63734b0ed01d208350e4134d97d4d | [
"MIT"
] | permissive | math2001/nine43 | cadeab1ab4264ee423a8b7c30d25955162c27978 | 7749dc63b9717a6ee4ddc1723d6c59e16046fc01 | refs/heads/master | 2020-05-15T21:54:17.797744 | 2019-11-29T22:49:34 | 2019-11-29T22:49:34 | 182,511,335 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 9,602 | py | import string
import trio
import trio.testing
import server.initiator as initiator
import net
from server.types import Player
from typings import *
def new_half_stream_pair() -> Tuple[net.JSONStream, trio.abc.Stream]:
left, right = trio.testing.memory_stream_pair()
client = net.JSONStream(left)
return client, right
async def check_login_request(client: net.JSONStream) -> None:
with trio.move_on_after(2) as cancel_scope:
assert await client.read() == {"type": "log in"}
assert (
cancel_scope.cancelled_caught is False
), "waiting for log in request from server took to long"
async def got_accepted(client: net.JSONStream) -> None:
with trio.move_on_after(2) as cancel_scope:
assert await client.read() == {"type": "log in update", "state": "accepted"}
assert (
cancel_scope.cancelled_caught is False
), "waiting for log in acception from server took to long"
async def test_username() -> None:
conn_sendch, conn_recvch = trio.open_memory_channel[trio.abc.Stream](0)
player_sendch, player_recvch = trio.open_memory_channel[Player](0)
quit_sendch, quit_recvch = trio.open_memory_channel[Player](0)
conns = {
"slow": new_half_stream_pair(),
"quick": new_half_stream_pair(),
"average": new_half_stream_pair(),
"late": new_half_stream_pair(),
"average2": new_half_stream_pair(),
"closing": new_half_stream_pair(),
"closing2": new_half_stream_pair(),
"closing3": new_half_stream_pair(),
"quitter": new_half_stream_pair(),
}
async def client_slow(connch: SendCh[trio.abc.Stream], seq: Seq) -> None:
client, right = conns["slow"]
async with seq(0):
await connch.send(right)
async with seq(6):
await check_login_request(client)
async with seq(10):
await client.write({"type": "log in", "username": "slow"})
await got_accepted(client)
async def client_quick(connch: SendCh[trio.abc.Stream], seq: Seq) -> None:
client, right = conns["quick"]
async with seq(1):
await connch.send(right)
await check_login_request(client)
await client.write({"type": "log in", "username": "quick"})
await got_accepted(client)
async def client_average(connch: SendCh[trio.abc.Stream], seq: Seq) -> None:
client, right = conns["average"]
async with seq(2):
await connch.send(right)
await check_login_request(client)
async with seq(7):
await client.write({"type": "log in", "username": "average"})
await got_accepted(client)
async def client_late(connch: SendCh[trio.abc.Stream], seq: Seq) -> None:
client, right = conns["late"]
async with seq(11):
await connch.send(right)
await check_login_request(client)
await client.write({"type": "log in", "username": "late"})
await got_accepted(client)
async def client_duplicate(connch: SendCh[trio.abc.Stream], seq: Seq) -> None:
client, right = conns["average2"]
async with seq(3):
await connch.send(right)
await check_login_request(client)
async with seq(8):
await client.write({"type": "log in", "username": "average"})
assert await client.read() == {
"type": "log in update",
"state": "refused",
"message": "username taken",
}
async with seq(12):
await client.write({"type": "log in", "username": "average2"})
await got_accepted(client)
async def client_closing_reuse(connch: SendCh[trio.abc.Stream], seq: Seq) -> None:
client, right = conns["closing"]
async with seq(5):
await connch.send(right)
await check_login_request(client)
async with seq(13):
await client.write({"type": "log in", "username": "closing"})
await got_accepted(client)
async def client_closing_giveup(connch: SendCh[trio.abc.Stream], seq: Seq) -> None:
client, right = conns["closing2"]
async with seq(4):
await connch.send(right)
await check_login_request(client)
await client.aclose()
client, right = conns["closing3"]
async with seq(9):
await connch.send(right)
await check_login_request(client)
await client.write({"type": "log in", "username": "closing"})
await client.aclose()
async def get_players(playerch: RecvCh[Player]) -> None:
order = ["quick", "average", "slow", "late", "average2", "closing"]
i = 0
async for player in playerch:
assert player.username == order[i]
assert player.stream == net.JSONStream(
conns[order[i]][1]
), f"{order[i]!r} stream differs"
i += 1
async def wait_for_all_clients(
connch: SendCh[trio.abc.Stream], quitch: SendCh[Player]
) -> None:
seq = trio.testing.Sequencer()
async with connch, quitch:
async with trio.open_nursery() as nursery:
nursery.start_soon(client_slow, connch, seq)
nursery.start_soon(client_quick, connch, seq)
nursery.start_soon(client_average, connch, seq)
nursery.start_soon(client_late, connch, seq)
nursery.start_soon(client_duplicate, connch, seq)
nursery.start_soon(client_closing_giveup, connch, seq)
nursery.start_soon(client_closing_reuse, connch, seq)
async def monitor(
connch: SendCh[trio.abc.Stream],
playerch: RecvCh[Player],
quitch: SendCh[Player],
) -> None:
async with trio.open_nursery() as nursery:
nursery.start_soon(wait_for_all_clients, connch, quitch)
nursery.start_soon(get_players, playerch)
with trio.move_on_after(2) as cancel_scope:
async with trio.open_nursery() as nursery:
nursery.start_soon(
initiator.initiator, conn_recvch, player_sendch, quit_recvch
)
nursery.start_soon(monitor, conn_sendch, player_recvch, quit_sendch)
assert (
cancel_scope.cancelled_caught is False
), "initator and/or monitor took too long to finish"
async def test_quitter() -> None:
# left is a net.JSONStream, right just a trio.abc.Stream
async def spawn(
connch: SendCh[trio.abc.Stream],
playerch: RecvCh[Player],
quitch: SendCh[Player],
) -> None:
left, right = new_half_stream_pair()
await connch.send(right)
assert await left.read() == {"type": "log in"}
await left.write({"type": "log in", "username": "first"})
assert await left.read() == {"type": "log in update", "state": "accepted"}
# the initiator should spit the player out
player = await playerch.receive()
assert player.username == "first"
assert player.stream == net.JSONStream(right)
# player quits from the lobby or a sub, or anything that isn't the
# initiator
await quitch.send(player)
left, right = new_half_stream_pair()
await connch.send(right)
assert await left.read() == {"type": "log in"}
# notice how we use the same username. It shouldn't block, because
# the other quitted
await left.write({"type": "log in", "username": "first"})
assert await left.read() == {"type": "log in update", "state": "accepted"}
player = await playerch.receive()
assert player.username == "first"
assert player.stream == net.JSONStream(right)
await conn_sendch.aclose()
await quit_sendch.aclose()
conn_sendch, conn_recvch = trio.open_memory_channel[trio.abc.Stream](0)
player_sendch, player_recvch = trio.open_memory_channel[Player](0)
quit_sendch, quit_recvch = trio.open_memory_channel[Player](0)
async with trio.open_nursery() as nursery:
nursery.cancel_scope.deadline = trio.current_time() + 2
nursery.start_soon(spawn, conn_sendch, player_recvch, quit_sendch)
nursery.start_soon(initiator.initiator, conn_recvch, player_sendch, quit_recvch)
assert (
nursery.cancel_scope.cancelled_caught is False
), f"spawn timed out after 2 seconds"
async def test_empty_username() -> None:
conn_sendch, conn_recvch = trio.open_memory_channel[trio.abc.Stream](0)
player_sendch, player_recvch = trio.open_memory_channel[Player](0)
quit_sendch, quit_recvch = trio.open_memory_channel[Player](0)
async def spawn(
connch: SendCh[trio.abc.Stream],
playerch: RecvCh[Player],
quitch: SendCh[Player],
) -> None:
left, right = new_half_stream_pair()
await connch.send(right)
await check_login_request(left)
await left.write({"type": "log in", "username": ""})
await got_accepted(left)
await playerch.receive()
await connch.aclose()
await quitch.aclose()
async with trio.open_nursery() as nursery:
nursery.cancel_scope.deadline = trio.current_time() + 2
nursery.start_soon(spawn, conn_sendch, player_recvch, quit_sendch)
nursery.start_soon(initiator.initiator, conn_recvch, player_sendch, quit_recvch)
assert (
nursery.cancel_scope.cancelled_caught is False
), f"spawn timed out after 2 seconds"
| [
"[email protected]"
] | |
83ec28298fc8649b0e87555dd5b7e847615479bd | 34f365117eb1d846fa922c24f3fc650188ce9746 | /bin/bed2scoreToExpandBed.py | 47a35ac1a5dacf9926cd21daed5f5ecf8f6a9b8a | [
"MIT"
] | permissive | PinarSiyah/NGStoolkit | 53ac6d87a572c498414a246ae051785b40fbc80d | b360da965c763de88c9453c4fd3d3eb7a61c935d | refs/heads/master | 2021-10-22T04:49:51.153970 | 2019-03-08T08:03:28 | 2019-03-08T08:03:28 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 776 | py | #!/usr/bin/env python
import os
import sys
import argparse
from itertools import izip
import bed
parser = argparse.ArgumentParser(description='expanding bed files with scores')
parser.add_argument('-i', required= True, help='input')
parser.add_argument('-o', required= True, help='output')
args = parser.parse_args()
bedFile = args.i
out = open(args.o, 'w')
normalizationValue = 20000000
totalScore = 0
for bedline in bed.bed(bedFile).read():
totalScore += float(min(0,bedline.score()))
for bedline in bed.bed(bedFile).read():
expandedScore = max(0, normalizationValue * (float(bedline.score()) / totalScore))
newScore = '.'
fields = bedline.fields()
fields[4] = newScore
out.write(int(round(expandedScore)) * (bedline.fields2line(fields) + '\n'))
out.close()
| [
"[email protected]"
] | |
1fa0fb672f7462963fe48cc954c50fe8db869ad6 | 8b576f16cfd9202f756611001e684657dde3e812 | /01_hellopython/hn_15_whileStar.py | 2b31aaec992654c1d0c429441fc4b6fbc68e37eb | [] | no_license | WenhaoChen0907/Python_Demo | 26cc4d120aaa990c2d26fd518dfe6bcb622b1d77 | 136b8ced40623b0970c2a5bd47852425dcac3e86 | refs/heads/master | 2023-02-23T23:58:09.584321 | 2021-01-30T11:49:50 | 2021-01-30T11:49:50 | 334,374,597 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 509 | py | # 输出小星星
# 方法一
"""
row = 1
while row <= 5:
print("*" * row)
row += 1
"""
# 方法二:循环嵌套
row = 1
while row <= 5:
# 每一行打印的星星和当前行数是一致的
# 增加一个循环,专门负责当前行中,每一列的星
col = 1
while col <= row:
# print函数输出默认换行,想要去掉换行可以使用, end=""
print("*", end="")
col += 1
# 一行打印完成时,添加换行
print("")
row += 1
| [
"[email protected]"
] | |
e89c50c2406b82a3479c9267330ff8e81db5ba63 | 4ca821475c57437bb0adb39291d3121d305905d8 | /models/research/object_detection/builders/model_builder_test.py | eb6b636e37abb503086ba0d29e6479d92b69ec5d | [
"Apache-2.0"
] | permissive | yefcion/ShipRec | 4a1a893b2fd50d34a66547caa230238b0bf386de | c74a676b545d42be453729505d52e172d76bea88 | refs/heads/master | 2021-09-17T04:49:47.330770 | 2018-06-28T02:25:50 | 2018-06-28T02:25:50 | 112,176,613 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 31,249 | py | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Tests for object_detection.models.model_builder."""
import tensorflow as tf
from google.protobuf import text_format
from object_detection.builders import model_builder
from object_detection.meta_architectures import faster_rcnn_meta_arch
from object_detection.meta_architectures import rfcn_meta_arch
from object_detection.meta_architectures import ssd_meta_arch
from object_detection.models import faster_rcnn_inception_resnet_v2_feature_extractor as frcnn_inc_res
from object_detection.models import faster_rcnn_inception_v2_feature_extractor as frcnn_inc_v2
from object_detection.models import faster_rcnn_nas_feature_extractor as frcnn_nas
from object_detection.models import faster_rcnn_pnas_feature_extractor as frcnn_pnas
from object_detection.models import faster_rcnn_resnet_v1_feature_extractor as frcnn_resnet_v1
from object_detection.models import ssd_resnet_v1_fpn_feature_extractor as ssd_resnet_v1_fpn
from object_detection.models.embedded_ssd_mobilenet_v1_feature_extractor import EmbeddedSSDMobileNetV1FeatureExtractor
from object_detection.models.ssd_inception_v2_feature_extractor import SSDInceptionV2FeatureExtractor
from object_detection.models.ssd_inception_v3_feature_extractor import SSDInceptionV3FeatureExtractor
from object_detection.models.ssd_mobilenet_v1_feature_extractor import SSDMobileNetV1FeatureExtractor
from object_detection.models.ssd_mobilenet_v2_feature_extractor import SSDMobileNetV2FeatureExtractor
from object_detection.protos import model_pb2
FRCNN_RESNET_FEAT_MAPS = {
'faster_rcnn_resnet50':
frcnn_resnet_v1.FasterRCNNResnet50FeatureExtractor,
'faster_rcnn_resnet101':
frcnn_resnet_v1.FasterRCNNResnet101FeatureExtractor,
'faster_rcnn_resnet152':
frcnn_resnet_v1.FasterRCNNResnet152FeatureExtractor
}
SSD_RESNET_V1_FPN_FEAT_MAPS = {
'ssd_resnet50_v1_fpn':
ssd_resnet_v1_fpn.SSDResnet50V1FpnFeatureExtractor,
'ssd_resnet101_v1_fpn':
ssd_resnet_v1_fpn.SSDResnet101V1FpnFeatureExtractor,
'ssd_resnet152_v1_fpn':
ssd_resnet_v1_fpn.SSDResnet152V1FpnFeatureExtractor
}
class ModelBuilderTest(tf.test.TestCase):
def create_model(self, model_config):
"""Builds a DetectionModel based on the model config.
Args:
model_config: A model.proto object containing the config for the desired
DetectionModel.
Returns:
DetectionModel based on the config.
"""
return model_builder.build(model_config, is_training=True)
def test_create_ssd_inception_v2_model_from_config(self):
model_text_proto = """
ssd {
feature_extractor {
type: 'ssd_inception_v2'
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
override_base_feature_extractor_hyperparams: true
}
box_coder {
faster_rcnn_box_coder {
}
}
matcher {
argmax_matcher {
}
}
similarity_calculator {
iou_similarity {
}
}
anchor_generator {
ssd_anchor_generator {
aspect_ratios: 1.0
}
}
image_resizer {
fixed_shape_resizer {
height: 320
width: 320
}
}
box_predictor {
convolutional_box_predictor {
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
loss {
classification_loss {
weighted_softmax {
}
}
localization_loss {
weighted_smooth_l1 {
}
}
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = self.create_model(model_proto)
self.assertIsInstance(model, ssd_meta_arch.SSDMetaArch)
self.assertIsInstance(model._feature_extractor,
SSDInceptionV2FeatureExtractor)
def test_create_ssd_inception_v3_model_from_config(self):
model_text_proto = """
ssd {
feature_extractor {
type: 'ssd_inception_v3'
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
override_base_feature_extractor_hyperparams: true
}
box_coder {
faster_rcnn_box_coder {
}
}
matcher {
argmax_matcher {
}
}
similarity_calculator {
iou_similarity {
}
}
anchor_generator {
ssd_anchor_generator {
aspect_ratios: 1.0
}
}
image_resizer {
fixed_shape_resizer {
height: 320
width: 320
}
}
box_predictor {
convolutional_box_predictor {
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
loss {
classification_loss {
weighted_softmax {
}
}
localization_loss {
weighted_smooth_l1 {
}
}
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = self.create_model(model_proto)
self.assertIsInstance(model, ssd_meta_arch.SSDMetaArch)
self.assertIsInstance(model._feature_extractor,
SSDInceptionV3FeatureExtractor)
def test_create_ssd_resnet_v1_fpn_model_from_config(self):
model_text_proto = """
ssd {
feature_extractor {
type: 'ssd_resnet50_v1_fpn'
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
box_coder {
faster_rcnn_box_coder {
}
}
matcher {
argmax_matcher {
}
}
similarity_calculator {
iou_similarity {
}
}
encode_background_as_zeros: true
anchor_generator {
multiscale_anchor_generator {
aspect_ratios: [1.0, 2.0, 0.5]
scales_per_octave: 2
}
}
image_resizer {
fixed_shape_resizer {
height: 320
width: 320
}
}
box_predictor {
weight_shared_convolutional_box_predictor {
depth: 32
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
random_normal_initializer {
}
}
}
num_layers_before_predictor: 1
}
}
normalize_loss_by_num_matches: true
normalize_loc_loss_by_codesize: true
loss {
classification_loss {
weighted_sigmoid_focal {
alpha: 0.25
gamma: 2.0
}
}
localization_loss {
weighted_smooth_l1 {
delta: 0.1
}
}
classification_weight: 1.0
localization_weight: 1.0
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
for extractor_type, extractor_class in SSD_RESNET_V1_FPN_FEAT_MAPS.items():
model_proto.ssd.feature_extractor.type = extractor_type
model = model_builder.build(model_proto, is_training=True)
self.assertIsInstance(model, ssd_meta_arch.SSDMetaArch)
self.assertIsInstance(model._feature_extractor, extractor_class)
def test_create_ssd_mobilenet_v1_model_from_config(self):
model_text_proto = """
ssd {
freeze_batchnorm: true
inplace_batchnorm_update: true
feature_extractor {
type: 'ssd_mobilenet_v1'
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
box_coder {
faster_rcnn_box_coder {
}
}
matcher {
argmax_matcher {
}
}
similarity_calculator {
iou_similarity {
}
}
anchor_generator {
ssd_anchor_generator {
aspect_ratios: 1.0
}
}
image_resizer {
fixed_shape_resizer {
height: 320
width: 320
}
}
box_predictor {
convolutional_box_predictor {
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
normalize_loc_loss_by_codesize: true
loss {
classification_loss {
weighted_softmax {
}
}
localization_loss {
weighted_smooth_l1 {
}
}
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = self.create_model(model_proto)
self.assertIsInstance(model, ssd_meta_arch.SSDMetaArch)
self.assertIsInstance(model._feature_extractor,
SSDMobileNetV1FeatureExtractor)
self.assertTrue(model._normalize_loc_loss_by_codesize)
self.assertTrue(model._freeze_batchnorm)
self.assertTrue(model._inplace_batchnorm_update)
def test_create_ssd_mobilenet_v2_model_from_config(self):
model_text_proto = """
ssd {
feature_extractor {
type: 'ssd_mobilenet_v2'
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
box_coder {
faster_rcnn_box_coder {
}
}
matcher {
argmax_matcher {
}
}
similarity_calculator {
iou_similarity {
}
}
anchor_generator {
ssd_anchor_generator {
aspect_ratios: 1.0
}
}
image_resizer {
fixed_shape_resizer {
height: 320
width: 320
}
}
box_predictor {
convolutional_box_predictor {
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
normalize_loc_loss_by_codesize: true
loss {
classification_loss {
weighted_softmax {
}
}
localization_loss {
weighted_smooth_l1 {
}
}
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = self.create_model(model_proto)
self.assertIsInstance(model, ssd_meta_arch.SSDMetaArch)
self.assertIsInstance(model._feature_extractor,
SSDMobileNetV2FeatureExtractor)
self.assertTrue(model._normalize_loc_loss_by_codesize)
def test_create_embedded_ssd_mobilenet_v1_model_from_config(self):
model_text_proto = """
ssd {
feature_extractor {
type: 'embedded_ssd_mobilenet_v1'
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
box_coder {
faster_rcnn_box_coder {
}
}
matcher {
argmax_matcher {
}
}
similarity_calculator {
iou_similarity {
}
}
anchor_generator {
ssd_anchor_generator {
aspect_ratios: 1.0
}
}
image_resizer {
fixed_shape_resizer {
height: 256
width: 256
}
}
box_predictor {
convolutional_box_predictor {
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
loss {
classification_loss {
weighted_softmax {
}
}
localization_loss {
weighted_smooth_l1 {
}
}
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = self.create_model(model_proto)
self.assertIsInstance(model, ssd_meta_arch.SSDMetaArch)
self.assertIsInstance(model._feature_extractor,
EmbeddedSSDMobileNetV1FeatureExtractor)
def test_create_faster_rcnn_resnet_v1_models_from_config(self):
model_text_proto = """
faster_rcnn {
inplace_batchnorm_update: true
num_classes: 3
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 600
max_dimension: 1024
}
}
feature_extractor {
type: 'faster_rcnn_resnet101'
}
first_stage_anchor_generator {
grid_anchor_generator {
scales: [0.25, 0.5, 1.0, 2.0]
aspect_ratios: [0.5, 1.0, 2.0]
height_stride: 16
width_stride: 16
}
}
first_stage_box_predictor_conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
initial_crop_size: 14
maxpool_kernel_size: 2
maxpool_stride: 2
second_stage_box_predictor {
mask_rcnn_box_predictor {
fc_hyperparams {
op: FC
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
second_stage_post_processing {
batch_non_max_suppression {
score_threshold: 0.01
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 300
}
score_converter: SOFTMAX
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
for extractor_type, extractor_class in FRCNN_RESNET_FEAT_MAPS.items():
model_proto.faster_rcnn.feature_extractor.type = extractor_type
model = model_builder.build(model_proto, is_training=True)
self.assertIsInstance(model, faster_rcnn_meta_arch.FasterRCNNMetaArch)
self.assertIsInstance(model._feature_extractor, extractor_class)
def test_create_faster_rcnn_resnet101_with_mask_prediction_enabled(self):
model_text_proto = """
faster_rcnn {
num_classes: 3
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 600
max_dimension: 1024
}
}
feature_extractor {
type: 'faster_rcnn_resnet101'
}
first_stage_anchor_generator {
grid_anchor_generator {
scales: [0.25, 0.5, 1.0, 2.0]
aspect_ratios: [0.5, 1.0, 2.0]
height_stride: 16
width_stride: 16
}
}
first_stage_box_predictor_conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
initial_crop_size: 14
maxpool_kernel_size: 2
maxpool_stride: 2
second_stage_box_predictor {
mask_rcnn_box_predictor {
fc_hyperparams {
op: FC
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
predict_instance_masks: true
}
}
second_stage_mask_prediction_loss_weight: 3.0
second_stage_post_processing {
batch_non_max_suppression {
score_threshold: 0.01
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 300
}
score_converter: SOFTMAX
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = model_builder.build(model_proto, is_training=True)
self.assertAlmostEqual(model._second_stage_mask_loss_weight, 3.0)
def test_create_faster_rcnn_nas_model_from_config(self):
model_text_proto = """
faster_rcnn {
num_classes: 3
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 600
max_dimension: 1024
}
}
feature_extractor {
type: 'faster_rcnn_nas'
}
first_stage_anchor_generator {
grid_anchor_generator {
scales: [0.25, 0.5, 1.0, 2.0]
aspect_ratios: [0.5, 1.0, 2.0]
height_stride: 16
width_stride: 16
}
}
first_stage_box_predictor_conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
initial_crop_size: 17
maxpool_kernel_size: 1
maxpool_stride: 1
second_stage_box_predictor {
mask_rcnn_box_predictor {
fc_hyperparams {
op: FC
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
second_stage_post_processing {
batch_non_max_suppression {
score_threshold: 0.01
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 300
}
score_converter: SOFTMAX
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = model_builder.build(model_proto, is_training=True)
self.assertIsInstance(model, faster_rcnn_meta_arch.FasterRCNNMetaArch)
self.assertIsInstance(
model._feature_extractor,
frcnn_nas.FasterRCNNNASFeatureExtractor)
def test_create_faster_rcnn_pnas_model_from_config(self):
model_text_proto = """
faster_rcnn {
num_classes: 3
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 600
max_dimension: 1024
}
}
feature_extractor {
type: 'faster_rcnn_pnas'
}
first_stage_anchor_generator {
grid_anchor_generator {
scales: [0.25, 0.5, 1.0, 2.0]
aspect_ratios: [0.5, 1.0, 2.0]
height_stride: 16
width_stride: 16
}
}
first_stage_box_predictor_conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
initial_crop_size: 17
maxpool_kernel_size: 1
maxpool_stride: 1
second_stage_box_predictor {
mask_rcnn_box_predictor {
fc_hyperparams {
op: FC
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
second_stage_post_processing {
batch_non_max_suppression {
score_threshold: 0.01
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 300
}
score_converter: SOFTMAX
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = model_builder.build(model_proto, is_training=True)
self.assertIsInstance(model, faster_rcnn_meta_arch.FasterRCNNMetaArch)
self.assertIsInstance(
model._feature_extractor,
frcnn_pnas.FasterRCNNPNASFeatureExtractor)
def test_create_faster_rcnn_inception_resnet_v2_model_from_config(self):
model_text_proto = """
faster_rcnn {
num_classes: 3
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 600
max_dimension: 1024
}
}
feature_extractor {
type: 'faster_rcnn_inception_resnet_v2'
}
first_stage_anchor_generator {
grid_anchor_generator {
scales: [0.25, 0.5, 1.0, 2.0]
aspect_ratios: [0.5, 1.0, 2.0]
height_stride: 16
width_stride: 16
}
}
first_stage_box_predictor_conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
initial_crop_size: 17
maxpool_kernel_size: 1
maxpool_stride: 1
second_stage_box_predictor {
mask_rcnn_box_predictor {
fc_hyperparams {
op: FC
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
second_stage_post_processing {
batch_non_max_suppression {
score_threshold: 0.01
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 300
}
score_converter: SOFTMAX
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = model_builder.build(model_proto, is_training=True)
self.assertIsInstance(model, faster_rcnn_meta_arch.FasterRCNNMetaArch)
self.assertIsInstance(
model._feature_extractor,
frcnn_inc_res.FasterRCNNInceptionResnetV2FeatureExtractor)
def test_create_faster_rcnn_inception_v2_model_from_config(self):
model_text_proto = """
faster_rcnn {
num_classes: 3
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 600
max_dimension: 1024
}
}
feature_extractor {
type: 'faster_rcnn_inception_v2'
}
first_stage_anchor_generator {
grid_anchor_generator {
scales: [0.25, 0.5, 1.0, 2.0]
aspect_ratios: [0.5, 1.0, 2.0]
height_stride: 16
width_stride: 16
}
}
first_stage_box_predictor_conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
initial_crop_size: 14
maxpool_kernel_size: 2
maxpool_stride: 2
second_stage_box_predictor {
mask_rcnn_box_predictor {
fc_hyperparams {
op: FC
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
second_stage_post_processing {
batch_non_max_suppression {
score_threshold: 0.01
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 300
}
score_converter: SOFTMAX
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = model_builder.build(model_proto, is_training=True)
self.assertIsInstance(model, faster_rcnn_meta_arch.FasterRCNNMetaArch)
self.assertIsInstance(model._feature_extractor,
frcnn_inc_v2.FasterRCNNInceptionV2FeatureExtractor)
def test_create_faster_rcnn_model_from_config_with_example_miner(self):
model_text_proto = """
faster_rcnn {
num_classes: 3
feature_extractor {
type: 'faster_rcnn_inception_resnet_v2'
}
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 600
max_dimension: 1024
}
}
first_stage_anchor_generator {
grid_anchor_generator {
scales: [0.25, 0.5, 1.0, 2.0]
aspect_ratios: [0.5, 1.0, 2.0]
height_stride: 16
width_stride: 16
}
}
first_stage_box_predictor_conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
second_stage_box_predictor {
mask_rcnn_box_predictor {
fc_hyperparams {
op: FC
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
hard_example_miner {
num_hard_examples: 10
iou_threshold: 0.99
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
model = model_builder.build(model_proto, is_training=True)
self.assertIsNotNone(model._hard_example_miner)
def test_create_rfcn_resnet_v1_model_from_config(self):
model_text_proto = """
faster_rcnn {
num_classes: 3
image_resizer {
keep_aspect_ratio_resizer {
min_dimension: 600
max_dimension: 1024
}
}
feature_extractor {
type: 'faster_rcnn_resnet101'
}
first_stage_anchor_generator {
grid_anchor_generator {
scales: [0.25, 0.5, 1.0, 2.0]
aspect_ratios: [0.5, 1.0, 2.0]
height_stride: 16
width_stride: 16
}
}
first_stage_box_predictor_conv_hyperparams {
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
initial_crop_size: 14
maxpool_kernel_size: 2
maxpool_stride: 2
second_stage_box_predictor {
rfcn_box_predictor {
conv_hyperparams {
op: CONV
regularizer {
l2_regularizer {
}
}
initializer {
truncated_normal_initializer {
}
}
}
}
}
second_stage_post_processing {
batch_non_max_suppression {
score_threshold: 0.01
iou_threshold: 0.6
max_detections_per_class: 100
max_total_detections: 300
}
score_converter: SOFTMAX
}
}"""
model_proto = model_pb2.DetectionModel()
text_format.Merge(model_text_proto, model_proto)
for extractor_type, extractor_class in FRCNN_RESNET_FEAT_MAPS.items():
model_proto.faster_rcnn.feature_extractor.type = extractor_type
model = model_builder.build(model_proto, is_training=True)
self.assertIsInstance(model, rfcn_meta_arch.RFCNMetaArch)
self.assertIsInstance(model._feature_extractor, extractor_class)
if __name__ == '__main__':
tf.test.main()
| [
"[email protected]"
] | |
9621ec41d9db1cd973fd5b6bcd3dceda3b721d04 | ca7aa979e7059467e158830b76673f5b77a0f5a3 | /Python_codes/p02722/s643080348.py | 12af358f61bf63984b21ca359bf673d793d1dadf | [] | no_license | Aasthaengg/IBMdataset | 7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901 | f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8 | refs/heads/main | 2023-04-22T10:22:44.763102 | 2021-05-13T17:27:22 | 2021-05-13T17:27:22 | 367,112,348 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 389 | py | def make_divisors(n):
divisors = []
for i in range(1, int(n**0.5)+1):
if n % i == 0:
divisors.append(i)
if i != n // i:
divisors.append(n//i)
return divisors
n=int(input())
l1=make_divisors(n-1)
l2=make_divisors(n)[2:]
for i in l2:
j=n/i
while j%i==0:
j/=i
if j%i==1 and n/i not in l1:
l1.append(n/i)
print(len(l1)) | [
"[email protected]"
] | |
63630a4c6196d7f097af947e60629dcf3546b07c | 00c6ded41b84008489a126a36657a8dc773626a5 | /.history/Sizing_Method/ConstrainsAnalysis/ConstrainsAnalysisPDP1P2_20210713172310.py | 9d6afc895a625c9f6d50854b953304f5dc66d88d | [] | no_license | 12libao/DEA | 85f5f4274edf72c7f030a356bae9c499e3afc2ed | 1c6f8109bbc18c4451a50eacad9b4dedd29682bd | refs/heads/master | 2023-06-17T02:10:40.184423 | 2021-07-16T19:05:18 | 2021-07-16T19:05:18 | 346,111,158 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 22,974 | py | # author: Bao Li #
# Georgia Institute of Technology #
import sys
import os
sys.path.insert(0, os.getcwd())
import numpy as np
import matplotlib.pylab as plt
import Sizing_Method.Other.US_Standard_Atmosphere_1976 as atm
import Sizing_Method.Aerodynamics.ThrustLapse as thrust_lapse
import Sizing_Method.Aerodynamics.Aerodynamics as ad
import Sizing_Method.ConstrainsAnalysis.ConstrainsAnalysis as ca
import Sizing_Method.ConstrainsAnalysis.ConstrainsAnalysisPD as ca_pd
from scipy.optimize import curve_fit
"""
The unit use is IS standard
"""
class ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun:
"""This is a power-based master constraints analysis"""
def __init__(self, altitude, velocity, beta, wing_load, Hp=0.2, number_of_motor=12, C_DR=0):
"""
:param beta: weight fraction
:param Hp: P_motor/P_total
:param n: number of motor
:param K1: drag polar coefficient for 2nd order term
:param K2: drag polar coefficient for 1st order term
:param C_D0: the drag coefficient at zero lift
:param C_DR: additional drag caused, for example, by external stores,
braking parachutes or flaps, or temporary external hardware
:return:
power load: P_WTO
"""
self.h = altitude
self.v = velocity
self.rho = atm.atmosphere(geometric_altitude=self.h).density()
self.beta = beta
self.hp = Hp
self.n = number_of_motor
# power lapse ratio
self.alpha = thrust_lapse.thrust_lapse_calculation(altitude=self.h,
velocity=self.v).high_bypass_ratio_turbofan()
self.k1 = ad.aerodynamics_without_pd(self.h, self.v).K1()
self.k2 = ad.aerodynamics_without_pd(self.h, self.v).K2()
self.cd0 = ad.aerodynamics_without_pd(self.h, self.v).CD_0()
self.cdr = C_DR
self.w_s = wing_load
self.g0 = 9.80665
self.coefficient = (1 - self.hp) * self.beta * self.v / self.alpha
# Estimation of ΔCL and ΔCD
pd = ad.aerodynamics_with_pd(
self.h, self.v, Hp=self.hp, n=self.n, W_S=self.w_s)
self.q = 0.5 * self.rho * self.v ** 2
self.cl = self.beta * self.w_s / self.q
# print(self.cl)
self.delta_cl = pd.delta_lift_coefficient(self.cl)
self.delta_cd0 = pd.delta_CD_0()
def master_equation(self, n, dh_dt, dV_dt):
cl = self.cl * n + self.delta_cl
cd = self.k1 * cl ** 2 + self.k2 * cl + self.cd0 + self.cdr + self.delta_cd0
p_w = self.coefficient * \
(self.q / (self.beta * self.w_s) *
cd + dh_dt / self.v + dV_dt / self.g0)
return p_w
def cruise(self):
p_w = ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun.master_equation(
self, n=1, dh_dt=0, dV_dt=0)
return p_w
def climb(self, roc):
p_w = ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun.master_equation(
self, n=1, dh_dt=roc, dV_dt=0)
return p_w
def level_turn(self, turn_rate=3, v=100):
"""
assume 2 min for 360 degree turn, which is 3 degree/seconds
assume turn at 300 knots, which is about 150 m/s
"""
load_factor = (1 + ((turn_rate * np.pi / 180)
* v / self.g0) ** 2) ** 0.5
p_w = ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun.master_equation(
self, n=load_factor, dh_dt=0, dV_dt=0)
return p_w
def take_off(self):
"""
A320neo take-off speed is about 150 knots, which is about 75 m/s
required runway length is about 2000 m
K_TO is a constant greater than one set to 1.2 (generally specified by appropriate flying regulations)
"""
Cl_max_to = 2.3 # 2.3
K_TO = 1.2 # V_TO / V_stall
s_G = 1266
p_w = 2 / 3 * self.coefficient / self.v * self.beta * K_TO ** 2 / (
s_G * self.rho * self.g0 * Cl_max_to) * self.w_s ** (
3 / 2)
return p_w
def stall_speed(self, V_stall_to=65, Cl_max_to=2.3):
V_stall_ld = 62
Cl_max_ld = 2.87
W_S_1 = 1 / 2 * self.rho * V_stall_to ** 2 * \
(Cl_max_to + self.delta_cl)
W_S_2 = 1 / 2 * self.rho * V_stall_ld ** 2 * \
(Cl_max_ld + self.delta_cl)
W_S = min(W_S_1, W_S_2)
return W_S
def service_ceiling(self, roc=0.5):
p_w = ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun.master_equation(
self, n=1, dh_dt=roc, dV_dt=0)
return p_w
allFuncs = [take_off, stall_speed, cruise,
service_ceiling, level_turn, climb]
class ConstrainsAnalysis_Mattingly_Method_with_DP_electric:
"""This is a power-based master constraints analysis
the difference between turbofun and electric for constrains analysis:
1. assume the thrust_lapse = 1 for electric propution
2. hp = 1 - hp_turbofun
"""
def __init__(self, altitude, velocity, beta, wing_load, Hp=0.2, number_of_motor=12, C_DR=0):
"""
:param beta: weight fraction
:param Hp: P_motor/P_total
:param n: number of motor
:param K1: drag polar coefficient for 2nd order term
:param K2: drag polar coefficient for 1st order term
:param C_D0: the drag coefficient at zero lift
:param C_DR: additional drag caused, for example, by external stores,
braking parachutes or flaps, or temporary external hardware
:return:
power load: P_WTO
"""
self.h = altitude
self.v = velocity
self.rho = atm.atmosphere(geometric_altitude=self.h).density()
self.beta = beta
self.hp = Hp # this is the difference part compare with turbofun
self.n = number_of_motor
# power lapse ratio
self.alpha = 1 # this is the difference part compare with turbofun
self.k1 = ad.aerodynamics_without_pd(self.h, self.v).K1()
self.k2 = ad.aerodynamics_without_pd(self.h, self.v).K2()
self.cd0 = ad.aerodynamics_without_pd(self.h, self.v).CD_0()
self.cdr = C_DR
self.w_s = wing_load
self.g0 = 9.80665
self.coefficient = self.hp * self.beta * self.v / self.alpha
# Estimation of ΔCL and ΔCD
pd = ad.aerodynamics_with_pd(
self.h, self.v, Hp=self.hp, n=self.n, W_S=self.w_s)
self.q = 0.5 * self.rho * self.v ** 2
self.cl = self.beta * self.w_s / self.q
# print(self.cl)
self.delta_cl = pd.delta_lift_coefficient(self.cl)
self.delta_cd0 = pd.delta_CD_0()
def master_equation(self, n, dh_dt, dV_dt):
cl = self.cl * n + self.delta_cl
cd = self.k1 * cl ** 2 + self.k2 * cl + self.cd0 + self.cdr + self.delta_cd0
p_w = self.coefficient * \
(self.q / (self.beta * self.w_s) *
cd + dh_dt / self.v + dV_dt / self.g0)
return p_w
def cruise(self):
p_w = ConstrainsAnalysis_Mattingly_Method_with_DP_electric.master_equation(
self, n=1, dh_dt=0, dV_dt=0)
return p_w
def climb(self, roc):
p_w = ConstrainsAnalysis_Mattingly_Method_with_DP_electric.master_equation(
self, n=1, dh_dt=roc, dV_dt=0)
return p_w
def level_turn(self, turn_rate=3, v=100):
"""
assume 2 min for 360 degree turn, which is 3 degree/seconds
assume turn at 300 knots, which is about 150 m/s
"""
load_factor = (1 + ((turn_rate * np.pi / 180)
* v / self.g0) ** 2) ** 0.5
p_w = ConstrainsAnalysis_Mattingly_Method_with_DP_electric.master_equation(
self, n=load_factor, dh_dt=0, dV_dt=0)
return p_w
def take_off(self):
"""
A320neo take-off speed is about 150 knots, which is about 75 m/s
required runway length is about 2000 m
K_TO is a constant greater than one set to 1.2 (generally specified by appropriate flying regulations)
"""
Cl_max_to = 2.3 # 2.3
K_TO = 1.2 # V_TO / V_stall
s_G = 1266
p_w = 2 / 3 * self.coefficient / self.v * self.beta * K_TO ** 2 / (
s_G * self.rho * self.g0 * Cl_max_to) * self.w_s ** (
3 / 2)
return p_w
def stall_speed(self, V_stall_to=65, Cl_max_to=2.3):
V_stall_ld = 62
Cl_max_ld = 2.87
W_S_1 = 1 / 2 * self.rho * V_stall_to ** 2 * (Cl_max_to + self.delta_cl)
W_S_2 = 1 / 2 * self.rho * V_stall_ld ** 2 * (Cl_max_ld + self.delta_cl)
W_S = min(W_S_1, W_S_2)
return W_S
def service_ceiling(self, roc=0.5):
p_w = ConstrainsAnalysis_Mattingly_Method_with_DP_electric.master_equation(
self, n=1, dh_dt=roc, dV_dt=0)
return p_w
allFuncs = [take_off, stall_speed, cruise,
service_ceiling, level_turn, climb]
class ConstrainsAnalysis_Gudmundsson_Method_with_DP_turbofun:
"""This is a power-based master constraints analysis based on Gudmundsson_method"""
def __init__(self, altitude, velocity, beta, wing_load, Hp=0.2, number_of_motor=12, e=0.75, AR=10.3):
"""
:param beta: weight fraction
:param e: wing planform efficiency factor is between 0.75 and 0.85, no more than 1
:param AR: wing aspect ratio, normally between 7 and 10
:return:
power load: P_WTO
"""
self.h = altitude
self.v = velocity
self.beta = beta
self.w_s = wing_load
self.g0 = 9.80665
self.beta = beta
self.hp = Hp
self.n = number_of_motor
self.rho = atm.atmosphere(geometric_altitude=self.h).density()
# power lapse ratio
self.alpha = thrust_lapse.thrust_lapse_calculation(altitude=self.h,
velocity=self.v).high_bypass_ratio_turbofan()
h = 2.43 # height of winglets
b = 35.8
# equation 9-88, If the wing has winglets the aspect ratio should be corrected
ar_corr = AR * (1 + 1.9 * h / b)
self.k = 1 / (np.pi * ar_corr * e)
self.coefficient = (1 - self.hp) * self.beta * self.v / self.alpha
# Estimation of ΔCL and ΔCD
pd = ad.aerodynamics_with_pd(
self.h, self.v, Hp=self.hp, n=self.n, W_S=self.w_s)
self.q = 0.5 * self.rho * self.v ** 2
cl = self.beta * self.w_s / self.q
self.delta_cl = pd.delta_lift_coefficient(cl)
self.delta_cd0 = pd.delta_CD_0()
# TABLE 3-1 Typical Aerodynamic Characteristics of Selected Classes of Aircraft
cd_min = 0.02
cd_to = 0.03
cl_to = 0.8
self.v_to = 68
self.s_g = 1480
self.mu = 0.04
self.cd_min = cd_min + self.delta_cd0
self.cl = cl + self.delta_cl
self.cd_to = cd_to + self.delta_cd0
self.cl_to = cl_to + self.delta_cl
def cruise(self):
p_w = self.q / self.w_s * (self.cd_min + self.k * self.cl ** 2)
return p_w * self.coefficient
def climb(self, roc):
p_w = roc / self.v + self.q * self.cd_min / self.w_s + self.k * self.cl
return p_w * self.coefficient
def level_turn(self, turn_rate=3, v=100):
"""
assume 2 min for 360 degree turn, which is 3 degree/seconds
assume turn at 100 m/s
"""
load_factor = (1 + ((turn_rate * np.pi / 180)
* v / self.g0) ** 2) ** 0.5
q = 0.5 * self.rho * v ** 2
p_w = q / self.w_s * (self.cd_min + self.k *
(load_factor / q * self.w_s + self.delta_cl) ** 2)
return p_w * self.coefficient
def take_off(self):
q = self.q / 2
p_w = self.v_to ** 2 / (2 * self.g0 * self.s_g) + q * self.cd_to / self.w_s + self.mu * (
1 - q * self.cl_to / self.w_s)
return p_w * self.coefficient
def service_ceiling(self, roc=0.5):
vy = (2 / self.rho * self.w_s *
(self.k / (3 * self.cd_min)) ** 0.5) ** 0.5
q = 0.5 * self.rho * vy ** 2
p_w = roc / vy + q / self.w_s * \
(self.cd_min + self.k * (self.w_s / q + self.delta_cl) ** 2)
# p_w = roc / (2 / self.rho * self.w_s * (self.k / (3 * self.cd_min)) ** 0.5) ** 0.5 + 4 * (
# self.k * self.cd_min / 3) ** 0.5
return p_w * self.coefficient
def stall_speed(self, V_stall_to=65, Cl_max_to=2.3):
V_stall_ld = 62
Cl_max_ld = 2.87
W_S_1 = 1 / 2 * self.rho * V_stall_to ** 2 * \
(Cl_max_to + self.delta_cl)
W_S_2 = 1 / 2 * self.rho * V_stall_ld ** 2 * \
(Cl_max_ld + self.delta_cl)
W_S = min(W_S_1, W_S_2)
return W_S
allFuncs = [take_off, stall_speed, cruise,
service_ceiling, level_turn, climb]
class ConstrainsAnalysis_Gudmundsson_Method_with_DP_electric:
"""This is a power-based master constraints analysis based on Gudmundsson_method
the difference between turbofun and electric for constrains analysis:
1. assume the thrust_lapse = 1 for electric propution
2. hp = 1 - hp_turbofun
"""
def __init__(self, altitude, velocity, beta, wing_load, Hp=0.2, number_of_motor=12, e=0.75, AR=10.3):
"""
:param beta: weight fraction
:param e: wing planform efficiency factor is between 0.75 and 0.85, no more than 1
:param AR: wing aspect ratio, normally between 7 and 10
:return:
power load: P_WTO
"""
self.h = altitude
self.v = velocity
self.beta = beta
self.w_s = wing_load
self.g0 = 9.80665
self.beta = beta
self.hp = Hp # this is the difference part compare with turbofun
self.n = number_of_motor
self.rho = atm.atmosphere(geometric_altitude=self.h).density()
# power lapse ratio
self.alpha = 1 # this is the difference part compare with turbofun
h = 2.43 # height of winglets
b = 35.8
# equation 9-88, If the wing has winglets the aspect ratio should be corrected
ar_corr = AR * (1 + 1.9 * h / b)
self.k = 1 / (np.pi * ar_corr * e)
self.coefficient = self.hp*self.beta * self.v / self.alpha
# Estimation of ΔCL and ΔCD
pd = ad.aerodynamics_with_pd(
self.h, self.v, Hp=self.hp, n=self.n, W_S=self.w_s)
self.q = 0.5 * self.rho * self.v ** 2
cl = self.beta * self.w_s / self.q
self.delta_cl = pd.delta_lift_coefficient(cl)
self.delta_cd0 = pd.delta_CD_0()
# TABLE 3-1 Typical Aerodynamic Characteristics of Selected Classes of Aircraft
cd_min = 0.02
cd_to = 0.03
cl_to = 0.8
self.v_to = 68
self.s_g = 1480
self.mu = 0.04
self.cd_min = cd_min + self.delta_cd0
self.cl = cl + self.delta_cl
self.cd_to = cd_to + self.delta_cd0
self.cl_to = cl_to + self.delta_cl
def cruise(self):
p_w = self.q / self.w_s * (self.cd_min + self.k * self.cl ** 2)
return p_w * self.coefficient
def climb(self, roc):
p_w = roc / self.v + self.q * self.cd_min / self.w_s + self.k * self.cl
return p_w * self.coefficient
def level_turn(self, turn_rate=3, v=100):
"""
assume 2 min for 360 degree turn, which is 3 degree/seconds
assume turn at 100 m/s
"""
load_factor = (1 + ((turn_rate * np.pi / 180)
* v / self.g0) ** 2) ** 0.5
q = 0.5 * self.rho * v ** 2
p_w = q / self.w_s * (self.cd_min + self.k *
(load_factor / q * self.w_s + self.delta_cl) ** 2)
return p_w * self.coefficient
def take_off(self):
q = self.q / 2
p_w = self.v_to ** 2 / (2 * self.g0 * self.s_g) + q * self.cd_to / self.w_s + self.mu * (
1 - q * self.cl_to / self.w_s)
return p_w * self.coefficient
def service_ceiling(self, roc=0.5):
vy = (2 / self.rho * self.w_s *
(self.k / (3 * self.cd_min)) ** 0.5) ** 0.5
q = 0.5 * self.rho * vy ** 2
p_w = roc / vy + q / self.w_s * \
(self.cd_min + self.k * (self.w_s / q + self.delta_cl) ** 2)
# p_w = roc / (2 / self.rho * self.w_s * (self.k / (3 * self.cd_min)) ** 0.5) ** 0.5 + 4 * (
# self.k * self.cd_min / 3) ** 0.5
return p_w * self.coefficient
def stall_speed(self, V_stall_to=65, Cl_max_to=2.3):
V_stall_ld = 62
Cl_max_ld = 2.87
W_S_1 = 1 / 2 * self.rho * V_stall_to ** 2 * \
(Cl_max_to + self.delta_cl)
W_S_2 = 1 / 2 * self.rho * V_stall_ld ** 2 * \
(Cl_max_ld + self.delta_cl)
W_S = min(W_S_1, W_S_2)
return W_S
allFuncs = [take_off, stall_speed, cruise,
service_ceiling, level_turn, climb]
if __name__ == "__main__":
n = 250
w_s = np.linspace(100, 9000, n)
constrains_name = ['take off', 'stall speed', 'cruise', 'service ceiling', 'level turn @3000m',
'climb @S-L', 'climb @3000m', 'climb @7000m', 'feasible region-hybrid', 'feasible region-conventional']
constrains = np.array([[0, 68, 0.988, 0.5], [0, 80, 1, 0.2], [11300, 230, 0.948, 0.8],
[11900, 230, 0.78, 0.5], [3000, 100, 0.984, 0.8], [0, 100, 0.984, 0.5],
[3000, 200, 0.975, 0.6], [7000, 230, 0.96, 0.8]])
color = ['c', 'k', 'b', 'g', 'y', 'plum', 'violet', 'm']
label = ['feasible region with PD', 'feasible region with PD', 'feasible region Gudmundsson',
'feasible region without PD', 'feasible region without PD', 'feasible region Mattingly']
methods = [ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun,
ConstrainsAnalysis_Gudmundsson_Method_with_DP_turbofun,
ConstrainsAnalysis_Mattingly_Method_with_DP_electric,
ConstrainsAnalysis_Gudmundsson_Method_with_DP_electric,
ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun,
ConstrainsAnalysis_Gudmundsson_Method_with_DP_turbofun,
ConstrainsAnalysis_Mattingly_Method_with_DP_turbofun,
ConstrainsAnalysis_Gudmundsson_Method_with_DP_turbofun]
subtitle = ["0", "1",'2','3','4','5','6','7']
m = constrains.shape[0]
p_w = np.zeros([m, n, 8])
# plots
fig, ax = plt.subplots(3, 2, sharex=True, figsize=(10, 10))
ax = ax.flatten()
for k in range(8):
for i in range(m):
for j in range(n):
h = constrains[i, 0]
v = constrains[i, 1]
beta = constrains[i, 2]
hp = constrains[i, 3]
# calculate p_w
if k < 4:
problem = methods[k](h, v, beta, w_s[j], hp)
if i >= 5:
p_w[i, j, k] = problem.allFuncs[-1](problem, roc=15 - 5 * (i - 5))
else:
p_w[i, j, k] = problem.allFuncs[i](problem)
elif k > 5:
problem = methods[k](h, v, beta, w_s[j], Hp=0)
if i >= 5:
p_w[i, j, k] = problem.allFuncs[-1](problem, roc=15 - 5 * (i - 5))
else:
p_w[i, j, k] = problem.allFuncs[i](problem)
elif k == 4:
if i == 1:
problem = methods[k](h, v, beta, w_s[j], hp)
p_w[i, j, k] = problem.allFuncs[i](problem)
else:
p_w[i, j, k] = p_w[i, j, 0] + p_w[i, j, 2]
else:
if i == 1:
problem = methods[k](h, v, beta, w_s[j], hp)
p_w[i, j, k] = problem.allFuncs[i](problem)
else:
p_w[i, j, k] = p_w[i, j, 1] + p_w[i, j, 3]
def func(x, a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10):
f = a0 + a1*x + a2*x**2 + a3*x**3 + a4*x**4 + a5 * \
np.sin(x) + a6*np.cos(x) + a7*x**5 + \
a8*x**6 + a9*x**7 + a10*x**8
return f
if k <= 5:
if i == 1:
xdata, ydata = p_w[i, :, k], np.linspace(0, 250, n)
popt, _ = curve_fit(func, xdata, ydata)
p_w[i, :, k] = func(w_s, popt[0], popt[1], popt[2],
popt[3], popt[4], popt[5], popt[6], popt[7], popt[8], popt[9], popt[10])
ax[k].plot(w_s, p_w[i, :, k], color=color[i],
linewidth=1, alpha=0.5, label=constrains_name[i])
else:
ax[k].plot(w_s, p_w[i, :, k], color=color[i],
linewidth=1, alpha=0.5, label=constrains_name[i])
else:
if i == 1:
ax[k-2].plot(p_w[i, :, k], np.linspace(
0, 250, n), color=color[i], linewidth=1, alpha=0.5, linestyle='--')
else:
ax[k-2].plot(w_s, p_w[i, :, k], color=color[i],
linewidth=1, alpha=0.5, linestyle='--')
if k <= 5:
ax[k].fill_between(w_s, np.amax(p_w[0:m, :, k], axis=0),
200, color='b', alpha=0.5, label=constrains_name[-2])
ax[k].set_xlim(200, 9000)
ax[k].grid()
if k <= 3:
ax[k].set_ylim(0, 80)
else:
ax[k].set_ylim(0, 150)
else:
p_w[1, :, k] = 200 / (p_w[1, -1, k] - p_w[1, 20, k]) * (w_s - p_w[1, 2, k])
ax[k-2].fill_between(w_s, np.amax(p_w[0:m, :, k], axis=0),
200, color='r', alpha=0.5, label=constrains_name[-1])
handles, labels = plt.gca().get_legend_handles_labels()
fig.legend(handles, labels, bbox_to_anchor=(0.125, 0.02, 0.75, 0.25), loc="lower left",
mode="expand", borderaxespad=0, ncol=4, frameon=False)
hp = constrains[:, 3]
plt.setp(ax[0].set_title('Mattingly Method'))
plt.setp(ax[1].set_title('Gudmundsson Method'))
plt.setp(ax[4:6], xlabel='Wing Load: $W_{TO}$/S (N/${m^2}$)')
plt.setp(ax[0], ylabel=r'$\bf{Turbofun}$''\n $P_{SL}$/$W_{TO}$ (W/N)')
plt.setp(ax[2], ylabel=r'$\bf{Motor}$ ''\n $P_{SL}$/$W_{TO}$ (W/N)')
plt.setp(ax[4], ylabel=r'$\bf{Turbofun+Motor}$' '\n' r'$\bf{vs.Conventional}$ ''\n $P_{SL}$/$W_{TO}$ (W/N)')
plt.subplots_adjust(bottom=0.15)
plt.suptitle(r'$\bf{Component Power to Loading Diagrams}$''\n (hp: take off=' +
str(hp[0]) + 'stall speed=' +
str(hp[1]) + 'cruise=' +
str(hp[2]) + 'service ceiling='+
str(hp[3]) + 'level turn=')
plt.show()
| [
"[email protected]"
] | |
e22f21d57b4dcbc9dfaa480ff03b9966ff371e2a | 53c35060ba641c399d80ed1daf6d3b1e5c49dab4 | /enso/platform/linux/selection.py | bdda893ac1441b8e74fdab2fdd7c0f13f11bb225 | [
"BSD-2-Clause"
] | permissive | RendijsSmukulis/enso-launcher-continued | c85462a36637a70985938a39c2d3448def8a9af2 | 97b21f4eabbd445c33c6e93c19e7b2a712ea2bca | refs/heads/master | 2021-01-23T03:22:02.651360 | 2017-03-19T03:02:25 | 2017-03-19T03:02:25 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 8,356 | py | """
Author : Guillaume "iXce" Seguin
Email : [email protected]
Copyright (C) 2008, Guillaume Seguin <[email protected]>.
All rights reserved.
Author : Pavel Vitis "blackdaemon"
Email : [email protected]
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of Enso nor the names of its contributors may
be used to endorse or promote products derived from this
software without specific prior written permission.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS
BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
"""
from __future__ import with_statement
from time import clock, time
import Xlib
#import Xlib.ext.xtest
import dbus
import dbus.mainloop.glib
import gtk.gdk
from gio import File # @UnresolvedImport Keep PyLint and PyDev happy
from enso.platform.linux.utils import get_display, get_keycode
from enso.platform.linux.weaklib import DbusWeakCallback
__updated__ = "2017-02-23"
"""
Class to handle Nautilus file-selection notifications in Linux Gnome desktop
"""
class NautilusFileSelection(object):
def __init__(self):
self.paths = []
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
callback = DbusWeakCallback(self._on_selection_change)
# Register signal receiver for SelectionChanged event in Nautilus
# windows
callback.token = dbus.Bus().add_signal_receiver(
callback,
"SelectionChanged",
dbus_interface="se.kaizer.FileSelection",
byte_arrays=True)
def _on_selection_change(self, selection, window_id):
# File selection changed (user clicked on file/directory or selected
# a group of files/directories.
# Update internal variable
self.paths = filter(None, [File(uri).get_path() for uri in selection])
nautilus_file_selection = NautilusFileSelection()
GET_TIMEOUT = 1.5
PASTE_STATE = Xlib.X.ShiftMask
PASTE_KEY = "^V"
def get_clipboard_text_cb(clipboard, text, userdata):
'''Callback for clipboard fetch handling'''
global selection_text
selection_text = text
def get_focused_window(display):
'''Get the currently focussed window'''
input_focus = display.get_input_focus()
window = Xlib.X.NONE
if input_focus is not None and input_focus.focus:
window = input_focus.focus
return window
def make_key(keycode, state, window, display):
'''Build a data dict for a KeyPress/KeyRelease event'''
root = display.screen().root
event_data = {
"time": int(time()),
"root": root,
"window": window,
"same_screen": True,
"child": Xlib.X.NONE,
"root_x": 0,
"root_y": 0,
"event_x": 0,
"event_y": 0,
"state": state,
"detail": keycode,
}
return event_data
def fake_key_up(key, window, display):
'''Fake a keyboard press event'''
event = Xlib.protocol.event.KeyPress( # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
**key) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
window.send_event(event, propagate=True)
display.sync()
def fake_key_down(key, window, display):
'''Fake a keyboard release event'''
event = Xlib.protocol.event.KeyRelease( # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
**key) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
window.send_event(event, propagate=True)
display.sync()
def fake_key_updown(key, window, display):
'''Fake a keyboard press/release events pair'''
fake_key_up(key, window, display)
fake_key_down(key, window, display)
def fake_paste(display=None):
'''Fake a "paste" keyboard event'''
if not display:
display = get_display()
window = get_focused_window(display)
state = PASTE_STATE
k = PASTE_KEY
ctrl = False
if k.startswith("^"):
k = k[1:]
ctrl = True
keycode = get_keycode(key=k, display=display)
key = make_key(keycode, state, window, display)
ctrl_keycode = get_keycode(key="Control_L", display=display)
ctrl_key = make_key(ctrl_keycode, state, window, display)
if ctrl:
Xlib.ext.xtest.fake_input(display, Xlib.X.KeyPress, ctrl_keycode) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
Xlib.ext.xtest.fake_input(display, Xlib.X.KeyPress, keycode) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
Xlib.ext.xtest.fake_input(display, Xlib.X.KeyRelease, keycode) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
Xlib.ext.xtest.fake_input(display, Xlib.X.KeyRelease, ctrl_keycode) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
display.sync()
def fake_ctrl_l(display=None):
'''Fake a "Ctrl+L" keyboard event'''
if not display:
display = get_display()
window = get_focused_window(display)
state = PASTE_STATE
k = "^L"
ctrl = False
if k.startswith("^"):
k = k[1:]
ctrl = True
keycode = get_keycode(key=k, display=display)
key = make_key(keycode, state, window, display)
ctrl_keycode = get_keycode(key="Control_L", display=display)
ctrl_key = make_key(ctrl_keycode, state, window, display)
if ctrl:
Xlib.ext.xtest.fake_input(display, Xlib.X.KeyPress, ctrl_keycode) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
Xlib.ext.xtest.fake_input(display, Xlib.X.KeyPress, keycode) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
Xlib.ext.xtest.fake_input(display, Xlib.X.KeyRelease, keycode) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
if ctrl:
Xlib.ext.xtest.fake_input(display, Xlib.X.KeyRelease, ctrl_keycode) # IGNORE:E1101 @UndefinedVariable Keep PyLint and PyDev happy
display.sync()
def get():
'''Fetch text from X PRIMARY selection'''
global selection_text, nautilus_file_selection
selection_text = None
clipboard = gtk.clipboard_get(gtk.gdk.SELECTION_PRIMARY)
clipboard.request_text(get_clipboard_text_cb)
# Iterate until we actually received something, or we timed out waiting
start = clock()
while not selection_text and (clock() - start) < GET_TIMEOUT:
gtk.main_iteration(False)
if not selection_text:
selection_text = ""
files = []
# Get file list from Nautilus window (if available)
focus = get_focused_window(get_display())
wmclass = focus.get_wm_class()
if wmclass is None: # or wmname is None:
focus = focus.query_tree().parent
wmclass = focus.get_wm_class()
#wmname = focus.get_wm_name()
# print wmclass, wmname
# TODO: Implement file selection from other Linux file managers
if nautilus_file_selection and nautilus_file_selection.paths and wmclass[0] == 'nautilus':
files = nautilus_file_selection.paths
selection = {
"text": selection_text,
"files": files,
}
return selection
def set(seldict): # @ReservedAssignment
'''Paste data into X CLIPBOARD selection'''
if "text" not in seldict:
return False
clipboard = gtk.clipboard_get(selection="CLIPBOARD")
primary = gtk.clipboard_get(selection="PRIMARY")
clipboard.set_text(seldict["text"])
primary.set_text(seldict["text"])
fake_paste()
return True
| [
"[email protected]"
] | |
0785a53b99508b9564fc6135140ca1a59f377301 | 993ef8924418866f932396a58e3ad0c2a940ddd3 | /Production/python/PrivateSamples/EMJ_UL16APV_mMed-1400_mDark-20_kappa-0p16_aligned-down_cff.py | 9b7db73723875f3b194a7d24f0d9f440b2b047af | [] | no_license | TreeMaker/TreeMaker | 48d81f6c95a17828dbb599d29c15137cd6ef009a | 15dd7fe9e9e6f97d9e52614c900c27d200a6c45f | refs/heads/Run2_UL | 2023-07-07T15:04:56.672709 | 2023-07-03T16:43:17 | 2023-07-03T16:43:17 | 29,192,343 | 16 | 92 | null | 2023-07-03T16:43:28 | 2015-01-13T13:59:30 | Python | UTF-8 | Python | false | false | 2,001 | py | import FWCore.ParameterSet.Config as cms
maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )
readFiles = cms.untracked.vstring()
secFiles = cms.untracked.vstring()
source = cms.Source ("PoolSource",fileNames = readFiles, secondaryFileNames = secFiles)
readFiles.extend( [
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-1.root',
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-10.root',
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-2.root',
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-3.root',
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-4.root',
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-5.root',
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-6.root',
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-7.root',
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-8.root',
'root://cmseos.fnal.gov///store/group/lpcsusyhad/ExoEMJAnalysis2020/Signal.Oct.2021/UL16APV/step4_MINIAODv2_mMed-1400_mDark-20_kappa-0p16_aligned-down_n-500_part-9.root',
] )
| [
"[email protected]"
] | |
99d1b2fac8e0f299ee585ed4eebd0b11a45183b3 | 5df9cd8ed8b2ac02606e8f760bb098a85ac40dd6 | /AQI/AQI/spiders/aqi_crawl.py | ecfcf2eed5e27c302ba774c16c202cb361e5750f | [] | no_license | ShaoLay/AQICrawl | 270352d31a41d7b925a4c899642cda21ad12abea | 5abf872fc0495d310514abc029dae799487299e5 | refs/heads/master | 2020-08-14T19:48:56.982460 | 2019-10-23T05:30:24 | 2019-10-23T05:30:24 | 215,224,771 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,669 | py | from scrapy.spiders import CrawlSpider, Rule
from scrapy.linkextractors import LinkExtractor
from AQI.items import AqiItem
class AqiSpider(CrawlSpider):
name = 'aqi_crawl'
allowed_domains = ['aqistudy.cn']
start_urls = ['https://www.aqistudy.cn/historydata/']
rules = (
Rule(LinkExtractor(allow='monthdata\.php')),
Rule(LinkExtractor(allow='daydate\.php'), callback='parse_day', follow=False)
)
def parse_day(self, response):
item = AqiItem()
title = response.xpath('//*[@id="title"]/text()').extract_first()
item['city_name'] = title[8:-11]
# 1. 取出所有 tr_list
tr_list = response.xpath('//tr')
# 2.删除表头
tr_list.pop(0)
for tr in tr_list:
# 日期
item['date'] = tr.xpath('./td[1]/text()').extract_first()
# AQI
item['aqi'] = tr.xpath('./td[2]/text()').extract_first()
# 质量等级
item['level'] = tr.xpath('./td[3]//text()').extract_first()
# PM2.5
item['pm2_5'] = tr.xpath('./td[4]/text()').extract_first()
# PM10
item['pm10'] = tr.xpath('./td[5]/text()').extract_first()
# 二氧化硫
item['so_2'] = tr.xpath('./td[6]/text()').extract_first()
# 一氧化碳
item['co'] = tr.xpath('./td[7]/text()').extract_first()
# 二氧化氮
item['no_2'] = tr.xpath('./td[8]/text()').extract_first()
# 臭氧
item['o_3'] = tr.xpath('./td[9]/text()').extract_first()
# 将数据 -->engine-->pipeline
yield item | [
"[email protected]"
] | |
53b6f8fc41440ab6256d1334cf60ed629b0fce31 | 9381d2a25adac95fab9fc4b8015aadd6c7bed6ca | /ITP1/2_D.py | c35c8e9af2a5a9165517debe9f1a651a661f4d22 | [] | no_license | kazuma104/AOJ | e3ca14bd31167656bcd203d4f92a43fd4045434c | d91cc3313cbfa575928787677e5ed6be63aa8acf | refs/heads/master | 2023-03-20T22:16:22.764351 | 2021-03-18T10:38:08 | 2021-03-18T10:38:08 | 262,047,590 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 141 | py | W,H,x,y,r = map(int, input().split())
if x-r < 0 or y-r < 0:
print("No")
elif x+r > W or y+r > H:
print("No")
else:
print("Yes") | [
"[email protected]"
] | |
1dd0526d70e5ef6e0a57ded59b165fd2f43842fa | 163bbb4e0920dedd5941e3edfb2d8706ba75627d | /Code/CodeRecords/2412/60715/301485.py | 69220007da8305e6488cfa5d20eabb5c5fb9f53a | [] | no_license | AdamZhouSE/pythonHomework | a25c120b03a158d60aaa9fdc5fb203b1bb377a19 | ffc5606817a666aa6241cfab27364326f5c066ff | refs/heads/master | 2022-11-24T08:05:22.122011 | 2020-07-28T16:21:24 | 2020-07-28T16:21:24 | 259,576,640 | 2 | 1 | null | null | null | null | UTF-8 | Python | false | false | 152 | py | n,s=map(int,input().split())
if(n==2 and s==0):
print(0)
elif(n==4 and s==3):
print(-1)
else:
print(1)
print(5)
print("1 4 2 3 5 ") | [
"[email protected]"
] | |
a28da9f95c09fb5f7e3ca5ab6f34efae1ce134b2 | ca7aa979e7059467e158830b76673f5b77a0f5a3 | /Python_codes/p03456/s282790569.py | 9f7fa6c7d4489dd727a1db2d30500f983f65a2ce | [] | no_license | Aasthaengg/IBMdataset | 7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901 | f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8 | refs/heads/main | 2023-04-22T10:22:44.763102 | 2021-05-13T17:27:22 | 2021-05-13T17:27:22 | 367,112,348 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 98 | py | a,b=map(str,input().split())
c=int(a+b)
if (c**(1/2))%1==0:
print('Yes')
else:
print('No') | [
"[email protected]"
] | |
f2229bd1270be63072c3f36c5e4cc704b0eb8c3c | 73ee941896043f9b3e2ab40028d24ddd202f695f | /external/chromium_org/chrome/tools/DEPS | 86737fb82392847aa02de3cf27f22ebea02cf380 | [
"BSD-3-Clause"
] | permissive | CyFI-Lab-Public/RetroScope | d441ea28b33aceeb9888c330a54b033cd7d48b05 | 276b5b03d63f49235db74f2c501057abb9e79d89 | refs/heads/master | 2022-04-08T23:11:44.482107 | 2016-09-22T20:15:43 | 2016-09-22T20:15:43 | 58,890,600 | 5 | 3 | null | null | null | null | UTF-8 | Python | false | false | 185 | include_rules = [
"+breakpad",
"+chrome/browser",
"+chrome/third_party/hunspell/google",
"+chrome/utility/local_discovery",
"+content/browser",
"+content/public/browser",
]
| [
"[email protected]"
] | ||
3836037d938bd2f19011c61605f118cd7ccee3ef | c045416b1f5c5bc4f0fbfa7d64a7cfa5afe1c3a4 | /magentaT/magenta/pipelines/lead_sheet_pipelines.py | 9fd8562fef751fb1354bf91f555c168f3e618ff7 | [
"Apache-2.0"
] | permissive | Tiasa/CreativeComposer | e037055c232dc6b261b4fd7542cab3865e7ec1c4 | b2ea3d1570b367068021726f1858587a0ad4d09f | refs/heads/master | 2021-06-27T06:59:37.351749 | 2020-10-29T21:54:19 | 2020-10-29T21:54:19 | 143,206,847 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,732 | py | # Copyright 2016 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Data processing pipelines for lead sheets."""
from magenta.music import chord_symbols_lib
from magenta.music import events_lib
from magenta.music import lead_sheets_lib
from magenta.pipelines import pipeline
from magenta.pipelines import statistics
from magenta.protobuf import music_pb2
import tensorflow as tf
class LeadSheetExtractor(pipeline.Pipeline):
"""Extracts lead sheet fragments from a quantized NoteSequence."""
def __init__(self, min_bars=7, max_steps=512, min_unique_pitches=5,
gap_bars=1.0, ignore_polyphonic_notes=False, filter_drums=True,
require_chords=True, all_transpositions=True, name=None):
super(LeadSheetExtractor, self).__init__(
input_type=music_pb2.NoteSequence,
output_type=lead_sheets_lib.LeadSheet,
name=name)
self._min_bars = min_bars
self._max_steps = max_steps
self._min_unique_pitches = min_unique_pitches
self._gap_bars = gap_bars
self._ignore_polyphonic_notes = ignore_polyphonic_notes
self._filter_drums = filter_drums
self._require_chords = require_chords
self._all_transpositions = all_transpositions
def transform(self, quantized_sequence):
try:
lead_sheets, stats = lead_sheets_lib.extract_lead_sheet_fragments(
quantized_sequence,
min_bars=self._min_bars,
max_steps_truncate=self._max_steps,
min_unique_pitches=self._min_unique_pitches,
gap_bars=self._gap_bars,
ignore_polyphonic_notes=self._ignore_polyphonic_notes,
filter_drums=self._filter_drums,
require_chords=self._require_chords,
all_transpositions=self._all_transpositions)
except events_lib.NonIntegerStepsPerBarError as detail:
tf.logging.warning('Skipped sequence: %s', detail)
lead_sheets = []
stats = [statistics.Counter('non_integer_steps_per_bar', 1)]
except chord_symbols_lib.ChordSymbolError as detail:
tf.logging.warning('Skipped sequence: %s', detail)
lead_sheets = []
stats = [statistics.Counter('chord_symbol_exception', 1)]
self._set_stats(stats)
return lead_sheets
| [
"[email protected]"
] | |
ad260b2ad0e4ba83bb002b471b76f420bf3405ba | 4be5c172c84e04c35677f5a327ab0ba592849676 | /python/design/queue_using_stacks/queue_using_stacks2.py | 1253bf3342a1290b6fd12967079eda6c6b4ac9b5 | [] | no_license | niranjan-nagaraju/Development | 3a16b547b030182867b7a44ac96a878c14058016 | d193ae12863971ac48a5ec9c0b35bfdf53b473b5 | refs/heads/master | 2023-04-06T20:42:57.882882 | 2023-03-31T18:38:40 | 2023-03-31T18:38:40 | 889,620 | 9 | 2 | null | 2019-05-27T17:00:29 | 2010-09-05T15:58:46 | Python | UTF-8 | Python | false | false | 3,921 | py | '''
Implement a queue using stacks
Approach:
An enqueue-efficient implementation using two stacks
Enqueue is O(1), dequeue is O(n)
Enqueue(x):
Push to S1
Dequeue():
if S2 has elements (they are already in queue-order)
return S2.pop()
Otherwise (S2 is empty)
Push all items from S1 to S2, S2 now has queue order
return S2.pop()
Test runs:
Enqueue(1):
S1: 1
S2:
Enqueue(2):
S1: 2 1
S2:
Enqueue(3):
S1: 3 2 1
S2:
Dequeue(): 1
S1: 3 2 1
S2:
<--
S1:
S2: 1 2 3
<-- x = S2.pop() == 1
S1:
S2: 2 3
Enqueue(4)
S1: 4
S2: 2 3
Enqueue(5)
S1: 5 4
S2: 2 3
Dequeue() : 2
S1: 5 4
S2: 2 3
<-- S2.pop() == 2
S1: 5 4
S2: 3
Dequeue(): 3
S1: 5 4
S2: 3
<-- S2.pop() == 3
S1: 5 4
S2:
Dequeue(): 4
S1: 5 4
S2:
<--
S1:
S2: 4 5
Dequeue(): 5
'''
from data_structures.sll.stack import Stack
class Queue(object):
def __init__(self):
self.s1 = Stack()
self.s2 = Stack()
# There can be newly pushed elements onto S1
# while S2 has earlier elements in queue-order
# Total items in queue would be the sum total in both the stacks
def __len__(self):
return self.s1.size + self.s2.size
#NOTE: front() cannot be implemented efficiently
# if S2 has elements in them, front of the queue would just be S2.top()
# as S2 order is the queue-order
# otherwise, we have items in S1 which are in the reverse-queue-order,
# The bottom of the stack would be the front in this case
def front(self):
if self.s2:
return self.s2.top()
else:
for x in self.s1:
pass
return x
#NOTE: back() cannot be implemented efficiently
# If S1 is empty, tail(S2) (which is in queue order) is the back of the queue
# If S2 has elements in them,
# back of the queue is in S1.top() as that would be where the last item was enqueued
def back(self):
if not self.s1:
for x in self.s2:
pass
return x
else:
return self.s1.top()
def length(self):
return self.s1.size + self.s2.size
# Enqueue is efficient, Just push to S1 and return
def enqueue(self, x):
self.s1.push(x)
# if S2 has items in it, we have atleast one item in actual queue-order, so we can just return S2.pop()
# Otherwise, move everything from S1 into S2, essentially ordering all current items in queue-order, and then return S2.pop()
def dequeue(self):
# Helper function to move all items from stack a to stack b
def move(a, b):
while a:
b.push(a.pop())
# s2 is empty, move everything from s1 to s2 so everything in s1 now
# is stored into s2 in queue-order
if not self.s2:
move(self.s1, self.s2)
# S2 already has elements in queue-order
# or everything in S1 was just moved into S2
# Either ways, Item to dequeue will be in S2 top
return self.s2.pop()
# NOTE: Queue elements is S2: top->bottom followed by S1: bottom->top
def __str__(self):
s1_contents = []
for x in self.s1:
s1_contents.insert(0, str(x))
s2_contents = []
for x in self.s2:
s2_contents.append(str(x))
return '[%d]: ' %(self.__len__()) + ' '.join(s2_contents) + ' ' + ' '.join(s1_contents)
def __repr__(self):
return "{%r , %r}" %(self.s1, self.s2)
# Basic testcases
if __name__ == "__main__":
queue = Queue()
for i in range(1, 4):
queue.enqueue(i)
assert(queue.front() == 1)
assert(queue.back() == i)
assert(queue.length() == 3)
assert(queue.dequeue() == 1)
queue.enqueue(4)
queue.enqueue(5)
assert(str(queue) == "[4]: 2 3 4 5")
assert("%r" %(queue) == "{[2]: 5 4 , [2]: 2 3}")
for i in range(2, 6):
assert(i == queue.dequeue())
assert(len(queue) == (5-i))
q2 = Queue()
q2.enqueue('+')
q2.enqueue('a')
assert('+' == q2.dequeue())
q2.enqueue('b')
assert('a' == q2.dequeue())
assert('b' == q2.dequeue())
q3 = Queue()
q3.enqueue(('a', 1))
q3.enqueue(('b', 2))
assert(q3.dequeue() == ('a',1))
q3.enqueue(('c', 3))
print 'Queue testcases passed'
| [
"[email protected]"
] | |
9ae449345867c9bc92cd38cb3903702d56fb8014 | d7016f69993570a1c55974582cda899ff70907ec | /sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2021_07_01/aio/operations/_iot_hub_operations.py | 3c8aa30ade98d05854c566a78a8b9912ca0c2835 | [
"MIT",
"LicenseRef-scancode-generic-cla",
"LGPL-2.1-or-later"
] | permissive | kurtzeborn/azure-sdk-for-python | 51ca636ad26ca51bc0c9e6865332781787e6f882 | b23e71b289c71f179b9cf9b8c75b1922833a542a | refs/heads/main | 2023-03-21T14:19:50.299852 | 2023-02-15T13:30:47 | 2023-02-15T13:30:47 | 157,927,277 | 0 | 0 | MIT | 2022-07-19T08:05:23 | 2018-11-16T22:15:30 | Python | UTF-8 | Python | false | false | 13,705 | py | # pylint: disable=too-many-lines
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
import sys
from typing import Any, Callable, Dict, IO, Optional, TypeVar, Union, cast, overload
from azure.core.exceptions import (
ClientAuthenticationError,
HttpResponseError,
ResourceExistsError,
ResourceNotFoundError,
ResourceNotModifiedError,
map_error,
)
from azure.core.pipeline import PipelineResponse
from azure.core.pipeline.transport import AsyncHttpResponse
from azure.core.polling import AsyncLROPoller, AsyncNoPolling, AsyncPollingMethod
from azure.core.rest import HttpRequest
from azure.core.tracing.decorator_async import distributed_trace_async
from azure.core.utils import case_insensitive_dict
from azure.mgmt.core.exceptions import ARMErrorFormat
from azure.mgmt.core.polling.async_arm_polling import AsyncARMPolling
from ... import models as _models
from ..._vendor import _convert_request
from ...operations._iot_hub_operations import build_manual_failover_request
if sys.version_info >= (3, 8):
from typing import Literal # pylint: disable=no-name-in-module, ungrouped-imports
else:
from typing_extensions import Literal # type: ignore # pylint: disable=ungrouped-imports
T = TypeVar("T")
ClsType = Optional[Callable[[PipelineResponse[HttpRequest, AsyncHttpResponse], T, Dict[str, Any]], Any]]
class IotHubOperations:
"""
.. warning::
**DO NOT** instantiate this class directly.
Instead, you should access the following operations through
:class:`~azure.mgmt.iothub.v2021_07_01.aio.IotHubClient`'s
:attr:`iot_hub` attribute.
"""
models = _models
def __init__(self, *args, **kwargs) -> None:
input_args = list(args)
self._client = input_args.pop(0) if input_args else kwargs.pop("client")
self._config = input_args.pop(0) if input_args else kwargs.pop("config")
self._serialize = input_args.pop(0) if input_args else kwargs.pop("serializer")
self._deserialize = input_args.pop(0) if input_args else kwargs.pop("deserializer")
async def _manual_failover_initial( # pylint: disable=inconsistent-return-statements
self,
iot_hub_name: str,
resource_group_name: str,
failover_input: Union[_models.FailoverInput, IO],
**kwargs: Any
) -> None:
error_map = {
401: ClientAuthenticationError,
404: ResourceNotFoundError,
409: ResourceExistsError,
304: ResourceNotModifiedError,
}
error_map.update(kwargs.pop("error_map", {}) or {})
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
content_type = content_type or "application/json"
_json = None
_content = None
if isinstance(failover_input, (IO, bytes)):
_content = failover_input
else:
_json = self._serialize.body(failover_input, "FailoverInput")
request = build_manual_failover_request(
iot_hub_name=iot_hub_name,
resource_group_name=resource_group_name,
subscription_id=self._config.subscription_id,
api_version=api_version,
content_type=content_type,
json=_json,
content=_content,
template_url=self._manual_failover_initial.metadata["url"],
headers=_headers,
params=_params,
)
request = _convert_request(request)
request.url = self._client.format_url(request.url)
pipeline_response: PipelineResponse = await self._client._pipeline.run( # pylint: disable=protected-access
request, stream=False, **kwargs
)
response = pipeline_response.http_response
if response.status_code not in [200, 202]:
map_error(status_code=response.status_code, response=response, error_map=error_map)
error = self._deserialize.failsafe_deserialize(_models.ErrorDetails, pipeline_response)
raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)
if cls:
return cls(pipeline_response, None, {})
_manual_failover_initial.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"
}
@overload
async def begin_manual_failover(
self,
iot_hub_name: str,
resource_group_name: str,
failover_input: _models.FailoverInput,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Manually initiate a failover for the IoT Hub to its secondary region.
Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see
https://aka.ms/manualfailover.
:param iot_hub_name: Name of the IoT hub to failover. Required.
:type iot_hub_name: str
:param resource_group_name: Name of the resource group containing the IoT hub resource.
Required.
:type resource_group_name: str
:param failover_input: Region to failover to. Must be the Azure paired region. Get the value
from the secondary location in the locations property. To learn more, see
https://aka.ms/manualfailover/region. Required.
:type failover_input: ~azure.mgmt.iothub.v2021_07_01.models.FailoverInput
:keyword content_type: Body Parameter content-type. Content type parameter for JSON body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@overload
async def begin_manual_failover(
self,
iot_hub_name: str,
resource_group_name: str,
failover_input: IO,
*,
content_type: str = "application/json",
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Manually initiate a failover for the IoT Hub to its secondary region.
Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see
https://aka.ms/manualfailover.
:param iot_hub_name: Name of the IoT hub to failover. Required.
:type iot_hub_name: str
:param resource_group_name: Name of the resource group containing the IoT hub resource.
Required.
:type resource_group_name: str
:param failover_input: Region to failover to. Must be the Azure paired region. Get the value
from the secondary location in the locations property. To learn more, see
https://aka.ms/manualfailover/region. Required.
:type failover_input: IO
:keyword content_type: Body Parameter content-type. Content type parameter for binary body.
Default value is "application/json".
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
@distributed_trace_async
async def begin_manual_failover(
self,
iot_hub_name: str,
resource_group_name: str,
failover_input: Union[_models.FailoverInput, IO],
**kwargs: Any
) -> AsyncLROPoller[None]:
"""Manually initiate a failover for the IoT Hub to its secondary region.
Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see
https://aka.ms/manualfailover.
:param iot_hub_name: Name of the IoT hub to failover. Required.
:type iot_hub_name: str
:param resource_group_name: Name of the resource group containing the IoT hub resource.
Required.
:type resource_group_name: str
:param failover_input: Region to failover to. Must be the Azure paired region. Get the value
from the secondary location in the locations property. To learn more, see
https://aka.ms/manualfailover/region. Is either a FailoverInput type or a IO type. Required.
:type failover_input: ~azure.mgmt.iothub.v2021_07_01.models.FailoverInput or IO
:keyword content_type: Body Parameter content-type. Known values are: 'application/json'.
Default value is None.
:paramtype content_type: str
:keyword callable cls: A custom type or function that will be passed the direct response
:keyword str continuation_token: A continuation token to restart a poller from a saved state.
:keyword polling: By default, your polling method will be AsyncARMPolling. Pass in False for
this operation to not poll, or pass in your own initialized polling object for a personal
polling strategy.
:paramtype polling: bool or ~azure.core.polling.AsyncPollingMethod
:keyword int polling_interval: Default waiting time between two polls for LRO operations if no
Retry-After header is present.
:return: An instance of AsyncLROPoller that returns either None or the result of cls(response)
:rtype: ~azure.core.polling.AsyncLROPoller[None]
:raises ~azure.core.exceptions.HttpResponseError:
"""
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})
api_version: Literal["2021-07-01"] = kwargs.pop("api_version", _params.pop("api-version", "2021-07-01"))
content_type: Optional[str] = kwargs.pop("content_type", _headers.pop("Content-Type", None))
cls: ClsType[None] = kwargs.pop("cls", None)
polling: Union[bool, AsyncPollingMethod] = kwargs.pop("polling", True)
lro_delay = kwargs.pop("polling_interval", self._config.polling_interval)
cont_token: Optional[str] = kwargs.pop("continuation_token", None)
if cont_token is None:
raw_result = await self._manual_failover_initial( # type: ignore
iot_hub_name=iot_hub_name,
resource_group_name=resource_group_name,
failover_input=failover_input,
api_version=api_version,
content_type=content_type,
cls=lambda x, y, z: x,
headers=_headers,
params=_params,
**kwargs
)
kwargs.pop("error_map", None)
def get_long_running_output(pipeline_response): # pylint: disable=inconsistent-return-statements
if cls:
return cls(pipeline_response, None, {})
if polling is True:
polling_method: AsyncPollingMethod = cast(AsyncPollingMethod, AsyncARMPolling(lro_delay, **kwargs))
elif polling is False:
polling_method = cast(AsyncPollingMethod, AsyncNoPolling())
else:
polling_method = polling
if cont_token:
return AsyncLROPoller.from_continuation_token(
polling_method=polling_method,
continuation_token=cont_token,
client=self._client,
deserialization_callback=get_long_running_output,
)
return AsyncLROPoller(self._client, raw_result, get_long_running_output, polling_method) # type: ignore
begin_manual_failover.metadata = {
"url": "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Devices/IotHubs/{iotHubName}/failover"
}
| [
"[email protected]"
] | |
9ca63456aabc1b850ca2345a6625a7699eae6610 | 71d4fafdf7261a7da96404f294feed13f6c771a0 | /mainwebsiteenv/lib/python2.7/site-packages/psycopg2/tests/test_bug_gc.py | fcad0f599090b4ba1dabca0b3a0599da294da7c6 | [] | no_license | avravikiran/mainwebsite | 53f80108caf6fb536ba598967d417395aa2d9604 | 65bb5e85618aed89bfc1ee2719bd86d0ba0c8acd | refs/heads/master | 2021-09-17T02:26:09.689217 | 2018-06-26T16:09:57 | 2018-06-26T16:09:57 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,773 | py | #!/usr/bin/env python
# bug_gc.py - test for refcounting/GC bug
#
# Copyright (C) 2010-2011 Federico Di Gregorio <[email protected]>
#
# psycopg2 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 3 of the License, or
# (at your option) any later version.
#
# In addition, as a special exception, the copyright holders give
# permission to link this program with the OpenSSL library (or with
# modified versions of OpenSSL that use the same license as OpenSSL),
# and distribute linked combinations including the two.
#
# You must obey the GNU Lesser General Public License in all respects for
# all of the code used other than OpenSSL.
#
# psycopg2 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.
import psycopg2
import psycopg2.extensions
import unittest
import gc
from testutils import ConnectingTestCase, skip_if_no_uuid
class StolenReferenceTestCase(ConnectingTestCase):
@skip_if_no_uuid
def test_stolen_reference_bug(self):
def fish(val, cur):
gc.collect()
return 42
UUID = psycopg2.extensions.new_type((2950,), "UUID", fish)
psycopg2.extensions.register_type(UUID, self.conn)
curs = self.conn.cursor()
curs.execute("select 'b5219e01-19ab-4994-b71e-149225dc51e4'::uuid")
curs.fetchone()
def test_suite():
return unittest.TestLoader().loadTestsFromName(__name__)
if __name__ == "__main__":
unittest.main()
| [
"[email protected]"
] | |
0c4c6b2d2404135d8229d93244b95ea8ac0bf89f | 870599f68f29701f6dc0c9911183ee1127a0e8f1 | /attend/util.py | de85823500fe59f84b6604edb5067152ca94ff88 | [] | no_license | rubenvereecken/attend | dc8168df8fde45421ed1f02a8dc519fc07b836ee | d5fedeec589956ba86c11a93709ad2c7d4f01fcf | refs/heads/master | 2021-03-27T20:50:00.543071 | 2017-09-29T09:42:16 | 2017-09-29T09:42:16 | 95,661,311 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,130 | py | import inspect
import numpy as np
import attend
import time
from functools import partial
# parse_timestamp = partial(time.strptime, format=attend.TIMESTAMP_FORMAT)
parse_timestamp = lambda x: time.strptime(x, attend.TIMESTAMP_FORMAT)
def pick(dic, l):
'''
Pick from dictionary all the keys present in a list of keywords
After the spirit of Lodash pick
'''
return { k: v for k, v in dic.items() if k in l }
def params_for(fun):
return list(inspect.signature(fun).parameters)
def call_with(fun, d):
return fun(**pick(d, params_for(fun)))
def init_with(cls, d, *args, **kwargs):
return cls(*args, **pick(d, params_for(cls.__init__)), **kwargs)
def notify(title, text='', duration=5000):
import subprocess as s
s.call(['notify-send', title, text])
import contextlib
@contextlib.contextmanager
def noop():
yield None
def pad(x, pad_width, axis=0):
padding = [[0, 0] for _ in range(x.ndim)]
padding[axis][1] = pad_width
return np.pad(x, padding, mode='constant')
def pad_and_stack(arrays, length=None, axis=0):
if length is None:
length = max(v.shape[0] for v in arrays)
def _padding(v):
padding = np.zeros([len(v.shape), 2], dtype=int)
assert length >= v.shape[axis]
padding[axis][1] = length - v.shape[axis]
return padding
return np.stack(np.pad(v, _padding(v), 'constant') for v in arrays)
def unstack_and_unpad(arrays, lengths):
return [arr[:lengths[i]] for i, arr in enumerate(arrays)]
def dict_to_args(d):
arg_list = []
for k, v in d.items():
if v is None:
# Don't pass None values, just 'none' values
continue
# s = 'none'
elif isinstance(v, bool):
s = str(int(v)) # Boolean is represented 0 or 1
elif isinstance(v, list):
# s = ' '.join(el for el in v)
s = ' '.join('--{}={}'.format(k, el) for el in v)
arg_list.append(s)
continue
else:
s = str(v)
s = '--{}={}'.format(k, s)
arg_list.append(s)
return ' '.join(arg_list)
| [
"[email protected]"
] | |
12ff517076961d3280a395ff8024086c0c6154b7 | 56fd2d92b8327cfb7d8f95b89c52e1700343b726 | /odin/utilities/mixins/strategy_mixins/features_mixins.py | 78f57281f4bf3ad86d7fe2d11595c0fc2708bdf0 | [
"MIT"
] | permissive | stjordanis/Odin | fecb640ccf4f2e6eb139389d25cbe37da334cdb6 | e2e9d638c68947d24f1260d35a3527dd84c2523f | refs/heads/master | 2020-04-15T09:13:17.850126 | 2017-02-09T00:25:55 | 2017-02-09T00:25:55 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 538 | py | import pandas as pd
from ....strategy import AbstractStrategy
class DefaultFeaturesMixin(AbstractStrategy):
"""Default Features Mixin Class
This just creates an empty dataframe containing as the index the symbols
available on each day of trading and no columns.
"""
def generate_features(self):
"""Implementation of abstract base class method."""
symbols = self.portfolio.data_handler.bars.ix[
"adj_price_close", -1, :
].dropna().index
return pd.DataFrame(index=symbols)
| [
"[email protected]"
] | |
4bdb997b1a9edc8482e96a303102a09e4fd12614 | 7d5b51afb991787f3b373c3b931a06a5bbd1deaa | /Dynamic Programming/2011.py | f0bbda3160a48b68c40316799b97402cad79f969 | [] | no_license | inkyu0103/BOJ | cb7549855702ba7a744d9121d12f5d327469acd6 | 0d889b9cc36a95e8e802d22a7b0ec87dbf80b193 | refs/heads/master | 2023-09-02T05:32:50.704738 | 2023-08-24T08:07:12 | 2023-08-24T08:07:12 | 247,743,620 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 364 | py | # 2011 암호코드
import sys
input = sys.stdin.readline
arr = [0] + list(map(int, list(input().rstrip())))
N = len(arr)
dp = [0] * N
dp[0] = 1
mod = 1000000
for i in range(1, N):
if arr[i]:
dp[i] = (dp[i - 1] + dp[i]) % mod
case = arr[i - 1] * 10 + arr[i]
if 10 <= case <= 26:
dp[i] = (dp[i - 2] + dp[i]) % mod
print(dp[N - 1])
| [
"[email protected]"
] | |
ab0c84236e64680d0eb83c624708d4e489ad1ee3 | 45c170fb0673deece06f3055979ece25c3210380 | /toontown/quest_original/Quests.py | 20f49852427f51699e790a85a9d4c0ef7d327c72 | [] | no_license | MTTPAM/PublicRelease | 5a479f5f696cfe9f2d9dcd96f378b5ce160ec93f | 825f562d5021c65d40115d64523bb850feff6a98 | refs/heads/master | 2021-07-24T09:48:32.607518 | 2018-11-13T03:17:53 | 2018-11-13T03:17:53 | 119,129,731 | 2 | 6 | null | 2018-11-07T22:10:10 | 2018-01-27T03:43:39 | Python | UTF-8 | Python | false | false | 176,321 | py | #Embedded file name: toontown.quest.Quests
from otp.otpbase import OTPGlobals
from toontown.toonbase import ToontownBattleGlobals
from toontown.toonbase import ToontownGlobals
from toontown.battle import SuitBattleGlobals
from toontown.coghq import CogDisguiseGlobals
import random
from toontown.toon import NPCToons
import copy, string
from toontown.hood import ZoneUtil
from direct.directnotify import DirectNotifyGlobal
from toontown.toonbase import TTLocalizer
from toontown.toonbase import ToonPythonUtil as PythonUtil
import time, types, random
notify = DirectNotifyGlobal.directNotify.newCategory('Quests')
ItemDict = TTLocalizer.QuestsItemDict
CompleteString = TTLocalizer.QuestsCompleteString
NotChosenString = TTLocalizer.QuestsNotChosenString
DefaultGreeting = TTLocalizer.QuestsDefaultGreeting
DefaultIncomplete = TTLocalizer.QuestsDefaultIncomplete
DefaultIncompleteProgress = TTLocalizer.QuestsDefaultIncompleteProgress
DefaultIncompleteWrongNPC = TTLocalizer.QuestsDefaultIncompleteWrongNPC
DefaultComplete = TTLocalizer.QuestsDefaultComplete
DefaultLeaving = TTLocalizer.QuestsDefaultLeaving
DefaultReject = TTLocalizer.QuestsDefaultReject
DefaultTierNotDone = TTLocalizer.QuestsDefaultTierNotDone
DefaultQuest = TTLocalizer.QuestsDefaultQuest
DefaultVisitQuestDialog = TTLocalizer.QuestsDefaultVisitQuestDialog
GREETING = 0
QUEST = 1
INCOMPLETE = 2
INCOMPLETE_PROGRESS = 3
INCOMPLETE_WRONG_NPC = 4
COMPLETE = 5
LEAVING = 6
Any = 1
OBSOLETE = 'OBSOLETE'
Start = 1
Cont = 0
Anywhere = 1
NA = 2
Same = 3
AnyFish = 4
AnyCashbotSuitPart = 5
AnyLawbotSuitPart = 6
AnyBossbotSuitPart = 7
ToonTailor = 999
ToonHQ = 1000
QuestDictRequiredQuestsIndex = 0
QuestDictStartIndex = 1
QuestDictDescIndex = 2
QuestDictFromNpcIndex = 3
QuestDictToNpcIndex = 4
QuestDictRewardIndex = 5
QuestDictNextQuestIndex = 6
QuestDictDialogIndex = 7
QuestDictExperienceIndex = 8
QuestDictMoneyIndex = 9
VeryEasy = 100
ModeratelyEasy = 80
Easy = 75
Medium = 50
Hard = 25
VeryHard = 20
TT_TIER = 0
DD_TIER = 4
DG_TIER = 7
AA_TIER = 8
MM_TIER = 11
BR_TIER = 14
DL_TIER = 17
ELDER_TIER = 20
LOOPING_FINAL_TIER = 20
VISIT_QUEST_ID = 1000
TROLLEY_QUEST_ID = 110
FIRST_COG_QUEST_ID = 145
NEWBIE_HP = 25
SELLBOT_HQ_NEWBIE_HP = 50
CASHBOT_HQ_NEWBIE_HP = 85
from toontown.toonbase.ToontownGlobals import FT_FullSuit, FT_Leg, FT_Arm, FT_Torso
QuestRandGen = random.Random()
def seedRandomGen(npcId, avId, tier, rewardHistory):
QuestRandGen.seed(npcId * 100 + avId + tier + len(rewardHistory))
def seededRandomChoice(seq):
return QuestRandGen.choice(seq)
def getCompleteStatusWithNpc(questComplete, toNpcId, npc):
if questComplete:
if npc:
if npcMatches(toNpcId, npc):
return COMPLETE
else:
return INCOMPLETE_WRONG_NPC
else:
return COMPLETE
elif npc:
if npcMatches(toNpcId, npc):
return INCOMPLETE_PROGRESS
else:
return INCOMPLETE
else:
return INCOMPLETE
def npcMatches(toNpcId, npc):
return toNpcId == npc.getNpcId() or toNpcId == Any or toNpcId == ToonHQ and npc.getHq() or toNpcId == ToonTailor and npc.getTailor()
def calcRecoverChance(numberNotDone, baseChance, cap = 1):
chance = baseChance
avgNum2Kill = 1.0 / (chance / 100.0)
if numberNotDone >= avgNum2Kill * 1.5 and cap:
chance = 1000
elif numberNotDone > avgNum2Kill * 0.5:
diff = float(numberNotDone - avgNum2Kill * 0.5)
luck = 1.0 + abs(diff / (avgNum2Kill * 0.5))
chance *= luck
return chance
def simulateRecoveryVar(numNeeded, baseChance, list = 0, cap = 1):
numHave = 0
numTries = 0
greatestFailChain = 0
currentFail = 0
capHits = 0
attemptList = {}
while numHave < numNeeded:
numTries += 1
chance = calcRecoverChance(currentFail, baseChance, cap)
test = random.random() * 100
if chance == 1000:
capHits += 1
if test < chance:
numHave += 1
if currentFail > greatestFailChain:
greatestFailChain = currentFail
if attemptList.get(currentFail):
attemptList[currentFail] += 1
else:
attemptList[currentFail] = 1
currentFail = 0
else:
currentFail += 1
print 'Test results: %s tries, %s longest failure chain, %s cap hits' % (numTries, greatestFailChain, capHits)
if list:
print 'failures for each succes %s' % attemptList
def simulateRecoveryFix(numNeeded, baseChance, list = 0):
numHave = 0
numTries = 0
greatestFailChain = 0
currentFail = 0
attemptList = {}
while numHave < numNeeded:
numTries += 1
chance = baseChance
test = random.random() * 100
if test < chance:
numHave += 1
if currentFail > greatestFailChain:
greatestFailChain = currentFail
if attemptList.get(currentFail):
attemptList[currentFail] += 1
else:
attemptList[currentFail] = 1
currentFail = 0
else:
currentFail += 1
print 'Test results: %s tries, %s longest failure chain' % (numTries, greatestFailChain)
if list:
print 'failures for each succes %s' % attemptList
class Quest:
_cogTracks = [Any,
'c',
'l',
'm',
's',
'g']
_factoryTypes = [Any,
FT_FullSuit,
FT_Leg,
FT_Arm,
FT_Torso]
def check(self, cond, msg):
pass
def checkLocation(self, location):
locations = [Anywhere] + TTLocalizer.GlobalStreetNames.keys()
self.check(location in locations, 'invalid location: %s' % location)
def checkNumCogs(self, num):
self.check(1, 'invalid number of cogs: %s' % num)
def checkNewbieLevel(self, level):
self.check(1, 'invalid newbie level: %s' % level)
def checkCogType(self, type):
types = [Any] + SuitBattleGlobals.SuitAttributes.keys()
self.check(type in types, 'invalid cog type: %s' % type)
def checkCogTrack(self, track):
self.check(track in self._cogTracks, 'invalid cog track: %s' % track)
def checkCogLevel(self, level):
self.check(level >= 1 and level <= 12, 'invalid cog level: %s' % level)
def checkNumSkelecogs(self, num):
self.check(1, 'invalid number of cogs: %s' % num)
def checkSkelecogTrack(self, track):
self.check(track in self._cogTracks, 'invalid cog track: %s' % track)
def checkSkelecogLevel(self, level):
self.check(level >= 1 and level <= 12, 'invalid cog level: %s' % level)
def checkNumSkeleRevives(self, num):
self.check(1, 'invalid number of cogs: %s' % num)
def checkNumForemen(self, num):
self.check(num > 0, 'invalid number of foremen: %s' % num)
def checkNumVPs(self, num):
self.check(num > 0, 'invalid number of VPs: %s' % num)
def checkNumSupervisors(self, num):
self.check(num > 0, 'invalid number of supervisors: %s' % num)
def checkNumCFOs(self, num):
self.check(num > 0, 'invalid number of CFOs: %s' % num)
def checkNumCJs(self, num):
self.check(num > 0, 'invalid number of CJs: %s' % num)
def checkNumCEOs(self, num):
self.check(num > 0, 'invalid number of CEOs: %s' % num)
def checkNumBuildings(self, num):
self.check(1, 'invalid num buildings: %s' % num)
def checkBuildingTrack(self, track):
self.check(track in self._cogTracks, 'invalid building track: %s' % track)
def checkBuildingFloors(self, floors):
self.check(floors >= 1 and floors <= 6, 'invalid num floors: %s' % floors)
def checkNumCogdos(self, num):
self.check(1, 'invalid num buildings: %s' % num)
def checkCogdoTrack(self, track):
self.check(track in self._cogTracks, 'invalid building track: %s' % track)
def checkNumFactories(self, num):
self.check(1, 'invalid num factories: %s' % num)
def checkFactoryType(self, type):
self.check(type in self._factoryTypes, 'invalid factory type: %s' % type)
def checkNumMints(self, num):
self.check(1, 'invalid num mints: %s' % num)
def checkNumStages(self, num):
self.check(1, 'invalid num mints: %s' % num)
def checkNumClubs(self, num):
self.check(1, 'invalid num mints: %s' % num)
def checkNumCogParts(self, num):
self.check(1, 'invalid num cog parts: %s' % num)
def checkNumGags(self, num):
self.check(1, 'invalid num gags: %s' % num)
def checkGagTrack(self, track):
self.check(track >= ToontownBattleGlobals.MIN_TRACK_INDEX and track <= ToontownBattleGlobals.MAX_TRACK_INDEX, 'invalid gag track: %s' % track)
def checkExperienceAmount(self, num):
self.check(num > 0, 'invalid track experience amount: %s' % num)
def checkGagItem(self, item):
self.check(item >= ToontownBattleGlobals.MIN_LEVEL_INDEX and item <= ToontownBattleGlobals.MAX_LEVEL_INDEX, 'invalid gag item: %s' % item)
def checkDeliveryItem(self, item):
self.check(ItemDict.has_key(item), 'invalid delivery item: %s' % item)
def checkNumItems(self, num):
self.check(1, 'invalid num items: %s' % num)
def checkRecoveryItem(self, item):
self.check(ItemDict.has_key(item), 'invalid recovery item: %s' % item)
def checkPercentChance(self, chance):
self.check(chance > 0 and chance <= 100, 'invalid percent chance: %s' % chance)
def checkRecoveryItemHolderAndType(self, holder, holderType = 'type'):
holderTypes = ['type', 'level', 'track']
self.check(holderType in holderTypes, 'invalid recovery item holderType: %s' % holderType)
if holderType == 'type':
holders = [Any, AnyFish] + SuitBattleGlobals.SuitAttributes.keys()
self.check(holder in holders, 'invalid recovery item holder: %s for holderType: %s' % (holder, holderType))
elif holderType == 'level':
pass
elif holderType == 'track':
self.check(holder in self._cogTracks, 'invalid recovery item holder: %s for holderType: %s' % (holder, holderType))
def checkTrackChoice(self, option):
self.check(option >= ToontownBattleGlobals.MIN_TRACK_INDEX and option <= ToontownBattleGlobals.MAX_TRACK_INDEX, 'invalid track option: %s' % option)
def checkNumFriends(self, num):
self.check(1, 'invalid number of friends: %s' % num)
def checkNumMinigames(self, num):
self.check(1, 'invalid number of minigames: %s' % num)
def filterFunc(avatar):
return 1
filterFunc = staticmethod(filterFunc)
def __init__(self, id, quest):
self.id = id
self.quest = quest
def getId(self):
return self.id
def getType(self):
return self.__class__
def getObjectiveStrings(self):
return ['']
def getString(self):
return self.getObjectiveStrings()[0]
def getRewardString(self, progressString):
return self.getString() + ' : ' + progressString
def getChooseString(self):
return self.getString()
def getPosterString(self):
return self.getString()
def getHeadlineString(self):
return self.getString()
def getDefaultQuestDialog(self):
return self.getString() + TTLocalizer.Period
def getNumQuestItems(self):
return -1
def addArticle(self, num, oString):
if len(oString) == 0:
return oString
elif num == 1:
return oString
else:
return '%d %s' % (num, oString)
def __repr__(self):
return 'Quest type: %s id: %s params: %s' % (self.__class__.__name__, self.id, self.quest[0:])
def doesCogCount(self, avId, cogDict, zoneId, avList):
return 0
def doesVPCount(self, avId, cogDict, zoneId, avList):
return 0
def doesCFOCount(self, avId, cogDict, zoneId, avList):
return 0
def doesCJCount(self, avId, cogDict, zoneId, avList):
return 0
def doesCEOCount(self, avId, cogDict, zoneId, avList):
return 0
def doesFactoryCount(self, avId, location, avList):
return 0
def doesMintCount(self, avId, location, avList):
return 0
def doesCogPartCount(self, avId, location, avList):
return 0
def getCompletionStatus(self, av, questDesc, npc = None):
notify.error('Pure virtual - please override me')
class LocationBasedQuest(Quest):
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
self.checkLocation(self.quest[0])
def getLocation(self):
return self.quest[0]
def getLocationName(self):
loc = self.getLocation()
if loc == Anywhere:
locName = ''
elif loc in ToontownGlobals.hoodNameMap:
locName = TTLocalizer.QuestInLocationString % {'inPhrase': ToontownGlobals.hoodNameMap[loc][1],
'location': ToontownGlobals.hoodNameMap[loc][-1] + TTLocalizer.QuestsLocationArticle}
elif loc in ToontownGlobals.StreetBranchZones:
locName = TTLocalizer.QuestInLocationString % {'inPhrase': ToontownGlobals.StreetNames[loc][1],
'location': ToontownGlobals.StreetNames[loc][-1] + TTLocalizer.QuestsLocationArticle}
return locName
def isLocationMatch(self, zoneId):
loc = self.getLocation()
if loc is Anywhere:
return 1
if ZoneUtil.isPlayground(loc):
if loc == ZoneUtil.getCanonicalHoodId(zoneId):
return 1
else:
return 0
else:
if loc == ZoneUtil.getCanonicalBranchZone(zoneId):
return 1
if loc == zoneId:
return 1
return 0
def getChooseString(self):
return TTLocalizer.QuestsLocationString % {'string': self.getString(),
'location': self.getLocationName()}
def getPosterString(self):
return TTLocalizer.QuestsLocationString % {'string': self.getString(),
'location': self.getLocationName()}
def getDefaultQuestDialog(self):
return (TTLocalizer.QuestsLocationString + TTLocalizer.Period) % {'string': self.getString(),
'location': self.getLocationName()}
class NewbieQuest:
def getNewbieLevel(self):
notify.error('Pure virtual - please override me')
def getString(self, newStr = TTLocalizer.QuestsCogNewNewbieQuestObjective, oldStr = TTLocalizer.QuestsCogOldNewbieQuestObjective):
laff = self.getNewbieLevel()
if laff <= NEWBIE_HP:
return newStr % self.getObjectiveStrings()[0]
else:
return oldStr % {'laffPoints': laff,
'objective': self.getObjectiveStrings()[0]}
def getCaption(self):
laff = self.getNewbieLevel()
if laff <= NEWBIE_HP:
return TTLocalizer.QuestsCogNewNewbieQuestCaption % laff
else:
return TTLocalizer.QuestsCogOldNewbieQuestCaption % laff
def getNumNewbies(self, avId, avList):
newbieHp = self.getNewbieLevel()
num = 0
for av in avList:
if av != avId and av.getMaxHp() <= newbieHp:
num += 1
return num
class CogQuest(LocationBasedQuest):
def __init__(self, id, quest):
LocationBasedQuest.__init__(self, id, quest)
if self.__class__ == CogQuest:
self.checkNumCogs(self.quest[1])
self.checkCogType(self.quest[2])
def getCogType(self):
return self.quest[2]
def getNumQuestItems(self):
return self.getNumCogs()
def getNumCogs(self):
return self.quest[1]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumCogs()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumCogs() == 1:
return ''
else:
return TTLocalizer.QuestsCogQuestProgress % {'progress': questDesc[4],
'numCogs': self.getNumCogs()}
def getCogNameString(self):
numCogs = self.getNumCogs()
cogType = self.getCogType()
if numCogs == 1:
if cogType == Any:
return TTLocalizer.Cog
else:
return SuitBattleGlobals.SuitAttributes[cogType]['singularname']
else:
if cogType == Any:
return TTLocalizer.Cogs
return SuitBattleGlobals.SuitAttributes[cogType]['pluralname']
def getObjectiveStrings(self):
cogName = self.getCogNameString()
numCogs = self.getNumCogs()
if numCogs == 1:
text = cogName
else:
text = TTLocalizer.QuestsCogQuestDefeatDesc % {'numCogs': numCogs,
'cogName': cogName}
return (text,)
def getString(self):
return TTLocalizer.QuestsCogQuestDefeat % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumCogs():
return getFinishToonTaskSCStrings(toNpcId)
cogName = self.getCogNameString()
numCogs = self.getNumCogs()
if numCogs == 1:
text = TTLocalizer.QuestsCogQuestSCStringS
else:
text = TTLocalizer.QuestsCogQuestSCStringP
cogLoc = self.getLocationName()
return text % {'cogName': cogName,
'cogLoc': cogLoc}
def getHeadlineString(self):
return TTLocalizer.QuestsCogQuestHeadline
def doesCogCount(self, avId, cogDict, zoneId, avList):
questCogType = self.getCogType()
return (questCogType is Any or questCogType is cogDict['type']) and avId in cogDict['activeToons'] and self.isLocationMatch(zoneId)
class CogNewbieQuest(CogQuest, NewbieQuest):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
if self.__class__ == CogNewbieQuest:
self.checkNumCogs(self.quest[1])
self.checkCogType(self.quest[2])
self.checkNewbieLevel(self.quest[3])
def getNewbieLevel(self):
return self.quest[3]
def getString(self):
return NewbieQuest.getString(self)
def doesCogCount(self, avId, cogDict, zoneId, avList):
if CogQuest.doesCogCount(self, avId, cogDict, zoneId, avList):
return self.getNumNewbies(avId, avList)
else:
return 0
class TrackExpQuest(LocationBasedQuest):
def __init__(self, id, quest):
LocationBasedQuest.__init__(self, id, quest)
if self.__class__ == TrackExpQuest:
self.checkGagTrack(self.quest[1])
self.checkExperienceAmount(self.quest[2])
def getTrackType(self):
return self.quest[1]
def getNumQuestItems(self):
return self.getNumExp()
def getNumExp(self):
return self.quest[2]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumExp()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumExp() == 1:
return ''
else:
return TTLocalizer.QuestsExpQuestProgress % {'progress': questDesc[4],
'numExp': self.getNumExp()}
def getObjectiveStrings(self):
trackName = self.getTrackType()
numExp = self.getNumExp()
if numExp == 1:
text = trackName
else:
text = TTLocalizer.QuestsExpQuestCollectDesc % {'track': TTLocalizer.BattleGlobalTracks[trackName],
'experience': numExp}
return (text,)
def getString(self):
trackName = self.getTrackType()
numExp = self.getNumExp()
return TTLocalizer.QuestsExpQuestCollect % {'experience': numExp,
'track': TTLocalizer.BattleGlobalTracks[trackName]}
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumExp():
return getFinishToonTaskSCStrings(toNpcId)
trackName = self.getTrackType()
numExp = self.getNumExp()
if numExp == 1:
text = TTLocalizer.QuestsExpQuestSCStringS
else:
text = TTLocalizer.QuestsExpQuestSCStringP
return text % {'track': TTLocalizer.BattleGlobalTracks[trackName],
'experience': numExp}
def getHeadlineString(self):
return TTLocalizer.QuestsExpQuestHeadline
def doesExpCount(self, avId, expArray):
trackType = self.getTrackType()
return expArray[trackType] > 0
class CogTrackQuest(CogQuest):
trackCodes = ['c',
'l',
'm',
's',
'g']
trackNamesS = [TTLocalizer.BossbotS,
TTLocalizer.LawbotS,
TTLocalizer.CashbotS,
TTLocalizer.SellbotS,
TTLocalizer.BoardbotS]
trackNamesP = [TTLocalizer.BossbotP,
TTLocalizer.LawbotP,
TTLocalizer.CashbotP,
TTLocalizer.SellbotP,
TTLocalizer.BoardbotP]
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
if self.__class__ == CogTrackQuest:
self.checkNumCogs(self.quest[1])
self.checkCogTrack(self.quest[2])
def getCogTrack(self):
return self.quest[2]
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumCogs() == 1:
return ''
else:
return TTLocalizer.QuestsCogTrackQuestProgress % {'progress': questDesc[4],
'numCogs': self.getNumCogs()}
def getObjectiveStrings(self):
numCogs = self.getNumCogs()
track = self.trackCodes.index(self.getCogTrack())
if numCogs == 1:
text = self.trackNamesS[track]
else:
text = TTLocalizer.QuestsCogTrackDefeatDesc % {'numCogs': numCogs,
'trackName': self.trackNamesP[track]}
return (text,)
def getString(self):
return TTLocalizer.QuestsCogTrackQuestDefeat % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumCogs():
return getFinishToonTaskSCStrings(toNpcId)
numCogs = self.getNumCogs()
track = self.trackCodes.index(self.getCogTrack())
if numCogs == 1:
cogText = self.trackNamesS[track]
text = TTLocalizer.QuestsCogTrackQuestSCStringS
else:
cogText = self.trackNamesP[track]
text = TTLocalizer.QuestsCogTrackQuestSCStringP
cogLocName = self.getLocationName()
return text % {'cogText': cogText,
'cogLoc': cogLocName}
def getHeadlineString(self):
return TTLocalizer.QuestsCogTrackQuestHeadline
def doesCogCount(self, avId, cogDict, zoneId, avList):
questCogTrack = self.getCogTrack()
return questCogTrack == cogDict['track'] and avId in cogDict['activeToons'] and self.isLocationMatch(zoneId)
class CogLevelQuest(CogQuest):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumCogs(self.quest[1])
self.checkCogLevel(self.quest[2])
def getCogType(self):
try:
return self.quest[3]
except:
return Any
def getCogLevel(self):
return self.quest[2]
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumCogs() == 1:
return ''
else:
return TTLocalizer.QuestsCogLevelQuestProgress % {'progress': questDesc[4],
'numCogs': self.getNumCogs()}
def getObjectiveStrings(self):
count = self.getNumCogs()
level = self.getCogLevel()
name = self.getCogNameString()
if count == 1:
text = TTLocalizer.QuestsCogLevelQuestDesc
else:
text = TTLocalizer.QuestsCogLevelQuestDescC
return (text % {'count': count,
'level': level,
'name': name},)
def getString(self):
return TTLocalizer.QuestsCogLevelQuestDefeat % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumCogs():
return getFinishToonTaskSCStrings(toNpcId)
count = self.getNumCogs()
level = self.getCogLevel()
name = self.getCogNameString()
if count == 1:
text = TTLocalizer.QuestsCogLevelQuestDesc
else:
text = TTLocalizer.QuestsCogLevelQuestDescI
objective = text % {'level': level,
'name': name}
location = self.getLocationName()
return TTLocalizer.QuestsCogLevelQuestSCString % {'objective': objective,
'location': location}
def getHeadlineString(self):
return TTLocalizer.QuestsCogLevelQuestHeadline
def doesCogCount(self, avId, cogDict, zoneId, avList):
questCogLevel = self.getCogLevel()
return questCogLevel <= cogDict['level'] and avId in cogDict['activeToons'] and self.isLocationMatch(zoneId)
class CogTrackLevelQuest(CogQuest):
trackCodes = ['c',
'l',
'm',
's',
'g']
trackNamesS = [TTLocalizer.BossbotS,
TTLocalizer.LawbotS,
TTLocalizer.CashbotS,
TTLocalizer.SellbotS,
TTLocalizer.BoardbotS]
trackNamesP = [TTLocalizer.BossbotP,
TTLocalizer.LawbotP,
TTLocalizer.CashbotP,
TTLocalizer.SellbotP,
TTLocalizer.BoardbotP]
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
if self.__class__ == CogTrackQuest:
self.checkNumCogs(self.quest[1])
self.checkCogTrack(self.quest[2])
self.checkCogLevel(self.quest[3])
def getCogTrack(self):
return self.quest[2]
def getCogLevel(self):
return self.quest[3]
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumCogs() == 1:
return ''
else:
return TTLocalizer.QuestsCogTrackQuestProgress % {'progress': questDesc[4],
'numCogs': self.getNumCogs()}
def getObjectiveStrings(self):
numCogs = self.getNumCogs()
level = self.getCogLevel()
track = self.trackCodes.index(self.getCogTrack())
if numCogs == 1:
text = TTLocalizer.QuestsCogLevelQuestDesc % {'level': level,
'name': self.trackNamesS[track]}
else:
text = TTLocalizer.QuestsCogLevelQuestDescC % {'count': numCogs,
'level': level,
'name': self.trackNamesP[track]}
return (text,)
def getString(self):
return TTLocalizer.QuestsCogLevelQuestDefeat % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumCogs():
return getFinishToonTaskSCStrings(toNpcId)
count = self.getNumCogs()
level = self.getCogLevel()
track = self.trackCodes.index(self.getCogTrack())
if count == 1:
text = TTLocalizer.QuestsCogLevelQuestDesc
else:
text = TTLocalizer.QuestsCogLevelQuestDescI
objective = text % {'level': level,
'name': self.trackNamesP[track]}
location = self.getLocationName()
return TTLocalizer.QuestsCogLevelQuestSCString % {'objective': objective,
'location': location}
def getHeadlineString(self):
return TTLocalizer.QuestsCogTrackQuestHeadline
def doesCogCount(self, avId, cogDict, zoneId, avList):
questCogTrack = self.getCogTrack()
questCogLevel = self.getCogLevel()
return questCogTrack == cogDict['track'] and questCogLevel <= cogDict['level'] and avId in cogDict['activeToons'] and self.isLocationMatch(zoneId)
class SkelecogQBase:
def getCogNameString(self):
numCogs = self.getNumCogs()
if numCogs == 1:
return TTLocalizer.ASkeleton
else:
return TTLocalizer.SkeletonP
def doesCogCount(self, avId, cogDict, zoneId, avList):
return cogDict['isSkelecog'] and avId in cogDict['activeToons'] and self.isLocationMatch(zoneId)
class SkelecogQuest(CogQuest, SkelecogQBase):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumSkelecogs(self.quest[1])
def getCogType(self):
return Any
def getCogNameString(self):
return SkelecogQBase.getCogNameString(self)
def doesCogCount(self, avId, cogDict, zoneId, avList):
return SkelecogQBase.doesCogCount(self, avId, cogDict, zoneId, avList)
class SkelecogNewbieQuest(SkelecogQuest, NewbieQuest):
def __init__(self, id, quest):
SkelecogQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def doesCogCount(self, avId, cogDict, zoneId, avList):
if SkelecogQuest.doesCogCount(self, avId, cogDict, zoneId, avList):
return self.getNumNewbies(avId, avList)
else:
return 0
class SkelecogTrackQuest(CogTrackQuest, SkelecogQBase):
trackNamesS = [TTLocalizer.BossbotSkelS,
TTLocalizer.LawbotSkelS,
TTLocalizer.CashbotSkelS,
TTLocalizer.SellbotSkelS,
TTLocalizer.BoardbotSkelS]
trackNamesP = [TTLocalizer.BossbotSkelP,
TTLocalizer.LawbotSkelP,
TTLocalizer.CashbotSkelP,
TTLocalizer.SellbotSkelP,
TTLocalizer.BoardbotSkelP]
def __init__(self, id, quest):
CogTrackQuest.__init__(self, id, quest)
self.checkNumSkelecogs(self.quest[1])
self.checkSkelecogTrack(self.quest[2])
def getCogNameString(self):
return SkelecogQBase.getCogNameString(self)
def doesCogCount(self, avId, cogDict, zoneId, avList):
return SkelecogQBase.doesCogCount(self, avId, cogDict, zoneId, avList) and self.getCogTrack() == cogDict['track']
class SkelecogLevelQuest(CogLevelQuest, SkelecogQBase):
def __init__(self, id, quest):
CogLevelQuest.__init__(self, id, quest)
self.checkNumSkelecogs(self.quest[1])
self.checkSkelecogLevel(self.quest[2])
def getCogType(self):
return Any
def getCogNameString(self):
return SkelecogQBase.getCogNameString(self)
def doesCogCount(self, avId, cogDict, zoneId, avList):
return SkelecogQBase.doesCogCount(self, avId, cogDict, zoneId, avList) and self.getCogLevel() <= cogDict['level']
class SkeleReviveQBase:
def getCogNameString(self):
numCogs = self.getNumCogs()
if numCogs == 1:
return TTLocalizer.Av2Cog
else:
return TTLocalizer.v2CogP
def doesCogCount(self, avId, cogDict, zoneId, avList):
return cogDict.get('hasRevives', False) and avId in cogDict.get('activeToons', []) and self.isLocationMatch(zoneId)
class SkeleReviveQuest(CogQuest, SkeleReviveQBase):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumSkeleRevives(self.quest[1])
def getCogType(self):
return Any
def getCogNameString(self):
return SkeleReviveQBase.getCogNameString(self)
def doesCogCount(self, avId, cogDict, zoneId, avList):
return SkeleReviveQBase.doesCogCount(self, avId, cogDict, zoneId, avList)
class ForemanQuest(CogQuest):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumForemen(self.quest[1])
def getCogType(self):
return Any
def getCogNameString(self):
numCogs = self.getNumCogs()
if numCogs == 1:
return TTLocalizer.AForeman
else:
return TTLocalizer.ForemanP
def doesCogCount(self, avId, cogDict, zoneId, avList):
return bool(CogQuest.doesCogCount(self, avId, cogDict, zoneId, avList) and cogDict['isForeman'])
class ForemanNewbieQuest(ForemanQuest, NewbieQuest):
def __init__(self, id, quest):
ForemanQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def doesCogCount(self, avId, cogDict, zoneId, avList):
if ForemanQuest.doesCogCount(self, avId, cogDict, zoneId, avList):
return self.getNumNewbies(avId, avList)
else:
return 0
class VPQuest(CogQuest):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumVPs(self.quest[1])
def getCogType(self):
return Any
def getCogNameString(self):
numCogs = self.getNumCogs()
if numCogs == 1:
return TTLocalizer.ACogVP
else:
return TTLocalizer.CogVPs
def doesCogCount(self, avId, cogDict, zoneId, avList):
return cogDict['isBoss'] > 0 and self.isLocationMatch(zoneId)
def doesVPCount(self, avId, cogDict, zoneId, avList):
return self.doesCogCount(avId, cogDict, zoneId, avList)
class VPNewbieQuest(VPQuest, NewbieQuest):
def __init__(self, id, quest):
VPQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def doesVPCount(self, avId, cogDict, zoneId, avList):
if VPQuest.doesVPCount(self, avId, cogDict, zoneId, avList):
return self.getNumNewbies(avId, avList)
else:
return 0
class SupervisorQuest(CogQuest):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumSupervisors(self.quest[1])
def getCogType(self):
return Any
def getCogNameString(self):
numCogs = self.getNumCogs()
if numCogs == 1:
return TTLocalizer.ASupervisor
else:
return TTLocalizer.SupervisorP
def doesCogCount(self, avId, cogDict, zoneId, avList):
return bool(CogQuest.doesCogCount(self, avId, cogDict, zoneId, avList) and cogDict['isSupervisor'])
class SupervisorNewbieQuest(SupervisorQuest, NewbieQuest):
def __init__(self, id, quest):
SupervisorQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def doesCogCount(self, avId, cogDict, zoneId, avList):
if SupervisorQuest.doesCogCount(self, avId, cogDict, zoneId, avList):
return self.getNumNewbies(avId, avList)
else:
return 0
class CFOQuest(CogQuest):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumCFOs(self.quest[1])
def getCogType(self):
return Any
def getCogNameString(self):
numCogs = self.getNumCogs()
if numCogs == 1:
return TTLocalizer.ACogCFO
else:
return TTLocalizer.CogCFOs
def doesCogCount(self, avId, cogDict, zoneId, avList):
return cogDict['isBoss'] > 0 and self.isLocationMatch(zoneId)
def doesCFOCount(self, avId, cogDict, zoneId, avList):
return self.doesCogCount(avId, cogDict, zoneId, avList)
class CFONewbieQuest(CFOQuest, NewbieQuest):
def __init__(self, id, quest):
CFOQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def doesCFOCount(self, avId, cogDict, zoneId, avList):
if CFOQuest.doesCFOCount(self, avId, cogDict, zoneId, avList):
return self.getNumNewbies(avId, avList)
else:
return 0
class CJQuest(CogQuest):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumCJs(self.quest[1])
def getCogType(self):
return Any
def getCogNameString(self):
numCogs = self.getNumCogs()
if numCogs == 1:
return TTLocalizer.ACogCJ
else:
return TTLocalizer.CogCJs
def doesCogCount(self, avId, cogDict, zoneId, avList):
return cogDict['isBoss'] > 0 and self.isLocationMatch(zoneId)
def doesCJCount(self, avId, cogDict, zoneId, avList):
return self.doesCogCount(avId, cogDict, zoneId, avList)
class CJNewbieQuest(CJQuest, NewbieQuest):
def __init__(self, id, quest):
CJQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def doesCJCount(self, avId, cogDict, zoneId, avList):
if CJQuest.doesCJCount(self, avId, cogDict, zoneId, avList):
return self.getNumNewbies(avId, avList)
else:
return 0
class CEOQuest(CogQuest):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumCEOs(self.quest[1])
def getCogType(self):
return Any
def getCogNameString(self):
numCogs = self.getNumCogs()
if numCogs == 1:
return TTLocalizer.ACogCEO
else:
return TTLocalizer.CogCEOs
def doesCogCount(self, avId, cogDict, zoneId, avList):
return cogDict['isBoss'] > 0 and self.isLocationMatch(zoneId)
def doesCEOCount(self, avId, cogDict, zoneId, avList):
return self.doesCogCount(avId, cogDict, zoneId, avList)
class CEONewbieQuest(CEOQuest, NewbieQuest):
def __init__(self, id, quest):
CEOQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def doesCEOCount(self, avId, cogDict, zoneId, avList):
if CEOQuest.doesCEOCount(self, avId, cogDict, zoneId, avList):
return self.getNumNewbies(avId, avList)
else:
return 0
class RescueQuest(VPQuest):
def __init__(self, id, quest):
VPQuest.__init__(self, id, quest)
def getNumToons(self):
return self.getNumCogs()
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumToons() == 1:
return ''
else:
return TTLocalizer.QuestsRescueQuestProgress % {'progress': questDesc[4],
'numToons': self.getNumToons()}
def getObjectiveStrings(self):
numToons = self.getNumCogs()
if numToons == 1:
text = TTLocalizer.QuestsRescueQuestToonS
else:
text = TTLocalizer.QuestsRescueQuestRescueDesc % {'numToons': numToons}
return (text,)
def getString(self):
return TTLocalizer.QuestsRescueQuestRescue % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumToons():
return getFinishToonTaskSCStrings(toNpcId)
numToons = self.getNumToons()
if numToons == 1:
text = TTLocalizer.QuestsRescueQuestSCStringS
else:
text = TTLocalizer.QuestsRescueQuestSCStringP
toonLoc = self.getLocationName()
return text % {'toonLoc': toonLoc}
def getHeadlineString(self):
return TTLocalizer.QuestsRescueQuestHeadline
class RescueNewbieQuest(RescueQuest, NewbieQuest):
def __init__(self, id, quest):
RescueQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self, newStr=TTLocalizer.QuestsRescueNewNewbieQuestObjective, oldStr=TTLocalizer.QuestsRescueOldNewbieQuestObjective)
def doesVPCount(self, avId, cogDict, zoneId, avList):
if RescueQuest.doesVPCount(self, avId, cogDict, zoneId, avList):
return self.getNumNewbies(avId, avList)
else:
return 0
class BuildingQuest(CogQuest):
trackCodes = ['c',
'l',
'm',
's',
'g']
trackNames = [TTLocalizer.Bossbot,
TTLocalizer.Lawbot,
TTLocalizer.Cashbot,
TTLocalizer.Sellbot,
TTLocalizer.Boardbot]
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumBuildings(self.quest[1])
self.checkBuildingTrack(self.quest[2])
self.checkBuildingFloors(self.quest[3])
def getNumFloors(self):
return self.quest[3]
def getBuildingTrack(self):
return self.quest[2]
def getNumQuestItems(self):
return self.getNumBuildings()
def getNumBuildings(self):
return self.quest[1]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumBuildings()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumBuildings() == 1:
return ''
else:
return TTLocalizer.QuestsBuildingQuestProgressString % {'progress': questDesc[4],
'num': self.getNumBuildings()}
def getObjectiveStrings(self):
count = self.getNumBuildings()
floors = TTLocalizer.QuestsBuildingQuestFloorNumbers[self.getNumFloors() - 1]
buildingTrack = self.getBuildingTrack()
if buildingTrack == Any:
type = TTLocalizer.Cog
else:
type = self.trackNames[self.trackCodes.index(buildingTrack)]
if count == 1:
if floors == '':
text = TTLocalizer.QuestsBuildingQuestDesc
else:
text = TTLocalizer.QuestsBuildingQuestDescF
elif floors == '':
text = TTLocalizer.QuestsBuildingQuestDescC
else:
text = TTLocalizer.QuestsBuildingQuestDescCF
return (text % {'count': count,
'floors': floors,
'type': type},)
def getString(self):
return TTLocalizer.QuestsBuildingQuestString % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumBuildings():
return getFinishToonTaskSCStrings(toNpcId)
count = self.getNumBuildings()
floors = TTLocalizer.QuestsBuildingQuestFloorNumbers[self.getNumFloors() - 1]
buildingTrack = self.getBuildingTrack()
if buildingTrack == Any:
type = TTLocalizer.Cog
else:
type = self.trackNames[self.trackCodes.index(buildingTrack)]
if count == 1:
if floors == '':
text = TTLocalizer.QuestsBuildingQuestDesc
else:
text = TTLocalizer.QuestsBuildingQuestDescF
elif floors == '':
text = TTLocalizer.QuestsBuildingQuestDescI
else:
text = TTLocalizer.QuestsBuildingQuestDescIF
objective = text % {'floors': floors,
'type': type}
location = self.getLocationName()
return TTLocalizer.QuestsBuildingQuestSCString % {'objective': objective,
'location': location}
def getHeadlineString(self):
return TTLocalizer.QuestsBuildingQuestHeadline
def doesCogCount(self, avId, cogDict, zoneId, avList):
return 0
def doesBuildingTypeCount(self, type):
buildingTrack = self.getBuildingTrack()
if buildingTrack == Any or buildingTrack == type:
return True
return False
def doesBuildingCount(self, avId, avList):
return 1
class BuildingNewbieQuest(BuildingQuest, NewbieQuest):
def __init__(self, id, quest):
BuildingQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[4])
def getNewbieLevel(self):
return self.quest[4]
def getString(self):
return NewbieQuest.getString(self)
def getHeadlineString(self):
return TTLocalizer.QuestsNewbieQuestHeadline
def doesBuildingCount(self, avId, avList):
return self.getNumNewbies(avId, avList)
class CogdoQuest(CogQuest):
trackCodes = ['c',
'l',
'm',
's',
'g']
trackNames = [TTLocalizer.Bossbot,
TTLocalizer.Lawbot,
TTLocalizer.Cashbot,
TTLocalizer.Sellbot,
TTLocalizer.Boardbot]
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumCogdos(self.quest[1])
self.checkCogdoTrack(self.quest[2])
def getCogdoTrack(self):
return self.quest[2]
def getNumQuestItems(self):
return self.getNumCogdos()
def getNumCogdos(self):
return self.quest[1]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumCogdos()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumCogdos() == 1:
return ''
else:
return TTLocalizer.QuestsCogdoQuestProgressString % {'progress': questDesc[4],
'num': self.getNumCogdos()}
def getObjectiveStrings(self):
count = self.getNumCogdos()
buildingTrack = self.getCogdoTrack()
if buildingTrack == Any:
type = TTLocalizer.Cog
else:
type = self.trackNames[self.trackCodes.index(buildingTrack)]
if count == 1:
text = TTLocalizer.QuestsCogdoQuestDesc
else:
text = TTLocalizer.QuestsCogdoQuestDescC
return (text % {'count': count,
'type': type},)
def getString(self):
return TTLocalizer.QuestsCogdoQuestString % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumCogdos():
return getFinishToonTaskSCStrings(toNpcId)
count = self.getNumCogdos()
buildingTrack = self.getCogdoTrack()
if buildingTrack == Any:
type = TTLocalizer.Cog
else:
type = self.trackNames[self.trackCodes.index(buildingTrack)]
if count == 1:
text = TTLocalizer.QuestsCogdoQuestDesc
else:
text = TTLocalizer.QuestsCogdoQuestDescI
objective = text % {'type': type}
location = self.getLocationName()
return TTLocalizer.QuestsCogdoQuestSCString % {'objective': objective,
'location': location}
def getHeadlineString(self):
return TTLocalizer.QuestsCogdoQuestHeadline
def doesCogCount(self, avId, cogDict, zoneId, avList):
return 0
def doesCogdoCount(self, avId, avList):
return 1
def doesCogdoTypeCount(self, type):
CogdoTrack = self.getCogdoTrack()
if CogdoTrack == Any or CogdoTrack == type:
return True
return False
class CogdoNewbieQuest(CogdoQuest, NewbieQuest):
def __init__(self, id, quest):
CogdoQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[3])
def getNewbieLevel(self):
return self.quest[3]
def getString(self):
return NewbieQuest.getString(self)
def getHeadlineString(self):
return TTLocalizer.QuestsNewbieQuestHeadline
def doesCogdoCount(self, avId, avList):
return self.getNumNewbies(avId, avList)
class FactoryQuest(LocationBasedQuest):
factoryTypeNames = {FT_FullSuit: TTLocalizer.Cog,
FT_Leg: TTLocalizer.FactoryTypeLeg,
FT_Arm: TTLocalizer.FactoryTypeArm,
FT_Torso: TTLocalizer.FactoryTypeTorso}
def __init__(self, id, quest):
LocationBasedQuest.__init__(self, id, quest)
self.checkNumFactories(self.quest[1])
def getNumQuestItems(self):
return self.getNumFactories()
def getNumFactories(self):
return self.quest[1]
def getFactoryType(self):
loc = self.getLocation()
type = Any
if loc in ToontownGlobals.factoryId2factoryType:
type = ToontownGlobals.factoryId2factoryType[loc]
return type
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumFactories()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumFactories() == 1:
return ''
else:
return TTLocalizer.QuestsFactoryQuestProgressString % {'progress': questDesc[4],
'num': self.getNumFactories()}
def getObjectiveStrings(self):
count = self.getNumFactories()
factoryType = self.getFactoryType()
if factoryType == Any:
type = TTLocalizer.Cog
else:
type = FactoryQuest.factoryTypeNames[factoryType]
if count == 1:
text = TTLocalizer.QuestsFactoryQuestDesc
else:
text = TTLocalizer.QuestsFactoryQuestDescC
return (text % {'count': count,
'type': type},)
def getString(self):
return TTLocalizer.QuestsFactoryQuestString % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumFactories():
return getFinishToonTaskSCStrings(toNpcId)
factoryType = self.getFactoryType()
if factoryType == Any:
type = TTLocalizer.Cog
else:
type = FactoryQuest.factoryTypeNames[factoryType]
count = self.getNumFactories()
if count == 1:
text = TTLocalizer.QuestsFactoryQuestDesc
else:
text = TTLocalizer.QuestsFactoryQuestDescI
objective = text % {'type': type}
location = self.getLocationName()
return TTLocalizer.QuestsFactoryQuestSCString % {'objective': objective,
'location': location}
def getHeadlineString(self):
return TTLocalizer.QuestsFactoryQuestHeadline
def doesFactoryCount(self, avId, location, avList):
return self.isLocationMatch(location)
class FactoryNewbieQuest(FactoryQuest, NewbieQuest):
def __init__(self, id, quest):
FactoryQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def getHeadlineString(self):
return TTLocalizer.QuestsNewbieQuestHeadline
def doesFactoryCount(self, avId, location, avList):
if FactoryQuest.doesFactoryCount(self, avId, location, avList):
return self.getNumNewbies(avId, avList)
else:
return num
class MintQuest(LocationBasedQuest):
def __init__(self, id, quest):
LocationBasedQuest.__init__(self, id, quest)
self.checkNumMints(self.quest[1])
def getNumQuestItems(self):
return self.getNumMints()
def getNumMints(self):
return self.quest[1]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumMints()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumMints() == 1:
return ''
else:
return TTLocalizer.QuestsMintQuestProgressString % {'progress': questDesc[4],
'num': self.getNumMints()}
def getObjectiveStrings(self):
count = self.getNumMints()
if count == 1:
text = TTLocalizer.QuestsMintQuestDesc
else:
text = TTLocalizer.QuestsMintQuestDescC % {'count': count}
return (text,)
def getString(self):
return TTLocalizer.QuestsMintQuestString % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumMints():
return getFinishToonTaskSCStrings(toNpcId)
count = self.getNumMints()
if count == 1:
objective = TTLocalizer.QuestsMintQuestDesc
else:
objective = TTLocalizer.QuestsMintQuestDescI
location = self.getLocationName()
return TTLocalizer.QuestsMintQuestSCString % {'objective': objective,
'location': location}
def getHeadlineString(self):
return TTLocalizer.QuestsMintQuestHeadline
def doesMintCount(self, avId, location, avList):
return self.isLocationMatch(location)
class MintNewbieQuest(MintQuest, NewbieQuest):
def __init__(self, id, quest):
MintQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def getHeadlineString(self):
return TTLocalizer.QuestsNewbieQuestHeadline
def doesMintCount(self, avId, location, avList):
if MintQuest.doesMintCount(self, avId, location, avList):
return self.getNumNewbies(avId, avList)
else:
return num
class StageQuest(LocationBasedQuest):
def __init__(self, id, quest):
LocationBasedQuest.__init__(self, id, quest)
self.checkNumStages(self.quest[1])
def getNumQuestItems(self):
return self.getNumStages()
def getNumStages(self):
return self.quest[1]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumStages()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumStages() == 1:
return ''
else:
return TTLocalizer.QuestsStageQuestProgressString % {'progress': questDesc[4],
'num': self.getNumStages()}
def getObjectiveStrings(self):
count = self.getNumStages()
if count == 1:
text = TTLocalizer.QuestsStageQuestDesc
else:
text = TTLocalizer.QuestsStageQuestDescC % {'count': count}
return (text,)
def getString(self):
return TTLocalizer.QuestsStageQuestString % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumStages():
return getFinishToonTaskSCStrings(toNpcId)
count = self.getNumStages()
if count == 1:
objective = TTLocalizer.QuestsStageQuestDesc
else:
objective = TTLocalizer.QuestsStageQuestDescI
location = self.getLocationName()
return TTLocalizer.QuestsStageQuestSCString % {'objective': objective,
'location': location}
def getHeadlineString(self):
return TTLocalizer.QuestsStageQuestHeadline
def doesStageCount(self, avId, location, avList):
return self.isLocationMatch(location)
class StageNewbieQuest(StageQuest, NewbieQuest):
def __init__(self, id, quest):
StageQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def getHeadlineString(self):
return TTLocalizer.QuestsNewbieQuestHeadline
def doesStageCount(self, avId, location, avList):
if StageQuest.doesStageCount(self, avId, location, avList):
return self.getNumNewbies(avId, avList)
else:
return num
class ClubQuest(LocationBasedQuest):
def __init__(self, id, quest):
LocationBasedQuest.__init__(self, id, quest)
self.checkNumClubs(self.quest[1])
def getNumQuestItems(self):
return self.getNumClubs()
def getNumClubs(self):
return self.quest[1]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumClubs()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumClubs() == 1:
return ''
else:
return TTLocalizer.QuestsClubQuestProgressString % {'progress': questDesc[4],
'num': self.getNumClubs()}
def getObjectiveStrings(self):
count = self.getNumClubs()
if count == 1:
text = TTLocalizer.QuestsClubQuestDesc
else:
text = TTLocalizer.QuestsClubQuestDescC % {'count': count}
return (text,)
def getString(self):
return TTLocalizer.QuestsClubQuestString % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumClubs():
return getFinishToonTaskSCStrings(toNpcId)
count = self.getNumClubs()
if count == 1:
objective = TTLocalizer.QuestsClubQuestDesc
else:
objective = TTLocalizer.QuestsClubQuestDescI
location = self.getLocationName()
return TTLocalizer.QuestsClubQuestSCString % {'objective': objective,
'location': location}
def getHeadlineString(self):
return TTLocalizer.QuestsClubQuestHeadline
def doesClubCount(self, avId, location, avList):
return self.isLocationMatch(location)
class ClubNewbieQuest(ClubQuest, NewbieQuest):
def __init__(self, id, quest):
ClubQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self)
def getHeadlineString(self):
return TTLocalizer.QuestsNewbieQuestHeadline
def doesClubCount(self, avId, location, avList):
if ClubQuest.doesClubCount(self, avId, location, avList):
return self.getNumNewbies(avId, avList)
else:
return num
class CogPartQuest(LocationBasedQuest):
def __init__(self, id, quest):
LocationBasedQuest.__init__(self, id, quest)
self.checkNumCogParts(self.quest[1])
def getNumQuestItems(self):
return self.getNumParts()
def getNumParts(self):
return self.quest[1]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumParts()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumParts() == 1:
return ''
else:
return TTLocalizer.QuestsCogPartQuestProgressString % {'progress': questDesc[4],
'num': self.getNumParts()}
def getObjectiveStrings(self):
count = self.getNumParts()
if count == 1:
text = TTLocalizer.QuestsCogPartQuestDesc
else:
text = TTLocalizer.QuestsCogPartQuestDescC
return (text % {'count': count},)
def getString(self):
return TTLocalizer.QuestsCogPartQuestString % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumParts():
return getFinishToonTaskSCStrings(toNpcId)
count = self.getNumParts()
if count == 1:
text = TTLocalizer.QuestsCogPartQuestDesc
else:
text = TTLocalizer.QuestsCogPartQuestDescI
objective = text
location = self.getLocationName()
return TTLocalizer.QuestsCogPartQuestSCString % {'objective': objective,
'location': location}
def getHeadlineString(self):
return TTLocalizer.QuestsCogPartQuestHeadline
def doesCogPartCount(self, avId, location, avList):
return self.isLocationMatch(location)
class CogPartNewbieQuest(CogPartQuest, NewbieQuest):
def __init__(self, id, quest):
CogPartQuest.__init__(self, id, quest)
self.checkNewbieLevel(self.quest[2])
def getNewbieLevel(self):
return self.quest[2]
def getString(self):
return NewbieQuest.getString(self, newStr=TTLocalizer.QuestsCogPartNewNewbieQuestObjective, oldStr=TTLocalizer.QuestsCogPartOldNewbieQuestObjective)
def getHeadlineString(self):
return TTLocalizer.QuestsNewbieQuestHeadline
def doesCogPartCount(self, avId, location, avList):
if CogPartQuest.doesCogPartCount(self, avId, location, avList):
return self.getNumNewbies(avId, avList)
else:
return num
class DeliverGagQuest(Quest):
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
self.checkNumGags(self.quest[0])
self.checkGagTrack(self.quest[1])
self.checkGagItem(self.quest[2])
def getGagType(self):
return (self.quest[1], self.quest[2])
def getNumQuestItems(self):
return self.getNumGags()
def getNumGags(self):
return self.quest[0]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
gag = self.getGagType()
num = self.getNumGags()
track = gag[0]
level = gag[1]
questComplete = npc and av.inventory and av.inventory.numItem(track, level) >= num
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumGags() == 1:
return ''
else:
return TTLocalizer.QuestsDeliverGagQuestProgress % {'progress': questDesc[4],
'numGags': self.getNumGags()}
def getObjectiveStrings(self):
track, item = self.getGagType()
num = self.getNumGags()
if num == 1:
text = ToontownBattleGlobals.AvPropStringsSingular[track][item]
else:
gagName = ToontownBattleGlobals.AvPropStringsPlural[track][item]
text = TTLocalizer.QuestsItemNameAndNum % {'num': TTLocalizer.getLocalNum(num),
'name': gagName}
return (text,)
def getString(self):
return TTLocalizer.QuestsDeliverGagQuestString % self.getObjectiveStrings()[0]
def getRewardString(self, progress):
return TTLocalizer.QuestsDeliverGagQuestStringLong % self.getObjectiveStrings()[0]
def getDefaultQuestDialog(self):
return TTLocalizer.QuestsDeliverGagQuestStringLong % self.getObjectiveStrings()[0] + '\x07' + TTLocalizer.QuestsDeliverGagQuestInstructions
def getSCStrings(self, toNpcId, progress):
if progress >= self.getNumGags():
return getFinishToonTaskSCStrings(toNpcId)
track, item = self.getGagType()
num = self.getNumGags()
if num == 1:
text = TTLocalizer.QuestsDeliverGagQuestToSCStringS
gagName = ToontownBattleGlobals.AvPropStringsSingular[track][item]
else:
text = TTLocalizer.QuestsDeliverGagQuestToSCStringP
gagName = ToontownBattleGlobals.AvPropStringsPlural[track][item]
return [text % {'gagName': gagName}, TTLocalizer.QuestsDeliverGagQuestSCString] + getVisitSCStrings(toNpcId)
def getHeadlineString(self):
return TTLocalizer.QuestsDeliverGagQuestHeadline
class DeliverItemQuest(Quest):
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
self.checkDeliveryItem(self.quest[0])
def getItem(self):
return self.quest[0]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
if npc and npcMatches(toNpcId, npc):
return COMPLETE
else:
return INCOMPLETE_WRONG_NPC
def getProgressString(self, avatar, questDesc):
return TTLocalizer.QuestsDeliverItemQuestProgress
def getObjectiveStrings(self):
iDict = ItemDict[self.getItem()]
article = iDict[2]
itemName = iDict[0]
return [article + itemName]
def getString(self):
return TTLocalizer.QuestsDeliverItemQuestString % self.getObjectiveStrings()[0]
def getRewardString(self, progress):
return TTLocalizer.QuestsDeliverItemQuestStringLong % self.getObjectiveStrings()[0]
def getDefaultQuestDialog(self):
return TTLocalizer.QuestsDeliverItemQuestStringLong % self.getObjectiveStrings()[0]
def getSCStrings(self, toNpcId, progress):
iDict = ItemDict[self.getItem()]
article = iDict[2]
itemName = iDict[0]
return [TTLocalizer.QuestsDeliverItemQuestSCString % {'article': article,
'itemName': itemName}] + getVisitSCStrings(toNpcId)
def getHeadlineString(self):
return TTLocalizer.QuestsDeliverItemQuestHeadline
class VisitQuest(Quest):
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
if npc and npcMatches(toNpcId, npc):
return COMPLETE
else:
return INCOMPLETE_WRONG_NPC
def getProgressString(self, avatar, questDesc):
return TTLocalizer.QuestsVisitQuestProgress
def getObjectiveStrings(self):
return ['']
def getString(self):
return TTLocalizer.QuestsVisitQuestStringShort
def getChooseString(self):
return TTLocalizer.QuestsVisitQuestStringLong
def getRewardString(self, progress):
return TTLocalizer.QuestsVisitQuestStringLong
def getDefaultQuestDialog(self):
return random.choice(DefaultVisitQuestDialog)
def getSCStrings(self, toNpcId, progress):
return getVisitSCStrings(toNpcId)
def getHeadlineString(self):
return TTLocalizer.QuestsVisitQuestHeadline
class RecoverItemQuest(LocationBasedQuest):
def __init__(self, id, quest):
LocationBasedQuest.__init__(self, id, quest)
self.checkNumItems(self.quest[1])
self.checkRecoveryItem(self.quest[2])
self.checkPercentChance(self.quest[3])
if len(self.quest) > 5:
self.checkRecoveryItemHolderAndType(self.quest[4], self.quest[5])
else:
self.checkRecoveryItemHolderAndType(self.quest[4])
def testRecover(self, progress):
test = random.random() * 100
chance = self.getPercentChance()
numberDone = progress & pow(2, 16) - 1
numberNotDone = progress >> 16
returnTest = None
avgNum2Kill = 1.0 / (chance / 100.0)
if numberNotDone >= avgNum2Kill * 1.5:
chance = 100
elif numberNotDone > avgNum2Kill * 0.5:
diff = float(numberNotDone - avgNum2Kill * 0.5)
luck = 1.0 + abs(diff / (avgNum2Kill * 0.5))
chance *= luck
if test <= chance:
returnTest = 1
numberNotDone = 0
numberDone += 1
else:
returnTest = 0
numberNotDone += 1
numberDone += 0
returnCount = numberNotDone << 16
returnCount += numberDone
return (returnTest, returnCount)
def testDone(self, progress):
numberDone = progress & pow(2, 16) - 1
print 'Quest number done %s' % numberDone
if numberDone >= self.getNumItems():
return 1
else:
return 0
def getNumQuestItems(self):
return self.getNumItems()
def getNumItems(self):
return self.quest[1]
def getItem(self):
return self.quest[2]
def getPercentChance(self):
return self.quest[3]
def getHolder(self):
return self.quest[4]
def getHolderType(self):
if len(self.quest) == 5:
return 'type'
else:
return self.quest[5]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
forwardProgress = toonProgress & pow(2, 16) - 1
questComplete = forwardProgress >= self.getNumItems()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumItems() == 1:
return ''
else:
progress = questDesc[4] & pow(2, 16) - 1
return TTLocalizer.QuestsRecoverItemQuestProgress % {'progress': progress,
'numItems': self.getNumItems()}
def getObjectiveStrings(self):
holder = self.getHolder()
holderType = self.getHolderType()
if holder == Any:
holderName = TTLocalizer.TheCogs
elif holder == AnyFish:
holderName = TTLocalizer.AFish
elif holderType == 'type':
holderName = SuitBattleGlobals.SuitAttributes[holder]['pluralname']
elif holderType == 'level':
holderName = TTLocalizer.QuestsRecoverItemQuestHolderString % {'level': TTLocalizer.Level,
'holder': holder,
'cogs': TTLocalizer.Cogs}
elif holderType == 'track':
if holder == 'c':
holderName = TTLocalizer.BossbotP
elif holder == 's':
holderName = TTLocalizer.SellbotP
elif holder == 'm':
holderName = TTLocalizer.CashbotP
elif holder == 'l':
holderName = TTLocalizer.LawbotP
elif holder == 'g':
holderName = TTLocalizer.BoardbotP
elif not holder:
print 'WHY THE HELL IS THERE NO HOLDER BARKS'
return [itemName, 'BARKS FRICKING FIX']
item = self.getItem()
num = self.getNumItems()
if num == 1:
itemName = ItemDict[item][2] + ItemDict[item][0]
else:
itemName = TTLocalizer.QuestsItemNameAndNum % {'num': TTLocalizer.getLocalNum(num),
'name': ItemDict[item][1]}
if not holderName:
holderName = 'Unknown holderName!'
return [itemName, holderName]
def getString(self):
return TTLocalizer.QuestsRecoverItemQuestString % {'item': self.getObjectiveStrings()[0],
'holder': self.getObjectiveStrings()[1]}
def getSCStrings(self, toNpcId, progress):
item = self.getItem()
num = self.getNumItems()
forwardProgress = progress & pow(2, 16) - 1
if forwardProgress >= self.getNumItems():
if num == 1:
itemName = ItemDict[item][2] + ItemDict[item][0]
else:
itemName = TTLocalizer.QuestsItemNameAndNum % {'num': TTLocalizer.getLocalNum(num),
'name': ItemDict[item][1]}
if toNpcId == ToonHQ:
strings = [TTLocalizer.QuestsRecoverItemQuestReturnToHQSCString % itemName, TTLocalizer.QuestsRecoverItemQuestGoToHQSCString]
elif toNpcId:
npcName, hoodName, buildingArticle, buildingName, toStreet, streetName, isInPlayground = getNpcInfo(toNpcId)
strings = [TTLocalizer.QuestsRecoverItemQuestReturnToSCString % {'item': itemName,
'npcName': npcName}]
if isInPlayground:
strings.append(TTLocalizer.QuestsRecoverItemQuestGoToPlaygroundSCString % hoodName)
else:
strings.append(TTLocalizer.QuestsRecoverItemQuestGoToStreetSCString % {'to': toStreet,
'street': streetName,
'hood': hoodName})
strings.extend([TTLocalizer.QuestsRecoverItemQuestVisitBuildingSCString % (buildingArticle, buildingName), TTLocalizer.QuestsRecoverItemQuestWhereIsBuildingSCString % (buildingArticle, buildingName)])
return strings
holder = self.getHolder()
holderType = self.getHolderType()
locName = self.getLocationName()
if holder == Any:
holderName = TTLocalizer.TheCogs
elif holder == AnyFish:
holderName = TTLocalizer.TheFish
elif holderType == 'type':
holderName = SuitBattleGlobals.SuitAttributes[holder]['pluralname']
elif holderType == 'level':
holderName = TTLocalizer.QuestsRecoverItemQuestHolderString % {'level': TTLocalizer.Level,
'holder': holder,
'cogs': TTLocalizer.Cogs}
elif holderType == 'track':
if holder == 'c':
holderName = TTLocalizer.BossbotP
elif holder == 's':
holderName = TTLocalizer.SellbotP
elif holder == 'm':
holderName = TTLocalizer.CashbotP
elif holder == 'l':
holderName = TTLocalizer.LawbotP
elif holder == 'g':
holderName = TTLocalizer.BoardbotP
if num == 1:
itemName = ItemDict[item][2] + ItemDict[item][0]
else:
itemName = TTLocalizer.QuestsItemNameAndNum % {'num': TTLocalizer.getLocalNum(num),
'name': ItemDict[item][1]}
return TTLocalizer.QuestsRecoverItemQuestRecoverFromSCString % {'item': itemName,
'holder': holderName,
'loc': locName}
def getHeadlineString(self):
return TTLocalizer.QuestsRecoverItemQuestHeadline
class TrackChoiceQuest(Quest):
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
if npc and npcMatches(toNpcId, npc):
return COMPLETE
else:
return INCOMPLETE_WRONG_NPC
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
else:
return NotChosenString
def getString(self):
return TTLocalizer.QuestsTrackChoiceQuestString
def getSCStrings(self, toNpcId, progress):
return [TTLocalizer.QuestsTrackChoiceQuestSCString] + getVisitSCStrings(toNpcId)
def getHeadlineString(self):
return TTLocalizer.QuestsTrackChoiceQuestHeadline
class FriendQuest(Quest):
def filterFunc(avatar):
if len(avatar.getFriendsList()) == 0:
return 1
else:
return 0
filterFunc = staticmethod(filterFunc)
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= 1 or len(av.getFriendsList()) > 0
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
else:
return ''
def getString(self):
return TTLocalizer.QuestsFriendQuestString
def getSCStrings(self, toNpcId, progress):
if progress:
return getFinishToonTaskSCStrings(toNpcId)
return TTLocalizer.QuestsFriendQuestSCString
def getHeadlineString(self):
return TTLocalizer.QuestsFriendQuestHeadline
def getObjectiveStrings(self):
return [TTLocalizer.QuestsFriendQuestString]
def doesFriendCount(self, av, otherAv):
return 1
class FriendNewbieQuest(FriendQuest, NewbieQuest):
def filterFunc(avatar):
return 1
filterFunc = staticmethod(filterFunc)
def __init__(self, id, quest):
FriendQuest.__init__(self, id, quest)
self.checkNumFriends(self.quest[0])
self.checkNewbieLevel(self.quest[1])
def getNumQuestItems(self):
return self.getNumFriends()
def getNumFriends(self):
return self.quest[0]
def getNewbieLevel(self):
return self.quest[1]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumFriends()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumFriends() == 1:
return ''
else:
return TTLocalizer.QuestsFriendNewbieQuestProgress % {'progress': questDesc[4],
'numFriends': self.getNumFriends()}
def getString(self):
return TTLocalizer.QuestsFriendNewbieQuestObjective % self.getNumFriends()
def getObjectiveStrings(self):
return [TTLocalizer.QuestsFriendNewbieQuestString % (self.getNumFriends(), self.getNewbieLevel())]
def doesFriendCount(self, av, otherAv):
if otherAv != None and otherAv.getMaxHp() <= self.getNewbieLevel():
return 1
return 0
class TrolleyQuest(Quest):
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= 1
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
else:
return ''
def getString(self):
return TTLocalizer.QuestsFriendQuestString
def getSCStrings(self, toNpcId, progress):
if progress:
return getFinishToonTaskSCStrings(toNpcId)
return TTLocalizer.QuestsTrolleyQuestSCString
def getHeadlineString(self):
return TTLocalizer.QuestsTrolleyQuestHeadline
def getObjectiveStrings(self):
return [TTLocalizer.QuestsTrolleyQuestString]
class MailboxQuest(Quest):
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= 1
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
else:
return ''
def getString(self):
return TTLocalizer.QuestsMailboxQuestString
def getSCStrings(self, toNpcId, progress):
if progress:
return getFinishToonTaskSCStrings(toNpcId)
return TTLocalizer.QuestsMailboxQuestSCString
def getHeadlineString(self):
return TTLocalizer.QuestsMailboxQuestHeadline
def getObjectiveStrings(self):
return [TTLocalizer.QuestsMailboxQuestString]
class PhoneQuest(Quest):
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= 1
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
else:
return ''
def getString(self):
return TTLocalizer.QuestsPhoneQuestString
def getSCStrings(self, toNpcId, progress):
if progress:
return getFinishToonTaskSCStrings(toNpcId)
return TTLocalizer.QuestsPhoneQuestSCString
def getHeadlineString(self):
return TTLocalizer.QuestsPhoneQuestHeadline
def getObjectiveStrings(self):
return [TTLocalizer.QuestsPhoneQuestString]
class EliteCogQBase:
def doesCogCount(self, avId, cogDict, zoneId, avList):
return cogDict['isElite'] and avId in cogDict['activeToons'] and self.isLocationMatch(zoneId)
class EliteCogQuest(CogQuest, EliteCogQBase):
def __init__(self, id, quest):
CogQuest.__init__(self, id, quest)
self.checkNumCogs(self.quest[1])
def getCogType(self):
return Any
def doesCogCount(self, avId, cogDict, zoneId, avList):
return EliteCogQBase.doesCogCount(self, avId, cogDict, zoneId, avList)
class MinigameNewbieQuest(Quest, NewbieQuest):
def __init__(self, id, quest):
Quest.__init__(self, id, quest)
self.checkNumMinigames(self.quest[0])
self.checkNewbieLevel(self.quest[1])
def getNumQuestItems(self):
return self.getNumMinigames()
def getNumMinigames(self):
return self.quest[0]
def getNewbieLevel(self):
return self.quest[1]
def getCompletionStatus(self, av, questDesc, npc = None):
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
questComplete = toonProgress >= self.getNumMinigames()
return getCompleteStatusWithNpc(questComplete, toNpcId, npc)
def getProgressString(self, avatar, questDesc):
if self.getCompletionStatus(avatar, questDesc) == COMPLETE:
return CompleteString
elif self.getNumMinigames() == 1:
return ''
else:
return TTLocalizer.QuestsMinigameNewbieQuestProgress % {'progress': questDesc[4],
'numMinigames': self.getNumMinigames()}
def getString(self):
return TTLocalizer.QuestsMinigameNewbieQuestObjective % self.getNumMinigames()
def getObjectiveStrings(self):
return [TTLocalizer.QuestsMinigameNewbieQuestString % self.getNumMinigames()]
def getHeadlineString(self):
return TTLocalizer.QuestsNewbieQuestHeadline
def getSCStrings(self, toNpcId, progress):
if progress:
return getFinishToonTaskSCStrings(toNpcId)
return TTLocalizer.QuestsTrolleyQuestSCString
def doesMinigameCount(self, av, avList):
newbieHp = self.getNewbieLevel()
points = 0
for toon in avList:
if toon != av and toon.getMaxHp() <= newbieHp:
points += 1
return points
DefaultDialog = {GREETING: DefaultGreeting,
QUEST: DefaultQuest,
INCOMPLETE: DefaultIncomplete,
INCOMPLETE_PROGRESS: DefaultIncompleteProgress,
INCOMPLETE_WRONG_NPC: DefaultIncompleteWrongNPC,
COMPLETE: DefaultComplete,
LEAVING: DefaultLeaving}
def getQuestFromNpcId(id):
return QuestDict.get(id)[QuestDictFromNpcIndex]
def getQuestToNpcId(id):
return QuestDict.get(id)[QuestDictToNpcIndex]
def getQuestDialog(id):
return QuestDict.get(id)[QuestDictDialogIndex]
def getQuestReward(id, av):
baseRewardId = QuestDict.get(id)[QuestDictRewardIndex]
return transformReward(baseRewardId, av)
def isQuestJustForFun(questId, rewardId):
return False
NoRewardTierZeroQuests = (101, 110, 121, 131, 141, 160, 161, 162, 163)
RewardTierZeroQuests = ()
PreClarabelleQuestIds = NoRewardTierZeroQuests + RewardTierZeroQuests
QuestDict = {101: ([],
Start,
(CogQuest,
Anywhere,
1,
Any),
20000,
20002,
NA,
102,
TTLocalizer.QuestDialogDict[164],
10,
5),
102: ([],
Cont,
(VisitQuest,),
20002,
2001,
NA,
NA,
TTLocalizer.QuestDialogDict[164],
10,
5),
2000: ([],
Start,
(VisitQuest,),
2001,
2112,
NA,
2001,
TTLocalizer.QuestDialogDict[2000],
300,
35),
2001: ([],
Cont,
(RecoverItemQuest,
Anywhere,
5,
2001,
Easy,
Any,
'type'),
2112,
2112,
NA,
2002,
TTLocalizer.QuestDialogDict[2001],
300,
35),
2002: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2002,
Easy,
Any,
'type'),
2112,
2112,
NA,
2003,
TTLocalizer.QuestDialogDict[2002],
300,
35),
2003: ([],
Cont,
(VisitQuest,),
2112,
2301,
NA,
2004,
TTLocalizer.QuestDialogDict[2003],
300,
35),
2004: ([],
Cont,
(VisitQuest,),
2301,
2112,
NA,
NA,
TTLocalizer.QuestDialogDict[2004],
300,
35),
2010: ([],
Start,
(VisitQuest,),
2001,
2405,
NA,
2011,
TTLocalizer.QuestDialogDict[2010],
300,
10),
2011: ([],
Cont,
(RecoverItemQuest,
Anywhere,
4,
2003,
30,
AnyFish),
2405,
2405,
NA,
2012,
TTLocalizer.QuestDialogDict[2011],
300,
10),
2012: ([],
Cont,
(RecoverItemQuest,
Anywhere,
4,
2004,
30,
AnyFish),
2405,
2405,
NA,
2013,
TTLocalizer.QuestDialogDict[2012],
300,
10),
2013: ([],
Cont,
(RecoverItemQuest,
Anywhere,
4,
2005,
30,
AnyFish),
2405,
2405,
NA,
2014,
TTLocalizer.QuestDialogDict[2013],
300,
10),
2014: ([],
Cont,
(DeliverGagQuest,
5,
5,
1),
2405,
2405,
NA,
2015,
TTLocalizer.QuestDialogDict[2014],
300,
10),
2015: ([],
Cont,
(DeliverGagQuest,
5,
4,
1),
2405,
2405,
NA,
2016,
TTLocalizer.QuestDialogDict[2015],
300,
10),
2016: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2006,
20,
Any,
'type'),
2405,
2405,
NA,
2017,
TTLocalizer.QuestDialogDict[2016],
300,
10),
2017: ([],
Cont,
(RecoverItemQuest,
Anywhere,
3,
2007,
30,
'cc',
'type'),
2405,
2405,
NA,
2018,
TTLocalizer.QuestDialogDict[2017],
300,
10),
2018: ([],
Cont,
(DeliverItemQuest, 2008),
2405,
2001,
NA,
NA,
TTLocalizer.QuestDialogDict[2018],
300,
10),
2020: ([],
Start,
(VisitQuest,),
2001,
2136,
NA,
2021,
TTLocalizer.QuestDialogDict[2020],
300,
35),
2021: ([],
Cont,
(RecoverItemQuest,
Anywhere,
3,
2009,
Easy,
'pp',
'type'),
2136,
2136,
NA,
2022,
TTLocalizer.QuestDialogDict[2021],
300,
35),
2022: ([],
Cont,
(RecoverItemQuest,
Anywhere,
3,
2010,
Easy,
'p',
'type'),
2136,
2136,
NA,
2023,
TTLocalizer.QuestDialogDict[2022],
300,
35),
2023: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2011,
Easy,
'b',
'type'),
2136,
2136,
NA,
2024,
TTLocalizer.QuestDialogDict[2023],
300,
35),
2024: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2012,
Easy,
'ca',
'type'),
2136,
2136,
NA,
2025,
TTLocalizer.QuestDialogDict[2024],
300,
35),
2025: ([],
Cont,
(RecoverItemQuest,
Anywhere,
3,
2013,
Easy,
'tm',
'type'),
2136,
2136,
NA,
2026,
TTLocalizer.QuestDialogDict[2025],
300,
35),
2026: ([],
Cont,
(DeliverItemQuest, 2014),
2136,
2002,
NA,
2027,
TTLocalizer.QuestDialogDict[2026],
300,
35),
2027: ([],
Cont,
(DeliverItemQuest, 2015),
2002,
2136,
NA,
2028,
TTLocalizer.QuestDialogDict[2027],
300,
35),
2028: ([],
Cont,
(CogTrackQuest,
Anywhere,
10,
'm'),
2136,
2136,
NA,
2029,
TTLocalizer.QuestDialogDict[2028],
300,
35),
2029: ([],
Cont,
(DeliverItemQuest, 2014),
2136,
2001,
NA,
NA,
TTLocalizer.QuestDialogDict[2029],
300,
35),
2030: ([],
Start,
(VisitQuest,),
2001,
2003,
NA,
(2031, 2032, 2033, 2034),
TTLocalizer.QuestDialogDict[2030],
300,
35),
2031: ([],
Cont,
(CogTrackQuest,
Anywhere,
5,
's'),
2003,
Same,
NA,
2035,
TTLocalizer.QuestDialogDict[2031],
300,
35),
2032: ([],
Cont,
(CogTrackQuest,
Anywhere,
5,
'm'),
Same,
Same,
NA,
2035,
TTLocalizer.QuestDialogDict[2032],
300,
35),
2033: ([],
Cont,
(CogTrackQuest,
Anywhere,
5,
'l'),
Same,
Same,
NA,
2035,
TTLocalizer.QuestDialogDict[2033],
300,
35),
2034: ([],
Cont,
(CogTrackQuest,
Anywhere,
5,
'c'),
Same,
Same,
NA,
2035,
TTLocalizer.QuestDialogDict[2034],
300,
35),
2035: ([],
Cont,
(CogTrackQuest,
Anywhere,
5,
'g'),
Same,
Same,
NA,
2036,
TTLocalizer.QuestDialogDict[2035],
300,
35),
2036: ([],
Cont,
(CogLevelQuest,
Anywhere,
5,
2),
Same,
Same,
NA,
2037,
TTLocalizer.QuestDialogDict[2036],
300,
35),
2037: ([],
Cont,
(EliteCogQuest, Anywhere, 5),
Same,
Same,
NA,
2038,
TTLocalizer.QuestDialogDict[2037],
300,
35),
2038: ([],
Cont,
(CogLevelQuest,
Anywhere,
2,
4),
Same,
Same,
NA,
NA,
TTLocalizer.QuestDialogDict[2038],
300,
35),
2040: ([],
Start,
(VisitQuest,),
2001,
2201,
NA,
2041,
TTLocalizer.QuestDialogDict[2040],
370,
70),
2041: ([],
Cont,
(RecoverItemQuest,
ToontownGlobals.ToontownCentral,
5,
2016,
Medium,
3,
'level'),
2201,
2201,
NA,
2042,
TTLocalizer.QuestDialogDict[2041],
370,
70),
2042: ([],
Cont,
(DeliverItemQuest, 2016),
2201,
2404,
NA,
2043,
TTLocalizer.QuestDialogDict[2042],
370,
70),
2043: ([],
Cont,
(RecoverItemQuest,
ToontownGlobals.ToontownCentral,
7,
2017,
Easy,
'g',
'track'),
2404,
2404,
NA,
2044,
TTLocalizer.QuestDialogDict[2043],
370,
70),
2044: ([],
Cont,
(RecoverItemQuest,
ToontownGlobals.ToontownCentral,
3,
2018,
Easy,
'c',
'track'),
2404,
2404,
NA,
2045,
TTLocalizer.QuestDialogDict[2044],
370,
70),
2045: ([],
Cont,
(RecoverItemQuest,
ToontownGlobals.ToontownCentral,
1,
2019,
Easy,
'cn',
'type'),
2404,
2404,
NA,
2046,
TTLocalizer.QuestDialogDict[2045],
370,
70),
2046: ([],
Cont,
(DeliverItemQuest, 2016),
2404,
2209,
NA,
NA,
TTLocalizer.QuestDialogDict[2046],
370,
70),
2050: ([],
Start,
(DeliverItemQuest, 2016),
2001,
2416,
NA,
2051,
TTLocalizer.QuestDialogDict[2050],
385,
20),
2051: ([],
Cont,
(DeliverItemQuest, 2016),
2416,
2415,
NA,
2052,
TTLocalizer.QuestDialogDict[2051],
385,
20),
2052: ([],
Cont,
(DeliverItemQuest, 2016),
2415,
2416,
NA,
2053,
TTLocalizer.QuestDialogDict[2052],
385,
20),
2053: ([],
Cont,
(DeliverItemQuest, 2016),
2416,
2201,
NA,
2054,
TTLocalizer.QuestDialogDict[2053],
385,
20),
2054: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2020,
Easy,
'g',
'track'),
2416,
2201,
NA,
2055,
TTLocalizer.QuestDialogDict[2054],
385,
20),
2055: ([],
Cont,
(DeliverItemQuest, 2016),
2201,
2415,
NA,
2056,
TTLocalizer.QuestDialogDict[2055],
385,
20),
2056: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2021,
Easy,
'f',
'type'),
2416,
2201,
NA,
2057,
TTLocalizer.QuestDialogDict[2056],
385,
20),
2057: ([],
Cont,
(DeliverItemQuest, 2022),
2415,
2416,
NA,
2058,
TTLocalizer.QuestDialogDict[2057],
385,
20),
2058: ([],
Cont,
(CogLevelQuest,
2400,
5,
2),
2416,
2416,
NA,
2059,
TTLocalizer.QuestDialogDict[2058],
385,
20),
2059: ([],
Cont,
(CogLevelQuest,
ToontownGlobals.ToontownCentral,
4,
4),
2416,
2416,
NA,
NA,
TTLocalizer.QuestDialogDict[2059],
385,
20),
2060: ([],
Start,
(VisitQuest,),
2001,
2318,
NA,
2061,
TTLocalizer.QuestDialogDict[2060],
350,
35),
2061: ([],
Cont,
(CogTrackLevelQuest,
Anywhere,
5,
'c',
3),
2318,
2318,
NA,
2062,
TTLocalizer.QuestDialogDict[2061],
350,
35),
2062: ([],
Cont,
(CogTrackQuest,
Anywhere,
10,
'l'),
2318,
2318,
NA,
2063,
TTLocalizer.QuestDialogDict[2062],
350,
35),
2063: ([],
Cont,
(CogLevelQuest,
Anywhere,
6,
2),
2318,
2318,
NA,
NA,
TTLocalizer.QuestDialogDict[2063],
350,
35),
2070: ([],
Start,
(VisitQuest,),
2001,
2402,
NA,
(2071, 2072, 2073, 2074),
TTLocalizer.QuestDialogDict[2070],
375,
50),
2071: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2016,
Medium,
's',
'track'),
2402,
2402,
NA,
(2075, 2076),
TTLocalizer.QuestDialogDict[2071],
375,
50),
2072: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2016,
Medium,
'm',
'track'),
2402,
2402,
NA,
(2075, 2076),
TTLocalizer.QuestDialogDict[2072],
375,
50),
2073: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2016,
Medium,
'l',
'track'),
2402,
2402,
NA,
(2075, 2076),
TTLocalizer.QuestDialogDict[2073],
375,
50),
2074: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2016,
Medium,
'c',
'track'),
2402,
2402,
NA,
(2075, 2076),
TTLocalizer.QuestDialogDict[2074],
375,
50),
2075: ([],
Cont,
(CogTrackQuest,
Anywhere,
5,
'g'),
2402,
2402,
NA,
(2077, 2078),
TTLocalizer.QuestDialogDict[2075],
375,
50),
2076: ([],
Cont,
(CogTrackQuest,
Anywhere,
5,
's'),
2402,
2402,
NA,
(2077, 2078),
TTLocalizer.QuestDialogDict[2076],
375,
50),
2077: ([],
Cont,
(CogQuest,
Anywhere,
2,
'mdm'),
2402,
2402,
NA,
2079,
TTLocalizer.QuestDialogDict[2077],
375,
50),
2078: ([],
Cont,
(CogQuest,
Anywhere,
2,
'gh'),
2402,
2402,
NA,
2079,
TTLocalizer.QuestDialogDict[2078],
375,
50),
2079: ([],
Cont,
(DeliverItemQuest, 2027),
2402,
2128,
NA,
NA,
TTLocalizer.QuestDialogDict[2079],
375,
50),
2080: ([],
Start,
(TrackExpQuest,
Anywhere,
4,
20),
2001,
2001,
NA,
2081,
TTLocalizer.QuestDialogDict[2080],
350,
50),
2081: ([],
Cont,
(TrackExpQuest,
Anywhere,
5,
20),
2001,
2001,
NA,
2082,
TTLocalizer.QuestDialogDict[2081],
350,
50),
2082: ([],
Cont,
(DeliverGagQuest,
1,
4,
2),
2001,
2117,
NA,
2083,
TTLocalizer.QuestDialogDict[2082],
350,
50),
2083: ([],
Cont,
(DeliverGagQuest,
1,
5,
2),
2117,
2123,
NA,
2084,
TTLocalizer.QuestDialogDict[2083],
350,
50),
2084: ([],
Cont,
(VisitQuest,),
2123,
2001,
NA,
2085,
TTLocalizer.QuestDialogDict[2084],
350,
50),
2085: ([],
Cont,
(CogQuest,
Anywhere,
5,
Any),
2001,
2001,
NA,
2086,
TTLocalizer.QuestDialogDict[2085],
350,
50),
2086: ([],
Cont,
(CogLevelQuest,
Anywhere,
3,
4),
2001,
2001,
NA,
NA,
TTLocalizer.QuestDialogDict[2086],
350,
50),
2090: ([],
Start,
(VisitQuest,),
2001,
2208,
NA,
2091,
TTLocalizer.QuestDialogDict[2090],
375,
25),
2091: ([],
Cont,
(CogQuest,
ToontownGlobals.ToontownCentral,
30,
Any),
2208,
2208,
NA,
2092,
TTLocalizer.QuestDialogDict[2091],
375,
25),
2092: ([],
Cont,
(CogLevelQuest,
2400,
4,
2),
2208,
2208,
NA,
2093,
TTLocalizer.QuestDialogDict[2092],
375,
25),
2093: ([],
Cont,
(CogLevelQuest,
2300,
3,
3),
2208,
2208,
NA,
2094,
TTLocalizer.QuestDialogDict[2093],
375,
25),
2094: ([],
Cont,
(CogLevelQuest,
2100,
2,
4),
2208,
2208,
NA,
2095,
TTLocalizer.QuestDialogDict[2094],
375,
25),
2095: ([],
Cont,
(CogLevelQuest,
2200,
2,
5),
2208,
2208,
NA,
2096,
TTLocalizer.QuestDialogDict[2095],
375,
25),
2096: ([],
Cont,
(RecoverItemQuest,
2200,
1,
2028,
Medium,
5,
'level'),
2208,
2208,
NA,
NA,
TTLocalizer.QuestDialogDict[2096],
375,
25),
2100: ([],
Start,
(VisitQuest,),
2001,
2222,
NA,
2101,
TTLocalizer.QuestDialogDict[2100],
375,
35),
2101: ([],
Cont,
(CogLevelQuest,
ToontownGlobals.ToontownCentral,
5,
3),
2222,
2222,
NA,
(2102, 2103, 2104),
TTLocalizer.QuestDialogDict[2101],
375,
35),
2102: ([],
Cont,
(CogTrackQuest,
ToontownGlobals.ToontownCentral,
10,
'l'),
2222,
2222,
NA,
(2105, 2106),
TTLocalizer.QuestDialogDict[2102],
375,
35),
2103: ([],
Cont,
(CogTrackQuest,
ToontownGlobals.ToontownCentral,
10,
'c'),
2222,
2222,
NA,
(2105, 2106),
TTLocalizer.QuestDialogDict[2103],
375,
35),
2104: ([],
Cont,
(CogTrackQuest,
ToontownGlobals.ToontownCentral,
10,
'g'),
2222,
2222,
NA,
(2105, 2106),
TTLocalizer.QuestDialogDict[2104],
375,
35),
2105: ([],
Cont,
(CogTrackLevelQuest,
Anywhere,
3,
's',
4),
2222,
2222,
NA,
2107,
TTLocalizer.QuestDialogDict[2105],
375,
35),
2106: ([],
Cont,
(CogTrackLevelQuest,
Anywhere,
3,
'm',
4),
2222,
2222,
NA,
2107,
TTLocalizer.QuestDialogDict[2106],
375,
35),
2107: ([],
Cont,
(CogQuest,
ToontownGlobals.ToontownCentral,
10,
Any),
2222,
2222,
NA,
NA,
TTLocalizer.QuestDialogDict[2107],
375,
35),
2110: ([],
Start,
(VisitQuest,),
2001,
6214,
NA,
2111,
TTLocalizer.QuestDialogDict[2110],
325,
50),
2111: ([],
Cont,
(RecoverItemQuest,
Anywhere,
10,
2029,
Easy,
Any,
'type'),
6214,
6214,
NA,
2112,
TTLocalizer.QuestDialogDict[2111],
325,
50),
2112: ([],
Cont,
(DeliverItemQuest, 2030),
6214,
2312,
NA,
2113,
TTLocalizer.QuestDialogDict[2112],
325,
50),
2113: ([],
Cont,
(VisitQuest,),
6214,
2303,
NA,
2114,
TTLocalizer.QuestDialogDict[2113],
325,
50),
2114: ([],
Cont,
(CogQuest,
ToontownGlobals.ToontownCentral,
5,
'ac'),
2303,
2303,
NA,
2115,
TTLocalizer.QuestDialogDict[2114],
325,
50),
2115: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2031,
Medium,
'ac',
'type'),
2303,
2303,
NA,
2116,
TTLocalizer.QuestDialogDict[2115],
325,
50),
2116: ([],
Cont,
(VisitQuest,),
2303,
2128,
NA,
2117,
TTLocalizer.QuestDialogDict[2116],
325,
50),
2117: ([],
Cont,
(RecoverItemQuest,
Anywhere,
4,
2032,
Easy,
AnyFish),
2128,
2128,
NA,
2118,
TTLocalizer.QuestDialogDict[2117],
325,
50),
2118: ([],
Cont,
(RecoverItemQuest,
Anywhere,
1,
2033,
Medium,
5,
'level'),
2128,
2128,
NA,
NA,
TTLocalizer.QuestDialogDict[2118],
325,
50),
2120: ([2118,
2107,
2096,
2086,
2079,
2064,
2059,
2046,
2038,
2029,
2018,
2005],
Start,
(VisitQuest,),
2216,
2001,
300,
2121,
TTLocalizer.QuestDialogDict[2120],
500,
75),
2121: ([],
Cont,
(RecoverItemQuest,
Anywhere,
4,
2034,
Medium,
AnyFish),
2216,
2216,
300,
2122,
TTLocalizer.QuestDialogDict[2121],
500,
75),
2122: ([],
Cont,
(RecoverItemQuest,
Anywhere,
4,
2035,
VeryEasy,
'gh',
'type'),
2216,
2216,
300,
2123,
TTLocalizer.QuestDialogDict[2122],
500,
75),
2123: ([],
Cont,
(DeliverItemQuest, Anywhere, 2035),
2216,
2001,
300,
2134,
TTLocalizer.QuestDialogDict[2123],
500,
75),
2124: ([],
Cont,
(VisitQuest,),
2001,
2216,
300,
2125,
TTLocalizer.QuestDialogDict[2124],
500,
75),
2125: ([],
Cont,
(DeliverItemQuest, 2035),
2216,
2214,
300,
2126,
TTLocalizer.QuestDialogDict[2125],
500,
75),
2126: ([],
Cont,
(CogLevelQuest,
ToontownGlobals.ToontownCentral,
8,
4),
2214,
2214,
300,
2127,
TTLocalizer.QuestDialogDict[2126],
500,
75),
2127: ([],
Cont,
(CogLevelQuest,
ToontownGlobals.ToontownCentral,
4,
5),
2214,
2214,
300,
2128,
TTLocalizer.QuestDialogDict[2127],
500,
75),
2128: ([],
Cont,
(BuildingQuest,
Anywhere,
1,
Any,
1),
2214,
2214,
300,
2129,
TTLocalizer.QuestDialogDict[2128],
500,
75),
2129: ([],
Cont,
(VisitQuest,),
2214,
2216,
300,
2130,
TTLocalizer.QuestDialogDict[2129],
500,
75),
2130: ([],
Cont,
(DeliverItemQuest, Anywhere, 2035),
2216,
2201,
300,
2131,
TTLocalizer.QuestDialogDict[2130],
500,
75),
2131: ([],
Cont,
(RecoverItemQuest,
Anywhere,
15,
2036,
VeryEasy,
AnyFish),
2201,
2201,
300,
2132,
TTLocalizer.QuestDialogDict[2131],
500,
75),
2132: ([],
Cont,
(VisitQuest,),
2226,
2216,
300,
2133,
TTLocalizer.QuestDialogDict[2132],
500,
75),
2133: ([],
Cont,
(DeliverItemQuest, Anywhere, 2035),
2216,
2201,
300,
2134,
TTLocalizer.QuestDialogDict[2133],
500,
75),
2134: ([],
Cont,
(RecoverItemQuest,
Anywhere,
10,
2016,
Easy,
4,
'level'),
2201,
2201,
300,
2135,
TTLocalizer.QuestDialogDict[2134],
500,
75),
2135: ([],
Cont,
(VisitQuest,),
2201,
2216,
300,
2136,
TTLocalizer.QuestDialogDict[2135],
500,
75),
2136: ([],
Cont,
(BuildingQuest,
Anywhere,
1,
Any,
2),
2216,
2216,
300,
NA,
TTLocalizer.QuestDialogDict[2136],
500,
75)}
Quest2RewardDict = {}
Tier2Reward2QuestsDict = {}
Quest2RemainingStepsDict = {}
def getAllRewardIdsForReward(rewardId):
if rewardId is AnyCashbotSuitPart:
return range(4000, 4012)
if rewardId is AnyLawbotSuitPart:
return range(4100, 4114)
if rewardId is AnyBossbotSuitPart:
return range(4200, 4217)
return (rewardId,)
def findFinalRewardId(questId):
finalRewardId = Quest2RewardDict.get(questId)
if finalRewardId:
remainingSteps = Quest2RemainingStepsDict.get(questId)
else:
try:
questDesc = QuestDict[questId]
except KeyError:
print 'findFinalRewardId: Quest ID: %d not found' % questId
return -1
nextQuestId = questDesc[QuestDictNextQuestIndex]
if nextQuestId == NA:
finalRewardId = questDesc[QuestDictRewardIndex]
remainingSteps = 1
else:
if type(nextQuestId) == type(()):
finalRewardId, remainingSteps = findFinalRewardId(nextQuestId[0])
for id in nextQuestId[1:]:
findFinalRewardId(id)
else:
finalRewardId, remainingSteps = findFinalRewardId(nextQuestId)
remainingSteps += 1
Quest2RewardDict[questId] = finalRewardId
Quest2RemainingStepsDict[questId] = remainingSteps
return (finalRewardId, remainingSteps)
for questId in QuestDict.keys():
findFinalRewardId(questId)
def getStartingQuests(tier = None):
startingQuests = []
return startingQuests
def getFinalRewardId(questId, fAll = 0):
if fAll or isStartingQuest(questId):
return Quest2RewardDict.get(questId)
else:
return None
def isStartingQuest(questId):
try:
return QuestDict[questId][QuestDictStartIndex] == Start
except KeyError:
return None
def getNumChoices(tier):
if tier in (0,):
return 0
elif tier in (1,):
return 2
else:
return 3
def getAvatarRewardId(av, questId):
for quest in av.quests:
if questId == quest[0]:
return quest[3]
notify.warning('getAvatarRewardId(): quest not found on avatar')
def getNextQuest(id, currentNpc, av):
nextQuest = QuestDict[id][QuestDictNextQuestIndex]
if nextQuest == NA:
return (NA, NA)
if type(nextQuest) == type(()):
nextReward = QuestDict[nextQuest[0]][QuestDictRewardIndex]
nextNextQuest, nextNextToNpcId = getNextQuest(nextQuest[0], currentNpc, av)
nextQuest = random.choice(nextQuest)
if not getQuestClass(nextQuest).filterFunc(av):
return getNextQuest(nextQuest, currentNpc, av)
nextToNpcId = getQuestToNpcId(nextQuest)
if nextToNpcId == Any:
nextToNpcId = 2004
elif nextToNpcId == Same:
if currentNpc.getHq():
nextToNpcId = ToonHQ
else:
nextToNpcId = currentNpc.getNpcId()
elif nextToNpcId == ToonHQ:
nextToNpcId = ToonHQ
return (nextQuest, nextToNpcId)
def filterQuests(entireQuestPool, currentNpc, av):
if notify.getDebug():
notify.debug('filterQuests: entireQuestPool: %s' % entireQuestPool)
validQuestPool = dict([ (questId, 1) for questId in entireQuestPool ])
if isLoopingFinalTier(av.getRewardTier()):
history = map(lambda questDesc: questDesc[0], av.quests)
else:
history = av.getQuestHistory()
if notify.getDebug():
notify.debug('filterQuests: av quest history: %s' % history)
currentQuests = av.quests
for questId in entireQuestPool:
if questId in history:
if notify.getDebug():
notify.debug('filterQuests: Removed %s because in history' % questId)
validQuestPool[questId] = 0
continue
potentialFromNpc = getQuestFromNpcId(questId)
if not npcMatches(potentialFromNpc, currentNpc):
if notify.getDebug():
notify.debug('filterQuests: Removed %s: potentialFromNpc does not match currentNpc' % questId)
validQuestPool[questId] = 0
continue
potentialToNpc = getQuestToNpcId(questId)
if currentNpc.getNpcId() == potentialToNpc:
if notify.getDebug():
notify.debug('filterQuests: Removed %s because potentialToNpc is currentNpc' % questId)
validQuestPool[questId] = 0
continue
if not getQuestClass(questId).filterFunc(av):
if notify.getDebug():
notify.debug('filterQuests: Removed %s because of filterFunc' % questId)
validQuestPool[questId] = 0
continue
if getQuestClass(questId) == TrackExpQuest:
quest = QuestDict.get(questId)
track = quest[1]
trackAccess = av.getTrackAccess()
if trackAccess[track] == 0:
validQuestPool[questId] = 0
continue
for quest in currentQuests:
fromNpcId = quest[1]
toNpcId = quest[2]
if potentialToNpc == toNpcId and toNpcId != ToonHQ:
validQuestPool[questId] = 0
if notify.getDebug():
notify.debug('filterQuests: Removed %s because npc involved' % questId)
break
finalQuestPool = filter(lambda key: validQuestPool[key], validQuestPool.keys())
if notify.getDebug():
notify.debug('filterQuests: finalQuestPool: %s' % finalQuestPool)
return finalQuestPool
def chooseTrackChoiceQuest(tier, av, fixed = 0):
def fixAndCallAgain():
if not fixed and av.fixTrackAccess():
notify.info('av %s trackAccess fixed: %s' % (av.getDoId(), trackAccess))
return chooseTrackChoiceQuest(tier, av, fixed=1)
else:
return None
bestQuest = None
trackAccess = av.getTrackAccess()
if tier == DG_TIER:
if trackAccess[ToontownBattleGlobals.HEAL_TRACK] == 1:
bestQuest = 4002
elif trackAccess[ToontownBattleGlobals.SOUND_TRACK] == 1:
bestQuest = 4001
else:
notify.warning('av %s has bogus trackAccess: %s' % (av.getDoId(), trackAccess))
return fixAndCallAgain()
elif tier == BR_TIER:
if trackAccess[ToontownBattleGlobals.TRAP_TRACK] == 1:
if trackAccess[ToontownBattleGlobals.SOUND_TRACK] == 1:
if trackAccess[ToontownBattleGlobals.DROP_TRACK] == 1:
bestQuest = 5004
elif trackAccess[ToontownBattleGlobals.LURE_TRACK] == 1:
bestQuest = 5003
else:
notify.warning('av %s has bogus trackAccess: %s' % (av.getDoId(), trackAccess))
return fixAndCallAgain()
elif trackAccess[ToontownBattleGlobals.HEAL_TRACK] == 1:
if trackAccess[ToontownBattleGlobals.DROP_TRACK] == 1:
bestQuest = 5002
elif trackAccess[ToontownBattleGlobals.LURE_TRACK] == 1:
bestQuest = 5001
else:
notify.warning('av %s has bogus trackAccess: %s' % (av.getDoId(), trackAccess))
return fixAndCallAgain()
elif trackAccess[ToontownBattleGlobals.SOUND_TRACK] == 0:
bestQuest = 5005
elif trackAccess[ToontownBattleGlobals.HEAL_TRACK] == 0:
bestQuest = 5006
elif trackAccess[ToontownBattleGlobals.DROP_TRACK] == 0:
bestQuest = 5007
elif trackAccess[ToontownBattleGlobals.LURE_TRACK] == 0:
bestQuest = 5008
else:
notify.warning('av %s has bogus trackAccess: %s' % (av.getDoId(), trackAccess))
return fixAndCallAgain()
else:
if notify.getDebug():
notify.debug('questPool for reward 400 had no dynamic choice, tier: %s' % tier)
bestQuest = seededRandomChoice(Tier2Reward2QuestsDict[tier][400])
if notify.getDebug():
notify.debug('chooseTrackChoiceQuest: avId: %s trackAccess: %s tier: %s bestQuest: %s' % (av.getDoId(),
trackAccess,
tier,
bestQuest))
return bestQuest
def chooseMatchingQuest(tier, validQuestPool, rewardId, npc, av):
questsMatchingReward = Tier2Reward2QuestsDict[tier].get(rewardId, [])
if notify.getDebug():
notify.debug('questsMatchingReward: %s tier: %s = %s' % (rewardId, tier, questsMatchingReward))
else:
validQuestsMatchingReward = PythonUtil.intersection(questsMatchingReward, validQuestPool)
if notify.getDebug():
notify.debug('validQuestsMatchingReward: %s tier: %s = %s' % (rewardId, tier, validQuestsMatchingReward))
if validQuestsMatchingReward:
bestQuest = seededRandomChoice(validQuestsMatchingReward)
else:
questsMatchingReward = Tier2Reward2QuestsDict[tier].get(AnyCashbotSuitPart, [])
if notify.getDebug():
notify.debug('questsMatchingReward: AnyCashbotSuitPart tier: %s = %s' % (tier, questsMatchingReward))
validQuestsMatchingReward = PythonUtil.intersection(questsMatchingReward, validQuestPool)
if validQuestsMatchingReward:
if notify.getDebug():
notify.debug('validQuestsMatchingReward: AnyCashbotSuitPart tier: %s = %s' % (tier, validQuestsMatchingReward))
bestQuest = seededRandomChoice(validQuestsMatchingReward)
else:
questsMatchingReward = Tier2Reward2QuestsDict[tier].get(AnyLawbotSuitPart, [])
if notify.getDebug():
notify.debug('questsMatchingReward: AnyLawbotSuitPart tier: %s = %s' % (tier, questsMatchingReward))
validQuestsMatchingReward = PythonUtil.intersection(questsMatchingReward, validQuestPool)
if validQuestsMatchingReward:
if notify.getDebug():
notify.debug('validQuestsMatchingReward: AnyLawbotSuitPart tier: %s = %s' % (tier, validQuestsMatchingReward))
bestQuest = seededRandomChoice(validQuestsMatchingReward)
else:
questsMatchingReward = Tier2Reward2QuestsDict[tier].get(Any, [])
if notify.getDebug():
notify.debug('questsMatchingReward: Any tier: %s = %s' % (tier, questsMatchingReward))
if not questsMatchingReward:
notify.warning('chooseMatchingQuests, no questsMatchingReward')
return None
validQuestsMatchingReward = PythonUtil.intersection(questsMatchingReward, validQuestPool)
if not validQuestsMatchingReward:
notify.warning('chooseMatchingQuests, no validQuestsMatchingReward')
return None
if notify.getDebug():
notify.debug('validQuestsMatchingReward: Any tier: %s = %s' % (tier, validQuestsMatchingReward))
bestQuest = seededRandomChoice(validQuestsMatchingReward)
return bestQuest
def transformReward(baseRewardId, av):
if baseRewardId == 900:
trackId, progress = av.getTrackProgress()
if trackId == -1:
notify.warning('transformReward: asked to transform 900 but av is not training')
actualRewardId = baseRewardId
else:
actualRewardId = 901 + trackId
return actualRewardId
if baseRewardId > 800 and baseRewardId < 900:
trackId, progress = av.getTrackProgress()
if trackId < 0:
notify.warning('transformReward: av: %s is training a track with none chosen!' % av.getDoId())
return 601
else:
actualRewardId = baseRewardId + 200 + trackId * 100
return actualRewardId
else:
return baseRewardId
def chooseBestQuests(tier, currentNpc, av):
if isLoopingFinalTier(tier):
rewardHistory = map(lambda questDesc: questDesc[3], av.quests)
else:
rewardHistory = av.getRewardHistory()[1]
seedRandomGen(currentNpc.getNpcId(), av.getDoId(), tier, rewardHistory)
numChoices = getNumChoices(tier)
rewards = getNextRewards(numChoices, tier, av)
if not rewards:
return []
possibleQuests = []
possibleRewards = list(rewards)
if Any not in possibleRewards:
possibleRewards.append(Any)
for rewardId in possibleRewards:
possibleQuests.extend(Tier2Reward2QuestsDict[tier].get(rewardId, []))
validQuestPool = filterQuests(possibleQuests, currentNpc, av)
if not validQuestPool:
return []
if numChoices == 0:
numChoices = 1
bestQuests = []
for i in range(numChoices):
if len(validQuestPool) == 0:
break
if len(rewards) == 0:
break
rewardId = rewards.pop(0)
bestQuestId = chooseMatchingQuest(tier, validQuestPool, rewardId, currentNpc, av)
if bestQuestId is None:
continue
validQuestPool.remove(bestQuestId)
bestQuestToNpcId = getQuestToNpcId(bestQuestId)
if bestQuestToNpcId == Any:
bestQuestToNpcId = 2003
elif bestQuestToNpcId == Same:
if currentNpc.getHq():
bestQuestToNpcId = ToonHQ
else:
bestQuestToNpcId = currentNpc.getNpcId()
elif bestQuestToNpcId == ToonHQ:
bestQuestToNpcId = ToonHQ
bestQuests.append([bestQuestId, rewardId, bestQuestToNpcId])
for quest in bestQuests:
quest[1] = transformReward(quest[1], av)
return bestQuests
def getFirstQuestIdInChain(questId):
while True:
questEntry = QuestDict.get(questId)
if not questEntry:
return questId
if questEntry[QuestDictStartIndex] != Start:
questId -= 1
else:
return questId
def questExists(id):
return QuestDict.has_key(id)
def getQuest(id):
questEntry = QuestDict.get(id)
if questEntry:
questDesc = questEntry[QuestDictDescIndex]
questClass = questDesc[0]
return questClass(id, questDesc[1:])
else:
return None
def getQuestExp(id):
questEntry = QuestDict.get(id)
if questEntry:
try:
questExp = questEntry[QuestDictExperienceIndex]
return questExp
except:
return 100
else:
return None
def getQuestMoney(id):
questEntry = QuestDict.get(id)
if questEntry:
try:
questMoney = questEntry[QuestDictMoneyIndex]
return questMoney
except:
return 100
else:
return 0
return 0
def getQuestClass(id):
questEntry = QuestDict.get(id)
if questEntry:
return questEntry[QuestDictDescIndex][0]
else:
return None
def getVisitSCStrings(npcId):
if npcId == ToonHQ:
strings = [TTLocalizer.QuestsRecoverItemQuestSeeHQSCString, TTLocalizer.QuestsRecoverItemQuestGoToHQSCString]
elif npcId == ToonTailor:
strings = [TTLocalizer.QuestsTailorQuestSCString]
elif npcId:
npcName, hoodName, buildingArticle, buildingName, toStreet, streetName, isInPlayground = getNpcInfo(npcId)
strings = [TTLocalizer.QuestsVisitQuestSeeSCString % npcName]
if isInPlayground:
strings.append(TTLocalizer.QuestsRecoverItemQuestGoToPlaygroundSCString % hoodName)
else:
strings.append(TTLocalizer.QuestsRecoverItemQuestGoToStreetSCString % {'to': toStreet,
'street': streetName,
'hood': hoodName})
strings.extend([TTLocalizer.QuestsRecoverItemQuestVisitBuildingSCString % (buildingArticle, buildingName), TTLocalizer.QuestsRecoverItemQuestWhereIsBuildingSCString % (buildingArticle, buildingName)])
return strings
def getFinishToonTaskSCStrings(npcId):
return [TTLocalizer.QuestsGenericFinishSCString] + getVisitSCStrings(npcId)
def chooseQuestDialog(id, status):
questDialog = getQuestDialog(id).get(status)
if questDialog == None:
if status == QUEST:
quest = getQuest(id)
questDialog = quest.getDefaultQuestDialog()
else:
questDialog = DefaultDialog[status]
if type(questDialog) == type(()):
return random.choice(questDialog)
else:
return questDialog
def chooseQuestDialogReject():
return random.choice(DefaultReject)
def chooseQuestDialogTierNotDone():
return random.choice(DefaultTierNotDone)
def getNpcInfo(npcId):
npcName = NPCToons.getNPCName(npcId)
npcZone = NPCToons.getNPCZone(npcId)
hoodId = ZoneUtil.getCanonicalHoodId(npcZone)
hoodName = base.cr.hoodMgr.getFullnameFromId(hoodId)
buildingArticle = NPCToons.getBuildingArticle(npcZone)
buildingName = NPCToons.getBuildingTitle(npcZone)
branchId = ZoneUtil.getCanonicalBranchZone(npcZone)
toStreet = ToontownGlobals.StreetNames[branchId][0]
streetName = ToontownGlobals.StreetNames[branchId][-1]
isInPlayground = ZoneUtil.isPlayground(branchId)
return (npcName,
hoodName,
buildingArticle,
buildingName,
toStreet,
streetName,
isInPlayground)
def getNpcLocationDialog(fromNpcId, toNpcId):
if not toNpcId:
return (None, None, None)
fromNpcZone = None
fromBranchId = None
if fromNpcId:
fromNpcZone = NPCToons.getNPCZone(fromNpcId)
fromBranchId = ZoneUtil.getCanonicalBranchZone(fromNpcZone)
toNpcZone = NPCToons.getNPCZone(toNpcId)
toBranchId = ZoneUtil.getCanonicalBranchZone(toNpcZone)
toNpcName, toHoodName, toBuildingArticle, toBuildingName, toStreetTo, toStreetName, isInPlayground = getNpcInfo(toNpcId)
if fromBranchId == toBranchId:
if isInPlayground:
streetDesc = TTLocalizer.QuestsStreetLocationThisPlayground
else:
streetDesc = TTLocalizer.QuestsStreetLocationThisStreet
elif isInPlayground:
streetDesc = TTLocalizer.QuestsStreetLocationNamedPlayground % toHoodName
else:
streetDesc = TTLocalizer.QuestsStreetLocationNamedStreet % {'toStreetName': toStreetName,
'toHoodName': toHoodName}
paragraph = TTLocalizer.QuestsLocationParagraph % {'building': TTLocalizer.QuestsLocationBuilding % toNpcName,
'buildingName': toBuildingName,
'buildingVerb': TTLocalizer.QuestsLocationBuildingVerb,
'street': streetDesc}
return (paragraph, toBuildingName, streetDesc)
def fillInQuestNames(text, avName = None, fromNpcId = None, toNpcId = None):
text = copy.deepcopy(text)
toNpcName = ''
fromNpcName = ''
where = ''
buildingName = ''
streetDesc = ''
if avName != None:
text = text.replace('_avName_', avName)
if toNpcId:
if toNpcId == ToonHQ:
toNpcName = TTLocalizer.QuestsHQOfficerFillin
where = TTLocalizer.QuestsHQWhereFillin
buildingName = TTLocalizer.QuestsHQBuildingNameFillin
streetDesc = TTLocalizer.QuestsHQLocationNameFillin
elif toNpcId == ToonTailor:
toNpcName = TTLocalizer.QuestsTailorFillin
where = TTLocalizer.QuestsTailorWhereFillin
buildingName = TTLocalizer.QuestsTailorBuildingNameFillin
streetDesc = TTLocalizer.QuestsTailorLocationNameFillin
else:
toNpcName = str(NPCToons.getNPCName(toNpcId))
where, buildingName, streetDesc = getNpcLocationDialog(fromNpcId, toNpcId)
if fromNpcId:
fromNpcName = str(NPCToons.getNPCName(fromNpcId))
text = text.replace('_toNpcName_', toNpcName)
text = text.replace('_fromNpcName_', fromNpcName)
text = text.replace('_where_', where)
text = text.replace('_buildingName_', buildingName)
text = text.replace('_streetDesc_', streetDesc)
return text
def getVisitingQuest():
return VisitQuest(VISIT_QUEST_ID)
class Reward:
def __init__(self, id, reward):
self.id = id
self.reward = reward
def getId(self):
return self.id
def getType(self):
return self.__class__
def getAmount(self):
return None
def sendRewardAI(self, av):
raise 'not implemented'
def countReward(self, qrc):
raise 'not implemented'
def getString(self):
return 'undefined'
def getPosterString(self):
return 'base class'
class MaxHpReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getAmount(self):
return self.reward[0]
def sendRewardAI(self, av):
maxHp = av.getMaxHp()
maxHp = min(ToontownGlobals.MaxHpLimit, maxHp + self.getAmount())
av.b_setMaxHp(maxHp)
av.toonUp(maxHp)
def countReward(self, qrc):
qrc.maxHp += self.getAmount()
def getString(self):
return TTLocalizer.QuestsMaxHpReward % self.getAmount()
def getPosterString(self):
return TTLocalizer.QuestsMaxHpRewardPoster % self.getAmount()
class MoneyReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getAmount(self):
return self.reward[0]
def sendRewardAI(self, av):
money = av.getMoney()
maxMoney = av.getMaxMoney()
av.addMoney(self.getAmount())
def countReward(self, qrc):
qrc.money += self.getAmount()
def getString(self):
amt = self.getAmount()
if amt == 1:
return TTLocalizer.QuestsMoneyRewardSingular
else:
return TTLocalizer.QuestsMoneyRewardPlural % amt
def getPosterString(self):
amt = self.getAmount()
if amt == 1:
return TTLocalizer.QuestsMoneyRewardPosterSingular
else:
return TTLocalizer.QuestsMoneyRewardPosterPlural % amt
class MaxMoneyReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getAmount(self):
return self.reward[0]
def sendRewardAI(self, av):
av.b_setMaxMoney(av.getMaxMoney() + self.getAmount())
def countReward(self, qrc):
qrc.maxMoney = self.getAmount()
def getString(self):
amt = self.getAmount()
if amt == 1:
return TTLocalizer.QuestsMaxMoneyRewardSingular
else:
return TTLocalizer.QuestsMaxMoneyRewardPlural % amt
def getPosterString(self):
amt = self.getAmount()
if amt == 1:
return TTLocalizer.QuestsMaxMoneyRewardPosterSingular
else:
return TTLocalizer.QuestsMaxMoneyRewardPosterPlural % amt
class MaxGagCarryReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getAmount(self):
return self.reward[0]
def sendRewardAI(self, av):
av.b_setMaxCarry(av.getMaxCarry() + self.getAmount())
def countReward(self, qrc):
qrc.maxCarry = self.getAmount()
def getString(self):
amt = self.getAmount()
return TTLocalizer.QuestsMaxGagCarryReward % amt
def getPosterString(self):
amt = self.getAmount()
return TTLocalizer.QuestsMaxGagCarryRewardPoster % amt
class MaxQuestCarryReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getAmount(self):
return self.reward[0]
def sendRewardAI(self, av):
av.b_setQuestCarryLimit(self.getAmount())
def countReward(self, qrc):
qrc.questCarryLimit = self.getAmount()
def getString(self):
amt = self.getAmount()
return TTLocalizer.QuestsMaxQuestCarryReward % amt
def getPosterString(self):
amt = self.getAmount()
return TTLocalizer.QuestsMaxQuestCarryRewardPoster % amt
class TeleportReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getZone(self):
return self.reward[0]
def sendRewardAI(self, av):
av.addTeleportAccess(self.getZone())
def countReward(self, qrc):
pass
def getString(self):
hoodName = ToontownGlobals.hoodNameMap[self.getZone()][-1]
return TTLocalizer.QuestsTeleportReward % hoodName
def getPosterString(self):
hoodName = ToontownGlobals.hoodNameMap[self.getZone()][-1]
return TTLocalizer.QuestsTeleportRewardPoster % hoodName
TrackTrainingQuotas = {ToontownBattleGlobals.HEAL_TRACK: 15,
ToontownBattleGlobals.TRAP_TRACK: 15,
ToontownBattleGlobals.LURE_TRACK: 15,
ToontownBattleGlobals.SOUND_TRACK: 15,
ToontownBattleGlobals.THROW_TRACK: 15,
ToontownBattleGlobals.SQUIRT_TRACK: 15,
ToontownBattleGlobals.ZAP_TRACK: 15,
ToontownBattleGlobals.DROP_TRACK: 15}
class TrackTrainingReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getTrack(self):
track = self.reward[0]
if track == None:
track = 0
return track
def sendRewardAI(self, av):
av.b_setTrackProgress(self.getTrack(), 0)
def countReward(self, qrc):
qrc.trackProgressId = self.getTrack()
qrc.trackProgress = 0
def getString(self):
trackName = ToontownBattleGlobals.Tracks[self.getTrack()].capitalize()
return TTLocalizer.QuestsTrackTrainingReward % trackName
def getPosterString(self):
return TTLocalizer.QuestsTrackTrainingRewardPoster
class TrackProgressReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getTrack(self):
track = self.reward[0]
if track == None:
track = 0
return track
def getProgressIndex(self):
return self.reward[1]
def sendRewardAI(self, av):
av.addTrackProgress(self.getTrack(), self.getProgressIndex())
def countReward(self, qrc):
qrc.addTrackProgress(self.getTrack(), self.getProgressIndex())
def getString(self):
trackName = ToontownBattleGlobals.Tracks[self.getTrack()].capitalize()
return TTLocalizer.QuestsTrackProgressReward % {'frameNum': self.getProgressIndex(),
'trackName': trackName}
def getPosterString(self):
trackName = ToontownBattleGlobals.Tracks[self.getTrack()].capitalize()
return TTLocalizer.QuestsTrackProgressRewardPoster % {'trackName': trackName,
'frameNum': self.getProgressIndex()}
class TrackCompleteReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getTrack(self):
track = self.reward[0]
if track == None:
track = 0
return track
def sendRewardAI(self, av):
av.addTrackAccess(self.getTrack())
av.clearTrackProgress()
def countReward(self, qrc):
qrc.addTrackAccess(self.getTrack())
qrc.clearTrackProgress()
def getString(self):
trackName = ToontownBattleGlobals.Tracks[self.getTrack()].capitalize()
return TTLocalizer.QuestsTrackCompleteReward % trackName
def getPosterString(self):
trackName = ToontownBattleGlobals.Tracks[self.getTrack()].capitalize()
return TTLocalizer.QuestsTrackCompleteRewardPoster % trackName
class ClothingTicketReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def sendRewardAI(self, av):
pass
def countReward(self, qrc):
pass
def getString(self):
return TTLocalizer.QuestsClothingTicketReward
def getPosterString(self):
return TTLocalizer.QuestsClothingTicketRewardPoster
class TIPClothingTicketReward(ClothingTicketReward):
def __init__(self, id, reward):
ClothingTicketReward.__init__(self, id, reward)
def getString(self):
return TTLocalizer.TIPQuestsClothingTicketReward
def getPosterString(self):
return TTLocalizer.TIPQuestsClothingTicketRewardPoster
class CheesyEffectReward(Reward):
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getEffect(self):
return self.reward[0]
def getHoodId(self):
return self.reward[1]
def getDurationMinutes(self):
return self.reward[2]
def sendRewardAI(self, av):
expireTime = time.time() + int(self.getDurationMinutes() * 60)
if self.getEffect() not in av.getCheesyEffects():
av.cheesyEffects.append(self.getEffect())
av.b_setCheesyEffects(av.getCheesyEffects())
def countReward(self, qrc):
pass
def getString(self):
effect = self.getEffect()
hoodId = self.getHoodId()
duration = self.getDurationMinutes()
string = TTLocalizer.CheesyEffectMinutes
if duration > 90:
duration = int((duration + 30) / 60)
string = TTLocalizer.CheesyEffectHours
if duration > 36:
duration = int((duration + 12) / 24)
string = TTLocalizer.CheesyEffectDays
if effect == 77:
effect = 12
desc = TTLocalizer.CheesyEffectDescriptions[effect][1]
return TTLocalizer.CheesyEffectIndefinite % {'effectName': desc}
def getPosterString(self):
effect = self.getEffect()
if effect == 77:
effect = 12
desc = TTLocalizer.CheesyEffectDescriptions[effect][0]
return TTLocalizer.QuestsCheesyEffectRewardPoster % desc
class CogSuitPartReward(Reward):
trackNames = [TTLocalizer.Bossbot,
TTLocalizer.Lawbot,
TTLocalizer.Cashbot,
TTLocalizer.Sellbot]
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getCogTrack(self):
return self.reward[0]
def getCogPart(self):
return self.reward[1]
def sendRewardAI(self, av):
dept = self.getCogTrack()
part = self.getCogPart()
av.giveCogPart(part, dept)
def countReward(self, qrc):
pass
def getCogTrackName(self):
index = ToontownGlobals.cogDept2index[self.getCogTrack()]
return CogSuitPartReward.trackNames[index]
def getCogPartName(self):
index = ToontownGlobals.cogDept2index[self.getCogTrack()]
return CogDisguiseGlobals.PartsQueryNames[index][self.getCogPart()]
def getString(self):
return TTLocalizer.QuestsCogSuitPartReward % {'cogTrack': self.getCogTrackName(),
'part': self.getCogPartName()}
def getPosterString(self):
return TTLocalizer.QuestsCogSuitPartRewardPoster % {'cogTrack': self.getCogTrackName(),
'part': self.getCogPartName()}
class CogMeritReward(Reward):
meritNames = TTLocalizer.RewardPanelMeritBarLabels
def __init__(self, id, reward):
Reward.__init__(self, id, reward)
def getMeritType(self):
return self.reward[0]
def getNumMerits(self):
return self.reward[1]
def sendRewardAI(self, av):
dept = self.getMeritType()
num = self.getNumMerits()
av.addMerits(dept, num)
def countReward(self, qrc):
pass
def getMeritName(self):
return CogMeritReward.meritNames[self.getMeritType()]
def getString(self):
return TTLocalizer.QuestsCogSuitMeritReward % {'numMerits': self.getNumMerits(),
'meritType': self.getMeritName()}
def getPosterString(self):
return TTLocalizer.QuestsCogSuitMeritRewardPoster % {'numMerits': self.getNumMerits(),
'meritType': self.getMeritName()}
def getRewardClass(id):
reward = RewardDict.get(id)
if reward:
return reward[0]
else:
return None
def getReward(id):
reward = RewardDict.get(id)
if reward:
rewardClass = reward[0]
return rewardClass(id, reward[1:])
else:
notify.warning('getReward(): id %s not found.' % id)
return None
def getNextRewards(numChoices, tier, av):
rewardTier = list(getRewardsInTier(tier))
optRewards = list(getOptionalRewardsInTier(tier))
if av.getGameAccess() == OTPGlobals.AccessFull and tier == TT_TIER + 3:
optRewards = []
if isLoopingFinalTier(tier):
rewardHistory = map(lambda questDesc: questDesc[3], av.quests)
if notify.getDebug():
notify.debug('getNextRewards: current rewards (history): %s' % rewardHistory)
else:
rewardHistory = av.getRewardHistory()[1]
if notify.getDebug():
notify.debug('getNextRewards: rewardHistory: %s' % rewardHistory)
if notify.getDebug():
notify.debug('getNextRewards: rewardTier: %s' % rewardTier)
notify.debug('getNextRewards: numChoices: %s' % numChoices)
for rewardId in getRewardsInTier(tier):
if getRewardClass(rewardId) == CogSuitPartReward:
deptStr = RewardDict.get(rewardId)[1]
cogPart = RewardDict.get(rewardId)[2]
dept = ToontownGlobals.cogDept2index[deptStr]
if av.hasCogPart(cogPart, dept):
notify.debug('getNextRewards: already has cog part: %s dept: %s' % (cogPart, dept))
rewardTier.remove(rewardId)
else:
notify.debug('getNextRewards: keeping quest for cog part: %s dept: %s' % (cogPart, dept))
for rewardId in rewardHistory:
if rewardId in rewardTier:
rewardTier.remove(rewardId)
elif rewardId in optRewards:
optRewards.remove(rewardId)
elif rewardId in (901, 902, 903, 904, 905, 906, 907, 908):
genericRewardId = 900
if genericRewardId in rewardTier:
rewardTier.remove(genericRewardId)
elif rewardId > 1000 and rewardId < 1799:
index = rewardId % 100
genericRewardId = 800 + index
if genericRewardId in rewardTier:
rewardTier.remove(genericRewardId)
if numChoices == 0:
if len(rewardTier) == 0:
return []
else:
return [rewardTier[0]]
rewardPool = rewardTier[:numChoices]
for i in range(len(rewardPool), numChoices * 2):
if optRewards:
optionalReward = seededRandomChoice(optRewards)
optRewards.remove(optionalReward)
rewardPool.append(optionalReward)
else:
break
if notify.getDebug():
notify.debug('getNextRewards: starting reward pool: %s' % rewardPool)
if len(rewardPool) == 0:
if notify.getDebug():
notify.debug('getNextRewards: no rewards left at all')
return []
finalRewardPool = [rewardPool.pop(0)]
for i in range(numChoices - 1):
if len(rewardPool) == 0:
break
selectedReward = seededRandomChoice(rewardPool)
rewardPool.remove(selectedReward)
finalRewardPool.append(selectedReward)
if notify.getDebug():
notify.debug('getNextRewards: final reward pool: %s' % finalRewardPool)
return finalRewardPool
RewardDict = {100: (MaxHpReward, 1),
101: (MaxHpReward, 2),
102: (MaxHpReward, 3),
103: (MaxHpReward, 4),
104: (MaxHpReward, 5),
105: (MaxHpReward, 6),
106: (MaxHpReward, 7),
107: (MaxHpReward, 8),
108: (MaxHpReward, 9),
109: (MaxHpReward, 10),
200: (MaxGagCarryReward, 1),
201: (MaxGagCarryReward, 2),
202: (MaxGagCarryReward, 3),
203: (MaxGagCarryReward, 4),
204: (MaxGagCarryReward, 5),
205: (MaxGagCarryReward, 6),
206: (MaxGagCarryReward, 7),
207: (MaxGagCarryReward, 8),
208: (MaxGagCarryReward, 9),
209: (MaxGagCarryReward, 10),
300: (TeleportReward, ToontownGlobals.ToontownCentral),
301: (TeleportReward, ToontownGlobals.DonaldsDock),
302: (TeleportReward, ToontownGlobals.DaisyGardens),
303: (TeleportReward, ToontownGlobals.MinniesMelodyland),
304: (TeleportReward, ToontownGlobals.TheBrrrgh),
305: (TeleportReward, ToontownGlobals.DonaldsDreamland),
306: (TeleportReward, ToontownGlobals.SellbotHQ),
307: (TeleportReward, ToontownGlobals.CashbotHQ),
308: (TeleportReward, ToontownGlobals.LawbotHQ),
309: (TeleportReward, ToontownGlobals.BossbotHQ),
310: (TeleportReward, ToontownGlobals.OutdoorZone),
400: (TrackTrainingReward, None),
401: (TrackTrainingReward, ToontownBattleGlobals.HEAL_TRACK),
402: (TrackTrainingReward, ToontownBattleGlobals.TRAP_TRACK),
403: (TrackTrainingReward, ToontownBattleGlobals.LURE_TRACK),
404: (TrackTrainingReward, ToontownBattleGlobals.SOUND_TRACK),
405: (TrackTrainingReward, ToontownBattleGlobals.THROW_TRACK),
406: (TrackTrainingReward, ToontownBattleGlobals.SQUIRT_TRACK),
407: (TrackTrainingReward, ToontownBattleGlobals.ZAP_TRACK),
408: (TrackTrainingReward, ToontownBattleGlobals.DROP_TRACK),
500: (MaxQuestCarryReward, 2),
501: (MaxQuestCarryReward, 3),
502: (MaxQuestCarryReward, 4),
600: (MoneyReward, 10),
601: (MoneyReward, 20),
602: (MoneyReward, 40),
603: (MoneyReward, 60),
604: (MoneyReward, 100),
605: (MoneyReward, 150),
606: (MoneyReward, 200),
607: (MoneyReward, 250),
608: (MoneyReward, 300),
609: (MoneyReward, 400),
610: (MoneyReward, 500),
611: (MoneyReward, 600),
612: (MoneyReward, 700),
613: (MoneyReward, 800),
614: (MoneyReward, 900),
615: (MoneyReward, 1000),
616: (MoneyReward, 1100),
617: (MoneyReward, 1200),
618: (MoneyReward, 1300),
619: (MoneyReward, 1400),
620: (MoneyReward, 1500),
621: (MoneyReward, 1750),
622: (MoneyReward, 2000),
623: (MoneyReward, 2500),
700: (MaxMoneyReward, 25),
701: (MaxMoneyReward, 50),
702: (MaxMoneyReward, 75),
703: (MaxMoneyReward, 100),
704: (MaxMoneyReward, 125),
705: (MaxMoneyReward, 150),
706: (MaxMoneyReward, 175),
707: (MaxMoneyReward, 200),
801: (TrackProgressReward, None, 1),
802: (TrackProgressReward, None, 2),
803: (TrackProgressReward, None, 3),
804: (TrackProgressReward, None, 4),
805: (TrackProgressReward, None, 5),
806: (TrackProgressReward, None, 6),
807: (TrackProgressReward, None, 7),
808: (TrackProgressReward, None, 8),
809: (TrackProgressReward, None, 9),
810: (TrackProgressReward, None, 10),
811: (TrackProgressReward, None, 11),
812: (TrackProgressReward, None, 12),
813: (TrackProgressReward, None, 13),
814: (TrackProgressReward, None, 14),
815: (TrackProgressReward, None, 15),
110: (TIPClothingTicketReward,),
1000: (ClothingTicketReward,),
1001: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 1),
1002: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 2),
1003: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 3),
1004: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 4),
1005: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 5),
1006: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 6),
1007: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 7),
1008: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 8),
1009: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 9),
1010: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 10),
1011: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 11),
1012: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 12),
1013: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 13),
1014: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 14),
1015: (TrackProgressReward, ToontownBattleGlobals.HEAL_TRACK, 15),
1101: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 1),
1102: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 2),
1103: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 3),
1104: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 4),
1105: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 5),
1106: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 6),
1107: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 7),
1108: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 8),
1109: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 9),
1110: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 10),
1111: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 11),
1112: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 12),
1113: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 13),
1114: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 14),
1115: (TrackProgressReward, ToontownBattleGlobals.TRAP_TRACK, 15),
1201: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 1),
1202: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 2),
1203: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 3),
1204: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 4),
1205: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 5),
1206: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 6),
1207: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 7),
1208: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 8),
1209: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 9),
1210: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 10),
1211: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 11),
1212: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 12),
1213: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 13),
1214: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 14),
1215: (TrackProgressReward, ToontownBattleGlobals.LURE_TRACK, 15),
1301: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 1),
1302: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 2),
1303: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 3),
1304: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 4),
1305: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 5),
1306: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 6),
1307: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 7),
1308: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 8),
1309: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 9),
1310: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 10),
1311: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 11),
1312: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 12),
1313: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 13),
1314: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 14),
1315: (TrackProgressReward, ToontownBattleGlobals.SOUND_TRACK, 15),
1601: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 1),
1602: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 2),
1603: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 3),
1604: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 4),
1605: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 5),
1606: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 6),
1607: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 7),
1608: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 8),
1609: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 9),
1610: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 10),
1611: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 11),
1612: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 12),
1613: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 13),
1614: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 14),
1615: (TrackProgressReward, ToontownBattleGlobals.ZAP_TRACK, 15),
1701: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 1),
1702: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 2),
1703: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 3),
1704: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 4),
1705: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 5),
1706: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 6),
1707: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 7),
1708: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 8),
1709: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 9),
1710: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 10),
1711: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 11),
1712: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 12),
1713: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 13),
1714: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 14),
1715: (TrackProgressReward, ToontownBattleGlobals.DROP_TRACK, 15),
900: (TrackCompleteReward, None),
901: (TrackCompleteReward, ToontownBattleGlobals.HEAL_TRACK),
902: (TrackCompleteReward, ToontownBattleGlobals.TRAP_TRACK),
903: (TrackCompleteReward, ToontownBattleGlobals.LURE_TRACK),
904: (TrackCompleteReward, ToontownBattleGlobals.SOUND_TRACK),
905: (TrackCompleteReward, ToontownBattleGlobals.THROW_TRACK),
906: (TrackCompleteReward, ToontownBattleGlobals.SQUIRT_TRACK),
907: (TrackCompleteReward, ToontownBattleGlobals.ZAP_TRACK),
908: (TrackCompleteReward, ToontownBattleGlobals.DROP_TRACK),
2205: (CheesyEffectReward,
ToontownGlobals.CEBigToon,
2000,
10),
2206: (CheesyEffectReward,
ToontownGlobals.CESmallToon,
2000,
10),
2101: (CheesyEffectReward,
ToontownGlobals.CEBigHead,
1000,
10),
2102: (CheesyEffectReward,
ToontownGlobals.CESmallHead,
1000,
10),
2103: (CheesyEffectReward,
ToontownGlobals.CEWire,
1000,
10),
2105: (CheesyEffectReward,
ToontownGlobals.CEBigToon,
0,
20),
2106: (CheesyEffectReward,
ToontownGlobals.CESmallToon,
0,
20),
2107: (CheesyEffectReward,
ToontownGlobals.CEWire,
0,
20),
2501: (CheesyEffectReward,
ToontownGlobals.CEBigHead,
5000,
60),
2502: (CheesyEffectReward,
ToontownGlobals.CESmallHead,
5000,
60),
2503: (CheesyEffectReward,
ToontownGlobals.CEBigLegs,
5000,
20),
2504: (CheesyEffectReward,
ToontownGlobals.CESmallLegs,
5000,
20),
2505: (CheesyEffectReward,
ToontownGlobals.CEBigToon,
0,
60),
2506: (CheesyEffectReward,
ToontownGlobals.CESmallToon,
0,
60),
2507: (CheesyEffectReward,
ToontownGlobals.CEWire,
0,
60),
2401: (CheesyEffectReward,
ToontownGlobals.CEBigHead,
1,
120),
2402: (CheesyEffectReward,
ToontownGlobals.CESmallHead,
1,
120),
2403: (CheesyEffectReward,
ToontownGlobals.CEBigLegs,
4000,
60),
2404: (CheesyEffectReward,
ToontownGlobals.CESmallLegs,
4000,
60),
2405: (CheesyEffectReward,
ToontownGlobals.CEBigToon,
0,
120),
2406: (CheesyEffectReward,
ToontownGlobals.CESmallToon,
0,
120),
2407: (CheesyEffectReward,
ToontownGlobals.CEFlatPortrait,
4000,
30),
2408: (CheesyEffectReward,
ToontownGlobals.CEFlatProfile,
4000,
30),
2409: (CheesyEffectReward,
ToontownGlobals.CETransparent,
4000,
30),
2410: (CheesyEffectReward,
ToontownGlobals.CENoColor,
4000,
30),
2411: (CheesyEffectReward,
ToontownGlobals.CEWire,
4000,
30),
2301: (CheesyEffectReward,
ToontownGlobals.CEBigHead,
1,
360),
2302: (CheesyEffectReward,
ToontownGlobals.CESmallHead,
1,
360),
2303: (CheesyEffectReward,
ToontownGlobals.CEBigLegs,
1,
360),
2304: (CheesyEffectReward,
ToontownGlobals.CESmallLegs,
1,
360),
2305: (CheesyEffectReward,
ToontownGlobals.CEBigToon,
0,
1440),
2306: (CheesyEffectReward,
ToontownGlobals.CESmallToon,
0,
1440),
2307: (CheesyEffectReward,
ToontownGlobals.CEFlatPortrait,
3000,
240),
2308: (CheesyEffectReward,
ToontownGlobals.CEFlatProfile,
3000,
240),
2309: (CheesyEffectReward,
ToontownGlobals.CETransparent,
1,
120),
2310: (CheesyEffectReward,
ToontownGlobals.CENoColor,
1,
120),
2311: (CheesyEffectReward,
ToontownGlobals.CEInvisible,
3000,
120),
2312: (CheesyEffectReward,
ToontownGlobals.CEWire,
3000,
120),
2900: (CheesyEffectReward,
ToontownGlobals.CENormal,
0,
0),
2901: (CheesyEffectReward,
ToontownGlobals.CEBigHead,
1,
1440),
2902: (CheesyEffectReward,
ToontownGlobals.CESmallHead,
1,
1440),
2903: (CheesyEffectReward,
ToontownGlobals.CEBigLegs,
1,
1440),
2904: (CheesyEffectReward,
ToontownGlobals.CESmallLegs,
1,
1440),
2905: (CheesyEffectReward,
ToontownGlobals.CEBigToon,
0,
1440),
2906: (CheesyEffectReward,
ToontownGlobals.CESmallToon,
0,
1440),
2907: (CheesyEffectReward,
ToontownGlobals.CEFlatPortrait,
1,
1440),
2908: (CheesyEffectReward,
ToontownGlobals.CEFlatProfile,
1,
1440),
2909: (CheesyEffectReward,
ToontownGlobals.CETransparent,
1,
1440),
2910: (CheesyEffectReward,
ToontownGlobals.CENoColor,
1,
1440),
2911: (CheesyEffectReward,
ToontownGlobals.CEInvisible,
1,
1440),
2911: (CheesyEffectReward,
ToontownGlobals.CEWire,
1,
1440),
2920: (CheesyEffectReward,
ToontownGlobals.CENormal,
0,
0),
2921: (CheesyEffectReward,
ToontownGlobals.CEBigHead,
1,
2880),
2922: (CheesyEffectReward,
ToontownGlobals.CESmallHead,
1,
2880),
2923: (CheesyEffectReward,
ToontownGlobals.CEBigLegs,
1,
2880),
2924: (CheesyEffectReward,
ToontownGlobals.CESmallLegs,
1,
2880),
2925: (CheesyEffectReward,
ToontownGlobals.CEBigToon,
0,
2880),
2926: (CheesyEffectReward,
ToontownGlobals.CESmallToon,
0,
2880),
2927: (CheesyEffectReward,
ToontownGlobals.CEFlatPortrait,
1,
2880),
2928: (CheesyEffectReward,
ToontownGlobals.CEFlatProfile,
1,
2880),
2929: (CheesyEffectReward,
ToontownGlobals.CETransparent,
1,
2880),
2930: (CheesyEffectReward,
ToontownGlobals.CENoColor,
1,
2880),
2931: (CheesyEffectReward,
ToontownGlobals.CEInvisible,
1,
2880),
2932: (CheesyEffectReward,
ToontownGlobals.CEWire,
1,
2880),
2940: (CheesyEffectReward,
ToontownGlobals.CENormal,
0,
0),
2941: (CheesyEffectReward,
ToontownGlobals.CEBigHead,
1,
10080),
2942: (CheesyEffectReward,
ToontownGlobals.CESmallHead,
1,
10080),
2943: (CheesyEffectReward,
ToontownGlobals.CEBigLegs,
1,
10080),
2944: (CheesyEffectReward,
ToontownGlobals.CESmallLegs,
1,
10080),
2945: (CheesyEffectReward,
ToontownGlobals.CEBigToon,
0,
10080),
2946: (CheesyEffectReward,
ToontownGlobals.CESmallToon,
0,
10080),
2947: (CheesyEffectReward,
ToontownGlobals.CEFlatPortrait,
1,
10080),
2948: (CheesyEffectReward,
ToontownGlobals.CEFlatProfile,
1,
10080),
2949: (CheesyEffectReward,
ToontownGlobals.CETransparent,
1,
10080),
2950: (CheesyEffectReward,
ToontownGlobals.CENoColor,
1,
10080),
2951: (CheesyEffectReward,
ToontownGlobals.CEInvisible,
1,
10080),
2952: (CheesyEffectReward,
ToontownGlobals.CEWire,
1,
10080),
2960: (CheesyEffectReward,
ToontownGlobals.CENormal,
0,
0),
2961: (CheesyEffectReward,
ToontownGlobals.CEBigHead,
1,
43200),
2962: (CheesyEffectReward,
ToontownGlobals.CESmallHead,
1,
43200),
2963: (CheesyEffectReward,
ToontownGlobals.CEBigLegs,
1,
43200),
2964: (CheesyEffectReward,
ToontownGlobals.CESmallLegs,
1,
43200),
2965: (CheesyEffectReward,
ToontownGlobals.CEBigToon,
0,
43200),
2966: (CheesyEffectReward,
ToontownGlobals.CESmallToon,
0,
43200),
2967: (CheesyEffectReward,
ToontownGlobals.CEFlatPortrait,
1,
43200),
2968: (CheesyEffectReward,
ToontownGlobals.CEFlatProfile,
1,
43200),
2969: (CheesyEffectReward,
ToontownGlobals.CETransparent,
1,
43200),
2970: (CheesyEffectReward,
ToontownGlobals.CENoColor,
1,
43200),
2971: (CheesyEffectReward,
ToontownGlobals.CEInvisible,
1,
43200),
2972: (CheesyEffectReward,
ToontownGlobals.CEWire,
1,
43200),
4000: (CogSuitPartReward, 'm', CogDisguiseGlobals.leftLegUpper),
4001: (CogSuitPartReward, 'm', CogDisguiseGlobals.leftLegLower),
4002: (CogSuitPartReward, 'm', CogDisguiseGlobals.leftLegFoot),
4003: (CogSuitPartReward, 'm', CogDisguiseGlobals.rightLegUpper),
4004: (CogSuitPartReward, 'm', CogDisguiseGlobals.rightLegLower),
4005: (CogSuitPartReward, 'm', CogDisguiseGlobals.rightLegFoot),
4006: (CogSuitPartReward, 'm', CogDisguiseGlobals.upperTorso),
4007: (CogSuitPartReward, 'm', CogDisguiseGlobals.torsoPelvis),
4008: (CogSuitPartReward, 'm', CogDisguiseGlobals.leftArmUpper),
4009: (CogSuitPartReward, 'm', CogDisguiseGlobals.leftArmLower),
4010: (CogSuitPartReward, 'm', CogDisguiseGlobals.rightArmUpper),
4011: (CogSuitPartReward, 'm', CogDisguiseGlobals.rightArmLower),
4100: (CogSuitPartReward, 'l', CogDisguiseGlobals.leftLegUpper),
4101: (CogSuitPartReward, 'l', CogDisguiseGlobals.leftLegLower),
4102: (CogSuitPartReward, 'l', CogDisguiseGlobals.leftLegFoot),
4103: (CogSuitPartReward, 'l', CogDisguiseGlobals.rightLegUpper),
4104: (CogSuitPartReward, 'l', CogDisguiseGlobals.rightLegLower),
4105: (CogSuitPartReward, 'l', CogDisguiseGlobals.rightLegFoot),
4106: (CogSuitPartReward, 'l', CogDisguiseGlobals.upperTorso),
4107: (CogSuitPartReward, 'l', CogDisguiseGlobals.torsoPelvis),
4108: (CogSuitPartReward, 'l', CogDisguiseGlobals.leftArmUpper),
4109: (CogSuitPartReward, 'l', CogDisguiseGlobals.leftArmLower),
4110: (CogSuitPartReward, 'l', CogDisguiseGlobals.leftArmHand),
4111: (CogSuitPartReward, 'l', CogDisguiseGlobals.rightArmUpper),
4112: (CogSuitPartReward, 'l', CogDisguiseGlobals.rightArmLower),
4113: (CogSuitPartReward, 'l', CogDisguiseGlobals.rightArmHand),
4200: (CogSuitPartReward, 'c', CogDisguiseGlobals.leftLegUpper),
4201: (CogSuitPartReward, 'c', CogDisguiseGlobals.leftLegLower),
4202: (CogSuitPartReward, 'c', CogDisguiseGlobals.leftLegFoot),
4203: (CogSuitPartReward, 'c', CogDisguiseGlobals.rightLegUpper),
4204: (CogSuitPartReward, 'c', CogDisguiseGlobals.rightLegLower),
4205: (CogSuitPartReward, 'c', CogDisguiseGlobals.rightLegFoot),
4206: (CogSuitPartReward, 'c', CogDisguiseGlobals.torsoLeftShoulder),
4207: (CogSuitPartReward, 'c', CogDisguiseGlobals.torsoRightShoulder),
4208: (CogSuitPartReward, 'c', CogDisguiseGlobals.torsoChest),
4209: (CogSuitPartReward, 'c', CogDisguiseGlobals.torsoHealthMeter),
4210: (CogSuitPartReward, 'c', CogDisguiseGlobals.torsoPelvis),
4211: (CogSuitPartReward, 'c', CogDisguiseGlobals.leftArmUpper),
4212: (CogSuitPartReward, 'c', CogDisguiseGlobals.leftArmLower),
4213: (CogSuitPartReward, 'c', CogDisguiseGlobals.leftArmHand),
4214: (CogSuitPartReward, 'c', CogDisguiseGlobals.rightArmUpper),
4215: (CogSuitPartReward, 'c', CogDisguiseGlobals.rightArmLower),
4216: (CogSuitPartReward, 'c', CogDisguiseGlobals.rightArmHand),
4300: (CogMeritReward, 0, 100),
4301: (CogMeritReward, 0, 200),
4302: (CogMeritReward, 0, 300),
4303: (CogMeritReward, 0, 400),
4304: (CogMeritReward, 0, 500),
4305: (CogMeritReward, 0, 600),
4306: (CogMeritReward, 0, 700),
4307: (CogMeritReward, 0, 800),
4308: (CogMeritReward, 0, 900),
4309: (CogMeritReward, 0, 1000),
4310: (CogMeritReward, 1, 100),
4311: (CogMeritReward, 1, 200),
4312: (CogMeritReward, 1, 300),
4313: (CogMeritReward, 1, 400),
4314: (CogMeritReward, 1, 500),
4315: (CogMeritReward, 1, 600),
4316: (CogMeritReward, 1, 700),
4317: (CogMeritReward, 1, 800),
4318: (CogMeritReward, 1, 900),
4319: (CogMeritReward, 1, 1000),
4320: (CogMeritReward, 2, 100),
4321: (CogMeritReward, 2, 200),
4322: (CogMeritReward, 2, 300),
4323: (CogMeritReward, 2, 400),
4324: (CogMeritReward, 2, 500),
4325: (CogMeritReward, 2, 600),
4326: (CogMeritReward, 2, 700),
4327: (CogMeritReward, 2, 800),
4328: (CogMeritReward, 2, 900),
4329: (CogMeritReward, 2, 1000),
4330: (CogMeritReward, 3, 100),
4331: (CogMeritReward, 3, 200),
4332: (CogMeritReward, 3, 300),
4333: (CogMeritReward, 3, 400),
4334: (CogMeritReward, 3, 500),
4335: (CogMeritReward, 3, 600),
4336: (CogMeritReward, 3, 700),
4337: (CogMeritReward, 3, 800),
4338: (CogMeritReward, 3, 900),
4339: (CogMeritReward, 3, 1000),
4340: (CogMeritReward, 4, 100),
4341: (CogMeritReward, 4, 200),
4342: (CogMeritReward, 4, 300),
4343: (CogMeritReward, 4, 400),
4344: (CogMeritReward, 4, 500),
4345: (CogMeritReward, 4, 600),
4346: (CogMeritReward, 4, 700),
4347: (CogMeritReward, 4, 800),
4348: (CogMeritReward, 4, 900),
4349: (CogMeritReward, 4, 1000)}
def getNumTiers():
return len(RequiredRewardTrackDict) - 1
def isLoopingFinalTier(tier):
return tier == LOOPING_FINAL_TIER
def getRewardsInTier(tier):
return RequiredRewardTrackDict.get(tier, [])
def getNumRewardsInTier(tier):
return len(RequiredRewardTrackDict.get(tier, []))
def rewardTierExists(tier):
return RequiredRewardTrackDict.has_key(tier)
def getOptionalRewardsInTier(tier):
return OptionalRewardTrackDict.get(tier, [])
def getRewardIdFromTrackId(trackId):
return 401 + trackId
RequiredRewardTrackDict = {TT_TIER: (100,),
TT_TIER + 1: (400,),
TT_TIER + 2: (100, 801, 204, 802, 803, 101, 804, 805, 102, 806, 807, 100, 808, 809, 101, 810, 811, 500, 812, 813, 700, 814, 815, 300),
TT_TIER + 3: (900,),
DD_TIER: (400,),
DD_TIER + 1: (101, 801, 802, 204, 803, 804, 100, 805, 806, 102, 807, 808, 100, 809, 810, 101, 811, 812, 701, 813, 814, 815, 301),
DD_TIER + 2: (900,),
AA_TIER: (400,),
AA_TIER + 1: (100, 801, 802, 209, 803, 804, 102, 101, 805, 806, 100, 501, 807, 808, 101, 809, 810, 811, 812, 813, 702, 814, 815, 310),
AA_TIER + 2: (900,),
DG_TIER: (100, 209, 102, 100, 101, 703, 101, 302),
MM_TIER: (400,),
MM_TIER + 1: (801, 802, 100, 803, 101, 804, 102, 209, 805, 806, 807, 100, 502, 808, 809, 810, 811, 812, 303, 101, 813, 704, 814, 815),
MM_TIER + 2: (900,),
BR_TIER: (400,),
BR_TIER + 1: (100, 801, 802, 209, 803, 804, 101, 805, 806, 807, 808, 102, 809, 810, 705, 811, 812, 100, 813, 814, 101, 815, 304),
BR_TIER + 2: (900,),
DL_TIER: (100, 209, 102, 103, 101, 706, 305),
DL_TIER + 1: (100, 209, 101, 102, 707, 103),
DL_TIER + 2: (100, 101, 102, 103, 209),
DL_TIER + 3: (102, 101, 100, 209, 707, 102),
ELDER_TIER: ()}
OptionalRewardTrackDict = {TT_TIER: (),
TT_TIER + 1: (),
TT_TIER + 2: (1000, 601, 601, 602, 602, 2205, 2206, 2205, 2206),
TT_TIER + 3: (601, 601, 602, 602, 2205, 2206, 2205, 2206),
DD_TIER: (1000, 601, 602, 603, 603, 2101, 2102, 2105, 2106),
DD_TIER + 1: (1000, 602, 602, 603, 603, 2101, 2102, 2105, 2106),
DD_TIER + 2: (1000, 602, 602, 603, 603, 2101, 2102, 2105, 2106),
AA_TIER: (1000, 602, 602, 603, 603, 2101, 2102, 2105, 2106),
AA_TIER + 1: (1000, 602, 602, 603, 603, 2101, 2102, 2105, 2106),
AA_TIER + 2: (1000, 602, 602, 603, 603, 2101, 2102, 2105, 2106),
DG_TIER: (1000, 603, 603, 604, 604, 2501, 2502, 2503, 2504, 2505, 2506, 2411),
MM_TIER: (1000, 604, 604, 605, 605, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2411),
MM_TIER + 1: (1000, 604, 604, 605, 605, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2411),
MM_TIER + 2: (1000, 604, 604, 605, 605, 2403, 2404, 2405, 2406, 2407, 2408, 2409, 2411),
BR_TIER: (1000, 606, 606, 606, 606, 606, 607, 607, 607, 607, 607, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 4330, 4331),
BR_TIER + 1: (1000, 606, 606, 606, 606, 606, 607, 607, 607, 607, 607, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 4330, 4331),
BR_TIER + 2: (1000, 606, 606, 606, 606, 606, 607, 607, 607, 607, 607, 2305, 2306, 2307, 2308, 2309, 2310, 2311, 2312, 4330, 4331),
DL_TIER: (607, 607, 607, 607, 608, 608, 608, 608, 2901, 2902, 2907, 2908, 2909, 2910, 2911, 2912, 4331, 4330, 4321, 4320),
DL_TIER + 1: (1000, 607, 607, 607, 607, 608, 608, 608, 608, 2923, 2924, 2927, 2928, 2929, 2930, 2931, 2932, 4330, 4331, 4320, 4321),
DL_TIER + 2: (608, 608, 608, 608, 609, 609, 609, 609, 2941, 2942, 2943, 2944, 2947, 2948, 2949, 2950, 2951, 2952, 4330, 4331, 4320, 4321, 4310, 4311),
DL_TIER + 3: (1000, 609, 609, 609, 609, 609, 609, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 4330, 4331, 4320, 4321, 4310, 4311, 4300, 4301),
ELDER_TIER: (1000, 1000, 610, 611, 612, 613, 614, 615, 616, 617, 618, 2961, 2962, 2963, 2964, 2965, 2966, 2967, 2968, 2969, 2970, 2971, 2972, 4334, 4335, 4336, 4324, 4325, 4326, 4314, 4315, 4316, 4304, 4305, 4306)}
def isRewardOptional(tier, rewardId):
return OptionalRewardTrackDict.has_key(tier) and rewardId in OptionalRewardTrackDict[tier]
def getItemName(itemId):
return ItemDict[itemId][0]
def getPluralItemName(itemId):
return ItemDict[itemId][1]
def avatarHasTrolleyQuest(av):
return len(av.quests) == 1 and av.quests[0][0] == TROLLEY_QUEST_ID
def avatarHasCompletedTrolleyQuest(av):
return av.quests[0][4] > 0
def avatarHasFirstCogQuest(av):
return len(av.quests) == 1 and av.quests[0][0] == FIRST_COG_QUEST_ID
def avatarHasCompletedFirstCogQuest(av):
return av.quests[0][4] > 0
def avatarHasFriendQuest(av):
return False
def avatarHasCompletedFriendQuest(av):
return True
def avatarHasPhoneQuest(av):
return False
def avatarHasCompletedPhoneQuest(av):
return True
def avatarWorkingOnRequiredRewards(av):
tier = av.getRewardTier()
rewardList = list(getRewardsInTier(tier))
for i in range(len(rewardList)):
actualRewardId = transformReward(rewardList[i], av)
rewardList[i] = actualRewardId
for questDesc in av.quests:
questId = questDesc[0]
rewardId = questDesc[3]
if rewardId in rewardList:
return 1
if rewardId == NA:
rewardId = transformReward(getFinalRewardId(questId, fAll=1), av)
if rewardId in rewardList:
return 1
return 0
def avatarHasAllRequiredRewards(av, tier):
rewardHistory = list(av.getRewardHistory()[1])
avQuests = av.getQuests()
for i in xrange(0, len(avQuests), 5):
questDesc = avQuests[i:i + 5]
questId, fromNpcId, toNpcId, rewardId, toonProgress = questDesc
transformedRewardId = transformReward(rewardId, av)
if rewardId in rewardHistory:
rewardHistory.remove(rewardId)
if transformedRewardId in rewardHistory:
rewardHistory.remove(transformedRewardId)
rewardList = getRewardsInTier(tier)
notify.debug('checking avatarHasAllRequiredRewards: history: %s, tier: %s' % (rewardHistory, rewardList))
for rewardId in rewardList:
if rewardId == 900:
found = 0
for actualRewardId in (901, 902, 903, 904, 905, 906, 907, 908):
if actualRewardId in rewardHistory:
found = 1
rewardHistory.remove(actualRewardId)
if notify.getDebug():
notify.debug('avatarHasAllRequiredRewards: rewardId 900 found as: %s' % actualRewardId)
break
if not found:
if notify.getDebug():
notify.debug('avatarHasAllRequiredRewards: rewardId 900 not found')
return 0
else:
actualRewardId = transformReward(rewardId, av)
if actualRewardId in rewardHistory:
rewardHistory.remove(actualRewardId)
else:
if notify.getDebug():
notify.debug('avatarHasAllRequiredRewards: rewardId %s not found' % actualRewardId)
return 0
if notify.getDebug():
notify.debug('avatarHasAllRequiredRewards: remaining rewards: %s' % rewardHistory)
for rewardId in rewardHistory:
if not isRewardOptional(tier, rewardId):
notify.warning('required reward found, expected only optional: %s' % rewardId)
return 1
def nextQuestList(nextQuest):
if nextQuest == NA:
return None
else:
seqTypes = (types.ListType, types.TupleType)
if type(nextQuest) in seqTypes:
return nextQuest
return (nextQuest,)
def checkReward(questId, forked = 0):
quest = QuestDict[questId]
reward = quest[5]
nextQuests = nextQuestList(quest[6])
if nextQuests is None:
validRewards = RewardDict.keys() + [Any,
AnyCashbotSuitPart,
AnyLawbotSuitPart,
OBSOLETE]
if reward is OBSOLETE:
print 'warning: quest %s is obsolete' % questId
return reward
else:
forked = forked or len(nextQuests) > 1
firstReward = checkReward(nextQuests[0], forked)
for qId in nextQuests[1:]:
thisReward = checkReward(qId, forked)
return firstReward
def assertAllQuestsValid():
print 'checking quests...'
for questId in QuestDict.keys():
try:
quest = getQuest(questId)
except AssertionError as e:
err = 'invalid quest: %s' % questId
print err
raise
for questId in QuestDict.keys():
quest = QuestDict[questId]
tier, start, questDesc, fromNpc, toNpc, reward, nextQuest, dialog = quest
if start:
checkReward(questId)
| [
"[email protected]"
] | |
1adddccff76d4ac8f1a4fb4fabee0bfe6a4b1109 | d5292505eb7b8b93eca743eb187a04ea58d6b6a3 | /venv/Lib/site-packages/networkx/convert.py | c25cde82fba68bbd0569f0c9e64cf4d4b24741ae | [
"Unlicense"
] | permissive | waleko/facerecognition | 9b017b14e0a943cd09844247d67e92f7b6d658fa | ea13b121d0b86646571f3a875c614d6bb4038f6a | refs/heads/exp | 2021-06-03T10:57:55.577962 | 2018-09-04T19:45:18 | 2018-09-04T19:45:18 | 131,740,335 | 5 | 1 | Unlicense | 2020-01-19T10:45:25 | 2018-05-01T17:10:42 | Python | UTF-8 | Python | false | false | 13,424 | py | """Functions to convert NetworkX graphs to and from other formats.
The preferred way of converting data to a NetworkX graph is through the
graph constuctor. The constructor calls the to_networkx_graph() function
which attempts to guess the input type and convert it automatically.
Examples
--------
Create a graph with a single edge from a dictionary of dictionaries
>>> d={0: {1: 1}} # dict-of-dicts single edge (0,1)
>>> G=nx.Graph(d)
See Also
--------
nx_agraph, nx_pydot
"""
# Copyright (C) 2006-2013 by
# Aric Hagberg <[email protected]>
# Dan Schult <[email protected]>
# Pieter Swart <[email protected]>
# All rights reserved.
# BSD license.
import warnings
import networkx as nx
__author__ = """\n""".join(['Aric Hagberg <[email protected]>',
'Pieter Swart ([email protected])',
'Dan Schult([email protected])'])
__all__ = ['to_networkx_graph',
'from_dict_of_dicts', 'to_dict_of_dicts',
'from_dict_of_lists', 'to_dict_of_lists',
'from_edgelist', 'to_edgelist']
def _prep_create_using(create_using):
"""Return a graph object ready to be populated.
If create_using is None return the default (just networkx.Graph())
If create_using.clear() works, assume it returns a graph object.
Otherwise raise an exception because create_using is not a networkx graph.
"""
if create_using is None:
return nx.Graph()
try:
create_using.clear()
except:
raise TypeError("Input graph is not a networkx graph type")
return create_using
def to_networkx_graph(data, create_using=None, multigraph_input=False):
"""Make a NetworkX graph from a known data structure.
The preferred way to call this is automatically
from the class constructor
>>> d = {0: {1: {'weight':1}}} # dict-of-dicts single edge (0,1)
>>> G = nx.Graph(d)
instead of the equivalent
>>> G = nx.from_dict_of_dicts(d)
Parameters
----------
data : object to be converted
Current known types are:
any NetworkX graph
dict-of-dicts
dict-of-lists
list of edges
Pandas DataFrame (row per edge)
numpy matrix
numpy ndarray
scipy sparse matrix
pygraphviz agraph
create_using : NetworkX graph
Use specified graph for result. Otherwise a new graph is created.
multigraph_input : bool (default False)
If True and data is a dict_of_dicts,
try to create a multigraph assuming dict_of_dict_of_lists.
If data and create_using are both multigraphs then create
a multigraph from a multigraph.
"""
# NX graph
if hasattr(data, "adj"):
try:
result = from_dict_of_dicts(data.adj,
create_using=create_using,
multigraph_input=data.is_multigraph())
if hasattr(data, 'graph'): # data.graph should be dict-like
result.graph.update(data.graph)
if hasattr(data, 'nodes'): # data.nodes should be dict-like
result._node.update((n, dd.copy()) for n, dd in data.nodes.items())
return result
except:
raise nx.NetworkXError("Input is not a correct NetworkX graph.")
# pygraphviz agraph
if hasattr(data, "is_strict"):
try:
return nx.nx_agraph.from_agraph(data, create_using=create_using)
except:
raise nx.NetworkXError("Input is not a correct pygraphviz graph.")
# dict of dicts/lists
if isinstance(data, dict):
try:
return from_dict_of_dicts(data, create_using=create_using,
multigraph_input=multigraph_input)
except:
try:
return from_dict_of_lists(data, create_using=create_using)
except:
raise TypeError("Input is not known type.")
# list or generator of edges
if (isinstance(data, (list, tuple)) or
any(hasattr(data, attr) for attr in ['_adjdict', 'next', '__next__'])):
try:
return from_edgelist(data, create_using=create_using)
except:
raise nx.NetworkXError("Input is not a valid edge list")
# Pandas DataFrame
try:
import pandas as pd
if isinstance(data, pd.DataFrame):
if data.shape[0] == data.shape[1]:
try:
return nx.from_pandas_adjacency(data, create_using=create_using)
except:
msg = "Input is not a correct Pandas DataFrame adjacency matrix."
raise nx.NetworkXError(msg)
else:
try:
return nx.from_pandas_edgelist(data, edge_attr=True, create_using=create_using)
except:
msg = "Input is not a correct Pandas DataFrame edge-list."
raise nx.NetworkXError(msg)
except ImportError:
msg = 'pandas not found, skipping conversion test.'
warnings.warn(msg, ImportWarning)
# numpy matrix or ndarray
try:
import numpy
if isinstance(data, (numpy.matrix, numpy.ndarray)):
try:
return nx.from_numpy_matrix(data, create_using=create_using)
except:
raise nx.NetworkXError(
"Input is not a correct numpy matrix or array.")
except ImportError:
warnings.warn('numpy not found, skipping conversion test.',
ImportWarning)
# scipy sparse matrix - any format
try:
import scipy
if hasattr(data, "format"):
try:
return nx.from_scipy_sparse_matrix(data, create_using=create_using)
except:
raise nx.NetworkXError(
"Input is not a correct scipy sparse matrix type.")
except ImportError:
warnings.warn('scipy not found, skipping conversion test.',
ImportWarning)
raise nx.NetworkXError(
"Input is not a known data type for conversion.")
def to_dict_of_lists(G, nodelist=None):
"""Return adjacency representation of graph as a dictionary of lists.
Parameters
----------
G : graph
A NetworkX graph
nodelist : list
Use only nodes specified in nodelist
Notes
-----
Completely ignores edge data for MultiGraph and MultiDiGraph.
"""
if nodelist is None:
nodelist = G
d = {}
for n in nodelist:
d[n] = [nbr for nbr in G.neighbors(n) if nbr in nodelist]
return d
def from_dict_of_lists(d, create_using=None):
"""Return a graph from a dictionary of lists.
Parameters
----------
d : dictionary of lists
A dictionary of lists adjacency representation.
create_using : NetworkX graph
Use specified graph for result. Otherwise a new graph is created.
Examples
--------
>>> dol = {0: [1]} # single edge (0,1)
>>> G = nx.from_dict_of_lists(dol)
or
>>> G = nx.Graph(dol) # use Graph constructor
"""
G = _prep_create_using(create_using)
G.add_nodes_from(d)
if G.is_multigraph() and not G.is_directed():
# a dict_of_lists can't show multiedges. BUT for undirected graphs,
# each edge shows up twice in the dict_of_lists.
# So we need to treat this case separately.
seen = {}
for node, nbrlist in d.items():
for nbr in nbrlist:
if nbr not in seen:
G.add_edge(node, nbr)
seen[node] = 1 # don't allow reverse edge to show up
else:
G.add_edges_from(((node, nbr) for node, nbrlist in d.items()
for nbr in nbrlist))
return G
def to_dict_of_dicts(G, nodelist=None, edge_data=None):
"""Return adjacency representation of graph as a dictionary of dictionaries.
Parameters
----------
G : graph
A NetworkX graph
nodelist : list
Use only nodes specified in nodelist
edge_data : list, optional
If provided, the value of the dictionary will be
set to edge_data for all edges. This is useful to make
an adjacency matrix type representation with 1 as the edge data.
If edgedata is None, the edgedata in G is used to fill the values.
If G is a multigraph, the edgedata is a dict for each pair (u,v).
"""
dod = {}
if nodelist is None:
if edge_data is None:
for u, nbrdict in G.adjacency():
dod[u] = nbrdict.copy()
else: # edge_data is not None
for u, nbrdict in G.adjacency():
dod[u] = dod.fromkeys(nbrdict, edge_data)
else: # nodelist is not None
if edge_data is None:
for u in nodelist:
dod[u] = {}
for v, data in ((v, data) for v, data in G[u].items() if v in nodelist):
dod[u][v] = data
else: # nodelist and edge_data are not None
for u in nodelist:
dod[u] = {}
for v in (v for v in G[u] if v in nodelist):
dod[u][v] = edge_data
return dod
def from_dict_of_dicts(d, create_using=None, multigraph_input=False):
"""Return a graph from a dictionary of dictionaries.
Parameters
----------
d : dictionary of dictionaries
A dictionary of dictionaries adjacency representation.
create_using : NetworkX graph
Use specified graph for result. Otherwise a new graph is created.
multigraph_input : bool (default False)
When True, the values of the inner dict are assumed
to be containers of edge data for multiple edges.
Otherwise this routine assumes the edge data are singletons.
Examples
--------
>>> dod = {0: {1: {'weight': 1}}} # single edge (0,1)
>>> G = nx.from_dict_of_dicts(dod)
or
>>> G = nx.Graph(dod) # use Graph constructor
"""
G = _prep_create_using(create_using)
G.add_nodes_from(d)
# is dict a MultiGraph or MultiDiGraph?
if multigraph_input:
# make a copy of the list of edge data (but not the edge data)
if G.is_directed():
if G.is_multigraph():
G.add_edges_from((u, v, key, data)
for u, nbrs in d.items()
for v, datadict in nbrs.items()
for key, data in datadict.items())
else:
G.add_edges_from((u, v, data)
for u, nbrs in d.items()
for v, datadict in nbrs.items()
for key, data in datadict.items())
else: # Undirected
if G.is_multigraph():
seen = set() # don't add both directions of undirected graph
for u, nbrs in d.items():
for v, datadict in nbrs.items():
if (u, v) not in seen:
G.add_edges_from((u, v, key, data)
for key, data in datadict.items())
seen.add((v, u))
else:
seen = set() # don't add both directions of undirected graph
for u, nbrs in d.items():
for v, datadict in nbrs.items():
if (u, v) not in seen:
G.add_edges_from((u, v, data)
for key, data in datadict.items())
seen.add((v, u))
else: # not a multigraph to multigraph transfer
if G.is_multigraph() and not G.is_directed():
# d can have both representations u-v, v-u in dict. Only add one.
# We don't need this check for digraphs since we add both directions,
# or for Graph() since it is done implicitly (parallel edges not allowed)
seen = set()
for u, nbrs in d.items():
for v, data in nbrs.items():
if (u, v) not in seen:
G.add_edge(u, v, key=0)
G[u][v][0].update(data)
seen.add((v, u))
else:
G.add_edges_from(((u, v, data)
for u, nbrs in d.items()
for v, data in nbrs.items()))
return G
def to_edgelist(G, nodelist=None):
"""Return a list of edges in the graph.
Parameters
----------
G : graph
A NetworkX graph
nodelist : list
Use only nodes specified in nodelist
"""
if nodelist is None:
return G.edges(data=True)
return G.edges(nodelist, data=True)
def from_edgelist(edgelist, create_using=None):
"""Return a graph from a list of edges.
Parameters
----------
edgelist : list or iterator
Edge tuples
create_using : NetworkX graph
Use specified graph for result. Otherwise a new graph is created.
Examples
--------
>>> edgelist = [(0, 1)] # single edge (0,1)
>>> G = nx.from_edgelist(edgelist)
or
>>> G = nx.Graph(edgelist) # use Graph constructor
"""
G = _prep_create_using(create_using)
G.add_edges_from(edgelist)
return G
| [
"[email protected]"
] | |
c31eab571b99a610289be0215b55c0b96a403c9d | 92429015d9a1f1cea9b9bf2c9f1a8a7a07586af5 | /attack_methods/feat_test_interface.py | 9cb5c53ae4fc13ba93a936aded8839b658eb5c61 | [] | no_license | arthur-qiu/adv_vis | 46a953ce6c3d562137c8e566bc9b523e25bc5bbd | ba46c00cf38ca5186d7db84844892036ed714eaf | refs/heads/master | 2021-01-03T23:00:45.065108 | 2020-04-05T03:47:01 | 2020-04-05T03:47:01 | 240,272,320 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 5,488 | py | import torch
import torch.nn as nn
import torch.nn.functional as F
from attack_methods import pgd, feature_targets
class Restart_PGD(nn.Module):
def __init__(self, epsilon, num_steps, step_size, num_restart = 10, data_min = -1.0, data_max = 1.0):
super().__init__()
self.epsilon = epsilon
self.num_steps = num_steps
self.step_size = step_size
self.num_restart = num_restart
self.data_min = data_min
self.data_max = data_max
self.untargeted_pgd = pgd.PGD(epsilon=epsilon, num_steps=num_steps, step_size=step_size, data_min=data_min, data_max=data_max).cuda()
def forward(self, model, bx, by):
final_results = torch.zeros_like(by).byte() + 1
for re in range(self.num_restart):
adv_bx = self.untargeted_pgd(model, bx, by)
logits = model(adv_bx)
if len(logits) == 2:
logits = logits[1]
pred = logits.data.max(1)[1]
correct = pred.eq(by.data)
final_results &= correct
if re == 0:
single_correct = final_results.sum().item()
final_correct = final_results.sum().item()
return final_correct, single_correct
class Mult_Targets(nn.Module):
def __init__(self, epsilon, num_steps, step_size, num_classes = 10, data_min = -1.0, data_max = 1.0):
super().__init__()
self.epsilon = epsilon
self.num_steps = num_steps
self.step_size = step_size
self.num_classes = num_classes
self.data_min = data_min
self.data_max = data_max
self.targeted_pgd = pgd.PGD_Margin_Target(epsilon=epsilon, num_steps=num_steps, step_size=step_size, data_min=data_min, data_max=data_max).cuda()
def forward(self, model, bx, by):
final_results = torch.zeros_like(by).byte() + 1
for re in range(1, self.num_classes):
adv_bx = self.targeted_pgd(model, bx, by, (by+re)%self.num_classes)
logits = model(adv_bx)
if len(logits) == 2:
logits = logits[1]
pred = logits.data.max(1)[1]
correct = pred.eq(by.data)
final_results &= correct
if re == 1:
single_correct = final_results.sum().item()
final_correct = final_results.sum().item()
return final_correct, single_correct
class Feature_Attack(nn.Module):
def __init__(self, epsilon, num_steps, step_size, num_classes = 10, data_min = -1.0, data_max = 1.0):
super().__init__()
self.epsilon = epsilon
self.num_steps = num_steps
self.step_size = step_size
self.num_classes = num_classes
self.data_min = data_min
self.data_max = data_max
self.feature_attack = feature_targets.Feature_Targets(epsilon=epsilon, num_steps=num_steps, step_size=step_size, data_min=data_min, data_max=data_max).cuda()
def forward(self, model, bx, by, target_bx):
final_results = torch.zeros_like(by).byte() + 1
for re in range(target_bx.shape[0]):
adv_bx = self.feature_attack(model, bx, by, torch.cat((target_bx[re:], target_bx[:re]),0))
logits = model(adv_bx)
if len(logits) == 2:
logits = logits[1]
pred = logits.data.max(1)[1]
correct = pred.eq(by.data)
final_results &= correct
if re == 0:
single_correct = final_results.sum().item()
final_correct = final_results.sum().item()
return final_correct, single_correct
class Test_All(nn.Module):
def __init__(self, epsilon, num_steps, step_size, data_min = -1.0, data_max = 1.0):
super().__init__()
self.epsilon = epsilon
self.num_steps = num_steps
self.step_size = step_size
self.data_min = data_min
self.data_max = data_max
self.untargeted_pgd = pgd.PGD(epsilon=epsilon, num_steps=num_steps, step_size=step_size, data_min=data_min, data_max=data_max).cuda()
self.targeted_pgd = pgd.PGD(epsilon=epsilon, num_steps=num_steps, step_size=step_size, data_min=data_min, data_max=data_max).cuda()
self.feature_attack = feature_targets.Feature_Targets(epsilon=epsilon, num_steps=num_steps, step_size=step_size, data_min=data_min, data_max=data_max).cuda()
def forward(self, model, bx, by, target_bx):
"""
:param model: the classifier's forward method
:param bx: batch of images
:param by: true labels
:return: perturbed batch of images
"""
adv_bx = bx.detach().clone()
# TODO
# if self.random_start:
# adv_bx += torch.zeros_like(adv_bx).uniform_(-self.epsilon, self.epsilon)
# adv_bx = adv_bx.clamp(self.data_min, self.data_max)
#
# for i in range(self.num_steps):
# adv_bx.requires_grad_()
# with torch.enable_grad():
# logits = model(adv_bx)
# if len(logits) == 2:
# logits = logits[1]
# loss = F.cross_entropy(logits, by, reduction='sum')
# grad = torch.autograd.grad(loss, adv_bx, only_inputs=True)[0]
#
# if self.grad_sign:
# adv_bx = adv_bx.detach() + self.step_size * torch.sign(grad.detach())
#
# adv_bx = torch.min(torch.max(adv_bx, bx - self.epsilon), bx + self.epsilon).clamp(self.data_min, self.data_max)
return adv_bx
| [
"Arthur"
] | Arthur |
75a04e3f175dcf1ab31fe1ed4681128d03f5a5e7 | b56eaf7a603cbb850be11dbbed2c33b954dedbcb | /ctools/pysc2/bin/battle_net_maps.py | 031964f9d15ee9e1b9c03452b2cab3efdf37a247 | [
"Apache-2.0"
] | permissive | LFhase/DI-star | 2887d9c5dd8bfaa629e0171504b05ac70fdc356f | 09d507c412235a2f0cf9c0b3485ec9ed15fb6421 | refs/heads/main | 2023-06-20T20:05:01.378611 | 2021-07-09T16:26:18 | 2021-07-09T16:26:18 | 384,499,311 | 1 | 0 | Apache-2.0 | 2021-07-09T16:50:29 | 2021-07-09T16:50:28 | null | UTF-8 | Python | false | false | 1,250 | py | #!/usr/bin/python
# Copyright 2019 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS-IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Print the list of available maps according to the game."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from absl import app
from ctools.pysc2 import run_configs
def main(unused_argv):
with run_configs.get().start(want_rgb=False) as controller:
available_maps = controller.available_maps()
print("\n")
print("Local map paths:")
for m in sorted(available_maps.local_map_paths):
print(" ", m)
print()
print("Battle.net maps:")
for m in sorted(available_maps.battlenet_map_names):
print(" ", m)
if __name__ == "__main__":
app.run(main)
| [
"[email protected]"
] | |
6736bae8e9a339384d9187263901c8a806725b7c | c76d46dcde554eaed0f79cafde00cce973b481e3 | /user_dashboard/templatetags/dash_extra.py | 47f23524cacfe2cb23d3a65a74d184822aba44c8 | [] | no_license | dharati-code/microapi | 26e2e9adb935d68a9ca663b69f0dd9c70e017c0b | 8c4848856bd680e7c8493b80fa5938b317d9e474 | refs/heads/master | 2023-02-04T13:46:25.235108 | 2020-12-22T14:17:31 | 2020-12-22T14:17:31 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 459 | py | from django import template
from user_dashboard.models import Configs
register = template.Library()
@register.filter
def get_item(dictionary, key):
return dictionary.get(key)
@register.filter
def get_configs(confobj, pie):
pe = confobj.get(konfigd_api=pie)
return pe
@register.filter
def get_status(onj, attr):
return getattr(onj, attr)
@register.filter
def addstr(arg1, arg2):
"""concatenate arg1 & arg2"""
return str(arg1) + str(arg2) | [
"[email protected]"
] | |
6350f193e0270a17e76912867183fe6569906bb1 | fbb67b247799b724dd60415026828ec247576f9f | /demo/assignments/word_freq.py | 759be0e803b112ce19d0545ee90a83e5bb4c09c4 | [] | no_license | srikanthpragada/PYTHON_31_MAY_2021 | 845afca884cac9a30d3e87068f0dab275c056974 | 55a4a168521bc93d331fd54b85ab4faa7e4f1f02 | refs/heads/master | 2023-06-13T03:22:23.946454 | 2021-07-10T14:17:42 | 2021-07-10T14:17:42 | 373,483,617 | 0 | 1 | null | null | null | null | UTF-8 | Python | false | false | 130 | py | st = "how do you do how did you do last year"
words = st.split(" ")
for w in set(words):
print(f"{w:10} {words.count(w)}")
| [
"[email protected]"
] | |
e2547859689ea3739bc06cb400f57095ca59c69d | 89bcfc45d70a3ca3f0f1878bebd71aa76d9dc5e2 | /simpleSpider/xpath_demo/neteasy163.py | 05e4e31d9f71d741cf48616cd3548eb9a4f52c92 | [] | no_license | lichao20000/python_spider | dfa95311ab375804e0de4a31ad1e4cb29b60c45b | 81f3377ad6df57ca877463192387933c99d4aff0 | refs/heads/master | 2022-02-16T20:59:40.711810 | 2019-09-10T03:13:07 | 2019-09-10T03:13:07 | null | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 2,857 | py | # coding: utf-8
from lxml import etree
import requests
import pymysql
import uuid
class NeteasyRank(object):
def __init__(self):
self.url = 'http://news.163.com/rank/'
self.headers = {'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko)'
' Chrome/71.0.3578.98 Safari/537.36'}
self.news = dict()
self.news_list = []
db_params = {
'host': '127.0.0.1',
'user': 'root',
'password': 'QAZ123qaz#',
'database': 'jianshu',
'charset': 'utf8'
}
self.conn = pymysql.connect(**db_params)
self.cursor = self.conn.cursor()
self._sql = None
@property
def sql(self):
if not self._sql:
self._sql = """
insert into news163(id,title_id,url,type,title,click_num) values (%s,%s,%s,%s,%s,%s)
"""
return self._sql
return self._sql
def parse(self):
response = requests.get(self.url, headers=self.headers)
# response.encoding = 'utf-8'
content = response.text
html = etree.HTML(content)
lis = html.xpath("//div[@id='whole']/following-sibling::div[1]/div[@class='tabBox']/div[@class='title-tab']/ul/li")
tab_contents = html.xpath("//div[@id='whole']/following-sibling::div[1]/div[@class='tabBox']/div[contains(@class,'tabContents')]")
for i, li in enumerate(lis):
tab_text = li.xpath('./text()')[0]
trs = tab_contents[i].xpath('.//tr')[1:]
for tr in trs:
tds = tr.xpath("./td")
self.news['type'] = tab_text
self.news['id'] = str(uuid.uuid1())
self.news['title_id'] = tds[0].xpath('./span/text()')[0]
self.news['url'] = tds[0].xpath('./a/@href')[0]
self.news['title'] = tds[0].xpath('./a/text()')[0]
self.news['click_num'] = tds[1].xpath('./text()')[0]
###################
# id,url,type,title,click_num) values (%s,%s,%s,%s,%s)
#
# 需要入库时开启下面代码
# self.cursor.execute(self.sql, (self.news['id'], self.news['title_id'], self.news['url'],
# self.news['type'], self.news['title'],
# self.news['click_num'])
# )
#
# self.conn.commit()
self.news_list.append(self.news)
self.news = {}
return self.news_list
if __name__ == '__main__':
net163 = NeteasyRank()
list_news = net163.parse()
# print(net163.sql)
for new in list_news:
print(new)
| [
"[email protected]"
] | |
645f53ecc1c87df1360824cfed175d4a363d1601 | 985b64cb54d3d36fc6f9c0926485199d08bc35c0 | /sortosm.py | f71c73d0a50c3eaf71f966a8af555fc36e37ec03 | [
"BSD-2-Clause"
] | permissive | TimSC/osm-to-gps-map | 05bef69e8755be4e266dc4e9e7582e0c1fd94d36 | 2bad808be37404fbef7a1d2fa0ce2db27ffdebe8 | refs/heads/master | 2022-08-26T04:24:56.270120 | 2022-08-17T02:30:44 | 2022-08-17T02:30:44 | 10,490,170 | 2 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,026 | py | import xml.etree.ElementTree as ET
import bz2, sys
def SortOsm(inFina, outFina):
fi = bz2.BZ2File(inFina)
root = ET.fromstring(fi.read())
fi.close()
objDict = {}
for obj in root:
if 'id' in obj.attrib:
i = int(obj.attrib['id'])
#print obj.tag, i
if obj.tag not in objDict:
objDict[obj.tag] = {}
objDict[obj.tag][i] = obj
#for ty in objDict:
# print ty, len(objDict[ty]), objDict[ty].keys()
outRoot = ET.Element("osm")
outTree = ET.ElementTree(outRoot)
outRoot.attrib = root.attrib
if 'node' in objDict:
keys = objDict['node'].keys()
keys.sort()
for i in keys:
outRoot.append(objDict['node'][i])
if 'way' in objDict:
keys = objDict['way'].keys()
keys.sort()
for i in keys:
outRoot.append(objDict['way'][i])
if 'relation' in objDict:
keys = objDict['relation'].keys()
keys.sort()
for i in keys:
outRoot.append(objDict['relation'][i])
fiOut = bz2.BZ2File(outFina,"w")
outTree.write(fiOut,"utf-8")
if __name__=="__main__":
SortOsm(sys.argv[1], sys.argv[2])
| [
"[email protected]"
] | |
8e951d78f9c8a8df3ede9c12bd2fa10966bcb7ce | edfb1065a9c355bdb9e53e17276af8a58844ea06 | /readthedocs/profiles/views.py | 7329901056e0b9ca20702092255315b82f7eef7a | [
"MIT"
] | permissive | cglewis/readthedocs.org | e1f8192085bc7873e6f5a3ddc1ad5e4e37008a83 | 97665144d06792fba83193ccc1cde0367190e782 | refs/heads/master | 2023-04-04T23:24:20.996581 | 2014-08-09T18:03:30 | 2014-08-09T18:03:30 | 22,791,996 | 0 | 0 | MIT | 2023-04-04T00:16:37 | 2014-08-09T18:03:06 | Python | UTF-8 | Python | false | false | 12,308 | py | """
Views for creating, editing and viewing site-specific user profiles.
"""
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.core.exceptions import ObjectDoesNotExist
from django.core.urlresolvers import reverse
from django.http import Http404
from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from django.shortcuts import render_to_response
from django.template import RequestContext
from django.views.generic.list import ListView
from profiles import utils
def create_profile(request, form_class=None, success_url=None,
template_name='profiles/create_profile.html',
extra_context=None):
"""
Create a profile for the current user, if one doesn't already
exist.
If the user already has a profile, as determined by
``request.user.get_profile()``, a redirect will be issued to the
:view:`profiles.views.edit_profile` view. If no profile model has
been specified in the ``AUTH_PROFILE_MODULE`` setting,
``django.contrib.auth.models.SiteProfileNotAvailable`` will be
raised.
**Optional arguments:**
``extra_context``
A dictionary of variables to add to the template context. Any
callable object in this dictionary will be called to produce
the end result which appears in the context.
``form_class``
The form class to use for validating and creating the user
profile. This form class must define a method named
``save()``, implementing the same argument signature as the
``save()`` method of a standard Django ``ModelForm`` (this
view will call ``save(commit=False)`` to obtain the profile
object, and fill in the user before the final save). If the
profile object includes many-to-many relations, the convention
established by ``ModelForm`` of using a method named
``save_m2m()`` will be used, and so your form class should
also define this method.
If this argument is not supplied, this view will use a
``ModelForm`` automatically generated from the model specified
by ``AUTH_PROFILE_MODULE``.
``success_url``
The URL to redirect to after successful profile creation. If
this argument is not supplied, this will default to the URL of
:view:`profiles.views.profile_detail` for the newly-created
profile object.
``template_name``
The template to use when displaying the profile-creation
form. If not supplied, this will default to
:template:`profiles/create_profile.html`.
**Context:**
``form``
The profile-creation form.
**Template:**
``template_name`` keyword argument, or
:template:`profiles/create_profile.html`.
"""
try:
profile_obj = request.user.get_profile()
return HttpResponseRedirect(reverse('profiles_edit_profile'))
except ObjectDoesNotExist:
pass
#
# We set up success_url here, rather than as the default value for
# the argument. Trying to do it as the argument's default would
# mean evaluating the call to reverse() at the time this module is
# first imported, which introduces a circular dependency: to
# perform the reverse lookup we need access to profiles/urls.py,
# but profiles/urls.py in turn imports this module.
#
if success_url is None:
success_url = reverse('profiles_profile_detail',
kwargs={ 'username': request.user.username })
if form_class is None:
form_class = utils.get_profile_form()
if request.method == 'POST':
form = form_class(data=request.POST, files=request.FILES)
if form.is_valid():
profile_obj = form.save(commit=False)
profile_obj.user = request.user
profile_obj.save()
if hasattr(form, 'save_m2m'):
form.save_m2m()
return HttpResponseRedirect(success_url)
else:
form = form_class()
if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value
return render_to_response(template_name,
{ 'form': form },
context_instance=context)
create_profile = login_required(create_profile)
def edit_profile(request, form_class=None, success_url=None,
template_name='profiles/edit_profile.html',
extra_context=None):
"""
Edit the current user's profile.
If the user does not already have a profile (as determined by
``User.get_profile()``), a redirect will be issued to the
:view:`profiles.views.create_profile` view; if no profile model
has been specified in the ``AUTH_PROFILE_MODULE`` setting,
``django.contrib.auth.models.SiteProfileNotAvailable`` will be
raised.
**Optional arguments:**
``extra_context``
A dictionary of variables to add to the template context. Any
callable object in this dictionary will be called to produce
the end result which appears in the context.
``form_class``
The form class to use for validating and editing the user
profile. This form class must operate similarly to a standard
Django ``ModelForm`` in that it must accept an instance of the
object to be edited as the keyword argument ``instance`` to
its constructor, and it must implement a method named
``save()`` which will save the updates to the object. If this
argument is not specified, this view will use a ``ModelForm``
generated from the model specified in the
``AUTH_PROFILE_MODULE`` setting.
``success_url``
The URL to redirect to following a successful edit. If not
specified, this will default to the URL of
:view:`profiles.views.profile_detail` for the profile object
being edited.
``template_name``
The template to use when displaying the profile-editing
form. If not specified, this will default to
:template:`profiles/edit_profile.html`.
**Context:**
``form``
The form for editing the profile.
``profile``
The user's current profile.
**Template:**
``template_name`` keyword argument or
:template:`profiles/edit_profile.html`.
"""
try:
profile_obj = request.user.get_profile()
except ObjectDoesNotExist:
return HttpResponseRedirect(reverse('profiles_create_profile'))
#
# See the comment in create_profile() for discussion of why
# success_url is set up here, rather than as a default value for
# the argument.
#
if success_url is None:
success_url = reverse('profiles_profile_detail',
kwargs={ 'username': request.user.username })
if form_class is None:
form_class = utils.get_profile_form()
if request.method == 'POST':
form = form_class(data=request.POST, files=request.FILES, instance=profile_obj)
if form.is_valid():
form.save()
return HttpResponseRedirect(success_url)
else:
form = form_class(instance=profile_obj)
if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value
return render_to_response(template_name,
{ 'form': form,
'profile': profile_obj, },
context_instance=context)
edit_profile = login_required(edit_profile)
def profile_detail(request, username, public_profile_field=None,
template_name='profiles/profile_detail.html',
extra_context=None):
"""
Detail view of a user's profile.
If no profile model has been specified in the
``AUTH_PROFILE_MODULE`` setting,
``django.contrib.auth.models.SiteProfileNotAvailable`` will be
raised.
If the user has not yet created a profile, ``Http404`` will be
raised.
**Required arguments:**
``username``
The username of the user whose profile is being displayed.
**Optional arguments:**
``extra_context``
A dictionary of variables to add to the template context. Any
callable object in this dictionary will be called to produce
the end result which appears in the context.
``public_profile_field``
The name of a ``BooleanField`` on the profile model; if the
value of that field on the user's profile is ``False``, the
``profile`` variable in the template will be ``None``. Use
this feature to allow users to mark their profiles as not
being publicly viewable.
If this argument is not specified, it will be assumed that all
users' profiles are publicly viewable.
``template_name``
The name of the template to use for displaying the profile. If
not specified, this will default to
:template:`profiles/profile_detail.html`.
**Context:**
``profile``
The user's profile, or ``None`` if the user's profile is not
publicly viewable (see the description of
``public_profile_field`` above).
**Template:**
``template_name`` keyword argument or
:template:`profiles/profile_detail.html`.
"""
user = get_object_or_404(User, username=username)
try:
profile_obj = user.get_profile()
except ObjectDoesNotExist:
raise Http404
if public_profile_field is not None and \
not getattr(profile_obj, public_profile_field):
profile_obj = None
if extra_context is None:
extra_context = {}
context = RequestContext(request)
for key, value in extra_context.items():
context[key] = callable(value) and value() or value
return render_to_response(template_name,
{ 'profile': profile_obj },
context_instance=context)
class ProfileListView(ListView):
"""
A list of user profiles.
If no profile model has been specified in the
``AUTH_PROFILE_MODULE`` setting,
``django.contrib.auth.models.SiteProfileNotAvailable`` will be
raised.
**Optional arguments:**
``public_profile_field``
The name of a ``BooleanField`` on the profile model; if the
value of that field on a user's profile is ``False``, that
profile will be excluded from the list. Use this feature to
allow users to mark their profiles as not being publicly
viewable.
If this argument is not specified, it will be assumed that all
users' profiles are publicly viewable.
``template_name``
The name of the template to use for displaying the profiles. If
not specified, this will default to
:template:`profiles/profile_list.html`.
Additionally, all arguments accepted by the
:view:`django.views.generic.list_detail.object_list` generic view
will be accepted here, and applied in the same fashion, with one
exception: ``queryset`` will always be the ``QuerySet`` of the
model specified by the ``AUTH_PROFILE_MODULE`` setting, optionally
filtered to remove non-publicly-viewable proiles.
**Context:**
Same as the :view:`django.views.generic.list_detail.object_list`
generic view.
**Template:**
``template_name`` keyword argument or
:template:`profiles/profile_list.html`.
"""
public_profile_field = None
template_name = 'profiles/profile_list.html'
def get_model(self):
return utils.get_profile_model()
def get_queryset(self):
queryset = self.get_model()._default_manager.all()
if self.public_profile_field is not None:
queryset = queryset.filter(**{self.public_profile_field: True})
return queryset
| [
"[email protected]"
] | |
82e5e9a09fa717768d05f8393a81f380a0bf8834 | 07ec5a0b3ba5e70a9e0fb65172ea6b13ef4115b8 | /lib/python3.6/site-packages/tensorflow/python/training/input.py | 2304925ca8931d85101039fd238a00588a2a0731 | [] | no_license | cronos91/ML-exercise | 39c5cd7f94bb90c57450f9a85d40c2f014900ea4 | 3b7afeeb6a7c87384049a9b87cac1fe4c294e415 | refs/heads/master | 2021-05-09T22:02:55.131977 | 2017-12-14T13:50:44 | 2017-12-14T13:50:44 | 118,736,043 | 0 | 0 | null | 2018-01-24T08:30:23 | 2018-01-24T08:30:22 | null | UTF-8 | Python | false | false | 130 | py | version https://git-lfs.github.com/spec/v1
oid sha256:5456569a54cde4607762afc196ac29a5d763a71eab509d9896a77e6bb8d33539
size 60349
| [
"[email protected]"
] | |
7a4f58d873d4ef63c94868b482e144f66ed6c748 | fb28a622b21f5127c83c7fe6193b6312294b2dbe | /apps/car/views.py | 34819052aab28c8706a817a794c9556158666698 | [] | no_license | laoyouqing/video | 0cd608b1f9d3a94da4a537867fafce6f7dcd1297 | 9aa7ecf17f0145437408a8c979f819bb61617294 | refs/heads/master | 2022-12-19T11:02:01.343892 | 2019-08-21T04:00:13 | 2019-08-21T04:00:13 | 203,500,521 | 0 | 0 | null | 2022-12-08T06:03:17 | 2019-08-21T03:40:13 | Python | UTF-8 | Python | false | false | 2,005 | py | from django.shortcuts import render
# Create your views here.
from django_redis import get_redis_connection
from rest_framework import viewsets, status
from rest_framework.generics import GenericAPIView
from rest_framework.permissions import IsAuthenticated
from rest_framework.response import Response
from rest_framework.views import APIView
from car.serializers import CartSerializer, CartVideoSerializer
from videos.models import Video
class CarView(GenericAPIView):
'''购物车'''
permission_classes = [IsAuthenticated]
serializer_class = CartSerializer
queryset = Video.objects.all()
def post(self, request):
"""
添加购物车
"""
ser = CartSerializer(data=request.data)
ser.is_valid(raise_exception=True)
video_id = ser.validated_data.get('video_id')
# 用户已登录,在redis中保存
redis_conn = get_redis_connection('cart')
pl = redis_conn.pipeline()
user=request.user
bvideo_id = str(video_id).encode('utf-8')
if bvideo_id in redis_conn.lrange('cart_%s' % user.id, 0, -1):
return Response({'msg':'已加入购物车'},status=status.HTTP_400_BAD_REQUEST)
# 记录购物车商品数量
pl.lpush('cart_%s' % user.id, video_id)
pl.execute()
return Response(ser.data, status=status.HTTP_201_CREATED)
def get(self, request):
redis_conn = get_redis_connection('cart')
user = request.user
# cart_ids=redis_conn.lrange('cart_%s' % user.id,0,-1)
cart_ids=redis_conn.lrange('cart_%s' % user.id,0,-1)
videos = Video.objects.filter(id__in=cart_ids)
ser=CartVideoSerializer(instance=videos,many=True)
return Response(ser.data)
def delete(self,request,pk):
redis_conn = get_redis_connection('cart')
user = request.user
a=redis_conn.lrem('cart_%s' % user.id, 0, pk)
return Response({'msg':'删除成功'},status=status.HTTP_200_OK)
| [
"[email protected]"
] | |
a63520698af13ffbf16e3bdb315e8a135cc8d278 | 40804cfe754f4a0c99055e81966367f5a8641fac | /rotate_list.py | 38847325d29fa93ffdf8778d1c9c7420ce5b297b | [] | no_license | raochuan/LintCodeInPython | a3731b9a14c623278c8170fedd7be85fd7acfbfb | e57869437287bcc7619411f9d3d965a83e2bfacb | refs/heads/master | 2021-01-17T23:57:47.709879 | 2016-08-02T07:21:36 | 2016-08-02T07:21:36 | 64,736,138 | 1 | 0 | null | 2016-08-02T07:48:56 | 2016-08-02T07:48:54 | Python | UTF-8 | Python | false | false | 815 | py | # -*- coding: utf-8 -*-
class Solution:
# @param head: the list
# @param k: rotate to the right k places
# @return: the list after rotation
def rotateRight(self, head, k):
# write your code here
if not head:
return head
list_len = 0
tail = None
node = head
while node: # 找到链表的尾部节点并统计链表长度
list_len += 1
tail = node
node = node.next
shift = k % list_len
if shift == 0:
return head
new_tail = head
for i in xrange(list_len - shift-1):
new_tail = new_tail.next
new_head = new_tail.next # 找到新的head
tail.next = head # tail指向原来的head
new_tail.next = None
return new_head | [
"[email protected]"
] | |
3465049bccb803e10ef5fdde087a7d9139c12762 | cccfb7be281ca89f8682c144eac0d5d5559b2deb | /tools/perf/page_sets/desktop_ui/download_shelf_story.py | 93cc95aaf9b6b55b32f7984b2d41cee2d80f646c | [
"BSD-3-Clause",
"LGPL-2.0-or-later",
"MPL-1.1",
"APSL-2.0",
"MIT",
"Zlib",
"GPL-2.0-only",
"Apache-2.0",
"LGPL-2.0-only",
"LicenseRef-scancode-unknown",
"LicenseRef-scancode-unknown-license-reference",
"LGPL-2.1-only"
] | permissive | SREERAGI18/chromium | 172b23d07568a4e3873983bf49b37adc92453dd0 | fd8a8914ca0183f0add65ae55f04e287543c7d4a | refs/heads/master | 2023-08-27T17:45:48.928019 | 2021-11-11T22:24:28 | 2021-11-11T22:24:28 | 428,659,250 | 1 | 0 | BSD-3-Clause | 2021-11-16T13:08:14 | 2021-11-16T13:08:14 | null | UTF-8 | Python | false | false | 5,621 | py | # Copyright 2021 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import logging
from page_sets.desktop_ui.browser_utils import Resize
from page_sets.desktop_ui.js_utils import MEASURE_JS_MEMORY
from page_sets.desktop_ui.multitab_story import MultiTabStory
from page_sets.desktop_ui.ui_devtools_utils import ClickOn, IsMac, PressKey
from page_sets.desktop_ui.url_list import TOP_URL
from page_sets.desktop_ui.webui_utils import Inspect
from telemetry.internal.browser.ui_devtools import MOUSE_EVENT_BUTTON_RIGHT
DOWNLOAD_SHELF_BENCHMARK_UMA = [
'Download.Shelf.Views.FirstDownloadPaintTime',
'Download.Shelf.Views.NotFirstDownloadPaintTime',
'Download.Shelf.Views.ShowContextMenuTime',
'Download.Shelf.WebUI.FirstDownloadPaintTime',
'Download.Shelf.WebUI.LoadCompletedTime',
'Download.Shelf.WebUI.LoadDocumentTime',
'Download.Shelf.WebUI.NotFirstDownloadPaintTime',
'Download.Shelf.WebUI.ShowContextMenuTime',
]
DOWNLOAD_URL = 'https://dl.google.com/chrome/mac/stable/GGRO/googlechrome.dmg'
WEBUI_DOWNLOAD_SHELF_URL = 'chrome://download-shelf.top-chrome/'
class DownloadShelfStory(MultiTabStory):
"""Base class for stories to download files"""
def RunNavigateSteps(self, action_runner):
url_list = self.URL_LIST
tabs = action_runner.tab.browser.tabs
for url in url_list:
# Suppress error caused by tab closed before it returns occasionally
try:
tabs.New(url=url)
except Exception:
pass
if not IsMac():
self._devtools = action_runner.tab.browser.GetUIDevtools()
def IsWebUI(self):
return 'webui' in self.NAME
def RunPageInteractions(self, action_runner):
# Wait for download items to show up, this may take quite some time
# for lowend machines.
action_runner.Wait(10)
if self.IsWebUI():
action_runner = Inspect(action_runner.tab.browser,
WEBUI_DOWNLOAD_SHELF_URL)
action_runner.ExecuteJavaScript(MEASURE_JS_MEMORY %
'download_shelf:used_js_heap_size_begin')
self.InteractWithPage(action_runner)
if self.IsWebUI():
action_runner.ExecuteJavaScript(MEASURE_JS_MEMORY %
'download_shelf:used_js_heap_size_end')
def InteractWithPage(self, action_runner):
self.ContextMenu(action_runner)
action_runner.Wait(2)
browser = action_runner.tab.browser
Resize(browser, browser.tabs[0].id, start_width=600, end_width=800)
action_runner.Wait(2)
def ContextMenu(self, action_runner):
if IsMac():
return
try:
if self.IsWebUI():
action_runner.ClickElement(
element_function=DROPDOWN_BUTTON_ELEMENT_FUNCTION)
else:
ClickOn(self._devtools,
'TransparentButton',
button=MOUSE_EVENT_BUTTON_RIGHT)
action_runner.Wait(1)
node_id = self._devtools.QueryNodes('<Window>')[
-1] # Context menu lives in the last Window.
PressKey(self._devtools, node_id, 'Esc')
action_runner.Wait(1)
except Exception as e:
logging.warning('Failed to run context menu. Error: %s', e)
def WillStartTracing(self, chrome_trace_config):
super(DownloadShelfStory, self).WillStartTracing(chrome_trace_config)
chrome_trace_config.EnableUMAHistograms(*DOWNLOAD_SHELF_BENCHMARK_UMA)
class DownloadShelfStory1File(DownloadShelfStory):
NAME = 'download_shelf:1file'
URL_LIST = [DOWNLOAD_URL]
URL = URL_LIST[0]
class DownloadShelfStory5File(DownloadShelfStory):
NAME = 'download_shelf:5file'
URL_LIST = [DOWNLOAD_URL] * 5
URL = URL_LIST[0]
class DownloadShelfStoryTop10Loading(DownloadShelfStory):
NAME = 'download_shelf:top10:loading'
URL_LIST = TOP_URL[:10] + [DOWNLOAD_URL]
URL = URL_LIST[0]
WAIT_FOR_NETWORK_QUIESCENCE = False
class DownloadShelfStoryMeasureMemory(DownloadShelfStory):
NAME = 'download_shelf:measure_memory'
URL_LIST = [DOWNLOAD_URL]
URL = URL_LIST[0]
def WillStartTracing(self, chrome_trace_config):
super(DownloadShelfStoryMeasureMemory,
self).WillStartTracing(chrome_trace_config)
chrome_trace_config.category_filter.AddExcludedCategory('*')
chrome_trace_config.category_filter.AddIncludedCategory('blink.console')
chrome_trace_config.category_filter.AddDisabledByDefault(
'disabled-by-default-memory-infra')
def GetExtraTracingMetrics(self):
return super(DownloadShelfStoryMeasureMemory,
self).GetExtraTracingMetrics() + ['memoryMetric']
def InteractWithPage(self, action_runner):
action_runner.MeasureMemory(deterministic_mode=True)
class DownloadShelfWebUIStory1File(DownloadShelfStory):
NAME = 'download_shelf_webui:1file'
URL_LIST = [DOWNLOAD_URL]
URL = URL_LIST[0]
class DownloadShelfWebUIStory5File(DownloadShelfStory):
NAME = 'download_shelf_webui:5file'
URL_LIST = [DOWNLOAD_URL] * 5
URL = URL_LIST[0]
class DownloadShelfWebUIStoryTop10Loading(DownloadShelfStory):
NAME = 'download_shelf_webui:top10:loading'
URL_LIST = TOP_URL[:10] + [DOWNLOAD_URL]
URL = URL_LIST[0]
WAIT_FOR_NETWORK_QUIESCENCE = False
class DownloadShelfWebUIStoryMeasureMemory(DownloadShelfStoryMeasureMemory):
NAME = 'download_shelf_webui:measure_memory'
URL_LIST = [DOWNLOAD_URL]
URL = URL_LIST[0]
DROPDOWN_BUTTON_ELEMENT_FUNCTION = '''
document.querySelector('download-shelf-app').shadowRoot.
querySelector('download-list').shadowRoot.
querySelector('download-item').shadowRoot.
getElementById('dropdown-button')
'''
| [
"[email protected]"
] | |
4287c198601ca5886f6c18af6d37e2e322a38868 | 5af1de35dc2b79ecfa823f3ce3bb1097ec29bbd7 | /src/map/map_info/tests.py | 899ed1151fa1a972ca3d943e25543c19998fe114 | [
"BSD-2-Clause"
] | permissive | daonb/oMap | 7b79f4e1fc2886523e5a5c1aab249b802bf30505 | a904ddee91d2ef4c54cae0ad7ba83fb3cb2150ab | refs/heads/master | 2021-01-21T01:52:12.233153 | 2011-06-22T11:52:18 | 2011-06-22T11:52:18 | 1,933,319 | 0 | 0 | null | null | null | null | UTF-8 | Python | false | false | 1,799 | py | import re
from django.test import TestCase
from django.test.client import Client
from django.core.urlresolvers import reverse
from django.contrib.gis.geos import *
from django.contrib.auth.models import User, AnonymousUser
from django import template
#from knesset.mks.server_urls import mock_pingback_server
from django.utils import simplejson as json
from models import Layer, Point
just_id = lambda x: x.id
class ViewsTest(TestCase):
def setUp(self):
self.jacob = User.objects.create_user('jacob', '[email protected]',
'JKM')
self.layer = Layer.objects.create(name='layer 1', owner=self.jacob)
self.p1 = Point.objects.create(user = self.jacob, layer = self.layer,
point = fromstr('POINT(31,31)', srid=4326),
subject = 'p1', description= 'This is p1')
self.p2 = Point.objects.create(user = self.jacob, layer = self.layer,
point = fromstr('POINT(32,32)', srid=4326),
subject = 'p2', description= 'This is p2', views_count=4)
def testMainView(self):
res = self.client.get(reverse('map-home'))
self.assertEqual(res.status_code, 200)
self.assertTemplateUsed(res, 'site/index.html')
self.assertEqual(map(just_id, res.context['points']),
[ self.p1.id, self.p2.id, ])
self.assertEqual(map(just_id, res.context['most_recent']),
[ self.p2.id, self.p1.id, ])
self.assertEqual(map(just_id, res.context['hot_topics']),
[ self.p2.id, self.p1.id])
def tearDown(self):
self.p1.delete()
self.p2.delete()
self.layer.delete()
self.jacob.delete()
| [
"[email protected]"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.