blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
2
616
content_id
stringlengths
40
40
detected_licenses
listlengths
0
69
license_type
stringclasses
2 values
repo_name
stringlengths
5
118
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringlengths
4
63
visit_date
timestamp[us]
revision_date
timestamp[us]
committer_date
timestamp[us]
github_id
int64
2.91k
686M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
23 values
gha_event_created_at
timestamp[us]
gha_created_at
timestamp[us]
gha_language
stringclasses
220 values
src_encoding
stringclasses
30 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
2
10.3M
extension
stringclasses
257 values
content
stringlengths
2
10.3M
authors
listlengths
1
1
author_id
stringlengths
0
212
6773d987b4e6d1240b1d25b96c6c347757f0c940
5af277b5819d74e61374d1d78c303ac93c831cf5
/axial/worker_util.py
41709759a5ceb21a7f25e4f616ed343461d35111
[ "Apache-2.0" ]
permissive
Ayoob7/google-research
a2d215afb31513bd59bc989e09f54667fe45704e
727ec399ad17b4dd1f71ce69a26fc3b0371d9fa7
refs/heads/master
2022-11-11T03:10:53.216693
2020-06-26T17:13:45
2020-06-26T17:13:45
275,205,856
2
0
Apache-2.0
2020-06-26T16:58:19
2020-06-26T16:58:18
null
UTF-8
Python
false
false
8,610
py
# coding=utf-8 # Copyright 2020 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. """Training and eval worker utilities.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import os import time from . import logging_utils from absl import logging import numpy as np import tensorflow.compat.v1 as tf class BaseModel(object): def train_fn(self, x_bhwc): raise NotImplementedError def eval_fn(self, x_bhwc): raise NotImplementedError def samples_fn(self, x_bhwc): raise NotImplementedError @property def trainable_variables(self): raise NotImplementedError @property def ema(self): raise NotImplementedError def _make_ema_model(orig_model, model_constructor): # Model with EMA parameters if orig_model.ema is None: return None def _to_original_variable_name(name): # map to the original variable name parts = name.split('/') assert parts[0] == 'ema_scope' return '/'.join(parts[1:]) def _ema_getter(getter, name, *args, **kwargs): v = getter(_to_original_variable_name(name), *args, **kwargs) v = orig_model.ema.average(v) if v is None: raise RuntimeError('invalid EMA variable name {} -> {}'.format( name, _to_original_variable_name(name))) return v with tf.variable_scope( tf.get_variable_scope(), custom_getter=_ema_getter, reuse=True): with tf.name_scope('ema_scope'): return model_constructor() def run_eval( model_constructor, logdir, total_bs, master, input_fn, dataset_size): worker = EvalWorker( master=master, model_constructor=model_constructor, total_bs=total_bs, input_fn=input_fn) worker.run(logdir=logdir, once=True) class EvalWorker(object): def __init__(self, master, model_constructor, total_bs, input_fn): self.strategy = tf.distribute.MirroredStrategy() self.num_cores = self.strategy.num_replicas_in_sync assert total_bs % self.num_cores == 0 self.total_bs = total_bs self.local_bs = total_bs // self.num_cores logging.info('num cores: {}'.format(self.num_cores)) logging.info('total batch size: {}'.format(self.total_bs)) logging.info('local batch size: {}'.format(self.local_bs)) with self.strategy.scope(): # Dataset iterator dataset = input_fn(params={'batch_size': self.total_bs}) self.eval_iterator = self.strategy.experimental_distribute_dataset( dataset).make_initializable_iterator() eval_iterator_next = next(self.eval_iterator) # Model self.model = model_constructor() # Model with EMA parameters self.ema_model = _make_ema_model(self.model, model_constructor) # Global step self.global_step = tf.train.get_global_step() assert self.global_step is not None, 'global step not created' # Eval/samples graphs self.eval_outputs = self._distributed( self.model.eval_fn, args=(eval_iterator_next,), reduction='mean') self.samples_outputs = self._distributed( self.model.samples_fn, args=(eval_iterator_next,), reduction='concat') # EMA versions of the above if self.ema_model is not None: self.ema_eval_outputs = self._distributed( self.ema_model.eval_fn, args=(eval_iterator_next,), reduction='mean') self.ema_samples_outputs = self._distributed( self.ema_model.samples_fn, args=(eval_iterator_next,), reduction='concat') def _distributed(self, model_fn, args, reduction): """Sharded computation.""" def model_wrapper(inputs_): return model_fn(inputs_['image']) out = self.strategy.run(model_wrapper, args=args) assert isinstance(out, dict) if reduction == 'mean': out = { k: tf.reduce_mean(self.strategy.reduce('mean', v)) for k, v in out.items() } assert all(v.shape == [] for v in out.values()) # pylint: disable=g-explicit-bool-comparison elif reduction == 'concat': out = { k: tf.concat(self.strategy.experimental_local_results(v), axis=0) for k, v in out.items() } assert all(v.shape[0] == self.total_bs for v in out.values()) else: raise NotImplementedError(reduction) return out def _make_session(self): config = tf.ConfigProto() config.allow_soft_placement = True logging.info('making session...') return tf.Session(config=config) def _run_eval(self, sess, ema): logging.info('eval pass...') sess.run(self.eval_iterator.initializer) all_loss_lists = collections.defaultdict(list) run_times = [] try: while True: # Log progress if run_times and len(run_times) % 100 == 0: num_batches_seen = len(list(all_loss_lists.values())[0]) logging.info( 'eval examples_so_far={} time_per_batch={:.5f} {}'.format( num_batches_seen * self.total_bs, np.mean(run_times[1:]), {k: np.mean(l) for k, l in all_loss_lists.items()})) tstart = time.time() results = sess.run(self.ema_eval_outputs if ema else self.eval_outputs) run_times.append(time.time() - tstart) for k, v in results.items(): all_loss_lists[k].append(v) except tf.errors.OutOfRangeError: pass num_batches_seen = len(list(all_loss_lists.values())[0]) logging.info('eval pass done ({} batches, {} examples)'.format( num_batches_seen, num_batches_seen * self.total_bs)) results = {k: np.mean(l) for k, l in all_loss_lists.items()} logging.info('final eval results: {}'.format(results)) return results def _run_sampling(self, sess, ema): sess.run(self.eval_iterator.initializer) logging.info('sampling...') samples = sess.run( self.ema_samples_outputs if ema else self.samples_outputs) logging.info('sampling done') return samples def _write_eval_and_samples(self, sess, log, curr_step, prefix, ema): # Samples samples_dict = self._run_sampling(sess, ema=ema) for k, v in samples_dict.items(): assert len(v.shape) == 4 and v.shape[0] == self.total_bs log.summary_writer.images( '{}/{}'.format(prefix, k), np.clip(v, 0, 255).astype('uint8'), step=curr_step) log.summary_writer.flush() # Eval eval_losses = self._run_eval(sess, ema=ema) for k, v in eval_losses.items(): log.write(prefix, [{k: v}], step=curr_step) def run(self, logdir, once, skip_non_ema_pass=True): """Runs the eval/sampling worker loop. Args: logdir: directory to read checkpoints from once: if True, writes results to a temporary directory (not to logdir), and exits after evaluating one checkpoint. """ if once: eval_logdir = os.path.join(logdir, 'eval_once_{}'.format(time.time())) else: eval_logdir = logdir logging.info('Writing eval data to: {}'.format(eval_logdir)) eval_log = logging_utils.Log(eval_logdir, write_graph=False) with self._make_session() as sess: # Checkpoint loading logging.info('making saver') saver = tf.train.Saver() for ckpt in tf.train.checkpoints_iterator(logdir): logging.info('restoring params...') saver.restore(sess, ckpt) global_step_val = sess.run(self.global_step) logging.info('restored global step: {}'.format(global_step_val)) if not skip_non_ema_pass: logging.info('non-ema pass') self._write_eval_and_samples( sess, log=eval_log, curr_step=global_step_val, prefix='eval', ema=False) if self.ema_model is not None: logging.info('ema pass') self._write_eval_and_samples( sess, log=eval_log, curr_step=global_step_val, prefix='eval_ema', ema=True) if once: break
8e7b7c6eca022b1f627d5d3b0a877db2f1559681
a94283c3b1b3da34233b75132cbdd93f8f22b34f
/MyGame.py
63d32db0a1c9818d6017728bb5674f3c4d148e53
[]
no_license
Andrey12GH/SchoolProject
e419060abf45ec37dc801767f46e6935b92388fa
a81ab4afbb32fd921cccf9901b65be2028d49fda
refs/heads/main
2023-04-23T00:04:26.973174
2021-05-14T18:57:38
2021-05-14T18:57:38
367,451,774
0
0
null
null
null
null
UTF-8
Python
false
false
22,756
py
from tkinter import * from tkinter import messagebox import time import random tk = Tk() # создаем всe def u_attak(): global AI_lost, s_x, s_y, points, points2, user_ships, turn_player while turn_player and user_ships <= 0: mouse_x = canvas.winfo_pointerx() - canvas.winfo_rootx() mouse_y = canvas.winfo_pointery() - canvas.winfo_rooty() ip_x = mouse_x // step_x ip_y = mouse_y // step_y # ЕСЛИ В ПОЛЕ ИИ if ip_x < s_x and ip_y < s_y: if enemy_ships[ip_y][ip_x] != 'T': canvas.create_rectangle(step_x * (ip_x + 1), step_y * (ip_y + 1), step_x * ip_x, step_y * ip_y, fill='blue') AI_lost -= 1 time.sleep(1) else: canvas.create_rectangle(step_x * (ip_x + 1), step_y * (ip_y + 1), step_x * ip_x, step_y * ip_y, fill='yellow') turn_player = False break if AI_lost <= 0: winner = "Победа" winner_add = "Все корабли Противника подбиты" print(winner, winner_add) points1 = [[10 for i in range(s_x)] for i in range(s_y)] points2 = [[10 for i in range(s_x)] for i in range(s_y)] id1 = canvas.create_rectangle(step_x * 3, step_y * 5, size_map_x + step_x*3 + size_map_x - step_x * 3, size_map_y + step_y, fill="gold") id2 = canvas.create_rectangle(step_x * 3 + step_x // 2, step_y * 5 + step_y // 2, size_map_x + step_x*3 + size_map_x - step_x * 3 - step_x // 2, size_map_y - step_y - step_y // 2 + step_y * 3, fill="green") id3 = canvas.create_text(step_x * 10, step_y * 6, text=winner, font=("Arial", 50), justify=CENTER) id4 = canvas.create_text(step_x * 10, step_y * 8, text=winner_add, font=("Arial", 25), justify=CENTER) def finish(x, y): global user_map, fin, path, user_lost, turn_player, AI_lost, s_x, s_y, points, points2, user_ships way = '' if user_map[y - 1][x] == '@': i = 1 while user_map[y - i][x] == '@': print(x, y - i) time.sleep(1) user_map[y - i][x] = 'X' user_map[y - i][x + 1] = 'x' user_map[y - i][x - 1] = 'x' user_draw() user_lost -= 1 tk.update() i += 1 user_map[y - i][x] = 'x' user_map[y - i][x + 1] = 'x' user_map[y - i][x - 1] = 'x' turn_player = True way = 'u' elif user_map[y][x + 1] == '@': i = 1 while user_map[y][x + i] == '@': print(x + i, 1) time.sleep(1) user_map[y][x + i] = 'X' user_map[y + 1][x + i] = 'x' user_map[y - 1][x + i] = 'x' user_lost -= 1 user_draw() tk.update() i += 1 user_map[y][x + i] = 'x' user_map[y + 1][x + i] = 'x' user_map[y - 1][x + i] = 'x' way = 'r' turn_player = True elif user_map[y][x - 1] == '@': i = 1 while user_map[y][x - i] == '@': print(x - i, y) time.sleep(1) user_map[y][x - i] = 'X' user_map[y - 1][x - i] = 'x' user_map[y + 1][x - i] = 'x' user_lost -= 1 user_draw() tk.update() i += 1 user_map[y][x - i] = 'x' user_map[y - 1][x - i] = 'x' user_map[y + 1][x - i] = 'x' way = 'l' turn_player = True elif user_map[y + 1][x] == '@': i = 1 while user_map[y + i][x] == '@': print(x, y + i) time.sleep(1) user_map[y + i][x] = 'X' user_map[y + i][x + 1] = 'x' user_map[y + i][x - 1] = 'x' user_lost -= 1 user_draw() tk.update() i += 1 user_map[y + i][x] = 'x' user_map[y + i][x + 1] = 'x' user_map[y + i][x - 1] = 'x' way = 'd' turn_player = True if way == 'u' or way == 'd': user_map[y][x + 1] = 'x' user_map[y][x - 1] = 'x' elif way == 'r' or way == 'l': user_map[y - 1][x] = 'x' user_map[y + 1][x] = 'x' canvas.bind_all("<Button-1>", u_attak()) while turn_player: pass canvas.bind_all("<Button-1>", add_to_all) if way == 'u': if user_map[y - i + 3][x] == '@': i = 0 while user_map[y + i][x] == '@': print(x, i + 1) time.sleep(1) user_map[y + i][x] = 'X' user_map[y + i][x + 1] = 'x' user_map[y + i][x - 1] = 'x' user_lost -= 1 user_draw() tk.update() i += 1 user_map[y + i][x] = 'x' user_map[y + i][x + 1] = 'x' user_map[y + i][x - 1] = 'x' fin = False if way == 'r': if user_map[y][x + i - 3] == '@': i = 0 while user_map[y][x - i] == '@': print(x - i, y) time.sleep(1) user_map[y][x - i] = 'X' user_map[y - 1][x - i] = 'x' user_map[y + 1][x - i] = 'x' user_lost -= 1 user_draw() tk.update() i += 1 user_map[y][x - i] = 'x' user_map[y - 1][x - i] = 'x' user_map[y + 1][x - i] = 'x' fin = False if way == 'l': if user_map[y][x - i + 3] == '@': i = 0 while user_map[y][x + i] == '@': print(x + i, y) time.sleep(1) user_map[y][x + i] = 'X' user_map[y - 1][x + i] = 'x' user_map[y + 1][x + i] = 'x' user_lost -= 1 user_draw() tk.update() i += 1 user_map[y][x + i] = 'x' user_map[y - 1][x + i] = 'x' user_map[y + 1][x + i] = 'x' fin = False if way == 'd': if user_map[y + i - 3][x] == '@': i = 0 while user_map[y - i][x] == '@': print(x, y - i) time.sleep(1) user_map[y - i][x] = 'X' user_map[y - i][x + 1] = 'x' user_map[y - i][x - 1] = 'x' user_lost -= 1 user_draw() tk.update() i += 1 user_map[y - i][x] = 'x' user_map[y - i][x + 1] = 'x' user_map[y - i][x - 1] = 'x' fin = False fre_points = ['.'] def check_winner_AI(): global user_map win = True for i in range(0, 10): for j in range(0, 10): if user_map[j][i] == '@': win = False return win list_ids = [] def AI_winner(): global step_x, step_y, list_ids, list_ids winner = "Поражение" winner_add = "Вы потеряли все свои корабли" points1 = [[10 for i in range(s_x)] for i in range(s_y)] points2 = [[10 for i in range(s_x)] for i in range(s_y)] id1 = canvas.create_rectangle(step_x * 3, step_y * 3, size_map_x + step_x*3 + size_map_x - step_x * 3, size_map_y - step_y, fill="black") id2 = canvas.create_rectangle(step_x * 3 + step_x // 2, step_y * 3 + step_y // 2, size_map_x + step_x*3 + size_map_x - step_x * 3 - step_x // 2, size_map_y - step_y - step_y // 2, fill="red") id3 = canvas.create_text(step_x * 10, step_y * 5, text=winner, font=("Arial", 50), justify=CENTER) id4 = canvas.create_text(step_x * 10, step_y * 6, text=winner_add, font=("Arial", 25), justify=CENTER) list_ids.append(id1) list_ids.append(id2) list_ids.append(id3) list_ids.append(id4) fin = True def enemy_shoot(): global user_map, enemy_was, turn_player, fin, user_lost if not turn_player: x = random.randint(1, 10) y = random.randint(1, 10) while user_map[y][x] == 'X' or user_map[y][x] == 'x': x = random.randint(1, 10) y = random.randint(1, 10) if user_map[y][x] == '.': user_map[y][x] = 'x' turn_player = True elif user_map[y][x] == '@': print(x, y) fin = True if fin: finish(x, y) enemy_shoot() user_map[y][x] = 'X' user_lost -= 1 user_draw() pole = [['.' for i in range(15)] for i in range(15)] def take_position(pole, ln): a = random.randint(3, 12) b = random.randint(3, 12) while pole[a][b] == str(ln) or pole[a][b] == '#': a = random.randint(3, 12) b = random.randint(3, 12) way = random.randint(1, 4) if way == 1: for i in range(0, ln): if pole[a - i][b] != '.': tf = False break else: tf = True if tf: for i in range(0, ln): pole[a - i][b] = 'T' if way == 2: for i in range(0, ln): if pole[a][b + i] != '.': tf = False break else: tf = True if tf: for i in range(0, ln): pole[a][b + i] = 'T' if way == 3: for i in range(0, ln): if pole[a + i][b] != '.': tf = False break else: tf = True if tf: for i in range(0, ln): pole[a + i][b] = 'T' if way == 4: for i in range(0, ln): if pole[a][b - i] != '.': tf = False break else: tf = True if tf: for i in range(0, ln): pole[a][b - i] = 'T' if tf == False: pole = take_position(pole, ln) return pole def zapoln(m): global pole for i in range(15): for j in range(15): if m[i][j] == 'T': try: # 1 pole[i + 1][j + 1] = '#' except IndexError: pole[i - 1][j - 1] = '#' try: # 2 pole[i + 1][j - 1] = '#' except IndexError: pole[i - 1][j + 1] = '#' try: # 3 pole[i - 1][j + 1] = '#' except IndexError: pole[i + 1][j - 1] = '#' try: # 4 pole[i - 1][j - 1] = '#' except IndexError: pole[i + 1][j + 1] = '#' if m[i + 1][j] == 'T' and m[i - 1][j] == '.': m[i - 1][j] = '#' if m[i - 1][j] == 'T' and m[i + 1][j] == '.': m[i + 1][j] = '#' if m[i][j + 1] == 'T' and m[i][j - 1] == '.': m[i][j - 1] = '#' if m[i][j - 1] == 'T' and m[i][j + 1] == '.': m[i][j + 1] = '#' return m def for1(pole): a = random.randint(3, 12) b = random.randint(3, 12) while pole[a][b] == 'T' or pole[a][b] == '#': a = random.randint(3, 12) b = random.randint(3, 12) pole[a][b] = 'T' pole[a + 1][b + 1] = '#' pole[a + 1][b] = '#' pole[a + 1][b - 1] = '#' pole[a][b + 1] = '#' pole[a][b - 1] = '#' pole[a - 1][b + 1] = '#' pole[a - 1][b] = '#' pole[a - 1][b - 1] = '#' return pole def create(pole): pole = take_position(pole, 4) pole = zapoln(pole) pole = take_position(pole, 3) pole = zapoln(pole) pole = take_position(pole, 2) pole = zapoln(pole) pole = take_position(pole, 2) pole = zapoln(pole) pole = for1(pole) pole = zapoln(pole) pole = for1(pole) pole = zapoln(pole) pole = for1(pole) pole = zapoln(pole) return pole def place(): global pole respole = [] for i in range(15): for j in range(15): if i < 3 or i > 12 or j < 3 or j > 12: pole[i][j] = '#' else: pole[i][j] = '.' pole = create(pole) for i in range(3, 13): respole.append(pole[i][3:13]) return respole enemy_ships = place() ''' <- расстановка кораблей противника случайным образом, в результате получаем его карту: enemy_ships ''' def enemy_draw(): for i in range(10): for j in range(10): if enemy_ships[i][j] == 'X': canvas.create_rectangle(step_x * (j - 1), step_y * (i - 1), step_x * j, step_y * i, fill='yellow') def enemy_die_ship():#доделать global enemy_ships for y in range(10): for x in range(10): if enemy_ships[x][y] == 'X': if enemy_ships[y-1][x] == 'X' or enemy_ships[y+1][x]: i = 0 while enemy_ships[y-i][x] == 'X':# в одном напрвлении i += 1 if enemy_ships[y-i][x] != 'T' and enemy_ships[y-i][x]!='X': j = 0 while enemy_ships[y + j][x] == 'X':#в другом j += 1 if enemy_ships[y + j][x] == '.': for k in range(y-i, y+j): enemy_ships[k][x+1] = 'X' enemy_ships[k][x] = 'X' enemy_ships[k][x-1] = 'X' elif enemy_ships[y][x-1] == 'X' or enemy_ships[y][x+1] == 'X': i = 0 while enemy_ships[y][x-i] == 'X': # в одном напрвлении i += 1 if enemy_ships[y][x-i] == '.': j = 0 while enemy_ships[y][x+j] == 'X': # в другом j += 1 if enemy_ships[y][x+j] != 'T' and enemy_ships[y-i][x]!='X': for k in range(x - i, x + j): enemy_ships[y-1][k] = 'X' enemy_ships[y][k] = 'X' enemy_ships[y+1][k] = 'X' enemy_draw() user_map = [['.' for i in range(12)] for j in range(12)] def user_draw(): global user_map, step_x, step_y for i in range(1, len(user_map) - 1): for j in range(1, len(user_map[0]) - 1): if user_map[j][i] == '#': canvas.create_rectangle(step_x * (j - 1) + size_map_x + step_x * 3, step_y * (i - 1), step_x * j + size_map_x + step_x * 3, step_y * i, fill='yellow') elif user_map[j][i] == '.': canvas.create_rectangle(step_x * (j - 1) + size_map_x + step_x * 3, step_y * (i - 1), step_x * j + size_map_x + step_x * 3, step_y * i, fill='skyblue') elif user_map[j][i] == '@': canvas.create_rectangle(step_x * (j - 1) + size_map_x + step_x * 3, step_y * (i - 1), step_x * j + size_map_x + step_x * 3, step_y * i, fill='red') elif user_map[j][i] == 'X': # big X canvas.create_rectangle(step_x * (j - 1) + size_map_x + step_x * 3, step_y * (i - 1), step_x * j + size_map_x + step_x * 3, step_y * i, fill='blue') elif user_map[j][i] == 'x': # small x canvas.create_rectangle(step_x * (j - 1) + size_map_x + step_x * 3, step_y * (i - 1), step_x * j + size_map_x + step_x * 3, step_y * i, fill='yellow') # размеры size_map_x = 500 size_map_y = 500 s_x = s_y = 10 step_x = size_map_x // s_x step_y = size_map_y // s_y # обновление, ход иrры app_running = True turn_player = True def on_closing(): global app_running if messagebox.askokcancel("Выход из игры", "Хотите выйти из игры?"): app_running = False tk.destroy() tk.protocol("WM_DELETE_WINDOW", on_closing) tk.title("Игра Морской Бой") tk.resizable(0, 0) canvas = Canvas(tk, width=2 * size_map_x + step_x * 3, height=size_map_y + step_y * 3, bd=0, highlightthickness=0) canvas.create_rectangle(0, 0, size_map_x, size_map_y, fill="skyblue") canvas.create_rectangle(size_map_x + step_x * 3, 0, 2 * size_map_x + step_x * 3, size_map_x, fill="skyblue") canvas.create_rectangle(size_map_x, 0, size_map_x, size_map_y, fill="lightyellow") canvas.pack() tk.update() # рисуем 1 холст def draw_table(offset_x=0): for i in range(0, s_x + 1): canvas.create_line(step_x * i + offset_x, 0, step_x * i + offset_x, size_map_y) for i in range(0, s_y + 1): canvas.create_line(offset_x, step_y * i, size_map_x + offset_x, step_y * i) draw_table() draw_table(size_map_x + step_x * 3) # рисуем поле 10х10(AI)size t3 = Label(tk, text="@@@@@@@", font=("Helvetica", 16)) t3.place(x=size_map_x + step_x*3//2 - t3.winfo_reqwidth() // 2, y= size_map_y) def mark_igrok(): global user_ships if user_ships>=0: t3.configure(text="Осталось расставить: " + str(user_ships) + " палуб") t3.place(x=size_map_x + step_x*3 // 2 - t3.winfo_reqwidth() // 2, y=size_map_y+5) user_ships = 7 user_lost = 7 etap = 'расстановка' def etap_ch(): global user_ships, etap if user_ships > 0: etap = 'расстановка' else: etap = 'бой' t4 = Label(tk, text="этап: " + etap, font=("Helvetica", 16)) t4.place(x=size_map_x + step_x * 3 // 2 - t3.winfo_reqwidth() // 2, y=size_map_y + 30) def user_place(event): global user_map, user_ships, s_x, s_y, size_map_y, size_map_x, step_x if user_ships > 0: mouse_x = canvas.winfo_pointerx() - canvas.winfo_rootx() mouse_y = canvas.winfo_pointery() - canvas.winfo_rooty() x = (mouse_x - size_map_x - step_x*3) // step_x + 1 y = (mouse_y - size_map_y) // step_y - 1 # ЕСЛИ В ПОЛЕ ИИ if x < s_x and y < s_y and user_ships > 0: print('ok') if user_map[x][y] == '.': user_map[x][y] = '@' user_ships -= 1 elif user_map[x][y] == '@': user_map[x][y] = '.' user_ships += 1 etap_ch() t4.configure(text="этап: " + etap) t4.place(x=size_map_x + step_x * 3 // 2 - t3.winfo_reqwidth() // 2, y=size_map_y + 30) user_draw() canvas.bind_all("<Button-1>", user_place) t0 = Label(tk, text="Игрок №1", font=("Helvetica", 16)) t0.place(x=size_map_x // 2 - t0.winfo_reqwidth() // 2, y=size_map_y + 3) t1 = Label(tk, text="Игрок №2", font=("Helvetica", 16)) t1.place(x=size_map_x + step_x*3 + size_map_x // 2 - t1.winfo_reqwidth() // 2, y=size_map_y + 3) t0.configure(bg="red") t0.configure(bg="#f0f0f0") t3 = Label(tk, text="", font=("Helvetica", 16)) t3.place(x=size_map_x + step_x*3//2 - t3.winfo_reqwidth() // 2, y= size_map_y) def begin_again(): global user_map, enemy_ships, pole, enemy_ships, step_x, step_y, user_lost, user_ships, AI_lost for j in range(len(list_ids)): canvas.delete(list_ids[j]) canvas.create_rectangle(0, 0, size_map_x, size_map_y, fill="skyblue") draw_table() pole = [['.' for i in range(15)] for i in range(15)] enemy_ships = place() user_map = [['.' for i in range(12)] for j in range(12)] user_ships = 7 user_lost = 7 AI_lost = 14 user_draw() canvas.bind_all("<Button-1>", user_place) ''' for i in range(len(enemy_ships)): for j in range(len(enemy_ships[0])): if enemy_ships[i][j] == 'T': canvas.create_rectangle(step_x * (j + 1), step_y * (i + 1), step_x * j, step_y * i, fill='red') ''' button_begin_again = Button(tk, text="Начать заново", command=begin_again) button_begin_again.place(x=size_map_x + 20, y=170) AI_lost = 14 def add_to_all(event): global AI_lost global s_x global s_y global points, points2, user_ships, turn_player mouse_x = canvas.winfo_pointerx() - canvas.winfo_rootx() mouse_y = canvas.winfo_pointery() - canvas.winfo_rooty() ip_x = mouse_x // step_x ip_y = mouse_y // step_y # ЕСЛИ В ПОЛЕ ИИ if ip_x < s_x and ip_y < s_y and turn_player and user_ships <= 0: if enemy_ships[ip_y][ip_x] == 'T': canvas.create_rectangle(step_x * (ip_x + 1), step_y * (ip_y + 1), step_x * ip_x, step_y * ip_y, fill='blue') AI_lost -= 1 enemy_ships[ip_y+1][ip_x+1] = 'X' else: canvas.create_rectangle(step_x * (ip_x + 1), step_y * (ip_y + 1), step_x * ip_x, step_y * ip_y,fill='yellow') turn_player = False time.sleep(1) enemy_shoot() if AI_lost == 0: winner = "Победа" winner_add = "Все корабли Противника подбиты" print(winner, winner_add) points1 = [[10 for i in range(s_x)] for i in range(s_y)] points2 = [[10 for i in range(s_x)] for i in range(s_y)] id1 = canvas.create_rectangle(step_x * 3, step_y * 3, size_map_x + step_x*3 + size_map_x - step_x * 3, size_map_y - step_y, fill="gold") id2 = canvas.create_rectangle(step_x * 3 + step_x // 2, step_y * 3 + step_y // 2, size_map_x + step_x*3 + size_map_x - step_x * 3 - step_x // 2, size_map_y - step_y - step_y // 2, fill="green") id3 = canvas.create_text(step_x * 10, step_y * 5, text=winner, font=("Arial", 50), justify=CENTER) id4 = canvas.create_text(step_x * 10, step_y * 6, text=winner_add, font=("Arial", 25), justify=CENTER) list_ids.append(id1) list_ids.append(id2) list_ids.append(id3) list_ids.append(id4) for u in range(10): print(enemy_ships[u]) for i in range(10): print(enemy_ships[i]) while app_running: etap_ch() mark_igrok() if user_ships <= 0: canvas.bind_all("<Button-1>", add_to_all) if user_lost <= 0: AI_winner() if app_running: tk.update_idletasks() tk.update() time.sleep(0.005)
0a6eda164c7b5f595b951ec6812496f800244175
8b2deda9f23fd1d70e2e7b6e69a0db21e11490c5
/GraphMatching/imgutils/bwmorph_thin.py
f3a986f2279f869b2a10ead09ef2713c3556710b
[]
no_license
phanikmr/Graph-Matching-for-Image-Retrival
a60c145e857a0f153a2188cadde3807b5a7c8fde
151a22e5a69769075bed57e917d0d3025f6db082
refs/heads/master
2021-07-23T23:41:07.674648
2017-07-01T16:18:19
2017-07-01T16:18:19
109,504,248
9
0
null
null
null
null
UTF-8
Python
false
false
6,716
py
import numpy as np from scipy import ndimage as ndi # lookup tables for bwmorph_thin G123_LUT = np.array([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0], dtype=np.bool) G123P_LUT = np.array([0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], dtype=np.bool) def bwmorph_thin(image, n_iter=None): """ Perform morphological thinning of a binary image Parameters ---------- image : binary (M, N) ndarray The image to be thinned. n_iter : int, number of iterations, optional Regardless of the value of this parameter, the thinned image is returned immediately if an iteration produces no change. If this parameter is specified it thus sets an upper bound on the number of iterations performed. Returns ------- out : ndarray of bools Thinned image. See also -------- skeletonize Notes ----- This algorithm [1]_ works by making multiple passes over the image, removing pixels matching a set of criteria designed to thin connected regions while preserving eight-connected components and 2 x 2 squares [2]_. In each of the two sub-iterations the algorithm correlates the intermediate skeleton image with a neighborhood mask, then looks up each neighborhood in a lookup table indicating whether the central pixel should be deleted in that sub-iteration. References ---------- .. [1] Z. Guo and R. W. Hall, "Parallel thinning with two-subiteration algorithms," Comm. ACM, vol. 32, no. 3, pp. 359-373, 1989. .. [2] Lam, L., Seong-Whan Lee, and Ching Y. Suen, "Thinning Methodologies-A Comprehensive Survey," IEEE Transactions on Pattern Analysis and Machine Intelligence, Vol 14, No. 9, September 1992, p. 879 Examples -------- >>> square = np.zeros((7, 7), dtype=np.uint8) >>> square[1:-1, 2:-2] = 1 >>> square[0,1] = 1 >>> square array([[0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 1, 1, 1, 0, 0], [0, 0, 0, 0, 0, 0, 0]], dtype=uint8) >>> skel = bwmorph_thin(square) >>> skel.astype(np.uint8) array([[0, 1, 0, 0, 0, 0, 0], [0, 0, 1, 0, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 1, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0]], dtype=uint8) """ # check parameters if n_iter is None: n = -1 elif n_iter <= 0: raise ValueError('n_iter must be > 0') else: n = n_iter # check that we have a 2d binary image, and convert it # to uint8 skel = np.array(image).astype(np.uint8) if skel.ndim != 2: raise ValueError('2D array required') if not np.all(np.in1d(image.flat,(0,1))): raise ValueError('Image contains values other than 0 and 1') # neighborhood mask mask = np.array([[ 8, 4, 2], [16, 0, 1], [32, 64,128]],dtype=np.uint8) # iterate either 1) indefinitely or 2) up to iteration limit while n != 0: before = np.sum(skel) # count points before thinning # for each subiteration for lut in [G123_LUT, G123P_LUT]: # correlate image with neighborhood mask N = ndi.correlate(skel, mask, mode='constant') # take deletion decision from this subiteration's LUT D = np.take(lut, N) # perform deletion skel[D] = 0 after = np.sum(skel) # coint points after thinning if before == after: # iteration had no effect: finish break # count down to iteration limit (or endlessly negative) n -= 1 return skel.astype(np.bool) """ # here's how to make the LUTs def nabe(n): return np.array([n>>i&1 for i in range(0,9)]).astype(np.bool) def hood(n): return np.take(nabe(n), np.array([[3, 2, 1], [4, 8, 0], [5, 6, 7]])) def G1(n): s = 0 bits = nabe(n) for i in (0,2,4,6): if not(bits[i]) and (bits[i+1] or bits[(i+2) % 8]): s += 1 return s==1 g1_lut = np.array([G1(n) for n in range(256)]) def G2(n): n1, n2 = 0, 0 bits = nabe(n) for k in (1,3,5,7): if bits[k] or bits[k-1]: n1 += 1 if bits[k] or bits[(k+1) % 8]: n2 += 1 return min(n1,n2) in [2,3] g2_lut = np.array([G2(n) for n in range(256)]) g12_lut = g1_lut & g2_lut def G3(n): bits = nabe(n) return not((bits[1] or bits[2] or not(bits[7])) and bits[0]) def G3p(n): bits = nabe(n) return not((bits[5] or bits[6] or not(bits[3])) and bits[4]) g3_lut = np.array([G3(n) for n in range(256)]) g3p_lut = np.array([G3p(n) for n in range(256)]) g123_lut = g12_lut & g3_lut g123p_lut = g12_lut & g3p_lut """
acf80746855eaad75fcbdc580daa49d5bee0bf95
20176bf4fbd8aec139c7b5a27f2c2e155e173e6e
/data/all-pratic/oinam_singh/myprogram/filewordcnt2.py
993801d7b654e4f8041739bbfb5d975e82b48048
[]
no_license
githubjyotiranjan/pytraining
4ac4a1f83cc4270e2939d9d32c705019c5bc61c5
8b50c4ab7848bd4cbfdfbc06489768d577289c66
refs/heads/master
2020-03-19T06:22:20.793296
2018-06-15T20:08:11
2018-06-15T20:08:11
136,013,642
0
0
null
null
null
null
UTF-8
Python
false
false
644
py
import operator from collections import OrderedDict from collections import defaultdict mydict = defaultdict(int) with open('tmpread.txt') as file: for line in file: line = line.strip() for w in line.split(): mydict[w] += 1 #sorted_x = sorted(dics.items(), key=operator.itemgetter(1)) print(mydict.items()); print(mydict.keys()); d_sorted_by_value = OrderedDict(sorted(mydict.items(), key=lambda x: x[1])) print(d_sorted_by_value.items()); print(d_sorted_by_value.keys()); d_sorted_by_key = OrderedDict(sorted(mydict.items(), key=lambda x: x[0])) print(d_sorted_by_key.items()); print(d_sorted_by_key.keys());
a0a772d71339b40f89c78d12bcbf09e8d427a633
f57ad671e26023fc22a035375acbfefec3442104
/DemoStr.py
4a1b6dfc909728c9e484341174dc88309a950bd6
[]
no_license
yurimkim1/python0802
62962c989e5622806d7b1c84f540d740f77fe32e
6e84443a3aabec9db351bf4b68d2340b66ee5796
refs/heads/master
2023-07-08T17:24:16.674558
2021-08-09T01:59:44
2021-08-09T01:59:44
392,205,377
0
0
null
null
null
null
UTF-8
Python
false
false
1,233
py
# DemoStr.py #str형식의 메서드 #print( dir(str) ) names = ["전우치","홍길동","이순신"] for name in names: print("안녕하세요 {0}님 더운 여름입니다.".format(name)) print("=" * 40) #메서드 연습 strA = "python is powerful" print( len(strA) ) print( strA.capitalize() ) print( strA.count("p")) print( strA.count("p", 7)) print( "demo.ppt".endswith("ppt") ) strB = "<<< spam and ham >>>" print(strB) #앞뒤에 있는 캐릭터 제거 result = strB.strip("<> ") print(result) result2 = result.replace("spam", "spam egg") print(result2) #문자열을 리스트로 변환(공백문자 기준) lst = result2.split() print( lst ) #하나의 문자열로 합치기 print( " ".join(lst) ) #정규 표현식 import re #패턴을 통한 검색 print( re.match("[0-9]*th", "35th") ) print( re.search("[0-9]*th", "35th") ) result = re.search("[0-9]*th", "35th") print( result.group() ) #약간의 함정 print( bool(re.match("[0-9]*th", " 35th")) ) print( bool(re.search("[0-9]*th", " 35th")) ) print( bool(re.search("apple", "this is apple")) ) print("---우편번호---") print( bool(re.search("\d{5}", "우리 동네는 52300")) ) print( bool(re.search("\d{4}", "올해는 2021년입니다.")) )
b9f55074dd8200515703d8c50308192339859bbe
72b5d40314e14d641940462cc22f567a6b8b33f0
/network/zmq/req-rep/proxy_server.py
8bc67cb5bfc22247cb5999d35905f1d6742acf75
[]
no_license
ianzhang1988/PythonScripts
968d7c4e10d8ced43ab93113374059ec743f6fda
9a5ca9cbade4f9648d872784edadcd152f054683
refs/heads/master
2022-08-19T09:44:24.277144
2022-07-27T10:03:10
2022-07-27T10:03:10
96,340,261
0
0
null
null
null
null
UTF-8
Python
false
false
2,858
py
# coding=utf-8 import zmq import threading import time class ProxyServer(): def __init__(self): self.context = zmq.Context() self.context2 = zmq.Context() self.working = False def start(self): self.working = True frontend = self.context.socket(zmq.ROUTER) backend = self.context.socket(zmq.DEALER) frontend.bind("tcp://*:5555") #backend.bind('inproc://workers') backend.bind('tcp://*:5556') self.thread1 = threading.Thread(target=self._work, args=(1,)) self.thread2 = threading.Thread(target=self._work, args=(2,)) self.thread1.start() self.thread2.start() try: zmq.proxy(frontend, backend) except zmq.ContextTerminated: print('context close') frontend.close() backend.close() def _work(self, id): #server_sock = self.context2.socket(zmq.REP) server_sock = self.context2.socket(zmq.REP) # server_sock.connect('inproc://workers') server_sock.connect('tcp://127.0.0.1:5556') server_sock.setsockopt(zmq.RCVTIMEO, 1000) while self.working: content = None try: #content = server_sock.recv_json() content = server_sock.recv_json() except zmq.Again: continue # echo back if content is not None: content['server_id'] = id server_sock.send_json(content) # print('thread %s:'%id, content) server_sock.setsockopt(zmq.LINGER, 0) server_sock.close() # test mem block send def _work2(self, id): #server_sock = self.context2.socket(zmq.REP) server_sock = self.context2.socket(zmq.REP) # server_sock.connect('inproc://workers') server_sock.connect('tcp://127.0.0.1:5556') server_sock.setsockopt(zmq.RCVTIMEO, 1000) while self.working: content = None try: #content = server_sock.recv_json() content = server_sock.recv() except zmq.Again: continue # echo back rep_body ={} rep_body['server_id'] = id rep_body['recv_len'] = len(content) server_sock.send_json(rep_body) # print('thread %s:'%id, content) server_sock.setsockopt(zmq.LINGER, 0) server_sock.close() def close(self): self.working = False print('close') self.context.term() print('term') self.thread1.join() self.thread2.join() self.context2.term() def main(): s = ProxyServer() t = threading.Thread(target=s.start) t.start() time.sleep(300) s.close() t.join() if __name__ == '__main__': main()
9d7f7f89abd72b463ee8e9034aa0738ec44b73c4
050868416d2743b05bf8b02b9f8efdb5e0368dbf
/Lesson7_2/main.py
5f0c65abca1216798c7f7f3abe22a31314d38c9d
[]
no_license
mkhabiev/Homework-all
dd1d16577daec7ac0130ebb1ab8ab1960d4a07d3
faa368b0648eb0969bf6824c2788b2c38841aa86
refs/heads/master
2022-12-27T14:43:56.745960
2020-10-18T13:24:34
2020-10-18T13:24:34
297,333,490
0
0
null
null
null
null
UTF-8
Python
false
false
805
py
import wikipedia def main(): language = input('Choose a language for Wiki: (en, ru, fr) ') wiki = wikipedia wiki.set_lang(language) while True: query = input('What do you want to search? ') results = wiki.search(query) for key, result in enumerate(results): print(key, result) print() about = input('Choose a short information\n ') summary = wiki.summary(about) d = 0 for i in range(0, len(summary), 50): try: print(summary[d:d+i] + '-') except Exception: print(summary[d:]) d += i ask_url = input('Do you want link? ') if ask_url.lower() == 'yes': article = wiki.page(about) print(article.url) main()
74f3ef6c3e844f6f8fa1234a783e57b16eddff82
8b57c6609e4bf3e6f5e730b7a4a996ad6b7023f0
/persistconn/packet.py
79a3d92edb26b212d7c04844f89ece59d3e93669
[]
no_license
bullll/splunk
862d9595ad28adf0e12afa92a18e2c96308b19fe
7cf8a158bc8e1cecef374dad9165d44ccb00c6e0
refs/heads/master
2022-04-20T11:48:50.573979
2020-04-23T18:12:58
2020-04-23T18:12:58
258,293,313
2
0
null
null
null
null
UTF-8
Python
false
false
7,103
py
from builtins import range from builtins import object import sys, os import json import splunk.util class PersistentServerConnectionProtocolException(Exception): """ Exception thrown when a recieved packet can't be interpreted """ pass class PersistentServerConnectionRequestPacket(object): """ Object representing a recieved packet """ def __init__(self): self.opcode = None self.command = None self.command_arg = None self.block = None def is_first(self): """ @rtype: bool @return: True if this packet represents the beginning of the request """ return (self.opcode & PersistentServerConnectionRequestPacket.OPCODE_REQUEST_INIT) != 0 def is_last(self): """ @rtype: bool @return: True if this packet represents the end of the request """ return (self.opcode & PersistentServerConnectionRequestPacket.OPCODE_REQUEST_END) != 0 def has_block(self): """ @rtype: bool @return: True if this packet contains an input block for the request """ return (self.opcode & PersistentServerConnectionRequestPacket.OPCODE_REQUEST_BLOCK) != 0 def allow_stream(self): """ For future use. """ return (self.opcode & PersistentServerConnectionRequestPacket.OPCODE_REQUEST_ALLOW_STREAM) != 0 def __str__(self): s = "is_first=%c is_last=%c allow_stream=%c" % ( "NY"[self.is_first()], "NY"[self.is_last()], "NY"[self.allow_stream()]) if self.command is not None: s += " command=%s" % json.dumps(self.command) if self.command_arg is not None: s += " command_arg=%s" % json.dumps(self.command_arg) if self.has_block(): s += " block_len=%u block=%s" % ( len(self.block), json.dumps(str(self.block))) return s OPCODE_REQUEST_INIT = 0x01 OPCODE_REQUEST_BLOCK = 0x02 OPCODE_REQUEST_END = 0x04 OPCODE_REQUEST_ALLOW_STREAM = 0x08 def read(self, handle): """ Read a length-prefixed protocol data from a file handle, filling this object @param handle: File handle to read from @rtype: bool @return: False if we're at EOF """ while True: opbyte = handle.read(1) if opbyte == b"": return False if opbyte != b"\n": break # ignore extra newlines before opcode self.opcode = ord(opbyte) if self.is_first(): command_pieces = PersistentServerConnectionRequestPacket._read_number(handle) self.command = [] for i in range(0, command_pieces): piece = PersistentServerConnectionRequestPacket._read_string(handle) if sys.version_info >= (3, 0): piece = piece.decode() self.command.append(piece) self.command_arg = PersistentServerConnectionRequestPacket._read_string(handle) if self.command_arg == b"": self.command_arg = None elif sys.version_info >= (3, 0): self.command_arg = self.command_arg.decode() if self.has_block(): self.block = PersistentServerConnectionRequestPacket._read_string(handle) return True @staticmethod def _read_to_eol(handle): v = b"" while True: e = handle.read(1) if not e: if v == b"": raise EOFError break if e == b'\n': break v += e return v @staticmethod def _read_number(handle): while True: v = PersistentServerConnectionRequestPacket._read_to_eol(handle) if v != b"": # ignore empty lines before a count break try: n = int(v) except ValueError: raise PersistentServerConnectionProtocolException("expected non-negative integer, got \"%s\"" % v) if n < 0: raise PersistentServerConnectionProtocolException("expected non-negative integer, got \"%d\"" % n) return n @staticmethod def _read_string(handle): return handle.read(PersistentServerConnectionRequestPacket._read_number(handle)) class PersistentServerConnectionPacketParser(object): """ Virtual class which handles packet-level I/O with stdin/stdout. The handle_packet method must be overridden. """ def __init__(self): self._owed_flush = False def write(self, data): """ Write out a string, preceded by its length. If a dict is passed in, it is automatically JSON encoded @param data: String or dictionary to send. """ if sys.version_info >= (3, 0): if isinstance(data, bytes): sys.stdout.buffer.write(("%u\n" % len(data)).encode("ascii")) sys.stdout.buffer.write(data) elif isinstance(data, str): edata = data.encode("utf-8") sys.stdout.buffer.write(("%u\n" % len(edata)).encode("ascii")) sys.stdout.buffer.write(edata) elif isinstance(data, dict): edata = json.dumps(data, separators=(',', ':')).encode("utf-8") sys.stdout.buffer.write(("%u\n" % len(edata)).encode("ascii")) sys.stdout.buffer.write(edata) else: raise TypeError("Don't know how to serialize %s" % type(data).__name__) else: if isinstance(data, splunk.util.string_type): sys.stdout.write("%u\n%s" % (len(data), data)) elif isinstance(data, dict): s = json.dumps(data, separators=(',', ':')) sys.stdout.write("%u\n%s" % (len(s), s)) else: raise TypeError("Don't know how to serialize %s" % type(data).__name__) self._owed_flush = True def run(self): """ Continuously read packets from stdin, passing each one to handle_packet() """ if os.name.startswith("nt"): import msvcrt msvcrt.setmode(sys.stdin.fileno(), os.O_BINARY) msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY) while True: in_packet = PersistentServerConnectionRequestPacket() handle = sys.stdin if sys.version_info >= (3, 0): handle = sys.stdin.buffer if not in_packet.read(handle): break self.handle_packet(in_packet) if self._owed_flush: sys.stdout.flush() self._owed_flush = False def handle_packet(self, in_packet): """ Virtual method called for each recieved packet @param in_packet: PersistentServerConnectionRequestPacket object recieved """ raise NotImplementedError("PersistentServerConnectionPacketParser.handle_packet")
f729f18c246e778316b422232434075c31dd032f
d5f03681070efcf7be19f7b63c135479950948f3
/scss/errors.py
65f5350c394ea93656b0b27bfb8316ffb4b2fff6
[ "MIT" ]
permissive
doug-fish/pyScss
6f642634234960dbe03a6cca1db97135082c567b
f63a6964df84c193478a7cce14013a5f53f6aee7
refs/heads/master
2020-12-11T05:38:41.234931
2014-09-10T05:02:35
2014-09-10T05:02:35
null
0
0
null
null
null
null
UTF-8
Python
false
false
8,537
py
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals import six import sys import traceback BROWSER_ERROR_TEMPLATE = """\ body:before {{ content: {0}; display: block; position: fixed; top: 0; left: 0; right: 0; font-size: 14px; margin: 1em; padding: 1em; border: 3px double red; white-space: pre; font-family: monospace; background: #fcebeb; color: black; }} """ def add_error_marker(text, position, start_line=1): """Add a caret marking a given position in a string of input. Returns (new_text, caret_line). """ indent = " " lines = [] caret_line = start_line for line in text.split("\n"): lines.append(indent + line) if 0 <= position <= len(line): lines.append(indent + (" " * position) + "^") caret_line = start_line position -= len(line) position -= 1 # for the newline start_line += 1 return "\n".join(lines), caret_line class SassBaseError(Exception): """Base class for all errors caused by Sass code. Shouldn't be raising this directly; use or create a subclass instead. """ def __init__(self, rule=None): super(SassBaseError, self).__init__() self.rule_stack = [] if rule is not None: self.add_rule(rule) def add_rule(self, rule): """Add a new rule to the "stack" of rules -- this is used to track, e.g., how a file was ultimately imported. """ self.rule_stack.append(rule) def format_file_and_line(self, rule): return "line {rule.lineno} of {rule.source_file.path}".format( rule=rule, ) def format_sass_stack(self): """Return a "traceback" of Sass imports.""" if not self.rule_stack: return "" ret = ["on ", self.format_file_and_line(self.rule_stack[0]), "\n"] last_file = self.rule_stack[0].source_file # TODO this could go away if rules knew their import chains... # TODO mixins and the like here too? # TODO the line number is wrong here, since this doesn't include the # *block* being parsed! for rule in self.rule_stack[1:]: if rule.source_file is not last_file: ret.extend(( "imported from ", self.format_file_and_line(rule), "\n")) last_file = rule.source_file return "".join(ret) def format_message(self): return "" def __str__(self): return "{message}\n{sass_stack}".format( message=self.format_message(), sass_stack=self.format_sass_stack(), ) class SassSyntaxError(SassBaseError): """Generic syntax error thrown by the guts of the expression parser; usually caught and wrapped later on. """ def __init__(self, input_string, position, desired_tokens): super(SassSyntaxError, self).__init__() self.input_string = input_string self.position = position self.desired_tokens = desired_tokens def __str__(self): # TODO this doesn't show the rule stack; should inherit from SassError # instead? if self.position == 0: after = "Syntax error" else: after = "Syntax error after {0!r}".format( self.input_string[max(0, self.position - 20):self.position]) found = "Found {0!r}".format( self.input_string[self.position:self.position + 10]) if not self.desired_tokens: expected = "but can't figure out what that means" elif len(self.desired_tokens) == 1: expected = "but expected {0}".format( ''.join(self.desired_tokens)) else: expected = "but expected one of {0}".format( ', '.join(sorted(self.desired_tokens))) return "{after}: {found} {expected}".format( after=after, found=found, expected=expected, ) class SassImportError(SassBaseError): """Error raised when unable to resolve an @import.""" def __init__(self, bad_name, compiler, **kwargs): super(SassImportError, self).__init__(**kwargs) self.bad_name = bad_name self.compiler = compiler def format_message(self): return ( "Couldn't find anything to import: {0}\n" "Search path:\n {1}" .format( self.bad_name, "\n ".join(self.compiler.search_path), ) ) class SassError(SassBaseError): """Error class that wraps another exception and attempts to bolt on some useful context. """ def __init__(self, exc, expression=None, expression_pos=None, **kwargs): super(SassError, self).__init__(**kwargs) self.exc = exc self.expression = expression self.expression_pos = expression_pos _, _, self.original_traceback = sys.exc_info() def format_prefix(self): """Return the general name of the error and the contents of the rule or property that caused the failure. This is the initial part of the error message and should be error-specific. """ # TODO this contains NULs and line numbers; could be much prettier if self.rule_stack: return ( "Error parsing block:\n" + " " + self.rule_stack[0].unparsed_contents + "\n" ) else: return "Unknown error\n" def format_python_stack(self): """Return a traceback of Python frames, from where the error occurred to where it was first caught and wrapped. """ ret = ["Traceback:\n"] ret.extend(traceback.format_tb(self.original_traceback)) return "".join(ret) def format_original_error(self): """Return the typical "TypeError: blah blah" for the original wrapped error. """ # TODO eventually we'll have sass-specific errors that will want nicer # "names" in browser display and stderr return "".join(( type(self.exc).__name__, ": ", six.text_type(self.exc), "\n", )) def __str__(self): try: prefix = self.format_prefix() sass_stack = self.format_sass_stack() python_stack = self.format_python_stack() original_error = self.format_original_error() # TODO not very well-specified whether these parts should already # end in newlines, or how many return prefix + "\n" + sass_stack + python_stack + original_error except Exception: # "unprintable error" is not helpful return six.text_type(self.exc) def to_css(self): """Return a stylesheet that will show the wrapped error at the top of the browser window. """ # TODO should this include the traceback? any security concerns? prefix = self.format_prefix() original_error = self.format_original_error() sass_stack = self.format_sass_stack() message = prefix + "\n" + sass_stack + original_error # Super simple escaping: only quotes and newlines are illegal in css # strings message = message.replace('\\', '\\\\') message = message.replace('"', '\\"') # use the maximum six digits here so it doesn't eat any following # characters that happen to look like hex message = message.replace('\n', '\\00000A') return BROWSER_ERROR_TEMPLATE.format('"' + message + '"') class SassParseError(SassError): """Error raised when parsing a Sass expression fails.""" def format_prefix(self): decorated_expr, line = add_error_marker(self.expression, self.expression_pos or -1) return """Error parsing expression at {1}:\n{0}\n""".format(decorated_expr, self.expression_pos) class SassEvaluationError(SassError): """Error raised when evaluating a parsed expression fails.""" def format_prefix(self): # TODO boy this is getting repeated a lot # TODO would be nice for the AST to have position information # TODO might be nice to print the AST and indicate where the failure # was? decorated_expr, line = add_error_marker(self.expression, self.expression_pos or -1) return """Error evaluating expression:\n{0}\n""".format(decorated_expr)
96b0ee7b3617734f1c7ec293da6d25865eaf503c
1a799809cb404522db2e1ae7c834beb8ddb5e526
/BUAN/Session3/class_2.py
7df6c379752488c16b54461b67f83f17bb048910
[]
no_license
yingjiaxuan/JBWorkspace
2305534c913d567190005c6ae3c330689adabebc
9cb89eba8ecef1d68ef3879dc53656098afdcf4d
refs/heads/master
2023-01-11T08:10:11.568088
2020-11-12T08:01:44
2020-11-12T08:01:44
312,206,459
0
0
null
null
null
null
UTF-8
Python
false
false
5,425
py
import pandas as pd from sklearn.model_selection import train_test_split from sklearn.linear_model import LogisticRegression, LogisticRegressionCV import numpy as np from sklearn import metrics def summary_corf(model_object): # 利用alpha去进行迭代 n_predictors = X.shape[1] model_coef = pd.DataFrame(model_object.coef_.reshape(1, n_predictors), columns=X.columns.values) model_coef['Intercept'] = model_object.intercept_ # 神秘模型,等会要看懂,线性方程的截距 return model_coef.transpose() pass def profit_calculation(model, x_value, y_value): # 输出平均收益 d_cutoff = 1 / 11 decision = list(model.predict_proba(x_value)[:, 1] > d_cutoff) sum = 0 for i in range(len(decision)): if decision[i] == True and y_value.iloc[i] == 1: profit = 10 elif decision[i] == True and y_value.iloc[i] == 0: profit = -1 else: profit = 0 sum = sum + profit print(sum / len(decision)) pass def profit_calculation_usage(model, x_value, y_value): # 输出平均收益 d_cutoff = 1 / 11 decision = list(model.predict_proba(x_value)[:, 1] > d_cutoff) y = list(y_value) sum = 0 for i in range(len(decision)): if decision[i] == True and y[i] == 1: profit = 10 elif decision[i] == True and y[i] == 0: profit = -1 else: profit = 0 sum = sum + profit average = sum / len(decision) return average pass if __name__ == "__main__": ''' - Classification rule becomes irrelevant Now decision rule matters - Confusion matrix becomes irrelevant Now decision matrix matters - Misclassification error rate/accuracy becomes irrelevant Now average profits matters So, we need a Decision Cut-Off Change confusion matrix into decision matrix. ——主要是因为给钱别人不一定会接,也就是和准确率不同的额外一层逻辑,使用这个去比较每 个model的收益 What is the minimum probability that you want to see to justify the decision to SEND? 10*x + (-1)*(1-x) > 0 , so ,SEND is that probability > 1/11 ''' df = pd.read_csv('/Users/simon/JBWorkspace/BUAN/Session3/Ref_File/PersonalLoan.csv') print(df.head(10)) print(df.columns.values) print(df.shape) print(df.isnull().sum()) rvar_list = ['ZIPCode'] df_sample1 = df.drop(columns=rvar_list) print(df_sample1) cvar_list = ['Education', 'SecuritiesAccount', 'CDAccount', 'Online', 'CreditCard', 'PersonalLoan'] nvar_list = ['Age', 'Experience', 'Income', 'Family', 'CCAvg', 'Mortgage'] df_sample2 = df_sample1.copy() df_sample2[nvar_list] = (df_sample1[nvar_list] - df_sample1[nvar_list].mean()) / df_sample1[nvar_list].std() print(df_sample2) df_sample3 = df_sample2.copy() df_sample3[cvar_list] = df_sample2[cvar_list].astype('category') df_sample3[nvar_list] = df_sample2[nvar_list].astype('float64') # 引用的问题 df_sample4 = df_sample3.copy() df_sample4 = pd.get_dummies(df_sample4, prefix_sep='_') print(df_sample4.columns.values) # rdummies = ['Education_1','SecuritiesAccount_No','CDAccount_No','Online_No','CreditCard_No','PersonalLoan_No'] rdummies = ['Education_1', 'SecuritiesAccount_Yes', 'CDAccount_Yes', 'Online_Yes', 'CreditCard_Yes', 'PersonalLoan_No'] df_sample5 = df_sample4.copy() df_sample5 = df_sample5.drop(columns=rdummies) print(df_sample5.columns.values) print(df_sample5) # 以上完成Pre-processing df4partition = df_sample5.copy() testpart_size = 0.2 df_nontestData, df_testData = train_test_split(df4partition, test_size=testpart_size, random_state=1) print('This is nontestData') print(df_nontestData) print('') print('This is testData') print(df_testData) # Logistic Regression with penalty DV = 'PersonalLoan_Yes' y = df_nontestData[DV] X = df_nontestData.drop(columns=[DV]) alpha = 10 clf = LogisticRegression(C=1 / alpha, penalty='l1', solver='saga', max_iter=200, random_state=1).fit(X, y) # 使用l1的penalty,saga类似于penalty type, max_iter是迭代次数, 同样目的是拿出一个合适的alpha print(summary_corf(clf)) y_test_actual = df_testData[DV] print(y_test_actual) X_test = df_testData.drop(columns=[DV]) print(X_test) outcome = clf.predict_proba(X_test)[:, 1] # 输出预测的"概率" profit_calculation(clf, X_test, y_test_actual) kfolds = 5 min_alpha = 0.01 max_alpha = 100 max_C = 1 / min_alpha min_C = 1 / max_alpha # 设置迭代步长list n_candidates = 5000 # 完全没听到 C_list = list(np.linspace(min_C, max_C, num=n_candidates)) print(C_list) # 0.001到100平均分1000个数字 clf_optimal = LogisticRegressionCV(Cs=C_list, cv=kfolds, scoring=profit_calculation_usage, penalty='l1', solver='saga', max_iter=200, random_state=1, n_jobs=-1).fit(X, y) # 增加了一个scoring,代表找scoring输出的结果作为模型结果 print(summary_corf(clf_optimal)) print(1 / clf_optimal.C_) # 整出alpha,也就是我们要的结果 pass
0eb9c09746daca075136fa1e972e62280a810725
ff0d004c47ac853566af4a0389b20eec58ddcf80
/facedancer/backends/GoodFETMaxUSBApp.py
3da8ca9727943733ae0343b508882a20fd43db59
[]
no_license
wanming2008/Facedancer
ad39576051df5591fdc75cbd68921054f594b4e5
055c316267d5e298d56f868d567f673b3b4b9743
refs/heads/master
2021-01-19T11:25:36.488917
2017-02-09T08:32:04
2017-02-09T08:32:04
null
0
0
null
null
null
null
UTF-8
Python
false
false
15,912
py
import os import serial import time from ..core import FacedancerApp from ..backends.MAXUSBApp import MAXUSBApp from ..USB import * from ..USBDevice import USBDeviceRequest # TODO: Move all functionality that doesn't explicitly depend on GoodFET # into MaxUSBApp. def bytes_as_hex(b, delim=" "): return delim.join(["%02x" % x for x in b]) class GoodfetMaxUSBApp(MAXUSBApp): app_name = "MAXUSB" app_num = 0x40 reg_ep0_fifo = 0x00 reg_ep1_out_fifo = 0x01 reg_ep2_in_fifo = 0x02 reg_ep3_in_fifo = 0x03 reg_setup_data_fifo = 0x04 reg_ep0_byte_count = 0x05 reg_ep1_out_byte_count = 0x06 reg_ep2_in_byte_count = 0x07 reg_ep3_in_byte_count = 0x08 reg_ep_stalls = 0x09 reg_clr_togs = 0x0a reg_endpoint_irq = 0x0b reg_endpoint_interrupt_enable = 0x0c reg_usb_irq = 0x0d reg_usb_interrupt_enable = 0x0e reg_usb_control = 0x0f reg_cpu_control = 0x10 reg_pin_control = 0x11 reg_revision = 0x12 reg_function_address = 0x13 reg_io_pins = 0x14 # bitmask values for reg_endpoint_irq = 0x0b is_setup_data_avail = 0x20 # SUDAVIRQ is_in3_buffer_avail = 0x10 # IN3BAVIRQ is_in2_buffer_avail = 0x08 # IN2BAVIRQ is_out1_data_avail = 0x04 # OUT1DAVIRQ is_out0_data_avail = 0x02 # OUT0DAVIRQ is_in0_buffer_avail = 0x01 # IN0BAVIRQ # bitmask values for reg_usb_control = 0x0f usb_control_vbgate = 0x40 usb_control_connect = 0x08 # bitmask values for reg_pin_control = 0x11 interrupt_level = 0x08 full_duplex = 0x10 @classmethod def appropriate_for_environment(cls, backend_name): """ Determines if the current environment seems appropriate for using the GoodFET::MaxUSB backend. """ # Check: if we have a backend name other than greatfet, # the user is trying to use something else. Abort! if backend_name and backend_name != "goodfet": return False # If we're not explicitly trying to use something else, # see if there's a connected GreatFET. try: gf = GoodFETSerialPort() gf.close() return True except: return False def __init__(self, device=None, verbose=0): if device is None: serial = GoodFETSerialPort() device = Facedancer(serial, verbose=verbose) FacedancerApp.__init__(self, device, verbose) self.connected_device = None self.enable() if verbose > 0: rev = self.read_register(self.reg_revision) print(self.app_name, "revision", rev) # set duplex and negative INT level (from GoodFEDMAXUSB.py) self.write_register(self.reg_pin_control, self.full_duplex | self.interrupt_level) def init_commands(self): self.read_register_cmd = FacedancerCommand(self.app_num, 0x00, b'') self.write_register_cmd = FacedancerCommand(self.app_num, 0x00, b'') self.enable_app_cmd = FacedancerCommand(self.app_num, 0x10, b'') self.ack_cmd = FacedancerCommand(self.app_num, 0x00, b'\x01') def read_register(self, reg_num, ack=False): if self.verbose > 1: print(self.app_name, "reading register 0x%02x" % reg_num) self.read_register_cmd.data = bytearray([ reg_num << 3, 0 ]) if ack: self.read_register_cmd.data[0] |= 1 self.device.writecmd(self.read_register_cmd) resp = self.device.readcmd() if self.verbose > 2: print(self.app_name, "read register 0x%02x has value 0x%02x" % (reg_num, resp.data[1])) return resp.data[1] def write_register(self, reg_num, value, ack=False): if self.verbose > 2: print(self.app_name, "writing register 0x%02x with value 0x%02x" % (reg_num, value)) self.write_register_cmd.data = bytearray([ (reg_num << 3) | 2, value ]) if ack: self.write_register_cmd.data[0] |= 1 self.device.writecmd(self.write_register_cmd) self.device.readcmd() def get_version(self): return self.read_register(self.reg_revision) def ack_status_stage(self): if self.verbose > 5: print(self.app_name, "sending ack!") self.device.writecmd(self.ack_cmd) self.device.readcmd() def connect(self, usb_device): if self.read_register(self.reg_usb_control) & self.usb_control_connect: self.write_register(self.reg_usb_control, self.usb_control_vbgate) time.sleep(.1) self.write_register(self.reg_usb_control, self.usb_control_vbgate | self.usb_control_connect) self.connected_device = usb_device if self.verbose > 0: print(self.app_name, "connected device", self.connected_device.name) def disconnect(self): self.write_register(self.reg_usb_control, self.usb_control_vbgate) if self.verbose > 0: print(self.app_name, "disconnected device", self.connected_device.name) self.connected_device = None def clear_irq_bit(self, reg, bit): self.write_register(reg, bit) def read_bytes(self, reg, n): if self.verbose > 2: print(self.app_name, "reading", n, "bytes from register", reg) data = bytes([ (reg << 3) ] + ([0] * n)) cmd = FacedancerCommand(self.app_num, 0x00, data) self.device.writecmd(cmd) resp = self.device.readcmd() if self.verbose > 3: print(self.app_name, "read", len(resp.data) - 1, "bytes from register", reg) return resp.data[1:] def write_bytes(self, reg, data): data = bytes([ (reg << 3) | 3 ]) + data cmd = FacedancerCommand(self.app_num, 0x00, data) self.device.writecmd(cmd) self.device.readcmd() # null response if self.verbose > 3: print(self.app_name, "wrote", len(data) - 1, "bytes to register", reg) # HACK: but given the limitations of the MAX chips, it seems necessary def send_on_endpoint(self, ep_num, data): if ep_num == 0: fifo_reg = self.reg_ep0_fifo bc_reg = self.reg_ep0_byte_count elif ep_num == 2: fifo_reg = self.reg_ep2_in_fifo bc_reg = self.reg_ep2_in_byte_count elif ep_num == 3: fifo_reg = self.reg_ep3_in_fifo bc_reg = self.reg_ep3_in_byte_count else: raise ValueError('endpoint ' + str(ep_num) + ' not supported') # FIFO buffer is only 64 bytes, must loop while len(data) > 64: self.write_bytes(fifo_reg, data[:64]) self.write_register(bc_reg, 64, ack=True) data = data[64:] self.write_bytes(fifo_reg, data) self.write_register(bc_reg, len(data), ack=True) if self.verbose > 1: print(self.app_name, "wrote", bytes_as_hex(data), "to endpoint", ep_num) # HACK: but given the limitations of the MAX chips, it seems necessary def read_from_endpoint(self, ep_num): if ep_num != 1: return b'' byte_count = self.read_register(self.reg_ep1_out_byte_count) if byte_count == 0: return b'' data = self.read_bytes(self.reg_ep1_out_fifo, byte_count) if self.verbose > 1: print(self.app_name, "read", bytes_as_hex(data), "from endpoint", ep_num) return data def stall_ep0(self): if self.verbose > 0: print(self.app_name, "stalling endpoint 0") self.write_register(self.reg_ep_stalls, 0x23) def service_irqs(self): while True: irq = self.read_register(self.reg_endpoint_irq) if self.verbose > 3: print(self.app_name, "read endpoint irq: 0x%02x" % irq) if self.verbose > 2: if irq & ~ (self.is_in0_buffer_avail \ | self.is_in2_buffer_avail | self.is_in3_buffer_avail): print(self.app_name, "notable irq: 0x%02x" % irq) if irq & self.is_setup_data_avail: self.clear_irq_bit(self.reg_endpoint_irq, self.is_setup_data_avail) b = self.read_bytes(self.reg_setup_data_fifo, 8) if (irq & self.is_out0_data_avail) and (b[0] & 0x80 == 0x00): data_bytes_len = b[6] + (b[7] << 8) b += self.read_bytes(self.reg_ep0_fifo, data_bytes_len) req = USBDeviceRequest(b) self.connected_device.handle_request(req) if irq & self.is_out1_data_avail: data = self.read_from_endpoint(1) if data: self.connected_device.handle_data_available(1, data) self.clear_irq_bit(self.reg_endpoint_irq, self.is_out1_data_avail) if irq & self.is_in2_buffer_avail: self.connected_device.handle_buffer_available(2) if irq & self.is_in3_buffer_avail: self.connected_device.handle_buffer_available(3) class Facedancer: def __init__(self, serialport, verbose=0): self.serialport = serialport self.verbose = verbose self.reset() self.monitor_app = GoodFETMonitorApp(self, verbose=self.verbose) self.monitor_app.announce_connected() def halt(self): self.serialport.setRTS(1) self.serialport.setDTR(1) def reset(self): if self.verbose > 1: print("Facedancer resetting...") self.halt() self.serialport.setDTR(0) c = self.readcmd() if self.verbose > 0: print("Facedancer reset") def read(self, n): """Read raw bytes.""" b = self.serialport.read(n) if self.verbose > 3: print("Facedancer received", len(b), "bytes;", self.serialport.inWaiting(), "bytes remaining") if self.verbose > 2: print("Facedancer Rx:", bytes_as_hex(b)) return b def readcmd(self): """Read a single command.""" b = self.read(4) app = b[0] verb = b[1] n = b[2] + (b[3] << 8) if n > 0: data = self.read(n) else: data = b'' if len(data) != n: raise ValueError('Facedancer expected ' + str(n) \ + ' bytes but received only ' + str(len(data))) cmd = FacedancerCommand(app, verb, data) if self.verbose > 1: print("Facedancer Rx command:", cmd) return cmd def write(self, b): """Write raw bytes.""" if self.verbose > 2: print("Facedancer Tx:", bytes_as_hex(b)) self.serialport.write(b) def writecmd(self, c): """Write a single command.""" self.write(c.as_bytestring()) if self.verbose > 1: print("Facedancer Tx command:", c) class FacedancerCommand: def __init__(self, app=None, verb=None, data=None): self.app = app self.verb = verb self.data = data def __str__(self): s = "app 0x%02x, verb 0x%02x, len %d" % (self.app, self.verb, len(self.data)) if len(self.data) > 0: s += ", data " + bytes_as_hex(self.data) return s def long_string(self): s = "app: " + str(self.app) + "\n" \ + "verb: " + str(self.verb) + "\n" \ + "len: " + str(len(self.data)) if len(self.data) > 0: try: s += "\n" + self.data.decode("utf-8") except UnicodeDecodeError: s += "\n" + bytes_as_hex(self.data) return s def as_bytestring(self): n = len(self.data) b = bytearray(n + 4) b[0] = self.app b[1] = self.verb b[2] = n & 0xff b[3] = n >> 8 b[4:] = self.data return b class GoodFETMonitorApp(FacedancerApp): app_name = "GoodFET monitor" app_num = 0x00 def read_byte(self, addr): d = [ addr & 0xff, addr >> 8 ] cmd = FacedancerCommand(self.app_num, 2, d) self.device.writecmd(cmd) resp = self.device.readcmd() return resp.data[0] def get_infostring(self): return bytes([ self.read_byte(0xff0), self.read_byte(0xff1) ]) def get_clocking(self): return bytes([ self.read_byte(0x57), self.read_byte(0x56) ]) def print_info(self): infostring = self.get_infostring() clocking = self.get_clocking() print("MCU", bytes_as_hex(infostring, delim="")) print("clocked at", bytes_as_hex(clocking, delim="")) def list_apps(self): cmd = FacedancerCommand(self.app_num, 0x82, b'\x01') self.device.writecmd(cmd) resp = self.device.readcmd() print("build date:", resp.data.decode("utf-8")) print("firmware apps:") while True: resp = self.device.readcmd() if len(resp.data) == 0: break print(resp.data.decode("utf-8")) def echo(self, s): b = bytes(s, encoding="utf-8") cmd = FacedancerCommand(self.app_num, 0x81, b) self.device.writecmd(cmd) resp = self.device.readcmd() return resp.data == b def announce_connected(self): cmd = FacedancerCommand(self.app_num, 0xb1, b'') self.device.writecmd(cmd) resp = self.device.readcmd() def GoodFETSerialPort(**kwargs): "Return a Serial port using default values possibly overriden by caller" port = os.environ.get('GOODFET') or "/dev/ttyUSB0" args = dict(port=port, baudrate=115200, parity=serial.PARITY_NONE, timeout=2) args.update(kwargs) return serial.Serial(**args) class GoodFETMonitorApp(FacedancerApp): app_name = "GoodFET monitor" app_num = 0x00 def read_byte(self, addr): d = [ addr & 0xff, addr >> 8 ] cmd = FacedancerCommand(self.app_num, 2, d) self.device.writecmd(cmd) resp = self.device.readcmd() return resp.data[0] def get_infostring(self): return bytes([ self.read_byte(0xff0), self.read_byte(0xff1) ]) def get_clocking(self): return bytes([ self.read_byte(0x57), self.read_byte(0x56) ]) def print_info(self): infostring = self.get_infostring() clocking = self.get_clocking() print("MCU", bytes_as_hex(infostring, delim="")) print("clocked at", bytes_as_hex(clocking, delim="")) def list_apps(self): cmd = FacedancerCommand(self.app_num, 0x82, b'\x01') self.device.writecmd(cmd) resp = self.device.readcmd() print("build date:", resp.data.decode("utf-8")) print("firmware apps:") while True: resp = self.device.readcmd() if len(resp.data) == 0: break print(resp.data.decode("utf-8")) def echo(self, s): b = bytes(s, encoding="utf-8") cmd = FacedancerCommand(self.app_num, 0x81, b) self.device.writecmd(cmd) resp = self.device.readcmd() return resp.data == b def announce_connected(self): cmd = FacedancerCommand(self.app_num, 0xb1, b'') self.device.writecmd(cmd) resp = self.device.readcmd()
8189a0c96fcbf810e1ffb176471c230243b7b08c
014199954994aa5dbfc2cc0e736b5c7bade5aebd
/P5-Identify Fraud from Enron Dataset/poi_id_tester.py
d330f26cfd2608eee90bb80ead42a091ae4ab5ec
[]
no_license
ddaskan/Data-Analyst-Nanodegree
bfcff01d45029e37476d9c84d4ec29883efdcb8a
7f6fe8cecb6c6f2fd2cdcb5c141a0d68c58ea732
refs/heads/master
2021-01-17T14:02:34.019649
2017-11-22T00:47:12
2017-11-22T00:47:12
62,079,806
0
1
null
null
null
null
UTF-8
Python
false
false
14,171
py
#!/usr/bin/python criterion_l = ['gini','entropy'] #2 max_depth_l = [None, 2,5,10,20,50,100] #7 min_samples_split_l = [1,2,3,4,5] #5 min_samples_leaf_l = [1,2,3,4,5] #5 criterion_a = [] max_depth_a = [] min_samples_split_a = [] min_samples_leaf_a =[] recall_a =[] precision_a=[] f1_a=[] import csv f = open('outputs.csv', 'wb') writer = csv.writer(f) writer.writerow(["criterion","max_depth","min_samples_split","min_samples_leaf","recall","precision","f1"]) for criterion in criterion_l: for max_depth in max_depth_l: for min_samples_split in min_samples_split_l: for min_samples_leaf in min_samples_leaf_l: import numpy as np from sklearn.metrics import accuracy_score from time import time import sys import pickle sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit from tester import dump_classifier_and_data ### Task 1: Select what features you'll use. ### features_list is a list of strings, each of which is a feature name. ### The first feature must be "poi". features_list = ['poi','salary', 'deferral_payments', 'total_payments', 'loan_advances', 'bonus', 'restricted_stock_deferred', 'deferred_income', 'total_stock_value', 'expenses', 'exercised_stock_options', 'other', 'long_term_incentive', 'restricted_stock', 'director_fees', 'to_messages', 'from_poi_to_this_person', 'from_messages', 'from_this_person_to_poi', 'shared_receipt_with_poi'] # You will need to use more features ### Load the dictionary containing the dataset with open("final_project_dataset.pkl", "r") as data_file: data_dict = pickle.load(data_file) #print "\n---DATA EXPLORATION---" #print "Total Number of Data Points: " + str(len(data_dict)) poi_count = 0 for key, value in data_dict.items(): if data_dict[key]["poi"]: poi_count+=1 #print "POI: " + str(poi_count), "Non-POI: " + str(len(data_dict)-poi_count) total_missings = 0 for j in range(len(features_list)-1): missings = 0 for key, value in data_dict.items(): if data_dict[key][features_list[j+1]]=="NaN": missings +=1 total_missings += missings # print str(missings)+" missing values in "+str(features_list[j+1]) #print str(total_missings)+" total missing values in dataset for selected "+str(len(features_list)-1)+" features" #print "\n" + str(len(features_list)-1) + " features are;" sd_list = [] mean_list = [] for j in range(len(features_list)-1): # print features_list[j+1] temp_list = [] for key, value in data_dict.items(): if data_dict[key][features_list[j+1]]=="NaN": data_dict[key][features_list[j+1]]=0 temp_list.append(float(data_dict[key][features_list[j+1]])) # print "max: " + str(max(temp_list)) # print "min: " + str(min(temp_list)) # print "range: " + str(max(temp_list)-min(temp_list)) sd_list.append(np.std(temp_list)) # print "SD: " + str(np.std(temp_list)) mean_list.append(np.mean(temp_list)) # print "mean: " + str(np.mean(temp_list)) + "\n" ### Task 2: Remove outliers #print "\n---ROMOVING OUTLIERS---" sd_limit = 3 #data points to be kept in this sd range removal = 0 data_dict.pop("TOTAL", None) #print str(removal)+" outliers removed" #print "Total number of data points after removing outliers: " + str(len(data_dict)) ### Task 3: Create new feature(s) #print "\n---NEW FEATURES---" for key, val in data_dict.items(): if data_dict[key]['to_messages'] != 0: data_dict[key]['to_poi_ratio'] = data_dict[key]['from_poi_to_this_person']/float(data_dict[key]['to_messages']) else: data_dict[key]['to_poi_ratio'] = 0.0 if data_dict[key]['from_messages'] != 0: data_dict[key]['from_poi_ratio'] = data_dict[key][ 'from_this_person_to_poi']/float(data_dict[key]['from_messages']) else: data_dict[key]['from_poi_ratio'] = 0.0 features_list.append('to_poi_ratio') features_list.append('from_poi_ratio') #print "New features 'to_poi_ratio' and 'from_poi_ratio' are created" ### Store to my_dataset for easy export below. my_dataset = data_dict ### Extract features and labels from dataset for local testing data = featureFormat(my_dataset, features_list, sort_keys = True) labels, features = targetFeatureSplit(data) #print "\n---FEATURE SELECTION---" from sklearn.feature_selection import SelectKBest, f_classif k = 3 #best features to be chosen 3 #print "First values of features", features[0].shape, features[0] selector = SelectKBest(f_classif, k=k) features = selector.fit_transform(features, labels) #print "First values of best {} features".format(k), features.shape, features[0] chosen = np.asarray(features_list[1:])[selector.get_support()] #print selector.scores_ scores = selector.scores_ index = np.argsort(scores)[::-1] #print 'Feature Ranking: ' for i in range(len(features_list)-1): print "{}. feature {} ({})".format(i+1,features_list[index[i]+1],scores[index[i]]) print "Chosen ones: ", chosen ### Task 4: Try a varity of classifiers ### Please name your classifier clf for easy export below. ### Note that if you want to do PCA or other multi-stage operations, ### you'll need to use Pipelines. For more info: ### http://scikit-learn.org/stable/modules/pipeline.html # Provided to give you a starting point. Try a variety of classifiers. from sklearn.grid_search import GridSearchCV from sklearn.naive_bayes import GaussianNB from sklearn.svm import SVC from sklearn import tree from sklearn.ensemble import RandomForestClassifier from sklearn.metrics import make_scorer, f1_score #f1_scorer = make_scorer(f1_score, pos_label=1) #param_random = {'n_estimators': [1,2,3,5,10,100], 'max_features': range(1,k+1),'criterion': ['gini', 'entropy']} #bests are 1 for both #param_random = {'random_state': range(0,100)} #clf = GridSearchCV(RandomForestClassifier(random_state=4), param_random, scoring=f1_scorer) #clf = RandomForestClassifier(n_estimators=1, max_features=2, random_state=4) #param_svc = {'C': [1, 10, 100, 1e3, 1e4, 1e5], 'degree': [2,3,4],'gamma': [0.00001, 0.0001, 0.001, 0.01, 0.1]} #clf = GridSearchCV(SVC(kernel='rbf',random_state=42), param_svc, scoring=f1_scorer) #clf = SVC(kernel='poly', degree=4, C=1000) #because GridSearchCV(SVC(kernel='poly')) doesn't work #clf = RandomForestClassifier() #clf = SVC() #clf = GaussianNB() clf = tree.DecisionTreeClassifier(criterion=criterion, max_depth=max_depth, min_samples_split=min_samples_split, min_samples_leaf=min_samples_leaf) from sklearn import decomposition from sklearn.pipeline import Pipeline from sklearn.preprocessing import MinMaxScaler, MaxAbsScaler, Normalizer scaler = MinMaxScaler() pca = decomposition.PCA() classifier = tree.DecisionTreeClassifier() steps = [('features', scaler), ('pca', pca),('classify', classifier)] pipe = Pipeline(steps) #clf = GridSearchCV(pipe, dict(pca__n_components=[None,2,3], classify__min_samples_split=[2,6,10], # classify__criterion=['gini','entropy']), # scoring='f1') #clf = Pipeline([('features', scaler), ('pca', decomposition.PCA()),('classify', tree.DecisionTreeClassifier())]) #THE BEST ### Task 5: Tune your classifier to achieve better than .3 precision and recall ### using our testing script. Check the tester.py script in the final project ### folder for details on the evaluation method, especially the test_classifier ### function. Because of the small size of the dataset, the script uses ### stratified shuffle split cross validation. For more info: ### http://scikit-learn.org/stable/modules/generated/sklearn.cross_validation.StratifiedShuffleSplit.html # Example starting point. Try investigating other evaluation techniques! print "\n---CLASSIFIER---" from sklearn.cross_validation import train_test_split features_train, features_test, labels_train, labels_test = \ train_test_split(features, labels, test_size=0.3, random_state=42) t0 = time() reg = clf.fit(features_train, labels_train) print "training time:", round(time()-t0, 3), "s" try: best_params = clf.best_params_ print "Best parameters: ", best_params except: pass t1 = time() pred = clf.predict(features_test) print "predict time:", round(time()-t1, 3), "s" accuracy = accuracy_score(labels_test, pred) print "accuracy: " + str(accuracy) from sklearn.metrics import classification_report print classification_report(labels_test, pred) #print f1_score(labels_test, pred) try: print "\n---FEATURE IMPORTANCES---" try: #GridSearchCV + Pipeline if best_params['pca__n_components'] != None: n = best_params['pca__n_components'] #chosen PCA components else: n = k fit_pipeline = clf.best_estimator_ fit_clf = fit_pipeline.steps[-1][1] except: #Just Pipeline fit_clf = clf.steps[-1][1] n = k importances = fit_clf.feature_importances_ indices = np.argsort(importances)[::-1] print 'Feature Ranking: ' for i in range(n): print "{}. component ({})".format(i+1,importances[indices[i]]) except: pass ### Task 6: Dump your classifier, dataset, and features_list so anyone can ### check your results. You do not need to change anything below, but make sure ### that the version of poi_id.py that you submit can be run on its own and ### generates the necessary .pkl files for validating your results. chosen_list = chosen.tolist() chosen_list.insert(0, "poi") features_list = chosen_list dump_classifier_and_data(clf, my_dataset, features_list) import time time.sleep(0.5) import pickle import sys from sklearn.cross_validation import StratifiedShuffleSplit sys.path.append("../tools/") from feature_format import featureFormat, targetFeatureSplit PERF_FORMAT_STRING = "\ \tAccuracy: {:>0.{display_precision}f}\tPrecision: {:>0.{display_precision}f}\t\ Recall: {:>0.{display_precision}f}\tF1: {:>0.{display_precision}f}\tF2: {:>0.{display_precision}f}" RESULTS_FORMAT_STRING = "\tTotal predictions: {:4d}\tTrue positives: {:4d}\tFalse positives: {:4d}\ \tFalse negatives: {:4d}\tTrue negatives: {:4d}" CLF_PICKLE_FILENAME = "my_classifier.pkl" DATASET_PICKLE_FILENAME = "my_dataset.pkl" FEATURE_LIST_FILENAME = "my_feature_list.pkl" def dump_classifier_and_data(clf, dataset, feature_list): with open(CLF_PICKLE_FILENAME, "w") as clf_outfile: pickle.dump(clf, clf_outfile) with open(DATASET_PICKLE_FILENAME, "w") as dataset_outfile: pickle.dump(dataset, dataset_outfile) with open(FEATURE_LIST_FILENAME, "w") as featurelist_outfile: pickle.dump(feature_list, featurelist_outfile) def load_classifier_and_data(): with open(CLF_PICKLE_FILENAME, "r") as clf_infile: clf = pickle.load(clf_infile) with open(DATASET_PICKLE_FILENAME, "r") as dataset_infile: dataset = pickle.load(dataset_infile) with open(FEATURE_LIST_FILENAME, "r") as featurelist_infile: feature_list = pickle.load(featurelist_infile) return clf, dataset, feature_list ### load up student's classifier, dataset, and feature_list clf, dataset, feature_list = load_classifier_and_data() ### Run testing script data = featureFormat(dataset, feature_list, sort_keys = True) labels, features = targetFeatureSplit(data) cv = StratifiedShuffleSplit(labels, 1000, random_state = 42) true_negatives = 0 false_negatives = 0 true_positives = 0 false_positives = 0 for train_idx, test_idx in cv: features_train = [] features_test = [] labels_train = [] labels_test = [] for ii in train_idx: features_train.append( features[ii] ) labels_train.append( labels[ii] ) for jj in test_idx: features_test.append( features[jj] ) labels_test.append( labels[jj] ) ### fit the classifier using training set, and test on test set clf.fit(features_train, labels_train) predictions = clf.predict(features_test) for prediction, truth in zip(predictions, labels_test): if prediction == 0 and truth == 0: true_negatives += 1 elif prediction == 0 and truth == 1: false_negatives += 1 elif prediction == 1 and truth == 0: false_positives += 1 elif prediction == 1 and truth == 1: true_positives += 1 else: print "Warning: Found a predicted label not == 0 or 1." print "All predictions should take value 0 or 1." print "Evaluating performance for processed predictions:" break try: total_predictions = true_negatives + false_negatives + false_positives + true_positives accuracy = 1.0*(true_positives + true_negatives)/total_predictions precision = 1.0*true_positives/(true_positives+false_positives) recall = 1.0*true_positives/(true_positives+false_negatives) f1 = 2.0 * true_positives/(2*true_positives + false_positives+false_negatives) f2 = (1+2.0*2.0) * precision*recall/(4*precision + recall) print clf print PERF_FORMAT_STRING.format(accuracy, precision, recall, f1, f2, display_precision = 5) print RESULTS_FORMAT_STRING.format(total_predictions, true_positives, false_positives, false_negatives, true_negatives) print "" except: print "Got a divide by zero when trying out:", clf print "Precision or recall may be undefined due to a lack of true positive predicitons." criterion_a.append(criterion) max_depth_a.append(max_depth) min_samples_split_a.append(min_samples_split) min_samples_leaf_a.append(min_samples_leaf) recall_a.append(recall) precision_a.append(precision) f1_a.append(f1) writer.writerow([criterion,max_depth,min_samples_split,min_samples_leaf,recall,precision,f1]) print criterion_a, f1_a
23c7f7e88507efcf6850a3cbbcb67fda762ac0af
907f0ae2a3117fcc5fdfb99838f86063d665b231
/311_Service_Request_Analysis/src/model_training/TrainEvaluateAndSaveModelToDisk.py
550da8b98db3a99508e59558520a78789c42daed
[]
no_license
ManikHossain08/BigdataAnalytics-1
5f9d49438683f1918dc9d60f73251c09083401c1
cb5340ce98ee2a3f8eed0ffbbbbb5bb14a60a2cf
refs/heads/master
2022-04-25T09:51:08.126721
2020-04-19T21:48:46
2020-04-19T21:48:46
277,288,909
1
0
null
2020-07-05T11:36:14
2020-07-05T11:36:13
null
UTF-8
Python
false
false
10,176
py
# Python source script for Training, Evaluating and Saving the Model to disk. import os from pyspark.ml.evaluation import RegressionEvaluator from pyspark.ml.feature import VectorAssembler from pyspark.ml.regression import GBTRegressor from pyspark.ml.regression import LinearRegression from pyspark.ml.regression import RandomForestRegressor from pyspark.ml.tuning import ParamGridBuilder, CrossValidator from pyspark.sql.functions import when, col import Constants import Utilities as utilFor311 def directly_read_prepared_data(path): return utilFor311.init_spark().read.csv(path, inferSchema=True, header=True) def prepare_data_for_supervised_learning(nyc_311_df_supervised): nyc_311_df_supervised = nyc_311_df_supervised.drop('created_date') # Code to make categorical data into columns (Agenct, Borough, Complaint Type, Channel) agencies = nyc_311_df_supervised.select("Agency").distinct().rdd.flatMap(lambda x: x).collect() boroughs = nyc_311_df_supervised.select("Borough").distinct().rdd.flatMap(lambda x: x).collect() complain_types = nyc_311_df_supervised.select("complaint_type").distinct().rdd.flatMap(lambda x: x).collect() open_data_channel_types = nyc_311_df_supervised.select("open_data_channel_type").distinct().rdd.flatMap( lambda x: x).collect() # filling new column with value 1 if belong to particular category agencies_expr = [when(col("Agency") == ty, 1).otherwise(0).alias("e_AGENCY_" + ty) for ty in agencies] boroughs_expr = [when(col("Borough") == code, 1).otherwise(0).alias("e_BOROUGH_" + code) for code in boroughs] complain_types_expr = [when(col("complaint_type") == ty, 1).otherwise(0).alias("e_COMPLAIN_TYPE_" + ty) for ty in complain_types] open_data_channel_types_expr = [ when(col("open_data_channel_type") == code, 1).otherwise(0).alias("e_CHANNEL_TYPE_" + code) for code in open_data_channel_types] final_nyc_311_df_supervised = nyc_311_df_supervised.select("Creation_Month", "Creation_Day", "Creation_Hour", 'time_to_resolve_in_hrs', *agencies_expr + boroughs_expr + complain_types_expr + open_data_channel_types_expr) final_nyc_311_df_supervised = final_nyc_311_df_supervised.withColumn("Creation_Month", final_nyc_311_df_supervised.Creation_Month.cast( 'int')) final_nyc_311_df_supervised = final_nyc_311_df_supervised.withColumn("Creation_Day", final_nyc_311_df_supervised.Creation_Day.cast( 'int')) final_nyc_311_df_supervised = final_nyc_311_df_supervised.withColumn("Creation_Hour", final_nyc_311_df_supervised.Creation_Hour.cast( 'int')) final_nyc_311_df_supervised = final_nyc_311_df_supervised.withColumn("time_to_resolve_in_hrs", final_nyc_311_df_supervised.time_to_resolve_in_hrs.cast( 'double')) # Save new csv for prepared data to be used in model Learning # final_nyc_311_df_supervised.coalesce(1).write.format('com.databricks.spark.csv').save( # './311dataset/final_nyc_311_df_supervised.csv', header='true') return final_nyc_311_df_supervised # Feature vector def prepare_feature_vector(final_nyc_311_df_supervised): assembler = VectorAssembler( inputCols=['Creation_Month', 'Creation_Day', 'Creation_Hour', 'e_AGENCY_HPD', 'e_AGENCY_NYPD', 'e_AGENCY_DEP', 'e_AGENCY_DSNY', 'e_AGENCY_DOITT', 'e_BOROUGH_UNSPECIFIED', 'e_BOROUGH_BROOKLYN', 'e_BOROUGH_BRONX', 'e_BOROUGH_MANHATTAN', 'e_BOROUGH_STATEN ISLAND', 'e_COMPLAIN_TYPE_UNSANITARY CONDITION', 'e_COMPLAIN_TYPE_Illegal Parking', 'e_COMPLAIN_TYPE_Noise - Residential', 'e_COMPLAIN_TYPE_Noise - Commercial', 'e_COMPLAIN_TYPE_Water System', 'e_COMPLAIN_TYPE_Blocked Driveway', 'e_COMPLAIN_TYPE_HEAT/HOT WATER', 'e_COMPLAIN_TYPE_PAINT/PLASTER', 'e_COMPLAIN_TYPE_PAINT/PLASTER', 'e_COMPLAIN_TYPE_Noise', 'e_COMPLAIN_TYPE_Request Large Bulky Item Collection', 'e_COMPLAIN_TYPE_PLUMBING', 'e_COMPLAIN_TYPE_WATER LEAK', 'e_COMPLAIN_TYPE_Noise - Street/Sidewalk', 'e_CHANNEL_TYPE_MOBILE', 'e_CHANNEL_TYPE_UNKNOWN', 'e_CHANNEL_TYPE_OTHER', 'e_CHANNEL_TYPE_PHONE', 'e_CHANNEL_TYPE_ONLINE'], outputCol="features") output = assembler.transform(final_nyc_311_df_supervised) x = output.select("features", "time_to_resolve_in_hrs").withColumnRenamed("time_to_resolve_in_hrs", "label") return x def split_train_test_set(feature_vector_with_labels): return feature_vector_with_labels.randomSplit([0.8, 0.2], seed=12345) def train_and_evaluate_model(model, model_name, hyper_param_grid, evaluator, train, test): tvs = CrossValidator(estimator=model, estimatorParamMaps=hyper_param_grid, evaluator=evaluator, ) model = tvs.fit(train) predictions = model.transform(test) evaluate_and_save_model(model, model_name, predictions) def evaluate_and_save_model(model, model_name, predictions): op_string = "" if model_name == 'Linear Regressor': op_string = op_string + model_name + " Results on Training Data" + os.linesep op_string = op_string + "=======================================" + os.linesep op_string = op_string + "RootMeanSquared Error: " + str( model.bestModel.summary.rootMeanSquaredError) + os.linesep op_string = op_string + "R2: " + str(model.bestModel.summary.r2) + os.linesep op_string = op_string + "Best Regularization Parameter - " + str( model.bestModel._java_obj.getRegParam()) + os.linesep op_string = op_string + "Best MaxIteration Parameter - " + str( model.bestModel._java_obj.getMaxIter()) + os.linesep if model_name != 'Linear Regressor': op_string = op_string + "Feature Importance - " + str(model.bestModel.featureImportances) + os.linesep if model_name == 'Random Forest Regressor': op_string = op_string + "Best Number of Trees Parameter - " + str( model.bestModel.getNumTrees) + os.linesep op_string = op_string + "Decision Trees Created - " + str(model.bestModel.trees) + os.linesep op_string = op_string + "Decision Trees Weights - " + str(model.bestModel.treeWeights) + os.linesep if model_name == 'Gradient Boost Regressor': op_string = op_string + "Best MaxIteration Parameter - " + str( model.bestModel._java_obj.parent().getMaxIter()) + os.linesep op_string = op_string + "Number of Decision Trees - " + str(model.bestModel.getNumTrees) + os.linesep op_string = op_string + "Decision Trees Created - " + str(model.bestModel.trees) + os.linesep op_string = op_string + "Decision Trees Weights - " + str(model.bestModel.treeWeights) + os.linesep op_string = op_string + os.linesep op_string = op_string + model_name + " Results on Test Data" + os.linesep op_string = op_string + "=======================================" + os.linesep evaluator = RegressionEvaluator(labelCol="label", predictionCol="prediction", metricName="rmse") rmse_val = evaluator.evaluate(predictions) op_string = op_string + "RootMeanSquared Error: " + str(rmse_val) + os.linesep evaluator = RegressionEvaluator(labelCol="label", predictionCol="prediction", metricName="r2") r2 = evaluator.evaluate(predictions) op_string = op_string + "R2: " + str(r2) + os.linesep op_string = op_string + "20 Sample Records for Predictions" + os.linesep op_string = op_string + str(predictions.select("features", "label", "prediction").take(20)) + os.linesep filename = Constants.RESULTS_FOLDER_ANALYSIS_SUPERVISED_LEARNING + model_name + "Results.txt" if os.path.exists(filename): append_write = 'a' else: append_write = 'w' text_file = open(filename, append_write) text_file.write(op_string) text_file.close() save_model_to_disk(model, model_name) def save_model_to_disk(model, model_name): model.save(Constants.RESULTS_FOLDER_ANALYSIS_SUPERVISED_LEARNING + str(model_name)) def train_linear_regressor(feature_vector_with_labels): train, test = split_train_test_set(feature_vector_with_labels) lr = LinearRegression() # Prepare Parameter Grid for Hyperparameter Search hyperparam_grid = ParamGridBuilder() \ .addGrid(lr.regParam, [0.1, 0.01]) \ .addGrid(lr.maxIter, [100, 200, 300]) \ .build() train_and_evaluate_model(lr, 'Linear Regressor', hyperparam_grid, RegressionEvaluator(), train, test) def train_gradient_boost_regressor(feature_vector_with_labels): train, test = split_train_test_set(feature_vector_with_labels) gb = GBTRegressor() # Prepare Parameter Grid for Hyperparameter Search hyperparam_grid = ParamGridBuilder() \ .addGrid(gb.maxIter, [10, 20]) \ .build() train_and_evaluate_model(gb, 'Gradient Boost Regressor', hyperparam_grid, RegressionEvaluator(), train, test) def train_random_forest(feature_vector_with_labels): train, test = split_train_test_set(feature_vector_with_labels) rf = RandomForestRegressor() # Prepare Parameter Grid for Hyperparameter Search hyperparam_grid = ParamGridBuilder() \ .addGrid(rf.numTrees, [70, 120]) \ .build() train_and_evaluate_model(rf, 'Random Forest Regressor', hyperparam_grid, RegressionEvaluator(), train, test)
55aa9b8bc82e37c05b6799ae8227f00cbc43dbd1
5608c2f74f8f929a461100c54aa02184c3c0a6f2
/daemon/v2.0/ref/md01.py
97b2022ff84f64907275b7deeaeebbf0df09b6a8
[ "MIT" ]
permissive
vt-gs/tracking
c35c84cbb12d831a528f8cc5fd395fa05a3abf8c
4588b840e69c1042d8e3560da44012101389e271
refs/heads/master
2021-01-02T22:42:27.694620
2019-06-23T16:52:40
2019-06-23T16:52:40
99,374,669
0
0
null
null
null
null
UTF-8
Python
false
false
8,433
py
#!/usr/bin/env python ######################################### # Title: MD01 Controller Class # # Project: VTGS Tracking Daemon # # Version: 2.0 # # Date: May 27, 2016 # # Author: Zach Leffke, KJ4QLP # # Comment: Expanded version of the MD-01# # interface # ######################################### import socket import os import string import sys import time import threading from binascii import * from datetime import datetime as date class md01(object): def __init__ (self, ip, port, timeout = 1.0, retries = 2): self.ip = ip #IP Address of MD01 Controller self.port = port #Port number of MD01 Controller self.timeout = timeout #Socket Timeout interval, default = 1.0 seconds self.connected = False self.retries = retries #Number of times to attempt reconnection, default = 2 self.cmd_az = 0 #Commanded Azimuth, used in Set Position Command self.cmd_el = 0 #Commanded Elevation, used in Set Position command self.cur_az = 0 # Current Azimuth, in degrees, from feedback self.cur_el = 0 #Current Elevation, in degrees, from feedback self.ph = 10 # Azimuth Resolution, in pulses per degree, from feedback, default = 10 self.pv = 10 #Elevation Resolution, in pulses per degree, from feedback, default = 10 self.feedback = '' #Feedback data from socket self.stop_cmd = bytearray() #Stop Command Message self.status_cmd = bytearray() #Status Command Message self.set_cmd = bytearray() #Set Command Message for x in [0x57,0,0,0,0,0,0,0,0,0,0,0x0F,0x20]: self.stop_cmd.append(x) for x in [0x57,0,0,0,0,0,0,0,0,0,0,0x1F,0x20]: self.status_cmd.append(x) for x in [0x57,0,0,0,0,0x0a,0,0,0,0,0x0a,0x2F,0x20]: self.set_cmd.append(x) #PH=PV=0x0a, 0x0a = 10, BIG-RAS/HR is 10 pulses per degree def getTimeStampGMT(self): return str(date.utcnow()) + " GMT | " def utc_ts(self): return str(date.utcnow()) + " UTC | " def connect(self): #connect to md01 controller self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) #TCP Socket self.sock.settimeout(self.timeout) #set socket timeout #print self.getTimeStampGMT() + 'MD01 | Attempting to connect to MD01 Controller: ' + str(self.ip) + ' ' + str(self.port) try: self.sock.connect((self.ip, self.port)) time.sleep(0.1) self.connected = True return self.connected #upon connection, get status to determine current antenna position #self.get_status() except socket.error as msg: #print "Exception Thrown: " + str(msg) + " (" + str(self.timeout) + "s)" #print "Unable to connect to MD01 at IP: " + str(self.ip) + ", Port: " + str(self.port) #self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() self.connected = False return self.connected def disconnect(self): #disconnect from md01 controller #print self.getTimeStampGMT() + "MD01 | Attempting to disconnect from MD01 Controller" self.sock.shutdown(socket.SHUT_RDWR) self.sock.close() self.connected = False #print self.getTimeStampGMT() + "MD01 | Successfully disconnected from MD01 Controller" return self.connected def get_status(self): #get azimuth and elevation feedback from md01 if self.connected == False: #self.printNotConnected('Get MD01 Status') return self.connected,0,0 #return -1 bad status, 0 for az, 0 for el else: try: self.sock.send(self.status_cmd) self.feedback = self.recv_data() except socket.error as msg: #print "Exception Thrown: " + str(msg) + " (" + str(self.timeout) + "s)" #print "Closing socket, Terminating program...." self.sock.close() self.connected = False return self.connected, self.cur_az, self.cur_el self.convert_feedback() return self.connected, self.cur_az, self.cur_el #return 0 good status, feedback az/el def set_stop(self): #stop md01 immediately if self.connected == False: #self.printNotConnected('Set Stop') return self.connected, 0, 0 else: try: self.sock.send(self.stop_cmd) self.feedback = self.recv_data() except socket.error as msg: #print "Exception Thrown: " + str(msg) + " (" + str(self.timeout) + "s)" #print "Closing socket, Terminating program...." self.sock.close() self.connected = False return self.connected, self.cur_az, self.cur_el self.convert_feedback() return self.connected, self.cur_az, self.cur_el #return 0 good status, feedback az/el def set_position(self, az, el): #set azimuth and elevation of md01 self.cmd_az = az self.cmd_el = el self.format_set_cmd() if self.connected == False: #self.printNotConnected('Set Position') return self.connected else: try: self.sock.send(self.set_cmd) except socket.error as msg: #print "Exception Thrown: " + str(msg) #print "Closing socket, Terminating program...." self.sock.close() self.connected = False return self.connected def recv_data(self): #receive socket data feedback = '' while True: c = self.sock.recv(1) if hexlify(c) == '20': feedback += c break else: feedback += c #print hexlify(feedback) return feedback def convert_feedback(self): h1 = ord(self.feedback[1]) h2 = ord(self.feedback[2]) h3 = ord(self.feedback[3]) h4 = ord(self.feedback[4]) #print h1, h2, h3, h4 self.cur_az = (h1*100.0 + h2*10.0 + h3 + h4/10.0) - 360.0 self.ph = ord(self.feedback[5]) v1 = ord(self.feedback[6]) v2 = ord(self.feedback[7]) v3 = ord(self.feedback[8]) v4 = ord(self.feedback[9]) self.cur_el = (v1*100.0 + v2*10.0 + v3 + v4/10.0) - 360.0 self.pv = ord(self.feedback[10]) def format_set_cmd(self): #make sure cmd_az in range -180 to +540 if (self.cmd_az>540): self.cmd_az = 540 elif (self.cmd_az < -180): self.cmd_az = -180 #make sure cmd_el in range 0 to 180 if (self.cmd_el < 0): self.cmd_el = 0 elif (self.cmd_el>180): self.cmd_el = 180 #convert commanded az, el angles into strings cmd_az_str = str(int((float(self.cmd_az) + 360) * self.ph)) cmd_el_str = str(int((float(self.cmd_el) + 360) * self.pv)) #print target_az, len(target_az) #ensure strings are 4 characters long, pad with 0s as necessary if len(cmd_az_str) == 1: cmd_az_str = '000' + cmd_az_str elif len(cmd_az_str) == 2: cmd_az_str = '00' + cmd_az_str elif len(cmd_az_str) == 3: cmd_az_str = '0' + cmd_az_str if len(cmd_el_str) == 1: cmd_el_str = '000' + cmd_el_str elif len(cmd_el_str) == 2: cmd_el_str = '00' + cmd_el_str elif len(cmd_el_str) == 3: cmd_el_str = '0' + cmd_el_str #print target_az, len(str(target_az)), target_el, len(str(target_el)) #update Set Command Message self.set_cmd[1] = cmd_az_str[0] self.set_cmd[2] = cmd_az_str[1] self.set_cmd[3] = cmd_az_str[2] self.set_cmd[4] = cmd_az_str[3] self.set_cmd[5] = self.ph self.set_cmd[6] = cmd_el_str[0] self.set_cmd[7] = cmd_el_str[1] self.set_cmd[8] = cmd_el_str[2] self.set_cmd[9] = cmd_el_str[3] self.set_cmd[10] = self.pv def printNotConnected(self, msg): print self.getTimeStampGMT() + "MD01 | Cannot " + msg + " until connected to MD01 Controller."
19a3b65be08b376dc24bc7b118d95c2e558b66bc
2f87f95bbaa7d50dd55b19af9db586f28d22642b
/backendProject/wsgi.py
1cb07a7cf4b525748964dab01e04b29457d12ee5
[]
no_license
willyborja95/ApiPaginaWeb
0bf136961c320a5edca4f857d95bac1d316db09b
dda607cda39fe3d4aaceb40d63bc20b91ebb6efd
refs/heads/master
2022-12-11T05:32:12.160881
2022-12-08T15:04:09
2022-12-08T15:04:09
215,600,253
2
0
null
2022-12-08T15:10:16
2019-10-16T16:59:35
Python
UTF-8
Python
false
false
405
py
""" WSGI config for backendProject project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backendProject.settings') application = get_wsgi_application()
28723cb937b34795b48c1c71972d6c845fb27609
509c2b7376c31464bb8ee8e95825aab7b93de2a9
/predict.py
b69030b470b9e2cad35243732fc667c720682340
[ "MIT" ]
permissive
leeheewon-cocen/Infra_Meditact_Meditact
b7f3f10f5afd32570ed10343ab42b72c2d650ea2
de61d1f41b4898b737f9628cbff1ac2791456de6
refs/heads/master
2023-05-15T05:40:02.850246
2021-05-31T14:29:19
2021-05-31T14:29:19
null
0
0
null
null
null
null
UTF-8
Python
false
false
867
py
from flask import Flask, request, jsonify from flask.json import JSONEncoder from flask_cors import CORS, cross_origin import keras import api app = Flask(__name__) app.config['JSON_AS_ASCII'] = False CORS(app) #@app.route("/", methods =['POST']) @app.route("/", methods =['GET']) def model(): #----------------------------- TODO: reading user input json and extract sentence payload = request.json #----------------------------- #input_features = api.preprocess_sentence("다리가 진짜 아파요") input_features = api.preprocess_sentence(payload['conversation']) model = keras.models.load_model('model_FINAL.h5', compile = False) result = { 'model name': 'work', 'api ver': '1.0', 'predict result': str(api.get_result(model.predict(input_features))) , } return jsonify(result)
[ "jonghyeon_rw@meditact-nlp-api.us-central1-a.c.meditact-nlp-808.internal" ]
jonghyeon_rw@meditact-nlp-api.us-central1-a.c.meditact-nlp-808.internal
7fb56335a0cf7e623ae6eb4f38657b038e0dd0ad
1bd9ac8457a46e2203ba735383a4f86da37193cb
/backbone/backbone.py
baa11e843e28fee0bbd229a83ca33bb56b490889
[ "MIT" ]
permissive
liuch37/tanet-pytorch
79d102a820d9d690dfd871fda5df15b8c636c5c8
2514b3d2fd28f821167367689595ef2d69fe8726
refs/heads/master
2022-12-21T04:52:59.836498
2020-09-28T05:41:09
2020-09-28T05:41:09
294,836,870
0
0
null
null
null
null
UTF-8
Python
false
false
5,067
py
''' This code is to construct backbone network for 13 layers of customized ResNet. ''' import torch import torch.nn as nn __all__ = ['basicblock','backbone'] class basicblock(nn.Module): def __init__(self, depth_in, output_dim, kernel_size, stride): super(basicblock, self).__init__() self.identity = nn.Identity() self.conv_res = nn.Conv2d(depth_in, output_dim, kernel_size=1, stride=1) self.batchnorm_res = nn.BatchNorm2d(output_dim) self.conv1 = nn.Conv2d(depth_in, output_dim, kernel_size=kernel_size, stride=stride, padding=1) self.conv2 = nn.Conv2d(output_dim, output_dim, kernel_size=kernel_size, stride=stride, padding=1) self.batchnorm1 = nn.BatchNorm2d(output_dim) self.batchnorm2 = nn.BatchNorm2d(output_dim) self.relu1 = nn.ReLU(inplace=True) self.relu2 = nn.ReLU(inplace=True) self.depth_in = depth_in self.output_dim = output_dim def forward(self, x): # create shortcut path if self.depth_in == self.output_dim: residual = self.identity(x) else: residual = self.conv_res(x) residual = self.batchnorm_res(residual) out = self.conv1(x) out = self.batchnorm1(out) out = self.relu1(out) out = self.conv2(out) out = self.batchnorm2(out) out += residual out = self.relu2(out) return out class backbone(nn.Module): def __init__(self, input_dim): super(backbone, self).__init__() self.conv1 = nn.Conv2d(input_dim, 64, kernel_size=3, stride=1, padding=1) self.batchnorm1 = nn.BatchNorm2d(64) self.relu1 = nn.ReLU(inplace=True) self.conv2 = nn.Conv2d(64, 128, kernel_size=3, stride=1, padding=1) self.batchnorm2 = nn.BatchNorm2d(128) self.relu2 = nn.ReLU(inplace=True) self.maxpool1 = nn.MaxPool2d(kernel_size=2, stride=2) # Block 1 starts self.basicblock1 = basicblock(128, 256, kernel_size=3, stride=1) # Block 1 ends self.conv3 = nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1) self.batchnorm3 = nn.BatchNorm2d(256) self.relu3 = nn.ReLU(inplace=True) self.maxpool2 = nn.MaxPool2d(kernel_size=2, stride=2) # Block 2 starts self.basicblock2 = basicblock(256, 256, kernel_size=3, stride=1) self.basicblock3 = basicblock(256, 256, kernel_size=3, stride=1) # Block 2 ends self.conv4 = nn.Conv2d(256, 256, kernel_size=3, stride=1, padding=1) self.batchnorm4 = nn.BatchNorm2d(256) self.relu4 = nn.ReLU(inplace=True) self.maxpool3 = nn.MaxPool2d(kernel_size=(1,2), stride=(1,2)) # Block 5 starts self.basicblock4 = basicblock(256, 512, kernel_size=3, stride=1) self.basicblock5 = basicblock(512, 512, kernel_size=3, stride=1) self.basicblock6 = basicblock(512, 512, kernel_size=3, stride=1) self.basicblock7 = basicblock(512, 512, kernel_size=3, stride=1) self.basicblock8 = basicblock(512, 512, kernel_size=3, stride=1) # Block 5 ends self.conv5 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1) self.batchnorm5 = nn.BatchNorm2d(512) self.relu5 = nn.ReLU(inplace=True) # Block 3 starts self.basicblock9 = basicblock(512, 512, kernel_size=3, stride=1) self.basicblock10 = basicblock(512, 512, kernel_size=3, stride=1) self.basicblock11 = basicblock(512, 512, kernel_size=3, stride=1) # Block 3 ends self.conv6 = nn.Conv2d(512, 512, kernel_size=3, stride=1, padding=1) self.batchnorm6 = nn.BatchNorm2d(512) self.relu6 = nn.ReLU(inplace=True) def forward(self, x): x = self.conv1(x) x = self.batchnorm1(x) x = self.relu1(x) x = self.conv2(x) x = self.batchnorm2(x) x = self.relu2(x) x = self.maxpool1(x) x = self.basicblock1(x) x = self.conv3(x) x = self.batchnorm3(x) x = self.relu3(x) x = self.maxpool2(x) x = self.basicblock2(x) x = self.basicblock3(x) x = self.conv4(x) x = self.batchnorm4(x) x = self.relu4(x) x = self.maxpool3(x) x = self.basicblock4(x) x = self.basicblock5(x) x = self.basicblock6(x) x = self.basicblock7(x) x = self.basicblock8(x) x = self.conv5(x) x = self.batchnorm5(x) x = self.relu5(x) x = self.basicblock9(x) x = self.basicblock10(x) x = self.basicblock11(x) x = self.conv6(x) x = self.batchnorm6(x) x = self.relu6(x) return x # unit test if __name__ == '__main__': batch_size = 32 Height = 48 Width = 160 Channel = 3 input_images = torch.randn(batch_size,Channel,Height,Width) model = backbone(Channel) output_features = model(input_images) print("Input size is:",input_images.shape) print("Output feature map size is:",output_features.shape)
828624b6a0bd565af050bba8f33e9056adbcecb7
7ac271f357f4c8f0c23c697b11966259f836880f
/app/web/api/dvdrental/actors/views.py
c01616606759e970c7df14c53e3b08550a941cdf
[]
no_license
cheng93/PythonWeb
74a58eadee4ee7d2872a582a907bbf47630df371
d5ced8dee1d5ba31778125c5e67169c92acf26a0
refs/heads/develop
2021-01-19T23:59:11.315871
2018-03-04T19:26:18
2018-03-04T19:26:18
89,063,916
0
0
null
2018-03-04T19:26:19
2017-04-22T11:09:14
Python
UTF-8
Python
false
false
865
py
from pyramid.view import view_defaults, view_config @view_defaults(renderer='json', request_method='GET') class ActorsView: def __init__(self, request): self.request = request @view_config(route_name='get_actors') def get_actors(self): actors = self.request.actor_command.get_actors() actors = [a.__dict__ for a in actors] return actors @view_config(route_name='get_actor') def get_actor(self): actor_id = self.request.matchdict['actor_id'] actor = self.request.actor_command.get_actor(actor_id) return actor.__dict__ @view_config(route_name='get_actor_films') def get_actor_films(self): actor_id = self.request.matchdict['actor_id'] films = self.request.actor_command.get_actor_films(actor_id) films = [f.__dict__ for f in films] return films
14a1b5e38215dfa16c907a767374fa41b3ce0b93
cd24bac9380e4ed0fd7782b5386f4e9e5b0910ad
/components/google-cloud/tests/experimental/remote/gcp_launcher/test_launcher.py
ea996b8a502b66db0eb608bb407aeee05f370fc3
[ "Apache-2.0", "BSD-3-Clause", "MIT", "BSD-2-Clause" ]
permissive
Ravenp87/pipelines
4a026834d152f032fb406bbaf3b2caaa88ee894c
4195963c4c7418d65c30d367311baa998e2fd470
refs/heads/master
2023-08-03T09:49:57.088233
2021-09-18T04:31:58
2021-09-18T04:31:58
405,197,026
0
0
NOASSERTION
2021-09-16T03:21:37
2021-09-10T19:51:29
Python
UTF-8
Python
false
false
2,412
py
# Copyright 2021 The Kubeflow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """Test Vertex AI Launcher Client module.""" import unittest from unittest import mock from google_cloud_pipeline_components.experimental.remote.gcp_launcher import launcher import google_cloud_pipeline_components class LauncherUtilsTests(unittest.TestCase): def setUp(self): super(LauncherUtilsTests, self).setUp() self._input_args = [ "--type", "CustomJob", "--project", "test_project", "--location", "us_central1", "--payload", "test_payload", "--gcp_resources", "test_file_path/test_file.txt", "--extra_arg", "extra_arg_value" ] self._payload = '{"display_name": "ContainerComponent", "job_spec": {"worker_pool_specs": [{"machine_spec": {"machine_type": "n1-standard-4"}, "replica_count": 1, "container_spec": {"image_uri": "google/cloud-sdk:latest", "command": ["sh", "-c", "set -e -x\\necho \\"$0, this is an output parameter\\"\\n", "{{$.inputs.parameters[\'input_text\']}}", "{{$.outputs.parameters[\'output_value\'].output_file}}"]}}]}}' self._project = 'test_project' self._location = 'test_region' self._gcp_resouces_path = 'gcp_resouces' self._type = 'CustomJob' @mock.patch.object( google_cloud_pipeline_components.experimental.remote.gcp_launcher. custom_job_remote_runner, "create_custom_job", autospec=True ) def test_launcher_on_custom_job_type_calls_custom_job_remote_runner( self, mock_custom_job_remote_runner ): launcher.main(self._input_args) mock_custom_job_remote_runner.assert_called_once_with( type='CustomJob', project='test_project', location='us_central1', payload='test_payload', gcp_resources='test_file_path/test_file.txt' )
8e2dc094d1635731d8f8c38eeebbb6adfe82ad2c
fea5dbaf406b5a93f0854befe080d886d59c13c0
/restaurant/views.py
2fedb02164af3df745c16b5244a88321014e75e5
[]
no_license
Little-Pr1nce/The_project_of_summercamp
634a2faf0fcce2f420fca10b958b513af51a61c5
a81996deafaff415cc329f277eb215d76b3c9704
refs/heads/master
2020-03-24T06:51:07.402947
2018-07-27T07:34:30
2018-07-27T07:34:30
142,544,318
0
0
null
null
null
null
UTF-8
Python
false
false
5,319
py
from django.shortcuts import render, reverse from django.urls import reverse_lazy from django.http import HttpResponseRedirect # Create your views here. from .models import Dish, Bill, ServerComment def index(request): """显示餐馆的主页""" if request.method != 'POST': # 如果顾客只是查看这个主页 # 选出种类是food的菜品 dishes_food = Dish.objects.filter(kind='food') # 选出种类是drinks的菜品 dishes_drinks = Dish.objects.filter(kind='drinks') # 选出种类是salads的菜品 dishes_salads = Dish.objects.filter(kind='salads') # 得到对餐厅的评论,最新的三条 # 首先计算数据库里有几条评论 number = 0 a = ServerComment.objects.all() for b in a: number = number + 1 # 从数据库的尾部得到最新的三条评论 server_comments = ServerComment.objects.all()[number - 3:number] comments = [] for comment in server_comments: comments.append(comment) comment1 = comments[0] comment2 = comments[1] comment3 = comments[2] content = {'dishes_food': dishes_food, 'dishes_drinks': dishes_drinks, 'dishes_salads': dishes_salads, 'comment1': comment1, 'comment2': comment2, 'comment3': comment3} return render(request, 'restaurant/index.html', content) else: # 客户输入自己的桌号查看自己的账单 table = request.POST['table'] return HttpResponseRedirect(reverse('restaurant:bill', args=table)) def dish_detail(request, dish_id): """显示单个菜品的详细信息,并且可以点菜""" # 根据从url得到的id来的到对应的菜品 dish = Dish.objects.get(id=dish_id) # 得到对应菜品的图片路径,并且string化 dish_path = str(dish.picture) if request.method != 'POST': # 如果用户不是提交点菜的相关信息,就显示菜品的详细信息 content = {'dish': dish, 'dish_path': dish_path} return render(request, 'restaurant/dish.html', content) else: # 用户提交数据 table = request.POST['table'] # 客户的桌号 number = request.POST['number'] # 客户点了几道这个菜 require = request.POST['require'] # 客户对这道菜的要求 """在模型里面设置了dish_name为主键,所以即使再次提交需求也可以覆盖之前的信息,保证了客户可以更改点菜要求的功能""" price = int(number) * int(dish.price) bill = Bill(dish_name=dish.name, dish_number=number, dish_table=table, dish_require=require, dish_price=str(price), dish_id=dish.id) bill.save() # 把点的菜保存到bill里 return HttpResponseRedirect(reverse_lazy('restaurant:index')) def get_bill(request, table): """显示用户点的菜,并且用户可以去结账""" # 如果客户只是查看这个页面 if request.method != 'POST': # 得到所有点过的菜品 bills = Bill.objects.filter(dish_table=table) price = 0 for dish in bills: # 计算总价 price = price + int(dish.dish_price) content = {'bills': bills, 'price': price, 'table': table} return render(request, 'restaurant/bill.html', content) else: # 用户要结账,就清空bill这个表,并且更新销量信息 bills = Bill.objects.filter(dish_table=table) # 得到整个账单 # 获取账单里面一道菜的信息,得到菜名和点菜数量 for bill in bills: # 通过菜品的名字得到一道菜,但是名字不是主键有可能得到很多相同的菜品,所以要用for来得到单个菜品,但是菜名也是一个主键 dishes = Dish.objects.filter(name=bill.dish_name) for dish in dishes: dish.sale = dish.sale + bill.dish_number dish.save() bills.delete() return HttpResponseRedirect(reverse_lazy('restaurant:evaluation')) def service_evaluation(request): """用户服务进行评论""" # 顾客访问这个页面 if request.method != 'POST': return render(request, 'restaurant/comment.html') else: # 客户提交评价,然后跳转到主页 comment = request.POST['comment'] serve_comment = ServerComment(comment=comment) serve_comment.save() return HttpResponseRedirect(reverse_lazy('restaurant:index')) def graph_food(request): """根据数据库的数据绘制图表""" dishes_food = Dish.objects.filter(kind='food') content = {'dishes_food': dishes_food} return render(request, 'restaurant/graph_food.html', content) def graph_salads(request): """根据数据库的数据绘制图表""" dishes_salads = Dish.objects.filter(kind='salads') content = {'dishes_salads': dishes_salads} return render(request, 'restaurant/graph_salads.html', content) def graph_drinks(request): """根据数据库的数据绘制图表""" dishes_drinks = Dish.objects.filter(kind='drinks') content = {'dishes_drinks': dishes_drinks} return render(request, 'restaurant/graph_drinks.html', content)
dc07e10ef638298141ad655475063b1d466b7bd6
adbf09a31415e6cf692ff349bd908ea25ded42a8
/challenges/custm_error.py
6588a2c0db988b4e09b75f6b79a1402a21026bb8
[]
no_license
cmulliss/gui_python
53a569f301cc82b58880c3c0b2b415fad1ecc3f8
6c83d8c2e834464b99024ffd8cf46ac4e734e7a4
refs/heads/main
2023-08-12T22:33:01.596005
2021-10-11T12:35:41
2021-10-11T12:35:41
408,176,101
0
0
null
null
null
null
UTF-8
Python
false
false
945
py
class TooManyPagesReadError(ValueError): pass class Book: def __init__(self, name: str, page_count: int): self.name = name self.page_count = page_count self.pages_read = 0 def __repr__(self): return ( f"<Book {self.name}, read {self.pages_read} pages out of {self.page_count}>" ) def read(self, pages: int): if self.pages_read + pages > self.page_count: raise TooManyPagesReadError( f"You tried to read {self.pages_read + pages} pages, but this book only has {self.page_count} pages." ) self.pages_read += pages print(f"You have now read {self.pages_read} pages out of {self.page_count}") python101 = Book("Python 101", 50) try: python101.read(35) python101.read(50) except TooManyPagesReadError as e: print(e) # This now raises an error, which has a helpful name and a helpful error message.
0231d5a6b9754525fcc80fa184b2442b8c4d82d2
b449980703b2234e5610d20d22d54cb811722b68
/netdisco/discoverables/nanoleaf_aurora.py
135d785a425446491b59ae18c63cdcf06bf42dd8
[ "Apache-2.0" ]
permissive
bdraco/netdisco
81209c0ad21b2ca124b91fa67799034c337d62a8
cf547a8bac673f5aa92cde98824929fc9a31f05b
refs/heads/master
2023-06-17T09:40:18.001345
2020-06-17T21:23:05
2020-06-17T21:23:05
275,917,535
0
0
NOASSERTION
2020-06-29T20:20:12
2020-06-29T20:20:12
null
UTF-8
Python
false
false
278
py
"""Discover Nanoleaf Aurora devices.""" from . import MDNSDiscoverable class Discoverable(MDNSDiscoverable): """Add support for discovering Nanoleaf Aurora devices.""" def __init__(self, nd): super(Discoverable, self).__init__(nd, '_nanoleafapi._tcp.local.')
25164cbffde1974a5c531b3dfc519310cb45c313
334d0a4652c44d0c313e11b6dcf8fb89829c6dbe
/checkov/terraform/checks/resource/kubernetes/ImageDigest.py
92de4c65bc61d761b0e9ee2ee9f999bd465db7c8
[ "Apache-2.0" ]
permissive
schosterbarak/checkov
4131e03b88ae91d82b2fa211f17e370a6f881157
ea6d697de4de2083c8f6a7aa9ceceffd6b621b58
refs/heads/master
2022-05-22T18:12:40.994315
2022-04-28T07:44:05
2022-04-28T07:59:17
233,451,426
0
0
Apache-2.0
2020-03-23T12:12:23
2020-01-12T20:07:15
Python
UTF-8
Python
false
false
1,563
py
from checkov.common.models.enums import CheckCategories, CheckResult from checkov.terraform.checks.resource.base_resource_check import BaseResourceCheck class ImageDigest(BaseResourceCheck): def __init__(self): """ The image specification should use a digest instead of a tag to make sure the container always uses the same version of the image. https://kubernetes.io/docs/concepts/configuration/overview/#container-images An admission controller could be used to enforce the use of image digest """ name = "Image should use digest" id = "CKV_K8S_43" supported_resources = ["kubernetes_pod"] categories = [CheckCategories.GENERAL_SECURITY] super().__init__(name=name, id=id, categories=categories, supported_resources=supported_resources) def scan_resource_conf(self, conf) -> CheckResult: spec = conf.get('spec')[0] if spec: containers = spec.get("container") for idx, container in enumerate(containers): if not isinstance(container, dict): return CheckResult.UNKNOWN if container.get("image") and isinstance(container.get("image"), list): name = container.get("image")[0] if "@" not in name: self.evaluated_keys = [f'spec/[0]/container/[{idx}]/image'] return CheckResult.FAILED return CheckResult.PASSED return CheckResult.FAILED check = ImageDigest()
860f042f856a8c132e5a1047a93a5f3de2798a0a
371725092b1f8778fb530a07c3a5c91140435380
/godfather/roles/town/vigilante.py
b65f23a6370f2308c1c2ad1f864f207066a4540e
[ "MIT" ]
permissive
melodicht/tvm-bot
e616b2f4674fdb64a216085447371e15bfe74878
a9c0ece0ae04c4c52c96ddd36012bee96474d524
refs/heads/master
2022-11-17T02:05:08.708718
2020-07-11T04:51:37
2020-07-11T04:51:37
275,153,408
0
0
null
2020-06-26T12:42:09
2020-06-26T12:42:09
null
UTF-8
Python
false
false
1,457
py
from godfather.roles.mixins import SingleAction, Shooter DESCRIPTION = 'You may shoot someone every night. If you shoot a townie, you will die of guilt the next night.' class Vigilante(SingleAction, Shooter): def __init__(self): super().__init__(name='Vigilante', role_id='vig', description=DESCRIPTION) self.guilty = False self.bullets = 3 # vigs only get 3 shots async def on_night(self, bot, player, game): if self.guilty: await player.user.send('You threw away your gun in guilt.') game.night_actions.add_action({ 'action': self.action, 'player': player, 'target': player, 'priority': 3 }) else: await super().on_night(bot, player, game) def can_do_action(self, _game): if self.guilty: return False, '' if self.bullets <= 0: return False, 'You ran out of bullets!' return True, '' async def after_action(self, player, target, night_record): record = night_record[target.user.id]['nightkill'] success = record['result'] and player in record['by'] if success and target.faction.id == 'town': self.guilty = True if not success: return await player.user.send('Your target was too strong to kill!') await target.user.send('You were shot by a Vigilante. You have died!')
4485c5cf11f59565b40a8d538af812f0554de596
ca7aa979e7059467e158830b76673f5b77a0f5a3
/Python_codes/p03089/s906755257.py
498b64bddcd6ad6dac9dc95de7a88f6376c3de4f
[]
no_license
Aasthaengg/IBMdataset
7abb6cbcc4fb03ef5ca68ac64ba460c4a64f8901
f33f1c5c3b16d0ea8d1f5a7d479ad288bb3f48d8
refs/heads/main
2023-04-22T10:22:44.763102
2021-05-13T17:27:22
2021-05-13T17:27:22
367,112,348
0
0
null
null
null
null
UTF-8
Python
false
false
293
py
N = int(input()) B = list(map(int, input().split())) ans = [] for i in range(N): last = 0 for j, b in enumerate(B, 1): if b == j: last = b if last == 0: print(-1) exit() else: ans.append(B.pop(last - 1)) [print(a) for a in ans[::-1]]
bfbc466ace7b86629605e60e2a490ecfd6f6aa04
d5a2a52ef41fa337efe98963a87a5e032729d28e
/lab02/lab02_extra.py
ab77c985bbadef83853bb7302c536f8f779249bd
[]
no_license
hadonlml/cs61a
dbfb871fcfe080e358a9ffdaedcd0d260a8c0554
03ccf9ba09b619d18fd515e123fc9062f90c1c46
refs/heads/main
2023-06-25T07:27:23.186597
2021-07-23T13:46:20
2021-07-23T13:46:20
385,963,582
0
0
null
null
null
null
UTF-8
Python
false
false
3,355
py
""" Optional problems for lab02 """ from lab02 import * # Higher Order Functions def compose1(f, g): """Return the composition function which given x, computes f(g(x)). >>> add_one = lambda x: x + 1 # adds one to x >>> square = lambda x: x**2 >>> a1 = compose1(square, add_one) # (x + 1)^2 >>> a1(4) 25 >>> mul_three = lambda x: x * 3 # multiplies 3 to x >>> a2 = compose1(mul_three, a1) # ((x + 1)^2) * 3 >>> a2(4) 75 >>> a2(5) 108 """ return lambda x: f(g(x)) def composite_identity(f, g): """ Return a function with one parameter x that returns True if f(g(x)) is equal to g(f(x)). You can assume the result of g(x) is a valid input for f and vice versa. >>> add_one = lambda x: x + 1 # adds one to x >>> square = lambda x: x**2 >>> b1 = composite_identity(square, add_one) >>> b1(0) # (0 + 1)^2 == 0^2 + 1 True >>> b1(4) # (4 + 1)^2 != 4^2 + 1 False """ "*** YOUR CODE HERE ***" def composite(x): if compose1(f, g)(x) == compose1(g, f)(x): return True else: return False return composite def count_cond(condition): """Returns a function with one parameter N that counts all the numbers from 1 to N that satisfy the two-argument predicate function Condition, where the first argument for Condition is N and the second argument is the number from 1 to N. >>> count_factors = count_cond(lambda n, i: n % i == 0) >>> count_factors(2) # 1, 2 2 >>> count_factors(4) # 1, 2, 4 3 >>> count_factors(12) # 1, 2, 3, 4, 6, 12 6 >>> is_prime = lambda n, i: count_factors(i) == 2 >>> count_primes = count_cond(is_prime) >>> count_primes(2) # 2 1 >>> count_primes(3) # 2, 3 2 >>> count_primes(4) # 2, 3 2 >>> count_primes(5) # 2, 3, 5 3 >>> count_primes(20) # 2, 3, 5, 7, 11, 13, 17, 19 8 """ "*** YOUR CODE HERE ***" def count_f(n) : i, count = 1, 0 while i <= n: if condition(n, i): count += 1 i += 1 return count return count_f def cycle(f1, f2, f3): """Returns a function that is itself a higher-order function. >>> def add1(x): ... return x + 1 >>> def times2(x): ... return x * 2 >>> def add3(x): ... return x + 3 >>> my_cycle = cycle(add1, times2, add3) >>> identity = my_cycle(0) >>> identity(5) 5 >>> add_one_then_double = my_cycle(2) >>> add_one_then_double(1) 4 >>> do_all_functions = my_cycle(3) >>> do_all_functions(2) 9 >>> do_more_than_a_cycle = my_cycle(4) >>> do_more_than_a_cycle(2) 10 >>> do_two_cycles = my_cycle(6) >>> do_two_cycles(1) 19 """ "*** YOUR CODE HERE ***" def highest_cycle(x): i = 0 fx = lambda t: t while i <= x: if i % 3 == 1: f = f1 fx = compose1(f, fx) elif i % 3 == 2: f = f2 fx = compose1(f, fx) elif i != 0 and i % 3 == 0: f = f3 fx = compose1(f, fx) i += 1 return fx return highest_cycle
067cd5718df564dae5abae24c119820c0c3d3c99
a14e6f45574ce5f2b887373f2528f90d5e0bc3bc
/KeepPCAwake.py
c28ecbda5b03241918167213a9928aaaa042d04b
[]
no_license
vpineda7/KeepPCAwake
738908d1d945610531c572eb6d57c55200522e36
5988e0dc3e696074672d6dda0106d22b34e20f78
refs/heads/master
2021-10-09T01:29:09.342828
2018-12-19T21:19:42
2018-12-19T21:19:42
null
0
0
null
null
null
null
UTF-8
Python
false
false
584
py
import ctypes ES_CONTINUOUS = 0x80000000 ES_SYSTEM_REQUIRED = 0x00000001 # CONTINUOUS repeats the action until the application closes, # SYSTEM_REQUIRED 'forces the system to be in the working state by resetting the system idle timer.' ctypes.windll.kernel32.SetThreadExecutionState(ES_CONTINUOUS | ES_SYSTEM_REQUIRED) # wait until broken while True: # attempt to run the following code try: # try needs some code as an argument, so I just added a zero. 0 except(KeyboardInterrupt): # catch a Ctrl+C break # stop waiting
6d5164b4d436b1e2a6ea87ec954b7e4dcc4046d8
ec31ad285b607a7b67146f45468b90731da38db8
/b2llvm/loadbxml.py
89cd2dc19777c828e9de5824d7189947baed5b6e
[]
no_license
DavidDeharbe/b2llvm
b4792f47bac500254d2317ad20566c562b413f40
219d7a4a66eaeb15749c72207b5a1eb62fff91e1
refs/heads/master
2021-01-23T22:05:41.559226
2014-12-19T15:02:44
2014-12-19T15:02:44
22,607,644
3
1
null
null
null
null
UTF-8
Python
false
false
34,187
py
"""Module providing functions to load a BXML file into a Python AST. This module is responsible for providing functions to load a BXML file and build the corresponding Python abstract syntax tree, using the format and the constructors found in file "ast.py". We use the xml.etree.ElementTree library See http://docs.python.org/2/library/xml.etree.elementtree.html 1. General design The translation recurses over the tree. There is one function for each kind of node. When different kinds of node are possible (for instance, where a substitution is expected) an additional dispatcher function is responsible for identifying the actual type of node, by looking at the XML tag. 2. Symbol table Most of the recursive traversal of the tree requires as parameter a symbol table. Such symbol table are provided by class SymbolTable that use a Python dictionary, where the keys are strings, and the values are the Python representation of the corresponding B symbol. I expect that no name conflict occurs in the input XML. Nevertheless, the inclusion in the symbol table is done through method add, which checks there is no such conflict. The elements stored into the symbol table are: - concrete variables - concrete constants/values - imports: name of import is mapped to ast import node - operations: name of operation is mapped to ast operation node - operation parameters - local variables When entering a new scope (e.g. an operation, or a VAR...IN substitution), a copy of the symbol table is created, and the local symbols are added to that copy. 3. Associative operators Expressions consisting of the application of an associative operator to more than two arguments are represented as a nested application of a binary application, associated to the left. For instance a + b + c would be represented as ((a + b) + c). 4. Symbol table(s) symast is a traditional symbol table where the keys are identifier strings and the values the AST node of the corresponding B entity. When the loader enters a new scope, it creates a new symbol table initialized with a copy of the inherited table. symimp is a special symbol table to handle imports - For imports with prefix, the entry in symimp has as key the prefix and as value the import clause. - For imports without prefix, there is one entry in symimp for each visible symbol of the imported machine, and the key is the identifier of the symbol and the value is the import clause. In both cases, the key is a string and the value an AST node. 5. References [LRM] B Language Reference Manual, version 1.8.6. Clearsy. """ import os import xml.etree.ElementTree as ET import b2llvm.ast as ast import b2llvm.cache as cache from b2llvm.bproject import BProject ### # # error handling # ### class Report(object): """Rudimentary error handling.""" def __init__(self): """Constructor""" self._error_nb = 0 self._warn_nb = 0 def error(self, message): """Outputs error message and increments error count.""" self._error_nb += 1 print("error: " + message) def warn(self, message): """Outputs warning message and increments warning count.""" self._warn_nb += 1 print("warning: " + message) ### # # global variables # ### _LOADING = set() _LOG = Report() # # MODULE ENTRY POINTS # def load_project(dirname='bxml', filename='project.xml'): ''' Keywords: - dirname: path to directory where bxml files are stored; default value is 'bxml'. - filename: the name of a bproject.bxml file. The default value is 'bproject.bxml'. Loads the contents of the given file, if it exists, into global variable project_db. If the file does not exist, then project_db is left empty, i.e. a pair formed by an empty dictionary and an empty set. ''' return BProject(dirname+os.sep+filename) def load_module(dirname, project, machine): ''' Inputs: - dirname: string with path to directory where B modules are stored - project: BProject object storing current project settings - machine: string with machine name Output: Root AST node for the representation of m. ''' if not project.has(machine): _LOG.error("cannot find machine " + machine + " in project file.") raise Exception("resource not found") loaded = cache.Cache() if project.is_base(machine): return load_base_machine(dirname, loaded, machine) else: assert project.is_developed(machine) return load_developed_machine(dirname, project, loaded, machine) ### # # modules # ### def load_base_machine(dirname, loaded, machine): ''' Loads B base machine from file to Python AST. Parameters: - dirname - loaded: cache from identifiers to root AST machine. - machine: the name of a B machine. Result: A Python representation of the B machine. Output: The routine prints to stdout error messages and warnings; at the end it reports the number of errors and warnings detected and printed during the execution. ''' global _LOADING, _LOG if loaded.has(id): return loaded.get(id) if machine in _LOADING: _LOG.error("there seems to be a recursive dependency in imports") _LOADING.add(machine) # symbol table: symbol to AST node symast = SymbolTable() symimp = SymbolTable() tree = ET.parse(path(dirname, machine)) root = tree.getroot() assert root.tag == 'Machine' assert root.get("type") == "abstraction" sets = [] constants = load_values(root, symast) variables = load_concrete_variables(root, symast) operations = load_operations(root, symast, symimp) pymachine = ast.make_base_machine(machine, sets, constants, variables, operations) symast.clear() symimp.clear() _LOADING.remove(machine) loaded.set(machine, pymachine) return pymachine def load_developed_machine(dirname, project, loaded, machine): ''' Loads BXML a developed machine from file to Python AST. All dependent components are loaded, including implementations of developed machines. Parameters: - dirname: the directory where the project files are stored - project: project settings object - loaded: cache from identifiers to root AST machine. - machine: the name of a developed B machine Result: A Python representation of the B machine Output: The routine prints to stdout error messages and warnings; at the end it reports the number of errors and warnings detected and printed during the execution. ''' global _LOG if loaded.has(machine): return loaded.get(machine) if machine in _LOADING: _LOG.error("there seems to be a recursive dependency in imports") _LOADING.add(machine) if not project.has(machine): _LOG.error("machine " + machine + " not found in project settings") return None if not project.is_developed(machine): _LOG.error("machine " + machine + " is not a developed machine.") return None tree = ET.parse(path(dirname, machine)) root = tree.getroot() assert root.tag == 'Machine' assert root.get("type") == "abstraction" assert name_attr(root) == machine sets = [] impl_id = project.implementation(machine) pyimpl = load_implementation(dirname, project, loaded, impl_id) pymachine = ast.make_developed_machine(machine, sets, pyimpl) pyimpl["machine"] = pymachine _LOADING.remove(machine) loaded.set(machine, pymachine) return pymachine def load_implementation(dirname, project, loaded, module): ''' Loads B implementation to Python AST. Parameters: - dirname: the directory where BXML files are to be found - project: the object representing the B project settings. - loaded: cache from identifiers to root AST machine. - module: the identifier of the implementation Result: A Python representation of the B implementation, or None if some error occured. Output: The routine prints to stdout error messages and warnings; at the end it reports the number of errors and warnings detected and printed during the execution. ''' global _LOG if loaded.has(module): return loaded.get(module) if module in _LOADING: _LOG.error("there seems to be a recursive dependency in imports") symast = SymbolTable() symast.add("BOOL", ast.BOOL) symast.add("INTEGER", ast.INTEGER) symimp = SymbolTable() _LOADING.add(module) tree = ET.parse(path(dirname, module)) root = tree.getroot() assert root.tag == 'Machine' assert root.get("type") == "implementation" impl_name = name_attr(root) assert impl_name == module imports = load_imports(root, symast, symimp, dirname, project, loaded) sets = load_sets(root, symast) constants = load_values(root, symast) variables = load_concrete_variables(root, symast) initialisation = load_initialisation(root, symast, symimp) operations = load_operations(root, symast, symimp) symast.clear() symimp.clear() pyimpl = ast.make_implementation(impl_name, imports, sets, constants, variables, initialisation, operations) _LOADING.remove(module) loaded.set(module, pyimpl) return pyimpl ### # # machine clauses # ### def load_imports(root, symast, symimp, dirname, project, loaded): ''' Parameters: - root: XML ElementTree representing the root of an implementation - symast: a symbol table - c: cache from identifiers to root AST machine. Result: List of import AST nodes. Side effects: All externally visible elements of the imported modules are added to the symbol table. All the named imports are added to the symbol table. ''' imports = root.find("./Imports") if imports == None: return [] imports = [load_import(i, symast, dirname, project, loaded) for i in imports.findall("./Referenced_Machine")] # Add visible symbols from imported machines ([LRM, Appendix C.10]) acc = [] # store machines that have already been processed for pyimp in imports: pymach = pyimp["mach"] if pymach not in acc: for symbol in visible_symbols(pymach): symast.add(symbol["id"], symbol) acc.append(pymach) if pyimp["pre"] != None: symimp.add(pyimp["pre"], pyimp) else: for symbol in visible_symbols(pymach): symimp.add(symbol["id"], pyimp) return imports def load_import(xmlimp, symast, dirname, project, loaded): ''' Loads one import clause to Python AST and update symbol table. Parameters: - xmlimp: a BXML tree element for an import. - symast: symbol table. - c: cache from identifiers to root AST machine. Result: A Python AST node representing the import clause. Side effects: If the import clause has a prefix, then it is added to the symbol table, together with the result node. ''' global _LOG module = xmlimp.find("./Name").text if not project.has(module): _LOG.error("machine "+module+" not found in project settings") return None if project.is_developed(module): mach = load_developed_machine(dirname, project, loaded, module) else: mach = load_base_machine(dirname, loaded, module) instance = xmlimp.find("./Instance") if instance != None: pyimp = ast.make_import(mach, instance.text) symast.add(instance.text, pyimp) else: pyimp = ast.make_import(mach) return pyimp def load_sets(root, symast): """Loads SETS clause to Python AST and updates symbol table.""" xmlsets = root.findall("./Sets/Set") result = [] for xmlset in xmlsets: name = value(xmlset.find("Identifier")) xmlelements = xmlset.findall("Enumerated_Values/Identifier") elements = [] for ex in xmlelements: ename = value(ex) epyval = ast.make_enumerated(ename) symast.add(ename, epyval) elements.append(epyval) pyval = ast.make_enumeration(name, elements) symast.add(name, pyval) result.append(pyval) return result def load_values(root, symast): """Loads VALUES clause to Python AST and updates symbol table.""" xmlvals = root.findall("./Values/Valuation") result = [] for xmlval in xmlvals: value_id = ident(xmlval) children = xmlval.findall("./*") assert len(children) == 1 xmlexp = children[0] value_exp = load_exp(xmlexp, symast) value_type = load_type(xmlexp, symast) pyval = ast.make_const(value_id, value_type, value_exp) result.append(pyval) symast.add(value_id, pyval) return result def load_concrete_variables(elem, symast): ''' Input: - elem: the BXML tree root node of a B implementation - symat: the symbol table used in abstract syntax tree Output: A Python dict mapping variable identifier (strings) to the Python representation for the concrete variables in the B implementation. ''' xmlvars = elem.findall("./Concrete_Variables/Identifier") xmlinv = elem.findall(".//Invariant//Expression_Comparison[@operator=':']") result = [] for xmlvar in xmlvars: asttype = load_type(xmlvar, symast) if asttype == None : asttype = get_inv_type(xmlvar,xmlinv) assert asttype != None name = value(xmlvar) astvar = ast.make_imp_var(name, asttype) symast.add(name, astvar) result.append(astvar) return result def load_initialisation(elem, symast, symimp): """Loads the XML child for initialisation to an AST node.""" initialisation = elem.find("./Initialisation") if initialisation == None: return [] xmlsubst = initialisation.find("./*") return [ load_sub(xmlsubst, symast, symimp) ] def load_operations(elem, symast, symimp): """Loads all XML elements for operations to a list of AST nodes.""" operations = elem.findall(".//Operation") return [load_operation(op, symast, symimp) for op in operations] def load_operation(elem, symast, symimp): """Loads an XML element for an operation to an AST node.""" assert elem.tag == "Operation" name = name_attr(elem) body = elem.find("./Body/*") inputs = elem.findall("./Input_Parameters/Identifier") outputs = elem.findall("./Output_Parameters/Identifier") symast2 = symast.copy() p_inputs = [ load_parameter(param, symast2) for param in inputs ] p_outputs = [ load_parameter(param, symast2) for param in outputs ] p_body = load_sub(body, symast2, symimp) symast2.clear() return ast.make_oper(name, p_inputs, p_outputs, p_body) def load_parameter(elem, symast): """Loads an XML element for an operation parameter to an AST node.""" name = value(elem) pytype = load_type(elem, symast) astnode = ast.make_arg_var(name, pytype) symast.add(name, astnode) return astnode ### # # substitutions # ### def load_sub(elem, symast, symimp): ''' Inputs: - elem: a XML node representing a B0 substitution - symast: symbol table as Python dictionary mapping strings to Python nodes Output: Python node representing the substitution n ''' global _LOG if elem.tag == "Bloc_Substitution": astnode = load_block_substitution(elem, symast, symimp) elif elem.tag == "Skip": astnode = load_skip(elem) elif elem.tag == "Assert_Substitution": astnode = load_assert_substitution(elem) elif elem.tag == "If_Substitution": astnode = load_if_substitution(elem, symast, symimp) elif elem.tag == "Affectation_Substitution": astnode = load_becomes_eq(elem, symast) elif elem.tag == "Case_Substitution": astnode = load_case_substitution(elem, symast, symimp) elif elem.tag == "VAR_IN": astnode = load_var_in(elem, symast, symimp) elif elem.tag == "Binary_Substitution": astnode = load_binary_substitution(elem, symast, symimp) elif elem.tag == "Nary_Substitution": astnode = load_nary_substitution(elem, symast, symimp) elif elem.tag == "Operation_Call": astnode = load_operation_call(elem, symast, symimp) elif elem.tag == "While": astnode = load_while(elem, symast, symimp) elif elem.tag == "Becomes_In": astnode = load_becomes_in(elem, symast) elif elem.tag in {"Choice_Substitution", "Becomes_Such_That", "Select_Substitution", "ANY_Substitution", "LET_Substitution"}: _LOG.error("unexpected substitution: " + elem.tag) astnode = ast.make_skip() else: _LOG.error("unrecognized substitution: " + elem.tag) astnode = ast.make_skip() return astnode def load_block_substitution(elem, symast, symimp): """Load an XML element for a block substitution to an AST node.""" assert elem.tag == "Bloc_Substitution" substs = [ load_sub(s, symast, symimp) for s in elem.findall("./*") ] return ast.make_blk(substs) def load_skip(elem): """Load an XML element for a SKIP substitution to an AST node.""" assert elem.tag == "Skip" return ast.make_skip() def load_assert_substitution(elem): """Load an XML element for a ASSERT substitution to an AST node.""" global _LOG assert elem.tag == "Assert_Substitution" _LOG.warn("assertion replaced by skip") return ast.make_skip() def load_if_substitution(elem, symast, symimp): """Load an XML element for a IF substitution to an AST node.""" global _LOG assert elem.tag == "If_Substitution" if elem.get("elseif") != None: _LOG.error("unrecognized elseif attribute in IF substitution") return ast.make_skip() xmlcond = elem.find("./Condition") xmlthen = elem.find("./Then") xmlelse = elem.find("./Else") pycond = load_boolean_expression(xmlcond.find("./*"), symast) pythen = load_sub(xmlthen.find("./*"), symast, symimp) thenbr = ast.make_if_br(pycond, pythen) if xmlelse == None: return ast.make_if([thenbr]) else: pyelse = load_sub(xmlelse.find("./*"), symast, symimp) elsebr = ast.make_if_br(None, pyelse) return ast.make_if([thenbr, elsebr]) def load_becomes_eq(elem, symast): """Load an XML element for a becomes equal substitution to an AST node.""" global _LOG assert elem.tag == "Affectation_Substitution" lhs = elem.findall("./Variables/*") rhs = elem.findall("./Values/*") if len(lhs) != 1 or len(rhs) != 1: _LOG.error("unsupported multiple becomes equal substitution") return ast.make_skip() dst = load_exp(lhs[0], symast) src = load_exp(rhs[0], symast) return ast.make_beq(dst, src) def load_becomes_in(elem, symast): """Load an XML element for a becomes in substitution to an AST node.""" assert elem.tag == "Becomes_In" lhs = elem.findall("./Variables/*") dst = [ load_exp(x, symast) for x in lhs ] return ast.make_bin(dst) def load_case_branch(elem, symast, symimp): """Load an XML element for a case branch to an AST node.""" return ast.make_case_br(load_exp(elem.find("./Value/*"), symast), load_sub(elem.find("./Then/*"), symast, symimp)) def load_case_default(elem, symast, symimp): """Load an XML element for a case default branch to an AST node.""" return ast.make_case_br(None, load_sub(elem.find("./Choice/Then/*"), symast, symimp)) def load_case_substitution(node, symast, symimp): """Load an XML element for a case substitution to an AST node.""" assert node.tag == "Case_Substitution" xmlexpr = node.find("./Value/*") xmlbranches = node.findall("./Choices/Choice") xmlelse = node.find("./Else") pyexpr = load_exp(xmlexpr, symast) pybranches = [ load_case_branch(x, symast, symimp) for x in xmlbranches ] if xmlelse != None: pybranches.append(load_case_default(xmlelse, symast, symimp)) return ast.make_case(pyexpr, pybranches) def load_var_in(node, symast, symimp): """Load an XML element for a variable declaration to an AST node.""" assert node.tag == "VAR_IN" xmlvars = node.findall("./Variables/Identifier") xmlbody = node.find("./Body") symast2 = symast.copy() pyvars = [] for xmlvar in xmlvars: name = value(xmlvar) pytype = load_type(xmlvar, symast) pyvar = ast.make_loc_var(name, pytype) symast2.add(name, pyvar) pyvars.append(pyvar) pybody = [ load_sub(xmlbody.find("./*"), symast2, symimp) ] symast2.clear() return ast.make_var_decl(pyvars, pybody) def load_binary_substitution(node, symast, symimp): """Load an XML element for a binary substitution to an AST node.""" global _LOG assert node.tag == "Binary_Substitution" oper = operator(node) if oper == "||": _LOG.error("parallel substitution cannot be translated") return ast.make_skip() elif oper == ";": left = node.find("./Left") right = node.find("./Right") return [load_sub(left, symast, symimp), load_sub(right, symast, symimp)] else: _LOG.error("unrecognized binary substitution") return ast.make_skip() def load_nary_substitution(node, symast, symimp): """Load an XML element for a nary substitution to an AST node.""" global _LOG assert node.tag == "Nary_Substitution" oper = operator(node) if oper == "||": _LOG.error("parallel substitution cannot be translated") return ast.make_skip() elif oper == ";": substs = node.findall("./*") return ast.make_blk([load_sub(sub, symast, symimp) for sub in substs]) else: _LOG.error("unrecognized n-ary substitution") return ast.make_skip() def load_operation_call(node, symast, symimp): """Load an XML element for an operation call to an AST node.""" assert node.tag == "Operation_Call" xmlname = node.find("./Name/*") # Operation from import w/o prefix: # <Identifier value='get'> # Operation from import w prefix: # <Identifier value='hh.get' instance='hh' component='get'> xmlout = node.findall("./Output_Parameters/*") xmlinp = node.findall("./Input_Parameters/*") astout = [ load_identifier(x, symast) for x in xmlout ] astinp = [ load_identifier(x, symast) for x in xmlinp ] instance = xmlname.get('instance') if instance == None: name = value(xmlname) else: name = xmlname.get('component') astop = symast.get(name) # operation is from a directly imported module if name in symimp.keys(): impo = symimp.get(name) return ast.make_call(astop, astinp, astout, impo) # operation is from a prefixed imported module elif instance in symimp.keys(): impo = symimp.get(instance) return ast.make_call(astop, astinp, astout, impo) # operation is local else: return ast.make_call(astop, astinp, astout) def load_while(node, symast, symimp): """Load an XML element for a while instruction to an AST node.""" assert node.tag == "While" xmlcond = node.find("./Condition/*") xmlbody = node.find("./Body/*") pycond = load_boolean_expression(xmlcond, symast) pybody = load_sub(xmlbody, symast, symimp) return ast.make_while(pycond, [pybody]) ### # # expressions # ### def load_exp(node, symast): """Load an XML element for an expression to an AST node.""" global _LOG if node.tag == "Binary_Expression": pynode = load_binary_expression(node, symast) elif node.tag == "Nary_Expression": pynode = load_nary_expression(node, symast) elif node.tag == "Unary_Expression": pynode = load_unary_expression(node, symast) elif node.tag == "Boolean_Litteral": pynode = load_boolean_literal(node) elif node.tag == "Integer_Litteral": pynode = load_integer_literal(node) elif node.tag == "Identifier": pynode = load_identifier(node, symast) elif node.tag == "Boolean_Expression": pynode = load_boolean_expression(node, symast) elif node.tag in {"EmptySet", "EmptySeq", "Quantified_Expression", "Quantified_Set", "String_Litteral", "Struct", "Record"}: _LOG.error("unexpected expression " + node.tag) pynode = None else: _LOG.error("unknown expression " + node.tag) pynode = None return pynode def load_identifier(node, symast): """Load an XML element for an identifier to an AST node.""" return symast.get(value(node)) def load_boolean_literal(node): """Load an XML element for an Boolean literal to an AST node.""" global _LOG assert node.tag == "Boolean_Litteral" if value(node) == "TRUE": return ast.TRUE elif value(node) == "FALSE": return ast.FALSE else: _LOG.error("unknown boolean literal") def load_integer_literal(node): """Load an XML element for an integer literal to an AST node.""" assert node.tag == "Integer_Litteral" return ast.make_intlit(int(value(node))) def setup_expression(node, handlers): """Preprocesses a XML expression node. Returns a handler to apply to the results of loading the expression arguments, and the list of the XML elements representing the expression arguments. """ global _LOG fun = operator(node) if fun not in handlers.keys(): _LOG.error("unexpected operator " + fun) return None return handlers[fun], discard_attributes(node) def load_unary(node, symast, tag, table): """Load an XML element for a unary to an AST node.""" assert node.tag == tag fun, xmlargs = setup_expression(node, table) assert len(xmlargs) == 1 pyarg = load_exp(xmlargs[0], symast) return fun(pyarg) def load_binary(node, symast, tag, table): """Load an XML element for a binary to an AST node.""" assert node.tag == tag fun, xmlargs = setup_expression(node, table) assert len(xmlargs) == 2 pyargs = [ load_exp(xmlarg, symast) for xmlarg in xmlargs ] return fun(pyargs[0], pyargs[1]) def load_nary(node, symast, tag, table): """Load an XML element for a nary to an AST node.""" assert node.tag == tag fun, xmlargs = setup_expression(node, table) assert len(xmlargs) >= 2 pyargs = [ load_exp(xmlarg, symast) for xmlarg in xmlargs ] return list_combine_ltr(pyargs, fun) def load_unary_expression(node, symast): """Load an XML element for a unary expression to an AST node.""" return load_unary(node, symast, "Unary_Expression", {"pred":ast.make_pred, "succ":ast.make_succ}) def load_binary_expression(node, symast): """Load an XML element for a binary expression to an AST node.""" return load_binary(node, symast, "Binary_Expression", {"+":ast.make_sum, "-":ast.make_diff, "*":ast.make_prod,"(":ast.make_arrayItem}) def load_nary_expression(node, symast): """Load an XML element for a nary expression to an AST node.""" return load_nary(node, symast, "Nary_Expression", {"+":ast.make_sum, "*":ast.make_prod}) def load_binary_predicate(node, symast): """Load an XML element for a binary predicate to an AST node.""" return load_binary(node, symast, "Binary_Predicate", {"&":ast.make_and, "or":ast.make_or}) def load_unary_predicate(node, symast): """Load an XML element for a unary predicate to an AST node.""" return load_unary(node, symast, "Unary_Predicate", {"not":ast.make_not}) def load_nary_predicate(node, symast): """Load an XML element for a nary predicate to an AST node.""" assert node.tag == "Nary_Predicate" fun, xmlargs = setup_expression(node, {"&":ast.make_and, "or":ast.make_or}) assert len(xmlargs) >= 2 pyargs = [ load_boolean_expression(arg, symast) for arg in xmlargs ] return list_combine_ltr(pyargs, fun) def load_expression_comparison(node, symast): """Load an XML element for a comparison to an AST node.""" return load_binary(node, symast, "Expression_Comparison", {"=": ast.make_eq, "/=": ast.make_neq, ">": ast.make_gt, ">=": ast.make_ge, "<": ast.make_lt, "<=": ast.make_le}) def load_boolean_expression(node, symast): """Load an XML element for a Boolean expression to an AST node.""" global _LOG if node.tag == "Binary_Predicate": return load_binary_predicate(node, symast) elif node.tag == "Expression_Comparison": return load_expression_comparison(node, symast) elif node.tag == "Unary_Predicate": return load_unary_predicate(node, symast) elif node.tag == "Nary_Predicate": return load_nary_predicate(node, symast) elif node.tag in {"Quantified_Predicate", "Set"}: _LOG.error("unexpected boolean expression" + node.tag) return None else: _LOG.error("unknown boolean expression " + node.tag) return None ### # # symbol table stuff # ### class SymbolTable(object): """Class for symbol tables.""" def __init__(self): """Constructor. Prefills with MAXINT.""" self._table = dict() self._table["MAXINT"] = ast.MAXINT def __str__(self): """Converts object to string.""" return "{"+",".join([key for key in self._table.keys()])+"}" def add(self, name, node): """Adds an element, checking if there is a conflict.""" if name in self._table: _LOG.error("name clash ("+name+")") self._table[name] = node def rem(self, name): """Removes an element, checking if it is present.""" if name not in self._table.keys(): _LOG.error(name+"not found in table") self._table.pop(name) def get(self, name): """Gets an element (i.e. an AST node) from its name.""" if name not in self._table.keys(): _LOG.error(name+"not found in table") return self._table[name] def clear(self): """Empties the symbol table.""" self._table.clear() def copy(self): """Creates a copy.""" result = SymbolTable() result._table = self._table.copy() return result def keys(self): """Returns symbol table keys.""" return self._table.keys() ### # # bxml shortcuts # ### def ident(node): ''' Returns the value of an XML element "ident" attribute. Return type is string, or None if there is no such attribute. ''' return node.get("ident") def value(node): ''' Returns the value of an XML element "value" attribute. Return type is string, or None if there is no such attribute. ''' return node.get("value") def operator(node): ''' Returns the value of an XML element "operator" attribute. Return type is string, or None if there is no such attribute. ''' return node.get("operator") def name_attr(node): ''' Returns the value of an XML element "name" attribute. Return type is string, or None if there is no such attribute. ''' return node.get("name") ### # # general-purpose accumulators # ### def list_combine_ltr(some_list, some_fun): ''' Inputs: - some_list: a list - f: a binary function defined on the elements of l Output: Left-to-right application of f to the elements of l. Example: some_list = [ 'a', 'b', 'c' ] some_fun = lambda x, y: '(' + x + '+' + y + ')' list_combine_ltr(some_list, f) --> '((a+b)+c)' ''' result = some_list[0] for idx in range(1, len(some_list)): result = some_fun(result, some_list[idx]) return result ### # # utilities # ### def get_inv_type(xmlid, xmlinv): ''' Input: - xmlid: a XML node representing an identifier - xmlinv: a XML node Output: - The right node that define the variable type ''' for xmlinvElem in xmlinv: varName = xmlinvElem[0].get("value") if (varName == xmlid.get("value")): elem = xmlinvElem break assert elem != None function = elem[1] if (function.get("operator")=="-->"): domxml = function[0] ranxml = function[1] res = ast.make_arrayType(domxml,ranxml) assert res != None return res def load_type(xmlid, symast): ''' Input: - xmlid: a XML node representing an identifier Output: - AST node representing the type for xmlid Note: - Assumes that the XML attribute TypeInfo exists and is an identifier with the name of the type. ''' return symast.get(value(xmlid.find("./Attributes/TypeInfo/Identifier"))) def discard_attributes(exp): ''' Inputs: - exp: a bxml expression node Output: All the bxml children node that are not tagged as "Attributes" Note: The nodes discarded by this function usually contain the typing information of the expression. ''' return [child for child in exp.findall("./*") if child.tag != "Attributes"] def visible_symbols(machine): ''' List of symbols defined in m that are externally visible. Parameters: - machine: Python AST node for a machine. Result: List of Python AST nodes representing the entities defined in m and accessible from other modules. If m is a developed machine, the list is taken from its corresponding implementation. ''' assert machine["kind"] in { "Machine" } impl = machine["implementation"] return impl["concrete_constants"]+impl["variables"]+impl["operations"] def path(dirname, module): """Builds path from directory path and module name.""" return dirname + os.sep + module + '.bxml'
7be0c435a379c5c33da5d27ab6f935ee52e8b024
d2f9e0128b03f792853d22f644b7357af2a0e945
/sia_sports_agency/apps.py
24b327a401ff222af1526730e0e6fcb3646a841a
[]
no_license
joan24t/sia_project
6f97803a51305c55ae85115e1d333fc4c9813ce8
91e4101dd1c8de56a274f7bec59829d844808b10
refs/heads/master
2020-05-18T07:46:04.094445
2019-11-04T19:58:58
2019-11-04T19:58:58
184,271,841
0
0
null
null
null
null
UTF-8
Python
false
false
107
py
from django.apps import AppConfig class SiaSportsAgencyConfig(AppConfig): name = 'sia_sports_agency'
a92bc6a34df382c72d23a550bf362ce8794d9cf6
6cca4444b63c898818fada529b8a4a181ebe7198
/script/main.py
e30e8e33d3097a74f6d30192adfc84dfcbd8ef79
[]
no_license
rohisama/rakuten-bank-happy
024f78a6d500d5e8e0a1bd3aa497ab4c4ce5f19c
f9119297833e7a423f45c69acf70d546b94ba19a
refs/heads/master
2020-06-26T01:39:56.710879
2020-03-14T04:55:15
2020-03-14T04:55:15
199,485,551
3
0
null
2019-10-29T16:39:10
2019-07-29T16:05:07
Python
UTF-8
Python
false
false
1,330
py
import time import os from rakuten_keiba import RakutenKeiba from chariloto import Chariloto from autorace import Autorace from oddspark import Oddspark from boatrace import Boatrace from spat4 import Spat4 from e_shinbun_bet import EShinbunBet from keirin import Keirin from slackbot.slackclient import SlackClient from slackbot_settings import * slack_client = None def depositting(): RakutenKeiba.depositting() Autorace.depositting() Chariloto.depositting() Oddspark.depositting() Boatrace.depositting() Spat4.depositting() EShinbunBet.depositting() Keirin.depositting() def withdrawal(): Autorace.withdrawal() Chariloto.withdrawal() Oddspark.withdrawal() Boatrace.withdrawal() Spat4.withdrawal() EShinbunBet.withdrawal() Keirin.withdrawal() def send_message_to_slack(msg): try: slack_client = get_slack_client() time.sleep(5) slack_client.rtm_send_message(SLACK_CHANNEL, msg) except: print("error") pass def get_slack_client(): return SlackClient(API_TOKEN) if slack_client is None else slack_client print("start depositting") send_message_to_slack("start rakuten-bank automation") depositting() time.sleep(600) print("start withdrawal") withdrawal() send_message_to_slack("finish rakuten-bank automation")
4c7a849bb7ed45e535002870303a3bd4c61415d1
608c48007ad5cf4360b84aee880fc6c7f968696a
/app/core/tests/test_commands.py
0ad5428f6d8f04e18f06f83a17ff90d8f3cdc41d
[ "MIT" ]
permissive
SirEric-A/recipe-app-api
df833284f184877695966f3537a27fb554bf7a18
05a767fcb87f2ca47918698930d10f6e21654576
refs/heads/master
2022-11-16T09:42:10.738980
2020-07-03T10:13:24
2020-07-03T10:13:24
273,184,360
0
0
null
null
null
null
UTF-8
Python
false
false
841
py
from unittest.mock import patch from django.core.management import call_command from django.db.utils import OperationalError from django.test import TestCase class CommandTests(TestCase): def test_wait_for_db_ready(self): '''test waiting for db when db is available''' with patch('django.db.utils.ConnectionHandler.__getitem__') as gi: gi.return_value = True call_command('wait_for_db') self.assertEqual(gi.call_count, 1) @patch('time.sleep', return_value=True) def test_wait_for_db(self, ts): '''test waiting for db''' with patch('django.db.utils.ConnectionHandler.__getitem__') as gi: gi.side_effect = [OperationalError] * 5 + [True] call_command('wait_for_db') self.assertEqual(gi.call_count, 6)
c56feff8a433e6ca0092641069c89e5f0034c870
23d77a735514f9d30c2ecb74a5fc4f26b15cddf9
/masterdata/mooncell/integrator/quest.py
f9d0775b82a809c66b6c65cf6e437c95418986d2
[ "MIT" ]
permissive
karanokk/masterdata
3d8bb4f8edf23173b6488f25d4dce70193dd4ec9
656318c8f8032a520bdb248c1b1ccd2efde77080
refs/heads/master
2021-05-21T08:00:03.812954
2020-08-05T13:54:00
2020-08-05T13:54:00
269,125,838
1
0
MIT
2021-03-31T20:09:56
2020-06-03T15:31:08
Python
UTF-8
Python
false
false
372
py
from ...utils import Mst from .common import Integrator class QuestIG(Integrator): def setup(self): self.rename_column(Mst.Quest, name='jpName') self.add_column(Mst.Quest, cnName='TEXT') self.rename_column(Mst.Spot, name='jpName') self.add_column(Mst.Spot, cnName='TEXT') def integrate(self): # TODO: quest pass
5d4f9a757da5aace17caaf6690141f6c1a475c09
0e6fbdea5ad0608c350fa7a56b7b93f7964c9618
/djangobower/apps.py
c0df87aac328e93125251edfc8762126ab388e6e
[]
no_license
guanqinchao/OurForum
dcc5e3504e83d2ca040a63558077f5cf562b73bc
cb4e9a958a763032c7e6237561112ecedeb165cd
refs/heads/master
2020-03-13T18:52:28.924707
2018-05-18T20:24:34
2018-05-18T20:24:34
131,244,117
0
0
null
null
null
null
UTF-8
Python
false
false
138
py
from __future__ import unicode_literals from django.apps import AppConfig class DjangobowerConfig(AppConfig): name = 'djangobower'
a7fe81d1961e7b27775d1fc2bcfdc15d9952d305
23f55d3240dd3a0599f85d3b4feda3ba3cfa1a22
/apply_ocr/google_vision.py
09ddb408192a4efdee6b481084cf4e32be08ee78
[]
no_license
jocosuccess/extract_info_paper
575a53445b7c1dca110f6b574d9c220ce7c53517
7ec04616c8f8527aec32ff2bb43247ffb6b58d97
refs/heads/master
2022-12-16T06:42:08.311067
2020-03-02T21:47:20
2020-03-02T21:47:20
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,592
py
import json import os import base64 import requests from datetime import datetime class ExtractGoogleOCR: def __init__(self, path): """ Constructor for the class """ self.my_dir = path self.google_key = self.load_text(os.path.join(self.my_dir, 'source', 'vision_key.txt')) @staticmethod def load_json(filename): json_file = open(filename) json_data = json.load(json_file) return json_data @staticmethod def load_text(filename): if os.path.isfile(filename): file1 = open(filename, 'r') text = file1.read() file1.close() else: text = '' return text @staticmethod def save_text(filename, text): file1 = open(filename, 'w') file1.write(text.decode(encoding="utf-8")) file1.close() @staticmethod def rm_file(filename): if os.path.isfile(filename): os.remove(filename) @staticmethod def __make_request_json(img_file, output_filename, detection_type='text'): with open(img_file, 'rb') as image_file: content_json_obj = {'content': base64.b64encode(image_file.read()).decode('UTF-8')} # content_json_obj = {'content': base64.b64encode(image_file.read())} if detection_type == 'text': feature_json_arr = [{'type': 'TEXT_DETECTION'}, {'type': 'DOCUMENT_TEXT_DETECTION'}] elif detection_type == 'logo': feature_json_arr = [{'type': 'LOGO_DETECTION'}] else: feature_json_arr = [{'type': 'TEXT_DETECTION'}, {'type': 'DOCUMENT_TEXT_DETECTION'}] request_list = {'features': feature_json_arr, 'image': content_json_obj} # Write the object to a file, as json with open(output_filename, 'w') as output_json: json.dump({'requests': [request_list]}, output_json) def __get_text_info(self, json_file, detection_type='text'): data = open(json_file, 'rb').read() response = requests.post( url='https://vision.googleapis.com/v1/images:annotate?key=' + self.google_key, data=data, headers={'Content-Type': 'application/json'}) ret_json = json.loads(response.text) ret_val = ret_json['responses'][0] if detection_type == 'text' and 'textAnnotations' in ret_val: return ret_val['textAnnotations'] elif detection_type == 'logo' and 'logoAnnotations' in ret_val: return ret_val['logoAnnotations'] else: return None def get_json_google_from_jpg(self, img_file, detection_type='text'): temp_json = "temp" + str(datetime.now().microsecond) + '.json' # --------------------- Image crop and rescaling, then ocr ------------------ if img_file is None: ret_json = None else: self.__make_request_json(img_file, temp_json, detection_type) ret_json = self.__get_text_info(temp_json, detection_type) # ret_json = self.__get_google_request(temp_json, detection_type) # --------------------- delete temporary files ------------------------------- self.rm_file(temp_json) # self.save_text(self.google_key, "") if ret_json is not None and detection_type == 'text': # for i in range(len(ret_json)): # ret_json[i]['description'] = self.conv_str(ret_json[i]['description']) self.save_text('a_ocr.txt', ret_json[0]['description'].encode('utf-8')) return ret_json
f9ed940a47fbdbac4844f4fe5e0289a9e96b9a9d
7012c3609f4aa5712f17bfee199d856d36a968d2
/Python프로그래밍및실습/ch2-data type, if statement/lab2-1.py
eba2e37ec30a334cd15096c6e63ae65ba045c421
[]
no_license
rrabit42/Python-Programming
1688c2b21ab19f09d2491152ae2dd0ddb1910288
551efb6fe4ee3b92c5cb2ef61d2198d55966471a
refs/heads/master
2021-07-23T01:27:42.657069
2020-07-28T17:23:40
2020-07-28T17:23:40
200,571,844
0
0
null
null
null
null
UTF-8
Python
false
false
167
py
# 문자로 저장된 숫자들의 합 구하기 x = input("숫자1 : ") y = input("숫자2 : ") z = input("숫자3 : ") sum1 = int(x) + int(y) + int(z) print(sum1)
0d5c2ddab78382117074275d658f62de9aa30721
aa5a44a1ae05222a641ef075584987de08d9cff1
/xblocks/xblock_reference/setup.py
e7dff59c73ab2e0cae18b641e9cf403174a0c304
[]
no_license
simranjits-cuelogic/edx-assignment
504a67bd3c721fe5d34a3d6b6a6658828b5d5986
cf5c1dd4803ef02492fa99bb61199d15122d3b87
refs/heads/master
2021-01-12T05:33:10.291506
2016-12-22T09:15:25
2016-12-22T09:15:25
77,125,399
0
0
null
null
null
null
UTF-8
Python
false
false
1,054
py
"""Setup for xblock_reference XBlock.""" import os from setuptools import setup def package_data(pkg, roots): """Generic function to find package_data. All of the files under each of the `roots` will be declared as package data for package `pkg`. """ data = [] for root in roots: for dirname, _, files in os.walk(os.path.join(pkg, root)): for fname in files: data.append(os.path.relpath(os.path.join(dirname, fname), pkg)) return {pkg: data} setup( name='xblock_reference-xblock', version='0.1', description='xblock_reference XBlock', # TODO: write a better description. license='UNKNOWN', # TODO: choose a license: 'AGPL v3' and 'Apache 2.0' are popular. packages=[ 'xblock_reference', ], install_requires=[ 'XBlock', ], entry_points={ 'xblock.v1': [ 'xblock_reference = xblock_reference:ReferenecXBlock', ] }, package_data=package_data("xblock_reference", ["static", "public"]), )
df774daf61ba15eb90766bfcf097cd921934fd35
bdcf56bc8fdf4255b34038bf0280f21917f185a7
/005_landmarks_retrieval/test_data_generator.py
e8957bda42baa14c938c1e8339c6d7db082c7560
[]
no_license
Apollo1840/United_Kagglers
8dc05287f893a33f774efeaf0cd2ad436122dc69
80147867a6011da5a36e78473781481c805619ea
refs/heads/master
2020-04-10T18:51:29.223449
2019-04-13T08:32:25
2019-04-13T08:32:25
161,214,800
1
0
null
2019-04-06T09:16:40
2018-12-10T17:53:31
Python
UTF-8
Python
false
false
474
py
# -*- coding: utf-8 -*- """ Created on Sat Apr 6 08:30:38 2019 @author: zouco """ from data_generator import triplet_generation from data_generator import DataGenerator tg = triplet_generation() ID = "00cfd9bbf55a241e" img3 = tg.get_one_input_tensor(ID) print(len(img3)) print(img3[0].shape) from tools.plot_image import plot_imgs plot_imgs(img3) dg = DataGenerator("test", None) X, y = dg.__getitem__(1) # print(X) print(len(X)) print(X[0].shape) print(y.shape)
0b8635d05f232b3683ce31ae12276f9c46ef05a3
35b58dedc97622b1973456d907ede6ab86c0d966
/day022/day22.py
8f8b5cb73e108c01ced7d4dee535666b5e32f737
[]
no_license
GithubLucasSong/PythonProject
7bb2bcc8af2de725b2ed9cc5bfedfd64a9a56635
e3602b4cb8af9391c6dbeaebb845829ffb7ab15f
refs/heads/master
2022-11-23T05:32:44.622532
2020-07-24T08:27:12
2020-07-24T08:27:12
282,165,132
0
0
null
null
null
null
UTF-8
Python
false
false
1,186
py
# from socket import * # s = socket(AF_INET,SOCK_DGRAM) #创建套接字 # addr = ('192.168.14.25',8080) #准备接收方地址 # data = input('请输入:') # s.sendto(data.encode(),addr) # #发送数据时,python3需要将字符串装换成byte # #encode('utf-8') 用utf-8对数据进行编码,获得bytes类型对象 # #decode()反过来 # s.close() # from socket import * # import time # # s = socket(AF_INET,SOCK_DGRAM) #创建套接字 # s.bind(('', 8788)) # addr = ('192.168.14.25',8788) #准备接收方地址 # data = input('亲输入:') # s.sendto(data.encode(),addr) # time.sleep(1) # #等待接收数据 # data = s.recvfrom(1024) # # 1024表示本次接收的最大的字节数 # print(data) from socket import * #创建套接字 udpSocket = socket(AF_INET,SOCK_DGRAM) #绑定本地信息,不使用随机分配的端口 binAddr = ('',7088) udpSocket.bind(binAddr) num = 0 while True: #接收对方发送的数据 recvData = udpSocket.recvfrom(1024) print(recvData) #将接收到的数据发回给对方 udpSocket.sendto(recvData[0],recvData[1]) num += 1 print('已将接收到的第%d个数据返回给对方,'%num) udpSocket.close()
1eb767cf72d777c0f346fc7cee95917651a364a3
b736c527824198e1b07c821b685ca679cede79dd
/classes/FileSystemTools.py
6485992423ec7a372ece0d2d6edc96202280c550
[]
no_license
LaoKpa/neat-3
c276b58ce2dd77ea32b701820adc29b99f508ec7
b2b89023db5822d498b3edc84f8b84880dc6e6b6
refs/heads/master
2022-03-19T08:57:40.857925
2019-11-16T05:29:17
2019-11-16T05:29:17
null
0
0
null
null
null
null
UTF-8
Python
false
false
7,461
py
from datetime import datetime from os import mkdir import os from copy import copy,deepcopy import time import glob import subprocess def getDateString(): return(datetime.now().strftime('%d-%m-%Y_%H-%M-%S')) def makeDir(dir_name): # Even if this is in a library dir, it should make the dir # in the script that called it. mkdir(dir_name) return(dir_name) def makeDateDir(base_dir='.'): # Just creates a dir with the current date for its name ds = getDateString() full_dir = combineDirAndFile(base_dir, ds) makeDir(full_dir) return(full_dir) def makeLabelDateDir(label, base_dir='.'): # You give it a label, and it creates the dir label_datestring dir_name = label + '_' + getDateString() full_dir = combineDirAndFile(base_dir, dir_name) makeDir(full_dir) return(full_dir) def combineDirAndFile(dir, file): # Adds the file to the end of dir, adding a slash in between if needed. return(addTrailingSlashIfNeeded(dir) + file) def dictPrettyPrint(in_dict): # Formats a dict into a nice string with each k,v entry on a new line, # and prints it. dict_str = '{\n' for k,v in in_dict.items(): dict_str += '\t{} : {}\n'.format(k, v) dict_str += '\n}\n' print(dict_str) def dictToStringList(dict): pd_copy = copy(dict) for k,v in pd_copy.items(): if type(v).__name__ == 'float': if abs(v)>10**-4: pd_copy[k] = '{:.5f}'.format(v) else: pd_copy[k] = '{:.2E}'.format(v) params = [str(k)+'='+str(v) for k,v in pd_copy.items() if v is not None] return(params) def paramDictToFnameStr(param_dict): # Creates a string that can be used as an fname, separated by # underscores. If a param has the value None, it isn't included. params = dictToStringList(param_dict) return('_'.join(params)) def paramDictToLabelStr(param_dict): # Creates a string that can be used as an fname, separated by # ', '. If a param has the value None, it isn't included. params = dictToStringList(param_dict) return(', '.join(params)) def listToFname(list): return('_'.join(list)) def parseSingleAndListParams(param_dict, exclude_list): # This is useful for if you want to do multiple runs, varying one or # several parameters at once. exclude_list are ones you don't want to # include in the parameters in the tuple. # It returns a list of the parameters that are varied, # and a list of dictionaries that can be directly passed to a function, where # each one has a different set of the varied params. # # You should pass the args where if you don't want to vary an arg, it's just normal # my_arg = 5, but if you do want to vary it, you pass it a list of the vary values, like # my_arg = [1, 5, 8]. If you want to vary two at the same time, you pass them both as separate # lists, and it will match them up, but they need to be the same size. # list_params is just a list of the params that were passed as a list, that we'll vary. list_params = [] # single_params is a dict of the params that aren't varied and will have the same vals in each # separate run. single_params = {} # ziplist is a list of the lists for the params that are varied. So if there are two varied # args, each length 3, it will take these, and then below zip them to create a list of pairs. # arg1=[1,2,3], arg2=[2,4,8] -> ziplist=[arg1,arg2] -> param_tups=[(1,2),(2,4),(3,8)] ziplist = [] for k,v in param_dict.items(): if type(v).__name__ == 'list': list_params.append(k) ziplist.append(v) else: if k not in exclude_list: single_params[k] = v param_tups = list(zip(*ziplist)) vary_param_dicts = [] vary_param_tups = [] for tup in param_tups: temp_dict = dict(zip(list_params,tup)) temp_kw = {**single_params, **temp_dict} vary_param_tups.append(temp_dict) vary_param_dicts.append(temp_kw) # list_params: just a list of the names of the varied ones. # vary_param_dicts: a list of the dicts that you can pass to each iteration, which includes the args that don't vary. # vary_param_tups: a list of dicts corresponding to vary_param_dicts, of only the values that change. return(list_params, vary_param_dicts, vary_param_tups) def strfdelta(tdelta, fmt): d = {"days": tdelta.days} d["hours"], rem = divmod(tdelta.seconds, 3600) d["minutes"], d["seconds"] = divmod(rem, 60) return fmt.format(**d) def getCurTimeObj(): return(datetime.now()) def getTimeDiffNum(start_time_obj): diff = datetime.timestamp(datetime.now()) - datetime.timestamp(start_time_obj) return(diff) def getTimeDiffObj(start_time_obj): #Gets the time diff in a nice format from the start_time_obj. diff = datetime.now() - start_time_obj return(diff) def getTimeDiffStr(start_time_obj): #Gets the time diff in a nice format from the start_time_obj. diff = getTimeDiffObj(start_time_obj) return(strfdelta(diff,'{hours} hrs, {minutes} mins, {seconds} s')) def writeDictToFile(dict, fname): # You have to copy it here, otherwise it'll actually overwrite the values in the dict # you passed. my_dict = copy(dict) f = open(fname,'w+') for k,v in my_dict.items(): if type(v).__name__ == 'float': if abs(v)>10**-4: my_dict[k] = '{:.5f}'.format(v) else: my_dict[k] = '{:.2E}'.format(v) f.write('{} = {}\n'.format(k, my_dict[k])) f.close() def readFileToDict(fname): d = {} with open(fname) as f: for line in f: (key, val) = line.split(' = ') val = val.strip('\n') #This is to handle the fact that everything gets read in #as a string, but some stuff you probably want to be floats. try: val = float(val) except: val = str(val) d[key] = val return(d) def dirFromFullPath(fname): # This gives you the path, stripping the local filename, if you pass it # a long path + filename. parts = fname.split('/') last_part = parts[-1] path = fname.replace(last_part,'') if path == '': return('./') else: return(path) def fnameFromFullPath(fname): # This just gets the local filename if you passed it some huge long name with the path. parts = fname.split('/') last_part = parts[-1] return(last_part) def stripAnyTrailingSlash(path): if path[-1] == '/': return(path[:-1]) else: return(path) def addTrailingSlashIfNeeded(path): if path[-1] == '/': return(path) else: return(path + '/') def gifFromImages(imgs_path, gif_name, ext = '.png', delay=50): imgs_path = stripAnyTrailingSlash(imgs_path) file_list = glob.glob(imgs_path + '/' + '*' + ext) # Get all the pngs in the current directory #print(file_list) #print([fnameFromFullPath(x).split('.png')[0] for x in file_list]) #list.sort(file_list, key=lambda x: int(x.split('_')[1].split('.png')[0])) list.sort(file_list, key=lambda x: int(fnameFromFullPath(x).split(ext)[0])) #list.sort(file_list) # Sort the images by #, this may need to be tweaked for your use case #print(file_list) assert len(file_list) < 300, 'Too many files ({}), will probably crash convert command.'.format(len(file_list)) output_fname = '{}/{}.gif'.format(imgs_path, gif_name) check_call_arglist = ['convert'] + ['-delay', str(delay)] + file_list + [output_fname] #print(check_call_arglist) print('Calling convert command to create gif...') subprocess.check_call(check_call_arglist) print('done.') return(output_fname) # older method: '''with open('image_list.txt', 'w') as file: for item in file_list: file.write("%s\n" % item) os.system('convert @image_list.txt {}/{}.gif'.format(imgs_path,gif_name)) # On windows convert is 'magick' ''' #
e8f82c2072683f5cfb607dc93e8ebb33894ebd10
b741ac3d28bb4f8d3b368cb6d134eab635273152
/guidepocapp/views.py
d77bb6db407f0849ef2a99efcd4194903111440a
[]
no_license
tjlee/poc_guide
8f188b5ab5a13c3a32ccd1811da8b7d5ceedb488
88216b9fa6ae0ebb0bd6ed19ca2393c27f99600c
refs/heads/master
2021-01-22T03:54:33.523925
2013-12-26T12:43:33
2013-12-26T12:43:33
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,003
py
from django.http import HttpResponse from django.template import RequestContext, loader from django.shortcuts import render, get_object_or_404 from django.http import HttpResponseRedirect from django.core.urlresolvers import reverse from guidepocapp.models import Region, Place, Guide, GuideToPlace from guidepocapp.forms import RegisterGuideForm def index(request): region_list = Region.objects.order_by('id')[:10] template = loader.get_template('guidepocapp/index.html') context = RequestContext(request, { 'region_list': region_list}) return HttpResponse(template.render(context)) # class RegionDetailView(generic): def detail_region(request, region_id): region = get_object_or_404(Region, pk=region_id) place_list = Place.objects.filter(region=region_id).order_by('id') return render(request, 'guidepocapp/region_detail.html', {'region_detail': region, 'places_list': place_list}) def detail_place(request, region_id, place_id): place = get_object_or_404(Place, pk=place_id) place_list = GuideToPlace.objects.filter(place_id=place_id) guide_list = [] for guide_to_place in place_list: guide_list += Guide.objects.filter(id=guide_to_place.guide_id_id) return render(request, 'guidepocapp/place_detail.html', {'place_detail': place, 'guide_list': guide_list}) def detail_guide(request, guide_id): guide = get_object_or_404(Guide, pk=guide_id) return render(request, 'guidepocapp/guide_detail.html', {'guide_detail': guide}) def register_guide(request): if request.method == 'POST': form = RegisterGuideForm(request.POST) if form.is_valid(): #todo: change this crap res = form.save() return HttpResponseRedirect(reverse('guide details', args=(res.id,))) # Redirect after POST else: form = RegisterGuideForm() return render(request, 'guidepocapp/register_guide.html', {'form': form}) def complete(request): return HttpResponse("lalala")
0895c3c506eb9016c11feb353775a2cd9aed3f62
f4b3be2a3955c26b4e05ab162fa4909cf9a14f11
/CRB/validators/subsystems/csvwriters/pivalidatecsv.py
50f60246ca50193cebf7afc4e52a74e9b776ef81
[]
no_license
njovujsh/crbdjango
fd1f61403c1fbdac01b1bda5145faeb4b9ef9608
fdf5cc6ca5920a596c5463187d29202719664144
refs/heads/master
2022-12-04T18:13:07.709963
2018-05-14T09:07:47
2018-05-14T09:07:47
133,333,767
0
0
null
2022-11-22T01:44:28
2018-05-14T09:04:17
JavaScript
UTF-8
Python
false
false
21,868
py
from validators.subsystems.csvwriters import processcsvs from django.utils.encoding import smart_str from validators.subsystems.datasets import validationstatus from django.http import HttpResponse from validators.subsystems.datasets import pcivalidate from validators.subsystems.datasets import scivalidate class CSVPIValidated(processcsvs.ProcessCSV): def __init__(self,filename, dialect, row, headers, delimiter="|",response=None): super(CSVPIValidated, self).__init__(filename, dialect,delimiter,response=response) self.delimiter = delimiter self.row = row if(headers): self.write_headers(headers) def write_row_data(self, coldata, val): try: self.validated_field = self.validate_and_return(val) #handle the pcivalidation self.pci_validation = pcivalidate.PCIValidate() #self.sci_validation = scivalidate.SCIValidate() #self.sci_validation.begin_validation() self.pci_validation.begin_validation() self.validated_pci_dict = self.pci_validation.get_real_dict() #self.validated_sci_dict = self.sci_validation.get_real_dict() self.PCI_Building_Unit_Number = self.load_validated_field(self.validated_pci_dict.get("PCI_Building_Unit_Number")) self.PCI_Building_Name = self.load_validated_field(self.validated_pci_dict.get("PCI_Building_Name")) self.PCI_Floor_Number = self.load_validated_field(self.validated_pci_dict.get("PCI_Floor_Number")) self.PCI_Plot_or_Street_Number = self.load_validated_field(self.validated_pci_dict.get("PCI_Plot_or_Street_Number")) self.PCI_LC_or_Street_Name = self.load_validated_field(self.validated_pci_dict.get("PCI_LC_or_Street_Name")) self.PCI_Parish = self.load_validated_field(self.validated_pci_dict.get("PCI_Parish")) self.PCI_Suburb = self.load_validated_field(self.validated_pci_dict.get("PCI_Suburb")) self.PCI_Village = self.load_validated_field(self.validated_pci_dict.get("PCI_Village")) self.PCI_County_or_Town = self.load_validated_field(self.validated_pci_dict.get("PCI_County_or_Town")) self.PCI_District = self.load_validated_field(self.validated_pci_dict.get("PCI_District")) self.PCI_Region = self.load_validated_field(self.validated_pci_dict.get("PCI_Region")) self.PCI_PO_Box_Number = self.load_validated_field(self.validated_pci_dict.get("PCI_PO_Box_Number")) self.PCI_Post_Office_Town = self.load_validated_field(self.validated_pci_dict.get("PCI_Post_Office_Town")) self.PCI_Country_Code = self.load_validated_field(self.validated_pci_dict.get("PCI_Country_Code")) self.PCI_Period_At_Address = self.load_validated_field(self.validated_pci_dict.get("PCI_Period_At_Address")) self.PCI_Flag_of_Ownership = self.load_validated_field(self.validated_pci_dict.get("PCI_Flag_of_Ownership")) #self.PCI_Primary_Number_Country_Dialling_Code = self.load_validated_field(self.validated_pci_dict.get("PCI_Primary_Number_Country_Dialling_Code")) self.PCI_Primary_Number_Telephone_Number = self.load_validated_field(self.validated_pci_dict.get("PCI_Primary_Number_Telephone_Number")) #self.PCI_Other_Number_Country_Dialling_Code = self.load_validated_field(self.validated_pci_dict.get("PCI_Other_Number_Country_Dialling_Code")) self.PCI_Other_Number_Telephone_Number = self.load_validated_field(self.validated_pci_dict.get("PCI_Other_Number_Telephone_Number")) #self.PCI_Mobile_Number_Country_Dialling_Code = self.load_validated_field(self.validated_pci_dict.get("PCI_Mobile_Number_Country_Dialling_Code")) self.PCI_Mobile_Number_Telephone_Number = self.load_validated_field(self.validated_pci_dict.get("PCI_Mobile_Number_Telephone_Number")) #self.PCI_Facsimile_Country_Dialling_Code = self.load_validated_field(self.validated_pci_dict.get("PCI_Facsimile_Country_Dialling_Code")) self.PCI_Facsimile_Number = self.load_validated_field(self.validated_pci_dict.get("PCI_Facsimile_Number")) self.PCI_Email_Address = self.load_validated_field(self.validated_pci_dict.get("PCI_Email_Address")) self.PCI_Web_site = self.load_validated_field(self.validated_pci_dict.get("PCI_Web_site")) #self.SCI_Unit_Number = self.load_validated_field(self.validated_sci_dict.get("SCI_Unit_Number")) #self.SCI_Unit_Name = self.load_validated_field(self.validated_sci_dict.get("SCI_Unit_Name")) #self.SCI_Floor_Number = self.load_validated_field(self.validated_sci_dict.get("SCI_Floor_Number")) #self.SCI_Plot_or_Street_Number = self.load_validated_field(self.validated_sci_dict.get("SCI_Plot_or_Street_Number")) #self.SCI_LC_or_Street_Name = self.load_validated_field(self.validated_sci_dict.get("SCI_LC_or_Street_Name")) #self.SCI_Parish = self.load_validated_field(self.validated_sci_dict.get("SCI_Parish")) #self.SCI_Suburb = self.load_validated_field(self.validated_sci_dict.get("SCI_Suburb")) #self.SCI_Village = self.load_validated_field(self.validated_sci_dict.get("SCI_Village")) #self.SCI_County_or_Town = self.load_validated_field(self.validated_sci_dict.get("SCI_County_or_Town")) #self.SCI_District = self.load_validated_field(self.validated_sci_dict.get("SCI_District")) #self.SCI_Region = self.load_validated_field(self.validated_sci_dict.get("SCI_Region")) #self.SCI_PO_Box_Number = self.load_validated_field(self.validated_sci_dict.get("SCI_PO_Box_Number")) #self.SCI_Post_Office_Town = self.load_validated_field(self.validated_sci_dict.get("SCI_Post_Office_Town")) #self.SCI_Country_Code = self.load_validated_field(self.validated_sci_dict.get("SCI_Country_Code")) #self.SCI_Period_At_Address = self.load_validated_field(self.validated_sci_dict.get("SCI_Period_At_Address")) #self.SCI_Flag_of_Ownership = self.load_validated_field(self.validated_sci_dict.get("SCI_Flag_for_ownership")) #self.SCI_Primary_Number_Country_Dialling_Code = self.load_validated_field(self.validated_sci_dict.get("SCI_Primary_Number_Country_Dialling_Code")) #self.SCI_Primary_Number_Telephone_Number = self.load_validated_field(self.validated_sci_dict.get("SCI_Primary_Number_Telephone_Number")) #self.SCI_Other_Number_Country_Dialling_Code = self.load_validated_field(self.validated_sci_dict.get("SCI_Other_Number_Country_Dialling_Code")) #self.SCI_Other_Number_Telephone_Number = self.load_validated_field(self.validated_sci_dict.get("SCI_Other_Number_Telephone_Number")) #self.SCI_Mobile_Number_Country_Dialling_Code = self.load_validated_field(self.validated_sci_dict.get("SCI_Mobile_Number_Country_Dialling_Code")) #self.SCI_Mobile_Number_Telephone_Number = self.load_validated_field(self.validated_sci_dict.get("SCI_Mobile_Number_Telephone_Number")) #self.SCI_Facsimile_Country_Dialling_Code = self.load_validated_field(self.validated_sci_dict.get("SCI_Facsimile_Country_Dialling_Code")) #self.SCI_Facsimile_Number = self.load_validated_field(self.validated_sci_dict.get("SCI_Facsimile_Number")) #self.SCI_Email_Address = self.load_validated_field(self.validated_sci_dict.get("SCI_Email_Address")) #self.SCI_Web_site = self.load_validated_field(self.validated_sci_dict.get("SCI_Web_site")) self.pi_field = self.load_validated_field(self.validated_field.get("PI_Identification_Code")) self.it_field = self.load_validated_field(self.validated_field.get("Institution_Type")) self.in_field = self.load_validated_field(self.validated_field.get("Institution_Name")) self.date_field = self.load_validated_field(self.validated_field.get("License_Issuing_Date")) #.replace("-", "", len(self.validated_field.get("License_Issuing_Date"))) self.date_field = self.replace_date(self.date_field) for data in coldata: self.writer.writerow([ self.get_data_id(), self.value_in(smart_str(unicode(data.PI_Identification_Code)), self.pi_field, field=None), self.value_in(smart_str(unicode(data.Institution_Type)), self.it_field), self.value_in(smart_str(unicode(data.Institution_Name)), self.in_field), self.value_in(smart_str(unicode(data.License_Issuing_Date.replace("-", "", len(data.License_Issuing_Date)))), self.date_field), self.value_in(smart_str(unicode(data.pci.PCI_Building_Unit_Number)), self.PCI_Building_Unit_Number), self.value_in(smart_str(unicode(data.pci.PCI_Building_Name)), self.PCI_Building_Name), self.value_in(smart_str(unicode(data.pci.PCI_Floor_Number)), self.PCI_Floor_Number), self.value_in(smart_str(unicode(data.pci.PCI_Plot_or_Street_Number)), self.PCI_Plot_or_Street_Number), self.value_in(smart_str(unicode(data.pci.PCI_LC_or_Street_Name)), self.PCI_LC_or_Street_Name), self.value_in(smart_str(unicode(data.pci.PCI_Parish)), self.PCI_Parish), self.value_in(smart_str(unicode(data.pci.PCI_Suburb)), self.PCI_Suburb), self.value_in(smart_str(unicode(data.pci.PCI_Village)), self.PCI_Village), self.value_in(smart_str(unicode(data.pci.PCI_County_or_Town)), self.PCI_County_or_Town), self.value_in(smart_str(unicode(data.pci.PCI_District)), self.PCI_District), self.value_in(smart_str(unicode(data.pci.PCI_Region)), self.PCI_Region), self.value_in(smart_str(unicode(data.pci.PCI_PO_Box_Number)), self.PCI_PO_Box_Number), self.value_in(smart_str(unicode(data.pci.PCI_Post_Office_Town)), self.PCI_Post_Office_Town), self.value_in(smart_str(unicode(data.pci.PCI_Country_Code)), self.PCI_Country_Code), self.value_in(smart_str(unicode(data.pci.PCI_Period_At_Address)), self.PCI_Period_At_Address), self.value_in(smart_str(unicode(data.pci.PCI_Flag_of_Ownership)), self.PCI_Flag_of_Ownership), #self.value_in(smart_str(unicode(data.pci.PCI_Primary_Number_Country_Dialling_Code)), self.PCI_Primary_Number_Country_Dialling_Code), self.value_in(smart_str(unicode(data.pci.PCI_Primary_Number_Telephone_Number)), self.PCI_Primary_Number_Telephone_Number), #self.value_in(smart_str(unicode(data.pci.PCI_Other_Number_Country_Dialling_Code)), self.PCI_Other_Number_Country_Dialling_Code), self.value_in(smart_str(unicode(data.pci.PCI_Other_Number_Telephone_Number)), self.PCI_Other_Number_Telephone_Number), #self.value_in(smart_str(unicode(data.pci.PCI_Mobile_Number_Country_Dialling_Code)), self.PCI_Mobile_Number_Country_Dialling_Code), self.value_in(smart_str(unicode(data.pci.PCI_Mobile_Number_Telephone_Number)), self.PCI_Mobile_Number_Telephone_Number), #self.value_in(smart_str(unicode(data.pci.PCI_Facsimile_Country_Dialling_Code)), self.PCI_Facsimile_Country_Dialling_Code), self.value_in(smart_str(unicode(data.pci.PCI_Facsimile_Number)), self.PCI_Facsimile_Number), self.value_in(smart_str(unicode(data.pci.PCI_Email_Address)), self.PCI_Email_Address), self.value_in(smart_str(unicode(data.pci.PCI_Web_site)), self.PCI_Web_site), #''' #self.value_in(smart_str(unicode(data.sci.SCI_Unit_Number)), self.SCI_Unit_Number), #self.value_in(smart_str(unicode(data.sci.SCI_Unit_Name)), self.SCI_Unit_Name), #self.value_in(smart_str(unicode(data.sci.SCI_Floor_Number)), self.SCI_Floor_Number), #self.value_in(smart_str(unicode(data.sci.SCI_Plot_or_Street_Number)), self.SCI_Plot_or_Street_Number), #self.value_in(smart_str(unicode(data.sci.SCI_LC_or_Street_Name)), self.SCI_LC_or_Street_Name), #self.value_in(smart_str(unicode(data.sci.SCI_Parish)), self.SCI_Parish), #self.value_in(smart_str(unicode(data.sci.SCI_Suburb)), self.SCI_Suburb), #self.value_in(smart_str(unicode(data.sci.SCI_Village)), self.SCI_Village), #self.value_in(smart_str(unicode(data.sci.SCI_County_or_Town)), self.SCI_County_or_Town), #self.value_in(smart_str(unicode(data.sci.SCI_District)), self.SCI_District), #self.value_in(smart_str(unicode(data.sci.SCI_Region)), self.SCI_Region), #self.value_in(smart_str(unicode(data.sci.SCI_PO_Box_Number)), self.SCI_PO_Box_Number), #self.value_in(smart_str(unicode(data.sci.SCI_Post_Office_Town)), self.SCI_Post_Office_Town), #self.value_in(smart_str(unicode(data.sci.SCI_Country_Code)), self.SCI_Country_Code), #self.value_in(smart_str(unicode(data.sci.SCI_Period_At_Address)), self.SCI_Period_At_Address), #self.value_in(smart_str(unicode(data.sci.SCI_Flag_for_ownership)), self.SCI_Flag_of_Ownership), #self.value_in(smart_str(unicode(data.sci.SCI_Primary_Number_Country_Dialling_Code)), self.SCI_Primary_Number_Country_Dialling_Code), #self.value_in(smart_str(unicode(data.sci.SCI_Primary_Number_Telephone_Number)), self.SCI_Primary_Number_Telephone_Number), #self.value_in(smart_str(unicode(data.sci.SCI_Other_Number_Country_Dialling_Code)), self.SCI_Other_Number_Country_Dialling_Code), #self.value_in(smart_str(unicode(data.sci.SCI_Other_Number_Telephone_Number)), self.SCI_Other_Number_Telephone_Number), #self.value_in(smart_str(unicode(data.sci.SCI_Mobile_Number_Country_Dialling_Code)), self.SCI_Mobile_Number_Country_Dialling_Code), #self.value_in(smart_str(unicode(data.sci.SCI_Mobile_Number_Telephone_Number)), self.SCI_Mobile_Number_Telephone_Number), #self.value_in(smart_str(unicode(data.sci.SCI_Facsimile_Country_Dialling_Code)), self.SCI_Facsimile_Country_Dialling_Code), #self.value_in(smart_str(unicode(data.sci.SCI_Facsimile_Number)), self.SCI_Facsimile_Number), #self.value_in(smart_str(unicode(data.sci.SCI_Email_Address)), self.SCI_Email_Address), #self.value_in(smart_str(unicode(data.sci.SCI_Web_site)), self.SCI_Web_site) #''' ]) return self.response except: raise def load_validated_field(self, field): self.appendlist = [] #print "FIELD ", field for f in validationstatus.validation_status(field): self.appendlist.append(f) return self.appendlist def validate_and_return(self, module): try: self.validator = module.begin_validation() return module.get_real_dict() except: raise def value_in(self, data, l, field=None): self.failed = 0 if(data in l): return data else: pass def replace_date(self, d): self.date_dict = [] for date in d: self.date_dict.append(str(date).replace("-", "", len(str(date)))) return self.date_dict class ProcessCSVPI(processcsvs.ProcessCSV): def __init__(self, filename, dialect, row, headers, delimiter="|",response=None): super(ProcessCSVPI, self).__init__(filename, dialect,delimiter=delimiter,response=response) self.delimiter = delimiter #print "DELIMTER ", self.delimiter self.row = row if(headers): self.write_headers(headers) def write_row_data(self, coldata): try: for data in coldata: #print "Writing rows" self.writer.writerow([ self.get_data_id(), smart_str(unicode(data.PI_Identification_Code)), smart_str(unicode(data.Institution_Type)), smart_str(unicode(data.Institution_Name)), smart_str(unicode(data.License_Issuing_Date.replace("-", "", len(data.License_Issuing_Date)))), smart_str(unicode(data.pci.PCI_Building_Unit_Number)), smart_str(unicode(data.pci.PCI_Building_Name)), smart_str(unicode(data.pci.PCI_Floor_Number)), smart_str(unicode(data.pci.PCI_Plot_or_Street_Number)), smart_str(unicode(data.pci.PCI_LC_or_Street_Name)), smart_str(unicode(data.pci.PCI_Parish)), smart_str(unicode(data.pci.PCI_Suburb)), smart_str(unicode(data.pci.PCI_Village)), smart_str(unicode(data.pci.PCI_County_or_Town)), smart_str(unicode(data.pci.PCI_District)), smart_str(unicode(data.pci.PCI_Region)), smart_str(unicode(data.pci.PCI_PO_Box_Number)), smart_str(unicode(data.pci.PCI_Post_Office_Town)), smart_str(unicode(data.pci.PCI_Country_Code)), smart_str(unicode(data.pci.PCI_Period_At_Address)), smart_str(unicode(data.pci.PCI_Flag_of_Ownership)), #smart_str(unicode(data.pci.PCI_Primary_Number_Country_Dialling_Code)), smart_str(unicode(data.pci.PCI_Primary_Number_Telephone_Number)), #smart_str(unicode(data.pci.PCI_Other_Number_Country_Dialling_Code)), smart_str(unicode(data.pci.PCI_Other_Number_Telephone_Number)), #smart_str(unicode(data.pci.PCI_Mobile_Number_Country_Dialling_Code)), smart_str(unicode(data.pci.PCI_Mobile_Number_Telephone_Number)), #smart_str(unicode(data.pci.PCI_Facsimile_Country_Dialling_Code)), smart_str(unicode(data.pci.PCI_Facsimile_Number)), smart_str(unicode(data.pci.PCI_Email_Address)), smart_str(unicode(data.pci.PCI_Web_site)), #''' #smart_str(unicode(data.sci.SCI_Unit_Number)), #smart_str(unicode(data.sci.SCI_Unit_Name)), #smart_str(unicode(data.sci.SCI_Floor_Number)), #smart_str(unicode(data.sci.SCI_Plot_or_Street_Number)), #smart_str(unicode(data.sci.SCI_LC_or_Street_Name)), #smart_str(unicode(data.sci.SCI_Parish)), #smart_str(unicode(data.sci.SCI_Suburb)), #smart_str(unicode(data.sci.SCI_Village)), #smart_str(unicode(data.sci.SCI_County_or_Town)), #smart_str(unicode(data.sci.SCI_District)), #smart_str(unicode(data.sci.SCI_Region)), #smart_str(unicode(data.sci.SCI_PO_Box_Number)), #smart_str(unicode(data.sci.SCI_Post_Office_Town)), #smart_str(unicode(data.sci.SCI_Country_Code)), #smart_str(unicode(data.sci.SCI_Period_At_Address)), #smart_str(unicode(data.sci.SCI_Flag_for_ownership)), #smart_str(unicode(data.sci.SCI_Primary_Number_Country_Dialling_Code)), #mart_str(unicode(data.sci.SCI_Primary_Number_Telephone_Number)), #smart_str(unicode(data.sci.SCI_Other_Number_Country_Dialling_Code)), #smart_str(unicode(data.sci.SCI_Other_Number_Telephone_Number)), #smart_str(unicode(data.sci.SCI_Mobile_Number_Country_Dialling_Code)), #smart_str(unicode(data.sci.SCI_Mobile_Number_Telephone_Number)), #smart_str(unicode(data.sci.SCI_Facsimile_Country_Dialling_Code)), #smart_str(unicode(data.sci.SCI_Facsimile_Number)), #smart_str(unicode(data.sci.SCI_Email_Address)), #smart_str(unicode(data.sci.SCI_Web_site)) #''' ]) return self.response except: raise
88f8f1f5b4e51beff0132b971b5f12b1f941cc37
4f60139c8012bde0bdd4997d18c4091c8cb117ae
/record_audio_rpi.py
c14add3084ee57e027106effa9e6937bd3adfbdc
[ "MIT" ]
permissive
duboviy/misc
fdb93b2dd06152504142d723341373b0ca1d1055
4cd8cbcf12fc29dd2f12699fbd2f3dd738b5e4b5
refs/heads/master
2021-01-13T15:35:11.398310
2020-10-08T06:30:52
2020-10-08T06:30:52
76,888,520
10
6
null
2017-04-15T18:36:04
2016-12-19T18:52:41
Python
UTF-8
Python
false
false
1,313
py
""" Script used for recording audio on the Raspberry Pi with Python and a USB Microphone. """ import pyaudio import wave form_1 = pyaudio.paInt16 # 16-bit resolution chans = 1 # 1 channel samp_rate = 44100 # 44.1kHz sampling rate chunk = 4096 # 2^12 samples for buffer record_secs = 30 # seconds to record dev_index = 2 # device index found by p.get_device_info_by_index(ii) wav_output_filename = 'test1.wav' # name of .wav file audio = pyaudio.PyAudio() # create pyaudio instantiation # create pyaudio stream stream = audio.open(format = form_1,rate = samp_rate,channels = chans, \ input_device_index = dev_index,input = True, \ frames_per_buffer=chunk) print("recording") frames = [] # loop through stream and append audio chunks to frame array for ii in range(0,int((samp_rate/chunk)*record_secs)): data = stream.read(chunk) frames.append(data) print("finished recording") # stop the stream, close it, and terminate the pyaudio instantiation stream.stop_stream() stream.close() audio.terminate() # save the audio frames as .wav file wavefile = wave.open(wav_output_filename,'wb') wavefile.setnchannels(chans) wavefile.setsampwidth(audio.get_sample_size(form_1)) wavefile.setframerate(samp_rate) wavefile.writeframes(b''.join(frames)) wavefile.close()
375a018c63de5a9df57f07c26829657f66bcfbeb
c369443df5ff98eccc0eee7f63bb8947f2943605
/shop/migrations/0002_product_photo.py
6f674858a235d0794a6b5cc89516d04cb88266a3
[]
no_license
erllan/shop-test
d2934f484b25d141a60caa5aca31a61eec48f055
1f77de177192ce6a1f8c5ccf1d7ca93ec026acf5
refs/heads/master
2023-03-06T01:04:38.785383
2021-02-27T18:02:07
2021-02-27T18:02:07
341,929,117
0
0
null
null
null
null
UTF-8
Python
false
false
408
py
# Generated by Django 3.1.7 on 2021-02-26 11:11 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shop', '0001_initial'), ] operations = [ migrations.AddField( model_name='product', name='photo', field=models.ImageField(default='static/image', upload_to='product/photo/'), ), ]
22a186c790c53f60967d236882877184068afc26
e199c0648ee56c84d421bb47b2b5c163a1bd4cf1
/prep/prep_wiktionary.py
70fb588952e6e9f0cbea315305346013b12561da
[ "MIT" ]
permissive
inoue0406/VocabularyPF
72a3abea4b920c7959997198ef02374e5d16782a
077300f82ef358ceb77e80f79ecb66f8124efbf6
refs/heads/main
2023-06-23T00:56:46.477992
2021-07-23T15:38:05
2021-07-23T15:38:05
365,765,325
0
0
null
null
null
null
UTF-8
Python
false
false
2,143
py
# prep for wiktionary data import json import pandas as pd #import wiktextract def extract_pronunciation(sounds): # Extract American Pronunciation #list_country = ["General American","Received Pronunciation","US","UK"] ipa = "" for i in range(len(sounds)): if "ipa" in sounds[i].keys(): #if "tags" in sounds[i].keys() and "ipa" in sounds[i].keys(): #if sounds[i]['tags'][0] in list_country: ipa = ipa + sounds[i]['ipa'] return ipa if __name__ == '__main__': # Inputs # 1: Wiktionary dump file fjson = "../data/Wiktionary/kaikki.org-dictionary-English.json" # 2: word list (NGSL) df_words = pd.read_csv('../data/NGSL_Word_Freq_list.csv') # Outputs fcsv = open('../data/out_wordlist_NGSL_Wiktionary.csv', 'w', encoding='utf-8') print("word,sound,sense",file=fcsv) with open(fjson, "r") as f: count = 0 for line in f: data = json.loads(line) # extract data if "word" in data.keys(): word = data['word'] if word == "pyre": #import pdb;pdb.set_trace() pass # if contained in NGSL list if sum(df_words["Lemma"] == word)==0: print(word,"not contained in NGSL. Skip.") continue print("processing word:",word) if "sounds" in data.keys(): sound =extract_pronunciation(data["sounds"]) else: sound = "" if "senses" in data.keys(): if "glosses" in data['senses'][0]: sense = data['senses'][0]['glosses'][0] else: sense = "NA" else: sense = "NA" #import pdb;pdb.set_trace() print("%s,%s,'%s'" % (word,sound,sense),file=fcsv) #lst.append(data) count = count + 1 #if count > 100:
f8dfea08d419d956b8b0401ae0fd292715671b03
c7c75f034c2bf595a2507414cdb5d7ce09e30a26
/5_median_filtering/median.py
48abe34afab672efa7c1c1d1203ad447d85e25da
[]
no_license
jrkns/digi_images
89b14d720266c97f5bea50e58966ae7d9409e734
5c97a5b29b0694540e61efa15e7d65bb55ee8504
refs/heads/master
2021-01-20T13:06:32.985730
2017-11-07T07:49:01
2017-11-07T07:49:01
101,735,385
0
0
null
null
null
null
UTF-8
Python
false
false
2,093
py
import sys from PIL import Image import numpy as np # P0 P1 P2 # P3 P4 P5 # P6 P7 P8 def med(array): length = len(array) if length%2 != 0: return array[(length//2)] return (array[(length//2)-1] + array[(length//2)]) // 2 def main(name): input_img = Image.open(name).convert('RGB') new_img = input_img.copy() w, h = input_img.size for x in range(w): for y in range(h): ignore = [False]*9 P = [(0,0,0)]*9 P[4] = input_img.getpixel((x,y)) try: P[0] = input_img.getpixel((x-1,y-1)) except: ignore[0] = True try: P[1] = input_img.getpixel((x,y-1)) except: ignore[1] = True try: P[2] = input_img.getpixel((x+1,y-1)) except: ignore[2] = True try: P[3] = input_img.getpixel((x-1,y)) except: ignore[3] = True try: P[5] = input_img.getpixel((x+1,y)) except: ignore[5] = True try: P[6] = input_img.getpixel((x-1,y+1)) except: ignore[6] = True try: P[7] = input_img.getpixel((x,y+1)) except: ignore[7] = True try: P[8] = input_img.getpixel((x+1,y+1)) except: ignore[8] = True red = list() green = list() blue = list() for i in range (len(ignore)): if not ignore[i]: red.append(P[i][0]) green.append(P[i][1]) blue.append(P[i][2]) red = sorted(red) green = sorted(green) blue = sorted(blue) new_img.putpixel((x,y),(med(red),med(green),med(blue))) # Save image new_img.save('out.png') if __name__ == '__main__': try: main(sys.argv[-1]) except: main('in.png')
de8792347405aadd837977316f12004147297193
8ed1430279ae52fd950dd0afe88549a100001e26
/share/qt/extract_strings_qt.py
fefe2a907b40cfcfc4faa38e5f166048293fadca
[ "MIT" ]
permissive
mirzaei-ce/core-najafbit
9fb70dbd4e17ec1635d7b886db17f8aab3f592bb
6de34210a9ba9cc3f21fee631bc1a1f4d12d445d
refs/heads/master
2021-08-11T08:53:58.165742
2017-11-13T13:00:14
2017-11-13T13:00:14
110,548,740
0
0
null
null
null
null
UTF-8
Python
false
false
1,876
py
#!/usr/bin/python ''' Extract _("...") strings for translation and convert to Qt4 stringdefs so that they can be picked up by Qt linguist. ''' from subprocess import Popen, PIPE import glob import operator import os import sys OUT_CPP="qt/najafbitstrings.cpp" EMPTY=['""'] def parse_po(text): """ Parse 'po' format produced by xgettext. Return a list of (msgid,msgstr) tuples. """ messages = [] msgid = [] msgstr = [] in_msgid = False in_msgstr = False for line in text.split('\n'): line = line.rstrip('\r') if line.startswith('msgid '): if in_msgstr: messages.append((msgid, msgstr)) in_msgstr = False # message start in_msgid = True msgid = [line[6:]] elif line.startswith('msgstr '): in_msgid = False in_msgstr = True msgstr = [line[7:]] elif line.startswith('"'): if in_msgid: msgid.append(line) if in_msgstr: msgstr.append(line) if in_msgstr: messages.append((msgid, msgstr)) return messages files = sys.argv[1:] # xgettext -n --keyword=_ $FILES XGETTEXT=os.getenv('XGETTEXT', 'xgettext') child = Popen([XGETTEXT,'--output=-','-n','--keyword=_'] + files, stdout=PIPE) (out, err) = child.communicate() messages = parse_po(out) f = open(OUT_CPP, 'w') f.write(""" #include <QtGlobal> // Automatically generated by extract_strings.py #ifdef __GNUC__ #define UNUSED __attribute__((unused)) #else #define UNUSED #endif """) f.write('static const char UNUSED *najafbit_strings[] = {\n') messages.sort(key=operator.itemgetter(0)) for (msgid, msgstr) in messages: if msgid != EMPTY: f.write('QT_TRANSLATE_NOOP("najafbit-core", %s),\n' % ('\n'.join(msgid))) f.write('};\n') f.close()
29cb92ebf6d3cf17309ccaf072ef6e2e474b7d99
642b7138da231474154a83c2dc3b4a2a42eb441b
/dp/largest_divisible_pairs.py
e811a9c6a31e06296c315fdc14696bec6b2b0bc9
[]
no_license
somanshu/python-pr
15465ed7182413591c709f9978420f6a16c9db91
7bfee6fc2a8340ba3e343f991a1da5bdb4ae9cb2
refs/heads/master
2020-07-02T17:21:37.132495
2019-08-22T08:04:11
2019-08-22T08:04:11
201,602,731
0
0
null
null
null
null
UTF-8
Python
false
false
722
py
# Largest divisible pairs subset # Input : arr[] = {10, 5, 3, 15, 20} # Output : 3 # Explanation: The largest subset is 10, 5, 20. # 10 is divisible by 5, and 20 is divisible by 10. def get_largest(arr): n = len(arr) arr.sort() dp = [0 for i in range(n)] path = [f"{arr[i]}" for i in range(n)] dp[n-1] = 1 for i in range(n-2, -1, -1): dp[i] = 1 for j in range(i+1, n): if (arr[j] % arr[i] == 0): path[i] = f"{path[i]} {path[j]}" dp[i] += dp[j] break resIndex = dp.index(max(dp)) return { "val": dp[resIndex], "path": path[resIndex] } arr = [1, 3, 6, 13, 17, 18] print(get_largest(arr))
75b6f2e998e6c86cf2cb96d28959a03cab166a1a
67dbbc795444af048cc1dd0ff5190cbc97317f3e
/production/waldo_detector.py
503517bbde11839a604a6e33ae19d4e5475170c9
[]
no_license
chosun41/wheres_waldo
73b6b724cab109ec80fe97a5e79b387bb48a2abc
d36bd05e50cf95e9b5776ff25ea655cee61116dc
refs/heads/main
2023-05-27T20:38:45.614322
2021-06-14T04:44:01
2021-06-14T04:44:01
374,183,498
0
0
null
null
null
null
UTF-8
Python
false
false
3,691
py
import warnings warnings.simplefilter(action='ignore', category=FutureWarning) import numpy as np import tensorflow as tf import streamlit as st st.write(st.config.get_option("server.enableCORS")) from matplotlib import pyplot as plt import matplotlib import matplotlib.patches as patches from PIL import Image from io import BytesIO from object_detection.utils import label_map_util from object_detection.utils import visualization_utils as vis_util st.set_option('deprecation.showfileUploaderEncoding', False) st.title("Waldo Object Detection") label_map = label_map_util.load_labelmap('labels.txt') categories = label_map_util.convert_label_map_to_categories(label_map, max_num_classes=1, use_display_name=True) category_index = label_map_util.create_category_index(categories) # load frozen inference graph @st.cache(allow_output_mutation=True) def load_model(): detection_graph = tf.Graph() with detection_graph.as_default(): od_graph_def = tf.compat.v1.GraphDef() with tf.io.gfile.GFile('frozen_inference_graph.pb', 'rb') as fid: serialized_graph = fid.read() od_graph_def.ParseFromString(serialized_graph) tf.import_graph_def(od_graph_def, name='') return detection_graph with st.spinner('Loading Model Into Memory....'): detection_graph = load_model() def load_image_into_numpy_array(image): (im_width, im_height) = image.size # original size return np.array(image.getdata()).reshape((im_height, im_width, 3)).astype(np.uint8) img_file_buffer = st.file_uploader("Upload Image to Detect Waldo....") # display image with box for waldo if img_file_buffer is not None: with st.spinner('Searching for Waldo in image ...'): with detection_graph.as_default(): with tf.compat.v1.Session(graph=detection_graph) as sess: orig_image = img_file_buffer.getvalue() image_np = load_image_into_numpy_array(Image.open(img_file_buffer)) image_tensor = detection_graph.get_tensor_by_name('image_tensor:0') boxes = detection_graph.get_tensor_by_name('detection_boxes:0') scores = detection_graph.get_tensor_by_name('detection_scores:0') classes = detection_graph.get_tensor_by_name('detection_classes:0') num_detections = detection_graph.get_tensor_by_name('num_detections:0') # Actual detection. (boxes, scores, classes, num_detections) = sess.run( [boxes, scores, classes, num_detections], feed_dict={image_tensor: np.expand_dims(image_np, axis=0)}) vis_util.visualize_boxes_and_labels_on_image_array( image_np, np.squeeze(boxes), np.squeeze(classes).astype(np.int32), np.squeeze(scores), category_index, use_normalized_coordinates=True, # allows boxes to conform to plot figure line_thickness=8) # control size of figure plt.figure(figsize=(24,16)) st.image(image_np) st.write("Image Uploaded Successfully") if scores[0][0]<0.5: st.write("Waldo Not Detected!") else: st.write("Waldo Detected!") norm_box=boxes[0][0] im_width,im_height=image_np.shape[0],image_np.shape[1] st.write(f"The original size of the image is {image_np.shape}") box = (int(norm_box[1]*im_height),int(norm_box[0]*im_width),int(norm_box[3]*im_height),int(norm_box[2]*im_width)) st.write(f"The coordinates of waldo in the original image is {box} - (xmin,ymin,xmax,ymax)") cropped_image = image_np[box[1]:box[3],box[0]:box[2],:] st.write(f"The size of the cropped image is {cropped_image.shape}") st.image(cropped_image)
6d0779593c9062f253a2f7388b745a60c7976aeb
119c010e2d41cf65a854116fe92dd645386c8eb1
/gllib/examples/multiwindow.py
becee35e22894a5e41da505fb1b3fd25e6a610bc
[]
no_license
keksnicoh/opengl_plot_prototype
052c93f22f12f405247577c48ca30cb66b5f54e7
c3d5364eecc7955198ba69950cae4fafe863f28b
refs/heads/master
2020-12-29T01:00:13.527803
2016-06-30T10:12:34
2016-06-30T10:12:34
41,973,105
1
0
null
null
null
null
UTF-8
Python
false
false
598
py
from gllib.application import GlWindow, GlApplication from gllib.controller import Controller from gllib.plot.plotter2d import Plotter from gllib.plot.domain import RealAxis from gllib.plot.graph import Line2d app = GlApplication() window1 = GlWindow(200, 200, x=0, y=0) window2 = GlWindow(200, 200, x=0, y=210) def plot_main(plotter): domain = RealAxis(length=100) plotter.graphs['test'] = Line2d(domain, "y=sin(x)") plotter = Plotter() window1.set_controller(plotter) window2.set_controller(Plotter()) app.windows.extend([window1, window2]) app.init() plot_main(plotter) app.run()
[ "Jesse Hinrichsen" ]
Jesse Hinrichsen
e7248625f3c05adbc85b54603d844980a8032b86
6d297282da2f549e67890f7d7fa4afa00c22d01f
/searchs/models.py
5b3e6159adc99b2ee9f9d24be8245766b97294e9
[]
no_license
nikoniko7zzz/Aione
7134008385d8e803620dc06eefee9d900bc4029f
89a20471b9afa351edf24f51b7ace269a72177e2
refs/heads/master
2023-07-02T02:10:56.900257
2021-08-12T05:55:57
2021-08-12T05:55:57
395,231,188
0
0
null
null
null
null
UTF-8
Python
false
false
490
py
from django.conf import settings from django.db import models class Search(models.Model): keyword1 = models.CharField('キーワード1', max_length=128) keyword2 = models.CharField('キーワード2', max_length=128) keyword3 = models.CharField('キーワード3', max_length=128) created_at = models.DateTimeField("作成日", auto_now_add=True) updated_at = models.DateTimeField("更新日", auto_now=True) def __str__(self): return self.keyword1
cfd77598d0a3294800f4f91ca901764f9a431a0f
c4cb645799539089f89b3203a7ce88ba85cde199
/src/development/vortex/development/utils/type_utils.py
a879dc18a11993d78969290275741151649e9e0b
[]
no_license
jesslynsepthiaa/vortex
2533d245f3003c649205af51f7692d6022d6638f
1532db8447d03e75d5ec26f93111270a4ccb7a7e
refs/heads/master
2023-01-10T19:20:25.190350
2020-11-13T07:20:39
2020-11-13T07:20:39
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,117
py
from typing import Union, Tuple, List from multipledispatch import dispatch ## python 3.8 -> typing.get_origin(model_type), typing.get_args(model_type) def get_origin(annotation): if hasattr(annotation, '__origin__'): return annotation.__origin__ else: return type(annotation) def get_args(annotation) -> Tuple[type]: if get_origin(annotation) in (Union, Tuple, List): return annotation.__args__ elif isinstance(annotation, type): return tuple(annotation) else: raise TypeError("unsupported") @dispatch(list, type) def _match_annotation(lhs, rhs): return rhs in lhs @dispatch(type, list) def _match_annotation(lhs, rhs): return _match_annotation(rhs, lhs) @dispatch(list, list) def _match_annotation(lhs, rhs): return any(r in lhs for r in rhs) @dispatch(type, type) def _match_annotation(lhs, rhs): return lhs == rhs def match_annotation(lhs, rhs): if get_origin(lhs) in (Union,): lhs = list(get_args(lhs)) if get_origin(rhs) in (Union,): rhs = list(get_args(rhs)) return _match_annotation(lhs, rhs)
09ab7a4a3d994633a0c37f67755c4ad8f568a956
1900d436c6ea213f5db159e3010528f1c7058036
/extractpages.py
a0690d974581295b4086c231bbfb630874ab9a08
[]
no_license
fabstao/extractpages
c3c3a477e80dee31a874fa623fcbf3d4b9dc3f45
a75e853a4294d788ea61496afac845eb4150a9f1
refs/heads/master
2022-04-26T00:30:02.931378
2020-04-22T00:54:42
2020-04-22T00:54:42
257,747,208
0
0
null
null
null
null
UTF-8
Python
false
false
704
py
#!/usr/bin/env python import os,sys from PyPDF2 import PdfFileReader, PdfFileWriter def pdf_splitter(path): fname = os.path.splitext(os.path.basename(path))[0] pdf = PdfFileReader(path) for page in range(pdf.getNumPages()): pdf_writer = PdfFileWriter() pdf_writer.addPage(pdf.getPage(page)) output_filename = '{}_page_{}.pdf'.format( fname, page+1) with open(output_filename, 'wb') as out: pdf_writer.write(out) print('Created: {}'.format(output_filename)) if __name__ == '__main__': if len(sys.argv) >= 2: path = sys.argv[1] pdf_splitter(path) else: print("ERROR: Uso: "+sys.argv[0]+" <archivo.pdf>") quit(1)
8b9a977a790a19ebddc3271fbbacfc37b5fc2cc5
b682860528efc2242623946adf1c476c9bb3d6c3
/Wechart/settings.py
eed9de84a17ceae41b1fdf23bbca9bdf2b85fb4d
[]
no_license
sunqiang25/Wechart
c2b941b4418d08c5c4d1675b8d7df25619333ed3
1b8f35350794e067f769d0166aaded0fb7d6a553
refs/heads/master
2020-03-12T01:29:38.475763
2018-04-20T15:22:28
2018-04-20T15:22:28
130,375,827
0
0
null
null
null
null
UTF-8
Python
false
false
2,741
py
""" Django settings for Wechart project. Generated by 'django-admin startproject' using Django 1.8.2. For more information on this file, see https://docs.djangoproject.com/en/1.8/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.8/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) import os BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/1.8/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = '0$e3s1r5u!#z7+5vn-u+w6(6-%2svsar@j*sc#2%)3-w$dm-qq' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = ['39.106.189.163'] # Application definition INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'TestModel', ) MIDDLEWARE_CLASSES = ( 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.auth.middleware.SessionAuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.security.SecurityMiddleware', ) ROOT_URLCONF = 'Wechart.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [BASE_DIR+"/templates",], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'Wechart.wsgi.application' # Database # https://docs.djangoproject.com/en/1.8/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.mysql', 'NAME': 'test', 'User': 'root', 'PASSWORD': 'sq416221@', 'HOST': 'localhost', 'PORT': '' } } # Internationalization # https://docs.djangoproject.com/en/1.8/topics/i18n/ LANGUAGE_CODE = 'en-us' TIME_ZONE = 'UTC' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.8/howto/static-files/ STATIC_URL = '/static/'
66b9a7e45b140bf99b71a6e3e6c26f59fb5dd040
feb66fe43b98599fa1ee9a3605e3069c6e443aeb
/functions/openapp.py
b93ec647ddcd73e74e62f2325f95fa6244e82366
[]
no_license
LsMacox/Jarvis-PC
f7c77ed8cd565fbb4e1ce3a5ff19732322931cf2
0a5b32383966c954e40ca3dbd88b4a9db59c47ca
refs/heads/master
2021-05-20T03:07:13.909668
2020-04-01T11:51:09
2020-04-01T11:51:09
252,159,671
0
0
null
null
null
null
UTF-8
Python
false
false
3,186
py
import os import subprocess import platform alias = { 'google chrome': ['гугл', 'google', 'хром', 'хроме', 'google chrome', 'гугл хром', 'гугл хроме'], 'wps pdf': [''], 'skype preview': ['skype'], 'avocode': [''], 'atom': [''], 'crossover': [''], 'mysql workbench': [''], 'terminal': [''], 'electerm': [''], 'музыка': [''], 'компьютер': [''], 'transmission': [''], 'team': [''], 'phpstorm': [''], 'корзина': [''], 'календарь': [''], 'калькулятор': [''], 'восстановление': [''], 'remmina': [''], 'oracle vm virtualbox': [''], 'discord': [''], 'app store': [''], 'снимок': [''], 'редактор': [''], 'диктофон': [''], 'pycharm professional': [''], 'менеджр пакетов synaptic': [''], 'файловый менеджр': [''], 'центр управления': [''], 'запись с экрана': [''], 'idle 3': [''], 'arduino ide': [''], 'filezilla': [''], 'менеджер пакетов': [''], 'медиаплеер vlc': [''], 'adobe photoshop cs6': [''], 'visual studio code': [''], } class OpenApps: def __init__(self, name): self.name = name self.app_name = self.get_app_name(); self.path = '' def os_check(self, name): if platform.system().lower() == name: return True else: return False def get_app_name(self): app_name = '' for alia in alias: for synonym in alias[alia]: if synonym == self.name: app_name = alia.lower() break return app_name def get_linux_path(self, static_path): files = os.listdir(static_path) for file in files: if file.find('.desktop') != -1: with open(os.path.join(static_path, file), 'r', encoding='utf-8', errors='ignore') as f: for num, line in enumerate(f): line = line.lower() if line.find('name=' + self.app_name) != -1: self.path = static_path + file for path in f: if path.lower().find('exec=') != -1: path = path.replace('Exec=', '') path = path.replace('exec=', '') self.path = path break else: self.path = False def get_linux_app_path(self): static_path_1 = "/usr/share/applications/" if os.path.exists(static_path_1): self.get_linux_path(static_path_1) def start(self): if self.os_check('linux'): self.get_linux_app_path() try: if self.path: cmd = 'nohup ' + self.path subprocess.Popen(cmd, shell=True) except UnboundLocalError: print('App not found')
591b4bce0c9b3eafaafb3a2de89ecac90cc30beb
3c52faabf5948f375098e119515b227734db6fc5
/codeforces/478/C.py
ccc89be6753632b7df701a42eddb900128b70163
[]
no_license
Akash-Kunwar/CP
d693237e7adafdbff37e4dc13edd45ee68494d29
c55c80e91d24039f4f937d9fd0604e09cbd34d35
refs/heads/master
2023-02-02T04:40:08.357342
2020-04-13T14:53:00
2020-12-21T15:32:40
323,367,319
0
0
null
null
null
null
UTF-8
Python
false
false
123
py
a=list(map(int,input().split())) a.sort() if(2*(a[0]+a[1])<=a[2]): print(a[0]+a[1]) else: print((a[0]+a[1]+a[2])//3)
577f29560901bb08e5c23d7a65f738f36a09d0b8
a52cb1a0dd8e6a5c9f91e36e9df611253baf1898
/qrs_detect/test/do_test_predictor.py
d795f75e6ef8d1799bb1156e923771df72e97814
[]
no_license
fraimondo/qrs-detector
5b9f9ee4afa580469f0545593cc62655f6046a01
a555a4e1812706a1d3b83cbc9d15364e9c65be07
refs/heads/master
2021-06-17T11:03:08.767810
2017-06-02T07:42:53
2017-06-02T07:42:53
93,139,309
0
0
null
null
null
null
UTF-8
Python
false
false
3,309
py
import time import sys import math sys.path.append('../sim/') from qrs_detect import QRSDetector, QRSPredictor from EdfReader import EdfReader as Er import numpy as np fname = '../data/test257-280-3.edf' # fname = '../data/PHYSIENS_2014-10-100004.edf' secs = 10 # secs = 40 channel = 2 # channel = 6 buf_size = 2 er = Er(fname) er.set_channels([channel]) buf_size = 10 samps = er.read_all_samples(secs).squeeze() n_samps = len(samps) sfreq = er.sampling_rate(2) qrsl = int(math.ceil(sfreq * 0.097)) hbl = int(math.ceil(sfreq * 0.611)) q = QRSDetector(sfreq=sfreq, debug=True) peaks = [] detect_times = np.zeros((n_samps, 1), dtype=np.double) for i, ist in enumerate(range(0, n_samps, buf_size)): st = time.time() new_peaks, n_samp = q.add_detect(samps[ist:ist + buf_size]) if len(new_peaks) > 0: peaks = peaks + new_peaks.tolist() end = time.time() detect_times[i] = end - st print peaks peaks = np.array(peaks).ravel() all_predictions = [] all_predictions_samps = [] # weights = [ # (np.array([1]), 'constant n=1'), # (np.ones((3)), 'constant n=3'), # (np.ones((5)), 'constant n=5'), # (np.arange(1, 3), 'linear n=3'), # (np.arange(1, 6), 'linear n=5'), # (np.arange(1, 11), 'linear n=10') # ] # import matplotlib.pyplot as plt # # fig, axes = plt.subplots(2, 3) # # # plt.title('Diferences Prediction - Peaks') # for i, (ax, (w, label)) in enumerate(zip(axes.ravel(), weights)): # # q = QRSPredictor(sfreq=sfreq, weights=w) # predictions = [] # predictions_samps = [] # predict_times = np.zeros((n_samps, 1), dtype=np.double) # for i, ist in enumerate(range(0, n_samps, buf_size)): # st = time.time() # p, d, m, samp = q.predict(samps[ist:ist + buf_size]) # if d is not None and len(d) > 0: # print d # if p is not None: # if p not in predictions: # predictions.append(p) # predictions_samps.append(q.detector.nsamples) # end = time.time() # predict_times[i] = end - st # # predictions = np.array(predictions).ravel() # predictions_samps = np.array(predictions_samps).ravel() # all_predictions.append(predictions) # all_predictions_samps.append(predictions_samps) # dif = peaks[2:] - predictions[:-1] # ax.hist(dif, 50) # ax.set_title(label) # m = np.median(dif) # ax.axvline(m, color='r', label='median {:.2f}'.format(m)) # m = np.mean(dif) # ax.axvline(m, color='g', label='mean {:.2f}'.format(m)) # m = np.std(dif) # ax.axvline(m, color='b', label='std {:.2f}'.format(m)) # ax.legend() # plt.figure() # plt.plot(samps) # # [plt.axvline(x, color='r', ls='--') for x in peaks] # [plt.axvline(x, color='g', ls='--') for x in predictions] # # plt.legend(['Raw signal', 'IIR Realtime', 'Predicted']) # plt.show() # plt.figure() sign = plt.plot(samps) a = [plt.axvline(x, color='r', ls='--') for x in peaks] b = [plt.axvline(x, color='g', ls='--') for x in predictions] plt.legend(['Raw signal', 'IIR Realtime', 'Predicted'], [sign, a[0], b[0]]) # # dif = peaks[2:] - predictions[:-1] # plt.figure() # plt.hist(dif, 50) # plt.title('Peaks - predictions') # # # plt.figure() # dif = predictions - predictions_samps # plt.hist(dif, 50) # plt.title('Predictions - sample when predicting') plt.show()
6527899277157f27281d95d4c9bc7b42aaa60277
09a4140b73991d6414dd5d53732ac6a66348bde2
/0x0B-python-input_output/0-read_file.py
c7ca53e2642f28652a842bc97c08787e4f9182d5
[]
no_license
yosef-kefale/holbertonschool-higher_level_programming
ee99e18eb0889ba80375809662b7965040bd6a30
f5021660778b97a947de4e982ab500ef85044c10
refs/heads/master
2022-08-21T17:28:47.123740
2018-09-09T22:43:19
2018-09-09T22:43:19
null
0
0
null
null
null
null
UTF-8
Python
false
false
209
py
#!/usr/bin/python3 def read_file(filename=""): """open and read a file Args filename """ with open(filename, encoding='UTF8') as f: text = f.read() print(text, end='')
2f843ac9d5e7497fd030c057527295003f46e7db
3e9139ee53b97f8c8a20e1b24c4f9c61221ddd1d
/Innlev_6/motorsykkel.py
929c0212c98eff2027b1694bd68234457c20cc17
[]
no_license
wangton-Raw/IN1000Assigment
6e7c4ef489eaf4e87b9a533d84f93e9201059518
386b1e90840aa5955617a054a6d0f61e22779cdc
refs/heads/main
2023-06-13T02:57:24.688023
2021-07-10T18:58:09
2021-07-10T18:58:09
384,764,647
1
0
null
null
null
null
UTF-8
Python
false
false
419
py
class Motorsykkel: def __init__(self,merke, registerNr, kilometer): self.merke = merke self.registerNr = registerNr self.kilometer = kilometer def kjor(self,km): self.kilometer = self.kilometer + km def hentKilometerstand(self): return self.kilometer def SkrivUt(self): print(self.merke) print(self.registerNr) print(self.kilometer)
f17fd0ff8209bab27020b6cb62b5007480ce389f
32a2963aa5b46506814816b61bdb846ce9c203ff
/weather/post_compression/bin2txt.py
552131f7504c22b12c376d97c2f37717b4a4318b
[]
no_license
leemagnusson/boatlogger2
5e347b56f05ad7ac45c0b03c982ae6b6f7608222
9334e550996ab851923b3b1c4ef7d4b99e64899e
refs/heads/master
2021-01-10T08:37:01.758444
2015-06-03T17:34:50
2015-06-03T17:34:50
36,748,843
1
0
null
null
null
null
UTF-8
Python
false
false
133
py
#!/usr/bin/python3 import sys data = open(sys.argv[1], 'rb').read() binary = ''.join([format(b, 'b') for b in data]) print(binary)
[ "beevek@f89a8b19-fc4c-1111-860b-ebfafb781f11" ]
beevek@f89a8b19-fc4c-1111-860b-ebfafb781f11
d26275536393cb1c5d88a3a802766f888e9cae2e
44110dbe639be4a3ca1fc37fddb5f8ecd1fdbdd3
/04_text_bit_calc.py
2c8513f2a33d88b31198dc210abfc3923c168083
[]
no_license
tchisholm-DTI/02_bit_calculator
f94d41981b371745719327695ff84b72079a67a7
51d8d28d906f380d7196825f82ecf8a30b633129
refs/heads/main
2023-06-07T02:50:38.547627
2021-07-01T08:35:26
2021-07-01T08:35:26
376,970,893
0
0
null
null
null
null
UTF-8
Python
false
false
583
py
# Calculates the # of bits for text (# of characters x 8) def text_bits(): print() # Ask user for a string ... var_text = input("Enter some text: ") # Calculate # of bits (length of string x 8) var_length = len(var_text) num_bits = 8 * var_length # Outputs answer with working print() print("\ '{}\' has {} characters ...".format(var_text, var_length)) print("# of bits is {} x 8...".format(var_length)) print("We need {} bits to represent {}".format(num_bits, var_text)) print() return "" # Main routine goes here text_bits()
143bec79e95c20b944cf1e40780dd40ad74be598
0a1c24797fed333eeba09d0767876e519fa827e6
/process.py
43e7613b9f9060afa8ef720ac74fa1f7b14019e0
[]
no_license
wchh-2000/Parking_data_analysis
72367f6b98dee9e53f601994b94c39f7e6f282cb
912bacf2ea088e6caae391c4c38b63d6364e7d6b
refs/heads/main
2023-05-31T03:23:17.079322
2021-06-06T14:04:35
2021-06-06T14:04:35
374,370,994
5
1
null
null
null
null
UTF-8
Python
false
false
2,143
py
def process(s):#输入Series owner_sum 不同时间段业主的在库车数量 本文件与时间段长度相关的为allbar中name import pandas as pd dfn=pd.DataFrame({'num':s.values,'datetime':s.index}) dfn['week']=list(map(datetime2week,dfn['datetime']))#星期类型 weekday/weekend dfn['time']=[i.time() for i in dfn['datetime']] #每个元素Timestamp类的 time方法返回时间 object类 maxnum=dfn.groupby([dfn['week'],dfn['time']])['num'].max() #Series类 双索引'week','time' 值'num'为相同索引下在库数量最大值 #print(maxnum['weekday'].values) meannum=dfn.groupby([dfn['week'],dfn['time']])['num'].mean() allbar('max','weekday',maxnum) allbar('max','weekend',maxnum) allbar('mean','weekday',meannum) allbar('mean','weekend',meannum) #return dfn def datetime2week(t):#输入Timestamp 2018-09-01 00:10:00 输出weekday/weekend import pandas as pd date=t.date()#Timestamp date方法返回日期 interval=(date-pd.to_datetime('2018-09-02').date()).days#2018-09-02为星期日 与其的天数差 #.days为Timedelta的属性 天数 int型 r=interval%7#余数0-6 余数0则为星期日 1为星期一 dic=[7,1,2,3,4,5,6] week=dic[r] if week in [6,7]: return 'weekend' else: return 'weekday' def allbar(s1,s2,S):#画统计好的不同时间段业主在库车数量 柱状图 #s1=mean/max s2=weekday/weekend 分组好处理过的Series S 如maxnum #S第一个索引week 第二个索引time import matplotlib.pyplot as plt import pylab as pyl #使matplotlib可显示中文 pyl.mpl.rcParams['font.sans-serif'] = ['SimHei'] #使matplotlib可显示中文 name=range(24) num=S[s2].values #S[s2,:]报错TypeError: ('weekday', slice(0, None, None)) plt.bar(range(len(num)), num,tick_label=name) title=s2+' '+s1 plt.title(title) plt.xlabel("时刻/点(h)") plt.ylabel('业主在库车数量') plt.grid() plt.yticks(range(0,560,20)) plt.savefig('./fig在库车数量统计结果/'+title+'.jpg',dpi=100)#指定分辨率100 plt.clf()#清空画布
2c98bad836e4801693c6c95f972ec383d5e6e2d5
cac52ce08c20333d81d9d9d1ee06f754c35aa31e
/backend/corpora/corpora/wsgi.py
a000552e618f149f26f4aa4e2c3d17a5ea6ffa3b
[]
no_license
AriBurr/corpora
4a0788bf89e28cd831dfcacc9220a09f9dd9d1c9
d30c607ff13b793228b00a45521be82f35a1df3f
refs/heads/master
2022-12-10T07:05:29.580307
2019-05-01T02:52:42
2019-05-01T02:52:42
176,421,389
0
2
null
2022-12-09T16:18:41
2019-03-19T04:09:17
Vue
UTF-8
Python
false
false
391
py
""" WSGI config for corpora project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.1/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'corpora.settings') application = get_wsgi_application()
4b5547d32b4bd2b931812d5078d801ce5e90c7ab
527c75d03c9bfd21694917b327d1280057d68fb5
/uclasm/graph_viz.py
e60d6a211c109c7bf6b802b680b24407cb741a1c
[ "MIT" ]
permissive
jdmoorman/uclasm
2f44d468dfff17557ee0e0a28c8edfd1e9dede60
ebecce0479415b1932480711133726cc9f7f4f8c
refs/heads/develop
2022-11-14T11:51:44.893579
2021-09-27T18:29:08
2021-09-27T18:29:08
148,378,128
20
3
MIT
2021-05-17T23:11:27
2018-09-11T20:46:09
Python
UTF-8
Python
false
false
1,696
py
import numpy as np import matplotlib import graphviz as gv def get_gv_graph(graph, eq_classes=None, with_node_labels=False, with_edge_labels=False, node_key='rdf:type', edge_key='rdf:type'): cmap1 = plt.get_cmap('Set1') cmap3 = plt.get_cmap('Set3') if eq_classes: nontrivial_classes = [eq_class for eq_class in eq_classes if len(eq_class) > 1] gv_graph = gv.Digraph() for i in range(graph.n_nodes): node_name = graph.nodelist[node_key][i] if eq_classes: eq_class = [eq_class for eq_class in eq_classes if i in eq_class][0] if eq_class in nontrivial_classes: idx = nontrivial_classes.index(eq_class) color = matplotlib.colors.rgb2hex(cmap3.colors[idx % len(cmap3.colors)]) else: idx = 8, color = matplotlib.colors.rgb2hex(cmap1.colors[idx]) else: color = matplotlib.colors.rgb2hex(cmap1.colors[8]) if with_node_labels: gv_graph.node(str(i), label=node_name, color=color, style='filled') else: gv_graph.node(str(i), color=color, style='filled') for v1, v2 in zip(graph.edgelist['node1'], graph.edgelist['node2']): v1_index, v2_index = graph.node_idxs[v1], graph.node_idxs[v2] if with_edge_labels: edge = graph.edgelist[(graph.edgelist['node1'] == v1) & (graph.edgelist['node2'] == v2)][edge_key] gv_graph.edge(str(v1_index), str(v2_index), label=str(list(edge)[0])) else: gv_graph.edge(str(v1_index), str(v2_index)) gv_graph.engine = 'fdp' return gv_graph
a52b47d7add0c7dd2c13b5e231c31693c9684e03
22ab78fa4bcb07ac2fdf1a5cd65ca6d6a29df435
/ball4.py
1d20c901588ca3699d06a4b1c629cf5454b6f058
[ "Apache-2.0" ]
permissive
polowis/ping-_pong_game
671428745a5a6c29e5279cfe05b54ed2f4f6b772
23467ab8ef01aa3f901bb5f17f8b11df4f4f3734
refs/heads/master
2020-05-28T09:09:47.389531
2019-06-15T14:34:14
2019-06-15T14:34:14
188,951,348
0
0
null
null
null
null
UTF-8
Python
false
false
4,261
py
""" 4.0.0 This is the final version of the ball movement, this WILL work. I will explain how to make this code work in the class If you're reading this, I just want to tell you, we nearly finish the assignment :)) (need to add scoring system and some other functions but thats ok). I have TESTED the code. but some minor bugs may occur. The code for paddle movement will be on the other file. HAPPY CODING :> 4.1.0 OOP version and non OOP version. Please use OOP version instead. Both versions have the same result, just different style of writing I have decided to combine movement paddle. Please use the class Ball code when submitting the assignment. """ from microbit import * import music import random import radio radio.on() class Ball: def __init__(self, x = 2, y = 2, xspeed = (random.choice([-1, 1])), yspeed = (random.choice([-1, 1]))): self.x = x self.y = y self.xspeed = xspeed self.yspeed = yspeed self.bottomPaddle = 1 self.topPaddle = 1 self.yspeed = (random.choice([-1, 1])) self.xspeed = (random.choice([-1, 1])) def __setPaddleTop(self): display.set_pixel(self.topPaddle, 0, 5) display.set_pixel((self.topPaddle - 1), 0, 5) def __setPaddleBottom(self): display.set_pixel(self.bottomPaddle, 4, 5) display.set_pixel(self.bottomPaddle - 1, 4, 5) def __getCurrentBallPosition(self): return self.x, self.y def __getSetPaddle(self): if self.bottomPaddle < 1: self.bottomPaddle = 1 elif self.bottomPaddle > 4: self.bottomPaddle = 4 def setPaddle(self, message): if message == "right": self.bottomPaddle += 1 elif message == "left": self.bottomPaddle -= 1 self.__getSetPaddle() return """ self.bottomPaddle += button_b.get_presses() self.bottomPaddle -= button_a.get_presses() if self.bottomPaddle < 1: self.bottomPaddle = 1 elif self.bottomPaddle > 4: self.bottomPaddle = 4 return """ def show(self): display.clear() self.__setPaddleTop() self.__setPaddleBottom() display.set_pixel(self.x, self.y, 9) sleep(1000) def AI(self): if (random.randint(1, 6)) != 1: if self.x < self.topPaddle - 1: self.topPaddle = self.topPaddle -1 elif self.x > self.topPaddle: self.topPaddle = self.topPaddle + 1 def render(self): self.__getCurrentBallPosition() display.set_pixel(self.x, self.y, 9) sleep(500) display.set_pixel(self.x, self.y, 0) sleep(500) def update(self): if self.y == 2: self.x = self.x + self.yspeed self.y = self.y + self.yspeed elif self.y == 1 or self.y == 3: if self.y == 1: if self.topPaddle == self.x: self.xspeed = 1 self.yspeed = 1 elif self.topPaddle - 1 == self.x: self.xspeed = -1 self.yspeed = 1 else: if self.bottomPaddle == self.x: self.xspeed = 1 self.yspeed = -1 elif self.bottomPaddle - 1 == self.x: self.xspeed = -1 self.yspeed = -1 self.x += self.xspeed self.y += self.yspeed else: self.x += self.xspeed self.y += self.yspeed if self.x <= 0 or self.x >= 4: self.xspeed = self.xspeed * -1 if self.y <= 0: return 1 elif self.y >= 4: return 2 else: return 0 ball = Ball() def function(): message = radion.receive() ball.setPaddle(message) ball.AI() edges = ball.update() ball.show() sleep(500) while True: function() ball.show() if ball.update() != 0: break sleep(500) if ball.update() == 1: display.show(Image.HAPPY) elif ball.update() == 2: display.show(Image.SAD)
a405dd016add0a976b3d15fb2efad48e5d1bb92a
f8eefef177c4794392ddbad008a67b10e14cb357
/common/python/ax/kubernetes/swagger_client/models/v1_fc_volume_source.py
9d448090061f6efbde6be77d0ffdd209014b098e
[ "Apache-2.0" ]
permissive
durgeshsanagaram/argo
8c667c7e64721f149194950f0d75b27efe091f50
8601d652476cd30457961aaf9feac143fd437606
refs/heads/master
2021-07-10T19:44:22.939557
2017-10-05T18:02:56
2017-10-05T18:02:56
105,924,908
1
0
null
2017-10-05T18:22:21
2017-10-05T18:22:20
null
UTF-8
Python
false
false
5,718
py
# coding: utf-8 """ No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen) OpenAPI spec version: Generated by: https://github.com/swagger-api/swagger-codegen.git """ from pprint import pformat from six import iteritems import re class V1FCVolumeSource(object): """ NOTE: This class is auto generated by the swagger code generator program. Do not edit the class manually. """ def __init__(self, target_ww_ns=None, lun=None, fs_type=None, read_only=None): """ V1FCVolumeSource - a model defined in Swagger :param dict swaggerTypes: The key is attribute name and the value is attribute type. :param dict attributeMap: The key is attribute name and the value is json key in definition. """ self.swagger_types = { 'target_ww_ns': 'list[str]', 'lun': 'int', 'fs_type': 'str', 'read_only': 'bool' } self.attribute_map = { 'target_ww_ns': 'targetWWNs', 'lun': 'lun', 'fs_type': 'fsType', 'read_only': 'readOnly' } self._target_ww_ns = target_ww_ns self._lun = lun self._fs_type = fs_type self._read_only = read_only @property def target_ww_ns(self): """ Gets the target_ww_ns of this V1FCVolumeSource. Required: FC target worldwide names (WWNs) :return: The target_ww_ns of this V1FCVolumeSource. :rtype: list[str] """ return self._target_ww_ns @target_ww_ns.setter def target_ww_ns(self, target_ww_ns): """ Sets the target_ww_ns of this V1FCVolumeSource. Required: FC target worldwide names (WWNs) :param target_ww_ns: The target_ww_ns of this V1FCVolumeSource. :type: list[str] """ if target_ww_ns is None: raise ValueError("Invalid value for `target_ww_ns`, must not be `None`") self._target_ww_ns = target_ww_ns @property def lun(self): """ Gets the lun of this V1FCVolumeSource. Required: FC target lun number :return: The lun of this V1FCVolumeSource. :rtype: int """ return self._lun @lun.setter def lun(self, lun): """ Sets the lun of this V1FCVolumeSource. Required: FC target lun number :param lun: The lun of this V1FCVolumeSource. :type: int """ if lun is None: raise ValueError("Invalid value for `lun`, must not be `None`") self._lun = lun @property def fs_type(self): """ Gets the fs_type of this V1FCVolumeSource. Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. :return: The fs_type of this V1FCVolumeSource. :rtype: str """ return self._fs_type @fs_type.setter def fs_type(self, fs_type): """ Sets the fs_type of this V1FCVolumeSource. Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. \"ext4\", \"xfs\", \"ntfs\". Implicitly inferred to be \"ext4\" if unspecified. :param fs_type: The fs_type of this V1FCVolumeSource. :type: str """ self._fs_type = fs_type @property def read_only(self): """ Gets the read_only of this V1FCVolumeSource. Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. :return: The read_only of this V1FCVolumeSource. :rtype: bool """ return self._read_only @read_only.setter def read_only(self, read_only): """ Sets the read_only of this V1FCVolumeSource. Optional: Defaults to false (read/write). ReadOnly here will force the ReadOnly setting in VolumeMounts. :param read_only: The read_only of this V1FCVolumeSource. :type: bool """ self._read_only = read_only def to_dict(self): """ Returns the model properties as a dict """ result = {} for attr, _ in iteritems(self.swagger_types): value = getattr(self, attr) if isinstance(value, list): result[attr] = list(map( lambda x: x.to_dict() if hasattr(x, "to_dict") else x, value )) elif hasattr(value, "to_dict"): result[attr] = value.to_dict() elif isinstance(value, dict): result[attr] = dict(map( lambda item: (item[0], item[1].to_dict()) if hasattr(item[1], "to_dict") else item, value.items() )) else: result[attr] = value return result def to_str(self): """ Returns the string representation of the model """ return pformat(self.to_dict()) def __repr__(self): """ For `print` and `pprint` """ return self.to_str() def __eq__(self, other): """ Returns true if both objects are equal """ if not isinstance(other, V1FCVolumeSource): return False return self.__dict__ == other.__dict__ def __ne__(self, other): """ Returns true if both objects are not equal """ return not self == other
23d826c97b4d4a30fe2c6510dc0c9978e0b79394
39354dfc8f61f57f022522a3e3a880c73a540d0d
/shenfun/chebyshev/la.py
f8577941aefb7ad55e988810e6a6e10afd9e8f08
[ "BSD-2-Clause" ]
permissive
mstf1985/shenfun
aab9cd416ea7cb549ef191ed9e32f4cd66d522d0
83a28b3f7142ef3bf60b20d707ba8c1d2f13a8ff
refs/heads/master
2022-12-10T20:27:51.825173
2020-08-28T13:58:58
2020-08-28T13:58:58
null
0
0
null
null
null
null
UTF-8
Python
false
false
21,278
py
#pylint: disable=line-too-long, missing-docstring from copy import copy import numpy as np from shenfun.optimization import optimizer from shenfun.optimization.cython import la from shenfun.la import TDMA as la_TDMA from shenfun.matrixbase import TPMatrix class TDMA(la_TDMA): def __call__(self, b, u=None, axis=0): if u is None: u = b else: assert u.shape == b.shape u[:] = b[:] if not self.dd.shape[0] == self.mat.shape[0]: self.init() self.TDMA_SymSolve(self.dd, self.ud, self.L, u, axis=axis) if self.mat.scale not in (1, 1.0): u /= self.mat.scale return u class Helmholtz(object): r"""Helmholtz solver .. math:: \alpha u'' + \beta u = b where :math:`u` is the solution, :math:`b` is the right hand side and :math:`\alpha` and :math:`\beta` are scalars, or arrays of scalars for a multidimensional problem. The user must provide mass and stiffness matrices with scale arrays :math:`(\alpha/\beta)` to each matrix. The matrices and scales can be provided as instances of :class:`.TPMatrix`, or :class:`.SpectralMatrix`. Parameters ---------- A : :class:`.SpectralMatrix` or :class:`.TPMatrix` mass or stiffness matrix B : :class:`.SpectralMatrix` or :class:`.TPMatrix` mass or stiffness matrix scale_A : array, optional Scale array to stiffness matrix scale_B : array, optional Scale array to mass matrix The two matrices must be one stiffness and one mass matrix. Which is which will be found by inspection if only two arguments are provided. The scales :math:`\alpha` and :math:`\beta` must then be available as A.scale and B.scale. If four arguments are provided they must be in the order - stiffness matrix, mass matrix, scale stiffness, scale mass Attributes ---------- axis : int The axis over which to solve for neumann : bool Whether or not bases are Neumann bc : BoundaryValues For Dirichlet problem with inhomogeneous boundary values Variables are extracted from the matrices The solver can be used along any axis of a multidimensional problem. For example, if the Chebyshev basis (Dirichlet or Neumann) is the last in a 3-dimensional TensorProductSpace, where the first two dimensions use Fourier, then the 1D Helmholtz equation arises when one is solving the 3D Poisson equation .. math:: \nabla^2 u = b With the spectral Galerkin method we multiply this equation with a test function (:math:`v`) and integrate (weighted inner product :math:`(\cdot, \cdot)_w`) over the domain .. math:: (v, \nabla^2 u)_w = (v, b)_w See :ref:`demo:poisson3d` for details, since it is actually quite involved. But basically, one obtains a linear algebra system to be solved along the :math:`z`-axis for all combinations of the two Fourier indices :math:`k` and :math:`l` .. math:: (A_{mj} - (k^2 + l^2) B_{mj}) \hat{u}[k, l, j] = (v, b)_w[k, l, m] Note that :math:`k` only varies along :math:`x`-direction, whereas :math:`l` varies along :math:`y`. To allow for Numpy broadcasting these two variables are stored as arrays of shape .. math:: k : (N, 1, 1) l : (1, M, 1) Here it is assumed that the solution array :math:`\hat{u}` has shape (N, M, P). Now, multiplying k array with :math:`\hat{u}` is achieved as an elementwise multiplication .. math:: k \cdot \hat{u} Numpy will then take care of broadcasting :math:`k` to an array of shape (N, M, P) before performing the elementwise multiplication. Likewise, the constant scale :math:`1` in front of the :math:`A_{mj}` matrix is stored with shape (1, 1, 1), and multiplying with :math:`\hat{u}` is performed as if it was a scalar (as it here happens to be). This is where the scale arrays come from. :math:`\alpha` is here :math:`1`, whereas :math:`\beta` is :math:`(k^2+l^2)`. Note that :math:`k+l` is an array of shape (N, M, 1). """ def __init__(self, *args): args = list(args) for i, arg in enumerate(args): if hasattr(arg, 'is_bc_matrix'): if arg.is_bc_matrix(): # For this particular case the boundary dofs contribution # to the right hand side is only nonzero for Fourier wavenumber # 0, so the contribution is in effect zero args.pop(i) break assert len(args) in (2, 4) A, B = args[0], args[1] M = {d.get_key(): d for d in (A, B)} self.A = A = M.get('ADDmat', M.get('ANNmat')) self.B = B = M.get('BDDmat', M.get('BNNmat')) if len(args) == 2: self.alfa = self.A.scale self.beta = self.B.scale if isinstance(self.A, TPMatrix): self.A = self.A.pmat self.B = self.B.pmat self.alfa *= self.A.scale self.beta *= self.B.scale elif len(args) == 4: self.alfa = args[2] self.beta = args[3] A, B = self.A, self.B B[2] = np.broadcast_to(B[2], A[2].shape) B[-2] = np.broadcast_to(B[-2], A[2].shape) v = A.testfunction[0] neumann = self.neumann = v.boundary_condition() == 'Neumann' self.axis = A.axis shape = [1] T = A.tensorproductspace if T is not None: shape = list(T.shape(True)) shape[A.axis] = 1 self.alfa = np.atleast_1d(self.alfa) self.beta = np.atleast_1d(self.beta) if not self.alfa.shape == shape: self.alfa = np.broadcast_to(self.alfa, shape).copy() if not self.beta.shape == shape: self.beta = np.broadcast_to(self.beta, shape).copy() shape[self.axis] = A.shape[0] + 2 self.u0 = np.zeros(shape) # Diagonal entries of U self.u1 = np.zeros(shape) # Diagonal+2 entries of U self.u2 = np.zeros(shape) # Diagonal+4 entries of U self.L = np.zeros(shape) # The single nonzero row of L self.LU_Helmholtz(A, B, self.alfa, self.beta, neumann, self.u0, self.u1, self.u2, self.L, self.axis) @staticmethod @optimizer def LU_Helmholtz(A, B, As, Bs, neumann, u0, u1, u2, L, axis=0): raise NotImplementedError @staticmethod @optimizer def Solve_Helmholtz(b, u, neumann, u0, u1, u2, L, axis=0): raise NotImplementedError def __call__(self, u, b): """Solve matrix problem Parameters ---------- b : array Array of right hand side on entry and solution on exit unless u is provided. u : array Output array If b and u are multidimensional, then the axis over which to solve for is determined on creation of the class. """ self.Solve_Helmholtz(b, u, self.neumann, self.u0, self.u1, self.u2, self.L, self.axis) if self.A.testfunction[0].has_nonhomogeneous_bcs: self.A.testfunction[0].bc.set_boundary_dofs(u, True) return u def matvec(self, v, c): """Matrix vector product c = dot(self, v) Parameters ---------- v : array c : array Returns ------- c : array """ assert self.neumann is False c[:] = 0 self.Helmholtz_matvec(v, c, self.alfa, self.beta, self.A[0], self.A[2], self.B[0], self.axis) return c @staticmethod @optimizer def Helmholtz_matvec(v, b, alfa, beta, dd, ud, bd, axis=0): raise NotImplementedError("Use Cython or Numba") class Biharmonic(object): r"""Multidimensional Biharmonic solver for .. math:: a_0 u'''' + \alpha u'' + \beta u = b where :math:`u` is the solution, :math:`b` is the right hand side and :math:`a_0, \alpha` and :math:`\beta` are scalars, or arrays of scalars for a multidimensional problem. The user must provide mass, stiffness and biharmonic matrices with associated scale arrays :math:`(a_0/\alpha/\beta)`. The matrices and scales can be provided in any order Parameters ---------- S : :class:`.TPMatrix` or :class:`.SpectralMatrix` A : :class:`.TPMatrix` or :class:`.SpectralMatrix` B : :class:`.TPMatrix` or :class:`.SpectralMatrix` scale_S : array, optional scale_A : array, optional scale_B : array, optional If only three arguments are passed, then we decide which matrix is which through inspection. The three scale arrays must then be available as S.scale, A.scale, B.scale. If six arguments are provided they must be in order S, A, B, scale S, scale A, scale B. Variables are extracted from the matrices The solver can be used along any axis of a multidimensional problem. For example, if the Chebyshev basis (Biharmonic) is the last in a 3-dimensional TensorProductSpace, where the first two dimensions use Fourier, then the 1D equation listed above arises when one is solving the 3D biharmonic equation .. math:: \nabla^4 u = b With the spectral Galerkin method we multiply this equation with a test function (:math:`v`) and integrate (weighted inner product :math:`(\cdot, \cdot)_w`) over the domain .. math:: (v, \nabla^4 u)_w = (v, b)_w See `the Poisson problem <https://rawgit.com/spectralDNS/shenfun/master/docs/src/mekit17/pub/._shenfun_bootstrap004.html#sec:tensorproductspaces>`_ for details, since it is actually quite involved. But basically, one obtains a linear algebra system to be solved along the :math:`z`-axis for all combinations of the two Fourier indices :math:`k` and :math:`l` .. math:: (S_{mj} - 2(k^2 + l^2) A_{mj}) + (k^2 + l^2)^2 B_{mj}) \hat{u}[k, l, j] = (v, b)_w[k, l, m] Note that :math:`k` only varies along :math:`x`-direction, whereas :math:`l` varies along :math:`y`. To allow for Numpy broadcasting these two variables are stored as arrays of shape .. math:: k : (N, 1, 1) l : (1, M, 1) Here it is assumed that the solution array :math:`\hat{u}` has shape (N, M, P). Now, multiplying :math:`k` array with :math:`\hat{u}` is achieved as .. math:: k \cdot \hat{u} Numpy will then take care of broadcasting :math:`k` to an array of shape (N, M, P) before performing the elementwise multiplication. Likewise, the constant scale :math:`1` in front of the :math:`A_{mj}` matrix is stored with shape (1, 1, 1), and multiplying with :math:`\hat{u}` is performed as if it was a scalar (as it here happens to be). This is where the scale arrays in the signature to the Helmholt solver comes from. :math:`a_0` is here :math:`1`, whereas :math:`\alpha` and :math:`\beta` are :math:`-2(k^2+l^2)` and :math:`(k^2+l^2)^2`, respectively. Note that :math:`k+l` is an array of shape (N, M, 1). """ def __init__(self, *args): args = list(args) if isinstance(args[0], TPMatrix): args = [arg for arg in args if not arg.is_bc_matrix()] assert len(args) in (3, 6) S, A, B = args[0], args[1], args[2] M = {d.get_key(): d for d in (S, A, B)} self.S = M['SBBmat'] self.A = M['ABBmat'] self.B = M['BBBmat'] if len(args) == 3: self.a0 = a0 = np.atleast_1d(self.S.scale).item() self.alfa = alfa = self.A.scale self.beta = beta = self.B.scale if isinstance(self.S, TPMatrix): self.S = self.S.pmat self.A = self.A.pmat self.B = self.B.pmat self.alfa *= self.A.scale self.beta *= self.B.scale elif len(args) == 6: self.a0 = a0 = args[3] self.alfa = alfa = args[4] self.beta = beta = args[5] S, A, B = self.S, self.A, self.B self.axis = S.axis T = S.tensorproductspace if T is None: shape = [S[0].shape] else: shape = list(T.shape(True)) sii, siu, siuu = S[0], S[2], S[4] ail, aii, aiu = A[-2], A[0], A[2] bill, bil, bii, biu, biuu = B[-4], B[-2], B[0], B[2], B[4] M = sii[::2].shape[0] shape[S.axis] = M ss = copy(shape) ss.insert(0, 2) self.u0 = np.zeros(ss) self.u1 = np.zeros(ss) self.u2 = np.zeros(ss) self.l0 = np.zeros(ss) self.l1 = np.zeros(ss) self.ak = np.zeros(ss) self.bk = np.zeros(ss) self.LU_Biharmonic(a0, alfa, beta, sii, siu, siuu, ail, aii, aiu, bill, bil, bii, biu, biuu, self.u0, self.u1, self.u2, self.l0, self.l1, self.axis) self.Biharmonic_factor_pr(self.ak, self.bk, self.l0, self.l1, self.axis) @staticmethod @optimizer def LU_Biharmonic(a0, alfa, beta, sii, siu, siuu, ail, aii, aiu, bill, bil, bii, biu, biuu, u0, u1, u2, l0, l1, axis): raise NotImplementedError('Use Cython or Numba') @staticmethod @optimizer def Biharmonic_factor_pr(ak, bk, l0, l1, axis): raise NotImplementedError('Use Cython or Numba') @staticmethod @optimizer def Biharmonic_Solve(axis, b, u, u0, u1, u2, l0, l1, ak, bk, a0): raise NotImplementedError('Use Cython or Numba') @staticmethod @optimizer def Biharmonic_matvec(v, b, a0, alfa, beta, sii, siu, siuu, ail, aii, aiu, bill, bil, bii, biu, biuu, axis=0): raise NotImplementedError('Use Cython or Numba') def __call__(self, u, b): """Solve matrix problem Parameters ---------- b : array Array of right hand side on entry and solution on exit unless u is provided. u : array Output array If b and u are multidimensional, then the axis over which to solve for is determined on creation of the class. """ self.Biharmonic_Solve(b, u, self.u0, self.u1, self.u2, self.l0, self.l1, self.ak, self.bk, self.a0, self.axis) if self.S.testfunction[0].has_nonhomogeneous_bcs: self.S.testfunction[0].bc.set_boundary_dofs(u, True) return u def matvec(self, v, c): c[:] = 0 self.Biharmonic_matvec(v, c, self.a0, self.alfa, self.beta, self.S[0], self.S[2], self.S[4], self.A[-2], self.A[0], self.A[2], self.B[-4], self.B[-2], self.B[0], self.B[2], self.B[4], self.axis) return c class PDMA(object): r"""Pentadiagonal matrix solver Pentadiagonal matrix with diagonals in offsets -4, -2, 0, 2, 4 Arising with Poisson equation and biharmonic basis u .. math:: \alpha u'' + \beta u = f As 4 arguments Parameters ---------- A : SpectralMatrix Stiffness matrix B : SpectralMatrix Mass matrix alfa : array beta : array or as dict with key/vals Parameters ---------- solver : str Choose between implementations ('cython', 'python') ABBmat : A Stiffness matrix BBBmat : B Mass matrix where alfa and beta must be avalable as A.scale, B.scale. Attributes ---------- axis : int The axis over which to solve for Variables are extracted from the matrices """ def __init__(self, *args, **kwargs): if 'ABBmat' in kwargs: assert 'BBBmat' in kwargs A = self.A = kwargs['ABBmat'] B = self.B = kwargs['BBBmat'] self.alfa = A.scale self.beta = B.scale elif len(args) == 4: A = self.A = args[0] B = self.B = args[1] self.alfa = args[2] self.beta = args[3] else: raise RuntimeError('Wrong input to PDMA solver') self.solver = kwargs.get('solver', 'cython') self.d, self.u1, self.u2 = (np.zeros_like(B[0]), np.zeros_like(B[2]), np.zeros_like(B[4])) self.l1, self.l2 = np.zeros_like(B[2]), np.zeros_like(B[4]) self.alfa = np.atleast_1d(self.alfa) self.beta = np.atleast_1d(self.beta) shape = list(self.beta.shape) if len(shape) == 1: if self.solver == 'python': H = self.alfa[0]*self.A + self.beta[0]*self.B self.d[:] = H[0] self.u1[:] = H[2] self.u2[:] = H[4] self.l1[:] = H[-2] self.l2[:] = H[-4] self.PDMA_LU(self.l2, self.l1, self.d, self.u1, self.u2) elif self.solver == 'cython': la.LU_Helmholtz_Biharmonic_1D(self.A, self.B, self.alfa[0], self.beta[0], self.l2, self.l1, self.d, self.u1, self.u2) else: self.axis = A.axis assert self.alfa.shape[A.axis] == 1 assert self.beta.shape[A.axis] == 1 N = A.shape[0]+4 self.alfa = np.broadcast_to(self.alfa, shape).copy() shape[A.axis] = N self.d = np.zeros(shape, float) # Diagonal entries of U self.u1 = np.zeros(shape, float) # Diagonal+2 entries of U self.l1 = np.zeros(shape, float) # Diagonal-2 entries of U self.u2 = np.zeros(shape, float) # Diagonal+4 entries of U self.l2 = np.zeros(shape, float) # Diagonal-4 entries of U if len(shape) == 2: raise NotImplementedError elif len(shape) == 3: la.LU_Helmholtz_Biharmonic_3D(A, B, A.axis, self.alfa, self.beta, self.l2, self.l1, self.d, self.u1, self.u2) @staticmethod def PDMA_LU(l2, l1, d, u1, u2): # pragma: no cover """LU decomposition of PDM (for testing only)""" n = d.shape[0] m = u1.shape[0] k = n - m for i in range(n-2*k): lam = l1[i]/d[i] d[i+k] -= lam*u1[i] u1[i+k] -= lam*u2[i] l1[i] = lam lam = l2[i]/d[i] l1[i+k] -= lam*u1[i] d[i+2*k] -= lam*u2[i] l2[i] = lam i = n-4 lam = l1[i]/d[i] d[i+k] -= lam*u1[i] l1[i] = lam i = n-3 lam = l1[i]/d[i] d[i+k] -= lam*u1[i] l1[i] = lam @staticmethod def PDMA_Solve(l2, l1, d, u1, u2, b): # pragma: no cover """Solve method for PDM (for testing only)""" n = d.shape[0] bc = np.full_like(b, b) bc[2] -= l1[0]*bc[0] bc[3] -= l1[1]*bc[1] for k in range(4, n): bc[k] -= (l1[k-2]*bc[k-2] + l2[k-4]*bc[k-4]) bc[n-1] /= d[n-1] bc[n-2] /= d[n-2] bc[n-3] /= d[n-3] bc[n-3] -= u1[n-3]*bc[n-1]/d[n-3] bc[n-4] /= d[n-4] bc[n-4] -= u1[n-4]*bc[n-2]/d[n-4] for k in range(n-5, -1, -1): bc[k] /= d[k] bc[k] -= (u1[k]*bc[k+2]/d[k] + u2[k]*bc[k+4]/d[k]) b[:] = bc def __call__(self, u, b): """Solve matrix problem Parameters ---------- b : array Array of right hand side on entry and solution on exit unless u is provided. u : array Output array If b and u are multidimensional, then the axis over which to solve for is determined on creation of the class. """ if np.ndim(u) == 3: la.Solve_Helmholtz_Biharmonic_3D_ptr(self.A.axis, b, u, self.l2, self.l1, self.d, self.u1, self.u2) elif np.ndim(u) == 2: la.Solve_Helmholtz_Biharmonic_2D_ptr(self.A.axis, b, u, self.l2, self.l1, self.d, self.u1, self.u2) else: if self.solver == 'python': # pragma: no cover u[:] = b self.PDMA_Solve(self.l2, self.l1, self.d, self.u1, self.u2, u) elif self.solver == 'cython': if u is b: u = np.zeros_like(b) #la.Solve_Helmholtz_Biharmonic_1D(b, u, self.l2, self.l1, # self.d, self.u1, self.u2) la.Solve_Helmholtz_Biharmonic_1D_p(b, u, self.l2, self.l1, self.d, self.u1, self.u2) #u /= self.mat.scale return u
249cbe2db846e060e04a73e1decf2b9cfbc3f420
decaefcd28798a21d9892ca1531094aab3728c75
/apps/dashboard/tests.py
8a2b4bd309b1d1fccad58c9664fb6ff7504a1407
[]
no_license
dodocanfly/ligao
4bd387aba7d427ea1e78ddfb1a4d9318a2fdbbb8
4f0951b2663cbc086301824b4af0eeaba094280b
refs/heads/master
2022-05-02T05:25:23.877782
2020-02-05T00:18:59
2020-02-05T00:18:59
229,268,527
2
0
null
2022-04-22T23:13:54
2019-12-20T13:19:06
JavaScript
UTF-8
Python
false
false
21,108
py
from django.test import TestCase from apps.users.models import CustomUser from .models import Organization, ClubCategory class OrganizationModelTests(TestCase): def test_get_main_club_categories(self): owner = CustomUser.objects.create_user('[email protected]', 'SuperStrongP455') organization = Organization.objects.create(owner=owner, name='organization name') category_1 = ClubCategory.objects.create(organization=organization, name='category 1') category_2 = ClubCategory.objects.create(organization=organization, name='category 2') category_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-1', parent=category_2) category_2_2 = ClubCategory.objects.create(organization=organization, name='category 2-2', parent=category_2) category_2_3 = ClubCategory.objects.create(organization=organization, name='category 2-3', parent=category_2) category_2_3_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-1', parent=category_2_3) category_2_3_2 = ClubCategory.objects.create(organization=organization, name='category 2-3-2', parent=category_2_3) category_2_3_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-2-1', parent=category_2_3_2) category_2_3_3 = ClubCategory.objects.create(organization=organization, name='category 2-3-3', parent=category_2_3) category_2_4 = ClubCategory.objects.create(organization=organization, name='category 2-4', parent=category_2) category_2_4_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-1', parent=category_2_4) category_2_4_2 = ClubCategory.objects.create(organization=organization, name='category 2-4-2', parent=category_2_4) category_2_4_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1', parent=category_2_4_2) category_2_4_2_1_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1-1', parent=category_2_4_2_1) category_2_4_3 = ClubCategory.objects.create(organization=organization, name='category 2-4-3', parent=category_2_4) category_2_5 = ClubCategory.objects.create(organization=organization, name='category 2-5', parent=category_2) category_3 = ClubCategory.objects.create(organization=organization, name='category 3') category_3_1 = ClubCategory.objects.create(organization=organization, name='category 3-1', parent=category_3) category_3_2 = ClubCategory.objects.create(organization=organization, name='category 3-2', parent=category_3) category_3_3 = ClubCategory.objects.create(organization=organization, name='category 3-3', parent=category_3) category_4 = ClubCategory.objects.create(organization=organization, name='category 4') category_4_1 = ClubCategory.objects.create(organization=organization, name='category 4-1', parent=category_4) category_4_2 = ClubCategory.objects.create(organization=organization, name='category 4-2', parent=category_4) self.assertListEqual( list(organization.get_main_club_categories()), [category_1, category_2, category_3, category_4], ) class ClubCategoryModelTests(TestCase): def test_distance_to_root(self): owner = CustomUser.objects.create_user('[email protected]', 'SuperStrongP455') organization = Organization.objects.create(owner=owner, name='organization name') category_1 = ClubCategory.objects.create(organization=organization, name='category 1') category_2 = ClubCategory.objects.create(organization=organization, name='category 2') category_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-1', parent=category_2) category_2_2 = ClubCategory.objects.create(organization=organization, name='category 2-2', parent=category_2) category_2_3 = ClubCategory.objects.create(organization=organization, name='category 2-3', parent=category_2) category_2_3_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-1', parent=category_2_3) category_2_3_2 = ClubCategory.objects.create(organization=organization, name='category 2-3-2', parent=category_2_3) category_2_3_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-2-1', parent=category_2_3_2) category_2_3_3 = ClubCategory.objects.create(organization=organization, name='category 2-3-3', parent=category_2_3) category_2_4 = ClubCategory.objects.create(organization=organization, name='category 2-4', parent=category_2) category_2_4_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-1', parent=category_2_4) category_2_4_2 = ClubCategory.objects.create(organization=organization, name='category 2-4-2', parent=category_2_4) category_2_4_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1', parent=category_2_4_2) category_2_4_2_1_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1-1', parent=category_2_4_2_1) category_2_4_3 = ClubCategory.objects.create(organization=organization, name='category 2-4-3', parent=category_2_4) category_2_5 = ClubCategory.objects.create(organization=organization, name='category 2-5', parent=category_2) category_3 = ClubCategory.objects.create(organization=organization, name='category 3') category_3_1 = ClubCategory.objects.create(organization=organization, name='category 3-1', parent=category_3) category_3_2 = ClubCategory.objects.create(organization=organization, name='category 3-2', parent=category_3) category_3_3 = ClubCategory.objects.create(organization=organization, name='category 3-3', parent=category_3) category_4 = ClubCategory.objects.create(organization=organization, name='category 4') category_4_1 = ClubCategory.objects.create(organization=organization, name='category 4-1', parent=category_4) category_4_2 = ClubCategory.objects.create(organization=organization, name='category 4-2', parent=category_4) self.assertEqual(category_1.distance_to_root(), 0) self.assertEqual(category_2.distance_to_root(), 0) self.assertEqual(category_2_1.distance_to_root(), 1) self.assertEqual(category_2_2.distance_to_root(), 1) self.assertEqual(category_2_3.distance_to_root(), 1) self.assertEqual(category_2_3_1.distance_to_root(), 2) self.assertEqual(category_2_3_2.distance_to_root(), 2) self.assertEqual(category_2_3_2_1.distance_to_root(), 3) self.assertEqual(category_2_3_3.distance_to_root(), 2) self.assertEqual(category_2_4.distance_to_root(), 1) self.assertEqual(category_2_4_1.distance_to_root(), 2) self.assertEqual(category_2_4_2.distance_to_root(), 2) self.assertEqual(category_2_4_2_1.distance_to_root(), 3) self.assertEqual(category_2_4_2_1_1.distance_to_root(), 4) self.assertEqual(category_2_4_3.distance_to_root(), 2) self.assertEqual(category_2_5.distance_to_root(), 1) self.assertEqual(category_3.distance_to_root(), 0) self.assertEqual(category_3_1.distance_to_root(), 1) self.assertEqual(category_3_2.distance_to_root(), 1) self.assertEqual(category_3_3.distance_to_root(), 1) self.assertEqual(category_4.distance_to_root(), 0) self.assertEqual(category_4_1.distance_to_root(), 1) self.assertEqual(category_4_2.distance_to_root(), 1) def test_distance_to_farthest_leaf(self): owner = CustomUser.objects.create_user('[email protected]', 'SuperStrongP455') organization = Organization.objects.create(owner=owner, name='organization name') category_1 = ClubCategory.objects.create(organization=organization, name='category 1') category_2 = ClubCategory.objects.create(organization=organization, name='category 2') category_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-1', parent=category_2) category_2_2 = ClubCategory.objects.create(organization=organization, name='category 2-2', parent=category_2) category_2_3 = ClubCategory.objects.create(organization=organization, name='category 2-3', parent=category_2) category_2_3_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-1', parent=category_2_3) category_2_3_2 = ClubCategory.objects.create(organization=organization, name='category 2-3-2', parent=category_2_3) category_2_3_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-2-1', parent=category_2_3_2) category_2_3_3 = ClubCategory.objects.create(organization=organization, name='category 2-3-3', parent=category_2_3) category_2_4 = ClubCategory.objects.create(organization=organization, name='category 2-4', parent=category_2) category_2_4_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-1', parent=category_2_4) category_2_4_2 = ClubCategory.objects.create(organization=organization, name='category 2-4-2', parent=category_2_4) category_2_4_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1', parent=category_2_4_2) category_2_4_2_1_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1-1', parent=category_2_4_2_1) category_2_4_3 = ClubCategory.objects.create(organization=organization, name='category 2-4-3', parent=category_2_4) category_2_5 = ClubCategory.objects.create(organization=organization, name='category 2-5', parent=category_2) category_3 = ClubCategory.objects.create(organization=organization, name='category 3') category_3_1 = ClubCategory.objects.create(organization=organization, name='category 3-1', parent=category_3) category_3_2 = ClubCategory.objects.create(organization=organization, name='category 3-2', parent=category_3) category_3_3 = ClubCategory.objects.create(organization=organization, name='category 3-3', parent=category_3) category_4 = ClubCategory.objects.create(organization=organization, name='category 4') category_4_1 = ClubCategory.objects.create(organization=organization, name='category 4-1', parent=category_4) category_4_2 = ClubCategory.objects.create(organization=organization, name='category 4-2', parent=category_4) self.assertEqual(category_1.distance_to_farthest_leaf(), 0) self.assertEqual(category_2.distance_to_farthest_leaf(), 4) self.assertEqual(category_2_1.distance_to_farthest_leaf(), 0) self.assertEqual(category_2_2.distance_to_farthest_leaf(), 0) self.assertEqual(category_2_3.distance_to_farthest_leaf(), 2) self.assertEqual(category_2_3_1.distance_to_farthest_leaf(), 0) self.assertEqual(category_2_3_2.distance_to_farthest_leaf(), 1) self.assertEqual(category_2_3_2_1.distance_to_farthest_leaf(), 0) self.assertEqual(category_2_3_3.distance_to_farthest_leaf(), 0) self.assertEqual(category_2_4.distance_to_farthest_leaf(), 3) self.assertEqual(category_2_4_1.distance_to_farthest_leaf(), 0) self.assertEqual(category_2_4_2.distance_to_farthest_leaf(), 2) self.assertEqual(category_2_4_2_1.distance_to_farthest_leaf(), 1) self.assertEqual(category_2_4_2_1_1.distance_to_farthest_leaf(), 0) self.assertEqual(category_2_4_3.distance_to_farthest_leaf(), 0) self.assertEqual(category_2_5.distance_to_farthest_leaf(), 0) self.assertEqual(category_3.distance_to_farthest_leaf(), 1) self.assertEqual(category_3_1.distance_to_farthest_leaf(), 0) self.assertEqual(category_3_2.distance_to_farthest_leaf(), 0) self.assertEqual(category_3_3.distance_to_farthest_leaf(), 0) self.assertEqual(category_4.distance_to_farthest_leaf(), 1) self.assertEqual(category_4_1.distance_to_farthest_leaf(), 0) self.assertEqual(category_4_2.distance_to_farthest_leaf(), 0) def test_get_children(self): owner = CustomUser.objects.create_user('[email protected]', 'SuperStrongP455') organization = Organization.objects.create(owner=owner, name='organization name') category_1 = ClubCategory.objects.create(organization=organization, name='category 1') category_2 = ClubCategory.objects.create(organization=organization, name='category 2') category_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-1', parent=category_2) category_2_2 = ClubCategory.objects.create(organization=organization, name='category 2-2', parent=category_2) category_2_3 = ClubCategory.objects.create(organization=organization, name='category 2-3', parent=category_2) category_2_3_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-1', parent=category_2_3) category_2_3_2 = ClubCategory.objects.create(organization=organization, name='category 2-3-2', parent=category_2_3) category_2_3_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-2-1', parent=category_2_3_2) category_2_3_3 = ClubCategory.objects.create(organization=organization, name='category 2-3-3', parent=category_2_3) category_2_4 = ClubCategory.objects.create(organization=organization, name='category 2-4', parent=category_2) category_2_4_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-1', parent=category_2_4) category_2_4_2 = ClubCategory.objects.create(organization=organization, name='category 2-4-2', parent=category_2_4) category_2_4_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1', parent=category_2_4_2) category_2_4_2_1_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1-1', parent=category_2_4_2_1) category_2_4_3 = ClubCategory.objects.create(organization=organization, name='category 2-4-3', parent=category_2_4) category_2_5 = ClubCategory.objects.create(organization=organization, name='category 2-5', parent=category_2) category_3 = ClubCategory.objects.create(organization=organization, name='category 3') category_3_1 = ClubCategory.objects.create(organization=organization, name='category 3-1', parent=category_3) category_3_2 = ClubCategory.objects.create(organization=organization, name='category 3-2', parent=category_3) category_3_3 = ClubCategory.objects.create(organization=organization, name='category 3-3', parent=category_3) category_4 = ClubCategory.objects.create(organization=organization, name='category 4') category_4_1 = ClubCategory.objects.create(organization=organization, name='category 4-1', parent=category_4) category_4_2 = ClubCategory.objects.create(organization=organization, name='category 4-2', parent=category_4) self.assertListEqual( list(category_1.get_children()), [], ) self.assertListEqual( list(category_2.get_children()), [category_2_1, category_2_2, category_2_3, category_2_4, category_2_5], ) self.assertListEqual( list(category_2_1.get_children()), [], ) self.assertListEqual( list(category_2_2.get_children()), [], ) self.assertListEqual( list(category_2_3.get_children()), [category_2_3_1, category_2_3_2, category_2_3_3], ) self.assertListEqual( list(category_2_3_1.get_children()), [], ) self.assertListEqual( list(category_2_3_2.get_children()), [category_2_3_2_1], ) self.assertListEqual( list(category_2_3_2_1.get_children()), [], ) self.assertListEqual( list(category_2_3_3.get_children()), [], ) self.assertListEqual( list(category_2_4.get_children()), [category_2_4_1, category_2_4_2, category_2_4_3], ) self.assertListEqual( list(category_2_4_1.get_children()), [], ) self.assertListEqual( list(category_2_4_2.get_children()), [category_2_4_2_1], ) self.assertListEqual( list(category_2_4_2_1.get_children()), [category_2_4_2_1_1], ) self.assertListEqual( list(category_2_4_2_1_1.get_children()), [], ) self.assertListEqual( list(category_2_4_3.get_children()), [], ) self.assertListEqual( list(category_2_5.get_children()), [], ) self.assertListEqual( list(category_3.get_children()), [category_3_1, category_3_2, category_3_3], ) self.assertListEqual( list(category_3_1.get_children()), [], ) self.assertListEqual( list(category_3_2.get_children()), [], ) self.assertListEqual( list(category_3_3.get_children()), [], ) self.assertListEqual( list(category_4.get_children()), [category_4_1, category_4_2], ) self.assertListEqual( list(category_4_1.get_children()), [], ) self.assertListEqual( list(category_4_2.get_children()), [], ) def test_am_i_in_myself(self): owner = CustomUser.objects.create_user('[email protected]', 'SuperStrongP455') organization = Organization.objects.create(owner=owner, name='organization name') category_1 = ClubCategory.objects.create(organization=organization, name='category 1') category_2 = ClubCategory.objects.create(organization=organization, name='category 2') category_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-1', parent=category_2) category_2_2 = ClubCategory.objects.create(organization=organization, name='category 2-2', parent=category_2) category_2_3 = ClubCategory.objects.create(organization=organization, name='category 2-3', parent=category_2) category_2_3_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-1', parent=category_2_3) category_2_3_2 = ClubCategory.objects.create(organization=organization, name='category 2-3-2', parent=category_2_3) category_2_3_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-3-2-1', parent=category_2_3_2) category_2_3_3 = ClubCategory.objects.create(organization=organization, name='category 2-3-3', parent=category_2_3) category_2_4 = ClubCategory.objects.create(organization=organization, name='category 2-4', parent=category_2) category_2_4_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-1', parent=category_2_4) category_2_4_2 = ClubCategory.objects.create(organization=organization, name='category 2-4-2', parent=category_2_4) category_2_4_2_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1', parent=category_2_4_2) category_2_4_2_1_1 = ClubCategory.objects.create(organization=organization, name='category 2-4-2-1-1', parent=category_2_4_2_1) category_2_4_3 = ClubCategory.objects.create(organization=organization, name='category 2-4-3', parent=category_2_4) category_2_5 = ClubCategory.objects.create(organization=organization, name='category 2-5', parent=category_2) category_3 = ClubCategory.objects.create(organization=organization, name='category 3') category_3_1 = ClubCategory.objects.create(organization=organization, name='category 3-1', parent=category_3) category_3_2 = ClubCategory.objects.create(organization=organization, name='category 3-2', parent=category_3) category_3_3 = ClubCategory.objects.create(organization=organization, name='category 3-3', parent=category_3) category_4 = ClubCategory.objects.create(organization=organization, name='category 4') category_4_1 = ClubCategory.objects.create(organization=organization, name='category 4-1', parent=category_4) category_4_2 = ClubCategory.objects.create(organization=organization, name='category 4-2', parent=category_4) self.assertTrue(category_1.am_i_in_myself(category_1)) self.assertTrue(category_2.am_i_in_myself(category_2)) self.assertTrue(category_2_1.am_i_in_myself(category_2)) self.assertTrue(category_2_2.am_i_in_myself(category_2)) self.assertTrue(category_2_3.am_i_in_myself(category_2)) self.assertTrue(category_2_4_2_1_1.am_i_in_myself(category_2)) self.assertFalse(category_2_4.am_i_in_myself(category_2_4_2))
4ec1e9d4f1bf6fc799449cbd2aab1ab8e609c661
eed0523056fec042d24180bd1f5443d9c510c271
/TheCannon/spectral_model.py
0b189fab510068fb42b0233fa0d4e6f756e2b769
[ "MIT", "LicenseRef-scancode-unknown-license-reference" ]
permissive
minzastro/TheCannon
3c42c0e775193d8dd3f649cc850da4afa7d61ebb
5e624f9e5699ef26b905832f166d13a9733153ff
refs/heads/master
2021-01-21T09:02:11.711509
2016-04-14T11:52:50
2016-04-14T11:52:50
56,233,122
0
0
null
2016-04-14T11:49:49
2016-04-14T11:49:47
Python
UTF-8
Python
false
false
8,969
py
from __future__ import (absolute_import, division, print_function, unicode_literals) import numpy as np import os import random from .helpers.corner import corner import matplotlib.pyplot as plt from matplotlib import colorbar def draw_spectra(model, dataset): """ Generate best-fit spectra for all the test objects Parameters ---------- model: CannonModel The Cannon spectral model dataset: Dataset Dataset that needs label inference Returns ------- best_fluxes: ndarray The best-fit test fluxes best_ivars: The best-fit test inverse variances """ coeffs_all, covs, scatters, red_chisqs, pivots, label_vector = model.model nstars = len(dataset.test_SNR) cannon_flux = np.zeros(dataset.test_flux.shape) cannon_ivar = np.zeros(dataset.test_ivar.shape) for i in range(nstars): x = label_vector[:,i,:] spec_fit = np.einsum('ij, ij->i', x, coeffs_all) cannon_flux[i,:] = spec_fit bad = dataset.test_ivar[i,:] == SMALL**2 cannon_ivar[i,:][~bad] = 1. / scatters[~bad] ** 2 return cannon_flux, cannon_ivar def overlay_spectra(model, dataset): """ Run a series of diagnostics on the fitted spectra Parameters ---------- model: model best-fit Cannon spectral model dataset: Dataset original spectra """ best_flux, best_ivar = draw_spectra(model, dataset) coeffs_all, covs, scatters, all_chisqs, pivots, label_vector = model.model # Overplot original spectra with best-fit spectra print("Overplotting spectra for ten random stars") res = dataset.test_flux-best_flux lambdas = dataset.wl npix = len(lambdas) nstars = best_flux.shape[0] pickstars = [] for i in range(10): pickstars.append(random.randrange(0, nstars-1)) for i in pickstars: print("Star %s" % i) ID = dataset.test_ID[i] spec_orig = dataset.test_flux[i,:] bad = dataset.test_flux[i,:] == 0 lambdas = np.ma.array(lambdas, mask=bad, dtype=float) npix = len(lambdas.compressed()) spec_orig = np.ma.array(dataset.test_flux[i,:], mask=bad) spec_fit = np.ma.array(best_flux[i,:], mask=bad) ivars_orig = np.ma.array(dataset.test_ivar[i,:], mask=bad) ivars_fit = np.ma.array(best_ivar[i,:], mask=bad) red_chisq = np.sum(all_chisqs[:,i], axis=0) / (npix - coeffs_all.shape[1]) red_chisq = np.round(red_chisq, 2) fig,axarr = plt.subplots(2) ax1 = axarr[0] im = ax1.scatter(lambdas, spec_orig, label="Orig Spec", c=1 / np.sqrt(ivars_orig), s=10) ax1.scatter(lambdas, spec_fit, label="Cannon Spec", c='r', s=10) ax1.errorbar(lambdas, spec_fit, yerr=1/np.sqrt(ivars_fit), fmt='ro', ms=1, alpha=0.7) ax1.set_xlabel(r"Wavelength $\lambda (\AA)$") ax1.set_ylabel("Normalized flux") ax1.set_title("Spectrum Fit: %s" % ID) ax1.set_title("Spectrum Fit") ax1.set_xlim(min(lambdas.compressed())-10, max(lambdas.compressed())+10) ax1.legend(loc='lower center', fancybox=True, shadow=True) ax2 = axarr[1] ax2.scatter(spec_orig, spec_fit, c=1/np.sqrt(ivars_orig), alpha=0.7) ax2.errorbar(spec_orig, spec_fit, yerr=1 / np.sqrt(ivars_fit), ecolor='k', fmt="none", ms=1, alpha=0.7) #fig.subplots_adjust(right=0.8) #cbar_ax = fig.add_axes([0.85, 0.15, 0.05, 0.7]) fig.colorbar() #fig.colorbar( # im, cax=cbar_ax, # label="Uncertainties on the Fluxes from the Original Spectrum") xlims = ax2.get_xlim() ylims = ax2.get_ylim() lims = [np.min([xlims, ylims]), np.max([xlims, ylims])] ax2.plot(lims, lims, 'k-', alpha=0.75) textstr = "Red Chi Sq: %s" % red_chisq props = dict(boxstyle='round', facecolor='palevioletred', alpha=0.5) ax2.text(0.05, 0.95, textstr, transform=ax2.transAxes, fontsize=14, verticalalignment='top', bbox=props) ax2.set_xlim(xlims) ax2.set_ylim(ylims) ax2.set_xlabel("Orig Fluxes") ax2.set_ylabel("Fitted Fluxes") plt.tight_layout() filename = "best_fit_spec_Star%s.png" % i print("Saved as %s" % filename) fig.savefig(filename) plt.close(fig) def residuals(cannon_set, dataset): """ Stack spectrum fit residuals, sort by each label. Include histogram of the RMS at each pixel. Parameters ---------- cannon_set: Dataset best-fit Cannon spectra dataset: Dataset original spectra """ print("Stacking spectrum fit residuals") res = dataset.test_fluxes - cannon_set.test_fluxes bad = dataset.test_ivars == SMALL**2 err = np.zeros(len(dataset.test_ivars)) err = np.sqrt(1. / dataset.test_ivars + 1. / cannon_set.test_ivars) res_norm = res / err res_norm = np.ma.array(res_norm, mask=(np.ones_like(res_norm) * (np.std(res_norm,axis=0) == 0))) res_norm = np.ma.compress_cols(res_norm) for i in range(len(cannon_set.get_plotting_labels())): label_name = cannon_set.get_plotting_labels()[i] print("Plotting residuals sorted by %s" % label_name) label_vals = cannon_set.tr_label_vals[:,i] sorted_res = res_norm[np.argsort(label_vals)] mu = np.mean(sorted_res.flatten()) sigma = np.std(sorted_res.flatten()) left, width = 0.1, 0.65 bottom, height = 0.1, 0.65 bottom_h = left_h = left+width+0.1 rect_scatter = [left, bottom, width, height] rect_histx = [left, bottom_h, width, 0.1] rect_histy = [left_h, bottom, 0.1, height] plt.figure() axScatter = plt.axes(rect_scatter) axHistx = plt.axes(rect_histx) axHisty = plt.axes(rect_histy) im = axScatter.imshow(sorted_res, cmap=plt.cm.bwr_r, interpolation="nearest", vmin=mu - 3. * sigma, vmax=mu + 3. * sigma, aspect='auto', origin='lower', extent=[0, len(dataset.wl), min(label_vals), max(label_vals)]) cax, kw = colorbar.make_axes(axScatter.axes, location='bottom') plt.colorbar(im, cax=cax, orientation='horizontal') axScatter.set_title( r"Spectral Residuals Sorted by ${0:s}$".format(label_name)) axScatter.set_xlabel("Pixels") axScatter.set_ylabel(r"$%s$" % label_name) axHisty.hist(np.std(res_norm,axis=1)[~np.isnan(np.std(res_norm, axis=1))], orientation='horizontal', range=[0,2]) axHisty.axhline(y=1, c='k', linewidth=3, label="y=1") axHisty.legend(bbox_to_anchor=(0., 0.8, 1., .102), prop={'family':'serif', 'size':'small'}) axHisty.text(1.0, 0.5, "Distribution of Stdev of Star Residuals", verticalalignment='center', transform=axHisty.transAxes, rotation=270) axHisty.set_ylabel("Standard Deviation") start, end = axHisty.get_xlim() axHisty.xaxis.set_ticks(np.linspace(start, end, 3)) axHisty.set_xlabel("Number of Stars") axHisty.xaxis.set_label_position("top") axHistx.hist(np.std(res_norm, axis=0)[~np.isnan(np.std(res_norm, axis=0))], range=[0.8,1.1]) axHistx.axvline(x=1, c='k', linewidth=3, label="x=1") axHistx.set_title("Distribution of Stdev of Pixel Residuals") axHistx.set_xlabel("Standard Deviation") axHistx.set_ylabel("Number of Pixels") start, end = axHistx.get_ylim() axHistx.yaxis.set_ticks(np.linspace(start, end, 3)) axHistx.legend() filename = "residuals_sorted_by_label_%s.png" % i plt.savefig(filename) print("File saved as %s" % filename) plt.close() # Auto-correlation of mean residuals print("Plotting Auto-Correlation of Mean Residuals") mean_res = res_norm.mean(axis=0) autocorr = np.correlate(mean_res, mean_res, mode="full") pkwidth = int(len(autocorr)/2-np.argmin(autocorr)) xmin = int(len(autocorr)/2)-pkwidth xmax = int(len(autocorr)/2)+pkwidth zoom_x = np.linspace(xmin, xmax, len(autocorr[xmin:xmax])) fig, axarr = plt.subplots(2) axarr[0].plot(autocorr) axarr[0].set_title("Autocorrelation of Mean Spectral Residual") axarr[0].set_xlabel("Lag (# Pixels)") axarr[0].set_ylabel("Autocorrelation") axarr[1].plot(zoom_x, autocorr[xmin:xmax]) axarr[1].set_title("Central Peak, Zoomed") axarr[1].set_xlabel("Lag (# Pixels)") axarr[1].set_ylabel("Autocorrelation") filename = "residuals_autocorr.png" plt.savefig(filename) print("saved %s" % filename) plt.close()
a17913347b44df299ab37d00d470e56f8528439c
3a533d1503f9a1c767ecd3a29885add49fff4f18
/saleor/channel/migrations/0009_channel_order_mark_as_paid_strategy.py
95a5a766de46242230839a732b42f3449cc37be9
[ "BSD-3-Clause" ]
permissive
jonserna/saleor
0c1e4297e10e0a0ce530b5296f6b4488f524c145
b7d1b320e096d99567d3fa7bc4780862809d19ac
refs/heads/master
2023-06-25T17:25:17.459739
2023-06-19T14:05:41
2023-06-19T14:05:41
186,167,599
0
0
BSD-3-Clause
2019-12-29T15:46:40
2019-05-11T18:21:31
TypeScript
UTF-8
Python
false
false
885
py
# Generated by Django 3.2.17 on 2023-02-08 14:43 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ("channel", "0008_update_null_order_settings"), ] operations = [ migrations.AddField( model_name="channel", name="order_mark_as_paid_strategy", field=models.CharField( choices=[ ("transaction_flow", "Use transaction"), ("payment_flow", "Use payment"), ], default="payment_flow", max_length=255, ), ), migrations.RunSQL( """ ALTER TABLE channel_channel ALTER COLUMN order_mark_as_paid_strategy SET DEFAULT 'payment_flow'; """, migrations.RunSQL.noop, ), ]
f8947e39072974aad673b7b25a067715adc7f5ec
d5a196f844f5aa31c814c37c245eec3b5dfae75a
/section3_1/sequence_sum_2.py
c235060ded22ed1a46e9fac8b22b0681c1a93a0a
[]
no_license
aleno4ka1998/gentle_lerning
3c08a9fc13f9529bb16ab26dee136b2b66a221a7
bafa75263997044f53707c5d9690faede5e8d05a
refs/heads/main
2023-02-05T21:52:24.602703
2020-12-31T15:22:16
2020-12-31T15:22:16
310,646,872
0
0
null
2020-12-31T15:22:18
2020-11-06T16:18:59
Python
UTF-8
Python
false
false
225
py
a = 0 b = 0 sequence_sum = 0 while True: sequence_sum += a a = int(input()) if a == 0: b = int(input()) if b == 0: break else: sequence_sum += b print(sequence_sum)
2d1a14ef8c734345c6a3ef08c3a6aed2507783ba
e54b80c3b94c5eb4d355f90faa6c0108395f83a1
/example-scripts/resources/platforms/aosp_mdpi.sikuli/aosp_mdpi.py
592d11679862ee52e5883eb9a3ff131d81970f8c
[]
no_license
firstwave/seemonkey-dist
669d1131a15a3ee9a7d527e0587d60a3119dc211
9c0cc0bd98fa2d14cca40e2f2a965cc99fda3a93
refs/heads/master
2020-06-06T05:07:29.350428
2012-01-03T19:54:09
2012-01-03T19:54:09
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,278
py
from sikuli import * print('aosp library loaded') def unlockScreen(device): # this function can safely be used even if # it is unknown if the device is locked or not device.wake() if device.exists("1321469716016.png"): if device.exists("1321472659750.png"): device.dragDrop(Pattern("1321469716016.png").similar(0.73),"1321472659750.png") else: device.dragDrop(Pattern("1321469716016.png").similar(0.73),"1321469736786.png") def dismissSoftKeyboard(device): if device.exists("1323908723908.png"): device.press('back') def clearAppData(device, package): # start the 'clear app data' activity for the provided # package name device.getMonkeyDevice().startActivity( action = "android.settings.APPLICATION_DETAILS_SETTINGS", data = "package:%s" % package, component = "com.android.settings/.applications.InstalledAppDetails") device.sleep(3000) if device.exists(Pattern("Cleardata.png").similar(0.93)): device.click(Pattern("Cleardata.png").similar(0.93)) device.sleep(250) device.click(Pattern("OK-1.png").similar(0.80)) device.press('back')
7e64a23c39456e6c950584c9847c95489668dbbc
b76edf9cd297a1d87b69a08c4e480dbde89ea742
/shopapp/views.py
3ff23863759a9bd763c18e1805d4ea1cd82314ba
[]
no_license
kailasnathps24/shopvlog
b70e75d8e90ed45de6b6a8489ce3e359b37b6d44
f6ea938eb22f7d6726f5a6a1ec6a300eb3071e99
refs/heads/master
2023-08-10T16:11:57.034264
2021-09-13T14:47:04
2021-09-13T14:47:04
406,009,564
0
0
null
null
null
null
UTF-8
Python
false
false
1,326
py
from django.shortcuts import render, get_object_or_404 from shopapp. models import * from django.db.models import Q from django.core.paginator import Paginator,EmptyPage,InvalidPage def home(request,c_slug=None): c_page=None prodt = None if c_slug!=None: c_page=get_object_or_404(categ,slug=c_slug) prodt=product.objects.filter(category=c_page,available=True) else: prodt = product.objects.all().filter(available=True) cat=categ.objects.all() paginator=Paginator(prodt,2) try: page=int(request.GET.get('page','1')) except: page=1 try: p=paginator.page(page) except(EmptyPage,InvalidPage): p=paginator.page(paginator.num_pages) return render(request,'index.html',{'pro':prodt,'ct':cat,'pg':p}) def prodDetails(request,c_slug,product_slug): try: prod=product.objects.get(category__slug=c_slug,slug=product_slug) except Exception as e: raise e return render(request,'item.html',{'pro':prod}) def searching(request): prod=None query=None if 'q' in request.GET: query=request.GET.get('q') prod=product.objects.all().filter(Q(name__contains=query)|Q(desc__contains=query)) return render(request,'search.html',{'pro':prod,'qr':query}) # Create your views here.
a405e1b721c0f0f68f6c6ff62b56bd42b11e160b
9dd7bb82597fc7ecc3344613e79ce4b1a47c8a77
/RotateArray.py
4314cb716ef4a9247ff3492cbcd6f868bb965656
[]
no_license
zhang4ever/LeetCode
2c8bee95493cf6bf002ff1d95451e6c9c96ce6e4
344986a8ae5ce6c55e2e79ee79ef0977bdb8b77c
refs/heads/master
2020-03-27T19:40:50.160175
2018-09-25T06:21:18
2018-09-25T06:21:18
147,005,014
0
0
null
null
null
null
UTF-8
Python
false
false
1,271
py
#!/usr/bin/env python # -*- coding: utf-8 -*- """ # @File : RotateArray.py # @Time : 2017-08-16 21:22 # @Author : zhang bo # @Note : For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. """ class Solution(object): # def rotate(self, nums, k): """ :type nums: List[int] :type k: int :rtype: void Do not return anything, modify nums in-place instead """ if k == 0: return nums t = len(nums)-k for i in range(k): print(nums) tmp = nums[t+i] nums[t+i] = nums[i] nums[i] = tmp return nums '''使用下标取余遍历更新列表元素''' def rotate1(self, nums, k): old = nums[:] for i in range(len(nums)): nums[(i+k) % len(nums)] = old[i] print(nums) return nums '''将最后的元素一次与前面的交换''' def rotate2(self, nums, k): for i in range(k): needle = nums[-1] for j in range(len(nums)): tmp = needle needle = nums[j] nums[j] = tmp return nums sol = Solution() nums = [1, ] k = 0 print(sol.rotate2(nums, k))
c5d40f8d86bda2cc8edb8289f91a916ebb6672e0
d554b1aa8b70fddf81da8988b4aaa43788fede88
/5 - Notebooks e Data/1 - Análises numéricas/Arquivos David/Atualizados/logDicas-master/data/2019-1/226/users/4254/codes/1664_1394.py
ec3158649ae06f42008199af8c1253c3184e5b02
[]
no_license
JosephLevinthal/Research-projects
a3bc3ca3b09faad16f5cce5949a2279cf14742ba
60d5fd6eb864a5181f4321e7a992812f3c2139f9
refs/heads/master
2022-07-31T06:43:02.686109
2020-05-23T00:24:26
2020-05-23T00:24:26
266,199,309
1
0
null
null
null
null
UTF-8
Python
false
false
137
py
h = float(input("Quantidade de horas: ")) if(h > 20): p = (20*50 + ((h-20)*70)) print(round(p,2)) else: p = (h*50) print(round(p,2))
cb60b404cea6bb2a5ead2c4c9e33ae1f1f863fc6
633af6d1f78014c6169069e0b816bf28d9730178
/restaurant/views.py
64048f1ca527054487d22db8a03f02089f921ae4
[ "MIT" ]
permissive
kwabena-aboah/ofos
75b92337e58fdb5164b5b4947e22019ee1efca42
267cbe03617c4fb9f1622e23039c4d92d58dd9ef
refs/heads/master
2022-03-29T05:40:12.614298
2022-02-19T18:41:30
2022-02-19T18:41:30
174,134,954
0
0
MIT
2022-03-12T01:09:29
2019-03-06T11:47:29
Python
UTF-8
Python
false
false
4,737
py
from django.http import JsonResponse from django.shortcuts import render, redirect from django.urls import reverse from . models import Order, Food from . forms import OrderForm, FoodForm from django.views.generic import View from django.contrib import messages from django.contrib.auth.decorators import login_required from django.contrib.auth import get_user_model from rest_framework.views import APIView from rest_framework.response import Response @login_required def index(request): """Lists all orders at homePage""" orders = Order.objects.all() context = {'orders': orders} return render(request, 'restaurant/index.html', context) @login_required def show(request, order_id): """display details of an order""" order = Order.objects.filter(id=order_id) context = {'order': order} return render(request, 'restaurant/print.html', context) @login_required def new_order(request): """Create new Order for food""" if request.POST: form = OrderForm(request.POST) if form.is_valid(): if form.save(): return redirect('/', messages.success(request, 'Successfully created Order.', 'alert-success')) else: return redirect('/', messages.error(request, 'Could not save data', 'alert-danger')) else: return redirect('/', messages.error(request, 'Form not valid', 'alert-danger')) else: form = OrderForm() context = {'form': form} return render(request, 'restaurant/new.html', context) @login_required def edit_order(request, order_id): """Update Order form for food""" order = Order.objects.get(id=order_id) if request.POST: form = OrderForm(request.POST, instance=order) if form.is_valid(): if form.save(): return redirect('/', messages.success(request, 'Successfully updated order.', 'alert-success')) else: return redirect('/', messages.error(request, 'Could not update order.', 'alert-danger')) else: return redirect('/', messages.error(request, 'Form not valid', 'alert-danger')) else: form = OrderForm(instance=order) context = {'form': form} return render(request, 'restaurant/edit.html', context) @login_required def delete_order(request, order_id): """Deletes an order""" order = Order.objects.get(id=order_id) order.delete() return redirect('/', messages.success(request, 'Successfully deleted order', 'alert-success')) @login_required def foods(request): """List all active foods""" foods = Food.objects.all() context = {'foods': foods} return render(request, 'restaurant/foods.html', context) @login_required def new_food(request): """Create new food in system""" if request.POST: form = FoodForm(request.POST, request.FILES) if form.is_valid(): if form.save(): return redirect('/foods', messages.success(request, 'Successfully created new food', 'alert-success')) else: return redirect('/foods', messages.error(request, 'Data not saved', 'alert-danger')) else: return redirect('/foods', messages.error(request, 'Form not valid', 'alert-danger')) else: food_form = FoodForm() context = {'food_form': food_form} return render(request, 'restaurant/new_food.html', context) @login_required def delete_food(request, food_id): """Deletes a specific food""" if Food.objects.filter(id=food_id).update(active='0'): return redirect('/foods', messages.success(request, "Food was successfully deleted", "alert-success")) else: return redirect('/foods', messages.error(request, 'Cannot delete food', 'alert-danger')) class ReportView(View): def get(self, request, *args, **kwargs): return render(request, 'restaurant/reports.html') def general_report(request, *args, **kwargs): data = { "orders": 100, "foods": 10, } return JsonResponse(data) User = get_user_model() class ChartData(APIView): authentication_classes = [] permission_classes = [] def get(self, request, format=None): user_count = User.objects.all().count() food_count = Food.objects.all().count() order_count = Order.objects.all().count() labels = ['Users', 'Foods', 'Orders'] default_items = [user_count, food_count, order_count] data = { "labels": labels, "default": default_items, } return Response(data)
f9ea0d7a36009194e2da641b4b5897f41cc41aeb
0743c1733cbdff5b7c93413b9161adc1e25056f6
/forwarding/test.py
1bb84f8ab1aeb5b39220e3f850087a8d541303f5
[]
no_license
rushikc/mini-net-DDoS
9d0848eeb643628c5dadf3042d05042d7bf4bd22
9dc90232a4e9d60739a245ecbac009e63ece32c7
refs/heads/master
2020-05-09T10:15:17.192129
2019-05-24T14:39:48
2019-05-24T14:39:48
181,034,030
0
0
null
null
null
null
UTF-8
Python
false
false
9,449
py
# Copyright 2011-2012 James McCauley # # 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. """ An L2 learning switch. It is derived from one written live for an SDN crash course. It is somwhat similar to NOX's pyswitch in that it installs exact-match rules for each flow. """ from pox.core import core import pox.openflow.libopenflow_01 as of from pox.lib.util import dpid_to_str, str_to_dpid from pox.lib.util import str_to_bool import time from pox.lib.addresses import IPAddr from pox.lib.addresses import EthAddr import pox.openflow.libopenflow_01 as of from pox.lib.util import dpid_to_str, str_to_bool from pox.lib.packet.arp import arp from pox.lib.packet.ethernet import ethernet, ETHER_BROADCAST log = core.getLogger() # We don't want to flood immediately when a switch connects. # Can be overriden on commandline. _flood_delay = 0 class LearningSwitch (object): """ The learning switch "brain" associated with a single OpenFlow switch. When we see a packet, we'd like to output it on a port which will eventually lead to the destination. To accomplish this, we build a table that maps addresses to ports. We populate the table by observing traffic. When we see a packet from some source coming from some port, we know that source is out that port. When we want to forward traffic, we look up the desintation in our table. If we don't know the port, we simply send the message out all ports except the one it came in on. (In the presence of loops, this is bad!). In short, our algorithm looks like this: For each packet from the switch: 1) Use source address and switch port to update address/port table 2) Is transparent = False and either Ethertype is LLDP or the packet's destination address is a Bridge Filtered address? Yes: 2a) Drop packet -- don't forward link-local traffic (LLDP, 802.1x) DONE 3) Is destination multicast? Yes: 3a) Flood the packet DONE 4) Port for destination address in our address/port table? No: 4a) Flood the packet DONE 5) Is output port the same as input port? Yes: 5a) Drop packet and similar ones for a while 6) Install flow table entry in the switch so that this flow goes out the appopriate port 6a) Send the packet out appropriate port """ def __init__ (self, connection, transparent): # Switch we'll be adding L2 learning switch capabilities to self.connection = connection self.transparent = transparent # Our table self.macToPort = {} # We want to hear PacketIn messages, so we listen # to the connection connection.addListeners(self) # We just use this to know when to log a helpful message self.hold_down_expired = _flood_delay == 0 #log.debug("Initializing LearningSwitch, transparent=%s", # str(self.transparent)) def _handle_PacketIn (self, event): """ Handle packet in messages from the switch to implement above algorithm. """ packet = event.parsed src_mac = packet.src dst_mac = packet.dst if packet.type == packet.IP_TYPE: packet_ip = event.parsed.find("ipv4") src_ip = packet_ip.srcip dst_ip = packet_ip.dstip if dst_ip == "10.0.0.4": print 'hey its unknown port' if dst_ip == "10.0.0.3": print 'hey its 3rd port' def flood (message = None): """ Floods the packet """ msg = of.ofp_packet_out() if time.time() - self.connection.connect_time >= _flood_delay: # Only flood if we've been connected for a little while... if self.hold_down_expired is False: # Oh yes it is! self.hold_down_expired = True log.info("%s: Flood hold-down expired -- flooding", dpid_to_str(event.dpid)) if message is not None: log.debug(message) #log.debug("%i: flood %s -> %s", event.dpid,packet.src,packet.dst) # OFPP_FLOOD is optional; on some switches you may need to change # this to OFPP_ALL. msg.actions.append(of.ofp_action_output(port = of.OFPP_FLOOD)) else: pass #log.info("Holding down flood for %s", dpid_to_str(event.dpid)) msg.data = event.ofp msg.in_port = event.port src_mac = packet.src dst_mac = packet.dst self.connection.send(msg) # print "inn3" def drop (duration = None): """ Drops this packet and optionally installs a flow to continue dropping similar ones for a while """ if duration is not None: if not isinstance(duration, tuple): duration = (duration,duration) msg = of.ofp_flow_mod() msg.match = of.ofp_match.from_packet(packet) msg.idle_timeout = duration[0] msg.hard_timeout = duration[1] msg.buffer_id = event.ofp.buffer_id self.connection.send(msg) elif event.ofp.buffer_id is not None: msg = of.ofp_packet_out() msg.buffer_id = event.ofp.buffer_id msg.in_port = event.port self.connection.send(msg) self.macToPort[packet.src] = event.port # 1 # print "inn4" dst_ip = "" src_ip = "" if packet.type == packet.IP_TYPE: packet_ip = event.parsed.find("ipv4") src_ip = packet_ip.srcip dst_ip = packet_ip.dstip if dst_ip == "10.0.0.4" : print 'hey its h44' msg = of.ofp_flow_mod() # msg.match = of.ofp_match.from_packet(packet, event.port) msg.idle_timeout = 10 msg.hard_timeout = 30 msg.cookie = 0 # msg.match.nw_dst = IPAddr("10.0.0.6") flow2out = of.ofp_action_output (port = 6) flow2dstIP = of.ofp_action_nw_addr.set_dst(IPAddr("10.0.0.6")) flow2srcMAC = of.ofp_action_dl_addr.set_src(EthAddr("00:00:00:00:00:04")) flow2dstMAC = of.ofp_action_dl_addr.set_dst(EthAddr("00:00:00:00:00:06")) msg.actions = [flow2dstIP, flow2srcMAC, flow2dstMAC, flow2out] msg.data = event.ofp # 6a self.connection.send(msg) elif src_ip == "10.0.0.6": print 'hey its h66' msg = of.ofp_flow_mod() # msg.match = of.ofp_match.from_packet(packet, event.port) msg.idle_timeout = 10 msg.hard_timeout = 30 msg.cookie = 0 # msg.match.nw_src = IPAddr("10.0.0.4") flow3out = of.ofp_action_output (port = 1) flow3srcIP = of.ofp_action_nw_addr.set_src(IPAddr("10.0.0.4")) flow3srcMAC = of.ofp_action_dl_addr.set_src(EthAddr("00:00:00:00:00:03")) flow3dstMAC = of.ofp_action_dl_addr.set_dst(EthAddr("00:00:00:00:00:01")) msg.actions = [flow3srcIP, flow3srcMAC, flow3dstMAC, flow3out] msg.data = event.ofp # 6a self.connection.send(msg) elif not self.transparent: # 2 if packet.type == packet.LLDP_TYPE or packet.dst.isBridgeFiltered(): drop() # 2a return elif packet.dst.is_multicast: flood() # 3a else: if packet.dst not in self.macToPort: # 4 flood("Port for %s unknown -- flooding" % (packet.dst,)) # 4a else: port = self.macToPort[packet.dst] if port == event.port: # 5 # 5a log.warning("Same port for packet from %s -> %s on %s.%s. Drop." % (packet.src, packet.dst, dpid_to_str(event.dpid), port)) drop(10) return # 6 log.debug("installing flow for %s.%i -> %s.%i" % (packet.src, event.port, packet.dst, port)) msg = of.ofp_flow_mod() msg.match = of.ofp_match.from_packet(packet, event.port) msg.idle_timeout = 10 msg.hard_timeout = 30 msg.actions.append(of.ofp_action_output(port = port)) msg.data = event.ofp # 6a self.connection.send(msg) class l2_learning (object): """ Waits for OpenFlow switches to connect and makes them learning switches. """ def __init__ (self, transparent, ignore = None): """ Initialize See LearningSwitch for meaning of 'transparent' 'ignore' is an optional list/set of DPIDs to ignore """ core.openflow.addListeners(self) self.transparent = transparent self.ignore = set(ignore) if ignore else () def _handle_ConnectionUp (self, event): if event.dpid in self.ignore: log.debug("Ignoring connection %s" % (event.connection,)) return log.debug("Connection %s" % (event.connection,)) LearningSwitch(event.connection, self.transparent) def launch (transparent=False, hold_down=_flood_delay, ignore = None): """ Starts an L2 learning switch. """ print "inn1" try: global _flood_delay _flood_delay = int(str(hold_down), 10) assert _flood_delay >= 0 except: raise RuntimeError("Expected hold-down to be a number") if ignore: ignore = ignore.replace(',', ' ').split() ignore = set(str_to_dpid(dpid) for dpid in ignore) core.registerNew(l2_learning, str_to_bool(transparent), ignore)
6d9aff0579e85befb9b7466eef954efb3b890ac5
2e14f3052742aa80b63eb87594e01f0050f8ecc4
/backend/session/urls.py
97f0a0051d90396155bc61d62601161c8a63f3dd
[]
no_license
albaqida/dashboard-app
ba6cc8dac830c01b932e47200c915ea28dae479e
7c1fe026ef10b5e576b0ac605a517a8238897d7b
refs/heads/develop
2021-07-24T13:30:07.532224
2017-11-06T02:59:47
2017-11-06T02:59:47
108,020,621
0
0
null
2017-10-23T18:12:51
2017-10-23T18:12:51
null
UTF-8
Python
false
false
137
py
from django.conf.urls import url from . import views urlpatterns = [ url(r'create-user$', views.create_user, name='create-user'), ]
95dff4f10c6ab977eafd45d613e7599e6563f873
2b0df4dd4e16f0cb60f41b585094f1e82fc86cf7
/lib/pgu/gui/misc.py
3a2bce5183d796bd91b400d32ce1626c04c8da7a
[]
no_license
taepatipol/BarbieSeahorseAdventureAI
274a9fc8b44ec06f2a34f7fb41c73b77466db5e9
e51930787b6d45e1387d97de2e3923a6d55fb5fd
refs/heads/master
2022-08-18T18:05:25.242343
2020-05-24T17:21:32
2020-05-24T17:21:32
227,073,926
0
0
null
null
null
null
UTF-8
Python
false
false
1,201
py
from const import * import widget import app class ProgressBar(widget.Widget): """A progress bar. <pre>ProgressBar(value,min,max)</pre> <dl> <dt>value<dd>starting value <dt>min<dd>minimum value rendered on the screen (usually 0) <dt>max<dd>maximum value </dl> <strong>Example</strong> <code> w = gui.ProgressBar(0,0,100) w.value = 25 </code> """ def __init__(self,value,min,max,**params): params.setdefault('cls','progressbar') widget.Widget.__init__(self,**params) self.min,self.max,self.value = min,max,value def paint(self,s): r = pygame.rect.Rect(0,0,self.rect.w,self.rect.h) r.w = r.w*(self.value-self.min)/(self.max-self.min) self.bar = r app.App.app.theme.render(s,self.style.bar,r) def __setattr__(self,k,v): if k == 'value': v = int(v) v = max(v,self.min) v = min(v,self.max) _v = self.__dict__.get(k,NOATTR) self.__dict__[k]=v if k == 'value' and _v != NOATTR and _v != v: self.send(CHANGE) self.repaint()
07291bb917c2cc38965129eb0817957818861346
abe169ad4dd0a5fdc331c050fc8fda4d6a0d6846
/webapp/urls.py
8bff53e7b6b2e980d3bfb70259e2078f8f703594
[]
no_license
chernykovv/rcn-django
2190a89768f3fc369337255d1c7bc04fc5cbf36e
e7082855c324fb056bb5cecc06c0de4b6c3dd665
refs/heads/main
2023-03-01T08:35:34.403456
2021-02-09T23:44:31
2021-02-09T23:44:31
337,566,907
1
0
null
null
null
null
UTF-8
Python
false
false
3,810
py
from django.conf.urls import patterns, include, url from django.conf import settings from django.contrib import admin from questions.views import ViolationView, MaintenanceView, NewOwnerView, ReviewView, DueRequetView, GetBadgesAjax from communities.views import CommunityView, DocumentEditView, DocumentCreateView, DocumentDeleteView, DocumentComCreateView, WebPageGetDetailAjax, ComSlidersCreateView, ComSlidersDeleteView, ComSlidersEditView, DocCategoryCreateView, DocCategoryDeleteView, DocCategoryEditView from webapp.views import payment_view admin.autodiscover() urlpatterns = patterns( 'webapp.views', url(r'^$', 'view_home'), ) urlpatterns += patterns('webapp.views', url(r'^login/$', 'redirect_community'), url(r'^payment/$', payment_view, name='paylease_payment') ) urlpatterns += patterns('', url(r'^homeowners-report-violation/$', ViolationView.as_view() , name='violation_view'), url(r'^homeowners-maintenance-request/$', MaintenanceView.as_view() , name='maintenance_view'), url(r'^homeowners-new-owner/$', NewOwnerView.as_view() , name='new_owner_view'), url(r'^homeowners-architectural-review/$', ReviewView.as_view() , name='review_view'), url(r'^dues-status-request', DueRequetView.as_view() , name='duerequest_view') ) urlpatterns += patterns( 'forms.ajax_views', url(r'^api/contact-form', 'view_contact_form'), url(r'^api/proposal-form', 'view_proposal_form'), ) urlpatterns += patterns( '', url(r'^front-edit/', include('front.urls')), ) urlpatterns += patterns( '', url(r'^admin/filebrowser/', include('filebrowser.urls')), url(r'^admin/', include(admin.site.urls)), ) if settings.DEBUG: urlpatterns += patterns( '', url(r'^media/(?P<path>.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), ) urlpatterns += patterns( 'news.views', url(r'^news/(?P<p_slug>.*)/tag=(?P<t_slug>.*)/article=(?P<a_slug>.*)$', 'view_tag_article'), url(r'^news/(?P<p_slug>.*)/tag=(?P<t_slug>.*)$', 'view_tag'), url(r'^news/(?P<p_slug>.*)/article=(?P<a_slug>.*)$', 'view_article'), url(r'^news/(?P<p_slug>.*)$', 'view_article_list'), ) urlpatterns += patterns('', url(r'^document/create/(?P<com_pk>\d+)/$', DocumentCreateView.as_view() , name='document_create_view'), url(r'^document/delete/(?P<pk>\d+)/$', DocumentDeleteView.as_view() , name='community_delete_view'), url(r'^document/update/(?P<pk>\d+)/(?P<com_pk>\d+)/$', DocumentEditView.as_view() , name='community_edit_view'), url(r'^document/create_com/$', DocumentComCreateView.as_view() , name='community_com'), url(r'^webpage/getdetails/$', WebPageGetDetailAjax.as_view() , name='webpage_ajax_com'), url(r'^(?P<slug>[-\w]+)/$', CommunityView.as_view() , name='community_view'), url(r'^comsliders/create/(?P<com_pk>\d+)/$', ComSlidersCreateView.as_view() , name='comsliders_create_view'), url(r'^comsliders/delete/(?P<pk>\d+)/$', ComSlidersDeleteView.as_view() , name='comsliders_delete_view'), url(r'^comsliders/update/(?P<pk>\d+)/(?P<com_pk>\d+)/$', ComSlidersEditView.as_view() , name='comsliders_edit_view'), url(r'^doccategory/create/$', DocCategoryCreateView.as_view() , name='doccategory_create_view'), url(r'^doccategory/delete/(?P<pk>\d+)/$', DocCategoryDeleteView.as_view() , name='doccategory_delete_view'), url(r'^doccategory/update/(?P<pk>\d+)/(?P<com_pk>\d+)/$', DocCategoryEditView.as_view() , name='docategory_edit_view'), url(r'^webpage/getbadeg/$', GetBadgesAjax.as_view() , name='getbadges'), ) urlpatterns += patterns( 'page_content.views', url(r'^edit/(?P<a_slug>.*)$', 'edit_web_page'), url(r'^(?P<a_slug>.*)/staff-member/(?P<staff_slug>.*)$', 'view_staff_member'), url(r'^(?P<a_slug>.*)$', 'view_web_page'), )
1d9741f463b1d422f98b321108ff9be5434e51a6
a9020c87d73200edd826719a751455033883c968
/treeexamples/example_1.py
0113e12ee3add24d617dd317054f9563cc854ab3
[ "MIT" ]
permissive
martinohanlon/GPIOXmasTreeGame
6d73f1bff190613481e29f2862250c339192e2c3
0d32ff7ca4fe3c2b536f5fa4490d09c1caf54b3a
refs/heads/master
2021-01-25T08:37:28.163740
2014-12-30T09:10:20
2014-12-30T09:10:20
28,156,951
2
0
null
null
null
null
UTF-8
Python
false
false
657
py
import tree # Some constants to identify each LED L0 = 1 L1 = 2 L2 = 4 L3 = 8 L4 = 16 L5 = 32 L6 = 64 ALL = 1+2+4+8+16+32+64 NO_LEDS = 0 tree.setup() # you must always call setup() first! # Pattern: flash each LED in turn for i in range(5): # repeat 5 times tree.leds_on_and_wait(L0, 0.3) # LED 0 on for 0.3 seconds tree.leds_on_and_wait(L1, 0.3) # LED 1 on for 0.3 seconds tree.leds_on_and_wait(L2, 0.3) # etc. tree.leds_on_and_wait(L3, 0.3) tree.leds_on_and_wait(L4, 0.3) tree.leds_on_and_wait(L5, 0.3) tree.leds_on_and_wait(L6, 0.3) tree.all_leds_off() # extinguish all LEDs # All done! tree.cleanup() # call cleanup() at the end
4b184906adbf84ff9b3a03c85ef8345868c66eb0
3f12df38a8f5780c44e527f5a3f16e5a7b044751
/store/admin.py
083688246e3ed67cec4b94d1ad824ec0a07fa441
[]
no_license
Sourmundada/GreatKart-Django
0e850cb2b49d9bc0c37b5193757b9a99ac6e4fbf
fa43c6232eb5217dd4a45528cbaaf00517901522
refs/heads/main
2023-07-13T00:15:34.352927
2021-08-21T05:34:13
2021-08-21T05:34:13
355,516,891
8
4
null
null
null
null
UTF-8
Python
false
false
815
py
from django.contrib import admin import admin_thumbnails from .models import Product, Variation, ReviewRating, ProductGallery @admin_thumbnails.thumbnail('image') class ProductGalleryInline(admin.TabularInline): model = ProductGallery extra = 1 class ProductAdmin(admin.ModelAdmin): list_display = ('product_name', 'price', 'is_available', 'created_date') prepopulated_fields = {'slug': ('product_name',)} inlines = [ProductGalleryInline] class VariationAdmin(admin.ModelAdmin): list_display = ('product', 'variation_category', 'variation_value', 'is_active') list_editable = ('is_active', ) list_filter = ('product', ) admin.site.register(Product, ProductAdmin) admin.site.register(Variation, VariationAdmin) admin.site.register(ReviewRating) admin.site.register(ProductGallery)
b9b310c51d364e149ebcb90826ab06f7588ebfbe
0046c8f952f8dadabb70a926e7206e9dd4d79237
/bubble/users.py
ee7ec58cc51eb96bae5f71ee0fd31771585a3728
[]
no_license
steveyang95/tools
663a93d768f9a2cccb455c94e09ee192bd5455d0
d69752d03f4d884816f4c195da476dc8441628c2
refs/heads/master
2020-03-30T22:00:05.864378
2019-07-06T08:40:09
2019-07-06T08:40:09
151,650,285
0
0
null
2018-12-26T04:14:05
2018-10-04T23:58:08
Python
UTF-8
Python
false
false
3,087
py
import os import sys import time import requests import string import random sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) import tools.stopwatch as stopwatch # Overall Users API Endpoint USERS_VERSION_TEST_URL = "https://{name}/version-test/api/1.1/wf/" USERS_LIVE_URL = "https://{name}/api/1.1/wf/" HEADER = {"Authorization": "Bearer {token}"} PARAMS = {} CLOCK = stopwatch.Clock() def create_users(users, live=False, endpoint="create_user"): _out("Starting to populate bubble database with {} users".format(len(users))) i = 0 session = requests.Session() base_url = USERS_VERSION_TEST_URL if not live else USERS_LIVE_URL url = "{}/{}".format(base_url, endpoint) for user in users: params = {"password": user['password'], "email": user['email'], "DisplayEmail": user['email']} if i % 5000 == 0: _out("curl -X POST {} -H 'application/json' -d {}".format(url, params), title="CURL") _out("Created {} users".format(i)) if i == 0: CLOCK.start_stopwatch("1") CLOCK.start_stopwatch("10") CLOCK.start_stopwatch("100") CLOCK.start_stopwatch("1000") r = session.post(url, json=params, headers=HEADER) exp = 0 while r.status_code != 200: _out("Code is {}. Will wait for a bit and then try again. Try {}".format(r.status_code, exp), "STATUS CODE") print(r.json()) time.sleep(2**exp) exp += 1 r = session.post(url, json=params, headers=HEADER) if exp == 5: _out("Failure to exponentially back off. Please try again") return i += 1 if i % 1 == 0: CLOCK.stop_stopwatch("1") CLOCK.start_stopwatch("1") if i % 10 == 0: CLOCK.stop_stopwatch("10") CLOCK.start_stopwatch("10") if i % 100 == 0: CLOCK.stop_stopwatch("100") CLOCK.start_stopwatch("100") if i % 1000 == 0: CLOCK.stop_stopwatch("1000") CLOCK.start_stopwatch("1000") if i % 2000 == 0: for sw in CLOCK.get_stopwatch_keys(): _out(CLOCK.get_average_time_elapsed(sw), "STATS {}".format(sw)) for sw in CLOCK.get_stopwatch_keys(): _out(CLOCK.get_average_time_elapsed(sw), "STATS {}".format(sw)) _out("Finished creating users!") def create_dummy_users(size): _out("Creating dummy users of size {}".format(size)) users = [] for i in range(size): users.append({"email": "{}@gmail.com".format(id_generator()), "password": id_generator(5)}) _out("Finished creating dummy users of size {}".format(size)) return users def id_generator(size=9, chars=string.ascii_letters + string.digits): return ''.join(random.choice(chars) for _ in range(size)) def _out(msg, title=None): title = title if title else "MESSAGE" print("\n[{}] {}".format(title, msg)) create_users(create_dummy_users(200000))
47e85f905e266f6fcbb4559c46c65de19a683b18
d84441b3426c9966aa072ad2ce9e9f5216527a54
/unfeed/sites/qdaily.py
aa774292eb813efd4ee54c7e4605b032b3cb9983
[]
no_license
tonicbupt/unfeed
96919010ab7dcca5cd120dfe739170ea42ea17e5
1fcab5acdbc1f41897f17eeabcf55c5867fc3d04
refs/heads/master
2020-12-25T10:34:53.962785
2014-05-24T10:57:10
2014-05-24T10:57:10
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,632
py
import copy from brownant import Site, Dinergate from brownant.pipeline import (TextResponseProperty, ElementTreeProperty, XPathTextProperty) from werkzeug.utils import cached_property from lxml.html import tostring from dateutil.parser import parse as parse_datetime from unfeed.utils.etree import eliminate_relative_urls from .pipeline import DictionaryProperty, DictionaryValueProperty site = Site('qdaily.com') @site.route('qdaily.com', '/', defaults={'page': 1}) class QdailyIndex(Dinergate): URL_BASE = 'http://qdaily.com' URL_TEMPLATE = '{self.URL_BASE}/display/homes/articlemore?page={self.page}' text_response = TextResponseProperty() dict_response = DictionaryProperty() html_response = DictionaryValueProperty(dict_key='html') etree = ElementTreeProperty(text_response_attr='html_response') def __iter__(self): xpath_base = '//div[@class="article-container"]' xpath_hd = xpath_base + '//div[@class="content"]' xpath_bd = xpath_base + '//div[contains(@class, "hover-content")]' category = self.etree.xpath( xpath_hd + '//p[@class="category"]/a/text()') title = self.etree.xpath(xpath_bd + '//h2/a/text()') url = self.etree.xpath(xpath_bd + '//h2/a/@href') description = self.etree.xpath( xpath_bd + '//div[@class="excerpt"]/a/text()') return zip(category, title, url, description) @site.route('qdaily.com', '/display/articles/<int:item_id>') class QdailyArticle(Dinergate): URL_BASE = QdailyIndex.URL_BASE URL_TEMPLATE = '{self.URL_BASE}/display/articles/{self.item_id}' text_response = TextResponseProperty() etree = ElementTreeProperty() title = XPathTextProperty(xpath='//h2[@class="main-title"]/text()') subtitle = XPathTextProperty(xpath='//h4[@class="sub-title"]/text()') author = XPathTextProperty( xpath='//*[contains(@class, "author")]/span[@class="name"]/text()') content_etree = XPathTextProperty( xpath='//*[contains(@class, "article-detail")]/div[@class="bd"]', pick_mode='first') published_text = XPathTextProperty( xpath='//*[contains(@class, "author")]/span[@class="date"]/text()') @cached_property def content(self): content_etree = eliminate_relative_urls( self.content_etree, self.URL_BASE, without_side_effect=True) html = tostring( content_etree, pretty_print=True, encoding='unicode') return html.strip() @cached_property def published(self): return parse_datetime(self.published_text.strip())
395af0f0b55dc1003d5e415b702212ce8a1d6d4d
6f996f18aaa54f554e7a1ffed0c9489b86056051
/flaskstarter/projects/models.py
1f72b78779ef68a815b8febc29b4e2d13177c24b
[]
no_license
Th3M4ttman/portfolio-site
17b180308aa6e1759582d91d3476eff0a02f5caf
e40fa3e81ea4588a5d1a8bb003b0b7fa3587e50c
refs/heads/master
2023-08-18T21:38:03.329340
2021-10-09T23:41:25
2021-10-09T23:41:25
411,526,497
0
0
null
null
null
null
UTF-8
Python
false
false
3,144
py
from sqlalchemy import Column, Integer, String, Boolean, Numeric, orm, ForeignKey, MetaData, Table from sqlalchemy.orm import sessionmaker from sqlalchemy.ext.declarative import declarative_base from ..extensions import db from flask_admin.contrib import sqla from sqlalchemy import inspect import json from flask_login import current_user from json import JSONEncoder def _default(self, obj): return getattr(obj.__class__, "to_json", _default.default)(obj) _default.default = JSONEncoder().default JSONEncoder.default = _default class Project(db.Model): __tablename__ = 'projects' id=Column(Integer, primary_key=True) title=Column('title', String(32)) cat=Column('category', String(32)) sub=Column('subcategory', String(32)) desc=Column('description', String(32)) imps = orm.relationship("Implementation", uselist=True, cascade="delete, delete-orphan") def __init__(self, id, title, cat, sub, desc, imps): self.id = id self.title = title self.cat = cat self.sub = sub self.desc = desc self.imps = imps def to_json(self): return {"id": self.id, "title": self.title, "cat": self.cat, "sub": self.sub, "desc": self.desc} class Implementation(db.Model): __tablename__ = 'implementations' imp_id=Column(Integer, primary_key=True) language=Column('language', String(32)) major=Column('major', Integer) minor=Column("minor", Integer) rev=Column("rev", Integer) project_id = Column(Integer, ForeignKey("projects.id")) def __init__(self, project_id, imp_id, language, major=0, minor=0, rev=0): self.project_id = project_id self.imp_id = imp_id self.language = language self.major = major self.minor = minor self.rev = rev self.project_id = imp_id def to_json(self): return json.dumps(self.__dict__) # Customized comment model admin class ProjectAdmin(sqla.ModelView): can_delete = True column_hide_backrefs = False column_display_pk = True column_list = [c_attr.key for c_attr in inspect(Project).mapper.column_attrs] column_sortable_list = ('id', 'title', 'cat', "sub", "desc") column_filters = ('id', 'title', 'cat', "sub", "desc") column_searchable_list = ('id', 'title', 'cat', "sub", "desc") def __init__(self, session): super(ProjectAdmin, self).__init__(Project, session) def is_accessible(self): if current_user.role == 'admin': return current_user.is_authenticated() # Customized comment model admin class ImpAdmin(sqla.ModelView): can_delete = True column_hide_backrefs = False column_display_pk = True column_list = [c_attr.key for c_attr in inspect(Implementation).mapper.column_attrs] column_sortable_list = ("project_id", "imp_id", "language", "major", "minor", "rev") column_filters = ("project_id", "imp_id", "language", "major", "minor", "rev") column_searchable_list = ("project_id", "imp_id", "language", "major", "minor", "rev") def __init__(self, session): super(ImpAdmin, self).__init__(Implementation, session) def is_accessible(self): if current_user.role == 'admin': return current_user.is_authenticated()
940d4c9b1e348b783e1a0aed831f3daf5d20544b
686578a34cbddf8907c8bfcdbf3384175079abae
/inicial/PyLadies/wsgi.py
ef112934b9cb565891a2db41bf41dc3d1c642fa3
[]
no_license
pyladies-bcn/django2
9d157537c7dd6d202b0eb27f23ff70f2aad29013
e709ab5a367a953d087e65f7c72b897a44b64ab6
refs/heads/master
2021-01-21T13:30:16.821911
2016-05-31T10:00:01
2016-05-31T10:00:01
51,360,083
0
0
null
null
null
null
UTF-8
Python
false
false
611
py
""" WSGI config for PyLadies project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/ """ import os, sys sys.path.append('/home/elena/djangostack-1.8.9-0/apps/django/django_projects/PyLadies') os.environ.setdefault("PYTHON_EGG_CACHE", "/home/elena/djangostack-1.8.9-0/apps/django/django_projects/PyLadies/egg_cache") from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "PyLadies.settings") application = get_wsgi_application()
4cbaeb8890a712bc2ae55461dd4173510c41a723
83c4a06aa6869168cc576ed507b46394783089fb
/src/competitions/migrations/0012_workout_new_bool.py
ea5c01c9d96a2bfa8d640f84419eb33d0e3c47d3
[]
no_license
GladwinAlmondMedia/fanfit-backend
a1e57d371119d2e1e80d041f1b2ca9c050f15983
eba4d79f9514728a1160a3f14fd9c0b1a19dc3ba
refs/heads/master
2021-05-04T05:11:26.078906
2016-10-31T18:08:10
2016-10-31T18:08:10
70,931,828
0
0
null
null
null
null
UTF-8
Python
false
false
468
py
# -*- coding: utf-8 -*- # Generated by Django 1.9.10 on 2016-10-23 18:53 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('competitions', '0011_auto_20161017_1647'), ] operations = [ migrations.AddField( model_name='workout', name='new_bool', field=models.CharField(max_length=10, null=True), ), ]
47c3142374ed34f1c9bd05ff36314ac8d2512ff8
de35033f12b8248a02f5cb44382271b1a6dd52ca
/key_map.py
6b94483173970284b3a6cbf215e671a3270c403e
[]
no_license
milicevichm/Energy_Management
cf8171f180fa20988b3e434f0be479e0ed3b7478
0a06cffd19b27fad949eb77439da76ceadc82a90
refs/heads/master
2021-01-01T05:42:09.568564
2015-02-16T21:24:31
2015-02-16T21:24:31
26,453,433
1
2
null
null
null
null
UTF-8
Python
false
false
8,037
py
#Author: Michael Milicevich #Class that maps appliance ID to datastore key for REDD Dataset class Key_Map(object): ''' This class contains a dict that maps all REDD DataStore keys for buildings 1 to 6 to the name of the appliance (as provided by metadata). Class also outputs appliance names to the user if needed. Parameters: ------------ building: The number (1-6) of the building instance you wish to map for for the dictionary keys. Attributes: ------------ map: The dictionary that stores the key of an item, with the index being the REDD defined appliance name. ''' def __init__(self, building = 1): self.map = {} self.load_map(building) def load_map(self, building): ''' Function loads the appropiate dictionary according to the building instance passed (1-6). Parameters: ------------ building: The number (1-6) of the building instance you wish to map for for the dictionary keys. ''' if building == 1: self.map['mains'] = '/building1/elec/meter1_2' self.map['mains1'] ='/building1/elec/meter1' self.map['mains2'] ='/building1/elec/meter2' self.map['fridge'] ='/building1/elec/meter5' self.map['dish washer'] ='/building1/elec/meter6' self.map['sockets1'] ='/building1/elec/meter7' self.map['sockets2'] ='/building1/elec/meter8' self.map['light1'] ='/building1/elec/meter9' self.map['microwave'] ='/building1/elec/meter11' self.map['unknown1'] ='/building1/elec/meter12' self.map['electric space heater'] ='/building1/elec/meter13' self.map['electric stove'] ='/building1/elec/meter14' self.map['sockets3'] ='/building1/elec/meter15' self.map['sockets4'] ='/building1/elec/meter16' self.map['light2'] ='/building1/elec/meter17' self.map['light3'] ='/building1/elec/meter18' self.map['unknown2'] ='/building1/elec/meter19' self.map['washer dryer'] ='/building1/elec/meter10_20' self.map['electric oven'] ='/building1/elec/meter3_4' elif building == 2: self.map['mains'] = '/building2/elec/meter1_2' self.map['mains1'] = '/building2/elec/meter1' self.map['mains2'] = '/building2/elec/meter2' self.map['sockets1'] = '/building2/elec/meter3' self.map['light'] = '/building2/elec/meter4' self.map['electric stove'] = '/building2/elec/meter5' self.map['microwave'] = '/building2/elec/meter6' self.map['washer dryer'] = '/building2/elec/meter7' self.map['sockets2'] = '/building2/elec/meter8' self.map['fridge'] = '/building2/elec/meter9' self.map['dish washer'] = '/building2/elec/meter10' self.map['waste disposal unit'] = '/building2/elec/meter11' elif building == 3: self.map['mains'] = '/building3/elec/meter1_2' self.map['mains1'] = '/building3/elec/meter1' self.map['mains2'] = '/building3/elec/meter2' self.map['sockets1'] = '/building3/elec/meter3' self.map['sockets2'] = '/building3/elec/meter4' self.map['light1'] = '/building3/elec/meter5' self.map['CE Appliance'] = '/building3/elec/meter6' self.map['fridge'] = '/building3/elec/meter7' self.map['waste disposal unit'] = '/building3/elec/meter8' self.map['dish washer'] = '/building3/elec/meter9' self.map['electric furnace'] = '/building3/elec/meter10' self.map['light2'] = '/building3/elec/meter11' self.map['sockets3'] = '/building3/elec/meter12' self.map['washer dryer'] = '/building3/elec/meter13_14' self.map['light3'] = '/building3/elec/meter15' self.map['microwave'] = '/building3/elec/meter16' self.map['light4'] = '/building3/elec/meter17' self.map['smoke alarm'] = '/building3/elec/meter18' self.map['light5'] = '/building3/elec/meter19' self.map['unknown'] = '/building3/elec/meter20' self.map['sockets4'] = '/building3/elec/meter21' self.map['sockets5'] = '/building3/elec/meter22' elif building == 4: self.map['mains'] = '/building4/elec/meter1_2' self.map['mains1'] = '/building4/elec/meter1' self.map['mains2'] = '/building4/elec/meter2' self.map['light1'] = '/building4/elec/meter3' self.map['electric furnace'] = '/building4/elec/meter4' self.map['sockets1'] = '/building4/elec/meter5' self.map['sockets2'] = '/building4/elec/meter6' self.map['washer dryer'] = '/building4/elec/meter7' self.map['electric stove'] = '/building4/elec/meter8' self.map['air conditioner1'] = '/building4/elec/meter9_10' self.map['unknown1'] = '/building4/elec/meter11' self.map['smoke alarm'] = '/building4/elec/meter12' self.map['light2'] = '/building4/elec/meter13' self.map['sockets3'] = '/building4/elec/meter14' self.map['dish washer'] = '/building4/elec/meter15' self.map['unknown2'] = '/building4/elec/meter16' self.map['unknown3'] = '/building4/elec/meter17' self.map['light3'] = '/building4/elec/meter18' self.map['light4'] = '/building4/elec/meter19' self.map['air conditioner2'] = '/building4/elec/meter20' elif building == 5: self.map['mains'] = '/building5/elec/meter1_2' self.map['mains1'] = '/building5/elec/meter1' self.map['mains2'] = '/building5/elec/meter2' self.map['microwave'] = '/building5/elec/meter3' self.map['light1'] = '/building5/elec/meter4' self.map['sockets1'] = '/building5/elec/meter5' self.map['electric furnace'] = '/building5/elec/meter6' self.map['sockets2'] = '/building5/elec/meter7' self.map['subpanel1'] = '/building5/elec/meter10' self.map['subpanel2'] = '/building5/elec/meter11' self.map['light2'] = '/building5/elec/meter14' self.map['sockets3'] = '/building5/elec/meter15' self.map['unknown'] = '/building5/elec/meter16' self.map['light3'] = '/building5/elec/meter17' self.map['fridge'] = '/building5/elec/meter18' self.map['light4'] = '/building5/elec/meter19' self.map['dish washer'] = '/building5/elec/meter20' self.map['waste disposal unit'] = '/building5/elec/meter21' self.map['CE appliance'] = '/building5/elec/meter22' self.map['light5'] = '/building5/elec/meter23' self.map['sockets4'] = '/building5/elec/meter24' self.map['sockets5'] = '/building5/elec/meter25' self.map['sockets6'] = '/building5/elec/meter26' self.map['electric space heater'] = '/building5/elec/meter12_13' self.map['washer dryer'] = '/building5/elec/meter8_9' elif building == 6: self.map['mains'] = '/building6/elec/meter1_2' self.map['mains1'] = '/building6/elec/meter1' self.map['mains2'] = '/building6/elec/meter2' self.map['sockets1'] = '/building6/elec/meter3' self.map['washer dryer'] = '/building6/elec/meter4' self.map['electric stove'] = '/building6/elec/meter5' self.map['CE appliance'] = '/building6/elec/meter6' self.map['unknown1'] = '/building6/elec/meter7' self.map['fridge'] = '/building6/elec/meter8' self.map['dish washer'] = '/building6/elec/meter9' self.map['sockets2'] = '/building6/elec/meter10' self.map['sockets3'] = '/building6/elec/meter11' self.map['electric space heater'] = '/building6/elec/meter12' self.map['sockets4'] = '/building6/elec/meter13' self.map['light'] = '/building6/elec/meter14' self.map['air handling unit'] = '/building6/elec/meter15' self.map['air conditioner'] = '/building6/elec/meter16_17' else: print("Error: Building application key map cannot be found.") def list_appliances(self): ''' Function prints out all of the different appliance names found in the current object instance. ''' for key in self.map: print(key) def get_key(self, apl): ''' Function returns the DataStore key based on appliance name input. Parameters: ------------ apl: The name of the appliance (as defined in metadata) ''' return self.map[apl] def is_in_map(self,appliance): flag = False for key in self.map: if key == appliance: flag = True if flag == True: return True else: return False
2baf7eb1ee7426cc1f1807192d8194507322a212
49cbdb19b0b8890b412be6c634608f3b96cbf693
/scene_2.py
ccddcbafb45789cdf0fb7a8d6c697b5d71a3197e
[]
no_license
quangminhdinh/Food-calories
bdf3e954069174963f7db62a5509372cf34878f3
3f062067667717ca9e49a4eee73e0ab2308e8e16
refs/heads/master
2023-07-15T14:46:42.904299
2021-08-29T17:49:48
2021-08-29T17:49:48
145,227,199
0
1
null
null
null
null
UTF-8
Python
false
false
2,320
py
import sys from render_canvas import * from pygame.locals import * class Scene2: def __init__(self, canvas, width, height, name): self.canvas = canvas self.image = pygame.image.load(os.path.join('data', 'background.png')) self.logo = pygame.image.load(os.path.join('data', 'white-logo.png')).convert_alpha() self.button = Button(350, 70, (width - 350) // 2, 550, 0, 1, canvas, "", 255, "", 0) self.activate = True self.width = width self.height = height self.name = str(name) def render(self): display_image(self.image, 0, 0, self.width, self.height, self.canvas) display_image(self.logo, (self.width - self.logo.get_width()) // 2, (self.height - self.logo.get_height()) // 2 - 100, self.logo.get_width(), self.logo.get_height(), self.canvas) self.button.render() display_text_middle(None, 30, "Get started!", (255, 255, 255), self.canvas, self.button) display_text_middle_screen(self.width, 410, None, 90, "Hi {0}, stay fit!".format(self.name), (255, 255, 255), self.canvas) def active(self): if self.activate: fps_clock = pygame.time.Clock() mouse_pos = (0, 0) scene1_render = True while scene1_render: self.render() act = self.button.activate(mouse_pos) if act: pygame.mouse.set_cursor(*pygame.cursors.diamond) else: pygame.mouse.set_cursor(*pygame.cursors.arrow) for event in pygame.event.get(): if event.type == pygame.QUIT or (event.type == KEYDOWN and event.key == K_ESCAPE): pygame.quit() sys.exit() elif event.type == MOUSEBUTTONUP and act: scene1_render = False elif event.type == MOUSEMOTION: mouse_pos = pygame.mouse.get_pos() pygame.display.update() fps_clock.tick(200) width1 = 1327 height1 = 700 pygame.init() display_surf = pygame.display.set_mode((width1, height1)) scene1 = Scene2(display_surf, width1, height1, "Minh") scene1.active()
f3a7b791562650dafd838e3cdb11491baea75ff0
f60fe3c4e0fd081453f9330e16959c6b96a32560
/apps/operation/__init__.py
edfcc214fcabda793b312deff350c0cf35f683b4
[]
no_license
alexzt0131/eduline
44458f969a618fa85b86606d44b12bd81764f7ea
bedc7b8816f5b97b124d96e3290b04cfd9c7b48a
refs/heads/master
2020-04-06T15:06:50.259665
2018-11-18T16:59:27
2018-11-18T16:59:27
157,566,233
0
0
null
null
null
null
UTF-8
Python
false
false
52
py
default_app_config = "operation.apps.OprationConfig"
f866c6da84ba149ac29dcea301ba65fc46fc8ac0
59c2f4aa6eeb2ff325f82ab573e2a4da389c1bad
/tests/tests.py
e9c490abcbeeff2c27575eddff78fdba7a46caaf
[ "MIT" ]
permissive
D4KU/redblack
b024966a00544f753e499da65d67edcd6a7b3870
a15ac3cb498a10778ce234d6c1c263c9a47f3307
refs/heads/master
2022-10-18T17:08:45.857568
2020-06-07T14:21:03
2020-06-07T14:21:03
262,396,814
0
0
null
null
null
null
UTF-8
Python
false
false
89,483
py
import importlib import unittest import random from datetime import datetime import tree importlib.reload(tree) from tree import Tree, Node class RbTreeTests(unittest.TestCase): def test_add(self): """ Use the tree we get from the test_build function and test the find function on each node""" rb_tree = Tree() rb_tree.insert(2) node_2 = rb_tree.root rb_tree.insert(1) node_1 = rb_tree.root.left rb_tree.insert(4) node_4 = rb_tree.root.right rb_tree.insert(5) node_5 = node_4.right rb_tree.insert(9) node_9 = node_5.right rb_tree.insert(3) node_3 = node_4.left rb_tree.insert(6) node_6 = node_9.left rb_tree.insert(7) node_7 = node_5.right rb_tree.insert(15) node_15 = node_9.right """ ___5B___ __2R__ 7R 1B 4B 6B 9B 3R 15R """ # valid cases self.assertEqual(rb_tree[5], node_5) self.assertEqual(rb_tree[2], node_2) self.assertEqual(rb_tree[1], node_1) self.assertEqual(rb_tree[4], node_4) self.assertEqual(rb_tree[3], node_3) self.assertEqual(rb_tree[7], node_7) self.assertEqual(rb_tree[6], node_6) self.assertEqual(rb_tree[9], node_9) self.assertEqual(rb_tree[15], node_15) # invalid cases with self.assertRaises(KeyError): rb_tree[-1] with self.assertRaises(KeyError): rb_tree[52454225] with self.assertRaises(KeyError): rb_tree[0] with self.assertRaises(KeyError): rb_tree[401] with self.assertRaises(KeyError): rb_tree[3.00001] # ***************TEST INSERTIONS*************** def test_recoloring_only(self): """ Create a red-black tree, add a red node such that we only have to recolor upwards twice add 4, which recolors 2 and 8 to False, 6 to True -10, 20 to False :return: """ tree = Tree() root = Node(key=10, red=False, parent=None) # LEFT SUBTREE node_m10 = Node(key=-10, red=True, parent=root) #OK node_6 = Node(key=6, red=False, parent=node_m10) #OK node_8 = Node(key=8, red=True, parent=node_6, left=None, right=None) #OK node_2 = Node(key=2, red=True, parent=node_6, left=None, right=None) #OK node_6.left = node_2 #OK node_6.right = node_8 #OK node_m20 = Node(key=-20, red=False, parent=node_m10, left=None, right=None) #OK node_m10.left = node_m20 #OK node_m10.right = node_6 #OK # RIGHT SUBTREE node_20 = Node(key=20, red=True, parent=root) #OK node_15 = Node(key=15, red=False, parent=node_20, left=None, right=None) #OK node_25 = Node(25, red=False, parent=node_20, left=None, right=None) #OK node_20.left = node_15 #OK node_20.right = node_25 #OK root.left = node_m10 #OK root.right = node_20 #OK tree.root = root tree.insert(4) """ _____10B_____ _____10B_____ __-10R__ __20R__ __-10R__ __20R__ -20B 6B 15B 25B --FIRST RECOLOR--> -20B 6R 15B 25B 2R 8R 2B 8B Add-->4R 4R _____10B_____ __-10B__ __20B__ --SECOND RECOLOR--> -20B 6R 15B 25B 2B 8B 4R """ """ This should trigger two recolors. 2 and 8 should turn to black, 6 should turn to red, -10 and 20 should turn to black 10 should try to turn to red, but since it's the root it can't be black""" expected_keys = [-20, -10, 2, 4, 6, 8, 10, 15, 20, 25] keys = list(tree.keys()) self.assertEqual(keys, expected_keys) self.assertEqual(node_2.red, False) self.assertEqual(node_8.red, False) self.assertEqual(node_6.red, True) self.assertEqual(node_m10.red, False) self.assertEqual(node_20.red, False) def test_recoloring_two(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # left subtree node_m10 = Node(key=-10, red=True, parent=root, left=None, right=None) node_m20 = Node(key=-20, red=False, parent=node_m10, left=None, right=None) node_6 = Node(key=6, red=False, parent=node_m10, left=None, right=None) node_m10.left = node_m20 node_m10.right = node_6 # right subtree node_20 = Node(key=20, red=True, parent=root, left=None, right=None) node_15 = Node(key=15, red=False, parent=node_20, left=None, right=None) node_25 = Node(key=25, red=False, parent=node_20, left=None, right=None) node_20.left = node_15 node_20.right = node_25 node_12 = Node(key=12, red=True, parent=node_15, left=None, right=None) node_17 = Node(key=17, red=True, parent=node_15, left=None, right=None) node_15.left = node_12 node_15.right = node_17 root.left = node_m10 root.right = node_20 rb_tree.root = root rb_tree.insert(19) """ _____10B_____ _____10B_____ __-10R__ __20R__ __-10R__ __20R__ -20B 6B 15B 25B FIRST RECOLOR--> -20B 6B 15R 25B 12R 17R 12B 17B Add-->19R 19R SECOND RECOLOR _____10B_____ __-10B__ __20B__ -20B 6B 15R 25B 12B 17B 19R """ expected_keys = [-20, -10, 6, 10, 12, 15, 17, 19, 20, 25] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_19 = node_17.right self.assertEqual(node_19.key, 19) self.assertEqual(node_19.red, True) self.assertEqual(node_19.parent, node_17) self.assertEqual(node_17.red, False) self.assertEqual(node_12.red, False) self.assertEqual(node_15.red, True) self.assertEqual(node_20.red, False) self.assertEqual(node_25.red, False) self.assertEqual(node_m10.red, False) self.assertEqual(rb_tree.root.red, False) def test_right_rotation(self): tree = Tree() root = Node(key=10, red=False, parent=None) # LEFT SUBTREE node_m10 = Node(key=-10, red=False, parent=root, left=None, right=None) node_7 = Node(key=7, red=True, parent=node_m10, left=None, right=None) node_m10.right = node_7 # RIGHT SUBTREE node_20 = Node(key=20, red=False, parent=root, left=None, right=None) node_15 = Node(key=15, red=True, parent=node_20, left=None, right=None) node_20.left = node_15 root.left = node_m10 root.right = node_20 tree.root = root tree.insert(13) """ ____10B____ ____10B____ -10B 20B --(LL -> R) RIGHT ROTATE--> -10B 15B 7R 15R 7R 13R 20R Add -> 13R """ expected_keys = [-10, 7, 10, 13, 15, 20] keys = list(tree.keys()) self.assertEqual(keys, expected_keys) node_20 = node_15.right node_13 = node_15.left self.assertEqual(node_15.red, False) # this should be the parent of both now self.assertEqual(node_15.parent.key, 10) self.assertEqual(node_20.key, 20) self.assertEqual(node_20.red, True) self.assertEqual(node_20.parent.key, 15) self.assertEqual(node_20.left, None) self.assertEqual(node_20.right, None) self.assertEqual(node_13.key, 13) self.assertEqual(node_13.red, True) self.assertEqual(node_13.parent.key, 15) self.assertEqual(node_13.left, None) self.assertEqual(node_13.right, None) def test_left_rotation_no_sibling(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # LEFT SUBTREE node_7 = Node(key=7, red=False, parent=root, left=None, right=None) node_8 = Node(key=8, red=True, parent=node_7, left=None, right=None) node_7.right = node_8 # RIGHT SUBTREE rightest = Node(key=20, red=False, parent=root, left=None, right=None) root.left = node_7 root.right = rightest rb_tree.root = root rb_tree.insert(9) """ --> 10B 10B ORIGINAL --> 7B 20B --LEFT ROTATION--> 8B 20B --> 8R 7R 9R --> 9R We add 9, which is the right child of 8 and causes a red-red relationship this calls for a left rotation, so 7 becomes left child of 8 and 9 the right child of 8 8 is black, 7 and 9 are red """ expected_keys = [7, 8, 9, 10, 20] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_9 = node_8.right self.assertEqual(node_9.key, 9) self.assertEqual(node_9.red, True) self.assertEqual(node_9.parent.key, 8) self.assertEqual(node_9.left, None) self.assertEqual(node_9.right, None) self.assertEqual(node_8.parent.key, 10) self.assertEqual(node_8.red, False) self.assertEqual(node_8.left.key, 7) self.assertEqual(node_8.right.key, 9) self.assertEqual(node_7.red, True) self.assertEqual(node_7.parent.key, 8) self.assertEqual(node_7.left, None) self.assertEqual(node_7.right, None) def test_right_rotation_no_sibling_left_subtree(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # LEFT SUBTREE node_m10 = Node(key=-10, red=False, parent=root, left=None, right=None) node_m11 = Node(key=-11, red=True, parent=node_m10, left=None, right=None) node_m10.left = node_m11 # RIGHT SUBTREE node_20 = Node(key=20, red=False, parent=root, left=None, right=None) node_15 = Node(key=15, red=True, parent=node_20, left=None, right=None) node_20.left = node_15 root.left = node_m10 root.right = node_20 rb_tree.root = root rb_tree.insert(-12) """ ____10____ ____10____ __-10B__ 20B (LL->R) Right rotate--> -11B 20B -11R 15R -12R -10R 15R Add--> 12R red-red relationship with -11 -12, so we do a right rotation where -12 becomes the left child of -11, -10 becomes the right child of -11 -11's parent is root, -11 is black, -10,-12 are True """ expected_keys = [-12, -11, -10, 10, 15, 20] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_m12 = node_m11.left self.assertEqual(rb_tree.root.left.key, -11) self.assertEqual(node_m12.key, -12) self.assertEqual(node_m12.red, True) self.assertEqual(node_m12.parent.key, -11) self.assertEqual(node_m12.left, None) self.assertEqual(node_m12.right, None) self.assertEqual(node_m11.red, False) self.assertEqual(node_m11.parent, rb_tree.root) self.assertEqual(node_m11.left.key, -12) self.assertEqual(node_m11.right.key, -10) self.assertEqual(node_m10.red, True) self.assertEqual(node_m10.parent.key, -11) self.assertEqual(node_m10.left, None) self.assertEqual(node_m10.right, None) def test_left_right_rotation_no_sibling(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # LEFT PART node_m10 = Node(key=-10, red=False, parent=root, left=None, right=None) node_7 = Node(key=7, red=True, parent=node_m10, left=None, right=None) node_m10.right = node_7 # RIGHT PART node_20 = Node(key=20, red=False, parent=root, left=None, right=None) node_15 = Node(key=15, red=True, parent=node_20, left=None, right=None) node_20.left = node_15 root.left=node_m10 root.right=node_20 rb_tree.root = root rb_tree.insert(17) """ ___10___ ____10____ -10B 20B -10B 20B 7R 15R --(LR=>RL) Left Rotate (no recolor) --> 7R 17R Add--> 17R 15R ____10____ Right Rotate (with recolor) --> -10B 17B 7R 15R 20R 15-17 should do a left rotation so 17 is now the parent of 15. Then, a right rotation should be done so 17 is the parent of 20(15's prev parent) Also, a recoloring should be done such that 17 is now black and his children are red """ expected_keys = [-10, 7, 10, 15, 17, 20] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_15 = node_15 node_20 = node_20 node_17 = node_15.parent self.assertEqual(rb_tree.root.right, node_17) self.assertEqual(node_17.key, 17) self.assertEqual(node_17.red, False) self.assertEqual(node_17.parent, rb_tree.root) self.assertEqual(node_17.left.key, 15) self.assertEqual(node_17.right.key, 20) self.assertEqual(node_20.parent.key, 17) self.assertEqual(node_20.red, True) self.assertEqual(node_20.left, None) self.assertEqual(node_20.right, None) self.assertEqual(node_15.parent.key, 17) self.assertEqual(node_15.red, True) self.assertEqual(node_15.left, None) self.assertEqual(node_15.right, None) def test_right_left_rotation_no_sibling(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # LEFT PART nodem10 = Node(key=-10, red=False, parent=root, left=None, right=None) node_7 = Node(key=7, red=True, parent=nodem10, left=None, right=None) nodem10.right = node_7 # RIGHT PART node_20 = Node(key=20, red=False, parent=root, left=None, right=None) node_15 = Node(key=15, red=True, parent=node_20, left=None, right=None) node_20.left = node_15 root.left = nodem10 root.right = node_20 rb_tree.root = root rb_tree.insert(2) """ ___10___ ___10___ -10B 20B -10B 20B 7R 15R --- (LR=>RL) Right Rotation (no recolor)--> 2R 15R Add--> 2R 7R _____10_____ Left Rotation (with recolor) --> __2B__ __20B__ -10R 7R 15R 2 goes as left to 7, but both are red so we do a RIGHT-LEFT rotation First a right rotation should happen, so that 2 becomes the parent of 7 [2 right-> 7] Second a left rotation should happen, so that 2 becomes the parent of -10 and 7 2 is black, -10 and 7 are now red. 2's parent is the root - 10 """ expected_keys = [-10, 2, 7, 10, 15, 20] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_2 = node_7.parent self.assertEqual(node_2.parent.key, 10) self.assertEqual(node_2.red, False) self.assertEqual(node_2.left.key, -10) self.assertEqual(node_2.right.key, 7) self.assertEqual(node_7.red, True) self.assertEqual(node_7.parent.key, 2) self.assertEqual(node_7.left, None) self.assertEqual(node_7.right, None) self.assertEqual(nodem10.red, True) self.assertEqual(nodem10.parent.key, 2) self.assertEqual(nodem10.left, None) self.assertEqual(nodem10.right, None) def test_recolor_lr(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None) # RIGHT SUBTREE node_m10 = Node(key=-10, red=True, parent=root, left=None, right=None) node_m20 = Node(key=-20, red=False, parent=node_m10, left=None, right=None) node_m10.left = node_m20 node_6 = Node(key=6, red=False, parent=node_m10, left=None, right=None) node_m10.right = node_6 node_1 = Node(key=1, red=True, parent=node_6, left=None, right=None) node_6.left = node_1 node_9 = Node(key=9, red=True, parent=node_6, left=None, right=None) node_6.right = node_9 # LEFT SUBTREE node_20 = Node(key=20, red=False, parent=root, left=None, right=None) node_15 = Node(key=15, red=True, parent=node_20, left=None, right=None) node_20.left = node_15 node_30 = Node(key=30, red=True, parent=node_20, left=None, right=None) node_20.right = node_30 root.left = node_m10 root.right = node_20 rb_tree.root = root rb_tree.insert(4) """ _________10B_________ _________10B_________ ___-10R___ __20B__ ___-10R___ __20B__ -20B __6B__ 15R 30R ---RECOLORS TO --> -20B __6R__ 15R 30R 1R 9R 1B 9B 4R 4R _________10B_________ ___6R___ __20B__ ______6B__ LEFT ROTATOES TO --> __-10B__ 9B 15R 30R ---RIGHT ROTATES TO--> __-10R__ _10R_ -20B 1B -20B 1B 9B __20B__ 4R 4R 15R 30R Adding 4, we recolor once, then we check upwards and see that there's a black sibling. We see that our direction is RightLeft (RL) and do a Left Rotation followed by a Right Rotation -10 becomes 6's left child and 1 becomes -10's right child """ expected_keys = [-20, -10, 1, 4, 6, 9, 10, 15, 20, 30] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_10 = rb_tree.root.right node_4 = node_1.right self.assertEqual(rb_tree.root.key, 6) self.assertEqual(rb_tree.root.parent, None) self.assertEqual(rb_tree.root.left.key, -10) self.assertEqual(rb_tree.root.right.key, 10) self.assertEqual(node_m10.parent.key, 6) self.assertEqual(node_m10.red, True) self.assertEqual(node_m10.left.key, -20) self.assertEqual(node_m10.right.key, 1) self.assertEqual(node_10.red, True) self.assertEqual(node_10.parent.key, 6) self.assertEqual(node_10.left.key, 9) self.assertEqual(node_10.right.key, 20) self.assertEqual(node_m20.red, False) self.assertEqual(node_m20.parent.key, -10) self.assertEqual(node_m20.left, None) self.assertEqual(node_m20.right, None) self.assertEqual(node_1.red, False) self.assertEqual(node_1.parent.key, -10) self.assertEqual(node_1.left, None) self.assertEqual(node_1.right.red, True) self.assertEqual(node_4.key, 4) self.assertEqual(node_4.red, True) def test_functional_test_build_tree(self): rb_tree = Tree() rb_tree.insert(2) self.assertEqual(rb_tree.root.key, 2) self.assertEqual(rb_tree.root.red, False) node_2 = rb_tree.root """ 2 """ expected_keys = [2] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) rb_tree.insert(1) """ 2B 1R """ expected_keys = [1, 2] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_1 = rb_tree.root.left self.assertEqual(node_1.key, 1) self.assertEqual(node_1.red, True) rb_tree.insert(4) """ 2B 1R 4R """ expected_keys = [1, 2, 4] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_4 = rb_tree.root.right self.assertEqual(node_4.key, 4) self.assertEqual(node_4.red, True) self.assertEqual(node_4.left, None) self.assertEqual(node_4.right, None) rb_tree.insert(5) """ 2B 2B 1R 4R ---CAUSES RECOLOR--> 1B 4B 5R 5R """ expected_keys = [1, 2, 4, 5] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_5 = node_4.right self.assertEqual(node_5.key, 5) self.assertEqual(node_4.red, False) self.assertEqual(node_1.red, False) self.assertEqual(node_5.red, True) rb_tree.insert(9) """ 2B __2B__ 1B 4B ---CAUSES LEFT ROTATION--> 1B 5B 5R 4R 9R 9R """ expected_keys = [1, 2, 4, 5, 9] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_9 = node_5.right self.assertEqual(node_9.key, 9) self.assertEqual(node_9.red, True) self.assertEqual(node_9.left, None) self.assertEqual(node_9.right, None) self.assertEqual(node_4.red, True) self.assertEqual(node_4.left, None) self.assertEqual(node_4.right, None) self.assertEqual(node_4.parent.key, 5) self.assertEqual(node_5.parent.key, 2) self.assertEqual(node_5.red, False) self.assertEqual(node_5.left.key, 4) self.assertEqual(node_5.right.key, 9) rb_tree.insert(3) """ __2B__ __2B__ 1B 5B ---CAUSES RECOLOR--> 1B 5R 4R 9R 4B 9B 3R 3R """ expected_keys = [1, 2, 3, 4, 5, 9] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_3 = node_4.left self.assertEqual(node_3.key, 3) self.assertEqual(node_3.red, True) self.assertEqual(node_3.left, None) self.assertEqual(node_3.right, None) self.assertEqual(node_3.parent.key, 4) self.assertEqual(node_4.red, False) self.assertEqual(node_4.right, None) self.assertEqual(node_4.parent.key, 5) self.assertEqual(node_9.red, False) self.assertEqual(node_9.parent.key, 5) self.assertEqual(node_5.red, True) self.assertEqual(node_5.left.key, 4) self.assertEqual(node_5.right.key, 9) rb_tree.insert(6) """ Nothing special __2B__ 1B 5R___ 4B _9B 3R 6R """ expected_keys = [1, 2, 3, 4, 5, 6, 9] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_6 = node_9.left self.assertEqual(node_6.key, 6) self.assertEqual(node_6.red, True) self.assertEqual(node_6.parent.key, 9) self.assertEqual(node_6.left, None) self.assertEqual(node_6.right, None) rb_tree.insert(7) """ __2B__ __2B__ 1B ___5R___ ---LEFT ROTATION TO--> 1B ___5R___ 4B _9B_ 4B 9B 3R 6R 3R 7R 7R 6B RIGHT ROTATION (RECOLOR) TO __2B__ 1B ___5R___ 4B 7B 3R 6R 9R """ expected_keys = [1, 2, 3, 4, 5, 6, 7, 9] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_7 = node_5.right self.assertEqual(node_7.key, 7) self.assertEqual(node_7.red, False) self.assertEqual(node_7.left.key, 6) self.assertEqual(node_7.right.key, 9) self.assertEqual(node_7.parent.key, 5) self.assertEqual(node_5.red, True) self.assertEqual(node_5.right.key, 7) self.assertEqual(node_6.red, True) self.assertEqual(node_6.left, None) self.assertEqual(node_6.right, None) self.assertEqual(node_6.parent.key, 7) self.assertEqual(node_9.red, True) self.assertEqual(node_9.left, None) self.assertEqual(node_9.right, None) self.assertEqual(node_9.parent.key, 7) rb_tree.insert(15) """ __2B__ __2B__ 1B ___5R___ 1B ___5R___ 4B 7B ---RECOLORS TO--> 4B 7R 3R 6R 9R 3R 6B 9B 15R 15R Red-red relationship on 5R-7R. 7R's sibling is False, so we need to rotate. 7 is the right child of 5, 5 is the right child of 2, so we have RR => L: Left rotation with recolor What we get is: ___5B___ __2R__ 7R 1B 4B 6B 9B 3R 15R """ expected_keys = [1, 2, 3, 4, 5, 6, 7, 9, 15] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_15 = node_9.right self.assertEqual(node_15.red, True) self.assertEqual(node_15.parent.key, 9) self.assertEqual(node_15.left, None) self.assertEqual(node_15.right, None) self.assertEqual(node_9.red, False) self.assertEqual(node_9.left, None) self.assertEqual(node_9.right.key, 15) self.assertEqual(node_9.parent.key, 7) self.assertEqual(node_6.red, False) self.assertEqual(node_7.red, True) self.assertEqual(node_7.left.key, 6) self.assertEqual(node_7.right.key, 9) self.assertEqual(rb_tree.root.key, 5) self.assertIsNone(node_5.parent) self.assertEqual(node_5.right.key, 7) self.assertEqual(node_5.left.key, 2) self.assertEqual(node_2.red, True) self.assertEqual(node_2.parent.key, 5) self.assertEqual(node_2.left.key, 1) self.assertEqual(node_2.right.key, 4) self.assertEqual(node_4.parent.key, 2) self.assertEqual(node_4.red, False) self.assertEqual(node_4.left.key, 3) self.assertEqual(node_4.right, None) def test_right_left_rotation_after_recolor(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) node_10 = root # left subtree node_5 = Node(key=5, red=False, parent=root, left=None, right=None) # right subtree node_20 = Node(key=20, red=True, parent=root, left=None, right=None) node_15 = Node(key=15, red=False, parent=node_20, left=None, right=None) node_25 = Node(key=25, red=False, parent=node_20, left=None, right=None) node_20.left = node_15 node_20.right = node_25 node_12 = Node(key=12, red=True, parent=node_15, left=None, right=None) node_17 = Node(key=17, red=True, parent=node_15, left=None, right=None) node_15.left = node_12 node_15.right = node_17 root.left = node_5 root.right = node_20 rb_tree.root = root rb_tree.insert(19) """ ____10B____ ____10B____ 5B __20R__ 5B __20R__ __15B__ 25B --RECOLORS TO--> __15R__ 25B 12R 17R 12B 17B Add-->19R 19R ____10B____ LR=>RL: Right rotation to 5B ___15R___ 12B __20R__ 17B 25B 19R ______15B_____ Left rotation to 10R __20R__ 5B 12B __17B__ 25B 19R """ expected_keys = [5, 10, 12, 15, 17, 19, 20, 25] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_19 = node_17.right self.assertEqual(node_19.key, 19) self.assertEqual(node_19.red, True) self.assertEqual(node_19.left, None) self.assertEqual(node_19.right, None) self.assertEqual(node_19.parent, node_17) self.assertEqual(node_17.parent, node_20) self.assertEqual(node_17.red, False) self.assertEqual(node_17.left, None) self.assertEqual(node_17.right, node_19) self.assertEqual(node_20.parent, node_15) self.assertEqual(node_20.red, True) self.assertEqual(node_20.left, node_17) self.assertEqual(node_20.right, node_25) self.assertEqual(rb_tree.root, node_15) self.assertIsNone(node_15.parent) self.assertEqual(node_15.left, node_10) self.assertEqual(node_15.right, node_20) self.assertEqual(node_15.red, False) self.assertEqual(node_10.parent, node_15) self.assertEqual(node_10.red, True) self.assertEqual(node_10.right, node_12) self.assertEqual(node_10.left, node_5) self.assertEqual(node_12.red, False) self.assertEqual(node_12.parent, node_10) self.assertEqual(node_12.left, None) self.assertEqual(node_12.right, None) def test_right_rotation_after_recolor(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) node_10 = root # left subtree node_m10 = Node(key=-10, red=True, parent=root, left=None, right=None) node_6 = Node(key=6, red=False, parent=node_m10, left=None, right=None) node_m20 = Node(key=-20, red=False, parent=node_m10, left=None, right=None) node_m10.left = node_m20 node_m10.right = node_6 node_m21 = Node(key=-21, red=True, parent=node_m20, left=None, right=None) node_m19 = Node(key=-19, red=True, parent=node_m20, left=None, right=None) node_m20.left = node_m21 node_m20.right = node_m19 # right subtree node_20 = Node(key=20, red=False, parent=root, left=None, right=None) node_15 = Node(key=15, red=True, parent=node_20, left=None, right=None) node_25 = Node(key=25, red=True, parent=node_20, left=None, right=None) node_20.left = node_15 node_20.right = node_25 root.left = node_m10 root.right = node_20 rb_tree.root = root rb_tree.insert(-22) """ _____10_____ _____10_____ / \ / \ -10R 20B -10R 20B / \ / \ / \ / \ -20B 6B 15R 25R --RECOLOR TO--> -20R 6B 15R 25R / \ / \ -21R -19R -21B -19B / / Add-> -22R 22R ____-10B_____ / \ -20R __10R__ / \ / \ Right rotation to-> -21B -19B 6B __20B__ / / \ -22R 15R 25R """ expected_keys = [-22, -21, -20, -19, -10, 6, 10, 15, 20, 25] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) self.assertEqual(rb_tree.root, node_m10) self.assertEqual(node_m10.parent, None) self.assertEqual(node_m10.left, node_m20) self.assertEqual(node_m10.right, node_10) self.assertEqual(node_m10.red, False) self.assertEqual(node_10.parent, node_m10) self.assertEqual(node_10.red, True) self.assertEqual(node_10.left, node_6) self.assertEqual(node_10.right, node_20) self.assertEqual(node_m20.parent, node_m10) self.assertEqual(node_m20.red, True) self.assertEqual(node_m20.left, node_m21) self.assertEqual(node_m20.right, node_m19) self.assertEqual(node_m21.red, False) self.assertEqual(node_m21.left.key, -22) self.assertEqual(node_6.parent, node_10) self.assertEqual(node_6.red, False) self.assertEqual(node_6.left, None) self.assertEqual(node_6.right, None) self.assertEqual(node_m19.red, False) self.assertEqual(node_m19.parent, node_m20) self.assertEqual(node_m19.left, None) self.assertEqual(node_m19.right, None) # ***************TEST INSERTIONS*************** # ***************TEST DELETIONS*************** def test_deletion_root(self): rb_tree = Tree() root = Node(key=5, red=False, parent=None, left=None, right=None) left_child = Node(key=3, red=True, parent=root, left=None, right=None) right_child = Node(key=8, red=True, parent=root, left=None, right=None) root.left = left_child root.right = right_child """ REMOVE--> __5__ __8B__ / \ --Result--> / 3R 8R 3R """ rb_tree.root = root del rb_tree[5] expected_keys = [3, 8] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_8 = rb_tree.root self.assertEqual(node_8.key, 8) self.assertEqual(node_8.red, False) self.assertEqual(node_8.parent, None) self.assertEqual(node_8.left.key, 3) self.assertEqual(node_8.right, None) node_3 = node_8.left self.assertEqual(node_3.red, True) self.assertEqual(node_3.parent, node_8) self.assertEqual(node_3.left, None) self.assertEqual(node_3.right, None) def test_deletion_root_2_nodes(self): rb_tree = Tree() root = Node(key=5, red=False, parent=None, left=None, right=None) right_child = Node(key=8, red=True, parent=root, left=None, right=None) root.right = right_child rb_tree.root = root del rb_tree[5] """ __5B__ <-- REMOVE __8B__ \ Should become--^ 8R """ expected_keys = [8] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) root = rb_tree.root self.assertEqual(root.key, 8) self.assertEqual(root.parent, None) self.assertEqual(root.red, False) self.assertEqual(root.left, None) self.assertEqual(root.right, None) def test_delete_single_child(self): rb_tree = Tree() root = Node(key=5, red=False, parent=None, left=None, right=None) left_child = Node(key=1, red=True, parent=root, left=None, right=None) right_child = Node(key=6, red=True, parent=root, left=None, right=None) root.left = left_child root.right = right_child rb_tree.root = root del rb_tree[6] """ 5 5B / \ should become / 1R 6R 1R """ expected_keys = [1, 5] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) self.assertEqual(root.right, None) self.assertEqual(root.key, 5) self.assertEqual(root.red, False) self.assertEqual(root.parent, None) self.assertEqual(root.left.key, 1) node_1 = root.left self.assertEqual(node_1.left, None) self.assertEqual(node_1.right, None) def test_delete_single_deep_child(self): rb_tree = Tree() root = Node(key=20, red=False, parent=None, left=None, right=None) # left subtree node_10 = Node(key=10, red=False, parent=None, left=None, right=None) node_5 = Node(key=5, red=True, parent=node_10, left=None, right=None) node_15 = Node(key=15, red=True, parent=node_10, left=None, right=None) node_10.left = node_5 node_10.right = node_15 # right subtree node_38 = Node(key=38, red=True, parent=root, left=None, right=None) node_28 = Node(key=28, red=False, parent=node_38, left=None, right=None) node_48 = Node(key=48, red=False, parent=node_38, left=None, right=None) node_38.left = node_28 node_38.right = node_48 # node_28 subtree node_23 = Node(key=23, red=True, parent=node_28, left=None, right=None) node_29 = Node(key=29, red=True, parent=node_28, left=None, right=None) node_28.left = node_23 node_28.right = node_29 # node 48 subtree node_41 = Node(key=41, red=True, parent=node_48, left=None, right=None) node_49 = Node(key=49, red=True, parent=node_48, left=None, right=None) node_48.left = node_41 node_48.right = node_49 root.left = node_10 root.right = node_38 rb_tree.root = root del rb_tree[49] """ ______20______ / \ 10B ___38R___ / \ / \ 5R 15R 28B 48B / \ / \ 23R 29R 41R 49R <--- REMOVE """ expected_keys = [5, 10, 15, 20, 23, 28, 29, 38, 41, 48] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) self.assertEqual(node_48.right, None) self.assertEqual(node_48.red, False) self.assertEqual(node_48.left.key, 41) with self.assertRaises(KeyError): rb_tree[49] def test_deletion_red_node_red_successor_no_children(self): """ This must be the easiest deletion yet! """ rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # Left subtree node_5 = Node(key=5, red=True, parent=root, left=None, right=None) node_m5 = Node(key=-5, red=False, parent=root, left=None, right=None) node_7 = Node(key=7, red=False, parent=node_5, left=None, right=None) node_5.left = node_m5 node_5.right = node_7 # right subtree node_35 = Node(key=35, red=True, parent=root, left=None, right=None) node_20 = Node(key=20, red=False, parent=node_35, left=None, right=None) node_38 = Node(key=38, red=False, parent=node_35, left=None, right=None) node_35.left = node_20 node_35.right = node_38 node_36 = Node(key=36, red=True, parent=node_38, left=None, right=None) node_38.left = node_36 root.left = node_5 root.right = node_35 rb_tree.root = root del rb_tree[35] """ 10B / \ 5R 35R <-- REMOVE THIS / \ / \ -5B 7B 20B 38B We get it's in-order successor, which is 36 / 36R 36 Is red and has no children, so we easily swap it's key with 35 and remove 36 10B / \ RESULT IS 5R 36R / \ / \ -5B 7B 20B 38B """ expected_keys = [-5, 5, 7, 10, 20, 36, 38] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) # Careful with reference equals node_36 = rb_tree.root.right self.assertEqual(node_36.key, 36) self.assertEqual(node_36.red, True) self.assertEqual(node_36.parent, rb_tree.root) self.assertEqual(node_36.left.key, 20) self.assertEqual(node_36.right.key, 38) self.assertEqual(node_20.parent.key, 36) self.assertEqual(node_38.parent.key, 36) self.assertEqual(node_38.left, None) def test_mirror_deletion_red_node_red_successor_no_children(self): """ This must be the easiest deletion yet! """ rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # Left subtree node_5 = Node(key=5, red=True, parent=root, left=None, right=None) node_m5 = Node(key=-5, red=False, parent=root, left=None, right=None) node_7 = Node(key=7, red=False, parent=node_5, left=None, right=None) node_5.left = node_m5 node_5.right = node_7 node_6 = Node(key=6, red=True, parent=node_7, left=None, right=None) node_7.left = node_6 # right subtree node_35 = Node(key=35, red=True, parent=root, left=None, right=None) node_20 = Node(key=20, red=False, parent=node_35, left=None, right=None) node_38 = Node(key=38, red=False, parent=node_35, left=None, right=None) node_35.left = node_20 node_35.right = node_38 node_36 = Node(key=36, red=True, parent=node_38, left=None, right=None) node_38.left = node_36 root.left = node_5 root.right = node_35 rb_tree.root = root del rb_tree[5] """ 10B / \ REMOVE --> 5R 35R / \ / \ -5B 7B 20B 38B We get it's in-order successor, which is 6 / / 6R 36R 6 Is red and has no children, so we easily swap it's key with 5 and remove 6 10B / \ RESULT IS 6R 35R / \ / \ -5B 7B 20B 38B / 36R """ expected_keys = [-5, 6, 7, 10, 20, 35, 36, 38] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_6 = rb_tree.root.left self.assertEqual(node_6.key, 6) self.assertEqual(node_6.red, True) self.assertEqual(node_6.parent, rb_tree.root) self.assertEqual(node_6.left.key, -5) self.assertEqual(node_6.right.key, 7) node_7 = node_6.right self.assertEqual(node_7.red, False) self.assertEqual(node_7.parent, node_6) self.assertEqual(node_7.left, None) self.assertEqual(node_7.right, None) def test_deletion_black_node_black_successor_right_red_child(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # left subtree node_5 = Node(key=5, red=False, parent=root, left=None, right=None) node_m5 = Node(key=-5, red=False, parent=node_5, left=None, right=None) node_7 = Node(key=7, red=False, parent=node_5, left=None, right=None) node_5.left = node_m5 node_5.right = node_7 # right subtree node_30 = Node(key=30, red=False, parent=root, left=None, right=None) node_20 = Node(key=20, red=False, parent=node_30, left=None, right=None) node_38 = Node(key=38, red=True, parent=node_30, left=None, right=None) node_30.left = node_20 node_30.right = node_38 # 38 subtree node_32 = Node(key=32, red=False, parent=node_38, left=None, right=None) node_41 = Node(key=41, red=False, parent=node_38, left=None, right=None) node_38.left = node_32 node_38.right = node_41 node_35 = Node(key=35, red=True, parent=node_32, left=None, right=None) node_32.right = node_35 root.left = node_5 root.right = node_30 rb_tree.root = root del rb_tree[30] """ ___10B___ ___10B___ / \ / \ 5B 30B <------- REMOVE THIS 5B 32B <---- / \ / \ / \ / \ -5B 7B 20B 38R -5B 7B 20B 38R / \ / \ successor ---> 32B 41B --> 35B 41B \ 30B becomes 32B 35R old 32B becomes 35B """ expected_keys = [-5, 5, 7, 10, 20, 32, 35, 38, 41] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_32 = node_30 self.assertEqual(node_32.key, 32) self.assertEqual(node_32.parent.key, 10) self.assertEqual(node_32.red, False) self.assertEqual(node_32.left, node_20) self.assertEqual(node_32.right, node_38) node_35 = node_38.left self.assertEqual(node_35.key, 35) self.assertEqual(node_35.parent.key, 38) self.assertEqual(node_35.red, False) self.assertEqual(node_35.left, None) self.assertEqual(node_35.right, None) def test_deletion_black_node_black_successor_no_child_case_4(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # left subtree node_m10 = Node(key=-10, red=False, parent=root, left=None, right=None) # right subtree node_30 = Node(key=30, red=True, parent=root, left=None, right=None) node_20 = Node(key=20, red=False, parent=node_30, left=None, right=None) node_38 = Node(key=38, red=False, parent=node_30, left=None, right=None) node_30.left = node_20 node_30.right = node_38 root.left = node_m10 root.right = node_30 rb_tree.root = root del rb_tree[10] """ ___10B___ <----- REMOVE THIS ___20B___ / \ / \ -10B 30R -10B 30R / \ / \ successor --> 20B 38B double black DB 38B Case 4 applies, since the sibling is black, has no red children and the parent is True So, we simply exchange colors of the parent and the sibling ___20B___ / \ -10B 30B DONE \ 38R """ expected_keys = [-10, 20, 30, 38] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) self.assertEqual(rb_tree.root.key, 20) self.assertEqual(rb_tree.root.red, False) node_30 = rb_tree.root.right self.assertEqual(node_30.parent.key, 20) self.assertEqual(node_30.key, 30) self.assertEqual(node_30.red, False) self.assertEqual(node_30.left, None) self.assertEqual(node_30.right.key, 38) node_38 = node_30.right self.assertEqual(node_38.key, 38) self.assertEqual(node_38.red, True) self.assertEqual(node_38.left, None) self.assertEqual(node_38.right, None) def test_deletion_black_node_no_successor_case_6(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # left subtree node_m10 = Node(key=-10, red=False, parent=root, left=None, right=None) # right subtree node_30 = Node(key=30, red=False, parent=root, left=None, right=None) node_25 = Node(key=25, red=True, parent=node_30, left=None, right=None) node_40 = Node(key=40, red=True, parent=node_30, left=None, right=None) node_30.left = node_25 node_30.right = node_40 root.left = node_m10 root.right = node_30 rb_tree.root = root del rb_tree[-10] """ ___10B___ / \ Case 6 applies here, since REMOVE--> -10B 30B The parent's color does not matter Double Black / \ The sibling's color is False 25R 40R The sibling's right child is True (in the MIRROR CASE - left child should be True) Here we do a left rotation and change the colors such that the sibling gets the parent's color (30 gets 10's color) the parent(now sibling's left) and sibling's right become False ___30B___ / \ 10B 40B / \ NULL 25R -10B would be here but we're removing it """ self.assertEqual(rb_tree.root.red, False) self.assertEqual(rb_tree.root.key, 30) node_10 = rb_tree.root.left self.assertEqual(node_10.key, 10) self.assertEqual(node_10.red, False) self.assertEqual(node_10.parent, rb_tree.root) self.assertEqual(node_10.left, None) node_25 = node_10.right self.assertEqual(node_25.key, 25) self.assertEqual(node_25.red, True) self.assertEqual(node_25.parent, node_10) self.assertEqual(node_25.left, None) self.assertEqual(node_25.right, None) node_40 = rb_tree.root.right self.assertEqual(node_40.key, 40) self.assertEqual(node_40.parent, rb_tree.root) self.assertEqual(node_40.red, False) self.assertEqual(node_40.left, None) self.assertEqual(node_40.right, None) def test_mirror_deletion_black_node_no_successor_case_6(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) node_12 = Node(key=12, red=False, parent=root, left=None, right=None) node_5 = Node(key=5, red=False, parent=root, left=None, right=None) node_1 = Node(key=1, red=True, parent=node_5, left=None, right=None) node_7 = Node(key=7, red=True, parent=node_5, left=None, right=None) node_5.left = node_1 node_5.right = node_7 root.left = node_5 root.right = node_12 rb_tree.root = root del rb_tree[12] """ __10B__ __5B__ / \ / \ 5B 12B <--- REMOVE 1B 10B / \ has no successors / 1R 7R 7R case 6 applies, so we left rotate at 5b """ node_5 = rb_tree.root self.assertEqual(node_5.key, 5) self.assertEqual(node_5.red, False) self.assertEqual(node_5.parent, None) self.assertEqual(node_5.left.key, 1) self.assertEqual(node_5.right.key, 10) node_1 = node_5.left self.assertEqual(node_1.key, 1) self.assertEqual(node_1.parent, node_5) self.assertEqual(node_1.red, False) self.assertEqual(node_1.left, None) self.assertEqual(node_1.right, None) node_10 = node_5.right self.assertEqual(node_10.key, 10) self.assertEqual(node_10.parent, node_5) self.assertEqual(node_10.red, False) self.assertEqual(node_10.left.key, 7) self.assertEqual(node_10.right, None) node_7 = node_10.left self.assertEqual(node_7.key, 7) self.assertEqual(node_7.parent, node_10) self.assertEqual(node_7.red, True) self.assertEqual(node_7.left, None) self.assertEqual(node_7.right, None) def test_deletion_black_node_no_successor_case_3_then_1(self): """ Delete a node such that case 3 is called, which pushes the double black node upwards into a case 1 problem """ rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # left subtree node_m10 = Node(key=-10, red=False, parent=root, left=None, right=None) # right subtree node_30 = Node(key=30, red=False, parent=root, left=None, right=None) root.left = node_m10 root.right = node_30 rb_tree.root = root del rb_tree[-10] """ Double Black ___10B___ __|10B|__ / \ ----> / \ REMOVE--> -10B 30B REMOVED 30R <--- COLOTrue True We color the sibling red and try to resolve the double black problem in the root. We go through the cases 1-6 and find that case 1 is what we're looking for Case 1 simply recolors the root to black and we are done ___10B___ \ 30R """ node_10 = rb_tree.root self.assertEqual(node_10.red, False) self.assertEqual(node_10.parent, None) self.assertEqual(node_10.left, None) self.assertEqual(node_10.right.key, 30) node_30 = node_10.right self.assertEqual(node_30.key, 30) self.assertEqual(node_30.red, True) self.assertEqual(node_30.parent, node_10) self.assertEqual(node_30.left, None) self.assertEqual(node_30.right, None) def test_deletion_black_node_no_successor_case_3_then_5_then_6(self): """ We're going to delete a black node which will cause a case 3 deletion which in turn would pass the double black node up into a case 5, which will restructure the tree in such a way that a case 6 rotation becomes possible """ rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # left subtree node_m30 = Node(key=-30, red=False, parent=root, left=None, right=None) node_m40 = Node(key=-40, red=False, parent=node_m30, left=None, right=None) node_m20 = Node(key=-20, red=False, parent=node_m30, left=None, right=None) node_m30.left = node_m40 node_m30.right = node_m20 # right subtree node_50 = Node(key=50, red=False, parent=root, left=None, right=None) node_30 = Node(key=30, red=True, parent=node_50, left=None, right=None) node_70 = Node(key=70, red=False, parent=node_50, left=None, right=None) node_50.left = node_30 node_50.right = node_70 node_15 = Node(key=15, red=False, parent=node_30, left=None, right=None) node_40 = Node(key=40, red=False, parent=node_30, left=None, right=None) node_30.left = node_15 node_30.right = node_40 root.left = node_m30 root.right = node_50 rb_tree.root = root del rb_tree[-40] """ In mirror cases, this'd be mirrored |node| - double black node ___10B___ ___10B___ / \ DOUBLE / \ -30B 50B False--> |-30B| 50B / \ / \ / \ / \ REMOVE-->|-40B| -20B 30R 70B --CASE 3--> REMOVED -20R 30R 70B / \ / \ 15B 40B 15B 40B --CASE 5--> ___10B___ parent is black still double / \ sibling is black black --> |-30B| 30B sibling.left is red \ / \ sibling.right is black -20R 15B 50R left rotation on sibling.left / \ 40B 70B What we've done here is we've simply restructured the tree to be eligible for a case 6 solution :) ___30B___ --CASE 6--> / \ parent color DOESNT MATTER 10B 50B sibling is black / \ / \ sibling.left DOESNT MATTER -30B 15B 40B 70B sibling.right is True \ left rotation on sibling (30B on the above) -20R where the sibling gets the color of the parent and the parent is now to the left of sibling and repainted False the sibling's right also gets repainted black """ node_30 = rb_tree.root self.assertEqual(node_30.key, 30) self.assertEqual(node_30.parent, None) self.assertEqual(node_30.red, False) self.assertEqual(node_30.left.key, 10) self.assertEqual(node_30.right.key, 50) # test left subtree node_10 = node_30.left self.assertEqual(node_10.key, 10) self.assertEqual(node_10.red, False) self.assertEqual(node_10.parent, node_30) self.assertEqual(node_10.left.key, -30) self.assertEqual(node_10.right.key, 15) node_m30 = node_10.left self.assertEqual(node_m30.key, -30) self.assertEqual(node_m30.red, False) self.assertEqual(node_m30.parent, node_10) self.assertEqual(node_m30.left, None) self.assertEqual(node_m30.right.key, -20) node_15 = node_10.right self.assertEqual(node_15.key, 15) self.assertEqual(node_15.red, False) self.assertEqual(node_15.parent, node_10) self.assertEqual(node_15.left, None) self.assertEqual(node_15.right, None) node_m20 = node_m30.right self.assertEqual(node_m20.key, -20) self.assertEqual(node_m20.red, True) self.assertEqual(node_m20.parent, node_m30) self.assertEqual(node_m20.left, None) self.assertEqual(node_m20.right, None) # test right subtree node_50 = node_30.right self.assertEqual(node_50.key, 50) self.assertEqual(node_50.red, False) self.assertEqual(node_50.parent, node_30) self.assertEqual(node_50.left.key, 40) self.assertEqual(node_50.right.key, 70) node_40 = node_50.left self.assertEqual(node_40.key, 40) self.assertEqual(node_40.parent, node_50) self.assertEqual(node_40.red, False) self.assertEqual(node_40.left, None) self.assertEqual(node_40.right, None) node_70 = node_50.right self.assertEqual(node_70.key, 70) self.assertEqual(node_70.red, False) self.assertEqual(node_70.parent, node_50) self.assertEqual(node_70.left, None) self.assertEqual(node_70.right, None) def test_mirror_deletion_black_node_no_successor_case_3_then_5_then_6(self): """ We're going to delete a black node which will cause a case 3 deletion which in turn would pass the double black node up into a case 5, which will restructure the tree in such a way that a case 6 rotation becomes possible """ rb_tree = Tree() root = Node(key=50, red=False, parent=None, left=None, right=None) # left subtree node_30 = Node(key=30, red=False, parent=root, left=None, right=None) node_20 = Node(key=20, red=False, parent=node_30, left=None, right=None) node_35 = Node(key=35, red=True, parent=node_30, left=None, right=None) node_30.left = node_20 node_30.right = node_35 node_34 = Node(key=34, red=False, parent=node_35, left=None, right=None) node_37 = Node(key=37, red=False, parent=node_35, left=None, right=None) node_35.left = node_34 node_35.right = node_37 # right subtree node_80 = Node(key=80, red=False, parent=root, left=None, right=None) node_70 = Node(key=70, red=False, parent=node_80, left=None, right=None) node_90 = Node(key=90, red=False, parent=node_80, left=None, right=None) node_80.left = node_70 node_80.right = node_90 root.left = node_30 root.right = node_80 rb_tree.root = root del rb_tree[90] """ Parent is black ___50B___ Sibling is black ___50B___ / \ Sibling's children are black / \ 30B 80B CASE 3 30B |80B| / \ / \ ==> / \ / \ 20B 35R 70B 90B <---REMOVE 20B 35R 70R X / \ / \ 34B 37B 34B 37B Case 5 Parent is black __50B__ Sibling is black CASE 5 / \ Closer sibling child is True =====> 35B |80B| (right in this case, / \ / left in mirror) 30R 37B 70R Outer sibling child is blck / \ 20B 34B We have now successfully position our tree for a CASE 6 scenario The parent's color does not matter __35B__ The sibling is black / \ The closer sibling child CASE 6 30R 50R 's color does not matter ====> / \ / \ The outer sibling child 20B 34B 37B 80B (left in this case, / right in mirror) 70R is True! """ expected_keys = [20, 30, 34, 35, 37, 50, 70, 80] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_35 = rb_tree.root self.assertEqual(node_35.key, 35) self.assertEqual(node_35.parent, None) self.assertEqual(node_35.red, False) self.assertEqual(node_35.left.key, 30) self.assertEqual(node_35.right.key, 50) # right subtree node_50 = node_35.right self.assertEqual(node_50.key, 50) self.assertEqual(node_50.red, False) self.assertEqual(node_50.parent, node_35) self.assertEqual(node_50.left.key, 37) self.assertEqual(node_50.right.key, 80) node_37 = node_50.left self.assertEqual(node_37.key, 37) self.assertEqual(node_37.red, False) self.assertEqual(node_37.parent, node_50) self.assertEqual(node_37.left, None) self.assertEqual(node_37.right, None) node_80 = node_50.right self.assertEqual(node_80.key, 80) self.assertEqual(node_80.red, False) self.assertEqual(node_80.parent, node_50) self.assertEqual(node_80.left.key, 70) self.assertEqual(node_80.right, None) node_70 = node_80.left self.assertEqual(node_70.key, 70) self.assertEqual(node_70.red, True) self.assertEqual(node_70.parent, node_80) self.assertEqual(node_70.left, None) self.assertEqual(node_70.right, None) # left subtree node_30 = node_35.left self.assertEqual(node_30.key, 30) self.assertEqual(node_30.parent, node_35) self.assertEqual(node_30.red, False) self.assertEqual(node_30.left.key, 20) self.assertEqual(node_30.right.key, 34) node_20 = node_30.left self.assertEqual(node_20.key, 20) self.assertEqual(node_20.red, False) self.assertEqual(node_20.parent, node_30) self.assertEqual(node_20.left, None) self.assertEqual(node_20.right, None) node_34 = node_30.right self.assertEqual(node_34.key, 34) self.assertEqual(node_34.red, False) self.assertEqual(node_34.parent, node_30) self.assertEqual(node_34.left, None) self.assertEqual(node_34.right, None) def test_deletion_black_node_successor_case_2_then_4(self): rb_tree = Tree() root = Node(key=10, red=False, parent=None, left=None, right=None) # left subtree node_m10 = Node(key=-10, red=False, parent=root, left=None, right=None) node_m20 = Node(key=-20, red=False, parent=node_m10, left=None, right=None) node_m5 = Node(key=-5, red=False, parent=node_m10, left=None, right=None) node_m10.left = node_m20 node_m10.right = node_m5 # right subtree node_40 = Node(key=40, red=False, parent=root, left=None, right=None) node_20 = Node(key=20, red=False, parent=node_40, left=None, right=None) node_60 = Node(key=60, red=True, parent=node_40, left=None, right=None) node_40.left = node_20 node_40.right = node_60 node_50 = Node(key=50, red=False, parent=node_60, left=None, right=None) node_80 = Node(key=80, red=False, parent=node_60, left=None, right=None) node_60.left = node_50 node_60.right = node_80 root.left = node_m10 root.right = node_40 rb_tree.root = root del rb_tree[10] """ REMOVE---> ___10B___ parent is black ___20B___ / \ sibling is red / \ -10B 40B s.children aren't red -10B 60B / \ / \ --CASE 2 ROTATE--> / \ / \ -20B -5B |20B| 60R LEFT ROTATE -20B -5B 40R 80B SUCCESSOR IS 20----^ / \ SIBLING 60 / \ 50B 80B REMOVE--> 20 50B CASE 4 ___20B___ 20'S parent is True / \ sibling is False -10B 60B sibling's children are NOT True / \ / \ so we push parent's -20B -5B 40B 80B redness down to the sibling / \ and remove node REMOVED--> X 50R """ expected_keys = [-20, -10, -5, 20, 40, 50, 60, 80] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_20 = rb_tree.root self.assertEqual(node_20.key, 20) self.assertEqual(node_20.parent, None) self.assertEqual(node_20.red, False) self.assertEqual(node_20.left.key, -10) self.assertEqual(node_20.right.key, 60) # test left subtree node_m10 = node_20.left self.assertEqual(node_m10.key, -10) self.assertEqual(node_m10.red, False) self.assertEqual(node_m10.parent, node_20) self.assertEqual(node_m10.left.key, -20) self.assertEqual(node_m10.right.key, -5) node_m20 = node_m10.left self.assertEqual(node_m20.key, -20) self.assertEqual(node_m20.red, False) self.assertEqual(node_m20.parent, node_m10) self.assertEqual(node_m20.left, None) self.assertEqual(node_m20.right, None) node_m5 = node_m10.right self.assertEqual(node_m5.key, -5) self.assertEqual(node_m5.red, False) self.assertEqual(node_m5.parent, node_m10) self.assertEqual(node_m5.left, None) self.assertEqual(node_m5.right, None) # test right subtree node_60 = node_20.right self.assertEqual(node_60.key, 60) self.assertEqual(node_60.red, False) self.assertEqual(node_60.parent, node_20) self.assertEqual(node_60.left.key, 40) self.assertEqual(node_60.right.key, 80) node_80 = node_60.right self.assertEqual(node_80.key, 80) self.assertEqual(node_80.red, False) self.assertEqual(node_80.parent, node_60) self.assertEqual(node_80.left, None) self.assertEqual(node_80.right, None) node_40 = node_60.left self.assertEqual(node_40.key, 40) self.assertEqual(node_40.red, False) self.assertEqual(node_40.parent, node_60) self.assertEqual(node_40.left, None) self.assertEqual(node_40.right.key, 50) node_50 = node_40.right self.assertEqual(node_50.key, 50) self.assertEqual(node_50.red, True) self.assertEqual(node_50.parent, node_40) self.assertEqual(node_50.left, None) self.assertEqual(node_50.right, None) def test_mirror_deletion_black_node_successor_case_2_then_4(self): rb_tree = Tree() root = Node(key=20, red=False, parent=None, left=None, right=None) # left subtree node_10 = Node(key=10, red=False, parent=root, left=None, right=None) node_8 = Node(key=8, red=True, parent=node_10, left=None, right=None) node_15 = Node(key=15, red=False, parent=node_10, left=None, right=None) node_10.left = node_8 node_10.right = node_15 node_6 = Node(key=6, red=False, parent=node_8, left=None, right=None) node_9 = Node(key=9, red=False, parent=node_8, left=None, right=None) node_8.left = node_6 node_8.right = node_9 # right subtree node_30 = Node(key=30, red=False, parent=root, left=None, right=None) node_25 = Node(key=25, red=False, parent=node_30, left=None, right=None) node_35 = Node(key=35, red=False, parent=node_30, left=None, right=None) node_30.left = node_25 node_30.right = node_35 root.left = node_10 root.right = node_30 rb_tree.root = root del rb_tree[15] """ ___20B___ Parent is black ___20B___ / \ Sibling is red / \ 10B 30B s.children are black 8B 30B / \ / \ ======> / \ / \ 8R 15B 25B 35B Case 2 6B 10R 25B 35B / \ ^----Remove left rotate / \ 6B 9B on 10 9B |15B| Parent is red ___20B___ Sibling is black CASE 4 / \ s.children are black ===> 8B 30B switch the colors of the parent / \ / \ and the sibling 6B 10B 25B 35B / \ 9R X """ node_20 = rb_tree.root self.assertEqual(node_20.key, 20) self.assertEqual(node_20.red, False) self.assertEqual(node_20.parent, None) self.assertEqual(node_20.left.key, 8) self.assertEqual(node_20.right.key, 30) # right subtree node_30 = node_20.right self.assertEqual(node_30.key, 30) self.assertEqual(node_30.red, False) self.assertEqual(node_30.parent, node_20) self.assertEqual(node_30.left.key, 25) self.assertEqual(node_30.right.key, 35) node_25 = node_30.left self.assertEqual(node_25.key, 25) self.assertEqual(node_25.red, False) self.assertEqual(node_25.parent, node_30) self.assertEqual(node_25.left, None) self.assertEqual(node_25.right, None) node_35 = node_30.right self.assertEqual(node_35.key, 35) self.assertEqual(node_35.red, False) self.assertEqual(node_35.parent, node_30) self.assertEqual(node_35.left, None) self.assertEqual(node_35.right, None) # left subtree node_8 = node_20.left self.assertEqual(node_8.key, 8) self.assertEqual(node_8.parent, node_20) self.assertEqual(node_8.red, False) self.assertEqual(node_8.left.key, 6) self.assertEqual(node_8.right.key, 10) node_6 = node_8.left self.assertEqual(node_6.key, 6) self.assertEqual(node_6.red, False) self.assertEqual(node_6.parent, node_8) self.assertEqual(node_6.left, None) self.assertEqual(node_6.right, None) node_10 = node_8.right self.assertEqual(node_10.key, 10) self.assertEqual(node_10.red, False) self.assertEqual(node_10.parent, node_8) self.assertEqual(node_10.left, node_9) self.assertEqual(node_10.right, None) node_9 = node_10.left self.assertEqual(node_9.key, 9) self.assertEqual(node_9.red, True) self.assertEqual(node_9.parent, node_10) self.assertEqual(node_9.left, None) self.assertEqual(node_9.right, None) def test_delete_tree_one_by_one(self): rb_tree = Tree() root = Node(key=20, red=False, parent=None, left=None, right=None) # left subtree node_10 = Node(key=10, red=False, parent=root, left=None, right=None) node_5 = Node(key=5, red=True, parent=node_10, left=None, right=None) node_15 = Node(key=15, red=True, parent=node_10, left=None, right=None) node_10.left = node_5 node_10.right = node_15 # right subtree node_38 = Node(key=38, red=True, parent=root, left=None, right=None) node_28 = Node(key=28, red=False, parent=node_38, left=None, right=None) node_48 = Node(key=48, red=False, parent=node_38, left=None, right=None) node_38.left = node_28 node_38.right = node_48 # node_28 subtree node_23 = Node(key=23, red=True, parent=node_28, left=None, right=None) node_29 = Node(key=29, red=True, parent=node_28, left=None, right=None) node_28.left = node_23 node_28.right = node_29 # node 48 subtree node_41 = Node(key=41, red=True, parent=node_48, left=None, right=None) node_49 = Node(key=49, red=True, parent=node_48, left=None, right=None) node_48.left = node_41 node_48.right = node_49 root.left = node_10 root.right = node_38 """ ______20______ / \ 10B ___38R___ / \ / \ 5R 15R 28B 48B / \ / \ 23R 29R 41R 49R """ rb_tree.root = root del rb_tree[49] del rb_tree[38] del rb_tree[28] del rb_tree[10] del rb_tree[5] del rb_tree[15] del rb_tree[48] """ We're left with __23B__ / \ 20B 41B / 29R """ node_23 = rb_tree.root self.assertEqual(node_23.key, 23) self.assertEqual(node_23.red, False) self.assertEqual(node_23.parent, None) self.assertEqual(node_23.left.key, 20) self.assertEqual(node_23.right.key, 41) node_20 = node_23.left self.assertEqual(node_20.red, False) self.assertEqual(node_20.parent, node_23) self.assertEqual(node_20.left, None) self.assertEqual(node_20.right, None) node_41 = node_23.right self.assertEqual(node_41.red, False) self.assertEqual(node_41.parent, node_23) self.assertEqual(node_41.key, 41) self.assertEqual(node_41.left.key, 29) self.assertEqual(node_41.right, None) node_29 = node_41.left self.assertEqual(node_29.key, 29) self.assertEqual(node_29.red, True) self.assertEqual(node_29.left, None) self.assertEqual(node_29.right, None) del rb_tree[20] """ _29B_ / \ 23B 41B """ node_29 = rb_tree.root self.assertEqual(node_29.key, 29) self.assertEqual(node_29.red, False) self.assertEqual(node_29.parent, None) self.assertEqual(node_29.left.key, 23) self.assertEqual(node_29.right.key, 41) node_23 = node_29.left self.assertEqual(node_23.parent, node_29) self.assertEqual(node_23.red, False) self.assertEqual(node_23.left, None) self.assertEqual(node_23.right, None) node_41 = node_29.right self.assertEqual(node_41.parent, node_29) self.assertEqual(node_41.red, False) self.assertEqual(node_41.left, None) self.assertEqual(node_41.right, None) del rb_tree[29] """ 41B / 23R """ node_41 = rb_tree.root self.assertEqual(node_41.key, 41) self.assertEqual(node_41.red, False) self.assertEqual(node_41.parent, None) self.assertEqual(node_41.right, None) node_23 = node_41.left self.assertEqual(node_23.key, 23) self.assertEqual(node_23.red, True) self.assertEqual(node_23.parent, node_41) self.assertEqual(node_23.left, None) self.assertEqual(node_23.right, None) del rb_tree[41] """ 23B """ node_23 = rb_tree.root self.assertEqual(node_23.key, 23) self.assertEqual(node_23.red, False) self.assertEqual(node_23.parent, None) self.assertEqual(node_23.left, None) self.assertEqual(node_23.right, None) del rb_tree[23] self.assertEqual(rb_tree.root, None) # ***************TEST DELETIONS*************** def test_add_delete_random_order(self): """ What I add here I'll also add at a site for red black tree visualization https://www.cs.usfca.edu/~galles/visualization/RedBlack.html and then see if they're the same """ rb_tree = Tree() rb_tree.insert(90) rb_tree.insert(70) rb_tree.insert(43) del rb_tree[70] rb_tree.insert(24) rb_tree.insert(14) rb_tree.insert(93) rb_tree.insert(47) del rb_tree[47] del rb_tree[90] rb_tree.insert(57) rb_tree.insert(1) rb_tree.insert(60) rb_tree.insert(47) del rb_tree[47] del rb_tree[1] del rb_tree[43] rb_tree.insert(49) """ well, the results aren't the same, but I'll assume that the algorithms are different Nevertheless, what we're left with is a perfectly valid RedBlack Tree, and, I'd argue, even betterly balanced than the one from the visualization VISUALIZATION TREE ____24B____ / \ 14B 60R / \ 57B 93B / 49R OUR TREE ______57B______ / \ __24B__ __60B__ / \ \ 14R 49R 93R """ expected_keys = [14, 24, 49, 57, 60, 93] keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) node_57 = rb_tree.root self.assertEqual(node_57.key, 57) self.assertEqual(node_57.parent, None) self.assertEqual(node_57.red, False) self.assertEqual(node_57.left.key, 24) self.assertEqual(node_57.right.key, 60) # right subtree node_60 = node_57.right self.assertEqual(node_60.key, 60) self.assertEqual(node_60.red, False) self.assertEqual(node_60.parent, node_57) self.assertEqual(node_60.right.key, 93) self.assertEqual(node_60.left, None) node_93 = node_60.right self.assertEqual(node_93.key, 93) self.assertEqual(node_93.red, True) self.assertEqual(node_93.parent, node_60) self.assertEqual(node_93.left, None) self.assertEqual(node_93.right, None) # left subtree node_24 = node_57.left self.assertEqual(node_24.key, 24) self.assertEqual(node_24.parent, node_57) self.assertEqual(node_24.red, False) self.assertEqual(node_24.left.key, 14) self.assertEqual(node_24.right.key, 49) node_14 = node_24.left self.assertEqual(node_14.key, 14) self.assertEqual(node_14.parent, node_24) self.assertEqual(node_14.red, True) self.assertEqual(node_14.left, None) self.assertEqual(node_14.right, None) node_49 = node_24.right self.assertEqual(node_49.key, 49) self.assertEqual(node_49.parent, node_24) self.assertEqual(node_49.red, True) self.assertEqual(node_49.left, None) self.assertEqual(node_49.right, None) def test_add_0_to_100_delete_100_to_0(self): rb_tree = Tree() for i in range(100): rb_tree.insert(i) self.assertEqual(rb_tree._len, i+1) expected_keys = list(range(100)) keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) for i in range(99, -1, -1): self.assertTrue(rb_tree.__contains__(i)) del rb_tree[i] self.assertFalse(rb_tree.__contains__(i)) self.assertEqual(rb_tree._len, i) self.assertIsNone(rb_tree.root) def test_add_delete_0_to_100_delete_0_to_100(self): rb_tree = Tree() for i in range(100): rb_tree.insert(i) self.assertEqual(rb_tree._len, i+1) expected_keys = list(range(100)) keys = list(rb_tree.keys()) self.assertEqual(keys, expected_keys) for i in range(100): self.assertTrue(rb_tree.__contains__(i)) del rb_tree[i] self.assertFalse(rb_tree.__contains__(i)) self.assertEqual(rb_tree._len, 99-i) self.assertIsNone(rb_tree.root) # ***************TEST DELETIONS*************** # ***************MISC TESTS*************** def test_ceil(self): # add all the numbers 0-99 step 2 # i.e 0, 2, 4 rb_tree = Tree() for i in range(0, 100, 2): rb_tree.insert(i) # then search for the ceilings, knowing theyre 1 up for i in range(1, 99, 2): self.assertEqual(rb_tree.floor_and_ceil(i)[1].key, i+1) def test_ceil_same_key(self): rb_tree = Tree() rb_tree.insert(10) rb_tree.insert(15) rb_tree.insert(20) rb_tree.insert(17) for i in range(11): self.assertEqual(rb_tree.floor_and_ceil(i)[1].key, 10) for i in range(11, 16): self.assertEqual(rb_tree.floor_and_ceil(i)[1].key, 15) for i in range(16, 18): self.assertEqual(rb_tree.floor_and_ceil(i)[1].key, 17) for i in range(18, 21): self.assertEqual(rb_tree.floor_and_ceil(i)[1].key, 20) def test_floor(self): # add all the numbers 0-99 step 2 # i.e 0, 2, 4 rb_tree = Tree() for i in range(0, 100, 2): rb_tree.insert(i) # then search for the ceilings, knowing theyre 1 up for i in range(1, 99, 2): self.assertEqual(rb_tree.floor_and_ceil(i)[0].key, i - 1) def test_floor_same_key(self): rb_tree = Tree() rb_tree.insert(10) rb_tree.insert(15) rb_tree.insert(20) rb_tree.insert(17) for i in range(11, 15): self.assertEqual(rb_tree.floor_and_ceil(i)[0].key, 10) for i in range(15, 17): self.assertEqual(rb_tree.floor_and_ceil(i)[0].key, 15) for i in range(17, 20): self.assertEqual(rb_tree.floor_and_ceil(i)[0].key, 17) for i in range(20, 50): self.assertEqual(rb_tree.floor_and_ceil(i)[0].key, 20) # These tests take the bulk of the time for testing. class RbTreePerformanceTests(unittest.TestCase): def test_addition_performance(self): """ Add 25,000 elements to the tree """ possible_keys = list(range(-100000, 100000)) elements = [random.choice(possible_keys) for _ in range(25000)] start_time = datetime.now() tree = Tree() for el in elements: tree.insert(el) time_taken = datetime.now()-start_time self.assertTrue(time_taken.seconds < 1) def test_deletion_performance(self): """ Delete 25,000 elements from the tree """ possible_keys = list(range(-100000, 100000)) elements = set([random.choice(possible_keys) for _ in range(25000)]) # fill up the tree tree = Tree() for el in elements: _, success = tree.insert(el) self.assertTrue(success) start_time = datetime.now() for el in elements: del tree[el] time_taken = datetime.now()-start_time self.assertTrue(time_taken.seconds < 1) def test_deletion_and_addition_performance(self): possible_keys = list(range(-500000, 500000)) elements = list(set([random.choice(possible_keys) for _ in range(25000)])) first_part = elements[:len(elements)//2] second_part = elements[len(elements)//2:] deletion_part = first_part[len(first_part)//3:(len(first_part)//3)*2] tree = Tree() start_time = datetime.now() # fill up the tree 1/2 for el in first_part: tree.insert(el) # delete 1/2 of the tree for del_el in deletion_part: del tree[del_el] for el in second_part: tree.insert(el) time_taken = datetime.now()-start_time self.assertTrue(time_taken.seconds < 1) if __name__ == '__main__': unittest.main()
bc0db3f3305c70eb8d1207273623828ce178dcb1
f1ed211cb86cd738a3c474aeb7050ffe906e80c6
/mypet/sloth/migrations/0005_auto_20210309_2309.py
ec7e44e032a4bd530336e3925aeb798b1cef9eb5
[]
no_license
IlyaES1989/pet
11f506b5f42fded88697af52cf026c67803e3b23
06ab31166dc5744b65f3f809295cb3927fd6d33d
refs/heads/main
2023-03-31T16:21:16.522713
2021-04-06T08:56:43
2021-04-06T08:56:43
345,998,663
0
0
null
null
null
null
UTF-8
Python
false
false
748
py
# Generated by Django 3.1.7 on 2021-03-09 18:09 from django.conf import settings from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ migrations.swappable_dependency(settings.AUTH_USER_MODEL), ('sloth', '0004_auto_20210309_2307'), ] operations = [ migrations.AlterField( model_name='variable', name='user', field=models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL), ), migrations.AlterField( model_name='variable', name='year', field=models.PositiveSmallIntegerField(default=2021), ), ]
31ab8ab68ccfc00be7fb36656ec7dbaeaba96bf4
bd28c8ae8969bf5034261f64ef6960ee71fa0e1b
/migrations/versions/75384324dc7d_users_table.py
09b83cadd25b30366ae76dc1d72b190ac19e9526
[]
no_license
MBuchenkova/microblog
c05e2d301d65deec802521fd66145d5e01042fef
17ee3e30de47a8f37470a1588d5d0d8c420058d8
refs/heads/master
2020-04-13T14:34:08.519270
2018-12-27T13:35:05
2018-12-27T13:35:05
163,266,193
0
0
null
null
null
null
UTF-8
Python
false
false
1,131
py
"""users table Revision ID: 75384324dc7d Revises: Create Date: 2018-12-27 14:52:19.515431 """ from alembic import op import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '75384324dc7d' down_revision = None branch_labels = None depends_on = None def upgrade(): # ### commands auto generated by Alembic - please adjust! ### op.create_table('user', sa.Column('id', sa.Integer(), nullable=False), sa.Column('username', sa.String(length=64), nullable=True), sa.Column('email', sa.String(length=120), nullable=True), sa.Column('password_hash', sa.String(length=128), nullable=True), sa.PrimaryKeyConstraint('id') ) op.create_index(op.f('ix_user_email'), 'user', ['email'], unique=True) op.create_index(op.f('ix_user_username'), 'user', ['username'], unique=True) # ### end Alembic commands ### def downgrade(): # ### commands auto generated by Alembic - please adjust! ### op.drop_index(op.f('ix_user_username'), table_name='user') op.drop_index(op.f('ix_user_email'), table_name='user') op.drop_table('user') # ### end Alembic commands ###
c07f2b8291f962871ca64b9068477b747d33f4e6
05cda8a550466295bbd53756ec3b65478e2c8445
/webgrid_blazeweb_ta/extensions.py
0f3b10f2cb49a81234625c5dceacfe08be837c7a
[ "BSD-3-Clause" ]
permissive
level12/webgrid
7241a2ef2c118e6c35846a51f7a7276b1c51c5ae
d0353e584925b80c7e07736f8a024f0eeef60dc5
refs/heads/master
2023-05-27T02:16:18.065358
2023-05-15T15:36:09
2023-05-15T15:36:35
53,168,296
13
8
NOASSERTION
2023-05-12T12:28:09
2016-03-04T22:01:32
Python
UTF-8
Python
false
false
989
py
MORPHI_PACKAGE_NAME = 'webgrid_blazeweb_ta' # begin morphi boilerplate try: import morphi except ImportError: morphi = None if morphi: from morphi.messages import Manager from morphi.registry import default_registry translation_manager = Manager(package_name=MORPHI_PACKAGE_NAME) default_registry.subscribe(translation_manager) gettext = translation_manager.gettext lazy_gettext = translation_manager.lazy_gettext lazy_ngettext = translation_manager.lazy_ngettext ngettext = translation_manager.ngettext else: translation_manager = None def gettext(message, **variables): if variables: return message.format(**variables) return message def ngettext(singular, plural, num, **variables): variables.setdefault('num', num) if num == 1: return gettext(singular, **variables) return gettext(plural, **variables) lazy_gettext = gettext lazy_ngettext = ngettext
d54f74cc74fedc146f8142760af211ca88a0137d
a47d0a31ca490ab1455d6baef96a0a728fff2c0a
/venv/bin/easy_install
802b6a28a54df33fd37a7e0182e3920abf67c68d
[]
no_license
xiaohe55/minipg-UI-test
2f81e25601b3ae826b90a241c8619fa811a55a94
b27fdb299d26d99cd18c2bd9c4d117e8e961a961
refs/heads/master
2020-03-09T04:24:28.188847
2018-04-08T02:16:59
2018-04-08T02:16:59
128,586,889
0
0
null
null
null
null
UTF-8
Python
false
false
289
#!/Users/xuanyuanshufen/PycharmProjects/minipg-UI-test/venv/bin/python3.6 # -*- coding: utf-8 -*- import re import sys from setuptools.command.easy_install import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(main())
37d1cf04c9fcf06da68b721d7307435eb846ab67
d0df13a91c815ab73b3648ad1685c5d853ddb95f
/download/views.py
90144d80f39eda3de6c94c2a02406a5a6193a0aa
[]
no_license
magiczzz07/appstore-2
cf0e054df710b989bf66f4399a9b0660537934a3
e6fccbcb5afb5e79e9491b96fbcdd3a11d35d35f
refs/heads/master
2020-12-14T02:37:25.974499
2019-11-19T21:51:29
2019-11-19T21:51:29
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,522
py
import datetime from django.shortcuts import get_object_or_404 from django.contrib.gis.geoip import GeoIP from django.http import HttpResponseRedirect from util.view_util import html_response, json_response, ipaddr_str_to_long, ipaddr_long_to_str from apps.models import App, Release from download.models import ReleaseDownloadsByDate, AppDownloadsByGeoLoc, Download, GeoLoc # =================================== # Download release # =================================== geoIP = GeoIP() def _client_ipaddr(request): forwarded_for = request.META.get('HTTP_X_FORWARDED_FOR') if forwarded_for: ipaddr_str = forwarded_for.split(',')[0] else: ipaddr_str = request.META.get('REMOTE_ADDR') return ipaddr_str_to_long(ipaddr_str) def _increment_count(klass, **args): obj, created = klass.objects.get_or_create(**args) obj.count += 1 obj.save() def release_download(request, app_name, version): release = get_object_or_404(Release, app__name = app_name, version = version, active = True) ip4addr = _client_ipaddr(request) when = datetime.date.today() # Update the App object release.app.downloads += 1 release.app.save() # Record the download as a Download object Download.objects.create(release = release, ip4addr = ip4addr, when = when) # Record the download in the timeline _increment_count(ReleaseDownloadsByDate, release = release, when = when) _increment_count(ReleaseDownloadsByDate, release = None, when = when) # Look up geographical information about the user's IP address #geoinfo = geoIP.city(ipaddr_long_to_str(ip4addr)) #if geoinfo: # Record the download in the user's country # country_geoloc, _ = GeoLoc.objects.get_or_create(country = geoinfo['country_code'], region = '', city = '') #_increment_count(AppDownloadsByGeoLoc, app = release.app, geoloc = country_geoloc) ## _increment_count(AppDownloadsByGeoLoc, app = None, geoloc = country_geoloc) #if geoinfo.get('city'): # Record the download in the user's city # city_geoloc, _ = GeoLoc.objects.get_or_create(country = geoinfo['country_code'], region = geoinfo['region'], city = geoinfo['city']) # _increment_count(AppDownloadsByGeoLoc, app = release.app, geoloc = city_geoloc) # _increment_count(AppDownloadsByGeoLoc, app = None, geoloc = city_geoloc) return HttpResponseRedirect(release.release_file_url) # =================================== # Download statistics # =================================== def all_stats(request): return html_response('all_stats.html', {}, request) def _all_geography_downloads(app): dls = AppDownloadsByGeoLoc.objects.filter(app = app) response = [[dl.geoloc.country, dl.geoloc.region, dl.geoloc.city, dl.count] for dl in dls] response.insert(0, ['Country', 'Region', 'City', 'Downloads']) return json_response(response) def _world_downloads(app): countries = AppDownloadsByGeoLoc.objects.filter(app = app, geoloc__region = '', geoloc__city = '') response = [[country.geoloc.country, country.count] for country in countries] response.insert(0, ['Country', 'Downloads']) return json_response(response) def _country_downloads(app, country_code): cities = AppDownloadsByGeoLoc.objects.filter(app = app, geoloc__country = country_code, geoloc__city__gt = '') response = [[city.geoloc.city, city.count] for city in cities] response.insert(0, ['City', 'Downloads']) return json_response(response) def all_stats_geography_all(request): return _all_geography_downloads(None) def all_stats_geography_world(request): return _world_downloads(None) def all_stats_geography_country(request, country_code): return _country_downloads(None, country_code) def all_stats_timeline(request): dls = ReleaseDownloadsByDate.objects.filter(release = None) response = {'Total': [[dl.when.isoformat(), dl.count] for dl in dls]} return json_response(response) def app_stats(request, app_name): app = get_object_or_404(App, active = True, name = app_name) app_downloads_by_country = AppDownloadsByGeoLoc.objects.filter(app = app, geoloc__region = '', geoloc__city = '') releases = app.release_set.all() release_downloads_by_date = [dl for release in releases for dl in ReleaseDownloadsByDate.objects.filter(release = release)] c = { 'app': app, 'app_downloads_by_country': app_downloads_by_country, 'release_downloads_by_date': release_downloads_by_date, } return html_response('app_stats.html', c, request) def app_stats_timeline(request, app_name): app = get_object_or_404(App, active = True, name = app_name) releases = app.release_set.all() response = dict() for release in releases: dls = ReleaseDownloadsByDate.objects.filter(release = release) response[release.version] = [[dl.when.isoformat(), dl.count] for dl in dls] return json_response(response) def app_stats_geography_all(request, app_name): app = get_object_or_404(App, active = True, name = app_name) return _all_geography_downloads(app) def app_stats_geography_world(request, app_name): app = get_object_or_404(App, active = True, name = app_name) return _world_downloads(app) def app_stats_country(request, app_name, country_code): app = get_object_or_404(App, active = True, name = app_name) return _country_downloads(app, country_code)
62c75f4ba000df4a059b3f0cd3c9e918a450e95a
61baf3b5ea44c16af971d70c54e87baf0f9feb22
/mydemo/tutorials-master/tensorflowTUT/tf18_CNN3/read.py
c8e7c9a50d9f3dd4c13fd9b204864134c0ae7e88
[ "MIT" ]
permissive
davidworkgit/python
b333d619ef6bce13aab32587acccf29f8dc09486
f5b95f7ed65b947842d056b435d3603ea3177f5e
refs/heads/master
2021-05-18T12:08:07.045654
2020-04-06T12:06:36
2020-04-06T12:06:36
251,237,992
0
0
null
null
null
null
UTF-8
Python
false
false
4,031
py
import numpy as np import tensorflow as tf from PIL import Image def getTestPicArray(filename): im = Image.open(filename) x_s = 28 y_s = 28 out = im.resize((x_s, y_s), Image.ANTIALIAS) im_arr = np.array(out.convert('L')) num0 = 0 num255 = 0 threshold = 100 for x in range(x_s): for y in range(y_s): if im_arr[x][y] > threshold: num255 = num255 + 1 else: num0 = num0 + 1 if (num255 > num0): print("convert!") for x in range(x_s): for y in range(y_s): im_arr[x][y] = 255 - im_arr[x][y] if (im_arr[x][y] < threshold): im_arr[x][y] = 0 # if(im_arr[x][y] > threshold) : im_arr[x][y] = 0 # else : im_arr[x][y] = 255 # if(im_arr[x][y] < threshold): im_arr[x][y] = im_arr[x][y] - im_arr[x][y] / 2 out = Image.fromarray(np.uint8(im_arr)) # out.save(filename.split('/')[0] + '/28pix/' + filename.split('/')[1]) # print im_arr nm = im_arr.reshape((1, 784)) nm = nm.astype(np.float32) nm = np.multiply(nm, 1.0 / 255.0) return nm # im = Image.open('./images/test.png') # data = list(im.getdata()) # result = [(255 - x) * 1.0 / 255.0 for x in data] # 读取图片转成灰度格式 # img = Image.open('./images/test.png').convert('L') # # # resize的过程 # img = img.resize((28, 28)) # # # 暂存像素值的一维数组 # result = [] # for i in range(28): # for j in range(28): # # mnist 里的颜色是0代表白色(背景),1.0代表黑色 # pixel = 1.0 - float(img.getpixel((j, i))) / 255.0 # # pixel = 255.0 - float(img.getpixel((j, i))) # 如果是0-255的颜色值 # result.append(pixel) # # result = np.array(result).reshape(28, 28) # print(result) data = getTestPicArray('./images/5.png') result = np.reshape(data,(1,784)) # 为输入图像和目标输出类别创建节点 x = tf.placeholder("float", shape=[None, 784]) # 训练所需数据 占位符 # *************** 构建多层卷积网络 *************** # def weight_variable(shape): initial = tf.truncated_normal(shape, stddev=0.1) # 取随机值,符合均值为0,标准差stddev为0.1 return tf.Variable(initial) def bias_variable(shape): initial = tf.constant(0.1, shape=shape) return tf.Variable(initial) def conv2d(x, W): return tf.nn.conv2d(x, W, strides=[1, 1, 1, 1], padding='SAME') def max_pool_2x2(x): return tf.nn.max_pool(x, ksize=[1, 2, 2, 1], strides=[1, 2, 2, 1], padding='SAME') x_image = tf.reshape(x, [-1, 28, 28, 1]) # -1表示任意数量的样本数,大小为28x28,深度为1的张量 W_conv1 = weight_variable([5, 5, 1, 32]) # 卷积在每个5x5的patch中算出32个特征。 b_conv1 = bias_variable([32]) h_conv1 = tf.nn.relu(conv2d(x_image, W_conv1) + b_conv1) h_pool1 = max_pool_2x2(h_conv1) W_conv2 = weight_variable([5, 5, 32, 64]) b_conv2 = bias_variable([64]) h_conv2 = tf.nn.relu(conv2d(h_pool1, W_conv2) + b_conv2) h_pool2 = max_pool_2x2(h_conv2) W_fc1 = weight_variable([7 * 7 * 64, 1024]) b_fc1 = bias_variable([1024]) h_pool2_flat = tf.reshape(h_pool2, [-1, 7 * 7 * 64]) h_fc1 = tf.nn.relu(tf.matmul(h_pool2_flat, W_fc1) + b_fc1) # 在输出层之前加入dropout以减少过拟合 keep_prob = tf.placeholder("float") h_fc1_drop = tf.nn.dropout(h_fc1, keep_prob) # 全连接层 W_fc2 = weight_variable([1024, 10]) b_fc2 = bias_variable([10]) # 输出层 # tf.nn.softmax()将神经网络的输层变成一个概率分布 y_conv = tf.nn.softmax(tf.matmul(h_fc1_drop, W_fc2) + b_fc2) saver = tf.train.Saver() # 定义saver # *************** 开始识别 *************** # with tf.Session() as sess: sess.run(tf.global_variables_initializer()) saver.restore(sess, "save/model.ckpt") # 这里使用了之前保存的模型参数 prediction = tf.argmax(y_conv, 1) predint = prediction.eval(feed_dict={x: result, keep_prob: 1.0}, session=sess) print("recognize result: %d" % predint[0])
[ "newhwdy@gmail" ]
newhwdy@gmail
28cfe5ab9167f10afb606a1c6f4ca906660e926c
cf652a64cb53c921befa139f53ef8276ae197794
/mini_fb/urls.py
9044d801f47c378a4bac00089d7f4a5e14be448b
[]
no_license
hqiu2626/cs108-examples
2e81515660739ddc7891dc79a932bf983f723a47
1af4b9e792f97198f616327365f791a84f43db45
refs/heads/main
2023-05-01T04:03:58.355962
2021-04-29T04:43:36
2021-04-29T04:43:36
346,933,664
0
0
null
null
null
null
UTF-8
Python
false
false
1,141
py
# mini_fb/urls.py from django.urls import path from .views import * # our view class definition urlpatterns = [ path('', ShowAllProfilesView.as_view(), name="show_all_profiles"), # path for default url for profile path('profile/<int:pk>', ShowProfilePageView.as_view(), name="show_profile_page"), # path for url for profile pk path('create_profile', CreateProfileView.as_view(), name="create_profile"), # path for creating a new profile path('profile/<int:pk>/update', UpdateProfileView.as_view(), name="update_profile"), # path for updating a profile path('profile/<int:pk>/post_status', post_status_message, name="post_status_message"), # path for posting status path('profile/<int:profile_pk>/delete_status/<int:status_pk>', DeleteStatusMessageView.as_view(), name="delete_status"), # path for deleting status path('profile/<int:pk>/news_feed', ShowNewsFeedView.as_view(), name="news_feed"), path('profile/<int:pk>/show_possible_friends', ShowPossibleFriendsView.as_view(), name="show_possible_friends"), path('profile/<int:profile_pk>/add_friend/<int:friend_pk>', add_friend, name="add_friend"), ]
03cb1330e2a328743fdc087ff860f810966cf81d
6ca3270f8f116708d6d96727d7f64766ef0bf276
/src/server/housepricehistory/housepricehistory/wsgi.py
ce03da85baa014b331ace15fc56eeeef76770920
[]
no_license
bendholmes/SoldHousePrices-Django-Postgres-D3-Jinja2
8a81c20a87b6df194d5428b0564d69eb73cac827
4eef7cbdced1c8287c99667d0297f6e771a5534b
refs/heads/master
2020-12-23T08:09:02.527680
2015-04-19T16:14:15
2015-04-19T16:14:15
60,120,539
0
1
null
null
null
null
UTF-8
Python
false
false
475
py
""" WSGI config for housepricehistory project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/1.6/howto/deployment/wsgi/ """ # # Copyright 2015 Benjamin David Holmes, All rights reserved. # import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "housepricehistory.settings") from django.core.wsgi import get_wsgi_application application = get_wsgi_application()
85990e005b4b4fecaf30d8f5e8d53cc1da84d93c
f0ad55b569008465f89d1990ca2464497008dc5b
/src/flash/esp8266_i2c_lcd.py
046babcf5e9090073e0169ecb5cae3386654456f
[ "MIT" ]
permissive
gr4viton/esp_fun
18b926a3584275f94bca1397d8b96111d49eaa66
28f74ce50c16555705ecee97336ae28c7fd86704
refs/heads/master
2021-01-14T04:32:02.541393
2020-02-23T22:32:22
2020-02-23T22:32:22
242,601,166
2
0
null
null
null
null
UTF-8
Python
false
false
3,289
py
"""Implements a HD44780 character LCD connected via PCF8574 on I2C. This was tested with: https://www.wemos.cc/product/d1-mini.html""" from time import sleep_ms # from machine import I2C from .lcd_api import LcdApi # The PCF8574 has a jumper selectable address: 0x20 - 0x27 DEFAULT_I2C_ADDR = 0x27 # Defines shifts or masks for the various LCD line attached to the PCF8574 MASK_RS = 0x01 MASK_RW = 0x02 MASK_E = 0x04 SHIFT_BACKLIGHT = 3 SHIFT_DATA = 4 class I2cLcd(LcdApi): """Implements a HD44780 character LCD connected via PCF8574 on I2C.""" def __init__(self, i2c, i2c_addr, num_lines, num_columns): self.i2c = i2c self.i2c_addr = i2c_addr self.i2c.writeto(self.i2c_addr, bytearray([0])) sleep_ms(20) # Allow LCD time to powerup # Send reset 3 times self.hal_write_init_nibble(self.LCD_FUNCTION_RESET) sleep_ms(5) # need to delay at least 4.1 msec self.hal_write_init_nibble(self.LCD_FUNCTION_RESET) sleep_ms(1) self.hal_write_init_nibble(self.LCD_FUNCTION_RESET) sleep_ms(1) # Put LCD into 4 bit mode self.hal_write_init_nibble(self.LCD_FUNCTION) sleep_ms(1) LcdApi.__init__(self, num_lines, num_columns) cmd = self.LCD_FUNCTION if num_lines > 1: cmd |= self.LCD_FUNCTION_2LINES self.hal_write_command(cmd) def hal_write_init_nibble(self, nibble): """Writes an initialization nibble to the LCD. This particular function is only used during initialization. """ byte = ((nibble >> 4) & 0x0F) << SHIFT_DATA self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E])) self.i2c.writeto(self.i2c_addr, bytearray([byte])) def hal_backlight_on(self): """Allows the hal layer to turn the backlight on.""" self.i2c.writeto(self.i2c_addr, bytearray([1 << SHIFT_BACKLIGHT])) def hal_backlight_off(self): """Allows the hal layer to turn the backlight off.""" self.i2c.writeto(self.i2c_addr, bytearray([0])) def hal_write_command(self, cmd): """Writes a command to the LCD. Data is latched on the falling edge of E. """ byte = (self.backlight << SHIFT_BACKLIGHT) | (((cmd >> 4) & 0x0F) << SHIFT_DATA) self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E])) self.i2c.writeto(self.i2c_addr, bytearray([byte])) byte = (self.backlight << SHIFT_BACKLIGHT) | ((cmd & 0x0F) << SHIFT_DATA) self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E])) self.i2c.writeto(self.i2c_addr, bytearray([byte])) if cmd <= 3: # The home and clear commands require a worst case delay of 4.1 msec sleep_ms(5) def hal_write_data(self, data): """Write data to the LCD.""" byte = MASK_RS | (self.backlight << SHIFT_BACKLIGHT) | (((data >> 4) & 0x0F) << SHIFT_DATA) self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E])) self.i2c.writeto(self.i2c_addr, bytearray([byte])) byte = MASK_RS | (self.backlight << SHIFT_BACKLIGHT) | ((data & 0x0F) << SHIFT_DATA) self.i2c.writeto(self.i2c_addr, bytearray([byte | MASK_E])) self.i2c.writeto(self.i2c_addr, bytearray([byte]))
10e3aaffe8146d35b918e3207254fa0f21c92912
80301f1cffc5afce13256e2ecab6323c5df00194
/en.3rd/py/U7003_5.py
fffd6e2a94a4a0004232ce03d4503c83622406f9
[]
no_license
ZhenjianYang/SoraVoiceScripts
c1ddf7c1bbcb933243754f9669bd6b75777c87b9
94a948090aba0f63b10b2c69dc845dc99c822fc4
refs/heads/master
2023-04-18T04:54:44.306652
2023-04-06T11:15:17
2023-04-06T11:15:17
103,167,541
43
11
null
2021-03-06T08:52:54
2017-09-11T17:36:55
Python
UTF-8
Python
false
false
237,917
py
from ED63RDScenarioHelper import * def main(): SetCodePage("ms932") CreateScenaFile( FileName = 'U7003_5 ._SN', MapName = 'Gaiden2', Location = 'U7003.x', MapIndex = 1, MapDefaultBGM = "ed60000", Flags = 0, EntryFunctionIndex = 0xFFFF, Reserved = 0, IncludedScenario = [ '', '', '', '', '', '', '', '' ], ) BuildStringList( '@FileName', # 8 ) DeclEntryPoint( Unknown_00 = 0, Unknown_04 = 0, Unknown_08 = 0, Unknown_0C = 4, Unknown_0E = 5, Unknown_10 = 0, Unknown_14 = 9500, Unknown_18 = -10000, Unknown_1C = 0, Unknown_20 = 0, Unknown_24 = 2500, Unknown_28 = 2800, Unknown_2C = 262, Unknown_30 = 45, Unknown_32 = 0, Unknown_34 = 360, Unknown_36 = 0, Unknown_38 = 1, Unknown_3A = 1, InitScenaIndex = 0, InitFunctionIndex = 0, EntryScenaIndex = 0, EntryFunctionIndex = 1, ) ScpFunction( "Function_0_AA", # 00, 0 "Function_1_AB", # 01, 1 "Function_2_AC", # 02, 2 "Function_3_12EE", # 03, 3 "Function_4_1983", # 04, 4 "Function_5_2D90", # 05, 5 "Function_6_46BD", # 06, 6 "Function_7_6654", # 07, 7 "Function_8_735E", # 08, 8 "Function_9_955E", # 09, 9 "Function_10_ABCF", # 0A, 10 "Function_11_AF11", # 0B, 11 "Function_12_CB19", # 0C, 12 ) def Function_0_AA(): pass label("Function_0_AA") Return() # Function_0_AA end def Function_1_AB(): pass label("Function_1_AB") Return() # Function_1_AB end def Function_2_AC(): pass label("Function_2_AC") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x584, 0)), scpexpr(EXPR_END)), "loc_5A1") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 5)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_495") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x8)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_32A") ChrTalk( #0 0x11, ( "#1936F...\x02\x03", "Five years ago, Kevin and Rufina did all they could\x01", "to help me and save me from danger.\x02\x03", "#1938FThey might have regretted the outcome, but that\x01", "doesn't change their intentions--or how important\x01", "they both are to me.\x02", ) ) CloseMessageWindow() TurnDirection(0xFE, 0x109, 400) Sleep(300) ChrTalk( #1 0x11, ( "#1932FThat's why we need to defeat the Lord of\x01", "Phantasma. Together.\x02\x03", "For Rufina as well as anyone else.\x02", ) ) CloseMessageWindow() ChrTalk( #2 0x109, ( "#1075FYeah. You're right.\x02\x03", "...\x02\x03", "#1079FWhat're you doing here, by the way?\x02", ) ) CloseMessageWindow() OP_62(0xFE, 0x0, 2000, 0x28, 0x2B, 0x64, 0x3) Sleep(300) ChrTalk( #3 0x11, ( "#1940FE-Ensuring the army has enough in the\x01", "way of rations is key to any operation.\x01", "That's what I'm doing.\x02\x03", "...Laugh, and I will whack you.\x02", ) ) CloseMessageWindow() Jump("loc_48F") label("loc_32A") ChrTalk( #4 0x11, ( "#1936F...\x02\x03", "Five years ago, Kevin and Rufina did all they could\x01", "to help me and save me from danger.\x02\x03", "#1938FThey might have regretted the outcome, but that\x01", "doesn't change their intentions--or how important\x01", "they both are to me.\x02", ) ) CloseMessageWindow() TurnDirection(0xFE, 0x0, 400) Sleep(300) ChrTalk( #5 0x11, ( "#1932FThat's why we need to defeat the Lord of\x01", "Phantasma. Together.\x02\x03", "#1932FFor Rufina as well as anyone else.\x02", ) ) CloseMessageWindow() label("loc_48F") OP_A2(0x2665) Jump("loc_596") label("loc_495") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x8)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_51E") TurnDirection(0xFE, 0x109, 0) ChrTalk( #6 0x11, ( "#1936FWe need to defeat the Lord of Phantasma\x01", "with our own hands.\x02\x03", "#1932FFor Rufina as well as anyone else.\x02", ) ) CloseMessageWindow() Jump("loc_596") label("loc_51E") TurnDirection(0xFE, 0x0, 0) ChrTalk( #7 0x11, ( "#1936FWe need to defeat the Lord of Phantasma\x01", "with our own hands.\x02\x03", "#1932FFor Rufina as well as anyone else.\x02", ) ) CloseMessageWindow() label("loc_596") ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_12ED") label("loc_5A1") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x580, 0)), scpexpr(EXPR_END)), "loc_837") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) OP_51(0x109, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x109, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_640") Jump("loc_682") label("loc_640") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_65C") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_682") label("loc_65C") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_678") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_682") label("loc_678") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_682") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x109, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x109, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_786") ChrTalk( #8 0x11, ( "#1446FKevin, you know as well as I do that you'll need\x01", "me with you to go inside Aster House.\x02\x03", "#1801FYou're not kicking me off the team on purpose,\x01", "are you?\x02", ) ) CloseMessageWindow() ChrTalk( #9 0x109, "#1077FD-Don't be silly!\x02", ) CloseMessageWindow() ChrTalk( #10 0x11, "#1801F*stare*\x02", ) CloseMessageWindow() OP_A2(0xB) Jump("loc_827") label("loc_786") ChrTalk( #11 0x11, ( "#1446FKevin, you know as well as I do that you'll need\x01", "me with you to go inside Aster House.\x02\x03", "#1801FYou're not kicking me off the team on purpose,\x01", "are you?\x02", ) ) CloseMessageWindow() label("loc_827") SetChrSubChip(0xFE, 0) ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_12ED") label("loc_837") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 4)), scpexpr(EXPR_END)), "loc_B70") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_A37") ChrTalk( #12 0x109, "#1065FUmm... Ries?\x02", ) CloseMessageWindow() OP_62(0xFE, 0x0, 2000, 0x0, 0x1, 0xFA, 0x2) OP_22(0x26, 0x0, 0x64) Sleep(1000) OP_51(0x109, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x109, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_912") Jump("loc_954") label("loc_912") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_92E") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_954") label("loc_92E") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_94A") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_954") label("loc_94A") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_954") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x109, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x109, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Sleep(200) ChrTalk( #13 0x11, "#1802FYes? What is it?\x02", ) CloseMessageWindow() ChrTalk( #14 0x109, ( "#1060FCould you come with me for a bit?\x02\x03", "#1075FI'll explain why later.\x01", "Although I probably won't need to.\x02", ) ) CloseMessageWindow() ChrTalk( #15 0x11, ( "#1440F...\x02\x03", "#1446FOkay. I'll come.\x02", ) ) CloseMessageWindow() OP_A2(0xB) Jump("loc_B60") label("loc_A37") OP_51(0x109, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x109, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_AC7") Jump("loc_B09") label("loc_AC7") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_AE3") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_B09") label("loc_AE3") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_AFF") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_B09") label("loc_AFF") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_B09") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x109, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x109, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #16 0x11, ( "#1445F...\x02\x03", "#1443FI'm ready whenever you are.\x02", ) ) CloseMessageWindow() label("loc_B60") SetChrSubChip(0xFE, 0) ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_12ED") label("loc_B70") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 3)), scpexpr(EXPR_END)), "loc_10AA") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_C47") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_C40") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x9)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_C0E") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #17 0x11, ( "#1445F(Leonhardt the Bladelord...)\x02\x03", "#1446F(He sounded like he knew Rufina, too...but how?)\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_C3D") label("loc_C0E") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #18 0x11, ( "#1446F...\x02\x03", "#1445FI see...\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_C3D") Jump("loc_C44") label("loc_C40") Call(5, 8) label("loc_C44") Jump("loc_10A7") label("loc_C47") RunExpression(0x2, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x8), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_E88") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x2, 0)), scpexpr(EXPR_END)), "loc_CFB") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #19 0x11, ( "#1447F#32WThe droplets from the spirits called forth\x01", "a morning mist in the forest.\x02\x03", "And by that spring, seven bells gathered...#20W\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_E82") label("loc_CFB") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_D8B") Jump("loc_DCD") label("loc_D8B") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_DA7") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_DCD") label("loc_DA7") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_DC3") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_DCD") label("loc_DC3") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_DCD") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #20 0x11, ( "#1448FPerhaps this would be a good time to read\x01", "a story from one of the Testaments.\x02\x03", "#1442FI am a sister of the church, after all.\x02", ) ) CloseMessageWindow() SetChrSubChip(0xFE, 0) TalkEnd(0xFE) label("loc_E82") OP_A2(0xB) Jump("loc_109E") label("loc_E88") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x2, 0)), scpexpr(EXPR_END)), "loc_F17") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #21 0x11, ( "#1447F#32WMay the two of them rest in peace.\x02\x03", "#1442FAnd may all those who live have courage\x01", "and be blessed.#20W\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_109E") label("loc_F17") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_FA7") Jump("loc_FE9") label("loc_FA7") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_FC3") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_FE9") label("loc_FC3") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_FDF") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_FE9") label("loc_FDF") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_FE9") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #22 0x11, ( "#1448FPerhaps this would be a good time to read\x01", "a story from one of the Testaments.\x02\x03", "#1442FI am a sister of the church, after all.\x02", ) ) CloseMessageWindow() SetChrSubChip(0xFE, 0) TalkEnd(0xFE) label("loc_109E") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_RESULT, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_10A7") Jump("loc_12ED") label("loc_10AA") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x564, 0)), scpexpr(EXPR_END)), "loc_10B4") Jump("loc_12ED") label("loc_10B4") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x562, 5)), scpexpr(EXPR_END)), "loc_1197") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_10D5") Call(3, 2) Jump("loc_1194") label("loc_10D5") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1158") ChrTalk( #23 0x11, "#1445F...\x02", ) CloseMessageWindow() ChrTalk( #24 0x109, "#1079FSomething wrong, Ries?\x02", ) CloseMessageWindow() ChrTalk( #25 0x11, "#1446F...No. It's nothing.\x02", ) CloseMessageWindow() OP_62(0x109, 0x0, 2000, 0x0, 0x1, 0xFA, 0x2) OP_22(0x26, 0x0, 0x64) Sleep(1000) OP_A2(0xB) Jump("loc_118C") label("loc_1158") ChrTalk( #26 0x11, ( "#1445F...\x02\x03", "(Why did both Kevin and Rufina...?)\x02", ) ) CloseMessageWindow() label("loc_118C") ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_1194") Jump("loc_12ED") label("loc_1197") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x561, 0)), scpexpr(EXPR_END)), "loc_12ED") OP_63(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_124A") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #27 0x11, ( "#1447F#40W...#20W\x02\x03", "#1442FAhh...\x02", ) ) CloseMessageWindow() OP_62(0xFE, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) OP_22(0x27, 0x0, 0x64) Sleep(1000) SetChrChipByIndex(0xFE, 2) SetChrSubChip(0xFE, 0) OP_62(0xFE, 0x0, 2000, 0x28, 0x2B, 0x64, 0x3) TurnDirection(0xFE, 0x0, 800) Sleep(200) ChrTalk( #28 0x11, "#1802FWh-What is it?!\x02", ) CloseMessageWindow() TalkEnd(0xFE) ClearChrFlags(0xFE, 0x10) OP_43(0xFE, 0x0, 0x0, 0xD) OP_A2(0xB) Jump("loc_12ED") label("loc_124A") TalkBegin(0xFE) ChrTalk( #29 0x11, ( "#1800F*cough*\x02\x03", "The Testaments exist to bring peace to the\x01", "hearts of Aidios' children.\x02\x03", "#1805FWould you like me to read you an excerpt\x01", "from them?\x02", ) ) CloseMessageWindow() TalkEnd(0xFE) OP_43(0xFE, 0x0, 0x0, 0xD) label("loc_12ED") Return() # Function_2_AC end def Function_3_12EE(): pass label("Function_3_12EE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x584, 0)), scpexpr(EXPR_END)), "loc_15AE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 7)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_140A") TalkBegin(0xFE) ChrTalk( #30 0x1E, ( "#1008FIt's gonna be a long journey, right?\x02\x03", "#1017FSo we'll probably get hungry on the way.\x01", "And if we don't have any food with us,\x01", "we're gonna be in biiig trouble!\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_1401") ChrTalk( #31 0x10F, "#1932F...I like the way you think.\x02", ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x8)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_1401") ChrTalk( #32 0x109, "#1066FHahaha...\x02", ) CloseMessageWindow() label("loc_1401") OP_A2(0x7) TalkEnd(0xFE) Jump("loc_15AB") label("loc_140A") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #33 0x1E, ( "#1015FUmm... Celeste says she's not going to need any,\x01", "so that leaves, like, what?\x02\x03", "Enough food for 16 people, I guess?\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_15A3") ChrTalk( #34 0x10F, ( "#1932F...I think you should bring enough for 18.\x02\x03", "#1938FI need about three people's worth of it.\x02", ) ) CloseMessageWindow() TurnDirection(0x1E, 0x10F, 0) SetChrSubChip(0xFE, 0) ChrTalk( #35 0x1E, ( "#1004FF-For real...?\x02\x03", "#1006FOkay, then!\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x8)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_15A3") ChrTalk( #36 0x109, ( "#1068F(I hope Gilbert's got a small stomach... \x01", "Sounds like he's gettin' jack all.)\x02", ) ) CloseMessageWindow() label("loc_15A3") ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_15AB") Jump("loc_1982") label("loc_15AE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x562, 5)), scpexpr(EXPR_END)), "loc_1982") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 7)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_187E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CD, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1743") TalkBegin(0xFE) ChrTalk( #37 0x1E, ( "#1008FI'm feeling kinda hungry, so I came over here\x01", "to get something to eat.\x02\x03", "#1019FWh-What are you looking at me like that for?! \x01", "Exercise makes you hungry! It's a fact of life!\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_173D") ChrTalk( #38 0x10F, ( "#1447FI couldn't agree more, Estelle.\x02\x03", "#1448FThat's a universal rule of this world.\x01", "To try to deny it would be folly.\x02", ) ) CloseMessageWindow() ChrTalk( #39 0x109, "#1068F(These two sure have a lot in common...)\x02", ) CloseMessageWindow() label("loc_173D") TalkEnd(0xFE) Jump("loc_1878") label("loc_1743") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #40 0x1E, ( "#1007F*sigh* I wish those two could get along...\x02\x03", "I wanna do something to help on that front,\x01", "but I'm not sure what I can do.\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_1833") ChrTalk( #41 0x109, ( "#1061F(Oh, I'm sure you could if you put\x01", "your mind to it, Estelle.)\x02", ) ) CloseMessageWindow() Jump("loc_1870") label("loc_1833") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_1853") ChrTalk( #42 0x10F, "#1440F...\x02", ) CloseMessageWindow() Jump("loc_1870") label("loc_1853") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_1870") ChrTalk( #43 0x110, "#1300F...\x02", ) CloseMessageWindow() label("loc_1870") ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_1878") OP_A2(0x7) Jump("loc_1982") label("loc_187E") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CD, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_18F7") ChrTalk( #44 0x1E, ( "#1015FI'm feeling kinda thirsty, too...\x02\x03", "#1006FMaybe I could go for some ice cream\x01", "or something?\x02", ) ) CloseMessageWindow() Jump("loc_197A") label("loc_18F7") ChrTalk( #45 0x1E, ( "#1007F*sigh* I wish those two could get along...\x02\x03", "I wanna do something to help on that front,\x01", "but I'm not sure what I can do.\x02", ) ) CloseMessageWindow() label("loc_197A") ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_1982") Return() # Function_3_12EE end def Function_4_1983(): pass label("Function_4_1983") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x584, 0)), scpexpr(EXPR_END)), "loc_206D") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 7)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_EXEC_OP, "OP_42(0x8)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_1E2C") TurnDirection(0x16, 0x109, 0) ChrTalk( #46 0x16, ( "#1500FIt's weird how it feels like we've known each\x01", "other for such a long time...but when you\x01", "think about it, it hasn't been that long at all.\x02", ) ) CloseMessageWindow() ChrTalk( #47 0x109, ( "#1075FHahaha. True enough.\x02\x03", "#1840FYou know...I might as well tell you this now.\x02\x03", "Right now, I'm pretty damn jealous of you,\x01", "Joshua.\x02", ) ) CloseMessageWindow() ChrTalk( #48 0x16, "#1504F...You are?\x02", ) CloseMessageWindow() ChrTalk( #49 0x109, ( "#1844FWhen you think about it, we've walked fairly\x01", "similar paths in life, right?\x02\x03", "But while I'm still feeling my way around in the\x01", "dark, you managed to make it back out into the\x01", "light again.\x02\x03", "#1846FI didn't really feel this way when you were finally\x01", "free from the Stigma and able to move on and all...\x02\x03", "...but now? That's a whole different story.\x02", ) ) CloseMessageWindow() ChrTalk( #50 0x16, ( "#1514F...You know? I think I know why, too.\x02\x03", "#1513FIt's probably because before now, you'd given\x01", "up on ever being able to come back to the light.\x01", "Except now, you want to believe you can again.\x02", ) ) CloseMessageWindow() ChrTalk( #51 0x109, ( "#1068FMan...you've got me all figured out.\x02\x03", "#1066FHaha... Pretty pitiful of me, huh?\x02", ) ) CloseMessageWindow() ChrTalk( #52 0x16, ( "#1509FMaybe, but there's no harm in that.\x02\x03", "#1501FBefore that, though, we've got to get\x01", "out of this world. \x02\x03", "But as long as we believe in ourselves,\x01", "I'm sure we can manage that.\x02", ) ) CloseMessageWindow() ChrTalk( #53 0x109, "#1840FFor sure.\x02", ) CloseMessageWindow() OP_A2(0x2667) Jump("loc_2067") label("loc_1E2C") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1F46") ChrTalk( #54 0x16, ( "#1505FThe Lord of Phantasma keeps referring to us as\x01", "pieces on a game board.\x02\x03", "#1502FAnd it's obvious enough that unless we all work\x01", "together, there's no way we're getting out of\x01", "here.\x02\x03", "Especially with how fixated she is on playing by\x01", "the rules she's established.\x02", ) ) CloseMessageWindow() OP_A2(0x1) Jump("loc_2067") label("loc_1F46") ChrTalk( #55 0x16, ( "#1502FIt's obvious enough that unless we all work\x01", "together, there's no way we're getting out of\x01", "here.\x02\x03", "#1503FThat's probably one of the rules that governs\x01", "the world itself.\x02\x03", "But at the same time, it feels like the Lord of\x01", "Phantasma herself is defined by the rules of\x01", "this world, too.\x02", ) ) CloseMessageWindow() label("loc_2067") TalkEnd(0xFE) Jump("loc_2D8F") label("loc_206D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 7)), scpexpr(EXPR_END)), "loc_2D8F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_2966") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_2259") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #56 0x110, ( "#264F...Joshua?\x02\x03", "#260FWhat are you doing here?\x02", ) ) CloseMessageWindow() OP_62(0xFE, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(1000) TurnDirection(0x16, 0x110, 400) Sleep(300) ChrTalk( #57 0x16, ( "#1513FOh, not much...\x02\x03", "#1500FI was just giving some thought to what we\x01", "might find ourselves up against during the\x01", "remainder of our time here.\x02", ) ) CloseMessageWindow() ChrTalk( #58 0x110, ( "#266F*sigh* Why would you waste time doing that\x01", "when we'll find out by proceeding anyway?\x02\x03", "#262FYou don't need to worry about anything as\x01", "long as I'm with you all.\x02", ) ) CloseMessageWindow() ChrTalk( #59 0x16, "#1509FHaha. I suppose you're right.\x02", ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_2963") label("loc_2259") RunExpression(0x2, (scpexpr(EXPR_GET_CHR_WORK, 0x16, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) RunExpression(0x3, (scpexpr(EXPR_GET_CHR_WORK, 0x17, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) EventBegin(0x0) OP_4A(0x16, 0) OP_4A(0x17, 0) TurnDirection(0x16, 0x101, 0) TurnDirection(0x0, 0x16, 0) TurnDirection(0x1, 0x16, 0) TurnDirection(0x2, 0x16, 0) TurnDirection(0x3, 0x16, 0) RunExpression(0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) RunExpression(0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) RunExpression(0x6, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x3), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) RunExpression(0x7, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_2446") TurnDirection(0x105, 0x101, 0) ChrTalk( #60 0x101, ( "#1000F...Joshua?\x02\x03", "What're you doing here?\x02", ) ) CloseMessageWindow() ChrTalk( #61 0x16, "#1505FOh, I was just thinking about Renne...\x02", ) CloseMessageWindow() Sleep(500) Fade(800) SetChrPos(0x10F, 58170, 1000, -57430, 147) SetChrPos(0xF0, 58610, 1000, -57100, 129) SetChrPos(0xF1, 60960, 1000, -56480, 129) SetChrPos(0x101, 60320, 1000, -59930, 129) SetChrPos(0x105, 58640, 1000, -59150, 133) TurnDirection(0x101, 0x105, 0) TurnDirection(0x16, 0x105, 0) TurnDirection(0x105, 0x101, 0) OP_6D(64870, -50, -60500, 0) OP_67(0, 4290, -10000, 0) OP_6B(6020, 0) OP_6C(71000, 0) OP_6E(203, 0) OP_0D() Sleep(500) ChrTalk( #62 0x105, ( "#1382FThe two of you have been trying to find\x01", "her ever since you left Liberl, right?\x02", ) ) CloseMessageWindow() Jump("loc_25AB") label("loc_2446") TurnDirection(0x17, 0x101, 0) ChrTalk( #63 0x101, ( "#1000F...Hmm?\x02\x03", "What're you guys doing here?\x02", ) ) CloseMessageWindow() ChrTalk( #64 0x16, "#1505FWe were just talking about Renne.\x02", ) CloseMessageWindow() Sleep(500) Fade(800) SetChrPos(0x10F, 58040, 1000, -58350, 129) SetChrPos(0xF0, 58610, 1000, -57100, 129) SetChrPos(0xF1, 60960, 1000, -56480, 129) SetChrPos(0x101, 59430, 1000, -60340, 129) TurnDirection(0x101, 0x17, 0) TurnDirection(0x16, 0x17, 0) TurnDirection(0x17, 0x101, 0) OP_6D(64870, -50, -60500, 0) OP_67(0, 4290, -10000, 0) OP_6B(6020, 0) OP_6C(71000, 0) OP_6E(203, 0) OP_0D() Sleep(500) ChrTalk( #65 0x17, ( "#1382FThe two of you have been trying to find her\x01", "ever since you left Liberl, right?\x02", ) ) CloseMessageWindow() label("loc_25AB") ChrTalk( #66 0x101, ( "#1003FYeah... I don't feel like we got to talk to her\x01", "properly back at the Axis Pillar.\x02\x03", "#1007FThere's something I really want to tell her,\x01", "too...and I'm not going to be satisfied until\x01", "I've done it.\x02", ) ) CloseMessageWindow() OP_8C(0x101, 129, 400) OP_8C(0x17, 129, 400) OP_8C(0x16, 129, 400) OP_62(0x101, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(2000) OP_63(0x101) Sleep(300) ChrTalk( #67 0x101, ( "#1016FHeehee. Still, she looks like she's doing okay.\x02\x03", "#1017FSo I think the best thing to do for now is keep\x01", "watching over her and see what happens.\x02", ) ) CloseMessageWindow() ChrTalk( #68 0x16, ( "#1501F...That might be for the best, yeah.\x02\x03", "#1513FAt the end of the day, she needs to be the one who\x01", "chooses what to do. Nothing good's going to come\x01", "from pushing her to make that call any faster.\x02\x03", "I just hope that ending up here with us and\x01", "everyone else has a positive effect on her.\x02\x03", "#1500FBut all we can really do is wait and see, huh?\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_28D9") ChrTalk( #69 0x105, "#1168F...Yes, I think you're right.\x02", ) CloseMessageWindow() Jump("loc_2902") label("loc_28D9") ChrTalk( #70 0x17, "#1168F...Yes, I think you're right.\x02", ) CloseMessageWindow() label("loc_2902") Sleep(500) Fade(500) ClearChrFlags(0x0, 0x8) ClearChrFlags(0x1, 0x8) ClearChrFlags(0x2, 0x8) ClearChrFlags(0x3, 0x8) OP_51(0x0, 0x1, (scpexpr(EXPR_GET_RESULT, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x2, (scpexpr(EXPR_GET_RESULT, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x3, (scpexpr(EXPR_GET_RESULT, 0x6), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x4, (scpexpr(EXPR_GET_RESULT, 0x7), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_4B(0x16, 0) OP_4B(0x17, 0) OP_51(0x16, 0x4, (scpexpr(EXPR_GET_RESULT, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x17, 0x4, (scpexpr(EXPR_GET_RESULT, 0x3), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_A2(0x2666) EventEnd(0x6) label("loc_2963") Jump("loc_2D8F") label("loc_2966") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_2C0B") OP_A2(0x1) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_2AA3") ChrTalk( #71 0x16, ( "#1505FIf Renne's theory that this world was molded into\x01", "its current form by the Lord of Phantasma is true...\x02\x03", "...I can only assume the rest of the planes in here\x01", "will be tailored to forwarding whatever their goal\x01", "is, too.\x02\x03", "#1503FI doubt said goal is in our best interests, either.\x02", ) ) CloseMessageWindow() Jump("loc_2C08") label("loc_2AA3") ChrTalk( #72 0x16, ( "#1501FWe're better off just keeping watch over Renne for\x01", "the time being.\x02\x03", "At the end of the day, she needs to be the one who\x01", "chooses what to do. Nothing good's going to come\x01", "from pushing her to make that call any faster.\x02\x03", "#1513F...Personally, I'm hoping that meeting everyone here\x01", "like this will end up having a positive effect on her\x01", "in the long run.\x02", ) ) CloseMessageWindow() label("loc_2C08") Jump("loc_2D8C") label("loc_2C0B") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_2CAA") ChrTalk( #73 0x16, ( "#1505FThe Lord of Phantasma clearly has some kind of\x01", "'game' for us in mind...#1200W #20W \x01", "#1503FI can't see it being very enjoyable for us, either.\x02", ) ) CloseMessageWindow() Jump("loc_2D8C") label("loc_2CAA") ChrTalk( #74 0x16, ( "#1501FWe're better off just keeping watch over Renne for\x01", "the time being.\x02\x03", "At the end of the day, she needs to be the one who\x01", "chooses what to do. Nothing good's going to come\x01", "from pushing her to make that call any faster.\x02", ) ) CloseMessageWindow() label("loc_2D8C") TalkEnd(0xFE) label("loc_2D8F") Return() # Function_4_1983 end def Function_5_2D90(): pass label("Function_5_2D90") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x561, 0)), scpexpr(EXPR_END)), "loc_33C1") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_3268") TalkBegin(0xFE) RunExpression(0x2, (scpexpr(EXPR_GET_CHR_WORK, 0x14, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xD)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_2FA8") TurnDirection(0xFE, 0x10E, 0) ChrTalk( #75 0x19, ( "#1541FWhy, hello, Julia.\x02\x03", "It's occurred to me that I never did properly\x01", "thank you for your assistance during my return\x01", "to Erebonia.\x02\x03", "#1547FSo, what say you? Would you like to accompany\x01", "me for a drink or two? On me, of course.\x02", ) ) CloseMessageWindow() ChrTalk( #76 0x10E, "#172FI... Well... I'm not sure that would be...\x02", ) CloseMessageWindow() OP_4A(0x14, 255) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xD)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_2F10") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_2F06") TurnDirection(0x10D, 0x10E, 400) Jump("loc_2F0D") label("loc_2F06") TurnDirection(0x14, 0x10E, 400) label("loc_2F0D") Jump("loc_2F2F") label("loc_2F10") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_2F28") TurnDirection(0x10D, 0x13, 400) Jump("loc_2F2F") label("loc_2F28") TurnDirection(0x14, 0x13, 400) label("loc_2F2F") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_2F6C") ChrTalk( #77 0x10D, "#272FFeel free to ignore him, Captain.\x02", ) CloseMessageWindow() Jump("loc_2F98") label("loc_2F6C") ChrTalk( #78 0x14, "#272FFeel free to ignore him, Captain.\x02", ) CloseMessageWindow() label("loc_2F98") OP_4B(0x14, 255) OP_51(0x14, 0x4, (scpexpr(EXPR_GET_RESULT, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_325F") label("loc_2FA8") ChrTalk( #79 0x19, ( "#1545FHeh. I've begun to think this may be a good\x01", "chance to get to know Julia a little better.\x02\x03", "#1542FI've been waiting for my chance to strike...\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_3205") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_3096") ChrTalk( #80 0x102, "#1505FI...wouldn't recommend it, Olivier. Really.\x02", ) CloseMessageWindow() Jump("loc_316A") label("loc_3096") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x0)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_30FB") ChrTalk( #81 0x101, ( "#1007F*sigh* If you thought my staff was bad,\x01", "wait until you meet her sword...\x02", ) ) CloseMessageWindow() Jump("loc_316A") label("loc_30FB") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_316A") ChrTalk( #82 0x105, ( "#1165FA-Ahaha...\x02\x03", "I...strongly wouldn't recommend it. Really,\x01", "I say that for your own good.\x02", ) ) CloseMessageWindow() label("loc_316A") ChrTalk( #83 0x10D, ( "#274FHow many times must I tell you not to cause\x01", "trouble before it gets through that seemingly\x01", "impenetrable skull of yours?\x02\x03", "Stay here and behave.\x02", ) ) CloseMessageWindow() Jump("loc_325F") label("loc_3205") ChrTalk( #84 0x19, ( "#1541F...but unfortunately, Mueller caught me before \x01", "I could make good on my plans.\x02", ) ) CloseMessageWindow() label("loc_325F") OP_A2(0xE) TalkEnd(0xFE) Jump("loc_33BE") label("loc_3268") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_3359") TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xD)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_32E2") TurnDirection(0x19, 0x10E, 0) ChrTalk( #85 0x19, ( "#1547FHohoho! It would be my pleasure to treat you\x01", "to a drink later, Julia.\x02", ) ) CloseMessageWindow() Jump("loc_3353") label("loc_32E2") ChrTalk( #86 0x19, ( "#1542FHmm... Now, how shall I go about this...?\x02\x03", "A good chance just doesn't seem to be\x01", "presenting itself...\x02", ) ) CloseMessageWindow() label("loc_3353") TalkEnd(0xFE) Jump("loc_33BE") label("loc_3359") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) OP_4A(0x14, 255) ChrTalk( #87 0x19, "#1541FMy dear friend, you misunderstand me!\x02", ) CloseMessageWindow() OP_62(0x14, 0x0, 2000, 0xC, 0xD, 0xFA, 0x2) OP_22(0x31, 0x0, 0x64) Sleep(1000) OP_4B(0x14, 255) ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_33BE") Jump("loc_46BC") label("loc_33C1") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x560, 0)), scpexpr(EXPR_END)), "loc_3713") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_3458") Jump("loc_349A") label("loc_3458") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_3474") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_349A") label("loc_3474") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_3490") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_349A") label("loc_3490") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_349A") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_3615") ChrTalk( #88 0x19, ( "#1540FHello, Kevin.\x02\x03", "#1545FIt sure seems like you've got quite a lot on your\x01", "mind.\x02\x03", "I won't force you to tell us everything, but given\x01", "that we've all been caught up in this, I think it's\x01", "fair to expect some kind of explanation. \x02", ) ) CloseMessageWindow() ChrTalk( #89 0x109, ( "#1843FYou'll get one. I promise.\x02\x03", "#1060FHope you don't mind waiting a little bit longer.\x02", ) ) CloseMessageWindow() OP_A2(0xE) Jump("loc_3708") label("loc_3615") ChrTalk( #90 0x19, ( "#1545FI can appreciate that someone in your line of\x01", "work will have plenty of things they can't speak\x01", "of freely...\x02\x03", "#1540F...but given that we've all been caught up in this,\x01", "I think it's fair to expect some kind of explanation\x01", "eventually.\x02", ) ) CloseMessageWindow() label("loc_3708") SetChrSubChip(0xFE, 0) TalkEnd(0xFE) Jump("loc_46BC") label("loc_3713") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x520, 5)), scpexpr(EXPR_END)), "loc_3BF8") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_39A2") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_37B8") Jump("loc_37FA") label("loc_37B8") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_37D4") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_37FA") label("loc_37D4") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_37F0") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_37FA") label("loc_37F0") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_37FA") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_391C") ChrTalk( #91 0x19, ( "#1545FHaha. It's been one fancy party after another \x01", "for me lately.\x02\x03", "#1540FSo truthfully, it's actually nice to have some\x01", "time to sit and relax once in a while.\x02", ) ) CloseMessageWindow() ChrTalk( #92 0x10D, ( "#272F...Does the possibility of 'doing some work'\x01", "not occur to you?\x02", ) ) CloseMessageWindow() OP_A2(0xE) Jump("loc_3997") label("loc_391C") TalkBegin(0xFE) ChrTalk( #93 0x19, ( "#1545FBe sure to work Mueller to the bone in my place,\x01", "my wonderful friends.\x02\x03", "He knows how to make himself useful.\x02", ) ) CloseMessageWindow() label("loc_3997") SetChrSubChip(0xFE, 0) TalkEnd(0xFE) Jump("loc_3BF5") label("loc_39A2") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_3B6D") SetChrFlags(0x19, 0x10) TalkBegin(0x19) OP_4A(0x19, 255) OP_4A(0x14, 255) ChrTalk( #94 0x19, ( "#1542F...No. I think it's safe to say that His Excellency\x01", "the Chancellor isn't in any way involved in this.\x02\x03", "This is far too roundabout a plan of attack even\x01", "for him.\x02\x03", "#1551FI can't be so sure that Ouroboros isn't, however...\x02", ) ) CloseMessageWindow() ChrTalk( #95 0x14, ( "#272FWell, I can't disagree that this doesn't feel like\x01", "something he would do.\x02\x03", "#276FNot least because if he wanted to harm you,\x01", "he had plenty of chances to do so in Heimdallr.\x02", ) ) CloseMessageWindow() OP_A2(0xE) ClearChrFlags(0x19, 0x10) OP_4B(0x19, 255) OP_4B(0x14, 255) TalkEnd(0x19) Jump("loc_3BF5") label("loc_3B6D") TalkBegin(0xFE) ChrTalk( #96 0x19, ( "#1540FGreetings! How fares the investigation?\x02\x03", "#1541FIf you find anything out, do come and let me know.\x01", "I'm ever so curious.\x02", ) ) CloseMessageWindow() TalkEnd(0xFE) label("loc_3BF5") Jump("loc_46BC") label("loc_3BF8") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x520, 0)), scpexpr(EXPR_END)), "loc_46BC") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_43BD") OP_4A(0x17, 255) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_3C1D") OP_4A(0x14, 255) label("loc_3C1D") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xD)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_EXEC_OP, "OP_42(0x7)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_3C3A") OP_4A(0x13, 255) label("loc_3C3A") SetChrFlags(0x19, 0x10) TalkBegin(0x19) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_3DE7") OP_51(0x105, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x19, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0x19) ClearChrFlags(0x19, 0x10) TurnDirection(0x19, 0x105, 0) OP_51(0x19, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x19, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x19, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_3CE0") Jump("loc_3D22") label("loc_3CE0") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_3CFC") OP_51(0x19, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_3D22") label("loc_3CFC") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_3D18") OP_51(0x19, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_3D22") label("loc_3D18") OP_51(0x19, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_3D22") OP_51(0x19, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x105, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x105, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x19, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0x19, 0x10) ChrTalk( #97 0x105, ( "#1382FHow have you been since we last met, \x01", "Your Highness?\x02\x03", "Word of your popularity in Erebonian high\x01", "society has been reaching us over in Liberl,\x01", "too.\x02", ) ) CloseMessageWindow() Jump("loc_3E89") label("loc_3DE7") SetChrSubChip(0x19, 0) ChrTalk( #98 0x17, ( "#1382FHow have you been since we last met, \x01", "Your Highness?\x02\x03", "Word of your popularity in Erebonian high\x01", "society has been reaching us over in Liberl,\x01", "too.\x02", ) ) CloseMessageWindow() label("loc_3E89") ChrTalk( #99 0x19, ( "#1545FWell, I'm doing a good enough job of convincing\x01", "them I'm little more than an elegant-yet-harmless\x01", "prince at the moment.\x02\x03", "#1542FStill, spending so much of my time pretending to \x01", "be someone I'm not can be terribly exhausting.\x02\x03", "#1544FSo I'm biding my time and waiting for the perfect\x01", "chance to cast it all aside and reveal my true form\x01", "to the world...\x02", ) ) CloseMessageWindow() Sleep(500) ChrTalk( #100 0x19, "#1541F#3SThen all shall know Olivier, the Gospeler of Love!\x02", ) OP_7C(0x0, 0xC8, 0xBB8, 0x64) CloseMessageWindow() OP_62(0x19, 0x12C, 1600, 0x36, 0x39, 0xFA, 0x0) OP_22(0x89, 0x0, 0x64) Sleep(2000) OP_62(0x0, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) OP_22(0x31, 0x0, 0x64) OP_62(0x1, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) OP_22(0x31, 0x0, 0x64) OP_62(0x2, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) OP_22(0x31, 0x0, 0x64) OP_62(0x3, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) OP_22(0x31, 0x0, 0x64) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_40E5") OP_62(0x17, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) OP_22(0x31, 0x0, 0x64) label("loc_40E5") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_410A") OP_62(0x14, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) OP_22(0x31, 0x0, 0x64) label("loc_410A") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xD)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_EXEC_OP, "OP_42(0x7)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_413A") OP_62(0x13, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) OP_22(0x31, 0x0, 0x64) label("loc_413A") Sleep(1000) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_4167") ChrTalk( #101 0x10D, "#274FYou moron...\x02", ) CloseMessageWindow() Jump("loc_417E") label("loc_4167") ChrTalk( #102 0x14, "#274FYou moron...\x02", ) CloseMessageWindow() label("loc_417E") ChrTalk( #103 0x109, ( "#1068F'Gospeler of Love'? THAT'S what you're going\x01", "with?\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_4244") ChrTalk( #104 0x102, ( "#1508FWho else thinks he's going to be even more of\x01", "a menace to society than the black orbment\x01", "Gospels ever were?\x02", ) ) CloseMessageWindow() Jump("loc_42BB") label("loc_4244") ChrTalk( #105 0x16, ( "#1508FWho else thinks he's going to be even more of\x01", "a menace to society than the black orbment\x01", "Gospels ever were?\x02", ) ) CloseMessageWindow() label("loc_42BB") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_4320") ChrTalk( #106 0x105, ( "#1165FHeehee. It's reassuring to see how little\x01", "he's changed at heart, though.\x02", ) ) CloseMessageWindow() Jump("loc_4374") label("loc_4320") ChrTalk( #107 0x17, ( "#1165FHeehee. It's reassuring to see how little\x01", "he's changed at heart, though.\x02", ) ) CloseMessageWindow() label("loc_4374") OP_63(0x19) OP_4B(0x17, 255) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_438D") OP_4B(0x14, 255) label("loc_438D") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xD)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_EXEC_OP, "OP_42(0x7)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_43AA") OP_4B(0x13, 255) label("loc_43AA") SetChrSubChip(0x19, 0) ClearChrFlags(0x19, 0x10) TalkEnd(0x19) OP_A2(0x2660) Jump("loc_46BC") label("loc_43BD") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x19, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0x19) ClearChrFlags(0x19, 0x10) TurnDirection(0x19, 0x0, 0) OP_51(0x19, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x19, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x19, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_444D") Jump("loc_448F") label("loc_444D") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_4469") OP_51(0x19, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_448F") label("loc_4469") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_4485") OP_51(0x19, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_448F") label("loc_4485") OP_51(0x19, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0x19, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_448F") OP_51(0x19, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x19, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0x19, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_45CF") ChrTalk( #108 0x19, ( "#1545FStill, the thought of that ghost has yet to\x01", "leave my mind since I first heard about her.\x02\x03", "Just imagine the spirit of a beautiful woman,\x01", "left all alone in this empty realm...\x02\x03", "#1547FHahaha! Doesn't the thought just get your\x01", "imagination racing?\x02", ) ) CloseMessageWindow() ChrTalk( #109 0x102, "#1508F...\x02", ) CloseMessageWindow() OP_A2(0xE) Jump("loc_46B4") label("loc_45CF") ChrTalk( #110 0x19, ( "#1540FStill, the thought of that ghost has yet to\x01", "leave my mind since I first heard about her.\x02\x03", "I wonder whether this garden's appearance is\x01", "a reflection of her interests?\x02\x03", "#1541FIf so, I have to commend her for her tastes.\x02", ) ) CloseMessageWindow() label("loc_46B4") SetChrSubChip(0x19, 0) TalkEnd(0x19) label("loc_46BC") Return() # Function_5_2D90 end def Function_6_46BD(): pass label("Function_6_46BD") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 3)), scpexpr(EXPR_END)), "loc_4D62") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4C8, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CD, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_4954") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_476C") Jump("loc_47AE") label("loc_476C") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_4788") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_47AE") label("loc_4788") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_47A4") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_47AE") label("loc_47A4") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_47AE") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #111 0x17, ( "#1383FSo...\x02\x03", "#1382F...you got to say farewell, Joshua?\x02", ) ) CloseMessageWindow() OP_62(0x102, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) OP_22(0x27, 0x0, 0x64) Sleep(1000) ChrTalk( #112 0x102, ( "#1513F...Yeah. Thanks.\x02\x03", "#1514FI'm impressed you worked that out without me\x01", "saying anything, Kloe. Heh. You're too sharp\x01", "for your own good.\x02", ) ) CloseMessageWindow() ChrTalk( #113 0x17, ( "#1165FAww. Hardly.\x02\x03", "#1168FYou just look like a huge burden's been lifted\x01", "from your shoulders, that's all. Kind of gave it\x01", "away to me.\x02", ) ) CloseMessageWindow() OP_A2(0x2669) SetChrSubChip(0xFE, 0) TalkEnd(0xFE) Jump("loc_4D5F") label("loc_4954") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_4BA5") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xA)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_4B11") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_49FA") Jump("loc_4A3C") label("loc_49FA") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_4A16") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_4A3C") label("loc_4A16") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_4A32") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_4A3C") label("loc_4A32") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_4A3C") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #114 0x17, ( "#1164FOh... Umm...\x02\x03", "#1382FHeehee. I'm just taking a break for now.\x02\x03", "#1165FI got a little too engrossed in reading the\x01", "books over in the library area, you see. \x02", ) ) CloseMessageWindow() SetChrSubChip(0xFE, 0) TalkEnd(0xFE) Jump("loc_4B9F") label("loc_4B11") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #115 0x17, ( "#1165FA-Ahaha... Sorry, Josette.\x02\x03", "I've always had this habit of getting really \x01", "engrossed in things when I'm doing them.\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_4B9F") OP_A2(0xC) Jump("loc_4D5F") label("loc_4BA5") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_4C35") Jump("loc_4C77") label("loc_4C35") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_4C51") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_4C77") label("loc_4C51") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_4C6D") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_4C77") label("loc_4C6D") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_4C77") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #116 0x17, ( "#1168FThis place is incredibly calming somehow, isn't it?\x02\x03", "#1168FI might've been more surprised than anything when\x01", "I first found myself here, but now I'm actually quite\x01", "comfortable.\x02", ) ) CloseMessageWindow() SetChrSubChip(0xFE, 0) TalkEnd(0xFE) label("loc_4D5F") Jump("loc_6653") label("loc_4D62") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 7)), scpexpr(EXPR_END)), "loc_5CAC") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5899") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_4DFC") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) OP_62(0xFE, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) OP_22(0x27, 0x0, 0x64) Sleep(1000) TurnDirection(0x17, 0x110, 400) ChrTalk( #117 0x17, ( "#1164FE-Erm... Renne...?\x02\x03", "#1165FAhaha... Umm...\x02\x03", "Take care, okay?\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_5896") label("loc_4DFC") RunExpression(0x2, (scpexpr(EXPR_GET_CHR_WORK, 0x16, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) RunExpression(0x3, (scpexpr(EXPR_GET_CHR_WORK, 0x17, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) EventBegin(0x0) OP_4A(0x16, 0) OP_4A(0x17, 0) TurnDirection(0x16, 0x101, 0) TurnDirection(0x17, 0x101, 0) TurnDirection(0x0, 0x17, 0) TurnDirection(0x1, 0x17, 0) TurnDirection(0x2, 0x17, 0) TurnDirection(0x3, 0x17, 0) RunExpression(0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) RunExpression(0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) RunExpression(0x6, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x3), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) RunExpression(0x7, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_5361") ChrTalk( #118 0x101, ( "#1000FKloe?\x02\x03", "What're you doing here?\x02", ) ) CloseMessageWindow() ChrTalk( #119 0x17, ( "#1164FOh, it's just...\x02\x03", "#1382FI was just curious how Renne was doing,\x01", "that's all.\x02", ) ) CloseMessageWindow() Sleep(500) Fade(800) SetChrPos(0x10F, 58040, 1000, -58350, 129) SetChrPos(0xF0, 58610, 1000, -57100, 129) SetChrPos(0xF1, 60960, 1000, -56480, 129) SetChrPos(0x101, 59430, 1000, -60340, 129) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_4F62") SetChrPos(0x105, 59050, 1000, -59340, 129) label("loc_4F62") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_4F81") SetChrPos(0x102, 59020, 1000, -59390, 81) label("loc_4F81") ClearChrFlags(0x101, 0x8) ClearChrFlags(0x10F, 0x8) TurnDirection(0x102, 0x17, 0) TurnDirection(0x101, 0x17, 0) TurnDirection(0x17, 0x101, 0) OP_6D(64870, -50, -60500, 0) OP_67(0, 4290, -10000, 0) OP_6B(6020, 0) OP_6C(71000, 0) OP_6E(203, 0) OP_0D() Sleep(500) ChrTalk( #120 0x17, ( "#1382FThe two of you have been trying to find\x01", "her ever since you left Liberl, right?\x02", ) ) CloseMessageWindow() ChrTalk( #121 0x102, ( "#1503FYeah... I don't feel like we got to talk to\x01", "her properly back at the Axis Pillar.\x02", ) ) CloseMessageWindow() ChrTalk( #122 0x101, ( "#1011FThere's something I really want to tell her,\x01", "too...and I'm not going to be satisfied until\x01", "I've done it.\x02", ) ) CloseMessageWindow() OP_8C(0x101, 129, 400) OP_8C(0x17, 129, 400) OP_8C(0x102, 129, 400) OP_62(0x101, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(2000) OP_63(0x101) Sleep(300) ChrTalk( #123 0x101, ( "#1016FHeehee. Still, she looks like she's doing okay.\x02\x03", "#1017FSo I think the best thing to do for now is keep\x01", "watching over her and see what happens.\x02", ) ) CloseMessageWindow() ChrTalk( #124 0x102, ( "#1501F...That might be for the best, yeah.\x02\x03", "#1513FAt the end of the day, she needs to be the one who\x01", "chooses what to do. Nothing good's going to come\x01", "from pushing her to make that call any faster.\x02\x03", "I just hope that ending up here with us and\x01", "everyone else has a positive effect on her.\x02\x03", "#1500FBut all we can really do is wait and see, huh?\x02", ) ) CloseMessageWindow() ChrTalk( #125 0x17, "#1168F...Yes, I think you're right.\x02", ) CloseMessageWindow() Jump("loc_5835") label("loc_5361") ChrTalk( #126 0x101, ( "#1000FHmm?\x02\x03", "What are the two of you doing here?\x02", ) ) CloseMessageWindow() ChrTalk( #127 0x17, ( "#1164FOh, Estelle.\x02\x03", "#1382FWe were just talking about Renne.\x02", ) ) CloseMessageWindow() Sleep(500) Fade(800) SetChrPos(0x10F, 58260, 1000, -58840, 129) SetChrPos(0xF0, 58610, 1000, -57100, 129) SetChrPos(0xF1, 60960, 1000, -56480, 129) SetChrPos(0x101, 59430, 1000, -60340, 129) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_5444") SetChrPos(0x105, 59050, 1000, -59340, 129) label("loc_5444") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_545C") SetChrFlags(0x102, 0x8) ClearChrFlags(0x16, 0x80) label("loc_545C") ClearChrFlags(0x101, 0x8) ClearChrFlags(0x10F, 0x8) TurnDirection(0x16, 0x17, 0) TurnDirection(0x101, 0x17, 0) TurnDirection(0x17, 0x101, 0) OP_6D(64870, -50, -60500, 0) OP_67(0, 4290, -10000, 0) OP_6B(6020, 0) OP_6C(71000, 0) OP_6E(203, 0) OP_0D() Sleep(500) ChrTalk( #128 0x17, ( "#1382FThe two of you have been trying to find\x01", "her ever since you left Liberl, right?\x02", ) ) CloseMessageWindow() ChrTalk( #129 0x101, ( "#1003FYeah... I don't feel like we got to talk to\x01", "her properly back at the Axis Pillar.\x02\x03", "#1007FThere's something I really want to tell her,\x01", "too...and I'm not going to be satisfied until\x01", "I've done it.\x02", ) ) CloseMessageWindow() OP_8C(0x101, 129, 400) OP_8C(0x17, 129, 400) OP_8C(0x16, 129, 400) OP_62(0x101, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(2000) OP_63(0x101) Sleep(300) ChrTalk( #130 0x101, ( "#1016FHeehee. Still, she looks like she's doing okay.\x02\x03", "#1017FSo I think the best thing to do for now is keep\x01", "watching over her and see what happens.\x02", ) ) CloseMessageWindow() ChrTalk( #131 0x16, ( "#1501F...That might be for the best, yeah.\x02\x03", "#1513FAt the end of the day, she needs to be the one who\x01", "chooses what to do. Nothing good's going to come\x01", "from pushing her to make that call any faster.\x02\x03", "I just hope that ending up here with us and\x01", "everyone else has a positive effect on her.\x02\x03", "#1500FBut all we can really do is wait and see, huh?\x02", ) ) CloseMessageWindow() ChrTalk( #132 0x17, "#1168F...Yes, I think you're right.\x02", ) CloseMessageWindow() label("loc_5835") Sleep(500) Fade(500) ClearChrFlags(0x0, 0x8) ClearChrFlags(0x1, 0x8) ClearChrFlags(0x2, 0x8) ClearChrFlags(0x3, 0x8) OP_51(0x0, 0x1, (scpexpr(EXPR_GET_RESULT, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x2, (scpexpr(EXPR_GET_RESULT, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x3, (scpexpr(EXPR_GET_RESULT, 0x6), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x4, (scpexpr(EXPR_GET_RESULT, 0x7), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_4B(0x16, 0) OP_4B(0x17, 0) OP_51(0x16, 0x4, (scpexpr(EXPR_GET_RESULT, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x17, 0x4, (scpexpr(EXPR_GET_RESULT, 0x3), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_A2(0x2666) EventEnd(0x6) label("loc_5896") Jump("loc_5CA9") label("loc_5899") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5B43") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_59D4") ChrTalk( #133 0x17, ( "#1162FIf this world really does change as a result\x01", "of people's thoughts...\x02\x03", "...then it seems reasonable to assume that\x01", "someone must have wished for all of us to\x01", "come together, too.\x02\x03", "#1169FCould that someone be the Lord of Phantasma?\x01", "Or is it that ghost?\x02\x03", "#1167F...Or maybe even us?\x02", ) ) CloseMessageWindow() Jump("loc_5B3D") label("loc_59D4") ChrTalk( #134 0x17, ( "#1167FI'm sure it's not going to be easy to come to an\x01", "understanding with Renne after all she's been\x01", "through, but you know what? \x02\x03", "#1168FIf anyone can do it, it's you and Joshua, Estelle.\x02\x03", "The bond between the two of you is so strong\x01", "that I'm not sure there's anything you couldn't\x01", "do together.\x02", ) ) CloseMessageWindow() ChrTalk( #135 0x101, ( "#1008FAwww...\x02\x03", "#1006FThanks, Kloe. I hope you're right.\x02", ) ) CloseMessageWindow() label("loc_5B3D") OP_A2(0xC) Jump("loc_5CA6") label("loc_5B43") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_5BE8") ChrTalk( #136 0x17, ( "#1167FNo sooner have we solved one mystery, another\x01", "presents itself...\x02\x03", "#1162FAs a game, this is certainly well thought out,\x01", "to say the least.\x02", ) ) CloseMessageWindow() Jump("loc_5CA6") label("loc_5BE8") ChrTalk( #137 0x17, ( "#1383FI'm not sure how much I'll be able to do to help\x01", "you when it comes to Renne, but I do want to do\x01", "everything within my power.\x02\x03", "#1382FSo if there's anything I can do, say the word.\x02", ) ) CloseMessageWindow() label("loc_5CA6") TalkEnd(0xFE) label("loc_5CA9") Jump("loc_6653") label("loc_5CAC") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 4)), scpexpr(EXPR_END)), "loc_5E73") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5DC5") ChrTalk( #138 0x17, ( "#1160FThis is my first time meeting Richard ever since\x01", "he officially left the army.\x02\x03", "#1161FI'd heard his company's name mentioned on a\x01", "number of occasions since then, though.\x02", ) ) CloseMessageWindow() ChrTalk( #139 0x101, ( "#1004FOh, really?\x02\x03", "#1015FMaybe it's doing pretty well for itself, then.\x02", ) ) CloseMessageWindow() OP_A2(0xC) Jump("loc_5E6D") label("loc_5DC5") ChrTalk( #140 0x17, ( "#1160FI've heard about Richard's company a number\x01", "of times since it was first established.\x02\x03", "#1383FThere've been small adverts for it in magazines,\x01", "too, I believe.\x02", ) ) CloseMessageWindow() label("loc_5E6D") TalkEnd(0xFE) Jump("loc_6653") label("loc_5E73") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x521, 6)), scpexpr(EXPR_END)), "loc_60C8") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5FA0") ChrTalk( #141 0x17, ( "#1167FWe have every reason to believe that there\x01", "are still people sealed in stones in this land\x01", "that we have yet to discover.\x02\x03", "#1167FWhether that is somewhere in Le Locle or on\x01", "the next plane, I don't know...but we need to\x01", "find them.\x02\x03", "#1162FSo let's keep going. Together.\x02", ) ) CloseMessageWindow() OP_A2(0xC) Jump("loc_60C2") label("loc_5FA0") ChrTalk( #142 0x17, ( "#1162FI'm worried about all the people still trapped\x01", "in sealing stones here. We should hurry on.\x02\x03", "#1167F...Althooough, I'm also worried about Ries...\x02", ) ) CloseMessageWindow() ChrTalk( #143 0x109, ( "#1840F(Erk... Why do I get the feeling she knows\x01", "more than she's letting on?)\x02", ) ) CloseMessageWindow() ChrTalk( #144 0x102, "#1514F(She's a sharp girl. She probably does.)\x02", ) CloseMessageWindow() label("loc_60C2") TalkEnd(0xFE) Jump("loc_6653") label("loc_60C8") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x521, 2)), scpexpr(EXPR_END)), "loc_62D9") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_6167") Jump("loc_61A9") label("loc_6167") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_6183") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_61A9") label("loc_6183") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_619F") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_61A9") label("loc_619F") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_61A9") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_6245") ChrTalk( #145 0x17, ( "#1164FOh, I'm just feeding Sieg. He said he was hungry.\x02\x03", "#1165FHeehee. It won't take long. Promise.\x02", ) ) CloseMessageWindow() OP_A2(0xC) Jump("loc_62C9") label("loc_6245") ChrTalk( #146 0x17, ( "#1160FStill, I'm truly glad that we were able to find\x01", "plenty of food and water here.\x02\x03", "We probably owe that to that ghost, too.\x02", ) ) CloseMessageWindow() label("loc_62C9") SetChrSubChip(0xFE, 1) ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_6653") label("loc_62D9") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x520, 5)), scpexpr(EXPR_END)), "loc_647B") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_63DD") ChrTalk( #147 0x17, ( "#1167FI certainly wasn't expecting Anelace to have\x01", "been drawn in here, too...\x02\x03", "...\x02\x03", "#1162FWe should keep up with our investigation as\x01", "quickly as we can.\x02\x03", "If you need anything from me, let me know. \x01", "I'm always happy to lend a hand.\x02", ) ) CloseMessageWindow() OP_A2(0xC) Jump("loc_6475") label("loc_63DD") ChrTalk( #148 0x17, ( "#1162FWe should keep up with our investigation as\x01", "quickly as we can.\x02\x03", "If you need anything from me, let me know. \x01", "I'm always happy to lend a hand.\x02", ) ) CloseMessageWindow() label("loc_6475") TalkEnd(0xFE) Jump("loc_6653") label("loc_647B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x520, 0)), scpexpr(EXPR_END)), "loc_6653") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_649C") Call(5, 5) Jump("loc_6653") label("loc_649C") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_658E") ChrTalk( #149 0x17, ( "#1383FIt has always felt like we were being somehow\x01", "protected when we were in this garden\x01", "as opposed to anywhere else in Phantasma...\x02\x03", "#1160F...so I can certainly believe the idea that it may\x01", "be connected to that ghost.\x02", ) ) CloseMessageWindow() OP_A2(0xC) Jump("loc_6650") label("loc_658E") ChrTalk( #150 0x17, ( "#1160FIt don't see any reason why this garden wouldn't\x01", "be connected to that ghost somehow.\x02\x03", "#1168FHeehee. And I don't mind that one bit. It feels\x01", "reassuring to know she's watching over us.\x02", ) ) CloseMessageWindow() label("loc_6650") TalkEnd(0xFE) label("loc_6653") Return() # Function_6_46BD end def Function_7_6654(): pass label("Function_7_6654") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x584, 0)), scpexpr(EXPR_END)), "loc_735D") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 5)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_6DC1") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_EXEC_OP, "OP_42(0x0)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_69C9") OP_51(0x101, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x101, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_6714") Jump("loc_6756") label("loc_6714") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_6730") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_6756") label("loc_6730") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_674C") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_6756") label("loc_674C") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_6756") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x101, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x101, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #151 0x101, ( "#1015FHuh? Why aren't you hanging out with Tita,\x01", "Agate?\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_6882") ChrTalk( #152 0x1D, ( "#551FThe hell kinda question is that? I'm not her dad.\x02\x03", "#053F...Besides, she's not a little kid.\x02\x03", "She knows what she needs to do without me\x01", "telling her or breathin' over her neck.\x02", ) ) CloseMessageWindow() Jump("loc_68F9") label("loc_6882") ChrTalk( #153 0x1D, ( "#551FThe hell kinda question is that? I'm not her dad.\x02\x03", "#051FBesides, she's with her friend right now. It's fine.\x02", ) ) CloseMessageWindow() label("loc_68F9") ChrTalk( #154 0x101, "#1028FOh-hooo...\x02", ) CloseMessageWindow() ChrTalk( #155 0x1D, "#555F...What? You got a problem?\x02", ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_69C6") ChrTalk( #156 0x104, ( "#1541FThere's no need to be so flustered, dearest. ㈱\x01", "Your feelings are nothing to be ashamed of.\x02", ) ) CloseMessageWindow() OP_62(0xFE, 0x0, 2000, 0xC, 0xD, 0xFA, 0x2) OP_22(0x31, 0x0, 0x64) Sleep(1000) label("loc_69C6") Jump("loc_6DBB") label("loc_69C9") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_6C47") OP_51(0x10F, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x10F, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_6A72") Jump("loc_6AB4") label("loc_6A72") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_6A8E") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_6AB4") label("loc_6A8E") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_6AAA") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_6AB4") label("loc_6AAA") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_6AB4") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x10F, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x10F, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #157 0x10F, ( "#1936FUmm...\x02\x03", "#1938FYou do know Tita is over there at the moment,\x01", "don't you?\x02", ) ) CloseMessageWindow() ChrTalk( #158 0x1D, ( "#052FYeah, sure...\x02\x03", "#051FWhy're you asking?\x02", ) ) CloseMessageWindow() ChrTalk( #159 0x10F, ( "#1938FWell, it's just that you always seemed\x01", "to be with her...\x02\x03", "#1937FI thought you may have been wondering\x01", "where she was.\x02", ) ) CloseMessageWindow() ChrTalk( #160 0x1D, ( "#055FI ain't some chick separated from its\x01", "mother hen, you know!\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_6C44") ChrTalk( #161 0x110, "#261FTeehee...\x02", ) CloseMessageWindow() label("loc_6C44") Jump("loc_6DBB") label("loc_6C47") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_6CD7") Jump("loc_6D19") label("loc_6CD7") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_6CF3") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_6D19") label("loc_6CF3") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_6D0F") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_6D19") label("loc_6D0F") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_6D19") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #162 0x1D, ( "#053FSounds like this is it. The end's finally in sight.\x02\x03", "#051FBetter train myself up as best I can--I'm gonna\x01", "need it.\x02", ) ) CloseMessageWindow() label("loc_6DBB") OP_A2(0x5) Jump("loc_7350") label("loc_6DC1") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_EXEC_OP, "OP_42(0x0)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_6FBA") OP_51(0x101, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x101, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_6E6A") Jump("loc_6EAC") label("loc_6E6A") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_6E86") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_6EAC") label("loc_6E86") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_6EA2") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_6EAC") label("loc_6EA2") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_6EAC") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x101, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x101, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #163 0x1D, ( "#053FShe's not a kid anymore, so I'm sure she'll be\x01", "fine without me.\x02\x03", "#051FIf she needs me, I'm always there, but I know\x01", "she can otherwise handle herself.\x02", ) ) CloseMessageWindow() ChrTalk( #164 0x101, "#1028FOh, my... ☆\x02", ) CloseMessageWindow() ChrTalk( #165 0x1D, "#055FWhat's with that starry-eyed look?!\x02", ) CloseMessageWindow() Jump("loc_7350") label("loc_6FBA") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_71BE") OP_51(0x10F, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x10F, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_7063") Jump("loc_70A5") label("loc_7063") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_707F") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_70A5") label("loc_707F") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_709B") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_70A5") label("loc_709B") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_70A5") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x10F, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x10F, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #166 0x1D, ( "#551FWe're not always with one another! We just happen\x01", "to be together sometimes.\x02\x03", "#051FBesides, she's not a kid anymore. She doesn't need\x01", "me looking after her every second of the day.\x02", ) ) CloseMessageWindow() ChrTalk( #167 0x10F, "#1930F...\x02", ) CloseMessageWindow() ChrTalk( #168 0x1D, "#055FWh-What's with that look?!\x02", ) CloseMessageWindow() Jump("loc_7350") label("loc_71BE") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_724E") Jump("loc_7290") label("loc_724E") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_726A") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_7290") label("loc_726A") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_7286") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_7290") label("loc_7286") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_7290") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #169 0x1D, ( "#050FFrom here on, we ain't gonna have time for standin'\x01", "still. We've gotta push on, on, and on.\x02\x03", "#051FSo make sure you train up while you can, okay?\x02", ) ) CloseMessageWindow() label("loc_7350") SetChrSubChip(0xFE, 0) ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_735D") Return() # Function_7_6654 end def Function_8_735E(): pass label("Function_8_735E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x584, 0)), scpexpr(EXPR_END)), "loc_7799") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_7740") ChrTalk( #170 0x12, ( "#060FWith the Arseille's speed, I don't think it'll take long\x01", "at all for us to break out of the planes.\x02\x03", "#067FMom was actually able to raise its top speed with a\x01", "few improvements the other month, too, so that'll\x01", "be a huge help.\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x0)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_7592") ChrTalk( #171 0x101, ( "#1001FHuh. Really?\x02\x03", "#1006FI hope I can meet your mom someday.\x02", ) ) CloseMessageWindow() ChrTalk( #172 0x12, ( "#067FHeehee... I'd love you to meet her, too!\x02\x03", "#560FI'll have to introduce you to both my parents one day.\x01", "I know they've been looking forward to meeting you\x01", "and Joshua!\x02\x03", "#061FCome over any time when you get back to Liberl!\x02", ) ) CloseMessageWindow() Jump("loc_773A") label("loc_7592") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_768C") ChrTalk( #173 0x102, ( "#1504FTheir names were, uh...\x02\x03", "#1500F...Dan and Erika, right?\x02", ) ) CloseMessageWindow() ChrTalk( #174 0x12, ( "#067FYup. That's right.\x02\x03", "#560FThe two of them have been really looking forward\x01", "to meeting you and Estelle.\x02\x03", "#061FCome over any time when you get back to Liberl!\x02", ) ) CloseMessageWindow() Jump("loc_773A") label("loc_768C") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x5)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_773A") ChrTalk( #175 0x106, ( "#552F(Oh, I'd forgotten about her messing around with\x01", "it before.)\x02\x03", "#551F(...I just remember being hit by a flying spanner\x01", "when she was.)\x02", ) ) CloseMessageWindow() ChrTalk( #176 0x12, "#565F...Hmm?\x02", ) CloseMessageWindow() label("loc_773A") OP_A2(0x0) Jump("loc_7793") label("loc_7740") ChrTalk( #177 0x12, ( "#062FR-Right!\x02\x03", "If I wanna get back to Mom and Dad,\x01", "I've gotta give it my all!\x02", ) ) CloseMessageWindow() label("loc_7793") TalkEnd(0xFE) Jump("loc_955D") label("loc_7799") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 3)), scpexpr(EXPR_END)), "loc_80D8") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_7E0B") SetChrFlags(0x12, 0x10) SetChrFlags(0x11, 0x10) TalkBegin(0x12) OP_4A(0x1B, 255) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x9)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_77F3") ChrTalk( #178 0x1B, "#1314F...Oh, I see.\x02", ) CloseMessageWindow() Jump("loc_7808") label("loc_77F3") ChrTalk( #179 0x11, "#1445FReally...\x02", ) CloseMessageWindow() label("loc_7808") ChrTalk( #180 0x12, ( "#060F...Yeah.\x02\x03", "#563FI only know part of the story...\x02\x03", "...but I think Loewe must've always wanted\x01", "a chance to properly say goodbye to Joshua,\x01", "too.\x02\x03", "I'm happy he was finally given that chance.\x02\x03", "And that Joshua was able to say a proper\x01", "goodbye to him, too.\x02\x03", "#066FI'm sure Joshua's just as happy in his own way.\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x9)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_7968") ChrTalk( #181 0x1B, "#816FYeah. Me, too.\x02", ) CloseMessageWindow() label("loc_7968") ChrTalk( #182 0x11, "#1448F...Indeed.\x02", ) CloseMessageWindow() Sleep(300) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_7C35") OP_51(0x110, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x11, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0x11) ClearChrFlags(0x11, 0x10) TurnDirection(0x11, 0x110, 0) OP_51(0x11, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x11, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x11, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_7A21") Jump("loc_7A63") label("loc_7A21") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_7A3D") OP_51(0x11, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_7A63") label("loc_7A3D") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_7A59") OP_51(0x11, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_7A63") label("loc_7A59") OP_51(0x11, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0x11, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_7A63") OP_51(0x11, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x110, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x110, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x11, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0x11, 0x10) Sleep(200) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4C8, 4)), scpexpr(EXPR_END)), "loc_7AD9") ChrTalk( #183 0x11, ( "#1962FI'm glad Renne was able to say goodbye to him\x01", "as well.\x02", ) ) CloseMessageWindow() Jump("loc_7B3B") label("loc_7AD9") ChrTalk( #184 0x11, ( "#1802FStill...\x02\x03", "#1445F...it's a shame you weren't able to say goodbye\x01", "to him as well, Renne.\x02", ) ) CloseMessageWindow() label("loc_7B3B") ChrTalk( #185 0x110, ( "#269FA shame, huh? I never expected to hear something\x01", "like that from you.\x02\x03", "#263FNevertheless, I appreciate the sentiment.\x02\x03", "Perhaps now that you have, you could read him\x01", "a story from the Testaments?\x02", ) ) CloseMessageWindow() ChrTalk( #186 0x11, "#1448F...It would be my pleasure.\x02", ) CloseMessageWindow() SetChrSubChip(0x11, 0) Jump("loc_7DF4") label("loc_7C35") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4C8, 4)), scpexpr(EXPR_END)), "loc_7D05") ChrTalk( #187 0x11, ( "#1447FI'm glad Renne was able to say goodbye to him\x01", "as well.\x02\x03", "#1806FIt's always a painful thing to have to part with\x01", "someone, but it's even more painful to not have\x01", "the chance to say farewell.\x02", ) ) CloseMessageWindow() Jump("loc_7DF4") label("loc_7D05") ChrTalk( #188 0x11, ( "#1806FI just wish Renne would have had a chance to say\x01", "goodbye to him as well.\x02\x03", "#1445FIt's always a painful thing to have to part with\x01", "someone, but it's even more painful to not have\x01", "the chance to say farewell...especially to family.\x02", ) ) CloseMessageWindow() label("loc_7DF4") OP_A2(0x2664) ClearChrFlags(0x12, 0x10) ClearChrFlags(0x11, 0x10) OP_4B(0x1B, 255) TalkEnd(0x12) Jump("loc_80D5") label("loc_7E0B") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_7E9B") Jump("loc_7EDD") label("loc_7E9B") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_7EB7") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_7EDD") label("loc_7EB7") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_7ED3") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_7EDD") label("loc_7ED3") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_7EDD") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_7FDB") ChrTalk( #189 0x12, ( "#060FI only know part of the story...\x02\x03", "#563F...but I think Loewe must've always wanted\x01", "a chance to properly say goodbye to Joshua.\x02\x03", "#066FAnd to Renne, too.\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_7FD5") ChrTalk( #190 0x110, "#263F...Heehee. Maybe.\x02", ) CloseMessageWindow() label("loc_7FD5") OP_A2(0x0) Jump("loc_80BA") label("loc_7FDB") ChrTalk( #191 0x12, ( "#060FWhenever I met Loewe back when he was still alive,\x01", "he always looked so...lonely, somehow.\x02\x03", "#564FThat was my first impression of him when we first\x01", "met, too.\x02\x03", "#067FHeehee. At least he's not lonely any more, though.\x02", ) ) CloseMessageWindow() label("loc_80BA") SetChrSubChip(0xFE, 0) TalkEnd(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_80D5") SetChrSubChip(0xFE, 2) label("loc_80D5") Jump("loc_955D") label("loc_80D8") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x561, 0)), scpexpr(EXPR_END)), "loc_8A7D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_87DD") RunExpression(0x2, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x8), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) RunExpression(0x3, (scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x8), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0x12) ClearChrFlags(0x12, 0x10) TurnDirection(0x12, 0x0, 0) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_8191") Jump("loc_81D3") label("loc_8191") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_81AD") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_81D3") label("loc_81AD") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_81C9") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_81D3") label("loc_81C9") OP_51(0x12, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_81D3") OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0x12, 0x10) ChrTalk( #192 0x12, ( "#064FPhillip is Duke Dunan's butler, isn't he?\x02\x03", "#063FWhat was the Lord of Phantasma thinking by\x01", "dragging him into all of this? He's got nothing\x01", "to do with it...\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_836A") ChrTalk( #193 0x110, ( "#263FOh, but if you ask me, they really know how to\x01", "keep things interesting.\x02\x03", "#260FI've taken a liking to them, to be honest.\x02\x03", "#261FI can't wait to finally get to face them head on.\x02", ) ) CloseMessageWindow() Jump("loc_851C") label("loc_836A") OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x20, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0x20) ClearChrFlags(0x20, 0x10) TurnDirection(0x20, 0x12, 0) OP_51(0x20, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x20, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x20, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_83FA") Jump("loc_843C") label("loc_83FA") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_8416") OP_51(0x20, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_843C") label("loc_8416") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_8432") OP_51(0x20, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_843C") label("loc_8432") OP_51(0x20, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_843C") OP_51(0x20, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x20, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0x20, 0x10) ChrTalk( #194 0x20, ( "#263FOh, but if you ask me, they really know how to\x01", "keep things interesting.\x02\x03", "#260FI've taken a liking to them, to be honest.\x02\x03", "#261FI can't wait to finally get to face them head on.\x02", ) ) CloseMessageWindow() label("loc_851C") ChrTalk( #195 0x109, ( "#1066FJuuust don't think of trying to go off\x01", "on your own, okay?\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_8669") OP_51(0x110, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0x12) ClearChrFlags(0x12, 0x10) TurnDirection(0x12, 0x110, 0) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_85FF") Jump("loc_8641") label("loc_85FF") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_861B") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_8641") label("loc_861B") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_8637") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_8641") label("loc_8637") OP_51(0x12, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_8641") OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x110, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x110, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0x12, 0x10) Jump("loc_8760") label("loc_8669") OP_51(0x20, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0x12) ClearChrFlags(0x12, 0x10) TurnDirection(0x12, 0x20, 0) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_86F9") Jump("loc_873B") label("loc_86F9") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_8715") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_873B") label("loc_8715") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_8731") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_873B") label("loc_8731") OP_51(0x12, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_873B") OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x20, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0x12, 0x10) label("loc_8760") ChrTalk( #196 0x12, ( "#562FS-Seriously...\x02\x03", "That'd be really, really dangerous...\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_87BD") ChrTalk( #197 0x10F, "#1440F...\x02", ) CloseMessageWindow() label("loc_87BD") ClearChrFlags(0xFE, 0x10) OP_A2(0x0) TalkEnd(0xFE) OP_51(0x12, 0x8, (scpexpr(EXPR_GET_RESULT, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x20, 0x8, (scpexpr(EXPR_GET_RESULT, 0x3), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_8A7A") label("loc_87DD") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_88ED") OP_51(0x110, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0x12) ClearChrFlags(0x12, 0x10) TurnDirection(0x12, 0x110, 0) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_8883") Jump("loc_88C5") label("loc_8883") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_889F") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_88C5") label("loc_889F") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_88BB") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_88C5") label("loc_88BB") OP_51(0x12, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_88C5") OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x110, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x110, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0x12, 0x10) Jump("loc_89E4") label("loc_88ED") OP_51(0x20, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0x12) ClearChrFlags(0x12, 0x10) TurnDirection(0x12, 0x20, 0) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_897D") Jump("loc_89BF") label("loc_897D") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_8999") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_89BF") label("loc_8999") Jc((scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_89B5") OP_51(0x12, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_89BF") label("loc_89B5") OP_51(0x12, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0x12, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_89BF") OP_51(0x12, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x20, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x20, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x12, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0x12, 0x10) label("loc_89E4") ChrTalk( #198 0x12, ( "#562FTrying to proceed on your own would be really,\x01", "REALLY dangerous, Renne.\x02\x03", "Please don't try and do that...\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_8A6D") SetChrSubChip(0xFE, 0) Jump("loc_8A72") label("loc_8A6D") SetChrSubChip(0xFE, 1) label("loc_8A72") ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_8A7A") Jump("loc_955D") label("loc_8A7D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x560, 0)), scpexpr(EXPR_END)), "loc_8D51") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_8C3C") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_8B22") Jump("loc_8B64") label("loc_8B22") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_8B3E") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_8B64") label("loc_8B3E") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_8B5A") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_8B64") label("loc_8B5A") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_8B64") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) ChrTalk( #199 0x12, ( "#064FOh, Renne! Heehee.\x01", "#061FWe'll have to talk again later.\x02\x03", "I still want to finish our conversation from\x01", "earlier.\x02", ) ) CloseMessageWindow() ChrTalk( #200 0x110, "#261FI'd be delighted.\x02", ) CloseMessageWindow() SetChrSubChip(0xFE, 0) TalkEnd(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x9)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_8C39") SetChrSubChip(0xFE, 1) label("loc_8C39") Jump("loc_8D4E") label("loc_8C3C") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #201 0x12, "#061FSo then I decided to give him a name...\x02", ) CloseMessageWindow() ChrTalk( #202 0x20, ( "#261FI raised a cat once before, too, you know.\x02\x03", "#265FThe professor called him a Steel Cougar,\x01", "if I recall...\x02", ) ) CloseMessageWindow() OP_62(0xFE, 0x0, 1700, 0x28, 0x2B, 0x64, 0x3) Sleep(1000) ChrTalk( #203 0x12, ( "#065FTh-That doesn't sound like the kind of cat\x01", "I'm thinking of!\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_8D4E") Jump("loc_955D") label("loc_8D51") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 7)), scpexpr(EXPR_END)), "loc_955D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_93A0") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_8F83") TalkBegin(0xFE) TurnDirection(0xFE, 0x110, 0) ChrTalk( #204 0x12, "#064FOooh, Renne!\x02", ) CloseMessageWindow() ChrTalk( #205 0x110, "#264FWhat are you doing here, Tita?\x02", ) CloseMessageWindow() ChrTalk( #206 0x12, ( "#060FOh, I was sort of just wandering aimlessly\x01", "while I was preoccupied.\x02\x03", "#061FSeeing you again made me remember all the\x01", "fun things we did together before, so I've been\x01", "thinking about those.\x02\x03", "Like that time we went shopping and bought\x01", "those really pretty brooches and stuff.\x02", ) ) CloseMessageWindow() ChrTalk( #207 0x110, ( "#260FHeehee. Oh, right.\x02\x03", "#267FThat reminds me, though...\x01", "I found one exactly like them in a tiny little\x01", "shop a while back.\x02\x03", "#261FThe jewel in the middle was red, though.\x02", ) ) CloseMessageWindow() Jump("loc_901C") label("loc_8F83") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #208 0x20, ( "#261F...But guess what? I found a brooch exactly\x01", "like the ones we bought a while back there.\x02\x03", "#265FThe jewel in the middle was red, though.\x02", ) ) CloseMessageWindow() label("loc_901C") ChrTalk( #209 0x12, ( "#064FAww... You're so lucky.\x02\x03", "They were all sold out of those in the shop\x01", "in Grancel.\x02\x03", "#562F*sigh* I really wanted a red one, too...\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_91B4") ChrTalk( #210 0x110, ( "#265FI know! Why don't we go on a shopping trip\x01", "together sometime, then? We could go to\x01", "somewhere reeeally far away.\x02\x03", "#269FYou'd like the Eastern Quarter in Calvard,\x01", "that's for sure. You could spend a whole day\x01", "shopping there and never feel bored.\x02", ) ) CloseMessageWindow() Jump("loc_92B1") label("loc_91B4") ChrTalk( #211 0x20, ( "#265FI know! Why don't we go on a shopping trip\x01", "together sometime, then? We could go to\x01", "somewhere reeeally far away.\x02\x03", "#269FYou'd like the Eastern Quarter in Calvard,\x01", "that's for sure. You could spend a whole day\x01", "shopping there and never feel bored.\x02", ) ) CloseMessageWindow() label("loc_92B1") ChrTalk( #212 0x12, ( "#064FR-Really?\x02\x03", "#061FI wonder what kinds of cute accessories\x01", "they'd have there?\x02\x03", "#560FOh, yeah! Let me tell you about the pendant \x01", "I bought a while back!\x02", ) ) CloseMessageWindow() ChrTalk( #213 0x101, ( "#1016F(It looks like they're back to good times\x01", "in no time.)\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) OP_A2(0x2662) TalkEnd(0xFE) Jump("loc_955D") label("loc_93A0") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_94DE") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_9487") TalkBegin(0xFE) TurnDirection(0x12, 0x110, 0) ChrTalk( #214 0x12, ( "#061FWe'll have to go shopping together again\x01", "sometime!\x02", ) ) CloseMessageWindow() ChrTalk( #215 0x110, ( "#260F...Sure. I wouldn't mind.\x02\x03", "#263FBut first we're going to have to get out of\x01", "Phantasma, aren't we?\x02", ) ) CloseMessageWindow() ChrTalk( #216 0x12, "#064F...Oh, right.\x02", ) CloseMessageWindow() TalkEnd(0xFE) Jump("loc_94D8") label("loc_9487") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #217 0x12, ( "#065FWh-What? Really?!\x02\x03", "#067F...I kinda want to see it now.\x02", ) ) CloseMessageWindow() TalkEnd(0xFE) ClearChrFlags(0xFE, 0x10) label("loc_94D8") OP_A2(0x0) Jump("loc_955D") label("loc_94DE") TalkBegin(0xFE) ChrTalk( #218 0x12, ( "#560FRenne's so lucky to be able to visit all\x01", "those shops, isn't she?\x02\x03", "#067FI want to go and see more of them, too!\x02", ) ) CloseMessageWindow() TalkEnd(0xFE) label("loc_955D") Return() # Function_8_735E end def Function_9_955E(): pass label("Function_9_955E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 4)), scpexpr(EXPR_END)), "loc_95BA") TalkBegin(0xFE) ChrTalk( #219 0x1B, "#814FHuh? Did something happen?\x02", ) CloseMessageWindow() ChrTalk( #220 0x109, "#1075FNothing to worry about, no.\x02", ) CloseMessageWindow() TalkEnd(0xFE) Jump("loc_ABCE") label("loc_95BA") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 3)), scpexpr(EXPR_END)), "loc_9A3D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4CC, 4)), scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_9885") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_9748") TurnDirection(0xFE, 0x102, 0) ChrTalk( #221 0x1B, ( "#1316FHmm... Okay, so...I'm not really sure on the\x01", "details of what happened...\x02\x03", "#816F...but I know one thing for sure.\x02\x03", "#811FYou're looking a lot brighter and more positive\x01", "now, Joshua.\x02", ) ) CloseMessageWindow() ChrTalk( #222 0x102, ( "#1504FReally?\x02\x03", "#1513F...Thanks.\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x0)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_9742") TurnDirection(0xFE, 0x101, 400) Sleep(300) ChrTalk( #223 0x1B, "#816FThat goes for you, too, Estelle!\x02", ) CloseMessageWindow() ChrTalk( #224 0x101, "#1017FA-Ahaha... Really?\x02", ) CloseMessageWindow() label("loc_9742") OP_A2(0x9) Jump("loc_987F") label("loc_9748") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_97B0") TurnDirection(0xFE, 0x102, 0) ChrTalk( #225 0x1B, ( "#816FYou look a lot more positive now, Joshua.\x02\x03", "#811FI'm so happy for you!\x02", ) ) CloseMessageWindow() Jump("loc_987F") label("loc_97B0") ChrTalk( #226 0x1B, ( "#817FI don't know that much about Joshua and Loewe's\x01", "relationship, either...\x02\x03", "#1314F...but what happened seems to have gone a long\x01", "way in helping him move forward, at least. That's\x01", "a good thing, right?\x02", ) ) CloseMessageWindow() label("loc_987F") TalkEnd(0xFE) Jump("loc_9A3A") label("loc_9885") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_98A5") Call(5, 8) Jump("loc_9A3A") label("loc_98A5") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_998A") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #227 0x1B, ( "#1314FWell, I'm not really that filled in on the whole\x01", "thing, to be honest.\x02\x03", "#813FFrom what I know, Loewe was like a brother\x01", "to Joshua.\x02\x03", "#817FBut during what happened on the Liber Ark,\x01", "he...\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_9A3A") label("loc_998A") TalkBegin(0xFE) ChrTalk( #228 0x1B, ( "#817FUmm...\x02\x03", "Loewe was basically like a brother to Joshua,\x01", "right?\x02\x03", "#813FI wasn't able to go to the Liber Ark with you guys,\x01", "so I'm not clued up on all this stuff...\x02", ) ) CloseMessageWindow() TalkEnd(0xFE) label("loc_9A3A") Jump("loc_ABCE") label("loc_9A3D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x564, 0)), scpexpr(EXPR_END)), "loc_9DC8") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_9A96") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #229 0x1B, ( "#814FH-Huh...?!\x02\x03", "#1317FWhere did everyone go?!\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) OP_A2(0x9) TalkEnd(0xFE) Jump("loc_9DC5") label("loc_9A96") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_9BDE") OP_62(0x1B, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(1000) TurnDirection(0x1B, 0x107, 500) ChrTalk( #230 0x1B, "#1310FOh! There you two are!\x02", ) CloseMessageWindow() ChrTalk( #231 0x107, "#067FHeehee...\x02", ) CloseMessageWindow() ChrTalk( #232 0x110, ( "#263FWe're off for a while.\x02\x03", "#260FWe'll talk with you again later,\x01", "though, okay?\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xE)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_9BDB") ChrTalk( #233 0x1B, ( "#818FAww...\x02\x03", "#1311FOkay, then... But you'll have to come and join us,\x01", "too, Ries. ㈱\x02", ) ) CloseMessageWindow() ChrTalk( #234 0x10F, "#1802FO-Oh...\x02", ) CloseMessageWindow() label("loc_9BDB") Jump("loc_9DBD") label("loc_9BDE") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_9CA4") OP_62(0x1B, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(1000) TurnDirection(0x1B, 0x107, 500) ChrTalk( #235 0x1B, ( "#1310FOh!! I spy a Tita!\x02\x03", "#811FC'mere and give me a cuddle!\x02", ) ) CloseMessageWindow() ChrTalk( #236 0x107, ( "#067FU-Umm...\x02\x03", "#560FI-I've gotta head out now... We'll talk later,\x01", "though, okay?\x02", ) ) CloseMessageWindow() Jump("loc_9DBD") label("loc_9CA4") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_9D45") OP_62(0x1B, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(1000) TurnDirection(0x1B, 0x110, 500) ChrTalk( #237 0x1B, "#1310FOh!! I spy a Renne!\x02", ) CloseMessageWindow() ChrTalk( #238 0x110, ( "#263FHeehee. We're off to explore now.\x02\x03", "#260FWe can talk again later, though.\x02", ) ) CloseMessageWindow() Jump("loc_9DBD") label("loc_9D45") ChrTalk( #239 0x1B, ( "#1316FTita and Renne were here before, too.\x02\x03", "#818FI guess they must've wandered off while\x01", "I was taking a nap here.\x02", ) ) CloseMessageWindow() label("loc_9DBD") ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_9DC5") Jump("loc_ABCE") label("loc_9DC8") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x562, 5)), scpexpr(EXPR_END)), "loc_9FB5") SetChrFlags(0x21, 0x10) TalkBegin(0x21) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_9F23") OP_A2(0x9) ChrTalk( #240 0x21, ( "#1311F#60WZzz... Mmm...#20W\x02\x03", "#819F#60WAhaha... Wait for meee...#20W\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x0)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_9E59") ChrTalk( #241 0x101, "#1016FU-Umm... Anelace...?\x02", ) CloseMessageWindow() label("loc_9E59") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_9E8A") ChrTalk( #242 0x102, "#1514FShe's fast asleep...\x02", ) CloseMessageWindow() Jump("loc_9F20") label("loc_9E8A") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x2)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_9ED7") ChrTalk( #243 0x103, "#1526F*sigh* She really can sleep anywhere, can't she?\x02", ) CloseMessageWindow() Jump("loc_9F20") label("loc_9ED7") ChrTalk( #244 0x109, ( "#1068FI wonder what she's chasing in that bizarre\x01", "dream of hers...?\x02", ) ) CloseMessageWindow() label("loc_9F20") Jump("loc_9FAA") label("loc_9F23") OP_9E(0x21, 0x14, 0x0, 0xC8, 0xBB8) Sleep(300) OP_9E(0x21, 0x14, 0x0, 0x1F4, 0xFA0) Sleep(200) ChrTalk( #245 0x21, ( "#1311F#60WHeehee... I got youuu...\x02\x03", "Now I can go to the Plushy Kingdom, too... ♪\x02", ) ) CloseMessageWindow() label("loc_9FAA") ClearChrFlags(0x21, 0x10) TalkEnd(0x21) Jump("loc_ABCE") label("loc_9FB5") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x561, 0)), scpexpr(EXPR_END)), "loc_A516") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x561, 1)), scpexpr(EXPR_END)), "loc_A2A4") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x561, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_A1E5") ChrTalk( #246 0x1B, "#814FOh, 'sup? Anything wrong?\x02", ) CloseMessageWindow() ChrTalk( #247 0x109, "#1078FWell...\x02", ) CloseMessageWindow() FadeToDark(300, 0, 100) SetChrName("") SetMessageWindowPos(72, 320, 56, 3) AnonymousTalk( #248 ( "\x07\x05Kevin explained to Anelace that they thought she was the person the amberl\x01", "monument's inscription was asking for.\x02", ) ) CloseMessageWindow() OP_56(0x0) FadeToBright(300, 0) OP_0D() Sleep(500) ChrTalk( #249 0x1B, ( "#814FMe? The 'sword-wielding dame'?\x02\x03", "#818FI dunnooo... I mean, it's a cool-sounding title\x01", "and all, but does it really fit me?\x02", ) ) CloseMessageWindow() ChrTalk( #250 0x109, ( "#1066FIt does if you ask me. But hey, even if you're\x01", "not sure, it's worth a try, right?\x02\x03", "Do you mind coming with us and giving it a go?\x02", ) ) CloseMessageWindow() ChrTalk( #251 0x1B, ( "#814FYou got it.\x02\x03", "#810FOff we go, then!\x02", ) ) CloseMessageWindow() OP_A2(0x2B0B) Jump("loc_A29E") label("loc_A1E5") ChrTalk( #252 0x1B, ( "#818FI'm still not sure I'm the person that monument\x01", "wants, but it's worth a try, at least.\x02\x03", "#810FSo just let me know when you're ready to go back\x01", "there. I'm ready to go any time.\x02", ) ) CloseMessageWindow() label("loc_A29E") TalkEnd(0xFE) Jump("loc_A513") label("loc_A2A4") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_A3F1") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4C7, 7)), scpexpr(EXPR_END)), "loc_A36A") ChrTalk( #253 0x1B, ( "#1317FD-Damn. I didn't think he was going to be\x01", "that powerful...\x02\x03", "#1316FThat fancy-schmancy skill of his was just\x01", "cheating...\x02\x03", "#815FHow can you even DO that with a sword?!\x02", ) ) CloseMessageWindow() Jump("loc_A3EB") label("loc_A36A") ChrTalk( #254 0x1B, ( "#814FPhillip was that duke's butler, right?\x02\x03", "#818FWas he really that strong?\x02\x03", "He didn't really look it when I last saw him.\x02", ) ) CloseMessageWindow() label("loc_A3EB") OP_A2(0x9) Jump("loc_A510") label("loc_A3F1") ChrTalk( #255 0x1B, ( "#1316F*sigh* I guess if I couldn't tell his true strength,\x01", "that means I've got a long way to go.\x02\x03", "#812FAll right! Time to get Richard to join me for \x01", "some more training!\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xB)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_A510") TurnDirection(0x1B, 0x10C, 400) Sleep(500) ChrTalk( #256 0x1B, "#815FWell? Would you be willing to?\x02", ) CloseMessageWindow() ChrTalk( #257 0x10C, "#111FHaha... I'll give it some thought.\x02", ) CloseMessageWindow() label("loc_A510") TalkEnd(0xFE) label("loc_A513") Jump("loc_ABCE") label("loc_A516") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x560, 0)), scpexpr(EXPR_END)), "loc_ABCE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_A9DF") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_A7A6") TalkBegin(0xFE) ChrTalk( #258 0x1B, ( "#817FSooo...\x02\x03", "...this world is on a high-level plane, repeating a \x01", "process of self-organization and creation in order\x01", "to realize the desires of humanity, operating on...\x02\x03", "...\x01", "...\x01", "...\x02", ) ) CloseMessageWindow() OP_9E(0x1B, 0x14, 0x0, 0x320, 0xBB8) Sleep(1000) ChrTalk( #259 0x1B, "#819F...Blaaarghhh...\x02", ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x0)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_A66C") ChrTalk( #260 0x101, "#1004FI think her head just exploded.\x02", ) CloseMessageWindow() Jump("loc_A7A3") label("loc_A66C") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_A6E0") ChrTalk( #261 0x102, ( "#1512FAnelace, you don't need to force yourself to\x01", "understand how this world works, you know.\x02", ) ) CloseMessageWindow() Jump("loc_A7A3") label("loc_A6E0") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x2)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_A754") ChrTalk( #262 0x103, ( "#1525FAnelace, you don't need to force yourself to\x01", "understand how this world works, you know.\x02", ) ) CloseMessageWindow() Jump("loc_A7A3") label("loc_A754") ChrTalk( #263 0x107, "#065FA-Anelace! Hang in there!\x02", ) CloseMessageWindow() ChrTalk( #264 0x109, "#1068FI think her head just exploded.\x02", ) CloseMessageWindow() label("loc_A7A3") Jump("loc_A9D1") label("loc_A7A6") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_A859") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) TurnDirection(0xFE, 0x110, 0) ChrTalk( #265 0x1B, ( "#816FSo you like plushies, too, huh, Renne?\x02\x03", "#811FWe're gonna have to sit and talk about\x01", "them later, then!\x02\x03", "I need to find out just HOW MUCH.\x02", ) ) CloseMessageWindow() Jump("loc_A9D1") label("loc_A859") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #266 0x1B, ( "#814FWhat? You've got that really rare Landmore\x01", "limited edition plushie?\x02\x03", "#1317FI really want that one, too! You're so lucky...\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x0)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_A911") ChrTalk( #267 0x101, "#1016F(A-Anelace...)\x02", ) CloseMessageWindow() Jump("loc_A967") label("loc_A911") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_A941") ChrTalk( #268 0x102, "#1512F(Umm... Anelace...)\x02", ) CloseMessageWindow() Jump("loc_A967") label("loc_A941") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x2)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_A967") ChrTalk( #269 0x103, "#1525F(I swear...)\x02", ) CloseMessageWindow() label("loc_A967") ChrTalk( #270 0x109, ( "#1068F(I think she's probably the one least bothered\x01", "about what's going on here out of all of us...)\x02", ) ) CloseMessageWindow() label("loc_A9D1") ClearChrFlags(0xFE, 0x10) OP_A2(0x9) TalkEnd(0xFE) Jump("loc_ABCE") label("loc_A9DF") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_EXEC_OP, "OP_42(0x6)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_AA6A") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #271 0x1B, ( "#817FSo what's a girl gotta do to get plushies to pop\x01", "up out of nowhere?\x02\x03", "Hmm...\x02\x03", "#1312FHmmmmm...\x02", ) ) CloseMessageWindow() Jump("loc_ABC6") label("loc_AA6A") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xF)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_AB1C") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) TurnDirection(0xFE, 0x110, 0) ChrTalk( #272 0x1B, ( "#816FSo you like plushies, too, huh, Renne?\x02\x03", "#811FWe're gonna have to sit and talk about them later,\x01", "then! I need to find out just HOW MUCH.\x02", ) ) CloseMessageWindow() Jump("loc_ABC6") label("loc_AB1C") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #273 0x1B, ( "#812FI was all set on going to get that one when it \x01", "came out...\x02\x03", "#1316F...but then this major job came in all of a sudden\x01", "and I couldn't go out and buy it.\x02", ) ) CloseMessageWindow() label("loc_ABC6") ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_ABCE") Return() # Function_9_955E end def Function_10_ABCF(): pass label("Function_10_ABCF") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 3)), scpexpr(EXPR_END)), "loc_AF10") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_AD23") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_AC8B") ChrTalk( #274 0x15, ( "#416F...Okay. That should do for now.\x02\x03", "#210FIt always pays to give your gun a good polish once\x01", "in a while to keep it in top working condition.\x02", ) ) CloseMessageWindow() Jump("loc_AD15") label("loc_AC8B") ChrTalk( #275 0x15, ( "#213FHey, take it easy. Everyone needs to rest from\x01", "time to time, you know.\x02\x03", "#212FCome on! Have a drink of this and take a load\x01", "off.\x02", ) ) CloseMessageWindow() label("loc_AD15") ClearChrFlags(0xFE, 0x10) OP_A2(0x4) TalkEnd(0xFE) Jump("loc_AF10") label("loc_AD23") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_ADD0") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) TurnDirection(0xFE, 0x102, 0) ChrTalk( #276 0x15, ( "#213FOh, Joshua...\x02\x03", "#215FUmm... Umm...\x02", ) ) CloseMessageWindow() ChrTalk( #277 0x102, ( "#1513FI'm fine.\x02\x03", "#1501FThanks for worrying about me, Josette.\x02", ) ) CloseMessageWindow() ChrTalk( #278 0x15, "#414FO-Oh, right...\x02", ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) Jump("loc_AF0D") label("loc_ADD0") TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_AE86") ChrTalk( #279 0x15, ( "#210FOrbal guns are pretty delicate things, so you need\x01", "to take them apart and give them a good clean once\x01", "in a while to keep them in top working condition.\x02", ) ) CloseMessageWindow() Jump("loc_AF0D") label("loc_AE86") ChrTalk( #280 0x15, ( "#416FI swear, this princess...\x02\x03", "#212FI don't know why she won't just rely on us some\x01", "instead of trying to investigate by herself.\x02", ) ) CloseMessageWindow() label("loc_AF0D") TalkEnd(0xFE) label("loc_AF10") Return() # Function_10_ABCF end def Function_11_AF11(): pass label("Function_11_AF11") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 3)), scpexpr(EXPR_END)), "loc_B190") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_B066") ChrTalk( #281 0x13, ( "#175FWhile this is just my personal belief, and I will never\x01", "have a chance to find out if it is right...\x02\x03", "#170F...I can't help but feel that 2nd Lieutenant Lorence\x01", "may have admired the colonel on a personal level,\x01", "too.\x02\x03", "#179FI don't have any hard evidence to back up my\x01", "belief, of course. Just call it instinct.\x02", ) ) CloseMessageWindow() OP_A2(0x2) Jump("loc_B18A") label("loc_B066") ChrTalk( #282 0x13, ( "#176FWhile there's no doubt that 2nd Lieutenant Lorence\x01", "used the Intelligence Division, I don't think that was\x01", "the only reason he served in it.\x02\x03", "#170FWhile I don't have any hard evidence to back up\x01", "my belief, I feel as though he felt a genuine sense\x01", "of loyalty to the organization, too.\x02", ) ) CloseMessageWindow() label("loc_B18A") TalkEnd(0xFE) Jump("loc_CB18") label("loc_B190") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x564, 0)), scpexpr(EXPR_END)), "loc_B19A") Jump("loc_CB18") label("loc_B19A") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x562, 5)), scpexpr(EXPR_END)), "loc_B3D5") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_B329") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4C8, 2)), scpexpr(EXPR_END)), "loc_B242") ChrTalk( #283 0x13, ( "#179FI had hoped to meet Kilika one day...\x02\x03", "#178F...but I hadn't expected she would be quite that\x01", "much of a force to be reckoned with.\x02", ) ) CloseMessageWindow() Jump("loc_B323") label("loc_B242") ChrTalk( #284 0x13, ( "#178FI'd heard Kilika was able to make her way through\x01", "one of the shadow towers alone, so she is clearly\x01", "a force to be reckoned with.\x02\x03", "#179FI wish I had been able to meet her while she was\x01", "still in Liberl, to be honest.\x02", ) ) CloseMessageWindow() label("loc_B323") OP_A2(0x2) Jump("loc_B3CF") label("loc_B329") ChrTalk( #285 0x13, ( "#175FRegardless, at least now we are half way through\x01", "this plane.\x02\x03", "#176FPerhaps now would be a good time to make sure\x01", "everyone is well trained and battle ready.\x02", ) ) CloseMessageWindow() label("loc_B3CF") TalkEnd(0xFE) Jump("loc_CB18") label("loc_B3D5") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x561, 0)), scpexpr(EXPR_END)), "loc_B817") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_B727") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_B51B") TurnDirection(0xFE, 0x104, 0) ChrTalk( #286 0x104, ( "#1541FWhy, hello, Julia.\x02\x03", "It's occurred to me that I never did properly\x01", "thank you for your assistance during my return\x01", "to Erebonia.\x02\x03", "#1547FSo, what say you? Would you like to accompany\x01", "me for a drink or two? On me, of course.\x02", ) ) CloseMessageWindow() ChrTalk( #287 0x13, "#172FI... Well... I'm not sure that would be...\x02", ) CloseMessageWindow() Jump("loc_B6E7") label("loc_B51B") ChrTalk( #288 0x13, ( "#175FPrince Olivert seems rather insistent on me\x01", "accompanying him for drinks. I'm not sure\x01", "what to do...\x02\x03", "#176FP-Perhaps it would be best for me to accept\x01", "his offer?\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x0)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_B654") ChrTalk( #289 0x101, ( "#1007FI swear, that Olivier...\x02\x03", "#1009FThe best thing to do is to ignore him, Julia!\x01", "Just pretend he doesn't even exist.\x02", ) ) CloseMessageWindow() Jump("loc_B6E7") label("loc_B654") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_B6B8") ChrTalk( #290 0x102, ( "#1512FI think the best thing to do would be to refuse.\x01", "In no uncertain terms.\x02", ) ) CloseMessageWindow() Jump("loc_B6E7") label("loc_B6B8") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_B6E7") ChrTalk( #291 0x105, "#1165FAhaha... Weeeeeell...\x02", ) CloseMessageWindow() label("loc_B6E7") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0xC)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_B721") ChrTalk( #292 0x10D, "#272FFeel free to ignore him, Captain.\x02", ) CloseMessageWindow() label("loc_B721") OP_A2(0x2) Jump("loc_B811") label("loc_B727") ChrTalk( #293 0x13, ( "#176F*cough* The prince aside...\x02\x03", "#178F...I'm still rather surprised that Phillip was one of\x01", "those recreated in this world.\x02\x03", "#175FAll of this just makes me wish that I could have\x01", "the chance to learn from him in the real world...\x02", ) ) CloseMessageWindow() label("loc_B811") TalkEnd(0xFE) Jump("loc_CB18") label("loc_B817") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x560, 0)), scpexpr(EXPR_END)), "loc_BA1B") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_B963") ChrTalk( #294 0x13, ( "#179FI never would have imagined the very ghost who\x01", "aided us all this time was an ancestor of the\x01", "Liberlian royal family.\x02\x03", "#171FHaha. Still, I can hardly imagine a more reassuring\x01", "revelation.\x02\x03", "#170FI'd like to think that with her help, we may be\x01", "able to compete against the Lord of Phantasma\x01", "after all.\x02", ) ) CloseMessageWindow() OP_A2(0x2) Jump("loc_BA15") label("loc_B963") ChrTalk( #295 0x13, ( "#170FIt's far too soon to be getting optimistic about\x01", "our odds of success...\x02\x03", "...but with Celeste's help, we may be able to\x01", "compete against the Lord of Phantasma after\x01", "all.\x02", ) ) CloseMessageWindow() label("loc_BA15") TalkEnd(0xFE) Jump("loc_CB18") label("loc_BA1B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 7)), scpexpr(EXPR_END)), "loc_BDCE") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_BAB2") Jump("loc_BAF4") label("loc_BAB2") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_BACE") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_BAF4") label("loc_BACE") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_BAEA") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_BAF4") label("loc_BAEA") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_BAF4") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_BCC6") ChrTalk( #296 0x13, ( "#176FIt's amazing to think that this world is where\x01", "people's thoughts become reality...\x02\x03", "#175FEven after all we've seen so far, I still find\x01", "myself doubting that could even be possible,\x01", "but it certainly makes sense.\x02\x03", "Still, if we assume that everything that's \x01", "happened so far has gone according to plan\x01", "for the Lord of Phantasma...\x02\x03", "#170F...then I think it's about time we started trying\x01", "to change that, hmm?\x02", ) ) CloseMessageWindow() OP_A2(0x2) Jump("loc_BDC3") label("loc_BCC6") ChrTalk( #297 0x13, ( "#176FEven after all we've seen so far, I still find\x01", "myself doubting that what Renne said could even\x01", "be possible, but I can't deny her logic...\x02\x03", "Still, enough is enough.\x02\x03", "#170FI think the Lord of Phantasma has had things their\x01", "way for far too long.\x02", ) ) CloseMessageWindow() label("loc_BDC3") SetChrSubChip(0xFE, 0) TalkEnd(0xFE) Jump("loc_CB18") label("loc_BDCE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 4)), scpexpr(EXPR_END)), "loc_C1BB") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_C102") ChrTalk( #298 0x13, ( "#170FBoth General Morgan and Brigadier General Bright\x01", "did their best to stop Richard from leaving the army\x01", "when he made his decision to do so.\x02\x03", "No one denies that he made a mistake, but he was\x01", "an exceptionally skilled soldier, and the military is\x01", "worse off without him.\x02\x03", "#179FI've heard rumors that Brigadier General Bright\x01", "hasn't given up on bringing him back into the\x01", "ranks yet, even.\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_BFF3") ChrTalk( #299 0x105, "#1165FThat sounds just like something he would do.\x02", ) CloseMessageWindow() ChrTalk( #300 0x101, ( "#1007FYeah... He's never been one for giving people\x01", "a break.\x02", ) ) CloseMessageWindow() Jump("loc_C0FC") label("loc_BFF3") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_C08E") ChrTalk( #301 0x102, ( "#1508FPresumably so that he can offload more of\x01", "his work onto him.\x02", ) ) CloseMessageWindow() ChrTalk( #302 0x101, ( "#1007FYeah... He's never been one for giving people\x01", "a break.\x02", ) ) CloseMessageWindow() Jump("loc_C0FC") label("loc_C08E") ChrTalk( #303 0x101, ( "#1019FYou've got to be kidding me...\x02\x03", "#1007FHe really doesn't believe in giving people\x01", "a break, does he?\x02", ) ) CloseMessageWindow() label("loc_C0FC") OP_A2(0x2) Jump("loc_C1B5") label("loc_C102") ChrTalk( #304 0x13, ( "#178FRegardless, I wasn't expecting Richard of all\x01", "people to end up here...\x02\x03", "#176FBut he does fit within the rule that only those\x01", "who have aided us end up in sealing stones.\x02", ) ) CloseMessageWindow() label("loc_C1B5") TalkEnd(0xFE) Jump("loc_CB18") label("loc_C1BB") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 0)), scpexpr(EXPR_END)), "loc_C35D") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_C2AD") ChrTalk( #305 0x13, ( "#176FI was aware that Father Graham was a member\x01", "of the Gralsritter...\x02\x03", "#175FI certainly wasn't aware that he was such a high-\x01", "ranking member of the group, however.\x02\x03", "And one of its most powerful members, at that.\x02", ) ) CloseMessageWindow() OP_A2(0x2) Jump("loc_C357") label("loc_C2AD") ChrTalk( #306 0x13, ( "#176FI was aware that Father Graham was a member\x01", "of the Gralsritter...\x02\x03", "#175FI certainly wasn't aware that he was such a high-\x01", "ranking member of the group, however.\x02", ) ) CloseMessageWindow() label("loc_C357") TalkEnd(0xFE) Jump("loc_CB18") label("loc_C35D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x521, 6)), scpexpr(EXPR_END)), "loc_C4F2") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_C445") ChrTalk( #307 0x13, ( "#178FWe've now conquered all three of the ordeals\x01", "that this garden's master mentioned.\x02\x03", "I presume that means our next destination must be\x01", "the fifth plane.\x02\x03", "#176FI wonder what kind of place that will be.\x02", ) ) CloseMessageWindow() OP_A2(0x2) Jump("loc_C4EC") label("loc_C445") ChrTalk( #308 0x13, ( "#178FI presume that since we've conquered all three\x01", "of the ordeals here, our next destination will be\x01", "the fifth plane.\x02\x03", "I wonder what kind of place that will be.\x02", ) ) CloseMessageWindow() label("loc_C4EC") TalkEnd(0xFE) Jump("loc_CB18") label("loc_C4F2") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x521, 2)), scpexpr(EXPR_END)), "loc_C6FE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_C5E7") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_C5A3") TalkBegin(0xFE) ChrTalk( #309 0x13, ( "#176F*sigh* I had an important meeting to attend at\x01", "military HQ tomorrow, too.\x02\x03", "But it looks like I'll have no choice but to miss it.\x02", ) ) CloseMessageWindow() TalkEnd(0xFE) Jump("loc_C5E1") label("loc_C5A3") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #310 0x13, "#178FShould you not rest, Your Highness?\x02", ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_C5E1") OP_A2(0x2) Jump("loc_C6FB") label("loc_C5E7") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x4)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_C6BD") TalkBegin(0xFE) ChrTalk( #311 0x13, ( "#172FOr is the meeting today, now? \x02\x03", "#175FBeing in this place truly distorts your sense\x01", "of time's passing...\x02\x03", "It's even possible the meeting could've been\x01", "days ago, thinking about it...\x02", ) ) CloseMessageWindow() TalkEnd(0xFE) Jump("loc_C6FB") label("loc_C6BD") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #312 0x13, "#178FShould you not rest, Your Highness?\x02", ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_C6FB") Jump("loc_CB18") label("loc_C6FE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x520, 5)), scpexpr(EXPR_END)), "loc_C925") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_C822") ChrTalk( #313 0x13, ( "#178FIt's clear from everything they've said and done\x01", "so far that our foes have thoroughly researched\x01", "all of us.\x02\x03", "#175FAnd yet recreating a place from outside Liberl\x01", "was certainly not something I expected them to\x01", "do...\x02\x03", "Just who is the Lord of Phantasma, anyway?\x02", ) ) CloseMessageWindow() OP_A2(0x2) Jump("loc_C91F") label("loc_C822") ChrTalk( #314 0x13, ( "#178FWe know now that the Lord of Phantasma\x01", "is challenging us with a significant amount\x01", "of research on us under their belt.\x02\x03", "#176FIt doesn't make sense to me. The more they do,\x01", "the more I can't fathom what it is they want.\x02\x03", "#175FOr who they are...\x02", ) ) CloseMessageWindow() label("loc_C91F") TalkEnd(0xFE) Jump("loc_CB18") label("loc_C925") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x520, 0)), scpexpr(EXPR_END)), "loc_CB18") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_CA38") ChrTalk( #315 0x13, ( "#176FIt's disturbing to think that we are literally\x01", "fighting fiends taken from the church's texts...\x02\x03", "#175FThen again, our enemies are capable of making\x01", "a replica of an entire city. I suppose summoning\x01", "mirrors and tanks are child's play to them.\x02", ) ) CloseMessageWindow() OP_A2(0x2) Jump("loc_CB15") label("loc_CA38") ChrTalk( #316 0x13, ( "#178FHaving listened to the archbishop's sermons often,\x01", "I am fairly familiar with the Testaments...\x02\x03", "#175FI never thought I would one day find myself face to\x01", "face with some of the monstrosities within them,\x01", "however.\x02", ) ) CloseMessageWindow() label("loc_CB15") TalkEnd(0xFE) label("loc_CB18") Return() # Function_11_AF11 end def Function_12_CB19(): pass label("Function_12_CB19") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x565, 3)), scpexpr(EXPR_END)), "loc_CDC0") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_CC5D") ChrTalk( #317 0x14, ( "#270FIt seems like we're finally able to see the light at\x01", "the end of the tunnel.\x02\x03", "#270FNow we just need to keep walking towards it.\x01", "For the sake of everyone we know, including\x01", "those no longer with us because of the Aureole.\x02\x03", "#278FLet's see what this seventh plane has in store\x01", "for us, shall we?\x02", ) ) CloseMessageWindow() OP_A2(0x3) Jump("loc_CDBA") label("loc_CC5D") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_CD38") TurnDirection(0xFE, 0x104, 0) ChrTalk( #318 0x14, ( "#277FIt seems like we're finally able to see the light\x01", "at the end of the tunnel.\x02\x03", "#276FBe careful, Olivier.\x02", ) ) CloseMessageWindow() ChrTalk( #319 0x104, "#1541FHeh. But of course, my love!\x02", ) CloseMessageWindow() ChrTalk( #320 0x14, "#274FAnd who, exactly, is your love?\x02", ) CloseMessageWindow() Jump("loc_CDBA") label("loc_CD38") ChrTalk( #321 0x14, ( "#277FIt seems like we're finally able to see the light\x01", "at the end of the tunnel.\x02\x03", "#278FPerhaps I'd best go and grab Olivier.\x02", ) ) CloseMessageWindow() label("loc_CDBA") TalkEnd(0xFE) Jump("loc_E960") label("loc_CDC0") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x564, 0)), scpexpr(EXPR_END)), "loc_CF36") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4C7, 2)), scpexpr(EXPR_END)), "loc_CE79") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #322 0x14, ( "#276FSo that is how a true master fights...\x02\x03", "#278FHeh. That was a worthwhile reminder of just how\x01", "much room I still have to improve my own skills.\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_CF33") label("loc_CE79") TalkBegin(0xFE) ChrTalk( #323 0x14, ( "#272FSo you were able to test your skills against the\x01", "famed Cassius Bright, were you?\x02\x03", "#277FI can't help but wish that I had been able to see\x01", "him fight up close and personal.\x02", ) ) CloseMessageWindow() TalkEnd(0xFE) label("loc_CF33") Jump("loc_E960") label("loc_CF36") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x562, 5)), scpexpr(EXPR_END)), "loc_D105") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_D044") ChrTalk( #324 0x14, ( "#276FThe Lord of Phantasma appears to have some\x01", "rather capable warriors under his command.\x02\x03", "#272FIf that's the strength of the second guardian,\x01", "I dread to think how powerful the rest will be.\x02\x03", "*sigh* This is going to be quite the challenge.\x02", ) ) CloseMessageWindow() OP_A2(0x3) Jump("loc_D0FF") label("loc_D044") ChrTalk( #325 0x14, ( "#270FThe Lord of Phantasma really seems to have\x01", "some capable warriors under his command.\x02\x03", "#276FCome to think of it, that Schwarzritter said\x01", "that he's one of the guardians, too, yes?\x02", ) ) CloseMessageWindow() label("loc_D0FF") TalkEnd(0xFE) Jump("loc_E960") label("loc_D105") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x561, 0)), scpexpr(EXPR_END)), "loc_D485") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_D328") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_D274") TalkBegin(0xFE) TurnDirection(0xFE, 0x104, 0) ChrTalk( #326 0x14, ( "#272F...Olivier, don't go causing any trouble while\x01", "you're here.\x02\x03", "Just because we're not in the real world\x01", "right now doesn't mean your actions can't\x01", "cause international problems.\x02", ) ) CloseMessageWindow() ChrTalk( #327 0x104, ( "#1541FHahaha! Why must you always be so paranoid\x01", "about me?\x02", ) ) CloseMessageWindow() ChrTalk( #328 0x14, ( "#274FBecause you never take me seriously.\x01", "Like you're not doing now.\x02", ) ) CloseMessageWindow() TalkEnd(0xFE) Jump("loc_D322") label("loc_D274") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #329 0x14, ( "#274F...You really are a few gears short of a\x01", "functioning battle orbment.\x02\x03", "Perhaps you need to be taught a lesson\x01", "so you don't get any more silly ideas.\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_D322") OP_A2(0x3) Jump("loc_D482") label("loc_D328") TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_D3FB") TurnDirection(0xFE, 0x104, 0) ChrTalk( #330 0x14, ( "#272F...Olivier, don't go causing any trouble while\x01", "you're here.\x02\x03", "Just because we're not in the real world\x01", "right now doesn't mean your actions can't\x01", "cause international problems.\x02", ) ) CloseMessageWindow() Jump("loc_D47F") label("loc_D3FB") ChrTalk( #331 0x14, ( "#272FJust leave this idiot to me.\x02\x03", "#270FI'll take responsibility for making sure he\x01", "behaves--no matter what it takes to do it.\x02", ) ) CloseMessageWindow() label("loc_D47F") TalkEnd(0xFE) label("loc_D482") Jump("loc_E960") label("loc_D485") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x560, 0)), scpexpr(EXPR_END)), "loc_D70F") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_D5F2") ChrTalk( #332 0x14, ( "#276FI never imagined that would be the origin of\x01", "the cube we've been reliant on all this time.\x02\x03", "At least now we understand how we came\x01", "to be drawn in here...to a degree.\x02\x03", "#270FIt seems like the one directly responsible for\x01", "that happening was the Lord of Phantasma,\x01", "too.\x02\x03", "#272FHmph. I can't wait to make them pay for what\x01", "they've done.\x02", ) ) CloseMessageWindow() OP_A2(0x3) Jump("loc_D709") label("loc_D5F2") ChrTalk( #333 0x14, ( "#272FAt least now that we know where the Recluse Cube\x01", "came from, we've got a relatively good idea how we\x01", "all ended up here.\x02\x03", "#276FThe one directly responsible for that happening was\x01", "no doubt the Lord of Phantasma.\x02\x03", "Hmph. I can't wait to make them pay for what\x01", "they've done.\x02", ) ) CloseMessageWindow() label("loc_D709") TalkEnd(0xFE) Jump("loc_E960") label("loc_D70F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 7)), scpexpr(EXPR_END)), "loc_D8D6") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_D83D") ChrTalk( #334 0x14, ( "#272FIt seems like the situation we're in is even more\x01", "severe than I feared.\x02\x03", "#276FWe've discovered a number of rules that govern\x01", "this world, all implemented by that Lord of\x01", "Phantasma...\x02\x03", "...but what if they created a rule that dictates\x01", "we can't actually leave this world?\x02", ) ) CloseMessageWindow() OP_A2(0x3) Jump("loc_D8D0") label("loc_D83D") ChrTalk( #335 0x14, ( "#272FOur only hope may turn out to be that ghost.\x02\x03", "#276FEspecially given how the Lord of Phantasma's\x01", "power seems unable to affect the garden.\x02", ) ) CloseMessageWindow() label("loc_D8D0") TalkEnd(0xFE) Jump("loc_E960") label("loc_D8D6") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 4)), scpexpr(EXPR_END)), "loc_DAA9") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_D9F0") ChrTalk( #336 0x14, ( "#277FSo our latest ally is the former Royal Army\x01", "officer Colonel Richard, is it?\x02\x03", "I've heard many great things about his skill in\x01", "battle and espionage, as well as his intellect.\x02\x03", "#278FHeh. He doesn't sound like the kind of man\x01", "I would want as an enemy.\x02", ) ) CloseMessageWindow() OP_A2(0x3) Jump("loc_DAA3") label("loc_D9F0") ChrTalk( #337 0x14, ( "#277FSo our latest ally is the former Royal Army\x01", "officer Colonel Richard, is it?\x02\x03", "He's not someone I would want as an enemy,\x01", "but I'll welcome him any day as a powerful ally.\x02", ) ) CloseMessageWindow() label("loc_DAA3") TalkEnd(0xFE) Jump("loc_E960") label("loc_DAA9") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x540, 0)), scpexpr(EXPR_END)), "loc_DD62") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_DB40") Jump("loc_DB82") label("loc_DB40") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_DB5C") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_DB82") label("loc_DB5C") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_DB78") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_DB82") label("loc_DB78") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_DB82") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_DCE3") ChrTalk( #338 0x14, ( "#272FThere was a point when Olivier tried delving\x01", "into research on the Gralsritter.\x02\x03", "He wasn't able to ascertain much in the end\x01", "no matter how hard he tried, though...\x02\x03", "#276FAfter seeing for myself what their strongest\x01", "members are capable of, I can understand why\x01", "he would want to look into them.\x02", ) ) CloseMessageWindow() OP_A2(0x3) Jump("loc_DD57") label("loc_DCE3") ChrTalk( #339 0x14, ( "#276FThe ability to slay a devil of that strength in\x01", "one blow is...unusual, to say the least.\x02\x03", "Unnatural, too.\x02", ) ) CloseMessageWindow() label("loc_DD57") SetChrSubChip(0xFE, 0) TalkEnd(0xFE) Jump("loc_E960") label("loc_DD62") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x521, 6)), scpexpr(EXPR_END)), "loc_E0B2") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_DF30") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_DE60") ChrTalk( #340 0x14, ( "#276FWhere has that fool gotten himself to, anyway?\x02\x03", "#272FI swear, I take my eyes off him for one moment...\x02\x03", "You'd think he could at least manage to play the\x01", "good prince during times of serious crisis like this...\x02", ) ) CloseMessageWindow() Jump("loc_DF2A") label("loc_DE60") ChrTalk( #341 0x14, ( "#276FSo all of the sealing stones in that bracer training\x01", "area contained bracers in the end.\x02\x03", "That masked jester has thankfully proven to play\x01", "by their own rules thus far, at least.\x02", ) ) CloseMessageWindow() ChrTalk( #342 0x102, "#1503F...\x02", ) CloseMessageWindow() label("loc_DF2A") OP_A2(0x3) Jump("loc_E0AC") label("loc_DF30") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_DFD6") ChrTalk( #343 0x14, ( "#272FHmph. Well, whatever. I'll leave him to his own\x01", "devices for now.\x02\x03", "It's not as though he can leave this garden\x01", "without the cube regardless.\x02", ) ) CloseMessageWindow() Jump("loc_E0AC") label("loc_DFD6") ChrTalk( #344 0x14, ( "#270FI may loathe that masked jester, but at least\x01", "they seem to always play by their own rules, \x01", "if nothing else.\x02\x03", "#276FI just hope there's some way that we can take\x01", "advantage of that in order to defeat them.\x02", ) ) CloseMessageWindow() label("loc_E0AC") TalkEnd(0xFE) Jump("loc_E960") label("loc_E0B2") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x521, 2)), scpexpr(EXPR_END)), "loc_E36E") OP_51(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x0, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_E149") Jump("loc_E18B") label("loc_E149") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_E165") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_E18B") label("loc_E165") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_E181") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_E18B") label("loc_E181") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_E18B") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_E2AF") ChrTalk( #345 0x14, ( "#276FI take it those armed beastmen we encountered\x01", "are another reflection of the Lord of Phantasma's \x01", "unpleasant tastes.\x02\x03", "#272F...But whatever. I'm tired of putting up with their\x01", "ridiculous games at this point.\x02\x03", "Let's keep pressing on.\x02", ) ) CloseMessageWindow() OP_A2(0x3) Jump("loc_E363") label("loc_E2AF") ChrTalk( #346 0x14, ( "#272FI've got no idea what the Lord of Phantasma\x01", "is planning...\x02\x03", "...but I'm tired of having to put up with their\x01", "ridiculous games at this point.\x02\x03", "#270FLet's keep pressing on.\x02", ) ) CloseMessageWindow() label("loc_E363") SetChrSubChip(0xFE, 0) TalkEnd(0xFE) Jump("loc_E960") label("loc_E36E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x520, 5)), scpexpr(EXPR_END)), "loc_E6EE") Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_E643") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) OP_51(0x104, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) TalkBegin(0xFE) ClearChrFlags(0xFE, 0x10) TurnDirection(0xFE, 0x104, 0) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x168), scpexpr(EXPR_ADD), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_SUB), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0xB4), scpexpr(EXPR_IDIV), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2D), scpexpr(EXPR_LEQ), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x13B), scpexpr(EXPR_GE), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x195), scpexpr(EXPR_LEQ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_OR), scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_PUSH_LONG, 0x2A3), scpexpr(EXPR_GE), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_E41B") Jump("loc_E45D") label("loc_E41B") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_E437") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_E45D") label("loc_E437") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_E453") OP_51(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_E45D") label("loc_E453") OP_51(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_E45D") OP_51(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x104, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0x104, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_51(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_E5FD") ChrTalk( #347 0x14, "#272F...Olivier. I need to talk to you later.\x02", ) CloseMessageWindow() ChrTalk( #348 0x104, ( "#1540FOh, my! My, my, my! Whatever for?\x02\x03", "#1541FHave you finally decided you cannot contain\x01", "your burning passion for me locked within\x01", "that rugged heart of yours a moment longer?\x02", ) ) CloseMessageWindow() ChrTalk( #349 0x14, ( "#270FNo, idiot. I just need to check up on how you're\x01", "doing.\x02\x03", "#276FAs well as how you were doing before we were\x01", "drawn in here.\x02", ) ) CloseMessageWindow() OP_A2(0x3) Jump("loc_E633") label("loc_E5FD") ChrTalk( #350 0x14, "#272FDon't go getting too carried away, Olivier.\x02", ) CloseMessageWindow() label("loc_E633") SetChrSubChip(0xFE, 0) ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) Jump("loc_E6EB") label("loc_E643") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_E652") Call(5, 5) Jump("loc_E6EB") label("loc_E652") SetChrFlags(0xFE, 0x10) TalkBegin(0xFE) ChrTalk( #351 0x14, ( "#276FWe must find a way out of here as soon as\x01", "possible.\x02\x03", "#272FWho knows what's happening in the outside\x01", "world while we're in here?\x02", ) ) CloseMessageWindow() ClearChrFlags(0xFE, 0x10) TalkEnd(0xFE) label("loc_E6EB") Jump("loc_E960") label("loc_E6EE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x520, 0)), scpexpr(EXPR_END)), "loc_E960") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_E8D4") ChrTalk( #352 0x14, ( "#270FIt's seeming more and more like we were all\x01", "drawn in here at the same time.\x02\x03", "#272F...Which is a relief in some ways. If that pitiful THING\x01", "had been left in the outside world without me to watch\x01", "it, I shudder to think what would have happened.\x02", ) ) CloseMessageWindow() ChrTalk( #353 0x102, "#1505FI'd come to his defense but...no, I can't blame you.\x02", ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_42(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_NEQ), scpexpr(EXPR_END)), "loc_E8CE") ChrTalk( #354 0x104, ( "#1542FTruly, I am offended.\x02\x03", "#1541FAt the very worst, I would have thrown\x01", "a luxurious banquet for all to enjoy.\x02", ) ) CloseMessageWindow() ChrTalk( #355 0x14, "#274F...\x02", ) CloseMessageWindow() label("loc_E8CE") OP_A2(0x3) Jump("loc_E95D") label("loc_E8D4") ChrTalk( #356 0x14, ( "#272FIt's seeming more and more like we were all\x01", "drawn in here at the same time.\x02\x03", "Which is a relief, as guilty as I feel to say so.\x02", ) ) CloseMessageWindow() label("loc_E95D") TalkEnd(0xFE) label("loc_E960") Return() # Function_12_CB19 end SaveToFile() Try(main)