hexsha
stringlengths
40
40
size
int64
5
2.06M
ext
stringclasses
10 values
lang
stringclasses
1 value
max_stars_repo_path
stringlengths
3
248
max_stars_repo_name
stringlengths
5
125
max_stars_repo_head_hexsha
stringlengths
40
78
max_stars_repo_licenses
sequencelengths
1
10
max_stars_count
int64
1
191k
max_stars_repo_stars_event_min_datetime
stringlengths
24
24
max_stars_repo_stars_event_max_datetime
stringlengths
24
24
max_issues_repo_path
stringlengths
3
248
max_issues_repo_name
stringlengths
5
125
max_issues_repo_head_hexsha
stringlengths
40
78
max_issues_repo_licenses
sequencelengths
1
10
max_issues_count
int64
1
67k
max_issues_repo_issues_event_min_datetime
stringlengths
24
24
max_issues_repo_issues_event_max_datetime
stringlengths
24
24
max_forks_repo_path
stringlengths
3
248
max_forks_repo_name
stringlengths
5
125
max_forks_repo_head_hexsha
stringlengths
40
78
max_forks_repo_licenses
sequencelengths
1
10
max_forks_count
int64
1
105k
max_forks_repo_forks_event_min_datetime
stringlengths
24
24
max_forks_repo_forks_event_max_datetime
stringlengths
24
24
content
stringlengths
5
2.06M
avg_line_length
float64
1
1.02M
max_line_length
int64
3
1.03M
alphanum_fraction
float64
0
1
count_classes
int64
0
1.6M
score_classes
float64
0
1
count_generators
int64
0
651k
score_generators
float64
0
1
count_decorators
int64
0
990k
score_decorators
float64
0
1
count_async_functions
int64
0
235k
score_async_functions
float64
0
1
count_documentation
int64
0
1.04M
score_documentation
float64
0
1
bc936c9856eecc335b0cca94f1df34512def1882
754
py
Python
Physics250-ME29/magAverageEMFinCoil.py
illusion173/Physics250
69f2ffdb8af013e8b0739779861c1455b579ddaf
[ "MIT" ]
null
null
null
Physics250-ME29/magAverageEMFinCoil.py
illusion173/Physics250
69f2ffdb8af013e8b0739779861c1455b579ddaf
[ "MIT" ]
null
null
null
Physics250-ME29/magAverageEMFinCoil.py
illusion173/Physics250
69f2ffdb8af013e8b0739779861c1455b579ddaf
[ "MIT" ]
null
null
null
import numpy as np import math extraNumber = 4 * math.pi * pow(10,-7) def avgEMF(): turns = input("Input how many turns: ") radius = input("Input the radius (cm):") resistance = input("Input resistance (Ω): ") magField0 = input("Input the first magnetic Field value (T): ") magField1 = input("Input the second magnetic Field value (T): ") time = input("Input the time (s): ") turns = float(turns) radius = float(radius) resistance = float(resistance) magField0 = float(magField0) magField1 = float(magField1) time = float(time) radius = radius/100 area = pow(radius,2)*math.pi averageEMF = turns * area * ((magField1-magField0)/time) print(averageEMF) avgEMF()
29
69
0.624668
0
0
0
0
0
0
0
0
184
0.243709
bc93ed322f15833ada38ade26d0df82b04900ca0
1,908
py
Python
bench_cupy.py
zhouxzh/Jetson_nano_stft_benchmark
ffa97984f95b9862ac2a10b8459bb7ef241c6c72
[ "MIT" ]
null
null
null
bench_cupy.py
zhouxzh/Jetson_nano_stft_benchmark
ffa97984f95b9862ac2a10b8459bb7ef241c6c72
[ "MIT" ]
null
null
null
bench_cupy.py
zhouxzh/Jetson_nano_stft_benchmark
ffa97984f95b9862ac2a10b8459bb7ef241c6c72
[ "MIT" ]
null
null
null
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Computes the spectrogram of a test signal using cupy and cuFFT. Author: Jan Schlüter """ import sys import os import timeit import numpy as np import cupy as cp INPUT_ON_GPU = True OUTPUT_ON_GPU = True from testfile import make_test_signal def spectrogram(signal, sample_rate=22050, frame_len=1024, fps=70): """ Computes a magnitude spectrogram at a given sample rate (in Hz), frame length (in samples) and frame rate (in Hz), on CUDA using cupy. """ if not INPUT_ON_GPU: signal = cp.array(signal.astype(np.float32)) # already blown up to a list of frames win = cp.hanning(frame_len).astype(cp.float32) # apply window function #signal *= win # this doesn't work correctly for some reason. signal = signal * win # perform FFT spect = cp.fft.rfft(signal) # convert into magnitude spectrogram spect = cp.abs(spect) # return if OUTPUT_ON_GPU: cp.cuda.get_current_stream().synchronize() else: return spect.get() def main(): # load input global x, spectrogram x = make_test_signal() # we do the following here because cupy cannot do stride tricks # the actual copying work is included in the benchmark unless INPUT_ON_GPU hop_size = 22050 // 70 frame_len = 1024 frames = len(x) - frame_len + 1 x = np.lib.stride_tricks.as_strided( x, (frames, frame_len), (x.strides[0], x.strides[0]))[::hop_size] if INPUT_ON_GPU: x = cp.array(x.astype(np.float32)) # benchmark times = timeit.repeat( setup='from __main__ import x, spectrogram', stmt='spectrogram(x)', repeat=5, number=32) print("Took %.3fs." % (min(times) / 32)) # save result #assert not OUTPUT_ON_GPU #np.save(sys.argv[0][:-2] + 'npy', spectrogram(x)) if __name__=="__main__": main()
26.5
92
0.649371
0
0
0
0
0
0
0
0
796
0.416972
bc945bd064cef2e58f31004f5a02ca29c75f9558
1,597
py
Python
dataxHWSp2021/HW3-4_NeuralNet/student/tests/q2b3.py
UCBerkeley-SCET/DataX-Berkeley
f912d22c838b511d3ada4ecfa3548afd80437b74
[ "Apache-2.0" ]
28
2020-06-15T23:53:36.000Z
2022-03-19T09:27:02.000Z
dataxHWSp2021/HW3-4_NeuralNet/student/tests/q2b3.py
UCBerkeley-SCET/DataX-Berkeley
f912d22c838b511d3ada4ecfa3548afd80437b74
[ "Apache-2.0" ]
4
2020-06-24T22:20:31.000Z
2022-02-28T01:37:36.000Z
dataxHWSp2021/HW3-4_NeuralNet/student/tests/q2b3.py
UCBerkeley-SCET/DataX-Berkeley
f912d22c838b511d3ada4ecfa3548afd80437b74
[ "Apache-2.0" ]
78
2020-06-19T09:41:01.000Z
2022-02-05T00:13:29.000Z
test = { 'name': 'q2b3', 'points': 5, 'suites': [ { 'cases': [ { 'code': '>>> ' 'histories_2b[2].model.count_params()\n' '119260', 'hidden': False, 'locked': False}, { 'code': '>>> ' 'histories_2b[2].model.layers[1].activation.__name__\n' "'sigmoid'", 'hidden': False, 'locked': False}, { 'code': '>>> ' 'histories_2b[2].model.layers[1].units\n' '150', 'hidden': False, 'locked': False}, { 'code': '>>> ' "histories_2b[2].history['loss'][4] " '<= ' "histories_2b[1].history['loss'][4]\n" 'True', 'hidden': False, 'locked': False}], 'scored': True, 'setup': '', 'teardown': '', 'type': 'doctest'}]}
55.068966
102
0.21603
0
0
0
0
0
0
0
0
437
0.273638
bc96f541ad15eaf540c8e8c9a48800ebc1c0301c
1,427
py
Python
geotrek/appconfig.py
Cynthia-Borot-PNE/Geotrek-admin
abd9ca8569a7e35ef7473f5b52731b1c78668754
[ "BSD-2-Clause" ]
null
null
null
geotrek/appconfig.py
Cynthia-Borot-PNE/Geotrek-admin
abd9ca8569a7e35ef7473f5b52731b1c78668754
[ "BSD-2-Clause" ]
null
null
null
geotrek/appconfig.py
Cynthia-Borot-PNE/Geotrek-admin
abd9ca8569a7e35ef7473f5b52731b1c78668754
[ "BSD-2-Clause" ]
null
null
null
from django.apps import AppConfig from django.contrib.admin.apps import AdminConfig from django.contrib.auth.apps import AuthConfig from django.contrib.contenttypes.apps import ContentTypesConfig from django.contrib.sessions.apps import SessionsConfig from django.db.models.signals import post_migrate from django_celery_results.apps import CeleryResultConfig from geotrek.common.utils.signals import check_srid_has_meter_unit, pm_callback class GeotrekConfig(AppConfig): """ Base class to handle table move on right schemas, and load SQL files !! WARNING !! need to create subclass in geotrek.myapp.apps for project apps, and create subclasses here for external subclasses """ def ready(self): post_migrate.connect(pm_callback, sender=self, dispatch_uid='geotrek.core.pm_callback') check_srid_has_meter_unit() class AuthGeotrekConfig(AuthConfig, GeotrekConfig): """ bind for django.contrib.auth """ pass class ContenttypeGeotrekConfig(ContentTypesConfig, GeotrekConfig): """ bind for django.contrib.contenttype """ pass class SessionsGeotrekConfig(SessionsConfig, GeotrekConfig): pass class AdminGeotrekConfig(AdminConfig, GeotrekConfig): pass class CeleryGeotrekConfig(GeotrekConfig, CeleryResultConfig): pass class EasyThumbnailsGeotrekConfig(GeotrekConfig): name = 'easy_thumbnails' verbose_name = 'Easy thumbnails'
27.442308
95
0.775753
965
0.676244
0
0
0
0
0
0
376
0.26349
bc96fd29e9d6cb6eb71dd73f5f39dcfd2bcd44f8
11,604
py
Python
dtr_code/shared/run_torch_trial.py
merrymercy/dtr-prototype
bf40e182453a7d8d23581ea68f32a9d7d2037d62
[ "Linux-OpenIB" ]
1
2021-08-02T02:42:58.000Z
2021-08-02T02:42:58.000Z
dtr_code/shared/run_torch_trial.py
merrymercy/dtr-prototype
bf40e182453a7d8d23581ea68f32a9d7d2037d62
[ "Linux-OpenIB" ]
null
null
null
dtr_code/shared/run_torch_trial.py
merrymercy/dtr-prototype
bf40e182453a7d8d23581ea68f32a9d7d2037d62
[ "Linux-OpenIB" ]
1
2021-08-05T08:58:53.000Z
2021-08-05T08:58:53.000Z
""" To avoid any issues of memory hanging around between inputs, we run each input as a separate process. A little ugly but effective """ import gc import glob import json import os import random import time import numpy as np import torch from common import invoke_main, read_json, write_json, prepare_out_file, check_file_exists from validate_config import validate_trials_config from pt_trial_util import create_csv_writer from tqdm import tqdm import model_util def extend_simrd_config(dest_dir, sim_conf_filename, model_name, specific_params, log_name): if not check_file_exists(dest_dir, sim_conf_filename): prepare_out_file(dest_dir, sim_conf_filename) write_json(dest_dir, sim_conf_filename, dict()) conf = read_json(dest_dir, sim_conf_filename) if model_name not in conf: conf[model_name] = [] conf[model_name].append({ 'name': model_util.get_model_family(model_name), 'batch_size': str(specific_params['batch_size']), 'layers': specific_params.get('layers', model_util.get_model_layers(model_name)), 'type': model_util.get_model_type(model_name), 'log': log_name, 'has_start': True }) write_json(dest_dir, sim_conf_filename, conf) def save_trial_log(dest_dir, sim_conf_filename, model_name, specific_params, is_baseline=False): """ Find the last DTR log produced in the trial (if any exist) and move it to the directory """ all_logs = glob.glob(os.path.join(os.getcwd(), '*.log')) if not all_logs: return # if we delete all logs in advance, there should be at most one log assert len(all_logs) == 1 most_recent = all_logs[0] # rename and move # (new name just appends info to the old one) batch_size = specific_params['batch_size'] budget = specific_params['memory_budget'] if budget < 0: budget = 'inf' new_name = '{}-{}-{}-{}'.format(model_name, batch_size, budget, os.path.basename(most_recent)) filename = prepare_out_file(dest_dir, new_name) os.rename(most_recent, filename) if is_baseline and sim_conf_filename is not None: extend_simrd_config(dest_dir, sim_conf_filename, model_name, specific_params, filename) def delete_logs(): for log in glob.glob(os.path.join(os.getcwd(), '*.log')): os.remove(log) def run_single_measurement(model_name, produce_model, run_model, teardown, inp, criterion, extra_params, use_dtr, use_profiling): """ This function initializes a model and performs a single measurement of the model on the given input. While it might seem most reasonable to initialize the model outside of the loop, DTR's logs have shown that certain constants in the model persist between loop iterations; performing these actions in a separate *function scope* turned out to be the only way to prevent having those constants hang around. Returns a dict of measurements """ torch.cuda.reset_max_memory_allocated() # resetting means the count should be reset to # only what's in scope, meaning only the input input_mem = torch.cuda.max_memory_allocated() model = produce_model(extra_params=extra_params) params = [] for m in model: if hasattr(m, 'parameters'): params.extend(m.parameters()) model_mem = torch.cuda.max_memory_allocated() optimizer = torch.optim.SGD(model[0].parameters(), 1e-3, momentum=0.9, weight_decay=1e-4) start = torch.cuda.Event(enable_timing=True) end = torch.cuda.Event(enable_timing=True) # start timing torch.cuda.synchronize() start_time = time.time() if use_dtr: torch.reset_profile() start.record() # with torch.autograd.profiler.profile(use_cuda=True) as prof: run_model(criterion, *model, *inp, optimizer=optimizer) end.record() start_sync = time.time() torch.cuda.synchronize() end_sync = time.time() end_time = time.time() # end timing if use_dtr: # operators-only time, tracked by DTR cuda_time = torch.compute_time() base_compute_time = -1 remat_compute_time = -1 search_time = -1 cost_time = -1 if use_profiling: base_compute_time = torch.base_compute_time() remat_compute_time = torch.remat_compute_time() search_time = torch.search_time() cost_time = torch.cost_time() torch.reset_profile() total_mem = torch.cuda.max_memory_allocated() teardown(*model) torch.cuda.reset_max_memory_allocated() del model if use_dtr: torch.toggle_log(False) del params batch_size = len(inp[0]) ips = batch_size / (end_time - start_time) result = { 'time': end_time - start_time, 'sync_time': end_sync - start_sync, 'gpu_time': start.elapsed_time(end), 'input_mem': input_mem, 'model_mem': model_mem, 'total_mem': total_mem, 'base_compute_time': base_compute_time, 'remat_compute_time': remat_compute_time, 'search_time': search_time, 'cost_time': cost_time, 'batch_size': batch_size, 'ips': ips } if use_dtr: result['cuda_time'] = cuda_time else: result['cuda_time'] = -1.0 return result def timing_loop(model_name, i, config, use_dtr, specific_params, writer, trial_run=False, trial_run_outfile=None, memory_budget=-1.0): dry_run = config['dry_run'] measurements = [] print(f'Running {model_name} : {specific_params}') # remove any logs hanging around (so we only have to look for one) delete_logs() # we only save logs for the final input on DTR save_log = use_dtr and specific_params.get('save_logs', config['save_logs']) and i == config['n_inputs'] - 1 if use_dtr: torch.toggle_log(False) # whether to report profiling info use_profiling = use_dtr and specific_params.get('use_profiling', False) use_cudnn = model_util.use_cudnn(model_name) with torch.backends.cudnn.flags(enabled=use_cudnn, benchmark=use_cudnn): criterion = model_util.get_criterion(model_name) produce_model, gen_input, run_model, teardown = model_util.prepare_model(model_name, specific_params['batch_size'], use_dtr=use_dtr) inp = gen_input(i, specific_params.get('extra_params', dict())) n_reps = specific_params.get('n_reps', config['n_reps']) if use_profiling: torch.toggle_profile(use_profiling) progress = tqdm(range(dry_run + n_reps)) for j in progress: progress.set_description(f'Rep [{j}]' + '' if j > dry_run else f'Dry run [{j}]') gc.collect() # Annotate where the final run starts in the log if save_log and j == dry_run + n_reps - 1: torch.toggle_log(True) torch.annotate_log('START') res = run_single_measurement(model_name, produce_model, run_model, teardown, inp, criterion, extra_params=specific_params.get('extra_params', dict()), use_dtr=use_dtr, use_profiling=use_profiling) if j >= dry_run: measurements.append(res) # Dump results model_name_replace_dict = { 'tv_resnet152': 'resnet152', 'tv_resnet50': 'resnet50', } train_ips_list = [] batch_size = None for res in measurements: batch_size = res['batch_size'] train_ips_list.append(res['ips']) out_file = "speed_results.tsv" with open(out_file, "a") as fout: val_dict = { 'network': model_name_replace_dict.get(model_name, model_name), 'algorithm': 'dtr', 'budget': specific_params['memory_budget'], 'batch_size': batch_size, 'ips': np.median(train_ips_list) if train_ips_list else -1, } print(val_dict) fout.write(json.dumps(val_dict) + "\n") print(f"save results to {out_file}") # write to csv file only when this trial is not # for getting a baseline memory usage if trial_run: write_json(os.getcwd(), trial_run_outfile, { 'mem' : max(map(lambda data: data['total_mem'], measurements)) }) return if save_log: save_trial_log(config['log_dest'], config.get('simrd_config', None), model_name, specific_params, is_baseline=specific_params['memory_budget'] == -1) # clean up after ourselves delete_logs() # do all the writing after the trial is over for j in range(len(measurements)): data = measurements[j] # do unit conversions now: times in ms, # memory in MB writer.writerow({ 'time': data['time']*1e3, 'sync_time': data['sync_time']*1e3, # pytorch's cuda elapsed time is already in ms 'gpu_time': float(data['gpu_time']), # 'cuda_time' : float(data['cuda_time']) * 1e-6, 'input_mem': data['input_mem']*1e-6, 'model_mem': data['model_mem']*1e-6, 'total_mem': data['total_mem']*1e-6, 'memory_budget': memory_budget, # profiling (reported in nanoseconds) 'base_compute_time': data['base_compute_time']*1e-6, 'remat_compute_time': data['remat_compute_time']*1e-6, 'search_time': data['search_time']*1e-6, 'cost_time': data['cost_time']*1e-6, 'rep': j - dry_run, 'input': i, **specific_params }) def main(config_dir, experiment_mode, model_name, input_idx, params_file, out_file, trial_run=False, trial_run_outfile=None): if 'DTR_MODEL_NAME' in os.environ: model_name = os.environ['DTR_MODEL_NAME'] config, msg = validate_trials_config(config_dir) if config is None: print(msg) return 1 use_dtr = (experiment_mode == 'dtr') i = int(input_idx) is_trial = trial_run == 'True' if config['set_seed']: torch.manual_seed(config['seed'] + i) random.seed(config['seed'] + i) cwd = os.getcwd() # handle specific params, esp. for DTR specific_params = read_json(cwd, params_file) if 'DTR_MEMORY_BUDGET' in os.environ: specific_params['memory_budget'] = float(os.environ['DTR_MEMORY_BUDGET']) assert 'batch_size' in specific_params if use_dtr: assert 'memory_budget' in specific_params if specific_params['memory_budget'] > 0: print(f'Setting budget to {int(specific_params["memory_budget"])}') torch.set_memory_budget(int(specific_params['memory_budget'])) if is_trial: timing_loop(model_name, i, config, use_dtr, specific_params, None, True, trial_run_outfile) return with open(out_file, 'a', newline='') as csvfile: writer = create_csv_writer(csvfile, specific_params) timing_loop(model_name, i, config, use_dtr, specific_params, writer, memory_budget=specific_params.get('memory_budget', -1)) if __name__ == '__main__': invoke_main(main, 'config_dir', 'experiment_mode', 'model_name', 'input_idx', 'params_file', 'out_file', 'trial_run', 'trial_run_outfile')
35.057402
170
0.635384
0
0
0
0
0
0
0
0
3,033
0.261375
bc986ff7e618db67d5b1902a0fdfeecd1595ea88
1,482
py
Python
pythonTools/downloadPDBsInList.py
rsanchezgarc/BIPSPI
e155fee0836084ea02bc9919c58817d26a4a13e5
[ "Apache-2.0" ]
5
2020-01-21T21:11:49.000Z
2022-02-06T19:55:28.000Z
pythonTools/downloadPDBsInList.py
rsanchezgarc/BIPSPI
e155fee0836084ea02bc9919c58817d26a4a13e5
[ "Apache-2.0" ]
null
null
null
pythonTools/downloadPDBsInList.py
rsanchezgarc/BIPSPI
e155fee0836084ea02bc9919c58817d26a4a13e5
[ "Apache-2.0" ]
3
2018-05-25T14:57:36.000Z
2022-01-27T12:53:41.000Z
import sys, os from subprocess import call try: from downloadPdb import downloadPDB except ImportError: from .downloadPdb import downloadPDB pdbListFile="/home/rsanchez/Tesis/rriPredMethod/data/joanDimers/117_dimers_list.tsv" outPath="/home/rsanchez/Tesis/rriPredMethod/data/joanDimers/pdbFiles/rawPDBs" USE_BIO_UNIT=False ##def downloadPDB(pdbId, pdbOutPath, useBioUnit): #### descargar pdb: wget ftp://ftp.wwpdb.org/pub/pdb/data/biounit/coordinates/all/1i1q.pdb2.gz o ya descomprimido #### wget -qO- ftp://ftp.wwpdb.org/pub/pdb/data/biounit/coordinates/all/1i1q.pdb2.gz |zcat > 1i1q.pdb ## outName= os.path.join(pdbOutPath,pdbId+'.pdb') ## if not os.path.isfile(outName): ## if useBioUnit: ## cmd= 'wget -qO- ftp://ftp.wwpdb.org/pub/pdb/data/biounit/coordinates/all/%s.pdb1.gz |zcat > %s'%(pdbId.lower(), outName) ## else: ## cmd= 'wget -qO- http://www.pdb.org/pdb/files/%s.pdb | cat > %s'%(pdbId.upper(), outName) ## print(cmd) ## call(cmd, shell= True) def downloadInFile(fname, outPath, useBioUnit): with open(fname) as f: for line in f: pdbId= line.split()[0] print(pdbId) downloadPDB(pdbId, outPath, bioUnit= 0 if useBioUnit else None) if __name__=="__main__": if len(sys.argv)==3: pdbListFile= os.path.abspath(os.path.expanduser(sys.argv[1])) outPath= os.path.abspath(os.path.expanduser(sys.argv[2])) print( pdbListFile, outPath) downloadInFile(pdbListFile, outPath, USE_BIO_UNIT)
36.146341
129
0.702429
0
0
0
0
0
0
0
0
802
0.541161
bc98a22d0cd11d65a7d45c78d01ce4ed45420116
1,935
py
Python
code/python3/search_facets.py
hsethi2709/xapian-docsprint
a872c83fef6fde13efce67fd5563d43514c7444a
[ "MIT" ]
47
2015-01-20T15:38:41.000Z
2022-02-15T21:03:50.000Z
code/python3/search_facets.py
hsethi2709/xapian-docsprint
a872c83fef6fde13efce67fd5563d43514c7444a
[ "MIT" ]
16
2015-06-09T16:12:50.000Z
2020-02-05T06:40:18.000Z
code/python3/search_facets.py
hsethi2709/xapian-docsprint
a872c83fef6fde13efce67fd5563d43514c7444a
[ "MIT" ]
56
2015-01-20T15:38:44.000Z
2022-03-03T18:13:39.000Z
#!/usr/bin/env python import json import sys import xapian import support def search(dbpath, querystring, offset=0, pagesize=10): # offset - defines starting point within result set # pagesize - defines number of records to retrieve # Open the database we're going to search. db = xapian.Database(dbpath) # Set up a QueryParser with a stemmer and suitable prefixes queryparser = xapian.QueryParser() queryparser.set_stemmer(xapian.Stem("en")) queryparser.set_stemming_strategy(queryparser.STEM_SOME) queryparser.add_prefix("title", "S") queryparser.add_prefix("description", "XD") # And parse the query query = queryparser.parse_query(querystring) # Use an Enquire object on the database to run the query enquire = xapian.Enquire(db) enquire.set_query(query) # And print out something about each match matches = [] ### Start of example code. # Set up a spy to inspect the MAKER value at slot 1 spy = xapian.ValueCountMatchSpy(1) enquire.add_matchspy(spy) for match in enquire.get_mset(offset, pagesize, 100): fields = json.loads(match.document.get_data().decode('utf8')) print(u"%(rank)i: #%(docid)3.3i %(title)s" % { 'rank': match.rank + 1, 'docid': match.docid, 'title': fields.get('TITLE', u''), }) matches.append(match.docid) # Fetch and display the spy values for facet in spy.values(): print("Facet: %(term)s; count: %(count)i" % { 'term' : facet.term.decode('utf-8'), 'count' : facet.termfreq }) # Finally, make sure we log the query and displayed results support.log_matches(querystring, offset, pagesize, matches) ### End of example code. if len(sys.argv) < 3: print("Usage: %s DBPATH QUERYTERM..." % sys.argv[0]) sys.exit(1) search(dbpath = sys.argv[1], querystring = " ".join(sys.argv[2:]))
31.209677
69
0.649612
0
0
0
0
0
0
0
0
728
0.376227
bc98ed1d916dea38c19eaadce5f09692d5d10eeb
1,272
py
Python
iconcollections/serializers.py
plrthink/myicons
62475e118e2c7404d88146ea5d67961418d7f8ab
[ "BSD-2-Clause" ]
83
2015-01-02T04:50:43.000Z
2021-06-06T03:26:55.000Z
iconcollections/serializers.py
plrthink/myicons
62475e118e2c7404d88146ea5d67961418d7f8ab
[ "BSD-2-Clause" ]
2
2015-01-04T11:25:20.000Z
2015-01-05T11:13:37.000Z
iconcollections/serializers.py
plrthink/myicons
62475e118e2c7404d88146ea5d67961418d7f8ab
[ "BSD-2-Clause" ]
20
2015-01-15T10:00:09.000Z
2019-11-06T07:25:59.000Z
import re from rest_framework import serializers from .models import Collection, CollectionIcon class CollectionSerializer(serializers.ModelSerializer): """Collections's serializer""" class Meta: model = Collection read_only = ('token', ) class CollectionIconSerializer(serializers.ModelSerializer): """CollectionIcon's Serializer. """ class Meta: model = CollectionIcon def validate_width(self, attrs, source): width = attrs[source] if width < 1.0: raise serializers.ValidationError('Width should be greater than 1.0') return attrs def validate_name(self, attrs, source): name = attrs[source].lower() name = re.sub(r'[^a-z0-9\-]', '-', name).strip('-') name = re.sub(r'-+', '-', name) if name: attrs[source] = name else: raise serializers.ValidationError('Invalid name') return attrs def validate(self, attrs): packicon = attrs.get('packicon') svg_d = attrs.get('svg_d') width = attrs.get('width') if packicon or (svg_d and width): return attrs raise serializers.ValidationError( 'Either a packicon or the shape of icon should be given' )
27.06383
81
0.616352
1,169
0.919025
0
0
0
0
0
0
228
0.179245
bc99e84c9e8d7aa99d673f47ef51acfd45692fba
1,738
py
Python
Python/partition-to-k-equal-sum-subsets.py
sm2774us/leetcode_interview_prep_2021
33b41bea66c266b733372d9a8b9d2965cd88bf8c
[ "Fair" ]
null
null
null
Python/partition-to-k-equal-sum-subsets.py
sm2774us/leetcode_interview_prep_2021
33b41bea66c266b733372d9a8b9d2965cd88bf8c
[ "Fair" ]
null
null
null
Python/partition-to-k-equal-sum-subsets.py
sm2774us/leetcode_interview_prep_2021
33b41bea66c266b733372d9a8b9d2965cd88bf8c
[ "Fair" ]
null
null
null
# Time: O(n*2^n) # Space: O(2^n) class Solution(object): def canPartitionKSubsets(self, nums, k): """ :type nums: List[int] :type k: int :rtype: bool """ def dfs(nums, target, used, todo, lookup): if lookup[used] is None: targ = (todo-1)%target + 1 lookup[used] = any(dfs(nums, target, used | (1<<i), todo-num, lookup) \ for i, num in enumerate(nums) \ if ((used>>i) & 1) == 0 and num <= targ) return lookup[used] total = sum(nums) if total%k or max(nums) > total//k: return False lookup = [None] * (1 << len(nums)) lookup[-1] = True return dfs(nums, total//k, 0, total, lookup) # Time: O(k^(n-k) * k!) # Space: O(n) # DFS solution with pruning. class Solution2(object): def canPartitionKSubsets(self, nums, k): """ :type nums: List[int] :type k: int :rtype: bool """ def dfs(nums, target, i, subset_sums): if i == len(nums): return True for k in range(len(subset_sums)): if subset_sums[k]+nums[i] > target: continue subset_sums[k] += nums[i] if dfs(nums, target, i+1, subset_sums): return True subset_sums[k] -= nums[i] if not subset_sums[k]: break return False total = sum(nums) if total%k != 0 or max(nums) > total//k: return False nums.sort(reverse=True) subset_sums = [0] * k return dfs(nums, total//k, 0, subset_sums)
30.491228
87
0.468354
1,630
0.93786
0
0
0
0
0
0
271
0.155926
bc9aea616fee38b1a73a79e690091369c909ef06
737
py
Python
var/spack/repos/builtin/packages/aspell/package.py
jeanbez/spack
f4e51ce8f366c85bf5aa0eafe078677b42dae1ba
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
null
null
null
var/spack/repos/builtin/packages/aspell/package.py
jeanbez/spack
f4e51ce8f366c85bf5aa0eafe078677b42dae1ba
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
8
2021-11-09T20:28:40.000Z
2022-03-15T03:26:33.000Z
var/spack/repos/builtin/packages/aspell/package.py
jeanbez/spack
f4e51ce8f366c85bf5aa0eafe078677b42dae1ba
[ "ECL-2.0", "Apache-2.0", "MIT-0", "MIT" ]
2
2019-02-08T20:37:20.000Z
2019-03-31T15:19:26.000Z
# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack.package import * # See also: AspellDictPackage class Aspell(AutotoolsPackage, GNUMirrorPackage): """GNU Aspell is a Free and Open Source spell checker designed to eventually replace Ispell.""" homepage = "http://aspell.net/" gnu_mirror_path = "aspell/aspell-0.60.6.1.tar.gz" extendable = True # support activating dictionaries version('0.60.6.1', sha256='f52583a83a63633701c5f71db3dc40aab87b7f76b29723aeb27941eff42df6e1') patch('fix_cpp.patch') patch('issue-519.patch', when='@:0.60.6.1')
32.043478
98
0.738128
478
0.648575
0
0
0
0
0
0
525
0.712347
bc9b38aa93978a9c5a2ff6d24ac4f1e6be8b4faa
1,888
py
Python
third_party_package/RDKit_2015_03_1/rdkit/ML/Descriptors/UnitTestParser.py
Ivy286/cluster_basedfps
7fc216537f570436f008ea567c137d03ba2b6d81
[ "WTFPL" ]
9
2019-04-23T01:46:12.000Z
2021-08-16T07:07:12.000Z
third_party_package/RDKit_2015_03_1/rdkit/ML/Descriptors/UnitTestParser.py
Ivy286/cluster_basedfps
7fc216537f570436f008ea567c137d03ba2b6d81
[ "WTFPL" ]
null
null
null
third_party_package/RDKit_2015_03_1/rdkit/ML/Descriptors/UnitTestParser.py
Ivy286/cluster_basedfps
7fc216537f570436f008ea567c137d03ba2b6d81
[ "WTFPL" ]
5
2016-09-21T03:47:48.000Z
2019-07-30T22:17:35.000Z
# # Copyright (C) 2001 greg Landrum # """ unit testing code for compound descriptors """ from __future__ import print_function import unittest import Parser from rdkit.six.moves import xrange class TestCase(unittest.TestCase): def setUp(self): print('\n%s: '%self.shortDescription(),end='') self.piece1 = [['d1','d2'],['d1','d2']] self.aDict = {'Fe':{'d1':1,'d2':2},'Pt':{'d1':10,'d2':20}} self.pDict = {'d1':100.,'d2':200.} self.compos = [('Fe',1),('Pt',1)] self.cExprs = ["SUM($1)","SUM($1)+SUM($2)","MEAN($1)","DEV($2)","MAX($1)","MIN($2)","SUM($1)/$a"] self.results = [11.,33.,5.5,9.,10.,2.,0.11] self.tol = 0.0001 def testSingleCalcs(self): " testing calculation of a single descriptor " for i in xrange(len(self.cExprs)): cExpr= self.cExprs[i] argVect = self.piece1 + [cExpr] res = Parser.CalcSingleCompoundDescriptor(self.compos,argVect,self.aDict,self.pDict) self.assertAlmostEqual(res,self.results[i],2) def testMultipleCalcs(self): " testing calculation of multiple descriptors " for i in xrange(len(self.cExprs)): cExpr= self.cExprs[i] argVect = self.piece1 + [cExpr] res = Parser.CalcMultipleCompoundsDescriptor([self.compos,self.compos],argVect, self.aDict,[self.pDict,self.pDict]) self.assertAlmostEqual(res[0],self.results[i],2) self.assertAlmostEqual(res[1],self.results[i],2) #self.assertTrue(abs(res[0]-self.results[i])<self.tol,'Expression %s failed'%(cExpr)) #self.assertTrue((res[1]-self.results[i])<self.tol,'Expression %s failed'%(cExpr)) def TestSuite(): suite = unittest.TestSuite() suite.addTest(TestCase('testSingleCalcs')) suite.addTest(TestCase('testMultipleCalcs')) return suite if __name__ == '__main__': suite = TestSuite() unittest.TextTestRunner().run(suite)
35.622642
101
0.64036
1,439
0.762182
0
0
0
0
0
0
535
0.283369
bc9c8f24e080e4c64950de33e4962b6b2e44ede2
1,575
py
Python
setup.py
maciek3000/data_dashboard
1b573b674d37f57ae7e8bbfb1e83c801b488dfd6
[ "MIT" ]
8
2021-05-03T04:06:15.000Z
2022-01-15T16:27:42.000Z
setup.py
maciek3000/data_dashboard
1b573b674d37f57ae7e8bbfb1e83c801b488dfd6
[ "MIT" ]
null
null
null
setup.py
maciek3000/data_dashboard
1b573b674d37f57ae7e8bbfb1e83c801b488dfd6
[ "MIT" ]
3
2021-05-19T17:31:18.000Z
2021-06-19T12:24:01.000Z
from setuptools import setup, find_packages import pathlib here = pathlib.Path(__file__).parent.resolve() long_description = (here / "readme.md").read_text(encoding="utf-8") setup( name="data_dashboard", version="0.1.1", description="Dashboard to explore the data and to create baseline Machine Learning model.", long_description=long_description, long_description_content_type="text/markdown", url="https://github.com/maciek3000/data_dashboard", author="Maciej Dowgird", author_email="[email protected]", classifiers=[ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Intended Audience :: Education", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.7", "Topic :: Scientific/Engineering :: Artificial Intelligence", "Topic :: Scientific/Engineering :: Visualization" ], package_dir={"data_dashboard": "data_dashboard"}, packages=find_packages(), python_requires=">=3.7", install_requires=[ "pandas>=1.2.3", "numpy>=1.19.5", "scipy>=1.6.1", "beautifulsoup4>=4.9.3", "scikit-learn>=0.24.1", "seaborn>=0.11.1", "bokeh>=2.3.0", "Jinja2>=2.11.3", "xgboost>=1.3.3", "lightgbm>=3.2.0" ], package_data={ "data_dashboard": ["static/*", "templates/*", "examples/*"] }, project_urls={ "Github": "https://github.com/maciek3000/data_dashboard", }, )
32.142857
95
0.615238
0
0
0
0
0
0
0
0
859
0.545397
bc9d746d95215d78b546409456d7b42ad25142a0
5,577
py
Python
test/e2e/tests/test_instance.py
acornett21/ack-ec2-controller
aa747d981239e41ae4254a9b31ee0f20ac882c85
[ "Apache-2.0" ]
null
null
null
test/e2e/tests/test_instance.py
acornett21/ack-ec2-controller
aa747d981239e41ae4254a9b31ee0f20ac882c85
[ "Apache-2.0" ]
null
null
null
test/e2e/tests/test_instance.py
acornett21/ack-ec2-controller
aa747d981239e41ae4254a9b31ee0f20ac882c85
[ "Apache-2.0" ]
null
null
null
# Copyright Amazon.com Inc. or its affiliates. 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. A copy of the # License is located at # # http://aws.amazon.com/apache2.0/ # # or in the "license" file accompanying this file. This file 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. """Integration tests for Instance API. """ import datetime import pytest import time import logging from acktest.resources import random_suffix_name from acktest.k8s import resource as k8s from e2e import service_marker, CRD_GROUP, CRD_VERSION, load_ec2_resource from e2e.replacement_values import REPLACEMENT_VALUES from e2e.bootstrap_resources import get_bootstrap_resources RESOURCE_PLURAL = "instances" # highly available instance type for deterministic testing INSTANCE_TYPE = "m4.large" INSTANCE_AMI = "Amazon Linux 2 Kernel" INSTANCE_TAG_KEY = "owner" INSTANCE_TAG_VAL = "ack-controller" CREATE_WAIT_AFTER_SECONDS = 10 DELETE_WAIT_AFTER_SECONDS = 10 TIMEOUT_SECONDS = 300 def get_instance(ec2_client, instance_id: str) -> dict: instance = None try: resp = ec2_client.describe_instances( InstanceIds=[instance_id] ) instance = resp["Reservations"][0]["Instances"][0] except Exception as e: logging.debug(e) finally: return instance def get_instance_state(ec2_client, instance_id): instance_state = None try: instance = get_instance(ec2_client, instance_id) instance_state = instance["State"]["Name"] except Exception as e: logging.debug(e) finally: return instance_state def wait_for_instance_or_die(ec2_client, instance_id, desired_state, timeout_sec): while True: now = datetime.datetime.now() timeout = now + datetime.timedelta(seconds=timeout_sec) if datetime.datetime.now() >= timeout: pytest.fail(f"Timed out waiting for Instance to enter {desired_state} state") time.sleep(DELETE_WAIT_AFTER_SECONDS) instance_state = get_instance_state(ec2_client, instance_id) if instance_state == desired_state: break def get_ami_id(ec2_client): try: # Use latest AL2 resp = ec2_client.describe_images( Owners=['amazon'], Filters=[ {"Name": "architecture", "Values": ['x86_64']}, {"Name": "state", "Values": ['available']}, {"Name": "virtualization-type", "Values": ['hvm']}, ], ) for image in resp['Images']: if 'Description' in image: if INSTANCE_AMI in image['Description']: return image['ImageId'] except Exception as e: logging.debug(e) @pytest.fixture def instance(ec2_client): test_resource_values = REPLACEMENT_VALUES.copy() resource_name = random_suffix_name("instance-ack-test", 24) test_vpc = get_bootstrap_resources().SharedTestVPC subnet_id = test_vpc.public_subnets.subnet_ids[0] ami_id = get_ami_id(ec2_client) test_resource_values["INSTANCE_NAME"] = resource_name test_resource_values["INSTANCE_AMI_ID"] = ami_id test_resource_values["INSTANCE_TYPE"] = INSTANCE_TYPE test_resource_values["INSTANCE_SUBNET_ID"] = subnet_id test_resource_values["INSTANCE_TAG_KEY"] = INSTANCE_TAG_KEY test_resource_values["INSTANCE_TAG_VAL"] = INSTANCE_TAG_VAL # Load Instance CR resource_data = load_ec2_resource( "instance", additional_replacements=test_resource_values, ) logging.debug(resource_data) # Create k8s resource ref = k8s.CustomResourceReference( CRD_GROUP, CRD_VERSION, RESOURCE_PLURAL, resource_name, namespace="default", ) k8s.create_custom_resource(ref, resource_data) cr = k8s.wait_resource_consumed_by_controller(ref) assert cr is not None assert k8s.get_resource_exists(ref) yield (ref, cr) # Delete the instance when tests complete try: _, deleted = k8s.delete_custom_resource(ref, 3, 10) assert deleted except: pass @service_marker @pytest.mark.canary class TestInstance: def test_create_delete(self, ec2_client, instance): (ref, cr) = instance resource_id = cr["status"]["instanceID"] time.sleep(CREATE_WAIT_AFTER_SECONDS) # Check Instance exists instance = get_instance(ec2_client, resource_id) assert instance is not None # Give time for instance to come up wait_for_instance_or_die(ec2_client, resource_id, 'running', TIMEOUT_SECONDS) # Validate instance tags instance_tags = instance["Tags"] tag_present = False for t in instance_tags: if (t['Key'] == INSTANCE_TAG_KEY and t['Value'] == INSTANCE_TAG_VAL): tag_present = True assert tag_present # Delete k8s resource _, deleted = k8s.delete_custom_resource(ref, 2, 5) assert deleted is True # Reservation still exists, but instance will commence termination # State needs to be 'terminated' in order to remove the dependency on the shared subnet # for successful test cleanup wait_for_instance_or_die(ec2_client, resource_id, 'terminated', TIMEOUT_SECONDS)
33.8
95
0.684777
1,184
0.212301
1,355
0.242962
2,591
0.464587
0
0
1,554
0.278644
bc9f42407dc824808c93da43b669882c77d6d9f4
9,461
py
Python
web/app/forms.py
Devidence7/Break
f961b1b46977c86739ff651fe81a1d9fff98a8e1
[ "MIT" ]
null
null
null
web/app/forms.py
Devidence7/Break
f961b1b46977c86739ff651fe81a1d9fff98a8e1
[ "MIT" ]
null
null
null
web/app/forms.py
Devidence7/Break
f961b1b46977c86739ff651fe81a1d9fff98a8e1
[ "MIT" ]
null
null
null
from flask_wtf import FlaskForm from wtforms import Form, StringField, PasswordField, BooleanField, SubmitField, IntegerField, validators, FileField, \ MultipleFileField, SelectField, RadioField, HiddenField, DecimalField, TextAreaField from wtforms.fields.html5 import DateField from wtforms.validators import DataRequired # Structure of the Login form class LoginForm(Form): email = StringField('Email', [ validators.DataRequired(message='Es necesario introducir un email')]) password = PasswordField('Contraseña', [ validators.DataRequired(message='Es necesario introducir una contraseña')]) remember_me = BooleanField('Recuerdame') submit = SubmitField('Iniciar Sesión') # Structure of the Register form class RegisterForm(Form): name = StringField('Nombre', [ validators.DataRequired(message='Es necesario introducir un nombre'), validators.Length(min=4, max=50, message='El tamaño máximo del nombre son 50 carácteres')]) lastname = StringField('Apellidos', [ validators.DataRequired(message='Es necesario introducir apellidos'), validators.Length(min=4, max=50, message='El tamaño máximo del nombre son 50 carácteres')]) # username = StringField('Username', [ # validators.Length(min=4, max=25, message='El nombre de usuario debe tener entre 4 y 25 carácteres')]) email = StringField('Email', [ validators.DataRequired(message='Es necesario introducir un email'), validators.Length(min=1, max=50, message='El email no puede contener más de 50 carácteres')]) password = PasswordField('Contraseña', [ validators.DataRequired(message='Es necesario una contraseña'), validators.Length(min=8, message='La contraseña debe tener al menos 8 caracteres') ]) confirm = PasswordField('Confirmar Contraseña', [ validators.EqualTo('password', message='Las contraseñas no coinciden') ]) # Structure of the Login form class RestorePasswordForm(Form): email = StringField('Email', [ validators.DataRequired(message='Es necesario introducir un email')]) submit = SubmitField("Correo de Recuperación") class EditProfile(FlaskForm): name = StringField('Nombre', [ validators.DataRequired(message='Es necesario introducir un nombre'), validators.Length(min=4, max=50, message='El tamaño máximo del nombre son 50 carácteres')]) lastname = StringField('Apellidos', [ validators.DataRequired(message='Es necesario introducir apellidos'), validators.Length(min=4, max=50, message='El tamaño máximo del nombre son 50 carácteres')]) gender = RadioField('Género', choices = [('hombre','Hombre'),('mujer','Mujer')]) submit = SubmitField('Guardar cambios') class EditLocation(FlaskForm): lat = HiddenField('Latitud', [ validators.DataRequired(message='No se ha podido obtener la nueva localización') ]) lng = HiddenField('Longitud', [ validators.DataRequired(message='No se ha podido obtener la nueva localización') ]) submit = SubmitField('Establecer ubicación') class EditPassword(FlaskForm): old = PasswordField('Contraseña Anterior', [ validators.DataRequired(message='Es necesario introducir una contraseña') ]) password = PasswordField('Eliga una contraseña', [ validators.DataRequired(message='Es necesario introducir una contraseña'), validators.Length(min=8, message='La contraseña debe tener al menos 8 caracteres') ]) confirm = PasswordField('Confirme la contraseña', [ validators.EqualTo('password', message='Las contraseñas no coinciden') ]) submit = SubmitField('Cambiar contraseña') class EditEmail(FlaskForm): email = StringField('Correo electrónico', [ validators.DataRequired(message='Es necesario introducir una dirección de correo'), validators.Length(min=1, max=50, message='El correo no puede contener más de 50 carácteres')]) confirm = StringField('Confirmar correo electrónico', [ validators.EqualTo('email', message='Los correos no coinciden') ]) submit = SubmitField('Cambiar correo') class EditPicture(FlaskForm): picture = FileField('Imagen de perfil') submit = SubmitField('Establecer imagen') delete = SubmitField('Eliminar imagen') class DeleteAccount(FlaskForm): delete = SubmitField("Eliminar cuenta") # Structure of the Subir Anuncio form class SubirAnuncioForm(FlaskForm): # pictures = HiddenField("Imágenes") # mimes = HiddenField("Formatos de imagen") name = StringField('Nombre del producto', [ validators.DataRequired(message='Es necesario introducir un nombre de producto'), validators.Length(min=1, max=50, message='El tamaño máximo del nombre del producto son 50 carácteres')]) price = DecimalField('Precio (€)', [ validators.DataRequired(message='Es necesario introducir un precio'), validators.NumberRange(min=0, max=1000000, message='El precio intoducido no es válido (de 0 € a 999.999,99 €)')]) category = SelectField('Categoría', choices = [ ('Automoción', 'Automoción'), ('Informática', 'Informática'), ('Moda', 'Moda'), ('Deporte y ocio', 'Deporte y ocio'), ('Videojuegos', 'Videojuegos'), ('Libros y música', 'Libros y música'), ('Hogar y jardín', 'Hogar y jardín'), ('Foto y audio', 'Foto y audio') ], validators = [ validators.DataRequired(message='Es necesario seleccionar una categoría') ]) description = TextAreaField('Descripción', [ validators.DataRequired(message='Es necesario escribir una descripción')]) lat = HiddenField('Latitud') lng = HiddenField('Longitud') enddate = DateField('End', format = '%Y-%m-%d', description = 'Time that the event will occur', validators= [validators.Optional()] ) submit = SubmitField('Publicar') class ProductSearch(Form): categories = ['Automoción', 'Informática', 'Moda', 'Deporte y ocio', 'Videojuegos', 'Libros y música', 'Hogar y jardín', 'Foto y audio'] category = SelectField('Categoría', choices = [ ('Automoción', 'Automoción'), ('Informática', 'Informática'), ('Moda', 'Moda'), ('Deporte y ocio', 'Deporte y ocio'), ('Videojuegos', 'Videojuegos'), ('Libros y música', 'Libros y música'), ('Hogar y jardín', 'Hogar y jardín'), ('Foto y audio', 'Foto y audio') ]) estados = [('en venta', 'En Venta'), ('vendido', 'Vendido')] resultadosporpag = ['15', '30', '45', '60', '75', '90'] ordenacionlist = [('published ASC', 'Fecha (Más viejos primero)'), ('published DESC', 'Fecha (Más nuevos primero)'), ('distance DESC', 'Distancia Descendente'), ('distance ASC', 'Distancia Ascendente'), ('price ASC', 'Precio Ascendente'), ('price DESC', 'Precio Descendente'), ('views DESC', 'Popularidad descendente')] status = SelectField('Estado', choices = [ ('en venta','En Venta'), ('vendido','Vendido') ]) keywords = StringField('Palabras Clave') minprice = StringField('Precio Mínimo') maxprice = StringField('Precio Máximo') minpublished = DateField('Start', format = '%Y-%m-%d', description = 'Time that the event will occur') maxpublished = DateField('Start', format = '%Y-%m-%d', description = 'Time that the event will occur') resultados = SelectField('Resultados Por Página', choices = [ ('15', '15'), ('30', '30'), ('45', '45'), ('60', '60'), ('75', '75'), ('90', '90') ]) ordenacion = SelectField('Ordenación de Resultados', choices = [ ('published ASC', 'Fecha (Más viejos primero)'), ('published DESC', 'Fecha (Más nuevos primero)'), ('distance DESC', 'Distancia Descendente'), ('distance ASC', 'Distancia Ascendente'), ('price ASC', 'Precio Ascendente'), ('price DESC', 'Precio Descendente'), ('views DESC', 'Popularidad descendente') ]) distancia = StringField('Distancia') submit = SubmitField('Buscar') class Review(FlaskForm): stars = IntegerField('Puntuación', [ validators.DataRequired(message='Es necesario introducir una puntuación entre 1 y 5'), validators.NumberRange(min=1, max=5, message='La puntuación debe ser de 1 a 5 estrellas')]) comment = TextAreaField('Comentario', [ validators.DataRequired(message='Es necesario escribir un comentario')]) submit = SubmitField('Publicar Valoración') class bidPlacementForm(FlaskForm): amount = StringField('Cantidad') submit = SubmitField('Realizar Puja') class reportForm(Form): category = SelectField('Categoría', choices = [ ('Sospecha de fraude', 'Sospecha de fraude'), ('No acudió a la cita', 'No acudió a la cita'), ('Mal comportamiento', 'Mal comportamiento'), ('Artículo defectuoso', 'Artículo defectuoso'), ('Otros', 'Otros')]) description = TextAreaField('Descripción del informe', [ validators.DataRequired(message='Es necesario escribir una descripción')]) submit = SubmitField('Publicar Informe')
48.025381
323
0.649931
9,067
0.948729
0
0
0
0
0
0
4,273
0.447107
bc9fd661a260bba8109c66590275e9d7c9b1094c
2,774
py
Python
hello.py
LMiceOrg/postdoc-voting
091fd6caa120f7c5aae600c0a492a185ec10e9d6
[ "CC0-1.0", "MIT" ]
null
null
null
hello.py
LMiceOrg/postdoc-voting
091fd6caa120f7c5aae600c0a492a185ec10e9d6
[ "CC0-1.0", "MIT" ]
null
null
null
hello.py
LMiceOrg/postdoc-voting
091fd6caa120f7c5aae600c0a492a185ec10e9d6
[ "CC0-1.0", "MIT" ]
null
null
null
#coding: utf-8 import sys import os import asyncio import websockets import json import socket import xlrd #global vars phd_data = None pro_data = None def get_host_ip(): try: s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.connect(('1.255.255.255', 65535)) ip = s.getsockname()[0] finally: s.close() return ip def read_xls(name): try: book = xlrd.open_workbook(name) except: print("Open Excel(%s) failed!" % name) for i in range(book.nsheets): s = book.sheet_by_index(i) sname = s.name svalue = list() for r in range(s.nrows): svalue.append( s.row_values(r) ) ctx[i] = (sname, svalue) return ctx #生成json def gen_pro(): ret = { "header": [ { "name": "id", "title": "ID", "size": 50, "sortable": True, "sortDir": "asc", "format": "number" }, { "name": "name", "title": "Name", "sortable": True }, { "name": "start", "title": "Start", "sortable": True, "size": 150, "format": "date", "formatMask": "dd-mm-yyyy" }, { "name": "age", "title": "Age", "sortable": True, "size": 80 }, { "name": "salary", "title": "Salary", "sortable": True, "size": 150, "format": "money", "show": True } ], "data":[] } return ret async def proc_msg(ws, msg): method = msg.get('method') if method == 'host_ip': ip=get_host_ip() ret = { "method":method, "type":'success', 'return':ip } await ws.send(json.dumps(ret)) elif method=='genpro': phd_file = msg.get('phd_file') if phd_file: phd_data = read_xls(phd_file) pro_file = msg.get('pro_file') if pro_file: pro_data = read_xls(pro_file) data = gen_pro() ret = { "method":method, "type":'success', 'return':data } await ws.send(json.dumps(ret)) else: ret = {'type':'unknown'} await ws.send(json.dumps(ret)) async def recv_msg(websocket): while True: recv_text = await websocket.recv() try: msg = json.loads(recv_text) await proc_msg(websocket, msg) except: ret = {'type':'error'} await ws.send(json.dumps(ret)) async def main_logic(websocket, path): await recv_msg(websocket) port = 5678 if len(sys.argv) >=2: port = sys.argv[1] ws_server = websockets.serve(main_logic, '0.0.0.0', port) asyncio.get_event_loop().run_until_complete(ws_server) asyncio.get_event_loop().run_forever()
20.248175
60
0.519466
0
0
0
0
0
0
1,099
0.395608
522
0.187905
bca0727b76dc54909be0bf60b6d636ec8f539927
2,518
py
Python
runtime/Python3/src/antlr4/dfa/DFASerializer.py
maximmenshikov/antlr4
5ad8c150ae6b9a34a92df1f59606516fe58cb65f
[ "BSD-3-Clause" ]
11,811
2015-01-01T02:40:39.000Z
2022-03-31T16:11:19.000Z
runtime/Python3/src/antlr4/dfa/DFASerializer.py
maximmenshikov/antlr4
5ad8c150ae6b9a34a92df1f59606516fe58cb65f
[ "BSD-3-Clause" ]
2,364
2015-01-01T00:29:19.000Z
2022-03-31T21:26:34.000Z
runtime/Python3/src/antlr4/dfa/DFASerializer.py
maximmenshikov/antlr4
5ad8c150ae6b9a34a92df1f59606516fe58cb65f
[ "BSD-3-Clause" ]
3,240
2015-01-05T02:34:15.000Z
2022-03-30T18:26:29.000Z
# # Copyright (c) 2012-2017 The ANTLR Project. All rights reserved. # Use of this file is governed by the BSD 3-clause license that # can be found in the LICENSE.txt file in the project root. #/ # A DFA walker that knows how to dump them to serialized strings.#/ from io import StringIO from antlr4 import DFA from antlr4.Utils import str_list from antlr4.dfa.DFAState import DFAState class DFASerializer(object): __slots__ = ('dfa', 'literalNames', 'symbolicNames') def __init__(self, dfa:DFA, literalNames:list=None, symbolicNames:list=None): self.dfa = dfa self.literalNames = literalNames self.symbolicNames = symbolicNames def __str__(self): if self.dfa.s0 is None: return None with StringIO() as buf: for s in self.dfa.sortedStates(): n = 0 if s.edges is not None: n = len(s.edges) for i in range(0, n): t = s.edges[i] if t is not None and t.stateNumber != 0x7FFFFFFF: buf.write(self.getStateString(s)) label = self.getEdgeLabel(i) buf.write("-") buf.write(label) buf.write("->") buf.write(self.getStateString(t)) buf.write('\n') output = buf.getvalue() if len(output)==0: return None else: return output def getEdgeLabel(self, i:int): if i==0: return "EOF" if self.literalNames is not None and i<=len(self.literalNames): return self.literalNames[i-1] elif self.symbolicNames is not None and i<=len(self.symbolicNames): return self.symbolicNames[i-1] else: return str(i-1) def getStateString(self, s:DFAState): n = s.stateNumber baseStateStr = ( ":" if s.isAcceptState else "") + "s" + str(n) + ( "^" if s.requiresFullContext else "") if s.isAcceptState: if s.predicates is not None: return baseStateStr + "=>" + str_list(s.predicates) else: return baseStateStr + "=>" + str(s.prediction) else: return baseStateStr class LexerDFASerializer(DFASerializer): def __init__(self, dfa:DFA): super().__init__(dfa, None) def getEdgeLabel(self, i:int): return "'" + chr(i) + "'"
34.027027
113
0.548451
2,127
0.844718
0
0
0
0
0
0
334
0.132645
bca253db9d9aae8a5131355cc2fd801c42bb88f2
13,242
py
Python
sw/calibrate.py
microsoft/moabian
db95844103faedb3788abb5f37d0f37a771a9455
[ "MIT" ]
13
2020-09-17T19:54:30.000Z
2022-03-01T00:25:11.000Z
sw/calibrate.py
microsoft/moabian
db95844103faedb3788abb5f37d0f37a771a9455
[ "MIT" ]
27
2020-09-21T23:51:50.000Z
2022-03-25T19:45:16.000Z
sw/calibrate.py
microsoft/moabian
db95844103faedb3788abb5f37d0f37a771a9455
[ "MIT" ]
13
2020-11-30T19:01:38.000Z
2021-11-10T11:28:36.000Z
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """ Calibration Controller Performs calibration for hue, center of camera position, and servo offsets """ import os import cv2 import time import json import argparse import datetime import numpy as np import logging as log from env import MoabEnv from typing import Tuple from common import Vector2 from detector import hsv_detector from controllers import pid_controller from dataclasses import dataclass, astuple from hardware import plate_angles_to_servo_positions @dataclass class CalibHue: hue: int = 44 # Reasonable default success: bool = False early_quit: bool = False # If menu is pressed before the calibration is complete def __iter__(self): return iter(astuple(self)) @dataclass class CalibPos: position: Tuple[float, float] = (0.0, 0.0) success: bool = False early_quit: bool = False # If menu is pressed before the calibration is complete def __iter__(self): return iter(astuple(self)) @dataclass class CalibServos: servos: Tuple[float, float, float] = (0.0, 0.0, 0.0) success: bool = False early_quit: bool = False # If menu is pressed before the calibration is complete def __iter__(self): return iter(astuple(self)) def ball_close_enough(x, y, radius, max_ball_dist=0.045, min_ball_dist=0.01): # reject balls which are too far from the center and too small return ( np.abs(x) < max_ball_dist and np.abs(y) < max_ball_dist and radius > min_ball_dist ) def calibrate_hue(camera_fn, detector_fn, is_menu_down_fn): hue_low = 0 hue_high = 360 hue_steps = 41 # Is 41 instead of 40 so that the steps are even img_frame, elapsed_time = camera_fn() hue_options = list(np.linspace(hue_low, hue_high, hue_steps)) detected_hues = [] for hue in hue_options: if is_menu_down_fn(): return CalibHue(early_quit=True) img_frame, elapsed_time = camera_fn() ball_detected, ((x, y), radius) = detector_fn(img_frame, hue=hue, debug=True) # If we found a ball roughly in the center that is large enough if ball_detected and ball_close_enough(x, y, radius): log.info( f"hue={hue:0.3f}, ball_detected={ball_detected}, " f"(x, y)={x:0.3f} {y:0.3f}, radius={radius:0.3f}" ) detected_hues.append(hue) if len(detected_hues) > 0: # https://en.wikipedia.org/wiki/Mean_of_circular_quantities detected_hues_rad = np.radians(detected_hues) sines, cosines = np.sin(detected_hues_rad), np.cos(detected_hues_rad) sin_mean, cos_mean = np.mean(sines), np.mean(cosines) avg_hue_rad = np.arctan2(sin_mean, cos_mean) avg_hue = np.degrees(avg_hue_rad) % 360 # Convert back to [0, 360] print(f"Hues are: {detected_hues}") print(f"Hue calibrated: {avg_hue:0.2f}") print(f"Avg hue: {avg_hue:0.2f}") return CalibHue(hue=int(avg_hue), success=True) else: log.warning(f"Hue calibration failed.") return CalibHue() def calibrate_pos(camera_fn, detector_fn, hue, is_menu_down_fn): for i in range(10): # Try and detect for 10 frames before giving up if is_menu_down_fn(): return CalibPos(early_quit=True) img_frame, elapsed_time = camera_fn() ball_detected, ((x, y), radius) = detector_fn(img_frame, hue=hue) # If we found a ball roughly in the center that is large enough if ball_detected and ball_close_enough(x, y, radius): x_offset = round(x, 3) y_offset = round(y, 3) log.info(f"Offset calibrated: [{x_offset:.3f}, {y_offset:.3f}]") return CalibPos(position=(x_offset, y_offset), success=True) log.warning(f"Offset calibration failed.") return CalibPos() def calibrate_servo_offsets(pid_fn, env, stationary_vel=0.005, time_limit=20): start_time = time.time() action = Vector2(0, 0) # Initial high vel_history (to use the vel_hist[-100:] later) vel_x_hist = [1.0 for _ in range(100)] vel_y_hist = [1.0 for _ in range(100)] # Run until the ball has stabilized or the time limit was reached while time.time() < start_time + time_limit: state = env.step(action) action, info = pid_fn(state) (x, y, vel_x, vel_y, sum_x, sum_y), ball_detected, buttons = state # Quit on menu down if buttons.menu_button: return CalibServos(early_quit=True) if ball_detected: vel_x_hist.append(vel_x) vel_y_hist.append(vel_y) prev_100_x = np.mean(np.abs(vel_x_hist[-100:])) prev_100_y = np.mean(np.abs(vel_y_hist[-100:])) print("Prev 100: ", (prev_100_x, prev_100_y)) # If the average velocity for the last 100 timesteps is under the limit if (prev_100_x < stationary_vel) and (prev_100_y < stationary_vel): # Calculate offsets by calculating servo positions at the # current stable position and subtracting the `default` zeroed # position of the servos. servos = np.array(plate_angles_to_servo_positions(*action)) servos_zeroed = np.array(plate_angles_to_servo_positions(0, 0)) servo_offsets = list(servos - servos_zeroed) return CalibServos(servos=servo_offsets, success=True) # If the plate could be stabilized in time_limit seconds, quit log.warning(f"Servo calibration failed.") return CalibServos() def write_calibration(calibration_dict, calibration_file="bot.json"): log.info("Writing calibration.") # write out stuff with open(calibration_file, "w+") as outfile: log.info(f"Creating calibration file {calibration_file}") json.dump(calibration_dict, outfile, indent=4, sort_keys=True) def read_calibration(calibration_file="bot.json"): log.info("Reading previous calibration.") if os.path.isfile(calibration_file): with open(calibration_file, "r") as f: calibration_dict = json.load(f) else: # Use defaults calibration_dict = { "ball_hue": 44, "plate_offsets": (0.0, 0.0), "servo_offsets": (0.0, 0.0, 0.0), } return calibration_dict def wait_for_joystick_or_menu(hardware, sleep_time=1 / 30): """Waits for either the joystick or the menu. Returns the buttons""" while True: buttons = hardware.get_buttons() if buttons.menu_button or buttons.joy_button: return buttons time.sleep(sleep_time) def wait_for_menu(hardware, sleep_time=1 / 30): while True: menu_button, joy_button, joy_x, joy_y = hardware.get_buttons() time.sleep(sleep_time) if menu_button: return def run_calibration(env, pid_fn, calibration_file): # Get some hidden things from env hardware = env.hardware camera_fn = hardware.camera detector_fn = hardware.detector def is_menu_down(hardware=hardware) -> bool: return hardware.get_buttons().menu_button # lift plate up first hardware.set_angles(0, 0) # Display message and wait for joystick hardware.display( "put ball on stand\nclick joystick", # "Place ball in\ncenter using\nclear stand.\n\n" "Click joystick\nwhen ready." scrolling=True, ) buttons = wait_for_joystick_or_menu(hardware) if buttons.menu_button: # Early quit hardware.go_up() return hardware.display("Calibrating...") hue_calib = calibrate_hue(camera_fn, detector_fn, is_menu_down) if hue_calib.early_quit: hardware.go_up() return # Calibrate position pos_calib = calibrate_pos(camera_fn, detector_fn, hue_calib.hue, is_menu_down) if pos_calib.early_quit: hardware.go_up() return # Save calibration calibration_dict = read_calibration(calibration_file) calibration_dict["ball_hue"] = hue_calib.hue calibration_dict["plate_offsets"] = pos_calib.position x_offset, y_offset = pos_calib.position write_calibration(calibration_dict) # Update the environment to use the new calibration # Warning! This mutates the state! hardware.reset_calibration(calibration_file=calibration_file) if pos_calib.success and hue_calib.success: # and servo_calib.success: hardware.display(f"Ok! Ball hue={hue_calib.hue}\nClick menu...", scrolling=True) elif not (pos_calib.success or hue_calib.success): # or servo_calib.success): hardware.display("Calibration failed\nClick menu...", scrolling=True) else: hue_str = ( f"Hue calib:\nsuccessful\nBall hue = {hue_calib.hue}\n\n" if hue_calib.success else "Hue calib:\nfailed\n\n" ) pos_str = ( f"Position \ncalib:\nsuccessful\nPosition = \n({100*x_offset:.1f}, {100*y_offset:.1f})cm\n\n" if hue_calib.success else "(X, Y) calib:\nfailed\n\n" ) hardware.display( "Calibration\npartially succeeded\n\n" + hue_str + pos_str + "Click menu\nto return...\n", scrolling=True, ) # When the calibration is complete, save the image of what the moab camera # sees (useful for debugging when the hue calibration fails) # Have a nice filename with the time and whether it succeeded or failed time_of_day = datetime.datetime.now().strftime("%H%M%S") filename = "/tmp/hue" if hue_calib.success: filename += f".{hue_calib.hue}.{time_of_day}.jpg" else: filename += f".fail.{time_of_day}.jpg" img_frame, _ = camera_fn() # Huemask keeps an internal cache. By sending a new hue (hue + 1) invalidates # the cache. TODO: added this while searching for a state bug detector_fn(img_frame, hue=hue_calib.hue + 1, debug=True, filename=filename) hardware.go_up() def run_servo_calibration(env, pid_fn, calibration_file): # Warning: servo calib works but doesn't currently give a good calibration raise NotImplementedError # Get some hidden things from env hardware = env.hardware camera_fn = hardware.camera detector_fn = hardware.detector # Start the calibration with uncalibrated servos hardware.servo_offsets = (0, 0, 0) # lift plate up fist hardware.set_angles(0, 0) # Calibrate servo offsets hardware.display( "Calibarating\nservos\n\n" "Place ball in\ncenter without\n stand.\n\n" "Click joystick\nto continue.", scrolling=True, ) buttons = wait_for_joystick_or_menu(hardware) if buttons.menu_button: # Early quit hardware.go_up() return hardware.display("Calibrating\nservos...", scrolling=True) servo_calib = calibrate_servo_offsets(pid_fn, env) # Save calibration calibration_dict = read_calibration(calibration_file) calibration_dict["servo_offsets"] = servo_calib.servos s1, s2, s3 = servo_calib.servos write_calibration(calibration_dict) # Update the environment to use the new calibration # Warning! This mutates the state! env.reset_calibration(calibration_file=calibration_file) if servo_calib.success: hardware.display( f"servo offsets =\n({s1:.2f}, {s2:.2f}, {s3:.2f})\n\n" "Click menu\nto return...\n", scrolling=True, ) print(f"servo offsets =\n({s1:.2f}, {s2:.2f}, {s3:.2f})") else: hardware.display( "Calibration\nfailed\n\nClick menu\nto return...", scrolling=True ) hardware.go_up() def calibrate_controller(**kwargs): run_calibration( kwargs["env"], kwargs["pid_fn"], kwargs["calibration_file"], ) def wait_for_menu_and_stream(): # Get some hidden things from env to be able to stream the calib results env = kwargs["env"] hardware = env.hardware camera_fn = hardware.camera detector_fn = hardware.detector menu_button = False while not menu_button: img_frame, _ = camera_fn() detector_fn(img_frame, debug=True) # Save to streaming menu, joy, _, _ = hardware.get_buttons() if menu or joy: break env.hardware.go_up() return wait_for_menu_and_stream def main(calibration_file, frequency=30, debug=True): pid_fn = pid_controller(frequency=frequency) with MoabEnv(frequency=frequency, debug=debug) as env: env.step((0, 0)) time.sleep(0.2) env.hardware.enable_servos() time.sleep(0.2) env.hardware.set_servos(133, 133, 133) run_calibration(env, pid_fn, calibration_file) env.hardware.disable_servos() if __name__ == "__main__": # Parse command line args parser = argparse.ArgumentParser() parser.add_argument("-d", "--debug", action="store_true") parser.add_argument("-f", "--file", default="bot.json", type=str) args, _ = parser.parse_known_args() main(args.file, debug=args.debug)
32.696296
105
0.655264
708
0.053466
0
0
741
0.055958
0
0
3,804
0.287268
bca450dae1b4675ac1d585a61880a16b6a3d235e
3,739
py
Python
marketing/tests_celery_tasks.py
renzyndrome/lits-crm
32daea8c76f91780b8cc8c3f107d04df606c0ec8
[ "MIT" ]
1
2021-03-01T12:07:10.000Z
2021-03-01T12:07:10.000Z
marketing/tests_celery_tasks.py
renzyndrome/lits-crm
32daea8c76f91780b8cc8c3f107d04df606c0ec8
[ "MIT" ]
null
null
null
marketing/tests_celery_tasks.py
renzyndrome/lits-crm
32daea8c76f91780b8cc8c3f107d04df606c0ec8
[ "MIT" ]
1
2021-12-09T09:38:50.000Z
2021-12-09T09:38:50.000Z
from datetime import datetime, timedelta from django.test import TestCase from django.test.utils import override_settings from marketing.tasks import ( delete_multiple_contacts_tasks, list_all_bounces_unsubscribes, run_all_campaigns, run_campaign, send_campaign_email_to_admin_contact, send_scheduled_campaigns, upload_csv_file, ) from marketing.tests import TestMarketingModel class TestCeleryTasks(TestMarketingModel, TestCase): @override_settings( CELERY_EAGER_PROPAGATES_EXCEPTIONS=True, CELERY_ALWAYS_EAGER=True, BROKER_BACKEND="memory", ) def test_celery_tasks(self): task = run_campaign.apply( (self.campaign.id,), ) self.assertEqual("SUCCESS", task.state) self.campaign.reply_to_email = None self.campaign.save() task = run_campaign.apply( (self.campaign.id,), ) self.assertEqual("SUCCESS", task.state) self.campaign.schedule_date_time = datetime.now() self.campaign.save() task = run_all_campaigns.apply() self.assertEqual("SUCCESS", task.state) task = list_all_bounces_unsubscribes.apply() self.assertEqual("SUCCESS", task.state) task = send_scheduled_campaigns.apply() self.assertEqual("SUCCESS", task.state) task = delete_multiple_contacts_tasks.apply( (self.contact_list.id,), ) self.assertEqual("SUCCESS", task.state) task = send_campaign_email_to_admin_contact.apply( (self.campaign.id,), ) self.assertEqual("SUCCESS", task.state) valid_rows = [ { "company name": "company_name_1", "email": "[email protected]", "first name": "first_name", "last name": "last_name", "city": "Hyderabad", "state": "Telangana", }, { "company name": "company_name_2", "email": "[email protected]", "first name": "first_name", "last name": "last_name", "city": "Hyderabad", "state": "Telangana", }, { "company name": "company_name_3", "email": "[email protected]", "first name": "first_name", "last name": "last_name", "city": "Hyderabad", "state": "Telangana", }, { "company name": "company_name_4", "email": "[email protected]", "first name": "first_name", "last name": "last_name", "city": "Hyderabad", "state": "Telangana", }, ] invalid_rows = [ { "company name": "company_name_1", "email": "useremail.com", "first name": "first_name", "last name": "last_name", "city": "Hyderabad", "state": "Telangana", }, { "company name": "company_name_2", "email": "user2@email", "first name": "first_name", "last name": "last_name", "city": "Hyderabad", "state": "Telangana", }, ] task = upload_csv_file.apply( ( valid_rows, invalid_rows, self.user.id, [ self.contact_list.id, ], self.company.id, ), ) self.assertEqual("SUCCESS", task.state)
29.912
58
0.502006
3,328
0.890078
0
0
3,271
0.874833
0
0
884
0.236427
bca568d5e71e781c0b945807208117a83879f72f
263
py
Python
doc's/3-labels_and_titles.py
andreluispy/py2html
227f3225632b467c95131b841d6ffab4c5202e44
[ "MIT" ]
null
null
null
doc's/3-labels_and_titles.py
andreluispy/py2html
227f3225632b467c95131b841d6ffab4c5202e44
[ "MIT" ]
null
null
null
doc's/3-labels_and_titles.py
andreluispy/py2html
227f3225632b467c95131b841d6ffab4c5202e44
[ "MIT" ]
null
null
null
from py2html.main import * page = web() page.create() # Header Parameters # text = header text # n = title level page.header(text='My Site', n=1) # Label Parameters # text = label text # color = label color page.label(text='', color='') page.compile()
16.4375
32
0.657795
0
0
0
0
0
0
0
0
135
0.513308
bca56f1f07a7efd89750413292d60e6212055e4a
1,022
py
Python
JorGpi/tests/test_pickup.py
adujovic/JorG
15062984e837a938819e548c83f6f5414fa47103
[ "BSD-3-Clause" ]
1
2020-07-22T11:05:03.000Z
2020-07-22T11:05:03.000Z
JorGpi/tests/test_pickup.py
adujovic/JorG
15062984e837a938819e548c83f6f5414fa47103
[ "BSD-3-Clause" ]
2
2019-06-07T11:53:48.000Z
2019-06-24T08:20:25.000Z
JorGpi/tests/test_pickup.py
adujovic/JorG
15062984e837a938819e548c83f6f5414fa47103
[ "BSD-3-Clause" ]
3
2019-07-01T12:38:06.000Z
2022-02-01T21:38:12.000Z
import unittest from JorGpi.pickup.pickup import SmartPickUp,Reference,CommandLineOptions class TestPickupIron(unittest.TestCase): @staticmethod def options(*args): return CommandLineOptions(*args) def test_iron_001(self): _input = "test -R _VASP/Fe/noFlip -D _VASP/Fe/flip00000 -E Fe -J1 -U mRy".split(" ") options = TestPickupIron.options(*_input) elements = ''.join(options('elements')) self.assertEqual(elements,'Fe$') ref = Reference(options('reference')+"/POSCAR") self.assertEqual(ref(),0) self.assertEqual(options('number_of_interactions'),1) pickerUpper = SmartPickUp(options('number_of_interactions'),elements) pickerUpper.read(options('reference'),*options('directories'),reference=ref()) self.assertEqual(options('units'),'mRy') _J_ij = pickerUpper.solve(units=options('units')).flatten() self.assertEqual(_J_ij[0],1.1861042008301703) self.assertEqual(_J_ij[1],4.157645364906014)
37.851852
92
0.682975
929
0.909002
0
0
78
0.076321
0
0
195
0.190802
bca5cc541dfab73d45981c6f120eb783e0579f49
131
py
Python
jwt_auth/admin.py
alaraayan/todo-backend
37e46b6789012c2d64a39f6d2429b1ae893dba37
[ "CC-BY-3.0" ]
null
null
null
jwt_auth/admin.py
alaraayan/todo-backend
37e46b6789012c2d64a39f6d2429b1ae893dba37
[ "CC-BY-3.0" ]
null
null
null
jwt_auth/admin.py
alaraayan/todo-backend
37e46b6789012c2d64a39f6d2429b1ae893dba37
[ "CC-BY-3.0" ]
null
null
null
from django.contrib import admin from django.contrib.auth import get_user_model User = get_user_model() admin.site.register(User)
21.833333
46
0.824427
0
0
0
0
0
0
0
0
0
0
bca685ecc21d97e8e24f16ef46f6aaabe24a9d13
21,795
py
Python
spotseeker_server/test/search/distance.py
uw-it-aca/spotseeker_server
1d8a5bf98b76fdcb807ed4cd32f939bb7e9aa66c
[ "Apache-2.0" ]
5
2015-03-12T00:36:33.000Z
2022-02-24T16:41:25.000Z
spotseeker_server/test/search/distance.py
uw-it-aca/spotseeker_server
1d8a5bf98b76fdcb807ed4cd32f939bb7e9aa66c
[ "Apache-2.0" ]
133
2016-02-03T23:54:45.000Z
2022-03-30T21:33:58.000Z
spotseeker_server/test/search/distance.py
uw-it-aca/spotseeker_server
1d8a5bf98b76fdcb807ed4cd32f939bb7e9aa66c
[ "Apache-2.0" ]
6
2015-01-07T23:21:15.000Z
2017-12-07T08:26:33.000Z
# Copyright 2021 UW-IT, University of Washington # SPDX-License-Identifier: Apache-2.0 from django.test import TestCase from django.conf import settings from django.test.client import Client from spotseeker_server.models import Spot import simplejson as json from decimal import * from django.test.utils import override_settings from mock import patch from spotseeker_server import models @override_settings(SPOTSEEKER_AUTH_MODULE="spotseeker_server.auth.all_ok") class SpotSearchDistanceTest(TestCase): def test_invalid_latitude(self): c = Client() response = c.get( "/api/v1/spot", { "center_latitude": "bad_data", "center_longitude": -40, "distance": 10, }, ) self.assertEquals( response.status_code, 200, "Accepts a query with bad latitude" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) def test_invalid_longitude(self): c = Client() response = c.get( "/api/v1/spot", { "center_latitude": "30", "center_longitude": "bad_data", "distance": "10", }, ) self.assertEquals( response.status_code, 200, "Accepts a query with bad longitude" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) def test_invalid_height(self): c = Client() response = c.get( "/api/v1/spot", { "center_latitude": "30", "center_longitude": -40, "height_from_sea_level": "bad_data", "distance": "10", }, ) self.assertEquals( response.status_code, 200, "Accepts a query with bad height" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) def test_invalid_distance(self): c = Client() response = c.get( "/api/v1/spot", { "center_latitude": "30", "center_longitude": "-40", "distance": "bad_data", }, ) self.assertEquals( response.status_code, 200, "Accepts a query with bad distance" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) def test_large_longitude(self): c = Client() response = c.get( "/api/v1/spot", {"center_latitude": 30, "center_longitude": 190, "distance": 10}, ) self.assertEquals( response.status_code, 200, "Accepts a query with too large longitude", ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) def test_large_latitude(self): c = Client() response = c.get( "/api/v1/spot", {"center_latitude": 100, "center_longitude": -40, "distance": 10}, ) self.assertEquals( response.status_code, 200, "Accepts a query with too large latitude", ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) def test_large_negative_latitude(self): c = Client() response = c.get( "/api/v1/spot", {"center_latitude": -100, "center_longitude": -40, "distance": 10}, ) self.assertEquals( response.status_code, 200, "Accepts a query with too negative latitude", ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) def test_large_negative_longitude(self): c = Client() response = c.get( "/api/v1/spot", {"center_latitude": 40, "center_longitude": -190, "distance": 10}, ) self.assertEquals( response.status_code, 200, "Accepts a query with too negative longitude", ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) def test_no_params(self): c = Client() response = c.get("/api/v1/spot", {}) self.assertEquals( response.status_code, 200, "Accepts a query with no params" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) def test_distances(self): # Spots are in the atlantic to make them less likely to collide # with actual spots center_lat = 30.000000 center_long = -40.000000 # Inner spots are 10 meters away from the center # Mid spots are 50 meters away from the center # Outer spots are 100 meters away from the center # Far out spots are 120 meters away, at the north # Creating these from the outside in, so things that sort by # primary key will give bad results for things that should be # sorted by distance for i in range(0, 100): far_out = Spot.objects.create( name="Far Out %s" % i, latitude=Decimal("30.0010779783"), longitude=Decimal("-40.0"), ) far_out.save() outer_top = Spot.objects.create( name="Outer Top", latitude=Decimal("30.0008983153"), longitude=Decimal("-40.0"), ) outer_top.save() outer_bottom = Spot.objects.create( name="Outer Bottom", latitude=Decimal("29.9991016847"), longitude=Decimal("-40.0"), ) outer_bottom.save() outer_left = Spot.objects.create( name="Outer Left", latitude=Decimal("30.0"), longitude=Decimal("-40.0010372851"), ) outer_left.save() outer_right = Spot.objects.create( name="Outer Right", latitude=Decimal("30.0"), longitude=Decimal("-39.9989627149"), ) outer_right.save() mid_top = Spot.objects.create( name="Mid Top", latitude=Decimal(" 30.0004491576"), longitude=Decimal("-40.0"), ) mid_top.save() mid_bottom = Spot.objects.create( name="Mid Bottom", latitude=Decimal("29.9995508424"), longitude=Decimal("-40.0"), ) mid_bottom.save() mid_left = Spot.objects.create( name="Mid Left", latitude=Decimal("30.0"), longitude=Decimal("-40.0005186426"), ) mid_left.save() mid_right = Spot.objects.create( name="Mid Right", latitude=Decimal("30.0"), longitude=Decimal("-39.9994813574"), ) mid_right.save() inner_top = Spot.objects.create( name="Inner Top", latitude=Decimal("30.0000898315"), longitude=Decimal("-40.0"), ) inner_top.save() inner_bottom = Spot.objects.create( name="Inner Bottom", latitude=Decimal("29.9999101685"), longitude=Decimal("-40.0"), ) inner_bottom.save() inner_left = Spot.objects.create( name="Inner Left", latitude=Decimal("30.0"), longitude=Decimal("-40.0001037285"), ) inner_left.save() inner_right = Spot.objects.create( name="Inner Right", latitude=Decimal("30.0"), longitude=Decimal("-39.9998962715"), ) inner_right.save() # Testing to make sure too small of a radius returns nothing c = Client() response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 1, }, ) self.assertEquals( response.status_code, 200, "Accepts a query with no matches" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) self.assertEquals( response.content.decode(), "[]", "Should return no matches" ) # Testing the inner ring response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 12, }, ) self.assertEquals( response.status_code, 200, "Accepts the distance query" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) spots = json.loads(response.content) self.assertEquals(len(spots), 4, "Returns 4 spots") spot_ids = { inner_left.pk: 1, inner_right.pk: 1, inner_top.pk: 1, inner_bottom.pk: 1, } for spot in spots: self.assertEquals( spot_ids[spot["id"]], 1, "Spot matches a unique inner spot" ) spot_ids[spot["id"]] = 2 # Testing the mid ring response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 60, }, ) self.assertEquals( response.status_code, 200, "Accepts the distance query" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) spots = json.loads(response.content) self.assertEquals(len(spots), 8, "Returns 8 spots") spot_ids = { inner_left.pk: 1, inner_right.pk: 1, inner_top.pk: 1, inner_bottom.pk: 1, mid_left.pk: 1, mid_right.pk: 1, mid_top.pk: 1, mid_bottom.pk: 1, } for spot in spots: self.assertEquals( spot_ids[spot["id"]], 1, "Spot matches a unique inner or mid spot", ) spot_ids[spot["id"]] = 2 # Testing the outer ring response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 110, }, ) self.assertEquals( response.status_code, 200, "Accepts the distance query" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) spots = json.loads(response.content) self.assertEquals(len(spots), 12, "Returns 12 spots") spot_ids = { inner_left.pk: 1, inner_right.pk: 1, inner_top.pk: 1, inner_bottom.pk: 1, mid_left.pk: 1, mid_right.pk: 1, mid_top.pk: 1, mid_bottom.pk: 1, outer_left.pk: 1, outer_right.pk: 1, outer_top.pk: 1, outer_bottom.pk: 1, } for spot in spots: self.assertEquals( spot_ids[spot["id"]], 1, "Spot matches a unique inner, mid or outer spot", ) spot_ids[spot["id"]] = 2 # testing a limit - should get the inner 4, and any 2 of the mid response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 60, "limit": 6, }, ) self.assertEquals( response.status_code, 200, "Accepts the distance query" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) spots = json.loads(response.content) self.assertEquals(len(spots), 6, "Returns 6 spots") spot_ids = { inner_left.pk: 1, inner_right.pk: 1, inner_top.pk: 1, inner_bottom.pk: 1, mid_left.pk: 1, mid_right.pk: 1, mid_top.pk: 1, mid_bottom.pk: 1, } for spot in spots: self.assertEquals( spot_ids[spot["id"]], 1, "Spot matches a unique inner, mid or outer spot", ) spot_ids[spot["id"]] = 2 self.assertEquals( spot_ids[inner_left.pk], 2, "Inner left was selected" ) self.assertEquals( spot_ids[inner_right.pk], 2, "Inner right was selected" ) self.assertEquals(spot_ids[inner_top.pk], 2, "Inner top was selected") self.assertEquals( spot_ids[inner_bottom.pk], 2, "Inner bottom was selected" ) # Testing limits - should get all of the inner and mid, but # no outer spots response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 101, "limit": 8, }, ) self.assertEquals( response.status_code, 200, "Accepts the distance query" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) spots = json.loads(response.content) self.assertEquals(len(spots), 8, "Returns 8 spots") spot_ids = { inner_left.pk: 1, inner_right.pk: 1, inner_top.pk: 1, inner_bottom.pk: 1, mid_left.pk: 1, mid_right.pk: 1, mid_top.pk: 1, mid_bottom.pk: 1, } for spot in spots: self.assertEquals( spot_ids[spot["id"]], 1, "Spot matches a unique inner or mid spot", ) spot_ids[spot["id"]] = 2 # Testing limits - should get all inner and mid spots, and # 2 outer spots response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 101, "limit": 10, }, ) self.assertEquals( response.status_code, 200, "Accepts the distance query" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) spots = json.loads(response.content) self.assertEquals(len(spots), 10, "Returns 10 spots") spot_ids = { inner_left.pk: 1, inner_right.pk: 1, inner_top.pk: 1, inner_bottom.pk: 1, mid_left.pk: 1, mid_right.pk: 1, mid_top.pk: 1, mid_bottom.pk: 1, outer_left.pk: 1, outer_right.pk: 1, outer_top.pk: 1, outer_bottom.pk: 1, } for spot in spots: self.assertEquals( spot_ids[spot["id"]], 1, "Spot matches a unique inner, mid or outer spot", ) spot_ids[spot["id"]] = 2 self.assertEquals( spot_ids[inner_left.pk], 2, "Inner left was selected" ) self.assertEquals( spot_ids[inner_right.pk], 2, "Inner right was selected" ) self.assertEquals(spot_ids[inner_top.pk], 2, "Inner top was selected") self.assertEquals( spot_ids[inner_bottom.pk], 2, "Inner bottom was selected" ) self.assertEquals(spot_ids[mid_left.pk], 2, "Mid left was selected") self.assertEquals(spot_ids[mid_right.pk], 2, "Mid rightwas selected") self.assertEquals(spot_ids[mid_top.pk], 2, "Mid top was selected") self.assertEquals( spot_ids[mid_bottom.pk], 2, "Mid bottom was selected" ) # Testing that limit 0 = no limit - get all 12 spots response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 110, "limit": 0, }, ) self.assertEquals( response.status_code, 200, "Accepts the distance query" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) spots = json.loads(response.content) self.assertEquals(len(spots), 12, "Returns 12 spots with a limit of 0") spot_ids = { inner_left.pk: 1, inner_right.pk: 1, inner_top.pk: 1, inner_bottom.pk: 1, mid_left.pk: 1, mid_right.pk: 1, mid_top.pk: 1, mid_bottom.pk: 1, outer_left.pk: 1, outer_right.pk: 1, outer_top.pk: 1, outer_bottom.pk: 1, } for spot in spots: self.assertEquals( spot_ids[spot["id"]], 1, "Spot matches a unique inner, mid or outer spot", ) spot_ids[spot["id"]] = 2 # Testing that the default limit is 20 spaces response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 150, }, ) self.assertEquals( response.status_code, 200, "Accepts the distance query" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) spots = json.loads(response.content) self.assertEquals( len(spots), 20, "Returns 20 spots with no defined limit" ) spot_ids = { inner_left.pk: 1, inner_right.pk: 1, inner_top.pk: 1, inner_bottom.pk: 1, mid_left.pk: 1, mid_right.pk: 1, mid_top.pk: 1, mid_bottom.pk: 1, outer_left.pk: 1, outer_right.pk: 1, outer_top.pk: 1, outer_bottom.pk: 1, } far_out_count = 0 for spot in spots: if spot["id"] in spot_ids: self.assertEquals( spot_ids[spot["id"]], 1, "Spot matches a unique inner, mid or outer spot", ) else: far_out_count += 1 self.assertEquals( far_out_count, 8, "Found 8 far out spots to fill in the limit of 20", ) # Testing that with a limit of 0, we pull in all spots in range response = c.get( "/api/v1/spot", { "center_latitude": center_lat, "center_longitude": center_long, "distance": 130, "limit": 0, }, ) self.assertEquals( response.status_code, 200, "Accepts the distance query" ) self.assertEquals( response["Content-Type"], "application/json", "Has the json header" ) spots = json.loads(response.content) self.assertEquals( len(spots), 112, "Returns 112 spots with a limit of 0" ) spot_ids = { inner_left.pk: 1, inner_right.pk: 1, inner_top.pk: 1, inner_bottom.pk: 1, mid_left.pk: 1, mid_right.pk: 1, mid_top.pk: 1, mid_bottom.pk: 1, outer_left.pk: 1, outer_right.pk: 1, outer_top.pk: 1, outer_bottom.pk: 1, } far_out_count = 0 for spot in spots: if spot["id"] in spot_ids: self.assertEquals( spot_ids[spot["id"]], 1, "Spot matches a unique inner, mid or outer spot", ) else: far_out_count += 1 self.assertEquals(far_out_count, 100, "Found all 100 far out spots")
31.864035
79
0.501491
21,327
0.978527
0
0
21,402
0.981968
0
0
5,677
0.260473
bca72e22e6e8fe1739abb6f05b2ae3bdddd3d4b0
1,807
py
Python
get_active_LSPs.py
JNPRAutomate/northstar_SDN_controller_automation
09fb5b84eaa1cf939268b542239c9923520d99d3
[ "MIT" ]
3
2019-03-18T17:27:11.000Z
2020-01-22T15:39:18.000Z
get_active_LSPs.py
ksator/northstar_SDN_controller_automation
b78b304194bb64bc14a9c96235ae0792c974f1af
[ "MIT" ]
null
null
null
get_active_LSPs.py
ksator/northstar_SDN_controller_automation
b78b304194bb64bc14a9c96235ae0792c974f1af
[ "MIT" ]
2
2018-03-12T21:13:52.000Z
2020-11-20T23:16:31.000Z
# this python script makes a rest call to Juniper Northstar to get active LSPs # usage: python get_active_LSPs.py import json import requests from requests.auth import HTTPBasicAuth from pprint import pprint import yaml from requests.packages.urllib3.exceptions import InsecureRequestWarning requests.packages.urllib3.disable_warnings(InsecureRequestWarning) def get_token(): url = 'https://' + my_variables_in_yaml['northstar']['ip'] + ':8443/oauth2/token' data_to_get_token = {"grant_type":"password","username":authuser,"password":authpwd} r = requests.post(url, data=json.dumps(data_to_get_token), auth=(authuser, authpwd), headers=headers, verify=False) return str('Bearer ' + r.json()['access_token']) def import_variables_from_file(): my_variables_file=open('variables.yml', 'r') my_variables_in_string=my_variables_file.read() my_variables_in_yaml=yaml.load(my_variables_in_string) my_variables_file.close() return my_variables_in_yaml my_variables_in_yaml=import_variables_from_file() authuser = my_variables_in_yaml['northstar']['username'] authpwd = my_variables_in_yaml['northstar']['password'] url_base = 'http://' + my_variables_in_yaml['northstar']['ip'] + ':8091/NorthStar/API/v2/tenant/' url = url_base + '1/topology/1/te-lsps' headers = { 'Accept': 'application/json' } headers = { 'Content-type': 'application/json' } # r = requests.get(url, headers=headers, auth=(authuser, authpwd)) get_token() headers = {'Authorization':get_token(), 'Accept' : 'application/json', 'Content-Type' : 'application/json'} r = requests.get(url, headers=headers, verify=False) # type(r.json()) # pprint(r.json()) # This gives the names of all the LSPs that are active for item in r.json(): if item['operationalStatus'] == 'Active': print "This LSP is active: " + item['name']
37.645833
116
0.753735
0
0
0
0
0
0
0
0
701
0.387936
bca98a1ce3fff11966f586aae11d75f7d4194f73
859
py
Python
bindings/python/tests/cdef_types.py
mewbak/dragonffi
2a205dbe4dd980d5dd53026c871514795573a7fb
[ "Apache-2.0" ]
null
null
null
bindings/python/tests/cdef_types.py
mewbak/dragonffi
2a205dbe4dd980d5dd53026c871514795573a7fb
[ "Apache-2.0" ]
null
null
null
bindings/python/tests/cdef_types.py
mewbak/dragonffi
2a205dbe4dd980d5dd53026c871514795573a7fb
[ "Apache-2.0" ]
null
null
null
# Copyright 2018 Adrien Guinet <[email protected]> # # 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. # RUN: "%python" "%s" # import pydffi import sys F = pydffi.FFI() CU = F.cdef(''' #include <stdint.h> typedef int32_t MyInt; typedef struct { int a; int b; } A; ''') assert(CU.types.MyInt == F.Int32Ty) assert(isinstance(CU.types.A, pydffi.StructType))
26.030303
74
0.726426
0
0
0
0
0
0
0
0
698
0.812573
bcaa2cc3091f251f513b10ec7f23dc034c71de01
6,031
py
Python
hierarchical_foresight/env/environment.py
deepneuralmachine/google-research
d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231
[ "Apache-2.0" ]
23,901
2018-10-04T19:48:53.000Z
2022-03-31T21:27:42.000Z
hierarchical_foresight/env/environment.py
deepneuralmachine/google-research
d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231
[ "Apache-2.0" ]
891
2018-11-10T06:16:13.000Z
2022-03-31T10:42:34.000Z
hierarchical_foresight/env/environment.py
deepneuralmachine/google-research
d2ce2cf0f5c004f8d78bfeddf6e88e88f4840231
[ "Apache-2.0" ]
6,047
2018-10-12T06:31:02.000Z
2022-03-31T13:59:28.000Z
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Environment wrapper around the maze navigation environment. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import copy from . import simple_maze import cv2 import numpy as np class Environment(object): """Wrapper around the Simple maze environment.""" def __init__(self, difficulty=None): """Initialize the environment with the specified difficulty.""" self.difficulty = difficulty self._sim_env = simple_maze.navigate(difficulty=difficulty) self.stepcount = 0 def reset(self): """Resets the environment.""" self.stepcount = 0 time_step = self._sim_env.reset() return time_step def get_goal_im(self): """Computes and returns the goal image.""" currp = copy.deepcopy(self._sim_env.physics.data.qpos[:]) currv = copy.deepcopy(self._sim_env.physics.data.qvel[:]) self._sim_env.task.dontreset = True tg = copy.deepcopy(self._sim_env.physics.named.data.geom_xpos['target'][:2]) self._sim_env.physics.data.qpos[:] = tg self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) self._sim_env.physics.data.qpos[:] = tg self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() self._sim_env.physics.data.qpos[:] = currp self._sim_env.physics.data.qvel[:] = currv self.step([0, 0]) self._sim_env.task.dontreset = False return gim def get_subgoal_ims(self, numg): """Computes and returs the ground truth sub goal images.""" currp = copy.deepcopy(self._sim_env.physics.data.qpos[:]) currv = copy.deepcopy(self._sim_env.physics.data.qvel[:]) self._sim_env.task.dontreset = True tg = copy.deepcopy(self._sim_env.physics.named.data.geom_xpos['target'][:2]) sg = [] if self.difficulty == 'e': if numg == 1: self._sim_env.physics.data.qpos[:] = currp + (tg - currp) / 2 self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() sg.append(gim) elif numg == 2: self._sim_env.physics.data.qpos[:] = currp + (tg - currp) / 3 self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() sg.append(gim) self._sim_env.physics.data.qpos[:] = currp + 2 * (tg - currp) / 3 self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() sg.append(gim) elif self.difficulty == 'm': if numg == 1: self._sim_env.physics.data.qpos[:] = [ self._sim_env.physics.named.model.geom_pos['wall2A', 'x'], self._sim_env.physics.named.model.geom_pos['wall2A', 'y'] - 0.25] self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() sg.append(gim) elif numg == 2: self._sim_env.physics.data.qpos[:] = [ self._sim_env.physics.named.model.geom_pos['wall2A', 'x'], self._sim_env.physics.named.model.geom_pos['wall2A', 'y'] - 0.25] self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() sg.append(gim) self._sim_env.physics.data.qpos[:] = [ self._sim_env.physics.named.model.geom_pos['wall2A', 'x'], self._sim_env.physics.named.model.geom_pos['wall2A', 'y'] - 0.25] self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() sg.append(gim) elif self.difficulty == 'h': if numg == 1: self._sim_env.physics.data.qpos[:] = [ self._sim_env.physics.named.model.geom_pos['wall1A', 'x'], self._sim_env.physics.named.model.geom_pos['wall1A', 'y'] - 0.25] self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() sg.append(gim) elif numg == 2: self._sim_env.physics.data.qpos[:] = [ self._sim_env.physics.named.model.geom_pos['wall1A', 'x'], self._sim_env.physics.named.model.geom_pos['wall1A', 'y'] - 0.25] self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() sg.append(gim) self._sim_env.physics.data.qpos[:] = [ self._sim_env.physics.named.model.geom_pos['wall2A', 'x'], self._sim_env.physics.named.model.geom_pos['wall2A', 'y'] - 0.25] self._sim_env.physics.data.qvel[:] = 0 self.step([0, 0]) _, gim = self.get_observation() sg.append(gim) sg = np.array(sg) self._sim_env.physics.data.qpos[:] = currp self._sim_env.physics.data.qvel[:] = currv self.step([0, 0]) self._sim_env.task.dontreset = False return sg def is_goal(self): """Checks if the current state is a goal state.""" return self._sim_env.task.is_goal(self._sim_env.physics) def step(self, action=None): """Steps the environment.""" time_step = self._sim_env.step(action) self._sim_env.physics.data.qvel[:] = 0 return time_step def get_observation(self): """Return image observation.""" obs = self._sim_env.task.get_observation(self._sim_env.physics) im = self._sim_env.physics.render(256, 256, camera_id='fixed') im = cv2.resize(im, (64, 64), interpolation=cv2.INTER_LANCZOS4) return obs, im
37.228395
80
0.636213
5,173
0.857735
0
0
0
0
0
0
1,174
0.194661
bcaa324b8d6cf63921fcf9763740cc9027d44173
855
py
Python
trips/migrations/0004_invoice.py
chorna/taxi24
09e174a0cb3b9543ca4987e60cd0d37ecda6ac3c
[ "MIT" ]
null
null
null
trips/migrations/0004_invoice.py
chorna/taxi24
09e174a0cb3b9543ca4987e60cd0d37ecda6ac3c
[ "MIT" ]
null
null
null
trips/migrations/0004_invoice.py
chorna/taxi24
09e174a0cb3b9543ca4987e60cd0d37ecda6ac3c
[ "MIT" ]
null
null
null
# Generated by Django 3.2.5 on 2021-07-11 23:51 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('trips', '0003_alter_trip_state'), ] operations = [ migrations.CreateModel( name='Invoice', fields=[ ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('serie', models.CharField(max_length=4)), ('number', models.CharField(max_length=8)), ('tax_amount', models.FloatField(default=0.0)), ('base_amount', models.FloatField()), ('trip_id', models.ForeignKey(db_column='trip_id', on_delete=django.db.models.deletion.PROTECT, to='trips.trip')), ], ), ]
32.884615
130
0.592982
729
0.852632
0
0
0
0
0
0
164
0.191813
bcaa742ec3f2633707689915b345db35e3f84a87
25,875
py
Python
src/general_harvester.py
Badger-Finance/python-keepers
b5b2b0b083a237dceecd161d81754512959822b1
[ "MIT" ]
null
null
null
src/general_harvester.py
Badger-Finance/python-keepers
b5b2b0b083a237dceecd161d81754512959822b1
[ "MIT" ]
22
2022-03-08T19:30:45.000Z
2022-03-28T21:14:15.000Z
src/general_harvester.py
Badger-Finance/python-keepers
b5b2b0b083a237dceecd161d81754512959822b1
[ "MIT" ]
null
null
null
import logging import os from decimal import Decimal from time import sleep import requests from hexbytes import HexBytes from web3 import Web3 from web3 import contract from web3.contract import Contract from config.constants import BASE_CURRENCIES from config.constants import GAS_LIMITS from config.constants import MULTICHAIN_CONFIG from config.enums import Network from src.harvester import IHarvester from src.misc_utils import hours from src.misc_utils import seconds_to_blocks from src.tx_utils import get_effective_gas_price from src.tx_utils import get_gas_price_of_tx from src.tx_utils import get_priority_fee from src.web3_utils import confirm_transaction from src.utils import get_abi from src.discord_utils import get_hash_from_failed_tx_error from src.web3_utils import get_last_harvest_times from src.token_utils import get_token_price from src.discord_utils import send_error_to_discord from src.discord_utils import send_success_to_discord logging.basicConfig(level=logging.INFO) MAX_TIME_BETWEEN_HARVESTS = hours(120) HARVEST_THRESHOLD = 0.0005 # min ratio of want to total vault AUM required to harvest NUM_FLASHBOTS_BUNDLES = 6 class GeneralHarvester(IHarvester): def __init__( self, chain: Network = Network.Ethereum, web3: Web3 = None, keeper_acl: str = os.getenv("KEEPER_ACL"), keeper_address: str = os.getenv("KEEPER_ADDRESS"), keeper_key: str = os.getenv("KEEPER_KEY"), base_oracle_address: str = os.getenv("ETH_USD_CHAINLINK"), use_flashbots: bool = False, discord_url: str = None, ): self.logger = logging.getLogger(__name__) self.chain = chain self.web3 = web3 self.keeper_key = keeper_key self.keeper_address = keeper_address self.keeper_acl: Contract = self.web3.eth.contract( address=self.web3.toChecksumAddress(keeper_acl), abi=get_abi(self.chain, "keeper_acl"), ) self.base_usd_oracle: Contract = self.web3.eth.contract( address=self.web3.toChecksumAddress(base_oracle_address), abi=get_abi(self.chain, "oracle"), ) # Times of last harvest if self.chain in [Network.Ethereum, Network.Fantom]: self.last_harvest_times = get_last_harvest_times( self.web3, self.keeper_acl, start_block=self.web3.eth.block_number - seconds_to_blocks(MAX_TIME_BETWEEN_HARVESTS), chain=self.chain, ) else: # Don't care about poly/arbitrum self.last_harvest_times = {} self.use_flashbots = use_flashbots self.discord_url = discord_url def is_time_to_harvest( self, strategy: contract.Contract, harvest_interval_threshold: int = MAX_TIME_BETWEEN_HARVESTS, ) -> bool: """Calculates the time between harvests for the supplied strategy and returns true if it has been longer than the supplied harvest_interval_threshold which is measured in seconds Args: strategy (contract): Vault strategy web3 contract object harvest_interval_threshold (int, optional): Amount of time in seconds that is acceptable to not have harvested within. Defaults to MAX_TIME_BETWEEN_HARVESTS. Returns: bool: True if time since last harvest is > harvest_interval_threshold, else False """ # Only care about harvest gas costs on eth if self.chain not in [Network.Ethereum, Network.Fantom]: return True try: last_harvest = self.last_harvest_times[strategy.address] current_time = self.web3.eth.get_block("latest")["timestamp"] self.logger.info( f"Time since last harvest: {(current_time - last_harvest) / 3600}" ) return current_time - last_harvest > harvest_interval_threshold except KeyError: return True def harvest( self, strategy: contract.Contract, ): """Orchestration function that harvests outstanding rewards. Args: strategy (contract) Raises: ValueError: If the keeper isn't whitelisted, throw an error and alert user. """ strategy_name = strategy.functions.getName().call() # TODO: update for ACL if not self.__is_keeper_whitelisted("harvest"): raise ValueError("Keeper ACL is not whitelisted for calling harvest") want_address = strategy.functions.want().call() want = self.web3.eth.contract( address=want_address, abi=get_abi(self.chain, "erc20"), ) vault_balance = want.functions.balanceOf(strategy.address).call() self.logger.info(f"vault balance: {vault_balance}") want_to_harvest = ( self.estimate_harvest_amount(strategy) / 10 ** want.functions.decimals().call() ) self.logger.info(f"estimated want change: {want_to_harvest}") # TODO: figure out how to handle profit estimation # current_price_eth = self.get_current_rewards_price() # self.logger.info(f"current rewards price per token (ETH): {current_price_eth}") gas_fee = self.estimate_gas_fee(strategy.address) self.logger.info(f"estimated gas cost: {gas_fee}") # for now we'll just harvest every hour should_harvest = self.is_profitable() self.logger.info(f"Should we harvest: {should_harvest}") if should_harvest: self.__process_harvest( strategy=strategy, strategy_name=strategy_name, ) def harvest_no_return( self, strategy: contract, ): strategy_name = strategy.functions.getName().call() # TODO: update for ACL if not self.__is_keeper_whitelisted("harvestNoReturn"): raise ValueError( "Keeper ACL is not whitelisted for calling harvestNoReturn" ) want_address = strategy.functions.want().call() want = self.web3.eth.contract( address=want_address, abi=get_abi(self.chain, "erc20"), ) vault_balance = want.functions.balanceOf(strategy.address).call() self.logger.info(f"vault balance: {vault_balance}") # TODO: figure out how to handle profit estimation # current_price_eth = self.get_current_rewards_price() # self.logger.info(f"current rewards price per token (ETH): {current_price_eth}") gas_fee = self.estimate_gas_fee(strategy.address, returns=False) self.logger.info(f"estimated gas cost: {gas_fee}") # for now we'll just harvest every hour should_harvest = self.is_profitable() self.logger.info(f"Should we harvest: {should_harvest}") if should_harvest: self.__process_harvest( strategy=strategy, strategy_name=strategy_name, ) def harvest_rewards_manager( self, strategy: contract, ): strategy_name = strategy.functions.getName().call() self.keeper_acl = self.web3.eth.contract( address=self.web3.toChecksumAddress( MULTICHAIN_CONFIG[self.chain]["rewards_manager"] ), abi=get_abi(self.chain, "rewards_manager"), ) if not self.__is_keeper_whitelisted("rewards_manager"): raise ValueError(f"Keeper is not whitelisted for {strategy_name}") want_address = strategy.functions.want().call() want = self.web3.eth.contract( address=want_address, abi=get_abi(self.chain, "erc20"), ) vault_balance = want.functions.balanceOf(strategy.address).call() self.logger.info(f"vault balance: {vault_balance}") gas_fee = self.estimate_gas_fee(strategy.address) self.logger.info(f"estimated gas cost: {gas_fee}") self.__process_harvest( strategy=strategy, strategy_name=strategy_name, ) def harvest_mta( self, voter_proxy: contract, ): # TODO: update for ACL if not self.__is_keeper_whitelisted("harvestMta"): raise ValueError("Keeper ACL is not whitelisted for calling harvestMta") gas_fee = self.estimate_gas_fee(voter_proxy.address, function="harvestMta") self.logger.info(f"estimated gas cost: {gas_fee}") should_harvest_mta = self.is_profitable() self.logger.info(f"Should we call harvestMta: {should_harvest_mta}") if should_harvest_mta: self.__process_harvest_mta(voter_proxy) def tend(self, strategy: contract): strategy_name = strategy.functions.getName().call() # TODO: update for ACL if not self.__is_keeper_whitelisted("tend"): raise ValueError("Keeper ACL is not whitelisted for calling tend") # TODO: figure out how to handle profit estimation # current_price_eth = self.get_current_rewards_price() # self.logger.info(f"current rewards price per token (ETH): {current_price_eth}") gas_fee = self.estimate_gas_fee(strategy.address, function="tend") self.logger.info(f"estimated gas cost: {gas_fee}") self.__process_tend( strategy=strategy, strategy_name=strategy_name, ) def tend_then_harvest(self, strategy: contract): self.tend(strategy) sleep(60) self.harvest(strategy) def estimate_harvest_amount(self, strategy: contract) -> Decimal: want = self.web3.eth.contract( address=strategy.functions.want().call(), abi=get_abi(self.chain, "erc20"), ) want_gained = self.keeper_acl.functions.harvest(strategy.address).call( {"from": self.keeper_address} ) # call badger api to get prices currency = BASE_CURRENCIES[self.chain] if self.chain == Network.Fantom: price_per_want = get_token_price( want.address, currency, self.chain, use_staging=True ) else: price_per_want = get_token_price(want.address, currency, self.chain) self.logger.info(f"price per want: {price_per_want} {currency}") self.logger.info(f"want gained: {want_gained}") if type(want_gained) is list: want_gained = 0 return price_per_want * want_gained def is_profitable(self) -> bool: # TODO: Implement this # harvest if ideal want change is > 0.05% of total vault assets # should_harvest = want_to_harvest / vault_balance >= HARVEST_THRESHOLD return True def __is_keeper_whitelisted(self, function: str) -> bool: """Checks if the bot we're using is whitelisted for the strategy. Returns: bool: True if our bot is whitelisted to make function calls, False otherwise. """ if function in ["harvest", "harvestMta"]: key = self.keeper_acl.functions.HARVESTER_ROLE().call() elif function == "tend": key = self.keeper_acl.functions.TENDER_ROLE().call() elif function == "rewards_manager": key = self.keeper_acl.functions.KEEPER_ROLE().call() return self.keeper_acl.functions.hasRole(key, self.keeper_address).call() def __process_tend( self, strategy: contract = None, strategy_name: str = None, ): try: tx_hash = self.__send_tend_tx(strategy) succeeded, _ = confirm_transaction(self.web3, tx_hash) if succeeded: gas_price_of_tx = get_gas_price_of_tx( self.web3, self.base_usd_oracle, tx_hash, self.chain ) self.logger.info(f"got gas price of tx: {gas_price_of_tx}") send_success_to_discord( tx_type=f"Tend {strategy_name}", tx_hash=tx_hash, gas_cost=gas_price_of_tx, chain=self.chain, url=self.discord_url, ) elif tx_hash != HexBytes(0): send_success_to_discord( tx_type=f"Tend {strategy_name}", tx_hash=tx_hash, chain=self.chain, url=self.discord_url, ) except Exception as e: self.logger.error(f"Error processing tend tx: {e}") send_error_to_discord( strategy_name, "Tend", error=e, chain=self.chain, keeper_address=self.keeper_address, ) def __process_harvest( self, strategy: contract = None, strategy_name: str = None, harvested: Decimal = None, returns: bool = True, ): """Private function to create, broadcast, confirm tx on eth and then send transaction to Discord for monitoring Args: strategy (contract, optional): Defaults to None. strategy_name (str, optional): Defaults to None. harvested (Decimal, optional): Amount of Sushi harvested. Defaults to None. """ try: tx_hash, max_target_block = self.__send_harvest_tx( strategy, returns=returns ) succeeded, msg = confirm_transaction( self.web3, tx_hash, max_block=max_target_block ) if succeeded: # If successful, update last harvest harvest # time to make sure we don't double harvest self.update_last_harvest_time(strategy.address) gas_price_of_tx = get_gas_price_of_tx( self.web3, self.base_usd_oracle, tx_hash, self.chain ) self.logger.info(f"got gas price of tx: {gas_price_of_tx}") send_success_to_discord( tx_type=f"Harvest {strategy_name}", tx_hash=tx_hash, gas_cost=gas_price_of_tx, chain=self.chain, url=self.discord_url, ) elif tx_hash != HexBytes(0): if not self.use_flashbots: # And if pending self.update_last_harvest_time(strategy.address) send_success_to_discord( tx_type=f"Harvest {strategy_name}", tx_hash=tx_hash, chain=self.chain, url=self.discord_url, ) else: send_error_to_discord( strategy_name, "Harvest", tx_hash=tx_hash, message=msg, chain=self.chain, keeper_address=self.keeper_address, ) except Exception as e: self.logger.error(f"Error processing harvest tx: {e}") send_error_to_discord( strategy_name, "Harvest", error=e, chain=self.chain, keeper_address=self.keeper_address, ) def __process_harvest_mta( self, voter_proxy: contract, ): """Private function to create, broadcast, confirm tx on eth and then send transaction to Discord for monitoring Args: voter_proxy (contract): Mstable voter proxy contract """ try: tx_hash = self.__send_harvest_mta_tx(voter_proxy) succeeded, _ = confirm_transaction(self.web3, tx_hash) if succeeded: # If successful, update last harvest harvest time self.update_last_harvest_time(voter_proxy.address) gas_price_of_tx = get_gas_price_of_tx( self.web3, self.base_usd_oracle, tx_hash, self.chain ) self.logger.info(f"got gas price of tx: {gas_price_of_tx}") send_success_to_discord( tx_type="Harvest MTA", tx_hash=tx_hash, gas_cost=gas_price_of_tx, chain=self.chain, url=self.discord_url, ) elif tx_hash != HexBytes(0): send_success_to_discord( tx_type="Harvest MTA", tx_hash=tx_hash, chain=self.chain, url=self.discord_url, ) except Exception as e: self.logger.error(f"Error processing harvestMta tx: {e}") send_error_to_discord( "", "Harvest MTA", error=e, chain=self.chain, keeper_address=self.keeper_address, ) def __send_harvest_tx(self, strategy: contract, returns: bool = True) -> HexBytes: """Sends transaction to ETH node for confirmation. Args: strategy (contract) Raises: Exception: If we have an issue sending transaction (unable to communicate with node, etc.) we log the error and return a tx_hash of 0x00. Returns: HexBytes: Transaction hash for transaction that was sent. """ max_target_block = None tx_hash = HexBytes(0) try: tx = self.__build_transaction(strategy.address, returns=returns) signed_tx = self.web3.eth.account.sign_transaction( tx, private_key=self.keeper_key ) tx_hash = signed_tx.hash if not self.use_flashbots: self.web3.eth.send_raw_transaction(signed_tx.rawTransaction) else: bundle = [ {"signed_transaction": signed_tx.rawTransaction}, ] block_number = self.web3.eth.block_number for i in range(1, NUM_FLASHBOTS_BUNDLES + 1): self.web3.flashbots.send_bundle( bundle, target_block_number=block_number + i ) max_target_block = block_number + NUM_FLASHBOTS_BUNDLES self.logger.info(f"Bundle broadcasted at {max_target_block}") except ValueError as e: self.logger.error(f"Error in sending harvest tx: {e}") tx_hash = get_hash_from_failed_tx_error( e, "Harvest", chain=self.chain, keeper_address=self.keeper_address ) finally: return tx_hash, max_target_block def __send_tend_tx(self, strategy: contract) -> HexBytes: """Sends transaction to ETH node for confirmation. Args: strategy (contract) Raises: Exception: If we have an issue sending transaction (unable to communicate with node, etc.) we log the error and return a tx_hash of 0x00. Returns: HexBytes: Transaction hash for transaction that was sent. """ tx_hash = HexBytes(0) try: tx = self.__build_transaction(strategy.address, function="tend") signed_tx = self.web3.eth.account.sign_transaction( tx, private_key=self.keeper_key ) tx_hash = signed_tx.hash self.web3.eth.send_raw_transaction(signed_tx.rawTransaction) except ValueError as e: self.logger.error(f"Error in sending tend tx: {e}") tx_hash = get_hash_from_failed_tx_error( e, "Tend", chain=self.chain, keeper_address=self.keeper_address ) finally: return tx_hash def __send_harvest_mta_tx(self, voter_proxy: contract) -> HexBytes: """Sends transaction to ETH node for confirmation. Args: voter_proxy (contract) Raises: Exception: If we have an issue sending transaction (unable to communicate with node, etc.) we log the error and return a tx_hash of 0x00. Returns: HexBytes: Transaction hash for transaction that was sent. """ tx_hash = HexBytes(0) try: tx = self.__build_transaction(voter_proxy.address, function="harvestMta") signed_tx = self.web3.eth.account.sign_transaction( tx, private_key=self.keeper_key ) tx_hash = signed_tx.hash self.web3.eth.send_raw_transaction(signed_tx.rawTransaction) except ValueError as e: self.logger.error(f"Error in sending harvestMta tx: {e}") tx_hash = get_hash_from_failed_tx_error( e, "Harvest MTA", chain=self.chain, keeper_address=self.keeper_address ) finally: return tx_hash def __build_transaction( self, address: str, returns: bool = True, function: str = "harvest" ) -> dict: """Builds transaction depending on which chain we're harvesting. EIP-1559 requires different handling for ETH txs than the other EVM chains. Args: contract (contract): contract to use to build harvest tx Returns: dict: tx dictionary """ options = { "nonce": self.web3.eth.get_transaction_count( self.keeper_address, "pending" ), "from": self.keeper_address, "gas": GAS_LIMITS[self.chain], } if self.chain == Network.Ethereum: options["maxPriorityFeePerGas"] = get_priority_fee(self.web3) options["maxFeePerGas"] = self.__get_effective_gas_price() else: options["gasPrice"] = self.__get_effective_gas_price() if function == "harvest": self.logger.info( f"estimated gas fee: {self.__estimate_harvest_gas(address, returns)}" ) return self.__build_harvest_transaction(address, returns, options) elif function == "tend": self.logger.info(f"estimated gas fee: {self.__estimate_tend_gas(address)}") return self.__build_tend_transaction(address, options) elif function == "harvestMta": self.logger.info( f"estimated gas fee: {self.__estimate_harvest_mta_gas(address)}" ) return self.__build_harvest_mta_transaction(address, options) def __build_harvest_transaction( self, strategy_address: str, returns: bool, options: dict ) -> dict: if returns: return self.keeper_acl.functions.harvest(strategy_address).buildTransaction( options ) else: return self.keeper_acl.functions.harvestNoReturn( strategy_address ).buildTransaction(options) def __build_tend_transaction(self, strategy_address: str, options: dict) -> dict: return self.keeper_acl.functions.tend(strategy_address).buildTransaction( options ) def __build_harvest_mta_transaction( self, voter_proxy_address: str, options: dict ) -> dict: return self.keeper_acl.functions.harvestMta( voter_proxy_address ).buildTransaction(options) def estimate_gas_fee( self, address: str, returns: bool = True, function: str = "harvest" ) -> Decimal: current_gas_price = self.__get_effective_gas_price() if function == "harvest": estimated_gas = self.__estimate_harvest_gas(address, returns) elif function == "tend": estimated_gas = self.__estimate_tend_gas(address) elif function == "harvestMta": estimated_gas = self.__estimate_harvest_mta_gas(address) return Decimal(current_gas_price * estimated_gas) def __estimate_harvest_gas(self, strategy_address: str, returns: bool) -> Decimal: if returns: estimated_gas_to_harvest = self.keeper_acl.functions.harvest( strategy_address ).estimateGas({"from": self.keeper_address}) else: estimated_gas_to_harvest = self.keeper_acl.functions.harvestNoReturn( strategy_address ).estimateGas({"from": self.keeper_address}) return Decimal(estimated_gas_to_harvest) def __estimate_tend_gas(self, strategy_address: str) -> Decimal: return Decimal( self.keeper_acl.functions.tend(strategy_address).estimateGas( {"from": self.keeper_address} ) ) def __estimate_harvest_mta_gas(self, voter_proxy_address: str) -> Decimal: return Decimal( self.keeper_acl.functions.harvestMta(voter_proxy_address).estimateGas( {"from": self.keeper_address} ) ) def __get_effective_gas_price(self) -> int: if self.chain == Network.Polygon: response = requests.get("https://gasstation-mainnet.matic.network").json() gas_price = self.web3.toWei(int(response.get("fast") * 1.1), "gwei") elif self.chain in [Network.Arbitrum, Network.Fantom]: gas_price = int(1.1 * self.web3.eth.gas_price) # Estimated gas price + buffer elif self.chain == Network.Ethereum: # EIP-1559 gas_price = get_effective_gas_price(self.web3) return gas_price def update_last_harvest_time(self, strategy_address: str): self.last_harvest_times[strategy_address] = self.web3.eth.get_block("latest")[ "timestamp" ]
37.939883
100
0.602705
24,717
0.955246
0
0
0
0
0
0
6,407
0.247614
bcaab7186ea62c16403a777679f43c5651b2eeea
1,170
py
Python
clickhouse_plantuml/column.py
yonesko/clickhouse-plantuml
6db26788fe86854967f627f28fd8a403ccbf7ffb
[ "Apache-2.0" ]
null
null
null
clickhouse_plantuml/column.py
yonesko/clickhouse-plantuml
6db26788fe86854967f627f28fd8a403ccbf7ffb
[ "Apache-2.0" ]
null
null
null
clickhouse_plantuml/column.py
yonesko/clickhouse-plantuml
6db26788fe86854967f627f28fd8a403ccbf7ffb
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python # License: Apache-2.0 # Copyright (C) 2020 Mikhail f. Shiryaev class Column(object): """ Represents ClickHouse column """ def __init__( self, database: str, table: str, name: str, type: str, default_kind: str, default_expression: str, comment: str, compression_codec: str, is_in_partition_key: bool, is_in_sorting_key: bool, is_in_primary_key: bool, is_in_sampling_key: bool, ): self.database = database self.table = table self.name = name self.type = type self.default_kind = default_kind self.default_expression = default_expression self.comment = comment self.compression_codec = compression_codec self.is_in_partition_key = is_in_partition_key self.is_in_sorting_key = is_in_sorting_key self.is_in_primary_key = is_in_primary_key self.is_in_sampling_key = is_in_sampling_key @property def db_table(self): return "{}.{}".format(self.database, self.table) def __str__(self): return self.name
25.434783
56
0.622222
1,081
0.923932
0
0
90
0.076923
0
0
133
0.113675
bcaae8938e310a72ba14496462496246c713e82d
577
py
Python
contrib/micronet/scripts/file2buf.py
pmalhaire/WireHub
588a372e678b49557deed6ba88a896596222fb2d
[ "Apache-2.0" ]
337
2018-12-21T22:13:57.000Z
2019-11-01T18:35:10.000Z
contrib/micronet/scripts/file2buf.py
nask0/WireHub
588a372e678b49557deed6ba88a896596222fb2d
[ "Apache-2.0" ]
8
2018-12-24T20:16:40.000Z
2019-09-02T11:54:48.000Z
contrib/micronet/scripts/file2buf.py
nask0/WireHub
588a372e678b49557deed6ba88a896596222fb2d
[ "Apache-2.0" ]
18
2018-12-24T02:49:38.000Z
2019-07-31T20:00:47.000Z
#!/usr/bin/env python3 import os import sys MAX = 8 fpath = sys.argv[1] name = sys.argv[2] with open(fpath, "rb") as fh: sys.stdout.write("char %s[] = {" % (name,) ) i = 0 while True: if i > 0: sys.stdout.write(", ") if i % MAX == 0: sys.stdout.write("\n\t") c = fh.read(1) if not c: sys.stdout.write("\n") break sys.stdout.write("0x%.2x" % (ord(c), )) i = i + 1 print("};") print("") print("unsigned int %s_sz = %s;" % (name, i)) print("")
15.594595
49
0.443674
0
0
0
0
0
0
0
0
97
0.168111
bcab57fb16b16bdb97e645f2dba9e5a2f1d7fa1f
10,293
py
Python
tests/test_observable/test_skip.py
christiansandberg/RxPY
036027d2858ea6c9d45839c863bd791e5bb50c36
[ "MIT" ]
null
null
null
tests/test_observable/test_skip.py
christiansandberg/RxPY
036027d2858ea6c9d45839c863bd791e5bb50c36
[ "MIT" ]
null
null
null
tests/test_observable/test_skip.py
christiansandberg/RxPY
036027d2858ea6c9d45839c863bd791e5bb50c36
[ "MIT" ]
null
null
null
import unittest from reactivex import operators as ops from reactivex.testing import ReactiveTest, TestScheduler on_next = ReactiveTest.on_next on_completed = ReactiveTest.on_completed on_error = ReactiveTest.on_error subscribe = ReactiveTest.subscribe subscribed = ReactiveTest.subscribed disposed = ReactiveTest.disposed created = ReactiveTest.created class TestSkip(unittest.TestCase): def test_skip_complete_after(self): scheduler = TestScheduler() xs = scheduler.create_hot_observable( on_next(70, 6), on_next(150, 4), on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_completed(690), ) def create(): return xs.pipe(ops.skip(20)) results = scheduler.start(create) assert results.messages == [on_completed(690)] assert xs.subscriptions == [subscribe(200, 690)] def test_skip_complete_same(self): scheduler = TestScheduler() xs = scheduler.create_hot_observable( on_next(70, 6), on_next(150, 4), on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_completed(690), ) def create(): return xs.pipe(ops.skip(17)) results = scheduler.start(create) assert results.messages == [on_completed(690)] assert xs.subscriptions == [subscribe(200, 690)] def test_skip_complete_before(self): scheduler = TestScheduler() xs = scheduler.create_hot_observable( on_next(70, 6), on_next(150, 4), on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_completed(690), ) def create(): return xs.pipe(ops.skip(10)) results = scheduler.start(create) assert results.messages == [ on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_completed(690), ] assert xs.subscriptions == [subscribe(200, 690)] def test_skip_Complete_zero(self): scheduler = TestScheduler() xs = scheduler.create_hot_observable( on_next(70, 6), on_next(150, 4), on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_completed(690), ) def create(): return xs.pipe(ops.skip(0)) results = scheduler.start(create) assert results.messages == [ on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_completed(690), ] assert xs.subscriptions == [subscribe(200, 690)] def test_skip_error_after(self): ex = "ex" scheduler = TestScheduler() xs = scheduler.create_hot_observable( on_next(70, 6), on_next(150, 4), on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_error(690, ex), ) def create(): return xs.pipe(ops.skip(20)) results = scheduler.start(create) assert results.messages == [on_error(690, ex)] assert xs.subscriptions == [subscribe(200, 690)] def test_skip_error_same(self): ex = "ex" scheduler = TestScheduler() xs = scheduler.create_hot_observable( on_next(70, 6), on_next(150, 4), on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_error(690, ex), ) def create(): return xs.pipe(ops.skip(17)) results = scheduler.start(create) assert results.messages == [on_error(690, ex)] assert xs.subscriptions == [subscribe(200, 690)] def test_skip_error_before(self): ex = "ex" scheduler = TestScheduler() xs = scheduler.create_hot_observable( on_next(70, 6), on_next(150, 4), on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_error(690, ex), ) def create(): return xs.pipe(ops.skip(3)) results = scheduler.start(create) assert results.messages == [ on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), on_error(690, ex), ] assert xs.subscriptions == [subscribe(200, 690)] def test_skip_dispose_before(self): scheduler = TestScheduler() xs = scheduler.create_hot_observable( on_next(70, 6), on_next(150, 4), on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), ) def create(): return xs.pipe(ops.skip(3)) results = scheduler.start(create, disposed=250) assert results.messages == [] assert xs.subscriptions == [subscribe(200, 250)] def test_skip_dispose_after(self): scheduler = TestScheduler() xs = scheduler.create_hot_observable( on_next(70, 6), on_next(150, 4), on_next(210, 9), on_next(230, 13), on_next(270, 7), on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), on_next(410, 15), on_next(415, 16), on_next(460, 72), on_next(510, 76), on_next(560, 32), on_next(570, -100), on_next(580, -3), on_next(590, 5), on_next(630, 10), ) def create(): return xs.pipe(ops.skip(3)) results = scheduler.start(create, disposed=400) assert results.messages == [ on_next(280, 1), on_next(300, -1), on_next(310, 3), on_next(340, 8), on_next(370, 11), ] assert xs.subscriptions == [subscribe(200, 400)] if __name__ == "__main__": unittest.main()
28.2
57
0.469445
9,885
0.960361
0
0
0
0
0
0
22
0.002137
bcab6a237bb88828d13a4bacbf608684ac108e0d
468
py
Python
CF#691/python/A.py
chaitanya1243/CP
a0e5e34daf6f7c22c9a91212b65338ef0c46d163
[ "MIT" ]
null
null
null
CF#691/python/A.py
chaitanya1243/CP
a0e5e34daf6f7c22c9a91212b65338ef0c46d163
[ "MIT" ]
null
null
null
CF#691/python/A.py
chaitanya1243/CP
a0e5e34daf6f7c22c9a91212b65338ef0c46d163
[ "MIT" ]
null
null
null
def solve(n, red , blue): rcount = bcount = 0 for i in range(n): if int(red[i]) > int(blue[i]): rcount = rcount +1 elif int(red[i]) < int(blue[i]): bcount = bcount + 1 print( 'RED' if rcount>bcount else ('BLUE' if bcount>rcount else 'EQUAL')) if __name__ == "__main__": T = int(input()) for t in range(T): n = int(input()) red = input() blue = input() solve(n, red, blue)
24.631579
79
0.5
0
0
0
0
0
0
0
0
28
0.059829
bcab784b7b6a5cec70ca79e8907334431af7152b
2,505
py
Python
shudder/__main__.py
fitpay/shudder
3bd3d7d712f60b7c7db1d259c024dde3eaeed26c
[ "Apache-2.0" ]
null
null
null
shudder/__main__.py
fitpay/shudder
3bd3d7d712f60b7c7db1d259c024dde3eaeed26c
[ "Apache-2.0" ]
null
null
null
shudder/__main__.py
fitpay/shudder
3bd3d7d712f60b7c7db1d259c024dde3eaeed26c
[ "Apache-2.0" ]
null
null
null
# Copyright 2014 Scopely, 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. """Start polling of SQS and metadata.""" import shudder.queue as queue import shudder.metadata as metadata from shudder.config import CONFIG import time import os import requests import signal import subprocess import sys if __name__ == '__main__': sqs_connection, sqs_queue = queue.create_queue() sns_connection, subscription_arn = queue.subscribe_sns(sqs_queue) def receive_signal(signum, stack): if signum in [1, 2, 3, 15]: print 'Caught signal %s, exiting.' % (str(signum)) queue.clean_up_sns(sns_connection, subscription_arn, sqs_queue) sys.exit() else: print 'Caught signal %s, ignoring.' % (str(signum)) uncatchable = ['SIG_DFL','SIGSTOP','SIGKILL'] for i in [x for x in dir(signal) if x.startswith("SIG")]: if not i in uncatchable: signum = getattr(signal,i) signal.signal(signum, receive_signal) while True: message = queue.poll_queue(sqs_connection, sqs_queue) if message or metadata.poll_instance_metadata(): queue.clean_up_sns(sns_connection, subscription_arn, sqs_queue) if 'endpoint' in CONFIG: requests.get(CONFIG["endpoint"]) if 'endpoints' in CONFIG: for endpoint in CONFIG["endpoints"]: requests.get(endpoint) if 'commands' in CONFIG: for command in CONFIG["commands"]: print 'Running command: %s' % command process = subprocess.Popen(command) while process.poll() is None: time.sleep(30) """Send a heart beat to aws""" queue.record_lifecycle_action_heartbeat(message) """Send a complete lifecycle action""" queue.complete_lifecycle_action(message) sys.exit(0) time.sleep(5)
37.38806
75
0.637126
0
0
0
0
0
0
0
0
854
0.340918
bcac6e3cd42df76570409abe5d700496d0e0e054
1,688
py
Python
example/hydrogen.py
NLESC-JCER/pyCHAMP
97523237b3521a426d664b6e2972257045ff8f5e
[ "Apache-2.0" ]
4
2019-05-15T13:09:23.000Z
2021-03-28T09:10:11.000Z
example/hydrogen.py
NLESC-JCER/pyCHAMP
97523237b3521a426d664b6e2972257045ff8f5e
[ "Apache-2.0" ]
14
2019-04-23T15:05:07.000Z
2019-08-14T13:21:07.000Z
example/hydrogen.py
NLESC-JCER/pyCHAMP
97523237b3521a426d664b6e2972257045ff8f5e
[ "Apache-2.0" ]
1
2019-09-30T22:55:53.000Z
2019-09-30T22:55:53.000Z
import autograd.numpy as np from pyCHAMP.wavefunction.wf_base import WF from pyCHAMP.optimizer.minimize import Minimize from pyCHAMP.sampler.metropolis import Metropolis from pyCHAMP.sampler.hamiltonian import Hamiltonian from pyCHAMP.solver.vmc import VMC class Hydrogen(WF): def __init__(self, nelec, ndim): WF.__init__(self, nelec, ndim) def values(self, parameters, pos): """ Compute the value of the wave function. Args: parameters : parameters of th wf x: position of the electron Returns: values of psi """ beta = parameters[0] if pos.ndim == 1: pos = pos.reshape(1, -1) r = np.sqrt(np.sum(pos**2, 1)) return 2*np.exp(-beta*r).reshape(-1, 1) def nuclear_potential(self, pos): r = np.sqrt(np.sum(pos**2, 1)) rm1 = - 1. / r return rm1.reshape(-1, 1) def electronic_potential(self, pos): return 0 if __name__ == "__main__": wf = Hydrogen(nelec=1, ndim=3) sampler = Metropolis(nwalkers=1000, nstep=1000, step_size=3, nelec=1, ndim=3, domain={'min': -5, 'max': 5}) sampler = Hamiltonian(nwalkers=1000, nstep=1000, step_size=3, nelec=1, ndim=3) optimizer = Minimize(method='bfgs', maxiter=25, tol=1E-4) # VMS solver vmc = VMC(wf=wf, sampler=sampler, optimizer=optimizer) # single point opt_param = [1.] pos, e, s = vmc.single_point(opt_param) print('Energy : ', e) print('Variance : ', s) vmc.plot_density(pos) # optimization init_param = [0.5] vmc.optimize(init_param) vmc.plot_history()
26.375
71
0.603081
715
0.423578
0
0
0
0
0
0
287
0.170024
bcac914db6f36c54dadd0991d6bb9fbf2492dbe9
585
py
Python
braintree/account_updater_daily_report.py
futureironman/braintree_python
26bb8a857bc29322a8bca2e8e0fe6d99cfe6a1ac
[ "MIT" ]
182
2015-01-09T05:26:46.000Z
2022-03-16T14:10:06.000Z
braintree/account_updater_daily_report.py
futureironman/braintree_python
26bb8a857bc29322a8bca2e8e0fe6d99cfe6a1ac
[ "MIT" ]
95
2015-02-24T23:29:56.000Z
2022-03-13T03:27:58.000Z
braintree/account_updater_daily_report.py
futureironman/braintree_python
26bb8a857bc29322a8bca2e8e0fe6d99cfe6a1ac
[ "MIT" ]
93
2015-02-19T17:59:06.000Z
2022-03-19T17:01:25.000Z
from braintree.configuration import Configuration from braintree.resource import Resource class AccountUpdaterDailyReport(Resource): def __init__(self, gateway, attributes): Resource.__init__(self, gateway, attributes) if "report_url" in attributes: self.report_url = attributes.pop("report_url") if "report_date" in attributes: self.report_date = attributes.pop("report_date") def __repr__(self): detail_list = ["report_url", "report_date"] return super(AccountUpdaterDailyReport, self).__repr__(detail_list)
36.5625
75
0.71453
493
0.842735
0
0
0
0
0
0
75
0.128205
bcae93da2c9dcb0c8765b93504dcb020462aad8e
1,696
py
Python
game/ball.py
geoncic/PyBlock
69c8220e38a21b7e1c6dd2196752173f9e78981f
[ "MIT" ]
null
null
null
game/ball.py
geoncic/PyBlock
69c8220e38a21b7e1c6dd2196752173f9e78981f
[ "MIT" ]
null
null
null
game/ball.py
geoncic/PyBlock
69c8220e38a21b7e1c6dd2196752173f9e78981f
[ "MIT" ]
null
null
null
import pygame import pygame.gfxdraw from constants import Constants class Balls(object): def __init__(self, all_sprites, all_balls): self.all_sprites = all_sprites self.all_balls = all_balls def spawn_ball(self, pos, vel, team): # Todo: Figure out how to spawn multiple balls with some sort of delay ball = Ball(pos, vel, team) self.all_sprites.add(ball) self.all_balls.add(ball) def ball_test(self): print("This is a Ball Test!") print(self) def update(self): print(self.__dict__) print(type(self)) class Ball(pygame.sprite.Sprite): def __init__(self, pos, vel, team): super().__init__() self.color = team self.file = Constants.BALL_TEAMS[self.color] self.rad = int(Constants.BALL_SIZE/2) self.image = pygame.Surface([Constants.BALL_SIZE, Constants.BALL_SIZE], pygame.SRCALPHA) pygame.draw.circle(self.image, self.file, (self.rad, self.rad), self.rad) self.x_pos = pos[0] self.y_pos = pos[1] self.rect = self.image.get_rect(center=(self.x_pos, self.y_pos)) self.dx = vel[0] self.dy = vel[1] def update(self): self.check_boundary() self.x_pos += self.dx self.y_pos += self.dy self.rect.center = [self.x_pos, self.y_pos] # self.rect.center = pygame.mouse.get_pos() # has sprite follow the mouse def check_boundary(self): if not Constants.PLAYER_WIDTH <= self.x_pos <= (Constants.PLAYER_WIDTH+Constants.BOARD_WIDTH): self.dx = -1*self.dx if not 0 <= self.y_pos <= Constants.SCREEN_HEIGHT: self.dy = -1*self.dy
30.836364
102
0.625
1,622
0.956368
0
0
0
0
0
0
165
0.097288
bcaebabdfa8553517a45b393cf40eff654bc096f
36,597
py
Python
program/eggUI.py
otills/embryocv
d501f057bada15ff5dc753d3dae5a883b5c9e244
[ "MIT" ]
1
2020-08-05T02:47:12.000Z
2020-08-05T02:47:12.000Z
program/eggUI.py
otills/embryocv
d501f057bada15ff5dc753d3dae5a883b5c9e244
[ "MIT" ]
null
null
null
program/eggUI.py
otills/embryocv
d501f057bada15ff5dc753d3dae5a883b5c9e244
[ "MIT" ]
1
2020-08-05T02:47:16.000Z
2020-08-05T02:47:16.000Z
from pyqtgraph.Qt import QtCore, QtGui import numpy as np from scipy.spatial import distance as dist import glob import re import os from PyQt5 import QtGui from PyQt5.QtCore import * from PyQt5.QtGui import * import sys import cv2 import pandas as pd from PyQt5.Qt import * import pyqtgraph as pg #from PyQt4.Qt import * #%% class eggUI(QDialog): ''' createOpenCVEggROI : take eggID defined ROIs and visualise ''' sliderUpdate = QtCore.pyqtSignal() embryoUpdate = QtCore.pyqtSignal() keyPressed = QtCore.pyqtSignal() def __init__(self, parent=None): super(eggUI, self).__init__(parent) # Make QDialog self.diag = QtGui.QDialog() global parentPath, vidTime self.diag.setWindowTitle('Identify eggs') self.diag.imv = pg.ImageView() self.btn_save = QPushButton('Save', self) #============================================================================== # #============================================================================== def showUI(self,ims,eggRotBBox, eggBoxPoints, embryoLabels, eggInt): self.eggInt = eggInt self.embryoLabels = embryoLabels self.diag.setWindowTitle('Identify eggs') # Make ImageView self.diag.imv = pg.ImageView() self.diag.resize(1000,600) # Make ROI self.importOpenCVROIs(eggRotBBox, eggBoxPoints) if (eggRotBBox[0][0][0] != 'nan'): self.createOpenCVEggROI() self.diag.imv.addItem(self.roi) # Remove buttons from ImageView widget self.diag.imv.ui.roiBtn.hide() self.diag.imv.ui.menuBtn.hide() # Make tableview self.diag.table = QtGui.QTableWidget() self.diag.table.setShowGrid(True) self.diag.table.setHorizontalHeaderLabels(['Embryo', 'Sorted']) # Sets different alignment data just on the first column self.diag.table.setRowCount(int(len(self.embryoLabels))) self.diag.table.setColumnCount(2) # Highlight first row self.diag.table.selectRow(0) # Make layout checkLayout = QGridLayout() # Deal with stretching for approrpraite formatting. checkLayout.setColumnStretch(0, 3) checkLayout.setColumnStretch(1, 1) checkLayout.setRowStretch(0, 1) checkLayout.setRowStretch(1, 3) # Add to layout checkLayout.addWidget(self.diag.imv,0,0,2,2) checkLayout.addWidget(self.diag.table,1,5) # Apply layout self.diag.setLayout(checkLayout) # Make buttons self.cpROI_btn = QtGui.QPushButton('&Copy ROI') self.cpROI_btn.setMinimumHeight(40); self.useCpROI_btn = QtGui.QPushButton('&Use Copied ROI') self.useCpROI_btn.setMinimumHeight(40); self.noEgg_btn = QtGui.QPushButton('&No Egg') self.noEgg_btn.setMinimumHeight(40); self.approveROI_btn = QtGui.QPushButton('&Approve ROIs') self.approveROI_btn.setMinimumHeight(40); self.exit_btn = QtGui.QPushButton('Exit') self.exit_btn.setMinimumHeight(40); # Make button layout self.btnLayout = QGridLayout() self.btnLayout.addWidget(self.cpROI_btn,0,0) self.btnLayout.addWidget(self.useCpROI_btn,0,1) self.btnLayout.addWidget(self.noEgg_btn,1,1) self.btnLayout.addWidget(self.approveROI_btn,1,0) # Exit button not implemented, just use window x (topRight). # self.btnLayout.addWidget(self.exit_btn,2,1) # Add button layout to GridLayout. checkLayout.addLayout(self.btnLayout,0,5) # Format images for pyqtgraph and put in ImageView # self.formatSequence(ims) self.imImport() self.diag.imv.setImage(self.compSeq) # Add the ROI to ImageItem self.diag.show() # Call function to add data self.dataForTable() # Function for modifying the table when ROI is approved. self.approveROI_btn.clicked.connect(self.updateTable) # Copy current ROI self.cpROI_btn.clicked.connect(self.cpROI) # Apply copied ROI self.useCpROI_btn.clicked.connect(self.applyCopiedROI) # Assign nan to frames not containing egg self.noEgg_btn.clicked.connect(self.recordNoEgg) # Exit - prompt user to confirm #self.exit_btn.clicked.connect(self.closeEvent) # Connect changes in timeline so correct ROI is created and displayed. self.diag.imv.timeLine.sigPositionChanged.connect(self.updateOpenCVEggROICurrEmbryo) #self.diag.keyPressEvent(self.keyPressEvent) #============================================================================== # Generate data for populating the embryo/approveROI table. #============================================================================== def dataForTable(self): self.tableData = {'Embryo':list(self.embryoLabels), 'ROI approved':['No'] * len(list(self.embryoLabels))} self.tableCols = [QtGui.QColor(0,0,100,120)]* len(list(self.embryoLabels)) # Enter data onto Table horHeaders = [] for n, key in enumerate(sorted(self.tableData.keys())): horHeaders.append(key) for m, item in enumerate(self.tableData[key]): newitem = QtGui.QTableWidgetItem(item) newitem.setBackground(QtGui.QColor(0,0,100,120)) self.diag.table.setItem(m, n, newitem) # Add Header self.diag.table.setHorizontalHeaderLabels(horHeaders) # Adjust size of Table self.diag.table.resizeRowsToContents() # self.diag.table.resizeColumnsToContents() #============================================================================== # Update table when approve ROI button clicked. #============================================================================== def updateTable(self): self.tableData['ROI approved'][self.diag.table.currentRow()] = 'Approved' self.tableCols[self.diag.table.currentRow()] = QtGui.QColor(0,100,0,120) horHeaders = [] for n, key in enumerate(sorted(self.tableData.keys())): horHeaders.append(key) for m, item in enumerate(self.tableData[key]): newitem = QtGui.QTableWidgetItem(item) self.diag.table.setItem(m, n, newitem) newitem.setBackground(self.tableCols[m]) #Add Header self.diag.table.setHorizontalHeaderLabels(horHeaders) #Adjust size of Table self.diag.table.resizeRowsToContents() #============================================================================== # Update the user interface #============================================================================== def updateUI(self,ims,eggRotBBox, eggBoxPoints): self.imImport() self.diag.imv.setImage(self.compSeq) self.importOpenCVROIs(eggRotBBox, eggBoxPoints) self.getSeqValsAndCurrROI() self.updateOpenCVEggROINewEmbryo() # Add the ROI to ImageItem #self.diag.imv.addItem(self.roi) #============================================================================== # Deal with data from the dataHandling class #============================================================================== def formatSequence(self,ims): # Format seq appropriately for pyqtgraph ROIs self.tSeqd = np.zeros_like(ims) for l in range(len(self.tSeqd)): self.tSeqd[l] = ims[l].T #============================================================================== # Get folders for a particular embryo #============================================================================== def getEmbryoFolders(self, parentPath, embryo): self.parentPath = parentPath self.embryo = embryo self.embryoFolders = glob.glob(parentPath + "*/" + embryo +"/") self.embryoFolders.sort(key=os.path.getctime) #============================================================================== # Get image #============================================================================== def imImport(self): for f in range(len(self.eggUIimPaths)): im = cv2.imread(self.eggUIimPaths[f],cv2.IMREAD_ANYDEPTH) ran = (im.max()-im.min())/255. out = (im/ran) out = out-out.min() self.compSeq[int(f)] = out.astype(np.uint8) self.compSeq[f] = self.compSeq[f].T #============================================================================== # Update image iteratively when slider moved #============================================================================== #============================================================================== # def updateImage(self): # self.getSeqValsAndCurrROI() # #self.UI.compSeq[e*len(self.eggIDIms):(e*len(self.eggIDIms)+len(self.eggIDIms))] = self.seq # #self.UI.comp(self.imImport(self.diag.imv.currentIndex())) # im = cv2.imread(self.eggUIimPaths[self.diag.imv.currentIndex],cv2.IMREAD_ANYDEPTH) # ran = (im.max()-im.min())/255. # out = (im/ran) # out = out-out.min() # self.compSeq[self.diag.imv.currentIndex] = out.astype(np.uint8) # self.diag.imv.setImage(self.compSeq.T) # self.diag.imv.show() # #======== #============================================================================== #============================================================================== # ROI functions #============================================================================== #============================================================================== # Import OpenCV determined ROIs from dataHandling instance. Called from showUI and updateUI. #============================================================================== def importOpenCVROIs(self,eggRotBBox, eggBoxPoints): self.eggRotBBox = eggRotBBox self.eggBoxPoints = eggBoxPoints self.originalEggRotBBox = eggRotBBox.copy() self.originalEggBoxPoints = eggBoxPoints.copy() #============================================================================== # Get index values for ROI data. #============================================================================== def getSeqValsAndCurrROI(self): # Calculate the indices for current frame if self.eggInt != 1234: self.divVal = self.diag.imv.currentIndex/float(len(self.eggRotBBox[1])) self.intDivVal = int(self.divVal) self.withinSeqVal = int((self.divVal - self.intDivVal)*len(self.eggRotBBox[self.intDivVal])) self.currROI_eggRotBBox = self.eggRotBBox[self.intDivVal,self.withinSeqVal] self.currROI_eggBoxPoints = self.eggBoxPoints[self.intDivVal,self.withinSeqVal] else: self.divVal = self.diag.imv.currentIndex self.intDivVal = int(self.divVal) self.currROI_eggRotBBox = self.eggRotBBox[0,self.intDivVal] self.currROI_eggBoxPoints = self.eggBoxPoints[0,self.intDivVal] #============================================================================== # Generate a pyqtgraph ROI, using data from OpenCV. #============================================================================== def createOpenCVEggROI(self): # Get relevant sequence position and ROI. self.getSeqValsAndCurrROI() if (self.currROI_eggRotBBox[0] != 'nan'): # 0 or 90 degree angles seem very buggy. Shift to 1 and 89 as a bodge fix. if self.currROI_eggRotBBox[4] == -90: #self.currROI_eggRotBBox[4] = -89 # Get rotated bounding box points ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) elif self.currROI_eggRotBBox[4] == -0: #self.currROI_eggRotBBox[4] = -1 ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) elif self.currROI_eggRotBBox[4] == -180: #self.currROI_eggRotBBox[4] = -179 ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) else: # Get rotated bounding box points ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] # Make ROI - note non 0,or 90 degree angles, require different of the X size # Rectangular ROI used to enable more easy handling of corner handles for tracking user chagnges. if (self.currROI_eggRotBBox[4] == -90.0) | (self.currROI_eggRotBBox[4] == -0.0)| (self.currROI_eggRotBBox[4] == 0.0): self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) # roi = pg.EllipseROI([bottomMost[0][0], bottomMost[0][1]], [eggRotBBox[vidTime][2], eggRotBBox[vidTime][3]]) # Debug # print 'no angle' else: # Random angle ROIs self.roi = pg.ROI([bottomMost[0][0], bottomMost[0][1]], [-self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) self.roi.setAngle(self.currROI_eggRotBBox[4], update=True) # roi = pg.EllipseROI([bottomMost[0][0], bottomMost[0][1]], [-eggRotBBox[vidTime][2], eggRotBBox[vidTime][3]]) # Add handles self.roi.addRotateHandle([1, 0],[0.5,0.5]) self.roi.addRotateHandle([0, 1], [0.5,0.5]) self.roi.addScaleHandle([1, 1], [0, 0]) self.roi.addScaleHandle([0, 0], [1, 1]) self.roi.setPen('y',width=3) self.roi.removable self.roi.invertible = 'True' # Make var for dealing with modifications to roi self.updatedEggROI=[] self.roi.sigRegionChangeFinished.connect(self.updateROI) #else: #============================================================================== # Update the ROI for current embryo. #============================================================================== def updateOpenCVEggROICurrEmbryo(self): # Remove previous if (hasattr(self, 'roi')): self.diag.imv.removeItem(self.roi) # Get relevant video position and ROI. self.getSeqValsAndCurrROI() # 0 or 90 degree angles seem very buggy. Shift to 1 and 89 as a bodge fix. if self.currROI_eggRotBBox[4] == -90: #self.currROI_eggRotBBox[4] = -89 # Get rotated bounding box points ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) elif self.currROI_eggRotBBox[4] == -0: #self.currROI_eggRotBBox[4] = -1 ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) elif self.currROI_eggRotBBox[4] == -180: #self.currROI_eggRotBBox[4] = -179 ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) else: # Get rotated bounding box points ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] # Make ROI - note non 0,or 90 degree angles, require different of the X size # Rectangular ROI used to enable more easy handling of corner handles for tracking user chagnges. if (self.currROI_eggRotBBox[4] == -90.0) | (self.currROI_eggRotBBox[4] == -0.0)| (self.currROI_eggRotBBox[4] == 0.0): self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) # roi = pg.EllipseROI([bottomMost[0][0], bottomMost[0][1]], [eggRotBBox[vidTime][2], eggRotBBox[vidTime][3]]) # Debug # print 'no angle' else: # Random angle ROIs self.roi = pg.ROI([bottomMost[0][0], bottomMost[0][1]], [-self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) self.roi.setAngle(self.currROI_eggRotBBox[4], update=True) # roi = pg.EllipseROI([bottomMost[0][0], bottomMost[0][1]], [-eggRotBBox[vidTime][2], eggRotBBox[vidTime][3]]) # roi = pg.EllipseROI([bottomMost[0][0], bottomMost[0][1]], [-eggRotBBox[vidTime][2], eggRotBBox[vidTime][3]]) # Add handles self.roi.addRotateHandle([1, 0],[0.5,0.5]) self.roi.addRotateHandle([0, 1], [0.5,0.5]) self.roi.addScaleHandle([1, 1], [0, 0]) self.roi.addScaleHandle([0, 0], [1, 1]) self.roi.setPen('y',width=3) self.roi.removable self.roi.invertible = 'True' # Make var for dealing with modifications to roi self.updatedEggROI=[] ### Still to do... self.diag.imv.addItem(self.roi) self.roi.sigRegionChangeFinished.connect(self.updateROI) #============================================================================== # Update ROI for new embryo. #============================================================================== def updateOpenCVEggROINewEmbryo(self): # Remove old ROI if (hasattr(self, 'roi')): self.diag.imv.removeItem(self.roi) # Get relevant video position and ROI self.getSeqValsAndCurrROI() # 0 or 90 degree angles seem very buggy. Shift to 1 and 89 as a bodge fix. if self.currROI_eggRotBBox[4] == -90: #self.currROI_eggRotBBox[4] = -89 # Get rotated bounding box points ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) elif self.currROI_eggRotBBox[4] == -0: #self.currROI_eggRotBBox[4] = -1 ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) elif self.currROI_eggRotBBox[4] == -180: #self.currROI_eggRotBBox[4] = -179 ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) else: # Get rotated bounding box points ySorted = self.currROI_eggBoxPoints[np.argsort(self.currROI_eggBoxPoints[:, 1]), :] # Get bottom most, and top most sorted corner points bottomMost = ySorted[:2, :] topMost = ySorted[2:, :] # Get bottom most bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] (bl, br) = bottomMost # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # The point with the largest distance will be our bottom-right point D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] (tl, tr) = topMost[np.argsort(D)[::-1], :] # Make ROI - note non 0,or 90 degree angles, require different of the X size # Rectangular ROI used to enable more easy handling of corner handles for tracking user chagnges. if (self.currROI_eggRotBBox[4] == -90.0) | (self.currROI_eggRotBBox[4] == -0.0)| (self.currROI_eggRotBBox[4] == 0.0): self.roi = pg.ROI([bl[0], bl[1]], [self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) # roi = pg.EllipseROI([bottomMost[0][0], bottomMost[0][1]], [eggRotBBox[vidTime][2], eggRotBBox[vidTime][3]]) # Debug # print 'no angle' else: # Random angle ROIs self.roi = pg.ROI([bottomMost[0][0], bottomMost[0][1]], [-self.currROI_eggRotBBox[2], self.currROI_eggRotBBox[3]]) self.roi.setAngle(self.currROI_eggRotBBox[4], update=True) # Add handles self.roi.addRotateHandle([1, 0],[0.5,0.5]) self.roi.addRotateHandle([0, 1], [0.5,0.5]) self.roi.addScaleHandle([1, 1], [0, 0]) self.roi.addScaleHandle([0, 0], [1, 1]) self.roi.setPen('y',width=3) self.roi.removable self.roi.invertible = 'True' # Make var for dealing with modifications to roi self.updatedEggROI=[] ### Still to do... self.diag.imv.addItem(self.roi) self.roi.sigRegionChangeFinished.connect(self.updateROI) #============================================================================== # Update ROI. #============================================================================== def updateROI(self): #global vidTime, xyPosHandles, ellipse, changeAngle, roiChanges,updatedEggROI, changeX, changeY, changeScaleX, changeScaleY, changeAngle # Get changes to ROI scale, angle and position roiChanges = self.roi.getGlobalTransform() changeX = -roiChanges.getTranslation()[0] changeY = roiChanges.getTranslation()[1] changeScaleX = roiChanges.getScale()[0] changeScaleY = roiChanges.getScale()[1] changeAngle = roiChanges.getAngle() # Update ROI, either updating the previously updated or taking the unaltered ROI from OpenCV as a starting point. #if len(self.updatedEggROI) == 0: self.updatedEggROI = (((self.currROI_eggRotBBox[0]-changeX),(self.currROI_eggRotBBox[1]+changeY)),((max((self.currROI_eggRotBBox[3]*changeScaleX),(self.currROI_eggRotBBox[2]*changeScaleY))),(min((self.currROI_eggRotBBox[3]*changeScaleX),(self.currROI_eggRotBBox[2]*changeScaleY)))),self.currROI_eggRotBBox[4]+changeAngle) #else: #self.updatedEggROI = (((self.updatedEggROI[0][0]-changeX),(self.updatedEggROI[0][1]+changeY)),((max((self.updatedEggROI[1][0]*changeScaleX),(self.updatedEggROI[1][1]*changeScaleY))),(min((self.updatedEggROI[1][0]*changeScaleX),(self.updatedEggROI[1][1]*changeScaleY)))),self.updatedEggROI[2]+changeAngle) hh = self.roi.getHandles() hh = [self.roi.mapToItem(self.diag.imv.getImageItem(), h.pos()) for h in hh] # Handle on each corner. Get handle positions self.xyPosHandles =[] for h in hh: self.xyPosHandles.append([h.x(),h.y()]) (eggBBX, eggBBY), (eggBBW, eggBBH), eggBBAng = cv2.minAreaRect(np.array(self.xyPosHandles, dtype=np.int32) ) if eggBBAng == -90: eggBBAng = -89 elif eggBBAng == -180: eggBBAng = -179 elif eggBBAng == -0: eggBBAng = -1 # Save updated # If more than one frame eggID per sequence.. if self.eggInt != 1234: self.eggRotBBox[self.intDivVal,self.withinSeqVal] = [eggBBX, eggBBY, eggBBW, eggBBH, eggBBAng] self.eggBoxPoints[self.intDivVal,self.withinSeqVal] = cv2.boxPoints(((eggBBX, eggBBY), (eggBBW, eggBBH), eggBBAng)) # Otherwise just save simply else: self.eggRotBBox[0,self.intDivVal] = [eggBBX, eggBBY, eggBBW, eggBBH, eggBBAng] self.eggBoxPoints[0,self.intDivVal] = cv2.boxPoints(((eggBBX, eggBBY), (eggBBW, eggBBH), eggBBAng)) #============================================================================== # Copy ROI on button click. #============================================================================== def cpROI(self): self.originalEggRotBBox = self.currROI_eggRotBBox self.originalEggBoxPoints = self.currROI_eggBoxPoints #============================================================================== # Assign nan to current ROI if 'No Egg' button clicked #============================================================================== def recordNoEgg(self): # Remove ROI self.diag.imv.removeItem(self.roi) # Store nans in place of ROI if self.eggInt != 1234: self.eggRotBBox[self.intDivVal,self.withinSeqVal] = [np.nan, np.nan, np.nan, np.nan, np.nan] self.eggBoxPoints[0,self.intDivVal] = [np.nan,np.nan,np.nan,np.nan] else: self.eggBoxPoints[0,self.intDivVal] = [np.nan,np.nan,np.nan,np.nan] self.eggRotBBox[0,self.intDivVal] = [np.nan, np.nan, np.nan, np.nan, np.nan] #============================================================================== # Copy ROI on button click. #============================================================================== def applyCopiedROI(self): self.getSeqValsAndCurrROI() # Store copied ROI to embryo sequence ROIs if self.eggInt != 1234: self.divVal = self.diag.imv.currentIndex/float(len(self.eggRotBBox[1])) self.intDivVal = int(self.divVal) self.withinSeqVal = int((self.divVal - self.intDivVal)*len(self.eggRotBBox[self.intDivVal])) self.eggRotBBox[self.intDivVal,self.withinSeqVal] = self.originalEggRotBBox self.eggBoxPoints[self.intDivVal,self.withinSeqVal] = self.originalEggBoxPoints else: self.divVal = self.diag.imv.currentIndex self.intDivVal = int(self.divVal) self.eggRotBBox[0,self.intDivVal] = self.originalEggRotBBox self.eggBoxPoints[0,self.intDivVal] = self.originalEggBoxPoints self.updateOpenCVEggROICurrEmbryo() #============================================================================== # #============================================================================== #============================================================================== # Close button - not implemented (hidden) #============================================================================== #============================================================================== # def closeEvent(self, event): # # quit_msg = "Are you sure you want to exit the program?" # reply = QtGui.QMessageBox.question(self, 'Message', # quit_msg, QtGui.QMessageBox.Yes, QtGui.QMessageBox.No) # # if reply == QtGui.QMessageBox.Yes: # #event.accept() # app.quit() # else: # event.ignore() # #============================================================================== #============================================================================== # #self.originalEggRotBBox = eggRotBBox.copy() # #self.originalEggBoxPoints = eggBoxPoints.copy() # #self.currROI_eggRotBBox = self.eggRotBBox[self.intDivVal,self.withinSeqVal] # #self.currROI_eggBoxPoints = self.eggBoxPoints[self.intDivVal,self.withinSeqVal] # # # Modified version of updateOpenCVEggROICurrEmbryo # # Remove previous # self.diag.imv.removeItem(self.roi) # # Get relevant video position and ROI. # self.getSeqValsAndCurrROI() # # Get rotated bounding box points # ySorted = self.originalEggBoxPoints[np.argsort(self.originalEggBoxPoints[:, 1]), :] # # Get bottom most, and top most sorted corner points # bottomMost = ySorted[:2, :] # topMost = ySorted[2:, :] # # Get bottom most # bottomMost = bottomMost[np.argsort(bottomMost[:, 1]), :] # (bl, br) = bottomMost # # Use bottom-left coordinate as anchor to calculate the Euclidean distance between the # # The point with the largest distance will be our bottom-right point # D = dist.cdist(bl[np.newaxis], topMost, "euclidean")[0] # (tl, tr) = topMost[np.argsort(D)[::-1], :] # # Make ROI - note non 0,or 90 degree angles, require different of the X size # # Rectangular ROI used to enable more easy handling of corner handles for tracking user chagnges. # if (self.originalEggRotBBox[4] == -90.0) | (self.originalEggRotBBox[4] == -0.0)| (self.originalEggRotBBox[4] == 0.0): # self.roi = pg.ROI([bottomMost[0][0], bottomMost[0][1]], [self.originalEggRotBBox[2], self.originalEggRotBBox[3]]) # # roi = pg.EllipseROI([bottomMost[0][0], bottomMost[0][1]], [eggRotBBox[vidTime][2], eggRotBBox[vidTime][3]]) # else: # # Random angle ROIs # self.roi = pg.ROI([bottomMost[0][0], bottomMost[0][1]], [-self.originalEggRotBBox[2], self.originalEggRotBBox[3]]) # self.roi.setAngle(self.originalEggRotBBox[4], update=True) # # roi = pg.EllipseROI([bottomMost[0][0], bottomMost[0][1]], [-eggRotBBox[vidTime][2], eggRotBBox[vidTime][3]]) # # Add handles # self.roi.addRotateHandle([1, 0],[0.5,0.5]) # self.roi.addRotateHandle([0, 1], [0.5,0.5]) # self.roi.addScaleHandle([1, 1], [0, 0]) # self.roi.addScaleHandle([0, 0], [1, 1]) # self.roi.setPen('y',width=3) # self.roi.removable # self.roi.invertible = 'True' # # Make var for dealing with modifications to roi # self.updatedEggROI=[] # ### Still to do... # self.diag.imv.addItem(self.roi) # self.roi.sigRegionChangeFinished.connect(self.updateROI) #============================================================================== #===============
54.540984
329
0.545099
32,377
0.88469
0
0
0
0
0
0
15,688
0.428669
bcaf2fd4c9457e78084e56f1b1fab3aa1985e417
394
py
Python
Curso em Vídeo/Mundo 2 Estruturas de Controle/Desafios/desafio053.py
henriqueumeda/-Estudo-python
28e93a377afa4732037a29eb74d4bc7c9e24b62f
[ "MIT" ]
null
null
null
Curso em Vídeo/Mundo 2 Estruturas de Controle/Desafios/desafio053.py
henriqueumeda/-Estudo-python
28e93a377afa4732037a29eb74d4bc7c9e24b62f
[ "MIT" ]
null
null
null
Curso em Vídeo/Mundo 2 Estruturas de Controle/Desafios/desafio053.py
henriqueumeda/-Estudo-python
28e93a377afa4732037a29eb74d4bc7c9e24b62f
[ "MIT" ]
null
null
null
frase = input('Digite uma frase: ').upper().strip().replace(' ', '') tamanho = int(len(frase)) inverso = '' #Opção mais simples: # inverso = frase[::-1] for contador in range(tamanho-1, -1, -1): inverso += frase[contador] print('O inverso de {} é {}'.format(frase, inverso)) if frase == inverso: print('Temos um palíndromo!') else: print('A frase digitada não é um palíndromo!')
24.625
68
0.639594
0
0
0
0
0
0
0
0
160
0.399002
bcaf69ed2a6fded7e4b539b423940b33563b6d40
540
py
Python
tests/unittest/options/pricing/test_binomial_trees.py
yiluzhu/quant
784c5cc20eeded2ff684b464eec4744f000d9638
[ "MIT" ]
1
2020-10-14T12:56:14.000Z
2020-10-14T12:56:14.000Z
tests/unittest/options/pricing/test_binomial_trees.py
yiluzhu/quant
784c5cc20eeded2ff684b464eec4744f000d9638
[ "MIT" ]
null
null
null
tests/unittest/options/pricing/test_binomial_trees.py
yiluzhu/quant
784c5cc20eeded2ff684b464eec4744f000d9638
[ "MIT" ]
null
null
null
from unittest import TestCase from options.pricing.binomial_trees import BinomialTreePricer from options.option import OptionType, Option class BinomialTreeTestCase(TestCase): def test_basic(self): """European option, spot price 50, strike price 52, risk free interest rate 5% expiry 2 years, volatility 30% """ pricer = BinomialTreePricer(steps=100) option = Option(OptionType.PUT, 50, 52, 0.05, 2, 0.3) result = pricer.price_option(option) self.assertEqual(6.7781, result)
30
86
0.698148
397
0.735185
0
0
0
0
0
0
129
0.238889
bcaf71bd0c6cd2298c1b67ea7ef95ddacb0851be
16,589
py
Python
mctimer.py
Sharpieman20/MCtimer
5d4609f3697778de090816b8a768b82bbe217294
[ "Beerware" ]
null
null
null
mctimer.py
Sharpieman20/MCtimer
5d4609f3697778de090816b8a768b82bbe217294
[ "Beerware" ]
null
null
null
mctimer.py
Sharpieman20/MCtimer
5d4609f3697778de090816b8a768b82bbe217294
[ "Beerware" ]
null
null
null
import atexit import os import sys import platform import json import glob import datetime import time import threading import tkinter as tk from pynput import mouse from pathlib import Path from playsound import playsound from enum import Enum import copy #"THE BEER-WARE LICENSE" (Revision 42): #bleach86 wrote this file. As long as you retain this notice you can do whatever you want with this stuff. #If we meet some day, and you think this stuff is worth it, you can buy me a beer in return input_fil = Path("/Users/sharpieman20/MCtimer/MCtimer") / "input.txt" # continuously read from input file every 10ms # when you get a "reset timer" message, reset the timer # # class Category: # def __init__(): # self.actions = [] # self.attempts = [] # # convert actions to attempts # def read(): # def write(): # class Actions(Enum): # CREATE_WORLD = 0 # START = 1 # class Attempt: stage = 0 ind = 0 time_count = 0 rsg = [ ("World Created", True), ([ "Savannah", "Desert", "Plains", "Other" ], False), ([ "0-15", "15-30", "30-45", "45-60", "60-75", "75+" ], False), ([ "Iron", "Logs", "Feathers", "Wool", "Gravel" ], True), ("Enter Nether", True), ("Find Fortress", True), ("Find Spawner", True), ("Exit Spawner", True), ("Exit Nether", True), ("Tower Build Start", True), ("Tower Build Finished", True), ("Tower Leave", True), ("Enter Stronghold", True), ("Enter End", True), ("Finish", True) ] cur_stages = {} json_file = 'mct_config.json' with open(json_file) as json_file: data2 = json.load(json_file) if data2['borderless'] == 'true': data2['borderless'] else: data2['borderless'] = False running_path = Path.cwd() NUM_CHARS = 11 system_type = platform.system() if system_type == 'Linux': directory = os.path.expanduser(data2['linux_saves']) elif system_type == 'Darwin': directory = os.path.expanduser(data2['mac_saves']) elif system_type == 'Windows': directory = os.path.expanduser(data2['windows_saves']) amount2 = 0 last_amount = 0 window = tk.Tk() # bg = BindGlobal(widget=window) window.text = tk.StringVar() window.text2 = tk.StringVar() window.text3 = tk.StringVar() window.text4 = tk.StringVar() window.geometry("{}x{}".format(data2["width"], data2["height"])) window.configure(bg='black') rt = time.time() old_version = False did_change = False count = 0 ig = 0 base = 0 program_time = 0 metronome_armed = False metronome_running = False metronome_active = False metronome_beats = int(data2['metronome_beats']) listener = None metronome_time = 0 base_update = int(data2['base_update']) rta_update = int(data2['rta_update']) * base_update metronome_bpm = int(data2['metronome_bpm']) metronome_interval = 0 if data2['auto_start'] == 'true': click1 = 1 click2 = 1 else: click1 = 0 click2 = 0 cur_fil = None world_base_time = 0 def get_time(): global last_amount global old_version global amount2 global ig global did_change # print("-------------------------") if data2['1.7+'] == 'false': try: global cur_fil global world_base_time mc_dir = Path(directory).parent stats_dir = mc_dir / "stats" os.chdir(stats_dir) json_file = glob.glob('*.dat') stats_file = json_file[0] amount = 0 with open(stats_file) as timer_file: # print(timer_file) data = json.load(timer_file) for item in data["stats-change"]: if "1100" in item: amount = item["1100"] # print(amount) latest = max([os.path.join(directory,d) for d in os.listdir(directory)], key=os.path.getmtime) # print(latest) if latest != cur_fil: cur_fil = latest world_base_time = amount # print("world base time now {}".format(world_base_time)) # print(amount) amount2 = float(amount - world_base_time) / 20 # print(amount2) run_time = str(datetime.timedelta(seconds=amount2, milliseconds=0.5)) # print(run_time) if last_amount == amount: ig = 0 return run_time[:-3] else: did_change = True # print(latest + "\nTime: " + run_time) last_amount = amount ig = 0 return run_time[:-3] except: ig = 1 return '0:00:00.000' else: try: latest = max([os.path.join(directory,d) for d in os.listdir(directory)], key=os.path.getmtime) if system_type == "Linux" or system_type == "Darwin": os.chdir(latest + '/stats/') else: os.chdir(latest + '\\stats\\') json_file = glob.glob('*.json') timer = json_file[0] with open(timer) as json_file: data = json.load(json_file) try: amount = data['stats']['minecraft:custom']['minecraft:play_one_minute'] except: amount = data['stat.playOneMinute'] old_version = True json_file.close() amount2 = float(amount) / 20 run_time = str(datetime.timedelta(seconds=amount2, milliseconds=0.5)) if last_amount == amount: ig = 0 return run_time[:-3] else: did_change = True print(latest + "\nTime: " + run_time) last_amount = amount ig = 0 return run_time[:-3] except: ig = 1 return '0:00:00.000' def window2(): font_name = data2['font_name'] rta_font_size = data2['rta_font_size'] igt_font_size = data2['igt_font_size'] font_modifiers = data2['font_modifiers'] rta_font = (font_name, rta_font_size, font_modifiers) igt_font = (font_name, igt_font_size, font_modifiers) greeting = tk.Label(fg=data2['rta_color'], bg=data2['bg_color'], font=rta_font, textvariable=window.text) greeting.pack() if data2['show_igt'] == 'true': greeting2 = tk.Label(fg=data2['igt_color'], bg=data2['bg_color'], font=igt_font, textvariable=window.text2) greeting2.pack() if data2['use_counter'] == 'true': greeting3 = tk.Label(fg=data2['counter_color'], bg=data2['bg_color'], font=rta_font, textvariable=window.text3) greeting3.pack() # bg.gbind(data2['increment'], on_increment_counter) # greeting.after(0, update_count) if data2['use_splits'] == 'true': split_font_size = data2['split_font_size'] split_font = (font_name, split_font_size, font_modifiers) greeting4 = tk.Label(fg=data2['split_color'], bg=data2['bg_color'], font=split_font, textvariable=window.text4) greeting4.pack() # bg.gbind(data2['cycle'], cycle) # bg.gbind(data2['split'], split) # bg.gbind(data2['skip'], skip) reset_split() # greeting.after(0, update_count) # bg.gbind(data2['pause'], on_press) # bg.gbind(data2['reset_start'], on_press2) # if data2['enable_metronome'] == 'true': # bg.gbind(data2['arm_metronome'], arm_metronome) # bg.gbind(data2['start_metronome'], start_metronome) # bg.gbind(data2['exit'], clicked3) # bg.bind(data2['start_metronome'], start_metronome) ''' this works for the window detecting right click ''' # window.bind(data2['start_metronome'], start_metronome) #window.bind("<Button-1>", clicked) #window.bind("<Button-3>", clicked2) greeting.after(0, tick_time) greeting.after(0, update_time2) window.title("MCtimer") window.attributes('-topmost', True) window.overrideredirect(data2['borderless']) window.geometry(data2['window_pos']) window.mainloop() def update_time(): global rt global program_time # do_metronome_action() if click1 == 1: window.text.set(real_time()) elif click1 == 0: # rt = time.time() diff = amount2 - base rtc = str(datetime.timedelta(seconds=diff)) diff_txt = rtc[:-3] # print(diff_txt) window.text.set(diff_txt) # print(base) if click2 == 0: rt = time.time() window.text.set("0:00:00.000") # window.after(int(data2['rta_update'])/10, update_time) def tick_time(): global time_count global metronome_armed time_count += 1 update_time() if metronome_armed or time_count % 20 == 0: check_input() window.after(rta_update, tick_time) def check_input(): txt = input_fil.read_text() input_fil.write_text("") global metronome_armed # print(txt) if "start_metronome" in txt: print(data2['enable_metronome']) if data2['enable_metronome'] == 'true': start_metronome(None) if "arm_metronome" in txt: metronome_armed = True if "pause_timer" in txt: left_click() if "start_timer" in txt: right_click() def update_time2(): window.text2.set(get_time()) window.after(1000, update_time2) def update_count(): count_str = str(count) text_str = "" for i in range(0, int(NUM_CHARS/2)): text_str += " " text_str += count_str for i in range(0, int(NUM_CHARS/2)): text_str += " " window.text3.set(text_str) window.after(rta_update, update_count) # def update_split() def on_press(event): left_click() def on_press2(event): right_click() def update_split(): global stage text_str = cur_stages[stage][0] if type(text_str) == type([]): text_str = text_str[ind] window.text4.set(text_str) def reset_split(): global ind, stage, cur_stages ind = 0 stage = 0 cur_stages = copy.deepcopy(rsg) update_split() def cycle(event): global ind, stage ind += 1 item = cur_stages[stage] if type(item[0]) == type([]): if ind == len(item[0]): ind = 0 else: ind = 0 update_split() def split(event): global stage, ind item = cur_stages[stage] if item[1]: if type(item[0]) == type([]): item[0].remove(item[0][ind]) if len(item[0]) == 0: stage += 1 ind = 0 update_split() return stage += 1 ind = 0 update_split() def skip(event): global stage stage += 1 update_split() def on_increment_counter(event): increment_counter() def clicked3(event): sys.exit(1) def clicked2(event): right_click() def clicked(event): left_click() def write_to_log(text): pass # log_dir = Path("/Users/sharpieman20/MCtimer/MCtimer/logs") # log_fil = log_dir / data2["current_section"] # log_fil.touch() # log_fil = log_fil.open("a") # log_fil.write(str(text)+"\n") def left_click(): global click1 if click1 == 1: click1 = 0 elif click1 == 0: click1 = 0 # global base # write_to_log(str(amount2-base)) # base = amount2 def right_click(): global click1 global click2 global count global did_change count = 0 did_change = True if click2 == 1: click1 = 0 click2 = 0 elif click2 == 0: click2 = 1 click1 = 1 # print(float(amount2)) # print("hehe") global base write_to_log("reset {}".format(str(amount2-base))) base = amount2 def increment_counter(): global count count += 1 ''' METRONOME CODE ''' ''' Metronome mouse listener ''' def exit_handler(): global listener mouse.Listener.stop(listener) window.quit() atexit.register(exit_handler) def listen_for_right_click(): def on_click(x, y, button, pressed): # print(button) if pressed: if pressed and button == mouse.Button.right: start_metronome(None) return False # mouse.Listener.stop(listener) # print("Right Click Detected (pressed)") with mouse.Listener(on_click=on_click) as listener: # listener.start() listener.join() ''' Sound playing code ''' def play_file_named(str_name): playsound((running_path / str_name).as_posix(), block = True) def play_up_beep(): play_file_named("MetronomeHit.mp3") def play_normal_beep(): play_file_named("MetronomeBase.mp3") def play_metronome_preset(): time.sleep(0.06) play_file_named("MetronomePreset.mp3") ''' Metronome functions ''' def arm_metronome(event): global metronome_armed global metronome_running if metronome_armed or metronome_running: return metronome_armed = True # x = threading.Thread(target=listen_for_right_click, daemon=True) # x.start() listen_for_right_click() print("armed and ready") def start_metronome(event): run_metronome() # print(metronome_running) # arm_metronome = False def run_metronome(): global metronome_time global metronome_interval global metronome_running if data2['has_metronome_preset'] == 'true': play_metronome_preset() metronome_running = False return metronome_time = 0 base_time = round(time.time()*1000) metronome_interval = int(100 * 60 / metronome_bpm)*10 time.sleep(float(data2['beat_offset'])*metronome_interval/1000.0) # print(metronome_interval)555 while metronome_running: start_time = round(time.time()*1000) - base_time do_metronome_action() end_time = round(time.time()*1000) - base_time elapsed = end_time - start_time time.sleep((metronome_interval - elapsed)/1000.0) # print("{} {} {}".format(start_time, end_time, )) metronome_time += metronome_interval def do_metronome_action(): global metronome_running global metronome_interval if not metronome_running: return # print(metronome_interval) # metronome_time = program_time - metronome_start_time if metronome_time >= metronome_interval * metronome_beats: metronome_running = False return # print(metronome_time) # print(metronome_interval) # print(time.time()*1000) if metronome_time % metronome_interval == 0: if (metronome_time % (metronome_interval*4)) == metronome_interval*3: # print("up beep") play_up_beep() # pass else: # print("normal beep") play_normal_beep() # pass # print(time.time()*1000) # print() def real_time(): global rt global click1 global click2 global amount2 global old_version global stage global ig global did_change if data2['auto_adjust'] == 'true': # print(did_change) # print(base) if did_change: rt = float(time.time()) - float(amount2) if data2['allow_offset'] == 'true': rt += base did_change = False if data2['auto_start'] == 'true': if ig == 1: rt = time.time() click1 = 1 click2 = 1 stage = 0 reset_split() return '0:00:00.000' elif click1 == 1: if old_version == True and stage == 0: ig = 0 rt = float(time.time()) - float(amount2) rtc = str(datetime.timedelta(seconds=rt)) stage = 1 print("stop") return rtc[:-3] else: ig = 0 rt2 = time.time() real_time = rt2 - rt rtc = str(datetime.timedelta(seconds=real_time)) # rt = float(amount2) - float(base) # rtc = str(datetime.timedelta(seconds=rt)) return rtc[:-3] else: if click1 == 1: rt2 = time.time() real_time = rt2 - rt rtc = str(datetime.timedelta(seconds=real_time)) return rtc[:-3] def main(): window2() main()
24.833832
119
0.578335
0
0
0
0
0
0
0
0
4,112
0.247875
bcb0236709da62fc588329e551c92b5fc621ffd9
2,927
py
Python
kafka/structs.py
informatique-cdc/kafka-python
d73bd6fc2f8825e2fddb7c4f091af7b266e37aea
[ "Apache-2.0" ]
4,389
2015-06-12T06:00:10.000Z
2022-03-31T20:41:42.000Z
kafka/structs.py
informatique-cdc/kafka-python
d73bd6fc2f8825e2fddb7c4f091af7b266e37aea
[ "Apache-2.0" ]
1,595
2015-12-02T20:58:22.000Z
2022-03-27T07:28:03.000Z
kafka/structs.py
informatique-cdc/kafka-python
d73bd6fc2f8825e2fddb7c4f091af7b266e37aea
[ "Apache-2.0" ]
1,115
2015-12-02T23:17:52.000Z
2022-03-30T03:34:29.000Z
""" Other useful structs """ from __future__ import absolute_import from collections import namedtuple """A topic and partition tuple Keyword Arguments: topic (str): A topic name partition (int): A partition id """ TopicPartition = namedtuple("TopicPartition", ["topic", "partition"]) """A Kafka broker metadata used by admin tools. Keyword Arguments: nodeID (int): The Kafka broker id. host (str): The Kafka broker hostname. port (int): The Kafka broker port. rack (str): The rack of the broker, which is used to in rack aware partition assignment for fault tolerance. Examples: `RACK1`, `us-east-1d`. Default: None """ BrokerMetadata = namedtuple("BrokerMetadata", ["nodeId", "host", "port", "rack"]) """A topic partition metadata describing the state in the MetadataResponse. Keyword Arguments: topic (str): The topic name of the partition this metadata relates to. partition (int): The id of the partition this metadata relates to. leader (int): The id of the broker that is the leader for the partition. replicas (List[int]): The ids of all brokers that contain replicas of the partition. isr (List[int]): The ids of all brokers that contain in-sync replicas of the partition. error (KafkaError): A KafkaError object associated with the request for this partition metadata. """ PartitionMetadata = namedtuple("PartitionMetadata", ["topic", "partition", "leader", "replicas", "isr", "error"]) """The Kafka offset commit API The Kafka offset commit API allows users to provide additional metadata (in the form of a string) when an offset is committed. This can be useful (for example) to store information about which node made the commit, what time the commit was made, etc. Keyword Arguments: offset (int): The offset to be committed metadata (str): Non-null metadata """ OffsetAndMetadata = namedtuple("OffsetAndMetadata", # TODO add leaderEpoch: OffsetAndMetadata(offset, leaderEpoch, metadata) ["offset", "metadata"]) """An offset and timestamp tuple Keyword Arguments: offset (int): An offset timestamp (int): The timestamp associated to the offset """ OffsetAndTimestamp = namedtuple("OffsetAndTimestamp", ["offset", "timestamp"]) MemberInformation = namedtuple("MemberInformation", ["member_id", "client_id", "client_host", "member_metadata", "member_assignment"]) GroupInformation = namedtuple("GroupInformation", ["error_code", "group", "state", "protocol_type", "protocol", "members", "authorized_operations"]) """Define retry policy for async producer Keyword Arguments: Limit (int): Number of retries. limit >= 0, 0 means no retries backoff_ms (int): Milliseconds to backoff. retry_on_timeouts: """ RetryOptions = namedtuple("RetryOptions", ["limit", "backoff_ms", "retry_on_timeouts"])
33.261364
102
0.702767
0
0
0
0
0
0
0
0
2,464
0.841818
bcb1c97f3222308944fcb2351152a564408ff396
7,357
py
Python
Vehicle_Counting_colab.py
manolosolalinde/Vehicle-Counting
898e1993613ea5a6803078cc5026d2d690c12322
[ "MIT" ]
null
null
null
Vehicle_Counting_colab.py
manolosolalinde/Vehicle-Counting
898e1993613ea5a6803078cc5026d2d690c12322
[ "MIT" ]
null
null
null
Vehicle_Counting_colab.py
manolosolalinde/Vehicle-Counting
898e1993613ea5a6803078cc5026d2d690c12322
[ "MIT" ]
null
null
null
import cv2 from trackers.tracker import create_blob, add_new_blobs, remove_duplicates import numpy as np from collections import OrderedDict from detectors.detector import get_bounding_boxes import uuid import os import contextlib from datetime import datetime import argparse from utils.detection_roi import get_roi_frame, draw_roi from counter import get_counting_line, is_passed_counting_line # parse CLI arguments parser = argparse.ArgumentParser() parser.add_argument('video', help='relative/absolute path to video or camera input of traffic scene') parser.add_argument('--iscam', action='store_true', help='specify if video capture is from a camera') parser.add_argument('--droi', help='specify a detection region of interest (ROI) \ i.e a set of vertices that represent the area (polygon) \ where you want detections to be made (format: 1,2|3,4|5,6|7,8|9,10 \ default: 0,0|frame_width,0|frame_width,frame_height|0,frame_height \ [i.e the whole video frame])') parser.add_argument('--showdroi', action='store_true', help='display/overlay the detection roi on the video') parser.add_argument('--mctf', type=int, help='maximum consecutive tracking failures \ i.e number of tracking failures before the tracker concludes \ the tracked object has left the frame') parser.add_argument('--di', type=int, help='detection interval i.e number of frames \ before detection is carried out again (in order to find new vehicles \ and update the trackers of old ones)') parser.add_argument('--detector', help='select a model/algorithm to use for vehicle detection \ (options: yolo, haarc, bgsub, ssd | default: yolo)') parser.add_argument('--tracker', help='select a model/algorithm to use for vehicle tracking \ (options: csrt, kcf, camshift | default: kcf)') parser.add_argument('--record', action='store_true', help='record video and vehicle count logs') parser.add_argument('--clposition', help='position of counting line (options: top, bottom, \ left, right | default: bottom)') parser.add_argument('--hideimage', action='store_true', help='hide resulting image') args = parser.parse_args() # capture traffic scene video video = int(args.video) if args.iscam else args.video cap = cv2.VideoCapture(video) _, frame = cap.read() # configs blobs = OrderedDict() blob_id = 1 frame_counter = 0 DETECTION_INTERVAL = 10 if args.di == None else args.di MAX_CONSECUTIVE_TRACKING_FAILURES = 3 if args.mctf == None else args.mctf detector = 'yolo' if args.detector == None else args.detector tracker = 'kcf' if args.tracker == None else args.tracker f_height, f_width, _ = frame.shape # init video object and log file to record counting if args.record: output_video = cv2.VideoWriter('./videos/output.avi', cv2.VideoWriter_fourcc('M','J','P','G'), 30, (f_width, f_height)) log_file_name = 'log.txt' with contextlib.suppress(FileNotFoundError): os.remove(log_file_name) log_file = open(log_file_name, 'a') log_file.write('vehicle_id, count, datetime\n') log_file.flush() # set counting line clposition = 'bottom' if args.clposition == None else args.clposition counting_line = get_counting_line(clposition, f_width, f_height) vehicle_count = 0 # create detection ROI droi = [(0, 0), (f_width, 0), (f_width, f_height), (0, f_height)] if args.droi: droi = [] points = args.droi.replace(' ', '').split('|') for point_str in points: point = tuple(map(int, point_str.split(','))) droi.append(point) # initialize trackers and create new blobs droi_frame = get_roi_frame(frame, droi) initial_bboxes = get_bounding_boxes(droi_frame, detector) for box in initial_bboxes: _blob = create_blob(box, frame, tracker) blobs[blob_id] = _blob blob_id += 1 while True: k = cv2.waitKey(1) if args.iscam or cap.get(cv2.CAP_PROP_POS_FRAMES) + 1 < cap.get(cv2.CAP_PROP_FRAME_COUNT): _, frame = cap.read() nframes = cap.get(cv2.CAP_PROP_POS_FRAMES) frame_count = cap.get(cv2.CAP_PROP_FRAME_COUNT) if nframes % 10 == 0 or nframes == 1: print("Processing {} of {} frames".format(nframes,frame_count)) for _id, blob in list(blobs.items()): # update trackers success, box = blob.tracker.update(frame) if success: blob.num_consecutive_tracking_failures = 0 blob.update(box) else: blob.num_consecutive_tracking_failures += 1 # delete untracked blobs if blob.num_consecutive_tracking_failures >= MAX_CONSECUTIVE_TRACKING_FAILURES: del blobs[_id] # count vehicles if is_passed_counting_line(blob.centroid, counting_line, clposition) and not blob.counted: blob.counted = True vehicle_count += 1 # log count data to a file (vehicle_id, count, datetime) if args.record: _row = '{0}, {1}, {2}\n'.format('v_' + str(_id), vehicle_count, datetime.now()) log_file.write(_row) log_file.flush() if frame_counter >= DETECTION_INTERVAL: # rerun detection droi_frame = get_roi_frame(frame, droi) boxes = get_bounding_boxes(droi_frame, detector) blobs, current_blob_id = add_new_blobs(boxes, blobs, frame, tracker, blob_id, counting_line, clposition) blob_id = current_blob_id blobs = remove_duplicates(blobs) frame_counter = 0 # draw and label blob bounding boxes for _id, blob in blobs.items(): (x, y, w, h) = [int(v) for v in blob.bounding_box] cv2.rectangle(frame, (x, y), (x + w, y + h), (0, 255, 0), 2) cv2.putText(frame, 'v_' + str(_id), (x, y - 2), cv2.FONT_HERSHEY_DUPLEX, 1, (0, 255, 0), 2, cv2.LINE_AA) # draw counting line cv2.line(frame, counting_line[0], counting_line[1], (0, 255, 0), 3) # display vehicle count cv2.putText(frame, 'Count: ' + str(vehicle_count), (20, 60), cv2.FONT_HERSHEY_DUPLEX, 2, (255, 0, 0), 2, cv2.LINE_AA) # show detection roi if args.showdroi: frame = draw_roi(frame, droi) # save frame in video output if args.record: output_video.write(frame) # visualize vehicle counting if not args.hideimage: resized_frame = cv2.resize(frame, (858, 480)) cv2.imshow('tracking', resized_frame) frame_counter += 1 # save frame if 's' key is pressed if k & 0xFF == ord('s'): cv2.imwrite(os.path.join('screenshots', 'ss_' + uuid.uuid4().hex + '.png'), frame) print('Screenshot taken.') else: print('End of video.') # end video loop if on the last frame break # end video loop if 'q' key is pressed if k & 0xFF == ord('q'): print('Video exited.') break # end capture, close window, close log file and video objects if any cap.release() if not args.hideimage: cv2.destroyAllWindows() if args.record: log_file.close() output_video.release()
40.646409
125
0.644964
0
0
0
0
0
0
0
0
2,365
0.321463
bcb21686e2484863628d877e956c259a49e6e1be
2,542
py
Python
app/resources/magic_castle_api.py
ComputeCanada/mc-hub
92b4c212ba8f7b5b1c8b8700f981275605a07067
[ "BSD-3-Clause" ]
5
2020-09-04T16:34:36.000Z
2020-09-25T19:14:59.000Z
app/resources/magic_castle_api.py
ComputeCanada/mc-hub
92b4c212ba8f7b5b1c8b8700f981275605a07067
[ "BSD-3-Clause" ]
39
2020-09-12T17:37:14.000Z
2022-03-10T17:49:57.000Z
app/resources/magic_castle_api.py
ComputeCanada/mc-hub
92b4c212ba8f7b5b1c8b8700f981275605a07067
[ "BSD-3-Clause" ]
1
2021-03-29T15:42:13.000Z
2021-03-29T15:42:13.000Z
from flask import request from resources.api_view import ApiView from exceptions.invalid_usage_exception import InvalidUsageException from models.user.user import User from models.user.authenticated_user import AuthenticatedUser class MagicCastleAPI(ApiView): def get(self, user: User, hostname): if hostname: magic_castle = user.get_magic_castle_by_hostname(hostname) return magic_castle.dump_configuration() else: if type(user) == AuthenticatedUser: return [ { **magic_castle.dump_configuration(planned_only=True), "hostname": magic_castle.get_hostname(), "status": magic_castle.get_status().value, "freeipa_passwd": magic_castle.get_freeipa_passwd(), "owner": magic_castle.get_owner_username(), } for magic_castle in user.get_all_magic_castles() ] else: return [ { **magic_castle.dump_configuration(planned_only=True), "hostname": magic_castle.get_hostname(), "status": magic_castle.get_status().value, "freeipa_passwd": magic_castle.get_freeipa_passwd(), } for magic_castle in user.get_all_magic_castles() ] def post(self, user: User, hostname, apply=False): if apply: magic_castle = user.get_magic_castle_by_hostname(hostname) magic_castle.apply() return {} else: magic_castle = user.create_empty_magic_castle() json_data = request.get_json() if not json_data: raise InvalidUsageException("No json data was provided") magic_castle.set_configuration(json_data) magic_castle.plan_creation() return {} def put(self, user: User, hostname): magic_castle = user.get_magic_castle_by_hostname(hostname) json_data = request.get_json() if not json_data: raise InvalidUsageException("No json data was provided") magic_castle.set_configuration(json_data) magic_castle.plan_modification() return {} def delete(self, user: User, hostname): magic_castle = user.get_magic_castle_by_hostname(hostname) magic_castle.plan_destruction() return {}
39.71875
77
0.5893
2,310
0.908733
0
0
0
0
0
0
129
0.050747
bcb26248e648d4d9b19d0a9ff813f2b53c5baabf
2,615
py
Python
tests/rbac/api/role/propose_member_test.py
kthblmfld/sawtooth-next-directory
57291f1a7e6ce1dfc11a9c5e2930e8c5ebd31707
[ "Apache-2.0" ]
null
null
null
tests/rbac/api/role/propose_member_test.py
kthblmfld/sawtooth-next-directory
57291f1a7e6ce1dfc11a9c5e2930e8c5ebd31707
[ "Apache-2.0" ]
null
null
null
tests/rbac/api/role/propose_member_test.py
kthblmfld/sawtooth-next-directory
57291f1a7e6ce1dfc11a9c5e2930e8c5ebd31707
[ "Apache-2.0" ]
null
null
null
# Copyright 2018 Contributors to Hyperledger Sawtooth # # 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. # ----------------------------------------------------------------------------- """ Propose Role Add Member Test """ # pylint: disable=invalid-name import time import requests import pytest from rbac.common.logs import get_logger from tests.rbac import helper from tests.rbac.api.assertions import assert_api_error from tests.rbac.api.assertions import assert_api_success from tests.rbac.api.assertions import assert_api_post_requires_auth LOGGER = get_logger(__name__) @pytest.mark.api @pytest.mark.api_role def test_api_propose_role_member(): """ Test a user proposing to add themselves to a role """ owner = helper.api.user.current role = helper.api.role.create.new(user=owner) user = helper.api.user.current2 url = helper.api.role.member.propose.url(role_id=role["id"]) data = {"id": user["user_id"]} assert assert_api_post_requires_auth(url=url, json=data) response = requests.post( url=url, headers={"Authorization": user["token"]}, json=data ) result = assert_api_success(response) assert result["proposal_id"] time.sleep(0.5) # temporary until API refactored to return the proposal proposal = helper.api.proposal.get(result["proposal_id"], owner) assert proposal["id"] == result["proposal_id"] assert proposal["status"] == "OPEN" assert proposal["type"] == "ADD_ROLE_MEMBER" assert proposal["object"] == role["id"] assert proposal["target"] == user["user_id"] assert proposal["opener"] == user["user_id"] @pytest.mark.api @pytest.mark.api_role def test_api_propose_role_member_required_fields(): """ Test proposing adding a member to a role with missing fields """ role, _ = helper.api.role.current user = helper.api.user.create.current url = helper.api.role.member.propose.url(role_id=role["id"]) data = {} response = requests.post( url=url, headers={"Authorization": user["token"]}, json=data ) assert_api_error(response, "Bad Request: id field is required", 400)
36.830986
79
0.702868
0
0
0
0
1,535
0.586998
0
0
1,146
0.438241
bcb2a48f3534ac05974fe4c223430ebf965fdf0b
881
py
Python
f2v.py
ClimberY/video_super_resolution_toolbox
e03fd34f60bf1104bd78ac0738a2648cee2eae46
[ "MIT" ]
null
null
null
f2v.py
ClimberY/video_super_resolution_toolbox
e03fd34f60bf1104bd78ac0738a2648cee2eae46
[ "MIT" ]
null
null
null
f2v.py
ClimberY/video_super_resolution_toolbox
e03fd34f60bf1104bd78ac0738a2648cee2eae46
[ "MIT" ]
null
null
null
import cv2 import os import numpy as np from PIL import Image def frame2video(im_dir, video_dir, fps): im_list = os.listdir(im_dir) im_list.sort(key=lambda x: int(x.replace("_RBPNF7", "").split('.')[0])) img = Image.open(os.path.join(im_dir, im_list[0])) img_size = img.size # 获得图片分辨率,im_dir文件夹下的图片分辨率需要一致 fourcc = cv2.VideoWriter_fourcc(*'XVID') videoWriter = cv2.VideoWriter(video_dir, fourcc, fps, img_size) for i in im_list: im_name = os.path.join(im_dir + i) frame = cv2.imdecode(np.fromfile(im_name, dtype=np.uint8), -1) videoWriter.write(frame) videoWriter.release() if __name__ == '__main__': im_dir = '/media/hy/Seagate Expansion Drive/Results/merge_dir/' # 帧存放路径 video_dir = '/media/hy/Seagate Expansion Drive/Results/sandy.mp4' # 合成视频存放的路径 fps = 15 # 帧率 frame2video(im_dir, video_dir, fps)
33.884615
82
0.682179
0
0
0
0
0
0
0
0
265
0.276907
bcb332026597a8538e3390f5b54de4be3aa00f42
11,103
py
Python
mflops/model_info.py
shuncyu/mflops
81fddf9407bcbdca02b9c57f6b03640b3fb94101
[ "MIT" ]
1
2020-12-17T03:09:20.000Z
2020-12-17T03:09:20.000Z
mflops/model_info.py
shuncyu/mflops
81fddf9407bcbdca02b9c57f6b03640b3fb94101
[ "MIT" ]
null
null
null
mflops/model_info.py
shuncyu/mflops
81fddf9407bcbdca02b9c57f6b03640b3fb94101
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 14 17:38:48 2020 @author: luke """ import sys from functools import partial import torch import torch.nn as nn import prettytable as pt from .basic_hook import MODULES_MAPPING def get_model_compute_info(model, input_res, print_per_layer_stat=False, input_constructor=None, ost=sys.stdout, verbose=False, ignore_modules=[], custom_modules_hooks={}): assert type(input_res) is tuple assert len(input_res) >= 1 assert isinstance(model, nn.Module) global CUSTOM_MODULES_MAPPING CUSTOM_MODULES_MAPPING = custom_modules_hooks compute_model = add_computing_methods(model) compute_model.eval() compute_model.start_compute(ost=ost, verbose=verbose, ignore_list=ignore_modules) if input_constructor: input = input_constructor(input_res) _ = compute_model(**input) else: try: batch = torch.ones(()).new_empty((1, *input_res), dtype=next(compute_model.parameters()).dtype, device=next(compute_model.parameters()).device) except StopIteration: batch = torch.ones(()).new_empty((1, *input_res)) _ = compute_model(batch) flops_count, mac_count, params_count = compute_model.compute_average_compute_cost() if print_per_layer_stat: print_model_with_compute(compute_model, flops_count, mac_count, params_count, ost=ost) compute_model.stop_compute() CUSTOM_MODULES_MAPPING = {} tb = pt.PrettyTable() tb.field_names = ['Metrics', 'Value'] tb.add_row(['%s' %'Floating Point Operations (FLOPs)', '%8s' %to_string(flops_count)]) tb.add_row(['%s' %'Memory Access Cost (MAC)', '%8s' %to_string(mac_count)]) tb.add_row(['%s' %'Number of Parameters', '%8s' %to_string(params_count)]) print(tb) return flops_count, mac_count, params_count def to_string(params_num, units=None, precision=3): if units is None: if params_num // 10**9 > 0: return str(round(params_num / 10**9, 3)) + ' G' elif params_num // 10**6 > 0: return str(round(params_num / 10**6, 3)) + ' M' elif params_num // 10**3 > 0: return str(round(params_num / 10**3, 3)) + ' K' else: return str(params_num) else: if units == 'G': return str(round(params_num / 10**9, precision)) + ' ' + units if units == 'M': return str(round(params_num / 10**6, precision)) + ' ' + units elif units == 'K': return str(round(params_num / 10**3, precision)) + ' ' + units else: return str(params_num) def print_model_with_compute(model, total_flops, total_mac, total_params, units='M', precision=3, ost=sys.stdout): def accumulate_params(self): if is_supported_instance(self): return self.__params__ else: sum = 0 for m in self.children(): sum += m.accumulate_params() return sum def accumulate_flops(self): if is_supported_instance(self): return self.__flops__ / model.__batch_counter__ else: sum = 0 for m in self.children(): sum += m.accumulate_flops() return sum def accumulate_mac(self): if is_supported_instance(self): return self.__mac__ / model.__batch_counter__ else: sum = 0 for m in self.children(): sum += m.accumulate_mac() return sum def compute_repr(self): accumulated_params_num = self.accumulate_params() accumulated_flops_cost = self.accumulate_flops() accumulated_mac_cost = self.accumulate_mac() return ', '.join([to_string(accumulated_params_num, units=units, precision=precision), '{:.3%} Params'.format(accumulated_params_num / total_params), to_string(accumulated_flops_cost, units=units, precision=precision), '{:.3%} FLOPs'.format(accumulated_flops_cost / total_flops), to_string(accumulated_mac_cost, units=units, precision=precision), '{:.3%} MAC'.format(accumulated_mac_cost / total_mac), '{:.3} MAC/FLOPs'.format(accumulated_mac_cost / (accumulated_flops_cost + 1e-5) \ * total_flops / (total_mac + 1e-5)), self.original_extra_repr()]) def add_extra_repr(m): m.accumulate_flops = accumulate_flops.__get__(m) m.accumulate_mac = accumulate_mac.__get__(m) m.accumulate_params = accumulate_params.__get__(m) compute_extra_repr = compute_repr.__get__(m) if m.extra_repr != compute_extra_repr: m.original_extra_repr = m.extra_repr m.extra_repr = compute_extra_repr assert m.extra_repr != m.original_extra_repr def del_extra_repr(m): if hasattr(m, 'original_extra_repr'): m.extra_repr = m.original_extra_repr del m.original_extra_repr if hasattr(m, 'accumulate_flops'): del m.accumulate_flops if hasattr(m, 'accumulate_mac'): del m.accumulate_mac model.apply(add_extra_repr) print(repr(model), file=ost) model.apply(del_extra_repr) def get_model_parameters_number(model): params_num = sum(p.numel() for p in model.parameters() if p.requires_grad) return params_num def add_computing_methods(net_main_module): # adding additional methods to the existing module object, # this is done this way so that each function has access to self object net_main_module.start_compute = start_compute.__get__(net_main_module) net_main_module.stop_compute = stop_compute.__get__(net_main_module) net_main_module.reset_compute = reset_compute.__get__(net_main_module) net_main_module.compute_average_compute_cost = compute_average_compute_cost.__get__( net_main_module) net_main_module.reset_compute() return net_main_module def compute_average_compute_cost(self): """ A method that will be available after add_computing_methods() is called on a desired net object. Returns current mean flops/mac consumption per image. """ batches_count = self.__batch_counter__ flops_sum = 0 mac_sum = 0 params_sum = 0 for module in self.modules(): if is_supported_instance(module): flops_sum += module.__flops__ mac_sum += module.__mac__ params_sum = get_model_parameters_number(self) return flops_sum / batches_count, mac_sum / batches_count, params_sum def start_compute(self, **kwargs): """ A method that will be available after add_computing_methods() is called on a desired net object. Activates the computation of mean flops/mac consumption per image. Call it before you run the network. """ add_batch_counter_hook_function(self) seen_types = set() def add_compute_hook_function(module, ost, verbose, ignore_list): if type(module) in ignore_list: seen_types.add(type(module)) if is_supported_instance(module): module.__params__ = 0 elif is_supported_instance(module): if hasattr(module, '__flops_handle__'): return if type(module) in CUSTOM_MODULES_MAPPING: handle = module.register_forward_hook( CUSTOM_MODULES_MAPPING[type(module)]) else: handle = module.register_forward_hook(MODULES_MAPPING[type(module)]) module.__flops_handle__ = handle module.__mac_handle__ = handle seen_types.add(type(module)) else: if verbose and not type(module) in (nn.Sequential, nn.ModuleList) and \ not type(module) in seen_types: print('Warning: module ' + type(module).__name__ + ' is treated as a zero-op.', file=ost) seen_types.add(type(module)) self.apply(partial(add_compute_hook_function, **kwargs)) def stop_compute(self): """ A method that will be available after add_computing_methods() is called on a desired net object. Stops computing the mean flops consumption per image. Call whenever you want to pause the computation. """ remove_batch_counter_hook_function(self) self.apply(remove_compute_hook_function) def reset_compute(self): """ A method that will be available after add_computing_methods() is called on a desired net object. Resets statistics computed so far. """ add_batch_counter_variables_or_reset(self) self.apply(add_compute_variable_or_reset) def batch_counter_hook(module, input, output): batch_size = 1 if len(input) > 0: # Can have multiple inputs, getting the first one input = input[0] batch_size = len(input) else: pass print('Warning! No positional inputs found for a module,' ' assuming batch size is 1.') module.__batch_counter__ += batch_size def add_batch_counter_variables_or_reset(module): module.__batch_counter__ = 0 def add_batch_counter_hook_function(module): if hasattr(module, '__batch_counter_handle__'): return handle = module.register_forward_hook(batch_counter_hook) module.__batch_counter_handle__ = handle def remove_batch_counter_hook_function(module): if hasattr(module, '__batch_counter_handle__'): module.__batch_counter_handle__.remove() del module.__batch_counter_handle__ def add_compute_variable_or_reset(module): if is_supported_instance(module): if hasattr(module, '__flops__') or hasattr(module, '__mac__') or \ hasattr(module, '__params__'): print('Warning: variables __flops__ or __mac__ or __params__ are already ' 'defined for the module' + type(module).__name__ + ' ptflops can affect your code!') module.__flops__ = 0 module.__mac__ = 0 module.__params__ = get_model_parameters_number(module) def is_supported_instance(module): if type(module) in MODULES_MAPPING or type(module) in CUSTOM_MODULES_MAPPING: return True return False def remove_compute_hook_function(module): if is_supported_instance(module): if hasattr(module, '__flops_handle__'): module.__flops_handle__.remove() del module.__flops_handle__ if hasattr(module, '__mac_handle__'): module.__mac_handle__.remove() del module.__mac_handle__
35.359873
107
0.631721
0
0
0
0
0
0
0
0
1,732
0.155994
bcb33dd64b91d776f626dc908c114e472e82874d
2,301
py
Python
dosagelib/plugins/derideal.py
Church-/dosage
7ef18a2a2e9f77aa1e64a44906731506a00fac45
[ "MIT" ]
1
2020-06-18T17:51:13.000Z
2020-06-18T17:51:13.000Z
dosagelib/plugins/derideal.py
Church-/dosage
7ef18a2a2e9f77aa1e64a44906731506a00fac45
[ "MIT" ]
null
null
null
dosagelib/plugins/derideal.py
Church-/dosage
7ef18a2a2e9f77aa1e64a44906731506a00fac45
[ "MIT" ]
null
null
null
# SPDX-License-Identifier: MIT # Copyright (C) 2019-2020 Tobias Gruetzmacher # Copyright (C) 2019-2020 Daniel Ring from ..scraper import _ParserScraper from ..helpers import indirectStarter class Derideal(_ParserScraper): baseUrl = 'https://www.derideal.com/' imageSearch = '//img[contains(@class, "comic-page")]' prevSearch = '//a[i[contains(@class, "fa-angle-left")]]' latestSearch = '//a[i[contains(@class, "fa-angle-double-right")]]' starter = indirectStarter def __init__(self, name, sub, first, last=None): if name == 'Derideal': super(Derideal, self).__init__(name) else: super(Derideal, self).__init__('Derideal/' + name) self.url = self.baseUrl + sub self.stripUrl = self.url + '/%s/' self.firstStripUrl = self.stripUrl % first self.startUrl = self.firstStripUrl if last: self.endOfLife = True def starter(self): indexPage = self.getPage(self.url) self.chapters = indexPage.xpath('//a[contains(text(), "Read this episode")]/@href') self.currentChapter = len(self.chapters) return indirectStarter(self) def namer(self, imageUrl, pageUrl): filename = pageUrl.rstrip('/').rsplit('/', 1)[-1] filename = filename.replace('espanol-escape-25', 'escape-26') filename = filename.replace('espanol-w-a-l-l-y', 'w-a-l-l-y') filename = filename.replace('hogar-prision', 'home-prison') filename = filename.replace('strip', 'pe').replace('purpurina-effect', 'pe') filename = filename.replace('sector-de-seguridad', 'security-sector') filename = 'ch' + str(self.currentChapter) + '-' + filename if pageUrl in self.chapters: self.currentChapter -= 1 return filename @classmethod def getmodules(cls): return ( cls('Derideal', 'derideal', 'cover-prime'), cls('Legacy', 'derideal-legacy', 'the-dream-cover', last='derideal-is-on-hiatus'), cls('LRE', 'RLE', 'the-leyend-of-the-rose-cover'), cls('ProjectPrime', 'project-prime', 'custus-part-i-cover'), cls('PurpurinaEffect', 'purpurina-effect', 'purpurina-effect-cover'), cls('TheVoid', 'the-void', 'the-void-cover') )
40.368421
94
0.614081
2,108
0.916123
0
0
490
0.212951
0
0
803
0.348979
bcb3b617387a63312fcb662d0698c65cf437acee
3,340
py
Python
LearnFunction/learnfunction01.py
subash-kc/2022-01-04-Python
5ce51e4265bcd860a4e62423edef6ec9cd1437b4
[ "MIT" ]
1
2022-01-14T18:03:42.000Z
2022-01-14T18:03:42.000Z
LearnFunction/learnfunction01.py
subash-kc/2022-01-04-Python
5ce51e4265bcd860a4e62423edef6ec9cd1437b4
[ "MIT" ]
null
null
null
LearnFunction/learnfunction01.py
subash-kc/2022-01-04-Python
5ce51e4265bcd860a4e62423edef6ec9cd1437b4
[ "MIT" ]
null
null
null
""" Function are subprograms which are used to compute a value or perform a task. Type of Functions:- Built in Functions: print(), upper() User define functions Advantage of Functions 1. Write once and use it as many time as you need. This provides code reusability 2. Function facilitates ease of code maintenance 3. Divide Large task into many small task so it will help you to debug code 4. You can remove or add new feature to a function anytime. """ """ We can define a function using def keyword followed by function name with parentheses. This is also called as Creating a function, Writing a Function, Defining a FUnction. Syntax:- def function_name(): Local Variable block of statement return(variable or expression) def function_name(param1, param2, param3, .....) Local Variable Block of statement return (variable or expression) Note - Nooed to mainitain a proper indentation """ # creating a list def add(): list = [8, 2, 3, 0, 7] total = 0; for i in range(0, len(list)): total = total + list[i] print('Sum of all elements in given list: ', total) if __name__ == '__main__': add() print() # another method def sum_list(): mylist = [8, 2, 3, 0, 7] # Using inbuilt sum method total = sum(mylist) print("Sum of all elements in given list1: ", total) if __name__ == '__main__': sum_list() print() def multiplylist(): list_multiply = [8, 2, 3, -1, 7] total = 1; for x in list_multiply: total = total * x print(total) if __name__ == '__main__': multiplylist() # Method 2: Unsing numpy.prid() ^ Install numpy package import numpy def product_total(): list_product = [8, 2, 3, -1, 7] total = numpy.prod(list_product) print("Another method using numpy method to find product in list: ", total) product_total() print() def findingminmax(num1: int, num2: int, num3: int) -> int: max = 0; if (num1 > num2 and num1 > num2): max = num1 elif (num2 > num1 and num2 > num3): max = num2 else: max = num3 print("The maximum number in given list is: ", max) findingminmax(22, 26, 30) print() print("Another Method to find maximum") def findingmaximum(num1: int, num2: int, num3: int) -> int: find_max_list = (num1, num2, num3) return max(find_max_list) x = int(input("Enter your first Number: ")) y = int(input("Enter your second Number: ")) z = int(input("Enter your third Number: ")) print("Maximum number is ::>", findingmaximum(x, y, z)) """Python program to print the even numbers from a given list""" def find_even(): sample_list = [1, 2, 3, 4, 5, 6, 7, 8, 9] for num in sample_list: if num % 2 == 0: print(num, end=" ") find_even() print() """ Pythhon program to find prime numbers in given list Function should return true if the number is prime; else false """ def isPrime(num): if (num < 2): return True for i in range (2, num//2+1): if(num%i==0): return False return True number =int(input("Enter the number you will like to check whether the number is prime or not: \n")) if isPrime(number): print(number, "is a Prime Number") else: print(number, "is not a Prime number") """ Another Method to find prime number """
18.870056
106
0.645808
0
0
0
0
0
0
0
0
1,743
0.521856
bcb3deb24bc63c8049391df8c67ec2a72c8f437a
945
py
Python
trackr/cli.py
rpedigoni/trackr
ab5cf0cc661d003c6bd2ffa5516babf2e931de78
[ "MIT" ]
9
2017-04-23T23:54:56.000Z
2021-12-26T02:21:28.000Z
trackr/cli.py
rpedigoni/trackr
ab5cf0cc661d003c6bd2ffa5516babf2e931de78
[ "MIT" ]
null
null
null
trackr/cli.py
rpedigoni/trackr
ab5cf0cc661d003c6bd2ffa5516babf2e931de78
[ "MIT" ]
3
2017-04-23T23:55:13.000Z
2017-05-03T01:20:23.000Z
# coding: utf-8 import click @click.command() @click.option('--carrier', prompt='Carrier ID', help='Example: "ect" for Correios') @click.option('--object-id', prompt='Object ID', help='Example: PN871429404BR') def main(carrier, object_id): from trackr import Trackr from trackr.exceptions import PackageNotFound try: p = Trackr.track(carrier, object_id) except PackageNotFound as e: click.echo(click.style( u'Package with object ID {} ({}) not found'.format( object_id, carrier), fg='red') ) if e.carrier_message: click.echo(click.style( u'Carrier message: {}'.format(e.carrier_message), fg='red',) ) return click.echo(click.style(u'Package found!', fg='green')) for t in p.tracking_info: click.echo(t.__unicode__()) if __name__ == "__main__": main()
25.540541
83
0.582011
0
0
0
0
873
0.92381
0
0
224
0.237037
bcb3f4ba8d64955ba6c3c16193d7d7869a8725dd
3,043
py
Python
pitop/common/notifications.py
pi-top/pi-top-Python-SDK
6c83cc5f612d77f86f8d391c7f2924a28f7b1232
[ "Apache-2.0" ]
28
2020-11-24T08:02:58.000Z
2022-02-27T18:37:33.000Z
pitop/common/notifications.py
pi-top/pi-top-Python-SDK
6c83cc5f612d77f86f8d391c7f2924a28f7b1232
[ "Apache-2.0" ]
263
2020-11-10T14:35:10.000Z
2022-03-31T12:35:13.000Z
pitop/common/notifications.py
pi-top/pi-top-Python-SDK
6c83cc5f612d77f86f8d391c7f2924a28f7b1232
[ "Apache-2.0" ]
1
2022-01-31T22:48:35.000Z
2022-01-31T22:48:35.000Z
from enum import Enum, auto from subprocess import CalledProcessError, run from pitop.common.command_runner import run_command from pitop.common.logger import PTLogger class NotificationAction: def __init__(self, call_to_action_text, command_str) -> None: self.call_to_action_text = call_to_action_text self.command_str = command_str class NotificationActionManager: def __init__(self): self.actions = list() self.default_action = None self.close_action = None def add_action(self, call_to_action_text, command_str) -> None: action = NotificationAction(call_to_action_text, command_str) self.actions.append(action) def set_default_action(self, command_str) -> None: default_action = NotificationAction("", command_str) self.default_action = default_action def set_close_action(self, command_str) -> None: close_action = NotificationAction("", command_str) self.close_action = close_action class NotificationUrgencyLevel(Enum): low = auto() normal = auto() critical = auto() def send_notification( title: str, text: str, icon_name: str = "", timeout: int = 0, app_name: str = "", notification_id: int = -1, actions_manager: NotificationActionManager = None, urgency_level: NotificationUrgencyLevel = None, capture_notification_id: bool = True, ) -> str: # Check that `notify-send-ng` is available, as it's not a hard dependency of the package try: run(["dpkg-query", "-l", "notify-send-ng"], capture_output=True, check=True) except CalledProcessError: raise Exception("notify-send-ng not installed") cmd = "/usr/bin/notify-send " cmd += "--print-id " cmd += "--expire-time=" + str(timeout) + " " if icon_name: cmd += "--icon=" + icon_name + " " if notification_id >= 0: cmd += "--replace=" + str(notification_id) + " " if actions_manager is not None: for action in actions_manager.actions: cmd += ( '--action="' + action.call_to_action_text + ":" + action.command_str + '" ' ) if actions_manager.default_action is not None: cmd += ( "--default-action=" + actions_manager.default_action.command_str + " " ) if actions_manager.close_action is not None: cmd += "--close-action=" + actions_manager.close_action.command_str + " " if app_name: cmd += "--app-name=" + app_name + " " if urgency_level is not None: cmd += "--urgency=" + urgency_level.name + " " cmd += ' "' + title + '" ' cmd += '"' + text + '"' PTLogger.info("notify-send command: {}".format(cmd)) try: resp_stdout = run_command(cmd, 2000, capture_output=capture_notification_id) except Exception as e: PTLogger.warning("Failed to show message: {}".format(e)) raise return resp_stdout
29.833333
92
0.621755
926
0.304305
0
0
0
0
0
0
399
0.131121
bcb4c4328d404e8eec9df91c64d171e98d7a2415
5,778
py
Python
src/Gismo_XY To Location.py
AntonelloDN/gismo
3ffbabaf8405efd3572701c9e0b7497211dfc248
[ "Apache-2.0" ]
57
2017-01-31T11:55:22.000Z
2022-03-26T16:00:40.000Z
src/Gismo_XY To Location.py
AntonelloDN/gismo
3ffbabaf8405efd3572701c9e0b7497211dfc248
[ "Apache-2.0" ]
11
2017-02-22T16:45:11.000Z
2020-05-06T17:00:07.000Z
src/Gismo_XY To Location.py
AntonelloDN/gismo
3ffbabaf8405efd3572701c9e0b7497211dfc248
[ "Apache-2.0" ]
19
2017-01-29T18:02:58.000Z
2021-08-25T10:56:57.000Z
# xy to location # # Gismo is a plugin for GIS environmental analysis (GPL) started by Djordje Spasic. # # This file is part of Gismo. # # Copyright (c) 2019, Djordje Spasic <[email protected]> # Gismo 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. # # Gismo is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/. # # The GPL-3.0+ license <http://spdx.org/licenses/GPL-3.0+> """ Use this component to calculate latitude and longitude coordinates of the _point in Rhino scene. For example: you created some building shapes with Gismo "OSM Shapes" component, and now you would like to check what are the latitude and longtitude coordinates of particular part of the building. - Provided by Gismo 0.0.3 input: _point: A point for which we would like to calculate its latitude and longitude coordinates anchorLocation_: Represents latitude,longitude coordinates which correspond to anchorOrigin_ in Rhino scene. - If nothing added to this input, anchorLocation_ with both latitude and longitude set to "0" will be used as a default. anchorOrigin_: A point in Rhino scene which corresponds to anchorLocation_. - If nothing added to this input, anchorOrigin will be set to: 0,0,0. output: readMe!: ... location: Location (latitude, longitude coordinates) of the _point input. """ ghenv.Component.Name = "Gismo_XY To Location" ghenv.Component.NickName = "XYtoLocation" ghenv.Component.Message = "VER 0.0.3\nJAN_29_2019" ghenv.Component.IconDisplayMode = ghenv.Component.IconDisplayMode.application ghenv.Component.Category = "Gismo" ghenv.Component.SubCategory = "1 | Gismo" #compatibleGismoVersion = VER 0.0.3\nJAN_29_2019 try: ghenv.Component.AdditionalHelpFromDocStrings = "2" except: pass import scriptcontext as sc import Grasshopper import Rhino def main(requiredPoint, anchorLocation, anchorOrigin): # check inputs if (requiredPoint == None): required_location = None validInputData = False printMsg = "Please add a point to this component's \"_point\" input." return required_location, validInputData, printMsg if (anchorLocation == None): locationName = "unknown location" anchor_locationLatitudeD = 0 anchor_locationLongitudeD = 0 timeZone = 0 elevation = 0 else: locationName, anchor_locationLatitudeD, anchor_locationLongitudeD, timeZone, elevation, validLocationData, printMsg = gismo_preparation.checkLocationData(anchorLocation) if (anchorOrigin == None): anchorOrigin = Rhino.Geometry.Point3d(0,0,0) unitConversionFactor, unitSystemLabel = gismo_preparation.checkUnits() anchorOrigin_meters = Rhino.Geometry.Point3d(anchorOrigin.X*unitConversionFactor, anchorOrigin.Y*unitConversionFactor, anchorOrigin.Z*unitConversionFactor) requiredPoint_meters = Rhino.Geometry.Point3d(requiredPoint.X*unitConversionFactor, requiredPoint.Y*unitConversionFactor, requiredPoint.Z*unitConversionFactor) # inputCRS EPSGcode = 4326 # WGS 84 inputCRS_dummy = gismo_gis.CRS_from_EPSGcode(EPSGcode) # outputCRS outputCRS_dummy = gismo_gis.UTM_CRS_from_latitude(anchor_locationLatitudeD, anchor_locationLongitudeD) anchor_originProjected_meters = gismo_gis.convertBetweenTwoCRS(inputCRS_dummy, outputCRS_dummy, anchor_locationLongitudeD, anchor_locationLatitudeD) # in meters # inputCRS # based on assumption that both anchorLocation_ input and required_location belong to the same UTM zone inputCRS = gismo_gis.UTM_CRS_from_latitude(anchor_locationLatitudeD, anchor_locationLongitudeD, anchor_locationLatitudeD, anchor_locationLongitudeD) # outputCRS EPSGcode = 4326 outputCRS = gismo_gis.CRS_from_EPSGcode(EPSGcode) latitudeLongitudePt = gismo_gis.convertBetweenTwoCRS(inputCRS, outputCRS, (anchor_originProjected_meters.X - anchorOrigin_meters.X) + requiredPoint_meters.X, (anchor_originProjected_meters.Y - anchorOrigin_meters.Y) + requiredPoint_meters.Y) required_location = gismo_preparation.constructLocation(locationName, latitudeLongitudePt.Y, latitudeLongitudePt.X, timeZone, elevation) validInputData = True printMsg = "ok" return required_location, validInputData, printMsg level = Grasshopper.Kernel.GH_RuntimeMessageLevel.Warning if sc.sticky.has_key("gismoGismo_released"): validVersionDate, printMsg = sc.sticky["gismo_check"].versionDate(ghenv.Component) if validVersionDate: gismo_preparation = sc.sticky["gismo_Preparation"]() gismo_gis = sc.sticky["gismo_GIS"]() location, validInputData, printMsg = main(_point, anchorLocation_, anchorOrigin_) if not validInputData: print printMsg ghenv.Component.AddRuntimeMessage(level, printMsg) else: print printMsg ghenv.Component.AddRuntimeMessage(level, printMsg) else: printMsg = "First please run the Gismo Gismo component." print printMsg ghenv.Component.AddRuntimeMessage(level, printMsg)
47.360656
246
0.72776
0
0
0
0
0
0
0
0
2,433
0.42108
bcb5f8a3494a7c1dd73bdaa2595e97b680531db5
256
py
Python
Notebooks/SentinelUtilities/SentinelAnomalyLookup/__init__.py
ytognder/Azure-Sentinel
7345560f178e731d7ba5a5541fd3383bca285311
[ "MIT" ]
266
2019-10-18T00:41:39.000Z
2022-03-18T05:44:01.000Z
Notebooks/SentinelUtilities/SentinelAnomalyLookup/__init__.py
ytognder/Azure-Sentinel
7345560f178e731d7ba5a5541fd3383bca285311
[ "MIT" ]
113
2020-03-10T16:56:10.000Z
2022-03-28T21:54:26.000Z
Notebooks/SentinelUtilities/SentinelAnomalyLookup/__init__.py
ytognder/Azure-Sentinel
7345560f178e731d7ba5a5541fd3383bca285311
[ "MIT" ]
93
2020-01-07T20:28:43.000Z
2022-03-23T04:09:39.000Z
# pylint: disable-msg=C0103 """ SentinelAnomalyLookup: This package is developed for Azure Sentinel Anomaly lookup """ # __init__.py from .anomaly_lookup_view_helper import AnomalyLookupViewHelper from .anomaly_finder import AnomalyQueries, AnomalyFinder
28.444444
82
0.832031
0
0
0
0
0
0
0
0
130
0.507813
bcb80d7d2c6e6e1e230619095dac5498b39b51c1
3,989
py
Python
items/coins.py
leerichoang/Legend-Of-Peach
bef98ba7afdbddc497c45f8adedfb60e81176bfb
[ "MIT" ]
null
null
null
items/coins.py
leerichoang/Legend-Of-Peach
bef98ba7afdbddc497c45f8adedfb60e81176bfb
[ "MIT" ]
null
null
null
items/coins.py
leerichoang/Legend-Of-Peach
bef98ba7afdbddc497c45f8adedfb60e81176bfb
[ "MIT" ]
2
2019-10-15T23:22:16.000Z
2019-10-29T04:38:02.000Z
import pygame from pygame.sprite import Sprite class Coins(Sprite): """Coins""" def __init__(self, hub, x, y, name='coin', state='floating'): super().__init__() # Values self.name = name self.hub = hub self.original_pos = [x, y] self.rest_height = y self.rest_x = x self.velY = 0 self.upwards = True self.state = state self.scale = (30, 50) self.scale2 = (14, 50) self.scale3 = (4, 50) # Screen Camera self.screen = self.hub.main_screen self.screen_rect = self.screen.get_rect() self.camera = hub.camera # Images self.index = 0 self.change_freq = 120 self.player_clock = pygame.time.get_ticks() + self.change_freq self.frameRate = 30 self.clock = pygame.time.get_ticks() + self.frameRate self.image_index = [pygame.image.load("imgs/Items/coin1.png"), pygame.image.load("imgs/Items/coin2.png"), pygame.image.load("imgs/Items/coin3.png"), pygame.image.load("imgs/Items/coin2.png")] self.image_index[0] = pygame.transform.scale(self.image_index[0], self.scale) self.image_index[1] = pygame.transform.scale(self.image_index[1], self.scale2) self.image_index[2] = pygame.transform.scale(self.image_index[2], self.scale3) self.image_index[3] = pygame.transform.scale(self.image_index[3], self.scale2) self.resting_index = [pygame.image.load("imgs/Items/CoinForBlackBG.png"), pygame.image.load("imgs/Items/CoinForBlackBG1.png"), pygame.image.load("imgs/Items/CoinForBlackBG2.png"), pygame.image.load("imgs/Items/CoinForBlackBG1.png")] for i in range(len(self.resting_index)): self.resting_index[i] = pygame.transform.scale(self.resting_index[i], self.scale) if self.state == "floating": self.image = self.image_index[self.index] else: self.image = self.resting_index[self.index] self.rect = self.image.get_rect() self.rect.x = self.original_pos[0] self.rect.y = self.original_pos[1] def draw(self): self.screen.blit(self.image, self.rect) def update(self): self.check_state() def check_state(self): if self.state == "floating": self.start_anim() elif self.state == "resting": self.resting() def start_anim(self): """Starts coin spin animation""" self.velY = 5 if self.rect.y == (self.rest_height - 60): self.upwards = False if self.upwards: self.rect.y -= self.velY else: self.rect.y += self.velY # start timer if pygame.time.get_ticks() > self.player_clock: self.player_clock = pygame.time.get_ticks() + self.change_freq if self.index == 0: self.original_pos[0] += 8 elif self.index == 1: self.original_pos[0] += 5 elif self.index == 2: self.original_pos[0] -= 5 elif self.index == 3: self.original_pos[0] -= 8 self.index += 1 self.index %= len(self.image_index) self.image = self.image_index[self.index] if self.rect.y == self.rest_height: self.hub.gamemode.coins += 1 self.hub.gamemode.check_coins() self.hub.gamemode.score += 200 self.kill() def resting(self): """Starts coin rest animation""" # start timer if pygame.time.get_ticks() > self.player_clock: self.player_clock = pygame.time.get_ticks() + self.change_freq self.index += 1 self.index %= len(self.resting_index) self.image = self.resting_index[self.index]
34.387931
93
0.560792
3,939
0.987466
0
0
0
0
0
0
392
0.09827
bcb9144fdddbbf32bc78ac12f77acb144b544d93
142
py
Python
python/package/geo/test/__init__.py
fiomenankiti/playground
7c3139ffe5db4b18cf042b8027c9f670860371e0
[ "MIT" ]
null
null
null
python/package/geo/test/__init__.py
fiomenankiti/playground
7c3139ffe5db4b18cf042b8027c9f670860371e0
[ "MIT" ]
null
null
null
python/package/geo/test/__init__.py
fiomenankiti/playground
7c3139ffe5db4b18cf042b8027c9f670860371e0
[ "MIT" ]
null
null
null
from geo.calc import Calc from geo.calc import Distance from geo.geosp import Wt from geo.geosp import Gh from geo.files.csv_file import check
28.4
36
0.823944
0
0
0
0
0
0
0
0
0
0
bcbacb893f1fc24efc7e31b69bae2dad2d6081f7
293
py
Python
tests/test_clean.py
tcapelle/nb_helpers
432b1f014f1b780b5a4d3722d44f237387db2330
[ "MIT" ]
7
2022-01-13T09:54:39.000Z
2022-02-08T23:34:47.000Z
tests/test_clean.py
tcapelle/nb_helpers
432b1f014f1b780b5a4d3722d44f237387db2330
[ "MIT" ]
62
2021-12-14T10:24:13.000Z
2022-02-09T00:00:12.000Z
tests/test_clean.py
tcapelle/nb_helpers
432b1f014f1b780b5a4d3722d44f237387db2330
[ "MIT" ]
2
2022-01-20T10:41:51.000Z
2022-02-04T11:26:41.000Z
from pathlib import Path from nb_helpers.clean import clean_all, clean_one from tests import TEST_PATH TEST_PATH TEST_NB = Path("test_nb.py") def test_clean_one(): "clean just one nb" clean_one(TEST_NB) def test_clean_all(): "clean all test nbs" clean_all(path=TEST_PATH)
17.235294
49
0.744027
0
0
0
0
0
0
0
0
51
0.174061
bcbc7df90a025f59202f5950277107bf1a366441
5,746
py
Python
apps/technical_analysis.py
KiloSat/FirstNivesh
0fe200e08bb9f7d89de91f59eb14448fa7b972b9
[ "MIT" ]
null
null
null
apps/technical_analysis.py
KiloSat/FirstNivesh
0fe200e08bb9f7d89de91f59eb14448fa7b972b9
[ "MIT" ]
null
null
null
apps/technical_analysis.py
KiloSat/FirstNivesh
0fe200e08bb9f7d89de91f59eb14448fa7b972b9
[ "MIT" ]
2
2021-04-03T16:39:23.000Z
2021-08-15T08:09:21.000Z
import streamlit as st def app(): import yfinance as yf import streamlit as st import datetime import matplotlib.pyplot as plt import talib import ta import numpy as np import matplotlib.ticker as mticker import pandas as pd import requests yf.pdr_override() st.write(""" # Technical Analysis of Securites Shown below are the **Moving Average Crossovers**, **Bollinger Bands**, **MACD's**, **Commodity Channel Indexes**, **Relative Strength Indexes** and **Extended Market Calculators** of any stock """) st.sidebar.header('User Input Parameters') today = datetime.date.today() def user_input_features(): ticker = st.sidebar.text_input("Ticker", 'GME') start_date = st.sidebar.text_input("Start Date", '2019-01-01') end_date = st.sidebar.text_input("End Date", f'{today}') return ticker, start_date, end_date symbol, start, end = user_input_features() def get_symbol(symbol): cticker = yf.Ticker(symbol) company_name = cticker.info['longName'] return company_name company_name = get_symbol(symbol.upper()) start = pd.to_datetime(start) end = pd.to_datetime(end) # Read data data = yf.download(symbol,start,end) # Adjusted Close Price st.header(f""" Adjusted Close Price\n {company_name} """) st.line_chart(data['Adj Close']) # ## SMA and EMA #Simple Moving Average data['SMA'] = talib.SMA(data['Adj Close'], timeperiod = 20) # Exponential Moving Average data['EMA'] = talib.EMA(data['Adj Close'], timeperiod = 20) # Plot st.header(f""" Simple Moving Average vs. Exponential Moving Average\n {company_name} """) st.line_chart(data[['Adj Close','SMA','EMA']]) # Bollinger Bands data['upper_band'], data['middle_band'], data['lower_band'] = talib.BBANDS(data['Adj Close'], timeperiod =20) # Plot st.header(f""" Bollinger Bands\n {company_name} """) st.line_chart(data[['Adj Close','upper_band','middle_band','lower_band']]) # ## MACD (Moving Average Convergence Divergence) # MACD data['macd'], data['macdsignal'], data['macdhist'] = talib.MACD(data['Adj Close'], fastperiod=12, slowperiod=26, signalperiod=9) # Plot st.header(f"""Moving Average Convergence Divergence\n {company_name}""") st.line_chart(data[['macd','macdsignal']]) ## CCI (Commodity Channel Index) # CCI cci = ta.trend.cci(data['High'], data['Low'], data['Close'], 31, 0.015) # Plot st.header(f"""Commodity Channel Index\n {company_name}""") st.line_chart(cci) # ## RSI (Relative Strength Index) # RSI data['RSI'] = talib.RSI(data['Adj Close'], timeperiod=14) # Plot st.header(f"""Relative Strength Index\n {company_name}""") st.line_chart(data['RSI']) # ## OBV (On Balance Volume) # OBV data['OBV'] = talib.OBV(data['Adj Close'], data['Volume'])/10**6 # Plot st.header(f"""On Balance Volume\n {company_name}""") st.line_chart(data['OBV']) # Extended Market fig, ax1 = plt.subplots() #Asks for stock ticker sma = 50 limit = 10 data = yf.download(symbol,start, today) #calculates sma and creates a column in the dataframe data['SMA'+str(sma)] = data.iloc[:,4].rolling(window=sma).mean() data['PC'] = ((data["Adj Close"]/data['SMA'+str(sma)])-1)*100 mean = round(data["PC"].mean(), 2) stdev = round(data["PC"].std(), 2) current= round(data["PC"][-1], 2) yday= round(data["PC"][-2], 2) stats = [['Mean', mean], ['Standard Deviation', stdev], ['Current', current], ['Yesterday', yday]] frame = pd.DataFrame(stats,columns = ['Statistic', 'Value']) st.header(f"""Extended Market Calculator\n {company_name}""") st.dataframe(frame.style.hide_index()) # fixed bin size bins = np.arange(-100, 100, 1) plt.rcParams['figure.figsize'] = 15, 10 plt.xlim([data["PC"].min()-5, data["PC"].max()+5]) plt.hist(data["PC"], bins=bins, alpha=0.5) plt.title(symbol+"-- % From "+str(sma)+" SMA Histogram since "+str(start.year)) plt.xlabel('Percent from '+str(sma)+' SMA (bin size = 1)') plt.ylabel('Count') plt.axvline( x=mean, ymin=0, ymax=1, color='k', linestyle='--') plt.axvline( x=stdev+mean, ymin=0, ymax=1, color='gray', alpha=1, linestyle='--') plt.axvline( x=2*stdev+mean, ymin=0, ymax=1, color='gray',alpha=.75, linestyle='--') plt.axvline( x=3*stdev+mean, ymin=0, ymax=1, color='gray', alpha=.5, linestyle='--') plt.axvline( x=-stdev+mean, ymin=0, ymax=1, color='gray', alpha=1, linestyle='--') plt.axvline( x=-2*stdev+mean, ymin=0, ymax=1, color='gray',alpha=.75, linestyle='--') plt.axvline( x=-3*stdev+mean, ymin=0, ymax=1, color='gray', alpha=.5, linestyle='--') plt.axvline( x=current, ymin=0, ymax=1, color='r', label = 'today') plt.axvline( x=yday, ymin=0, ymax=1, color='blue', label = 'yesterday') #add more x axis labels ax1.xaxis.set_major_locator(mticker.MaxNLocator(14)) st.pyplot(fig) #Create Plots fig2, ax2 = plt.subplots() data=data[-150:] data['PC'].plot(label='close',color='k') plt.title(symbol+"-- % From "+str(sma)+" SMA Over last 100 days") plt.xlabel('Date') plt.ylabel('Percent from '+str(sma)+' EMA') #add more x axis labels ax2.xaxis.set_major_locator(mticker.MaxNLocator(8)) plt.axhline( y=limit, xmin=0, xmax=1, color='r') plt.rcParams['figure.figsize'] = 15, 10 st.pyplot(fig2)
34.202381
197
0.603376
0
0
0
0
0
0
0
0
1,991
0.346502
bcbd7d0edc16eccd95b307b889e7f1a174b4d31c
4,642
py
Python
tests/sentry/mediators/sentry_apps/test_creator.py
pombredanne/django-sentry
4ad09417fb3cfa3aa4a0d4175ae49fe02837c567
[ "BSD-3-Clause" ]
null
null
null
tests/sentry/mediators/sentry_apps/test_creator.py
pombredanne/django-sentry
4ad09417fb3cfa3aa4a0d4175ae49fe02837c567
[ "BSD-3-Clause" ]
null
null
null
tests/sentry/mediators/sentry_apps/test_creator.py
pombredanne/django-sentry
4ad09417fb3cfa3aa4a0d4175ae49fe02837c567
[ "BSD-3-Clause" ]
null
null
null
from __future__ import absolute_import from mock import patch from django.db import IntegrityError from sentry.mediators.sentry_apps import Creator from sentry.models import ( AuditLogEntry, AuditLogEntryEvent, ApiApplication, IntegrationFeature, SentryApp, SentryAppComponent, User, ) from sentry.testutils import TestCase class TestCreator(TestCase): def setUp(self): self.user = self.create_user() self.org = self.create_organization(owner=self.user) self.creator = Creator( name="nulldb", user=self.user, author="Sentry", organization=self.org, scopes=("project:read",), webhook_url="http://example.com", schema={"elements": [self.create_issue_link_schema()]}, is_internal=False, ) def test_slug(self): app = self.creator.call() assert app.slug == "nulldb" def test_creates_proxy_user(self): self.creator.call() assert User.objects.get(username__contains="nulldb", is_sentry_app=True) def test_creates_api_application(self): self.creator.call() proxy = User.objects.get(username__contains="nulldb") assert ApiApplication.objects.get(owner=proxy) def test_creates_sentry_app(self): self.creator.call() proxy = User.objects.get(username__contains="nulldb") app = ApiApplication.objects.get(owner=proxy) sentry_app = SentryApp.objects.get( name="nulldb", application=app, owner=self.org, proxy_user=proxy ) assert sentry_app assert sentry_app.scope_list == ["project:read"] def test_expands_rolled_up_events(self): self.creator.events = ["issue"] app = self.creator.call() sentry_app = SentryApp.objects.get(id=app.id) assert "issue.created" in sentry_app.events def test_creates_ui_components(self): self.creator.schema = { "elements": [self.create_issue_link_schema(), self.create_alert_rule_action_schema()] } app = self.creator.call() assert SentryAppComponent.objects.filter(sentry_app_id=app.id, type="issue-link").exists() assert SentryAppComponent.objects.filter( sentry_app_id=app.id, type="alert-rule-action" ).exists() def test_creates_integration_feature(self): app = self.creator.call() assert IntegrationFeature.objects.filter(sentry_app=app).exists() @patch("sentry.mediators.sentry_apps.creator.Creator.log") @patch("sentry.models.integrationfeature.IntegrationFeature.objects.create") def test_raises_error_creating_integration_feature(self, mock_create, mock_log): mock_create.side_effect = IntegrityError() self.creator.call() mock_log.assert_called_with(sentry_app="nulldb", error_message="") def test_creates_audit_log_entry(self): request = self.make_request(user=self.user, method="GET") Creator.run( name="nulldb", user=self.user, author="Sentry", organization=self.org, scopes=("project:read",), webhook_url="http://example.com", schema={"elements": [self.create_issue_link_schema()]}, request=request, is_internal=False, ) assert AuditLogEntry.objects.filter(event=AuditLogEntryEvent.SENTRY_APP_ADD).exists() def test_blank_schema(self): self.creator.schema = "" assert self.creator.call() def test_none_schema(self): self.creator.schema = None assert self.creator.call() def test_schema_with_no_elements(self): self.creator.schema = {"elements": []} assert self.creator.call() @patch("sentry.analytics.record") def test_records_analytics(self, record): sentry_app = Creator.run( name="nulldb", user=self.user, author="Sentry", organization=self.org, scopes=("project:read",), webhook_url="http://example.com", schema={"elements": [self.create_issue_link_schema()]}, request=self.make_request(user=self.user, method="GET"), is_internal=False, ) record.assert_called_with( "sentry_app.created", user_id=self.user.id, organization_id=self.org.id, sentry_app=sentry_app.slug, ) def test_allows_name_that_exists_as_username_already(self): self.create_user(username="nulldb") assert self.creator.call()
32.013793
98
0.640888
4,285
0.923093
0
0
1,067
0.229858
0
0
500
0.107712
bcbdf778d11c4a8378ce0f01967703c04ca3e0b9
17,869
py
Python
python/Model_Files/LFV_3/parameters.py
ZAKI1905/HEP-Phen
bc06fecb2aa6bf108b59f76794e63c29eb37a35a
[ "MIT" ]
1
2019-10-21T08:25:46.000Z
2019-10-21T08:25:46.000Z
python/Model_Files/LFV_3/parameters.py
ZAKI1905/HEP-Phen
bc06fecb2aa6bf108b59f76794e63c29eb37a35a
[ "MIT" ]
null
null
null
python/Model_Files/LFV_3/parameters.py
ZAKI1905/HEP-Phen
bc06fecb2aa6bf108b59f76794e63c29eb37a35a
[ "MIT" ]
null
null
null
# This file was automatically created by FeynRules 2.3.32 # Mathematica version: 11.3.0 for Mac OS X x86 (64-bit) (March 7, 2018) # Date: Sat 21 Apr 2018 20:48:39 from object_library import all_parameters, Parameter from function_library import complexconjugate, re, im, csc, sec, acsc, asec, cot # This is a default parameter object representing 0. ZERO = Parameter(name = 'ZERO', nature = 'internal', type = 'real', value = '0.0', texname = '0') # User-defined parameters. cabi = Parameter(name = 'cabi', nature = 'external', type = 'real', value = 0.227736, texname = '\\theta _c', lhablock = 'CKMBLOCK', lhacode = [ 1 ]) aEWM1 = Parameter(name = 'aEWM1', nature = 'external', type = 'real', value = 127.9, texname = '\\text{aEWM1}', lhablock = 'SMINPUTS', lhacode = [ 1 ]) Gf = Parameter(name = 'Gf', nature = 'external', type = 'real', value = 0.0000116637, texname = 'G_f', lhablock = 'SMINPUTS', lhacode = [ 2 ]) aS = Parameter(name = 'aS', nature = 'external', type = 'real', value = 0.1184, texname = '\\alpha _s', lhablock = 'SMINPUTS', lhacode = [ 3 ]) ymdo = Parameter(name = 'ymdo', nature = 'external', type = 'real', value = 0.00504, texname = '\\text{ymdo}', lhablock = 'YUKAWA', lhacode = [ 1 ]) ymup = Parameter(name = 'ymup', nature = 'external', type = 'real', value = 0.00255, texname = '\\text{ymup}', lhablock = 'YUKAWA', lhacode = [ 2 ]) yms = Parameter(name = 'yms', nature = 'external', type = 'real', value = 0.101, texname = '\\text{yms}', lhablock = 'YUKAWA', lhacode = [ 3 ]) ymc = Parameter(name = 'ymc', nature = 'external', type = 'real', value = 1.27, texname = '\\text{ymc}', lhablock = 'YUKAWA', lhacode = [ 4 ]) ymb = Parameter(name = 'ymb', nature = 'external', type = 'real', value = 4.7, texname = '\\text{ymb}', lhablock = 'YUKAWA', lhacode = [ 5 ]) ymt = Parameter(name = 'ymt', nature = 'external', type = 'real', value = 172, texname = '\\text{ymt}', lhablock = 'YUKAWA', lhacode = [ 6 ]) yme = Parameter(name = 'yme', nature = 'external', type = 'real', value = 0.000511, texname = '\\text{yme}', lhablock = 'YUKAWA', lhacode = [ 11 ]) ymm = Parameter(name = 'ymm', nature = 'external', type = 'real', value = 0.10566, texname = '\\text{ymm}', lhablock = 'YUKAWA', lhacode = [ 13 ]) ymtau = Parameter(name = 'ymtau', nature = 'external', type = 'real', value = 1.777, texname = '\\text{ymtau}', lhablock = 'YUKAWA', lhacode = [ 15 ]) kq = Parameter(name = 'kq', nature = 'external', type = 'real', value = 0.001, texname = 'k_q', lhablock = 'FRBlock', lhacode = [ 1 ]) lamf = Parameter(name = 'lamf', nature = 'external', type = 'real', value = 0.1, texname = 'l_{\\text{fi}}', lhablock = 'FRBlock', lhacode = [ 2 ]) yf1x1 = Parameter(name = 'yf1x1', nature = 'external', type = 'complex', value = 0, texname = '\\text{yf1x1}', lhablock = 'FRBlock6', lhacode = [ 1, 1 ]) yf1x2 = Parameter(name = 'yf1x2', nature = 'external', type = 'complex', value = 0, texname = '\\text{yf1x2}', lhablock = 'FRBlock6', lhacode = [ 1, 2 ]) yf1x3 = Parameter(name = 'yf1x3', nature = 'external', type = 'complex', value = 0, texname = '\\text{yf1x3}', lhablock = 'FRBlock6', lhacode = [ 1, 3 ]) yf2x1 = Parameter(name = 'yf2x1', nature = 'external', type = 'complex', value = 0, texname = '\\text{yf2x1}', lhablock = 'FRBlock6', lhacode = [ 2, 1 ]) yf2x2 = Parameter(name = 'yf2x2', nature = 'external', type = 'complex', value = 0, texname = '\\text{yf2x2}', lhablock = 'FRBlock6', lhacode = [ 2, 2 ]) yf2x3 = Parameter(name = 'yf2x3', nature = 'external', type = 'complex', value = 1.e-6, texname = '\\text{yf2x3}', lhablock = 'FRBlock6', lhacode = [ 2, 3 ]) yf3x1 = Parameter(name = 'yf3x1', nature = 'external', type = 'complex', value = 0, texname = '\\text{yf3x1}', lhablock = 'FRBlock6', lhacode = [ 3, 1 ]) yf3x2 = Parameter(name = 'yf3x2', nature = 'external', type = 'complex', value = 0, texname = '\\text{yf3x2}', lhablock = 'FRBlock6', lhacode = [ 3, 2 ]) yf3x3 = Parameter(name = 'yf3x3', nature = 'external', type = 'complex', value = 0, texname = '\\text{yf3x3}', lhablock = 'FRBlock6', lhacode = [ 3, 3 ]) MZ = Parameter(name = 'MZ', nature = 'external', type = 'real', value = 91.1876, texname = '\\text{MZ}', lhablock = 'MASS', lhacode = [ 23 ]) Me = Parameter(name = 'Me', nature = 'external', type = 'real', value = 0.000511, texname = '\\text{Me}', lhablock = 'MASS', lhacode = [ 11 ]) MMU = Parameter(name = 'MMU', nature = 'external', type = 'real', value = 0.10566, texname = '\\text{MMU}', lhablock = 'MASS', lhacode = [ 13 ]) MTA = Parameter(name = 'MTA', nature = 'external', type = 'real', value = 1.777, texname = '\\text{MTA}', lhablock = 'MASS', lhacode = [ 15 ]) MU = Parameter(name = 'MU', nature = 'external', type = 'real', value = 0.00255, texname = 'M', lhablock = 'MASS', lhacode = [ 2 ]) MC = Parameter(name = 'MC', nature = 'external', type = 'real', value = 1.27, texname = '\\text{MC}', lhablock = 'MASS', lhacode = [ 4 ]) MT = Parameter(name = 'MT', nature = 'external', type = 'real', value = 172, texname = '\\text{MT}', lhablock = 'MASS', lhacode = [ 6 ]) MD = Parameter(name = 'MD', nature = 'external', type = 'real', value = 0.00504, texname = '\\text{MD}', lhablock = 'MASS', lhacode = [ 1 ]) MS = Parameter(name = 'MS', nature = 'external', type = 'real', value = 0.101, texname = '\\text{MS}', lhablock = 'MASS', lhacode = [ 3 ]) MB = Parameter(name = 'MB', nature = 'external', type = 'real', value = 4.7, texname = '\\text{MB}', lhablock = 'MASS', lhacode = [ 5 ]) MH = Parameter(name = 'MH', nature = 'external', type = 'real', value = 125, texname = '\\text{MH}', lhablock = 'MASS', lhacode = [ 25 ]) MP = Parameter(name = 'MP', nature = 'external', type = 'real', value = 120, texname = '\\text{MP}', lhablock = 'MASS', lhacode = [ 9000005 ]) Mfi = Parameter(name = 'Mfi', nature = 'external', type = 'real', value = 10, texname = '\\text{Mfi}', lhablock = 'MASS', lhacode = [ 9000006 ]) WZ = Parameter(name = 'WZ', nature = 'external', type = 'real', value = 2.4952, texname = '\\text{WZ}', lhablock = 'DECAY', lhacode = [ 23 ]) WW = Parameter(name = 'WW', nature = 'external', type = 'real', value = 2.085, texname = '\\text{WW}', lhablock = 'DECAY', lhacode = [ 24 ]) WT = Parameter(name = 'WT', nature = 'external', type = 'real', value = 1.50833649, texname = '\\text{WT}', lhablock = 'DECAY', lhacode = [ 6 ]) WH = Parameter(name = 'WH', nature = 'external', type = 'real', value = 0.00589569, texname = '\\text{WH}', lhablock = 'DECAY', lhacode = [ 25 ]) WH1 = Parameter(name = 'WH1', nature = 'external', type = 'real', value = 0.00575308848, texname = '\\text{WH1}', lhablock = 'DECAY', lhacode = [ 9000005 ]) Wfi = Parameter(name = 'Wfi', nature = 'external', type = 'real', value = 6.03044e-9, texname = '\\text{Wfi}', lhablock = 'DECAY', lhacode = [ 9000006 ]) aEW = Parameter(name = 'aEW', nature = 'internal', type = 'real', value = '1/aEWM1', texname = '\\alpha _{\\text{EW}}') G = Parameter(name = 'G', nature = 'internal', type = 'real', value = '2*cmath.sqrt(aS)*cmath.sqrt(cmath.pi)', texname = 'G') CKM1x1 = Parameter(name = 'CKM1x1', nature = 'internal', type = 'complex', value = 'cmath.cos(cabi)', texname = '\\text{CKM1x1}') CKM1x2 = Parameter(name = 'CKM1x2', nature = 'internal', type = 'complex', value = 'cmath.sin(cabi)', texname = '\\text{CKM1x2}') CKM1x3 = Parameter(name = 'CKM1x3', nature = 'internal', type = 'complex', value = '0', texname = '\\text{CKM1x3}') CKM2x1 = Parameter(name = 'CKM2x1', nature = 'internal', type = 'complex', value = '-cmath.sin(cabi)', texname = '\\text{CKM2x1}') CKM2x2 = Parameter(name = 'CKM2x2', nature = 'internal', type = 'complex', value = 'cmath.cos(cabi)', texname = '\\text{CKM2x2}') CKM2x3 = Parameter(name = 'CKM2x3', nature = 'internal', type = 'complex', value = '0', texname = '\\text{CKM2x3}') CKM3x1 = Parameter(name = 'CKM3x1', nature = 'internal', type = 'complex', value = '0', texname = '\\text{CKM3x1}') CKM3x2 = Parameter(name = 'CKM3x2', nature = 'internal', type = 'complex', value = '0', texname = '\\text{CKM3x2}') CKM3x3 = Parameter(name = 'CKM3x3', nature = 'internal', type = 'complex', value = '1', texname = '\\text{CKM3x3}') MW = Parameter(name = 'MW', nature = 'internal', type = 'real', value = 'cmath.sqrt(MZ**2/2. + cmath.sqrt(MZ**4/4. - (aEW*cmath.pi*MZ**2)/(Gf*cmath.sqrt(2))))', texname = 'M_W') ee = Parameter(name = 'ee', nature = 'internal', type = 'real', value = '2*cmath.sqrt(aEW)*cmath.sqrt(cmath.pi)', texname = 'e') sw2 = Parameter(name = 'sw2', nature = 'internal', type = 'real', value = '1 - MW**2/MZ**2', texname = '\\text{sw2}') cw = Parameter(name = 'cw', nature = 'internal', type = 'real', value = 'cmath.sqrt(1 - sw2)', texname = 'c_w') sw = Parameter(name = 'sw', nature = 'internal', type = 'real', value = 'cmath.sqrt(sw2)', texname = 's_w') g1 = Parameter(name = 'g1', nature = 'internal', type = 'real', value = 'ee/cw', texname = 'g_1') gw = Parameter(name = 'gw', nature = 'internal', type = 'real', value = 'ee/sw', texname = 'g_w') vev = Parameter(name = 'vev', nature = 'internal', type = 'real', value = '(2*MW*sw)/ee', texname = '\\text{vev}') mfi = Parameter(name = 'mfi', nature = 'internal', type = 'real', value = 'cmath.sqrt(100 - (kq*vev**2)/2.)', texname = 'M_{\\text{fi}}') AH = Parameter(name = 'AH', nature = 'internal', type = 'real', value = '(47*ee**2*(1 - (2*MH**4)/(987.*MT**4) - (14*MH**2)/(705.*MT**2) + (213*MH**12)/(2.634632e7*MW**12) + (5*MH**10)/(119756.*MW**10) + (41*MH**8)/(180950.*MW**8) + (87*MH**6)/(65800.*MW**6) + (57*MH**4)/(6580.*MW**4) + (33*MH**2)/(470.*MW**2)))/(72.*cmath.pi**2*vev)', texname = 'A_H') GH = Parameter(name = 'GH', nature = 'internal', type = 'real', value = '-(G**2*(1 + (13*MH**6)/(16800.*MT**6) + MH**4/(168.*MT**4) + (7*MH**2)/(120.*MT**2)))/(12.*cmath.pi**2*vev)', texname = 'G_H') Gphi = Parameter(name = 'Gphi', nature = 'internal', type = 'real', value = '-(G**2*(1 + MH**6/(560.*MT**6) + MH**4/(90.*MT**4) + MH**2/(12.*MT**2)))/(8.*cmath.pi**2*vev)', texname = 'G_h') lam = Parameter(name = 'lam', nature = 'internal', type = 'real', value = 'MH**2/(2.*vev**2)', texname = '\\text{lam}') yb = Parameter(name = 'yb', nature = 'internal', type = 'real', value = '(ymb*cmath.sqrt(2))/vev', texname = '\\text{yb}') yc = Parameter(name = 'yc', nature = 'internal', type = 'real', value = '(ymc*cmath.sqrt(2))/vev', texname = '\\text{yc}') ydo = Parameter(name = 'ydo', nature = 'internal', type = 'real', value = '(ymdo*cmath.sqrt(2))/vev', texname = '\\text{ydo}') ye = Parameter(name = 'ye', nature = 'internal', type = 'real', value = '(yme*cmath.sqrt(2))/vev', texname = '\\text{ye}') ym = Parameter(name = 'ym', nature = 'internal', type = 'real', value = '(ymm*cmath.sqrt(2))/vev', texname = '\\text{ym}') ys = Parameter(name = 'ys', nature = 'internal', type = 'real', value = '(yms*cmath.sqrt(2))/vev', texname = '\\text{ys}') yt = Parameter(name = 'yt', nature = 'internal', type = 'real', value = '(ymt*cmath.sqrt(2))/vev', texname = '\\text{yt}') ytau = Parameter(name = 'ytau', nature = 'internal', type = 'real', value = '(ymtau*cmath.sqrt(2))/vev', texname = '\\text{ytau}') yup = Parameter(name = 'yup', nature = 'internal', type = 'real', value = '(ymup*cmath.sqrt(2))/vev', texname = '\\text{yup}') muH = Parameter(name = 'muH', nature = 'internal', type = 'real', value = 'cmath.sqrt(lam*vev**2)', texname = '\\mu')
31.459507
288
0.38245
0
0
0
0
0
0
0
0
4,348
0.243326
bcbef8c15ce4fa1656c062f45eb901b87f935220
1,828
py
Python
musicLrc.py
xiangxing98/Rhythm-Enlightment
d6302321e858d07480b18e94c59de87f91c39202
[ "MIT" ]
null
null
null
musicLrc.py
xiangxing98/Rhythm-Enlightment
d6302321e858d07480b18e94c59de87f91c39202
[ "MIT" ]
null
null
null
musicLrc.py
xiangxing98/Rhythm-Enlightment
d6302321e858d07480b18e94c59de87f91c39202
[ "MIT" ]
null
null
null
import time musicLrc = """ [00:03.50]传奇 [00:19.10]作词:刘兵 作曲:李健 [00:20.60]演唱:王菲 [00:26.60] [04:40.75][02:39.90][00:36.25]只是因为在人群中多看了你一眼 [04:49.00] [02:47.44][00:43.69]再也没能忘掉你容颜 [02:54.83][00:51.24]梦想着偶然能有一天再相见 [03:02.32][00:58.75]从此我开始孤单思念 [03:08.15][01:04.30] [03:09.35][01:05.50]想你时你在天边 [03:16.90][01:13.13]想你时你在眼前 [03:24.42][01:20.92]想你时你在脑海 [03:31.85][01:28.44]想你时你在心田 [03:38.67][01:35.05] [04:09.96][03:39.87][01:36.25]宁愿相信我们前世有约 [04:16.37][03:46.38][01:42.47]今生的爱情故事 不会再改变 [04:24.82][03:54.83][01:51.18]宁愿用这一生等你发现 [04:31.38][04:01.40][01:57.43]我一直在你身旁 从未走远 [04:39.55][04:09.00][02:07.85] """ lrcDict = {} musicLrcList = musicLrc.splitlines() #print(musicLrcList) for lrcLine in musicLrcList: #[04:40.75][02:39.90][00:36.25]只是因为在人群中多看了你一眼 #[04:40.75 [02:39.90 [00:36.25 只是因为在人群中多看了你一眼 #[00:20.60]演唱:王菲 lrcLineList = lrcLine.split("]") for index in range(len(lrcLineList) - 1): timeStr = lrcLineList[index][1:] #print(timeStr) #00:03.50 timeList = timeStr.split(":") timelrc = float(timeList[0]) * 60 + float(timeList[1]) #print(time) lrcDict[timelrc] = lrcLineList[-1] print(lrcDict) allTimeList = [] for t in lrcDict: allTimeList.append(t) allTimeList.sort() #print(allTimeList) ''' while 1: getTime = float(input("请输入一个时间")) for n in range(len(allTimeList)): tempTime = allTimeList[n] if getTime < tempTime: break if n == 0: print("时间太小") else: print(lrcDict[allTimeList[n - 1]]) ''' getTime = 0 while 1: for n in range(len(allTimeList)): tempTime = allTimeList[n] if getTime < tempTime: break lrc = lrcDict.get(allTimeList[n - 1]) if lrc == None: pass else: print(lrc) time.sleep(1) getTime += 1
22.292683
62
0.605033
0
0
0
0
0
0
0
0
1,385
0.635321
bcbfd5dadc46bd5eab08a4b4f4c45a601d0075b6
16,826
py
Python
octoprint_octopod/__init__.py
mnebelung/OctoPrint-OctoPod
3af1a2e1ad7c6f73ed05d9c1ff029fb645f3115a
[ "Apache-2.0" ]
52
2019-05-28T03:41:20.000Z
2022-01-29T00:32:57.000Z
octoprint_octopod/__init__.py
mnebelung/OctoPrint-OctoPod
3af1a2e1ad7c6f73ed05d9c1ff029fb645f3115a
[ "Apache-2.0" ]
111
2019-05-28T14:50:01.000Z
2022-03-21T22:12:05.000Z
octoprint_octopod/__init__.py
mnebelung/OctoPrint-OctoPod
3af1a2e1ad7c6f73ed05d9c1ff029fb645f3115a
[ "Apache-2.0" ]
11
2019-07-20T15:36:21.000Z
2021-12-30T16:53:56.000Z
# coding=utf-8 from __future__ import absolute_import import datetime import logging import sys import flask import octoprint.plugin from octoprint.events import eventManager, Events from octoprint.server import user_permission from octoprint.util import RepeatedTimer from .bed_notifications import BedNotifications from .custom_notifications import CustomNotifications from .ifttt_notifications import IFTTTAlerts from .job_notifications import JobNotifications from .layer_notifications import LayerNotifications from .libs.sbc import SBCFactory, SBC, RPi from .mmu import MMUAssistance from .palette2 import Palette2Notifications from .paused_for_user import PausedForUser from .soc_temp_notifications import SocTempNotifications from .thermal_protection_notifications import ThermalProtectionNotifications from .tools_notifications import ToolsNotifications # Plugin that stores APNS tokens reported from iOS devices to know which iOS devices to alert # when print is done or other relevant events debug_soc_temp = False class OctopodPlugin(octoprint.plugin.SettingsPlugin, octoprint.plugin.AssetPlugin, octoprint.plugin.TemplatePlugin, octoprint.plugin.StartupPlugin, octoprint.plugin.SimpleApiPlugin, octoprint.plugin.EventHandlerPlugin, octoprint.plugin.ProgressPlugin): def __init__(self): super(OctopodPlugin, self).__init__() self._logger = logging.getLogger("octoprint.plugins.octopod") self._checkTempTimer = None self._ifttt_alerts = IFTTTAlerts(self._logger) self._job_notifications = JobNotifications(self._logger, self._ifttt_alerts) self._tool_notifications = ToolsNotifications(self._logger, self._ifttt_alerts) self._bed_notifications = BedNotifications(self._logger, self._ifttt_alerts) self._mmu_assitance = MMUAssistance(self._logger, self._ifttt_alerts) self._paused_for_user = PausedForUser(self._logger, self._ifttt_alerts) self._palette2 = Palette2Notifications(self._logger, self._ifttt_alerts) self._layerNotifications = LayerNotifications(self._logger, self._ifttt_alerts) self._check_soc_temp_timer = None self._soc_timer_interval = 5.0 if debug_soc_temp else 30.0 self._soc_temp_notifications = SocTempNotifications(self._logger, self._ifttt_alerts, self._soc_timer_interval, debug_soc_temp) self._custom_notifications = CustomNotifications(self._logger) self._thermal_protection_notifications = ThermalProtectionNotifications(self._logger, self._ifttt_alerts) # StartupPlugin mixin def on_after_startup(self): self._logger.info("OctoPod loaded!") # Set logging level to what we have in the settings if self._settings.get_boolean(["debug_logging"]): self._logger.setLevel(logging.DEBUG) else: self._logger.setLevel(logging.INFO) # Register to listen for messages from other plugins self._plugin_manager.register_message_receiver(self.on_plugin_message) # Start timer that will check bed temperature and send notifications if needed self._restart_timer() # if running on linux then check soc temperature if sys.platform.startswith("linux") or debug_soc_temp: sbc = RPi(self._logger) if debug_soc_temp else SBCFactory().factory(self._logger) if sbc.is_supported: self._soc_temp_notifications.sbc = sbc sbc.debugMode = debug_soc_temp self._soc_temp_notifications.send_plugin_message = self.send_plugin_message self.start_soc_timer(self._soc_timer_interval) # SettingsPlugin mixin def get_settings_defaults(self): return dict( debug_logging=False, server_url='http://octopodprint.com/', camera_snapshot_url='http://localhost:8080/?action=snapshot', tokens=[], sound_notification='default', temp_interval=5, tool0_low=0, tool0_target_temp=False, bed_low=30, bed_target_temp_hold=10, mmu_interval=5, pause_interval=5, palette2_printing_error_codes=[103, 104, 111, 121], progress_type='50', # 0=disabled, 25=every 25%, 50=every 50%, 100=only when finished ifttt_key='', ifttt_name='', soc_temp_high=75, thermal_runway_threshold=10, thermal_threshold_minutes_frequency=10, thermal_cooldown_seconds_threshold=14, thermal_warmup_bed_seconds_threshold=19, thermal_warmup_hotend_seconds_threshold=39, thermal_warmup_chamber_seconds_threshold=19, thermal_below_target_threshold=5, webcam_flipH=False, webcam_flipV=False, webcam_rotate90=False, notify_first_X_layers=1, print_complete_delay_seconds=0 ) def on_settings_save(self, data): old_debug_logging = self._settings.get_boolean(["debug_logging"]) octoprint.plugin.SettingsPlugin.on_settings_save(self, data) new_debug_logging = self._settings.get_boolean(["debug_logging"]) if old_debug_logging != new_debug_logging: if new_debug_logging: self._logger.setLevel(logging.DEBUG) else: self._logger.setLevel(logging.INFO) def get_settings_version(self): return 13 def on_settings_migrate(self, target, current): if current is None or current == 1: # add the 2 new values included self._settings.set(['temp_interval'], self.get_settings_defaults()["temp_interval"]) self._settings.set(['bed_low'], self.get_settings_defaults()["bed_low"]) if current is None or current <= 2: self._settings.set(['bed_target_temp_hold'], self.get_settings_defaults()["bed_target_temp_hold"]) if current is None or current <= 3: self._settings.set(['mmu_interval'], self.get_settings_defaults()["mmu_interval"]) if current is None or current <= 4: self._settings.set(['pause_interval'], self.get_settings_defaults()["pause_interval"]) if current is None or current <= 5: self._settings.set(['tool0_low'], self.get_settings_defaults()["tool0_low"]) if current is None or current <= 6: self._settings.set(['palette2_printing_error_codes'], self.get_settings_defaults()["palette2_printing_error_codes"]) if current is None or current <= 7: self._settings.set(['progress_type'], self.get_settings_defaults()["progress_type"]) if current is None or current <= 8: self._settings.set(['ifttt_key'], self.get_settings_defaults()["ifttt_key"]) self._settings.set(['ifttt_name'], self.get_settings_defaults()["ifttt_name"]) if current is None or current <= 9: self._settings.set(['soc_temp_high'], self.get_settings_defaults()["soc_temp_high"]) self._settings.set(['webcam_flipH'], self._settings.global_get(["webcam", "flipH"])) self._settings.set(['webcam_flipV'], self._settings.global_get(["webcam", "flipV"])) self._settings.set(['webcam_rotate90'], self._settings.global_get(["webcam", "rotate90"])) if current is None or current <= 10: self._settings.set(['tool0_target_temp'], self.get_settings_defaults()["tool0_target_temp"]) if current is None or current <= 11: self._settings.set(['thermal_runway_threshold'], self.get_settings_defaults()["thermal_runway_threshold"]) self._settings.set(['thermal_threshold_minutes_frequency'], self.get_settings_defaults()["thermal_threshold_minutes_frequency"]) self._settings.set(['sound_notification'], self.get_settings_defaults()["sound_notification"]) if current is None or current <= 12: self._settings.set(['thermal_cooldown_seconds_threshold'], self.get_settings_defaults()["thermal_cooldown_seconds_threshold"]) self._settings.set(['thermal_below_target_threshold'], self.get_settings_defaults()["thermal_below_target_threshold"]) self._settings.set(['thermal_warmup_bed_seconds_threshold'], self.get_settings_defaults()["thermal_warmup_bed_seconds_threshold"]) self._settings.set(['thermal_warmup_hotend_seconds_threshold'], self.get_settings_defaults()["thermal_warmup_hotend_seconds_threshold"]) self._settings.set(['thermal_warmup_chamber_seconds_threshold'], self.get_settings_defaults()["thermal_warmup_chamber_seconds_threshold"]) if current is None or current <= 13: self._settings.set(['notify_first_X_layers'], self.get_settings_defaults()["notify_first_X_layers"]) # AssetPlugin mixin def get_assets(self): # Define your plugin's asset files to automatically include in the # core UI here. return dict( js=["js/octopod.js"], css=["css/octopod.css"], ) # ProgressPlugin # progress-hook def on_print_progress(self, storage, path, progress): # progress 0 - 100 self._job_notifications.on_print_progress(self._settings, progress) # EventHandlerPlugin mixin def on_event(self, event, payload): if event == Events.PRINTER_STATE_CHANGED: self._job_notifications.send__print_job_notification(self._settings, self._printer, payload) elif event == "DisplayLayerProgress_layerChanged": # Event sent from DisplayLayerProgress plugin when there was a detected layer changed self._layerNotifications.layer_changed(self._settings, payload["currentLayer"]) elif event == Events.PRINT_STARTED or event == Events.PRINT_DONE or event == Events.PRINT_CANCELLED \ or event == Events.PRINT_FAILED: # Reset layers for which we need to send a notification. Each new print job has its own self._layerNotifications.reset_layers() # SimpleApiPlugin mixin def update_token(self, old_token, new_token, device_name, printer_id, printer_name, language_code): self._logger.debug("Received tokens for %s." % device_name) existing_tokens = self._settings.get(["tokens"]) # Safety check in case a user manually modified config.yaml and left invalid JSON if existing_tokens is None: existing_tokens = [] found = False updated = False for token in existing_tokens: # Check if existing token has been updated if token["apnsToken"] == old_token and token["printerID"] == printer_id: if old_token != new_token: self._logger.debug("Updating token for %s." % device_name) # Token that exists needs to be updated with new token token["apnsToken"] = new_token token["date"] = datetime.datetime.now().strftime("%x %X") updated = True found = True elif token["apnsToken"] == new_token and token["printerID"] == printer_id: found = True if found: if printer_name is not None and ("printerName" not in token or token["printerName"] != printer_name): # Printer name in OctoPod has been updated token["printerName"] = printer_name token["date"] = datetime.datetime.now().strftime("%x %X") updated = True if language_code is not None and ( "languageCode" not in token or token["languageCode"] != language_code): # Language being used by OctoPod has been updated token["languageCode"] = language_code token["date"] = datetime.datetime.now().strftime("%x %X") updated = True break if not found: self._logger.debug("Adding token for %s." % device_name) # Token was not found so we need to add it existing_tokens.append( {'apnsToken': new_token, 'deviceName': device_name, 'date': datetime.datetime.now().strftime("%x %X"), 'printerID': printer_id, 'printerName': printer_name, 'languageCode': language_code}) updated = True if updated: # Save new settings self._settings.set(["tokens"], existing_tokens) self._settings.save() eventManager().fire(Events.SETTINGS_UPDATED) self._logger.debug("Tokens saved") def get_api_commands(self): return dict(updateToken=["oldToken", "newToken", "deviceName", "printerID"], test=[], snooze=["eventCode", "minutes"], addLayer=["layer"], removeLayer=["layer"], getLayers=[], getSoCTemps=[]) def on_api_command(self, command, data): if not user_permission.can(): return flask.make_response("Insufficient rights", 403) if command == 'updateToken': # Convert from ASCII to UTF-8 since some chars will fail otherwise (e.g. apostrophe) - Only for Python 2 if sys.version_info[0] == 2: data["deviceName"] = data["deviceName"].encode("utf-8") printer_name = data["printerName"] if 'printerName' in data else None language_code = data["languageCode"] if 'languageCode' in data else None self.update_token("{oldToken}".format(**data), "{newToken}".format(**data), "{deviceName}".format(**data), "{printerID}".format(**data), printer_name, language_code) elif command == 'test': payload = dict( state_id="OPERATIONAL", state_string="Operational" ) code = self._job_notifications.send__print_job_notification(self._settings, self._printer, payload, data["server_url"], data["camera_snapshot_url"], data["camera_flip_h"], data["camera_flip_v"], data["camera_rotate90"], True) return flask.jsonify(dict(code=code)) elif command == 'snooze': if data["eventCode"] == 'mmu-event': self._mmu_assitance.snooze(data["minutes"]) else: return flask.make_response("Snooze for unknown event", 400) elif command == 'addLayer': self._layerNotifications.add_layer(data["layer"]) elif command == 'removeLayer': self._layerNotifications.remove_layer(data["layer"]) elif command == 'getLayers': return flask.jsonify(dict(layers=self._layerNotifications.get_layers())) elif command == 'getSoCTemps': return flask.jsonify(self._soc_temp_notifications.get_soc_temps()) else: return flask.make_response("Unknown command", 400) # TemplatePlugin mixin def get_template_configs(self): return [ dict(type="settings", name="OctoPod Notifications", custom_bindings=True) ] # Softwareupdate hook def get_update_information(self): # Define the configuration for your plugin to use with the Software Update # Plugin here. See https://github.com/foosel/OctoPrint/wiki/Plugin:-Software-Update # for details. return dict( octopod=dict( displayName="OctoPod Plugin", displayVersion=self._plugin_version, # version check: github repository type="github_release", user="gdombiak", repo="OctoPrint-OctoPod", current=self._plugin_version, # update method: pip pip="https://github.com/gdombiak/OctoPrint-OctoPod/archive/{target_version}.zip" ) ) # Plugin messages def on_plugin_message(self, plugin, data, permissions=None): self._palette2.check_plugin_message(self._settings, plugin, data) def send_plugin_message(self, data): self._plugin_manager.send_plugin_message(self._identifier, data) # Timer functions def _restart_timer(self): # stop the timer if self._checkTempTimer: self._logger.debug(u"Stopping Timer...") self._checkTempTimer.cancel() self._checkTempTimer = None # start a new timer interval = self._settings.get_int(['temp_interval']) if interval: self._logger.debug(u"Starting Timer...") self._checkTempTimer = RepeatedTimer(interval, self.run_timer_job, None, None, True) self._checkTempTimer.start() def run_timer_job(self): self._bed_notifications.check_temps(self._settings, self._printer) self._tool_notifications.check_temps(self._settings, self._printer) self._thermal_protection_notifications.check_temps(self._settings, self._printer) def start_soc_timer(self, interval): self._logger.debug(u"Monitoring SoC temp with Timer") self._check_soc_temp_timer = RepeatedTimer(interval, self.update_soc_temp, run_first=True) self._check_soc_temp_timer.start() def update_soc_temp(self): self._soc_temp_notifications.check_soc_temp(self._settings) # GCODE hook def process_gcode(self, comm, line, *args, **kwargs): line = self._paused_for_user.process_gcode(self._settings, self._printer, line) return self._mmu_assitance.process_gcode(self._settings, line) # Helper functions def push_notification(self, message, image=None): """ Send arbitrary push notification to OctoPod app running on iPhone (includes Apple Watch and iPad) via the OctoPod APNS service. :param message: (String) Message to include in the notification :param image: Optional. (PIL Image) Image to include in the notification :return: True if the notification was successfully sent """ return self._custom_notifications.send_notification(self._settings, message, image) # If you want your plugin to be registered within OctoPrint under a different name than what you defined in setup.py # ("OctoPrint-PluginSkeleton"), you may define that here. Same goes for the other metadata derived from setup.py that # can be overwritten via __plugin_xyz__ control properties. See the documentation for that. __plugin_name__ = "OctoPod Plugin" __plugin_pythoncompat__ = ">=2.7,<4" def __plugin_load__(): global __plugin_implementation__ __plugin_implementation__ = OctopodPlugin() global __plugin_hooks__ __plugin_hooks__ = { "octoprint.plugin.softwareupdate.check_config": __plugin_implementation__.get_update_information, "octoprint.comm.protocol.gcode.received": __plugin_implementation__.process_gcode } global __plugin_helpers__ __plugin_helpers__ = { "apns_notification": __plugin_implementation__.push_notification }
39.683962
141
0.757934
14,930
0.887317
0
0
0
0
0
0
4,918
0.292286
bcc019e1e7277f852d55bb225dc74bb333185aa3
660
py
Python
tests/test_buffers.py
romanchyla/CSPatterns
d9627297aabce1ab648f4a4cdbe9882527add138
[ "MIT" ]
null
null
null
tests/test_buffers.py
romanchyla/CSPatterns
d9627297aabce1ab648f4a4cdbe9882527add138
[ "MIT" ]
null
null
null
tests/test_buffers.py
romanchyla/CSPatterns
d9627297aabce1ab648f4a4cdbe9882527add138
[ "MIT" ]
null
null
null
from cspatterns.datastructures import buffer def test_circular_buffer(): b = buffer.CircularBuffer(2, ['n']) assert len(b.next) == 2 assert b.n is None b = buffer.CircularBuffer.create(2, attrs=['n', 'fib']) curr = b out = [0, 1, ] curr.prev[-2].n = 0 curr.prev[-2].fib = 1 curr.prev[-1].n = 1 curr.prev[-1].fib = 1 # we are going to calculate fibonacci while curr.prev[-1].n < 12: curr.n = curr.prev[-1].n + 1 curr.fib = curr.prev[-1].fib + curr.prev[-2].fib out.append(curr.fib) curr = curr.next[1] assert out == [0, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233]
25.384615
66
0.551515
0
0
0
0
0
0
0
0
48
0.072727
bcc146cfb565fd0140a85d638082d12ef6686650
1,214
py
Python
plugins/redacted/migrations/0001_initial.py
2600box/harvest
57264c15a3fba693b4b58d0b6d4fbf4bd5453bbd
[ "Apache-2.0" ]
9
2019-03-26T14:50:00.000Z
2020-11-10T16:44:08.000Z
plugins/redacted/migrations/0001_initial.py
2600box/harvest
57264c15a3fba693b4b58d0b6d4fbf4bd5453bbd
[ "Apache-2.0" ]
22
2019-03-02T23:16:13.000Z
2022-02-27T10:36:36.000Z
plugins/redacted/migrations/0001_initial.py
2600box/harvest
57264c15a3fba693b4b58d0b6d4fbf4bd5453bbd
[ "Apache-2.0" ]
5
2019-04-24T00:51:30.000Z
2020-11-06T18:31:49.000Z
# Generated by Django 2.1.7 on 2019-02-17 14:50 from django.db import migrations, models class Migration(migrations.Migration): initial = True dependencies = [ ] operations = [ migrations.CreateModel( name='RedactedClientConfig', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('username', models.TextField()), ('password', models.TextField()), ('cookies', models.TextField(null=True)), ('authkey', models.TextField(null=True)), ('passkey', models.TextField(null=True)), ('last_login_failed', models.BooleanField(default=False)), ], ), migrations.CreateModel( name='RedactedThrottledRequest', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('datetime', models.DateTimeField()), ('url', models.CharField(max_length=2048)), ], options={ 'abstract': False, }, ), ]
31.947368
114
0.538715
1,121
0.923394
0
0
0
0
0
0
202
0.166392
bcc1d17c27a82c381571bf91c586033e374ec7d9
1,741
py
Python
code_examples/plotting_data/hexbin.py
ezcitron/BasemapTutorial
0db9248b430d39518bdfdb25d713145be4eb966a
[ "CC0-1.0" ]
99
2015-01-14T21:20:48.000Z
2022-01-25T10:38:37.000Z
code_examples/plotting_data/hexbin.py
ezcitron/BasemapTutorial
0db9248b430d39518bdfdb25d713145be4eb966a
[ "CC0-1.0" ]
1
2017-08-31T07:02:20.000Z
2017-08-31T07:02:20.000Z
code_examples/plotting_data/hexbin.py
ezcitron/BasemapTutorial
0db9248b430d39518bdfdb25d713145be4eb966a
[ "CC0-1.0" ]
68
2015-01-14T21:21:01.000Z
2022-01-29T14:53:38.000Z
from mpl_toolkits.basemap import Basemap import matplotlib.pyplot as plt import matplotlib.colors as colors from numpy import array from numpy import max map = Basemap(llcrnrlon=-0.5,llcrnrlat=39.8,urcrnrlon=4.,urcrnrlat=43., resolution='i', projection='tmerc', lat_0 = 39.5, lon_0 = 1) map.readshapefile('../sample_files/lightnings', 'lightnings') x = [] y = [] c = [] for info, lightning in zip(map.lightnings_info, map.lightnings): x.append(lightning[0]) y.append(lightning[1]) if float(info['amplitude']) < 0: c.append(-1 * float(info['amplitude'])) else: c.append(float(info['amplitude'])) plt.figure(0) map.drawcoastlines() map.readshapefile('../sample_files/comarques', 'comarques') map.hexbin(array(x), array(y)) map.colorbar(location='bottom') plt.figure(1) map.drawcoastlines() map.readshapefile('../sample_files/comarques', 'comarques') map.hexbin(array(x), array(y), gridsize=20, mincnt=1, cmap='summer', bins='log') map.colorbar(location='bottom', format='%.1f', label='log(# lightnings)') plt.figure(2) map.drawcoastlines() map.readshapefile('../sample_files/comarques', 'comarques') map.hexbin(array(x), array(y), gridsize=20, mincnt=1, cmap='summer', norm=colors.LogNorm()) cb = map.colorbar(location='bottom', format='%d', label='# lightnings') cb.set_ticks([1, 5, 10, 15, 20, 25, 30]) cb.set_ticklabels([1, 5, 10, 15, 20, 25, 30]) plt.figure(3) map.drawcoastlines() map.readshapefile('../sample_files/comarques', 'comarques') map.hexbin(array(x), array(y), C = array(c), reduce_C_function = max, gridsize=20, mincnt=1, cmap='YlOrBr', linewidths=0.5, edgecolors='k') map.colorbar(location='bottom', label='Mean amplitude (kA)') plt.show()
23.527027
139
0.687536
0
0
0
0
0
0
0
0
363
0.208501
bcc231c6648af0cd64b843faf63ad79a79b6853b
895
py
Python
src/plugins/sjsy.py
2443391447/nonebot2
c9fa0c44c130b8a1425b2b71105fa909232c37b0
[ "MIT" ]
1
2021-08-24T03:18:23.000Z
2021-08-24T03:18:23.000Z
src/plugins/sjsy.py
2443391447/nonebot2
c9fa0c44c130b8a1425b2b71105fa909232c37b0
[ "MIT" ]
null
null
null
src/plugins/sjsy.py
2443391447/nonebot2
c9fa0c44c130b8a1425b2b71105fa909232c37b0
[ "MIT" ]
1
2021-09-01T07:50:03.000Z
2021-09-01T07:50:03.000Z
from nonebot import on_keyword, on_command from nonebot.typing import T_State from nonebot.adapters.cqhttp import Message, Bot, Event # 这两个没用的别删 from nonebot.adapters.cqhttp.message import MessageSegment import requests from nonebot.permission import * from nonebot.rule import to_me from aiocqhttp.exceptions import Error as CQHttpError sheying = on_keyword({'随机摄影'}) @sheying.handle() async def main(bot: Bot, event: Event, state: T_State): msg = await downloads() try: await sheying.send(message=Message(msg)) except CQHttpError: pass async def downloads(): url = "https://yanghanwen.xyz/tu/ren.php" resp = requests.get(url).json() url_ing = resp['data'] xians = f"[CQ:image,file={url_ing}]" return xians # await xians.send("正在爬取图片,请稍后……") # await xians.send(MessageSegment.at(id) + xians + "精选摄影")
28.870968
68
0.689385
0
0
0
0
202
0.212408
517
0.543638
235
0.247108
bcc3dcd13da8bfacff9f3f45c797b5dd285e8744
4,031
py
Python
src/extractors/emojiextractor.py
chmduquesne/rofimoji
9abdc0a8db1b166bb30da994c4aadb7baf91df2d
[ "MIT" ]
574
2017-10-29T18:04:31.000Z
2022-03-30T23:34:34.000Z
src/extractors/emojiextractor.py
chmduquesne/rofimoji
9abdc0a8db1b166bb30da994c4aadb7baf91df2d
[ "MIT" ]
104
2017-11-02T08:24:29.000Z
2022-03-29T02:39:58.000Z
src/extractors/emojiextractor.py
chmduquesne/rofimoji
9abdc0a8db1b166bb30da994c4aadb7baf91df2d
[ "MIT" ]
53
2017-11-01T22:38:02.000Z
2022-02-14T09:20:36.000Z
import html from collections import namedtuple from pathlib import Path from typing import List, Dict import requests from bs4 import BeautifulSoup from lxml import etree from lxml.etree import XPath Emoji = namedtuple('Emoji', 'char name') class EmojiExtractor(object): def __init__(self): self.all_emojis = self.fetch_emoji_list() self.annotations = self.fetch_annotations() self.base_emojis = self.fetch_base_emojis() def fetch_emoji_list(self: 'EmojiExtractor') -> List[Emoji]: print('Downloading list of all emojis') data = requests.get( 'https://unicode.org/emoji/charts-14.0/full-emoji-list.html', timeout=120 ) # type: requests.Response html = BeautifulSoup(data.text, 'lxml') emojis = [] for row in html.find('table').find_all('tr'): if not row.th: emoji = row.find('td', {'class': 'chars'}).string description = row.find('td', {'class': 'name'}).string.replace('⊛ ', '') emojis.append(Emoji(emoji, description)) return emojis def fetch_annotations(self: 'EmojiExtractor') -> Dict[chr, List[str]]: print('Downloading annotations') data = requests.get( 'https://raw.githubusercontent.com/unicode-org/cldr/latest/common/annotations/en.xml', timeout=60 ) # type: requests.Response xpath = XPath('./annotations/annotation[not(@type="tts")]') return {element.get('cp'): element.text.split(' | ') for element in xpath(etree.fromstring(data.content))} def fetch_base_emojis(self: 'EmojiExtractor') -> List[chr]: print('Downloading list of human emojis...') data = requests.get( 'https://unicode.org/Public/14.0.0/ucd/emoji/emoji-data.txt', timeout=60 ) # type: requests.Response started = False emojis = [] for line in data.text.split('\n'): if not started and line != '# All omitted code points have Emoji_Modifier_Base=No ': continue started = True if line == '# Total elements: 132': break if line and not line.startswith('#'): emojis.extend(self.resolve_character_range(line.split(';')[0].strip())) return emojis def resolve_character_range(self, line: str) -> List[str]: try: (start, end) = line.split('..') return [chr(char) for char in range(int(start, 16), int(end, 16) + 1)] except ValueError: return [self.resolve_character(line)] def resolve_character(self, string: str) -> str: return "".join(chr(int(character, 16)) for character in string.split(' ')) def write_symbol_file(self: 'EmojiExtractor'): print('Writing collected emojis to symbol file') with Path('../picker/data/emojis.csv').open('w') as symbol_file: for entry in self.compile_entries(self.all_emojis): symbol_file.write(entry + "\n") def compile_entries(self: 'EmojiExtractor', emojis: List[Emoji]) -> List[str]: annotated_emojis = [] for emoji in emojis: entry = f"{emoji.char} {html.escape(emoji.name)}" if emoji.char in self.annotations: entry += f" <small>({html.escape(', '.join([annotation for annotation in self.annotations[emoji.char] if annotation != emoji.name]))})</small>" annotated_emojis.append(entry) return annotated_emojis def write_metadata_file(self: 'EmojiExtractor'): print('Writing metadata to metadata file') with Path('../picker/copyme.py').open('w') as metadata_file: metadata_file.write('skin_tone_selectable_emojis={\'') metadata_file.write('\', \''.join(self.base_emojis)) metadata_file.write('\'}\n') def extract(self: 'EmojiExtractor'): self.write_symbol_file() self.write_metadata_file()
37.324074
159
0.607045
3,787
0.939003
0
0
0
0
0
0
1,072
0.265807
bcc4fcfb44a442a2523238a8484bf80417464006
5,084
py
Python
tests/integration_tests/security/test_seccomp.py
gregbdunn/firecracker
e7bc0a1f9b70deaa7bfd9eb641e0c7982fe63e68
[ "Apache-2.0" ]
2
2018-12-20T05:40:43.000Z
2018-12-20T05:59:58.000Z
tests/integration_tests/security/test_seccomp.py
gregbdunn/firecracker
e7bc0a1f9b70deaa7bfd9eb641e0c7982fe63e68
[ "Apache-2.0" ]
null
null
null
tests/integration_tests/security/test_seccomp.py
gregbdunn/firecracker
e7bc0a1f9b70deaa7bfd9eb641e0c7982fe63e68
[ "Apache-2.0" ]
1
2018-11-27T08:50:51.000Z
2018-11-27T08:50:51.000Z
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 """Tests that the seccomp filters don't let blacklisted syscalls through.""" import os from subprocess import run import pytest import host_tools.cargo_build as host # pylint:disable=import-error @pytest.fixture def tmp_basic_jailer(test_session_root_path): """Build `demo_basic_jailer`, required for the basic seccomp tests. :return: The paths of the built binary. """ binaries_srcdir = os.path.normpath( os.path.join( os.getcwd(), 'integration_tests/security/demo_advanced_seccomp/' ) ) build_path = os.path.join( test_session_root_path, host.CARGO_RELEASE_REL_PATH ) run("cd {} && CARGO_TARGET_DIR={} cargo build --release".format( binaries_srcdir, build_path), shell=True, check=True) release_binaries_path = os.path.join( host.CARGO_RELEASE_REL_PATH, host.RELEASE_BINARIES_REL_PATH ) release_binaries_path = os.path.join( test_session_root_path, release_binaries_path ) demo_basic_jailer = os.path.normpath( os.path.join( release_binaries_path, 'demo_basic_jailer' ) ) yield demo_basic_jailer os.remove(demo_basic_jailer) @pytest.fixture def tmp_advanced_seccomp_binaries(test_session_root_path): """ Build binaries required for the advanced seccomp tests. Build `demo_advanced_jailer`, `demo_harmless_firecracker`, and `demo_malicious_firecracker. :return: The paths of the built binaries. """ binaries_srcdir = os.path.normpath( os.path.join( os.getcwd(), 'integration_tests/security/demo_advanced_seccomp/' ) ) build_path = os.path.join( test_session_root_path, host.CARGO_RELEASE_REL_PATH ) run("cd {} && CARGO_TARGET_DIR={} cargo build --release".format( binaries_srcdir, build_path), shell=True, check=True) release_binaries_path = os.path.join( host.CARGO_RELEASE_REL_PATH, host.RELEASE_BINARIES_REL_PATH ) release_binaries_path = os.path.join( test_session_root_path, release_binaries_path ) demo_advanced_jailer = os.path.normpath( os.path.join( release_binaries_path, 'demo_advanced_jailer' ) ) demo_harmless_firecracker = os.path.normpath( os.path.join( release_binaries_path, 'demo_harmless_firecracker' ) ) demo_malicious_firecracker = os.path.normpath( os.path.join( release_binaries_path, 'demo_malicious_firecracker' ) ) yield \ demo_advanced_jailer, \ demo_harmless_firecracker, \ demo_malicious_firecracker os.remove(demo_advanced_jailer) os.remove(demo_harmless_firecracker) os.remove(demo_malicious_firecracker) def test_seccomp_ls(tmp_basic_jailer): """Assert that the seccomp filters deny a blacklisted syscall.""" # pylint: disable=redefined-outer-name # The fixture pattern causes a pylint false positive for that rule. # Path to the `ls` binary, which attempts to execute `SYS_access`, # blacklisted for Firecracker. ls_command_path = '/bin/ls' demo_jailer = tmp_basic_jailer assert os.path.exists(demo_jailer) # Compile the mini jailer. outcome = run([demo_jailer, ls_command_path]) # The seccomp filters should send SIGSYS (31) to the binary. `ls` doesn't # handle it, so it will exit with error. assert outcome.returncode != 0 def test_advanced_seccomp_harmless(tmp_advanced_seccomp_binaries): """ Test `demo_harmless_firecracker`. Test that the built demo jailer allows the built demo harmless firecracker. """ # pylint: disable=redefined-outer-name # The fixture pattern causes a pylint false positive for that rule. demo_advanced_jailer, demo_harmless_firecracker, _ =\ tmp_advanced_seccomp_binaries assert os.path.exists(demo_advanced_jailer) assert os.path.exists(demo_harmless_firecracker) outcome = run([demo_advanced_jailer, demo_harmless_firecracker]) # The demo harmless firecracker should have terminated gracefully. assert outcome.returncode == 0 def test_advanced_seccomp_malicious(tmp_advanced_seccomp_binaries): """ Test `demo_malicious_firecracker`. Test that the built demo jailer denies the built demo malicious firecracker. """ # pylint: disable=redefined-outer-name # The fixture pattern causes a pylint false positive for that rule. demo_advanced_jailer, _, demo_malicious_firecracker =\ tmp_advanced_seccomp_binaries assert os.path.exists(demo_advanced_jailer) assert os.path.exists(demo_malicious_firecracker) outcome = run([demo_advanced_jailer, demo_malicious_firecracker]) # The demo malicious firecracker should have received `SIGSYS`. assert outcome.returncode != 0
29.387283
79
0.696302
0
0
2,655
0.522227
2,687
0.528521
0
0
1,874
0.368607
bcc54625026e4e77ba54fe67d05a342fde131c90
185
py
Python
cluster/density/test.py
michealowen/MachingLearning
9dcc908f2d3e468390e5abb7f051b449b0ecb455
[ "Apache-2.0" ]
2
2019-09-11T07:02:25.000Z
2020-12-17T10:40:02.000Z
cluster/density/test.py
michealowen/MachingLearning
9dcc908f2d3e468390e5abb7f051b449b0ecb455
[ "Apache-2.0" ]
null
null
null
cluster/density/test.py
michealowen/MachingLearning
9dcc908f2d3e468390e5abb7f051b449b0ecb455
[ "Apache-2.0" ]
null
null
null
class a: def __init__(self,da): self.da = da return def go(self): dd() return None def dd(): print('ok') return None aa = a(1) aa.go()
12.333333
26
0.475676
123
0.664865
0
0
0
0
0
0
4
0.021622
bcc5a1b4f97e4fd31b1d8727fc7f8a5dcff9e43e
566,013
py
Python
REM/Tool/IDA 7.3/python/ida_hexrays.py
dodieboy/Np_class
af9ec993eda3c1e2bf70257c8384696bb64a5e9d
[ "MIT" ]
null
null
null
REM/Tool/IDA 7.3/python/ida_hexrays.py
dodieboy/Np_class
af9ec993eda3c1e2bf70257c8384696bb64a5e9d
[ "MIT" ]
null
null
null
REM/Tool/IDA 7.3/python/ida_hexrays.py
dodieboy/Np_class
af9ec993eda3c1e2bf70257c8384696bb64a5e9d
[ "MIT" ]
2
2021-03-30T00:46:58.000Z
2021-12-12T23:41:12.000Z
# This file was automatically generated by SWIG (http://www.swig.org). # Version 2.0.12 # # Do not make changes to this file unless you know what you are doing--modify # the SWIG interface file instead. """ IDA Plugin SDK API wrapper: hexrays """ from sys import version_info if version_info >= (2,6,0): def swig_import_helper(): from os.path import dirname import imp fp = None try: fp, pathname, description = imp.find_module('_ida_hexrays', [dirname(__file__)]) except ImportError: import _ida_hexrays return _ida_hexrays if fp is not None: try: _mod = imp.load_module('_ida_hexrays', fp, pathname, description) finally: fp.close() return _mod _ida_hexrays = swig_import_helper() del swig_import_helper else: import _ida_hexrays del version_info try: _swig_property = property except NameError: pass # Python < 2.2 doesn't have 'property'. def _swig_setattr_nondynamic(self,class_type,name,value,static=1): if (name == "thisown"): return self.this.own(value) if (name == "this"): if type(value).__name__ == 'SwigPyObject': self.__dict__[name] = value return method = class_type.__swig_setmethods__.get(name,None) if method: return method(self,value) if (not static): self.__dict__[name] = value else: raise AttributeError("You cannot add attributes to %s" % self) def _swig_setattr(self,class_type,name,value): return _swig_setattr_nondynamic(self,class_type,name,value,0) def _swig_getattr(self,class_type,name): if (name == "thisown"): return self.this.own() method = class_type.__swig_getmethods__.get(name,None) if method: return method(self) raise AttributeError(name) def _swig_repr(self): try: strthis = "proxy of " + self.this.__repr__() except: strthis = "" return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,) try: _object = object _newclass = 1 except AttributeError: class _object : pass _newclass = 0 def _swig_setattr_nondynamic_method(set): def set_attr(self,name,value): if (name == "thisown"): return self.this.own(value) if hasattr(self,name) or (name == "this"): set(self,name,value) else: raise AttributeError("You cannot add attributes to %s" % self) return set_attr try: import weakref weakref_proxy = weakref.proxy except: weakref_proxy = lambda x: x import ida_idaapi import sys _BC695 = sys.modules["__main__"].IDAPYTHON_COMPAT_695_API if _BC695: def bc695redef(func): ida_idaapi._BC695.replace_fun(func) return func import ida_pro import ida_xref import ida_typeinf import ida_idp def _kludge_use_TPopupMenu(*args): """ _kludge_use_TPopupMenu(m) """ return _ida_hexrays._kludge_use_TPopupMenu(*args) class array_of_bitsets(object): """ Proxy of C++ qvector<(bitset_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> array_of_bitsets __init__(self, x) -> array_of_bitsets """ this = _ida_hexrays.new_array_of_bitsets(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_array_of_bitsets __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> bitset_t """ return _ida_hexrays.array_of_bitsets_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.array_of_bitsets_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.array_of_bitsets_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.array_of_bitsets_empty(self, *args) def at(self, *args): """ at(self, _idx) -> bitset_t """ return _ida_hexrays.array_of_bitsets_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.array_of_bitsets_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.array_of_bitsets_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.array_of_bitsets_resize(self, *args) def grow(self, *args): """ grow(self, x=bitset_t()) """ return _ida_hexrays.array_of_bitsets_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.array_of_bitsets_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.array_of_bitsets_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.array_of_bitsets_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.array_of_bitsets_swap(self, *args) def extract(self, *args): """ extract(self) -> bitset_t """ return _ida_hexrays.array_of_bitsets_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.array_of_bitsets_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.array_of_bitsets___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.array_of_bitsets___ne__(self, *args) def begin(self, *args): """ begin(self) -> bitset_t begin(self) -> bitset_t """ return _ida_hexrays.array_of_bitsets_begin(self, *args) def end(self, *args): """ end(self) -> bitset_t end(self) -> bitset_t """ return _ida_hexrays.array_of_bitsets_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> bitset_t """ return _ida_hexrays.array_of_bitsets_insert(self, *args) def erase(self, *args): """ erase(self, it) -> bitset_t erase(self, first, last) -> bitset_t """ return _ida_hexrays.array_of_bitsets_erase(self, *args) def find(self, *args): """ find(self, x) -> bitset_t find(self, x) -> bitset_t """ return _ida_hexrays.array_of_bitsets_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.array_of_bitsets_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.array_of_bitsets_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.array_of_bitsets__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.array_of_bitsets___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> bitset_t """ return _ida_hexrays.array_of_bitsets___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.array_of_bitsets___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator array_of_bitsets_swigregister = _ida_hexrays.array_of_bitsets_swigregister array_of_bitsets_swigregister(array_of_bitsets) class mopvec_t(object): """ Proxy of C++ qvector<(mop_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> mopvec_t __init__(self, x) -> mopvec_t """ this = _ida_hexrays.new_mopvec_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_mopvec_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> mop_t """ return _ida_hexrays.mopvec_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.mopvec_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.mopvec_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.mopvec_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> mop_t """ return _ida_hexrays.mopvec_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.mopvec_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.mopvec_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.mopvec_t_resize(self, *args) def grow(self, *args): """ grow(self, x=mop_t()) """ return _ida_hexrays.mopvec_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.mopvec_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.mopvec_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.mopvec_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.mopvec_t_swap(self, *args) def extract(self, *args): """ extract(self) -> mop_t """ return _ida_hexrays.mopvec_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.mopvec_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.mopvec_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.mopvec_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> mop_t begin(self) -> mop_t """ return _ida_hexrays.mopvec_t_begin(self, *args) def end(self, *args): """ end(self) -> mop_t end(self) -> mop_t """ return _ida_hexrays.mopvec_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> mop_t """ return _ida_hexrays.mopvec_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> mop_t erase(self, first, last) -> mop_t """ return _ida_hexrays.mopvec_t_erase(self, *args) def find(self, *args): """ find(self, x) -> mop_t find(self, x) -> mop_t """ return _ida_hexrays.mopvec_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.mopvec_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.mopvec_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.mopvec_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.mopvec_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> mop_t """ return _ida_hexrays.mopvec_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.mopvec_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator mopvec_t_swigregister = _ida_hexrays.mopvec_t_swigregister mopvec_t_swigregister(mopvec_t) class mcallargs_t(object): """ Proxy of C++ qvector<(mcallarg_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> mcallargs_t __init__(self, x) -> mcallargs_t """ this = _ida_hexrays.new_mcallargs_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_mcallargs_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> mcallarg_t """ return _ida_hexrays.mcallargs_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.mcallargs_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.mcallargs_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.mcallargs_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> mcallarg_t """ return _ida_hexrays.mcallargs_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.mcallargs_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.mcallargs_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.mcallargs_t_resize(self, *args) def grow(self, *args): """ grow(self, x=mcallarg_t()) """ return _ida_hexrays.mcallargs_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.mcallargs_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.mcallargs_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.mcallargs_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.mcallargs_t_swap(self, *args) def extract(self, *args): """ extract(self) -> mcallarg_t """ return _ida_hexrays.mcallargs_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.mcallargs_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.mcallargs_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.mcallargs_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> mcallarg_t begin(self) -> mcallarg_t """ return _ida_hexrays.mcallargs_t_begin(self, *args) def end(self, *args): """ end(self) -> mcallarg_t end(self) -> mcallarg_t """ return _ida_hexrays.mcallargs_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> mcallarg_t """ return _ida_hexrays.mcallargs_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> mcallarg_t erase(self, first, last) -> mcallarg_t """ return _ida_hexrays.mcallargs_t_erase(self, *args) def find(self, *args): """ find(self, x) -> mcallarg_t find(self, x) -> mcallarg_t """ return _ida_hexrays.mcallargs_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.mcallargs_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.mcallargs_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.mcallargs_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.mcallargs_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> mcallarg_t """ return _ida_hexrays.mcallargs_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.mcallargs_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator mcallargs_t_swigregister = _ida_hexrays.mcallargs_t_swigregister mcallargs_t_swigregister(mcallargs_t) class block_chains_vec_t(object): """ Proxy of C++ qvector<(block_chains_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> block_chains_vec_t __init__(self, x) -> block_chains_vec_t """ this = _ida_hexrays.new_block_chains_vec_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_block_chains_vec_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> block_chains_t """ return _ida_hexrays.block_chains_vec_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.block_chains_vec_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.block_chains_vec_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.block_chains_vec_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> block_chains_t """ return _ida_hexrays.block_chains_vec_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.block_chains_vec_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.block_chains_vec_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.block_chains_vec_t_resize(self, *args) def grow(self, *args): """ grow(self, x=block_chains_t()) """ return _ida_hexrays.block_chains_vec_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.block_chains_vec_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.block_chains_vec_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.block_chains_vec_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.block_chains_vec_t_swap(self, *args) def extract(self, *args): """ extract(self) -> block_chains_t """ return _ida_hexrays.block_chains_vec_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.block_chains_vec_t_inject(self, *args) def begin(self, *args): """ begin(self) -> block_chains_t begin(self) -> block_chains_t """ return _ida_hexrays.block_chains_vec_t_begin(self, *args) def end(self, *args): """ end(self) -> block_chains_t end(self) -> block_chains_t """ return _ida_hexrays.block_chains_vec_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> block_chains_t """ return _ida_hexrays.block_chains_vec_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> block_chains_t erase(self, first, last) -> block_chains_t """ return _ida_hexrays.block_chains_vec_t_erase(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.block_chains_vec_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> block_chains_t """ return _ida_hexrays.block_chains_vec_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.block_chains_vec_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator block_chains_vec_t_swigregister = _ida_hexrays.block_chains_vec_t_swigregister block_chains_vec_t_swigregister(block_chains_vec_t) class user_numforms_t(object): """ Proxy of C++ std::map<(operand_locator_t,number_format_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def at(self, *args): """ at(self, _Keyval) -> number_format_t """ return _ida_hexrays.user_numforms_t_at(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.user_numforms_t_size(self, *args) def __init__(self, *args): """ __init__(self) -> user_numforms_t """ this = _ida_hexrays.new_user_numforms_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_numforms_t __del__ = lambda self : None; user_numforms_t_swigregister = _ida_hexrays.user_numforms_t_swigregister user_numforms_t_swigregister(user_numforms_t) class lvar_mapping_t(object): """ Proxy of C++ std::map<(lvar_locator_t,lvar_locator_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def at(self, *args): """ at(self, _Keyval) -> lvar_locator_t """ return _ida_hexrays.lvar_mapping_t_at(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.lvar_mapping_t_size(self, *args) def __init__(self, *args): """ __init__(self) -> lvar_mapping_t """ this = _ida_hexrays.new_lvar_mapping_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_lvar_mapping_t __del__ = lambda self : None; lvar_mapping_t_swigregister = _ida_hexrays.lvar_mapping_t_swigregister lvar_mapping_t_swigregister(lvar_mapping_t) class hexwarns_t(object): """ Proxy of C++ qvector<(hexwarn_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> hexwarns_t __init__(self, x) -> hexwarns_t """ this = _ida_hexrays.new_hexwarns_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_hexwarns_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> hexwarn_t """ return _ida_hexrays.hexwarns_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.hexwarns_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.hexwarns_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.hexwarns_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> hexwarn_t """ return _ida_hexrays.hexwarns_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.hexwarns_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.hexwarns_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.hexwarns_t_resize(self, *args) def grow(self, *args): """ grow(self, x=hexwarn_t()) """ return _ida_hexrays.hexwarns_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.hexwarns_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.hexwarns_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.hexwarns_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.hexwarns_t_swap(self, *args) def extract(self, *args): """ extract(self) -> hexwarn_t """ return _ida_hexrays.hexwarns_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.hexwarns_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.hexwarns_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.hexwarns_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> hexwarn_t begin(self) -> hexwarn_t """ return _ida_hexrays.hexwarns_t_begin(self, *args) def end(self, *args): """ end(self) -> hexwarn_t end(self) -> hexwarn_t """ return _ida_hexrays.hexwarns_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> hexwarn_t """ return _ida_hexrays.hexwarns_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> hexwarn_t erase(self, first, last) -> hexwarn_t """ return _ida_hexrays.hexwarns_t_erase(self, *args) def find(self, *args): """ find(self, x) -> hexwarn_t find(self, x) -> hexwarn_t """ return _ida_hexrays.hexwarns_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.hexwarns_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.hexwarns_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.hexwarns_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.hexwarns_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> hexwarn_t """ return _ida_hexrays.hexwarns_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.hexwarns_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator hexwarns_t_swigregister = _ida_hexrays.hexwarns_t_swigregister hexwarns_t_swigregister(hexwarns_t) class ctree_items_t(object): """ Proxy of C++ qvector<(p.citem_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> ctree_items_t __init__(self, x) -> ctree_items_t """ this = _ida_hexrays.new_ctree_items_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_ctree_items_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> citem_t *& """ return _ida_hexrays.ctree_items_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.ctree_items_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.ctree_items_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.ctree_items_t_empty(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.ctree_items_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.ctree_items_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.ctree_items_t_resize(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.ctree_items_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.ctree_items_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.ctree_items_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.ctree_items_t_swap(self, *args) def extract(self, *args): """ extract(self) -> citem_t ** """ return _ida_hexrays.ctree_items_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.ctree_items_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.ctree_items_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.ctree_items_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> qvector< citem_t * >::iterator begin(self) -> qvector< citem_t * >::const_iterator """ return _ida_hexrays.ctree_items_t_begin(self, *args) def end(self, *args): """ end(self) -> qvector< citem_t * >::iterator end(self) -> qvector< citem_t * >::const_iterator """ return _ida_hexrays.ctree_items_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> qvector< citem_t * >::iterator """ return _ida_hexrays.ctree_items_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> qvector< citem_t * >::iterator erase(self, first, last) -> qvector< citem_t * >::iterator """ return _ida_hexrays.ctree_items_t_erase(self, *args) def find(self, *args): """ find(self, x) -> qvector< citem_t * >::iterator find(self, x) -> qvector< citem_t * >::const_iterator """ return _ida_hexrays.ctree_items_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.ctree_items_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.ctree_items_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.ctree_items_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.ctree_items_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> citem_t """ return _ida_hexrays.ctree_items_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.ctree_items_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator def at(self, *args): """ at(self, n) -> citem_t """ return _ida_hexrays.ctree_items_t_at(self, *args) ctree_items_t_swigregister = _ida_hexrays.ctree_items_t_swigregister ctree_items_t_swigregister(ctree_items_t) class user_labels_t(object): """ Proxy of C++ std::map<(int,qstring)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def at(self, *args): """ at(self, _Keyval) -> _qstring< char > & """ return _ida_hexrays.user_labels_t_at(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.user_labels_t_size(self, *args) def __init__(self, *args): """ __init__(self) -> user_labels_t """ this = _ida_hexrays.new_user_labels_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_labels_t __del__ = lambda self : None; user_labels_t_swigregister = _ida_hexrays.user_labels_t_swigregister user_labels_t_swigregister(user_labels_t) class user_cmts_t(object): """ Proxy of C++ std::map<(treeloc_t,citem_cmt_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def at(self, *args): """ at(self, _Keyval) -> citem_cmt_t """ return _ida_hexrays.user_cmts_t_at(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.user_cmts_t_size(self, *args) def __init__(self, *args): """ __init__(self) -> user_cmts_t """ this = _ida_hexrays.new_user_cmts_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_cmts_t __del__ = lambda self : None; user_cmts_t_swigregister = _ida_hexrays.user_cmts_t_swigregister user_cmts_t_swigregister(user_cmts_t) class user_iflags_t(object): """ Proxy of C++ std::map<(citem_locator_t,int32)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def at(self, *args): """ at(self, _Keyval) -> int & """ return _ida_hexrays.user_iflags_t_at(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.user_iflags_t_size(self, *args) def __init__(self, *args): """ __init__(self) -> user_iflags_t """ this = _ida_hexrays.new_user_iflags_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_iflags_t __del__ = lambda self : None; user_iflags_t_swigregister = _ida_hexrays.user_iflags_t_swigregister user_iflags_t_swigregister(user_iflags_t) class user_unions_t(object): """ Proxy of C++ std::map<(ea_t,intvec_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def at(self, *args): """ at(self, _Keyval) -> intvec_t """ return _ida_hexrays.user_unions_t_at(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.user_unions_t_size(self, *args) def __init__(self, *args): """ __init__(self) -> user_unions_t """ this = _ida_hexrays.new_user_unions_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_unions_t __del__ = lambda self : None; user_unions_t_swigregister = _ida_hexrays.user_unions_t_swigregister user_unions_t_swigregister(user_unions_t) class cinsnptrvec_t(object): """ Proxy of C++ qvector<(p.cinsn_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> cinsnptrvec_t __init__(self, x) -> cinsnptrvec_t """ this = _ida_hexrays.new_cinsnptrvec_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_cinsnptrvec_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> cinsn_t *& """ return _ida_hexrays.cinsnptrvec_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.cinsnptrvec_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.cinsnptrvec_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.cinsnptrvec_t_empty(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.cinsnptrvec_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.cinsnptrvec_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.cinsnptrvec_t_resize(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.cinsnptrvec_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.cinsnptrvec_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.cinsnptrvec_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.cinsnptrvec_t_swap(self, *args) def extract(self, *args): """ extract(self) -> cinsn_t ** """ return _ida_hexrays.cinsnptrvec_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.cinsnptrvec_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cinsnptrvec_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cinsnptrvec_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> qvector< cinsn_t * >::iterator begin(self) -> qvector< cinsn_t * >::const_iterator """ return _ida_hexrays.cinsnptrvec_t_begin(self, *args) def end(self, *args): """ end(self) -> qvector< cinsn_t * >::iterator end(self) -> qvector< cinsn_t * >::const_iterator """ return _ida_hexrays.cinsnptrvec_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> qvector< cinsn_t * >::iterator """ return _ida_hexrays.cinsnptrvec_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> qvector< cinsn_t * >::iterator erase(self, first, last) -> qvector< cinsn_t * >::iterator """ return _ida_hexrays.cinsnptrvec_t_erase(self, *args) def find(self, *args): """ find(self, x) -> qvector< cinsn_t * >::iterator find(self, x) -> qvector< cinsn_t * >::const_iterator """ return _ida_hexrays.cinsnptrvec_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.cinsnptrvec_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.cinsnptrvec_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.cinsnptrvec_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.cinsnptrvec_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> cinsn_t """ return _ida_hexrays.cinsnptrvec_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.cinsnptrvec_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator def at(self, *args): """ at(self, n) -> cinsn_t """ return _ida_hexrays.cinsnptrvec_t_at(self, *args) cinsnptrvec_t_swigregister = _ida_hexrays.cinsnptrvec_t_swigregister cinsnptrvec_t_swigregister(cinsnptrvec_t) class eamap_t(object): """ Proxy of C++ std::map<(ea_t,cinsnptrvec_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def at(self, *args): """ at(self, _Keyval) -> cinsnptrvec_t """ return _ida_hexrays.eamap_t_at(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.eamap_t_size(self, *args) def __init__(self, *args): """ __init__(self) -> eamap_t """ this = _ida_hexrays.new_eamap_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_eamap_t __del__ = lambda self : None; eamap_t_swigregister = _ida_hexrays.eamap_t_swigregister eamap_t_swigregister(eamap_t) class boundaries_t(object): """ Proxy of C++ std::map<(p.cinsn_t,rangeset_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def at(self, *args): """ at(self, _Keyval) -> rangeset_t """ return _ida_hexrays.boundaries_t_at(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.boundaries_t_size(self, *args) def __init__(self, *args): """ __init__(self) -> boundaries_t """ this = _ida_hexrays.new_boundaries_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_boundaries_t __del__ = lambda self : None; boundaries_t_swigregister = _ida_hexrays.boundaries_t_swigregister boundaries_t_swigregister(boundaries_t) def user_iflags_second(*args): """ user_iflags_second(p) -> int32 const & Get reference to the current map value. @param p (C++: user_iflags_iterator_t) """ return _ida_hexrays.user_iflags_second(*args) class cfuncptr_t(object): """ Proxy of C++ qrefcnt_t<(cfunc_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, p) -> cfuncptr_t __init__(self, r) -> cfuncptr_t """ this = _ida_hexrays.new_cfuncptr_t(*args) try: self.this.append(this) except: self.this = this def reset(self, *args): """ reset(self) """ return _ida_hexrays.cfuncptr_t_reset(self, *args) def __deref__(self, *args): """ __deref__(self) -> cfunc_t """ return _ida_hexrays.cfuncptr_t___deref__(self, *args) def __ref__(self, *args): """ __ref__(self) -> cfunc_t """ return _ida_hexrays.cfuncptr_t___ref__(self, *args) __swig_destroy__ = _ida_hexrays.delete_cfuncptr_t __del__ = lambda self : None; entry_ea = _swig_property(_ida_hexrays.cfuncptr_t_entry_ea_get, _ida_hexrays.cfuncptr_t_entry_ea_set) mba = _swig_property(_ida_hexrays.cfuncptr_t_mba_get, _ida_hexrays.cfuncptr_t_mba_set) body = _swig_property(_ida_hexrays.cfuncptr_t_body_get, _ida_hexrays.cfuncptr_t_body_set) argidx = _swig_property(_ida_hexrays.cfuncptr_t_argidx_get) maturity = _swig_property(_ida_hexrays.cfuncptr_t_maturity_get, _ida_hexrays.cfuncptr_t_maturity_set) user_labels = _swig_property(_ida_hexrays.cfuncptr_t_user_labels_get, _ida_hexrays.cfuncptr_t_user_labels_set) user_cmts = _swig_property(_ida_hexrays.cfuncptr_t_user_cmts_get, _ida_hexrays.cfuncptr_t_user_cmts_set) numforms = _swig_property(_ida_hexrays.cfuncptr_t_numforms_get, _ida_hexrays.cfuncptr_t_numforms_set) user_iflags = _swig_property(_ida_hexrays.cfuncptr_t_user_iflags_get, _ida_hexrays.cfuncptr_t_user_iflags_set) user_unions = _swig_property(_ida_hexrays.cfuncptr_t_user_unions_get, _ida_hexrays.cfuncptr_t_user_unions_set) refcnt = _swig_property(_ida_hexrays.cfuncptr_t_refcnt_get, _ida_hexrays.cfuncptr_t_refcnt_set) statebits = _swig_property(_ida_hexrays.cfuncptr_t_statebits_get, _ida_hexrays.cfuncptr_t_statebits_set) hdrlines = _swig_property(_ida_hexrays.cfuncptr_t_hdrlines_get, _ida_hexrays.cfuncptr_t_hdrlines_set) treeitems = _swig_property(_ida_hexrays.cfuncptr_t_treeitems_get, _ida_hexrays.cfuncptr_t_treeitems_set) def release(self, *args): """ release(self) """ return _ida_hexrays.cfuncptr_t_release(self, *args) def build_c_tree(self, *args): """ build_c_tree(self) """ return _ida_hexrays.cfuncptr_t_build_c_tree(self, *args) def verify(self, *args): """ verify(self, aul, even_without_debugger) """ return _ida_hexrays.cfuncptr_t_verify(self, *args) def print_dcl(self, *args): """ print_dcl(self) """ return _ida_hexrays.cfuncptr_t_print_dcl(self, *args) def print_func(self, *args): """ print_func(self, vp) """ return _ida_hexrays.cfuncptr_t_print_func(self, *args) def get_func_type(self, *args): """ get_func_type(self, type) -> bool """ return _ida_hexrays.cfuncptr_t_get_func_type(self, *args) def get_lvars(self, *args): """ get_lvars(self) -> lvars_t """ return _ida_hexrays.cfuncptr_t_get_lvars(self, *args) def get_stkoff_delta(self, *args): """ get_stkoff_delta(self) -> sval_t """ return _ida_hexrays.cfuncptr_t_get_stkoff_delta(self, *args) def find_label(self, *args): """ find_label(self, label) -> citem_t """ return _ida_hexrays.cfuncptr_t_find_label(self, *args) def remove_unused_labels(self, *args): """ remove_unused_labels(self) """ return _ida_hexrays.cfuncptr_t_remove_unused_labels(self, *args) def get_user_cmt(self, *args): """ get_user_cmt(self, loc, rt) -> char const * """ return _ida_hexrays.cfuncptr_t_get_user_cmt(self, *args) def set_user_cmt(self, *args): """ set_user_cmt(self, loc, cmt) """ return _ida_hexrays.cfuncptr_t_set_user_cmt(self, *args) def get_user_iflags(self, *args): """ get_user_iflags(self, loc) -> int32 """ return _ida_hexrays.cfuncptr_t_get_user_iflags(self, *args) def set_user_iflags(self, *args): """ set_user_iflags(self, loc, iflags) """ return _ida_hexrays.cfuncptr_t_set_user_iflags(self, *args) def has_orphan_cmts(self, *args): """ has_orphan_cmts(self) -> bool """ return _ida_hexrays.cfuncptr_t_has_orphan_cmts(self, *args) def del_orphan_cmts(self, *args): """ del_orphan_cmts(self) -> int """ return _ida_hexrays.cfuncptr_t_del_orphan_cmts(self, *args) def get_user_union_selection(self, *args): """ get_user_union_selection(self, ea, path) -> bool """ return _ida_hexrays.cfuncptr_t_get_user_union_selection(self, *args) def set_user_union_selection(self, *args): """ set_user_union_selection(self, ea, path) """ return _ida_hexrays.cfuncptr_t_set_user_union_selection(self, *args) def save_user_labels(self, *args): """ save_user_labels(self) """ return _ida_hexrays.cfuncptr_t_save_user_labels(self, *args) def save_user_cmts(self, *args): """ save_user_cmts(self) """ return _ida_hexrays.cfuncptr_t_save_user_cmts(self, *args) def save_user_numforms(self, *args): """ save_user_numforms(self) """ return _ida_hexrays.cfuncptr_t_save_user_numforms(self, *args) def save_user_iflags(self, *args): """ save_user_iflags(self) """ return _ida_hexrays.cfuncptr_t_save_user_iflags(self, *args) def save_user_unions(self, *args): """ save_user_unions(self) """ return _ida_hexrays.cfuncptr_t_save_user_unions(self, *args) def get_line_item(self, *args): """ get_line_item(self, line, x, is_ctree_line, phead, pitem, ptail) -> bool """ return _ida_hexrays.cfuncptr_t_get_line_item(self, *args) def get_warnings(self, *args): """ get_warnings(self) -> hexwarns_t """ return _ida_hexrays.cfuncptr_t_get_warnings(self, *args) def get_eamap(self, *args): """ get_eamap(self) -> eamap_t """ return _ida_hexrays.cfuncptr_t_get_eamap(self, *args) def get_boundaries(self, *args): """ get_boundaries(self) -> boundaries_t """ return _ida_hexrays.cfuncptr_t_get_boundaries(self, *args) def get_pseudocode(self, *args): """ get_pseudocode(self) -> strvec_t """ return _ida_hexrays.cfuncptr_t_get_pseudocode(self, *args) def refresh_func_ctext(self, *args): """ refresh_func_ctext(self) """ return _ida_hexrays.cfuncptr_t_refresh_func_ctext(self, *args) def gather_derefs(self, *args): """ gather_derefs(self, ci, udm=None) -> bool """ return _ida_hexrays.cfuncptr_t_gather_derefs(self, *args) def find_item_coords(self, *args): """ find_item_coords(self, item, px, py) -> bool find_item_coords(self, item) -> PyObject * """ return _ida_hexrays.cfuncptr_t_find_item_coords(self, *args) def __str__(self, *args): """ __str__(self) -> qstring """ return _ida_hexrays.cfuncptr_t___str__(self, *args) cfuncptr_t_swigregister = _ida_hexrays.cfuncptr_t_swigregister cfuncptr_t_swigregister(cfuncptr_t) class qvector_history_t(object): """ Proxy of C++ qvector<(history_item_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> qvector_history_t __init__(self, x) -> qvector_history_t """ this = _ida_hexrays.new_qvector_history_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_qvector_history_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> history_item_t """ return _ida_hexrays.qvector_history_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.qvector_history_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.qvector_history_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.qvector_history_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> history_item_t """ return _ida_hexrays.qvector_history_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.qvector_history_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.qvector_history_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.qvector_history_t_resize(self, *args) def grow(self, *args): """ grow(self, x=history_item_t()) """ return _ida_hexrays.qvector_history_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.qvector_history_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.qvector_history_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.qvector_history_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.qvector_history_t_swap(self, *args) def extract(self, *args): """ extract(self) -> history_item_t """ return _ida_hexrays.qvector_history_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.qvector_history_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.qvector_history_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.qvector_history_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> history_item_t begin(self) -> history_item_t """ return _ida_hexrays.qvector_history_t_begin(self, *args) def end(self, *args): """ end(self) -> history_item_t end(self) -> history_item_t """ return _ida_hexrays.qvector_history_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> history_item_t """ return _ida_hexrays.qvector_history_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> history_item_t erase(self, first, last) -> history_item_t """ return _ida_hexrays.qvector_history_t_erase(self, *args) def find(self, *args): """ find(self, x) -> history_item_t find(self, x) -> history_item_t """ return _ida_hexrays.qvector_history_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.qvector_history_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.qvector_history_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.qvector_history_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.qvector_history_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> history_item_t """ return _ida_hexrays.qvector_history_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.qvector_history_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator qvector_history_t_swigregister = _ida_hexrays.qvector_history_t_swigregister qvector_history_t_swigregister(qvector_history_t) class history_t(qvector_history_t): """ Proxy of C++ qstack<(history_item_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def pop(self, *args): """ pop(self) -> history_item_t """ return _ida_hexrays.history_t_pop(self, *args) def top(self, *args): """ top(self) -> history_item_t top(self) -> history_item_t """ return _ida_hexrays.history_t_top(self, *args) def push(self, *args): """ push(self, v) """ return _ida_hexrays.history_t_push(self, *args) def __init__(self, *args): """ __init__(self) -> history_t """ this = _ida_hexrays.new_history_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_history_t __del__ = lambda self : None; history_t_swigregister = _ida_hexrays.history_t_swigregister history_t_swigregister(history_t) class qlist_cinsn_t_iterator(object): """ Proxy of C++ qlist_cinsn_t_iterator class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr cur = _swig_property(_ida_hexrays.qlist_cinsn_t_iterator_cur_get) def next(self, *args): """ next(self) """ return _ida_hexrays.qlist_cinsn_t_iterator_next(self, *args) def __eq__(self, *args): """ __eq__(self, x) -> bool """ return _ida_hexrays.qlist_cinsn_t_iterator___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, x) -> bool """ return _ida_hexrays.qlist_cinsn_t_iterator___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> qlist_cinsn_t_iterator """ this = _ida_hexrays.new_qlist_cinsn_t_iterator(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_qlist_cinsn_t_iterator __del__ = lambda self : None; qlist_cinsn_t_iterator_swigregister = _ida_hexrays.qlist_cinsn_t_iterator_swigregister qlist_cinsn_t_iterator_swigregister(qlist_cinsn_t_iterator) class qvector_lvar_t(object): """ Proxy of C++ qvector<(lvar_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> qvector_lvar_t __init__(self, x) -> qvector_lvar_t """ this = _ida_hexrays.new_qvector_lvar_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_qvector_lvar_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> lvar_t """ return _ida_hexrays.qvector_lvar_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.qvector_lvar_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.qvector_lvar_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.qvector_lvar_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> lvar_t """ return _ida_hexrays.qvector_lvar_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.qvector_lvar_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.qvector_lvar_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.qvector_lvar_t_resize(self, *args) def grow(self, *args): """ grow(self, x=lvar_t()) """ return _ida_hexrays.qvector_lvar_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.qvector_lvar_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.qvector_lvar_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.qvector_lvar_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.qvector_lvar_t_swap(self, *args) def extract(self, *args): """ extract(self) -> lvar_t """ return _ida_hexrays.qvector_lvar_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.qvector_lvar_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.qvector_lvar_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.qvector_lvar_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> lvar_t begin(self) -> lvar_t """ return _ida_hexrays.qvector_lvar_t_begin(self, *args) def end(self, *args): """ end(self) -> lvar_t end(self) -> lvar_t """ return _ida_hexrays.qvector_lvar_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> lvar_t """ return _ida_hexrays.qvector_lvar_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> lvar_t erase(self, first, last) -> lvar_t """ return _ida_hexrays.qvector_lvar_t_erase(self, *args) def find(self, *args): """ find(self, x) -> lvar_t find(self, x) -> lvar_t """ return _ida_hexrays.qvector_lvar_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.qvector_lvar_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.qvector_lvar_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.qvector_lvar_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.qvector_lvar_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> lvar_t """ return _ida_hexrays.qvector_lvar_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.qvector_lvar_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator qvector_lvar_t_swigregister = _ida_hexrays.qvector_lvar_t_swigregister qvector_lvar_t_swigregister(qvector_lvar_t) class qlist_cinsn_t(object): """ Proxy of C++ qlist<(cinsn_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> qlist_cinsn_t __init__(self, x) -> qlist_cinsn_t """ this = _ida_hexrays.new_qlist_cinsn_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_qlist_cinsn_t __del__ = lambda self : None; def swap(self, *args): """ swap(self, x) """ return _ida_hexrays.qlist_cinsn_t_swap(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.qlist_cinsn_t_empty(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.qlist_cinsn_t_size(self, *args) def front(self, *args): """ front(self) -> cinsn_t front(self) -> cinsn_t """ return _ida_hexrays.qlist_cinsn_t_front(self, *args) def back(self, *args): """ back(self) -> cinsn_t back(self) -> cinsn_t """ return _ida_hexrays.qlist_cinsn_t_back(self, *args) def rbegin(self, *args): """ rbegin(self) -> qlist< cinsn_t >::reverse_iterator rbegin(self) -> qlist< cinsn_t >::const_reverse_iterator """ return _ida_hexrays.qlist_cinsn_t_rbegin(self, *args) def rend(self, *args): """ rend(self) -> qlist< cinsn_t >::reverse_iterator rend(self) -> qlist< cinsn_t >::const_reverse_iterator """ return _ida_hexrays.qlist_cinsn_t_rend(self, *args) def push_front(self, *args): """ push_front(self, x) """ return _ida_hexrays.qlist_cinsn_t_push_front(self, *args) def push_back(self, *args): """ push_back(self, x) push_back(self) -> cinsn_t """ return _ida_hexrays.qlist_cinsn_t_push_back(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.qlist_cinsn_t_clear(self, *args) def pop_front(self, *args): """ pop_front(self) """ return _ida_hexrays.qlist_cinsn_t_pop_front(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.qlist_cinsn_t_pop_back(self, *args) def __eq__(self, *args): """ __eq__(self, x) -> bool """ return _ida_hexrays.qlist_cinsn_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, x) -> bool """ return _ida_hexrays.qlist_cinsn_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> qlist_cinsn_t_iterator """ return _ida_hexrays.qlist_cinsn_t_begin(self, *args) def end(self, *args): """ end(self) -> qlist_cinsn_t_iterator """ return _ida_hexrays.qlist_cinsn_t_end(self, *args) def insert(self, *args): """ insert(self, p, x) -> qlist< cinsn_t >::iterator insert(self, p) -> qlist< cinsn_t >::iterator insert(self, p, x) -> qlist_cinsn_t_iterator """ return _ida_hexrays.qlist_cinsn_t_insert(self, *args) def erase(self, *args): """ erase(self, p) -> qlist< cinsn_t >::iterator erase(self, p1, p2) erase(self, p) """ return _ida_hexrays.qlist_cinsn_t_erase(self, *args) qlist_cinsn_t_swigregister = _ida_hexrays.qlist_cinsn_t_swigregister qlist_cinsn_t_swigregister(qlist_cinsn_t) class qvector_carg_t(object): """ Proxy of C++ qvector<(carg_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> qvector_carg_t __init__(self, x) -> qvector_carg_t """ this = _ida_hexrays.new_qvector_carg_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_qvector_carg_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> carg_t """ return _ida_hexrays.qvector_carg_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.qvector_carg_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.qvector_carg_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.qvector_carg_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> carg_t """ return _ida_hexrays.qvector_carg_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.qvector_carg_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.qvector_carg_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.qvector_carg_t_resize(self, *args) def grow(self, *args): """ grow(self, x=carg_t()) """ return _ida_hexrays.qvector_carg_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.qvector_carg_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.qvector_carg_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.qvector_carg_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.qvector_carg_t_swap(self, *args) def extract(self, *args): """ extract(self) -> carg_t """ return _ida_hexrays.qvector_carg_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.qvector_carg_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.qvector_carg_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.qvector_carg_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> carg_t begin(self) -> carg_t """ return _ida_hexrays.qvector_carg_t_begin(self, *args) def end(self, *args): """ end(self) -> carg_t end(self) -> carg_t """ return _ida_hexrays.qvector_carg_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> carg_t """ return _ida_hexrays.qvector_carg_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> carg_t erase(self, first, last) -> carg_t """ return _ida_hexrays.qvector_carg_t_erase(self, *args) def find(self, *args): """ find(self, x) -> carg_t find(self, x) -> carg_t """ return _ida_hexrays.qvector_carg_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.qvector_carg_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.qvector_carg_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.qvector_carg_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.qvector_carg_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> carg_t """ return _ida_hexrays.qvector_carg_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.qvector_carg_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator qvector_carg_t_swigregister = _ida_hexrays.qvector_carg_t_swigregister qvector_carg_t_swigregister(qvector_carg_t) class qvector_ccase_t(object): """ Proxy of C++ qvector<(ccase_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> qvector_ccase_t __init__(self, x) -> qvector_ccase_t """ this = _ida_hexrays.new_qvector_ccase_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_qvector_ccase_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> ccase_t """ return _ida_hexrays.qvector_ccase_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.qvector_ccase_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.qvector_ccase_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.qvector_ccase_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> ccase_t """ return _ida_hexrays.qvector_ccase_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.qvector_ccase_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.qvector_ccase_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.qvector_ccase_t_resize(self, *args) def grow(self, *args): """ grow(self, x=ccase_t()) """ return _ida_hexrays.qvector_ccase_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.qvector_ccase_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.qvector_ccase_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.qvector_ccase_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.qvector_ccase_t_swap(self, *args) def extract(self, *args): """ extract(self) -> ccase_t """ return _ida_hexrays.qvector_ccase_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.qvector_ccase_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.qvector_ccase_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.qvector_ccase_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> ccase_t begin(self) -> ccase_t """ return _ida_hexrays.qvector_ccase_t_begin(self, *args) def end(self, *args): """ end(self) -> ccase_t end(self) -> ccase_t """ return _ida_hexrays.qvector_ccase_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> ccase_t """ return _ida_hexrays.qvector_ccase_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> ccase_t erase(self, first, last) -> ccase_t """ return _ida_hexrays.qvector_ccase_t_erase(self, *args) def find(self, *args): """ find(self, x) -> ccase_t find(self, x) -> ccase_t """ return _ida_hexrays.qvector_ccase_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.qvector_ccase_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.qvector_ccase_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.qvector_ccase_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.qvector_ccase_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> ccase_t """ return _ida_hexrays.qvector_ccase_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.qvector_ccase_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator qvector_ccase_t_swigregister = _ida_hexrays.qvector_ccase_t_swigregister qvector_ccase_t_swigregister(qvector_ccase_t) class lvar_saved_infos_t(object): """ Proxy of C++ qvector<(lvar_saved_info_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> lvar_saved_infos_t __init__(self, x) -> lvar_saved_infos_t """ this = _ida_hexrays.new_lvar_saved_infos_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_lvar_saved_infos_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> lvar_saved_info_t """ return _ida_hexrays.lvar_saved_infos_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.lvar_saved_infos_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.lvar_saved_infos_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.lvar_saved_infos_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> lvar_saved_info_t """ return _ida_hexrays.lvar_saved_infos_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.lvar_saved_infos_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.lvar_saved_infos_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.lvar_saved_infos_t_resize(self, *args) def grow(self, *args): """ grow(self, x=lvar_saved_info_t()) """ return _ida_hexrays.lvar_saved_infos_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.lvar_saved_infos_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.lvar_saved_infos_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.lvar_saved_infos_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.lvar_saved_infos_t_swap(self, *args) def extract(self, *args): """ extract(self) -> lvar_saved_info_t """ return _ida_hexrays.lvar_saved_infos_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.lvar_saved_infos_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.lvar_saved_infos_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.lvar_saved_infos_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> lvar_saved_info_t begin(self) -> lvar_saved_info_t """ return _ida_hexrays.lvar_saved_infos_t_begin(self, *args) def end(self, *args): """ end(self) -> lvar_saved_info_t end(self) -> lvar_saved_info_t """ return _ida_hexrays.lvar_saved_infos_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> lvar_saved_info_t """ return _ida_hexrays.lvar_saved_infos_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> lvar_saved_info_t erase(self, first, last) -> lvar_saved_info_t """ return _ida_hexrays.lvar_saved_infos_t_erase(self, *args) def find(self, *args): """ find(self, x) -> lvar_saved_info_t find(self, x) -> lvar_saved_info_t """ return _ida_hexrays.lvar_saved_infos_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.lvar_saved_infos_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.lvar_saved_infos_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.lvar_saved_infos_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.lvar_saved_infos_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> lvar_saved_info_t """ return _ida_hexrays.lvar_saved_infos_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.lvar_saved_infos_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator lvar_saved_infos_t_swigregister = _ida_hexrays.lvar_saved_infos_t_swigregister lvar_saved_infos_t_swigregister(lvar_saved_infos_t) class ui_stroff_ops_t(object): """ Proxy of C++ qvector<(ui_stroff_op_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> ui_stroff_ops_t __init__(self, x) -> ui_stroff_ops_t """ this = _ida_hexrays.new_ui_stroff_ops_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_ui_stroff_ops_t __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> ui_stroff_op_t """ return _ida_hexrays.ui_stroff_ops_t_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.ui_stroff_ops_t_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.ui_stroff_ops_t_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.ui_stroff_ops_t_empty(self, *args) def at(self, *args): """ at(self, _idx) -> ui_stroff_op_t """ return _ida_hexrays.ui_stroff_ops_t_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.ui_stroff_ops_t_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.ui_stroff_ops_t_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.ui_stroff_ops_t_resize(self, *args) def grow(self, *args): """ grow(self, x=ui_stroff_op_t()) """ return _ida_hexrays.ui_stroff_ops_t_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.ui_stroff_ops_t_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.ui_stroff_ops_t_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.ui_stroff_ops_t_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.ui_stroff_ops_t_swap(self, *args) def extract(self, *args): """ extract(self) -> ui_stroff_op_t """ return _ida_hexrays.ui_stroff_ops_t_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.ui_stroff_ops_t_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.ui_stroff_ops_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.ui_stroff_ops_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> ui_stroff_op_t begin(self) -> ui_stroff_op_t """ return _ida_hexrays.ui_stroff_ops_t_begin(self, *args) def end(self, *args): """ end(self) -> ui_stroff_op_t end(self) -> ui_stroff_op_t """ return _ida_hexrays.ui_stroff_ops_t_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> ui_stroff_op_t """ return _ida_hexrays.ui_stroff_ops_t_insert(self, *args) def erase(self, *args): """ erase(self, it) -> ui_stroff_op_t erase(self, first, last) -> ui_stroff_op_t """ return _ida_hexrays.ui_stroff_ops_t_erase(self, *args) def find(self, *args): """ find(self, x) -> ui_stroff_op_t find(self, x) -> ui_stroff_op_t """ return _ida_hexrays.ui_stroff_ops_t_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.ui_stroff_ops_t_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.ui_stroff_ops_t_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.ui_stroff_ops_t__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.ui_stroff_ops_t___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> ui_stroff_op_t """ return _ida_hexrays.ui_stroff_ops_t___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.ui_stroff_ops_t___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator ui_stroff_ops_t_swigregister = _ida_hexrays.ui_stroff_ops_t_swigregister ui_stroff_ops_t_swigregister(ui_stroff_ops_t) def qswap(*args): """ qswap(a, b) """ return _ida_hexrays.qswap(*args) class fnum_array(object): """ Proxy of C++ wrapped_array_t<(uint16,6)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr data = _swig_property(_ida_hexrays.fnum_array_data_get) def __init__(self, *args): """ __init__(self, data) -> fnum_array """ this = _ida_hexrays.new_fnum_array(*args) try: self.this.append(this) except: self.this = this def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.fnum_array___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> unsigned short const & """ return _ida_hexrays.fnum_array___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.fnum_array___setitem__(self, *args) __iter__ = ida_idaapi._bounded_getitem_iterator __swig_destroy__ = _ida_hexrays.delete_fnum_array __del__ = lambda self : None; fnum_array_swigregister = _ida_hexrays.fnum_array_swigregister fnum_array_swigregister(fnum_array) def debug_hexrays_ctree(*args): """ debug_hexrays_ctree(msg) """ return _ida_hexrays.debug_hexrays_ctree(*args) def init_hexrays_plugin(*args): """ init_hexrays_plugin(flags=0) -> bool Initialize your plugin for hex-rays decompiler. This function must be called before calling any other decompiler function. It initializes the pointer to the dispatcher. @param flags: reserved, must be 0 (C++: int) @return: true if the decompiler exists and the dispatcher pointer is ready to use. """ return _ida_hexrays.init_hexrays_plugin(*args) def get_widget_vdui(*args): """ get_widget_vdui(f) -> vdui_t Get the 'vdui_t' instance associated to the TWidget @param f: pointer to window (C++: TWidget *) @return: a vdui_t *, or NULL """ return _ida_hexrays.get_widget_vdui(*args) def boundaries_find(*args): """ boundaries_find(map, key) -> boundaries_iterator_t Find the specified key in boundaries_t. @param map (C++: const boundaries_t *) @param key (C++: const cinsn_t *&) """ return _ida_hexrays.boundaries_find(*args) def boundaries_insert(*args): """ boundaries_insert(map, key, val) -> boundaries_iterator_t Insert new ( 'cinsn_t' *, 'rangeset_t' ) pair into boundaries_t. @param map (C++: boundaries_t *) @param key (C++: const cinsn_t *&) @param val (C++: const rangeset_t &) """ return _ida_hexrays.boundaries_insert(*args) def term_hexrays_plugin(*args): """ term_hexrays_plugin() Stop working with hex-rays decompiler. """ return _ida_hexrays.term_hexrays_plugin(*args) class Hexrays_Hooks(object): """ Proxy of C++ Hexrays_Hooks class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, _flags=0) -> Hexrays_Hooks """ if self.__class__ == Hexrays_Hooks: _self = None else: _self = self this = _ida_hexrays.new_Hexrays_Hooks(_self, *args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_Hexrays_Hooks __del__ = lambda self : None; def hook(self, *args): """ hook(self) -> bool """ return _ida_hexrays.Hexrays_Hooks_hook(self, *args) def unhook(self, *args): """ unhook(self) -> bool """ return _ida_hexrays.Hexrays_Hooks_unhook(self, *args) def flowchart(self, *args): """ flowchart(self, fc) -> int """ return _ida_hexrays.Hexrays_Hooks_flowchart(self, *args) def stkpnts(self, *args): """ stkpnts(self, mba, _sps) -> int """ return _ida_hexrays.Hexrays_Hooks_stkpnts(self, *args) def prolog(self, *args): """ prolog(self, mba, fc, reachable_blocks) -> int """ return _ida_hexrays.Hexrays_Hooks_prolog(self, *args) def microcode(self, *args): """ microcode(self, mba) -> int """ return _ida_hexrays.Hexrays_Hooks_microcode(self, *args) def preoptimized(self, *args): """ preoptimized(self, mba) -> int """ return _ida_hexrays.Hexrays_Hooks_preoptimized(self, *args) def locopt(self, *args): """ locopt(self, mba) -> int """ return _ida_hexrays.Hexrays_Hooks_locopt(self, *args) def prealloc(self, *args): """ prealloc(self, mba) -> int """ return _ida_hexrays.Hexrays_Hooks_prealloc(self, *args) def glbopt(self, *args): """ glbopt(self, mba) -> int """ return _ida_hexrays.Hexrays_Hooks_glbopt(self, *args) def structural(self, *args): """ structural(self, ct) -> int """ return _ida_hexrays.Hexrays_Hooks_structural(self, *args) def maturity(self, *args): """ maturity(self, cfunc, new_maturity) -> int """ return _ida_hexrays.Hexrays_Hooks_maturity(self, *args) def interr(self, *args): """ interr(self, errcode) -> int """ return _ida_hexrays.Hexrays_Hooks_interr(self, *args) def combine(self, *args): """ combine(self, blk, insn) -> int """ return _ida_hexrays.Hexrays_Hooks_combine(self, *args) def print_func(self, *args): """ print_func(self, cfunc, vp) -> int """ return _ida_hexrays.Hexrays_Hooks_print_func(self, *args) def func_printed(self, *args): """ func_printed(self, cfunc) -> int """ return _ida_hexrays.Hexrays_Hooks_func_printed(self, *args) def resolve_stkaddrs(self, *args): """ resolve_stkaddrs(self, mba) -> int """ return _ida_hexrays.Hexrays_Hooks_resolve_stkaddrs(self, *args) def open_pseudocode(self, *args): """ open_pseudocode(self, vu) -> int """ return _ida_hexrays.Hexrays_Hooks_open_pseudocode(self, *args) def switch_pseudocode(self, *args): """ switch_pseudocode(self, vu) -> int """ return _ida_hexrays.Hexrays_Hooks_switch_pseudocode(self, *args) def refresh_pseudocode(self, *args): """ refresh_pseudocode(self, vu) -> int """ return _ida_hexrays.Hexrays_Hooks_refresh_pseudocode(self, *args) def close_pseudocode(self, *args): """ close_pseudocode(self, vu) -> int """ return _ida_hexrays.Hexrays_Hooks_close_pseudocode(self, *args) def keyboard(self, *args): """ keyboard(self, vu, key_code, shift_state) -> int """ return _ida_hexrays.Hexrays_Hooks_keyboard(self, *args) def right_click(self, *args): """ right_click(self, vu) -> int """ return _ida_hexrays.Hexrays_Hooks_right_click(self, *args) def double_click(self, *args): """ double_click(self, vu, shift_state) -> int """ return _ida_hexrays.Hexrays_Hooks_double_click(self, *args) def curpos(self, *args): """ curpos(self, vu) -> int """ return _ida_hexrays.Hexrays_Hooks_curpos(self, *args) def create_hint(self, *args): """ create_hint(self, vu) -> PyObject * """ return _ida_hexrays.Hexrays_Hooks_create_hint(self, *args) def text_ready(self, *args): """ text_ready(self, vu) -> int """ return _ida_hexrays.Hexrays_Hooks_text_ready(self, *args) def populating_popup(self, *args): """ populating_popup(self, widget, popup_handle, vu) -> int """ return _ida_hexrays.Hexrays_Hooks_populating_popup(self, *args) def lvar_name_changed(self, *args): """ lvar_name_changed(self, vu, v, name, is_user_name) -> int """ return _ida_hexrays.Hexrays_Hooks_lvar_name_changed(self, *args) def lvar_type_changed(self, *args): """ lvar_type_changed(self, vu, v, tinfo) -> int """ return _ida_hexrays.Hexrays_Hooks_lvar_type_changed(self, *args) def lvar_cmt_changed(self, *args): """ lvar_cmt_changed(self, vu, v, cmt) -> int """ return _ida_hexrays.Hexrays_Hooks_lvar_cmt_changed(self, *args) def lvar_mapping_changed(self, *args): """ lvar_mapping_changed(self, vu, frm, to) -> int """ return _ida_hexrays.Hexrays_Hooks_lvar_mapping_changed(self, *args) def cmt_changed(self, *args): """ cmt_changed(self, cfunc, loc, cmt) -> int """ return _ida_hexrays.Hexrays_Hooks_cmt_changed(self, *args) def __disown__(self): self.this.disown() _ida_hexrays.disown_Hexrays_Hooks(self) return weakref_proxy(self) Hexrays_Hooks_swigregister = _ida_hexrays.Hexrays_Hooks_swigregister Hexrays_Hooks_swigregister(Hexrays_Hooks) class uval_ivl_t(object): """ Proxy of C++ ivl_tpl<(uval_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr off = _swig_property(_ida_hexrays.uval_ivl_t_off_get, _ida_hexrays.uval_ivl_t_off_set) size = _swig_property(_ida_hexrays.uval_ivl_t_size_get, _ida_hexrays.uval_ivl_t_size_set) def __init__(self, *args): """ __init__(self, _off, _size) -> uval_ivl_t """ this = _ida_hexrays.new_uval_ivl_t(*args) try: self.this.append(this) except: self.this = this def valid(self, *args): """ valid(self) -> bool """ return _ida_hexrays.uval_ivl_t_valid(self, *args) def end(self, *args): """ end(self) -> unsigned long long """ return _ida_hexrays.uval_ivl_t_end(self, *args) def last(self, *args): """ last(self) -> unsigned long long """ return _ida_hexrays.uval_ivl_t_last(self, *args) __swig_destroy__ = _ida_hexrays.delete_uval_ivl_t __del__ = lambda self : None; uval_ivl_t_swigregister = _ida_hexrays.uval_ivl_t_swigregister uval_ivl_t_swigregister(uval_ivl_t) class uval_ivl_ivlset_t(object): """ Proxy of C++ ivlset_tpl<(ivl_t,uval_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> uval_ivl_ivlset_t __init__(self, ivl) -> uval_ivl_ivlset_t """ this = _ida_hexrays.new_uval_ivl_ivlset_t(*args) try: self.this.append(this) except: self.this = this def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.uval_ivl_ivlset_t_swap(self, *args) def getivl(self, *args): """ getivl(self, idx) -> ivl_t """ return _ida_hexrays.uval_ivl_ivlset_t_getivl(self, *args) def lastivl(self, *args): """ lastivl(self) -> ivl_t """ return _ida_hexrays.uval_ivl_ivlset_t_lastivl(self, *args) def nivls(self, *args): """ nivls(self) -> size_t """ return _ida_hexrays.uval_ivl_ivlset_t_nivls(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.uval_ivl_ivlset_t_empty(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.uval_ivl_ivlset_t_clear(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.uval_ivl_ivlset_t_qclear(self, *args) def all_values(self, *args): """ all_values(self) -> bool """ return _ida_hexrays.uval_ivl_ivlset_t_all_values(self, *args) def set_all_values(self, *args): """ set_all_values(self) """ return _ida_hexrays.uval_ivl_ivlset_t_set_all_values(self, *args) def single_value(self, *args): """ single_value(self, v) -> bool """ return _ida_hexrays.uval_ivl_ivlset_t_single_value(self, *args) def __eq__(self, *args): """ __eq__(self, v) -> bool """ return _ida_hexrays.uval_ivl_ivlset_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, v) -> bool """ return _ida_hexrays.uval_ivl_ivlset_t___ne__(self, *args) def begin(self, *args): """ begin(self) -> ivlset_tpl< ivl_t,unsigned long long >::const_iterator begin(self) -> ivlset_tpl< ivl_t,unsigned long long >::iterator """ return _ida_hexrays.uval_ivl_ivlset_t_begin(self, *args) def end(self, *args): """ end(self) -> ivlset_tpl< ivl_t,unsigned long long >::const_iterator end(self) -> ivlset_tpl< ivl_t,unsigned long long >::iterator """ return _ida_hexrays.uval_ivl_ivlset_t_end(self, *args) __swig_destroy__ = _ida_hexrays.delete_uval_ivl_ivlset_t __del__ = lambda self : None; uval_ivl_ivlset_t_swigregister = _ida_hexrays.uval_ivl_ivlset_t_swigregister uval_ivl_ivlset_t_swigregister(uval_ivl_ivlset_t) class array_of_ivlsets(object): """ Proxy of C++ qvector<(ivlset_t)> class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> array_of_ivlsets __init__(self, x) -> array_of_ivlsets """ this = _ida_hexrays.new_array_of_ivlsets(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_array_of_ivlsets __del__ = lambda self : None; def push_back(self, *args): """ push_back(self, x) push_back(self) -> ivlset_t """ return _ida_hexrays.array_of_ivlsets_push_back(self, *args) def pop_back(self, *args): """ pop_back(self) """ return _ida_hexrays.array_of_ivlsets_pop_back(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.array_of_ivlsets_size(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.array_of_ivlsets_empty(self, *args) def at(self, *args): """ at(self, _idx) -> ivlset_t """ return _ida_hexrays.array_of_ivlsets_at(self, *args) def qclear(self, *args): """ qclear(self) """ return _ida_hexrays.array_of_ivlsets_qclear(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.array_of_ivlsets_clear(self, *args) def resize(self, *args): """ resize(self, _newsize, x) resize(self, _newsize) """ return _ida_hexrays.array_of_ivlsets_resize(self, *args) def grow(self, *args): """ grow(self, x=ivlset_t()) """ return _ida_hexrays.array_of_ivlsets_grow(self, *args) def capacity(self, *args): """ capacity(self) -> size_t """ return _ida_hexrays.array_of_ivlsets_capacity(self, *args) def reserve(self, *args): """ reserve(self, cnt) """ return _ida_hexrays.array_of_ivlsets_reserve(self, *args) def truncate(self, *args): """ truncate(self) """ return _ida_hexrays.array_of_ivlsets_truncate(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.array_of_ivlsets_swap(self, *args) def extract(self, *args): """ extract(self) -> ivlset_t """ return _ida_hexrays.array_of_ivlsets_extract(self, *args) def inject(self, *args): """ inject(self, s, len) """ return _ida_hexrays.array_of_ivlsets_inject(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.array_of_ivlsets___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.array_of_ivlsets___ne__(self, *args) def begin(self, *args): """ begin(self) -> ivlset_t begin(self) -> ivlset_t """ return _ida_hexrays.array_of_ivlsets_begin(self, *args) def end(self, *args): """ end(self) -> ivlset_t end(self) -> ivlset_t """ return _ida_hexrays.array_of_ivlsets_end(self, *args) def insert(self, *args): """ insert(self, it, x) -> ivlset_t """ return _ida_hexrays.array_of_ivlsets_insert(self, *args) def erase(self, *args): """ erase(self, it) -> ivlset_t erase(self, first, last) -> ivlset_t """ return _ida_hexrays.array_of_ivlsets_erase(self, *args) def find(self, *args): """ find(self, x) -> ivlset_t find(self, x) -> ivlset_t """ return _ida_hexrays.array_of_ivlsets_find(self, *args) def has(self, *args): """ has(self, x) -> bool """ return _ida_hexrays.array_of_ivlsets_has(self, *args) def add_unique(self, *args): """ add_unique(self, x) -> bool """ return _ida_hexrays.array_of_ivlsets_add_unique(self, *args) def _del(self, *args): """ _del(self, x) -> bool """ return _ida_hexrays.array_of_ivlsets__del(self, *args) def __len__(self, *args): """ __len__(self) -> size_t """ return _ida_hexrays.array_of_ivlsets___len__(self, *args) def __getitem__(self, *args): """ __getitem__(self, i) -> ivlset_t """ return _ida_hexrays.array_of_ivlsets___getitem__(self, *args) def __setitem__(self, *args): """ __setitem__(self, i, v) """ return _ida_hexrays.array_of_ivlsets___setitem__(self, *args) front = ida_idaapi._qvector_front back = ida_idaapi._qvector_back __iter__ = ida_idaapi._bounded_getitem_iterator array_of_ivlsets_swigregister = _ida_hexrays.array_of_ivlsets_swigregister array_of_ivlsets_swigregister(array_of_ivlsets) MAX_SUPPORTED_STACK_SIZE = _ida_hexrays.MAX_SUPPORTED_STACK_SIZE def hexrays_alloc(*args): """ hexrays_alloc(size) -> void * """ return _ida_hexrays.hexrays_alloc(*args) def hexrays_free(*args): """ hexrays_free(ptr) """ return _ida_hexrays.hexrays_free(*args) MAX_VLR_SIZE = _ida_hexrays.MAX_VLR_SIZE CMP_NZ = _ida_hexrays.CMP_NZ CMP_Z = _ida_hexrays.CMP_Z CMP_AE = _ida_hexrays.CMP_AE CMP_B = _ida_hexrays.CMP_B CMP_A = _ida_hexrays.CMP_A CMP_BE = _ida_hexrays.CMP_BE CMP_GT = _ida_hexrays.CMP_GT CMP_GE = _ida_hexrays.CMP_GE CMP_LT = _ida_hexrays.CMP_LT CMP_LE = _ida_hexrays.CMP_LE class valrng_t(object): """ Proxy of C++ valrng_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, size_=MAX_VLR_SIZE) -> valrng_t __init__(self, r) -> valrng_t """ this = _ida_hexrays.new_valrng_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_valrng_t __del__ = lambda self : None; def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.valrng_t_swap(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.valrng_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.valrng_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.valrng_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.valrng_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.valrng_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.valrng_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.valrng_t_compare(self, *args) def set_none(self, *args): """ set_none(self) """ return _ida_hexrays.valrng_t_set_none(self, *args) def set_all(self, *args): """ set_all(self) """ return _ida_hexrays.valrng_t_set_all(self, *args) def set_unk(self, *args): """ set_unk(self) """ return _ida_hexrays.valrng_t_set_unk(self, *args) def set_eq(self, *args): """ set_eq(self, v) """ return _ida_hexrays.valrng_t_set_eq(self, *args) def set_cmp(self, *args): """ set_cmp(self, cmp, _value) """ return _ida_hexrays.valrng_t_set_cmp(self, *args) def reduce_size(self, *args): """ reduce_size(self, new_size) -> bool """ return _ida_hexrays.valrng_t_reduce_size(self, *args) def intersect_with(self, *args): """ intersect_with(self, r) -> bool """ return _ida_hexrays.valrng_t_intersect_with(self, *args) def unite_with(self, *args): """ unite_with(self, r) -> bool """ return _ida_hexrays.valrng_t_unite_with(self, *args) def inverse(self, *args): """ inverse(self) """ return _ida_hexrays.valrng_t_inverse(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.valrng_t_empty(self, *args) def all_values(self, *args): """ all_values(self) -> bool """ return _ida_hexrays.valrng_t_all_values(self, *args) def is_unknown(self, *args): """ is_unknown(self) -> bool """ return _ida_hexrays.valrng_t_is_unknown(self, *args) def has(self, *args): """ has(self, v) -> bool """ return _ida_hexrays.valrng_t_has(self, *args) def _print(self, *args): """ _print(self) """ return _ida_hexrays.valrng_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.valrng_t_dstr(self, *args) def cvt_to_single_value(self, *args): """ cvt_to_single_value(self) -> bool """ return _ida_hexrays.valrng_t_cvt_to_single_value(self, *args) def cvt_to_cmp(self, *args): """ cvt_to_cmp(self, strict) -> bool """ return _ida_hexrays.valrng_t_cvt_to_cmp(self, *args) def get_size(self, *args): """ get_size(self) -> int """ return _ida_hexrays.valrng_t_get_size(self, *args) def max_value(self, *args): """ max_value(self, size_) -> uvlr_t max_value(self) -> uvlr_t """ return _ida_hexrays.valrng_t_max_value(self, *args) def min_svalue(self, *args): """ min_svalue(self, size_) -> uvlr_t min_svalue(self) -> uvlr_t """ return _ida_hexrays.valrng_t_min_svalue(self, *args) def max_svalue(self, *args): """ max_svalue(self, size_) -> uvlr_t max_svalue(self) -> uvlr_t """ return _ida_hexrays.valrng_t_max_svalue(self, *args) def _register(self, *args): """ _register(self) """ return _ida_hexrays.valrng_t__register(self, *args) def _deregister(self, *args): """ _deregister(self) """ return _ida_hexrays.valrng_t__deregister(self, *args) valrng_t_swigregister = _ida_hexrays.valrng_t_swigregister valrng_t_swigregister(valrng_t) cvar = _ida_hexrays.cvar MAX_VALUE = cvar.MAX_VALUE MAX_SVALUE = cvar.MAX_SVALUE MIN_SVALUE = cvar.MIN_SVALUE NO_ACCESS = _ida_hexrays.NO_ACCESS WRITE_ACCESS = _ida_hexrays.WRITE_ACCESS READ_ACCESS = _ida_hexrays.READ_ACCESS RW_ACCESS = _ida_hexrays.RW_ACCESS def is_may_access(*args): """ is_may_access(maymust) -> bool """ return _ida_hexrays.is_may_access(*args) MERR_OK = _ida_hexrays.MERR_OK MERR_BLOCK = _ida_hexrays.MERR_BLOCK MERR_INTERR = _ida_hexrays.MERR_INTERR MERR_INSN = _ida_hexrays.MERR_INSN MERR_MEM = _ida_hexrays.MERR_MEM MERR_BADBLK = _ida_hexrays.MERR_BADBLK MERR_BADSP = _ida_hexrays.MERR_BADSP MERR_PROLOG = _ida_hexrays.MERR_PROLOG MERR_SWITCH = _ida_hexrays.MERR_SWITCH MERR_EXCEPTION = _ida_hexrays.MERR_EXCEPTION MERR_HUGESTACK = _ida_hexrays.MERR_HUGESTACK MERR_LVARS = _ida_hexrays.MERR_LVARS MERR_BITNESS = _ida_hexrays.MERR_BITNESS MERR_BADCALL = _ida_hexrays.MERR_BADCALL MERR_BADFRAME = _ida_hexrays.MERR_BADFRAME MERR_UNKTYPE = _ida_hexrays.MERR_UNKTYPE MERR_BADIDB = _ida_hexrays.MERR_BADIDB MERR_SIZEOF = _ida_hexrays.MERR_SIZEOF MERR_REDO = _ida_hexrays.MERR_REDO MERR_CANCELED = _ida_hexrays.MERR_CANCELED MERR_RECDEPTH = _ida_hexrays.MERR_RECDEPTH MERR_OVERLAP = _ida_hexrays.MERR_OVERLAP MERR_PARTINIT = _ida_hexrays.MERR_PARTINIT MERR_COMPLEX = _ida_hexrays.MERR_COMPLEX MERR_LICENSE = _ida_hexrays.MERR_LICENSE MERR_ONLY32 = _ida_hexrays.MERR_ONLY32 MERR_ONLY64 = _ida_hexrays.MERR_ONLY64 MERR_BUSY = _ida_hexrays.MERR_BUSY MERR_FARPTR = _ida_hexrays.MERR_FARPTR MERR_EXTERN = _ida_hexrays.MERR_EXTERN MERR_FUNCSIZE = _ida_hexrays.MERR_FUNCSIZE MERR_BADRANGES = _ida_hexrays.MERR_BADRANGES MERR_STOP = _ida_hexrays.MERR_STOP MERR_MAX_ERR = _ida_hexrays.MERR_MAX_ERR MERR_LOOP = _ida_hexrays.MERR_LOOP def get_merror_desc(*args): """ get_merror_desc(code, mba) -> ea_t Get textual description of an error code @param code: Microcode error codes (C++: merror_t) @param mba: the microcode array (C++: mbl_array_t *) @return: the error address """ return _ida_hexrays.get_merror_desc(*args) def reg2mreg(*args): """ reg2mreg(reg) -> mreg_t Map a processor register to microregister. @param reg: processor register number (C++: int) @return: microregister register id or mr_none """ return _ida_hexrays.reg2mreg(*args) def mreg2reg(*args): """ mreg2reg(reg, width) -> int Map a microregister to processor register. @param reg: microregister number (C++: mreg_t) @param width: size of microregister in bytes (C++: int) @return: processor register id or -1 """ return _ida_hexrays.mreg2reg(*args) class optinsn_t(object): """ Proxy of C++ optinsn_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def func(self, *args): """ func(self, blk, ins) -> int """ return _ida_hexrays.optinsn_t_func(self, *args) def install(self, *args): """ install(self) """ return _ida_hexrays.optinsn_t_install(self, *args) def remove(self, *args): """ remove(self) -> bool """ return _ida_hexrays.optinsn_t_remove(self, *args) __swig_destroy__ = _ida_hexrays.delete_optinsn_t __del__ = lambda self : None; def __init__(self, *args): """ __init__(self) -> optinsn_t """ if self.__class__ == optinsn_t: _self = None else: _self = self this = _ida_hexrays.new_optinsn_t(_self, *args) try: self.this.append(this) except: self.this = this def __disown__(self): self.this.disown() _ida_hexrays.disown_optinsn_t(self) return weakref_proxy(self) optinsn_t_swigregister = _ida_hexrays.optinsn_t_swigregister optinsn_t_swigregister(optinsn_t) MUST_ACCESS = cvar.MUST_ACCESS MAY_ACCESS = cvar.MAY_ACCESS MAYMUST_ACCESS_MASK = cvar.MAYMUST_ACCESS_MASK ONE_ACCESS_TYPE = cvar.ONE_ACCESS_TYPE INCLUDE_SPOILED_REGS = cvar.INCLUDE_SPOILED_REGS EXCLUDE_PASS_REGS = cvar.EXCLUDE_PASS_REGS FULL_XDSU = cvar.FULL_XDSU WITH_ASSERTS = cvar.WITH_ASSERTS EXCLUDE_VOLATILE = cvar.EXCLUDE_VOLATILE INCLUDE_UNUSED_SRC = cvar.INCLUDE_UNUSED_SRC INCLUDE_DEAD_RETREGS = cvar.INCLUDE_DEAD_RETREGS INCLUDE_RESTRICTED = cvar.INCLUDE_RESTRICTED CALL_SPOILS_ONLY_ARGS = cvar.CALL_SPOILS_ONLY_ARGS class optblock_t(object): """ Proxy of C++ optblock_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def func(self, *args): """ func(self, blk) -> int """ return _ida_hexrays.optblock_t_func(self, *args) def install(self, *args): """ install(self) """ return _ida_hexrays.optblock_t_install(self, *args) def remove(self, *args): """ remove(self) -> bool """ return _ida_hexrays.optblock_t_remove(self, *args) __swig_destroy__ = _ida_hexrays.delete_optblock_t __del__ = lambda self : None; def __init__(self, *args): """ __init__(self) -> optblock_t """ if self.__class__ == optblock_t: _self = None else: _self = self this = _ida_hexrays.new_optblock_t(_self, *args) try: self.this.append(this) except: self.this = this def __disown__(self): self.this.disown() _ida_hexrays.disown_optblock_t(self) return weakref_proxy(self) optblock_t_swigregister = _ida_hexrays.optblock_t_swigregister optblock_t_swigregister(optblock_t) m_nop = _ida_hexrays.m_nop m_stx = _ida_hexrays.m_stx m_ldx = _ida_hexrays.m_ldx m_ldc = _ida_hexrays.m_ldc m_mov = _ida_hexrays.m_mov m_neg = _ida_hexrays.m_neg m_lnot = _ida_hexrays.m_lnot m_bnot = _ida_hexrays.m_bnot m_xds = _ida_hexrays.m_xds m_xdu = _ida_hexrays.m_xdu m_low = _ida_hexrays.m_low m_high = _ida_hexrays.m_high m_add = _ida_hexrays.m_add m_sub = _ida_hexrays.m_sub m_mul = _ida_hexrays.m_mul m_udiv = _ida_hexrays.m_udiv m_sdiv = _ida_hexrays.m_sdiv m_umod = _ida_hexrays.m_umod m_smod = _ida_hexrays.m_smod m_or = _ida_hexrays.m_or m_and = _ida_hexrays.m_and m_xor = _ida_hexrays.m_xor m_shl = _ida_hexrays.m_shl m_shr = _ida_hexrays.m_shr m_sar = _ida_hexrays.m_sar m_cfadd = _ida_hexrays.m_cfadd m_ofadd = _ida_hexrays.m_ofadd m_cfshl = _ida_hexrays.m_cfshl m_cfshr = _ida_hexrays.m_cfshr m_sets = _ida_hexrays.m_sets m_seto = _ida_hexrays.m_seto m_setp = _ida_hexrays.m_setp m_setnz = _ida_hexrays.m_setnz m_setz = _ida_hexrays.m_setz m_setae = _ida_hexrays.m_setae m_setb = _ida_hexrays.m_setb m_seta = _ida_hexrays.m_seta m_setbe = _ida_hexrays.m_setbe m_setg = _ida_hexrays.m_setg m_setge = _ida_hexrays.m_setge m_setl = _ida_hexrays.m_setl m_setle = _ida_hexrays.m_setle m_jcnd = _ida_hexrays.m_jcnd m_jnz = _ida_hexrays.m_jnz m_jz = _ida_hexrays.m_jz m_jae = _ida_hexrays.m_jae m_jb = _ida_hexrays.m_jb m_ja = _ida_hexrays.m_ja m_jbe = _ida_hexrays.m_jbe m_jg = _ida_hexrays.m_jg m_jge = _ida_hexrays.m_jge m_jl = _ida_hexrays.m_jl m_jle = _ida_hexrays.m_jle m_jtbl = _ida_hexrays.m_jtbl m_ijmp = _ida_hexrays.m_ijmp m_goto = _ida_hexrays.m_goto m_call = _ida_hexrays.m_call m_icall = _ida_hexrays.m_icall m_ret = _ida_hexrays.m_ret m_push = _ida_hexrays.m_push m_pop = _ida_hexrays.m_pop m_und = _ida_hexrays.m_und m_ext = _ida_hexrays.m_ext m_f2i = _ida_hexrays.m_f2i m_f2u = _ida_hexrays.m_f2u m_i2f = _ida_hexrays.m_i2f m_u2f = _ida_hexrays.m_u2f m_f2f = _ida_hexrays.m_f2f m_fneg = _ida_hexrays.m_fneg m_fadd = _ida_hexrays.m_fadd m_fsub = _ida_hexrays.m_fsub m_fmul = _ida_hexrays.m_fmul m_fdiv = _ida_hexrays.m_fdiv def must_mcode_close_block(*args): """ must_mcode_close_block(mcode, including_calls) -> bool Must an instruction with the given opcode be the last one in a block? Such opcodes are called closing opcodes. @param mcode: instruction opcode (C++: mcode_t) @param including_calls: should m_call/m_icall be considered as the closing opcodes? If this function returns true, the opcode cannot appear in the middle of a block. Calls are a special case because before MMAT_CALLS they are closing opcodes. Afteer MMAT_CALLS that are not considered as closing opcodes. (C++: bool) """ return _ida_hexrays.must_mcode_close_block(*args) def is_mcode_propagatable(*args): """ is_mcode_propagatable(mcode) -> bool May opcode be propagated? Such opcodes can be used in sub-instructions (nested instructions) There is a handful of non-propagatable opcodes, like jumps, ret, nop, etc All other regular opcodes are propagatable and may appear in a nested instruction. @param mcode (C++: mcode_t) """ return _ida_hexrays.is_mcode_propagatable(*args) def is_mcode_addsub(*args): """ is_mcode_addsub(mcode) -> bool """ return _ida_hexrays.is_mcode_addsub(*args) def is_mcode_xdsu(*args): """ is_mcode_xdsu(mcode) -> bool """ return _ida_hexrays.is_mcode_xdsu(*args) def is_mcode_set(*args): """ is_mcode_set(mcode) -> bool """ return _ida_hexrays.is_mcode_set(*args) def is_mcode_set1(*args): """ is_mcode_set1(mcode) -> bool """ return _ida_hexrays.is_mcode_set1(*args) def is_mcode_j1(*args): """ is_mcode_j1(mcode) -> bool """ return _ida_hexrays.is_mcode_j1(*args) def is_mcode_jcond(*args): """ is_mcode_jcond(mcode) -> bool """ return _ida_hexrays.is_mcode_jcond(*args) def is_mcode_convertible_to_jmp(*args): """ is_mcode_convertible_to_jmp(mcode) -> bool """ return _ida_hexrays.is_mcode_convertible_to_jmp(*args) def is_mcode_convertible_to_set(*args): """ is_mcode_convertible_to_set(mcode) -> bool """ return _ida_hexrays.is_mcode_convertible_to_set(*args) def is_mcode_call(*args): """ is_mcode_call(mcode) -> bool """ return _ida_hexrays.is_mcode_call(*args) def is_mcode_fpu(*args): """ is_mcode_fpu(mcode) -> bool """ return _ida_hexrays.is_mcode_fpu(*args) def is_mcode_commutative(*args): """ is_mcode_commutative(mcode) -> bool """ return _ida_hexrays.is_mcode_commutative(*args) def is_mcode_shift(*args): """ is_mcode_shift(mcode) -> bool """ return _ida_hexrays.is_mcode_shift(*args) def is_mcode_divmod(*args): """ is_mcode_divmod(op) -> bool """ return _ida_hexrays.is_mcode_divmod(*args) def set2jcnd(*args): """ set2jcnd(code) -> mcode_t """ return _ida_hexrays.set2jcnd(*args) def jcnd2set(*args): """ jcnd2set(code) -> mcode_t """ return _ida_hexrays.jcnd2set(*args) def negate_mcode_relation(*args): """ negate_mcode_relation(code) -> mcode_t """ return _ida_hexrays.negate_mcode_relation(*args) def swap_mcode_relation(*args): """ swap_mcode_relation(code) -> mcode_t """ return _ida_hexrays.swap_mcode_relation(*args) def get_signed_mcode(*args): """ get_signed_mcode(code) -> mcode_t """ return _ida_hexrays.get_signed_mcode(*args) def get_unsigned_mcode(*args): """ get_unsigned_mcode(code) -> mcode_t """ return _ida_hexrays.get_unsigned_mcode(*args) def is_signed_mcode(*args): """ is_signed_mcode(code) -> bool """ return _ida_hexrays.is_signed_mcode(*args) def is_unsigned_mcode(*args): """ is_unsigned_mcode(code) -> bool """ return _ida_hexrays.is_unsigned_mcode(*args) def mcode_modifies_d(*args): """ mcode_modifies_d(mcode) -> bool """ return _ida_hexrays.mcode_modifies_d(*args) class operand_locator_t(object): """ Proxy of C++ operand_locator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ea = _swig_property(_ida_hexrays.operand_locator_t_ea_get, _ida_hexrays.operand_locator_t_ea_set) opnum = _swig_property(_ida_hexrays.operand_locator_t_opnum_get, _ida_hexrays.operand_locator_t_opnum_set) def __init__(self, *args): """ __init__(self, _ea, _opnum) -> operand_locator_t """ this = _ida_hexrays.new_operand_locator_t(*args) try: self.this.append(this) except: self.this = this def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.operand_locator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.operand_locator_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.operand_locator_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.operand_locator_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.operand_locator_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.operand_locator_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.operand_locator_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_operand_locator_t __del__ = lambda self : None; operand_locator_t_swigregister = _ida_hexrays.operand_locator_t_swigregister operand_locator_t_swigregister(operand_locator_t) mr_none = cvar.mr_none mr_cf = cvar.mr_cf mr_zf = cvar.mr_zf mr_sf = cvar.mr_sf mr_of = cvar.mr_of mr_pf = cvar.mr_pf cc_count = cvar.cc_count mr_cc = cvar.mr_cc mr_first = cvar.mr_first class number_format_t(object): """ Proxy of C++ number_format_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr flags = _swig_property(_ida_hexrays.number_format_t_flags_get, _ida_hexrays.number_format_t_flags_set) opnum = _swig_property(_ida_hexrays.number_format_t_opnum_get, _ida_hexrays.number_format_t_opnum_set) props = _swig_property(_ida_hexrays.number_format_t_props_get, _ida_hexrays.number_format_t_props_set) serial = _swig_property(_ida_hexrays.number_format_t_serial_get, _ida_hexrays.number_format_t_serial_set) org_nbytes = _swig_property(_ida_hexrays.number_format_t_org_nbytes_get, _ida_hexrays.number_format_t_org_nbytes_set) type_name = _swig_property(_ida_hexrays.number_format_t_type_name_get, _ida_hexrays.number_format_t_type_name_set) def __init__(self, *args): """ __init__(self, _opnum=0) -> number_format_t """ this = _ida_hexrays.new_number_format_t(*args) try: self.this.append(this) except: self.this = this def get_radix(self, *args): """ get_radix(self) -> int """ return _ida_hexrays.number_format_t_get_radix(self, *args) def is_fixed(self, *args): """ is_fixed(self) -> bool """ return _ida_hexrays.number_format_t_is_fixed(self, *args) def is_hex(self, *args): """ is_hex(self) -> bool """ return _ida_hexrays.number_format_t_is_hex(self, *args) def is_dec(self, *args): """ is_dec(self) -> bool """ return _ida_hexrays.number_format_t_is_dec(self, *args) def is_oct(self, *args): """ is_oct(self) -> bool """ return _ida_hexrays.number_format_t_is_oct(self, *args) def is_enum(self, *args): """ is_enum(self) -> bool """ return _ida_hexrays.number_format_t_is_enum(self, *args) def is_char(self, *args): """ is_char(self) -> bool """ return _ida_hexrays.number_format_t_is_char(self, *args) def is_stroff(self, *args): """ is_stroff(self) -> bool """ return _ida_hexrays.number_format_t_is_stroff(self, *args) def is_numop(self, *args): """ is_numop(self) -> bool """ return _ida_hexrays.number_format_t_is_numop(self, *args) def needs_to_be_inverted(self, *args): """ needs_to_be_inverted(self) -> bool """ return _ida_hexrays.number_format_t_needs_to_be_inverted(self, *args) __swig_destroy__ = _ida_hexrays.delete_number_format_t __del__ = lambda self : None; number_format_t_swigregister = _ida_hexrays.number_format_t_swigregister number_format_t_swigregister(number_format_t) NF_FIXED = _ida_hexrays.NF_FIXED """ number format has been defined by the user """ NF_NEGDONE = _ida_hexrays.NF_NEGDONE """ temporary internal bit: negation has been performed """ NF_BINVDONE = _ida_hexrays.NF_BINVDONE """ temporary internal bit: inverting bits is done """ NF_NEGATE = _ida_hexrays.NF_NEGATE """ The user asked to negate the constant. """ NF_BITNOT = _ida_hexrays.NF_BITNOT """ The user asked to invert bits of the constant. """ NF_STROFF = _ida_hexrays.NF_STROFF """ internal bit: used as stroff, valid iff 'is_stroff()' """ class vd_printer_t(object): """ Proxy of C++ vd_printer_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr tmpbuf = _swig_property(_ida_hexrays.vd_printer_t_tmpbuf_get, _ida_hexrays.vd_printer_t_tmpbuf_set) hdrlines = _swig_property(_ida_hexrays.vd_printer_t_hdrlines_get, _ida_hexrays.vd_printer_t_hdrlines_set) def _print(self, *args): """ _print(self, indent, format) -> int """ return _ida_hexrays.vd_printer_t__print(self, *args) def __init__(self, *args): """ __init__(self) -> vd_printer_t """ if self.__class__ == vd_printer_t: _self = None else: _self = self this = _ida_hexrays.new_vd_printer_t(_self, *args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_vd_printer_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_vd_printer_t(self) return weakref_proxy(self) vd_printer_t_swigregister = _ida_hexrays.vd_printer_t_swigregister vd_printer_t_swigregister(vd_printer_t) class vc_printer_t(vd_printer_t): """ Proxy of C++ vc_printer_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr func = _swig_property(_ida_hexrays.vc_printer_t_func_get, _ida_hexrays.vc_printer_t_func_set) lastchar = _swig_property(_ida_hexrays.vc_printer_t_lastchar_get, _ida_hexrays.vc_printer_t_lastchar_set) def __init__(self, *args): """ __init__(self, f) -> vc_printer_t """ if self.__class__ == vc_printer_t: _self = None else: _self = self this = _ida_hexrays.new_vc_printer_t(_self, *args) try: self.this.append(this) except: self.this = this def oneliner(self, *args): """ oneliner(self) -> bool """ return _ida_hexrays.vc_printer_t_oneliner(self, *args) __swig_destroy__ = _ida_hexrays.delete_vc_printer_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_vc_printer_t(self) return weakref_proxy(self) vc_printer_t_swigregister = _ida_hexrays.vc_printer_t_swigregister vc_printer_t_swigregister(vc_printer_t) class qstring_printer_t(vc_printer_t): """ Proxy of C++ qstring_printer_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr with_tags = _swig_property(_ida_hexrays.qstring_printer_t_with_tags_get, _ida_hexrays.qstring_printer_t_with_tags_set) s = _swig_property(_ida_hexrays.qstring_printer_t_s_get, _ida_hexrays.qstring_printer_t_s_set) def _print(self, *args): """ _print(self, indent, format) -> int """ return _ida_hexrays.qstring_printer_t__print(self, *args) def __init__(self, *args): """ __init__(self, f, tags) -> qstring_printer_t """ this = _ida_hexrays.new_qstring_printer_t(*args) try: self.this.append(this) except: self.this = this def get_s(self, *args): """ get_s(self) -> qstring """ return _ida_hexrays.qstring_printer_t_get_s(self, *args) s = property(lambda self: self.get_s()) qstring_printer_t_swigregister = _ida_hexrays.qstring_printer_t_swigregister qstring_printer_t_swigregister(qstring_printer_t) def dstr(*args): """ dstr(tif) -> char const * Print the specified type info. This function can be used from a debugger by typing "tif->dstr()" @param tif (C++: const tinfo_t *) """ return _ida_hexrays.dstr(*args) def is_type_correct(*args): """ is_type_correct(ptr) -> bool Verify a type string. @param ptr (C++: const type_t *) @return: true if type string is correct """ return _ida_hexrays.is_type_correct(*args) def is_small_udt(*args): """ is_small_udt(tif) -> bool Is a small structure or union? @param tif (C++: const tinfo_t &) @return: true if the type is a small UDT (user defined type). Small UDTs fit into a register (or pair or registers) as a rule. """ return _ida_hexrays.is_small_udt(*args) def is_nonbool_type(*args): """ is_nonbool_type(type) -> bool Is definitely a non-boolean type? @param type (C++: const tinfo_t &) @return: true if the type is a non-boolean type (non bool and well defined) """ return _ida_hexrays.is_nonbool_type(*args) def is_bool_type(*args): """ is_bool_type(type) -> bool Is a boolean type? @param type (C++: const tinfo_t &) @return: true if the type is a boolean type """ return _ida_hexrays.is_bool_type(*args) def is_ptr_or_array(*args): """ is_ptr_or_array(t) -> bool Is a pointer or array type? @param t (C++: type_t) """ return _ida_hexrays.is_ptr_or_array(*args) def is_paf(*args): """ is_paf(t) -> bool Is a pointer, array, or function type? @param t (C++: type_t) """ return _ida_hexrays.is_paf(*args) def is_inplace_def(*args): """ is_inplace_def(type) -> bool Is struct/union/enum definition (not declaration)? @param type (C++: const tinfo_t &) """ return _ida_hexrays.is_inplace_def(*args) def partial_type_num(*args): """ partial_type_num(type) -> int Calculate number of partial subtypes. @param type (C++: const tinfo_t &) @return: number of partial subtypes. The bigger is this number, the uglier is the type. """ return _ida_hexrays.partial_type_num(*args) def get_float_type(*args): """ get_float_type(width) -> tinfo_t Get a type of a floating point value with the specified width @param width: width of the desired type (C++: int) @return: type info object """ return _ida_hexrays.get_float_type(*args) def get_int_type_by_width_and_sign(*args): """ get_int_type_by_width_and_sign(srcwidth, sign) -> tinfo_t Create a type info by width and sign. Returns a simple type (examples: int, short) with the given width and sign. @param srcwidth: size of the type in bytes (C++: int) @param sign: sign of the type (C++: type_sign_t) """ return _ida_hexrays.get_int_type_by_width_and_sign(*args) def get_unk_type(*args): """ get_unk_type(size) -> tinfo_t Create a partial type info by width. Returns a partially defined type (examples: _DWORD, _BYTE) with the given width. @param size: size of the type in bytes (C++: int) """ return _ida_hexrays.get_unk_type(*args) def dummy_ptrtype(*args): """ dummy_ptrtype(ptrsize, isfp) -> tinfo_t Generate a dummy pointer type @param ptrsize: size of pointed object (C++: int) @param isfp: is floating point object? (C++: bool) """ return _ida_hexrays.dummy_ptrtype(*args) def get_member_type(*args): """ get_member_type(mptr, type) -> bool Get type of a structure field. This function performs validity checks of the field type. Wrong types are rejected. @param mptr: structure field (C++: const member_t *) @param type: pointer to the variable where the type is returned. This parameter can be NULL. (C++: tinfo_t *) @return: false if failed """ return _ida_hexrays.get_member_type(*args) def make_pointer(*args): """ make_pointer(type) -> tinfo_t Create a pointer type. This function performs the following conversion: "type" -> "type*" @param type: object type. (C++: const tinfo_t &) @return: "type*". for example, if 'char' is passed as the argument, """ return _ida_hexrays.make_pointer(*args) def create_typedef(*args): """ create_typedef(name) -> tinfo_t create_typedef(n) -> tinfo_t Create a reference to a named type. @param name: type name (C++: const char *) @return: type which refers to the specified name. For example, if name is "DWORD", the type info which refers to "DWORD" is created. """ return _ida_hexrays.create_typedef(*args) GUESSED_NONE = _ida_hexrays.GUESSED_NONE GUESSED_WEAK = _ida_hexrays.GUESSED_WEAK GUESSED_FUNC = _ida_hexrays.GUESSED_FUNC GUESSED_DATA = _ida_hexrays.GUESSED_DATA TS_NOELL = _ida_hexrays.TS_NOELL TS_SHRINK = _ida_hexrays.TS_SHRINK TS_DONTREF = _ida_hexrays.TS_DONTREF TS_MASK = _ida_hexrays.TS_MASK def get_type(*args): """ get_type(id, tif, guess) -> bool Get a global type. Global types are types of addressable objects and struct/union/enum types @param id: address or id of the object (C++: uval_t) @param tif: buffer for the answer (C++: tinfo_t *) @param guess: what kind of types to consider (C++: type_source_t) @return: success """ return _ida_hexrays.get_type(*args) def set_type(*args): """ set_type(id, tif, source, force=False) -> bool Set a global type. @param id: address or id of the object (C++: uval_t) @param tif: new type info (C++: const tinfo_t &) @param source: where the type comes from (C++: type_source_t) @param force: true means to set the type as is, false means to merge the new type with the possibly existing old type info. (C++: bool) @return: success """ return _ida_hexrays.set_type(*args) class vdloc_t(ida_typeinf.argloc_t): """ Proxy of C++ vdloc_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def reg1(self, *args): """ reg1(self) -> int """ return _ida_hexrays.vdloc_t_reg1(self, *args) def _set_reg1(self, *args): """ _set_reg1(self, r1) """ return _ida_hexrays.vdloc_t__set_reg1(self, *args) def set_reg1(self, *args): """ set_reg1(self, r1) """ return _ida_hexrays.vdloc_t_set_reg1(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.vdloc_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.vdloc_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.vdloc_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.vdloc_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.vdloc_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.vdloc_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.vdloc_t_compare(self, *args) def is_aliasable(self, *args): """ is_aliasable(self, mb, size) -> bool """ return _ida_hexrays.vdloc_t_is_aliasable(self, *args) def __init__(self, *args): """ __init__(self) -> vdloc_t """ this = _ida_hexrays.new_vdloc_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_vdloc_t __del__ = lambda self : None; vdloc_t_swigregister = _ida_hexrays.vdloc_t_swigregister vdloc_t_swigregister(vdloc_t) def print_vdloc(*args): """ print_vdloc(loc, nbytes) Print vdloc. Since vdloc does not always carry the size info, we pass it as NBYTES.. @param loc (C++: const vdloc_t &) @param nbytes (C++: int) """ return _ida_hexrays.print_vdloc(*args) def arglocs_overlap(*args): """ arglocs_overlap(loc1, w1, loc2, w2) -> bool Do two arglocs overlap? @param loc1 (C++: const vdloc_t &) @param w1 (C++: size_t) @param loc2 (C++: const vdloc_t &) @param w2 (C++: size_t) """ return _ida_hexrays.arglocs_overlap(*args) class lvar_locator_t(object): """ Proxy of C++ lvar_locator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr location = _swig_property(_ida_hexrays.lvar_locator_t_location_get, _ida_hexrays.lvar_locator_t_location_set) defea = _swig_property(_ida_hexrays.lvar_locator_t_defea_get, _ida_hexrays.lvar_locator_t_defea_set) def __init__(self, *args): """ __init__(self) -> lvar_locator_t __init__(self, loc, ea) -> lvar_locator_t """ this = _ida_hexrays.new_lvar_locator_t(*args) try: self.this.append(this) except: self.this = this def get_stkoff(self, *args): """ get_stkoff(self) -> sval_t """ return _ida_hexrays.lvar_locator_t_get_stkoff(self, *args) def is_reg1(self, *args): """ is_reg1(self) -> bool """ return _ida_hexrays.lvar_locator_t_is_reg1(self, *args) def is_reg2(self, *args): """ is_reg2(self) -> bool """ return _ida_hexrays.lvar_locator_t_is_reg2(self, *args) def is_reg_var(self, *args): """ is_reg_var(self) -> bool """ return _ida_hexrays.lvar_locator_t_is_reg_var(self, *args) def is_stk_var(self, *args): """ is_stk_var(self) -> bool """ return _ida_hexrays.lvar_locator_t_is_stk_var(self, *args) def is_scattered(self, *args): """ is_scattered(self) -> bool """ return _ida_hexrays.lvar_locator_t_is_scattered(self, *args) def get_reg1(self, *args): """ get_reg1(self) -> mreg_t """ return _ida_hexrays.lvar_locator_t_get_reg1(self, *args) def get_reg2(self, *args): """ get_reg2(self) -> mreg_t """ return _ida_hexrays.lvar_locator_t_get_reg2(self, *args) def get_scattered(self, *args): """ get_scattered(self) -> scattered_aloc_t get_scattered(self) -> scattered_aloc_t """ return _ida_hexrays.lvar_locator_t_get_scattered(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.lvar_locator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.lvar_locator_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.lvar_locator_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.lvar_locator_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.lvar_locator_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.lvar_locator_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.lvar_locator_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_lvar_locator_t __del__ = lambda self : None; lvar_locator_t_swigregister = _ida_hexrays.lvar_locator_t_swigregister lvar_locator_t_swigregister(lvar_locator_t) class lvar_t(lvar_locator_t): """ Proxy of C++ lvar_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr name = _swig_property(_ida_hexrays.lvar_t_name_get, _ida_hexrays.lvar_t_name_set) cmt = _swig_property(_ida_hexrays.lvar_t_cmt_get, _ida_hexrays.lvar_t_cmt_set) tif = _swig_property(_ida_hexrays.lvar_t_tif_get, _ida_hexrays.lvar_t_tif_set) width = _swig_property(_ida_hexrays.lvar_t_width_get, _ida_hexrays.lvar_t_width_set) defblk = _swig_property(_ida_hexrays.lvar_t_defblk_get, _ida_hexrays.lvar_t_defblk_set) divisor = _swig_property(_ida_hexrays.lvar_t_divisor_get, _ida_hexrays.lvar_t_divisor_set) def used(self, *args): """ used(self) -> bool """ return _ida_hexrays.lvar_t_used(self, *args) def typed(self, *args): """ typed(self) -> bool """ return _ida_hexrays.lvar_t_typed(self, *args) def mreg_done(self, *args): """ mreg_done(self) -> bool """ return _ida_hexrays.lvar_t_mreg_done(self, *args) def has_nice_name(self, *args): """ has_nice_name(self) -> bool """ return _ida_hexrays.lvar_t_has_nice_name(self, *args) def is_unknown_width(self, *args): """ is_unknown_width(self) -> bool """ return _ida_hexrays.lvar_t_is_unknown_width(self, *args) def has_user_info(self, *args): """ has_user_info(self) -> bool """ return _ida_hexrays.lvar_t_has_user_info(self, *args) def has_user_name(self, *args): """ has_user_name(self) -> bool """ return _ida_hexrays.lvar_t_has_user_name(self, *args) def has_user_type(self, *args): """ has_user_type(self) -> bool """ return _ida_hexrays.lvar_t_has_user_type(self, *args) def is_result_var(self, *args): """ is_result_var(self) -> bool """ return _ida_hexrays.lvar_t_is_result_var(self, *args) def is_arg_var(self, *args): """ is_arg_var(self) -> bool """ return _ida_hexrays.lvar_t_is_arg_var(self, *args) def is_fake_var(self, *args): """ is_fake_var(self) -> bool """ return _ida_hexrays.lvar_t_is_fake_var(self, *args) def is_overlapped_var(self, *args): """ is_overlapped_var(self) -> bool """ return _ida_hexrays.lvar_t_is_overlapped_var(self, *args) def is_floating_var(self, *args): """ is_floating_var(self) -> bool """ return _ida_hexrays.lvar_t_is_floating_var(self, *args) def is_spoiled_var(self, *args): """ is_spoiled_var(self) -> bool """ return _ida_hexrays.lvar_t_is_spoiled_var(self, *args) def is_noptr_var(self, *args): """ is_noptr_var(self) -> bool """ return _ida_hexrays.lvar_t_is_noptr_var(self, *args) def is_mapdst_var(self, *args): """ is_mapdst_var(self) -> bool """ return _ida_hexrays.lvar_t_is_mapdst_var(self, *args) def is_thisarg(self, *args): """ is_thisarg(self) -> bool """ return _ida_hexrays.lvar_t_is_thisarg(self, *args) def is_forced_var(self, *args): """ is_forced_var(self) -> bool """ return _ida_hexrays.lvar_t_is_forced_var(self, *args) def has_regname(self, *args): """ has_regname(self) -> bool """ return _ida_hexrays.lvar_t_has_regname(self, *args) def is_dummy_arg(self, *args): """ is_dummy_arg(self) -> bool """ return _ida_hexrays.lvar_t_is_dummy_arg(self, *args) def is_notarg(self, *args): """ is_notarg(self) -> bool """ return _ida_hexrays.lvar_t_is_notarg(self, *args) def set_used(self, *args): """ set_used(self) """ return _ida_hexrays.lvar_t_set_used(self, *args) def clear_used(self, *args): """ clear_used(self) """ return _ida_hexrays.lvar_t_clear_used(self, *args) def set_typed(self, *args): """ set_typed(self) """ return _ida_hexrays.lvar_t_set_typed(self, *args) def set_non_typed(self, *args): """ set_non_typed(self) """ return _ida_hexrays.lvar_t_set_non_typed(self, *args) def clr_user_info(self, *args): """ clr_user_info(self) """ return _ida_hexrays.lvar_t_clr_user_info(self, *args) def set_user_name(self, *args): """ set_user_name(self) """ return _ida_hexrays.lvar_t_set_user_name(self, *args) def set_user_type(self, *args): """ set_user_type(self) """ return _ida_hexrays.lvar_t_set_user_type(self, *args) def clr_user_type(self, *args): """ clr_user_type(self) """ return _ida_hexrays.lvar_t_clr_user_type(self, *args) def clr_user_name(self, *args): """ clr_user_name(self) """ return _ida_hexrays.lvar_t_clr_user_name(self, *args) def set_mreg_done(self, *args): """ set_mreg_done(self) """ return _ida_hexrays.lvar_t_set_mreg_done(self, *args) def clr_mreg_done(self, *args): """ clr_mreg_done(self) """ return _ida_hexrays.lvar_t_clr_mreg_done(self, *args) def set_unknown_width(self, *args): """ set_unknown_width(self) """ return _ida_hexrays.lvar_t_set_unknown_width(self, *args) def clr_unknown_width(self, *args): """ clr_unknown_width(self) """ return _ida_hexrays.lvar_t_clr_unknown_width(self, *args) def set_arg_var(self, *args): """ set_arg_var(self) """ return _ida_hexrays.lvar_t_set_arg_var(self, *args) def clr_arg_var(self, *args): """ clr_arg_var(self) """ return _ida_hexrays.lvar_t_clr_arg_var(self, *args) def set_fake_var(self, *args): """ set_fake_var(self) """ return _ida_hexrays.lvar_t_set_fake_var(self, *args) def clr_fake_var(self, *args): """ clr_fake_var(self) """ return _ida_hexrays.lvar_t_clr_fake_var(self, *args) def set_overlapped_var(self, *args): """ set_overlapped_var(self) """ return _ida_hexrays.lvar_t_set_overlapped_var(self, *args) def clr_overlapped_var(self, *args): """ clr_overlapped_var(self) """ return _ida_hexrays.lvar_t_clr_overlapped_var(self, *args) def set_floating_var(self, *args): """ set_floating_var(self) """ return _ida_hexrays.lvar_t_set_floating_var(self, *args) def clr_floating_var(self, *args): """ clr_floating_var(self) """ return _ida_hexrays.lvar_t_clr_floating_var(self, *args) def set_spoiled_var(self, *args): """ set_spoiled_var(self) """ return _ida_hexrays.lvar_t_set_spoiled_var(self, *args) def clr_spoiled_var(self, *args): """ clr_spoiled_var(self) """ return _ida_hexrays.lvar_t_clr_spoiled_var(self, *args) def set_mapdst_var(self, *args): """ set_mapdst_var(self) """ return _ida_hexrays.lvar_t_set_mapdst_var(self, *args) def clr_mapdst_var(self, *args): """ clr_mapdst_var(self) """ return _ida_hexrays.lvar_t_clr_mapdst_var(self, *args) def set_noptr_var(self, *args): """ set_noptr_var(self) """ return _ida_hexrays.lvar_t_set_noptr_var(self, *args) def clr_noptr_var(self, *args): """ clr_noptr_var(self) """ return _ida_hexrays.lvar_t_clr_noptr_var(self, *args) def set_thisarg(self, *args): """ set_thisarg(self) """ return _ida_hexrays.lvar_t_set_thisarg(self, *args) def clr_thisarg(self, *args): """ clr_thisarg(self) """ return _ida_hexrays.lvar_t_clr_thisarg(self, *args) def set_forced_var(self, *args): """ set_forced_var(self) """ return _ida_hexrays.lvar_t_set_forced_var(self, *args) def clr_forced_var(self, *args): """ clr_forced_var(self) """ return _ida_hexrays.lvar_t_clr_forced_var(self, *args) def set_dummy_arg(self, *args): """ set_dummy_arg(self) """ return _ida_hexrays.lvar_t_set_dummy_arg(self, *args) def clr_dummy_arg(self, *args): """ clr_dummy_arg(self) """ return _ida_hexrays.lvar_t_clr_dummy_arg(self, *args) def set_notarg(self, *args): """ set_notarg(self) """ return _ida_hexrays.lvar_t_set_notarg(self, *args) def clr_notarg(self, *args): """ clr_notarg(self) """ return _ida_hexrays.lvar_t_clr_notarg(self, *args) def has_common(self, *args): """ has_common(self, v) -> bool """ return _ida_hexrays.lvar_t_has_common(self, *args) def has_common_bit(self, *args): """ has_common_bit(self, loc, width2) -> bool """ return _ida_hexrays.lvar_t_has_common_bit(self, *args) def type(self, *args): """ type(self) -> tinfo_t type(self) -> tinfo_t """ return _ida_hexrays.lvar_t_type(self, *args) def accepts_type(self, *args): """ accepts_type(self, t, may_change_thisarg=False) -> bool """ return _ida_hexrays.lvar_t_accepts_type(self, *args) def set_lvar_type(self, *args): """ set_lvar_type(self, t, may_fail=False) -> bool """ return _ida_hexrays.lvar_t_set_lvar_type(self, *args) def set_final_lvar_type(self, *args): """ set_final_lvar_type(self, t) """ return _ida_hexrays.lvar_t_set_final_lvar_type(self, *args) def set_width(self, *args): """ set_width(self, w, svw_flags=0) -> bool """ return _ida_hexrays.lvar_t_set_width(self, *args) def append_list(self, *args): """ append_list(self, lst, pad_if_scattered=False) """ return _ida_hexrays.lvar_t_append_list(self, *args) def is_aliasable(self, *args): """ is_aliasable(self, mba) -> bool """ return _ida_hexrays.lvar_t_is_aliasable(self, *args) __swig_destroy__ = _ida_hexrays.delete_lvar_t __del__ = lambda self : None; lvar_t_swigregister = _ida_hexrays.lvar_t_swigregister lvar_t_swigregister(lvar_t) SVW_INT = _ida_hexrays.SVW_INT SVW_FLOAT = _ida_hexrays.SVW_FLOAT SVW_SOFT = _ida_hexrays.SVW_SOFT class lvars_t(qvector_lvar_t): """ Proxy of C++ lvars_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def find_input_lvar(self, *args): """ find_input_lvar(self, argloc, _size) -> int """ return _ida_hexrays.lvars_t_find_input_lvar(self, *args) def find_stkvar(self, *args): """ find_stkvar(self, spoff, width) -> int """ return _ida_hexrays.lvars_t_find_stkvar(self, *args) def find(self, *args): """ find(self, ll) -> lvar_t """ return _ida_hexrays.lvars_t_find(self, *args) def find_lvar(self, *args): """ find_lvar(self, location, width, defblk=-1) -> int """ return _ida_hexrays.lvars_t_find_lvar(self, *args) def __init__(self, *args): """ __init__(self) -> lvars_t """ this = _ida_hexrays.new_lvars_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_lvars_t __del__ = lambda self : None; lvars_t_swigregister = _ida_hexrays.lvars_t_swigregister lvars_t_swigregister(lvars_t) class lvar_saved_info_t(object): """ Proxy of C++ lvar_saved_info_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ll = _swig_property(_ida_hexrays.lvar_saved_info_t_ll_get, _ida_hexrays.lvar_saved_info_t_ll_set) name = _swig_property(_ida_hexrays.lvar_saved_info_t_name_get, _ida_hexrays.lvar_saved_info_t_name_set) type = _swig_property(_ida_hexrays.lvar_saved_info_t_type_get, _ida_hexrays.lvar_saved_info_t_type_set) cmt = _swig_property(_ida_hexrays.lvar_saved_info_t_cmt_get, _ida_hexrays.lvar_saved_info_t_cmt_set) size = _swig_property(_ida_hexrays.lvar_saved_info_t_size_get, _ida_hexrays.lvar_saved_info_t_size_set) flags = _swig_property(_ida_hexrays.lvar_saved_info_t_flags_get, _ida_hexrays.lvar_saved_info_t_flags_set) def __init__(self, *args): """ __init__(self) -> lvar_saved_info_t """ this = _ida_hexrays.new_lvar_saved_info_t(*args) try: self.this.append(this) except: self.this = this def has_info(self, *args): """ has_info(self) -> bool """ return _ida_hexrays.lvar_saved_info_t_has_info(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.lvar_saved_info_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.lvar_saved_info_t___ne__(self, *args) def is_kept(self, *args): """ is_kept(self) -> bool """ return _ida_hexrays.lvar_saved_info_t_is_kept(self, *args) def clear_keep(self, *args): """ clear_keep(self) """ return _ida_hexrays.lvar_saved_info_t_clear_keep(self, *args) def set_keep(self, *args): """ set_keep(self) """ return _ida_hexrays.lvar_saved_info_t_set_keep(self, *args) def is_forced_lvar(self, *args): """ is_forced_lvar(self) -> bool """ return _ida_hexrays.lvar_saved_info_t_is_forced_lvar(self, *args) def set_forced_lvar(self, *args): """ set_forced_lvar(self) """ return _ida_hexrays.lvar_saved_info_t_set_forced_lvar(self, *args) def clr_forced_lvar(self, *args): """ clr_forced_lvar(self) """ return _ida_hexrays.lvar_saved_info_t_clr_forced_lvar(self, *args) def is_noptr_lvar(self, *args): """ is_noptr_lvar(self) -> bool """ return _ida_hexrays.lvar_saved_info_t_is_noptr_lvar(self, *args) def set_noptr_lvar(self, *args): """ set_noptr_lvar(self) """ return _ida_hexrays.lvar_saved_info_t_set_noptr_lvar(self, *args) def clr_noptr_lvar(self, *args): """ clr_noptr_lvar(self) """ return _ida_hexrays.lvar_saved_info_t_clr_noptr_lvar(self, *args) __swig_destroy__ = _ida_hexrays.delete_lvar_saved_info_t __del__ = lambda self : None; lvar_saved_info_t_swigregister = _ida_hexrays.lvar_saved_info_t_swigregister lvar_saved_info_t_swigregister(lvar_saved_info_t) LVINF_KEEP = _ida_hexrays.LVINF_KEEP """ preserve saved user settings regardless of vars for example, if a var loses all its user-defined attributes or even gets destroyed, keep its 'lvar_saved_info_t' . this is used for ephemeral variables that get destroyed by macro recognition. """ LVINF_FORCE = _ida_hexrays.LVINF_FORCE """ force allocation of a new variable. forces the decompiler to create a new variable at ll.defea """ LVINF_NOPTR = _ida_hexrays.LVINF_NOPTR """ variable type should not be a pointer """ class lvar_uservec_t(object): """ Proxy of C++ lvar_uservec_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr lvvec = _swig_property(_ida_hexrays.lvar_uservec_t_lvvec_get, _ida_hexrays.lvar_uservec_t_lvvec_set) lmaps = _swig_property(_ida_hexrays.lvar_uservec_t_lmaps_get, _ida_hexrays.lvar_uservec_t_lmaps_set) stkoff_delta = _swig_property(_ida_hexrays.lvar_uservec_t_stkoff_delta_get, _ida_hexrays.lvar_uservec_t_stkoff_delta_set) ulv_flags = _swig_property(_ida_hexrays.lvar_uservec_t_ulv_flags_get, _ida_hexrays.lvar_uservec_t_ulv_flags_set) def __init__(self, *args): """ __init__(self) -> lvar_uservec_t """ this = _ida_hexrays.new_lvar_uservec_t(*args) try: self.this.append(this) except: self.this = this def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.lvar_uservec_t_swap(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.lvar_uservec_t_clear(self, *args) def find_info(self, *args): """ find_info(self, vloc) -> lvar_saved_info_t """ return _ida_hexrays.lvar_uservec_t_find_info(self, *args) def keep_info(self, *args): """ keep_info(self, v) """ return _ida_hexrays.lvar_uservec_t_keep_info(self, *args) __swig_destroy__ = _ida_hexrays.delete_lvar_uservec_t __del__ = lambda self : None; lvar_uservec_t_swigregister = _ida_hexrays.lvar_uservec_t_swigregister lvar_uservec_t_swigregister(lvar_uservec_t) ULV_PRECISE_DEFEA = _ida_hexrays.ULV_PRECISE_DEFEA """ Use precise defea's for lvar locations. """ def restore_user_lvar_settings(*args): """ restore_user_lvar_settings(lvinf, func_ea) -> bool Restore user defined local variable settings in the database. @param lvinf: ptr to output buffer (C++: lvar_uservec_t *) @param func_ea: entry address of the function (C++: ea_t) @return: success """ return _ida_hexrays.restore_user_lvar_settings(*args) def save_user_lvar_settings(*args): """ save_user_lvar_settings(func_ea, lvinf) Save user defined local variable settings into the database. @param func_ea: entry address of the function (C++: ea_t) @param lvinf: user-specified info about local variables (C++: const lvar_uservec_t &) """ return _ida_hexrays.save_user_lvar_settings(*args) class user_lvar_modifier_t(object): """ Proxy of C++ user_lvar_modifier_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def modify_lvars(self, *args): """ modify_lvars(self, lvinf) -> bool """ return _ida_hexrays.user_lvar_modifier_t_modify_lvars(self, *args) def __init__(self, *args): """ __init__(self) -> user_lvar_modifier_t """ if self.__class__ == user_lvar_modifier_t: _self = None else: _self = self this = _ida_hexrays.new_user_lvar_modifier_t(_self, *args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_lvar_modifier_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_user_lvar_modifier_t(self) return weakref_proxy(self) user_lvar_modifier_t_swigregister = _ida_hexrays.user_lvar_modifier_t_swigregister user_lvar_modifier_t_swigregister(user_lvar_modifier_t) def modify_user_lvars(*args): """ modify_user_lvars(entry_ea, mlv) -> bool Modify saved local variable settings. @param entry_ea: function start address (C++: ea_t) @param mlv: local variable modifier (C++: user_lvar_modifier_t &) @return: true if modified variables """ return _ida_hexrays.modify_user_lvars(*args) class udcall_t(object): """ Proxy of C++ udcall_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr name = _swig_property(_ida_hexrays.udcall_t_name_get, _ida_hexrays.udcall_t_name_set) tif = _swig_property(_ida_hexrays.udcall_t_tif_get, _ida_hexrays.udcall_t_tif_set) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.udcall_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.udcall_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.udcall_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.udcall_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.udcall_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.udcall_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.udcall_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> udcall_t """ this = _ida_hexrays.new_udcall_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_udcall_t __del__ = lambda self : None; udcall_t_swigregister = _ida_hexrays.udcall_t_swigregister udcall_t_swigregister(udcall_t) def restore_user_defined_calls(*args): """ restore_user_defined_calls(udcalls, func_ea) -> bool Restore user defined function calls from the database. @param udcalls: ptr to output buffer (C++: udcall_map_t *) @param func_ea: entry address of the function (C++: ea_t) @return: success """ return _ida_hexrays.restore_user_defined_calls(*args) def save_user_defined_calls(*args): """ save_user_defined_calls(func_ea, udcalls) Save user defined local function calls into the database. @param func_ea: entry address of the function (C++: ea_t) @param udcalls: user-specified info about user defined function calls (C++: const udcall_map_t &) """ return _ida_hexrays.save_user_defined_calls(*args) def parse_user_call(*args): """ parse_user_call(udc, decl, silent) -> bool Convert function type declaration into internal structure @param udc: - pointer to output structure (C++: udcall_t *) @param decl: - function type declaration (C++: const char *) @param silent: - if TRUE: do not show warning in case of incorrect type (C++: bool) @return: success """ return _ida_hexrays.parse_user_call(*args) def convert_to_user_call(*args): """ convert_to_user_call(udc, cdg) -> merror_t try to generate user-defined call for an instruction @param udc (C++: const udcall_t &) @param cdg (C++: codegen_t &) @return: Microcode error codes code: MERR_OK - user-defined call generated else - error (MERR_INSN == inacceptable udc.tif) """ return _ida_hexrays.convert_to_user_call(*args) class microcode_filter_t(object): """ Proxy of C++ microcode_filter_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def match(self, *args): """ match(self, cdg) -> bool """ return _ida_hexrays.microcode_filter_t_match(self, *args) def apply(self, *args): """ apply(self, cdg) -> merror_t """ return _ida_hexrays.microcode_filter_t_apply(self, *args) def __init__(self, *args): """ __init__(self) -> microcode_filter_t """ if self.__class__ == microcode_filter_t: _self = None else: _self = self this = _ida_hexrays.new_microcode_filter_t(_self, *args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_microcode_filter_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_microcode_filter_t(self) return weakref_proxy(self) microcode_filter_t_swigregister = _ida_hexrays.microcode_filter_t_swigregister microcode_filter_t_swigregister(microcode_filter_t) def install_microcode_filter(*args): """ install_microcode_filter(filter, install=True) register/unregister non-standard microcode generator @param filter: - microcode generator object (C++: microcode_filter_t *) @param install: - TRUE - register the object, FALSE - unregister (C++: bool) """ return _ida_hexrays.install_microcode_filter(*args) class udc_filter_t(microcode_filter_t): """ Proxy of C++ udc_filter_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def match(self, *args): """ match(self, cdg) -> bool """ return _ida_hexrays.udc_filter_t_match(self, *args) def init(self, *args): """ init(self, decl) -> bool """ return _ida_hexrays.udc_filter_t_init(self, *args) def apply(self, *args): """ apply(self, cdg) -> merror_t """ return _ida_hexrays.udc_filter_t_apply(self, *args) def __init__(self, *args): """ __init__(self) -> udc_filter_t """ if self.__class__ == udc_filter_t: _self = None else: _self = self this = _ida_hexrays.new_udc_filter_t(_self, *args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_udc_filter_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_udc_filter_t(self) return weakref_proxy(self) udc_filter_t_swigregister = _ida_hexrays.udc_filter_t_swigregister udc_filter_t_swigregister(udc_filter_t) class bitset_t(object): """ Proxy of C++ bitset_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> bitset_t __init__(self, m) -> bitset_t """ this = _ida_hexrays.new_bitset_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_bitset_t __del__ = lambda self : None; def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.bitset_t_swap(self, *args) def copy(self, *args): """ copy(self, m) -> bitset_t """ return _ida_hexrays.bitset_t_copy(self, *args) def add(self, *args): """ add(self, bit) -> bool add(self, bit, width) -> bool add(self, ml) -> bool """ return _ida_hexrays.bitset_t_add(self, *args) def sub(self, *args): """ sub(self, bit) -> bool sub(self, bit, width) -> bool sub(self, ml) -> bool """ return _ida_hexrays.bitset_t_sub(self, *args) def cut_at(self, *args): """ cut_at(self, maxbit) -> bool """ return _ida_hexrays.bitset_t_cut_at(self, *args) def shift_down(self, *args): """ shift_down(self, shift) """ return _ida_hexrays.bitset_t_shift_down(self, *args) def has(self, *args): """ has(self, bit) -> bool """ return _ida_hexrays.bitset_t_has(self, *args) def has_all(self, *args): """ has_all(self, bit, width) -> bool """ return _ida_hexrays.bitset_t_has_all(self, *args) def has_any(self, *args): """ has_any(self, bit, width) -> bool """ return _ida_hexrays.bitset_t_has_any(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.bitset_t_dstr(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.bitset_t_empty(self, *args) def count(self, *args): """ count(self) -> int count(self, bit) -> int """ return _ida_hexrays.bitset_t_count(self, *args) def last(self, *args): """ last(self) -> int """ return _ida_hexrays.bitset_t_last(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.bitset_t_clear(self, *args) def fill_with_ones(self, *args): """ fill_with_ones(self, maxbit) """ return _ida_hexrays.bitset_t_fill_with_ones(self, *args) def has_common(self, *args): """ has_common(self, ml) -> bool """ return _ida_hexrays.bitset_t_has_common(self, *args) def intersect(self, *args): """ intersect(self, ml) -> bool """ return _ida_hexrays.bitset_t_intersect(self, *args) def is_subset_of(self, *args): """ is_subset_of(self, ml) -> bool """ return _ida_hexrays.bitset_t_is_subset_of(self, *args) def includes(self, *args): """ includes(self, ml) -> bool """ return _ida_hexrays.bitset_t_includes(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.bitset_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.bitset_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.bitset_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.bitset_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.bitset_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.bitset_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.bitset_t_compare(self, *args) def itat(self, *args): """ itat(self, n) -> bitset_t::iterator """ return _ida_hexrays.bitset_t_itat(self, *args) def begin(self, *args): """ begin(self) -> bitset_t::iterator """ return _ida_hexrays.bitset_t_begin(self, *args) def end(self, *args): """ end(self) -> bitset_t::iterator """ return _ida_hexrays.bitset_t_end(self, *args) def front(self, *args): """ front(self) -> int """ return _ida_hexrays.bitset_t_front(self, *args) def back(self, *args): """ back(self) -> int """ return _ida_hexrays.bitset_t_back(self, *args) def inc(self, *args): """ inc(self, p, n=1) """ return _ida_hexrays.bitset_t_inc(self, *args) def itv(self, *args): """ itv(self, it) -> int """ return _ida_hexrays.bitset_t_itv(self, *args) __len__ = count def __iter__(self): it = self.begin() for i in xrange(self.count()): yield self.itv(it) self.inc(it) bitset_t_swigregister = _ida_hexrays.bitset_t_swigregister bitset_t_swigregister(bitset_t) bitset_width = cvar.bitset_width bitset_align = cvar.bitset_align bitset_shift = cvar.bitset_shift class ivl_t(uval_ivl_t): """ Proxy of C++ ivl_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, _off, _size) -> ivl_t """ this = _ida_hexrays.new_ivl_t(*args) try: self.this.append(this) except: self.this = this def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.ivl_t_empty(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.ivl_t_clear(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.ivl_t_dstr(self, *args) def extend_to_cover(self, *args): """ extend_to_cover(self, r) -> bool """ return _ida_hexrays.ivl_t_extend_to_cover(self, *args) def intersect(self, *args): """ intersect(self, r) """ return _ida_hexrays.ivl_t_intersect(self, *args) def overlap(self, *args): """ overlap(self, ivl) -> bool """ return _ida_hexrays.ivl_t_overlap(self, *args) def includes(self, *args): """ includes(self, ivl) -> bool """ return _ida_hexrays.ivl_t_includes(self, *args) def contains(self, *args): """ contains(self, off2) -> bool """ return _ida_hexrays.ivl_t_contains(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.ivl_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.ivl_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.ivl_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.ivl_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.ivl_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.ivl_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.ivl_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_ivl_t __del__ = lambda self : None; ivl_t_swigregister = _ida_hexrays.ivl_t_swigregister ivl_t_swigregister(ivl_t) class ivl_with_name_t(object): """ Proxy of C++ ivl_with_name_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ivl = _swig_property(_ida_hexrays.ivl_with_name_t_ivl_get, _ida_hexrays.ivl_with_name_t_ivl_set) whole = _swig_property(_ida_hexrays.ivl_with_name_t_whole_get, _ida_hexrays.ivl_with_name_t_whole_set) part = _swig_property(_ida_hexrays.ivl_with_name_t_part_get, _ida_hexrays.ivl_with_name_t_part_set) def __init__(self, *args): """ __init__(self) -> ivl_with_name_t """ this = _ida_hexrays.new_ivl_with_name_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_ivl_with_name_t __del__ = lambda self : None; ivl_with_name_t_swigregister = _ida_hexrays.ivl_with_name_t_swigregister ivl_with_name_t_swigregister(ivl_with_name_t) class ivlset_t(uval_ivl_ivlset_t): """ Proxy of C++ ivlset_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> ivlset_t __init__(self, ivl) -> ivlset_t """ this = _ida_hexrays.new_ivlset_t(*args) try: self.this.append(this) except: self.this = this def add(self, *args): """ add(self, ivl) -> bool add(self, ea, size) -> bool add(self, ivs) -> bool """ return _ida_hexrays.ivlset_t_add(self, *args) def addmasked(self, *args): """ addmasked(self, ivs, mask) -> bool """ return _ida_hexrays.ivlset_t_addmasked(self, *args) def sub(self, *args): """ sub(self, ivl) -> bool sub(self, ea, size) -> bool sub(self, ivs) -> bool """ return _ida_hexrays.ivlset_t_sub(self, *args) def _print(self, *args): """ _print(self) """ return _ida_hexrays.ivlset_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.ivlset_t_dstr(self, *args) def count(self, *args): """ count(self) -> asize_t """ return _ida_hexrays.ivlset_t_count(self, *args) def has_common(self, *args): """ has_common(self, ivl, strict=False) -> bool has_common(self, ivs) -> bool """ return _ida_hexrays.ivlset_t_has_common(self, *args) def contains(self, *args): """ contains(self, off) -> bool """ return _ida_hexrays.ivlset_t_contains(self, *args) def includes(self, *args): """ includes(self, ivs) -> bool """ return _ida_hexrays.ivlset_t_includes(self, *args) def intersect(self, *args): """ intersect(self, ivs) -> bool """ return _ida_hexrays.ivlset_t_intersect(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.ivlset_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.ivlset_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.ivlset_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.ivlset_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.ivlset_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.ivlset_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.ivlset_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_ivlset_t __del__ = lambda self : None; ivlset_t_swigregister = _ida_hexrays.ivlset_t_swigregister ivlset_t_swigregister(ivlset_t) def get_mreg_name(*args): """ get_mreg_name(bit, width, ud=None) -> int """ return _ida_hexrays.get_mreg_name(*args) class rlist_t(bitset_t): """ Proxy of C++ rlist_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> rlist_t __init__(self, m) -> rlist_t __init__(self, reg, width) -> rlist_t """ this = _ida_hexrays.new_rlist_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_rlist_t __del__ = lambda self : None; def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.rlist_t_dstr(self, *args) rlist_t_swigregister = _ida_hexrays.rlist_t_swigregister rlist_t_swigregister(rlist_t) class mlist_t(object): """ Proxy of C++ mlist_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr reg = _swig_property(_ida_hexrays.mlist_t_reg_get, _ida_hexrays.mlist_t_reg_set) mem = _swig_property(_ida_hexrays.mlist_t_mem_get, _ida_hexrays.mlist_t_mem_set) def __init__(self, *args): """ __init__(self) -> mlist_t __init__(self, ivl) -> mlist_t __init__(self, r, size) -> mlist_t """ this = _ida_hexrays.new_mlist_t(*args) try: self.this.append(this) except: self.this = this def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.mlist_t_swap(self, *args) def addmem(self, *args): """ addmem(self, ea, size) -> bool """ return _ida_hexrays.mlist_t_addmem(self, *args) def add(self, *args): """ add(self, r, size) -> bool add(self, r) -> bool add(self, ivl) -> bool add(self, lst) -> bool """ return _ida_hexrays.mlist_t_add(self, *args) def sub(self, *args): """ sub(self, r, size) -> bool sub(self, ivl) -> bool sub(self, lst) -> bool """ return _ida_hexrays.mlist_t_sub(self, *args) def count(self, *args): """ count(self) -> asize_t """ return _ida_hexrays.mlist_t_count(self, *args) def _print(self, *args): """ _print(self) """ return _ida_hexrays.mlist_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.mlist_t_dstr(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.mlist_t_empty(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.mlist_t_clear(self, *args) def has(self, *args): """ has(self, r) -> bool """ return _ida_hexrays.mlist_t_has(self, *args) def has_all(self, *args): """ has_all(self, r, size) -> bool """ return _ida_hexrays.mlist_t_has_all(self, *args) def has_any(self, *args): """ has_any(self, r, size) -> bool """ return _ida_hexrays.mlist_t_has_any(self, *args) def has_memory(self, *args): """ has_memory(self) -> bool """ return _ida_hexrays.mlist_t_has_memory(self, *args) def has_common(self, *args): """ has_common(self, lst) -> bool """ return _ida_hexrays.mlist_t_has_common(self, *args) def includes(self, *args): """ includes(self, lst) -> bool """ return _ida_hexrays.mlist_t_includes(self, *args) def intersect(self, *args): """ intersect(self, lst) -> bool """ return _ida_hexrays.mlist_t_intersect(self, *args) def is_subset_of(self, *args): """ is_subset_of(self, lst) -> bool """ return _ida_hexrays.mlist_t_is_subset_of(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.mlist_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.mlist_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.mlist_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.mlist_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.mlist_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.mlist_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.mlist_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_mlist_t __del__ = lambda self : None; mlist_t_swigregister = _ida_hexrays.mlist_t_swigregister mlist_t_swigregister(mlist_t) class simple_graph_t(object): """ Proxy of C++ simple_graph_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr title = _swig_property(_ida_hexrays.simple_graph_t_title_get, _ida_hexrays.simple_graph_t_title_set) colored_gdl_edges = _swig_property(_ida_hexrays.simple_graph_t_colored_gdl_edges_get, _ida_hexrays.simple_graph_t_colored_gdl_edges_set) simple_graph_t_swigregister = _ida_hexrays.simple_graph_t_swigregister simple_graph_t_swigregister(simple_graph_t) class op_parent_info_t(object): """ Proxy of C++ op_parent_info_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr mba = _swig_property(_ida_hexrays.op_parent_info_t_mba_get, _ida_hexrays.op_parent_info_t_mba_set) blk = _swig_property(_ida_hexrays.op_parent_info_t_blk_get, _ida_hexrays.op_parent_info_t_blk_set) topins = _swig_property(_ida_hexrays.op_parent_info_t_topins_get, _ida_hexrays.op_parent_info_t_topins_set) curins = _swig_property(_ida_hexrays.op_parent_info_t_curins_get, _ida_hexrays.op_parent_info_t_curins_set) def __init__(self, *args): """ __init__(self, _mba=None, _blk=None, _topins=None) -> op_parent_info_t """ this = _ida_hexrays.new_op_parent_info_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_op_parent_info_t __del__ = lambda self : None; op_parent_info_t_swigregister = _ida_hexrays.op_parent_info_t_swigregister op_parent_info_t_swigregister(op_parent_info_t) class minsn_visitor_t(op_parent_info_t): """ Proxy of C++ minsn_visitor_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, _mba=None, _blk=None, _topins=None) -> minsn_visitor_t """ if self.__class__ == minsn_visitor_t: _self = None else: _self = self this = _ida_hexrays.new_minsn_visitor_t(_self, *args) try: self.this.append(this) except: self.this = this def visit_minsn(self, *args): """ visit_minsn(self) -> int """ return _ida_hexrays.minsn_visitor_t_visit_minsn(self, *args) __swig_destroy__ = _ida_hexrays.delete_minsn_visitor_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_minsn_visitor_t(self) return weakref_proxy(self) minsn_visitor_t_swigregister = _ida_hexrays.minsn_visitor_t_swigregister minsn_visitor_t_swigregister(minsn_visitor_t) class mop_visitor_t(op_parent_info_t): """ Proxy of C++ mop_visitor_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, _mba=None, _blk=None, _topins=None) -> mop_visitor_t """ if self.__class__ == mop_visitor_t: _self = None else: _self = self this = _ida_hexrays.new_mop_visitor_t(_self, *args) try: self.this.append(this) except: self.this = this prune = _swig_property(_ida_hexrays.mop_visitor_t_prune_get, _ida_hexrays.mop_visitor_t_prune_set) def visit_mop(self, *args): """ visit_mop(self, op, type, is_target) -> int """ return _ida_hexrays.mop_visitor_t_visit_mop(self, *args) __swig_destroy__ = _ida_hexrays.delete_mop_visitor_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_mop_visitor_t(self) return weakref_proxy(self) mop_visitor_t_swigregister = _ida_hexrays.mop_visitor_t_swigregister mop_visitor_t_swigregister(mop_visitor_t) class scif_visitor_t(object): """ Proxy of C++ scif_visitor_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def visit_scif_mop(self, *args): """ visit_scif_mop(self, r, off) -> int """ return _ida_hexrays.scif_visitor_t_visit_scif_mop(self, *args) def __init__(self, *args): """ __init__(self) -> scif_visitor_t """ if self.__class__ == scif_visitor_t: _self = None else: _self = self this = _ida_hexrays.new_scif_visitor_t(_self, *args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_scif_visitor_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_scif_visitor_t(self) return weakref_proxy(self) scif_visitor_t_swigregister = _ida_hexrays.scif_visitor_t_swigregister scif_visitor_t_swigregister(scif_visitor_t) class mlist_mop_visitor_t(object): """ Proxy of C++ mlist_mop_visitor_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr topins = _swig_property(_ida_hexrays.mlist_mop_visitor_t_topins_get, _ida_hexrays.mlist_mop_visitor_t_topins_set) curins = _swig_property(_ida_hexrays.mlist_mop_visitor_t_curins_get, _ida_hexrays.mlist_mop_visitor_t_curins_set) changed = _swig_property(_ida_hexrays.mlist_mop_visitor_t_changed_get, _ida_hexrays.mlist_mop_visitor_t_changed_set) list = _swig_property(_ida_hexrays.mlist_mop_visitor_t_list_get, _ida_hexrays.mlist_mop_visitor_t_list_set) def __init__(self, *args): """ __init__(self) -> mlist_mop_visitor_t """ if self.__class__ == mlist_mop_visitor_t: _self = None else: _self = self this = _ida_hexrays.new_mlist_mop_visitor_t(_self, *args) try: self.this.append(this) except: self.this = this def visit_mop(self, *args): """ visit_mop(self, op) -> int """ return _ida_hexrays.mlist_mop_visitor_t_visit_mop(self, *args) __swig_destroy__ = _ida_hexrays.delete_mlist_mop_visitor_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_mlist_mop_visitor_t(self) return weakref_proxy(self) mlist_mop_visitor_t_swigregister = _ida_hexrays.mlist_mop_visitor_t_swigregister mlist_mop_visitor_t_swigregister(mlist_mop_visitor_t) class lvar_ref_t(object): """ Proxy of C++ lvar_ref_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr mba = _swig_property(_ida_hexrays.lvar_ref_t_mba_get) off = _swig_property(_ida_hexrays.lvar_ref_t_off_get, _ida_hexrays.lvar_ref_t_off_set) idx = _swig_property(_ida_hexrays.lvar_ref_t_idx_get, _ida_hexrays.lvar_ref_t_idx_set) def __init__(self, *args): """ __init__(self, m, i, o=0) -> lvar_ref_t __init__(self, r) -> lvar_ref_t """ this = _ida_hexrays.new_lvar_ref_t(*args) try: self.this.append(this) except: self.this = this def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.lvar_ref_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.lvar_ref_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.lvar_ref_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.lvar_ref_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.lvar_ref_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.lvar_ref_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.lvar_ref_t_compare(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.lvar_ref_t_swap(self, *args) def var(self, *args): """ var(self) -> lvar_t """ return _ida_hexrays.lvar_ref_t_var(self, *args) __swig_destroy__ = _ida_hexrays.delete_lvar_ref_t __del__ = lambda self : None; lvar_ref_t_swigregister = _ida_hexrays.lvar_ref_t_swigregister lvar_ref_t_swigregister(lvar_ref_t) mop_z = cvar.mop_z mop_r = cvar.mop_r mop_n = cvar.mop_n mop_str = cvar.mop_str mop_d = cvar.mop_d mop_S = cvar.mop_S mop_v = cvar.mop_v mop_b = cvar.mop_b mop_f = cvar.mop_f mop_l = cvar.mop_l mop_a = cvar.mop_a mop_h = cvar.mop_h mop_c = cvar.mop_c mop_fn = cvar.mop_fn mop_p = cvar.mop_p mop_sc = cvar.mop_sc NOSIZE = cvar.NOSIZE class stkvar_ref_t(object): """ Proxy of C++ stkvar_ref_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr mba = _swig_property(_ida_hexrays.stkvar_ref_t_mba_get) off = _swig_property(_ida_hexrays.stkvar_ref_t_off_get, _ida_hexrays.stkvar_ref_t_off_set) def __init__(self, *args): """ __init__(self, m, o) -> stkvar_ref_t """ this = _ida_hexrays.new_stkvar_ref_t(*args) try: self.this.append(this) except: self.this = this def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.stkvar_ref_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.stkvar_ref_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.stkvar_ref_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.stkvar_ref_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.stkvar_ref_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.stkvar_ref_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.stkvar_ref_t_compare(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.stkvar_ref_t_swap(self, *args) def get_stkvar(self, *args): """ get_stkvar(self, p_off=None) -> member_t * """ return _ida_hexrays.stkvar_ref_t_get_stkvar(self, *args) __swig_destroy__ = _ida_hexrays.delete_stkvar_ref_t __del__ = lambda self : None; stkvar_ref_t_swigregister = _ida_hexrays.stkvar_ref_t_swigregister stkvar_ref_t_swigregister(stkvar_ref_t) class scif_t(vdloc_t): """ Proxy of C++ scif_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr mba = _swig_property(_ida_hexrays.scif_t_mba_get, _ida_hexrays.scif_t_mba_set) name = _swig_property(_ida_hexrays.scif_t_name_get, _ida_hexrays.scif_t_name_set) type = _swig_property(_ida_hexrays.scif_t_type_get, _ida_hexrays.scif_t_type_set) def __init__(self, *args): """ __init__(self, _mba, n, tif) -> scif_t """ this = _ida_hexrays.new_scif_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_scif_t __del__ = lambda self : None; scif_t_swigregister = _ida_hexrays.scif_t_swigregister scif_t_swigregister(scif_t) class mnumber_t(operand_locator_t): """ Proxy of C++ mnumber_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr value = _swig_property(_ida_hexrays.mnumber_t_value_get, _ida_hexrays.mnumber_t_value_set) org_value = _swig_property(_ida_hexrays.mnumber_t_org_value_get, _ida_hexrays.mnumber_t_org_value_set) def __init__(self, *args): """ __init__(self, v, _ea=BADADDR, n=0) -> mnumber_t """ this = _ida_hexrays.new_mnumber_t(*args) try: self.this.append(this) except: self.this = this def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.mnumber_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.mnumber_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.mnumber_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.mnumber_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.mnumber_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.mnumber_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.mnumber_t_compare(self, *args) def update_value(self, *args): """ update_value(self, val64) """ return _ida_hexrays.mnumber_t_update_value(self, *args) __swig_destroy__ = _ida_hexrays.delete_mnumber_t __del__ = lambda self : None; mnumber_t_swigregister = _ida_hexrays.mnumber_t_swigregister mnumber_t_swigregister(mnumber_t) class fnumber_t(object): """ Proxy of C++ fnumber_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr fnum = _swig_property(_ida_hexrays.fnumber_t_fnum_get, _ida_hexrays.fnumber_t_fnum_set) nbytes = _swig_property(_ida_hexrays.fnumber_t_nbytes_get, _ida_hexrays.fnumber_t_nbytes_set) def dereference_uint16(self, *args): """ dereference_uint16(self) -> uint16 * """ return _ida_hexrays.fnumber_t_dereference_uint16(self, *args) def dereference_const_uint16(self, *args): """ dereference_const_uint16(self) -> uint16 const * """ return _ida_hexrays.fnumber_t_dereference_const_uint16(self, *args) def _print(self, *args): """ _print(self) """ return _ida_hexrays.fnumber_t__print(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.fnumber_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.fnumber_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.fnumber_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.fnumber_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.fnumber_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.fnumber_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.fnumber_t_compare(self, *args) def __get_fnum(self, *args): """ __get_fnum(self) -> fnum_array """ return _ida_hexrays.fnumber_t___get_fnum(self, *args) fnum = property(__get_fnum) def __init__(self, *args): """ __init__(self) -> fnumber_t """ this = _ida_hexrays.new_fnumber_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_fnumber_t __del__ = lambda self : None; fnumber_t_swigregister = _ida_hexrays.fnumber_t_swigregister fnumber_t_swigregister(fnumber_t) SHINS_NUMADDR = _ida_hexrays.SHINS_NUMADDR """ display definition addresses for numbers """ SHINS_VALNUM = _ida_hexrays.SHINS_VALNUM """ display value numbers """ SHINS_SHORT = _ida_hexrays.SHINS_SHORT """ do not display use-def chains and other attrs """ SHINS_LDXEA = _ida_hexrays.SHINS_LDXEA """ display address of ldx expressions (not used) """ NO_SIDEFF = _ida_hexrays.NO_SIDEFF WITH_SIDEFF = _ida_hexrays.WITH_SIDEFF ONLY_SIDEFF = _ida_hexrays.ONLY_SIDEFF ANY_REGSIZE = _ida_hexrays.ANY_REGSIZE class mop_t(object): """ Proxy of C++ mop_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr t = _swig_property(_ida_hexrays.mop_t_t_get, _ida_hexrays.mop_t_t_set) oprops = _swig_property(_ida_hexrays.mop_t_oprops_get, _ida_hexrays.mop_t_oprops_set) valnum = _swig_property(_ida_hexrays.mop_t_valnum_get, _ida_hexrays.mop_t_valnum_set) size = _swig_property(_ida_hexrays.mop_t_size_get, _ida_hexrays.mop_t_size_set) def set_impptr_done(self, *args): """ set_impptr_done(self) """ return _ida_hexrays.mop_t_set_impptr_done(self, *args) def set_udt(self, *args): """ set_udt(self) """ return _ida_hexrays.mop_t_set_udt(self, *args) def set_undef_val(self, *args): """ set_undef_val(self) """ return _ida_hexrays.mop_t_set_undef_val(self, *args) def is_impptr_done(self, *args): """ is_impptr_done(self) -> bool """ return _ida_hexrays.mop_t_is_impptr_done(self, *args) def is_udt(self, *args): """ is_udt(self) -> bool """ return _ida_hexrays.mop_t_is_udt(self, *args) def probably_floating(self, *args): """ probably_floating(self) -> bool """ return _ida_hexrays.mop_t_probably_floating(self, *args) def is_ccflags(self, *args): """ is_ccflags(self) -> bool """ return _ida_hexrays.mop_t_is_ccflags(self, *args) def is_undef_val(self, *args): """ is_undef_val(self) -> bool """ return _ida_hexrays.mop_t_is_undef_val(self, *args) def __init__(self, *args): """ __init__(self) -> mop_t __init__(self, rop) -> mop_t __init__(self, _r, _s) -> mop_t """ this = _ida_hexrays.new_mop_t(*args) try: self.this.append(this) except: self.this = this def assign(self, *args): """ assign(self, rop) -> mop_t """ return _ida_hexrays.mop_t_assign(self, *args) __swig_destroy__ = _ida_hexrays.delete_mop_t __del__ = lambda self : None; def zero(self, *args): """ zero(self) """ return _ida_hexrays.mop_t_zero(self, *args) def swap(self, *args): """ swap(self, rop) """ return _ida_hexrays.mop_t_swap(self, *args) def erase(self, *args): """ erase(self) """ return _ida_hexrays.mop_t_erase(self, *args) def erase_but_keep_size(self, *args): """ erase_but_keep_size(self) """ return _ida_hexrays.mop_t_erase_but_keep_size(self, *args) def _print(self, *args): """ _print(self, shins_flags=0x04|0x02) """ return _ida_hexrays.mop_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.mop_t_dstr(self, *args) def create_from_mlist(self, *args): """ create_from_mlist(self, mba, lst, fullsize) -> bool """ return _ida_hexrays.mop_t_create_from_mlist(self, *args) def create_from_ivlset(self, *args): """ create_from_ivlset(self, mba, ivs, fullsize) -> bool """ return _ida_hexrays.mop_t_create_from_ivlset(self, *args) def create_from_vdloc(self, *args): """ create_from_vdloc(self, mba, loc, _size) """ return _ida_hexrays.mop_t_create_from_vdloc(self, *args) def create_from_scattered_vdloc(self, *args): """ create_from_scattered_vdloc(self, mba, name, type, loc) """ return _ida_hexrays.mop_t_create_from_scattered_vdloc(self, *args) def create_from_insn(self, *args): """ create_from_insn(self, m) """ return _ida_hexrays.mop_t_create_from_insn(self, *args) def make_number(self, *args): """ make_number(self, _value, _size, _ea=BADADDR, opnum=0) """ return _ida_hexrays.mop_t_make_number(self, *args) def make_fpnum(self, *args): """ make_fpnum(self, bytes, _size) -> bool """ return _ida_hexrays.mop_t_make_fpnum(self, *args) def _make_reg(self, *args): """ _make_reg(self, reg) _make_reg(self, reg, _size) """ return _ida_hexrays.mop_t__make_reg(self, *args) def make_reg(self, *args): """ make_reg(self, reg) make_reg(self, reg, _size) """ return _ida_hexrays.mop_t_make_reg(self, *args) def _make_lvar(self, *args): """ _make_lvar(self, mba, idx, off=0) """ return _ida_hexrays.mop_t__make_lvar(self, *args) def _make_gvar(self, *args): """ _make_gvar(self, ea) """ return _ida_hexrays.mop_t__make_gvar(self, *args) def make_gvar(self, *args): """ make_gvar(self, ea) """ return _ida_hexrays.mop_t_make_gvar(self, *args) def _make_stkvar(self, *args): """ _make_stkvar(self, mba, off) """ return _ida_hexrays.mop_t__make_stkvar(self, *args) def make_reg_pair(self, *args): """ make_reg_pair(self, loreg, hireg, halfsize) """ return _ida_hexrays.mop_t_make_reg_pair(self, *args) def _make_insn(self, *args): """ _make_insn(self, ins) """ return _ida_hexrays.mop_t__make_insn(self, *args) def make_insn(self, *args): """ make_insn(self, ins) """ return _ida_hexrays.mop_t_make_insn(self, *args) def _make_blkref(self, *args): """ _make_blkref(self, blknum) """ return _ida_hexrays.mop_t__make_blkref(self, *args) def make_blkref(self, *args): """ make_blkref(self, blknum) """ return _ida_hexrays.mop_t_make_blkref(self, *args) def make_helper(self, *args): """ make_helper(self, name) """ return _ida_hexrays.mop_t_make_helper(self, *args) def _make_strlit(self, *args): """ _make_strlit(self, str) """ return _ida_hexrays.mop_t__make_strlit(self, *args) def _make_callinfo(self, *args): """ _make_callinfo(self, fi) """ return _ida_hexrays.mop_t__make_callinfo(self, *args) def _make_cases(self, *args): """ _make_cases(self, _cases) """ return _ida_hexrays.mop_t__make_cases(self, *args) def _make_pair(self, *args): """ _make_pair(self, _pair) """ return _ida_hexrays.mop_t__make_pair(self, *args) def is_reg(self, *args): """ is_reg(self) -> bool is_reg(self, _r) -> bool is_reg(self, _r, _size) -> bool """ return _ida_hexrays.mop_t_is_reg(self, *args) def is_cc(self, *args): """ is_cc(self) -> bool """ return _ida_hexrays.mop_t_is_cc(self, *args) def is_bit_reg(self, *args): """ is_bit_reg(self, reg) -> bool is_bit_reg(self) -> bool """ return _ida_hexrays.mop_t_is_bit_reg(self, *args) def is_kreg(self, *args): """ is_kreg(self) -> bool """ return _ida_hexrays.mop_t_is_kreg(self, *args) def is_mob(self, *args): """ is_mob(self, serial) -> bool """ return _ida_hexrays.mop_t_is_mob(self, *args) def is_scattered(self, *args): """ is_scattered(self) -> bool """ return _ida_hexrays.mop_t_is_scattered(self, *args) def is_glbaddr(self, *args): """ is_glbaddr(self) -> bool is_glbaddr(self, ea) -> bool """ return _ida_hexrays.mop_t_is_glbaddr(self, *args) def is_stkaddr(self, *args): """ is_stkaddr(self) -> bool """ return _ida_hexrays.mop_t_is_stkaddr(self, *args) def is_insn(self, *args): """ is_insn(self) -> bool is_insn(self, code) -> bool """ return _ida_hexrays.mop_t_is_insn(self, *args) def has_side_effects(self, *args): """ has_side_effects(self, include_ldx_and_divs=False) -> bool """ return _ida_hexrays.mop_t_has_side_effects(self, *args) def may_use_aliased_memory(self, *args): """ may_use_aliased_memory(self) -> bool """ return _ida_hexrays.mop_t_may_use_aliased_memory(self, *args) def is01(self, *args): """ is01(self) -> bool """ return _ida_hexrays.mop_t_is01(self, *args) def is_sign_extended_from(self, *args): """ is_sign_extended_from(self, nbytes) -> bool """ return _ida_hexrays.mop_t_is_sign_extended_from(self, *args) def is_zero_extended_from(self, *args): """ is_zero_extended_from(self, nbytes) -> bool """ return _ida_hexrays.mop_t_is_zero_extended_from(self, *args) def is_extended_from(self, *args): """ is_extended_from(self, nbytes, is_signed) -> bool """ return _ida_hexrays.mop_t_is_extended_from(self, *args) def equal_mops(self, *args): """ equal_mops(self, rop, eqflags) -> bool """ return _ida_hexrays.mop_t_equal_mops(self, *args) def __eq__(self, *args): """ __eq__(self, rop) -> bool """ return _ida_hexrays.mop_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, rop) -> bool """ return _ida_hexrays.mop_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, rop) -> bool """ return _ida_hexrays.mop_t___lt__(self, *args) def lexcompare(self, *args): """ lexcompare(self, rop) -> int """ return _ida_hexrays.mop_t_lexcompare(self, *args) def for_all_ops(self, *args): """ for_all_ops(self, mv, type=None, is_target=False) -> int """ return _ida_hexrays.mop_t_for_all_ops(self, *args) def for_all_scattered_submops(self, *args): """ for_all_scattered_submops(self, sv) -> int """ return _ida_hexrays.mop_t_for_all_scattered_submops(self, *args) def value(self, *args): """ value(self, is_signed) -> uint64 """ return _ida_hexrays.mop_t_value(self, *args) def signed_value(self, *args): """ signed_value(self) -> int64 """ return _ida_hexrays.mop_t_signed_value(self, *args) def unsigned_value(self, *args): """ unsigned_value(self) -> uint64 """ return _ida_hexrays.mop_t_unsigned_value(self, *args) def is_constant(self, *args): """ is_constant(self, is_signed=True) -> bool """ return _ida_hexrays.mop_t_is_constant(self, *args) def is_equal_to(self, *args): """ is_equal_to(self, n, is_signed=True) -> bool """ return _ida_hexrays.mop_t_is_equal_to(self, *args) def is_zero(self, *args): """ is_zero(self) -> bool """ return _ida_hexrays.mop_t_is_zero(self, *args) def is_one(self, *args): """ is_one(self) -> bool """ return _ida_hexrays.mop_t_is_one(self, *args) def is_positive_constant(self, *args): """ is_positive_constant(self) -> bool """ return _ida_hexrays.mop_t_is_positive_constant(self, *args) def is_negative_constant(self, *args): """ is_negative_constant(self) -> bool """ return _ida_hexrays.mop_t_is_negative_constant(self, *args) def get_stkvar(self, *args): """ get_stkvar(self, p_off) -> member_t * """ return _ida_hexrays.mop_t_get_stkvar(self, *args) def get_stkoff(self, *args): """ get_stkoff(self, p_off) -> bool """ return _ida_hexrays.mop_t_get_stkoff(self, *args) def get_insn(self, *args): """ get_insn(self, code) -> minsn_t get_insn(self, code) -> minsn_t """ return _ida_hexrays.mop_t_get_insn(self, *args) def make_low_half(self, *args): """ make_low_half(self, width) -> bool """ return _ida_hexrays.mop_t_make_low_half(self, *args) def make_high_half(self, *args): """ make_high_half(self, width) -> bool """ return _ida_hexrays.mop_t_make_high_half(self, *args) def make_first_half(self, *args): """ make_first_half(self, width) -> bool """ return _ida_hexrays.mop_t_make_first_half(self, *args) def make_second_half(self, *args): """ make_second_half(self, width) -> bool """ return _ida_hexrays.mop_t_make_second_half(self, *args) def shift_mop(self, *args): """ shift_mop(self, offset) -> bool """ return _ida_hexrays.mop_t_shift_mop(self, *args) def change_size(self, *args): """ change_size(self, nsize, sideff=WITH_SIDEFF) -> bool """ return _ida_hexrays.mop_t_change_size(self, *args) def double_size(self, *args): """ double_size(self, sideff=WITH_SIDEFF) -> bool """ return _ida_hexrays.mop_t_double_size(self, *args) def preserve_side_effects(self, *args): """ preserve_side_effects(self, blk, top, moved_calls=None) -> bool """ return _ida_hexrays.mop_t_preserve_side_effects(self, *args) def apply_ld_mcode(self, *args): """ apply_ld_mcode(self, mcode, ea, newsize) """ return _ida_hexrays.mop_t_apply_ld_mcode(self, *args) def apply_xdu(self, *args): """ apply_xdu(self, ea, newsize) """ return _ida_hexrays.mop_t_apply_xdu(self, *args) def apply_xds(self, *args): """ apply_xds(self, ea, newsize) """ return _ida_hexrays.mop_t_apply_xds(self, *args) def _register(self, *args): """ _register(self) """ return _ida_hexrays.mop_t__register(self, *args) def _deregister(self, *args): """ _deregister(self) """ return _ida_hexrays.mop_t__deregister(self, *args) def _get_r(self, *args): """ _get_r(self) -> mreg_t """ return _ida_hexrays.mop_t__get_r(self, *args) def _set_r(self, *args): """ _set_r(self, _v) """ return _ida_hexrays.mop_t__set_r(self, *args) r = property( lambda self: self._get_r() if self.t == mop_r else None, lambda self, v: self._ensure_cond(self.t == mop_r,"self.t == mop_r") and self._set_r(v)) def _get_nnn(self, *args): """ _get_nnn(self) -> mnumber_t """ return _ida_hexrays.mop_t__get_nnn(self, *args) def _set_nnn(self, *args): """ _set_nnn(self, _v) """ return _ida_hexrays.mop_t__set_nnn(self, *args) nnn = property( lambda self: self._get_nnn() if self.t == mop_n else None, lambda self, v: self._ensure_cond(self.t == mop_n,"self.t == mop_n") and self._ensure_no_obj(self._get_nnn(),"nnn", True) and self._acquire_ownership(v, True) and self._set_nnn(v)) def _get_cstr(self, *args): """ _get_cstr(self) -> char const * """ return _ida_hexrays.mop_t__get_cstr(self, *args) def _set_cstr(self, *args): """ _set_cstr(self, _v) """ return _ida_hexrays.mop_t__set_cstr(self, *args) cstr = property( lambda self: self._get_cstr() if self.t == mop_str else None, lambda self, v: self._ensure_cond(self.t == mop_str,"self.t == mop_str") and self._ensure_no_obj(self._get_cstr(),"cstr", False) and self._acquire_ownership(v, False) and self._set_cstr(v)) def _get_d(self, *args): """ _get_d(self) -> minsn_t """ return _ida_hexrays.mop_t__get_d(self, *args) def _set_d(self, *args): """ _set_d(self, _v) """ return _ida_hexrays.mop_t__set_d(self, *args) d = property( lambda self: self._get_d() if self.t == mop_d else None, lambda self, v: self._ensure_cond(self.t == mop_d,"self.t == mop_d") and self._ensure_no_obj(self._get_d(),"d", True) and self._acquire_ownership(v, True) and self._set_d(v)) def _get_s(self, *args): """ _get_s(self) -> stkvar_ref_t """ return _ida_hexrays.mop_t__get_s(self, *args) def _set_s(self, *args): """ _set_s(self, _v) """ return _ida_hexrays.mop_t__set_s(self, *args) s = property( lambda self: self._get_s() if self.t == mop_S else None, lambda self, v: self._ensure_cond(self.t == mop_S,"self.t == mop_S") and self._ensure_no_obj(self._get_s(),"s", True) and self._acquire_ownership(v, True) and self._set_s(v)) def _get_g(self, *args): """ _get_g(self) -> ea_t """ return _ida_hexrays.mop_t__get_g(self, *args) def _set_g(self, *args): """ _set_g(self, _v) """ return _ida_hexrays.mop_t__set_g(self, *args) g = property( lambda self: self._get_g() if self.t == mop_v else None, lambda self, v: self._ensure_cond(self.t == mop_v,"self.t == mop_v") and self._set_g(v)) def _get_b(self, *args): """ _get_b(self) -> int """ return _ida_hexrays.mop_t__get_b(self, *args) def _set_b(self, *args): """ _set_b(self, _v) """ return _ida_hexrays.mop_t__set_b(self, *args) b = property( lambda self: self._get_b() if self.t == mop_b else None, lambda self, v: self._ensure_cond(self.t == mop_b,"self.t == mop_b") and self._set_b(v)) def _get_f(self, *args): """ _get_f(self) -> mcallinfo_t """ return _ida_hexrays.mop_t__get_f(self, *args) def _set_f(self, *args): """ _set_f(self, _v) """ return _ida_hexrays.mop_t__set_f(self, *args) f = property( lambda self: self._get_f() if self.t == mop_f else None, lambda self, v: self._ensure_cond(self.t == mop_f,"self.t == mop_f") and self._ensure_no_obj(self._get_f(),"f", True) and self._acquire_ownership(v, True) and self._set_f(v)) def _get_l(self, *args): """ _get_l(self) -> lvar_ref_t """ return _ida_hexrays.mop_t__get_l(self, *args) def _set_l(self, *args): """ _set_l(self, _v) """ return _ida_hexrays.mop_t__set_l(self, *args) l = property( lambda self: self._get_l() if self.t == mop_l else None, lambda self, v: self._ensure_cond(self.t == mop_l,"self.t == mop_l") and self._ensure_no_obj(self._get_l(),"l", True) and self._acquire_ownership(v, True) and self._set_l(v)) def _get_a(self, *args): """ _get_a(self) -> mop_addr_t """ return _ida_hexrays.mop_t__get_a(self, *args) def _set_a(self, *args): """ _set_a(self, _v) """ return _ida_hexrays.mop_t__set_a(self, *args) a = property( lambda self: self._get_a() if self.t == mop_a else None, lambda self, v: self._ensure_cond(self.t == mop_a,"self.t == mop_a") and self._ensure_no_obj(self._get_a(),"a", True) and self._acquire_ownership(v, True) and self._set_a(v)) def _get_helper(self, *args): """ _get_helper(self) -> char const * """ return _ida_hexrays.mop_t__get_helper(self, *args) def _set_helper(self, *args): """ _set_helper(self, _v) """ return _ida_hexrays.mop_t__set_helper(self, *args) helper = property( lambda self: self._get_helper() if self.t == mop_h else None, lambda self, v: self._ensure_cond(self.t == mop_h,"self.t == mop_h") and self._ensure_no_obj(self._get_helper(),"helper", False) and self._acquire_ownership(v, False) and self._set_helper(v)) def _get_c(self, *args): """ _get_c(self) -> mcases_t """ return _ida_hexrays.mop_t__get_c(self, *args) def _set_c(self, *args): """ _set_c(self, _v) """ return _ida_hexrays.mop_t__set_c(self, *args) c = property( lambda self: self._get_c() if self.t == mop_c else None, lambda self, v: self._ensure_cond(self.t == mop_c,"self.t == mop_c") and self._ensure_no_obj(self._get_c(),"c", True) and self._acquire_ownership(v, True) and self._set_c(v)) def _get_fpc(self, *args): """ _get_fpc(self) -> fnumber_t """ return _ida_hexrays.mop_t__get_fpc(self, *args) def _set_fpc(self, *args): """ _set_fpc(self, _v) """ return _ida_hexrays.mop_t__set_fpc(self, *args) fpc = property( lambda self: self._get_fpc() if self.t == mop_fn else None, lambda self, v: self._ensure_cond(self.t == mop_fn,"self.t == mop_fn") and self._ensure_no_obj(self._get_fpc(),"fpc", True) and self._acquire_ownership(v, True) and self._set_fpc(v)) def _get_pair(self, *args): """ _get_pair(self) -> mop_pair_t """ return _ida_hexrays.mop_t__get_pair(self, *args) def _set_pair(self, *args): """ _set_pair(self, _v) """ return _ida_hexrays.mop_t__set_pair(self, *args) pair = property( lambda self: self._get_pair() if self.t == mop_p else None, lambda self, v: self._ensure_cond(self.t == mop_p,"self.t == mop_p") and self._ensure_no_obj(self._get_pair(),"pair", True) and self._acquire_ownership(v, True) and self._set_pair(v)) def _get_scif(self, *args): """ _get_scif(self) -> scif_t """ return _ida_hexrays.mop_t__get_scif(self, *args) def _set_scif(self, *args): """ _set_scif(self, _v) """ return _ida_hexrays.mop_t__set_scif(self, *args) scif = property( lambda self: self._get_scif() if self.t == mop_sc else None, lambda self, v: self._ensure_cond(self.t == mop_sc,"self.t == mop_sc") and self._ensure_no_obj(self._get_scif(),"scif", True) and self._acquire_ownership(v, True) and self._set_scif(v)) def _get_t(self, *args): """ _get_t(self) -> mopt_t """ return _ida_hexrays.mop_t__get_t(self, *args) def _set_t(self, *args): """ _set_t(self, v) """ return _ida_hexrays.mop_t__set_t(self, *args) def _ensure_no_t(self): if self.t not in [mop_z]: raise Exception("%s has type %s; cannot be modified" % (self, self.t)) return True t = property( _get_t, lambda self, v: self._ensure_no_t() and self._set_t(v)) def __dbg_get_meminfo(self, *args): """ __dbg_get_meminfo(self) -> qstring """ return _ida_hexrays.mop_t___dbg_get_meminfo(self, *args) def __dbg_get_registered_kind(self, *args): """ __dbg_get_registered_kind(self) -> int """ return _ida_hexrays.mop_t___dbg_get_registered_kind(self, *args) def _obj_id(self, *args): """ _obj_id(self) -> PyObject * """ return _ida_hexrays.mop_t__obj_id(self, *args) obj_id = property(_obj_id) def _ensure_cond(self, ok, cond_str): if not ok: raise Exception("Condition \"%s\" not verified" % cond_str) return True def _ensure_no_obj(self, o, attr, attr_is_acquired): if attr_is_acquired and o is not None: raise Exception("%s already owns attribute \"%s\" (%s); cannot be modified" % (self, attr, o)) return True def _acquire_ownership(self, v, acquire): if acquire and (v is not None) and not isinstance(v, (int, long)): if not v.thisown: raise Exception("%s is already owned, and cannot be reused" % v) v.thisown = False dereg = getattr(v, "_deregister", None) if dereg: dereg() return True def _maybe_disown_and_deregister(self): if self.thisown: self.thisown = False self._deregister() def _own_and_register(self): assert(not self.thisown) self.thisown = True self._register() def replace_by(self, o): assert(isinstance(o, (cexpr_t, cinsn_t))) o._maybe_disown_and_deregister() self._replace_by(o) def _meminfo(self): cpp = self.__dbg_get_meminfo() rkind = self.__dbg_get_registered_kind() rkind_str = [ "(not owned)", "cfuncptr_t", "cinsn_t", "cexpr_t", "cblock_t", "mbl_array_t", "mop_t", "minsn_t", "optinsn_t", "optblock_t", "valrng_t"][rkind] return "%s [thisown=%s, owned by IDAPython as=%s]" % ( cpp, self.thisown, rkind_str) meminfo = property(_meminfo) mop_t_swigregister = _ida_hexrays.mop_t_swigregister mop_t_swigregister(mop_t) MAX_OPSIZE = cvar.MAX_OPSIZE DOUBLE_OPSIZE = cvar.DOUBLE_OPSIZE OPROP_IMPDONE = _ida_hexrays.OPROP_IMPDONE """ imported operand (a pointer) has been dereferenced """ OPROP_UDT = _ida_hexrays.OPROP_UDT """ a struct or union """ OPROP_FLOAT = _ida_hexrays.OPROP_FLOAT """ possibly floating value """ OPROP_CCFLAGS = _ida_hexrays.OPROP_CCFLAGS """ condition codes register value """ OPROP_UDEFVAL = _ida_hexrays.OPROP_UDEFVAL """ uses undefined value """ def lexcompare(*args): """ lexcompare(a, b) -> int """ return _ida_hexrays.lexcompare(*args) class mop_pair_t(object): """ Proxy of C++ mop_pair_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr lop = _swig_property(_ida_hexrays.mop_pair_t_lop_get, _ida_hexrays.mop_pair_t_lop_set) hop = _swig_property(_ida_hexrays.mop_pair_t_hop_get, _ida_hexrays.mop_pair_t_hop_set) def __init__(self, *args): """ __init__(self) -> mop_pair_t """ this = _ida_hexrays.new_mop_pair_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_mop_pair_t __del__ = lambda self : None; mop_pair_t_swigregister = _ida_hexrays.mop_pair_t_swigregister mop_pair_t_swigregister(mop_pair_t) class mop_addr_t(mop_t): """ Proxy of C++ mop_addr_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr insize = _swig_property(_ida_hexrays.mop_addr_t_insize_get, _ida_hexrays.mop_addr_t_insize_set) outsize = _swig_property(_ida_hexrays.mop_addr_t_outsize_get, _ida_hexrays.mop_addr_t_outsize_set) def __init__(self, *args): """ __init__(self) -> mop_addr_t __init__(self, ra) -> mop_addr_t __init__(self, ra, isz, osz) -> mop_addr_t """ this = _ida_hexrays.new_mop_addr_t(*args) try: self.this.append(this) except: self.this = this def lexcompare(self, *args): """ lexcompare(self, ra) -> int """ return _ida_hexrays.mop_addr_t_lexcompare(self, *args) __swig_destroy__ = _ida_hexrays.delete_mop_addr_t __del__ = lambda self : None; mop_addr_t_swigregister = _ida_hexrays.mop_addr_t_swigregister mop_addr_t_swigregister(mop_addr_t) class mcallarg_t(mop_t): """ Proxy of C++ mcallarg_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ea = _swig_property(_ida_hexrays.mcallarg_t_ea_get, _ida_hexrays.mcallarg_t_ea_set) type = _swig_property(_ida_hexrays.mcallarg_t_type_get, _ida_hexrays.mcallarg_t_type_set) name = _swig_property(_ida_hexrays.mcallarg_t_name_get, _ida_hexrays.mcallarg_t_name_set) argloc = _swig_property(_ida_hexrays.mcallarg_t_argloc_get, _ida_hexrays.mcallarg_t_argloc_set) def __init__(self, *args): """ __init__(self) -> mcallarg_t __init__(self, rarg) -> mcallarg_t """ this = _ida_hexrays.new_mcallarg_t(*args) try: self.this.append(this) except: self.this = this def copy_mop(self, *args): """ copy_mop(self, op) """ return _ida_hexrays.mcallarg_t_copy_mop(self, *args) def _print(self, *args): """ _print(self, shins_flags=0x04|0x02) """ return _ida_hexrays.mcallarg_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.mcallarg_t_dstr(self, *args) def set_regarg(self, *args): """ set_regarg(self, mr, sz, tif) set_regarg(self, mr, tif) set_regarg(self, mr, dt, sign=type_unsigned) """ return _ida_hexrays.mcallarg_t_set_regarg(self, *args) def make_int(self, *args): """ make_int(self, val, val_ea, opno=0) """ return _ida_hexrays.mcallarg_t_make_int(self, *args) def make_uint(self, *args): """ make_uint(self, val, val_ea, opno=0) """ return _ida_hexrays.mcallarg_t_make_uint(self, *args) __swig_destroy__ = _ida_hexrays.delete_mcallarg_t __del__ = lambda self : None; mcallarg_t_swigregister = _ida_hexrays.mcallarg_t_swigregister mcallarg_t_swigregister(mcallarg_t) ROLE_UNK = _ida_hexrays.ROLE_UNK ROLE_EMPTY = _ida_hexrays.ROLE_EMPTY ROLE_MEMSET = _ida_hexrays.ROLE_MEMSET ROLE_MEMSET32 = _ida_hexrays.ROLE_MEMSET32 ROLE_MEMSET64 = _ida_hexrays.ROLE_MEMSET64 ROLE_MEMCPY = _ida_hexrays.ROLE_MEMCPY ROLE_STRCPY = _ida_hexrays.ROLE_STRCPY ROLE_STRLEN = _ida_hexrays.ROLE_STRLEN ROLE_STRCAT = _ida_hexrays.ROLE_STRCAT ROLE_TAIL = _ida_hexrays.ROLE_TAIL ROLE_BUG = _ida_hexrays.ROLE_BUG ROLE_ALLOCA = _ida_hexrays.ROLE_ALLOCA ROLE_BSWAP = _ida_hexrays.ROLE_BSWAP ROLE_PRESENT = _ida_hexrays.ROLE_PRESENT ROLE_CONTAINING_RECORD = _ida_hexrays.ROLE_CONTAINING_RECORD ROLE_FASTFAIL = _ida_hexrays.ROLE_FASTFAIL ROLE_READFLAGS = _ida_hexrays.ROLE_READFLAGS ROLE_IS_MUL_OK = _ida_hexrays.ROLE_IS_MUL_OK ROLE_SATURATED_MUL = _ida_hexrays.ROLE_SATURATED_MUL ROLE_BITTEST = _ida_hexrays.ROLE_BITTEST ROLE_BITTESTANDSET = _ida_hexrays.ROLE_BITTESTANDSET ROLE_BITTESTANDRESET = _ida_hexrays.ROLE_BITTESTANDRESET ROLE_BITTESTANDCOMPLEMENT = _ida_hexrays.ROLE_BITTESTANDCOMPLEMENT ROLE_VA_ARG = _ida_hexrays.ROLE_VA_ARG ROLE_VA_COPY = _ida_hexrays.ROLE_VA_COPY ROLE_VA_START = _ida_hexrays.ROLE_VA_START ROLE_VA_END = _ida_hexrays.ROLE_VA_END ROLE_ROL = _ida_hexrays.ROLE_ROL ROLE_ROR = _ida_hexrays.ROLE_ROR ROLE_CFSUB3 = _ida_hexrays.ROLE_CFSUB3 ROLE_OFSUB3 = _ida_hexrays.ROLE_OFSUB3 ROLE_ABS = _ida_hexrays.ROLE_ABS FUNC_NAME_MEMCPY = _ida_hexrays.FUNC_NAME_MEMCPY FUNC_NAME_MEMSET = _ida_hexrays.FUNC_NAME_MEMSET FUNC_NAME_MEMSET32 = _ida_hexrays.FUNC_NAME_MEMSET32 FUNC_NAME_MEMSET64 = _ida_hexrays.FUNC_NAME_MEMSET64 FUNC_NAME_STRCPY = _ida_hexrays.FUNC_NAME_STRCPY FUNC_NAME_STRLEN = _ida_hexrays.FUNC_NAME_STRLEN FUNC_NAME_STRCAT = _ida_hexrays.FUNC_NAME_STRCAT FUNC_NAME_TAIL = _ida_hexrays.FUNC_NAME_TAIL FUNC_NAME_VA_ARG = _ida_hexrays.FUNC_NAME_VA_ARG FUNC_NAME_EMPTY = _ida_hexrays.FUNC_NAME_EMPTY FUNC_NAME_PRESENT = _ida_hexrays.FUNC_NAME_PRESENT FUNC_NAME_CONTAINING_RECORD = _ida_hexrays.FUNC_NAME_CONTAINING_RECORD class mcallinfo_t(object): """ Proxy of C++ mcallinfo_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr callee = _swig_property(_ida_hexrays.mcallinfo_t_callee_get, _ida_hexrays.mcallinfo_t_callee_set) solid_args = _swig_property(_ida_hexrays.mcallinfo_t_solid_args_get, _ida_hexrays.mcallinfo_t_solid_args_set) call_spd = _swig_property(_ida_hexrays.mcallinfo_t_call_spd_get, _ida_hexrays.mcallinfo_t_call_spd_set) stkargs_top = _swig_property(_ida_hexrays.mcallinfo_t_stkargs_top_get, _ida_hexrays.mcallinfo_t_stkargs_top_set) cc = _swig_property(_ida_hexrays.mcallinfo_t_cc_get, _ida_hexrays.mcallinfo_t_cc_set) args = _swig_property(_ida_hexrays.mcallinfo_t_args_get, _ida_hexrays.mcallinfo_t_args_set) retregs = _swig_property(_ida_hexrays.mcallinfo_t_retregs_get, _ida_hexrays.mcallinfo_t_retregs_set) return_type = _swig_property(_ida_hexrays.mcallinfo_t_return_type_get, _ida_hexrays.mcallinfo_t_return_type_set) return_argloc = _swig_property(_ida_hexrays.mcallinfo_t_return_argloc_get, _ida_hexrays.mcallinfo_t_return_argloc_set) return_regs = _swig_property(_ida_hexrays.mcallinfo_t_return_regs_get, _ida_hexrays.mcallinfo_t_return_regs_set) spoiled = _swig_property(_ida_hexrays.mcallinfo_t_spoiled_get, _ida_hexrays.mcallinfo_t_spoiled_set) pass_regs = _swig_property(_ida_hexrays.mcallinfo_t_pass_regs_get, _ida_hexrays.mcallinfo_t_pass_regs_set) visible_memory = _swig_property(_ida_hexrays.mcallinfo_t_visible_memory_get, _ida_hexrays.mcallinfo_t_visible_memory_set) dead_regs = _swig_property(_ida_hexrays.mcallinfo_t_dead_regs_get, _ida_hexrays.mcallinfo_t_dead_regs_set) flags = _swig_property(_ida_hexrays.mcallinfo_t_flags_get, _ida_hexrays.mcallinfo_t_flags_set) role = _swig_property(_ida_hexrays.mcallinfo_t_role_get, _ida_hexrays.mcallinfo_t_role_set) def __init__(self, *args): """ __init__(self, _callee=BADADDR, _sargs=0) -> mcallinfo_t """ this = _ida_hexrays.new_mcallinfo_t(*args) try: self.this.append(this) except: self.this = this def lexcompare(self, *args): """ lexcompare(self, f) -> int """ return _ida_hexrays.mcallinfo_t_lexcompare(self, *args) def set_type(self, *args): """ set_type(self, type) -> bool """ return _ida_hexrays.mcallinfo_t_set_type(self, *args) def get_type(self, *args): """ get_type(self) -> tinfo_t """ return _ida_hexrays.mcallinfo_t_get_type(self, *args) def is_vararg(self, *args): """ is_vararg(self) -> bool """ return _ida_hexrays.mcallinfo_t_is_vararg(self, *args) def _print(self, *args): """ _print(self, size=-1, shins_flags=0x04|0x02) """ return _ida_hexrays.mcallinfo_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.mcallinfo_t_dstr(self, *args) __swig_destroy__ = _ida_hexrays.delete_mcallinfo_t __del__ = lambda self : None; mcallinfo_t_swigregister = _ida_hexrays.mcallinfo_t_swigregister mcallinfo_t_swigregister(mcallinfo_t) FCI_PROP = _ida_hexrays.FCI_PROP """ call has been propagated """ FCI_DEAD = _ida_hexrays.FCI_DEAD """ some return registers were determined dead """ FCI_FINAL = _ida_hexrays.FCI_FINAL """ call type is final, should not be changed """ FCI_NORET = _ida_hexrays.FCI_NORET """ call does not return """ FCI_PURE = _ida_hexrays.FCI_PURE """ pure function """ FCI_NOSIDE = _ida_hexrays.FCI_NOSIDE """ call does not have side effects """ FCI_SPLOK = _ida_hexrays.FCI_SPLOK """ spoiled/visible_memory lists have been optimized. for some functions we can reduce them as soon as information about the arguments becomes available. in order not to try optimize them again we use this bit. """ FCI_HASCALL = _ida_hexrays.FCI_HASCALL """ A function is an synthetic helper combined from several instructions and at least one of them was a call to a real functions """ FCI_HASFMT = _ida_hexrays.FCI_HASFMT """ printf- or scanf-style format string A variadic function with recognized """ class mcases_t(object): """ Proxy of C++ mcases_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr values = _swig_property(_ida_hexrays.mcases_t_values_get, _ida_hexrays.mcases_t_values_set) targets = _swig_property(_ida_hexrays.mcases_t_targets_get, _ida_hexrays.mcases_t_targets_set) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.mcases_t_swap(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.mcases_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.mcases_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.mcases_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.mcases_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.mcases_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.mcases_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.mcases_t_compare(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.mcases_t_empty(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.mcases_t_size(self, *args) def resize(self, *args): """ resize(self, s) """ return _ida_hexrays.mcases_t_resize(self, *args) def _print(self, *args): """ _print(self) """ return _ida_hexrays.mcases_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.mcases_t_dstr(self, *args) def __init__(self, *args): """ __init__(self) -> mcases_t """ this = _ida_hexrays.new_mcases_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_mcases_t __del__ = lambda self : None; mcases_t_swigregister = _ida_hexrays.mcases_t_swigregister mcases_t_swigregister(mcases_t) class voff_t(object): """ Proxy of C++ voff_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr off = _swig_property(_ida_hexrays.voff_t_off_get, _ida_hexrays.voff_t_off_set) type = _swig_property(_ida_hexrays.voff_t_type_get, _ida_hexrays.voff_t_type_set) def __init__(self, *args): """ __init__(self) -> voff_t __init__(self, _type, _off) -> voff_t __init__(self, op) -> voff_t """ this = _ida_hexrays.new_voff_t(*args) try: self.this.append(this) except: self.this = this def set(self, *args): """ set(self, _type, _off) """ return _ida_hexrays.voff_t_set(self, *args) def set_stkoff(self, *args): """ set_stkoff(self, stkoff) """ return _ida_hexrays.voff_t_set_stkoff(self, *args) def set_reg(self, *args): """ set_reg(self, mreg) """ return _ida_hexrays.voff_t_set_reg(self, *args) def undef(self, *args): """ undef(self) """ return _ida_hexrays.voff_t_undef(self, *args) def defined(self, *args): """ defined(self) -> bool """ return _ida_hexrays.voff_t_defined(self, *args) def is_reg(self, *args): """ is_reg(self) -> bool """ return _ida_hexrays.voff_t_is_reg(self, *args) def is_stkoff(self, *args): """ is_stkoff(self) -> bool """ return _ida_hexrays.voff_t_is_stkoff(self, *args) def get_reg(self, *args): """ get_reg(self) -> mreg_t """ return _ida_hexrays.voff_t_get_reg(self, *args) def get_stkoff(self, *args): """ get_stkoff(self) -> sval_t """ return _ida_hexrays.voff_t_get_stkoff(self, *args) def inc(self, *args): """ inc(self, delta) """ return _ida_hexrays.voff_t_inc(self, *args) def add(self, *args): """ add(self, width) -> voff_t """ return _ida_hexrays.voff_t_add(self, *args) def diff(self, *args): """ diff(self, r) -> sval_t """ return _ida_hexrays.voff_t_diff(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.voff_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.voff_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.voff_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.voff_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.voff_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.voff_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.voff_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_voff_t __del__ = lambda self : None; voff_t_swigregister = _ida_hexrays.voff_t_swigregister voff_t_swigregister(voff_t) class vivl_t(voff_t): """ Proxy of C++ vivl_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr size = _swig_property(_ida_hexrays.vivl_t_size_get, _ida_hexrays.vivl_t_size_set) def __init__(self, *args): """ __init__(self, _type=mop_z, _off=-1, _size=0) -> vivl_t __init__(self, ch) -> vivl_t __init__(self, op) -> vivl_t """ this = _ida_hexrays.new_vivl_t(*args) try: self.this.append(this) except: self.this = this def set(self, *args): """ set(self, _type, _off, _size=0) set(self, voff, _size) """ return _ida_hexrays.vivl_t_set(self, *args) def set_stkoff(self, *args): """ set_stkoff(self, stkoff, sz=0) """ return _ida_hexrays.vivl_t_set_stkoff(self, *args) def set_reg(self, *args): """ set_reg(self, mreg, sz=0) """ return _ida_hexrays.vivl_t_set_reg(self, *args) def extend_to_cover(self, *args): """ extend_to_cover(self, r) -> bool """ return _ida_hexrays.vivl_t_extend_to_cover(self, *args) def intersect(self, *args): """ intersect(self, r) -> uval_t """ return _ida_hexrays.vivl_t_intersect(self, *args) def overlap(self, *args): """ overlap(self, r) -> bool """ return _ida_hexrays.vivl_t_overlap(self, *args) def includes(self, *args): """ includes(self, r) -> bool """ return _ida_hexrays.vivl_t_includes(self, *args) def contains(self, *args): """ contains(self, voff2) -> bool """ return _ida_hexrays.vivl_t_contains(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.vivl_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.vivl_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.vivl_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.vivl_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.vivl_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.vivl_t_compare(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool __eq__(self, mop) -> bool """ return _ida_hexrays.vivl_t___eq__(self, *args) def _print(self, *args): """ _print(self) """ return _ida_hexrays.vivl_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.vivl_t_dstr(self, *args) __swig_destroy__ = _ida_hexrays.delete_vivl_t __del__ = lambda self : None; vivl_t_swigregister = _ida_hexrays.vivl_t_swigregister vivl_t_swigregister(vivl_t) class chain_t(ida_pro.intvec_t): """ Proxy of C++ chain_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr width = _swig_property(_ida_hexrays.chain_t_width_get, _ida_hexrays.chain_t_width_set) varnum = _swig_property(_ida_hexrays.chain_t_varnum_get, _ida_hexrays.chain_t_varnum_set) flags = _swig_property(_ida_hexrays.chain_t_flags_get, _ida_hexrays.chain_t_flags_set) def __init__(self, *args): """ __init__(self) -> chain_t __init__(self, t, off, w=1, v=-1) -> chain_t __init__(self, _k, w=1) -> chain_t """ this = _ida_hexrays.new_chain_t(*args) try: self.this.append(this) except: self.this = this def set_value(self, *args): """ set_value(self, r) """ return _ida_hexrays.chain_t_set_value(self, *args) def key(self, *args): """ key(self) -> voff_t """ return _ida_hexrays.chain_t_key(self, *args) def is_inited(self, *args): """ is_inited(self) -> bool """ return _ida_hexrays.chain_t_is_inited(self, *args) def is_reg(self, *args): """ is_reg(self) -> bool """ return _ida_hexrays.chain_t_is_reg(self, *args) def is_stkoff(self, *args): """ is_stkoff(self) -> bool """ return _ida_hexrays.chain_t_is_stkoff(self, *args) def is_replaced(self, *args): """ is_replaced(self) -> bool """ return _ida_hexrays.chain_t_is_replaced(self, *args) def is_overlapped(self, *args): """ is_overlapped(self) -> bool """ return _ida_hexrays.chain_t_is_overlapped(self, *args) def is_fake(self, *args): """ is_fake(self) -> bool """ return _ida_hexrays.chain_t_is_fake(self, *args) def is_passreg(self, *args): """ is_passreg(self) -> bool """ return _ida_hexrays.chain_t_is_passreg(self, *args) def is_term(self, *args): """ is_term(self) -> bool """ return _ida_hexrays.chain_t_is_term(self, *args) def set_inited(self, *args): """ set_inited(self, b) """ return _ida_hexrays.chain_t_set_inited(self, *args) def set_replaced(self, *args): """ set_replaced(self, b) """ return _ida_hexrays.chain_t_set_replaced(self, *args) def set_overlapped(self, *args): """ set_overlapped(self, b) """ return _ida_hexrays.chain_t_set_overlapped(self, *args) def set_term(self, *args): """ set_term(self, b) """ return _ida_hexrays.chain_t_set_term(self, *args) def get_reg(self, *args): """ get_reg(self) -> mreg_t """ return _ida_hexrays.chain_t_get_reg(self, *args) def get_stkoff(self, *args): """ get_stkoff(self) -> sval_t """ return _ida_hexrays.chain_t_get_stkoff(self, *args) def overlap(self, *args): """ overlap(self, r) -> bool """ return _ida_hexrays.chain_t_overlap(self, *args) def includes(self, *args): """ includes(self, r) -> bool """ return _ida_hexrays.chain_t_includes(self, *args) def endoff(self, *args): """ endoff(self) -> voff_t """ return _ida_hexrays.chain_t_endoff(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.chain_t___lt__(self, *args) def _print(self, *args): """ _print(self) """ return _ida_hexrays.chain_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.chain_t_dstr(self, *args) def append_list(self, *args): """ append_list(self, list) """ return _ida_hexrays.chain_t_append_list(self, *args) def clear_varnum(self, *args): """ clear_varnum(self) """ return _ida_hexrays.chain_t_clear_varnum(self, *args) __swig_destroy__ = _ida_hexrays.delete_chain_t __del__ = lambda self : None; chain_t_swigregister = _ida_hexrays.chain_t_swigregister chain_t_swigregister(chain_t) CHF_INITED = _ida_hexrays.CHF_INITED """ is chain initialized? (valid only after lvar allocation) """ CHF_REPLACED = _ida_hexrays.CHF_REPLACED """ chain operands have been replaced? """ CHF_OVER = _ida_hexrays.CHF_OVER """ overlapped chain """ CHF_FAKE = _ida_hexrays.CHF_FAKE """ fake chain created by widen_chains() """ CHF_PASSTHRU = _ida_hexrays.CHF_PASSTHRU """ pass-thru chain, must use the input variable to the block """ CHF_TERM = _ida_hexrays.CHF_TERM """ terminating chain; the variable does not survive across the block """ SIZEOF_BLOCK_CHAINS = _ida_hexrays.SIZEOF_BLOCK_CHAINS class block_chains_t(object): """ Proxy of C++ block_chains_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def get_reg_chain(self, *args): """ get_reg_chain(self, reg, width=1) -> chain_t get_reg_chain(self, reg, width=1) -> chain_t """ return _ida_hexrays.block_chains_t_get_reg_chain(self, *args) def get_stk_chain(self, *args): """ get_stk_chain(self, off, width=1) -> chain_t get_stk_chain(self, off, width=1) -> chain_t """ return _ida_hexrays.block_chains_t_get_stk_chain(self, *args) def get_chain(self, *args): """ get_chain(self, k, width=1) -> chain_t get_chain(self, k, width=1) -> chain_t get_chain(self, ch) -> chain_t get_chain(self, ch) -> chain_t """ return _ida_hexrays.block_chains_t_get_chain(self, *args) def _print(self, *args): """ _print(self) """ return _ida_hexrays.block_chains_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.block_chains_t_dstr(self, *args) def __init__(self, *args): """ __init__(self) -> block_chains_t """ this = _ida_hexrays.new_block_chains_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_block_chains_t __del__ = lambda self : None; block_chains_t_swigregister = _ida_hexrays.block_chains_t_swigregister block_chains_t_swigregister(block_chains_t) class chain_visitor_t(object): """ Proxy of C++ chain_visitor_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr parent = _swig_property(_ida_hexrays.chain_visitor_t_parent_get, _ida_hexrays.chain_visitor_t_parent_set) def __init__(self, *args): """ __init__(self) -> chain_visitor_t """ if self.__class__ == chain_visitor_t: _self = None else: _self = self this = _ida_hexrays.new_chain_visitor_t(_self, *args) try: self.this.append(this) except: self.this = this def visit_chain(self, *args): """ visit_chain(self, nblock, ch) -> int """ return _ida_hexrays.chain_visitor_t_visit_chain(self, *args) __swig_destroy__ = _ida_hexrays.delete_chain_visitor_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_chain_visitor_t(self) return weakref_proxy(self) chain_visitor_t_swigregister = _ida_hexrays.chain_visitor_t_swigregister chain_visitor_t_swigregister(chain_visitor_t) class graph_chains_t(block_chains_vec_t): """ Proxy of C++ graph_chains_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> graph_chains_t """ this = _ida_hexrays.new_graph_chains_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_graph_chains_t __del__ = lambda self : None; def for_all_chains(self, *args): """ for_all_chains(self, cv, gca_flags) -> int """ return _ida_hexrays.graph_chains_t_for_all_chains(self, *args) def is_locked(self, *args): """ is_locked(self) -> bool """ return _ida_hexrays.graph_chains_t_is_locked(self, *args) def acquire(self, *args): """ acquire(self) """ return _ida_hexrays.graph_chains_t_acquire(self, *args) def release(self, *args): """ release(self) """ return _ida_hexrays.graph_chains_t_release(self, *args) def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.graph_chains_t_swap(self, *args) graph_chains_t_swigregister = _ida_hexrays.graph_chains_t_swigregister graph_chains_t_swigregister(graph_chains_t) GCA_EMPTY = _ida_hexrays.GCA_EMPTY """ include empty chains """ GCA_SPEC = _ida_hexrays.GCA_SPEC """ include chains for special registers """ GCA_ALLOC = _ida_hexrays.GCA_ALLOC """ enumerate only allocated chains """ GCA_NALLOC = _ida_hexrays.GCA_NALLOC """ enumerate only non-allocated chains """ GCA_OFIRST = _ida_hexrays.GCA_OFIRST """ consider only chains of the first block """ GCA_OLAST = _ida_hexrays.GCA_OLAST """ consider only chains of the last block """ class minsn_t(object): """ Proxy of C++ minsn_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr opcode = _swig_property(_ida_hexrays.minsn_t_opcode_get, _ida_hexrays.minsn_t_opcode_set) iprops = _swig_property(_ida_hexrays.minsn_t_iprops_get, _ida_hexrays.minsn_t_iprops_set) next = _swig_property(_ida_hexrays.minsn_t_next_get, _ida_hexrays.minsn_t_next_set) prev = _swig_property(_ida_hexrays.minsn_t_prev_get, _ida_hexrays.minsn_t_prev_set) ea = _swig_property(_ida_hexrays.minsn_t_ea_get, _ida_hexrays.minsn_t_ea_set) l = _swig_property(_ida_hexrays.minsn_t_l_get, _ida_hexrays.minsn_t_l_set) r = _swig_property(_ida_hexrays.minsn_t_r_get, _ida_hexrays.minsn_t_r_set) d = _swig_property(_ida_hexrays.minsn_t_d_get, _ida_hexrays.minsn_t_d_set) def is_optional(self, *args): """ is_optional(self) -> bool """ return _ida_hexrays.minsn_t_is_optional(self, *args) def is_combined(self, *args): """ is_combined(self) -> bool """ return _ida_hexrays.minsn_t_is_combined(self, *args) def is_farcall(self, *args): """ is_farcall(self) -> bool """ return _ida_hexrays.minsn_t_is_farcall(self, *args) def is_cleaning_pop(self, *args): """ is_cleaning_pop(self) -> bool """ return _ida_hexrays.minsn_t_is_cleaning_pop(self, *args) def is_extstx(self, *args): """ is_extstx(self) -> bool """ return _ida_hexrays.minsn_t_is_extstx(self, *args) def is_tailcall(self, *args): """ is_tailcall(self) -> bool """ return _ida_hexrays.minsn_t_is_tailcall(self, *args) def is_fpinsn(self, *args): """ is_fpinsn(self) -> bool """ return _ida_hexrays.minsn_t_is_fpinsn(self, *args) def is_assert(self, *args): """ is_assert(self) -> bool """ return _ida_hexrays.minsn_t_is_assert(self, *args) def is_persistent(self, *args): """ is_persistent(self) -> bool """ return _ida_hexrays.minsn_t_is_persistent(self, *args) def is_wild_match(self, *args): """ is_wild_match(self) -> bool """ return _ida_hexrays.minsn_t_is_wild_match(self, *args) def is_propagatable(self, *args): """ is_propagatable(self) -> bool """ return _ida_hexrays.minsn_t_is_propagatable(self, *args) def is_ignlowsrc(self, *args): """ is_ignlowsrc(self) -> bool """ return _ida_hexrays.minsn_t_is_ignlowsrc(self, *args) def is_inverted_jx(self, *args): """ is_inverted_jx(self) -> bool """ return _ida_hexrays.minsn_t_is_inverted_jx(self, *args) def was_noret_icall(self, *args): """ was_noret_icall(self) -> bool """ return _ida_hexrays.minsn_t_was_noret_icall(self, *args) def is_multimov(self, *args): """ is_multimov(self) -> bool """ return _ida_hexrays.minsn_t_is_multimov(self, *args) def is_combinable(self, *args): """ is_combinable(self) -> bool """ return _ida_hexrays.minsn_t_is_combinable(self, *args) def was_split(self, *args): """ was_split(self) -> bool """ return _ida_hexrays.minsn_t_was_split(self, *args) def set_optional(self, *args): """ set_optional(self) """ return _ida_hexrays.minsn_t_set_optional(self, *args) def clr_combined(self, *args): """ clr_combined(self) """ return _ida_hexrays.minsn_t_clr_combined(self, *args) def set_farcall(self, *args): """ set_farcall(self) """ return _ida_hexrays.minsn_t_set_farcall(self, *args) def set_cleaning_pop(self, *args): """ set_cleaning_pop(self) """ return _ida_hexrays.minsn_t_set_cleaning_pop(self, *args) def set_extstx(self, *args): """ set_extstx(self) """ return _ida_hexrays.minsn_t_set_extstx(self, *args) def set_tailcall(self, *args): """ set_tailcall(self) """ return _ida_hexrays.minsn_t_set_tailcall(self, *args) def clr_tailcall(self, *args): """ clr_tailcall(self) """ return _ida_hexrays.minsn_t_clr_tailcall(self, *args) def set_fpinsn(self, *args): """ set_fpinsn(self) """ return _ida_hexrays.minsn_t_set_fpinsn(self, *args) def clr_fpinsn(self, *args): """ clr_fpinsn(self) """ return _ida_hexrays.minsn_t_clr_fpinsn(self, *args) def set_assert(self, *args): """ set_assert(self) """ return _ida_hexrays.minsn_t_set_assert(self, *args) def clr_assert(self, *args): """ clr_assert(self) """ return _ida_hexrays.minsn_t_clr_assert(self, *args) def set_persistent(self, *args): """ set_persistent(self) """ return _ida_hexrays.minsn_t_set_persistent(self, *args) def set_wild_match(self, *args): """ set_wild_match(self) """ return _ida_hexrays.minsn_t_set_wild_match(self, *args) def clr_propagatable(self, *args): """ clr_propagatable(self) """ return _ida_hexrays.minsn_t_clr_propagatable(self, *args) def set_ignlowsrc(self, *args): """ set_ignlowsrc(self) """ return _ida_hexrays.minsn_t_set_ignlowsrc(self, *args) def clr_ignlowsrc(self, *args): """ clr_ignlowsrc(self) """ return _ida_hexrays.minsn_t_clr_ignlowsrc(self, *args) def set_inverted_jx(self, *args): """ set_inverted_jx(self) """ return _ida_hexrays.minsn_t_set_inverted_jx(self, *args) def set_noret_icall(self, *args): """ set_noret_icall(self) """ return _ida_hexrays.minsn_t_set_noret_icall(self, *args) def clr_noret_icall(self, *args): """ clr_noret_icall(self) """ return _ida_hexrays.minsn_t_clr_noret_icall(self, *args) def set_multimov(self, *args): """ set_multimov(self) """ return _ida_hexrays.minsn_t_set_multimov(self, *args) def clr_multimov(self, *args): """ clr_multimov(self) """ return _ida_hexrays.minsn_t_clr_multimov(self, *args) def set_combinable(self, *args): """ set_combinable(self) """ return _ida_hexrays.minsn_t_set_combinable(self, *args) def clr_combinable(self, *args): """ clr_combinable(self) """ return _ida_hexrays.minsn_t_clr_combinable(self, *args) def set_split_size(self, *args): """ set_split_size(self, s) """ return _ida_hexrays.minsn_t_set_split_size(self, *args) def get_split_size(self, *args): """ get_split_size(self) -> int """ return _ida_hexrays.minsn_t_get_split_size(self, *args) def __init__(self, *args): """ __init__(self, _ea) -> minsn_t __init__(self, m) -> minsn_t """ this = _ida_hexrays.new_minsn_t(*args) try: self.this.append(this) except: self.this = this def swap(self, *args): """ swap(self, m) """ return _ida_hexrays.minsn_t_swap(self, *args) def _print(self, *args): """ _print(self, shins_flags=0x04|0x02) """ return _ida_hexrays.minsn_t__print(self, *args) def dstr(self, *args): """ dstr(self) -> char const * """ return _ida_hexrays.minsn_t_dstr(self, *args) def setaddr(self, *args): """ setaddr(self, new_ea) """ return _ida_hexrays.minsn_t_setaddr(self, *args) def optimize_solo(self, *args): """ optimize_solo(self, optflags=0) -> int """ return _ida_hexrays.minsn_t_optimize_solo(self, *args) def optimize_subtree(self, *args): """ optimize_subtree(self, blk, top, parent, converted_call, optflags=0x0002) -> int """ return _ida_hexrays.minsn_t_optimize_subtree(self, *args) def for_all_ops(self, *args): """ for_all_ops(self, mv) -> int """ return _ida_hexrays.minsn_t_for_all_ops(self, *args) def for_all_insns(self, *args): """ for_all_insns(self, mv) -> int """ return _ida_hexrays.minsn_t_for_all_insns(self, *args) def _make_nop(self, *args): """ _make_nop(self) """ return _ida_hexrays.minsn_t__make_nop(self, *args) def equal_insns(self, *args): """ equal_insns(self, m, eqflags) -> bool """ return _ida_hexrays.minsn_t_equal_insns(self, *args) def __lt__(self, *args): """ __lt__(self, ri) -> bool """ return _ida_hexrays.minsn_t___lt__(self, *args) def lexcompare(self, *args): """ lexcompare(self, ri) -> int """ return _ida_hexrays.minsn_t_lexcompare(self, *args) def is_noret_call(self, *args): """ is_noret_call(self, ignore_noret_icall=False) -> bool """ return _ida_hexrays.minsn_t_is_noret_call(self, *args) def is_unknown_call(self, *args): """ is_unknown_call(self) -> bool """ return _ida_hexrays.minsn_t_is_unknown_call(self, *args) def is_helper(self, *args): """ is_helper(self, name) -> bool """ return _ida_hexrays.minsn_t_is_helper(self, *args) def find_call(self, *args): """ find_call(self, with_helpers=False) -> minsn_t """ return _ida_hexrays.minsn_t_find_call(self, *args) def contains_call(self, *args): """ contains_call(self, with_helpers=False) -> bool """ return _ida_hexrays.minsn_t_contains_call(self, *args) def has_side_effects(self, *args): """ has_side_effects(self, include_ldx_and_divs=False) -> bool """ return _ida_hexrays.minsn_t_has_side_effects(self, *args) def get_role(self, *args): """ get_role(self) -> funcrole_t """ return _ida_hexrays.minsn_t_get_role(self, *args) def is_memcpy(self, *args): """ is_memcpy(self) -> bool """ return _ida_hexrays.minsn_t_is_memcpy(self, *args) def is_memset(self, *args): """ is_memset(self) -> bool """ return _ida_hexrays.minsn_t_is_memset(self, *args) def is_alloca(self, *args): """ is_alloca(self) -> bool """ return _ida_hexrays.minsn_t_is_alloca(self, *args) def is_bswap(self, *args): """ is_bswap(self) -> bool """ return _ida_hexrays.minsn_t_is_bswap(self, *args) def is_readflags(self, *args): """ is_readflags(self) -> bool """ return _ida_hexrays.minsn_t_is_readflags(self, *args) def contains_opcode(self, *args): """ contains_opcode(self, mcode) -> bool """ return _ida_hexrays.minsn_t_contains_opcode(self, *args) def find_opcode(self, *args): """ find_opcode(self, mcode) -> minsn_t find_opcode(self, mcode) -> minsn_t """ return _ida_hexrays.minsn_t_find_opcode(self, *args) def find_ins_op(self, *args): """ find_ins_op(self, other, op=m_nop) -> minsn_t """ return _ida_hexrays.minsn_t_find_ins_op(self, *args) def find_num_op(self, *args): """ find_num_op(self, other) -> mop_t """ return _ida_hexrays.minsn_t_find_num_op(self, *args) def is_mov(self, *args): """ is_mov(self) -> bool """ return _ida_hexrays.minsn_t_is_mov(self, *args) def is_like_move(self, *args): """ is_like_move(self) -> bool """ return _ida_hexrays.minsn_t_is_like_move(self, *args) def modifes_d(self, *args): """ modifes_d(self) -> bool """ return _ida_hexrays.minsn_t_modifes_d(self, *args) def modifies_pair_mop(self, *args): """ modifies_pair_mop(self) -> bool """ return _ida_hexrays.minsn_t_modifies_pair_mop(self, *args) def is_between(self, *args): """ is_between(self, m1, m2) -> bool """ return _ida_hexrays.minsn_t_is_between(self, *args) def is_after(self, *args): """ is_after(self, m) -> bool """ return _ida_hexrays.minsn_t_is_after(self, *args) def may_use_aliased_memory(self, *args): """ may_use_aliased_memory(self) -> bool """ return _ida_hexrays.minsn_t_may_use_aliased_memory(self, *args) def _register(self, *args): """ _register(self) """ return _ida_hexrays.minsn_t__register(self, *args) def _deregister(self, *args): """ _deregister(self) """ return _ida_hexrays.minsn_t__deregister(self, *args) def __dbg_get_meminfo(self, *args): """ __dbg_get_meminfo(self) -> qstring """ return _ida_hexrays.minsn_t___dbg_get_meminfo(self, *args) def __dbg_get_registered_kind(self, *args): """ __dbg_get_registered_kind(self) -> int """ return _ida_hexrays.minsn_t___dbg_get_registered_kind(self, *args) def _obj_id(self, *args): """ _obj_id(self) -> PyObject * """ return _ida_hexrays.minsn_t__obj_id(self, *args) obj_id = property(_obj_id) def _ensure_cond(self, ok, cond_str): if not ok: raise Exception("Condition \"%s\" not verified" % cond_str) return True def _ensure_no_obj(self, o, attr, attr_is_acquired): if attr_is_acquired and o is not None: raise Exception("%s already owns attribute \"%s\" (%s); cannot be modified" % (self, attr, o)) return True def _acquire_ownership(self, v, acquire): if acquire and (v is not None) and not isinstance(v, (int, long)): if not v.thisown: raise Exception("%s is already owned, and cannot be reused" % v) v.thisown = False dereg = getattr(v, "_deregister", None) if dereg: dereg() return True def _maybe_disown_and_deregister(self): if self.thisown: self.thisown = False self._deregister() def _own_and_register(self): assert(not self.thisown) self.thisown = True self._register() def replace_by(self, o): assert(isinstance(o, (cexpr_t, cinsn_t))) o._maybe_disown_and_deregister() self._replace_by(o) def _meminfo(self): cpp = self.__dbg_get_meminfo() rkind = self.__dbg_get_registered_kind() rkind_str = [ "(not owned)", "cfuncptr_t", "cinsn_t", "cexpr_t", "cblock_t", "mbl_array_t", "mop_t", "minsn_t", "optinsn_t", "optblock_t", "valrng_t"][rkind] return "%s [thisown=%s, owned by IDAPython as=%s]" % ( cpp, self.thisown, rkind_str) meminfo = property(_meminfo) __swig_destroy__ = _ida_hexrays.delete_minsn_t __del__ = lambda self : None; minsn_t_swigregister = _ida_hexrays.minsn_t_swigregister minsn_t_swigregister(minsn_t) IPROP_OPTIONAL = _ida_hexrays.IPROP_OPTIONAL """ optional instruction """ IPROP_PERSIST = _ida_hexrays.IPROP_PERSIST """ persistent insn; they are not destroyed """ IPROP_WILDMATCH = _ida_hexrays.IPROP_WILDMATCH """ match multiple insns """ IPROP_CLNPOP = _ida_hexrays.IPROP_CLNPOP """ (e.g. "pop ecx" is often used for that) the purpose of the instruction is to clean stack """ IPROP_FPINSN = _ida_hexrays.IPROP_FPINSN """ floating point insn """ IPROP_FARCALL = _ida_hexrays.IPROP_FARCALL """ call of a far function using push cs/call sequence """ IPROP_TAILCALL = _ida_hexrays.IPROP_TAILCALL """ tail call """ IPROP_ASSERT = _ida_hexrays.IPROP_ASSERT """ assertion: usually mov #val, op. assertions are used to help the optimizer. assertions are ignored when generating ctree """ IPROP_SPLIT = _ida_hexrays.IPROP_SPLIT """ the instruction has been split: """ IPROP_SPLIT1 = _ida_hexrays.IPROP_SPLIT1 """ into 1 byte """ IPROP_SPLIT2 = _ida_hexrays.IPROP_SPLIT2 """ into 2 bytes """ IPROP_SPLIT4 = _ida_hexrays.IPROP_SPLIT4 """ into 4 bytes """ IPROP_SPLIT8 = _ida_hexrays.IPROP_SPLIT8 """ into 8 bytes """ IPROP_COMBINED = _ida_hexrays.IPROP_COMBINED """ insn has been modified because of a partial reference """ IPROP_EXTSTX = _ida_hexrays.IPROP_EXTSTX """ this is m_ext propagated into m_stx """ IPROP_IGNLOWSRC = _ida_hexrays.IPROP_IGNLOWSRC """ low part of the instruction source operand has been created artificially (this bit is used only for 'and x, 80...') """ IPROP_INV_JX = _ida_hexrays.IPROP_INV_JX """ inverted conditional jump """ IPROP_WAS_NORET = _ida_hexrays.IPROP_WAS_NORET """ was noret icall """ IPROP_MULTI_MOV = _ida_hexrays.IPROP_MULTI_MOV """ (example: STM on ARM may transfer multiple registers) the minsn was generated as part of insn that moves multiple registersbits that can be set by plugins: """ IPROP_DONT_PROP = _ida_hexrays.IPROP_DONT_PROP """ may not propagate """ IPROP_DONT_COMB = _ida_hexrays.IPROP_DONT_COMB """ may not combine this instruction with others """ OPTI_ADDREXPRS = _ida_hexrays.OPTI_ADDREXPRS """ optimize all address expressions (&x+N; &x-&y) """ OPTI_MINSTKREF = _ida_hexrays.OPTI_MINSTKREF """ may update minstkref """ OPTI_COMBINSNS = _ida_hexrays.OPTI_COMBINSNS """ may combine insns (only for optimize_insn) """ OPTI_NO_LDXOPT = _ida_hexrays.OPTI_NO_LDXOPT """ do not optimize low/high(ldx) """ EQ_IGNSIZE = _ida_hexrays.EQ_IGNSIZE """ ignore operand sizes """ EQ_IGNCODE = _ida_hexrays.EQ_IGNCODE """ ignore instruction opcodes """ EQ_CMPDEST = _ida_hexrays.EQ_CMPDEST """ compare instruction destinations """ EQ_OPTINSN = _ida_hexrays.EQ_OPTINSN """ optimize mop_d operands """ def getf_reginsn(*args): """ getf_reginsn(ins) -> minsn_t Skip assertions forward. @param ins (C++: const minsn_t *) """ return _ida_hexrays.getf_reginsn(*args) def getb_reginsn(*args): """ getb_reginsn(ins) -> minsn_t Skip assertions backward. @param ins (C++: const minsn_t *) """ return _ida_hexrays.getb_reginsn(*args) BLT_NONE = _ida_hexrays.BLT_NONE BLT_STOP = _ida_hexrays.BLT_STOP BLT_0WAY = _ida_hexrays.BLT_0WAY BLT_1WAY = _ida_hexrays.BLT_1WAY BLT_2WAY = _ida_hexrays.BLT_2WAY BLT_NWAY = _ida_hexrays.BLT_NWAY BLT_XTRN = _ida_hexrays.BLT_XTRN class mblock_t(object): """ Proxy of C++ mblock_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr nextb = _swig_property(_ida_hexrays.mblock_t_nextb_get, _ida_hexrays.mblock_t_nextb_set) prevb = _swig_property(_ida_hexrays.mblock_t_prevb_get, _ida_hexrays.mblock_t_prevb_set) flags = _swig_property(_ida_hexrays.mblock_t_flags_get, _ida_hexrays.mblock_t_flags_set) start = _swig_property(_ida_hexrays.mblock_t_start_get, _ida_hexrays.mblock_t_start_set) end = _swig_property(_ida_hexrays.mblock_t_end_get, _ida_hexrays.mblock_t_end_set) head = _swig_property(_ida_hexrays.mblock_t_head_get, _ida_hexrays.mblock_t_head_set) tail = _swig_property(_ida_hexrays.mblock_t_tail_get, _ida_hexrays.mblock_t_tail_set) mba = _swig_property(_ida_hexrays.mblock_t_mba_get, _ida_hexrays.mblock_t_mba_set) serial = _swig_property(_ida_hexrays.mblock_t_serial_get, _ida_hexrays.mblock_t_serial_set) type = _swig_property(_ida_hexrays.mblock_t_type_get, _ida_hexrays.mblock_t_type_set) dead_at_start = _swig_property(_ida_hexrays.mblock_t_dead_at_start_get, _ida_hexrays.mblock_t_dead_at_start_set) mustbuse = _swig_property(_ida_hexrays.mblock_t_mustbuse_get, _ida_hexrays.mblock_t_mustbuse_set) maybuse = _swig_property(_ida_hexrays.mblock_t_maybuse_get, _ida_hexrays.mblock_t_maybuse_set) mustbdef = _swig_property(_ida_hexrays.mblock_t_mustbdef_get, _ida_hexrays.mblock_t_mustbdef_set) maybdef = _swig_property(_ida_hexrays.mblock_t_maybdef_get, _ida_hexrays.mblock_t_maybdef_set) dnu = _swig_property(_ida_hexrays.mblock_t_dnu_get, _ida_hexrays.mblock_t_dnu_set) maxbsp = _swig_property(_ida_hexrays.mblock_t_maxbsp_get, _ida_hexrays.mblock_t_maxbsp_set) minbstkref = _swig_property(_ida_hexrays.mblock_t_minbstkref_get, _ida_hexrays.mblock_t_minbstkref_set) minbargref = _swig_property(_ida_hexrays.mblock_t_minbargref_get, _ida_hexrays.mblock_t_minbargref_set) predset = _swig_property(_ida_hexrays.mblock_t_predset_get, _ida_hexrays.mblock_t_predset_set) succset = _swig_property(_ida_hexrays.mblock_t_succset_get, _ida_hexrays.mblock_t_succset_set) def mark_lists_dirty(self, *args): """ mark_lists_dirty(self) """ return _ida_hexrays.mblock_t_mark_lists_dirty(self, *args) def request_propagation(self, *args): """ request_propagation(self) """ return _ida_hexrays.mblock_t_request_propagation(self, *args) def needs_propagation(self, *args): """ needs_propagation(self) -> bool """ return _ida_hexrays.mblock_t_needs_propagation(self, *args) def request_demote64(self, *args): """ request_demote64(self) """ return _ida_hexrays.mblock_t_request_demote64(self, *args) def lists_dirty(self, *args): """ lists_dirty(self) -> bool """ return _ida_hexrays.mblock_t_lists_dirty(self, *args) def lists_ready(self, *args): """ lists_ready(self) -> bool """ return _ida_hexrays.mblock_t_lists_ready(self, *args) def make_lists_ready(self, *args): """ make_lists_ready(self) -> int """ return _ida_hexrays.mblock_t_make_lists_ready(self, *args) def npred(self, *args): """ npred(self) -> int """ return _ida_hexrays.mblock_t_npred(self, *args) def nsucc(self, *args): """ nsucc(self) -> int """ return _ida_hexrays.mblock_t_nsucc(self, *args) def pred(self, *args): """ pred(self, n) -> int """ return _ida_hexrays.mblock_t_pred(self, *args) def succ(self, *args): """ succ(self, n) -> int """ return _ida_hexrays.mblock_t_succ(self, *args) __swig_destroy__ = _ida_hexrays.delete_mblock_t __del__ = lambda self : None; def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.mblock_t_empty(self, *args) def _print(self, *args): """ _print(self, vp) """ return _ida_hexrays.mblock_t__print(self, *args) def dump(self, *args): """ dump(self) """ return _ida_hexrays.mblock_t_dump(self, *args) def dump_block(self, *args): """ dump_block(self, title) """ return _ida_hexrays.mblock_t_dump_block(self, *args) def insert_into_block(self, *args): """ insert_into_block(self, nm, om) -> minsn_t """ val = _ida_hexrays.mblock_t_insert_into_block(self, *args) mn = args[0] mn._maybe_disown_and_deregister() return val def remove_from_block(self, *args): """ remove_from_block(self, m) -> minsn_t """ mn = args[0] val = _ida_hexrays.mblock_t_remove_from_block(self, *args) if mn: mn._own_and_register() return val def for_all_insns(self, *args): """ for_all_insns(self, mv) -> int """ return _ida_hexrays.mblock_t_for_all_insns(self, *args) def for_all_ops(self, *args): """ for_all_ops(self, mv) -> int """ return _ida_hexrays.mblock_t_for_all_ops(self, *args) def for_all_uses(self, *args): """ for_all_uses(self, list, i1, i2, mmv) -> int """ return _ida_hexrays.mblock_t_for_all_uses(self, *args) def optimize_insn(self, *args): """ optimize_insn(self, m, optflags=0x0002|0x0004) -> int """ return _ida_hexrays.mblock_t_optimize_insn(self, *args) def optimize_block(self, *args): """ optimize_block(self) -> int """ return _ida_hexrays.mblock_t_optimize_block(self, *args) def build_lists(self, *args): """ build_lists(self, kill_deads) -> int """ return _ida_hexrays.mblock_t_build_lists(self, *args) def optimize_useless_jump(self, *args): """ optimize_useless_jump(self) -> int """ return _ida_hexrays.mblock_t_optimize_useless_jump(self, *args) def append_use_list(self, *args): """ append_use_list(self, list, op, maymust, mask=bitrange_t(0, USHRT_MAX)) """ return _ida_hexrays.mblock_t_append_use_list(self, *args) def append_def_list(self, *args): """ append_def_list(self, list, op, maymust) """ return _ida_hexrays.mblock_t_append_def_list(self, *args) def build_use_list(self, *args): """ build_use_list(self, ins, maymust) -> mlist_t """ return _ida_hexrays.mblock_t_build_use_list(self, *args) def build_def_list(self, *args): """ build_def_list(self, ins, maymust) -> mlist_t """ return _ida_hexrays.mblock_t_build_def_list(self, *args) def is_used(self, *args): """ is_used(self, list, i1, i2, maymust=MAY_ACCESS) -> bool """ return _ida_hexrays.mblock_t_is_used(self, *args) def find_first_use(self, *args): """ find_first_use(self, list, i1, i2, maymust=MAY_ACCESS) -> minsn_t """ return _ida_hexrays.mblock_t_find_first_use(self, *args) def is_redefined(self, *args): """ is_redefined(self, list, i1, i2, maymust=MAY_ACCESS) -> bool """ return _ida_hexrays.mblock_t_is_redefined(self, *args) def find_redefinition(self, *args): """ find_redefinition(self, list, i1, i2, maymust=MAY_ACCESS) -> minsn_t """ return _ida_hexrays.mblock_t_find_redefinition(self, *args) def is_rhs_redefined(self, *args): """ is_rhs_redefined(self, ins, i1, i2) -> bool """ return _ida_hexrays.mblock_t_is_rhs_redefined(self, *args) def find_access(self, *args): """ find_access(self, op, parent, mend, fdflags) -> minsn_t """ return _ida_hexrays.mblock_t_find_access(self, *args) def find_def(self, *args): """ find_def(self, op, p_i1, i2, fdflags) -> minsn_t """ return _ida_hexrays.mblock_t_find_def(self, *args) def find_use(self, *args): """ find_use(self, op, p_i1, i2, fdflags) -> minsn_t """ return _ida_hexrays.mblock_t_find_use(self, *args) def get_valranges(self, *args): """ get_valranges(self, res, vivl, vrflags) -> bool get_valranges(self, res, vivl, m, vrflags) -> bool """ return _ida_hexrays.mblock_t_get_valranges(self, *args) def make_nop(self, *args): """ make_nop(self, m) """ return _ida_hexrays.mblock_t_make_nop(self, *args) def get_reginsn_qty(self, *args): """ get_reginsn_qty(self) -> size_t """ return _ida_hexrays.mblock_t_get_reginsn_qty(self, *args) def is_call_block(self, *args): """ is_call_block(self) -> bool """ return _ida_hexrays.mblock_t_is_call_block(self, *args) def is_unknown_call(self, *args): """ is_unknown_call(self) -> bool """ return _ida_hexrays.mblock_t_is_unknown_call(self, *args) def is_nway(self, *args): """ is_nway(self) -> bool """ return _ida_hexrays.mblock_t_is_nway(self, *args) def is_branch(self, *args): """ is_branch(self) -> bool """ return _ida_hexrays.mblock_t_is_branch(self, *args) def is_simple_goto_block(self, *args): """ is_simple_goto_block(self) -> bool """ return _ida_hexrays.mblock_t_is_simple_goto_block(self, *args) def is_simple_jcnd_block(self, *args): """ is_simple_jcnd_block(self) -> bool """ return _ida_hexrays.mblock_t_is_simple_jcnd_block(self, *args) def preds(self): """ Iterates the list of predecessor blocks """ for ser in self.predset: yield self.mba.get_mblock(ser) def succs(self): """ Iterates the list of successor blocks """ for ser in self.succset: yield self.mba.get_mblock(ser) mblock_t_swigregister = _ida_hexrays.mblock_t_swigregister mblock_t_swigregister(mblock_t) MBL_PRIV = _ida_hexrays.MBL_PRIV """ the specified are accepted (used in patterns) private block - no instructions except """ MBL_NONFAKE = _ida_hexrays.MBL_NONFAKE """ regular block """ MBL_FAKE = _ida_hexrays.MBL_FAKE """ fake block (after a tail call) """ MBL_GOTO = _ida_hexrays.MBL_GOTO """ this block is a goto target """ MBL_TCAL = _ida_hexrays.MBL_TCAL """ aritifical call block for tail calls """ MBL_PUSH = _ida_hexrays.MBL_PUSH """ needs "convert push/pop instructions" """ MBL_DMT64 = _ida_hexrays.MBL_DMT64 """ needs "demote 64bits" """ MBL_COMB = _ida_hexrays.MBL_COMB """ needs "combine" pass """ MBL_PROP = _ida_hexrays.MBL_PROP """ needs 'propagation' pass """ MBL_DEAD = _ida_hexrays.MBL_DEAD """ needs "eliminate deads" pass """ MBL_LIST = _ida_hexrays.MBL_LIST """ use/def lists are ready (not dirty) """ MBL_INCONST = _ida_hexrays.MBL_INCONST """ inconsistent lists: we are building them """ MBL_CALL = _ida_hexrays.MBL_CALL """ call information has been built """ MBL_BACKPROP = _ida_hexrays.MBL_BACKPROP """ performed backprop_cc """ MBL_NORET = _ida_hexrays.MBL_NORET """ dead end block: doesn't return execution control """ MBL_DSLOT = _ida_hexrays.MBL_DSLOT """ block for delay slot """ MBL_VALRANGES = _ida_hexrays.MBL_VALRANGES """ should optimize using value ranges """ FD_BACKWARD = _ida_hexrays.FD_BACKWARD """ search direction """ FD_FORWARD = _ida_hexrays.FD_FORWARD """ search direction """ FD_USE = _ida_hexrays.FD_USE """ look for use """ FD_DEF = _ida_hexrays.FD_DEF """ look for definition """ FD_DIRTY = _ida_hexrays.FD_DIRTY """ by function calls and indirect memory access ignore possible implicit definitions """ VR_AT_START = _ida_hexrays.VR_AT_START """ at the block start (if M is NULL) get value ranges before the instruction or """ VR_AT_END = _ida_hexrays.VR_AT_END """ get value ranges after the instruction or at the block end, just after the last instruction (if M is NULL) """ VR_EXACT = _ida_hexrays.VR_EXACT """ valrng size will be >= vivl.size find exact match. if not set, the returned """ WARN_VARARG_REGS = _ida_hexrays.WARN_VARARG_REGS WARN_ILL_PURGED = _ida_hexrays.WARN_ILL_PURGED WARN_ILL_FUNCTYPE = _ida_hexrays.WARN_ILL_FUNCTYPE WARN_VARARG_TCAL = _ida_hexrays.WARN_VARARG_TCAL WARN_VARARG_NOSTK = _ida_hexrays.WARN_VARARG_NOSTK WARN_VARARG_MANY = _ida_hexrays.WARN_VARARG_MANY WARN_ADDR_OUTARGS = _ida_hexrays.WARN_ADDR_OUTARGS WARN_DEP_UNK_CALLS = _ida_hexrays.WARN_DEP_UNK_CALLS WARN_ILL_ELLIPSIS = _ida_hexrays.WARN_ILL_ELLIPSIS WARN_GUESSED_TYPE = _ida_hexrays.WARN_GUESSED_TYPE WARN_EXP_LINVAR = _ida_hexrays.WARN_EXP_LINVAR WARN_WIDEN_CHAINS = _ida_hexrays.WARN_WIDEN_CHAINS WARN_BAD_PURGED = _ida_hexrays.WARN_BAD_PURGED WARN_CBUILD_LOOPS = _ida_hexrays.WARN_CBUILD_LOOPS WARN_NO_SAVE_REST = _ida_hexrays.WARN_NO_SAVE_REST WARN_ODD_INPUT_REG = _ida_hexrays.WARN_ODD_INPUT_REG WARN_ODD_ADDR_USE = _ida_hexrays.WARN_ODD_ADDR_USE WARN_MUST_RET_FP = _ida_hexrays.WARN_MUST_RET_FP WARN_ILL_FPU_STACK = _ida_hexrays.WARN_ILL_FPU_STACK WARN_SELFREF_PROP = _ida_hexrays.WARN_SELFREF_PROP WARN_WOULD_OVERLAP = _ida_hexrays.WARN_WOULD_OVERLAP WARN_ARRAY_INARG = _ida_hexrays.WARN_ARRAY_INARG WARN_MAX_ARGS = _ida_hexrays.WARN_MAX_ARGS WARN_BAD_FIELD_TYPE = _ida_hexrays.WARN_BAD_FIELD_TYPE WARN_WRITE_CONST = _ida_hexrays.WARN_WRITE_CONST WARN_BAD_RETVAR = _ida_hexrays.WARN_BAD_RETVAR WARN_FRAG_LVAR = _ida_hexrays.WARN_FRAG_LVAR WARN_HUGE_STKOFF = _ida_hexrays.WARN_HUGE_STKOFF WARN_UNINITED_REG = _ida_hexrays.WARN_UNINITED_REG WARN_FIXED_MACRO = _ida_hexrays.WARN_FIXED_MACRO WARN_WRONG_VA_OFF = _ida_hexrays.WARN_WRONG_VA_OFF WARN_CR_NOFIELD = _ida_hexrays.WARN_CR_NOFIELD WARN_CR_BADOFF = _ida_hexrays.WARN_CR_BADOFF WARN_BAD_STROFF = _ida_hexrays.WARN_BAD_STROFF WARN_BAD_VARSIZE = _ida_hexrays.WARN_BAD_VARSIZE WARN_UNSUPP_REG = _ida_hexrays.WARN_UNSUPP_REG WARN_UNALIGNED_ARG = _ida_hexrays.WARN_UNALIGNED_ARG WARN_BAD_STD_TYPE = _ida_hexrays.WARN_BAD_STD_TYPE WARN_BAD_CALL_SP = _ida_hexrays.WARN_BAD_CALL_SP WARN_MISSED_SWITCH = _ida_hexrays.WARN_MISSED_SWITCH WARN_BAD_SP = _ida_hexrays.WARN_BAD_SP WARN_BAD_STKPNT = _ida_hexrays.WARN_BAD_STKPNT WARN_UNDEF_LVAR = _ida_hexrays.WARN_UNDEF_LVAR WARN_JUMPOUT = _ida_hexrays.WARN_JUMPOUT WARN_BAD_VALRNG = _ida_hexrays.WARN_BAD_VALRNG WARN_BAD_SHADOW = _ida_hexrays.WARN_BAD_SHADOW WARN_MAX = _ida_hexrays.WARN_MAX class hexwarn_t(object): """ Proxy of C++ hexwarn_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ea = _swig_property(_ida_hexrays.hexwarn_t_ea_get, _ida_hexrays.hexwarn_t_ea_set) id = _swig_property(_ida_hexrays.hexwarn_t_id_get, _ida_hexrays.hexwarn_t_id_set) text = _swig_property(_ida_hexrays.hexwarn_t_text_get, _ida_hexrays.hexwarn_t_text_set) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.hexwarn_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.hexwarn_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.hexwarn_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.hexwarn_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.hexwarn_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.hexwarn_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.hexwarn_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> hexwarn_t """ this = _ida_hexrays.new_hexwarn_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_hexwarn_t __del__ = lambda self : None; hexwarn_t_swigregister = _ida_hexrays.hexwarn_t_swigregister hexwarn_t_swigregister(hexwarn_t) MMAT_ZERO = _ida_hexrays.MMAT_ZERO MMAT_GENERATED = _ida_hexrays.MMAT_GENERATED MMAT_PREOPTIMIZED = _ida_hexrays.MMAT_PREOPTIMIZED MMAT_LOCOPT = _ida_hexrays.MMAT_LOCOPT MMAT_CALLS = _ida_hexrays.MMAT_CALLS MMAT_GLBOPT1 = _ida_hexrays.MMAT_GLBOPT1 MMAT_GLBOPT2 = _ida_hexrays.MMAT_GLBOPT2 MMAT_GLBOPT3 = _ida_hexrays.MMAT_GLBOPT3 MMAT_LVARS = _ida_hexrays.MMAT_LVARS MMIDX_GLBLOW = _ida_hexrays.MMIDX_GLBLOW MMIDX_LVARS = _ida_hexrays.MMIDX_LVARS MMIDX_RETADDR = _ida_hexrays.MMIDX_RETADDR MMIDX_SHADOW = _ida_hexrays.MMIDX_SHADOW MMIDX_ARGS = _ida_hexrays.MMIDX_ARGS MMIDX_GLBHIGH = _ida_hexrays.MMIDX_GLBHIGH class mba_ranges_t(object): """ Proxy of C++ mba_ranges_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr pfn = _swig_property(_ida_hexrays.mba_ranges_t_pfn_get, _ida_hexrays.mba_ranges_t_pfn_set) ranges = _swig_property(_ida_hexrays.mba_ranges_t_ranges_get, _ida_hexrays.mba_ranges_t_ranges_set) def __init__(self, *args): """ __init__(self, _pfn=None) -> mba_ranges_t __init__(self, r) -> mba_ranges_t """ this = _ida_hexrays.new_mba_ranges_t(*args) try: self.this.append(this) except: self.this = this def start(self, *args): """ start(self) -> ea_t """ return _ida_hexrays.mba_ranges_t_start(self, *args) def empty(self, *args): """ empty(self) -> bool """ return _ida_hexrays.mba_ranges_t_empty(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.mba_ranges_t_clear(self, *args) def is_snippet(self, *args): """ is_snippet(self) -> bool """ return _ida_hexrays.mba_ranges_t_is_snippet(self, *args) def is_fragmented(self, *args): """ is_fragmented(self) -> bool """ return _ida_hexrays.mba_ranges_t_is_fragmented(self, *args) __swig_destroy__ = _ida_hexrays.delete_mba_ranges_t __del__ = lambda self : None; mba_ranges_t_swigregister = _ida_hexrays.mba_ranges_t_swigregister mba_ranges_t_swigregister(mba_ranges_t) class mba_range_iterator_t(object): """ Proxy of C++ mba_range_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr rii = _swig_property(_ida_hexrays.mba_range_iterator_t_rii_get, _ida_hexrays.mba_range_iterator_t_rii_set) fii = _swig_property(_ida_hexrays.mba_range_iterator_t_fii_get, _ida_hexrays.mba_range_iterator_t_fii_set) def is_snippet(self, *args): """ is_snippet(self) -> bool """ return _ida_hexrays.mba_range_iterator_t_is_snippet(self, *args) def set(self, *args): """ set(self, mbr) -> bool """ return _ida_hexrays.mba_range_iterator_t_set(self, *args) def next(self, *args): """ next(self) -> bool """ return _ida_hexrays.mba_range_iterator_t_next(self, *args) def chunk(self, *args): """ chunk(self) -> range_t """ return _ida_hexrays.mba_range_iterator_t_chunk(self, *args) def __init__(self, *args): """ __init__(self) -> mba_range_iterator_t """ this = _ida_hexrays.new_mba_range_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_mba_range_iterator_t __del__ = lambda self : None; mba_range_iterator_t_swigregister = _ida_hexrays.mba_range_iterator_t_swigregister mba_range_iterator_t_swigregister(mba_range_iterator_t) class mbl_array_t(object): """ Proxy of C++ mbl_array_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def precise_defeas(self, *args): """ precise_defeas(self) -> bool """ return _ida_hexrays.mbl_array_t_precise_defeas(self, *args) def optimized(self, *args): """ optimized(self) -> bool """ return _ida_hexrays.mbl_array_t_optimized(self, *args) def short_display(self, *args): """ short_display(self) -> bool """ return _ida_hexrays.mbl_array_t_short_display(self, *args) def show_reduction(self, *args): """ show_reduction(self) -> bool """ return _ida_hexrays.mbl_array_t_show_reduction(self, *args) def graph_insns(self, *args): """ graph_insns(self) -> bool """ return _ida_hexrays.mbl_array_t_graph_insns(self, *args) def loaded_gdl(self, *args): """ loaded_gdl(self) -> bool """ return _ida_hexrays.mbl_array_t_loaded_gdl(self, *args) def should_beautify(self, *args): """ should_beautify(self) -> bool """ return _ida_hexrays.mbl_array_t_should_beautify(self, *args) def rtype_refined(self, *args): """ rtype_refined(self) -> bool """ return _ida_hexrays.mbl_array_t_rtype_refined(self, *args) def may_refine_rettype(self, *args): """ may_refine_rettype(self) -> bool """ return _ida_hexrays.mbl_array_t_may_refine_rettype(self, *args) def use_wingraph32(self, *args): """ use_wingraph32(self) -> bool """ return _ida_hexrays.mbl_array_t_use_wingraph32(self, *args) def display_numaddrs(self, *args): """ display_numaddrs(self) -> bool """ return _ida_hexrays.mbl_array_t_display_numaddrs(self, *args) def display_valnums(self, *args): """ display_valnums(self) -> bool """ return _ida_hexrays.mbl_array_t_display_valnums(self, *args) def is_pattern(self, *args): """ is_pattern(self) -> bool """ return _ida_hexrays.mbl_array_t_is_pattern(self, *args) def is_thunk(self, *args): """ is_thunk(self) -> bool """ return _ida_hexrays.mbl_array_t_is_thunk(self, *args) def saverest_done(self, *args): """ saverest_done(self) -> bool """ return _ida_hexrays.mbl_array_t_saverest_done(self, *args) def callinfo_built(self, *args): """ callinfo_built(self) -> bool """ return _ida_hexrays.mbl_array_t_callinfo_built(self, *args) def has_overvars(self, *args): """ has_overvars(self) -> bool """ return _ida_hexrays.mbl_array_t_has_overvars(self, *args) def really_alloc(self, *args): """ really_alloc(self) -> bool """ return _ida_hexrays.mbl_array_t_really_alloc(self, *args) def lvars_allocated(self, *args): """ lvars_allocated(self) -> bool """ return _ida_hexrays.mbl_array_t_lvars_allocated(self, *args) def chain_varnums_ok(self, *args): """ chain_varnums_ok(self) -> bool """ return _ida_hexrays.mbl_array_t_chain_varnums_ok(self, *args) def returns_fpval(self, *args): """ returns_fpval(self) -> bool """ return _ida_hexrays.mbl_array_t_returns_fpval(self, *args) def has_passregs(self, *args): """ has_passregs(self) -> bool """ return _ida_hexrays.mbl_array_t_has_passregs(self, *args) def generated_asserts(self, *args): """ generated_asserts(self) -> bool """ return _ida_hexrays.mbl_array_t_generated_asserts(self, *args) def propagated_asserts(self, *args): """ propagated_asserts(self) -> bool """ return _ida_hexrays.mbl_array_t_propagated_asserts(self, *args) def deleted_pairs(self, *args): """ deleted_pairs(self) -> bool """ return _ida_hexrays.mbl_array_t_deleted_pairs(self, *args) def common_stkvars_stkargs(self, *args): """ common_stkvars_stkargs(self) -> bool """ return _ida_hexrays.mbl_array_t_common_stkvars_stkargs(self, *args) def lvar_names_ok(self, *args): """ lvar_names_ok(self) -> bool """ return _ida_hexrays.mbl_array_t_lvar_names_ok(self, *args) def lvars_renamed(self, *args): """ lvars_renamed(self) -> bool """ return _ida_hexrays.mbl_array_t_lvars_renamed(self, *args) def has_over_chains(self, *args): """ has_over_chains(self) -> bool """ return _ida_hexrays.mbl_array_t_has_over_chains(self, *args) def valranges_done(self, *args): """ valranges_done(self) -> bool """ return _ida_hexrays.mbl_array_t_valranges_done(self, *args) def argidx_ok(self, *args): """ argidx_ok(self) -> bool """ return _ida_hexrays.mbl_array_t_argidx_ok(self, *args) def is_ctr(self, *args): """ is_ctr(self) -> bool """ return _ida_hexrays.mbl_array_t_is_ctr(self, *args) def is_dtr(self, *args): """ is_dtr(self) -> bool """ return _ida_hexrays.mbl_array_t_is_dtr(self, *args) def is_cdtr(self, *args): """ is_cdtr(self) -> bool """ return _ida_hexrays.mbl_array_t_is_cdtr(self, *args) def get_mba_flags(self, *args): """ get_mba_flags(self) -> int """ return _ida_hexrays.mbl_array_t_get_mba_flags(self, *args) def get_mba_flags2(self, *args): """ get_mba_flags2(self) -> int """ return _ida_hexrays.mbl_array_t_get_mba_flags2(self, *args) def set_mba_flags(self, *args): """ set_mba_flags(self, f) """ return _ida_hexrays.mbl_array_t_set_mba_flags(self, *args) def clr_mba_flags(self, *args): """ clr_mba_flags(self, f) """ return _ida_hexrays.mbl_array_t_clr_mba_flags(self, *args) def set_mba_flags2(self, *args): """ set_mba_flags2(self, f) """ return _ida_hexrays.mbl_array_t_set_mba_flags2(self, *args) def clr_mba_flags2(self, *args): """ clr_mba_flags2(self, f) """ return _ida_hexrays.mbl_array_t_clr_mba_flags2(self, *args) def clr_cdtr(self, *args): """ clr_cdtr(self) """ return _ida_hexrays.mbl_array_t_clr_cdtr(self, *args) def calc_shins_flags(self, *args): """ calc_shins_flags(self) -> int """ return _ida_hexrays.mbl_array_t_calc_shins_flags(self, *args) def stkoff_vd2ida(self, *args): """ stkoff_vd2ida(self, off) -> sval_t """ return _ida_hexrays.mbl_array_t_stkoff_vd2ida(self, *args) def stkoff_ida2vd(self, *args): """ stkoff_ida2vd(self, off) -> sval_t """ return _ida_hexrays.mbl_array_t_stkoff_ida2vd(self, *args) def argbase(self, *args): """ argbase(self) -> sval_t """ return _ida_hexrays.mbl_array_t_argbase(self, *args) def idaloc2vd(self, *args): """ idaloc2vd(self, loc, width) -> vdloc_t """ return _ida_hexrays.mbl_array_t_idaloc2vd(self, *args) def vd2idaloc(self, *args): """ vd2idaloc(self, loc, width, spd) -> argloc_t vd2idaloc(self, loc, width) -> argloc_t """ return _ida_hexrays.mbl_array_t_vd2idaloc(self, *args) def is_stkarg(self, *args): """ is_stkarg(self, v) -> bool """ return _ida_hexrays.mbl_array_t_is_stkarg(self, *args) def get_ida_argloc(self, *args): """ get_ida_argloc(self, v) -> argloc_t """ return _ida_hexrays.mbl_array_t_get_ida_argloc(self, *args) mbr = _swig_property(_ida_hexrays.mbl_array_t_mbr_get, _ida_hexrays.mbl_array_t_mbr_set) entry_ea = _swig_property(_ida_hexrays.mbl_array_t_entry_ea_get, _ida_hexrays.mbl_array_t_entry_ea_set) last_prolog_ea = _swig_property(_ida_hexrays.mbl_array_t_last_prolog_ea_get, _ida_hexrays.mbl_array_t_last_prolog_ea_set) first_epilog_ea = _swig_property(_ida_hexrays.mbl_array_t_first_epilog_ea_get, _ida_hexrays.mbl_array_t_first_epilog_ea_set) qty = _swig_property(_ida_hexrays.mbl_array_t_qty_get, _ida_hexrays.mbl_array_t_qty_set) npurged = _swig_property(_ida_hexrays.mbl_array_t_npurged_get, _ida_hexrays.mbl_array_t_npurged_set) cc = _swig_property(_ida_hexrays.mbl_array_t_cc_get, _ida_hexrays.mbl_array_t_cc_set) tmpstk_size = _swig_property(_ida_hexrays.mbl_array_t_tmpstk_size_get, _ida_hexrays.mbl_array_t_tmpstk_size_set) frsize = _swig_property(_ida_hexrays.mbl_array_t_frsize_get, _ida_hexrays.mbl_array_t_frsize_set) frregs = _swig_property(_ida_hexrays.mbl_array_t_frregs_get, _ida_hexrays.mbl_array_t_frregs_set) fpd = _swig_property(_ida_hexrays.mbl_array_t_fpd_get, _ida_hexrays.mbl_array_t_fpd_set) pfn_flags = _swig_property(_ida_hexrays.mbl_array_t_pfn_flags_get, _ida_hexrays.mbl_array_t_pfn_flags_set) retsize = _swig_property(_ida_hexrays.mbl_array_t_retsize_get, _ida_hexrays.mbl_array_t_retsize_set) shadow_args = _swig_property(_ida_hexrays.mbl_array_t_shadow_args_get, _ida_hexrays.mbl_array_t_shadow_args_set) fullsize = _swig_property(_ida_hexrays.mbl_array_t_fullsize_get, _ida_hexrays.mbl_array_t_fullsize_set) stacksize = _swig_property(_ida_hexrays.mbl_array_t_stacksize_get, _ida_hexrays.mbl_array_t_stacksize_set) inargoff = _swig_property(_ida_hexrays.mbl_array_t_inargoff_get, _ida_hexrays.mbl_array_t_inargoff_set) minstkref = _swig_property(_ida_hexrays.mbl_array_t_minstkref_get, _ida_hexrays.mbl_array_t_minstkref_set) minstkref_ea = _swig_property(_ida_hexrays.mbl_array_t_minstkref_ea_get, _ida_hexrays.mbl_array_t_minstkref_ea_set) minargref = _swig_property(_ida_hexrays.mbl_array_t_minargref_get, _ida_hexrays.mbl_array_t_minargref_set) spd_adjust = _swig_property(_ida_hexrays.mbl_array_t_spd_adjust_get, _ida_hexrays.mbl_array_t_spd_adjust_set) aliased_vars = _swig_property(_ida_hexrays.mbl_array_t_aliased_vars_get, _ida_hexrays.mbl_array_t_aliased_vars_set) aliased_args = _swig_property(_ida_hexrays.mbl_array_t_aliased_args_get, _ida_hexrays.mbl_array_t_aliased_args_set) gotoff_stkvars = _swig_property(_ida_hexrays.mbl_array_t_gotoff_stkvars_get, _ida_hexrays.mbl_array_t_gotoff_stkvars_set) restricted_memory = _swig_property(_ida_hexrays.mbl_array_t_restricted_memory_get, _ida_hexrays.mbl_array_t_restricted_memory_set) aliased_memory = _swig_property(_ida_hexrays.mbl_array_t_aliased_memory_get, _ida_hexrays.mbl_array_t_aliased_memory_set) nodel_memory = _swig_property(_ida_hexrays.mbl_array_t_nodel_memory_get, _ida_hexrays.mbl_array_t_nodel_memory_set) consumed_argregs = _swig_property(_ida_hexrays.mbl_array_t_consumed_argregs_get, _ida_hexrays.mbl_array_t_consumed_argregs_set) maturity = _swig_property(_ida_hexrays.mbl_array_t_maturity_get, _ida_hexrays.mbl_array_t_maturity_set) reqmat = _swig_property(_ida_hexrays.mbl_array_t_reqmat_get, _ida_hexrays.mbl_array_t_reqmat_set) final_type = _swig_property(_ida_hexrays.mbl_array_t_final_type_get, _ida_hexrays.mbl_array_t_final_type_set) idb_type = _swig_property(_ida_hexrays.mbl_array_t_idb_type_get, _ida_hexrays.mbl_array_t_idb_type_set) idb_spoiled = _swig_property(_ida_hexrays.mbl_array_t_idb_spoiled_get, _ida_hexrays.mbl_array_t_idb_spoiled_set) spoiled_list = _swig_property(_ida_hexrays.mbl_array_t_spoiled_list_get, _ida_hexrays.mbl_array_t_spoiled_list_set) fti_flags = _swig_property(_ida_hexrays.mbl_array_t_fti_flags_get, _ida_hexrays.mbl_array_t_fti_flags_set) idb_node = _swig_property(_ida_hexrays.mbl_array_t_idb_node_get, _ida_hexrays.mbl_array_t_idb_node_set) label = _swig_property(_ida_hexrays.mbl_array_t_label_get, _ida_hexrays.mbl_array_t_label_set) vars = _swig_property(_ida_hexrays.mbl_array_t_vars_get, _ida_hexrays.mbl_array_t_vars_set) argidx = _swig_property(_ida_hexrays.mbl_array_t_argidx_get, _ida_hexrays.mbl_array_t_argidx_set) retvaridx = _swig_property(_ida_hexrays.mbl_array_t_retvaridx_get, _ida_hexrays.mbl_array_t_retvaridx_set) error_ea = _swig_property(_ida_hexrays.mbl_array_t_error_ea_get, _ida_hexrays.mbl_array_t_error_ea_set) error_strarg = _swig_property(_ida_hexrays.mbl_array_t_error_strarg_get, _ida_hexrays.mbl_array_t_error_strarg_set) blocks = _swig_property(_ida_hexrays.mbl_array_t_blocks_get, _ida_hexrays.mbl_array_t_blocks_set) natural = _swig_property(_ida_hexrays.mbl_array_t_natural_get, _ida_hexrays.mbl_array_t_natural_set) std_ivls = _swig_property(_ida_hexrays.mbl_array_t_std_ivls_get, _ida_hexrays.mbl_array_t_std_ivls_set) notes = _swig_property(_ida_hexrays.mbl_array_t_notes_get, _ida_hexrays.mbl_array_t_notes_set) occurred_warns = _swig_property(_ida_hexrays.mbl_array_t_occurred_warns_get, _ida_hexrays.mbl_array_t_occurred_warns_set) def write_to_const_detected(self, *args): """ write_to_const_detected(self) -> bool """ return _ida_hexrays.mbl_array_t_write_to_const_detected(self, *args) def bad_call_sp_detected(self, *args): """ bad_call_sp_detected(self) -> bool """ return _ida_hexrays.mbl_array_t_bad_call_sp_detected(self, *args) def regargs_is_not_aligned(self, *args): """ regargs_is_not_aligned(self) -> bool """ return _ida_hexrays.mbl_array_t_regargs_is_not_aligned(self, *args) def has_bad_sp(self, *args): """ has_bad_sp(self) -> bool """ return _ida_hexrays.mbl_array_t_has_bad_sp(self, *args) __swig_destroy__ = _ida_hexrays.delete_mbl_array_t __del__ = lambda self : None; def term(self, *args): """ term(self) """ return _ida_hexrays.mbl_array_t_term(self, *args) def get_curfunc(self, *args): """ get_curfunc(self) -> func_t * """ return _ida_hexrays.mbl_array_t_get_curfunc(self, *args) def use_frame(self, *args): """ use_frame(self) -> bool """ return _ida_hexrays.mbl_array_t_use_frame(self, *args) def is_snippet(self, *args): """ is_snippet(self) -> bool """ return _ida_hexrays.mbl_array_t_is_snippet(self, *args) def optimize_local(self, *args): """ optimize_local(self, locopt_bits) -> int """ return _ida_hexrays.mbl_array_t_optimize_local(self, *args) def build_graph(self, *args): """ build_graph(self) -> merror_t """ return _ida_hexrays.mbl_array_t_build_graph(self, *args) def get_graph(self, *args): """ get_graph(self) -> mbl_graph_t """ return _ida_hexrays.mbl_array_t_get_graph(self, *args) def analyze_calls(self, *args): """ analyze_calls(self, acflags) -> int """ return _ida_hexrays.mbl_array_t_analyze_calls(self, *args) def optimize_global(self, *args): """ optimize_global(self) -> merror_t """ return _ida_hexrays.mbl_array_t_optimize_global(self, *args) def alloc_lvars(self, *args): """ alloc_lvars(self) """ return _ida_hexrays.mbl_array_t_alloc_lvars(self, *args) def dump(self, *args): """ dump(self) """ return _ida_hexrays.mbl_array_t_dump(self, *args) def dump_mba(self, *args): """ dump_mba(self, _verify, title) """ return _ida_hexrays.mbl_array_t_dump_mba(self, *args) def _print(self, *args): """ _print(self, vp) """ return _ida_hexrays.mbl_array_t__print(self, *args) def verify(self, *args): """ verify(self, always) """ return _ida_hexrays.mbl_array_t_verify(self, *args) def mark_chains_dirty(self, *args): """ mark_chains_dirty(self) """ return _ida_hexrays.mbl_array_t_mark_chains_dirty(self, *args) def get_mblock(self, *args): """ get_mblock(self, n) -> mblock_t get_mblock(self, n) -> mblock_t """ return _ida_hexrays.mbl_array_t_get_mblock(self, *args) def insert_block(self, *args): """ insert_block(self, bblk) -> mblock_t """ return _ida_hexrays.mbl_array_t_insert_block(self, *args) def remove_block(self, *args): """ remove_block(self, blk) -> bool """ return _ida_hexrays.mbl_array_t_remove_block(self, *args) def copy_block(self, *args): """ copy_block(self, blk, new_serial, cpblk_flags=3) -> mblock_t """ return _ida_hexrays.mbl_array_t_copy_block(self, *args) def remove_empty_blocks(self, *args): """ remove_empty_blocks(self) -> bool """ return _ida_hexrays.mbl_array_t_remove_empty_blocks(self, *args) def combine_blocks(self, *args): """ combine_blocks(self) -> bool """ return _ida_hexrays.mbl_array_t_combine_blocks(self, *args) def for_all_ops(self, *args): """ for_all_ops(self, mv) -> int """ return _ida_hexrays.mbl_array_t_for_all_ops(self, *args) def for_all_insns(self, *args): """ for_all_insns(self, mv) -> int """ return _ida_hexrays.mbl_array_t_for_all_insns(self, *args) def for_all_topinsns(self, *args): """ for_all_topinsns(self, mv) -> int """ return _ida_hexrays.mbl_array_t_for_all_topinsns(self, *args) def find_mop(self, *args): """ find_mop(self, ctx, ea, is_dest, list) -> mop_t """ return _ida_hexrays.mbl_array_t_find_mop(self, *args) def arg(self, *args): """ arg(self, n) -> lvar_t arg(self, n) -> lvar_t """ return _ida_hexrays.mbl_array_t_arg(self, *args) def get_std_region(self, *args): """ get_std_region(self, idx) -> ivl_t """ return _ida_hexrays.mbl_array_t_get_std_region(self, *args) def get_lvars_region(self, *args): """ get_lvars_region(self) -> ivl_t """ return _ida_hexrays.mbl_array_t_get_lvars_region(self, *args) def get_shadow_region(self, *args): """ get_shadow_region(self) -> ivl_t """ return _ida_hexrays.mbl_array_t_get_shadow_region(self, *args) def get_args_region(self, *args): """ get_args_region(self) -> ivl_t """ return _ida_hexrays.mbl_array_t_get_args_region(self, *args) def get_stack_region(self, *args): """ get_stack_region(self) -> ivl_t """ return _ida_hexrays.mbl_array_t_get_stack_region(self, *args) def serialize(self, *args): """ serialize(self) """ return _ida_hexrays.mbl_array_t_serialize(self, *args) def deserialize(*args): """ deserialize(bytes, nbytes) -> mbl_array_t """ return _ida_hexrays.mbl_array_t_deserialize(*args) deserialize = staticmethod(deserialize) def _register(self, *args): """ _register(self) """ return _ida_hexrays.mbl_array_t__register(self, *args) def _deregister(self, *args): """ _deregister(self) """ return _ida_hexrays.mbl_array_t__deregister(self, *args) mbl_array_t_swigregister = _ida_hexrays.mbl_array_t_swigregister mbl_array_t_swigregister(mbl_array_t) MBA_PRCDEFS = _ida_hexrays.MBA_PRCDEFS """ use precise defeas for chain-allocated lvars """ MBA_NOFUNC = _ida_hexrays.MBA_NOFUNC """ function is not present, addresses might be wrong """ MBA_PATTERN = _ida_hexrays.MBA_PATTERN """ microcode pattern, callinfo is present """ MBA_LOADED = _ida_hexrays.MBA_LOADED """ loaded gdl, no instructions (debugging) """ MBA_RETFP = _ida_hexrays.MBA_RETFP """ function returns floating point value """ MBA_SPLINFO = _ida_hexrays.MBA_SPLINFO """ (final_type ? idb_spoiled : spoiled_regs) is valid """ MBA_PASSREGS = _ida_hexrays.MBA_PASSREGS """ has 'mcallinfo_t::pass_regs' """ MBA_THUNK = _ida_hexrays.MBA_THUNK """ thunk function """ MBA_CMNSTK = _ida_hexrays.MBA_CMNSTK """ stkvars+stkargs should be considered as one area """ MBA_PREOPT = _ida_hexrays.MBA_PREOPT """ preoptimization stage complete """ MBA_CMBBLK = _ida_hexrays.MBA_CMBBLK """ request to combine blocks """ MBA_ASRTOK = _ida_hexrays.MBA_ASRTOK """ assertions have been generated """ MBA_CALLS = _ida_hexrays.MBA_CALLS """ callinfo has been built """ MBA_ASRPROP = _ida_hexrays.MBA_ASRPROP """ assertion have been propagated """ MBA_SAVRST = _ida_hexrays.MBA_SAVRST """ save-restore analysis has been performed """ MBA_RETREF = _ida_hexrays.MBA_RETREF """ return type has been refined """ MBA_GLBOPT = _ida_hexrays.MBA_GLBOPT """ microcode has been optimized globally """ MBA_OVERVAR = _ida_hexrays.MBA_OVERVAR """ an overlapped variable has been detected """ MBA_LVARS0 = _ida_hexrays.MBA_LVARS0 """ lvar pre-allocation has been performed """ MBA_LVARS1 = _ida_hexrays.MBA_LVARS1 """ lvar real allocation has been performed """ MBA_DELPAIRS = _ida_hexrays.MBA_DELPAIRS """ pairs have been deleted once """ MBA_CHVARS = _ida_hexrays.MBA_CHVARS """ can verify chain varnums """ MBA_SHORT = _ida_hexrays.MBA_SHORT """ use short display """ MBA_COLGDL = _ida_hexrays.MBA_COLGDL """ display graph after each reduction """ MBA_INSGDL = _ida_hexrays.MBA_INSGDL """ display instruction in graphs """ MBA_NICE = _ida_hexrays.MBA_NICE """ apply transformations to c code """ MBA_REFINE = _ida_hexrays.MBA_REFINE """ may refine return value size """ MBA_RESERVED = _ida_hexrays.MBA_RESERVED MBA_WINGR32 = _ida_hexrays.MBA_WINGR32 """ use wingraph32 """ MBA_NUMADDR = _ida_hexrays.MBA_NUMADDR """ display definition addresses for numbers """ MBA_VALNUM = _ida_hexrays.MBA_VALNUM """ display value numbers """ MBA_INITIAL_FLAGS = _ida_hexrays.MBA_INITIAL_FLAGS MBA2_LVARNAMES_OK = _ida_hexrays.MBA2_LVARNAMES_OK MBA2_LVARS_RENAMED = _ida_hexrays.MBA2_LVARS_RENAMED MBA2_OVER_CHAINS = _ida_hexrays.MBA2_OVER_CHAINS MBA2_VALRNG_DONE = _ida_hexrays.MBA2_VALRNG_DONE MBA2_IS_CTR = _ida_hexrays.MBA2_IS_CTR MBA2_IS_DTR = _ida_hexrays.MBA2_IS_DTR MBA2_ARGIDX_OK = _ida_hexrays.MBA2_ARGIDX_OK MBA2_NO_DUP_CALLS = _ida_hexrays.MBA2_NO_DUP_CALLS MBA2_NO_DUP_LVARS = _ida_hexrays.MBA2_NO_DUP_LVARS MBA2_INITIAL_FLAGS = _ida_hexrays.MBA2_INITIAL_FLAGS MBA2_ALL_FLAGS = _ida_hexrays.MBA2_ALL_FLAGS NALT_VD = _ida_hexrays.NALT_VD """ this index is not used by ida """ LOCOPT_ALL = _ida_hexrays.LOCOPT_ALL """ is not set, only dirty blocks will be optimized redo optimization for all blocks. if this bit """ LOCOPT_REFINE = _ida_hexrays.LOCOPT_REFINE """ refine return type, ok to fail """ LOCOPT_REFINE2 = _ida_hexrays.LOCOPT_REFINE2 """ refine return type, try harder """ ACFL_LOCOPT = _ida_hexrays.ACFL_LOCOPT """ perform local propagation (requires ACFL_BLKOPT) """ ACFL_BLKOPT = _ida_hexrays.ACFL_BLKOPT """ perform interblock transformations """ ACFL_GLBPROP = _ida_hexrays.ACFL_GLBPROP """ perform global propagation """ ACFL_GLBDEL = _ida_hexrays.ACFL_GLBDEL """ perform dead code eliminition """ ACFL_GUESS = _ida_hexrays.ACFL_GUESS """ may guess calling conventions """ CPBLK_FAST = _ida_hexrays.CPBLK_FAST """ do not update minbstkref and minbargref """ CPBLK_MINREF = _ida_hexrays.CPBLK_MINREF """ update minbstkref and minbargref """ CPBLK_OPTJMP = _ida_hexrays.CPBLK_OPTJMP """ if it becomes useless del the jump insn at the end of the block """ def mbl_array_t_deserialize(*args): """ mbl_array_t_deserialize(bytes, nbytes) -> mbl_array_t """ return _ida_hexrays.mbl_array_t_deserialize(*args) class chain_keeper_t(object): """ Proxy of C++ chain_keeper_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, _gc) -> chain_keeper_t """ this = _ida_hexrays.new_chain_keeper_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_chain_keeper_t __del__ = lambda self : None; def front(self, *args): """ front(self) -> block_chains_t """ return _ida_hexrays.chain_keeper_t_front(self, *args) def back(self, *args): """ back(self) -> block_chains_t """ return _ida_hexrays.chain_keeper_t_back(self, *args) def for_all_chains(self, *args): """ for_all_chains(self, cv, gca) -> int """ return _ida_hexrays.chain_keeper_t_for_all_chains(self, *args) chain_keeper_t_swigregister = _ida_hexrays.chain_keeper_t_swigregister chain_keeper_t_swigregister(chain_keeper_t) GC_REGS_AND_STKVARS = _ida_hexrays.GC_REGS_AND_STKVARS GC_ASR = _ida_hexrays.GC_ASR GC_XDSU = _ida_hexrays.GC_XDSU GC_END = _ida_hexrays.GC_END GC_DIRTY_ALL = _ida_hexrays.GC_DIRTY_ALL class mbl_graph_t(simple_graph_t): """ Proxy of C++ mbl_graph_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr def is_ud_chain_dirty(self, *args): """ is_ud_chain_dirty(self, gctype) -> bool """ return _ida_hexrays.mbl_graph_t_is_ud_chain_dirty(self, *args) def is_du_chain_dirty(self, *args): """ is_du_chain_dirty(self, gctype) -> bool """ return _ida_hexrays.mbl_graph_t_is_du_chain_dirty(self, *args) def get_chain_stamp(self, *args): """ get_chain_stamp(self) -> int """ return _ida_hexrays.mbl_graph_t_get_chain_stamp(self, *args) def get_ud(self, *args): """ get_ud(self, gctype) -> graph_chains_t """ return _ida_hexrays.mbl_graph_t_get_ud(self, *args) def get_du(self, *args): """ get_du(self, gctype) -> graph_chains_t """ return _ida_hexrays.mbl_graph_t_get_du(self, *args) def is_redefined_globally(self, *args): """ is_redefined_globally(self, list, b1, b2, m1, m2, maymust=MAY_ACCESS) -> bool """ return _ida_hexrays.mbl_graph_t_is_redefined_globally(self, *args) def is_used_globally(self, *args): """ is_used_globally(self, list, b1, b2, m1, m2, maymust=MAY_ACCESS) -> bool """ return _ida_hexrays.mbl_graph_t_is_used_globally(self, *args) def get_mblock(self, *args): """ get_mblock(self, n) -> mblock_t """ return _ida_hexrays.mbl_graph_t_get_mblock(self, *args) mbl_graph_t_swigregister = _ida_hexrays.mbl_graph_t_swigregister mbl_graph_t_swigregister(mbl_graph_t) class codegen_t(object): """ Proxy of C++ codegen_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr mba = _swig_property(_ida_hexrays.codegen_t_mba_get, _ida_hexrays.codegen_t_mba_set) mb = _swig_property(_ida_hexrays.codegen_t_mb_get, _ida_hexrays.codegen_t_mb_set) insn = _swig_property(_ida_hexrays.codegen_t_insn_get, _ida_hexrays.codegen_t_insn_set) ignore_micro = _swig_property(_ida_hexrays.codegen_t_ignore_micro_get, _ida_hexrays.codegen_t_ignore_micro_set) def __init__(self, *args): """ __init__(self, m) -> codegen_t """ if self.__class__ == codegen_t: _self = None else: _self = self this = _ida_hexrays.new_codegen_t(_self, *args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_codegen_t __del__ = lambda self : None; def analyze_prolog(self, *args): """ analyze_prolog(self, fc, reachable) -> merror_t """ return _ida_hexrays.codegen_t_analyze_prolog(self, *args) def gen_micro(self, *args): """ gen_micro(self) -> merror_t """ return _ida_hexrays.codegen_t_gen_micro(self, *args) def load_operand(self, *args): """ load_operand(self, opnum) -> mreg_t """ return _ida_hexrays.codegen_t_load_operand(self, *args) def emit_micro_mvm(self, *args): """ emit_micro_mvm(self, code, dtype, l, r, d, offsize) -> minsn_t """ return _ida_hexrays.codegen_t_emit_micro_mvm(self, *args) def emit(self, *args): """ emit(self, code, width, l, r, d, offsize) -> minsn_t emit(self, code, l, r, d) -> minsn_t """ return _ida_hexrays.codegen_t_emit(self, *args) def __disown__(self): self.this.disown() _ida_hexrays.disown_codegen_t(self) return weakref_proxy(self) codegen_t_swigregister = _ida_hexrays.codegen_t_swigregister codegen_t_swigregister(codegen_t) def is_kreg(*args): """ is_kreg(r) -> bool Is a kernel register? @param r (C++: mreg_t) """ return _ida_hexrays.is_kreg(*args) def get_temp_regs(*args): """ get_temp_regs() -> mlist_t Get list of temporary registers. Tempregs are temporary registers that are used during code generation. They do not map to regular processor registers. They are used only to store temporary values during execution of one instruction. Tempregs may not be used to pass a value from one block to another. In other words, at the end of a block all tempregs must be dead. """ return _ida_hexrays.get_temp_regs(*args) def get_hexrays_version(*args): """ get_hexrays_version() -> char const * Get decompiler version. The returned string is of the form <major>.<minor>.<revision>.<build-date> @return: pointer to version string. For example: "2.0.0.140605" """ return _ida_hexrays.get_hexrays_version(*args) def checkout_hexrays_license(*args): """ checkout_hexrays_license(silent) -> bool Check out a floating decompiler license. This function will display a dialog box if the license is not available. For non-floating licenses this function is effectively no-op. It is not necessary to call this function before decompiling. If the license was not checked out, the decompiler will automatically do it. This function can be used to check out a license in advance and ensure that a license is available. @param silent: silently fail if the license can not be checked out. (C++: bool) @return: false if failed """ return _ida_hexrays.checkout_hexrays_license(*args) def open_pseudocode(*args): """ open_pseudocode(ea, new_window) -> vdui_t Open pseudocode window. The specified function is decompiled and the pseudocode window is opened. @param ea: function to decompile (C++: ea_t) @param new_window: 0:reuse existing window; 1:open new window; -1: reuse existing window if the current view is pseudocode (C++: int) @return: false if failed """ return _ida_hexrays.open_pseudocode(*args) def close_pseudocode(*args): """ close_pseudocode(f) -> bool Close pseudocode window. @param f: pointer to window (C++: TWidget *) @return: false if failed """ return _ida_hexrays.close_pseudocode(*args) VDRUN_NEWFILE = _ida_hexrays.VDRUN_NEWFILE """ Create a new file or overwrite existing file. """ VDRUN_APPEND = _ida_hexrays.VDRUN_APPEND """ Create a new file or append to existing file. """ VDRUN_ONLYNEW = _ida_hexrays.VDRUN_ONLYNEW """ Fail if output file already exists. """ VDRUN_SILENT = _ida_hexrays.VDRUN_SILENT """ Silent decompilation. """ VDRUN_SENDIDB = _ida_hexrays.VDRUN_SENDIDB """ Send problematic databases to hex-rays.com. """ VDRUN_MAYSTOP = _ida_hexrays.VDRUN_MAYSTOP """ the user can cancel decompilation """ VDRUN_CMDLINE = _ida_hexrays.VDRUN_CMDLINE """ called from ida's command line """ VDRUN_STATS = _ida_hexrays.VDRUN_STATS """ print statistics into vd_stats.txt """ VDRUN_LUMINA = _ida_hexrays.VDRUN_LUMINA """ use lumina server """ def decompile_many(*args): """ decompile_many(outfile, funcaddrs, flags) -> bool Batch decompilation. Decompile all or the specified functions @param outfile: name of the output file (C++: const char *) @param funcaddrs: list of functions to decompile. If NULL or empty, then decompile all nonlib functions (C++: eavec_t *) @param flags: Batch decompilation bits (C++: int) @return: true if no internal error occurred and the user has not cancelled decompilation """ return _ida_hexrays.decompile_many(*args) class hexrays_failure_t(object): """ Proxy of C++ hexrays_failure_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr code = _swig_property(_ida_hexrays.hexrays_failure_t_code_get, _ida_hexrays.hexrays_failure_t_code_set) errea = _swig_property(_ida_hexrays.hexrays_failure_t_errea_get, _ida_hexrays.hexrays_failure_t_errea_set) str = _swig_property(_ida_hexrays.hexrays_failure_t_str_get, _ida_hexrays.hexrays_failure_t_str_set) def __init__(self, *args): """ __init__(self) -> hexrays_failure_t __init__(self, c, ea, buf=None) -> hexrays_failure_t __init__(self, c, ea, buf) -> hexrays_failure_t """ this = _ida_hexrays.new_hexrays_failure_t(*args) try: self.this.append(this) except: self.this = this def desc(self, *args): """ desc(self) -> qstring """ return _ida_hexrays.hexrays_failure_t_desc(self, *args) __swig_destroy__ = _ida_hexrays.delete_hexrays_failure_t __del__ = lambda self : None; hexrays_failure_t_swigregister = _ida_hexrays.hexrays_failure_t_swigregister hexrays_failure_t_swigregister(hexrays_failure_t) class vd_failure_t(object): """ Proxy of C++ vd_failure_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr hf = _swig_property(_ida_hexrays.vd_failure_t_hf_get, _ida_hexrays.vd_failure_t_hf_set) def __init__(self, *args): """ __init__(self) -> vd_failure_t __init__(self, code, ea, buf=None) -> vd_failure_t __init__(self, code, ea, buf) -> vd_failure_t __init__(self, _hf) -> vd_failure_t """ this = _ida_hexrays.new_vd_failure_t(*args) try: self.this.append(this) except: self.this = this def desc(self, *args): """ desc(self) -> qstring """ return _ida_hexrays.vd_failure_t_desc(self, *args) __swig_destroy__ = _ida_hexrays.delete_vd_failure_t __del__ = lambda self : None; vd_failure_t_swigregister = _ida_hexrays.vd_failure_t_swigregister vd_failure_t_swigregister(vd_failure_t) class vd_interr_t(vd_failure_t): """ Proxy of C++ vd_interr_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, ea, buf) -> vd_interr_t """ this = _ida_hexrays.new_vd_interr_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_vd_interr_t __del__ = lambda self : None; vd_interr_t_swigregister = _ida_hexrays.vd_interr_t_swigregister vd_interr_t_swigregister(vd_interr_t) def send_database(*args): """ send_database(err, silent) Send the database to Hex-Rays. This function sends the current database to the Hex-Rays server. The database is sent in the compressed form over an encrypted (SSL) connection. @param err: failure description object. Empty hexrays_failure_t object can be used if error information is not available. (C++: const hexrays_failure_t &) @param silent: if false, a dialog box will be displayed before sending the database. (C++: bool) """ return _ida_hexrays.send_database(*args) class gco_info_t(object): """ Proxy of C++ gco_info_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr name = _swig_property(_ida_hexrays.gco_info_t_name_get, _ida_hexrays.gco_info_t_name_set) size = _swig_property(_ida_hexrays.gco_info_t_size_get, _ida_hexrays.gco_info_t_size_set) flags = _swig_property(_ida_hexrays.gco_info_t_flags_get, _ida_hexrays.gco_info_t_flags_set) def is_reg(self, *args): """ is_reg(self) -> bool """ return _ida_hexrays.gco_info_t_is_reg(self, *args) def is_use(self, *args): """ is_use(self) -> bool """ return _ida_hexrays.gco_info_t_is_use(self, *args) def is_def(self, *args): """ is_def(self) -> bool """ return _ida_hexrays.gco_info_t_is_def(self, *args) def append_to_list(self, *args): """ append_to_list(self, list, mba) -> bool """ return _ida_hexrays.gco_info_t_append_to_list(self, *args) def __init__(self, *args): """ __init__(self) -> gco_info_t """ this = _ida_hexrays.new_gco_info_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_gco_info_t __del__ = lambda self : None; gco_info_t_swigregister = _ida_hexrays.gco_info_t_swigregister gco_info_t_swigregister(gco_info_t) GCO_STK = _ida_hexrays.GCO_STK """ a stack variable """ GCO_REG = _ida_hexrays.GCO_REG """ is register? otherwise a stack variable """ GCO_USE = _ida_hexrays.GCO_USE """ is source operand? """ GCO_DEF = _ida_hexrays.GCO_DEF """ is destination operand? """ def get_current_operand(*args): """ get_current_operand(out) -> bool Get the instruction operand under the cursor. This function determines the operand that is under the cursor in the active disassembly listing. If the operand refers to a register or stack variable, it return true. @param out (C++: gco_info_t *) """ return _ida_hexrays.get_current_operand(*args) def remitem(*args): """ remitem(e) """ return _ida_hexrays.remitem(*args) cot_empty = _ida_hexrays.cot_empty cot_comma = _ida_hexrays.cot_comma cot_asg = _ida_hexrays.cot_asg cot_asgbor = _ida_hexrays.cot_asgbor cot_asgxor = _ida_hexrays.cot_asgxor cot_asgband = _ida_hexrays.cot_asgband cot_asgadd = _ida_hexrays.cot_asgadd cot_asgsub = _ida_hexrays.cot_asgsub cot_asgmul = _ida_hexrays.cot_asgmul cot_asgsshr = _ida_hexrays.cot_asgsshr cot_asgushr = _ida_hexrays.cot_asgushr cot_asgshl = _ida_hexrays.cot_asgshl cot_asgsdiv = _ida_hexrays.cot_asgsdiv cot_asgudiv = _ida_hexrays.cot_asgudiv cot_asgsmod = _ida_hexrays.cot_asgsmod cot_asgumod = _ida_hexrays.cot_asgumod cot_tern = _ida_hexrays.cot_tern cot_lor = _ida_hexrays.cot_lor cot_land = _ida_hexrays.cot_land cot_bor = _ida_hexrays.cot_bor cot_xor = _ida_hexrays.cot_xor cot_band = _ida_hexrays.cot_band cot_eq = _ida_hexrays.cot_eq cot_ne = _ida_hexrays.cot_ne cot_sge = _ida_hexrays.cot_sge cot_uge = _ida_hexrays.cot_uge cot_sle = _ida_hexrays.cot_sle cot_ule = _ida_hexrays.cot_ule cot_sgt = _ida_hexrays.cot_sgt cot_ugt = _ida_hexrays.cot_ugt cot_slt = _ida_hexrays.cot_slt cot_ult = _ida_hexrays.cot_ult cot_sshr = _ida_hexrays.cot_sshr cot_ushr = _ida_hexrays.cot_ushr cot_shl = _ida_hexrays.cot_shl cot_add = _ida_hexrays.cot_add cot_sub = _ida_hexrays.cot_sub cot_mul = _ida_hexrays.cot_mul cot_sdiv = _ida_hexrays.cot_sdiv cot_udiv = _ida_hexrays.cot_udiv cot_smod = _ida_hexrays.cot_smod cot_umod = _ida_hexrays.cot_umod cot_fadd = _ida_hexrays.cot_fadd cot_fsub = _ida_hexrays.cot_fsub cot_fmul = _ida_hexrays.cot_fmul cot_fdiv = _ida_hexrays.cot_fdiv cot_fneg = _ida_hexrays.cot_fneg cot_neg = _ida_hexrays.cot_neg cot_cast = _ida_hexrays.cot_cast cot_lnot = _ida_hexrays.cot_lnot cot_bnot = _ida_hexrays.cot_bnot cot_ptr = _ida_hexrays.cot_ptr cot_ref = _ida_hexrays.cot_ref cot_postinc = _ida_hexrays.cot_postinc cot_postdec = _ida_hexrays.cot_postdec cot_preinc = _ida_hexrays.cot_preinc cot_predec = _ida_hexrays.cot_predec cot_call = _ida_hexrays.cot_call cot_idx = _ida_hexrays.cot_idx cot_memref = _ida_hexrays.cot_memref cot_memptr = _ida_hexrays.cot_memptr cot_num = _ida_hexrays.cot_num cot_fnum = _ida_hexrays.cot_fnum cot_str = _ida_hexrays.cot_str cot_obj = _ida_hexrays.cot_obj cot_var = _ida_hexrays.cot_var cot_insn = _ida_hexrays.cot_insn cot_sizeof = _ida_hexrays.cot_sizeof cot_helper = _ida_hexrays.cot_helper cot_type = _ida_hexrays.cot_type cot_last = _ida_hexrays.cot_last cit_empty = _ida_hexrays.cit_empty cit_block = _ida_hexrays.cit_block cit_expr = _ida_hexrays.cit_expr cit_if = _ida_hexrays.cit_if cit_for = _ida_hexrays.cit_for cit_while = _ida_hexrays.cit_while cit_do = _ida_hexrays.cit_do cit_switch = _ida_hexrays.cit_switch cit_break = _ida_hexrays.cit_break cit_continue = _ida_hexrays.cit_continue cit_return = _ida_hexrays.cit_return cit_goto = _ida_hexrays.cit_goto cit_asm = _ida_hexrays.cit_asm cit_end = _ida_hexrays.cit_end class operator_info_t(object): """ Proxy of C++ operator_info_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr text = _swig_property(_ida_hexrays.operator_info_t_text_get, _ida_hexrays.operator_info_t_text_set) precedence = _swig_property(_ida_hexrays.operator_info_t_precedence_get, _ida_hexrays.operator_info_t_precedence_set) valency = _swig_property(_ida_hexrays.operator_info_t_valency_get, _ida_hexrays.operator_info_t_valency_set) fixtype = _swig_property(_ida_hexrays.operator_info_t_fixtype_get, _ida_hexrays.operator_info_t_fixtype_set) flags = _swig_property(_ida_hexrays.operator_info_t_flags_get, _ida_hexrays.operator_info_t_flags_set) def __init__(self, *args): """ __init__(self) -> operator_info_t """ this = _ida_hexrays.new_operator_info_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_operator_info_t __del__ = lambda self : None; operator_info_t_swigregister = _ida_hexrays.operator_info_t_swigregister operator_info_t_swigregister(operator_info_t) FX_NONE = cvar.FX_NONE FX_INFIX = cvar.FX_INFIX FX_PREFIX = cvar.FX_PREFIX FX_POSTFIX = cvar.FX_POSTFIX FX_TERNARY = cvar.FX_TERNARY COI_RL = cvar.COI_RL COI_LR = cvar.COI_LR COI_INT = cvar.COI_INT COI_FP = cvar.COI_FP COI_SH = cvar.COI_SH COI_SGN = cvar.COI_SGN COI_SBN = cvar.COI_SBN def negated_relation(*args): """ negated_relation(op) -> ctype_t Negate a comparison operator. For example, cot_sge becomes cot_slt. @param op (C++: ctype_t) """ return _ida_hexrays.negated_relation(*args) def swapped_relation(*args): """ swapped_relation(op) -> ctype_t Swap a comparison operator. For example, cot_sge becomes cot_sle. @param op (C++: ctype_t) """ return _ida_hexrays.swapped_relation(*args) def get_op_signness(*args): """ get_op_signness(op) -> type_sign_t Get operator sign. Meaningful for sign-dependent operators, like cot_sdiv. @param op (C++: ctype_t) """ return _ida_hexrays.get_op_signness(*args) def asgop(*args): """ asgop(cop) -> ctype_t Convert plain operator into assignment operator. For example, cot_add returns cot_asgadd. @param cop (C++: ctype_t) """ return _ida_hexrays.asgop(*args) def asgop_revert(*args): """ asgop_revert(cop) -> ctype_t Convert assignment operator into plain operator. For example, cot_asgadd returns cot_add @param cop (C++: ctype_t) @return: cot_empty is the input operator is not an assignment operator. """ return _ida_hexrays.asgop_revert(*args) def op_uses_x(*args): """ op_uses_x(op) -> bool Does operator use the 'x' field of 'cexpr_t' ? @param op (C++: ctype_t) """ return _ida_hexrays.op_uses_x(*args) def op_uses_y(*args): """ op_uses_y(op) -> bool Does operator use the 'y' field of 'cexpr_t' ? @param op (C++: ctype_t) """ return _ida_hexrays.op_uses_y(*args) def op_uses_z(*args): """ op_uses_z(op) -> bool Does operator use the 'z' field of 'cexpr_t' ? @param op (C++: ctype_t) """ return _ida_hexrays.op_uses_z(*args) def is_binary(*args): """ is_binary(op) -> bool Is binary operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_binary(*args) def is_unary(*args): """ is_unary(op) -> bool Is unary operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_unary(*args) def is_relational(*args): """ is_relational(op) -> bool Is comparison operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_relational(*args) def is_assignment(*args): """ is_assignment(op) -> bool Is assignment operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_assignment(*args) def accepts_udts(*args): """ accepts_udts(op) -> bool """ return _ida_hexrays.accepts_udts(*args) def is_prepost(*args): """ is_prepost(op) -> bool Is pre/post increment/decrement operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_prepost(*args) def is_commutative(*args): """ is_commutative(op) -> bool Is commutative operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_commutative(*args) def is_additive(*args): """ is_additive(op) -> bool Is additive operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_additive(*args) def is_multiplicative(*args): """ is_multiplicative(op) -> bool Is multiplicative operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_multiplicative(*args) def is_bitop(*args): """ is_bitop(op) -> bool Is bit related operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_bitop(*args) def is_logical(*args): """ is_logical(op) -> bool Is logical operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_logical(*args) def is_loop(*args): """ is_loop(op) -> bool Is loop statement code? @param op (C++: ctype_t) """ return _ida_hexrays.is_loop(*args) def is_break_consumer(*args): """ is_break_consumer(op) -> bool Does a break statement influence the specified statement code? @param op (C++: ctype_t) """ return _ida_hexrays.is_break_consumer(*args) def is_lvalue(*args): """ is_lvalue(op) -> bool Is Lvalue operator? @param op (C++: ctype_t) """ return _ida_hexrays.is_lvalue(*args) def accepts_small_udts(*args): """ accepts_small_udts(op) -> bool Is the operator allowed on small structure or union? @param op (C++: ctype_t) """ return _ida_hexrays.accepts_small_udts(*args) class cnumber_t(object): """ Proxy of C++ cnumber_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr _value = _swig_property(_ida_hexrays.cnumber_t__value_get, _ida_hexrays.cnumber_t__value_set) nf = _swig_property(_ida_hexrays.cnumber_t_nf_get, _ida_hexrays.cnumber_t_nf_set) def __init__(self, *args): """ __init__(self, _opnum=0) -> cnumber_t """ this = _ida_hexrays.new_cnumber_t(*args) try: self.this.append(this) except: self.this = this def _print(self, *args): """ _print(self, type, parent=None, nice_stroff=None) """ return _ida_hexrays.cnumber_t__print(self, *args) def value(self, *args): """ value(self, type) -> uint64 """ return _ida_hexrays.cnumber_t_value(self, *args) def assign(self, *args): """ assign(self, v, nbytes, sign) """ return _ida_hexrays.cnumber_t_assign(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cnumber_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cnumber_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cnumber_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cnumber_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cnumber_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cnumber_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cnumber_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_cnumber_t __del__ = lambda self : None; cnumber_t_swigregister = _ida_hexrays.cnumber_t_swigregister cnumber_t_swigregister(cnumber_t) class var_ref_t(object): """ Proxy of C++ var_ref_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr mba = _swig_property(_ida_hexrays.var_ref_t_mba_get, _ida_hexrays.var_ref_t_mba_set) idx = _swig_property(_ida_hexrays.var_ref_t_idx_get, _ida_hexrays.var_ref_t_idx_set) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.var_ref_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.var_ref_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.var_ref_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.var_ref_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.var_ref_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.var_ref_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.var_ref_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> var_ref_t """ this = _ida_hexrays.new_var_ref_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_var_ref_t __del__ = lambda self : None; var_ref_t_swigregister = _ida_hexrays.var_ref_t_swigregister var_ref_t_swigregister(var_ref_t) class ctree_visitor_t(object): """ Proxy of C++ ctree_visitor_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr cv_flags = _swig_property(_ida_hexrays.ctree_visitor_t_cv_flags_get, _ida_hexrays.ctree_visitor_t_cv_flags_set) def maintain_parents(self, *args): """ maintain_parents(self) -> bool """ return _ida_hexrays.ctree_visitor_t_maintain_parents(self, *args) def must_prune(self, *args): """ must_prune(self) -> bool """ return _ida_hexrays.ctree_visitor_t_must_prune(self, *args) def must_restart(self, *args): """ must_restart(self) -> bool """ return _ida_hexrays.ctree_visitor_t_must_restart(self, *args) def is_postorder(self, *args): """ is_postorder(self) -> bool """ return _ida_hexrays.ctree_visitor_t_is_postorder(self, *args) def only_insns(self, *args): """ only_insns(self) -> bool """ return _ida_hexrays.ctree_visitor_t_only_insns(self, *args) def prune_now(self, *args): """ prune_now(self) """ return _ida_hexrays.ctree_visitor_t_prune_now(self, *args) def clr_prune(self, *args): """ clr_prune(self) """ return _ida_hexrays.ctree_visitor_t_clr_prune(self, *args) def set_restart(self, *args): """ set_restart(self) """ return _ida_hexrays.ctree_visitor_t_set_restart(self, *args) def clr_restart(self, *args): """ clr_restart(self) """ return _ida_hexrays.ctree_visitor_t_clr_restart(self, *args) parents = _swig_property(_ida_hexrays.ctree_visitor_t_parents_get, _ida_hexrays.ctree_visitor_t_parents_set) def __init__(self, *args): """ __init__(self, _flags) -> ctree_visitor_t """ if self.__class__ == ctree_visitor_t: _self = None else: _self = self this = _ida_hexrays.new_ctree_visitor_t(_self, *args) try: self.this.append(this) except: self.this = this def apply_to(self, *args): """ apply_to(self, item, parent) -> int """ return _ida_hexrays.ctree_visitor_t_apply_to(self, *args) def apply_to_exprs(self, *args): """ apply_to_exprs(self, item, parent) -> int """ return _ida_hexrays.ctree_visitor_t_apply_to_exprs(self, *args) def parent_expr(self, *args): """ parent_expr(self) -> cexpr_t """ return _ida_hexrays.ctree_visitor_t_parent_expr(self, *args) def parent_insn(self, *args): """ parent_insn(self) -> cinsn_t """ return _ida_hexrays.ctree_visitor_t_parent_insn(self, *args) def visit_insn(self, *args): """ visit_insn(self, arg0) -> int """ return _ida_hexrays.ctree_visitor_t_visit_insn(self, *args) def visit_expr(self, *args): """ visit_expr(self, arg0) -> int """ return _ida_hexrays.ctree_visitor_t_visit_expr(self, *args) def leave_insn(self, *args): """ leave_insn(self, arg0) -> int """ return _ida_hexrays.ctree_visitor_t_leave_insn(self, *args) def leave_expr(self, *args): """ leave_expr(self, arg0) -> int """ return _ida_hexrays.ctree_visitor_t_leave_expr(self, *args) __swig_destroy__ = _ida_hexrays.delete_ctree_visitor_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_ctree_visitor_t(self) return weakref_proxy(self) ctree_visitor_t_swigregister = _ida_hexrays.ctree_visitor_t_swigregister ctree_visitor_t_swigregister(ctree_visitor_t) CV_FAST = _ida_hexrays.CV_FAST """ do not maintain parent information """ CV_PRUNE = _ida_hexrays.CV_PRUNE """ this bit is set by visit...() to prune the walk """ CV_PARENTS = _ida_hexrays.CV_PARENTS """ maintain parent information """ CV_POST = _ida_hexrays.CV_POST """ call the leave...() functions """ CV_RESTART = _ida_hexrays.CV_RESTART """ restart enumeration at the top expr (apply_to_exprs) """ CV_INSNS = _ida_hexrays.CV_INSNS """ visit only statements, prune all expressions do not use before the final ctree maturity because expressions may contain statements at intermediate stages (see cot_insn). Otherwise you risk missing statements embedded into expressions. """ class ctree_parentee_t(ctree_visitor_t): """ Proxy of C++ ctree_parentee_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, post=False) -> ctree_parentee_t """ if self.__class__ == ctree_parentee_t: _self = None else: _self = self this = _ida_hexrays.new_ctree_parentee_t(_self, *args) try: self.this.append(this) except: self.this = this def recalc_parent_types(self, *args): """ recalc_parent_types(self) -> bool """ return _ida_hexrays.ctree_parentee_t_recalc_parent_types(self, *args) __swig_destroy__ = _ida_hexrays.delete_ctree_parentee_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_ctree_parentee_t(self) return weakref_proxy(self) ctree_parentee_t_swigregister = _ida_hexrays.ctree_parentee_t_swigregister ctree_parentee_t_swigregister(ctree_parentee_t) class cfunc_parentee_t(ctree_parentee_t): """ Proxy of C++ cfunc_parentee_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr func = _swig_property(_ida_hexrays.cfunc_parentee_t_func_get, _ida_hexrays.cfunc_parentee_t_func_set) def __init__(self, *args): """ __init__(self, f, post=False) -> cfunc_parentee_t """ if self.__class__ == cfunc_parentee_t: _self = None else: _self = self this = _ida_hexrays.new_cfunc_parentee_t(_self, *args) try: self.this.append(this) except: self.this = this def calc_rvalue_type(self, *args): """ calc_rvalue_type(self, target, e) -> bool """ return _ida_hexrays.cfunc_parentee_t_calc_rvalue_type(self, *args) __swig_destroy__ = _ida_hexrays.delete_cfunc_parentee_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_cfunc_parentee_t(self) return weakref_proxy(self) cfunc_parentee_t_swigregister = _ida_hexrays.cfunc_parentee_t_swigregister cfunc_parentee_t_swigregister(cfunc_parentee_t) CMAT_ZERO = _ida_hexrays.CMAT_ZERO CMAT_BUILT = _ida_hexrays.CMAT_BUILT CMAT_TRANS1 = _ida_hexrays.CMAT_TRANS1 CMAT_NICE = _ida_hexrays.CMAT_NICE CMAT_TRANS2 = _ida_hexrays.CMAT_TRANS2 CMAT_CPA = _ida_hexrays.CMAT_CPA CMAT_TRANS3 = _ida_hexrays.CMAT_TRANS3 CMAT_CASTED = _ida_hexrays.CMAT_CASTED CMAT_FINAL = _ida_hexrays.CMAT_FINAL ITP_EMPTY = _ida_hexrays.ITP_EMPTY ITP_ARG1 = _ida_hexrays.ITP_ARG1 ITP_ARG64 = _ida_hexrays.ITP_ARG64 ITP_BRACE1 = _ida_hexrays.ITP_BRACE1 ITP_INNER_LAST = _ida_hexrays.ITP_INNER_LAST ITP_ASM = _ida_hexrays.ITP_ASM ITP_ELSE = _ida_hexrays.ITP_ELSE ITP_DO = _ida_hexrays.ITP_DO ITP_SEMI = _ida_hexrays.ITP_SEMI ITP_CURLY1 = _ida_hexrays.ITP_CURLY1 ITP_CURLY2 = _ida_hexrays.ITP_CURLY2 ITP_BRACE2 = _ida_hexrays.ITP_BRACE2 ITP_COLON = _ida_hexrays.ITP_COLON ITP_BLOCK1 = _ida_hexrays.ITP_BLOCK1 ITP_BLOCK2 = _ida_hexrays.ITP_BLOCK2 ITP_CASE = _ida_hexrays.ITP_CASE ITP_SIGN = _ida_hexrays.ITP_SIGN class treeloc_t(object): """ Proxy of C++ treeloc_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ea = _swig_property(_ida_hexrays.treeloc_t_ea_get, _ida_hexrays.treeloc_t_ea_set) itp = _swig_property(_ida_hexrays.treeloc_t_itp_get, _ida_hexrays.treeloc_t_itp_set) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.treeloc_t___lt__(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.treeloc_t___eq__(self, *args) def __init__(self, *args): """ __init__(self) -> treeloc_t """ this = _ida_hexrays.new_treeloc_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_treeloc_t __del__ = lambda self : None; treeloc_t_swigregister = _ida_hexrays.treeloc_t_swigregister treeloc_t_swigregister(treeloc_t) RETRIEVE_ONCE = _ida_hexrays.RETRIEVE_ONCE RETRIEVE_ALWAYS = _ida_hexrays.RETRIEVE_ALWAYS class citem_cmt_t(object): """ Proxy of C++ citem_cmt_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr used = _swig_property(_ida_hexrays.citem_cmt_t_used_get, _ida_hexrays.citem_cmt_t_used_set) def __init__(self, *args): """ __init__(self) -> citem_cmt_t __init__(self, s) -> citem_cmt_t """ this = _ida_hexrays.new_citem_cmt_t(*args) try: self.this.append(this) except: self.this = this def c_str(self, *args): """ c_str(self) -> char const * """ return _ida_hexrays.citem_cmt_t_c_str(self, *args) def __str__(self, *args): """ __str__(self) -> char const * """ return _ida_hexrays.citem_cmt_t___str__(self, *args) __swig_destroy__ = _ida_hexrays.delete_citem_cmt_t __del__ = lambda self : None; citem_cmt_t_swigregister = _ida_hexrays.citem_cmt_t_swigregister citem_cmt_t_swigregister(citem_cmt_t) class citem_locator_t(object): """ Proxy of C++ citem_locator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ea = _swig_property(_ida_hexrays.citem_locator_t_ea_get, _ida_hexrays.citem_locator_t_ea_set) op = _swig_property(_ida_hexrays.citem_locator_t_op_get, _ida_hexrays.citem_locator_t_op_set) def __init__(self, *args): """ __init__(self, _ea, _op) -> citem_locator_t __init__(self, i) -> citem_locator_t """ this = _ida_hexrays.new_citem_locator_t(*args) try: self.this.append(this) except: self.this = this def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.citem_locator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.citem_locator_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.citem_locator_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.citem_locator_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.citem_locator_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.citem_locator_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.citem_locator_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_citem_locator_t __del__ = lambda self : None; citem_locator_t_swigregister = _ida_hexrays.citem_locator_t_swigregister citem_locator_t_swigregister(citem_locator_t) class bit_bound_t(object): """ Proxy of C++ bit_bound_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr nbits = _swig_property(_ida_hexrays.bit_bound_t_nbits_get, _ida_hexrays.bit_bound_t_nbits_set) sbits = _swig_property(_ida_hexrays.bit_bound_t_sbits_get, _ida_hexrays.bit_bound_t_sbits_set) def __init__(self, *args): """ __init__(self, n=0, s=0) -> bit_bound_t """ this = _ida_hexrays.new_bit_bound_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_bit_bound_t __del__ = lambda self : None; bit_bound_t_swigregister = _ida_hexrays.bit_bound_t_swigregister bit_bound_t_swigregister(bit_bound_t) class citem_t(object): """ Proxy of C++ citem_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ea = _swig_property(_ida_hexrays.citem_t_ea_get, _ida_hexrays.citem_t_ea_set) label_num = _swig_property(_ida_hexrays.citem_t_label_num_get, _ida_hexrays.citem_t_label_num_set) index = _swig_property(_ida_hexrays.citem_t_index_get, _ida_hexrays.citem_t_index_set) def __init__(self, *args): """ __init__(self) -> citem_t __init__(self, o) -> citem_t """ this = _ida_hexrays.new_citem_t(*args) try: self.this.append(this) except: self.this = this def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.citem_t_swap(self, *args) def is_expr(self, *args): """ is_expr(self) -> bool """ return _ida_hexrays.citem_t_is_expr(self, *args) def contains_expr(self, *args): """ contains_expr(self, e) -> bool """ return _ida_hexrays.citem_t_contains_expr(self, *args) def contains_label(self, *args): """ contains_label(self) -> bool """ return _ida_hexrays.citem_t_contains_label(self, *args) def find_parent_of(self, *args): """ find_parent_of(self, sitem) -> citem_t find_parent_of(self, item) -> citem_t """ return _ida_hexrays.citem_t_find_parent_of(self, *args) def find_closest_addr(self, *args): """ find_closest_addr(self, _ea) -> citem_t """ return _ida_hexrays.citem_t_find_closest_addr(self, *args) def print1(self, *args): """ print1(self, func) """ return _ida_hexrays.citem_t_print1(self, *args) __swig_destroy__ = _ida_hexrays.delete_citem_t __del__ = lambda self : None; cinsn = _swig_property(_ida_hexrays.citem_t_cinsn_get) cexpr = _swig_property(_ida_hexrays.citem_t_cexpr_get) def _get_op(self, *args): """ _get_op(self) -> ctype_t """ return _ida_hexrays.citem_t__get_op(self, *args) def _set_op(self, *args): """ _set_op(self, v) """ return _ida_hexrays.citem_t__set_op(self, *args) def _ensure_no_op(self): if self.op not in [cot_empty, cit_empty]: raise Exception("%s has op %s; cannot be modified" % (self, self.op)) return True op = property( _get_op, lambda self, v: self._ensure_no_op() and self._set_op(v)) def __dbg_get_meminfo(self, *args): """ __dbg_get_meminfo(self) -> qstring """ return _ida_hexrays.citem_t___dbg_get_meminfo(self, *args) def __dbg_get_registered_kind(self, *args): """ __dbg_get_registered_kind(self) -> int """ return _ida_hexrays.citem_t___dbg_get_registered_kind(self, *args) def _obj_id(self, *args): """ _obj_id(self) -> PyObject * """ return _ida_hexrays.citem_t__obj_id(self, *args) obj_id = property(_obj_id) def _ensure_cond(self, ok, cond_str): if not ok: raise Exception("Condition \"%s\" not verified" % cond_str) return True def _ensure_no_obj(self, o, attr, attr_is_acquired): if attr_is_acquired and o is not None: raise Exception("%s already owns attribute \"%s\" (%s); cannot be modified" % (self, attr, o)) return True def _acquire_ownership(self, v, acquire): if acquire and (v is not None) and not isinstance(v, (int, long)): if not v.thisown: raise Exception("%s is already owned, and cannot be reused" % v) v.thisown = False dereg = getattr(v, "_deregister", None) if dereg: dereg() return True def _maybe_disown_and_deregister(self): if self.thisown: self.thisown = False self._deregister() def _own_and_register(self): assert(not self.thisown) self.thisown = True self._register() def replace_by(self, o): assert(isinstance(o, (cexpr_t, cinsn_t))) o._maybe_disown_and_deregister() self._replace_by(o) def _meminfo(self): cpp = self.__dbg_get_meminfo() rkind = self.__dbg_get_registered_kind() rkind_str = [ "(not owned)", "cfuncptr_t", "cinsn_t", "cexpr_t", "cblock_t", "mbl_array_t", "mop_t", "minsn_t", "optinsn_t", "optblock_t", "valrng_t"][rkind] return "%s [thisown=%s, owned by IDAPython as=%s]" % ( cpp, self.thisown, rkind_str) meminfo = property(_meminfo) citem_t_swigregister = _ida_hexrays.citem_t_swigregister citem_t_swigregister(citem_t) class cexpr_t(citem_t): """ Proxy of C++ cexpr_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr type = _swig_property(_ida_hexrays.cexpr_t_type_get, _ida_hexrays.cexpr_t_type_set) exflags = _swig_property(_ida_hexrays.cexpr_t_exflags_get, _ida_hexrays.cexpr_t_exflags_set) def cpadone(self, *args): """ cpadone(self) -> bool """ return _ida_hexrays.cexpr_t_cpadone(self, *args) def is_odd_lvalue(self, *args): """ is_odd_lvalue(self) -> bool """ return _ida_hexrays.cexpr_t_is_odd_lvalue(self, *args) def is_fpop(self, *args): """ is_fpop(self) -> bool """ return _ida_hexrays.cexpr_t_is_fpop(self, *args) def is_cstr(self, *args): """ is_cstr(self) -> bool """ return _ida_hexrays.cexpr_t_is_cstr(self, *args) def is_undef_val(self, *args): """ is_undef_val(self) -> bool """ return _ida_hexrays.cexpr_t_is_undef_val(self, *args) def is_jumpout(self, *args): """ is_jumpout(self) -> bool """ return _ida_hexrays.cexpr_t_is_jumpout(self, *args) def is_vftable(self, *args): """ is_vftable(self) -> bool """ return _ida_hexrays.cexpr_t_is_vftable(self, *args) def set_cpadone(self, *args): """ set_cpadone(self) """ return _ida_hexrays.cexpr_t_set_cpadone(self, *args) def set_vftable(self, *args): """ set_vftable(self) """ return _ida_hexrays.cexpr_t_set_vftable(self, *args) def __init__(self, *args): """ __init__(self) -> cexpr_t __init__(self, cop, _x) -> cexpr_t __init__(self, cop, _x, _y) -> cexpr_t __init__(self, cop, _x, _y, _z) -> cexpr_t __init__(self, r) -> cexpr_t """ this = _ida_hexrays.new_cexpr_t(*args) try: self.this.append(this) except: self.this = this def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.cexpr_t_swap(self, *args) def assign(self, *args): """ assign(self, r) -> cexpr_t """ return _ida_hexrays.cexpr_t_assign(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cexpr_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cexpr_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cexpr_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cexpr_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cexpr_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cexpr_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cexpr_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_cexpr_t __del__ = lambda self : None; def _replace_by(self, *args): """ _replace_by(self, r) """ return _ida_hexrays.cexpr_t__replace_by(self, *args) def cleanup(self, *args): """ cleanup(self) """ return _ida_hexrays.cexpr_t_cleanup(self, *args) def put_number(self, *args): """ put_number(self, func, value, nbytes, sign=no_sign) """ return _ida_hexrays.cexpr_t_put_number(self, *args) def print1(self, *args): """ print1(self, func) """ return _ida_hexrays.cexpr_t_print1(self, *args) def calc_type(self, *args): """ calc_type(self, recursive) """ return _ida_hexrays.cexpr_t_calc_type(self, *args) def equal_effect(self, *args): """ equal_effect(self, r) -> bool """ return _ida_hexrays.cexpr_t_equal_effect(self, *args) def is_child_of(self, *args): """ is_child_of(self, parent) -> bool """ return _ida_hexrays.cexpr_t_is_child_of(self, *args) def contains_operator(self, *args): """ contains_operator(self, needed_op, times=1) -> bool """ return _ida_hexrays.cexpr_t_contains_operator(self, *args) def contains_comma(self, *args): """ contains_comma(self, times=1) -> bool """ return _ida_hexrays.cexpr_t_contains_comma(self, *args) def contains_insn(self, *args): """ contains_insn(self, times=1) -> bool """ return _ida_hexrays.cexpr_t_contains_insn(self, *args) def contains_insn_or_label(self, *args): """ contains_insn_or_label(self) -> bool """ return _ida_hexrays.cexpr_t_contains_insn_or_label(self, *args) def contains_comma_or_insn_or_label(self, *args): """ contains_comma_or_insn_or_label(self, maxcommas=1) -> bool """ return _ida_hexrays.cexpr_t_contains_comma_or_insn_or_label(self, *args) def is_nice_expr(self, *args): """ is_nice_expr(self) -> bool """ return _ida_hexrays.cexpr_t_is_nice_expr(self, *args) def is_nice_cond(self, *args): """ is_nice_cond(self) -> bool """ return _ida_hexrays.cexpr_t_is_nice_cond(self, *args) def is_call_object_of(self, *args): """ is_call_object_of(self, parent) -> bool """ return _ida_hexrays.cexpr_t_is_call_object_of(self, *args) def is_call_arg_of(self, *args): """ is_call_arg_of(self, parent) -> bool """ return _ida_hexrays.cexpr_t_is_call_arg_of(self, *args) def get_type_sign(self, *args): """ get_type_sign(self) -> type_sign_t """ return _ida_hexrays.cexpr_t_get_type_sign(self, *args) def is_type_unsigned(self, *args): """ is_type_unsigned(self) -> bool """ return _ida_hexrays.cexpr_t_is_type_unsigned(self, *args) def is_type_signed(self, *args): """ is_type_signed(self) -> bool """ return _ida_hexrays.cexpr_t_is_type_signed(self, *args) def get_high_nbit_bound(self, *args): """ get_high_nbit_bound(self) -> bit_bound_t """ return _ida_hexrays.cexpr_t_get_high_nbit_bound(self, *args) def get_low_nbit_bound(self, *args): """ get_low_nbit_bound(self) -> int """ return _ida_hexrays.cexpr_t_get_low_nbit_bound(self, *args) def requires_lvalue(self, *args): """ requires_lvalue(self, child) -> bool """ return _ida_hexrays.cexpr_t_requires_lvalue(self, *args) def has_side_effects(self, *args): """ has_side_effects(self) -> bool """ return _ida_hexrays.cexpr_t_has_side_effects(self, *args) def numval(self, *args): """ numval(self) -> uint64 """ return _ida_hexrays.cexpr_t_numval(self, *args) def is_const_value(self, *args): """ is_const_value(self, _v) -> bool """ return _ida_hexrays.cexpr_t_is_const_value(self, *args) def is_negative_const(self, *args): """ is_negative_const(self) -> bool """ return _ida_hexrays.cexpr_t_is_negative_const(self, *args) def is_non_negative_const(self, *args): """ is_non_negative_const(self) -> bool """ return _ida_hexrays.cexpr_t_is_non_negative_const(self, *args) def is_non_zero_const(self, *args): """ is_non_zero_const(self) -> bool """ return _ida_hexrays.cexpr_t_is_non_zero_const(self, *args) def is_zero_const(self, *args): """ is_zero_const(self) -> bool """ return _ida_hexrays.cexpr_t_is_zero_const(self, *args) def get_const_value(self, *args): """ get_const_value(self) -> bool """ return _ida_hexrays.cexpr_t_get_const_value(self, *args) def maybe_ptr(self, *args): """ maybe_ptr(self) -> bool """ return _ida_hexrays.cexpr_t_maybe_ptr(self, *args) def get_ptr_or_array(self, *args): """ get_ptr_or_array(self) -> cexpr_t """ return _ida_hexrays.cexpr_t_get_ptr_or_array(self, *args) def find_op(self, *args): """ find_op(self, _op) -> cexpr_t find_op(self, _op) -> cexpr_t """ return _ida_hexrays.cexpr_t_find_op(self, *args) def find_num_op(self, *args): """ find_num_op(self) -> cexpr_t find_num_op(self) -> cexpr_t """ return _ida_hexrays.cexpr_t_find_num_op(self, *args) def theother(self, *args): """ theother(self, what) -> cexpr_t theother(self, what) -> cexpr_t """ return _ida_hexrays.cexpr_t_theother(self, *args) def get_1num_op(self, *args): """ get_1num_op(self, o1, o2) -> bool """ return _ida_hexrays.cexpr_t_get_1num_op(self, *args) def _register(self, *args): """ _register(self) """ return _ida_hexrays.cexpr_t__register(self, *args) def _deregister(self, *args): """ _deregister(self) """ return _ida_hexrays.cexpr_t__deregister(self, *args) def _get_n(self, *args): """ _get_n(self) -> cnumber_t """ return _ida_hexrays.cexpr_t__get_n(self, *args) def _set_n(self, *args): """ _set_n(self, _v) """ return _ida_hexrays.cexpr_t__set_n(self, *args) n = property( lambda self: self._get_n() if self.op == cot_num else None, lambda self, v: self._ensure_cond(self.op == cot_num,"self.op == cot_num") and self._ensure_no_obj(self._get_n(),"n", True) and self._acquire_ownership(v, True) and self._set_n(v)) def _get_fpc(self, *args): """ _get_fpc(self) -> fnumber_t """ return _ida_hexrays.cexpr_t__get_fpc(self, *args) def _set_fpc(self, *args): """ _set_fpc(self, _v) """ return _ida_hexrays.cexpr_t__set_fpc(self, *args) fpc = property( lambda self: self._get_fpc() if self.op == cot_fnum else None, lambda self, v: self._ensure_cond(self.op == cot_fnum,"self.op == cot_fnum") and self._ensure_no_obj(self._get_fpc(),"fpc", True) and self._acquire_ownership(v, True) and self._set_fpc(v)) def get_v(self, *args): """ get_v(self) -> var_ref_t """ return _ida_hexrays.cexpr_t_get_v(self, *args) def set_v(self, *args): """ set_v(self, v) """ return _ida_hexrays.cexpr_t_set_v(self, *args) v = property(lambda self: self.get_v(), lambda self, v: self.set_v(v)) def _get_obj_ea(self, *args): """ _get_obj_ea(self) -> ea_t """ return _ida_hexrays.cexpr_t__get_obj_ea(self, *args) def _set_obj_ea(self, *args): """ _set_obj_ea(self, _v) """ return _ida_hexrays.cexpr_t__set_obj_ea(self, *args) obj_ea = property( lambda self: self._get_obj_ea() if self.op == cot_obj else ida_idaapi.BADADDR, lambda self, v: self._ensure_cond(self.op == cot_obj,"self.op == cot_obj") and self._ensure_no_obj(self._get_obj_ea(),"obj_ea", False) and self._acquire_ownership(v, False) and self._set_obj_ea(v)) def _get_refwidth(self, *args): """ _get_refwidth(self) -> int """ return _ida_hexrays.cexpr_t__get_refwidth(self, *args) def _set_refwidth(self, *args): """ _set_refwidth(self, _v) """ return _ida_hexrays.cexpr_t__set_refwidth(self, *args) refwidth = property( lambda self: self._get_refwidth() if True else 0, lambda self, v: self._ensure_cond(True,"True") and self._ensure_no_obj(self._get_refwidth(),"refwidth", False) and self._acquire_ownership(v, False) and self._set_refwidth(v)) def _get_x(self, *args): """ _get_x(self) -> cexpr_t """ return _ida_hexrays.cexpr_t__get_x(self, *args) def _set_x(self, *args): """ _set_x(self, _v) """ return _ida_hexrays.cexpr_t__set_x(self, *args) x = property( lambda self: self._get_x() if op_uses_x(self.op) else None, lambda self, v: self._ensure_cond(op_uses_x(self.op),"op_uses_x(self.op)") and self._ensure_no_obj(self._get_x(),"x", True) and self._acquire_ownership(v, True) and self._set_x(v)) def _get_y(self, *args): """ _get_y(self) -> cexpr_t """ return _ida_hexrays.cexpr_t__get_y(self, *args) def _set_y(self, *args): """ _set_y(self, _v) """ return _ida_hexrays.cexpr_t__set_y(self, *args) y = property( lambda self: self._get_y() if op_uses_y(self.op) else None, lambda self, v: self._ensure_cond(op_uses_y(self.op),"op_uses_y(self.op)") and self._ensure_no_obj(self._get_y(),"y", True) and self._acquire_ownership(v, True) and self._set_y(v)) def _get_a(self, *args): """ _get_a(self) -> carglist_t """ return _ida_hexrays.cexpr_t__get_a(self, *args) def _set_a(self, *args): """ _set_a(self, _v) """ return _ida_hexrays.cexpr_t__set_a(self, *args) a = property( lambda self: self._get_a() if self.op == cot_call else None, lambda self, v: self._ensure_cond(self.op == cot_call,"self.op == cot_call") and self._ensure_no_obj(self._get_a(),"a", True) and self._acquire_ownership(v, True) and self._set_a(v)) def _get_m(self, *args): """ _get_m(self) -> int """ return _ida_hexrays.cexpr_t__get_m(self, *args) def _set_m(self, *args): """ _set_m(self, _v) """ return _ida_hexrays.cexpr_t__set_m(self, *args) m = property( lambda self: self._get_m() if (self.op == cot_memptr or self.op == cot_memref) else 0, lambda self, v: self._ensure_cond((self.op == cot_memptr or self.op == cot_memref),"(self.op == cot_memptr or self.op == cot_memref)") and self._ensure_no_obj(self._get_m(),"m", False) and self._acquire_ownership(v, False) and self._set_m(v)) def _get_z(self, *args): """ _get_z(self) -> cexpr_t """ return _ida_hexrays.cexpr_t__get_z(self, *args) def _set_z(self, *args): """ _set_z(self, _v) """ return _ida_hexrays.cexpr_t__set_z(self, *args) z = property( lambda self: self._get_z() if op_uses_z(self.op) else None, lambda self, v: self._ensure_cond(op_uses_z(self.op),"op_uses_z(self.op)") and self._ensure_no_obj(self._get_z(),"z", True) and self._acquire_ownership(v, True) and self._set_z(v)) def _get_ptrsize(self, *args): """ _get_ptrsize(self) -> int """ return _ida_hexrays.cexpr_t__get_ptrsize(self, *args) def _set_ptrsize(self, *args): """ _set_ptrsize(self, _v) """ return _ida_hexrays.cexpr_t__set_ptrsize(self, *args) ptrsize = property( lambda self: self._get_ptrsize() if (self.op == cot_ptr or self.op == cot_memptr) else 0, lambda self, v: self._ensure_cond((self.op == cot_ptr or self.op == cot_memptr),"(self.op == cot_ptr or self.op == cot_memptr)") and self._ensure_no_obj(self._get_ptrsize(),"ptrsize", False) and self._acquire_ownership(v, False) and self._set_ptrsize(v)) def _get_insn(self, *args): """ _get_insn(self) -> cinsn_t """ return _ida_hexrays.cexpr_t__get_insn(self, *args) def _set_insn(self, *args): """ _set_insn(self, _v) """ return _ida_hexrays.cexpr_t__set_insn(self, *args) insn = property( lambda self: self._get_insn() if self.op == cot_insn else None, lambda self, v: self._ensure_cond(self.op == cot_insn,"self.op == cot_insn") and self._ensure_no_obj(self._get_insn(),"insn", True) and self._acquire_ownership(v, True) and self._set_insn(v)) def _get_helper(self, *args): """ _get_helper(self) -> char * """ return _ida_hexrays.cexpr_t__get_helper(self, *args) def _set_helper(self, *args): """ _set_helper(self, _v) """ return _ida_hexrays.cexpr_t__set_helper(self, *args) helper = property( lambda self: self._get_helper() if self.op == cot_helper else None, lambda self, v: self._ensure_cond(self.op == cot_helper,"self.op == cot_helper") and self._ensure_no_obj(self._get_helper(),"helper", False) and self._acquire_ownership(v, False) and self._set_helper(v)) def _get_string(self, *args): """ _get_string(self) -> char * """ return _ida_hexrays.cexpr_t__get_string(self, *args) def _set_string(self, *args): """ _set_string(self, _v) """ return _ida_hexrays.cexpr_t__set_string(self, *args) string = property( lambda self: self._get_string() if self.op == cot_str else None, lambda self, v: self._ensure_cond(self.op == cot_str,"self.op == cot_str") and self._ensure_no_obj(self._get_string(),"string", False) and self._acquire_ownership(v, False) and self._set_string(v)) cexpr_t_swigregister = _ida_hexrays.cexpr_t_swigregister cexpr_t_swigregister(cexpr_t) EXFL_CPADONE = _ida_hexrays.EXFL_CPADONE """ pointer arithmetic correction done """ EXFL_LVALUE = _ida_hexrays.EXFL_LVALUE """ expression is lvalue even if it doesn't look like it """ EXFL_FPOP = _ida_hexrays.EXFL_FPOP """ floating point operation """ EXFL_ALONE = _ida_hexrays.EXFL_ALONE """ standalone helper """ EXFL_CSTR = _ida_hexrays.EXFL_CSTR """ string literal """ EXFL_PARTIAL = _ida_hexrays.EXFL_PARTIAL """ type of the expression is considered partial """ EXFL_UNDEF = _ida_hexrays.EXFL_UNDEF """ expression uses undefined value """ EXFL_JUMPOUT = _ida_hexrays.EXFL_JUMPOUT """ jump out-of-function """ EXFL_VFTABLE = _ida_hexrays.EXFL_VFTABLE """ is ptr to vftable (used for cot_memptr, cot_memref) """ EXFL_ALL = _ida_hexrays.EXFL_ALL """ all currently defined bits """ class ceinsn_t(object): """ Proxy of C++ ceinsn_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr expr = _swig_property(_ida_hexrays.ceinsn_t_expr_get, _ida_hexrays.ceinsn_t_expr_set) def __init__(self, *args): """ __init__(self) -> ceinsn_t """ this = _ida_hexrays.new_ceinsn_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_ceinsn_t __del__ = lambda self : None; ceinsn_t_swigregister = _ida_hexrays.ceinsn_t_swigregister ceinsn_t_swigregister(ceinsn_t) CALC_CURLY_BRACES = _ida_hexrays.CALC_CURLY_BRACES NO_CURLY_BRACES = _ida_hexrays.NO_CURLY_BRACES USE_CURLY_BRACES = _ida_hexrays.USE_CURLY_BRACES class cif_t(ceinsn_t): """ Proxy of C++ cif_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ithen = _swig_property(_ida_hexrays.cif_t_ithen_get, _ida_hexrays.cif_t_ithen_set) ielse = _swig_property(_ida_hexrays.cif_t_ielse_get, _ida_hexrays.cif_t_ielse_set) def __init__(self, *args): """ __init__(self) -> cif_t __init__(self, r) -> cif_t """ this = _ida_hexrays.new_cif_t(*args) try: self.this.append(this) except: self.this = this def assign(self, *args): """ assign(self, r) -> cif_t """ return _ida_hexrays.cif_t_assign(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cif_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cif_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cif_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cif_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cif_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cif_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cif_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_cif_t __del__ = lambda self : None; def cleanup(self, *args): """ cleanup(self) """ return _ida_hexrays.cif_t_cleanup(self, *args) cif_t_swigregister = _ida_hexrays.cif_t_swigregister cif_t_swigregister(cif_t) class cloop_t(ceinsn_t): """ Proxy of C++ cloop_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr body = _swig_property(_ida_hexrays.cloop_t_body_get, _ida_hexrays.cloop_t_body_set) def __init__(self, *args): """ __init__(self) -> cloop_t __init__(self, b) -> cloop_t __init__(self, r) -> cloop_t """ this = _ida_hexrays.new_cloop_t(*args) try: self.this.append(this) except: self.this = this def assign(self, *args): """ assign(self, r) -> cloop_t """ return _ida_hexrays.cloop_t_assign(self, *args) __swig_destroy__ = _ida_hexrays.delete_cloop_t __del__ = lambda self : None; def cleanup(self, *args): """ cleanup(self) """ return _ida_hexrays.cloop_t_cleanup(self, *args) cloop_t_swigregister = _ida_hexrays.cloop_t_swigregister cloop_t_swigregister(cloop_t) class cfor_t(cloop_t): """ Proxy of C++ cfor_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr init = _swig_property(_ida_hexrays.cfor_t_init_get, _ida_hexrays.cfor_t_init_set) step = _swig_property(_ida_hexrays.cfor_t_step_get, _ida_hexrays.cfor_t_step_set) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cfor_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cfor_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cfor_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cfor_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cfor_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cfor_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cfor_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> cfor_t """ this = _ida_hexrays.new_cfor_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_cfor_t __del__ = lambda self : None; cfor_t_swigregister = _ida_hexrays.cfor_t_swigregister cfor_t_swigregister(cfor_t) class cwhile_t(cloop_t): """ Proxy of C++ cwhile_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cwhile_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cwhile_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cwhile_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cwhile_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cwhile_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cwhile_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cwhile_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> cwhile_t """ this = _ida_hexrays.new_cwhile_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_cwhile_t __del__ = lambda self : None; cwhile_t_swigregister = _ida_hexrays.cwhile_t_swigregister cwhile_t_swigregister(cwhile_t) class cdo_t(cloop_t): """ Proxy of C++ cdo_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cdo_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cdo_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cdo_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cdo_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cdo_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cdo_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cdo_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> cdo_t """ this = _ida_hexrays.new_cdo_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_cdo_t __del__ = lambda self : None; cdo_t_swigregister = _ida_hexrays.cdo_t_swigregister cdo_t_swigregister(cdo_t) class creturn_t(ceinsn_t): """ Proxy of C++ creturn_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.creturn_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.creturn_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.creturn_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.creturn_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.creturn_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.creturn_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.creturn_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> creturn_t """ this = _ida_hexrays.new_creturn_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_creturn_t __del__ = lambda self : None; creturn_t_swigregister = _ida_hexrays.creturn_t_swigregister creturn_t_swigregister(creturn_t) class cgoto_t(object): """ Proxy of C++ cgoto_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr label_num = _swig_property(_ida_hexrays.cgoto_t_label_num_get, _ida_hexrays.cgoto_t_label_num_set) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cgoto_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cgoto_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cgoto_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cgoto_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cgoto_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cgoto_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cgoto_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> cgoto_t """ this = _ida_hexrays.new_cgoto_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_cgoto_t __del__ = lambda self : None; cgoto_t_swigregister = _ida_hexrays.cgoto_t_swigregister cgoto_t_swigregister(cgoto_t) class casm_t(ida_pro.eavec_t): """ Proxy of C++ casm_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self, ea) -> casm_t __init__(self, r) -> casm_t """ this = _ida_hexrays.new_casm_t(*args) try: self.this.append(this) except: self.this = this def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.casm_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.casm_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.casm_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.casm_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.casm_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.casm_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.casm_t_compare(self, *args) def one_insn(self, *args): """ one_insn(self) -> bool """ return _ida_hexrays.casm_t_one_insn(self, *args) __swig_destroy__ = _ida_hexrays.delete_casm_t __del__ = lambda self : None; casm_t_swigregister = _ida_hexrays.casm_t_swigregister casm_t_swigregister(casm_t) class cinsn_t(citem_t): """ Proxy of C++ cinsn_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __init__(self, *args): """ __init__(self) -> cinsn_t __init__(self, r) -> cinsn_t """ this = _ida_hexrays.new_cinsn_t(*args) try: self.this.append(this) except: self.this = this def swap(self, *args): """ swap(self, r) """ return _ida_hexrays.cinsn_t_swap(self, *args) def assign(self, *args): """ assign(self, r) -> cinsn_t """ return _ida_hexrays.cinsn_t_assign(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cinsn_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cinsn_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cinsn_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cinsn_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cinsn_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cinsn_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cinsn_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_cinsn_t __del__ = lambda self : None; def _replace_by(self, *args): """ _replace_by(self, r) """ return _ida_hexrays.cinsn_t__replace_by(self, *args) def cleanup(self, *args): """ cleanup(self) """ return _ida_hexrays.cinsn_t_cleanup(self, *args) def zero(self, *args): """ zero(self) """ return _ida_hexrays.cinsn_t_zero(self, *args) def new_insn(self, *args): """ new_insn(self, insn_ea) -> cinsn_t """ return _ida_hexrays.cinsn_t_new_insn(self, *args) def create_if(self, *args): """ create_if(self, cnd) -> cif_t """ return _ida_hexrays.cinsn_t_create_if(self, *args) def _print(self, *args): """ _print(self, indent, vp, use_curly=CALC_CURLY_BRACES) """ return _ida_hexrays.cinsn_t__print(self, *args) def print1(self, *args): """ print1(self, func) """ return _ida_hexrays.cinsn_t_print1(self, *args) def is_ordinary_flow(self, *args): """ is_ordinary_flow(self) -> bool """ return _ida_hexrays.cinsn_t_is_ordinary_flow(self, *args) def contains_insn(self, *args): """ contains_insn(self, type, times=1) -> bool """ return _ida_hexrays.cinsn_t_contains_insn(self, *args) def collect_free_breaks(self, *args): """ collect_free_breaks(self, breaks) -> bool """ return _ida_hexrays.cinsn_t_collect_free_breaks(self, *args) def collect_free_continues(self, *args): """ collect_free_continues(self, continues) -> bool """ return _ida_hexrays.cinsn_t_collect_free_continues(self, *args) def contains_free_break(self, *args): """ contains_free_break(self) -> bool """ return _ida_hexrays.cinsn_t_contains_free_break(self, *args) def contains_free_continue(self, *args): """ contains_free_continue(self) -> bool """ return _ida_hexrays.cinsn_t_contains_free_continue(self, *args) def _register(self, *args): """ _register(self) """ return _ida_hexrays.cinsn_t__register(self, *args) def _deregister(self, *args): """ _deregister(self) """ return _ida_hexrays.cinsn_t__deregister(self, *args) def _get_cblock(self, *args): """ _get_cblock(self) -> cblock_t """ return _ida_hexrays.cinsn_t__get_cblock(self, *args) def _set_cblock(self, *args): """ _set_cblock(self, _v) """ return _ida_hexrays.cinsn_t__set_cblock(self, *args) cblock = property( lambda self: self._get_cblock() if self.op == cit_block else None, lambda self, v: self._ensure_cond(self.op == cit_block,"self.op == cit_block") and self._ensure_no_obj(self._get_cblock(),"cblock", True) and self._acquire_ownership(v, True) and self._set_cblock(v)) def _get_cexpr(self, *args): """ _get_cexpr(self) -> cexpr_t """ return _ida_hexrays.cinsn_t__get_cexpr(self, *args) def _set_cexpr(self, *args): """ _set_cexpr(self, _v) """ return _ida_hexrays.cinsn_t__set_cexpr(self, *args) cexpr = property( lambda self: self._get_cexpr() if self.op == cit_expr else None, lambda self, v: self._ensure_cond(self.op == cit_expr,"self.op == cit_expr") and self._ensure_no_obj(self._get_cexpr(),"cexpr", True) and self._acquire_ownership(v, True) and self._set_cexpr(v)) def _get_cif(self, *args): """ _get_cif(self) -> cif_t """ return _ida_hexrays.cinsn_t__get_cif(self, *args) def _set_cif(self, *args): """ _set_cif(self, _v) """ return _ida_hexrays.cinsn_t__set_cif(self, *args) cif = property( lambda self: self._get_cif() if self.op == cit_if else None, lambda self, v: self._ensure_cond(self.op == cit_if,"self.op == cit_if") and self._ensure_no_obj(self._get_cif(),"cif", True) and self._acquire_ownership(v, True) and self._set_cif(v)) def _get_cfor(self, *args): """ _get_cfor(self) -> cfor_t """ return _ida_hexrays.cinsn_t__get_cfor(self, *args) def _set_cfor(self, *args): """ _set_cfor(self, _v) """ return _ida_hexrays.cinsn_t__set_cfor(self, *args) cfor = property( lambda self: self._get_cfor() if self.op == cit_for else None, lambda self, v: self._ensure_cond(self.op == cit_for,"self.op == cit_for") and self._ensure_no_obj(self._get_cfor(),"cfor", True) and self._acquire_ownership(v, True) and self._set_cfor(v)) def _get_cwhile(self, *args): """ _get_cwhile(self) -> cwhile_t """ return _ida_hexrays.cinsn_t__get_cwhile(self, *args) def _set_cwhile(self, *args): """ _set_cwhile(self, _v) """ return _ida_hexrays.cinsn_t__set_cwhile(self, *args) cwhile = property( lambda self: self._get_cwhile() if self.op == cit_while else None, lambda self, v: self._ensure_cond(self.op == cit_while,"self.op == cit_while") and self._ensure_no_obj(self._get_cwhile(),"cwhile", True) and self._acquire_ownership(v, True) and self._set_cwhile(v)) def _get_cdo(self, *args): """ _get_cdo(self) -> cdo_t """ return _ida_hexrays.cinsn_t__get_cdo(self, *args) def _set_cdo(self, *args): """ _set_cdo(self, _v) """ return _ida_hexrays.cinsn_t__set_cdo(self, *args) cdo = property( lambda self: self._get_cdo() if self.op == cit_do else None, lambda self, v: self._ensure_cond(self.op == cit_do,"self.op == cit_do") and self._ensure_no_obj(self._get_cdo(),"cdo", True) and self._acquire_ownership(v, True) and self._set_cdo(v)) def _get_cswitch(self, *args): """ _get_cswitch(self) -> cswitch_t """ return _ida_hexrays.cinsn_t__get_cswitch(self, *args) def _set_cswitch(self, *args): """ _set_cswitch(self, _v) """ return _ida_hexrays.cinsn_t__set_cswitch(self, *args) cswitch = property( lambda self: self._get_cswitch() if self.op == cit_switch else None, lambda self, v: self._ensure_cond(self.op == cit_switch,"self.op == cit_switch") and self._ensure_no_obj(self._get_cswitch(),"cswitch", True) and self._acquire_ownership(v, True) and self._set_cswitch(v)) def _get_creturn(self, *args): """ _get_creturn(self) -> creturn_t """ return _ida_hexrays.cinsn_t__get_creturn(self, *args) def _set_creturn(self, *args): """ _set_creturn(self, _v) """ return _ida_hexrays.cinsn_t__set_creturn(self, *args) creturn = property( lambda self: self._get_creturn() if self.op == cit_return else None, lambda self, v: self._ensure_cond(self.op == cit_return,"self.op == cit_return") and self._ensure_no_obj(self._get_creturn(),"creturn", True) and self._acquire_ownership(v, True) and self._set_creturn(v)) def _get_cgoto(self, *args): """ _get_cgoto(self) -> cgoto_t """ return _ida_hexrays.cinsn_t__get_cgoto(self, *args) def _set_cgoto(self, *args): """ _set_cgoto(self, _v) """ return _ida_hexrays.cinsn_t__set_cgoto(self, *args) cgoto = property( lambda self: self._get_cgoto() if self.op == cit_goto else None, lambda self, v: self._ensure_cond(self.op == cit_goto,"self.op == cit_goto") and self._ensure_no_obj(self._get_cgoto(),"cgoto", True) and self._acquire_ownership(v, True) and self._set_cgoto(v)) def _get_casm(self, *args): """ _get_casm(self) -> casm_t """ return _ida_hexrays.cinsn_t__get_casm(self, *args) def _set_casm(self, *args): """ _set_casm(self, _v) """ return _ida_hexrays.cinsn_t__set_casm(self, *args) casm = property( lambda self: self._get_casm() if self.op == cit_asm else None, lambda self, v: self._ensure_cond(self.op == cit_asm,"self.op == cit_asm") and self._ensure_no_obj(self._get_casm(),"casm", True) and self._acquire_ownership(v, True) and self._set_casm(v)) def insn_is_epilog(*args): """ insn_is_epilog(insn) -> bool """ return _ida_hexrays.cinsn_t_insn_is_epilog(*args) insn_is_epilog = staticmethod(insn_is_epilog) def is_epilog(self): return cinsn_t.insn_is_epilog(self) cinsn_t_swigregister = _ida_hexrays.cinsn_t_swigregister cinsn_t_swigregister(cinsn_t) def cinsn_t_insn_is_epilog(*args): """ cinsn_t_insn_is_epilog(insn) -> bool """ return _ida_hexrays.cinsn_t_insn_is_epilog(*args) class cblock_t(qlist_cinsn_t): """ Proxy of C++ cblock_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cblock_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cblock_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cblock_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cblock_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cblock_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cblock_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cblock_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> cblock_t """ this = _ida_hexrays.new_cblock_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_cblock_t __del__ = lambda self : None; def _deregister(self, *args): """ _deregister(self) """ return _ida_hexrays.cblock_t__deregister(self, *args) cblock_t_swigregister = _ida_hexrays.cblock_t_swigregister cblock_t_swigregister(cblock_t) class carg_t(cexpr_t): """ Proxy of C++ carg_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr is_vararg = _swig_property(_ida_hexrays.carg_t_is_vararg_get, _ida_hexrays.carg_t_is_vararg_set) formal_type = _swig_property(_ida_hexrays.carg_t_formal_type_get, _ida_hexrays.carg_t_formal_type_set) def consume_cexpr(self, *args): """ consume_cexpr(self, e) """ return _ida_hexrays.carg_t_consume_cexpr(self, *args) def __init__(self, *args): """ __init__(self) -> carg_t """ this = _ida_hexrays.new_carg_t(*args) try: self.this.append(this) except: self.this = this def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.carg_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.carg_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.carg_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.carg_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.carg_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.carg_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.carg_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_carg_t __del__ = lambda self : None; carg_t_swigregister = _ida_hexrays.carg_t_swigregister carg_t_swigregister(carg_t) class carglist_t(qvector_carg_t): """ Proxy of C++ carglist_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr functype = _swig_property(_ida_hexrays.carglist_t_functype_get, _ida_hexrays.carglist_t_functype_set) flags = _swig_property(_ida_hexrays.carglist_t_flags_get, _ida_hexrays.carglist_t_flags_set) def __init__(self, *args): """ __init__(self) -> carglist_t __init__(self, ftype, fl=0) -> carglist_t """ this = _ida_hexrays.new_carglist_t(*args) try: self.this.append(this) except: self.this = this def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.carglist_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.carglist_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.carglist_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.carglist_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.carglist_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.carglist_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.carglist_t_compare(self, *args) __swig_destroy__ = _ida_hexrays.delete_carglist_t __del__ = lambda self : None; carglist_t_swigregister = _ida_hexrays.carglist_t_swigregister carglist_t_swigregister(carglist_t) CFL_FINAL = _ida_hexrays.CFL_FINAL """ call type is final, should not be changed """ CFL_HELPER = _ida_hexrays.CFL_HELPER """ created from a decompiler helper function """ class ccase_t(cinsn_t): """ Proxy of C++ ccase_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr values = _swig_property(_ida_hexrays.ccase_t_values_get, _ida_hexrays.ccase_t_values_set) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.ccase_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.ccase_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.ccase_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.ccase_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.ccase_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.ccase_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.ccase_t_compare(self, *args) def size(self, *args): """ size(self) -> size_t """ return _ida_hexrays.ccase_t_size(self, *args) def value(self, *args): """ value(self, i) -> uint64 const & """ return _ida_hexrays.ccase_t_value(self, *args) def __init__(self, *args): """ __init__(self) -> ccase_t """ this = _ida_hexrays.new_ccase_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_ccase_t __del__ = lambda self : None; ccase_t_swigregister = _ida_hexrays.ccase_t_swigregister ccase_t_swigregister(ccase_t) class ccases_t(qvector_ccase_t): """ Proxy of C++ ccases_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.ccases_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.ccases_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.ccases_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.ccases_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.ccases_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.ccases_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.ccases_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> ccases_t """ this = _ida_hexrays.new_ccases_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_ccases_t __del__ = lambda self : None; ccases_t_swigregister = _ida_hexrays.ccases_t_swigregister ccases_t_swigregister(ccases_t) class cswitch_t(ceinsn_t): """ Proxy of C++ cswitch_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr mvnf = _swig_property(_ida_hexrays.cswitch_t_mvnf_get, _ida_hexrays.cswitch_t_mvnf_set) cases = _swig_property(_ida_hexrays.cswitch_t_cases_get, _ida_hexrays.cswitch_t_cases_set) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.cswitch_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.cswitch_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.cswitch_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.cswitch_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.cswitch_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.cswitch_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.cswitch_t_compare(self, *args) def __init__(self, *args): """ __init__(self) -> cswitch_t """ this = _ida_hexrays.new_cswitch_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_cswitch_t __del__ = lambda self : None; cswitch_t_swigregister = _ida_hexrays.cswitch_t_swigregister cswitch_t_swigregister(cswitch_t) class ctree_anchor_t(object): """ Proxy of C++ ctree_anchor_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr value = _swig_property(_ida_hexrays.ctree_anchor_t_value_get, _ida_hexrays.ctree_anchor_t_value_set) def __init__(self, *args): """ __init__(self) -> ctree_anchor_t """ this = _ida_hexrays.new_ctree_anchor_t(*args) try: self.this.append(this) except: self.this = this def get_index(self, *args): """ get_index(self) -> int """ return _ida_hexrays.ctree_anchor_t_get_index(self, *args) def get_itp(self, *args): """ get_itp(self) -> item_preciser_t """ return _ida_hexrays.ctree_anchor_t_get_itp(self, *args) def is_valid_anchor(self, *args): """ is_valid_anchor(self) -> bool """ return _ida_hexrays.ctree_anchor_t_is_valid_anchor(self, *args) def is_citem_anchor(self, *args): """ is_citem_anchor(self) -> bool """ return _ida_hexrays.ctree_anchor_t_is_citem_anchor(self, *args) def is_lvar_anchor(self, *args): """ is_lvar_anchor(self) -> bool """ return _ida_hexrays.ctree_anchor_t_is_lvar_anchor(self, *args) def is_itp_anchor(self, *args): """ is_itp_anchor(self) -> bool """ return _ida_hexrays.ctree_anchor_t_is_itp_anchor(self, *args) def is_blkcmt_anchor(self, *args): """ is_blkcmt_anchor(self) -> bool """ return _ida_hexrays.ctree_anchor_t_is_blkcmt_anchor(self, *args) __swig_destroy__ = _ida_hexrays.delete_ctree_anchor_t __del__ = lambda self : None; ctree_anchor_t_swigregister = _ida_hexrays.ctree_anchor_t_swigregister ctree_anchor_t_swigregister(ctree_anchor_t) ANCHOR_INDEX = _ida_hexrays.ANCHOR_INDEX ANCHOR_MASK = _ida_hexrays.ANCHOR_MASK ANCHOR_CITEM = _ida_hexrays.ANCHOR_CITEM """ c-tree item """ ANCHOR_LVAR = _ida_hexrays.ANCHOR_LVAR """ declaration of local variable """ ANCHOR_ITP = _ida_hexrays.ANCHOR_ITP """ item type preciser """ ANCHOR_BLKCMT = _ida_hexrays.ANCHOR_BLKCMT """ block comment (for ctree items) """ VDI_NONE = _ida_hexrays.VDI_NONE VDI_EXPR = _ida_hexrays.VDI_EXPR VDI_LVAR = _ida_hexrays.VDI_LVAR VDI_FUNC = _ida_hexrays.VDI_FUNC VDI_TAIL = _ida_hexrays.VDI_TAIL class ctree_item_t(object): """ Proxy of C++ ctree_item_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr citype = _swig_property(_ida_hexrays.ctree_item_t_citype_get, _ida_hexrays.ctree_item_t_citype_set) def __init__(self, *args): """ __init__(self) -> ctree_item_t """ this = _ida_hexrays.new_ctree_item_t(*args) try: self.this.append(this) except: self.this = this def get_memptr(self, *args): """ get_memptr(self, p_sptr=None) -> member_t * """ return _ida_hexrays.ctree_item_t_get_memptr(self, *args) def get_lvar(self, *args): """ get_lvar(self) -> lvar_t """ return _ida_hexrays.ctree_item_t_get_lvar(self, *args) def get_ea(self, *args): """ get_ea(self) -> ea_t """ return _ida_hexrays.ctree_item_t_get_ea(self, *args) def get_label_num(self, *args): """ get_label_num(self, gln_flags) -> int """ return _ida_hexrays.ctree_item_t_get_label_num(self, *args) def is_citem(self, *args): """ is_citem(self) -> bool """ return _ida_hexrays.ctree_item_t_is_citem(self, *args) def _get_it(self, *args): """ _get_it(self) -> citem_t """ return _ida_hexrays.ctree_item_t__get_it(self, *args) it = property(lambda self: self._get_it()) def _get_e(self, *args): """ _get_e(self) -> cexpr_t """ return _ida_hexrays.ctree_item_t__get_e(self, *args) e = property(lambda self: self._get_e()) def _get_i(self, *args): """ _get_i(self) -> cinsn_t """ return _ida_hexrays.ctree_item_t__get_i(self, *args) i = property(lambda self: self._get_i()) def _get_l(self, *args): """ _get_l(self) -> lvar_t """ return _ida_hexrays.ctree_item_t__get_l(self, *args) l = property(lambda self: self._get_l()) def _get_f(self, *args): """ _get_f(self) -> cfunc_t """ return _ida_hexrays.ctree_item_t__get_f(self, *args) f = property(lambda self: self._get_f()) loc = _swig_property(_ida_hexrays.ctree_item_t_loc_get) __swig_destroy__ = _ida_hexrays.delete_ctree_item_t __del__ = lambda self : None; ctree_item_t_swigregister = _ida_hexrays.ctree_item_t_swigregister ctree_item_t_swigregister(ctree_item_t) GLN_CURRENT = _ida_hexrays.GLN_CURRENT """ get label of the current item """ GLN_GOTO_TARGET = _ida_hexrays.GLN_GOTO_TARGET """ get goto target """ GLN_ALL = _ida_hexrays.GLN_ALL """ get both """ FORBID_UNUSED_LABELS = _ida_hexrays.FORBID_UNUSED_LABELS ALLOW_UNUSED_LABELS = _ida_hexrays.ALLOW_UNUSED_LABELS def _ll_lnot(*args): """ _ll_lnot(e) -> cexpr_t """ return _ida_hexrays._ll_lnot(*args) def _ll_new_block(*args): """ _ll_new_block() -> cinsn_t """ return _ida_hexrays._ll_new_block(*args) def _ll_create_helper(*args): """ _ll_create_helper(standalone, type, format) -> cexpr_t """ return _ida_hexrays._ll_create_helper(*args) def _ll_call_helper(*args): """ _ll_call_helper(rettype, args, format) -> cexpr_t """ return _ida_hexrays._ll_call_helper(*args) def _ll_make_num(*args): """ _ll_make_num(n, func=None, ea=BADADDR, opnum=0, sign=no_sign, size=0) -> cexpr_t """ return _ida_hexrays._ll_make_num(*args) def _ll_make_ref(*args): """ _ll_make_ref(e) -> cexpr_t """ return _ida_hexrays._ll_make_ref(*args) def _ll_dereference(*args): """ _ll_dereference(e, ptrsize, is_flt=False) -> cexpr_t """ return _ida_hexrays._ll_dereference(*args) def save_user_labels(*args): """ save_user_labels(func_ea, user_labels) Save user defined labels into the database. @param func_ea: the entry address of the function (C++: ea_t) @param user_labels: collection of user defined labels (C++: const user_labels_t *) """ return _ida_hexrays.save_user_labels(*args) def save_user_cmts(*args): """ save_user_cmts(func_ea, user_cmts) Save user defined comments into the database. @param func_ea: the entry address of the function (C++: ea_t) @param user_cmts: collection of user defined comments (C++: const user_cmts_t *) """ return _ida_hexrays.save_user_cmts(*args) def save_user_numforms(*args): """ save_user_numforms(func_ea, numforms) Save user defined number formats into the database. @param func_ea: the entry address of the function (C++: ea_t) @param numforms: collection of user defined comments (C++: const user_numforms_t *) """ return _ida_hexrays.save_user_numforms(*args) def save_user_iflags(*args): """ save_user_iflags(func_ea, iflags) Save user defined citem iflags into the database. @param func_ea: the entry address of the function (C++: ea_t) @param iflags: collection of user defined citem iflags (C++: const user_iflags_t *) """ return _ida_hexrays.save_user_iflags(*args) def save_user_unions(*args): """ save_user_unions(func_ea, unions) Save user defined union field selections into the database. @param func_ea: the entry address of the function (C++: ea_t) @param unions: collection of union field selections (C++: const user_unions_t *) """ return _ida_hexrays.save_user_unions(*args) def restore_user_labels(*args): """ restore_user_labels(func_ea) -> user_labels_t Restore user defined labels from the database. @param func_ea: the entry address of the function (C++: ea_t) @return: collection of user defined labels. The returned object must be deleted by the caller using delete_user_labels() """ return _ida_hexrays.restore_user_labels(*args) def restore_user_cmts(*args): """ restore_user_cmts(func_ea) -> user_cmts_t Restore user defined comments from the database. @param func_ea: the entry address of the function (C++: ea_t) @return: collection of user defined comments. The returned object must be deleted by the caller using delete_user_cmts() """ return _ida_hexrays.restore_user_cmts(*args) def restore_user_numforms(*args): """ restore_user_numforms(func_ea) -> user_numforms_t Restore user defined number formats from the database. @param func_ea: the entry address of the function (C++: ea_t) @return: collection of user defined number formats. The returned object must be deleted by the caller using delete_user_numforms() """ return _ida_hexrays.restore_user_numforms(*args) def restore_user_iflags(*args): """ restore_user_iflags(func_ea) -> user_iflags_t Restore user defined citem iflags from the database. @param func_ea: the entry address of the function (C++: ea_t) @return: collection of user defined iflags. The returned object must be deleted by the caller using delete_user_iflags() """ return _ida_hexrays.restore_user_iflags(*args) def restore_user_unions(*args): """ restore_user_unions(func_ea) -> user_unions_t Restore user defined union field selections from the database. @param func_ea: the entry address of the function (C++: ea_t) @return: collection of union field selections The returned object must be deleted by the caller using delete_user_unions() """ return _ida_hexrays.restore_user_unions(*args) class cfunc_t(object): """ Proxy of C++ cfunc_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr entry_ea = _swig_property(_ida_hexrays.cfunc_t_entry_ea_get, _ida_hexrays.cfunc_t_entry_ea_set) mba = _swig_property(_ida_hexrays.cfunc_t_mba_get, _ida_hexrays.cfunc_t_mba_set) body = _swig_property(_ida_hexrays.cfunc_t_body_get, _ida_hexrays.cfunc_t_body_set) argidx = _swig_property(_ida_hexrays.cfunc_t_argidx_get) maturity = _swig_property(_ida_hexrays.cfunc_t_maturity_get, _ida_hexrays.cfunc_t_maturity_set) user_labels = _swig_property(_ida_hexrays.cfunc_t_user_labels_get, _ida_hexrays.cfunc_t_user_labels_set) user_cmts = _swig_property(_ida_hexrays.cfunc_t_user_cmts_get, _ida_hexrays.cfunc_t_user_cmts_set) numforms = _swig_property(_ida_hexrays.cfunc_t_numforms_get, _ida_hexrays.cfunc_t_numforms_set) user_iflags = _swig_property(_ida_hexrays.cfunc_t_user_iflags_get, _ida_hexrays.cfunc_t_user_iflags_set) user_unions = _swig_property(_ida_hexrays.cfunc_t_user_unions_get, _ida_hexrays.cfunc_t_user_unions_set) refcnt = _swig_property(_ida_hexrays.cfunc_t_refcnt_get, _ida_hexrays.cfunc_t_refcnt_set) statebits = _swig_property(_ida_hexrays.cfunc_t_statebits_get, _ida_hexrays.cfunc_t_statebits_set) hdrlines = _swig_property(_ida_hexrays.cfunc_t_hdrlines_get, _ida_hexrays.cfunc_t_hdrlines_set) treeitems = _swig_property(_ida_hexrays.cfunc_t_treeitems_get, _ida_hexrays.cfunc_t_treeitems_set) __swig_destroy__ = _ida_hexrays.delete_cfunc_t __del__ = lambda self : None; def release(self, *args): """ release(self) """ return _ida_hexrays.cfunc_t_release(self, *args) def build_c_tree(self, *args): """ build_c_tree(self) """ return _ida_hexrays.cfunc_t_build_c_tree(self, *args) def verify(self, *args): """ verify(self, aul, even_without_debugger) """ return _ida_hexrays.cfunc_t_verify(self, *args) def print_dcl(self, *args): """ print_dcl(self) """ return _ida_hexrays.cfunc_t_print_dcl(self, *args) def print_func(self, *args): """ print_func(self, vp) """ return _ida_hexrays.cfunc_t_print_func(self, *args) def get_func_type(self, *args): """ get_func_type(self, type) -> bool """ return _ida_hexrays.cfunc_t_get_func_type(self, *args) def get_lvars(self, *args): """ get_lvars(self) -> lvars_t """ return _ida_hexrays.cfunc_t_get_lvars(self, *args) def get_stkoff_delta(self, *args): """ get_stkoff_delta(self) -> sval_t """ return _ida_hexrays.cfunc_t_get_stkoff_delta(self, *args) def find_label(self, *args): """ find_label(self, label) -> citem_t """ return _ida_hexrays.cfunc_t_find_label(self, *args) def remove_unused_labels(self, *args): """ remove_unused_labels(self) """ return _ida_hexrays.cfunc_t_remove_unused_labels(self, *args) def get_user_cmt(self, *args): """ get_user_cmt(self, loc, rt) -> char const * """ return _ida_hexrays.cfunc_t_get_user_cmt(self, *args) def set_user_cmt(self, *args): """ set_user_cmt(self, loc, cmt) """ return _ida_hexrays.cfunc_t_set_user_cmt(self, *args) def get_user_iflags(self, *args): """ get_user_iflags(self, loc) -> int32 """ return _ida_hexrays.cfunc_t_get_user_iflags(self, *args) def set_user_iflags(self, *args): """ set_user_iflags(self, loc, iflags) """ return _ida_hexrays.cfunc_t_set_user_iflags(self, *args) def has_orphan_cmts(self, *args): """ has_orphan_cmts(self) -> bool """ return _ida_hexrays.cfunc_t_has_orphan_cmts(self, *args) def del_orphan_cmts(self, *args): """ del_orphan_cmts(self) -> int """ return _ida_hexrays.cfunc_t_del_orphan_cmts(self, *args) def get_user_union_selection(self, *args): """ get_user_union_selection(self, ea, path) -> bool """ return _ida_hexrays.cfunc_t_get_user_union_selection(self, *args) def set_user_union_selection(self, *args): """ set_user_union_selection(self, ea, path) """ return _ida_hexrays.cfunc_t_set_user_union_selection(self, *args) def save_user_labels(self, *args): """ save_user_labels(self) """ return _ida_hexrays.cfunc_t_save_user_labels(self, *args) def save_user_cmts(self, *args): """ save_user_cmts(self) """ return _ida_hexrays.cfunc_t_save_user_cmts(self, *args) def save_user_numforms(self, *args): """ save_user_numforms(self) """ return _ida_hexrays.cfunc_t_save_user_numforms(self, *args) def save_user_iflags(self, *args): """ save_user_iflags(self) """ return _ida_hexrays.cfunc_t_save_user_iflags(self, *args) def save_user_unions(self, *args): """ save_user_unions(self) """ return _ida_hexrays.cfunc_t_save_user_unions(self, *args) def get_line_item(self, *args): """ get_line_item(self, line, x, is_ctree_line, phead, pitem, ptail) -> bool """ return _ida_hexrays.cfunc_t_get_line_item(self, *args) def get_warnings(self, *args): """ get_warnings(self) -> hexwarns_t """ return _ida_hexrays.cfunc_t_get_warnings(self, *args) def get_eamap(self, *args): """ get_eamap(self) -> eamap_t """ return _ida_hexrays.cfunc_t_get_eamap(self, *args) def get_boundaries(self, *args): """ get_boundaries(self) -> boundaries_t """ return _ida_hexrays.cfunc_t_get_boundaries(self, *args) def get_pseudocode(self, *args): """ get_pseudocode(self) -> strvec_t """ return _ida_hexrays.cfunc_t_get_pseudocode(self, *args) def refresh_func_ctext(self, *args): """ refresh_func_ctext(self) """ return _ida_hexrays.cfunc_t_refresh_func_ctext(self, *args) def gather_derefs(self, *args): """ gather_derefs(self, ci, udm=None) -> bool """ return _ida_hexrays.cfunc_t_gather_derefs(self, *args) def find_item_coords(self, *args): """ find_item_coords(self, item, px, py) -> bool find_item_coords(self, item) -> PyObject * """ return _ida_hexrays.cfunc_t_find_item_coords(self, *args) def __str__(self, *args): """ __str__(self) -> qstring """ return _ida_hexrays.cfunc_t___str__(self, *args) cfunc_t_swigregister = _ida_hexrays.cfunc_t_swigregister cfunc_t_swigregister(cfunc_t) CIT_COLLAPSED = _ida_hexrays.CIT_COLLAPSED """ display element in collapsed form """ CFS_BOUNDS = _ida_hexrays.CFS_BOUNDS """ 'eamap' and 'boundaries' are ready """ CFS_TEXT = _ida_hexrays.CFS_TEXT """ 'sv' is ready (and hdrlines) """ CFS_LVARS_HIDDEN = _ida_hexrays.CFS_LVARS_HIDDEN """ local variable definitions are collapsed """ DECOMP_NO_WAIT = _ida_hexrays.DECOMP_NO_WAIT """ do not display waitbox """ DECOMP_NO_CACHE = _ida_hexrays.DECOMP_NO_CACHE """ do not use decompilation cache """ DECOMP_NO_FRAME = _ida_hexrays.DECOMP_NO_FRAME """ do not use function frame info (only snippet mode) """ DECOMP_WARNINGS = _ida_hexrays.DECOMP_WARNINGS """ display warnings in the output window """ def decompile(*args): """ decompile(mbr, hf, flags=0) -> cfuncptr_t Decompile a snippet or a function. @param mbr: what to decompile (C++: const mba_ranges_t &) @param hf: extended error information (if failed) (C++: hexrays_failure_t *) @param flags: bitwise combination of decompile() flags ... bits (C++: int) @return: pointer to the decompilation result (a reference counted pointer). NULL if failed. """ return _ida_hexrays.decompile(*args) def decompile_func(*args): """ decompile_func(pfn, hf, flags=0) -> cfuncptr_t Decompile a function. Multiple decompilations of the same function return the same object. @param pfn: pointer to function to decompile (C++: func_t *) @param hf: extended error information (if failed) (C++: hexrays_failure_t *) @param flags: bitwise combination of decompile() flags ... bits (C++: int) @return: pointer to the decompilation result (a reference counted pointer). NULL if failed. """ return _ida_hexrays.decompile_func(*args) def gen_microcode(*args): """ gen_microcode(mbr, hf, retlist=None, flags=0, reqmat=MMAT_GLBOPT3) -> mbl_array_t Generate microcode of an arbitrary code snippet @param mbr: snippet ranges (C++: const mba_ranges_t &) @param hf: extended error information (if failed) (C++: hexrays_failure_t *) @param retlist: list of registers the snippet returns (C++: const mlist_t *) @param flags: bitwise combination of decompile() flags ... bits (C++: int) @param reqmat: required microcode maturity (C++: mba_maturity_t) @return: pointer to the microcode, NULL if failed. """ return _ida_hexrays.gen_microcode(*args) def mark_cfunc_dirty(*args): """ mark_cfunc_dirty(ea, close_views=False) -> bool Flush the cached decompilation results. Erases a cache entry for the specified function. @param ea: function to erase from the cache (C++: ea_t) @param close_views: close pseudocode windows that show the function (C++: bool) @return: if a cache entry existed. """ return _ida_hexrays.mark_cfunc_dirty(*args) def clear_cached_cfuncs(*args): """ clear_cached_cfuncs() Flush all cached decompilation results. """ return _ida_hexrays.clear_cached_cfuncs(*args) def has_cached_cfunc(*args): """ has_cached_cfunc(ea) -> bool Do we have a cached decompilation result for 'ea'? @param ea (C++: ea_t) """ return _ida_hexrays.has_cached_cfunc(*args) def get_ctype_name(*args): """ get_ctype_name(op) -> char const * """ return _ida_hexrays.get_ctype_name(*args) def create_field_name(*args): """ create_field_name(type, offset=BADADDR) -> qstring """ return _ida_hexrays.create_field_name(*args) hxe_flowchart = _ida_hexrays.hxe_flowchart hxe_stkpnts = _ida_hexrays.hxe_stkpnts hxe_prolog = _ida_hexrays.hxe_prolog hxe_microcode = _ida_hexrays.hxe_microcode hxe_preoptimized = _ida_hexrays.hxe_preoptimized hxe_locopt = _ida_hexrays.hxe_locopt hxe_prealloc = _ida_hexrays.hxe_prealloc hxe_glbopt = _ida_hexrays.hxe_glbopt hxe_structural = _ida_hexrays.hxe_structural hxe_maturity = _ida_hexrays.hxe_maturity hxe_interr = _ida_hexrays.hxe_interr hxe_combine = _ida_hexrays.hxe_combine hxe_print_func = _ida_hexrays.hxe_print_func hxe_func_printed = _ida_hexrays.hxe_func_printed hxe_resolve_stkaddrs = _ida_hexrays.hxe_resolve_stkaddrs hxe_open_pseudocode = _ida_hexrays.hxe_open_pseudocode hxe_switch_pseudocode = _ida_hexrays.hxe_switch_pseudocode hxe_refresh_pseudocode = _ida_hexrays.hxe_refresh_pseudocode hxe_close_pseudocode = _ida_hexrays.hxe_close_pseudocode hxe_keyboard = _ida_hexrays.hxe_keyboard hxe_right_click = _ida_hexrays.hxe_right_click hxe_double_click = _ida_hexrays.hxe_double_click hxe_curpos = _ida_hexrays.hxe_curpos hxe_create_hint = _ida_hexrays.hxe_create_hint hxe_text_ready = _ida_hexrays.hxe_text_ready hxe_populating_popup = _ida_hexrays.hxe_populating_popup lxe_lvar_name_changed = _ida_hexrays.lxe_lvar_name_changed lxe_lvar_type_changed = _ida_hexrays.lxe_lvar_type_changed lxe_lvar_cmt_changed = _ida_hexrays.lxe_lvar_cmt_changed lxe_lvar_mapping_changed = _ida_hexrays.lxe_lvar_mapping_changed hxe_cmt_changed = _ida_hexrays.hxe_cmt_changed USE_KEYBOARD = _ida_hexrays.USE_KEYBOARD USE_MOUSE = _ida_hexrays.USE_MOUSE class ctext_position_t(object): """ Proxy of C++ ctext_position_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr lnnum = _swig_property(_ida_hexrays.ctext_position_t_lnnum_get, _ida_hexrays.ctext_position_t_lnnum_set) x = _swig_property(_ida_hexrays.ctext_position_t_x_get, _ida_hexrays.ctext_position_t_x_set) y = _swig_property(_ida_hexrays.ctext_position_t_y_get, _ida_hexrays.ctext_position_t_y_set) def in_ctree(self, *args): """ in_ctree(self, hdrlines) -> bool """ return _ida_hexrays.ctext_position_t_in_ctree(self, *args) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.ctext_position_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.ctext_position_t___ne__(self, *args) def __lt__(self, *args): """ __lt__(self, r) -> bool """ return _ida_hexrays.ctext_position_t___lt__(self, *args) def __gt__(self, *args): """ __gt__(self, r) -> bool """ return _ida_hexrays.ctext_position_t___gt__(self, *args) def __le__(self, *args): """ __le__(self, r) -> bool """ return _ida_hexrays.ctext_position_t___le__(self, *args) def __ge__(self, *args): """ __ge__(self, r) -> bool """ return _ida_hexrays.ctext_position_t___ge__(self, *args) def compare(self, *args): """ compare(self, r) -> int """ return _ida_hexrays.ctext_position_t_compare(self, *args) def __init__(self, *args): """ __init__(self, _lnnum=-1, _x=0, _y=0) -> ctext_position_t """ this = _ida_hexrays.new_ctext_position_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_ctext_position_t __del__ = lambda self : None; ctext_position_t_swigregister = _ida_hexrays.ctext_position_t_swigregister ctext_position_t_swigregister(ctext_position_t) HEXRAYS_API_MAGIC = cvar.HEXRAYS_API_MAGIC class history_item_t(ctext_position_t): """ Proxy of C++ history_item_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr ea = _swig_property(_ida_hexrays.history_item_t_ea_get, _ida_hexrays.history_item_t_ea_set) end = _swig_property(_ida_hexrays.history_item_t_end_get, _ida_hexrays.history_item_t_end_set) def __init__(self, *args): """ __init__(self, _ea=BADADDR, _lnnum=-1, _x=0, _y=0) -> history_item_t __init__(self, _ea, p) -> history_item_t """ this = _ida_hexrays.new_history_item_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_history_item_t __del__ = lambda self : None; history_item_t_swigregister = _ida_hexrays.history_item_t_swigregister history_item_t_swigregister(history_item_t) class vdui_t(object): """ Proxy of C++ vdui_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') def __init__(self, *args, **kwargs): raise AttributeError("No constructor defined") __repr__ = _swig_repr flags = _swig_property(_ida_hexrays.vdui_t_flags_get, _ida_hexrays.vdui_t_flags_set) def visible(self, *args): """ visible(self) -> bool """ return _ida_hexrays.vdui_t_visible(self, *args) def valid(self, *args): """ valid(self) -> bool """ return _ida_hexrays.vdui_t_valid(self, *args) def locked(self, *args): """ locked(self) -> bool """ return _ida_hexrays.vdui_t_locked(self, *args) def set_visible(self, *args): """ set_visible(self, v) """ return _ida_hexrays.vdui_t_set_visible(self, *args) def set_valid(self, *args): """ set_valid(self, v) """ return _ida_hexrays.vdui_t_set_valid(self, *args) def set_locked(self, *args): """ set_locked(self, v) -> bool """ return _ida_hexrays.vdui_t_set_locked(self, *args) view_idx = _swig_property(_ida_hexrays.vdui_t_view_idx_get, _ida_hexrays.vdui_t_view_idx_set) ct = _swig_property(_ida_hexrays.vdui_t_ct_get, _ida_hexrays.vdui_t_ct_set) toplevel = _swig_property(_ida_hexrays.vdui_t_toplevel_get, _ida_hexrays.vdui_t_toplevel_set) mba = _swig_property(_ida_hexrays.vdui_t_mba_get, _ida_hexrays.vdui_t_mba_set) cfunc = _swig_property(_ida_hexrays.vdui_t_cfunc_get, _ida_hexrays.vdui_t_cfunc_set) last_code = _swig_property(_ida_hexrays.vdui_t_last_code_get, _ida_hexrays.vdui_t_last_code_set) cpos = _swig_property(_ida_hexrays.vdui_t_cpos_get, _ida_hexrays.vdui_t_cpos_set) head = _swig_property(_ida_hexrays.vdui_t_head_get, _ida_hexrays.vdui_t_head_set) item = _swig_property(_ida_hexrays.vdui_t_item_get, _ida_hexrays.vdui_t_item_set) tail = _swig_property(_ida_hexrays.vdui_t_tail_get, _ida_hexrays.vdui_t_tail_set) def refresh_view(self, *args): """ refresh_view(self, redo_mba) """ return _ida_hexrays.vdui_t_refresh_view(self, *args) def refresh_ctext(self, *args): """ refresh_ctext(self, activate=True) """ return _ida_hexrays.vdui_t_refresh_ctext(self, *args) def switch_to(self, *args): """ switch_to(self, f, activate) """ return _ida_hexrays.vdui_t_switch_to(self, *args) def in_ctree(self, *args): """ in_ctree(self) -> bool """ return _ida_hexrays.vdui_t_in_ctree(self, *args) def get_number(self, *args): """ get_number(self) -> cnumber_t """ return _ida_hexrays.vdui_t_get_number(self, *args) def get_current_label(self, *args): """ get_current_label(self) -> int """ return _ida_hexrays.vdui_t_get_current_label(self, *args) def clear(self, *args): """ clear(self) """ return _ida_hexrays.vdui_t_clear(self, *args) def refresh_cpos(self, *args): """ refresh_cpos(self, idv) -> bool """ return _ida_hexrays.vdui_t_refresh_cpos(self, *args) def get_current_item(self, *args): """ get_current_item(self, idv) -> bool """ return _ida_hexrays.vdui_t_get_current_item(self, *args) def ui_rename_lvar(self, *args): """ ui_rename_lvar(self, v) -> bool """ return _ida_hexrays.vdui_t_ui_rename_lvar(self, *args) def rename_lvar(self, *args): """ rename_lvar(self, v, name, is_user_name) -> bool """ return _ida_hexrays.vdui_t_rename_lvar(self, *args) def ui_set_call_type(self, *args): """ ui_set_call_type(self, e) -> bool """ return _ida_hexrays.vdui_t_ui_set_call_type(self, *args) def ui_set_lvar_type(self, *args): """ ui_set_lvar_type(self, v) -> bool """ return _ida_hexrays.vdui_t_ui_set_lvar_type(self, *args) def set_lvar_type(self, *args): """ set_lvar_type(self, v, type) -> bool """ return _ida_hexrays.vdui_t_set_lvar_type(self, *args) def set_noptr_lvar(self, *args): """ set_noptr_lvar(self, v) -> bool """ return _ida_hexrays.vdui_t_set_noptr_lvar(self, *args) def ui_edit_lvar_cmt(self, *args): """ ui_edit_lvar_cmt(self, v) -> bool """ return _ida_hexrays.vdui_t_ui_edit_lvar_cmt(self, *args) def set_lvar_cmt(self, *args): """ set_lvar_cmt(self, v, cmt) -> bool """ return _ida_hexrays.vdui_t_set_lvar_cmt(self, *args) def ui_map_lvar(self, *args): """ ui_map_lvar(self, v) -> bool """ return _ida_hexrays.vdui_t_ui_map_lvar(self, *args) def ui_unmap_lvar(self, *args): """ ui_unmap_lvar(self, v) -> bool """ return _ida_hexrays.vdui_t_ui_unmap_lvar(self, *args) def map_lvar(self, *args): """ map_lvar(self, frm, to) -> bool """ return _ida_hexrays.vdui_t_map_lvar(self, *args) def set_strmem_type(self, *args): """ set_strmem_type(self, sptr, mptr) -> bool """ return _ida_hexrays.vdui_t_set_strmem_type(self, *args) def rename_strmem(self, *args): """ rename_strmem(self, sptr, mptr) -> bool """ return _ida_hexrays.vdui_t_rename_strmem(self, *args) def set_global_type(self, *args): """ set_global_type(self, ea) -> bool """ return _ida_hexrays.vdui_t_set_global_type(self, *args) def rename_global(self, *args): """ rename_global(self, ea) -> bool """ return _ida_hexrays.vdui_t_rename_global(self, *args) def rename_label(self, *args): """ rename_label(self, label) -> bool """ return _ida_hexrays.vdui_t_rename_label(self, *args) def jump_enter(self, *args): """ jump_enter(self, idv, omflags) -> bool """ return _ida_hexrays.vdui_t_jump_enter(self, *args) def ctree_to_disasm(self, *args): """ ctree_to_disasm(self) -> bool """ return _ida_hexrays.vdui_t_ctree_to_disasm(self, *args) def calc_cmt_type(self, *args): """ calc_cmt_type(self, lnnum, cmttype) -> cmt_type_t """ return _ida_hexrays.vdui_t_calc_cmt_type(self, *args) def edit_cmt(self, *args): """ edit_cmt(self, loc) -> bool """ return _ida_hexrays.vdui_t_edit_cmt(self, *args) def edit_func_cmt(self, *args): """ edit_func_cmt(self) -> bool """ return _ida_hexrays.vdui_t_edit_func_cmt(self, *args) def del_orphan_cmts(self, *args): """ del_orphan_cmts(self) -> bool """ return _ida_hexrays.vdui_t_del_orphan_cmts(self, *args) def set_num_radix(self, *args): """ set_num_radix(self, base) -> bool """ return _ida_hexrays.vdui_t_set_num_radix(self, *args) def set_num_enum(self, *args): """ set_num_enum(self) -> bool """ return _ida_hexrays.vdui_t_set_num_enum(self, *args) def set_num_stroff(self, *args): """ set_num_stroff(self) -> bool """ return _ida_hexrays.vdui_t_set_num_stroff(self, *args) def invert_sign(self, *args): """ invert_sign(self) -> bool """ return _ida_hexrays.vdui_t_invert_sign(self, *args) def invert_bits(self, *args): """ invert_bits(self) -> bool """ return _ida_hexrays.vdui_t_invert_bits(self, *args) def collapse_item(self, *args): """ collapse_item(self, hide) -> bool """ return _ida_hexrays.vdui_t_collapse_item(self, *args) def collapse_lvars(self, *args): """ collapse_lvars(self, hide) -> bool """ return _ida_hexrays.vdui_t_collapse_lvars(self, *args) def split_item(self, *args): """ split_item(self, split) -> bool """ return _ida_hexrays.vdui_t_split_item(self, *args) __swig_destroy__ = _ida_hexrays.delete_vdui_t __del__ = lambda self : None; vdui_t_swigregister = _ida_hexrays.vdui_t_swigregister vdui_t_swigregister(vdui_t) CMT_NONE = cvar.CMT_NONE CMT_TAIL = cvar.CMT_TAIL CMT_BLOCK1 = cvar.CMT_BLOCK1 CMT_BLOCK2 = cvar.CMT_BLOCK2 CMT_LVAR = cvar.CMT_LVAR CMT_FUNC = cvar.CMT_FUNC CMT_ALL = cvar.CMT_ALL VDUI_VISIBLE = _ida_hexrays.VDUI_VISIBLE """ is visible? """ VDUI_VALID = _ida_hexrays.VDUI_VALID """ is valid? """ VDUI_LOCKED = _ida_hexrays.VDUI_LOCKED """ is locked? """ class ui_stroff_op_t(object): """ Proxy of C++ ui_stroff_op_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr text = _swig_property(_ida_hexrays.ui_stroff_op_t_text_get, _ida_hexrays.ui_stroff_op_t_text_set) offset = _swig_property(_ida_hexrays.ui_stroff_op_t_offset_get, _ida_hexrays.ui_stroff_op_t_offset_set) def __eq__(self, *args): """ __eq__(self, r) -> bool """ return _ida_hexrays.ui_stroff_op_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, r) -> bool """ return _ida_hexrays.ui_stroff_op_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> ui_stroff_op_t """ this = _ida_hexrays.new_ui_stroff_op_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_ui_stroff_op_t __del__ = lambda self : None; ui_stroff_op_t_swigregister = _ida_hexrays.ui_stroff_op_t_swigregister ui_stroff_op_t_swigregister(ui_stroff_op_t) class ui_stroff_applicator_t(object): """ Proxy of C++ ui_stroff_applicator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr def apply(self, *args): """ apply(self, opnum, path) -> bool """ return _ida_hexrays.ui_stroff_applicator_t_apply(self, *args) def __init__(self, *args): """ __init__(self) -> ui_stroff_applicator_t """ if self.__class__ == ui_stroff_applicator_t: _self = None else: _self = self this = _ida_hexrays.new_ui_stroff_applicator_t(_self, *args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_ui_stroff_applicator_t __del__ = lambda self : None; def __disown__(self): self.this.disown() _ida_hexrays.disown_ui_stroff_applicator_t(self) return weakref_proxy(self) ui_stroff_applicator_t_swigregister = _ida_hexrays.ui_stroff_applicator_t_swigregister ui_stroff_applicator_t_swigregister(ui_stroff_applicator_t) def select_udt_by_offset(*args): """ select_udt_by_offset(udts, ops, applicator) -> int Select UDT @param udts: list of UDT tinfo_t for the selection, if NULL or empty then UDTs from the "Local types" will be used (C++: const qvector < tinfo_t > *) @param ops: operands (C++: const ui_stroff_ops_t &) @param applicator (C++: ui_stroff_applicator_t &) """ return _ida_hexrays.select_udt_by_offset(*args) hx_user_numforms_begin = _ida_hexrays.hx_user_numforms_begin hx_user_numforms_end = _ida_hexrays.hx_user_numforms_end hx_user_numforms_next = _ida_hexrays.hx_user_numforms_next hx_user_numforms_prev = _ida_hexrays.hx_user_numforms_prev hx_user_numforms_first = _ida_hexrays.hx_user_numforms_first hx_user_numforms_second = _ida_hexrays.hx_user_numforms_second hx_user_numforms_find = _ida_hexrays.hx_user_numforms_find hx_user_numforms_insert = _ida_hexrays.hx_user_numforms_insert hx_user_numforms_erase = _ida_hexrays.hx_user_numforms_erase hx_user_numforms_clear = _ida_hexrays.hx_user_numforms_clear hx_user_numforms_size = _ida_hexrays.hx_user_numforms_size hx_user_numforms_free = _ida_hexrays.hx_user_numforms_free hx_user_numforms_new = _ida_hexrays.hx_user_numforms_new hx_lvar_mapping_begin = _ida_hexrays.hx_lvar_mapping_begin hx_lvar_mapping_end = _ida_hexrays.hx_lvar_mapping_end hx_lvar_mapping_next = _ida_hexrays.hx_lvar_mapping_next hx_lvar_mapping_prev = _ida_hexrays.hx_lvar_mapping_prev hx_lvar_mapping_first = _ida_hexrays.hx_lvar_mapping_first hx_lvar_mapping_second = _ida_hexrays.hx_lvar_mapping_second hx_lvar_mapping_find = _ida_hexrays.hx_lvar_mapping_find hx_lvar_mapping_insert = _ida_hexrays.hx_lvar_mapping_insert hx_lvar_mapping_erase = _ida_hexrays.hx_lvar_mapping_erase hx_lvar_mapping_clear = _ida_hexrays.hx_lvar_mapping_clear hx_lvar_mapping_size = _ida_hexrays.hx_lvar_mapping_size hx_lvar_mapping_free = _ida_hexrays.hx_lvar_mapping_free hx_lvar_mapping_new = _ida_hexrays.hx_lvar_mapping_new hx_udcall_map_begin = _ida_hexrays.hx_udcall_map_begin hx_udcall_map_end = _ida_hexrays.hx_udcall_map_end hx_udcall_map_next = _ida_hexrays.hx_udcall_map_next hx_udcall_map_prev = _ida_hexrays.hx_udcall_map_prev hx_udcall_map_first = _ida_hexrays.hx_udcall_map_first hx_udcall_map_second = _ida_hexrays.hx_udcall_map_second hx_udcall_map_find = _ida_hexrays.hx_udcall_map_find hx_udcall_map_insert = _ida_hexrays.hx_udcall_map_insert hx_udcall_map_erase = _ida_hexrays.hx_udcall_map_erase hx_udcall_map_clear = _ida_hexrays.hx_udcall_map_clear hx_udcall_map_size = _ida_hexrays.hx_udcall_map_size hx_udcall_map_free = _ida_hexrays.hx_udcall_map_free hx_udcall_map_new = _ida_hexrays.hx_udcall_map_new hx_user_cmts_begin = _ida_hexrays.hx_user_cmts_begin hx_user_cmts_end = _ida_hexrays.hx_user_cmts_end hx_user_cmts_next = _ida_hexrays.hx_user_cmts_next hx_user_cmts_prev = _ida_hexrays.hx_user_cmts_prev hx_user_cmts_first = _ida_hexrays.hx_user_cmts_first hx_user_cmts_second = _ida_hexrays.hx_user_cmts_second hx_user_cmts_find = _ida_hexrays.hx_user_cmts_find hx_user_cmts_insert = _ida_hexrays.hx_user_cmts_insert hx_user_cmts_erase = _ida_hexrays.hx_user_cmts_erase hx_user_cmts_clear = _ida_hexrays.hx_user_cmts_clear hx_user_cmts_size = _ida_hexrays.hx_user_cmts_size hx_user_cmts_free = _ida_hexrays.hx_user_cmts_free hx_user_cmts_new = _ida_hexrays.hx_user_cmts_new hx_user_iflags_begin = _ida_hexrays.hx_user_iflags_begin hx_user_iflags_end = _ida_hexrays.hx_user_iflags_end hx_user_iflags_next = _ida_hexrays.hx_user_iflags_next hx_user_iflags_prev = _ida_hexrays.hx_user_iflags_prev hx_user_iflags_first = _ida_hexrays.hx_user_iflags_first hx_user_iflags_second = _ida_hexrays.hx_user_iflags_second hx_user_iflags_find = _ida_hexrays.hx_user_iflags_find hx_user_iflags_insert = _ida_hexrays.hx_user_iflags_insert hx_user_iflags_erase = _ida_hexrays.hx_user_iflags_erase hx_user_iflags_clear = _ida_hexrays.hx_user_iflags_clear hx_user_iflags_size = _ida_hexrays.hx_user_iflags_size hx_user_iflags_free = _ida_hexrays.hx_user_iflags_free hx_user_iflags_new = _ida_hexrays.hx_user_iflags_new hx_user_unions_begin = _ida_hexrays.hx_user_unions_begin hx_user_unions_end = _ida_hexrays.hx_user_unions_end hx_user_unions_next = _ida_hexrays.hx_user_unions_next hx_user_unions_prev = _ida_hexrays.hx_user_unions_prev hx_user_unions_first = _ida_hexrays.hx_user_unions_first hx_user_unions_second = _ida_hexrays.hx_user_unions_second hx_user_unions_find = _ida_hexrays.hx_user_unions_find hx_user_unions_insert = _ida_hexrays.hx_user_unions_insert hx_user_unions_erase = _ida_hexrays.hx_user_unions_erase hx_user_unions_clear = _ida_hexrays.hx_user_unions_clear hx_user_unions_size = _ida_hexrays.hx_user_unions_size hx_user_unions_free = _ida_hexrays.hx_user_unions_free hx_user_unions_new = _ida_hexrays.hx_user_unions_new hx_user_labels_begin = _ida_hexrays.hx_user_labels_begin hx_user_labels_end = _ida_hexrays.hx_user_labels_end hx_user_labels_next = _ida_hexrays.hx_user_labels_next hx_user_labels_prev = _ida_hexrays.hx_user_labels_prev hx_user_labels_first = _ida_hexrays.hx_user_labels_first hx_user_labels_second = _ida_hexrays.hx_user_labels_second hx_user_labels_find = _ida_hexrays.hx_user_labels_find hx_user_labels_insert = _ida_hexrays.hx_user_labels_insert hx_user_labels_erase = _ida_hexrays.hx_user_labels_erase hx_user_labels_clear = _ida_hexrays.hx_user_labels_clear hx_user_labels_size = _ida_hexrays.hx_user_labels_size hx_user_labels_free = _ida_hexrays.hx_user_labels_free hx_user_labels_new = _ida_hexrays.hx_user_labels_new hx_eamap_begin = _ida_hexrays.hx_eamap_begin hx_eamap_end = _ida_hexrays.hx_eamap_end hx_eamap_next = _ida_hexrays.hx_eamap_next hx_eamap_prev = _ida_hexrays.hx_eamap_prev hx_eamap_first = _ida_hexrays.hx_eamap_first hx_eamap_second = _ida_hexrays.hx_eamap_second hx_eamap_find = _ida_hexrays.hx_eamap_find hx_eamap_insert = _ida_hexrays.hx_eamap_insert hx_eamap_erase = _ida_hexrays.hx_eamap_erase hx_eamap_clear = _ida_hexrays.hx_eamap_clear hx_eamap_size = _ida_hexrays.hx_eamap_size hx_eamap_free = _ida_hexrays.hx_eamap_free hx_eamap_new = _ida_hexrays.hx_eamap_new hx_boundaries_begin = _ida_hexrays.hx_boundaries_begin hx_boundaries_end = _ida_hexrays.hx_boundaries_end hx_boundaries_next = _ida_hexrays.hx_boundaries_next hx_boundaries_prev = _ida_hexrays.hx_boundaries_prev hx_boundaries_first = _ida_hexrays.hx_boundaries_first hx_boundaries_second = _ida_hexrays.hx_boundaries_second hx_boundaries_find = _ida_hexrays.hx_boundaries_find hx_boundaries_insert = _ida_hexrays.hx_boundaries_insert hx_boundaries_erase = _ida_hexrays.hx_boundaries_erase hx_boundaries_clear = _ida_hexrays.hx_boundaries_clear hx_boundaries_size = _ida_hexrays.hx_boundaries_size hx_boundaries_free = _ida_hexrays.hx_boundaries_free hx_boundaries_new = _ida_hexrays.hx_boundaries_new hx_block_chains_begin = _ida_hexrays.hx_block_chains_begin hx_block_chains_end = _ida_hexrays.hx_block_chains_end hx_block_chains_next = _ida_hexrays.hx_block_chains_next hx_block_chains_prev = _ida_hexrays.hx_block_chains_prev hx_block_chains_get = _ida_hexrays.hx_block_chains_get hx_block_chains_find = _ida_hexrays.hx_block_chains_find hx_block_chains_insert = _ida_hexrays.hx_block_chains_insert hx_block_chains_erase = _ida_hexrays.hx_block_chains_erase hx_block_chains_clear = _ida_hexrays.hx_block_chains_clear hx_block_chains_size = _ida_hexrays.hx_block_chains_size hx_block_chains_free = _ida_hexrays.hx_block_chains_free hx_block_chains_new = _ida_hexrays.hx_block_chains_new hx_valrng_t_clear = _ida_hexrays.hx_valrng_t_clear hx_valrng_t_copy = _ida_hexrays.hx_valrng_t_copy hx_valrng_t_assign = _ida_hexrays.hx_valrng_t_assign hx_valrng_t_compare = _ida_hexrays.hx_valrng_t_compare hx_valrng_t_set_eq = _ida_hexrays.hx_valrng_t_set_eq hx_valrng_t_set_cmp = _ida_hexrays.hx_valrng_t_set_cmp hx_valrng_t_reduce_size = _ida_hexrays.hx_valrng_t_reduce_size hx_valrng_t_intersect_with = _ida_hexrays.hx_valrng_t_intersect_with hx_valrng_t_unite_with = _ida_hexrays.hx_valrng_t_unite_with hx_valrng_t_inverse = _ida_hexrays.hx_valrng_t_inverse hx_valrng_t_has = _ida_hexrays.hx_valrng_t_has hx_valrng_t_print = _ida_hexrays.hx_valrng_t_print hx_valrng_t_dstr = _ida_hexrays.hx_valrng_t_dstr hx_valrng_t_cvt_to_single_value = _ida_hexrays.hx_valrng_t_cvt_to_single_value hx_valrng_t_cvt_to_cmp = _ida_hexrays.hx_valrng_t_cvt_to_cmp hx_get_merror_desc = _ida_hexrays.hx_get_merror_desc hx_reg2mreg = _ida_hexrays.hx_reg2mreg hx_mreg2reg = _ida_hexrays.hx_mreg2reg hx_install_optinsn_handler = _ida_hexrays.hx_install_optinsn_handler hx_remove_optinsn_handler = _ida_hexrays.hx_remove_optinsn_handler hx_install_optblock_handler = _ida_hexrays.hx_install_optblock_handler hx_remove_optblock_handler = _ida_hexrays.hx_remove_optblock_handler hx_must_mcode_close_block = _ida_hexrays.hx_must_mcode_close_block hx_is_mcode_propagatable = _ida_hexrays.hx_is_mcode_propagatable hx_negate_mcode_relation = _ida_hexrays.hx_negate_mcode_relation hx_swap_mcode_relation = _ida_hexrays.hx_swap_mcode_relation hx_get_signed_mcode = _ida_hexrays.hx_get_signed_mcode hx_get_unsigned_mcode = _ida_hexrays.hx_get_unsigned_mcode hx_mcode_modifies_d = _ida_hexrays.hx_mcode_modifies_d hx_operand_locator_t_compare = _ida_hexrays.hx_operand_locator_t_compare hx_vd_printer_t_print = _ida_hexrays.hx_vd_printer_t_print hx_file_printer_t_print = _ida_hexrays.hx_file_printer_t_print hx_qstring_printer_t_print = _ida_hexrays.hx_qstring_printer_t_print hx_dstr = _ida_hexrays.hx_dstr hx_is_type_correct = _ida_hexrays.hx_is_type_correct hx_is_small_udt = _ida_hexrays.hx_is_small_udt hx_is_nonbool_type = _ida_hexrays.hx_is_nonbool_type hx_is_bool_type = _ida_hexrays.hx_is_bool_type hx_partial_type_num = _ida_hexrays.hx_partial_type_num hx_get_float_type = _ida_hexrays.hx_get_float_type hx_get_int_type_by_width_and_sign = _ida_hexrays.hx_get_int_type_by_width_and_sign hx_get_unk_type = _ida_hexrays.hx_get_unk_type hx_dummy_ptrtype = _ida_hexrays.hx_dummy_ptrtype hx_get_member_type = _ida_hexrays.hx_get_member_type hx_make_pointer = _ida_hexrays.hx_make_pointer hx_create_typedef = _ida_hexrays.hx_create_typedef hx_get_type = _ida_hexrays.hx_get_type hx_set_type = _ida_hexrays.hx_set_type hx_vdloc_t_dstr = _ida_hexrays.hx_vdloc_t_dstr hx_vdloc_t_compare = _ida_hexrays.hx_vdloc_t_compare hx_vdloc_t_is_aliasable = _ida_hexrays.hx_vdloc_t_is_aliasable hx_print_vdloc = _ida_hexrays.hx_print_vdloc hx_arglocs_overlap = _ida_hexrays.hx_arglocs_overlap hx_lvar_locator_t_compare = _ida_hexrays.hx_lvar_locator_t_compare hx_lvar_locator_t_dstr = _ida_hexrays.hx_lvar_locator_t_dstr hx_lvar_t_dstr = _ida_hexrays.hx_lvar_t_dstr hx_lvar_t_is_promoted_arg = _ida_hexrays.hx_lvar_t_is_promoted_arg hx_lvar_t_accepts_type = _ida_hexrays.hx_lvar_t_accepts_type hx_lvar_t_set_lvar_type = _ida_hexrays.hx_lvar_t_set_lvar_type hx_lvar_t_set_width = _ida_hexrays.hx_lvar_t_set_width hx_lvar_t_append_list = _ida_hexrays.hx_lvar_t_append_list hx_lvars_t_find_stkvar = _ida_hexrays.hx_lvars_t_find_stkvar hx_lvars_t_find = _ida_hexrays.hx_lvars_t_find hx_lvars_t_find_lvar = _ida_hexrays.hx_lvars_t_find_lvar hx_restore_user_lvar_settings = _ida_hexrays.hx_restore_user_lvar_settings hx_save_user_lvar_settings = _ida_hexrays.hx_save_user_lvar_settings hx_modify_user_lvars = _ida_hexrays.hx_modify_user_lvars hx_restore_user_defined_calls = _ida_hexrays.hx_restore_user_defined_calls hx_save_user_defined_calls = _ida_hexrays.hx_save_user_defined_calls hx_parse_user_call = _ida_hexrays.hx_parse_user_call hx_convert_to_user_call = _ida_hexrays.hx_convert_to_user_call hx_install_microcode_filter = _ida_hexrays.hx_install_microcode_filter hx_udc_filter_t_init = _ida_hexrays.hx_udc_filter_t_init hx_udc_filter_t_apply = _ida_hexrays.hx_udc_filter_t_apply hx_bitset_t_bitset_t = _ida_hexrays.hx_bitset_t_bitset_t hx_bitset_t_copy = _ida_hexrays.hx_bitset_t_copy hx_bitset_t_add = _ida_hexrays.hx_bitset_t_add hx_bitset_t_add_ = _ida_hexrays.hx_bitset_t_add_ hx_bitset_t_add__ = _ida_hexrays.hx_bitset_t_add__ hx_bitset_t_sub = _ida_hexrays.hx_bitset_t_sub hx_bitset_t_sub_ = _ida_hexrays.hx_bitset_t_sub_ hx_bitset_t_sub__ = _ida_hexrays.hx_bitset_t_sub__ hx_bitset_t_cut_at = _ida_hexrays.hx_bitset_t_cut_at hx_bitset_t_shift_down = _ida_hexrays.hx_bitset_t_shift_down hx_bitset_t_has = _ida_hexrays.hx_bitset_t_has hx_bitset_t_has_all = _ida_hexrays.hx_bitset_t_has_all hx_bitset_t_has_any = _ida_hexrays.hx_bitset_t_has_any hx_bitset_t_dstr = _ida_hexrays.hx_bitset_t_dstr hx_bitset_t_empty = _ida_hexrays.hx_bitset_t_empty hx_bitset_t_count = _ida_hexrays.hx_bitset_t_count hx_bitset_t_count_ = _ida_hexrays.hx_bitset_t_count_ hx_bitset_t_last = _ida_hexrays.hx_bitset_t_last hx_bitset_t_fill_with_ones = _ida_hexrays.hx_bitset_t_fill_with_ones hx_bitset_t_has_common = _ida_hexrays.hx_bitset_t_has_common hx_bitset_t_intersect = _ida_hexrays.hx_bitset_t_intersect hx_bitset_t_is_subset_of = _ida_hexrays.hx_bitset_t_is_subset_of hx_bitset_t_compare = _ida_hexrays.hx_bitset_t_compare hx_bitset_t_goup = _ida_hexrays.hx_bitset_t_goup hx_ivl_t_dstr = _ida_hexrays.hx_ivl_t_dstr hx_ivl_t_compare = _ida_hexrays.hx_ivl_t_compare hx_ivlset_t_add = _ida_hexrays.hx_ivlset_t_add hx_ivlset_t_add_ = _ida_hexrays.hx_ivlset_t_add_ hx_ivlset_t_addmasked = _ida_hexrays.hx_ivlset_t_addmasked hx_ivlset_t_sub = _ida_hexrays.hx_ivlset_t_sub hx_ivlset_t_sub_ = _ida_hexrays.hx_ivlset_t_sub_ hx_ivlset_t_has_common = _ida_hexrays.hx_ivlset_t_has_common hx_ivlset_t_print = _ida_hexrays.hx_ivlset_t_print hx_ivlset_t_dstr = _ida_hexrays.hx_ivlset_t_dstr hx_ivlset_t_count = _ida_hexrays.hx_ivlset_t_count hx_ivlset_t_has_common_ = _ida_hexrays.hx_ivlset_t_has_common_ hx_ivlset_t_contains = _ida_hexrays.hx_ivlset_t_contains hx_ivlset_t_includes = _ida_hexrays.hx_ivlset_t_includes hx_ivlset_t_intersect = _ida_hexrays.hx_ivlset_t_intersect hx_ivlset_t_compare = _ida_hexrays.hx_ivlset_t_compare hx_get_mreg_name = _ida_hexrays.hx_get_mreg_name hx_rlist_t_print = _ida_hexrays.hx_rlist_t_print hx_rlist_t_dstr = _ida_hexrays.hx_rlist_t_dstr hx_mlist_t_addmem = _ida_hexrays.hx_mlist_t_addmem hx_mlist_t_print = _ida_hexrays.hx_mlist_t_print hx_mlist_t_dstr = _ida_hexrays.hx_mlist_t_dstr hx_mlist_t_compare = _ida_hexrays.hx_mlist_t_compare hx_lvar_ref_t_compare = _ida_hexrays.hx_lvar_ref_t_compare hx_lvar_ref_t_var = _ida_hexrays.hx_lvar_ref_t_var hx_stkvar_ref_t_compare = _ida_hexrays.hx_stkvar_ref_t_compare hx_stkvar_ref_t_get_stkvar = _ida_hexrays.hx_stkvar_ref_t_get_stkvar hx_fnumber_t_print = _ida_hexrays.hx_fnumber_t_print hx_fnumber_t_dstr = _ida_hexrays.hx_fnumber_t_dstr hx_mop_t_copy = _ida_hexrays.hx_mop_t_copy hx_mop_t_assign = _ida_hexrays.hx_mop_t_assign hx_mop_t_swap = _ida_hexrays.hx_mop_t_swap hx_mop_t_erase = _ida_hexrays.hx_mop_t_erase hx_mop_t_print = _ida_hexrays.hx_mop_t_print hx_mop_t_dstr = _ida_hexrays.hx_mop_t_dstr hx_mop_t_create_from_mlist = _ida_hexrays.hx_mop_t_create_from_mlist hx_mop_t_create_from_ivlset = _ida_hexrays.hx_mop_t_create_from_ivlset hx_mop_t_create_from_vdloc = _ida_hexrays.hx_mop_t_create_from_vdloc hx_mop_t_create_from_scattered_vdloc = _ida_hexrays.hx_mop_t_create_from_scattered_vdloc hx_mop_t_create_from_insn = _ida_hexrays.hx_mop_t_create_from_insn hx_mop_t_make_number = _ida_hexrays.hx_mop_t_make_number hx_mop_t_make_fpnum = _ida_hexrays.hx_mop_t_make_fpnum hx_mop_t_make_reg_pair = _ida_hexrays.hx_mop_t_make_reg_pair hx_mop_t_make_helper = _ida_hexrays.hx_mop_t_make_helper hx_mop_t_is_bit_reg = _ida_hexrays.hx_mop_t_is_bit_reg hx_mop_t_may_use_aliased_memory = _ida_hexrays.hx_mop_t_may_use_aliased_memory hx_mop_t_is01 = _ida_hexrays.hx_mop_t_is01 hx_mop_t_is_sign_extended_from = _ida_hexrays.hx_mop_t_is_sign_extended_from hx_mop_t_is_zero_extended_from = _ida_hexrays.hx_mop_t_is_zero_extended_from hx_mop_t_equal_mops = _ida_hexrays.hx_mop_t_equal_mops hx_mop_t_lexcompare = _ida_hexrays.hx_mop_t_lexcompare hx_mop_t_for_all_ops = _ida_hexrays.hx_mop_t_for_all_ops hx_mop_t_for_all_scattered_submops = _ida_hexrays.hx_mop_t_for_all_scattered_submops hx_mop_t_is_constant = _ida_hexrays.hx_mop_t_is_constant hx_mop_t_get_stkoff = _ida_hexrays.hx_mop_t_get_stkoff hx_mop_t_make_low_half = _ida_hexrays.hx_mop_t_make_low_half hx_mop_t_make_high_half = _ida_hexrays.hx_mop_t_make_high_half hx_mop_t_make_first_half = _ida_hexrays.hx_mop_t_make_first_half hx_mop_t_make_second_half = _ida_hexrays.hx_mop_t_make_second_half hx_mop_t_shift_mop = _ida_hexrays.hx_mop_t_shift_mop hx_mop_t_change_size = _ida_hexrays.hx_mop_t_change_size hx_mop_t_preserve_side_effects = _ida_hexrays.hx_mop_t_preserve_side_effects hx_mop_t_apply_ld_mcode = _ida_hexrays.hx_mop_t_apply_ld_mcode hx_mcallarg_t_print = _ida_hexrays.hx_mcallarg_t_print hx_mcallarg_t_dstr = _ida_hexrays.hx_mcallarg_t_dstr hx_mcallarg_t_set_regarg = _ida_hexrays.hx_mcallarg_t_set_regarg hx_mcallinfo_t_lexcompare = _ida_hexrays.hx_mcallinfo_t_lexcompare hx_mcallinfo_t_set_type = _ida_hexrays.hx_mcallinfo_t_set_type hx_mcallinfo_t_get_type = _ida_hexrays.hx_mcallinfo_t_get_type hx_mcallinfo_t_print = _ida_hexrays.hx_mcallinfo_t_print hx_mcallinfo_t_dstr = _ida_hexrays.hx_mcallinfo_t_dstr hx_mcases_t_compare = _ida_hexrays.hx_mcases_t_compare hx_mcases_t_print = _ida_hexrays.hx_mcases_t_print hx_mcases_t_dstr = _ida_hexrays.hx_mcases_t_dstr hx_vivl_t_extend_to_cover = _ida_hexrays.hx_vivl_t_extend_to_cover hx_vivl_t_intersect = _ida_hexrays.hx_vivl_t_intersect hx_vivl_t_print = _ida_hexrays.hx_vivl_t_print hx_vivl_t_dstr = _ida_hexrays.hx_vivl_t_dstr hx_chain_t_print = _ida_hexrays.hx_chain_t_print hx_chain_t_dstr = _ida_hexrays.hx_chain_t_dstr hx_chain_t_append_list = _ida_hexrays.hx_chain_t_append_list hx_block_chains_t_get_chain = _ida_hexrays.hx_block_chains_t_get_chain hx_block_chains_t_print = _ida_hexrays.hx_block_chains_t_print hx_block_chains_t_dstr = _ida_hexrays.hx_block_chains_t_dstr hx_graph_chains_t_for_all_chains = _ida_hexrays.hx_graph_chains_t_for_all_chains hx_graph_chains_t_release = _ida_hexrays.hx_graph_chains_t_release hx_minsn_t_init = _ida_hexrays.hx_minsn_t_init hx_minsn_t_copy = _ida_hexrays.hx_minsn_t_copy hx_minsn_t_swap = _ida_hexrays.hx_minsn_t_swap hx_minsn_t_print = _ida_hexrays.hx_minsn_t_print hx_minsn_t_dstr = _ida_hexrays.hx_minsn_t_dstr hx_minsn_t_setaddr = _ida_hexrays.hx_minsn_t_setaddr hx_minsn_t_optimize_subtree = _ida_hexrays.hx_minsn_t_optimize_subtree hx_minsn_t_for_all_ops = _ida_hexrays.hx_minsn_t_for_all_ops hx_minsn_t_for_all_insns = _ida_hexrays.hx_minsn_t_for_all_insns hx_minsn_t__make_nop = _ida_hexrays.hx_minsn_t__make_nop hx_minsn_t_equal_insns = _ida_hexrays.hx_minsn_t_equal_insns hx_minsn_t_lexcompare = _ida_hexrays.hx_minsn_t_lexcompare hx_minsn_t_is_noret_call = _ida_hexrays.hx_minsn_t_is_noret_call hx_minsn_t_is_helper = _ida_hexrays.hx_minsn_t_is_helper hx_minsn_t_find_call = _ida_hexrays.hx_minsn_t_find_call hx_minsn_t_has_side_effects = _ida_hexrays.hx_minsn_t_has_side_effects hx_minsn_t_find_opcode = _ida_hexrays.hx_minsn_t_find_opcode hx_minsn_t_find_ins_op = _ida_hexrays.hx_minsn_t_find_ins_op hx_minsn_t_find_num_op = _ida_hexrays.hx_minsn_t_find_num_op hx_minsn_t_modifes_d = _ida_hexrays.hx_minsn_t_modifes_d hx_minsn_t_is_between = _ida_hexrays.hx_minsn_t_is_between hx_minsn_t_may_use_aliased_memory = _ida_hexrays.hx_minsn_t_may_use_aliased_memory hx_getf_reginsn = _ida_hexrays.hx_getf_reginsn hx_getb_reginsn = _ida_hexrays.hx_getb_reginsn hx_mblock_t_init = _ida_hexrays.hx_mblock_t_init hx_mblock_t_print = _ida_hexrays.hx_mblock_t_print hx_mblock_t_dump = _ida_hexrays.hx_mblock_t_dump hx_mblock_t_vdump_block = _ida_hexrays.hx_mblock_t_vdump_block hx_mblock_t_insert_into_block = _ida_hexrays.hx_mblock_t_insert_into_block hx_mblock_t_remove_from_block = _ida_hexrays.hx_mblock_t_remove_from_block hx_mblock_t_for_all_insns = _ida_hexrays.hx_mblock_t_for_all_insns hx_mblock_t_for_all_ops = _ida_hexrays.hx_mblock_t_for_all_ops hx_mblock_t_for_all_uses = _ida_hexrays.hx_mblock_t_for_all_uses hx_mblock_t_optimize_insn = _ida_hexrays.hx_mblock_t_optimize_insn hx_mblock_t_optimize_block = _ida_hexrays.hx_mblock_t_optimize_block hx_mblock_t_build_lists = _ida_hexrays.hx_mblock_t_build_lists hx_mblock_t_append_use_list = _ida_hexrays.hx_mblock_t_append_use_list hx_mblock_t_append_def_list = _ida_hexrays.hx_mblock_t_append_def_list hx_mblock_t_build_use_list = _ida_hexrays.hx_mblock_t_build_use_list hx_mblock_t_build_def_list = _ida_hexrays.hx_mblock_t_build_def_list hx_mblock_t_find_first_use = _ida_hexrays.hx_mblock_t_find_first_use hx_mblock_t_find_redefinition = _ida_hexrays.hx_mblock_t_find_redefinition hx_mblock_t_is_rhs_redefined = _ida_hexrays.hx_mblock_t_is_rhs_redefined hx_mblock_t_find_access = _ida_hexrays.hx_mblock_t_find_access hx_mblock_t_get_valranges = _ida_hexrays.hx_mblock_t_get_valranges hx_mbl_array_t_idaloc2vd = _ida_hexrays.hx_mbl_array_t_idaloc2vd hx_mbl_array_t_vd2idaloc = _ida_hexrays.hx_mbl_array_t_vd2idaloc hx_mbl_array_t_term = _ida_hexrays.hx_mbl_array_t_term hx_mbl_array_t_optimize_local = _ida_hexrays.hx_mbl_array_t_optimize_local hx_mbl_array_t_build_graph = _ida_hexrays.hx_mbl_array_t_build_graph hx_mbl_array_t_get_graph = _ida_hexrays.hx_mbl_array_t_get_graph hx_mbl_array_t_analyze_calls = _ida_hexrays.hx_mbl_array_t_analyze_calls hx_mbl_array_t_optimize_global = _ida_hexrays.hx_mbl_array_t_optimize_global hx_mbl_array_t_alloc_lvars = _ida_hexrays.hx_mbl_array_t_alloc_lvars hx_mbl_array_t_dump = _ida_hexrays.hx_mbl_array_t_dump hx_mbl_array_t_vdump_mba = _ida_hexrays.hx_mbl_array_t_vdump_mba hx_mbl_array_t_print = _ida_hexrays.hx_mbl_array_t_print hx_mbl_array_t_verify = _ida_hexrays.hx_mbl_array_t_verify hx_mbl_array_t_mark_chains_dirty = _ida_hexrays.hx_mbl_array_t_mark_chains_dirty hx_mbl_array_t_insert_block = _ida_hexrays.hx_mbl_array_t_insert_block hx_mbl_array_t_remove_block = _ida_hexrays.hx_mbl_array_t_remove_block hx_mbl_array_t_remove_empty_blocks = _ida_hexrays.hx_mbl_array_t_remove_empty_blocks hx_mbl_array_t_combine_blocks = _ida_hexrays.hx_mbl_array_t_combine_blocks hx_mbl_array_t_for_all_ops = _ida_hexrays.hx_mbl_array_t_for_all_ops hx_mbl_array_t_for_all_insns = _ida_hexrays.hx_mbl_array_t_for_all_insns hx_mbl_array_t_for_all_topinsns = _ida_hexrays.hx_mbl_array_t_for_all_topinsns hx_mbl_array_t_find_mop = _ida_hexrays.hx_mbl_array_t_find_mop hx_mbl_array_t_arg = _ida_hexrays.hx_mbl_array_t_arg hx_mbl_array_t_serialize = _ida_hexrays.hx_mbl_array_t_serialize hx_mbl_array_t_deserialize = _ida_hexrays.hx_mbl_array_t_deserialize hx_mbl_graph_t_is_accessed_globally = _ida_hexrays.hx_mbl_graph_t_is_accessed_globally hx_mbl_graph_t_get_ud = _ida_hexrays.hx_mbl_graph_t_get_ud hx_mbl_graph_t_get_du = _ida_hexrays.hx_mbl_graph_t_get_du hx_codegen_t_emit = _ida_hexrays.hx_codegen_t_emit hx_codegen_t_emit_ = _ida_hexrays.hx_codegen_t_emit_ hx_is_kreg = _ida_hexrays.hx_is_kreg hx_get_temp_regs = _ida_hexrays.hx_get_temp_regs hx_get_hexrays_version = _ida_hexrays.hx_get_hexrays_version hx_open_pseudocode = _ida_hexrays.hx_open_pseudocode hx_close_pseudocode = _ida_hexrays.hx_close_pseudocode hx_get_widget_vdui = _ida_hexrays.hx_get_widget_vdui hx_decompile_many = _ida_hexrays.hx_decompile_many hx_hexrays_failure_t_desc = _ida_hexrays.hx_hexrays_failure_t_desc hx_send_database = _ida_hexrays.hx_send_database hx_gco_info_t_append_to_list = _ida_hexrays.hx_gco_info_t_append_to_list hx_get_current_operand = _ida_hexrays.hx_get_current_operand hx_remitem = _ida_hexrays.hx_remitem hx_negated_relation = _ida_hexrays.hx_negated_relation hx_swapped_relation = _ida_hexrays.hx_swapped_relation hx_get_op_signness = _ida_hexrays.hx_get_op_signness hx_asgop = _ida_hexrays.hx_asgop hx_asgop_revert = _ida_hexrays.hx_asgop_revert hx_cnumber_t_print = _ida_hexrays.hx_cnumber_t_print hx_cnumber_t_value = _ida_hexrays.hx_cnumber_t_value hx_cnumber_t_assign = _ida_hexrays.hx_cnumber_t_assign hx_cnumber_t_compare = _ida_hexrays.hx_cnumber_t_compare hx_var_ref_t_compare = _ida_hexrays.hx_var_ref_t_compare hx_ctree_visitor_t_apply_to = _ida_hexrays.hx_ctree_visitor_t_apply_to hx_ctree_visitor_t_apply_to_exprs = _ida_hexrays.hx_ctree_visitor_t_apply_to_exprs hx_ctree_parentee_t_recalc_parent_types = _ida_hexrays.hx_ctree_parentee_t_recalc_parent_types hx_cfunc_parentee_t_calc_rvalue_type = _ida_hexrays.hx_cfunc_parentee_t_calc_rvalue_type hx_citem_locator_t_compare = _ida_hexrays.hx_citem_locator_t_compare hx_citem_t_contains_expr = _ida_hexrays.hx_citem_t_contains_expr hx_citem_t_contains_label = _ida_hexrays.hx_citem_t_contains_label hx_citem_t_find_parent_of = _ida_hexrays.hx_citem_t_find_parent_of hx_citem_t_find_closest_addr = _ida_hexrays.hx_citem_t_find_closest_addr hx_cexpr_t_assign = _ida_hexrays.hx_cexpr_t_assign hx_cexpr_t_compare = _ida_hexrays.hx_cexpr_t_compare hx_cexpr_t_replace_by = _ida_hexrays.hx_cexpr_t_replace_by hx_cexpr_t_cleanup = _ida_hexrays.hx_cexpr_t_cleanup hx_cexpr_t_put_number = _ida_hexrays.hx_cexpr_t_put_number hx_cexpr_t_print1 = _ida_hexrays.hx_cexpr_t_print1 hx_cexpr_t_calc_type = _ida_hexrays.hx_cexpr_t_calc_type hx_cexpr_t_equal_effect = _ida_hexrays.hx_cexpr_t_equal_effect hx_cexpr_t_is_child_of = _ida_hexrays.hx_cexpr_t_is_child_of hx_cexpr_t_contains_operator = _ida_hexrays.hx_cexpr_t_contains_operator hx_cexpr_t_get_high_nbit_bound = _ida_hexrays.hx_cexpr_t_get_high_nbit_bound hx_cexpr_t_get_low_nbit_bound = _ida_hexrays.hx_cexpr_t_get_low_nbit_bound hx_cexpr_t_requires_lvalue = _ida_hexrays.hx_cexpr_t_requires_lvalue hx_cexpr_t_has_side_effects = _ida_hexrays.hx_cexpr_t_has_side_effects hx_cif_t_assign = _ida_hexrays.hx_cif_t_assign hx_cif_t_compare = _ida_hexrays.hx_cif_t_compare hx_cloop_t_assign = _ida_hexrays.hx_cloop_t_assign hx_cfor_t_compare = _ida_hexrays.hx_cfor_t_compare hx_cwhile_t_compare = _ida_hexrays.hx_cwhile_t_compare hx_cdo_t_compare = _ida_hexrays.hx_cdo_t_compare hx_creturn_t_compare = _ida_hexrays.hx_creturn_t_compare hx_cgoto_t_compare = _ida_hexrays.hx_cgoto_t_compare hx_casm_t_compare = _ida_hexrays.hx_casm_t_compare hx_cinsn_t_assign = _ida_hexrays.hx_cinsn_t_assign hx_cinsn_t_compare = _ida_hexrays.hx_cinsn_t_compare hx_cinsn_t_replace_by = _ida_hexrays.hx_cinsn_t_replace_by hx_cinsn_t_cleanup = _ida_hexrays.hx_cinsn_t_cleanup hx_cinsn_t_new_insn = _ida_hexrays.hx_cinsn_t_new_insn hx_cinsn_t_create_if = _ida_hexrays.hx_cinsn_t_create_if hx_cinsn_t_print = _ida_hexrays.hx_cinsn_t_print hx_cinsn_t_print1 = _ida_hexrays.hx_cinsn_t_print1 hx_cinsn_t_is_ordinary_flow = _ida_hexrays.hx_cinsn_t_is_ordinary_flow hx_cinsn_t_contains_insn = _ida_hexrays.hx_cinsn_t_contains_insn hx_cinsn_t_collect_free_breaks = _ida_hexrays.hx_cinsn_t_collect_free_breaks hx_cinsn_t_collect_free_continues = _ida_hexrays.hx_cinsn_t_collect_free_continues hx_cblock_t_compare = _ida_hexrays.hx_cblock_t_compare hx_carglist_t_compare = _ida_hexrays.hx_carglist_t_compare hx_ccase_t_compare = _ida_hexrays.hx_ccase_t_compare hx_ccases_t_compare = _ida_hexrays.hx_ccases_t_compare hx_cswitch_t_compare = _ida_hexrays.hx_cswitch_t_compare hx_ctree_item_t_get_memptr = _ida_hexrays.hx_ctree_item_t_get_memptr hx_ctree_item_t_get_lvar = _ida_hexrays.hx_ctree_item_t_get_lvar hx_ctree_item_t_get_ea = _ida_hexrays.hx_ctree_item_t_get_ea hx_ctree_item_t_get_label_num = _ida_hexrays.hx_ctree_item_t_get_label_num hx_lnot = _ida_hexrays.hx_lnot hx_new_block = _ida_hexrays.hx_new_block hx_vcreate_helper = _ida_hexrays.hx_vcreate_helper hx_vcall_helper = _ida_hexrays.hx_vcall_helper hx_make_num = _ida_hexrays.hx_make_num hx_make_ref = _ida_hexrays.hx_make_ref hx_dereference = _ida_hexrays.hx_dereference hx_save_user_labels = _ida_hexrays.hx_save_user_labels hx_save_user_cmts = _ida_hexrays.hx_save_user_cmts hx_save_user_numforms = _ida_hexrays.hx_save_user_numforms hx_save_user_iflags = _ida_hexrays.hx_save_user_iflags hx_save_user_unions = _ida_hexrays.hx_save_user_unions hx_restore_user_labels = _ida_hexrays.hx_restore_user_labels hx_restore_user_cmts = _ida_hexrays.hx_restore_user_cmts hx_restore_user_numforms = _ida_hexrays.hx_restore_user_numforms hx_restore_user_iflags = _ida_hexrays.hx_restore_user_iflags hx_restore_user_unions = _ida_hexrays.hx_restore_user_unions hx_cfunc_t_build_c_tree = _ida_hexrays.hx_cfunc_t_build_c_tree hx_cfunc_t_verify = _ida_hexrays.hx_cfunc_t_verify hx_cfunc_t_print_dcl = _ida_hexrays.hx_cfunc_t_print_dcl hx_cfunc_t_print_func = _ida_hexrays.hx_cfunc_t_print_func hx_cfunc_t_get_func_type = _ida_hexrays.hx_cfunc_t_get_func_type hx_cfunc_t_get_lvars = _ida_hexrays.hx_cfunc_t_get_lvars hx_cfunc_t_get_stkoff_delta = _ida_hexrays.hx_cfunc_t_get_stkoff_delta hx_cfunc_t_find_label = _ida_hexrays.hx_cfunc_t_find_label hx_cfunc_t_remove_unused_labels = _ida_hexrays.hx_cfunc_t_remove_unused_labels hx_cfunc_t_get_user_cmt = _ida_hexrays.hx_cfunc_t_get_user_cmt hx_cfunc_t_set_user_cmt = _ida_hexrays.hx_cfunc_t_set_user_cmt hx_cfunc_t_get_user_iflags = _ida_hexrays.hx_cfunc_t_get_user_iflags hx_cfunc_t_set_user_iflags = _ida_hexrays.hx_cfunc_t_set_user_iflags hx_cfunc_t_has_orphan_cmts = _ida_hexrays.hx_cfunc_t_has_orphan_cmts hx_cfunc_t_del_orphan_cmts = _ida_hexrays.hx_cfunc_t_del_orphan_cmts hx_cfunc_t_get_user_union_selection = _ida_hexrays.hx_cfunc_t_get_user_union_selection hx_cfunc_t_set_user_union_selection = _ida_hexrays.hx_cfunc_t_set_user_union_selection hx_cfunc_t_get_line_item = _ida_hexrays.hx_cfunc_t_get_line_item hx_cfunc_t_get_warnings = _ida_hexrays.hx_cfunc_t_get_warnings hx_cfunc_t_get_eamap = _ida_hexrays.hx_cfunc_t_get_eamap hx_cfunc_t_get_boundaries = _ida_hexrays.hx_cfunc_t_get_boundaries hx_cfunc_t_get_pseudocode = _ida_hexrays.hx_cfunc_t_get_pseudocode hx_cfunc_t_gather_derefs = _ida_hexrays.hx_cfunc_t_gather_derefs hx_cfunc_t_find_item_coords = _ida_hexrays.hx_cfunc_t_find_item_coords hx_cfunc_t_cleanup = _ida_hexrays.hx_cfunc_t_cleanup hx_decompile = _ida_hexrays.hx_decompile hx_gen_microcode = _ida_hexrays.hx_gen_microcode hx_mark_cfunc_dirty = _ida_hexrays.hx_mark_cfunc_dirty hx_clear_cached_cfuncs = _ida_hexrays.hx_clear_cached_cfuncs hx_has_cached_cfunc = _ida_hexrays.hx_has_cached_cfunc hx_get_ctype_name = _ida_hexrays.hx_get_ctype_name hx_create_field_name = _ida_hexrays.hx_create_field_name hx_install_hexrays_callback = _ida_hexrays.hx_install_hexrays_callback hx_remove_hexrays_callback = _ida_hexrays.hx_remove_hexrays_callback hx_vdui_t_set_locked = _ida_hexrays.hx_vdui_t_set_locked hx_vdui_t_refresh_view = _ida_hexrays.hx_vdui_t_refresh_view hx_vdui_t_refresh_ctext = _ida_hexrays.hx_vdui_t_refresh_ctext hx_vdui_t_switch_to = _ida_hexrays.hx_vdui_t_switch_to hx_vdui_t_get_number = _ida_hexrays.hx_vdui_t_get_number hx_vdui_t_get_current_label = _ida_hexrays.hx_vdui_t_get_current_label hx_vdui_t_clear = _ida_hexrays.hx_vdui_t_clear hx_vdui_t_refresh_cpos = _ida_hexrays.hx_vdui_t_refresh_cpos hx_vdui_t_get_current_item = _ida_hexrays.hx_vdui_t_get_current_item hx_vdui_t_ui_rename_lvar = _ida_hexrays.hx_vdui_t_ui_rename_lvar hx_vdui_t_rename_lvar = _ida_hexrays.hx_vdui_t_rename_lvar hx_vdui_t_ui_set_call_type = _ida_hexrays.hx_vdui_t_ui_set_call_type hx_vdui_t_ui_set_lvar_type = _ida_hexrays.hx_vdui_t_ui_set_lvar_type hx_vdui_t_set_lvar_type = _ida_hexrays.hx_vdui_t_set_lvar_type hx_vdui_t_ui_edit_lvar_cmt = _ida_hexrays.hx_vdui_t_ui_edit_lvar_cmt hx_vdui_t_set_lvar_cmt = _ida_hexrays.hx_vdui_t_set_lvar_cmt hx_vdui_t_ui_map_lvar = _ida_hexrays.hx_vdui_t_ui_map_lvar hx_vdui_t_ui_unmap_lvar = _ida_hexrays.hx_vdui_t_ui_unmap_lvar hx_vdui_t_map_lvar = _ida_hexrays.hx_vdui_t_map_lvar hx_vdui_t_set_strmem_type = _ida_hexrays.hx_vdui_t_set_strmem_type hx_vdui_t_rename_strmem = _ida_hexrays.hx_vdui_t_rename_strmem hx_vdui_t_set_global_type = _ida_hexrays.hx_vdui_t_set_global_type hx_vdui_t_rename_global = _ida_hexrays.hx_vdui_t_rename_global hx_vdui_t_rename_label = _ida_hexrays.hx_vdui_t_rename_label hx_vdui_t_jump_enter = _ida_hexrays.hx_vdui_t_jump_enter hx_vdui_t_ctree_to_disasm = _ida_hexrays.hx_vdui_t_ctree_to_disasm hx_vdui_t_calc_cmt_type = _ida_hexrays.hx_vdui_t_calc_cmt_type hx_vdui_t_edit_cmt = _ida_hexrays.hx_vdui_t_edit_cmt hx_vdui_t_edit_func_cmt = _ida_hexrays.hx_vdui_t_edit_func_cmt hx_vdui_t_del_orphan_cmts = _ida_hexrays.hx_vdui_t_del_orphan_cmts hx_vdui_t_set_num_radix = _ida_hexrays.hx_vdui_t_set_num_radix hx_vdui_t_set_num_enum = _ida_hexrays.hx_vdui_t_set_num_enum hx_vdui_t_set_num_stroff = _ida_hexrays.hx_vdui_t_set_num_stroff hx_vdui_t_invert_sign = _ida_hexrays.hx_vdui_t_invert_sign hx_vdui_t_invert_bits = _ida_hexrays.hx_vdui_t_invert_bits hx_vdui_t_collapse_item = _ida_hexrays.hx_vdui_t_collapse_item hx_vdui_t_collapse_lvars = _ida_hexrays.hx_vdui_t_collapse_lvars hx_vdui_t_split_item = _ida_hexrays.hx_vdui_t_split_item hx_hexrays_alloc = _ida_hexrays.hx_hexrays_alloc hx_hexrays_free = _ida_hexrays.hx_hexrays_free hx_vdui_t_set_noptr_lvar = _ida_hexrays.hx_vdui_t_set_noptr_lvar hx_select_udt_by_offset = _ida_hexrays.hx_select_udt_by_offset hx_mblock_t_get_valranges_ = _ida_hexrays.hx_mblock_t_get_valranges_ hx_cfunc_t_refresh_func_ctext = _ida_hexrays.hx_cfunc_t_refresh_func_ctext hx_checkout_hexrays_license = _ida_hexrays.hx_checkout_hexrays_license hx_mbl_array_t_copy_block = _ida_hexrays.hx_mbl_array_t_copy_block hx_mblock_t_optimize_useless_jump = _ida_hexrays.hx_mblock_t_optimize_useless_jump hx_mblock_t_get_reginsn_qty = _ida_hexrays.hx_mblock_t_get_reginsn_qty class user_numforms_iterator_t(object): """ Proxy of C++ user_numforms_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.user_numforms_iterator_t_x_get, _ida_hexrays.user_numforms_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.user_numforms_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.user_numforms_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> user_numforms_iterator_t """ this = _ida_hexrays.new_user_numforms_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_numforms_iterator_t __del__ = lambda self : None; user_numforms_iterator_t_swigregister = _ida_hexrays.user_numforms_iterator_t_swigregister user_numforms_iterator_t_swigregister(user_numforms_iterator_t) def user_numforms_begin(*args): """ user_numforms_begin(map) -> user_numforms_iterator_t Get iterator pointing to the beginning of user_numforms_t. @param map (C++: const user_numforms_t *) """ return _ida_hexrays.user_numforms_begin(*args) def user_numforms_end(*args): """ user_numforms_end(map) -> user_numforms_iterator_t Get iterator pointing to the end of user_numforms_t. @param map (C++: const user_numforms_t *) """ return _ida_hexrays.user_numforms_end(*args) def user_numforms_next(*args): """ user_numforms_next(p) -> user_numforms_iterator_t Move to the next element. @param p (C++: user_numforms_iterator_t) """ return _ida_hexrays.user_numforms_next(*args) def user_numforms_prev(*args): """ user_numforms_prev(p) -> user_numforms_iterator_t Move to the previous element. @param p (C++: user_numforms_iterator_t) """ return _ida_hexrays.user_numforms_prev(*args) def user_numforms_first(*args): """ user_numforms_first(p) -> operand_locator_t Get reference to the current map key. @param p (C++: user_numforms_iterator_t) """ return _ida_hexrays.user_numforms_first(*args) def user_numforms_second(*args): """ user_numforms_second(p) -> number_format_t Get reference to the current map value. @param p (C++: user_numforms_iterator_t) """ return _ida_hexrays.user_numforms_second(*args) def user_numforms_find(*args): """ user_numforms_find(map, key) -> user_numforms_iterator_t Find the specified key in user_numforms_t. @param map (C++: const user_numforms_t *) @param key (C++: const operand_locator_t &) """ return _ida_hexrays.user_numforms_find(*args) def user_numforms_insert(*args): """ user_numforms_insert(map, key, val) -> user_numforms_iterator_t Insert new ( 'operand_locator_t' , 'number_format_t' ) pair into user_numforms_t. @param map (C++: user_numforms_t *) @param key (C++: const operand_locator_t &) @param val (C++: const number_format_t &) """ return _ida_hexrays.user_numforms_insert(*args) def user_numforms_erase(*args): """ user_numforms_erase(map, p) Erase current element from user_numforms_t. @param map (C++: user_numforms_t *) @param p (C++: user_numforms_iterator_t) """ return _ida_hexrays.user_numforms_erase(*args) def user_numforms_clear(*args): """ user_numforms_clear(map) Clear user_numforms_t. @param map (C++: user_numforms_t *) """ return _ida_hexrays.user_numforms_clear(*args) def user_numforms_size(*args): """ user_numforms_size(map) -> size_t Get size of user_numforms_t. @param map (C++: user_numforms_t *) """ return _ida_hexrays.user_numforms_size(*args) def user_numforms_free(*args): """ user_numforms_free(map) Delete user_numforms_t instance. @param map (C++: user_numforms_t *) """ return _ida_hexrays.user_numforms_free(*args) def user_numforms_new(*args): """ user_numforms_new() -> user_numforms_t Create a new user_numforms_t instance. """ return _ida_hexrays.user_numforms_new(*args) class lvar_mapping_iterator_t(object): """ Proxy of C++ lvar_mapping_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.lvar_mapping_iterator_t_x_get, _ida_hexrays.lvar_mapping_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.lvar_mapping_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.lvar_mapping_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> lvar_mapping_iterator_t """ this = _ida_hexrays.new_lvar_mapping_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_lvar_mapping_iterator_t __del__ = lambda self : None; lvar_mapping_iterator_t_swigregister = _ida_hexrays.lvar_mapping_iterator_t_swigregister lvar_mapping_iterator_t_swigregister(lvar_mapping_iterator_t) def lvar_mapping_begin(*args): """ lvar_mapping_begin(map) -> lvar_mapping_iterator_t Get iterator pointing to the beginning of lvar_mapping_t. @param map (C++: const lvar_mapping_t *) """ return _ida_hexrays.lvar_mapping_begin(*args) def lvar_mapping_end(*args): """ lvar_mapping_end(map) -> lvar_mapping_iterator_t Get iterator pointing to the end of lvar_mapping_t. @param map (C++: const lvar_mapping_t *) """ return _ida_hexrays.lvar_mapping_end(*args) def lvar_mapping_next(*args): """ lvar_mapping_next(p) -> lvar_mapping_iterator_t Move to the next element. @param p (C++: lvar_mapping_iterator_t) """ return _ida_hexrays.lvar_mapping_next(*args) def lvar_mapping_prev(*args): """ lvar_mapping_prev(p) -> lvar_mapping_iterator_t Move to the previous element. @param p (C++: lvar_mapping_iterator_t) """ return _ida_hexrays.lvar_mapping_prev(*args) def lvar_mapping_first(*args): """ lvar_mapping_first(p) -> lvar_locator_t Get reference to the current map key. @param p (C++: lvar_mapping_iterator_t) """ return _ida_hexrays.lvar_mapping_first(*args) def lvar_mapping_second(*args): """ lvar_mapping_second(p) -> lvar_locator_t Get reference to the current map value. @param p (C++: lvar_mapping_iterator_t) """ return _ida_hexrays.lvar_mapping_second(*args) def lvar_mapping_find(*args): """ lvar_mapping_find(map, key) -> lvar_mapping_iterator_t Find the specified key in lvar_mapping_t. @param map (C++: const lvar_mapping_t *) @param key (C++: const lvar_locator_t &) """ return _ida_hexrays.lvar_mapping_find(*args) def lvar_mapping_insert(*args): """ lvar_mapping_insert(map, key, val) -> lvar_mapping_iterator_t Insert new ( 'lvar_locator_t' , 'lvar_locator_t' ) pair into lvar_mapping_t. @param map (C++: lvar_mapping_t *) @param key (C++: const lvar_locator_t &) @param val (C++: const lvar_locator_t &) """ return _ida_hexrays.lvar_mapping_insert(*args) def lvar_mapping_erase(*args): """ lvar_mapping_erase(map, p) Erase current element from lvar_mapping_t. @param map (C++: lvar_mapping_t *) @param p (C++: lvar_mapping_iterator_t) """ return _ida_hexrays.lvar_mapping_erase(*args) def lvar_mapping_clear(*args): """ lvar_mapping_clear(map) Clear lvar_mapping_t. @param map (C++: lvar_mapping_t *) """ return _ida_hexrays.lvar_mapping_clear(*args) def lvar_mapping_size(*args): """ lvar_mapping_size(map) -> size_t Get size of lvar_mapping_t. @param map (C++: lvar_mapping_t *) """ return _ida_hexrays.lvar_mapping_size(*args) def lvar_mapping_free(*args): """ lvar_mapping_free(map) Delete lvar_mapping_t instance. @param map (C++: lvar_mapping_t *) """ return _ida_hexrays.lvar_mapping_free(*args) def lvar_mapping_new(*args): """ lvar_mapping_new() -> lvar_mapping_t Create a new lvar_mapping_t instance. """ return _ida_hexrays.lvar_mapping_new(*args) class udcall_map_iterator_t(object): """ Proxy of C++ udcall_map_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.udcall_map_iterator_t_x_get, _ida_hexrays.udcall_map_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.udcall_map_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.udcall_map_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> udcall_map_iterator_t """ this = _ida_hexrays.new_udcall_map_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_udcall_map_iterator_t __del__ = lambda self : None; udcall_map_iterator_t_swigregister = _ida_hexrays.udcall_map_iterator_t_swigregister udcall_map_iterator_t_swigregister(udcall_map_iterator_t) def udcall_map_begin(*args): """ udcall_map_begin(map) -> udcall_map_iterator_t Get iterator pointing to the beginning of udcall_map_t. @param map (C++: const udcall_map_t *) """ return _ida_hexrays.udcall_map_begin(*args) def udcall_map_end(*args): """ udcall_map_end(map) -> udcall_map_iterator_t Get iterator pointing to the end of udcall_map_t. @param map (C++: const udcall_map_t *) """ return _ida_hexrays.udcall_map_end(*args) def udcall_map_next(*args): """ udcall_map_next(p) -> udcall_map_iterator_t Move to the next element. @param p (C++: udcall_map_iterator_t) """ return _ida_hexrays.udcall_map_next(*args) def udcall_map_prev(*args): """ udcall_map_prev(p) -> udcall_map_iterator_t Move to the previous element. @param p (C++: udcall_map_iterator_t) """ return _ida_hexrays.udcall_map_prev(*args) def udcall_map_first(*args): """ udcall_map_first(p) -> ea_t const & Get reference to the current map key. @param p (C++: udcall_map_iterator_t) """ return _ida_hexrays.udcall_map_first(*args) def udcall_map_second(*args): """ udcall_map_second(p) -> udcall_t Get reference to the current map value. @param p (C++: udcall_map_iterator_t) """ return _ida_hexrays.udcall_map_second(*args) def udcall_map_find(*args): """ udcall_map_find(map, key) -> udcall_map_iterator_t Find the specified key in udcall_map_t. @param map (C++: const udcall_map_t *) @param key (C++: const ea_t &) """ return _ida_hexrays.udcall_map_find(*args) def udcall_map_insert(*args): """ udcall_map_insert(map, key, val) -> udcall_map_iterator_t Insert new (ea_t, 'udcall_t' ) pair into udcall_map_t. @param map (C++: udcall_map_t *) @param key (C++: const ea_t &) @param val (C++: const udcall_t &) """ return _ida_hexrays.udcall_map_insert(*args) def udcall_map_erase(*args): """ udcall_map_erase(map, p) Erase current element from udcall_map_t. @param map (C++: udcall_map_t *) @param p (C++: udcall_map_iterator_t) """ return _ida_hexrays.udcall_map_erase(*args) def udcall_map_clear(*args): """ udcall_map_clear(map) Clear udcall_map_t. @param map (C++: udcall_map_t *) """ return _ida_hexrays.udcall_map_clear(*args) def udcall_map_size(*args): """ udcall_map_size(map) -> size_t Get size of udcall_map_t. @param map (C++: udcall_map_t *) """ return _ida_hexrays.udcall_map_size(*args) def udcall_map_free(*args): """ udcall_map_free(map) Delete udcall_map_t instance. @param map (C++: udcall_map_t *) """ return _ida_hexrays.udcall_map_free(*args) def udcall_map_new(*args): """ udcall_map_new() -> udcall_map_t * Create a new udcall_map_t instance. """ return _ida_hexrays.udcall_map_new(*args) class user_cmts_iterator_t(object): """ Proxy of C++ user_cmts_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.user_cmts_iterator_t_x_get, _ida_hexrays.user_cmts_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.user_cmts_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.user_cmts_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> user_cmts_iterator_t """ this = _ida_hexrays.new_user_cmts_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_cmts_iterator_t __del__ = lambda self : None; user_cmts_iterator_t_swigregister = _ida_hexrays.user_cmts_iterator_t_swigregister user_cmts_iterator_t_swigregister(user_cmts_iterator_t) def user_cmts_begin(*args): """ user_cmts_begin(map) -> user_cmts_iterator_t Get iterator pointing to the beginning of user_cmts_t. @param map (C++: const user_cmts_t *) """ return _ida_hexrays.user_cmts_begin(*args) def user_cmts_end(*args): """ user_cmts_end(map) -> user_cmts_iterator_t Get iterator pointing to the end of user_cmts_t. @param map (C++: const user_cmts_t *) """ return _ida_hexrays.user_cmts_end(*args) def user_cmts_next(*args): """ user_cmts_next(p) -> user_cmts_iterator_t Move to the next element. @param p (C++: user_cmts_iterator_t) """ return _ida_hexrays.user_cmts_next(*args) def user_cmts_prev(*args): """ user_cmts_prev(p) -> user_cmts_iterator_t Move to the previous element. @param p (C++: user_cmts_iterator_t) """ return _ida_hexrays.user_cmts_prev(*args) def user_cmts_first(*args): """ user_cmts_first(p) -> treeloc_t Get reference to the current map key. @param p (C++: user_cmts_iterator_t) """ return _ida_hexrays.user_cmts_first(*args) def user_cmts_second(*args): """ user_cmts_second(p) -> citem_cmt_t Get reference to the current map value. @param p (C++: user_cmts_iterator_t) """ return _ida_hexrays.user_cmts_second(*args) def user_cmts_find(*args): """ user_cmts_find(map, key) -> user_cmts_iterator_t Find the specified key in user_cmts_t. @param map (C++: const user_cmts_t *) @param key (C++: const treeloc_t &) """ return _ida_hexrays.user_cmts_find(*args) def user_cmts_insert(*args): """ user_cmts_insert(map, key, val) -> user_cmts_iterator_t Insert new ( 'treeloc_t' , 'citem_cmt_t' ) pair into user_cmts_t. @param map (C++: user_cmts_t *) @param key (C++: const treeloc_t &) @param val (C++: const citem_cmt_t &) """ return _ida_hexrays.user_cmts_insert(*args) def user_cmts_erase(*args): """ user_cmts_erase(map, p) Erase current element from user_cmts_t. @param map (C++: user_cmts_t *) @param p (C++: user_cmts_iterator_t) """ return _ida_hexrays.user_cmts_erase(*args) def user_cmts_clear(*args): """ user_cmts_clear(map) Clear user_cmts_t. @param map (C++: user_cmts_t *) """ return _ida_hexrays.user_cmts_clear(*args) def user_cmts_size(*args): """ user_cmts_size(map) -> size_t Get size of user_cmts_t. @param map (C++: user_cmts_t *) """ return _ida_hexrays.user_cmts_size(*args) def user_cmts_free(*args): """ user_cmts_free(map) Delete user_cmts_t instance. @param map (C++: user_cmts_t *) """ return _ida_hexrays.user_cmts_free(*args) def user_cmts_new(*args): """ user_cmts_new() -> user_cmts_t Create a new user_cmts_t instance. """ return _ida_hexrays.user_cmts_new(*args) class user_iflags_iterator_t(object): """ Proxy of C++ user_iflags_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.user_iflags_iterator_t_x_get, _ida_hexrays.user_iflags_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.user_iflags_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.user_iflags_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> user_iflags_iterator_t """ this = _ida_hexrays.new_user_iflags_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_iflags_iterator_t __del__ = lambda self : None; user_iflags_iterator_t_swigregister = _ida_hexrays.user_iflags_iterator_t_swigregister user_iflags_iterator_t_swigregister(user_iflags_iterator_t) def user_iflags_begin(*args): """ user_iflags_begin(map) -> user_iflags_iterator_t Get iterator pointing to the beginning of user_iflags_t. @param map (C++: const user_iflags_t *) """ return _ida_hexrays.user_iflags_begin(*args) def user_iflags_end(*args): """ user_iflags_end(map) -> user_iflags_iterator_t Get iterator pointing to the end of user_iflags_t. @param map (C++: const user_iflags_t *) """ return _ida_hexrays.user_iflags_end(*args) def user_iflags_next(*args): """ user_iflags_next(p) -> user_iflags_iterator_t Move to the next element. @param p (C++: user_iflags_iterator_t) """ return _ida_hexrays.user_iflags_next(*args) def user_iflags_prev(*args): """ user_iflags_prev(p) -> user_iflags_iterator_t Move to the previous element. @param p (C++: user_iflags_iterator_t) """ return _ida_hexrays.user_iflags_prev(*args) def user_iflags_first(*args): """ user_iflags_first(p) -> citem_locator_t Get reference to the current map key. @param p (C++: user_iflags_iterator_t) """ return _ida_hexrays.user_iflags_first(*args) def user_iflags_find(*args): """ user_iflags_find(map, key) -> user_iflags_iterator_t Find the specified key in user_iflags_t. @param map (C++: const user_iflags_t *) @param key (C++: const citem_locator_t &) """ return _ida_hexrays.user_iflags_find(*args) def user_iflags_insert(*args): """ user_iflags_insert(map, key, val) -> user_iflags_iterator_t Insert new ( 'citem_locator_t' , int32) pair into user_iflags_t. @param map (C++: user_iflags_t *) @param key (C++: const citem_locator_t &) @param val (C++: const int32 &) """ return _ida_hexrays.user_iflags_insert(*args) def user_iflags_erase(*args): """ user_iflags_erase(map, p) Erase current element from user_iflags_t. @param map (C++: user_iflags_t *) @param p (C++: user_iflags_iterator_t) """ return _ida_hexrays.user_iflags_erase(*args) def user_iflags_clear(*args): """ user_iflags_clear(map) Clear user_iflags_t. @param map (C++: user_iflags_t *) """ return _ida_hexrays.user_iflags_clear(*args) def user_iflags_size(*args): """ user_iflags_size(map) -> size_t Get size of user_iflags_t. @param map (C++: user_iflags_t *) """ return _ida_hexrays.user_iflags_size(*args) def user_iflags_free(*args): """ user_iflags_free(map) Delete user_iflags_t instance. @param map (C++: user_iflags_t *) """ return _ida_hexrays.user_iflags_free(*args) def user_iflags_new(*args): """ user_iflags_new() -> user_iflags_t Create a new user_iflags_t instance. """ return _ida_hexrays.user_iflags_new(*args) class user_unions_iterator_t(object): """ Proxy of C++ user_unions_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.user_unions_iterator_t_x_get, _ida_hexrays.user_unions_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.user_unions_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.user_unions_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> user_unions_iterator_t """ this = _ida_hexrays.new_user_unions_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_unions_iterator_t __del__ = lambda self : None; user_unions_iterator_t_swigregister = _ida_hexrays.user_unions_iterator_t_swigregister user_unions_iterator_t_swigregister(user_unions_iterator_t) def user_unions_begin(*args): """ user_unions_begin(map) -> user_unions_iterator_t Get iterator pointing to the beginning of user_unions_t. @param map (C++: const user_unions_t *) """ return _ida_hexrays.user_unions_begin(*args) def user_unions_end(*args): """ user_unions_end(map) -> user_unions_iterator_t Get iterator pointing to the end of user_unions_t. @param map (C++: const user_unions_t *) """ return _ida_hexrays.user_unions_end(*args) def user_unions_next(*args): """ user_unions_next(p) -> user_unions_iterator_t Move to the next element. @param p (C++: user_unions_iterator_t) """ return _ida_hexrays.user_unions_next(*args) def user_unions_prev(*args): """ user_unions_prev(p) -> user_unions_iterator_t Move to the previous element. @param p (C++: user_unions_iterator_t) """ return _ida_hexrays.user_unions_prev(*args) def user_unions_first(*args): """ user_unions_first(p) -> ea_t const & Get reference to the current map key. @param p (C++: user_unions_iterator_t) """ return _ida_hexrays.user_unions_first(*args) def user_unions_second(*args): """ user_unions_second(p) -> intvec_t Get reference to the current map value. @param p (C++: user_unions_iterator_t) """ return _ida_hexrays.user_unions_second(*args) def user_unions_find(*args): """ user_unions_find(map, key) -> user_unions_iterator_t Find the specified key in user_unions_t. @param map (C++: const user_unions_t *) @param key (C++: const ea_t &) """ return _ida_hexrays.user_unions_find(*args) def user_unions_insert(*args): """ user_unions_insert(map, key, val) -> user_unions_iterator_t Insert new (ea_t, intvec_t) pair into user_unions_t. @param map (C++: user_unions_t *) @param key (C++: const ea_t &) @param val (C++: const intvec_t &) """ return _ida_hexrays.user_unions_insert(*args) def user_unions_erase(*args): """ user_unions_erase(map, p) Erase current element from user_unions_t. @param map (C++: user_unions_t *) @param p (C++: user_unions_iterator_t) """ return _ida_hexrays.user_unions_erase(*args) def user_unions_clear(*args): """ user_unions_clear(map) Clear user_unions_t. @param map (C++: user_unions_t *) """ return _ida_hexrays.user_unions_clear(*args) def user_unions_size(*args): """ user_unions_size(map) -> size_t Get size of user_unions_t. @param map (C++: user_unions_t *) """ return _ida_hexrays.user_unions_size(*args) def user_unions_free(*args): """ user_unions_free(map) Delete user_unions_t instance. @param map (C++: user_unions_t *) """ return _ida_hexrays.user_unions_free(*args) def user_unions_new(*args): """ user_unions_new() -> user_unions_t Create a new user_unions_t instance. """ return _ida_hexrays.user_unions_new(*args) class user_labels_iterator_t(object): """ Proxy of C++ user_labels_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.user_labels_iterator_t_x_get, _ida_hexrays.user_labels_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.user_labels_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.user_labels_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> user_labels_iterator_t """ this = _ida_hexrays.new_user_labels_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_user_labels_iterator_t __del__ = lambda self : None; user_labels_iterator_t_swigregister = _ida_hexrays.user_labels_iterator_t_swigregister user_labels_iterator_t_swigregister(user_labels_iterator_t) def user_labels_begin(*args): """ user_labels_begin(map) -> user_labels_iterator_t Get iterator pointing to the beginning of user_labels_t. @param map (C++: const user_labels_t *) """ return _ida_hexrays.user_labels_begin(*args) def user_labels_end(*args): """ user_labels_end(map) -> user_labels_iterator_t Get iterator pointing to the end of user_labels_t. @param map (C++: const user_labels_t *) """ return _ida_hexrays.user_labels_end(*args) def user_labels_next(*args): """ user_labels_next(p) -> user_labels_iterator_t Move to the next element. @param p (C++: user_labels_iterator_t) """ return _ida_hexrays.user_labels_next(*args) def user_labels_prev(*args): """ user_labels_prev(p) -> user_labels_iterator_t Move to the previous element. @param p (C++: user_labels_iterator_t) """ return _ida_hexrays.user_labels_prev(*args) def user_labels_first(*args): """ user_labels_first(p) -> int const & Get reference to the current map key. @param p (C++: user_labels_iterator_t) """ return _ida_hexrays.user_labels_first(*args) def user_labels_second(*args): """ user_labels_second(p) -> qstring & Get reference to the current map value. @param p (C++: user_labels_iterator_t) """ return _ida_hexrays.user_labels_second(*args) def user_labels_find(*args): """ user_labels_find(map, key) -> user_labels_iterator_t Find the specified key in user_labels_t. @param map (C++: const user_labels_t *) @param key (C++: const int &) """ return _ida_hexrays.user_labels_find(*args) def user_labels_insert(*args): """ user_labels_insert(map, key, val) -> user_labels_iterator_t Insert new (int, qstring) pair into user_labels_t. @param map (C++: user_labels_t *) @param key (C++: const int &) @param val (C++: const qstring &) """ return _ida_hexrays.user_labels_insert(*args) def user_labels_erase(*args): """ user_labels_erase(map, p) Erase current element from user_labels_t. @param map (C++: user_labels_t *) @param p (C++: user_labels_iterator_t) """ return _ida_hexrays.user_labels_erase(*args) def user_labels_clear(*args): """ user_labels_clear(map) Clear user_labels_t. @param map (C++: user_labels_t *) """ return _ida_hexrays.user_labels_clear(*args) def user_labels_size(*args): """ user_labels_size(map) -> size_t Get size of user_labels_t. @param map (C++: user_labels_t *) """ return _ida_hexrays.user_labels_size(*args) def user_labels_free(*args): """ user_labels_free(map) Delete user_labels_t instance. @param map (C++: user_labels_t *) """ return _ida_hexrays.user_labels_free(*args) def user_labels_new(*args): """ user_labels_new() -> user_labels_t Create a new user_labels_t instance. """ return _ida_hexrays.user_labels_new(*args) class eamap_iterator_t(object): """ Proxy of C++ eamap_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.eamap_iterator_t_x_get, _ida_hexrays.eamap_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.eamap_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.eamap_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> eamap_iterator_t """ this = _ida_hexrays.new_eamap_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_eamap_iterator_t __del__ = lambda self : None; eamap_iterator_t_swigregister = _ida_hexrays.eamap_iterator_t_swigregister eamap_iterator_t_swigregister(eamap_iterator_t) def eamap_begin(*args): """ eamap_begin(map) -> eamap_iterator_t Get iterator pointing to the beginning of eamap_t. @param map (C++: const eamap_t *) """ return _ida_hexrays.eamap_begin(*args) def eamap_end(*args): """ eamap_end(map) -> eamap_iterator_t Get iterator pointing to the end of eamap_t. @param map (C++: const eamap_t *) """ return _ida_hexrays.eamap_end(*args) def eamap_next(*args): """ eamap_next(p) -> eamap_iterator_t Move to the next element. @param p (C++: eamap_iterator_t) """ return _ida_hexrays.eamap_next(*args) def eamap_prev(*args): """ eamap_prev(p) -> eamap_iterator_t Move to the previous element. @param p (C++: eamap_iterator_t) """ return _ida_hexrays.eamap_prev(*args) def eamap_first(*args): """ eamap_first(p) -> ea_t const & Get reference to the current map key. @param p (C++: eamap_iterator_t) """ return _ida_hexrays.eamap_first(*args) def eamap_second(*args): """ eamap_second(p) -> cinsnptrvec_t Get reference to the current map value. @param p (C++: eamap_iterator_t) """ return _ida_hexrays.eamap_second(*args) def eamap_find(*args): """ eamap_find(map, key) -> eamap_iterator_t Find the specified key in eamap_t. @param map (C++: const eamap_t *) @param key (C++: const ea_t &) """ return _ida_hexrays.eamap_find(*args) def eamap_insert(*args): """ eamap_insert(map, key, val) -> eamap_iterator_t Insert new (ea_t, cinsnptrvec_t) pair into eamap_t. @param map (C++: eamap_t *) @param key (C++: const ea_t &) @param val (C++: const cinsnptrvec_t &) """ return _ida_hexrays.eamap_insert(*args) def eamap_erase(*args): """ eamap_erase(map, p) Erase current element from eamap_t. @param map (C++: eamap_t *) @param p (C++: eamap_iterator_t) """ return _ida_hexrays.eamap_erase(*args) def eamap_clear(*args): """ eamap_clear(map) Clear eamap_t. @param map (C++: eamap_t *) """ return _ida_hexrays.eamap_clear(*args) def eamap_size(*args): """ eamap_size(map) -> size_t Get size of eamap_t. @param map (C++: eamap_t *) """ return _ida_hexrays.eamap_size(*args) def eamap_free(*args): """ eamap_free(map) Delete eamap_t instance. @param map (C++: eamap_t *) """ return _ida_hexrays.eamap_free(*args) def eamap_new(*args): """ eamap_new() -> eamap_t Create a new eamap_t instance. """ return _ida_hexrays.eamap_new(*args) class boundaries_iterator_t(object): """ Proxy of C++ boundaries_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.boundaries_iterator_t_x_get, _ida_hexrays.boundaries_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.boundaries_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.boundaries_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> boundaries_iterator_t """ this = _ida_hexrays.new_boundaries_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_boundaries_iterator_t __del__ = lambda self : None; boundaries_iterator_t_swigregister = _ida_hexrays.boundaries_iterator_t_swigregister boundaries_iterator_t_swigregister(boundaries_iterator_t) def boundaries_begin(*args): """ boundaries_begin(map) -> boundaries_iterator_t Get iterator pointing to the beginning of boundaries_t. @param map (C++: const boundaries_t *) """ return _ida_hexrays.boundaries_begin(*args) def boundaries_end(*args): """ boundaries_end(map) -> boundaries_iterator_t Get iterator pointing to the end of boundaries_t. @param map (C++: const boundaries_t *) """ return _ida_hexrays.boundaries_end(*args) def boundaries_next(*args): """ boundaries_next(p) -> boundaries_iterator_t Move to the next element. @param p (C++: boundaries_iterator_t) """ return _ida_hexrays.boundaries_next(*args) def boundaries_prev(*args): """ boundaries_prev(p) -> boundaries_iterator_t Move to the previous element. @param p (C++: boundaries_iterator_t) """ return _ida_hexrays.boundaries_prev(*args) def boundaries_first(*args): """ boundaries_first(p) -> cinsn_t Get reference to the current map key. @param p (C++: boundaries_iterator_t) """ return _ida_hexrays.boundaries_first(*args) def boundaries_second(*args): """ boundaries_second(p) -> rangeset_t Get reference to the current map value. @param p (C++: boundaries_iterator_t) """ return _ida_hexrays.boundaries_second(*args) def boundaries_erase(*args): """ boundaries_erase(map, p) Erase current element from boundaries_t. @param map (C++: boundaries_t *) @param p (C++: boundaries_iterator_t) """ return _ida_hexrays.boundaries_erase(*args) def boundaries_clear(*args): """ boundaries_clear(map) Clear boundaries_t. @param map (C++: boundaries_t *) """ return _ida_hexrays.boundaries_clear(*args) def boundaries_size(*args): """ boundaries_size(map) -> size_t Get size of boundaries_t. @param map (C++: boundaries_t *) """ return _ida_hexrays.boundaries_size(*args) def boundaries_free(*args): """ boundaries_free(map) Delete boundaries_t instance. @param map (C++: boundaries_t *) """ return _ida_hexrays.boundaries_free(*args) def boundaries_new(*args): """ boundaries_new() -> boundaries_t Create a new boundaries_t instance. """ return _ida_hexrays.boundaries_new(*args) class block_chains_iterator_t(object): """ Proxy of C++ block_chains_iterator_t class """ thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr x = _swig_property(_ida_hexrays.block_chains_iterator_t_x_get, _ida_hexrays.block_chains_iterator_t_x_set) def __eq__(self, *args): """ __eq__(self, p) -> bool """ return _ida_hexrays.block_chains_iterator_t___eq__(self, *args) def __ne__(self, *args): """ __ne__(self, p) -> bool """ return _ida_hexrays.block_chains_iterator_t___ne__(self, *args) def __init__(self, *args): """ __init__(self) -> block_chains_iterator_t """ this = _ida_hexrays.new_block_chains_iterator_t(*args) try: self.this.append(this) except: self.this = this __swig_destroy__ = _ida_hexrays.delete_block_chains_iterator_t __del__ = lambda self : None; block_chains_iterator_t_swigregister = _ida_hexrays.block_chains_iterator_t_swigregister block_chains_iterator_t_swigregister(block_chains_iterator_t) def block_chains_begin(*args): """ block_chains_begin(set) -> block_chains_iterator_t Get iterator pointing to the beginning of 'block_chains_t' . @param set (C++: const block_chains_t *) """ return _ida_hexrays.block_chains_begin(*args) def block_chains_end(*args): """ block_chains_end(set) -> block_chains_iterator_t Get iterator pointing to the end of 'block_chains_t' . @param set (C++: const block_chains_t *) """ return _ida_hexrays.block_chains_end(*args) def block_chains_next(*args): """ block_chains_next(p) -> block_chains_iterator_t Move to the next element. @param p (C++: block_chains_iterator_t) """ return _ida_hexrays.block_chains_next(*args) def block_chains_prev(*args): """ block_chains_prev(p) -> block_chains_iterator_t Move to the previous element. @param p (C++: block_chains_iterator_t) """ return _ida_hexrays.block_chains_prev(*args) def block_chains_get(*args): """ block_chains_get(p) -> chain_t Get reference to the current set value. @param p (C++: block_chains_iterator_t) """ return _ida_hexrays.block_chains_get(*args) def block_chains_find(*args): """ block_chains_find(set, val) -> block_chains_iterator_t Find the specified key in set 'block_chains_t' . @param set (C++: const block_chains_t *) @param val (C++: const chain_t &) """ return _ida_hexrays.block_chains_find(*args) def block_chains_insert(*args): """ block_chains_insert(set, val) -> block_chains_iterator_t Insert new ( 'chain_t' ) into set 'block_chains_t' . @param set (C++: block_chains_t *) @param val (C++: const chain_t &) """ return _ida_hexrays.block_chains_insert(*args) def block_chains_erase(*args): """ block_chains_erase(set, p) Erase current element from 'block_chains_t' . @param set (C++: block_chains_t *) @param p (C++: block_chains_iterator_t) """ return _ida_hexrays.block_chains_erase(*args) def block_chains_clear(*args): """ block_chains_clear(set) Clear 'block_chains_t' . @param set (C++: block_chains_t *) """ return _ida_hexrays.block_chains_clear(*args) def block_chains_size(*args): """ block_chains_size(set) -> size_t Get size of 'block_chains_t' . @param set (C++: block_chains_t *) """ return _ida_hexrays.block_chains_size(*args) def block_chains_free(*args): """ block_chains_free(set) Delete 'block_chains_t' instance. @param set (C++: block_chains_t *) """ return _ida_hexrays.block_chains_free(*args) def block_chains_new(*args): """ block_chains_new() -> block_chains_t Create a new 'block_chains_t' instance. """ return _ida_hexrays.block_chains_new(*args) #<pycode(py_hexrays)> import ida_funcs hexrays_failure_t.__str__ = lambda self: str("%x: %s" % (self.errea, self.desc())) # --------------------------------------------------------------------- # Renamings is_allowed_on_small_struni = accepts_small_udts is_small_struni = is_small_udt # --------------------------------------------------------------------- class DecompilationFailure(Exception): """ Raised on a decompilation error. The associated hexrays_failure_t object is stored in the 'info' member of this exception. """ def __init__(self, info): Exception.__init__(self, 'Decompilation failed: %s' % (str(info), )) self.info = info return # --------------------------------------------------------------------- def decompile(ea, hf=None, flags=0): if isinstance(ea, (int, long)): func = ida_funcs.get_func(ea) if not func: return elif type(ea) == ida_funcs.func_t: func = ea else: raise RuntimeError('arg 1 of decompile expects either ea_t or cfunc_t argument') if hf is None: hf = hexrays_failure_t() ptr = _ida_hexrays.decompile_func(func, hf, flags) if ptr.__deref__() is None: raise DecompilationFailure(hf) return ptr # --------------------------------------------------------------------- # stringify all string types #qtype.__str__ = qtype.c_str #qstring.__str__ = qstring.c_str #citem_cmt_t.__str__ = citem_cmt_t.c_str # --------------------------------------------------------------------- # listify all list types import ida_idaapi ida_idaapi._listify_types( cinsnptrvec_t, ctree_items_t, qvector_lvar_t, qvector_carg_t, qvector_ccase_t, hexwarns_t, history_t, lvar_saved_infos_t, ui_stroff_ops_t) def citem_to_specific_type(self): """ cast the citem_t object to its more specific type, either cexpr_t or cinsn_t. """ if self.op >= cot_empty and self.op <= cot_last: return self.cexpr elif self.op >= cit_empty and self.op < cit_end: return self.cinsn raise RuntimeError('unknown op type %s' % (repr(self.op), )) citem_t.to_specific_type = property(citem_to_specific_type) """ array used for translating cinsn_t->op type to their names. """ cinsn_t.op_to_typename = {} for k in dir(_ida_hexrays): if k.startswith('cit_'): cinsn_t.op_to_typename[getattr(_ida_hexrays, k)] = k[4:] """ array used for translating cexpr_t->op type to their names. """ cexpr_t.op_to_typename = {} for k in dir(_ida_hexrays): if k.startswith('cot_'): cexpr_t.op_to_typename[getattr(_ida_hexrays, k)] = k[4:] def property_op_to_typename(self): return self.op_to_typename[self.op] cinsn_t.opname = property(property_op_to_typename) cexpr_t.opname = property(property_op_to_typename) def cexpr_operands(self): """ return a dictionary with the operands of a cexpr_t. """ if self.op >= cot_comma and self.op <= cot_asgumod or \ self.op >= cot_lor and self.op <= cot_fdiv or \ self.op == cot_idx: return {'x': self.x, 'y': self.y} elif self.op == cot_tern: return {'x': self.x, 'y': self.y, 'z': self.z} elif self.op in [cot_fneg, cot_neg, cot_sizeof] or \ self.op >= cot_lnot and self.op <= cot_predec: return {'x': self.x} elif self.op == cot_cast: return {'type': self.type, 'x': self.x} elif self.op == cot_call: return {'x': self.x, 'a': self.a} elif self.op in [cot_memref, cot_memptr]: return {'x': self.x, 'm': self.m} elif self.op == cot_num: return {'n': self.n} elif self.op == cot_fnum: return {'fpc': self.fpc} elif self.op == cot_str: return {'string': self.string} elif self.op == cot_obj: return {'obj_ea': self.obj_ea} elif self.op == cot_var: return {'v': self.v} elif self.op == cot_helper: return {'helper': self.helper} raise RuntimeError('unknown op type %s' % self.opname) cexpr_t.operands = property(cexpr_operands) def cinsn_details(self): """ return the details pointer for the cinsn_t object depending on the value of its op member. \ this is one of the cblock_t, cif_t, etc. objects. """ if self.op not in self.op_to_typename: raise RuntimeError('unknown item->op type') opname = self.opname if opname == 'empty': return self if opname in ['break', 'continue']: return None return getattr(self, 'c' + opname) cinsn_t.details = property(cinsn_details) def cblock_iter(self): iter = self.begin() for i in range(self.size()): yield iter.cur next(iter) return cblock_t.__iter__ = cblock_iter cblock_t.__len__ = cblock_t.size # cblock.find(cinsn_t) -> returns the iterator positioned at the given item def cblock_find(self, item): iter = self.begin() for i in range(self.size()): if iter.cur == item: return iter next(iter) return cblock_t.find = cblock_find # cblock.index(cinsn_t) -> returns the index of the given item def cblock_index(self, item): iter = self.begin() for i in range(self.size()): if iter.cur == item: return i next(iter) return cblock_t.index = cblock_index # cblock.at(int) -> returns the item at the given index index def cblock_at(self, index): iter = self.begin() for i in range(self.size()): if i == index: return iter.cur next(iter) return cblock_t.at = cblock_at # cblock.remove(cinsn_t) def cblock_remove(self, item): iter = self.find(item) self.erase(iter) return cblock_t.remove = cblock_remove # cblock.insert(index, cinsn_t) def cblock_insert(self, index, item): pos = self.at(index) iter = self.find(pos) self.insert(iter, item) return cblock_t.insert = cblock_insert cfuncptr_t.__str__ = lambda self: str(self.__deref__()) import ida_typeinf def cfunc_type(self): """ Get the function's return type tinfo_t object. """ tif = ida_typeinf.tinfo_t() result = self.get_func_type(tif) if not result: return return tif cfunc_t.type = property(cfunc_type) cfuncptr_t.type = property(lambda self: self.__deref__().type) cfunc_t.arguments = property(lambda self: [o for o in self.lvars if o.is_arg_var]) cfuncptr_t.arguments = property(lambda self: self.__deref__().arguments) cfunc_t.lvars = property(cfunc_t.get_lvars) cfuncptr_t.lvars = property(lambda self: self.__deref__().lvars) cfunc_t.warnings = property(cfunc_t.get_warnings) cfuncptr_t.warnings = property(lambda self: self.__deref__().warnings) cfunc_t.pseudocode = property(cfunc_t.get_pseudocode) cfuncptr_t.pseudocode = property(lambda self: self.__deref__().get_pseudocode()) cfunc_t.eamap = property(cfunc_t.get_eamap) cfuncptr_t.eamap = property(lambda self: self.__deref__().get_eamap()) cfunc_t.boundaries = property(cfunc_t.get_boundaries) cfuncptr_t.boundaries = property(lambda self: self.__deref__().get_boundaries()) #pragma SWIG nowarn=+503 lvar_t.used = property(lvar_t.used) lvar_t.typed = property(lvar_t.typed) lvar_t.mreg_done = property(lvar_t.mreg_done) lvar_t.has_nice_name = property(lvar_t.has_nice_name) lvar_t.is_unknown_width = property(lvar_t.is_unknown_width) lvar_t.has_user_info = property(lvar_t.has_user_info) lvar_t.has_user_name = property(lvar_t.has_user_name) lvar_t.has_user_type = property(lvar_t.has_user_type) lvar_t.is_result_var = property(lvar_t.is_result_var) lvar_t.is_arg_var = property(lvar_t.is_arg_var) lvar_t.is_fake_var = property(lvar_t.is_fake_var) lvar_t.is_overlapped_var = property(lvar_t.is_overlapped_var) lvar_t.is_floating_var = property(lvar_t.is_floating_var) lvar_t.is_spoiled_var = property(lvar_t.is_spoiled_var) lvar_t.is_mapdst_var = property(lvar_t.is_mapdst_var) # dictify all dict-like types def _map_as_dict(maptype, name, keytype, valuetype): maptype.keytype = keytype maptype.valuetype = valuetype for fctname in ['begin', 'end', 'first', 'second', 'next', \ 'find', 'insert', 'erase', 'clear', 'size']: fct = getattr(_ida_hexrays, name + '_' + fctname) setattr(maptype, '__' + fctname, fct) maptype.__len__ = maptype.size maptype.__getitem__ = maptype.at maptype.begin = lambda self, *args: self.__begin(self, *args) maptype.end = lambda self, *args: self.__end(self, *args) maptype.first = lambda self, *args: self.__first(*args) maptype.second = lambda self, *args: self.__second(*args) maptype.next = lambda self, *args: self.__next(*args) maptype.find = lambda self, *args: self.__find(self, *args) maptype.insert = lambda self, *args: self.__insert(self, *args) maptype.erase = lambda self, *args: self.__erase(self, *args) maptype.clear = lambda self, *args: self.__clear(self, *args) maptype.size = lambda self, *args: self.__size(self, *args) def _map___iter__(self): """ Iterate over dictionary keys. """ return self.iterkeys() maptype.__iter__ = _map___iter__ def _map___getitem__(self, key): """ Returns the value associated with the provided key. """ if not isinstance(key, self.keytype): raise KeyError('type of key should be ' + repr(self.keytype) + ' but got ' + repr(type(key))) if key not in self: raise KeyError('key not found') return self.second(self.find(key)) maptype.__getitem__ = _map___getitem__ def _map___setitem__(self, key, value): """ Returns the value associated with the provided key. """ if not isinstance(key, self.keytype): raise KeyError('type of `key` should be ' + repr(self.keytype) + ' but got ' + repr(type(key))) if not isinstance(value, self.valuetype): raise KeyError('type of `value` should be ' + repr(self.valuetype) + ' but got ' + type(value)) self.insert(key, value) return maptype.__setitem__ = _map___setitem__ def _map___delitem__(self, key): """ Removes the value associated with the provided key. """ if not isinstance(key, self.keytype): raise KeyError('type of `key` should be ' + repr(self.keytype) + ' but got ' + repr(type(key))) if key not in self: raise KeyError('key not found') self.erase(self.find(key)) return maptype.__delitem__ = _map___delitem__ def _map___contains__(self, key): """ Returns true if the specified key exists in the . """ if not isinstance(key, self.keytype): raise KeyError('type of `key` should be ' + repr(self.keytype) + ' but got ' + repr(type(key))) if self.find(key) != self.end(): return True return False maptype.__contains__ = _map___contains__ def _map_clear(self): self.clear() return maptype.clear = _map_clear def _map_copy(self): ret = {} for k in self.iterkeys(): ret[k] = self[k] return ret maptype.copy = _map_copy def _map_get(self, key, default=None): if key in self: return self[key] return default maptype.get = _map_get def _map_iterkeys(self): iter = self.begin() while iter != self.end(): yield self.first(iter) iter = self.next(iter) return maptype.iterkeys = _map_iterkeys def _map_itervalues(self): iter = self.begin() while iter != self.end(): yield self.second(iter) iter = self.next(iter) return maptype.itervalues = _map_itervalues def _map_iteritems(self): iter = self.begin() while iter != self.end(): yield (self.first(iter), self.second(iter)) iter = self.next(iter) return maptype.iteritems = _map_iteritems def _map_keys(self): return list(self.iterkeys()) maptype.keys = _map_keys def _map_values(self): return list(self.itervalues()) maptype.values = _map_values def _map_items(self): return list(self.iteritems()) maptype.items = _map_items def _map_has_key(self, key): return key in self maptype.has_key = _map_has_key def _map_pop(self, key): """ Sets the value associated with the provided key. """ if not isinstance(key, self.keytype): raise KeyError('type of `key` should be ' + repr(self.keytype) + ' but got ' + repr(type(key))) if key not in self: raise KeyError('key not found') ret = self[key] del self[key] return ret maptype.pop = _map_pop def _map_popitem(self): """ Sets the value associated with the provided key. """ if len(self) == 0: raise KeyError('key not found') key = self.keys()[0] return (key, self.pop(key)) maptype.popitem = _map_popitem def _map_setdefault(self, key, default=None): """ Sets the value associated with the provided key. """ if not isinstance(key, self.keytype): raise KeyError('type of `key` should be ' + repr(self.keytype) + ' but got ' + repr(type(key))) if key in self: return self[key] self[key] = default return default maptype.setdefault = _map_setdefault #_map_as_dict(user_labels_t, 'user_labels', (int, long), qstring) _map_as_dict(user_cmts_t, 'user_cmts', treeloc_t, citem_cmt_t) _map_as_dict(user_numforms_t, 'user_numforms', operand_locator_t, number_format_t) _map_as_dict(user_iflags_t, 'user_iflags', citem_locator_t, int) import ida_pro _map_as_dict(user_unions_t, 'user_unions', (int, long), ida_pro.intvec_t) _map_as_dict(eamap_t, 'eamap', long, cinsnptrvec_t) import ida_range _map_as_dict(boundaries_t, 'boundaries', cinsn_t, ida_range.rangeset_t) # # Object ownership # def _call_with_transferrable_ownership(fun, *args): e = args[0] was_owned = e.thisown res = fun(e, *args[1:]) # ATM, 'res' doesn't own the resulting cexpr_t. # In case 'fun' # - created a new object: we want to own that one in case 'e' was owned # - didn't create a new object: we will remove & re-gain ownership on # the same underlying cexpr_t. No biggie. if was_owned: if res: e._maybe_disown_and_deregister() res._own_and_register() else: debug_hexrays_ctree("NOTE: call_with_transferrable_ownership() called with non-IDAPython-owned object. Is this intentional?") return res def lnot(e): return _call_with_transferrable_ownership(_ll_lnot, e) def make_ref(e): return _call_with_transferrable_ownership(_ll_make_ref, e) def dereference(e, ptrsize, is_float=False): return _call_with_transferrable_ownership(_ll_dereference, e, ptrsize, is_float) def call_helper(rettype, args, *rest): res = _ll_call_helper(rettype, args, *rest) if res: res._own_and_register() if type(args) == carglist_t: args.thisown = False return res def new_block(): res = _ll_new_block() if res: res._own_and_register() return res def make_num(*args): res = _ll_make_num(*args) if res: res._own_and_register() return res def create_helper(*args): res = _ll_create_helper(*args) if res: res._own_and_register() return res # ---------------- class __cbhooks_t(Hexrays_Hooks): instances = [] def __init__(self, callback): self.callback = callback self.instances.append(self) Hexrays_Hooks.__init__(self) def maturity(self, *args): return self.callback(hxe_maturity, *args) def interr(self, *args): return self.callback(hxe_interr, *args) def print_func(self, *args): return self.callback(hxe_print_func, *args) def func_printed(self, *args): return self.callback(hxe_func_printed, *args) def open_pseudocode(self, *args): return self.callback(hxe_open_pseudocode, *args) def switch_pseudocode(self, *args): return self.callback(hxe_switch_pseudocode, *args) def refresh_pseudocode(self, *args): return self.callback(hxe_refresh_pseudocode, *args) def close_pseudocode(self, *args): return self.callback(hxe_close_pseudocode, *args) def keyboard(self, *args): return self.callback(hxe_keyboard, *args) def right_click(self, *args): return self.callback(hxe_right_click, *args) def double_click(self, *args): return self.callback(hxe_double_click, *args) def curpos(self, *args): return self.callback(hxe_curpos, *args) def create_hint(self, *args): return self.callback(hxe_create_hint, *args) def text_ready(self, *args): return self.callback(hxe_text_ready, *args) def populating_popup(self, *args): return self.callback(hxe_populating_popup, *args) def install_hexrays_callback(callback): "Deprecated. Please use Hexrays_Hooks instead" h = __cbhooks_t(callback) h.hook() return True def remove_hexrays_callback(callback): "Deprecated. Please use Hexrays_Hooks instead" for inst in __cbhooks_t.instances: if inst.callback == callback: inst.unhook() __cbhooks_t.instances.remove(inst) return 1 return 0 #</pycode(py_hexrays)> if _BC695: get_tform_vdui=get_widget_vdui hx_get_tform_vdui=hx_get_widget_vdui HEXRAYS_API_MAGIC1=(HEXRAYS_API_MAGIC>>32) HEXRAYS_API_MAGIC2=(HEXRAYS_API_MAGIC&0xFFFFFFFF)
29.641948
603
0.637696
403,709
0.71325
6,245
0.011033
0
0
0
0
166,152
0.293548
bcc6795e9da5c859c6308d7dfd37a7f5806dbb41
3,714
py
Python
webapp/gen_graphs.py
bfitzy2142/NET4901-SP
908c13332a5356bd6a59879b8d78af76432b807c
[ "MIT" ]
3
2019-08-04T03:09:02.000Z
2020-06-08T15:48:36.000Z
webapp/gen_graphs.py
bfitzy2142/NET4901-SP
908c13332a5356bd6a59879b8d78af76432b807c
[ "MIT" ]
3
2019-09-06T08:30:21.000Z
2020-06-30T03:24:56.000Z
webapp/gen_graphs.py
bfitzy2142/NET4901-SP-SDLENS
908c13332a5356bd6a59879b8d78af76432b807c
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 """ @author: Sam Cook MySql Parser for graphical presentation """ import mysql.connector import datetime from mysql.connector import Error from datetime import datetime, timedelta import json class sql_graph_info(): def __init__(self, node, interface, time, sql_creds, db): """ Initializer for the sql_graph_info Object. """ self.node = node self.interface = interface self.time = time self.sql_creds = sql_creds self.db = db def db_pull(self, node, interface, time, ): """ Pulls the RX and TX information from the database to display for the graphs page. Arguments: node [str] -- The node that holds the interface which is to presented. interface [str] -- The interface in which the counter information will be based off of. time [str] -- Time ranging from 30 minutes to 10 Years Returns: dict -- containing arrays of the counter values at their coresponding timestamp. """ data_end = datetime.now() if time == '1': data_start = datetime.now() - timedelta(hours=0, minutes=30) elif time == '2': data_start = datetime.now() - timedelta(hours=1) elif time == '3': data_start = datetime.now() - timedelta(hours=2) elif time == '4': data_start = datetime.now() - timedelta(hours=6) elif time == '5': data_start = datetime.now() - timedelta(days=1) else: data_start = datetime.now() - timedelta(days=3650) data_end.strftime('%Y-%m-%d %H:%M:%S') data_start.strftime('%Y-%m-%d %H:%M:%S') node_st = "openflow" + node query = ( f"SELECT timestamp, Rx_pckts, Tx_pckts, Rx_drops, Tx_drops " f"FROM {node_st}_counters WHERE " f"Interface='openflow:{node}:{interface}'" f"AND timestamp >= '{data_start}'" f"AND timestamp < '{data_end}'" ) mydb = mysql.connector.connect( host=self.sql_creds['host'], user=self.sql_creds['user'], passwd=self.sql_creds['password'], database=self.db ) cur = mydb.cursor() cur.execute(query) response = cur.fetchall() graphPoints = [] displayPoints = [] dataPointDict = {} for dataPoint in response: date = str(dataPoint[0]) rx_count = int(dataPoint[1]) tx_count = int(dataPoint[2]) rx_drops = int(dataPoint[3]) tx_drops = int(dataPoint[4]) if dataPointDict: old_rx_c = int(dataPointDict['rx_count']) old_tx_c = int(dataPointDict["tx_count"]) old_rx_d = int(dataPointDict["rx_drops"]) old_tx_d = int(dataPointDict["tx_drops"]) dif_rx_c = rx_count - old_rx_c dif_tx_c = tx_count - old_tx_c dif_rx_d = rx_drops - old_rx_d dif_tx_d = tx_drops - old_tx_d difDict = {"date": date, "rx_count": dif_rx_c, "tx_count": dif_tx_c, "rx_drops": dif_rx_d, "tx_drops": dif_tx_d} displayPoints.append(difDict) dataPointDict = {"date": date, "rx_count": rx_count, "tx_count": tx_count, "rx_drops": rx_drops, "tx_drops": tx_drops} graphPoints.append(dataPointDict) return displayPoints
34.71028
72
0.53608
3,495
0.941034
0
0
0
0
0
0
1,136
0.30587
bcca1a19ecd367ba4725d3ef774b347cae61be62
830
py
Python
scqubits/tests/test_fluxqubit.py
dmtvanzanten/scqubits
d4d8a0f71ac91077594a6173348279aa490ed048
[ "BSD-3-Clause" ]
null
null
null
scqubits/tests/test_fluxqubit.py
dmtvanzanten/scqubits
d4d8a0f71ac91077594a6173348279aa490ed048
[ "BSD-3-Clause" ]
null
null
null
scqubits/tests/test_fluxqubit.py
dmtvanzanten/scqubits
d4d8a0f71ac91077594a6173348279aa490ed048
[ "BSD-3-Clause" ]
null
null
null
# test_fluxqubit.py # meant to be run with 'pytest' # # This file is part of scqubits. # # Copyright (c) 2019 and later, Jens Koch and Peter Groszkowski # All rights reserved. # # This source code is licensed under the BSD-style license found in the # LICENSE file in the root directory of this source tree. ############################################################################ import numpy as np from scqubits import FluxQubit from scqubits.tests.conftest import StandardTests class TestFluxQubit(StandardTests): @classmethod def setup_class(cls): cls.qbt = None cls.qbt_type = FluxQubit cls.file_str = "fluxqubit" cls.op1_str = "n_1_operator" cls.op2_str = "n_2_operator" cls.param_name = "flux" cls.param_list = np.linspace(0.45, 0.55, 50)
28.62069
76
0.622892
328
0.395181
0
0
288
0.346988
0
0
431
0.519277
bcca9310b776373045a4dd0e28575a2063a3d591
1,379
py
Python
PhysicsTools/PatAlgos/python/producersLayer1/pfParticleProducer_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
852
2015-01-11T21:03:51.000Z
2022-03-25T21:14:00.000Z
PhysicsTools/PatAlgos/python/producersLayer1/pfParticleProducer_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
30,371
2015-01-02T00:14:40.000Z
2022-03-31T23:26:05.000Z
PhysicsTools/PatAlgos/python/producersLayer1/pfParticleProducer_cfi.py
ckamtsikis/cmssw
ea19fe642bb7537cbf58451dcf73aa5fd1b66250
[ "Apache-2.0" ]
3,240
2015-01-02T05:53:18.000Z
2022-03-31T17:24:21.000Z
import FWCore.ParameterSet.Config as cms patPFParticles = cms.EDProducer("PATPFParticleProducer", # General configurables pfCandidateSource = cms.InputTag("noJet"), # MC matching configurables addGenMatch = cms.bool(False), genParticleMatch = cms.InputTag(""), ## particles source to be used for the MC matching ## must be an InputTag or VInputTag to a product of ## type edm::Association<reco::GenParticleCollection> embedGenMatch = cms.bool(False), ## embed gen match inside the object instead of storing the ref # add user data userData = cms.PSet( # add custom classes here userClasses = cms.PSet( src = cms.VInputTag('') ), # add doubles here userFloats = cms.PSet( src = cms.VInputTag('') ), # add ints here userInts = cms.PSet( src = cms.VInputTag('') ), # add candidate ptrs here userCands = cms.PSet( src = cms.VInputTag('') ), # add "inline" functions here userFunctions = cms.vstring(), userFunctionLabels = cms.vstring() ), # Efficiencies addEfficiencies = cms.bool(False), efficiencies = cms.PSet(), # resolution addResolutions = cms.bool(False), resolutions = cms.PSet(), )
29.340426
106
0.585207
0
0
0
0
0
0
0
0
460
0.333575
bccb37cf2799cc964344db7c5cf679594dae2889
2,252
py
Python
tests/test_api.py
ines/spacy-js
5b7a86cb0d1099285e01252f7e1d44a36ad9a07f
[ "MIT" ]
141
2018-10-27T17:18:54.000Z
2022-03-31T11:08:02.000Z
tests/test_api.py
Fabulabs/spacy-js
c7a34298203d26b25f9eb1f6b9eb875faa33d144
[ "MIT" ]
16
2018-10-27T21:44:36.000Z
2022-01-22T03:01:54.000Z
tests/test_api.py
Fabulabs/spacy-js
c7a34298203d26b25f9eb1f6b9eb875faa33d144
[ "MIT" ]
22
2019-01-12T16:38:20.000Z
2022-03-14T19:11:38.000Z
# coding: utf8 from __future__ import unicode_literals import pytest import spacy import json from api.server import parse, doc2json, load_model @pytest.fixture(scope="session") def model(): return "en_core_web_sm" @pytest.fixture(scope="session") def text(): return "This is a sentence about Facebook. This is another one." @pytest.fixture(scope="session") def nlp(model): return spacy.load(model) @pytest.fixture(scope="session") def doc(nlp, text): return nlp(text) def test_server_parse(model, text, doc): load_model(model) json_doc = parse(model, text) direct_json_doc = doc2json(doc, model) assert json.dumps(json_doc, sort_keys=True) == json.dumps( direct_json_doc, sort_keys=True ) def test_doc2json_doc_tokens(doc, model): data = doc2json(doc, model) assert data["model"] == model assert data["doc"]["text"] == doc.text assert data["doc"]["text_with_ws"] == doc.text_with_ws assert data["doc"]["is_tagged"] assert data["doc"]["is_parsed"] assert data["doc"]["is_sentenced"] assert len(data["tokens"]) == len(doc) assert data["tokens"][0]["text"] == doc[0].text assert data["tokens"][0]["head"] == doc[0].head.i def test_doc2json_doc_ents(doc, model): data = doc2json(doc, model) ents = list(doc.ents) assert "ents" in data assert len(data["ents"]) == len(ents) assert len(data["ents"]) >= 1 assert data["ents"][0]["start"] == ents[0].start assert data["ents"][0]["end"] == ents[0].end assert data["ents"][0]["label"] == ents[0].label_ def test_doc2json_doc_sents(doc, model): data = doc2json(doc, model) sents = list(doc.sents) assert "sents" in data assert len(data["sents"]) == len(sents) assert len(data["sents"]) >= 1 assert data["sents"][0]["start"] == sents[0].start assert data["sents"][0]["end"] == sents[0].end def test_doc2json_doc_noun_chunks(doc, model): data = doc2json(doc, model) chunks = list(doc.noun_chunks) assert "noun_chunks" in data assert len(data["noun_chunks"]) == len(chunks) assert len(data["noun_chunks"]) >= 1 assert data["noun_chunks"][0]["start"] == chunks[0].start assert data["noun_chunks"][0]["end"] == chunks[0].end
27.463415
68
0.654085
0
0
0
0
336
0.149201
0
0
426
0.189165
bcccafa97336dc1ded4587f29664425a01e6d815
28,365
py
Python
python/GafferArnold/ArnoldTextureBake.py
medubelko/gaffer
12c5994c21dcfb8b13b5b86efbcecdcb29202b33
[ "BSD-3-Clause" ]
1
2019-12-02T02:31:25.000Z
2019-12-02T02:31:25.000Z
python/GafferArnold/ArnoldTextureBake.py
medubelko/gaffer
12c5994c21dcfb8b13b5b86efbcecdcb29202b33
[ "BSD-3-Clause" ]
null
null
null
python/GafferArnold/ArnoldTextureBake.py
medubelko/gaffer
12c5994c21dcfb8b13b5b86efbcecdcb29202b33
[ "BSD-3-Clause" ]
null
null
null
########################################################################## # # Copyright (c) 2018, Image Engine Design Inc. All rights reserved. # # 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 John Haddon nor the names of # any other contributors to this software 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 OWNER 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. # ########################################################################## import IECore import IECoreScene import Gaffer import GafferScene import GafferArnold import GafferDispatch import GafferImage import imath import inspect class ArnoldTextureBake( GafferDispatch.TaskNode ) : class __CameraSetup( GafferScene.FilteredSceneProcessor ) : def __init__( self, name = "__CameraSetup" ) : GafferScene.FilteredSceneProcessor.__init__( self, name ) # Public plugs self["cameraGroup"] = Gaffer.StringPlug( "cameraGroup", Gaffer.Plug.Direction.In, "__TEXTUREBAKE_CAMERAS" ) self["bakeDirectory"] = Gaffer.StringPlug( "bakeDirectory", Gaffer.Plug.Direction.In, "" ) self["defaultFileName"] = Gaffer.StringPlug( "defaultFileName", Gaffer.Plug.Direction.In, "${bakeDirectory}/<AOV>/<AOV>.<UDIM>.exr" ) self["defaultResolution"] = Gaffer.IntPlug( "defaultResolution", Gaffer.Plug.Direction.In, 512 ) self["uvSet"] = Gaffer.StringPlug( "uvSet", Gaffer.Plug.Direction.In, "uv" ) self["udims"] = Gaffer.StringPlug( "udims", Gaffer.Plug.Direction.In, "" ) self["normalOffset"] = Gaffer.FloatPlug( "normalOffset", Gaffer.Plug.Direction.In, 0.1 ) self["aovs"] = Gaffer.StringPlug( "aovs", Gaffer.Plug.Direction.In, "beauty:rgba" ) self["tasks"] = Gaffer.IntPlug( "tasks", Gaffer.Plug.Direction.In, 1 ) self["taskIndex"] = Gaffer.IntPlug( "taskIndex", Gaffer.Plug.Direction.In, 0 ) # Output self["renderFileList"] = Gaffer.StringVectorDataPlug( "renderFileList", Gaffer.Plug.Direction.Out, defaultValue = IECore.StringVectorData() ) self["renderFileList"].setFlags( Gaffer.Plug.Flags.Serialisable, False ) # Private internal network self["__udimQuery"] = GafferScene.UDIMQuery() self["__udimQuery"]["in"].setInput( self["in"] ) self["__udimQuery"]["uvSet"].setInput( self["uvSet"] ) self["__udimQuery"]["attributes"].setValue( "bake:resolution bake:fileName" ) self["__udimQuery"]["filter"].setInput( self["filter"] ) self["__chunkedBakeInfo"] = Gaffer.CompoundObjectPlug( "__chunkedBakeInfo", Gaffer.Plug.Direction.In, IECore.CompoundObject() ) self["__chunkedBakeInfo"].setFlags( Gaffer.Plug.Flags.Serialisable, False ) self["__chunkExpression"] = Gaffer.Expression() self["__chunkExpression"].setExpression( inspect.cleandoc( """ import collections import re rawInfo = parent["__udimQuery"]["out"] defaultFileName = parent["defaultFileName"] defaultResolution = parent["defaultResolution"] selectUdimsStr = parent["udims"] # FrameList really ought to take care of this check, instead of just doing # something obviously wrong if re.match( ".*[0-9] +[0-9].*", selectUdimsStr ): raise RuntimeError( "ArnoldTextureBake : Udim list must be comma separated." ) selectUdims = set( IECore.FrameList.parse( selectUdimsStr ).asList() ) allMeshes = collections.defaultdict( lambda : [] ) for udim, meshes in rawInfo.items(): if selectUdims and not int( udim ) in selectUdims: continue for mesh, extraAttributes in meshes.items(): resolution = defaultResolution if "bake:resolution" in extraAttributes: resolution = extraAttributes["bake:resolution"].value fileName = defaultFileName if "bake:fileName" in extraAttributes: fileName = extraAttributes["bake:fileName"].value allMeshes[ (fileName, udim) ].append( { "mesh" : mesh, "resolution" : resolution } ) fileList = sorted( allMeshes.keys() ) info = IECore.CompoundObject() numTasks = min( parent["tasks"], len( fileList ) ) taskIndex = parent["taskIndex"] if taskIndex < numTasks: chunkStart = ( taskIndex * len( fileList ) ) / numTasks chunkEnd = ( ( taskIndex + 1 ) * len( fileList ) ) / numTasks dupeCount = 0 prevFileName = "" for fileNameTemplate, udim in fileList[chunkStart:chunkEnd]: for meshData in allMeshes[(fileNameTemplate, udim)]: o = IECore.CompoundObject() o["mesh"] = IECore.StringData( meshData["mesh"] ) o["udim"] = IECore.IntData( int( udim ) ) o["resolution"] = IECore.IntData( meshData["resolution"] ) udimStr = str( udim ) fileName = fileNameTemplate.replace( "<UDIM>", udimStr ) if fileName == prevFileName: dupeCount += 1 fileName = fileName + ".layer" + str( dupeCount ) else: prevFileName = fileName dupeCount = 0 o["fileName"] = IECore.StringData( fileName ) name = o["mesh"].value.replace( "/", "_" ) + "." + udimStr info[ name ] = o parent["__chunkedBakeInfo"] = info fileList = [] for name, i in info.items(): fileName = i["fileName"].value for nameAndAov in parent["aovs"].strip( " " ).split( " " ): fileList.append( i["fileName"].value.replace( "<AOV>", nameAndAov.split(":")[0] ) ) parent["renderFileList"] = IECore.StringVectorData( fileList ) """ ), "python" ) self["__parent"] = GafferScene.Parent() self["__parent"]["parent"].setValue( "/" ) for c in ['bound', 'transform', 'attributes', 'object', 'childNames', 'setNames', 'set']: self["__parent"]["in"][c].setInput( self["in"][c] ) self["__outputExpression"] = Gaffer.Expression() self["__outputExpression"].setExpression( inspect.cleandoc( """ import IECoreScene # Transfer all input globals except for outputs inGlobals = parent["in"]["globals"] outGlobals = IECore.CompoundObject() for key, value in inGlobals.items(): if not key.startswith( "output:" ): outGlobals[key] = value # Make our own outputs info = parent["__chunkedBakeInfo"] for cameraName, i in info.items(): params = IECore.CompoundData() fileName = i["fileName"].value params["camera"] = IECore.StringData( "/" + parent["cameraGroup"] + "/" + cameraName ) for nameAndAov in parent["aovs"].strip( " " ).split( " " ): tokens = nameAndAov.split( ":" ) if len( tokens ) != 2: raise RuntimeError( "Invalid bake aov specification: %s It should contain a : between name and data." ) ( aovName, aov ) = tokens aovFileName = fileName.replace( "<AOV>", aovName ) outGlobals["output:" + cameraName + "." + aov] = IECoreScene.Output( aovFileName, "exr", aov + " RGBA", params ) parent["__parent"]["in"]["globals"] = outGlobals """ ), "python" ) self["__camera"] = GafferScene.Camera() self["__camera"]["projection"].setValue( "orthographic" ) self["__cameraTweaks"] = GafferScene.CameraTweaks() self["__cameraTweaks"]["in"].setInput( self["__camera"]["out"] ) self["__cameraTweaks"]["tweaks"]["projection"] = GafferScene.TweakPlug( "projection", "uv_camera" ) self["__cameraTweaks"]["tweaks"]["resolution"] = GafferScene.TweakPlug( "resolution", imath.V2i( 0 ) ) self["__cameraTweaks"]["tweaks"]["u_offset"] = GafferScene.TweakPlug( "u_offset", 0.0 ) self["__cameraTweaks"]["tweaks"]["v_offset"] = GafferScene.TweakPlug( "v_offset", 0.0 ) self["__cameraTweaks"]["tweaks"]["mesh"] = GafferScene.TweakPlug( "mesh", "" ) self["__cameraTweaks"]["tweaks"]["uv_set"] = GafferScene.TweakPlug( "uv_set", "" ) self["__cameraTweaks"]["tweaks"]["extend_edges"] = GafferScene.TweakPlug( "extend_edges", False ) self["__cameraTweaks"]["tweaks"]["offset"] = GafferScene.TweakPlug( "offset", 0.1 ) self["__cameraTweaks"]["tweaks"]["offset"]["value"].setInput( self["normalOffset"] ) self["__cameraTweaksFilter"] = GafferScene.PathFilter() self["__cameraTweaksFilter"]["paths"].setValue( IECore.StringVectorData( [ '/camera' ] ) ) self["__cameraTweaks"]["filter"].setInput( self["__cameraTweaksFilter"]["out"] ) self["__collectScenes"] = GafferScene.CollectScenes() self["__collectScenes"]["sourceRoot"].setValue( "/camera" ) self["__collectScenes"]["rootNameVariable"].setValue( "collect:cameraName" ) self["__collectScenes"]["in"].setInput( self["__cameraTweaks"]["out"] ) self["__group"] = GafferScene.Group() self["__group"]["in"][0].setInput( self["__collectScenes"]["out"] ) self["__group"]["name"].setInput( self["cameraGroup"] ) self["__parent"]["children"][0].setInput( self["__group"]["out"] ) self["__collectSceneRootsExpression"] = Gaffer.Expression() self["__collectSceneRootsExpression"].setExpression( inspect.cleandoc( """ info = parent["__chunkedBakeInfo"] parent["__collectScenes"]["rootNames"] = IECore.StringVectorData( info.keys() ) """ ), "python" ) self["__cameraSetupExpression"] = Gaffer.Expression() self["__cameraSetupExpression"].setExpression( inspect.cleandoc( """ cameraName = context["collect:cameraName"] info = parent["__chunkedBakeInfo"] i = info[cameraName] udimOffset = i["udim"].value - 1001 parent["__cameraTweaks"]["tweaks"]["resolution"]["value"] = imath.V2i( i["resolution"].value ) parent["__cameraTweaks"]["tweaks"]["u_offset"]["value"] = -( udimOffset % 10 ) parent["__cameraTweaks"]["tweaks"]["v_offset"]["value"] = -( udimOffset / 10 ) parent["__cameraTweaks"]["tweaks"]["mesh"]["value"] = i["mesh"].value parent["__cameraTweaks"]["tweaks"]["uv_set"]["value"] = parent["uvSet"] if parent["uvSet"] != "uv" else "" """ ), "python" ) self["out"].setFlags( Gaffer.Plug.Flags.Serialisable, False ) self["out"].setInput( self["__parent"]["out"] ) def __init__( self, name = "ArnoldTextureBake" ) : GafferDispatch.TaskNode.__init__( self, name ) self["in"] = GafferScene.ScenePlug() self["filter"] = GafferScene.FilterPlug() self["bakeDirectory"] = Gaffer.StringPlug( "bakeDirectory", defaultValue = "" ) self["defaultFileName"] = Gaffer.StringPlug( "defaultFileName", defaultValue = "${bakeDirectory}/<AOV>/<AOV>.<UDIM>.exr" ) self["defaultResolution"] = Gaffer.IntPlug( "defaultResolution", defaultValue = 512 ) self["uvSet"] = Gaffer.StringPlug( "uvSet", defaultValue = 'uv' ) self["udims"] = Gaffer.StringPlug( "udims", defaultValue = "" ) self["normalOffset"] = Gaffer.FloatPlug( "offset", defaultValue = 0.1 ) self["aovs"] = Gaffer.StringPlug( "aovs", defaultValue = 'beauty:RGBA' ) self["tasks"] = Gaffer.IntPlug( "tasks", defaultValue = 1 ) self["cleanupIntermediateFiles"] = Gaffer.BoolPlug( "cleanupIntermediateFiles", defaultValue = True ) self["applyMedianFilter"] = Gaffer.BoolPlug( "applyMedianFilter", Gaffer.Plug.Direction.In, False ) self["medianRadius"] = Gaffer.IntPlug( "medianRadius", Gaffer.Plug.Direction.In, 1 ) # Set up connection to preTasks beforehand self["__PreTaskList"] = GafferDispatch.TaskList() self["__PreTaskList"]["preTasks"].setInput( self["preTasks"] ) self["__CleanPreTasks"] = Gaffer.DeleteContextVariables() self["__CleanPreTasks"].setup( GafferDispatch.TaskNode.TaskPlug() ) self["__CleanPreTasks"]["in"].setInput( self["__PreTaskList"]["task"] ) self["__CleanPreTasks"]["variables"].setValue( "BAKE_WEDGE:index BAKE_WEDGE:value_unused" ) # First, setup python commands which will dispatch a chunk of a render or image tasks as # immediate execution once they reach the farm - this allows us to run multiple tasks in # one farm process. self["__RenderDispatcher"] = GafferDispatch.PythonCommand() self["__RenderDispatcher"]["preTasks"][0].setInput( self["__CleanPreTasks"]["out"] ) self["__RenderDispatcher"]["command"].setValue( inspect.cleandoc( """ import GafferDispatch # We need to access frame and "BAKE_WEDGE:index" so that the hash of render varies with the wedge index, # so we might as well print what we're doing IECore.msg( IECore.MessageHandler.Level.Info, "Bake Process", "Dispatching render task index %i for frame %i" % ( context["BAKE_WEDGE:index"], context.getFrame() ) ) d = GafferDispatch.LocalDispatcher() d.dispatch( [ self.parent()["__bakeDirectoryContext"] ] ) """ ) ) self["__ImageDispatcher"] = GafferDispatch.PythonCommand() self["__ImageDispatcher"]["preTasks"][0].setInput( self["__RenderDispatcher"]["task"] ) self["__ImageDispatcher"]["command"].setValue( inspect.cleandoc( """ import GafferDispatch # We need to access frame and "BAKE_WEDGE:index" so that the hash of render varies with the wedge index, # so we might as well print what we're doing IECore.msg( IECore.MessageHandler.Level.Info, "Bake Process", "Dispatching image task index %i for frame %i" % ( context["BAKE_WEDGE:index"], context.getFrame() ) ) d = GafferDispatch.LocalDispatcher() d.dispatch( [ self.parent()["__CleanUpSwitch"] ] ) """ ) ) # Connect through the dispatch settings to the render dispatcher # ( The image dispatcher runs much quicker, and should be OK using default settings ) self["__RenderDispatcher"]["dispatcher"].setInput( self["dispatcher"] ) # Set up variables so the dispatcher knows that the render and image dispatches depend on # the file paths ( in case they are varying in a wedge ) for redispatch in [ self["__RenderDispatcher"], self["__ImageDispatcher"] ]: redispatch["variables"].addChild( Gaffer.NameValuePlug( "bakeDirectory", "", "bakeDirectoryVar" ) ) redispatch["variables"].addChild( Gaffer.NameValuePlug( "defaultFileName", "", "defaultFileNameVar" ) ) # Connect the variables via an expression so that get expanded ( this also means that # if you put #### in a filename you will get per frame tasks, because the hash will depend # on frame number ) self["__DispatchVariableExpression"] = Gaffer.Expression() self["__DispatchVariableExpression"].setExpression( inspect.cleandoc( """ parent["__RenderDispatcher"]["variables"]["bakeDirectoryVar"]["value"] = parent["bakeDirectory"] parent["__RenderDispatcher"]["variables"]["defaultFileNameVar"]["value"] = parent["defaultFileName"] parent["__ImageDispatcher"]["variables"]["bakeDirectoryVar"]["value"] = parent["bakeDirectory"] parent["__ImageDispatcher"]["variables"]["defaultFileNameVar"]["value"] = parent["defaultFileName"] """ ), "python" ) # Wedge based on tasks into the overall number of tasks to run. Note that we don't know how # much work each task will do until we actually run the render tasks ( this is when scene # expansion happens ). Because we must group all tasks that write to the same file into the # same task batch, if tasks is a large number, some tasks batches could end up empty self["__MainWedge"] = GafferDispatch.Wedge() self["__MainWedge"]["preTasks"][0].setInput( self["__ImageDispatcher"]["task"] ) self["__MainWedge"]["variable"].setValue( "BAKE_WEDGE:value_unused" ) self["__MainWedge"]["indexVariable"].setValue( "BAKE_WEDGE:index" ) self["__MainWedge"]["mode"].setValue( 1 ) self["__MainWedge"]["intMin"].setValue( 1 ) self["__MainWedge"]["intMax"].setInput( self["tasks"] ) self["task"].setInput( self["__MainWedge"]["task"] ) self["task"].setFlags( Gaffer.Plug.Flags.Serialisable, False ) # Now set up the render tasks. This involves doing the actual rendering, and triggering the # output of the file list index file. # First get rid of options from the upstream scene that could mess up the bake self["__OptionOverrides"] = GafferScene.StandardOptions() self["__OptionOverrides"]["in"].setInput( self["in"] ) self["__OptionOverrides"]["options"]["pixelAspectRatio"]["enabled"].setValue( True ) self["__OptionOverrides"]["options"]["resolutionMultiplier"]["enabled"].setValue( True ) self["__OptionOverrides"]["options"]["overscan"]["enabled"].setValue( True ) self["__OptionOverrides"]["options"]["renderCropWindow"]["enabled"].setValue( True ) self["__OptionOverrides"]["options"]["cameraBlur"]["enabled"].setValue( True ) self["__OptionOverrides"]["options"]["transformBlur"]["enabled"].setValue( True ) self["__OptionOverrides"]["options"]["deformationBlur"]["enabled"].setValue( True ) self["__CameraSetup"] = self.__CameraSetup() self["__CameraSetup"]["in"].setInput( self["__OptionOverrides"]["out"] ) self["__CameraSetup"]["filter"].setInput( self["filter"] ) self["__CameraSetup"]["defaultFileName"].setInput( self["defaultFileName"] ) self["__CameraSetup"]["defaultResolution"].setInput( self["defaultResolution"] ) self["__CameraSetup"]["uvSet"].setInput( self["uvSet"] ) self["__CameraSetup"]["aovs"].setInput( self["aovs"] ) self["__CameraSetup"]["normalOffset"].setInput( self["normalOffset"] ) self["__CameraSetup"]["tasks"].setInput( self["tasks"] ) self["__CameraSetup"]["udims"].setInput( self["udims"] ) self["__Expression"] = Gaffer.Expression() self["__Expression"].setExpression( 'parent["__CameraSetup"]["taskIndex"] = context.get( "BAKE_WEDGE:index", 0 )', "python" ) self["__indexFilePath"] = Gaffer.StringPlug() self["__indexFilePath"].setFlags( Gaffer.Plug.Flags.Serialisable, False ) self["__IndexFileExpression"] = Gaffer.Expression() self["__IndexFileExpression"].setExpression( inspect.cleandoc( """ import os parent["__indexFilePath"] = os.path.join( parent["bakeDirectory"], "BAKE_FILE_INDEX_" + str( context.get("BAKE_WEDGE:index", 0 ) ) + ".####.txt" ) """ ), "python" ) self["__outputIndexCommand"] = GafferDispatch.PythonCommand() self["__outputIndexCommand"]["variables"].addChild( Gaffer.NameValuePlug( "bakeDirectory", Gaffer.StringPlug() ) ) self["__outputIndexCommand"]["variables"][0]["value"].setInput( self["bakeDirectory"] ) self["__outputIndexCommand"]["variables"].addChild( Gaffer.NameValuePlug( "indexFilePath", Gaffer.StringPlug() ) ) self["__outputIndexCommand"]["variables"][1]["value"].setInput( self["__indexFilePath"] ) self["__outputIndexCommand"]["variables"].addChild( Gaffer.NameValuePlug( "fileList", Gaffer.StringVectorDataPlug( defaultValue = IECore.StringVectorData() ) ) ) self["__outputIndexCommand"]["variables"][2]["value"].setInput( self["__CameraSetup"]["renderFileList"] ) self["__outputIndexCommand"]["command"].setValue( inspect.cleandoc( """ import os import distutils.dir_util # Ensure path exists distutils.dir_util.mkpath( variables["bakeDirectory"] ) f = open( variables["indexFilePath"], "w" ) f.writelines( [ i + "\\n" for i in sorted( variables["fileList"] ) ] ) f.close() IECore.msg( IECore.MessageHandler.Level.Info, "Bake Process", "Wrote list of bake files for this chunk to " + variables["indexFilePath"] ) """ ) ) self["__arnoldRender"] = GafferArnold.ArnoldRender() self["__arnoldRender"]["preTasks"][0].setInput( self["__outputIndexCommand"]["task"] ) self["__arnoldRender"]["dispatcher"]["immediate"].setValue( True ) self["__arnoldRender"]["in"].setInput( self["__CameraSetup"]["out"] ) self["__bakeDirectoryContext"] = GafferDispatch.TaskContextVariables() self["__bakeDirectoryContext"]["variables"].addChild( Gaffer.NameValuePlug( "bakeDirectory", Gaffer.StringPlug() ) ) self["__bakeDirectoryContext"]["variables"][0]["value"].setInput( self["bakeDirectory"] ) self["__bakeDirectoryContext"]["preTasks"][0].setInput( self["__arnoldRender"]["task"] ) # Now set up the image tasks. This involves merging all layers for a UDIM, filling in the # background, writing out this image, converting it to tx, and optionally deleting all the exrs self["__imageList"] = Gaffer.CompoundObjectPlug( "__imageList", defaultValue = IECore.CompoundObject() ) self["__imageList"].setFlags( Gaffer.Plug.Flags.Serialisable, False ) self["__ImageReader"] = GafferImage.ImageReader() self["__CurInputFileExpression"] = Gaffer.Expression() self["__CurInputFileExpression"].setExpression( inspect.cleandoc( """ l = parent["__imageList"] outFile = context["wedge:outFile"] loopIndex = context[ "loop:index" ] parent["__ImageReader"]["fileName"] = l[outFile][ loopIndex ] """ ), "python" ) # Find the max size of any input file self["__SizeLoop"] = Gaffer.LoopComputeNode() self["__SizeLoop"].setup( Gaffer.IntPlug() ) self["__SizeMaxExpression"] = Gaffer.Expression() self["__SizeMaxExpression"].setExpression( inspect.cleandoc( """ f = parent["__ImageReader"]["out"]["format"] parent["__SizeLoop"]["next"] = max( f.width(), parent["__SizeLoop"]["previous"] ) """ ), "python" ) # Loop over all input files for this output file, and merge them all together self["__ImageLoop"] = Gaffer.LoopComputeNode() self["__ImageLoop"].setup( GafferImage.ImagePlug() ) self["__NumInputsForCurOutputExpression"] = Gaffer.Expression() self["__NumInputsForCurOutputExpression"].setExpression( inspect.cleandoc( """ l = parent["__imageList"] outFile = context["wedge:outFile"] numInputs = len( l[outFile] ) parent["__ImageLoop"]["iterations"] = numInputs parent["__SizeLoop"]["iterations"] = numInputs """ ), "python" ) self["__Resize"] = GafferImage.Resize() self["__Resize"]["format"]["displayWindow"]["min"].setValue( imath.V2i( 0, 0 ) ) self["__Resize"]['format']["displayWindow"]["max"]["x"].setInput( self["__SizeLoop"]["out"] ) self["__Resize"]['format']["displayWindow"]["max"]["y"].setInput( self["__SizeLoop"]["out"] ) self["__Resize"]['in'].setInput( self["__ImageReader"]["out"] ) self["__Merge"] = GafferImage.Merge() self["__Merge"]["in"][0].setInput( self["__Resize"]["out"] ) self["__Merge"]["in"][1].setInput( self["__ImageLoop"]["previous"] ) self["__Merge"]["operation"].setValue( GafferImage.Merge.Operation.Add ) self["__ImageLoop"]["next"].setInput( self["__Merge"]["out"] ) # Write out the combined image, so we can immediately read it back in # This is just because we're doing enough image processing that we # could saturate the cache, and Gaffer wouldn't know that this is # the important result to keep self["__ImageIntermediateWriter"] = GafferImage.ImageWriter() self["__ImageIntermediateWriter"]["in"].setInput( self["__ImageLoop"]["out"] ) self["__ImageIntermediateReader"] = GafferImage.ImageReader() # Now that we've merged everything together, we can use a BleedFill to fill in the background, # so that texture filtering across the edges will pull in colors that are at least reasonable. self["__BleedFill"] = GafferImage.BleedFill() self["__BleedFill"]["in"].setInput( self["__ImageIntermediateReader"]["out"] ) self["__Median"] = GafferImage.Median() self["__Median"]["in"].setInput( self["__BleedFill"]["out"] ) self["__Median"]["enabled"].setInput( self["applyMedianFilter"] ) self["__Median"]["radius"]["x"].setInput( self["medianRadius"] ) self["__Median"]["radius"]["y"].setInput( self["medianRadius"] ) # Write out the result self["__ImageWriter"] = GafferImage.ImageWriter() self["__ImageWriter"]["in"].setInput( self["__Median"]["out"] ) self["__ImageWriter"]["preTasks"][0].setInput( self["__ImageIntermediateWriter"]["task"] ) # Convert result to texture self["__ConvertCommand"] = GafferDispatch.SystemCommand() # We shouldn't need a sub-shell and this prevents S.I.P on the Mac from # blocking the dylibs loaded by maketx. self["__ConvertCommand"]["shell"].setValue( False ) self["__ConvertCommand"]["substitutions"].addChild( Gaffer.NameValuePlug( "inFile", IECore.StringData(), "member1" ) ) self["__ConvertCommand"]["substitutions"].addChild( Gaffer.NameValuePlug( "outFile", IECore.StringData(), "member1" ) ) self["__ConvertCommand"]["preTasks"][0].setInput( self["__ImageWriter"]["task"] ) self["__ConvertCommand"]["command"].setValue( 'maketx --wrap clamp {inFile} -o {outFile}' ) self["__CommandSetupExpression"] = Gaffer.Expression() self["__CommandSetupExpression"].setExpression( inspect.cleandoc( """ outFileBase = context["wedge:outFile"] intermediateExr = outFileBase + ".intermediate.exr" parent["__ImageIntermediateWriter"]["fileName"] = intermediateExr parent["__ImageIntermediateReader"]["fileName"] = intermediateExr tmpExr = outFileBase + ".tmp.exr" parent["__ImageWriter"]["fileName"] = tmpExr parent["__ConvertCommand"]["substitutions"]["member1"]["value"] = tmpExr parent["__ConvertCommand"]["substitutions"]["member2"]["value"] = outFileBase + ".tx" """ ), "python" ) self["__ImageWedge"] = GafferDispatch.Wedge() self["__ImageWedge"]["preTasks"][0].setInput( self["__ConvertCommand"]["task"] ) self["__ImageWedge"]["variable"].setValue( 'wedge:outFile' ) self["__ImageWedge"]["indexVariable"].setValue( 'wedge:outFileIndex' ) self["__ImageWedge"]["mode"].setValue( int( GafferDispatch.Wedge.Mode.StringList ) ) self["__CleanUpCommand"] = GafferDispatch.PythonCommand() self["__CleanUpCommand"]["preTasks"][0].setInput( self["__ImageWedge"]["task"] ) self["__CleanUpCommand"]["variables"].addChild( Gaffer.NameValuePlug( "filesToDelete", Gaffer.StringVectorDataPlug( defaultValue = IECore.StringVectorData() ), "member1" ) ) self["__CleanUpCommand"]["command"].setValue( inspect.cleandoc( """ import os for tmpFile in variables["filesToDelete"]: os.remove( tmpFile ) """ ) ) self["__CleanUpExpression"] = Gaffer.Expression() self["__CleanUpExpression"].setExpression( inspect.cleandoc( """ imageList = parent["__imageList"] toDelete = [] for outFileBase, inputExrs in imageList.items(): tmpExr = outFileBase + ".tmp.exr" intermediateExr = outFileBase + ".intermediate.exr" toDelete.extend( inputExrs ) toDelete.append( tmpExr ) toDelete.append( intermediateExr ) toDelete.append( parent["__indexFilePath"] ) parent["__CleanUpCommand"]["variables"]["member1"]["value"] = IECore.StringVectorData( toDelete ) """ ), "python" ) self["__CleanUpSwitch"] = GafferDispatch.TaskSwitch() self["__CleanUpSwitch"]["preTasks"][0].setInput( self["__ImageWedge"]["task"] ) self["__CleanUpSwitch"]["preTasks"][1].setInput( self["__CleanUpCommand"]["task"] ) self["__CleanUpSwitch"]["index"].setInput( self["cleanupIntermediateFiles"] ) # Set up the list of input image files to process, and the corresponding list of # output files to wedge over self["__ImageSetupExpression"] = Gaffer.Expression() self["__ImageSetupExpression"].setExpression( inspect.cleandoc( """ f = open( parent["__indexFilePath"], "r" ) fileList = f.read().splitlines() fileDict = {} for i in fileList: rootName = i.rsplit( ".exr", 1 )[0] if rootName in fileDict: fileDict[ rootName ].append( i ) else: fileDict[ rootName ] = IECore.StringVectorData( [i] ) parent["__imageList"] = IECore.CompoundObject( fileDict ) parent["__ImageWedge"]["strings"] = IECore.StringVectorData( fileDict.keys() ) """ ), "python" ) IECore.registerRunTimeTyped( ArnoldTextureBake, typeName = "GafferArnold::ArnoldTextureBake" )
47.196339
175
0.692649
26,303
0.927305
0
0
0
0
0
0
19,257
0.6789
bccd1fa8fe336f245d1474aeb673c6c021c08a1b
20,598
py
Python
aea/protocols/generator/common.py
valory-xyz/agents-aea
8f38efa96041b0156ed1ae328178e395dbabf2fc
[ "Apache-2.0" ]
null
null
null
aea/protocols/generator/common.py
valory-xyz/agents-aea
8f38efa96041b0156ed1ae328178e395dbabf2fc
[ "Apache-2.0" ]
null
null
null
aea/protocols/generator/common.py
valory-xyz/agents-aea
8f38efa96041b0156ed1ae328178e395dbabf2fc
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # ------------------------------------------------------------------------------ # # Copyright 2022 Valory AG # Copyright 2018-2021 Fetch.AI Limited # # 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 module contains utility code for generator modules.""" import inspect import os import re import shutil import subprocess # nosec import sys import tempfile from pathlib import Path from typing import Tuple from aea.configurations.base import ProtocolSpecification from aea.configurations.constants import ( DEFAULT_PROTOCOL_CONFIG_FILE, PACKAGES, PROTOCOL_LANGUAGE_JS, PROTOCOL_LANGUAGE_PYTHON, ) from aea.configurations.loader import ConfigLoader from aea.helpers.io import open_file SPECIFICATION_PRIMITIVE_TYPES = ["pt:bytes", "pt:int", "pt:float", "pt:bool", "pt:str"] SPECIFICATION_COMPOSITIONAL_TYPES = [ "pt:set", "pt:list", "pt:dict", "pt:union", "pt:optional", ] PYTHON_COMPOSITIONAL_TYPES = [ "FrozenSet", "Tuple", "Dict", "Union", "Optional", ] MESSAGE_IMPORT = "from aea.protocols.base import Message" SERIALIZER_IMPORT = "from aea.protocols.base import Serializer" PATH_TO_PACKAGES = PACKAGES INIT_FILE_NAME = "__init__.py" PROTOCOL_YAML_FILE_NAME = DEFAULT_PROTOCOL_CONFIG_FILE MESSAGE_DOT_PY_FILE_NAME = "message.py" DIALOGUE_DOT_PY_FILE_NAME = "dialogues.py" CUSTOM_TYPES_DOT_PY_FILE_NAME = "custom_types.py" SERIALIZATION_DOT_PY_FILE_NAME = "serialization.py" PYTHON_TYPE_TO_PROTO_TYPE = { "bytes": "bytes", "int": "int32", "float": "float", "bool": "bool", "str": "string", } CURRENT_DIR = os.path.dirname(inspect.getfile(inspect.currentframe())) # type: ignore ISORT_CONFIGURATION_FILE = os.path.join(CURRENT_DIR, "isort.cfg") ISORT_CLI_ARGS = [ "--settings-path", ISORT_CONFIGURATION_FILE, "--quiet", ] PROTOLINT_CONFIGURATION_FILE_NAME = "protolint.yaml" PROTOLINT_CONFIGURATION = """lint: rules: remove: - MESSAGE_NAMES_UPPER_CAMEL_CASE - ENUM_FIELD_NAMES_ZERO_VALUE_END_WITH - PACKAGE_NAME_LOWER_CASE - REPEATED_FIELD_NAMES_PLURALIZED - FIELD_NAMES_LOWER_SNAKE_CASE""" PROTOLINT_INDENTATION_ERROR_STR = "incorrect indentation style" PROTOLINT_ERROR_WHITELIST = [PROTOLINT_INDENTATION_ERROR_STR] def _to_camel_case(text: str) -> str: """ Convert a text in snake_case format into the CamelCase format. :param text: the text to be converted. :return: The text in CamelCase format. """ return "".join(word.title() for word in text.split("_")) def _camel_case_to_snake_case(text: str) -> str: """ Convert a text in CamelCase format into the snake_case format. :param text: the text to be converted. :return: The text in CamelCase format. """ return re.sub(r"(?<!^)(?=[A-Z])", "_", text).lower() def _match_brackets(text: str, index_of_open_bracket: int) -> int: """ Give the index of the matching close bracket for the opening bracket at 'index_of_open_bracket' in the input 'text'. :param text: the text containing the brackets. :param index_of_open_bracket: the index of the opening bracket. :return: the index of the matching closing bracket (if any). :raises SyntaxError if there are no matching closing bracket. """ if text[index_of_open_bracket] != "[": raise SyntaxError( "Index {} in 'text' is not an open bracket '['. It is {}".format( index_of_open_bracket, text[index_of_open_bracket], ) ) open_bracket_stack = [] for index in range(index_of_open_bracket, len(text)): if text[index] == "[": open_bracket_stack.append(text[index]) elif text[index] == "]": open_bracket_stack.pop() if not open_bracket_stack: return index raise SyntaxError( "No matching closing bracket ']' for the opening bracket '[' at {} " + str(index_of_open_bracket) ) def _has_matched_brackets(text: str) -> bool: """ Evaluate whether every opening bracket '[' in the 'text' has a matching closing bracket ']'. :param text: the text. :return: Boolean result, and associated message. """ open_bracket_stack = [] for index, _ in enumerate(text): if text[index] == "[": open_bracket_stack.append(index) elif text[index] == "]": if len(open_bracket_stack) == 0: return False open_bracket_stack.pop() return len(open_bracket_stack) == 0 def _get_sub_types_of_compositional_types(compositional_type: str) -> Tuple[str, ...]: """ Extract the sub-types of compositional types. This method handles both specification types (e.g. pt:set[], pt:dict[]) as well as python types (e.g. FrozenSet[], Union[]). :param compositional_type: the compositional type string whose sub-types are to be extracted. :return: tuple containing all extracted sub-types. """ sub_types_list = list() for valid_compositional_type in ( SPECIFICATION_COMPOSITIONAL_TYPES + PYTHON_COMPOSITIONAL_TYPES ): if compositional_type.startswith(valid_compositional_type): inside_string = compositional_type[ compositional_type.index("[") + 1 : compositional_type.rindex("]") ].strip() while inside_string != "": do_not_add = False if inside_string.find(",") == -1: # No comma; this is the last sub-type provisional_sub_type = inside_string.strip() if ( provisional_sub_type == "..." ): # The sub-string is ... used for Tuple, e.g. Tuple[int, ...] do_not_add = True else: sub_type = provisional_sub_type inside_string = "" else: # There is a comma; this MAY not be the last sub-type sub_string_until_comma = inside_string[ : inside_string.index(",") ].strip() if ( sub_string_until_comma.find("[") == -1 ): # No open brackets; this is a primitive type and NOT the last sub-type sub_type = sub_string_until_comma inside_string = inside_string[ inside_string.index(",") + 1 : ].strip() else: # There is an open bracket'['; this is a compositional type try: closing_bracket_index = _match_brackets( inside_string, inside_string.index("[") ) except SyntaxError: raise SyntaxError( "Bad formatting. No matching close bracket ']' for the open bracket at {}".format( inside_string[ : inside_string.index("[") + 1 ].strip() ) ) sub_type = inside_string[: closing_bracket_index + 1].strip() the_rest_of_inside_string = inside_string[ closing_bracket_index + 1 : ].strip() if ( the_rest_of_inside_string.find(",") == -1 ): # No comma; this is the last sub-type inside_string = the_rest_of_inside_string.strip() else: # There is a comma; this is not the last sub-type inside_string = the_rest_of_inside_string[ the_rest_of_inside_string.index(",") + 1 : ].strip() if not do_not_add: sub_types_list.append(sub_type) return tuple(sub_types_list) raise SyntaxError( "{} is not a valid compositional type.".format(compositional_type) ) def _union_sub_type_to_protobuf_variable_name( content_name: str, content_type: str ) -> str: """ Given a content of type union, create a variable name for its sub-type for protobuf. :param content_name: the name of the content :param content_type: the sub-type of a union type :return: The variable name """ if content_type.startswith("FrozenSet"): sub_type = _get_sub_types_of_compositional_types(content_type)[0] expanded_type_str = "set_of_{}".format(sub_type) elif content_type.startswith("Tuple"): sub_type = _get_sub_types_of_compositional_types(content_type)[0] expanded_type_str = "list_of_{}".format(sub_type) elif content_type.startswith("Dict"): sub_type_1 = _get_sub_types_of_compositional_types(content_type)[0] sub_type_2 = _get_sub_types_of_compositional_types(content_type)[1] expanded_type_str = "dict_of_{}_{}".format(sub_type_1, sub_type_2) else: expanded_type_str = content_type protobuf_variable_name = "{}_type_{}".format(content_name, expanded_type_str) return protobuf_variable_name def _python_pt_or_ct_type_to_proto_type(content_type: str) -> str: """ Convert a PT or CT from python to their protobuf equivalent. :param content_type: the python type :return: The protobuf equivalent """ if content_type in PYTHON_TYPE_TO_PROTO_TYPE.keys(): proto_type = PYTHON_TYPE_TO_PROTO_TYPE[content_type] else: proto_type = content_type return proto_type def _includes_custom_type(content_type: str) -> bool: """ Evaluate whether a content type is a custom type or has a custom type as a sub-type. :param content_type: the content type :return: Boolean result """ if content_type.startswith("Optional"): sub_type = _get_sub_types_of_compositional_types(content_type)[0] result = _includes_custom_type(sub_type) elif content_type.startswith("Union"): sub_types = _get_sub_types_of_compositional_types(content_type) result = False for sub_type in sub_types: if _includes_custom_type(sub_type): result = True break elif ( content_type.startswith("FrozenSet") or content_type.startswith("Tuple") or content_type.startswith("Dict") or content_type in PYTHON_TYPE_TO_PROTO_TYPE.keys() ): result = False else: result = True return result def is_installed(programme: str) -> bool: """ Check whether a programme is installed on the system. :param programme: the name of the programme. :return: True if installed, False otherwise """ res = shutil.which(programme) return res is not None def base_protolint_command() -> str: """ Return the base protolint command. :return: The base protolint command """ if sys.platform.startswith("win"): protolint_base_cmd = "protolint" # pragma: nocover else: protolint_base_cmd = "PATH=${PATH}:${GOPATH}/bin/:~/go/bin protolint" return protolint_base_cmd def check_prerequisites() -> None: """Check whether a programme is installed on the system.""" # check black code formatter is installed if not is_installed("black"): raise FileNotFoundError( "Cannot find black code formatter! To install, please follow this link: https://black.readthedocs.io/en/stable/installation_and_usage.html" ) # check isort code formatter is installed if not is_installed("isort"): raise FileNotFoundError( "Cannot find isort code formatter! To install, please follow this link: https://pycqa.github.io/isort/#installing-isort" ) # check protolint code formatter is installed if subprocess.call(f"{base_protolint_command()} version", shell=True) != 0: # nosec raise FileNotFoundError( "Cannot find protolint protocol buffer schema file linter! To install, please follow this link: https://github.com/yoheimuta/protolint." ) # check protocol buffer compiler is installed if not is_installed("protoc"): raise FileNotFoundError( "Cannot find protocol buffer compiler! To install, please follow this link: https://developers.google.com/protocol-buffers/" ) def get_protoc_version() -> str: """Get the protoc version used.""" result = subprocess.run( # nosec ["protoc", "--version"], stdout=subprocess.PIPE, check=True ) result_str = result.stdout.decode("utf-8").strip("\n").strip("\r") return result_str def load_protocol_specification(specification_path: str) -> ProtocolSpecification: """ Load a protocol specification. :param specification_path: path to the protocol specification yaml file. :return: A ProtocolSpecification object """ config_loader = ConfigLoader( "protocol-specification_schema.json", ProtocolSpecification ) protocol_spec = config_loader.load_protocol_specification( open_file(specification_path) ) return protocol_spec def _create_protocol_file( path_to_protocol_package: str, file_name: str, file_content: str ) -> None: """ Create a file in the generated protocol package. :param path_to_protocol_package: path to the file :param file_name: the name of the file :param file_content: the content of the file """ pathname = os.path.join(path_to_protocol_package, file_name) with open_file(pathname, "w") as file: file.write(file_content) def try_run_black_formatting(path_to_protocol_package: str) -> None: """ Run Black code formatting via subprocess. :param path_to_protocol_package: a path where formatting should be applied. """ subprocess.run( # nosec [sys.executable, "-m", "black", path_to_protocol_package, "--quiet"], check=True, ) def try_run_isort_formatting(path_to_protocol_package: str) -> None: """ Run Isort code formatting via subprocess. :param path_to_protocol_package: a path where formatting should be applied. """ subprocess.run( # nosec [sys.executable, "-m", "isort", *ISORT_CLI_ARGS, path_to_protocol_package], check=True, ) def try_run_protoc( path_to_generated_protocol_package: str, name: str, language: str = PROTOCOL_LANGUAGE_PYTHON, ) -> None: """ Run 'protoc' protocol buffer compiler via subprocess. :param path_to_generated_protocol_package: path to the protocol buffer schema file. :param name: name of the protocol buffer schema file. :param language: the target language in which to compile the protobuf schema file """ # for closure-styled imports for JS, comment the first line and uncomment the second js_commonjs_import_option = ( "import_style=commonjs,binary:" if language == PROTOCOL_LANGUAGE_JS else "" ) language_part_of_the_command = f"--{language}_out={js_commonjs_import_option}{path_to_generated_protocol_package}" subprocess.run( # nosec [ "protoc", f"-I={path_to_generated_protocol_package}", language_part_of_the_command, f"{path_to_generated_protocol_package}/{name}.proto", ], stderr=subprocess.PIPE, encoding="utf-8", check=True, env=os.environ.copy(), ) def try_run_protolint(path_to_generated_protocol_package: str, name: str) -> None: """ Run 'protolint' linter via subprocess. :param path_to_generated_protocol_package: path to the protocol buffer schema file. :param name: name of the protocol buffer schema file. """ # path to proto file path_to_proto_file = os.path.join( path_to_generated_protocol_package, f"{name}.proto", ) # Dump protolint configuration into a temporary file temp_dir = tempfile.mkdtemp() path_to_configuration_in_tmp_file = Path( temp_dir, PROTOLINT_CONFIGURATION_FILE_NAME ) with open_file(path_to_configuration_in_tmp_file, "w") as file: file.write(PROTOLINT_CONFIGURATION) # Protolint command cmd = f'{base_protolint_command()} lint -config_path={path_to_configuration_in_tmp_file} -fix "{path_to_proto_file}"' # Execute protolint command subprocess.run( # nosec cmd, stderr=subprocess.PIPE, stdout=subprocess.PIPE, encoding="utf-8", check=True, env=os.environ.copy(), shell=True, ) # Delete temporary configuration file shutil.rmtree(temp_dir) # pragma: no cover def check_protobuf_using_protoc( path_to_generated_protocol_package: str, name: str ) -> Tuple[bool, str]: """ Check whether a protocol buffer schema file is valid. Validation is via trying to compile the schema file. If successfully compiled it is valid, otherwise invalid. If valid, return True and a 'protobuf file is valid' message, otherwise return False and the error thrown by the compiler. :param path_to_generated_protocol_package: path to the protocol buffer schema file. :param name: name of the protocol buffer schema file. :return: Boolean result and an accompanying message """ try: try_run_protoc(path_to_generated_protocol_package, name) os.remove(os.path.join(path_to_generated_protocol_package, name + "_pb2.py")) return True, "protobuf file is valid" except subprocess.CalledProcessError as e: pattern = name + ".proto:[0-9]+:[0-9]+: " error_message = re.sub(pattern, "", e.stderr[:-1]) return False, error_message def compile_protobuf_using_protoc( path_to_generated_protocol_package: str, name: str, language: str ) -> Tuple[bool, str]: """ Compile a protocol buffer schema file using protoc. If successfully compiled, return True and a success message, otherwise return False and the error thrown by the compiler. :param path_to_generated_protocol_package: path to the protocol buffer schema file. :param name: name of the protocol buffer schema file. :param language: the target language in which to compile the protobuf schema file :return: Boolean result and an accompanying message """ try: try_run_protoc(path_to_generated_protocol_package, name, language) return True, "protobuf schema successfully compiled" except subprocess.CalledProcessError as e: pattern = name + ".proto:[0-9]+:[0-9]+: " error_message = re.sub(pattern, "", e.stderr[:-1]) return False, error_message def apply_protolint(path_to_proto_file: str, name: str) -> Tuple[bool, str]: """ Apply protolint linter to a protocol buffer schema file. If no output, return True and a success message, otherwise return False and the output shown by the linter (minus the indentation suggestions which are automatically fixed by protolint). :param path_to_proto_file: path to the protocol buffer schema file. :param name: name of the protocol buffer schema file. :return: Boolean result and an accompanying message """ try: try_run_protolint(path_to_proto_file, name) return True, "protolint has no output" except subprocess.CalledProcessError as e: lines_to_show = [] for line in e.stderr.split("\n"): to_show = True for whitelist_error_str in PROTOLINT_ERROR_WHITELIST: if whitelist_error_str in line: to_show = False break if to_show: lines_to_show.append(line) error_message = "\n".join(lines_to_show) return False, error_message
35.636678
151
0.646373
0
0
0
0
0
0
0
0
8,884
0.431304
bccd22c451ca48a6b2b63fe4d46e6f3d5177271f
12,177
py
Python
tests/unit/python/foglamp/services/core/api/test_backup_restore.py
vaibhav-ScaleDB/FogLAMP
445e7a588f5ec5fcae0360b49fdc4e4de0ea2ec8
[ "Apache-2.0" ]
null
null
null
tests/unit/python/foglamp/services/core/api/test_backup_restore.py
vaibhav-ScaleDB/FogLAMP
445e7a588f5ec5fcae0360b49fdc4e4de0ea2ec8
[ "Apache-2.0" ]
null
null
null
tests/unit/python/foglamp/services/core/api/test_backup_restore.py
vaibhav-ScaleDB/FogLAMP
445e7a588f5ec5fcae0360b49fdc4e4de0ea2ec8
[ "Apache-2.0" ]
null
null
null
# -*- coding: utf-8 -*- # FOGLAMP_BEGIN # See: http://foglamp.readthedocs.io/ # FOGLAMP_END import os import asyncio import json from unittest.mock import MagicMock, patch from collections import Counter from aiohttp import web import pytest from foglamp.services.core import routes from foglamp.services.core import connect from foglamp.plugins.storage.common.backup import Backup from foglamp.plugins.storage.common.restore import Restore from foglamp.plugins.storage.common import exceptions from foglamp.services.core.api import backup_restore from foglamp.common.storage_client.storage_client import StorageClientAsync __author__ = "Vaibhav Singhal" __copyright__ = "Copyright (c) 2017 OSIsoft, LLC" __license__ = "Apache 2.0" __version__ = "${VERSION}" @asyncio.coroutine def mock_coro(*args, **kwargs): if len(args) > 0: return args[0] else: return "" @pytest.allure.feature("unit") @pytest.allure.story("api", "backup") class TestBackup: """Unit test the Backup functionality """ @pytest.fixture def client(self, loop, test_client): app = web.Application(loop=loop) # fill the routes table routes.setup(app) return loop.run_until_complete(test_client(app)) @pytest.mark.parametrize("input_data, expected", [ (1, "RUNNING"), (2, "COMPLETED"), (3, "CANCELED"), (4, "INTERRUPTED"), (5, "FAILED"), (6, "RESTORED"), (7, "UNKNOWN") ]) def test_get_status(self, input_data, expected): assert expected == backup_restore._get_status(input_data) @pytest.mark.parametrize("request_params", [ '', '?limit=1', '?skip=1', '?status=completed', '?status=failed', '?status=restored&skip=10', '?status=running&limit=1', '?status=canceled&limit=10&skip=0', '?status=interrupted&limit=&skip=', '?status=&limit=&skip=' ]) async def test_get_backups(self, client, request_params): storage_client_mock = MagicMock(StorageClientAsync) response = [{'file_name': '1.dump', 'id': 1, 'type': '1', 'status': '2', 'ts': '2018-02-15 15:18:41.821978+05:30', 'exit_code': '0'}] with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Backup, 'get_all_backups', return_value=mock_coro(response)): resp = await client.get('/foglamp/backup{}'.format(request_params)) assert 200 == resp.status result = await resp.text() json_response = json.loads(result) assert 1 == len(json_response['backups']) assert Counter({"id", "date", "status"}) == Counter(json_response['backups'][0].keys()) @pytest.mark.parametrize("request_params, response_code, response_message", [ ('?limit=invalid', 400, "Limit must be a positive integer"), ('?limit=-1', 400, "Limit must be a positive integer"), ('?skip=invalid', 400, "Skip/Offset must be a positive integer"), ('?skip=-1', 400, "Skip/Offset must be a positive integer"), ('?status=BLA', 400, "'BLA' is not a valid status") ]) async def test_get_backups_bad_data(self, client, request_params, response_code, response_message): resp = await client.get('/foglamp/backup{}'.format(request_params)) assert response_code == resp.status assert response_message == resp.reason async def test_get_backups_exceptions(self, client): with patch.object(connect, 'get_storage_async', return_value=Exception): resp = await client.get('/foglamp/backup') assert 500 == resp.status assert "Internal Server Error" == resp.reason async def test_create_backup(self, client): async def mock_create(): return "running_or_failed" storage_client_mock = MagicMock(StorageClientAsync) with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Backup, 'create_backup', return_value=mock_create()): resp = await client.post('/foglamp/backup') assert 200 == resp.status assert '{"status": "running_or_failed"}' == await resp.text() async def test_create_backup_exception(self, client): with patch.object(connect, 'get_storage_async', return_value=Exception): with patch.object(Backup, 'create_backup', return_value=Exception): resp = await client.post('/foglamp/backup') assert 500 == resp.status assert "Internal Server Error" == resp.reason async def test_get_backup_details(self, client): storage_client_mock = MagicMock(StorageClientAsync) response = {'id': 1, 'file_name': '1.dump', 'ts': '2018-02-15 15:18:41.821978+05:30', 'status': '2', 'type': '1', 'exit_code': '0'} with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Backup, 'get_backup_details', return_value=mock_coro(response)): resp = await client.get('/foglamp/backup/{}'.format(1)) assert 200 == resp.status result = await resp.text() json_response = json.loads(result) assert 3 == len(json_response) assert Counter({"id", "date", "status"}) == Counter(json_response.keys()) @pytest.mark.parametrize("input_exception, response_code, response_message", [ (exceptions.DoesNotExist, 404, "Backup id 8 does not exist"), (Exception, 500, "Internal Server Error") ]) async def test_get_backup_details_exceptions(self, client, input_exception, response_code, response_message): storage_client_mock = MagicMock(StorageClientAsync) with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Backup, 'get_backup_details', side_effect=input_exception): resp = await client.get('/foglamp/backup/{}'.format(8)) assert response_code == resp.status assert response_message == resp.reason async def test_get_backup_details_bad_data(self, client): resp = await client.get('/foglamp/backup/{}'.format('BLA')) assert 400 == resp.status assert "Invalid backup id" == resp.reason async def test_delete_backup(self, client): storage_client_mock = MagicMock(StorageClientAsync) with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Backup, 'delete_backup', return_value=mock_coro(None)): resp = await client.delete('/foglamp/backup/{}'.format(1)) assert 200 == resp.status result = await resp.text() json_response = json.loads(result) assert {'message': 'Backup deleted successfully'} == json_response @pytest.mark.parametrize("input_exception, response_code, response_message", [ (exceptions.DoesNotExist, 404, "Backup id 8 does not exist"), (Exception, 500, "Internal Server Error") ]) async def test_delete_backup_exceptions(self, client, input_exception, response_code, response_message): storage_client_mock = MagicMock(StorageClientAsync) with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Backup, 'delete_backup', side_effect=input_exception): resp = await client.delete('/foglamp/backup/{}'.format(8)) assert response_code == resp.status assert response_message == resp.reason async def test_delete_backup_bad_data(self, client): resp = await client.delete('/foglamp/backup/{}'.format('BLA')) assert 400 == resp.status assert "Invalid backup id" == resp.reason async def test_get_backup_status(self, client): resp = await client.get('/foglamp/backup/status') assert 200 == resp.status result = await resp.text() json_response = json.loads(result) assert {'backupStatus': [{'index': 1, 'name': 'RUNNING'}, {'index': 2, 'name': 'COMPLETED'}, {'index': 3, 'name': 'CANCELED'}, {'index': 4, 'name': 'INTERRUPTED'}, {'index': 5, 'name': 'FAILED'}, {'index': 6, 'name': 'RESTORED'}]} == json_response @pytest.mark.parametrize("input_exception, response_code, response_message", [ (ValueError, 400, "Invalid backup id"), (exceptions.DoesNotExist, 404, "Backup id 8 does not exist"), (Exception, 500, "Internal Server Error") ]) async def test_get_backup_download_exceptions(self, client, input_exception, response_code, response_message): storage_client_mock = MagicMock(StorageClientAsync) with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Backup, 'get_backup_details', side_effect=input_exception): resp = await client.get('/foglamp/backup/{}/download'.format(8)) assert response_code == resp.status assert response_message == resp.reason async def test_get_backup_download(self, client): storage_client_mock = MagicMock(StorageClientAsync) response = {'id': 1, 'file_name': '/usr/local/foglamp/data/backup/foglamp.db', 'ts': '2018-02-15 15:18:41', 'status': '2', 'type': '1'} with patch("aiohttp.web.FileResponse", return_value=web.FileResponse(path=os.path.realpath(__file__))) as file_res: with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Backup, 'get_backup_details', return_value=mock_coro(response)) as patch_backup_detail: with patch('tarfile.open'): resp = await client.get('/foglamp/backup/{}/download'.format(1)) assert 200 == resp.status assert 'OK' == resp.reason patch_backup_detail.assert_called_once_with(1) assert 1 == file_res.call_count @pytest.allure.feature("unit") @pytest.allure.story("api", "restore") class TestRestore: """Unit test the Restore functionality""" @pytest.fixture def client(self, loop, test_client): app = web.Application(loop=loop) # fill the routes table routes.setup(app) return loop.run_until_complete(test_client(app)) async def test_restore_backup(self, client): async def mock_restore(): return "running" storage_client_mock = MagicMock(StorageClientAsync) with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Restore, 'restore_backup', return_value=mock_restore()): resp = await client.put('/foglamp/backup/{}/restore'.format(1)) assert 200 == resp.status r = await resp.text() assert {'status': 'running'} == json.loads(r) @pytest.mark.parametrize("backup_id, input_exception, code, message", [ (8, exceptions.DoesNotExist, 404, "Backup with 8 does not exist"), (2, Exception, 500, "Internal Server Error"), ('blah', ValueError, 400, 'Invalid backup id') ]) async def test_restore_backup_exceptions(self, client, backup_id, input_exception, code, message): storage_client_mock = MagicMock(StorageClientAsync) with patch.object(connect, 'get_storage_async', return_value=storage_client_mock): with patch.object(Restore, 'restore_backup', side_effect=input_exception): resp = await client.put('/foglamp/backup/{}/restore'.format(backup_id)) assert code == resp.status assert message == resp.reason
46.834615
123
0.635214
11,141
0.914922
0
0
11,403
0.936438
8,400
0.689825
2,893
0.237579
bccd4ecf3e75810f078465ed5395ba34d886f56a
3,690
py
Python
pyemits/core/preprocessing/dimensional_reduction.py
thompson0012/PyEmits
9cb6fbf27ca7e8952ed5aca26118055e04492c23
[ "Apache-2.0" ]
6
2021-10-21T14:13:25.000Z
2021-12-26T12:22:51.000Z
pyemits/core/preprocessing/dimensional_reduction.py
thompson0012/PyEmits
9cb6fbf27ca7e8952ed5aca26118055e04492c23
[ "Apache-2.0" ]
null
null
null
pyemits/core/preprocessing/dimensional_reduction.py
thompson0012/PyEmits
9cb6fbf27ca7e8952ed5aca26118055e04492c23
[ "Apache-2.0" ]
null
null
null
""" Why need dimensional reduction The following is the use of dimensionality reduction in the data set: • As data dimensions continue to decrease, the space required for data storage will also decrease. • Low-dimensional data helps reduce calculation/training time. • Some algorithms tend to perform poorly on high-dimensional data, and dimensionality reduction can improve algorithm availability. • Dimensionality reduction can solve the problem of multicollinearity by removing redundant features. For example, we have two variables: "On the treadmill for a period of time Time spent” and “calorie consumption”. These two variables are highly correlated. The longer the time spent on the treadmill, the more calories burned. Naturally, the more. Therefore, it does not make much sense to store these two data at the same time, just one is enough. • Dimensionality reduction helps data visualization. As mentioned earlier, if the dimensionality of the data is very high, the visualization will become quite difficult, while drawing two-dimensional three-dimensional The graph of dimensional data is very simple. Common dimensional reduction techniques: 1. missing value ratio 2. low variance filter 3. high correlation filter 4. random forest 5. backward feature elimination 6. forward feature selection 7. factor analysis 8. principle components analysis 9. independent component analysis 10. IOSMAP 11. t-SNE 12. UMAP """ random_state = 0 from enum import Enum class FeatureSelection(Enum): @classmethod def missing_value_ratio(cls, threshold): return @classmethod def low_variance_filter(cls, threshold): return @classmethod def high_correlation_filter(cls, threshold): return @classmethod def random_forest(cls): from sklearn.ensemble import RandomForestRegressor RF = RandomForestRegressor() RF.fit() RF.feature_importances_ return @classmethod def backward_feature_extraction(cls): from sklearn.linear_model import LinearRegression from sklearn.feature_selection import RFE clf = LinearRegression() rfe = RFE(clf, 10) rfe = rfe.fit_transform() return @classmethod def forward_feature_extraction(cls): from sklearn.feature_selection import f_regression ffs = f_regression() return class ProjectionBased(Enum): @classmethod def isomap(cls): from sklearn.manifold import Isomap ISOMAP = Isomap(neighbors_algorithm=5, n_components=3, n_jobs=-1) ISOMAP.fit_transform() return @classmethod def tsne(cls): from sklearn.manifold import TSNE tsne = TSNE(n_components=3, n_iter=300) tsne.fit_transform() return @classmethod def umap(cls): # install umap return class ComponentsFactorsBased(Enum): @classmethod def factor_analysis(cls): from sklearn.decomposition import FactorAnalysis FA = FactorAnalysis(n_components=3) FA.fit_transform() return @classmethod def pca(cls): from sklearn.decomposition import PCA pca = PCA(n_components=3) pca.fit_transform() return @classmethod def ica(cls): from sklearn.decomposition import FastICA ICA = FastICA(n_components=3) ICA.fit_transform() return @classmethod def lda(cls, solver='svd', n_components=3): from sklearn.discriminant_analysis import LinearDiscriminantAnalysis LDA = LinearDiscriminantAnalysis(solver=solver, n_components=n_components) LDA.fit_transform() return
30.495868
217
0.714363
2,208
0.595791
0
0
2,041
0.550729
0
0
1,467
0.395845
bccea585927cd051fb0a3ed4b33c0aada5c1d9b8
456
py
Python
sample_project/exam/exam.py
pcse/gitlab_tools
2896b636b0f8955bdb5f2236e257cc5d3efd54d7
[ "BSD-3-Clause" ]
null
null
null
sample_project/exam/exam.py
pcse/gitlab_tools
2896b636b0f8955bdb5f2236e257cc5d3efd54d7
[ "BSD-3-Clause" ]
null
null
null
sample_project/exam/exam.py
pcse/gitlab_tools
2896b636b0f8955bdb5f2236e257cc5d3efd54d7
[ "BSD-3-Clause" ]
1
2022-03-17T16:51:08.000Z
2022-03-17T16:51:08.000Z
""" These methods can be called inside WebCAT to determine which tests are loaded for a given section/exam pair. This allows a common WebCAT submission site to support different project tests """ def section(): # Instructor section (instructor to change before distribution) #return 8527 #return 8528 return 8529 def exam(): # A or B exam (instructor to change to match specific project distribution return "A" #return "B"
25.333333
78
0.723684
0
0
0
0
0
0
0
0
372
0.815789
bccf9e77bf6eaccd18d5b5a8053e3859146a0272
2,727
py
Python
scrapy/clarinetear/spiders/pagina12.py
ramiror/clarinete
4ebf37cf9f705e04e2aad15015be12c48fe25fd3
[ "BSD-2-Clause" ]
null
null
null
scrapy/clarinetear/spiders/pagina12.py
ramiror/clarinete
4ebf37cf9f705e04e2aad15015be12c48fe25fd3
[ "BSD-2-Clause" ]
null
null
null
scrapy/clarinetear/spiders/pagina12.py
ramiror/clarinete
4ebf37cf9f705e04e2aad15015be12c48fe25fd3
[ "BSD-2-Clause" ]
null
null
null
from datetime import datetime import scrapy import lxml from lxml.html.clean import Cleaner import re SOURCE = 'Página 12' LANGUAGE = 'es' cleaner = Cleaner(allow_tags=['p', 'br', 'b', 'a', 'strong', 'i', 'em']) class Pagina12Spider(scrapy.Spider): name = 'pagina12' allowed_domains = ['www.pagina12.com.ar'] start_urls = ['https://www.pagina12.com.ar/'] def start_requests(self): url = getattr(self, 'article_url', None) if url is not None: yield scrapy.Request(url, callback=self.parse_article, cb_kwargs=dict(url=url)) def parse(self, response): urls = [] for article in response.css('article'): link = article.css('a') url = link.attrib['href'] if not url: continue if not url.startswith('http'): url = 'https://www.pagina12.com.ar' + url urls.append(url) maybe_img = article.css('img.show-for-large-only') obj = { 'title': article.css('.article-title a::text, a .title::text').get(), 'volanta': (article.css('.article-title a .title-prefix::text').get() or '').strip(), 'url': url, 'image': maybe_img.attrib['src'] if maybe_img else None, 'source': SOURCE, 'source_language': LANGUAGE, } yield obj request = scrapy.Request(url, callback=self.parse_article, cb_kwargs=dict(url=url)) yield request yield {'homepage': urls, 'source': SOURCE} def parse_article(self, response, url): html = ''.join(response.xpath('//div[@class="article-main-content article-text "]/p').extract()) if not html: return content = lxml.html.tostring(cleaner.clean_html(lxml.html.fromstring(html))).decode('utf-8') date = response.css('div.date span::text').get().strip() date_fragments = re.match(r'^([0-9]{1,2}) de ([a-z]+) de ([0-9]{4})$', date) months = { 'enero': 1, 'febrero': 2, 'marzo': 3, 'abril': 4, 'mayo': 5, 'junio': 6, 'julio': 7, 'agosto': 8, 'septiembre': 9, 'octubre': 10, 'noviembre': 11, 'diciembre': 12, } day = int(date_fragments.group(1)) month = months[date_fragments.group(2)] year = int(date_fragments.group(3)) hour = 0 minute = 0 date = datetime(year, month, day, hour, minute) obj = { 'url': url, 'content': content, 'date': date.isoformat() } yield obj
32.855422
104
0.521819
2,512
0.920821
2,340
0.857771
0
0
0
0
600
0.219941
bccfcca536c98cf3954ec419341b10079911dafc
6,978
py
Python
svd.py
christyc14/fyp
c63e719e383a84eb49ffa0c8bd901bfd4aef5864
[ "MIT" ]
null
null
null
svd.py
christyc14/fyp
c63e719e383a84eb49ffa0c8bd901bfd4aef5864
[ "MIT" ]
null
null
null
svd.py
christyc14/fyp
c63e719e383a84eb49ffa0c8bd901bfd4aef5864
[ "MIT" ]
null
null
null
from calendar import c from typing import Dict, List, Union from zlib import DEF_BUF_SIZE import json_lines import numpy as np import re from sklearn.preprocessing import MultiLabelBinarizer from sklearn.manifold import TSNE from sklearn.preprocessing import StandardScaler import pandas as pd import json from scipy.sparse.linalg import svds from scipy.spatial import distance import os import streamlit as st def preprocess_ingredients(ingredients): processed_ingredients = [] for i in range(len(ingredients)): processed_ingredient = re.sub( r"\(([^)]*)\)|(([0-9]\d{0,2}(\.\d{1,3})*(,\d+)?)(%|mg|units))|(<\/?i>)|(\/.+)|(\\.+)|\[([^\]]*)\]", "", ingredients[i], ).strip() if ( processed_ingredient.lower() == "water" or processed_ingredient.lower() == "aqua" or processed_ingredient.lower() == "eau" ): processed_ingredient = "Water" processed_ingredients.append(processed_ingredient) return processed_ingredients @st.experimental_memo def content_recommender(opt, _item1, _item2, _item3, df) -> pd.DataFrame: content_df = df[df.category == opt] content_df["ingredients"] = content_df["ingredients"].map(preprocess_ingredients) mlb = MultiLabelBinarizer() output = mlb.fit_transform(content_df.ingredients.values) content_df = content_df.drop(["ingredients"], axis=1) model = TSNE(n_components=2, learning_rate=200) tsne_features = model.fit_transform(output) content_df["X"] = tsne_features[:, 0] content_df["Y"] = tsne_features[:, 1] content_df["dist"] = 0.0 item1 = content_df[content_df["product_name"] == _item1] item2 = content_df[content_df["product_name"] == _item2] item3 = content_df[content_df["product_name"] == _item3] p1 = np.array([item1["X"], item1["Y"]]).reshape(1, -1) p2 = np.array([item2["X"], item2["Y"]]).reshape(1, -1) p3 = np.array([item3["X"], item3["Y"]]).reshape(1, -1) for ind, item in content_df.iterrows(): pn = np.array([item.X, item.Y]).reshape(-1, 1) df.at[ind, "dist"] = min( distance.chebyshev(p1, pn), distance.chebyshev(p2, pn), distance.chebyshev(p3, pn), ) content_df = content_df[~content_df.product_name.isin([_item1, _item2, _item3])] content_df = content_df.sort_values("dist") return content_df @st.experimental_memo def collab_recommender(df_tmp, num_recs, username): reviews = df_tmp.explode("review_data") reviews["username"] = reviews["review_data"].apply(lambda x: x["UserNickname"]) reviews["rating"] = reviews["review_data"].apply(lambda x: x["Rating"]) grouped_reviews = reviews.groupby("username")["review_data"].apply(list) multiple_rating_users = set(grouped_reviews[grouped_reviews.map(len) > 1].index) multi_reviews = reviews[reviews.username.isin(multiple_rating_users)] products_reviewed_per_user = {u: set() for u in multiple_rating_users} product_index = dict(zip(df_tmp["url"].values, range(len(df_tmp["url"])))) username_index = dict(zip(multiple_rating_users, range(len(multiple_rating_users)))) matrix = np.zeros((len(multiple_rating_users), len(df_tmp["url"]))) for user, rating, url in zip( multi_reviews.username.values, multi_reviews.rating.values, multi_reviews.url.values, ): matrix[username_index[user]][product_index[url]] = rating products_reviewed_per_user[user].add(url) ss = StandardScaler() normatrix = ss.fit_transform(matrix) print(normatrix) U, S, V = svds(normatrix) all_user_predicted_rating = ss.inverse_transform(U @ np.diag(S) @ V) preds_df = pd.DataFrame( all_user_predicted_rating, columns=product_index, index=username_index ) sorted_user_preds = preds_df.loc[username].sort_values(ascending=False) sorted_user_preds = sorted_user_preds[ ~sorted_user_preds.index.isin(products_reviewed_per_user[username]) ] sorted_user_preds = sorted_user_preds.head(num_recs) # we want those that they haven't already tested collab_df = pd.merge( df_tmp, sorted_user_preds.to_frame(), left_on="url", right_index=True, how="right", ) collab_df.rename(columns={username: "pred_rating"}, inplace=True) return collab_df if __name__ == "__main__": file_path = os.path.dirname(__file__) if file_path != "": os.chdir(file_path) products: List[Dict[str, Union[str, List[str]]]] = [] # input data into List with open("../cbscraper/product_urls_with_reviews.jsonlines", "rb") as f: unique = set() lines = f.read().splitlines() df_inter = pd.DataFrame(lines) df_inter.columns = ["json_element"] df_inter["json_element"].apply(json.loads) df = pd.json_normalize(df_inter["json_element"].apply(json.loads)) # to save myself if i do something dumb and run the scraper without deleting the .jsonlines file df.drop_duplicates(subset=["url"], inplace=True) # option: category of product, eg cleanser categories = set(df.category.values) # filter data by given option print("Hello world!") print("Welcome!") print(categories) print("pls enter the category:") cat = str(input()) display_product_names = df[df.category == cat] print(display_product_names[["brand", "product_name"]]) print("pls enter your top 3 products indices, separated by a new line") item1 = int(input()) item2 = int(input()) item3 = int(input()) print("pls enter # of recs:") num_recs = int(input()) reviews = display_product_names.explode("review_data") reviews["username"] = reviews["review_data"].apply(lambda x: x["UserNickname"]) grouped_reviews = reviews.groupby("username")["review_data"].apply(list) multiple_rating_users = set(grouped_reviews[grouped_reviews.map(len) > 1].index) print(multiple_rating_users) print("pls enter sephora userid, if you don't have one just enter 'none':") username = str(input()) if username == "none": print("your ingredients based recommendations are:") cbf = content_recommender( cat, df.product_name.values[item1], df.product_name.values[item2], df.product_name.values[item3], num_recs, df, ) print(cbf[["brand", "product_name", "url", "avg_rating"]]) else: cbf = content_recommender( cat, df.product_name.values[item1], df.product_name.values[item2], df.product_name.values[item3], num_recs + 10, df, ) cf = collab_recommender(cbf, num_recs, username) print("your hybrid recommendations are:") print(cf[["brand", "product_name", "url", "pred_rating"]]) print("thank u for using this service :)")
38.131148
111
0.655775
0
0
0
0
3,329
0.477071
0
0
1,234
0.176842
bccff1b3d6077ecdb8e86f1fedd69c5761247393
22,448
py
Python
esp32/tools/flasher.py
rodgergr/pycom-micropython-sigfox
50a31befc40a39b1e4c3513f20da968792227b0e
[ "MIT" ]
null
null
null
esp32/tools/flasher.py
rodgergr/pycom-micropython-sigfox
50a31befc40a39b1e4c3513f20da968792227b0e
[ "MIT" ]
null
null
null
esp32/tools/flasher.py
rodgergr/pycom-micropython-sigfox
50a31befc40a39b1e4c3513f20da968792227b0e
[ "MIT" ]
1
2019-09-22T01:28:52.000Z
2019-09-22T01:28:52.000Z
#!/usr/bin/env python # # Copyright (c) 2018, Pycom Limited. # # This software is licensed under the GNU GPL version 3 or any # later version, with permitted additional terms. For more information # see the Pycom Licence v1.0 document supplied with this file, or # available at https://www.pycom.io/opensource/licensing # """ Flash the ESP32 (bootloader, partitions table and factory app). How to call esptool: python esptool.py '--chip', 'esp32', '--port', /dev/ttyUSB0, '--baud', '921600', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', '0x1000', bootloader.bin, '0x8000', partitions.bin, '0x10000', application.bin, '0x3FF000', 'config_no_wifi.bin' """ from esptool import ESP32ROM import os import sys import struct import sqlite3 import argparse import subprocess import threading import time import fw_version import csv working_threads = {} macs_db = None wmacs = {} DB_MAC_UNUSED = 0 DB_MAC_ERROR = -1 DB_MAC_LOCK = -2 DB_MAC_OK = 1 def open_macs_db(db_filename): global macs_db if not os.path.exists(db_filename): print("MAC addresses database not found") sys.exit(1) macs_db = sqlite3.connect(db_filename) def fetch_MACs(number): return [x[0].encode('ascii', 'ignore') for x in macs_db.execute("select mac from macs where status = 0 order by rowid asc limit ?", (number,)).fetchall()] def set_mac_status(mac, wmac, status): macs_db.execute("update macs set status = ?, last_touch = strftime('%s','now'), wmac = ? where mac = ?", (status, wmac, mac)) macs_db.commit() def print_exception(e): print ('Exception: {}, on line {}'.format(e, sys.exc_info()[-1].tb_lineno)) def erase_flash(port, command): global working_threads process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) num_erases = 0 # poll the process for new output until finished while True: nextline = process.stdout.readline() if nextline == '' and process.poll() != None: break if 'Chip erase completed successfully' in nextline: sys.stdout.write('Board erased OK on port %s\n' % port) num_erases += 1 sys.stdout.flush() # hack to give feedback to the main thread if process.returncode != 0 or num_erases != 1: working_threads[port] = None def read_wlan_mac(port, command): global working_threads global wmacs process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) mac_read = False # poll the process for new output until finished while True: nextline = process.stdout.readline() if nextline == '' and process.poll() != None: break if 'MAC: ' in nextline: wmacs[port] = nextline[5:-1].replace(":", "-").upper() sys.stdout.write('MAC address %s read OK on port %s\n' % (nextline[5:-1], port)) mac_read = True sys.stdout.flush() # hack to give feedback to the main thread if process.returncode != 0 or not mac_read: working_threads[port] = None def set_vdd_sdio_voltage(port, command): global working_threads process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) # poll the process for new output until finished while True: nextline = process.stdout.readline() if nextline == '' and process.poll() != None: break if 'VDD_SDIO setting complete' in nextline: sys.stdout.write('Board VDD_SDIO Voltage configured OK on port %s\n' % port) sys.stdout.flush() # hack to give feedback to the main thread if process.returncode != 0: working_threads[port] = None def flash_firmware(port, command): global working_threads process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) num_hashes = 0 # poll the process for new output until finished while True: nextline = process.stdout.readline() if nextline == '' and process.poll() != None: break if 'at 0x00001000' in nextline: sys.stdout.write('Bootloader programmed OK on port %s\n' % port) elif 'at 0x00008000' in nextline: sys.stdout.write('Partition table programmed OK on port %s\n' % port) elif 'at 0x00010000' in nextline: sys.stdout.write('Application programmed OK on port %s\n' % port) elif 'Hash of data verified' in nextline: num_hashes += 1 sys.stdout.flush() # hack to give feedback to the main thread if process.returncode != 0 or num_hashes != 3: working_threads[port] = None def run_initial_test(port, board): global working_threads if board == 'LoPy': import run_initial_lopy_test as run_test elif board == 'LoPy4': import run_initial_lopy4_test as run_test elif board == 'SiPy': import run_initial_sipy_test as run_test else: import run_initial_wipy_test as run_test try: if not run_test.test_board(port): # same trick to give feedback to the main thread working_threads[port] = None except Exception: working_threads[port] = None def flash_lpwan_mac(port, mac): import flash_lpwan_mac global working_threads try: if not flash_lpwan_mac.program_board(port, mac): # same trick to give feedback to the main thread working_threads[port] = None except Exception: working_threads[port] = None def run_final_test(port, board, mac): if board == 'LoPy': import run_final_lopy_test as run_test elif board == 'LoPy4': import run_final_lopy4_test as run_test else: import run_final_sipy_test as run_test try: if not run_test.test_board(port, mac, fw_version.number): # same trick to give feedback to the main thread working_threads[port] = None except Exception: working_threads[port] = None def run_qa_test(port, board): global working_threads if board == 'LoPy': import run_qa_lopy_test as run_test elif board == 'LoPy4': import run_qa_lopy4_test as run_test elif board == 'SiPy': import run_qa_sipy_test as run_test else: import run_qa_wipy_test as run_test try: if not run_test.test_board(port, fw_version.number): # same trick to give feedback to the main thread working_threads[port] = None except Exception: working_threads[port] = None def main(): cmd_parser = argparse.ArgumentParser(description='Flash the ESP32 and optionally run a small test on it.') cmd_parser.add_argument('--esptool', default=None, help='the path to the esptool') cmd_parser.add_argument('--espefuse', default=None, help='the path to the espefuse') cmd_parser.add_argument('--boot', default=None, help='the path to the bootloader binary') cmd_parser.add_argument('--table', default=None, help='the path to the partitions table') cmd_parser.add_argument('--app', default=None, help='the path to the application binary') cmd_parser.add_argument('--macs', default="macs.db", help='the path to the MAC addresses database') cmd_parser.add_argument('--ports', default=['/dev/ttyUSB0'], nargs='+', help="the serial ports of the ESP32's to program") cmd_parser.add_argument('--erase', default=None, help='set to True to erase the boards first') cmd_parser.add_argument('--qa', action='store_true', help='just do some quality asurance test') cmd_parser.add_argument('--board', default='LoPy', help='identifies the board to be flashed and tested') cmd_parser.add_argument('--revision', default='1', help='identifies the hardware revision') cmd_args = cmd_parser.parse_args() global working_threads global wmacs output = "" ret = 0 global_ret = 0 if cmd_args.qa: raw_input("Please reset all the boards, wait until the LED starts blinking and then press enter...") time.sleep(2.5) # wait for the board to reset try: for port in cmd_args.ports: working_threads[port] = threading.Thread(target=run_qa_test, args=(port, cmd_args.board)) working_threads[port].start() for port in cmd_args.ports: if working_threads[port]: working_threads[port].join() for port in cmd_args.ports: if working_threads[port] == None: print("Failed QA test on board connected to %s" % port) ret = 1 except Exception as e: ret = 1 print_exception(e) if ret == 0: print("=============================================================") print("QA test succeeded on all boards:-)") print("=============================================================") else: print("=============================================================") print("ERROR: Some boards failed the QA test!") print("=============================================================") global_ret = 1 else: print("Reading the WLAN MAC address...") try: for port in cmd_args.ports: cmd = ['python', 'esptool.py', '--port', port, 'read_mac'] working_threads[port] = threading.Thread(target=read_wlan_mac, args=(port, cmd)) working_threads[port].start() for port in cmd_args.ports: if working_threads[port]: working_threads[port].join() _ports = list(cmd_args.ports) for port in _ports: if working_threads[port] == None: print("Error reading the WLAN MAC on the board on port %s" % port) cmd_args.ports.remove(port) ret = 1 except Exception as e: ret = 1 print_exception(e) if ret == 0: print("=============================================================") print("WLAN MAC address reading succeeded :-)") print("=============================================================") else: print("=============================================================") print("ERROR: WLAN MAC address reading failed in some boards!") print("=============================================================") global_ret = 1 raw_input("Please reset all the boards and press enter to continue with the flashing process...") if int(cmd_args.revision) > 1: # program the efuse bits to set the VDD_SDIO voltage to 1.8V try: print('Configuring the VDD_SDIO voltage...') for port in cmd_args.ports: cmd = ['python', cmd_args.espefuse, '--port', port, '--do-not-confirm', 'set_flash_voltage', '1.8V'] working_threads[port] = threading.Thread(target=set_vdd_sdio_voltage, args=(port, cmd)) working_threads[port].start() for port in cmd_args.ports: if working_threads[port]: working_threads[port].join() _ports = list(cmd_args.ports) for port in _ports: if working_threads[port] == None: print("Error setting the VDD_SDIO voltage on the board on port %s" % port) cmd_args.ports.remove(port) ret = 1 except Exception as e: ret = 1 print_exception(e) if ret == 0: print("=============================================================") print("VDD_SDIO voltage setting succeeded :-)") print("=============================================================") else: print("=============================================================") print("ERROR: VDD_SDIO voltage setting failed in some boards!") print("=============================================================") global_ret = 1 raw_input("Please reset all the boards and press enter to continue with the flashing process...") time.sleep(1.0) # wait for the board to reset working_threads = {} if cmd_args.erase: try: print('Erasing flash memory... (will take a few seconds)') for port in cmd_args.ports: cmd = ['python', cmd_args.esptool, '--chip', 'esp32', '--port', port, '--baud', '921600', 'erase_flash'] working_threads[port] = threading.Thread(target=erase_flash, args=(port, cmd)) working_threads[port].start() for port in cmd_args.ports: if working_threads[port]: working_threads[port].join() _ports = list(cmd_args.ports) for port in _ports: if working_threads[port] == None: print("Error erasing board on port %s" % port) cmd_args.ports.remove(port) ret = 1 except Exception as e: ret = 1 print_exception(e) if ret == 0: print("=============================================================") print("Batch erasing succeeded :-)") print("=============================================================") else: print("=============================================================") print("ERROR: Batch erasing failed in some boards!") print("=============================================================") global_ret = 1 raw_input("Please reset all the boards and press enter to continue with the flashing process...") time.sleep(1.0) # wait for the board to reset working_threads = {} try: if cmd_args.board == 'LoPy' or cmd_args.board == 'SiPy' or cmd_args.board == 'LoPy4': open_macs_db(cmd_args.macs) macs_list = fetch_MACs(len(cmd_args.ports)) if len(macs_list) < len(cmd_args.ports): print("No enough remaining MAC addresses to use") sys.exit(1) mac_per_port = {} i = 0 for port in cmd_args.ports: mac_per_port[port] = macs_list[i] i += 1 for port in cmd_args.ports: cmd = ['python', cmd_args.esptool, '--chip', 'esp32', '--port', port, '--baud', '921600', 'write_flash', '-z', '--flash_mode', 'dio', '--flash_freq', '40m', '--flash_size', 'detect', '0x1000', cmd_args.boot, '0x8000', cmd_args.table, '0x10000', cmd_args.app] working_threads[port] = threading.Thread(target=flash_firmware, args=(port, cmd)) working_threads[port].start() for port in cmd_args.ports: if working_threads[port]: working_threads[port].join() _ports = list(cmd_args.ports) for port in _ports: if working_threads[port] == None: print("Error programming board on port %s" % port) cmd_args.ports.remove(port) ret = 1 else: print("Board on port %s programmed OK" % port) except Exception as e: ret = 1 print_exception(e) if ret == 0: print("=============================================================") print("Batch programming succeeded :-)") print("=============================================================") else: print("=============================================================") print("ERROR: Batch firmware programming failed on some boards!") print("=============================================================") global_ret = 1 raw_input("Please place all boards into run mode, RESET them and then \n press enter to continue with the testing process...") time.sleep(5.0) # wait for the board to reset working_threads = {} try: for port in cmd_args.ports: working_threads[port] = threading.Thread(target=run_initial_test, args=(port, cmd_args.board)) working_threads[port].start() for port in cmd_args.ports: if working_threads[port]: working_threads[port].join() _ports = list(cmd_args.ports) for port in _ports: if working_threads[port] == None: print("Error testing board on port %s" % port) cmd_args.ports.remove(port) ret = 1 elif cmd_args.board == 'WiPy': print("Batch test OK on port %s, firmware version %s" % (port, fw_version.number)) with open('%s_Flasher_Results.csv' % (cmd_args.board), 'ab') as csv_file: csv_writer = csv.writer(csv_file, delimiter=',') csv_writer.writerow(['%s' % (cmd_args.board), '%s' % (fw_version.number), ' ', 'OK']) except Exception as e: ret = 1 print_exception(e) if ret == 0: print("=============================================================") print("Batch testing succeeded :-)") print("=============================================================") else: print("=============================================================") print("ERROR: Batch testing failed in some boards!") print("=============================================================") global_ret = 1 # only do the MAC programming and MAC verificacion for the LoPy, SiPy and LoPy4 if cmd_args.board == 'LoPy' or cmd_args.board == 'SiPy' or cmd_args.board == 'LoPy4': print("Waiting before programming the LPWAN MAC address...") time.sleep(3.5) # wait for the board to reset working_threads = {} try: for port in cmd_args.ports: set_mac_status(mac_per_port[port], "", DB_MAC_LOCK) # mark them as locked, so if the script fails and doesn't get to save, they wont be accidentally reused working_threads[port] = threading.Thread(target=flash_lpwan_mac, args=(port, mac_per_port[port])) working_threads[port].start() for port in cmd_args.ports: if working_threads[port]: working_threads[port].join() _ports = list(cmd_args.ports) for port in _ports: if working_threads[port] == None: print("Error programing MAC address on port %s" % port) cmd_args.ports.remove(port) ret = 1 set_mac_status(mac_per_port[port], wmacs[port], DB_MAC_ERROR) except Exception as e: ret = 1 print_exception(e) if ret == 0: print("=============================================================") print("Batch MAC programming succeeded :-)") print("=============================================================") else: print("=============================================================") print("ERROR: Batch MAC programming failed in some boards!") print("=============================================================") global_ret = 1 print("Waiting for the board(s) to reboot...") time.sleep(4.5) # wait for the board to reset working_threads = {} try: for port in cmd_args.ports: working_threads[port] = threading.Thread(target=run_final_test, args=(port, cmd_args.board, mac_per_port[port])) working_threads[port].start() for port in cmd_args.ports: if working_threads[port]: working_threads[port].join() for port in cmd_args.ports: if working_threads[port] == None: ret = 1 set_mac_status(mac_per_port[port], wmacs[port], DB_MAC_ERROR) print("Error performing MAC address test on port %s" % port) else: set_mac_status(mac_per_port[port], wmacs[port], DB_MAC_OK) print("Final test OK on port %s, firmware version %s, MAC address %s" % (port, fw_version.number, mac_per_port[port])) with open('%s_Flasher_Results.csv' % (cmd_args.board), 'ab') as csv_file: csv_writer = csv.writer(csv_file, delimiter=',') csv_writer.writerow(['%s' % (cmd_args.board), '%s' % (fw_version.number), '%s' % (mac_per_port[port]), 'OK']) except Exception as e: ret = 1 print_exception(e) if ret == 0: print("=============================================================") print("Final test succeeded on all boards :-)") print("=============================================================") else: print("=============================================================") print("ERROR: Some boards failed the final test!") print("=============================================================") global_ret = 1 macs_db.close() sys.exit(global_ret) if __name__ == "__main__": main()
42.116323
286
0.513587
0
0
0
0
0
0
0
0
7,286
0.324572
bccff8756b8fd9c49c849a5ee7e86c1a5271fe95
2,315
py
Python
hknweb/events/tests/models/utils.py
jyxzhang/hknweb
a01ffd8587859bf63c46213be6a0c8b87164a5c2
[ "MIT" ]
null
null
null
hknweb/events/tests/models/utils.py
jyxzhang/hknweb
a01ffd8587859bf63c46213be6a0c8b87164a5c2
[ "MIT" ]
null
null
null
hknweb/events/tests/models/utils.py
jyxzhang/hknweb
a01ffd8587859bf63c46213be6a0c8b87164a5c2
[ "MIT" ]
null
null
null
import datetime from django.utils import timezone from django.contrib.auth.models import User from hknweb.events.models import Event, EventType, Rsvp class ModelFactory: @staticmethod def create_user(**kwargs): default_kwargs = { "username": "default username", } kwargs = {**default_kwargs, **kwargs} return User.objects.create(**kwargs) @staticmethod def create_event_type(**kwargs): default_kwargs = { "type": "default event type", } kwargs = {**default_kwargs, **kwargs} return EventType.objects.create(**kwargs) @staticmethod def create_event(name, event_type, created_by, **kwargs): required_kwargs = { "name": name, "event_type": event_type, "created_by": created_by, } default_kwargs = { "start_time": timezone.now(), "end_time": timezone.now() + datetime.timedelta(hours=2), "location": "default location", "description": "default description", } kwargs = {**required_kwargs, **default_kwargs, **kwargs} return Event.objects.create(**kwargs) @staticmethod def create_rsvp(user, event, **kwargs): required_kwargs = { "user": user, "event": event, } kwargs = {**required_kwargs, **kwargs} return Rsvp.objects.create(**kwargs) @staticmethod def create_event_with_rsvps(): event_create_user = ModelFactory.create_user(username="event create user") num_rsvps = 3 rsvp_users = [ ModelFactory.create_user(username="rsvp_user_{}".format(str(i))) for i in range(1, 1 + num_rsvps) ] event_type = ModelFactory.create_event_type() event_name = "custom event name" event = ModelFactory.create_event( name=event_name, event_type=event_type, created_by=event_create_user, rsvp_limit=num_rsvps - 1, ) rsvps = [ModelFactory.create_rsvp(rsvp_user, event) for rsvp_user in rsvp_users] return ( event_create_user, rsvp_users, event_type, event_name, event, rsvps, )
28.9375
88
0.581425
2,160
0.933045
0
0
2,112
0.912311
0
0
233
0.100648
bcd088f1e5c34ccfa8be8350d7cb0a6ebc06a38b
4,979
py
Python
HealthNet/prescriptions/views.py
jimga150/HealthNet
84e55302b02221ae6e93640904af837fdfe09a83
[ "MIT" ]
null
null
null
HealthNet/prescriptions/views.py
jimga150/HealthNet
84e55302b02221ae6e93640904af837fdfe09a83
[ "MIT" ]
null
null
null
HealthNet/prescriptions/views.py
jimga150/HealthNet
84e55302b02221ae6e93640904af837fdfe09a83
[ "MIT" ]
null
null
null
from django.shortcuts import redirect from .forms import PrescriptionForm from core.views import is_doctor, is_nurse, is_admin, is_patient from core.models import * from .models import Prescription from django.contrib.auth.decorators import login_required, user_passes_test from django.utils import timezone from django.shortcuts import render from django.core.urlresolvers import reverse def not_admin(user): """ :param user: The User in question :return: True if the user is anything but an Admin """ return not is_admin(user) def is_doctor_or_nurse(user): """ :param user: The User in question :return: True if the user is a Doctor or Nurse """ return is_doctor(user) or is_nurse(user) @login_required @user_passes_test(is_doctor) def new_prescription(request): """ Page for the form a doctor fills out to prescribe a drug :param request: the request with possible form submission :return: Prescription form or redirect to listing page (below) """ if request.method == 'POST': prescription_form = PrescriptionForm(data=request.POST) validity = prescription_form.is_valid() if validity: prescription = prescription_form.save(commit=False) prescription.date_prescribed = timezone.now() prescription.doctor = Doctor.objects.all().get(user=request.user) prescription.save() log = Log.objects.create_Log(request.user, request.user.username, timezone.now(), "Prescription filled out") log.save() else: print("Error") print(prescription_form.errors) if 'submit_singular' in request.POST and validity: return redirect('prescriptions') elif 'submit_another' in request.POST: prescription_form = PrescriptionForm() else: prescription_form = PrescriptionForm() context = {"prescription_form": prescription_form} return render(request, 'prescriptions/makenew.html', context) def get_prescription_list_for(cpatient): """ Generic getter for a specific patient's prescription list :param cpatient: Patient to fetch list for :return: context of Prescription list """ Prescriptions = Prescription.objects.all().filter(patient=cpatient) per = [] for p in Prescriptions.iterator(): per.append(str(dict(p.TIME_CHOICES)[p.Time_units])) p_list = zip(Prescriptions, per) return {"Labels": ["Doctor", "Drug", "Dosage", "Rate"], "Name": str(cpatient), "Prescriptions": p_list} @login_required @user_passes_test(not_admin) def prescriptions(request): """ Lists either all patients in the hospital with links to their prescription lists, or the prescriptions applied to a single defined patient. :param request: The request sent in, not used here :return: List page rendering """ context = {} if is_doctor(request.user) or is_nurse(request.user): context["Labels"] = ["Name", "Prescriptions"] patients = Patient.objects.all() prescription_nums = [] for pat in patients.iterator(): prescription_nums.append(Prescription.objects.filter(patient=pat).count()) context["Patients"] = zip(patients, prescription_nums) elif is_patient(request.user): cpatient = Patient.objects.get(user=request.user) context = get_prescription_list_for(cpatient) context["is_doctor"] = is_doctor(request.user) context["is_doctor"] = is_doctor(request.user) return render(request, 'prescriptions/list.html', context) @login_required @user_passes_test(is_doctor_or_nurse) def prescriptions_list(request, patient_id): """ Page that doctors and nurses are sent to when accessing a single patient's prescription list. :param request: The request sent in, not used here :param patient_id: ID of the patient who's being listed :return: List page rendering """ cpatient = Patient.objects.get(pk=patient_id) context = get_prescription_list_for(cpatient) context["is_doctor"] = is_doctor(request.user) return render(request, 'prescriptions/list.html', context) @login_required @user_passes_test(is_doctor) def delete_prescription(request, prescription_id): """ Page for confirming/deleting a single prescription :param request: The request sent in, not used here :param prescription_id: ID number of the prescription in question :return: Redirect or confirmation page """ prescription = Prescription.objects.get(pk=prescription_id) patient_id = prescription.patient.id if request.method == 'POST': prescription.delete() return redirect(reverse('list prescriptions for patient', kwargs={'patient_id': patient_id})) context = {"Prescription": prescription, 'patient_id': patient_id} return render(request, 'prescriptions/delete.html', context)
33.193333
119
0.69753
0
0
0
0
3,691
0.741314
0
0
1,721
0.345652
bcd22bd32e41749d160e83a36693fbb03e02a7c0
2,232
py
Python
algorithms/329. Longest Increasing Path in a Matrix.py
woozway/py3-leetcode
e51a9ce7a6bb3e35c0fcb8c8f4f6cd5763708dbf
[ "MIT" ]
1
2020-12-02T13:54:30.000Z
2020-12-02T13:54:30.000Z
algorithms/329. Longest Increasing Path in a Matrix.py
woozway/py3-leetcode
e51a9ce7a6bb3e35c0fcb8c8f4f6cd5763708dbf
[ "MIT" ]
null
null
null
algorithms/329. Longest Increasing Path in a Matrix.py
woozway/py3-leetcode
e51a9ce7a6bb3e35c0fcb8c8f4f6cd5763708dbf
[ "MIT" ]
null
null
null
""" 1. Clarification 2. Possible solutions - dfs + memoization - Topological sort 3. Coding 4. Tests """ # T=O(m*n), S=O(m*n) from functools import lru_cache class Solution: DIRS = [(-1, 0), (1, 0), (0, -1), (0, 1)] def longestIncreasingPath(self, matrix: List[List[int]]) -> int: if not matrix: return 0 @lru_cache(None) def dfs(row: int, col: int) -> int: best = 1 for dx, dy in Solution.DIRS: newRow, newCol = row + dx, col + dy if 0 <= newRow < rows and 0 <= newCol < cols and matrix[newRow][newCol] > matrix[row][col]: best = max(best, dfs(newRow, newCol) + 1) return best ans = 0 rows, cols = len(matrix), len(matrix[0]) for i in range(rows): for j in range(cols): ans = max(ans, dfs(i, j)) return ans # T=O(m*n), S=O(m*n) class Solution: DIRS = [(-1, 0), (1, 0), (0, -1), (0, 1)] def longestIncreasingPath(self, matrix: List[List[int]]) -> int: if not matrix: return 0 rows, cols = len(matrix), len(matrix[0]) outdegrees = [[0] * cols for _ in range(rows)] queue = collections.deque() for i in range(rows): for j in range(cols): for dx, dy in Solution.DIRS: newRow, newCol = i + dx, j + dy if 0 <= newRow < rows and 0 <= newCol < cols and matrix[newRow][newCol] > matrix[i][j]: outdegrees[i][j] += 1 if outdegrees[i][j] == 0: queue.append((i, j)) ans = 0 while queue: ans += 1 size = len(queue) for _ in range(size): row, col = queue.popleft() for dx, dy in Solution.DIRS: newRow, newCol = row + dx, col + dy if 0 <= newRow < rows and 0 <= newCol < cols and matrix[newRow][newCol] < matrix[row][col]: outdegrees[newRow][newCol] -= 1 if outdegrees[newRow][newCol] == 0: queue.append((newRow, newCol)) return ans
30.162162
111
0.471774
2,038
0.913082
0
0
368
0.164875
0
0
152
0.0681
bcd344e1483580a8d86580469eef57c0ac31bfc7
1,511
py
Python
cocos2d/tools/coding-style/tailing-spaces.py
NIKEA-SOFT/TestGame
04f13e5f1324bca9f1e47f02037ea1eddd3bcc8f
[ "MIT" ]
898
2020-01-09T12:03:08.000Z
2022-03-31T07:59:46.000Z
cocos2d/tools/coding-style/tailing-spaces.py
NIKEA-SOFT/TestGame
04f13e5f1324bca9f1e47f02037ea1eddd3bcc8f
[ "MIT" ]
172
2020-02-21T08:56:42.000Z
2021-05-12T03:18:40.000Z
cocos2d/tools/coding-style/tailing-spaces.py
NIKEA-SOFT/TestGame
04f13e5f1324bca9f1e47f02037ea1eddd3bcc8f
[ "MIT" ]
186
2020-01-13T09:34:30.000Z
2022-03-22T04:48:48.000Z
#!/usr/bin/env python #coding=utf-8 ''' Remove tailing whitespaces and ensures one and only one empty ending line. ''' import os, re def scan(*dirs, **kwargs): files = [] extensions = kwargs['extensions'] if kwargs.has_key('extensions') else None excludes = kwargs['excludes'] if kwargs.has_key('excludes') else [] for top in dirs: for root, dirnames, filenames in os.walk(top): dirnames = [i for i in dirnames if i in excludes] for f in filenames: if f in excludes: continue ext = os.path.splitext(f)[1].lower() if extensions is None or ext in extensions: files.append(os.path.join(root, f)) return files def fixone(src): lines = open(src, 'r').readlines() trimed = [] for line in lines: trimed.append(re.sub('\s+$', '', line)) while len(trimed) > 1 and not trimed[-1]: trimed.pop() trimed.append('') with open(src, 'w') as f: for line in trimed: f.write('%s\n' % line) def lint(root): print('Checking tailing whitespaces in: %s' % root) dirs = [ os.path.join(root, 'cocos'), os.path.join(root, 'extensions'), os.path.join(root, 'templates'), os.path.join(root, 'tests'), os.path.join(root, 'tools', 'simulator') ] files = scan(*dirs, extensions=['.c', '.cpp', '.h', '.hpp', '.m', '.mm', '.java']) for f in files: print(f) fixone(f) def main(): default_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..', '..')) lint(default_root) main()
24.370968
85
0.608868
0
0
0
0
0
0
0
0
318
0.210457
bcd3b0b0dedcabbec5fd0840549ab45783c9eb2d
4,096
py
Python
three.py/TestPostprocessing-8Bit.py
Michael-Pascale/three.py
9912f5f850245fb9456a25b6737e12290ae54a2d
[ "MIT" ]
null
null
null
three.py/TestPostprocessing-8Bit.py
Michael-Pascale/three.py
9912f5f850245fb9456a25b6737e12290ae54a2d
[ "MIT" ]
null
null
null
three.py/TestPostprocessing-8Bit.py
Michael-Pascale/three.py
9912f5f850245fb9456a25b6737e12290ae54a2d
[ "MIT" ]
null
null
null
from core import * from cameras import * from geometry import * from material import * from lights import * class TestPostprocessing2(Base): def initialize(self): self.setWindowTitle('Pixellation and Reduced Color Palette') self.setWindowSize(1024,768) self.renderer = Renderer() self.renderer.setViewportSize(1024,768) self.renderer.setClearColor(0.5,0.5,0.5) self.scene = Scene() self.camera = PerspectiveCamera() self.camera.setAspectRatio(1024/768) self.camera.transform.setPosition(0, 0, 6) self.cameraControls = FirstPersonController(self.input, self.camera) self.renderTarget = RenderTarget.RenderTarget(1024,768) crateTexture = OpenGLUtils.initializeTexture("images/crate.jpg") ballTexture = OpenGLUtils.initializeTexture("images/basketball.png") self.cube = Mesh( BoxGeometry(), SurfaceLambertMaterial(objTexture=crateTexture) ) self.cube.transform.translate(1.5, 0, 0, Matrix.LOCAL) self.scene.add(self.cube) self.sphere = Mesh( SphereGeometry(), SurfaceLambertMaterial(objTexture=ballTexture) ) self.sphere.transform.translate(-1.5, 0, 0, Matrix.LOCAL) self.scene.add(self.sphere) ambientLight = AmbientLight(color=[0.1,0.1,0.2]) self.scene.add( ambientLight ) directionalLight = DirectionalLight(color=[1,1,1], position=[4,4,-2], direction=[-1,-1,-1]) self.scene.add( directionalLight ) # add postprocessing content self.postScene = Scene() postGeo = Geometry() vertexPositionData = [[-1,-1],[1,-1],[1,1], [-1,-1],[1,1],[-1,1]] postGeo.setAttribute("vec2", "vertexPosition", vertexPositionData) postGeo.vertexCount = 6 vsCode = """ in vec2 vertexPosition; void main() { gl_Position = vec4(vertexPosition, 0, 1); } """ fsCode = """ uniform sampler2D image; uniform vec2 textureSize; // round x to the nearest 1/denominator float roundFrac(float x, float denominator) { return round(x*denominator) / denominator; } void main() { // pixellate original image int k = 8; vec2 rounded = k * floor(gl_FragCoord.xy / k); vec2 UV = rounded / textureSize; vec4 color = vec4(0,0,0,0); for (int x = 0; x < k; x++) { for (int y = 0; y < k; y++) { color += texture(image, UV + vec2(x,y)/textureSize); } } color /= (k*k); // reduce color to a smaller palette color.r = roundFrac(color.r, 8); color.g = roundFrac(color.g, 8); color.b = roundFrac(color.b, 8); // combine sepia tones with vignette gl_FragColor = color; } """ uniforms = [ ["vec2", "textureSize", [1024,768]], ["sampler2D", "image", self.renderTarget.textureID] ] postMat = Material(vsCode, fsCode, uniforms) postMesh = Mesh(postGeo, postMat) self.postScene.add(postMesh) def update(self): self.cameraControls.update() # rotate main scene objects self.cube.transform.rotateX(0.005, Matrix.LOCAL) self.cube.transform.rotateY(0.008, Matrix.LOCAL) self.sphere.transform.rotateX(0.005, Matrix.LOCAL) self.sphere.transform.rotateY(0.008, Matrix.LOCAL) # first, render scene into target (texture) self.renderer.render(self.scene, self.camera, self.renderTarget) # second, render post-processed scene to window. # (note: camera irrelevant since projection/view matrices are not used in shader.) self.renderer.render(self.postScene, self.camera) # instantiate and run the program TestPostprocessing2().run()
32
99
0.577148
3,901
0.952393
0
0
0
0
0
0
1,535
0.374756
bcd3c580510f803674768f898ad9016345f92071
3,027
py
Python
scripts/test_cache_size_vs_code_balance.py
tareqmalas/girih
0c126788937d189147be47115703b752235e585c
[ "BSD-3-Clause" ]
7
2015-07-14T08:29:14.000Z
2021-07-30T14:53:13.000Z
scripts/test_cache_size_vs_code_balance.py
tareqmalas/girih
0c126788937d189147be47115703b752235e585c
[ "BSD-3-Clause" ]
null
null
null
scripts/test_cache_size_vs_code_balance.py
tareqmalas/girih
0c126788937d189147be47115703b752235e585c
[ "BSD-3-Clause" ]
3
2016-08-30T01:25:40.000Z
2017-06-22T05:50:05.000Z
#!/usr/bin/env python def igs_test(target_dir, exp_name, th, group='', dry_run=0): from scripts.conf.conf import machine_conf, machine_info from scripts.utils import run_test import itertools cs = 8192 th = th # Test using rasonable time # T = scale * size / perf # scale = T*perf/size desired_time = 20 if(machine_info['hostname']=='Haswell_18core'): k_perf_order = {0:150, 1:500, 4:40, 5:200 ,6:20} elif(machine_info['hostname']=='IVB_10core'): k_perf_order = {0:120, 1:300, 4:35, 5:150 ,6:20} k_time_scale = {n: desired_time*k_perf_order[n] for n in k_perf_order.keys()} #exp = is_dp, ts, k, N, bs_z, tb_l exp_l = [] # spatial blocking exp_l = exp_l + \ [(0, 0, 0, 960, 0, [-1]) ,(1, 0, 0, 960, 0, [-1]) ,(1, 0, 1, 960, 0, [-1]) ,(1, 0, 4, 480, 0, [-1]) ,(1, 0, 5, 680, 0, [-1]) ] # 1WD exp_l = exp_l + \ [(0, 2, 0, 960, 1, [1, 3, 5]) ,(1, 2, 0, 960, 1, [1, 3, 5]) ,(1, 2, 1, 960, 1, [1, 3, 5, 7, 9, 11, 15, 19, 23, 29]) ,(1, 2, 4, 480, 1, [1, 3, 5]) ,(1, 2, 5, 680, 1, [1, 3, 9, 19]) ] # Solar kernel exp_l = exp_l + \ [(1, 2, 6, 480, 1, [1, 3, 5, 7]) ,(1, 2, 6, 480, 2, [1, 3, 5, 7]) ,(1, 2, 6, 480, 3, [1, 3, 5, 7]) ,(1, 2, 6, 480, 6, [1, 3, 5, 7]) ,(1, 2, 6, 480, 9, [1, 3, 5, 7])] mwdt=1 tgs, thx, thy, thz = (1,1,1,1) count=0 for is_dp, ts, kernel, N, bs_z, tb_l in exp_l: for tb in tb_l: outfile=('kernel%d_isdp%d_ts%d_bsz$d_tb%d_N%d_%s_%s.txt' % (kernel, is_dp, ts, bs_z, tb, N, group, exp_name[-13:])) nt = max(int(k_time_scale[kernel]/(N**3/1e6)), 30) # print outfile, ts, kernel, tb, N run_test(ntests=1,dry_run=dry_run, is_dp=is_dp, th=th, tgs=tgs, thx=thx, thy=thy, thz=thz, kernel=kernel, ts=ts, nx=N, ny=N, nz=N, nt=nt, outfile=outfile, target_dir=target_dir, cs=cs, mwdt=mwdt, tb=tb, nwf=bs_z) count = count+1 return count def main(): from scripts.utils import create_project_tarball, get_stencil_num, parse_results from scripts.conf.conf import machine_conf, machine_info import os, sys import time,datetime # user params dry_run = 1 if len(sys.argv)<2 else int(sys.argv[1]) # dry run time_stamp = datetime.datetime.fromtimestamp(time.time()).strftime('%Y%m%d_%H_%M') exp_name = "cache_size_vs_code_balance_at_%s_%s" % (machine_info['hostname'], time_stamp) tarball_dir='results/'+exp_name if(dry_run==0): create_project_tarball(tarball_dir, "project_"+exp_name) target_dir='results/' + exp_name th = 1 pin_str = "S0:0-%d "%(th-1) count=0 group = 'MEM' if( (machine_info['hostname']=='IVB_10core') and (group=='TLB_DATA') ): group='TLB' machine_conf['pinning_args'] = "-m -g " + group + " -C " + pin_str + ' -s 0x03 --' count= count + igs_test(target_dir, exp_name, th=th, group=group, dry_run=dry_run) print "experiments count =" + str(count) if __name__ == "__main__": main()
31.863158
218
0.573835
0
0
0
0
0
0
0
0
541
0.178725
bcd4aa69ca55232166dab3fedc825cb402a37789
654
py
Python
generate/lib/run-firefox/firefox_runner.py
flamencist/browser-extensions
cc2424ce69c718f9f6b1fb0e6cd19759ba384591
[ "BSD-3-Clause" ]
102
2015-01-09T22:12:00.000Z
2021-04-21T01:18:51.000Z
generate/lib/run-firefox/firefox_runner.py
flamencist/browser-extensions
cc2424ce69c718f9f6b1fb0e6cd19759ba384591
[ "BSD-3-Clause" ]
17
2015-01-24T22:30:47.000Z
2020-11-19T01:13:32.000Z
generate/lib/run-firefox/firefox_runner.py
flamencist/browser-extensions
cc2424ce69c718f9f6b1fb0e6cd19759ba384591
[ "BSD-3-Clause" ]
33
2015-01-15T16:11:15.000Z
2021-06-11T12:15:29.000Z
import os import shutil import codecs import json from cuddlefish.runner import run_app from cuddlefish.rdf import RDFManifest def run(): original_harness_options = os.path.join('development', 'firefox', 'harness-options.json') backup_harness_options = os.path.join('development', 'firefox', 'harness-options-bak.json') shutil.move(original_harness_options, backup_harness_options) with codecs.open(backup_harness_options, encoding='utf8') as harness_file: harness_config = json.load(harness_file) run_app( harness_root_dir=os.path.join('development', 'firefox'), harness_options=harness_config, app_type="firefox", verbose=True )
28.434783
92
0.785933
0
0
0
0
0
0
0
0
129
0.197248
bcd52639c509cc2628a1148eef258524825f4528
8,408
py
Python
pyripple/protocol/orderbook.py
gip/pyripple
d0c696bed7c6ad4c2309733484f9915074f9acdd
[ "Apache-2.0" ]
null
null
null
pyripple/protocol/orderbook.py
gip/pyripple
d0c696bed7c6ad4c2309733484f9915074f9acdd
[ "Apache-2.0" ]
null
null
null
pyripple/protocol/orderbook.py
gip/pyripple
d0c696bed7c6ad4c2309733484f9915074f9acdd
[ "Apache-2.0" ]
null
null
null
# PyRipple # # Copyright 2015 Gilles Pirio # # 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. """ .. moduleauthor:: Gilles Pirio <[email protected]> """ import numpy as np import pandas as pd import mpmath as mp from mpmath import mpf import matplotlib import matplotlib.pyplot as plt import json def _weigtedAverage(book, target): rs = 0 ws = 0 t = target for order in book: if t <= order['limit']: rs += t ws += t*order['rate'] return ws / rs else: rs += order['limit'] ws += order['limit']*order['rate'] t -= order['limit'] def _currencyStr((c, i)): return 'XRP' if c=='XRP' else '%s@%s' % (c, i) def _foldBook(accumulator, orderbook): if accumulator is None: accumulator = { 'bids': { }, 'asks': { }, 'ledgers': [ ] } ldg= orderbook.ledger.index accumulator['ledgers'].append(ldg) for offer in orderbook.offersA: uid = (offer['account'], offer['sequence']) if uid in accumulator['asks']: accumulator['asks'][uid]['end'] = ldg else: accumulator['asks'][uid] = { 'start': ldg, 'end': ldg, 'offer': offer } for offer in orderbook.offersB: uid = (offer['account'], offer['sequence']) if uid in accumulator['bids']: accumulator['bids'][uid]['end'] = ldg else: accumulator['bids'][uid] = { 'start': ldg, 'end': ldg, 'offer': offer } return accumulator def _foldBooks(orderbooks): acc = None for orderbook in orderbooks: acc = _foldBook(acc, orderbook) return acc class Orderbook: def __init__(self, (c0, i0), (c1, i1), ldgA, offersA, ldbB, offersB, through=[]): self.c0= c0 self.i0= i0 self.c1= c1 self.i1= i1 self.offersA= offersA self.offersB= offersB self.spread= offersA[0]['rate']-offersB[0]['rate'] self.spread_pct= self.spread*100 / offersA[0]['rate'] self.ledger= ldgA self.through= through def weigtedAverageA(self, v): return _weigtedAverage(self.offersA, v) def weigtedAverageB(self, v): return _weigtedAverage(self.offersB, v) def info(self): return { 'currency': _currencyStr((self.c0, self.i0)), 'counter_currency': _currencyStr((self.c1, self.i1)), 'spread': self.spread, 'spread': self.spread_pct, 'best_ask': self.offersA[0]['rate'], 'n_asks': len(self.offersA), 'n_bids': len(self.offersB), 'best_bid': self.offersB[0]['rate'], 'through': self.through } def showInfo(self): print ('Orderbook %s%s in ledger %i' % (self.c0, self.c1, self.ledger.index)) print (' Close date: %s' % self.ledger.date_human) print (' Currency: XRP' if self.c0=='XRP' else ' Currency: %s@%s' % (self.c0, self.i0)) print (' Counter currency: XRP' if self.c1=='XRP' else ' Counter currency: %s@%s' % (self.c1, self.i1)) print (' Spread: %f (%f %%)' % (self.spread, self.spread_pct)) print (' Best ask/bid: %f / %f' % (self.offersA[0]['rate'], self.offersB[0]['rate'])) print ' Through: ', self.through def __mul__(self, other): assert self.c1 == other.c0 and self.i1 == other.i0, "Invalide trade" # Let's compute the new orderbook! def prudctOffers(o0, o1): offers = [] i0= 0 i1= 0 xlim= 0 o0limit= 0 o1limit= 0 while i1 < len(o1) and i0 < len(o0): if o0limit==0: o0rate= o0[i0]['rate'] o0limit= o0[i0]['limit'] i0+= 1 if o1limit==0: o1rate= o1[i1]['rate'] o1limit= o1[i1]['limit'] i1+= 1 delta = o0limit*o0rate-o1limit if delta<0: amt= o0limit*o1rate o0limit= 0 o1limit-= amt xlim+= amt offers.append({ 'rate': o0rate*o1rate, 'limit': amt, 'xlimit': xlim }) elif delta>0: amt= o1limit o1limit= 0 o0limit-= amt xlim+= amt offers.append({ 'rate': o0rate*o1rate, 'limit': amt, 'xlimit': xlim }) else: o0limit= 0 o1limit= 0 xlim+= o1limit offers.append({ 'rate': o0rate*o1rate, 'limit': o1limit, 'xlimit': xlim }) return offers through = list(self.through) through.append((self.c1, self.i1)) return Orderbook((self.c0, self.i0), (other.c1, other.i1), self.ledger, prudctOffers(self.offersA, other.offersA), other.ledger, prudctOffers(self.offersB, other.offersB), through) def plot(self, *args, **kwargs): fA = pd.DataFrame(self.offersA) fB = pd.DataFrame(self.offersB) newfig= kwargs.get('newfig', True) if newfig: plt.figure(num=None, figsize=(16, 12), dpi=80, facecolor='w', edgecolor='k'); axes = plt.gca(); plt.title('Order book for %s / %s at ledger %i' % (_currencyStr((self.c0, self.i0)), _currencyStr((self.c1, self.i1)), self.ledger.index)); plt.xlabel(_currencyStr((self.c1, self.i1))) plt.ylabel('%s%s' % (self.c0, self.c1)) plt.gca().xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(lambda x, p: format(int(x), ','))) if kwargs.get('orders', True): plt.hlines(fA['rate'], 0, fA['limit'], color='b', label= 'Asks') plt.plot(fA['limit'], fA['rate'], 'b^') plt.hlines(fB['rate'], 0, fB['limit'], color='r', label= 'Bids') plt.plot(fB['limit'], fB['rate'], 'r^') def supplyDemand(xlimits): x= [] y= [] limit= 0 for (r, l) in xlimits: x.append(r) x.append(r) y.append(limit) limit= l y.append(limit) return (x,y) if kwargs.get('supplydemand', True): (x, y)= supplyDemand(zip(fA['rate'], fA['xlimit'])) plt.plot(y, x, 'b--', label= 'Supply') (x, y)= supplyDemand(zip(fB['rate'], fB['xlimit'])) plt.plot(y, x, 'r--', label= 'Demand') if newfig: plt.legend() def plotWeighted(self, limit, *args, **kwargs): newfig= kwargs.get('newfig', True) if newfig: plt.figure(num=None, figsize=(16, 12), dpi=80, facecolor='w', edgecolor='k'); plt.xlabel('%s@%s' % (self.c1, self.i1)) plt.title('Rate (weigthed average) for %s / %s ledger %i' % (_currencyStr((self.c0, self.i0)), _currencyStr((self.c1, self.i1)), self.ledger.index)) plt.gca().xaxis.set_major_formatter(matplotlib.ticker.FuncFormatter(lambda x, p: format(int(x), ','))) x = np.arange(1, limit, limit / 1000 if limit > 1000 else 1) cask = kwargs.get('styleask', 'b') cbid = kwargs.get('stylebid', 'r') label = kwargs.get('label', 'Weighted avg') plt.plot(x, map(self.weigtedAverageA, x), cask, label= label + ' (ask)') plt.plot(x, map(self.weigtedAverageB, x), cbid, label= label + ' (bid)') if newfig: plt.legend() @staticmethod def plotTimeResolvedBook(orderbooks): ob0 = orderbooks[0] fold = _foldBooks(orderbooks) plt.figure(num=None, figsize=(16, 12), dpi=80, facecolor='w', edgecolor='k'); plt.hlines(map(lambda x: x['offer']['rate'], fold['asks'].values()), map(lambda x: x['start'], fold['asks'].values()), map(lambda x: x['end'], fold['asks'].values()), color ='b', label= 'asks' ) plt.hlines(map(lambda x: x['offer']['rate'], fold['bids'].values()), map(lambda x: x['start'], fold['bids'].values()), map(lambda x: x['end'], fold['bids'].values()), color ='r', label= 'bids' ) x = map(lambda ob: ob.ledger.index, orderbooks) plt.plot(x, map(lambda x: x.offersA[0]['rate'], orderbooks), 'b--') plt.plot(x, map(lambda x: x.offersB[0]['rate'], orderbooks), 'r--') axes = plt.gca() axes.get_xaxis().set_major_formatter(matplotlib.ticker.FuncFormatter(lambda x, p: format(int(x)))) axes.set_xlabel('Ripple ledger #') axes.set_ylabel('%s%s' % (ob0.c0, ob0.c1)) plt.title('Order books for %s / %s' % (_currencyStr((ob0.c0, ob0.i0)), _currencyStr((ob0.c1, ob0.i1)))); plt.legend()
37.20354
154
0.593958
6,412
0.762607
0
0
1,189
0.141413
0
0
1,846
0.219553
bcd61a8f67cde91f10cbb1a9264485fd9ef2e8b8
3,205
py
Python
myvenv/lib/python3.6/site-packages/nltk/test/unit/test_senna.py
catb0y/twitter_feeling
9092a26f2554bbf6b14b33d797abaffa48cda99c
[ "MIT" ]
69
2020-03-31T06:40:17.000Z
2022-02-25T11:48:18.000Z
myvenv/lib/python3.6/site-packages/nltk/test/unit/test_senna.py
catb0y/twitter_feeling
9092a26f2554bbf6b14b33d797abaffa48cda99c
[ "MIT" ]
11
2019-12-26T17:21:03.000Z
2022-03-21T22:17:07.000Z
myvenv/lib/python3.6/site-packages/nltk/test/unit/test_senna.py
catb0y/twitter_feeling
9092a26f2554bbf6b14b33d797abaffa48cda99c
[ "MIT" ]
28
2020-04-15T15:24:17.000Z
2021-12-26T04:05:02.000Z
# -*- coding: utf-8 -*- """ Unit tests for Senna """ from __future__ import unicode_literals from os import environ, path, sep import logging import unittest from nltk.classify import Senna from nltk.tag import SennaTagger, SennaChunkTagger, SennaNERTagger # Set Senna executable path for tests if it is not specified as an environment variable if 'SENNA' in environ: SENNA_EXECUTABLE_PATH = path.normpath(environ['SENNA']) + sep else: SENNA_EXECUTABLE_PATH = '/usr/share/senna-v3.0' senna_is_installed = path.exists(SENNA_EXECUTABLE_PATH) @unittest.skipUnless(senna_is_installed, "Requires Senna executable") class TestSennaPipeline(unittest.TestCase): """Unittest for nltk.classify.senna""" def test_senna_pipeline(self): """Senna pipeline interface""" pipeline = Senna(SENNA_EXECUTABLE_PATH, ['pos', 'chk', 'ner']) sent = 'Dusseldorf is an international business center'.split() result = [(token['word'], token['chk'], token['ner'], token['pos']) for token in pipeline.tag(sent)] expected = [('Dusseldorf', 'B-NP', 'B-LOC', 'NNP'), ('is', 'B-VP', 'O', 'VBZ'), ('an', 'B-NP', 'O', 'DT'), ('international', 'I-NP', 'O', 'JJ'), ('business', 'I-NP', 'O', 'NN'), ('center', 'I-NP', 'O', 'NN')] self.assertEqual(result, expected) @unittest.skipUnless(senna_is_installed, "Requires Senna executable") class TestSennaTagger(unittest.TestCase): """Unittest for nltk.tag.senna""" def test_senna_tagger(self): tagger = SennaTagger(SENNA_EXECUTABLE_PATH) result = tagger.tag('What is the airspeed of an unladen swallow ?'.split()) expected = [('What', 'WP'), ('is', 'VBZ'), ('the', 'DT'), ('airspeed', 'NN'),('of', 'IN'), ('an', 'DT'), ('unladen', 'NN'), ('swallow', 'NN'), ('?', '.')] self.assertEqual(result, expected) def test_senna_chunk_tagger(self): chktagger = SennaChunkTagger(SENNA_EXECUTABLE_PATH) result_1 = chktagger.tag('What is the airspeed of an unladen swallow ?'.split()) expected_1 = [('What', 'B-NP'), ('is', 'B-VP'), ('the', 'B-NP'), ('airspeed', 'I-NP'), ('of', 'B-PP'), ('an', 'B-NP'), ('unladen', 'I-NP'), ('swallow', 'I-NP'), ('?', 'O')] result_2 = list(chktagger.bio_to_chunks(result_1, chunk_type='NP')) expected_2 = [('What', '0'), ('the airspeed', '2-3'), ('an unladen swallow', '5-6-7')] self.assertEqual(result_1, expected_1) self.assertEqual(result_2, expected_2) def test_senna_ner_tagger(self): nertagger = SennaNERTagger(SENNA_EXECUTABLE_PATH) result_1 = nertagger.tag('Shakespeare theatre was in London .'.split()) expected_1 = [('Shakespeare', 'B-PER'), ('theatre', 'O'), ('was', 'O'), ('in', 'O'), ('London', 'B-LOC'), ('.', 'O')] result_2 = nertagger.tag('UN headquarters are in NY , USA .'.split()) expected_2 = [('UN', 'B-ORG'), ('headquarters', 'O'), ('are', 'O'), ('in', 'O'), ('NY', 'B-LOC'), (',', 'O'), ('USA', 'B-LOC'), ('.', 'O')] self.assertEqual(result_1, expected_1) self.assertEqual(result_2, expected_2)
42.733333
108
0.597504
2,508
0.782527
0
0
2,648
0.826209
0
0
1,115
0.347894
bcd716fdc72869755eef1e517937f6675edfef9d
8,191
py
Python
eoxserver/services/opensearch/v11/description.py
kalxas/eoxserver
8073447d926f3833923bde7b7061e8a1658dee06
[ "OML" ]
25
2015-08-10T19:34:34.000Z
2021-02-05T08:28:01.000Z
eoxserver/services/opensearch/v11/description.py
kalxas/eoxserver
8073447d926f3833923bde7b7061e8a1658dee06
[ "OML" ]
153
2015-01-20T08:35:49.000Z
2022-03-16T11:00:56.000Z
eoxserver/services/opensearch/v11/description.py
kalxas/eoxserver
8073447d926f3833923bde7b7061e8a1658dee06
[ "OML" ]
10
2015-01-23T15:48:30.000Z
2021-01-21T15:41:18.000Z
#------------------------------------------------------------------------------- # # Project: EOxServer <http://eoxserver.org> # Authors: Fabian Schindler <[email protected]> # #------------------------------------------------------------------------------- # Copyright (C) 2015 EOX IT Services GmbH # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell # copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in all # copies of this Software or works derived from this Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN # THE SOFTWARE. #------------------------------------------------------------------------------- from itertools import chain from lxml.builder import ElementMaker try: from django.core.urlresolvers import reverse except ImportError: from django.urls import reverse from django.shortcuts import get_object_or_404 from eoxserver.core.config import get_eoxserver_config from eoxserver.core.util.xmltools import ( XMLEncoder, NameSpace, NameSpaceMap ) from eoxserver.resources.coverages import models from eoxserver.services.opensearch.formats import get_formats from eoxserver.services.opensearch.extensions import get_extensions from eoxserver.services.opensearch.config import OpenSearchConfigReader class OpenSearch11DescriptionEncoder(XMLEncoder): content_type = "application/opensearchdescription+xml" def __init__(self, search_extensions): ns_os = NameSpace("http://a9.com/-/spec/opensearch/1.1/", None) self.ns_param = ns_param = NameSpace( "http://a9.com/-/spec/opensearch/extensions/parameters/1.0/", "parameters" ) ns_atom = NameSpace("http://www.w3.org/2005/Atom", "atom") nsmap = NameSpaceMap(ns_os, ns_param, ns_atom) for search_extension in search_extensions: nsmap.add(search_extension.namespace) self.OS = ElementMaker(namespace=ns_os.uri, nsmap=nsmap) self.PARAM = ElementMaker(namespace=ns_param.uri, nsmap=nsmap) self.ATOM = ElementMaker(namespace=ns_atom.uri, nsmap=nsmap) self.search_extensions = search_extensions def encode_description(self, request, collection, result_formats): """ Encode an OpenSearch 1.1 description document. """ OS = self.OS description = OS("OpenSearchDescription", OS("ShortName", collection.identifier if collection is not None else "" ), OS("Description") ) for method in ("GET", "POST"): description.extend([ self.encode_url( request, collection, result_format, method ) for result_format in result_formats ]) description.extend([ OS("Contact"), OS("Tags", "CEOS-OS-BP-V1.1/L1"), OS("LongName"), OS("Developer"), OS("Attribution"), OS("SyndicationRight", "open"), OS("AdultContent"), OS("Language"), OS("InputEncoding"), OS("OutputEncoding") ]) return description def encode_url(self, request, collection, result_format, method): """ Encode a single opensearch URL, either for a specific collection, or the whole service. """ if collection is not None: search_url = reverse("opensearch:collection:search", kwargs={ "collection_id": collection.identifier, "format_name": result_format.name } ) else: search_url = reverse("opensearch:search", kwargs={ "format_name": result_format.name } ) conf = OpenSearchConfigReader(get_eoxserver_config()) search_url = request.build_absolute_uri(search_url) default_parameters = ( dict(name="q", type="searchTerms", profiles=[ ]), dict(name="count", type="count", min=0, max=conf.max_count), dict(name="startIndex", type="startIndex", min=0), ) parameters = list(chain(default_parameters, *[ [ dict(parameter, **{"namespace": search_extension.namespace}) for parameter in search_extension.get_schema( collection, models.Collection if collection is None else models.Product ) ] for search_extension in self.search_extensions ])) query_template = "&".join( "%s={%s%s%s%s}" % ( parameter["name"], parameter["namespace"].prefix if "namespace" in parameter else "", ":" if "namespace" in parameter else "", parameter["type"], "?" if parameter.get("optional", True) else "" ) for parameter in parameters ) url = self.OS("Url", *[ self.encode_parameter(parameter, parameter.get("namespace")) for parameter in parameters ], type=result_format.mimetype, template="%s?%s" % (search_url, query_template) if method == "GET" else search_url, rel="results" if collection is not None else "collection", ** { self.ns_param("method"): method, self.ns_param("enctype"): "application/x-www-form-urlencoded", "indexOffset": "0" } ) return url def encode_parameter(self, parameter, namespace): options = parameter.pop("options", []) profiles = parameter.pop("profiles", []) attributes = {"name": parameter["name"]} if namespace: attributes["value"] = "{%s:%s}" % ( namespace.prefix, parameter.pop("type") ) else: attributes["value"] = "{%s}" % parameter.pop("type") if 'min' in parameter: attributes['minInclusive'] = str(parameter['min']) if 'max' in parameter: attributes['maxInclusive'] = str(parameter['max']) pattern = parameter.get("pattern") if pattern: attributes["pattern"] = pattern return self.PARAM("Parameter", *[ self.PARAM("Option", value=option, label=option) for option in options ] + [ self.ATOM("link", rel="profile", href=profile["href"], title=profile["title"] ) for profile in profiles ], minimum="0" if parameter.get("optional", True) else "1", maximum="1", **attributes ) class OpenSearch11DescriptionHandler(object): def handle(self, request, collection_id=None): collection = None if collection_id: collection = get_object_or_404(models.Collection, identifier=collection_id ) encoder = OpenSearch11DescriptionEncoder([ extension() for extension in get_extensions() ]) return ( encoder.serialize( encoder.encode_description( request, collection, [format_() for format_ in get_formats()] ) ), encoder.content_type )
37.746544
81
0.580393
6,110
0.745941
0
0
0
0
0
0
2,561
0.31266
bcd88cb9aee8377371dcb96cf615ef4e2ec10580
4,113
py
Python
exercises/level_0/stringing.py
eliranM98/python_course
d9431dd6c0f27fca8ca052cc2a821ed0b883136c
[ "MIT" ]
6
2019-03-29T06:14:53.000Z
2021-10-15T23:42:36.000Z
exercises/level_0/stringing.py
eliranM98/python_course
d9431dd6c0f27fca8ca052cc2a821ed0b883136c
[ "MIT" ]
4
2019-09-06T10:03:40.000Z
2022-03-11T23:30:55.000Z
exercises/level_0/stringing.py
eliranM98/python_course
d9431dd6c0f27fca8ca052cc2a821ed0b883136c
[ "MIT" ]
12
2019-06-20T19:34:52.000Z
2021-10-15T23:42:39.000Z
text = ''' Victor Hugo's ({}) tale of injustice, heroism and love follows the fortunes of Jean Valjean, an escaped convict determined to put his criminal past behind him. But his attempts to become a respected member of the community are constantly put under threat: by his own conscience, when, owing to a case of mistaken identity, another man is arrested in his place; and by the relentless investigations of the dogged Inspector Javert. It is not simply for himself that Valjean must stay free, however, for he has sworn to protect the baby daughter of Fantine, driven to prostitution by poverty. Norman Denny's ({}) lively English translation is accompanied by an introduction discussing Hugo's political and artistic aims in writing Les Miserables. Victor Hugo (1802-85) wrote volumes of criticism, dramas, satirical verse and political journalism but is best remembered for his novels, especially Notre-Dame de Paris (also known as The Hunchback of Notre-Dame) and Les Miserables, which was adapted into one of the most successful musicals of all time. 'All human life is here' Cameron Mackintosh, producer of the musical Les Miserables 'One of the half-dozen greatest novels of the world' Upton Sinclair 'A great writer - inventive, witty, sly, innovatory' A. S. Byatt, author of Possession ''' name = 'Victor' word1 = 'writer' word2 = 'witty' numbers = "0123456789" small_letters = 'abcdefghijklmnopqrstuvwxyz' big_letters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' name_index = text.find(name) name_plus3 = text[name_index: name_index+len(name)+3] word1_index = text.find(word1, 0, 100) word2_index = text.find(word2, int(len(text)/2), len(text)) count_characters = text.count('of') is_text_starts_with_name = text.startswith(name) is_text_ends_with_name = text.endswith(name) text = text.format('1822-95', '1807-63') words = text.split(' ') text1 = ''.join(words) text2 = ','.join(words) text3 = '_'.join(words) text4 = ' '.join(words) text5 = text.replace('of', '@🐔') text6 = text.capitalize() text7 = text.replace('a', '') text8 = text.strip() upper_name = name.upper() lower_name = name.lower() is_name_upper = name.isupper() is_name_lower = name.islower() is_big_letters_upper = big_letters.isupper() is_small_letters_lower = small_letters.islower() stringed_integer = '90'.isnumeric() stringed_float = '90.5'.isnumeric() converted_int = int('90') converted_float = float('90.5') converted_string = str(183) is_digit = converted_string[1].isdigit() edges = small_letters[0] + big_letters[-1] body = numbers[1:-1] evens = numbers[::2] odds = numbers[1::2] print('name', name) print('word1', word1) print('word2', word2) print('numbers', numbers) print('small_letters', small_letters) print('big_letters', big_letters) print('name_index', name_index) print('name_plus3', name_plus3) print('word1_index', word1_index) print('word2_index', word2_index) print('count_characters -> \'of\' in the text', count_characters) print('is_text_starts_with_name', is_text_starts_with_name) print('is_text_ends_with_name', is_text_ends_with_name) print('\n\n\n\n\n', 'text', text, '\n\n\n\n\n') print('\n\n\n\n\n', 'words', words, '\n\n\n\n\n') print('\n\n\n\n\n', 'text1', text1, '\n\n\n\n\n') print('\n\n\n\n\n', 'text2', text2, '\n\n\n\n\n') print('\n\n\n\n\n', 'text3', text3, '\n\n\n\n\n') print('\n\n\n\n\n', 'text4', text4, '\n\n\n\n\n') print('\n\n\n\n\n', 'text5', text5, '\n\n\n\n\n') print('\n\n\n\n\n', 'text6', text6, '\n\n\n\n\n') print('\n\n\n\n\n', 'text7', text7, '\n\n\n\n\n') print('\n\n\n\n\n', 'text8', text8, '\n\n\n\n\n') print('upper_name', upper_name) print('lower_name', lower_name) print('is_name_upper', is_name_upper) print('is_name_lower', is_name_lower) print('is_big_letters_upper', is_big_letters_upper) print('is_small_letters_lower', is_small_letters_lower) print('stringed_integer', stringed_integer) print('stringed_float', stringed_float) print('converted_int', converted_int) print('converted_float', converted_float) print('converted_string', converted_string) print('is_digit', is_digit) print('edges', edges) print('body', body) print('evens', evens) print('odds', odds)
41.545455
590
0.735959
0
0
0
0
0
0
0
0
2,193
0.532799
bcda0fb17ff31d81f09ba63207547e8568fa2ae6
2,085
py
Python
lab1/text_recognizer/models/mlp.py
Agyey/fsdl-text-recognizer-2021-labs
4bd85042ab9f6decd78849bb655c197cc13ffc11
[ "MIT" ]
null
null
null
lab1/text_recognizer/models/mlp.py
Agyey/fsdl-text-recognizer-2021-labs
4bd85042ab9f6decd78849bb655c197cc13ffc11
[ "MIT" ]
null
null
null
lab1/text_recognizer/models/mlp.py
Agyey/fsdl-text-recognizer-2021-labs
4bd85042ab9f6decd78849bb655c197cc13ffc11
[ "MIT" ]
null
null
null
from typing import Any, Dict import argparse import numpy as np import torch import torch.nn as nn import torch.nn.functional as F FC1_DIM = 1024 FC2_DIM = 128 class MLP(nn.Module): """Simple MLP suitable for recognizing single characters.""" def __init__( self, data_config: Dict[str, Any], args: argparse.Namespace = None, ) -> None: super().__init__() self.args = vars(args) if args is not None else {} input_dim = np.prod(data_config["input_dims"]) num_classes = len(data_config["mapping"]) self.dropout = nn.Dropout(0.5) layers = self.args.get("layers", FC1_DIM) self.layers = layers if layers: fcn = (int(FC1_DIM - x * ((FC1_DIM - FC2_DIM)//(layers-1))) for x in range(layers)) fcl = input_dim fcv = [] for fci in fcn: fcv.append(nn.Linear(fcl, fci)) fcl = fci fcv.append(nn.Linear(fcl, num_classes)) self.fcv = nn.Sequential(*fcv) else: fc1_dim = self.args.get("fc1", FC1_DIM) fc2_dim = self.args.get("fc2", FC2_DIM) self.fc1 = nn.Linear(input_dim, fc1_dim) self.fc2 = nn.Linear(fc1_dim, fc2_dim) self.fc3 = nn.Linear(fc2_dim, num_classes) def forward(self, x): x = torch.flatten(x, 1) if self.layers: for fci in self.fcv[:-1]: x = fci(x) x = F.relu(x) x = self.dropout(x) x = self.fcv[-1](x) else: x = self.fc1(x) x = F.relu(x) x = self.dropout(x) x = self.fc2(x) x = F.relu(x) x = self.dropout(x) x = self.fc3(x) return x @staticmethod def add_to_argparse(parser): parser.add_argument("--layers", type=int, default=None, choices=range(2, 20)) parser.add_argument("--fc1", type=int, default=1024) parser.add_argument("--fc2", type=int, default=128) return parser
29.366197
95
0.533813
1,920
0.920863
0
0
275
0.131894
0
0
123
0.058993
bcda1861cc6349c05142c05367f155b32d44ad1c
979
py
Python
frontend/widgets/button.py
AzoeDesarrollos/PyMavisDatabase
bfcd0557f63a4d8a73f0f8e891c47b47a1de1b45
[ "MIT" ]
null
null
null
frontend/widgets/button.py
AzoeDesarrollos/PyMavisDatabase
bfcd0557f63a4d8a73f0f8e891c47b47a1de1b45
[ "MIT" ]
2
2019-10-05T14:20:11.000Z
2019-10-05T14:22:31.000Z
frontend/widgets/button.py
AzoeDesarrollos/PyMavisDatabase
bfcd0557f63a4d8a73f0f8e891c47b47a1de1b45
[ "MIT" ]
null
null
null
from pygame import Surface, font from .basewidget import BaseWidget from frontend import Renderer, WidgetHandler class Button(BaseWidget): action = None def __init__(self, x, y, texto, action=None): self.f = font.SysFont('Verdana', 16) imagen = self.crear(texto) rect = imagen.get_rect(topleft=(x, y)) super().__init__(imagen, rect) Renderer.add_widget(self, 1) WidgetHandler.add_widget(self, 1) self.action = action def crear(self, texto): w, h = self.f.size(texto) image = Surface((w + 4, h + 2)) image.fill((125, 125, 125), (1, 1, w+2, h)) render = self.f.render(texto, 1, (255, 255, 255), (125, 125, 125)) image.blit(render, (2, 1)) return image def on_mousebuttondown(self, button): if button == 1 and self.action is not None: self.action() def on_mouseover(self): pass def update(self): self.dirty = 1
27.971429
74
0.592441
863
0.881512
0
0
0
0
0
0
9
0.009193
bcda32ab85ecef62e60d41fc5f944271b774ca47
709
py
Python
tensorflow_rnn/mnist_lstm.py
naoki009/samples
dac3bbddbd06374c39768cbe17fefd0110fe316f
[ "BSD-2-Clause" ]
null
null
null
tensorflow_rnn/mnist_lstm.py
naoki009/samples
dac3bbddbd06374c39768cbe17fefd0110fe316f
[ "BSD-2-Clause" ]
null
null
null
tensorflow_rnn/mnist_lstm.py
naoki009/samples
dac3bbddbd06374c39768cbe17fefd0110fe316f
[ "BSD-2-Clause" ]
1
2020-08-14T11:44:42.000Z
2020-08-14T11:44:42.000Z
import numpy as np import tensorflow as tf """ Do an MNIST classification line by line by LSTM """ (x_train, y_train), \ (x_test, y_test) = tf.keras.datasets.mnist.load_data() x_train, x_test = x_train/255.0, x_test/255.0 model = tf.keras.Sequential() model.add(tf.keras.layers.LSTM(128, input_shape=(None, 28))) #model.add(tf.keras.layers.BatchNormalization()) model.add(tf.keras.layers.Dense(10)) model.add(tf.keras.layers.Activation("softmax")) model.summary() model.compile(loss=tf.keras.losses.SparseCategoricalCrossentropy(), optimizer="sgd", metrics=["accuracy"]) model.fit(x_train, y_train, validation_data=(x_test, y_test), batch_size=100, epochs=100)
27.269231
67
0.70945
0
0
0
0
0
0
0
0
127
0.179126
bcdd9f6e351b12352ead172914df612d99371de2
984
py
Python
scrap/CloudCoverUndersampling.py
cseale/kaggle-amazon-rainforests
cf42941bb3c70ba19257764b66fe33550be88e0b
[ "Apache-2.0" ]
null
null
null
scrap/CloudCoverUndersampling.py
cseale/kaggle-amazon-rainforests
cf42941bb3c70ba19257764b66fe33550be88e0b
[ "Apache-2.0" ]
null
null
null
scrap/CloudCoverUndersampling.py
cseale/kaggle-amazon-rainforests
cf42941bb3c70ba19257764b66fe33550be88e0b
[ "Apache-2.0" ]
null
null
null
# coding: utf-8 # In[1]: import numpy as np import pandas as pd import os from random import shuffle from tqdm import tqdm DATA_DIR = '../input/amazon/' TRAIN_TIF_DIR = DATA_DIR + 'train-tif/' TRAIN_CSV = DATA_DIR + 'train.csv' TEST_TIF_DIR = DATA_DIR + 'test-tif/' IMG_SIZE = 100 LR = 1e-3 MODEL_NAME = 'amazon=-{}-{}.model'.format(LR, '2conv-basic') CLOUD_COVER_LABELS = [ 'clear', 'cloudy', 'haze', 'partly_cloudy'] # read our data and take a look at what we are dealing with train_csv = pd.read_csv(TRAIN_CSV) train_csv.head() tags = pd.DataFrame() for label in CLOUD_COVER_LABELS: tags[label] = train_csv.tags.apply(lambda x: np.where(label in x, 1, 0)) train_csv = pd.concat([train_csv, tags], axis=1) # In[17]: pd.concat([train_csv[train_csv.clear == 1].sample(n=7251), train_csv[train_csv.cloudy == 1].sample(n=7251), train_csv[train_csv.haze == 1], train_csv[train_csv.partly_cloudy == 1].sample(n=7251)], axis=0, ignore_index=True)
20.93617
83
0.690041
0
0
0
0
0
0
0
0
213
0.216463
bcddbefe85e0c400583bdfd288157408fcf8f518
11,271
py
Python
rpython/translator/platform/posix.py
wdv4758h/mu-client-pypy
d2fcc01f0b4fe3ffa232762124e3e6d38ed3a0cf
[ "Apache-2.0", "OpenSSL" ]
null
null
null
rpython/translator/platform/posix.py
wdv4758h/mu-client-pypy
d2fcc01f0b4fe3ffa232762124e3e6d38ed3a0cf
[ "Apache-2.0", "OpenSSL" ]
null
null
null
rpython/translator/platform/posix.py
wdv4758h/mu-client-pypy
d2fcc01f0b4fe3ffa232762124e3e6d38ed3a0cf
[ "Apache-2.0", "OpenSSL" ]
null
null
null
"""Base support for POSIX-like platforms.""" import py, os, sys from rpython.translator.platform import Platform, log, _run_subprocess import rpython rpydir = str(py.path.local(rpython.__file__).join('..')) class BasePosix(Platform): exe_ext = '' make_cmd = 'make' relevant_environ = ('CPATH', 'LIBRARY_PATH', 'C_INCLUDE_PATH') DEFAULT_CC = 'gcc' rpath_flags = ['-Wl,-rpath=\'$$ORIGIN/\''] def __init__(self, cc=None): self.cc = cc or os.environ.get('CC', self.DEFAULT_CC) def _libs(self, libraries): return ['-l%s' % lib for lib in libraries] def _libdirs(self, library_dirs): assert '' not in library_dirs return ['-L%s' % ldir for ldir in library_dirs] def _includedirs(self, include_dirs): assert '' not in include_dirs return ['-I%s' % idir for idir in include_dirs] def _linkfiles(self, link_files): return list(link_files) def _compile_c_file(self, cc, cfile, compile_args): oname = self._make_o_file(cfile, ext='o') args = ['-c'] + compile_args + [str(cfile), '-o', str(oname)] self._execute_c_compiler(cc, args, oname, cwd=str(cfile.dirpath())) return oname def _link_args_from_eci(self, eci, standalone): return Platform._link_args_from_eci(self, eci, standalone) def _exportsymbols_link_flags(self): if (self.cc == 'mingw32' or (self.cc== 'gcc' and os.name=='nt') or sys.platform == 'cygwin'): return ["-Wl,--export-all-symbols"] return ["-Wl,--export-dynamic"] def _link(self, cc, ofiles, link_args, standalone, exe_name): args = [str(ofile) for ofile in ofiles] + link_args args += ['-o', str(exe_name)] if not standalone: args = self._args_for_shared(args) self._execute_c_compiler(cc, args, exe_name, cwd=str(exe_name.dirpath())) return exe_name def _pkg_config(self, lib, opt, default, check_result_dir=False): try: ret, out, err = _run_subprocess("pkg-config", [lib, opt]) except OSError, e: err = str(e) ret = 1 if ret: result = default else: # strip compiler flags result = [entry[2:] for entry in out.split()] # if not result: pass # if pkg-config explicitly returned nothing, then # we assume it means no options are needed elif check_result_dir: # check that at least one of the results is a valid dir for check in result: if os.path.isdir(check): break else: if ret: msg = ("running 'pkg-config %s %s' failed:\n%s\n" "and the default %r is not a valid directory" % ( lib, opt, err.rstrip(), default)) else: msg = ("'pkg-config %s %s' returned no valid directory:\n" "%s\n%s" % (lib, opt, out.rstrip(), err.rstrip())) raise ValueError(msg) return result def get_rpath_flags(self, rel_libdirs): # needed for cross-compilation i.e. ARM return self.rpath_flags + ['-Wl,-rpath-link=\'%s\'' % ldir for ldir in rel_libdirs] def get_shared_only_compile_flags(self): return tuple(self.shared_only) + ('-fvisibility=hidden',) def gen_makefile(self, cfiles, eci, exe_name=None, path=None, shared=False, headers_to_precompile=[], no_precompile_cfiles = [], icon=None): cfiles = self._all_cfiles(cfiles, eci) if path is None: path = cfiles[0].dirpath() rpypath = py.path.local(rpydir) if exe_name is None: exe_name = cfiles[0].new(ext=self.exe_ext) else: exe_name = exe_name.new(ext=self.exe_ext) linkflags = list(self.link_flags) if shared: linkflags = self._args_for_shared(linkflags) linkflags += self._exportsymbols_link_flags() if shared: libname = exe_name.new(ext='').basename target_name = 'lib' + exe_name.new(ext=self.so_ext).basename else: target_name = exe_name.basename if shared: cflags = tuple(self.cflags) + self.get_shared_only_compile_flags() else: cflags = tuple(self.cflags) + tuple(self.standalone_only) m = GnuMakefile(path) m.exe_name = path.join(exe_name.basename) m.eci = eci def rpyrel(fpath): lpath = py.path.local(fpath) rel = lpath.relto(rpypath) if rel: return os.path.join('$(RPYDIR)', rel) # Hack: also relativize from the path '$RPYDIR/..'. # Otherwise, when translating pypy, we get the paths in # pypy/module/* that are kept as absolute, which makes the # whole purpose of $RPYDIR rather pointless. rel = lpath.relto(rpypath.join('..')) if rel: return os.path.join('$(RPYDIR)', '..', rel) m_dir = m.makefile_dir if m_dir == lpath: return '.' if m_dir.dirpath() == lpath: return '..' return fpath rel_cfiles = [m.pathrel(cfile) for cfile in cfiles] rel_ofiles = [rel_cfile[:rel_cfile.rfind('.')]+'.o' for rel_cfile in rel_cfiles] m.cfiles = rel_cfiles rel_includedirs = [rpyrel(incldir) for incldir in self.preprocess_include_dirs(eci.include_dirs)] rel_libdirs = [rpyrel(libdir) for libdir in self.preprocess_library_dirs(eci.library_dirs)] m.comment('automatically generated makefile') definitions = [ ('RPYDIR', '"%s"' % rpydir), ('TARGET', target_name), ('DEFAULT_TARGET', exe_name.basename), ('SOURCES', rel_cfiles), ('OBJECTS', rel_ofiles), ('LIBS', self._libs(eci.libraries) + list(self.extra_libs)), ('LIBDIRS', self._libdirs(rel_libdirs)), ('INCLUDEDIRS', self._includedirs(rel_includedirs)), ('CFLAGS', cflags), ('CFLAGSEXTRA', list(eci.compile_extra)), ('LDFLAGS', linkflags), ('LDFLAGS_LINK', list(self.link_flags)), ('LDFLAGSEXTRA', list(eci.link_extra)), ('CC', self.cc), ('CC_LINK', eci.use_cpp_linker and 'g++' or '$(CC)'), ('LINKFILES', eci.link_files), ('RPATH_FLAGS', self.get_rpath_flags(rel_libdirs)), ] for args in definitions: m.definition(*args) rules = [ ('all', '$(DEFAULT_TARGET)', []), ('$(TARGET)', '$(OBJECTS)', '$(CC_LINK) $(LDFLAGSEXTRA) -o $@ $(OBJECTS) $(LIBDIRS) $(LIBS) $(LINKFILES) $(LDFLAGS)'), ('%.o', '%.c', '$(CC) $(CFLAGS) $(CFLAGSEXTRA) -o $@ -c $< $(INCLUDEDIRS)'), ('%.o', '%.s', '$(CC) $(CFLAGS) $(CFLAGSEXTRA) -o $@ -c $< $(INCLUDEDIRS)'), ('%.o', '%.cxx', '$(CXX) $(CFLAGS) $(CFLAGSEXTRA) -o $@ -c $< $(INCLUDEDIRS)'), ] for rule in rules: m.rule(*rule) if shared: m.definition('SHARED_IMPORT_LIB', libname), m.definition('PYPY_MAIN_FUNCTION', "pypy_main_startup") m.rule('main.c', '', 'echo "' 'int $(PYPY_MAIN_FUNCTION)(int, char*[]); ' 'int main(int argc, char* argv[]) ' '{ return $(PYPY_MAIN_FUNCTION)(argc, argv); }" > $@') m.rule('$(DEFAULT_TARGET)', ['$(TARGET)', 'main.o'], '$(CC_LINK) $(LDFLAGS_LINK) main.o -L. -l$(SHARED_IMPORT_LIB) -o $@ $(RPATH_FLAGS)') return m def execute_makefile(self, path_to_makefile, extra_opts=[]): if isinstance(path_to_makefile, GnuMakefile): path = path_to_makefile.makefile_dir else: path = path_to_makefile log.execute('make %s in %s' % (" ".join(extra_opts), path)) returncode, stdout, stderr = _run_subprocess( self.make_cmd, ['-C', str(path)] + extra_opts) self._handle_error(returncode, stdout, stderr, path.join('make')) class Definition(object): def __init__(self, name, value): self.name = name self.value = value def write(self, f): def write_list(prefix, lst): lst = lst or [''] for i, fn in enumerate(lst): fn = fn.replace('\\', '\\\\') print >> f, prefix, fn, if i < len(lst)-1: print >> f, '\\' else: print >> f prefix = ' ' * len(prefix) name, value = self.name, self.value if isinstance(value, str): f.write('%s = %s\n' % (name, value.replace('\\', '\\\\'))) else: write_list('%s =' % (name,), value) f.write('\n') class Rule(object): def __init__(self, target, deps, body): self.target = target self.deps = deps self.body = body def write(self, f): target, deps, body = self.target, self.deps, self.body if isinstance(deps, str): dep_s = deps else: dep_s = ' '.join(deps) f.write('%s: %s\n' % (target, dep_s)) if isinstance(body, str): f.write('\t%s\n' % body) elif body: f.write('\t%s\n' % '\n\t'.join(body)) f.write('\n') class Comment(object): def __init__(self, body): self.body = body def write(self, f): f.write('# %s\n' % (self.body,)) class GnuMakefile(object): def __init__(self, path=None): self.defs = {} self.lines = [] self.makefile_dir = py.path.local(path) def pathrel(self, fpath): if fpath.dirpath() == self.makefile_dir: return fpath.basename elif fpath.dirpath().dirpath() == self.makefile_dir.dirpath(): assert fpath.relto(self.makefile_dir.dirpath()), ( "%r should be relative to %r" % ( fpath, self.makefile_dir.dirpath())) path = '../' + fpath.relto(self.makefile_dir.dirpath()) return path.replace('\\', '/') else: return str(fpath) def definition(self, name, value): defs = self.defs defn = Definition(name, value) if name in defs: self.lines[defs[name]] = defn else: defs[name] = len(self.lines) self.lines.append(defn) def rule(self, target, deps, body): self.lines.append(Rule(target, deps, body)) def comment(self, body): self.lines.append(Comment(body)) def write(self, out=None): if out is None: f = self.makefile_dir.join('Makefile').open('w') else: f = out for line in self.lines: line.write(f) f.flush() if out is None: f.close()
36.009585
130
0.53021
11,051
0.980481
0
0
0
0
0
0
1,986
0.176204
bcde4233b8d9a36e066c7f656e904c7a4e46422b
3,247
py
Python
chintai-scrape/A001_parse_htmls.py
GINK03/itmedia-scraping
5afbe06dd0aa12db1694a2b387aa2eeafb20e981
[ "MIT" ]
16
2018-02-06T14:43:41.000Z
2021-01-23T05:07:33.000Z
chintai-scrape/A001_parse_htmls.py
GINK03/itmedia-scraping
5afbe06dd0aa12db1694a2b387aa2eeafb20e981
[ "MIT" ]
null
null
null
chintai-scrape/A001_parse_htmls.py
GINK03/itmedia-scraping
5afbe06dd0aa12db1694a2b387aa2eeafb20e981
[ "MIT" ]
4
2018-01-16T13:50:43.000Z
2019-12-16T19:45:54.000Z
import glob import bs4 import gzip import pickle import re import os from concurrent.futures import ProcessPoolExecutor as PPE import json from pathlib import Path from hashlib import sha256 import shutil Path('json').mkdir(exist_ok=True) def sanitize(text): text = re.sub(r'(\t|\n|\r)', '', text) text = re.sub(r'\xa0', '', text) text = re.sub(r'\\r', '', text) text = re.sub('地図で物件の周辺環境をチェック!', '', text) return text def is_train(x): if '線' in x: return False else: return True def pmap(arg): key, fns = arg SIZE = len(fns) for index, fn in enumerate(fns): try: print('now', key,index, 'size', SIZE, fn) html = gzip.decompress(open(fn, 'rb').read()) soup = bs4.BeautifulSoup(html, 'lxml') if soup.find('link', {'rel':'canonical'}) is None: Path(fn).unlink() continue canonical = soup.find('link', {'rel':'canonical'})['href'] if '/detail/' not in canonical: Path(fn).unlink() continue basic_table = soup.find('div', {'class':'detail_basicInfo'}) if basic_table is None: Path(fn).unlink() continue basic_table = basic_table.find('table') # ズレの処理 tds = list(basic_table.find_all('td')) tds.pop(0) #print(tds.pop(0).text) tds = [td for td in tds if is_train(td)] print(len(basic_table.find_all('th')), len(tds)) if len(basic_table.find_all('th')) == 13 and len(tds) == 14: tds.pop(4) ... basic_obj = {sanitize(th.text):sanitize(td.text) for th, td in zip(basic_table.find_all('th'),tds)} detail_obj = {} for table in soup.find('div', {'class':'detail_specTable'}).find_all('table'): #print(table) for th, td in zip(table.find_all('th'), table.find_all('td')): detail_obj[sanitize(th.text)] = sanitize(td.text) obj = {'basic':basic_obj, 'detail':detail_obj, 'canonical':canonical, 'title':soup.title.text} last_fn = fn.split('/')[-1] shutil.move(fn, f'parsed_htmls/{last_fn}' ) with open(f'json/{last_fn}', 'w') as fp: fp.write(json.dumps(obj, indent=2, ensure_ascii=False)) except Exception as ex: #Path(fn).unlink() print(ex) #detail_table = soup.find('table', {'class':'bukken_detail_table'}) #detail_obj = {re.sub(r'\t', '', th.text):re.sub(r'(\t|\n)', '', td.text) for th, td in zip(detail_table.find_all('th'), detail_table.find_all('td'))} #print(detail_obj) #urls = [sha256(bytes(v, 'utf8')).hexdigest() for v in json.load(fp=open('./hash_url.json')).values()] #fns = [f'./htmls/{url}' for url in urls] import random files = glob.glob('./htmls/*') random.shuffle(files) args = {} for index, fn in enumerate(files): key = index%8 if args.get(key) is None: args[key] = [] args[key].append(fn) args = [(key,fns) for key,fns in args.items()] #[pmap(arg) for arg in args] with PPE(max_workers=8) as exe: exe.map(pmap, args)
36.077778
158
0.55559
0
0
0
0
0
0
0
0
843
0.256153
bcde81a6deec0252f40277dde895c56c9a4836eb
5,047
py
Python
google-datacatalog-apache-atlas-connector/src/google/datacatalog_connectors/apache_atlas/scrape/metadata_scraper.py
ricardolsmendes/datacatalog-connectors-hive
9e71588133c0b0227e789c8d6bb26cfa031d2cfb
[ "Apache-2.0" ]
19
2020-04-27T21:55:47.000Z
2022-03-22T19:45:14.000Z
google-datacatalog-apache-atlas-connector/src/google/datacatalog_connectors/apache_atlas/scrape/metadata_scraper.py
ricardolsmendes/datacatalog-connectors-hive
9e71588133c0b0227e789c8d6bb26cfa031d2cfb
[ "Apache-2.0" ]
12
2020-05-28T14:48:29.000Z
2022-01-15T17:52:09.000Z
google-datacatalog-apache-atlas-connector/src/google/datacatalog_connectors/apache_atlas/scrape/metadata_scraper.py
mesmacosta/datacatalog-connectors-hive
ab7e49fbef8599dd9053c2260b261ce01f510a47
[ "Apache-2.0" ]
15
2020-05-03T17:25:51.000Z
2022-01-11T22:10:35.000Z
#!/usr/bin/python # # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import logging from google.datacatalog_connectors.apache_atlas import scrape class MetadataScraper: def __init__(self, connection_args): self._apache_atlas_facade = scrape.apache_atlas_facade.\ ApacheAtlasFacade(connection_args) self.__metadata_enricher = scrape.metadata_enricher.\ MetadataEnricher(self._apache_atlas_facade) def get_metadata(self, **kwargs): self._log_scrape_start('Scraping all Metadata...') classifications_dict = {} entity_types_dict = {} enum_types_dict = {} self._log_scrape_start('Scraping admin metrics...') admin_metrics = self._apache_atlas_facade.get_admin_metrics() logging.info(admin_metrics) self._log_single_object_scrape_result(admin_metrics) self._log_scrape_start('Scraping typedefs...') for typedef in self._apache_atlas_facade.get_typedefs(): self._scrape_classification_types(classifications_dict, typedef) self._scrape_enum_types(enum_types_dict, typedef) self._scrape_entity_types(entity_types_dict, typedef) self.__metadata_enricher.enrich_entity_relationships(entity_types_dict) return { 'classifications': classifications_dict, 'enum_types': enum_types_dict, 'entity_types': entity_types_dict }, None def _scrape_entity_types(self, entity_types_dict, typedef): self._log_scrape_start('Scraping EntityTypes...') for entity_type in typedef.entityDefs: entity_type_name = entity_type.name entity_type_dict = { 'name': entity_type_name, 'data': entity_type._data, 'superTypes': entity_type.superTypes, 'entities': {} } entities = self.__scrape_entity_type(entity_type) entity_type_dict['entities'] = entities entity_types_dict[entity_type_name] = entity_type_dict def _scrape_classification_types(self, classifications_dict, typedef): self._log_scrape_start('Scraping Classifications/Templates...') for classification_type in typedef.classificationDefs: classification_data = classification_type._data logging.info('Classification: %s', classification_type.name) logging.debug(classification_data) classifications_dict[classification_type.name] = { 'name': classification_type.name, 'guid': classification_type.guid, 'data': classification_data } def _scrape_enum_types(self, enum_types_dict, typedef): self._log_scrape_start('Scraping Enum types...') for enum_type in typedef.enumDefs: enum_data = enum_type._data logging.info('Enum type: %s', enum_type.name) logging.debug(enum_data) enum_types_dict[enum_type.name] = { 'name': enum_type.name, 'guid': enum_type.guid, 'data': enum_data } def __scrape_entity_type(self, entity_type): searched_entries = {} entity_type_name = entity_type.name logging.info('=> Entity Type: %s', entity_type_name) logging.debug(entity_type._data) search_results = self._apache_atlas_facade.\ search_entities_from_entity_type(entity_type_name) guids = [] for entity in search_results: # Collecting guids and storing entity to enricher data later on. guid = entity.guid guids.append(guid) searched_entries[guid] = {'guid': guid, 'data': entity._data} fetched_entities_dict = {} if guids: fetched_entities_dict = self._apache_atlas_facade.fetch_entities( guids) self.__metadata_enricher.enrich_entity_classifications( fetched_entities_dict, searched_entries) logging.info('Entity Type: %s scrapped!', entity_type_name) logging.info('') return fetched_entities_dict @classmethod def _log_scrape_start(cls, message, *args): logging.info('') logging.info(message, *args) logging.info('-------------------------------------------------') @classmethod def _log_single_object_scrape_result(cls, the_object): logging.info('Found!' if the_object else 'NOT found!')
37.385185
79
0.656628
4,370
0.865861
0
0
330
0.065385
0
0
1,099
0.217753
bcded4531d60ca947d6fb59affac50e25540dcfc
7,490
py
Python
aviary/roost/data.py
sxie22/aviary
74b87eee86067f69af6e5b86bd12fca2202c4de5
[ "MIT" ]
null
null
null
aviary/roost/data.py
sxie22/aviary
74b87eee86067f69af6e5b86bd12fca2202c4de5
[ "MIT" ]
null
null
null
aviary/roost/data.py
sxie22/aviary
74b87eee86067f69af6e5b86bd12fca2202c4de5
[ "MIT" ]
null
null
null
import functools import json from os.path import abspath, dirname, exists, join from typing import Dict, Sequence import numpy as np import pandas as pd import torch from pymatgen.core import Composition from torch.utils.data import Dataset class CompositionData(Dataset): def __init__( self, df: pd.DataFrame, task_dict: Dict[str, str], elem_emb: str = "matscholar200", inputs: Sequence[str] = ["composition"], identifiers: Sequence[str] = ["material_id", "composition"], ): """Data class for Roost models. Args: df (pd.DataFrame): Pandas dataframe holding input and target values. task_dict (dict[str, "regression" | "classification"]): Map from target names to task type. elem_emb (str, optional): One of "matscholar200", "cgcnn92", "megnet16", "onehot112" or path to a file with custom embeddings. Defaults to "matscholar200". inputs (list[str], optional): df column name holding material compositions. Defaults to ["composition"]. identifiers (list, optional): df columns for distinguishing data points. Will be copied over into the model's output CSV. Defaults to ["material_id", "composition"]. """ assert len(identifiers) == 2, "Two identifiers are required" assert len(inputs) == 1, "One input column required are required" self.inputs = inputs self.task_dict = task_dict self.identifiers = identifiers self.df = df if elem_emb in ["matscholar200", "cgcnn92", "megnet16", "onehot112"]: elem_emb = join( dirname(abspath(__file__)), f"../embeddings/element/{elem_emb}.json" ) else: assert exists(elem_emb), f"{elem_emb} does not exist!" with open(elem_emb) as f: self.elem_features = json.load(f) self.elem_emb_len = len(list(self.elem_features.values())[0]) self.n_targets = [] for target, task in self.task_dict.items(): if task == "regression": self.n_targets.append(1) elif task == "classification": n_classes = np.max(self.df[target].values) + 1 self.n_targets.append(n_classes) def __len__(self): return len(self.df) @functools.lru_cache(maxsize=None) # Cache data for faster training def __getitem__(self, idx): """[summary] Args: idx (int): dataset index Raises: AssertionError: [description] ValueError: [description] Returns: atom_weights: torch.Tensor shape (M, 1) weights of atoms in the material atom_fea: torch.Tensor shape (M, n_fea) features of atoms in the material self_fea_idx: torch.Tensor shape (M*M, 1) list of self indices nbr_fea_idx: torch.Tensor shape (M*M, 1) list of neighbor indices target: torch.Tensor shape (1,) target value for material cry_id: torch.Tensor shape (1,) input id for the material """ df_idx = self.df.iloc[idx] composition = df_idx[self.inputs][0] cry_ids = df_idx[self.identifiers].values comp_dict = Composition(composition).get_el_amt_dict() elements = list(comp_dict.keys()) weights = list(comp_dict.values()) weights = np.atleast_2d(weights).T / np.sum(weights) try: atom_fea = np.vstack([self.elem_features[element] for element in elements]) except AssertionError: raise AssertionError( f"cry-id {cry_ids[0]} [{composition}] contains element types not in embedding" ) except ValueError: raise ValueError( f"cry-id {cry_ids[0]} [{composition}] composition cannot be parsed into elements" ) nele = len(elements) self_fea_idx = [] nbr_fea_idx = [] for i, _ in enumerate(elements): self_fea_idx += [i] * nele nbr_fea_idx += list(range(nele)) # convert all data to tensors atom_weights = torch.Tensor(weights) atom_fea = torch.Tensor(atom_fea) self_fea_idx = torch.LongTensor(self_fea_idx) nbr_fea_idx = torch.LongTensor(nbr_fea_idx) targets = [] for target in self.task_dict: if self.task_dict[target] == "regression": targets.append(torch.Tensor([df_idx[target]])) elif self.task_dict[target] == "classification": targets.append(torch.LongTensor([df_idx[target]])) return ( (atom_weights, atom_fea, self_fea_idx, nbr_fea_idx), targets, *cry_ids, ) def collate_batch(dataset_list): """ Collate a list of data and return a batch for predicting crystal properties. Parameters ---------- dataset_list: list of tuples for each data point. (atom_fea, nbr_fea, nbr_fea_idx, target) atom_fea: torch.Tensor shape (n_i, atom_fea_len) nbr_fea: torch.Tensor shape (n_i, M, nbr_fea_len) self_fea_idx: torch.LongTensor shape (n_i, M) nbr_fea_idx: torch.LongTensor shape (n_i, M) target: torch.Tensor shape (1, ) cif_id: str or int Returns ------- N = sum(n_i); N0 = sum(i) batch_atom_weights: torch.Tensor shape (N, 1) batch_atom_fea: torch.Tensor shape (N, orig_atom_fea_len) Atom features from atom type batch_self_fea_idx: torch.LongTensor shape (N, M) Indices of mapping atom to copies of itself batch_nbr_fea_idx: torch.LongTensor shape (N, M) Indices of M neighbors of each atom crystal_atom_idx: list of torch.LongTensor of length N0 Mapping from the crystal idx to atom idx target: torch.Tensor shape (N, 1) Target value for prediction batch_comps: list batch_ids: list """ # define the lists batch_atom_weights = [] batch_atom_fea = [] batch_self_fea_idx = [] batch_nbr_fea_idx = [] crystal_atom_idx = [] batch_targets = [] batch_cry_ids = [] cry_base_idx = 0 for i, (inputs, target, *cry_ids) in enumerate(dataset_list): atom_weights, atom_fea, self_fea_idx, nbr_fea_idx = inputs # number of atoms for this crystal n_i = atom_fea.shape[0] # batch the features together batch_atom_weights.append(atom_weights) batch_atom_fea.append(atom_fea) # mappings from bonds to atoms batch_self_fea_idx.append(self_fea_idx + cry_base_idx) batch_nbr_fea_idx.append(nbr_fea_idx + cry_base_idx) # mapping from atoms to crystals crystal_atom_idx.append(torch.tensor([i] * n_i)) # batch the targets and ids batch_targets.append(target) batch_cry_ids.append(cry_ids) # increment the id counter cry_base_idx += n_i return ( ( torch.cat(batch_atom_weights, dim=0), torch.cat(batch_atom_fea, dim=0), torch.cat(batch_self_fea_idx, dim=0), torch.cat(batch_nbr_fea_idx, dim=0), torch.cat(crystal_atom_idx), ), tuple(torch.stack(b_target, dim=0) for b_target in zip(*batch_targets)), *zip(*batch_cry_ids), )
33.738739
100
0.607076
4,677
0.624433
0
0
2,527
0.337383
0
0
3,373
0.450334
bcdf1f594847bcd658c78df9bc4bf018e0d729b0
201
py
Python
tests/test_util.py
danqing/dqpy
f296341adb0dbbfb361eaf8b815b0ffd189ebf58
[ "MIT" ]
null
null
null
tests/test_util.py
danqing/dqpy
f296341adb0dbbfb361eaf8b815b0ffd189ebf58
[ "MIT" ]
25
2018-05-22T15:59:37.000Z
2020-02-14T08:08:24.000Z
tests/test_util.py
danqing/dqpy
f296341adb0dbbfb361eaf8b815b0ffd189ebf58
[ "MIT" ]
null
null
null
import unittest from dq import util class TestUtil(unittest.TestCase): def test_safe_cast(self): assert util.safe_cast('1', int) == 1 assert util.safe_cast('meow', int, 2) == 2
18.272727
50
0.656716
161
0.800995
0
0
0
0
0
0
9
0.044776
bce0bfd9222f594d713d4743ed32c26bb4279c4c
1,483
py
Python
check_perm.py
codecakes/random_games
1e670021ec97a196726e937e658878dc63ba9d34
[ "MIT" ]
null
null
null
check_perm.py
codecakes/random_games
1e670021ec97a196726e937e658878dc63ba9d34
[ "MIT" ]
null
null
null
check_perm.py
codecakes/random_games
1e670021ec97a196726e937e658878dc63ba9d34
[ "MIT" ]
null
null
null
""" PermCheck Check whether array A is a permutation. https://codility.com/demo/results/demoANZ7M2-GFU/ Task description A non-empty zero-indexed array A consisting of N integers is given. A permutation is a sequence containing each element from 1 to N once, and only once. For example, array A such that: A[0] = 4 A[1] = 1 A[2] = 3 A[3] = 2 is a permutation, but array A such that: A[0] = 4 A[1] = 1 A[2] = 3 is not a permutation, because value 2 is missing. The goal is to check whether array A is a permutation. Write a function: def solution(A) that, given a zero-indexed array A, returns 1 if array A is a permutation and 0 if it is not. For example, given array A such that: A[0] = 4 A[1] = 1 A[2] = 3 A[3] = 2 the function should return 1. Given array A such that: A[0] = 4 A[1] = 1 A[2] = 3 the function should return 0. Assume that: N is an integer within the range [1..100,000]; each element of array A is an integer within the range [1..1,000,000,000]. Complexity: expected worst-case time complexity is O(N); expected worst-case space complexity is O(N), beyond input storage (not counting the storage required for input arguments). Elements of input arrays can be modified. """ def solution(A): # write your code in Python 2.7 s = set(A) N_set = len(s) #O(n) N = len(A) if N != N_set: return 0 sum_N = N*(N+1)/2 #O(1) sum_A = sum(A) #O(n) return 1 if sum_N == sum_A else 0
27.981132
123
0.662171
0
0
0
0
0
0
0
0
1,294
0.872556