text
stringlengths
38
1.54M
from django.conf import settings as django_settings from django.core import mail from django_mailer import models, constants, queue_email_message from django_mailer.tests.base import MailerTestCase class TestBackend(MailerTestCase): """ Backend tests for the django_mailer app. For Django versions less than 1.2, these tests are still run but they just use the queue_email_message funciton rather than directly sending messages. """ def setUp(self): super(TestBackend, self).setUp() if constants.EMAIL_BACKEND_SUPPORT: if hasattr(django_settings, 'EMAIL_BACKEND'): self.old_email_backend = django_settings.EMAIL_BACKEND else: self.old_email_backend = None django_settings.EMAIL_BACKEND = 'django_mailer.smtp_queue.'\ 'EmailBackend' def tearDown(self): super(TestBackend, self).tearDown() if constants.EMAIL_BACKEND_SUPPORT: if self.old_email_backend: django_settings.EMAIL_BACKEND = self.old_email_backend else: delattr(django_settings, 'EMAIL_BACKEND') def send_message(self, msg): if constants.EMAIL_BACKEND_SUPPORT: msg.send() else: queue_email_message(msg) def testQueuedMessagePriorities(self): # high priority message msg = mail.EmailMessage(subject='subject', body='body', from_email='mail_from@abc.com', to=['mail_to@abc.com'], headers={'X-Mail-Queue-Priority': 'high'}) self.send_message(msg) # low priority message msg = mail.EmailMessage(subject='subject', body='body', from_email='mail_from@abc.com', to=['mail_to@abc.com'], headers={'X-Mail-Queue-Priority': 'low'}) self.send_message(msg) # normal priority message msg = mail.EmailMessage(subject='subject', body='body', from_email='mail_from@abc.com', to=['mail_to@abc.com'], headers={'X-Mail-Queue-Priority': 'normal'}) self.send_message(msg) # normal priority message (no explicit priority header) msg = mail.EmailMessage(subject='subject', body='body', from_email='mail_from@abc.com', to=['mail_to@abc.com']) self.send_message(msg) qs = models.QueuedMessage.objects.high_priority() self.assertEqual(qs.count(), 1) queued_message = qs[0] self.assertEqual(queued_message.priority, constants.PRIORITY_HIGH) qs = models.QueuedMessage.objects.low_priority() self.assertEqual(qs.count(), 1) queued_message = qs[0] self.assertEqual(queued_message.priority, constants.PRIORITY_LOW) qs = models.QueuedMessage.objects.normal_priority() self.assertEqual(qs.count(), 2) for queued_message in qs: self.assertEqual(queued_message.priority, constants.PRIORITY_NORMAL) def testSendMessageNowPriority(self): # NOW priority message msg = mail.EmailMessage(subject='subject', body='body', from_email='mail_from@abc.com', to=['mail_to@abc.com'], headers={'X-Mail-Queue-Priority': 'now'}) self.send_message(msg) queued_messages = models.QueuedMessage.objects.all() self.assertEqual(queued_messages.count(), 0) self.assertEqual(len(mail.outbox), 1)
#!/usr/bin/env python import json, urllib2, os, sys def api_call(url, token=None, data=None): if data: data = json.dumps(data) req = urllib2.Request(url, data) if data: req.add_header('Content-Type', 'application/json; charset=UTF-8') if token: req.add_header('Authorization', 'token ' + token) p = urllib2.urlopen(req) return json.loads(p.read()) def travis_ping(travis_token, repository): last_build_id = api_call('https://api.travis-ci.org/repos/{}/builds'.format(repository), travis_token)[0]['id'] return api_call('https://api.travis-ci.org/requests', travis_token, { 'build_id': last_build_id })['result'] travis_ping(os.environ["API_TOKEN"], sys.argv[1])
# reset the console %reset -f #Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt # Import dataset dataset_train = pd.read_csv('SalaryData_Train.csv') dataset_train.head() dataset_train.columns dataset_train.shape #(30161, 14) dataset_train.info() dataset_train.dtypes dataset_test = pd.read_csv('SalaryData_Test.csv') dataset_test.head() dataset_test.columns dataset_test.shape #(15060, 14) dataset_test.info() dataset_test.dtypes # Missing values dataset_train.isnull().sum() # No missing values dataset_train.drop_duplicates(keep='first', inplace=True) # 3258 rows are duplicates dataset_test.isnull().sum() # No missing values dataset_test.drop_duplicates(keep='first', inplace=True) # 930 rows are duplicates # splite the data by type train_num = dataset_train.select_dtypes(include='int64') train_num.shape # (26903, 5) train_cat = dataset_train.select_dtypes(include='object') train_cat.shape # (26903, 9) test_num = dataset_test.select_dtypes(include='int64') test_num.shape # (14130, 5) test_cat = dataset_test.select_dtypes(include='object') test_cat.shape # (14130, 9) # Exploratory Data Analysis is done only on train data # Statistical Description dataset_train.describe() # Measures of Dispersion np.var(dataset_train) np.std(dataset_train) # Skewnes ans Kurtosis from scipy.stats import skew, kurtosis skew(train_num) kurtosis(train_num) # Histograms plt.hist(dataset_train['age']);plt.title('Histogram of Age');plt.xlabel('Age');plt.ylabel('Frequency') plt.hist(dataset_train['educationno'], color='coral');plt.title('Histogram of Education');plt.xlabel('Education');plt.ylabel('Frequency') plt.hist(dataset_train['capitalgain'], color='teal');plt.title('Histogram of Capital Gain');plt.xlabel('Capital Gain');plt.ylabel('Frequency') plt.hist(dataset_train['capitalloss'], color='brown');plt.title('Histogram of Capital Loss');plt.xlabel('Capital Loss');plt.ylabel('Frequency') plt.hist(dataset_train['hoursperweek'], color='purple');plt.title('Histogram of Hours');plt.xlabel('Hours per Week');plt.ylabel('Frequency') # Count plot for categorical data import seaborn as sns sns.countplot(dataset_train['workclass']).set_title('Countplot of Work Class') pd.crosstab(dataset_train.workclass,dataset_train.Salary).plot(kind="bar") sns.countplot(dataset_train['education']).set_title('Countplot of Education') pd.crosstab(dataset_train.education,dataset_train.Salary).plot(kind="bar") sns.countplot(dataset_train['maritalstatus']).set_title('Countplot of Marital Status') pd.crosstab(dataset_train.maritalstatus,dataset_train.Salary).plot(kind="bar") sns.countplot(dataset_train['occupation']).set_title('Countplot of Occupation') pd.crosstab(dataset_train.occupation,dataset_train.Salary).plot(kind="bar") sns.countplot(dataset_train['relationship']).set_title('Countplot of RelationShip') pd.crosstab(dataset_train.relationship,dataset_train.Salary).plot(kind="bar") sns.countplot(dataset_train['race']).set_title('Countplot of Race') pd.crosstab(dataset_train.race,dataset_train.Salary).plot(kind="bar") sns.countplot(dataset_train['sex']).set_title('Countplot of Sex') pd.crosstab(dataset_train.sex,dataset_train.Salary).plot(kind="bar") sns.countplot(dataset_train['native']).set_title('Countplot of Native') pd.crosstab(dataset_train.native,dataset_train.Salary).plot(kind="bar") # Normal Q-Q plot plt.plot(train_num);plt.legend(list(train_num)) age = np.array(dataset_train['age']) edu = np.array(dataset_train['educationno']) capgain = np.array(dataset_train['capitalgain']) caploss = np.array(dataset_train['capitalloss']) hpw = np.array(dataset_train['hoursperweek']) from scipy import stats stats.probplot(age, dist='norm', plot=plt);plt.title('Q-Q plot of Age') stats.probplot(edu, dist='norm', plot=plt);plt.title('Q-Q plot of Educationno') stats.probplot(capgain, dist='norm', plot=plt);plt.title('Q-Q plot of Capital Gain') stats.probplot(caploss, dist='norm', plot=plt);plt.title('Q-Q plot of Capital Loss') stats.probplot(hpw, dist='norm', plot=plt);plt.title('Q-Q plot of Hours Per Week') # Normal Probability Distribution from scipy import stats x_age = np.linspace(np.min(age), np.max(age)) y_age = stats.norm.pdf(x_age, np.median(x_age), np.std(x_age)) plt.plot(x_age, y_age);plt.xlim(np.min(age), np.max(age));plt.title('Normal Probability Distribution of Age');plt.xlabel('Age');plt.ylabel('Probability') x_edu = np.linspace(np.min(edu), np.max(edu)) y_edu = stats.norm.pdf(x_edu, np.median(x_edu), np.std(x_edu)) plt.plot(x_edu, y_edu);plt.xlim(np.min(edu), np.max(edu));plt.title('Normal Probability Distribution of Educationno');plt.xlabel('Educationno');plt.ylabel('Probability') x_capgain = np.linspace(np.min(capgain), np.max(capgain)) y_capgain = stats.norm.pdf(x_capgain, np.median(x_capgain), np.std(x_capgain)) plt.plot(x_capgain, y_capgain);plt.xlim(np.min(capgain), np.max(capgain));plt.title('Normal Probability Distribution of Capital Gain');plt.xlabel('Capital Gain');plt.ylabel('Probability') x_caploss = np.linspace(np.min(caploss), np.max(caploss)) y_caploss = stats.norm.pdf(x_caploss, np.median(x_caploss), np.std(x_caploss)) plt.plot(x_caploss, y_caploss);plt.xlim(np.min(caploss), np.max(caploss));plt.title('Normal Probability Distribution of Capital Loss');plt.xlabel('Capital Loss');plt.ylabel('Probability') x_hpw = np.linspace(np.min(hpw), np.max(hpw)) y_hpw = stats.norm.pdf(x_hpw, np.median(x_hpw), np.std(x_hpw)) plt.plot(x_hpw, y_hpw);plt.xlim(np.min(hpw), np.max(hpw));plt.title('Normal Probability Distribution of Hours per Week');plt.xlabel('Hours per Week');plt.ylabel('Probability') # Boxplot sns.boxplot(dataset_train['age'],orient='v', color='orange').set_title('Boxplot of Age') sns.boxplot(dataset_train['educationno'],orient='v', color='teal').set_title('Boxplot of Age') sns.boxplot(dataset_train['capitalgain'],orient='v').set_title('Boxplot of Age') sns.boxplot(dataset_train['capitalloss'],orient='v').set_title('Boxplot of Age') sns.boxplot(dataset_train['hoursperweek'],orient='v').set_title('Boxplot of Hours per Week') # Data Distribution - Boxplot of continuous variables wrt to each category of categorical columns sns.boxplot(x="workclass",y="age",data=dataset_train).set_title('Boxplot of WorkClass & Age') sns.boxplot(x="workclass",y="educationno",data=dataset_train).set_title('Boxplot of WorkClass & Educationno') sns.boxplot(x="workclass",y="capitalgain",data=dataset_train).set_title('Boxplot of WorkClass & CapitalGain') sns.boxplot(x="workclass",y="capitalloss",data=dataset_train).set_title('Boxplot of WorkClass & CapitalLoss') sns.boxplot(x="workclass",y="hoursperweek",data=dataset_train).set_title('Boxplot of WorkClass & HoursPerWeek') sns.boxplot(x="education",y="age",data=dataset_train).set_title('Boxplot of Education & Age') sns.boxplot(x="education",y="educationno",data=dataset_train).set_title('Boxplot of Education & Educationno') sns.boxplot(x="education",y="capitalgain",data=dataset_train).set_title('Boxplot of Education & CapitalGain') sns.boxplot(x="education",y="capitalloss",data=dataset_train).set_title('Boxplot of Education & CapitalLoss') sns.boxplot(x="education",y="hoursperweek",data=dataset_train).set_title('Boxplot of Education & HoursPerWeek') sns.boxplot(x="maritalstatus",y="age",data=dataset_train).set_title('Boxplot of MaritalStatus & Age') sns.boxplot(x="maritalstatus",y="educationno",data=dataset_train).set_title('Boxplot of MaritalStatus & Educationno') sns.boxplot(x="maritalstatus",y="capitalgain",data=dataset_train).set_title('Boxplot of MaritalStatus & CapitalGain') sns.boxplot(x="maritalstatus",y="capitalloss",data=dataset_train).set_title('Boxplot of MaritalStatus & CapitalLoss') sns.boxplot(x="maritalstatus",y="hoursperweek",data=dataset_train).set_title('Boxplot of MaritalStatus & HoursPerWeek') sns.boxplot(x="occupation",y="age",data=dataset_train).set_title('Boxplot of Occupation & Age') sns.boxplot(x="occupation",y="educationno",data=dataset_train).set_title('Boxplot of Occupation & Educationno') sns.boxplot(x="occupation",y="capitalgain",data=dataset_train).set_title('Boxplot of Occupation & CapitalGain') sns.boxplot(x="occupation",y="capitalloss",data=dataset_train).set_title('Boxplot of Occupation & CapitalLoss') sns.boxplot(x="occupation",y="hoursperweek",data=dataset_train).set_title('Boxplot of Occupation & HoursPerWeek') sns.boxplot(x="relationship",y="age",data=dataset_train).set_title('Boxplot of RelationShip & Age') sns.boxplot(x="relationship",y="educationno",data=dataset_train).set_title('Boxplot of RelationShip & Educationno') sns.boxplot(x="relationship",y="capitalgain",data=dataset_train).set_title('Boxplot of RelationShip & CapitalGain') sns.boxplot(x="relationship",y="capitalloss",data=dataset_train).set_title('Boxplot of RelationShip & CapitalLoss') sns.boxplot(x="relationship",y="hoursperweek",data=dataset_train).set_title('Boxplot of RelationShip & HoursPerWeek') sns.boxplot(x="race",y="age",data=dataset_train).set_title('Boxplot of Race & Age') sns.boxplot(x="race",y="educationno",data=dataset_train).set_title('Boxplot of Race & Educationno') sns.boxplot(x="race",y="capitalgain",data=dataset_train).set_title('Boxplot of Race & CapitalGain') sns.boxplot(x="race",y="capitalloss",data=dataset_train).set_title('Boxplot of Race & CapitalLoss') sns.boxplot(x="race",y="hoursperweek",data=dataset_train).set_title('Boxplot of Race & HoursPerWeek') sns.boxplot(x="sex",y="age",data=dataset_train).set_title('Boxplot of Sex & Age') sns.boxplot(x="sex",y="educationno",data=dataset_train).set_title('Boxplot of Sex & Educationno') sns.boxplot(x="sex",y="capitalgain",data=dataset_train).set_title('Boxplot of Sex & CapitalGain') sns.boxplot(x="sex",y="capitalloss",data=dataset_train).set_title('Boxplot of Sex & CapitalLoss') sns.boxplot(x="sex",y="hoursperweek",data=dataset_train).set_title('Boxplot of Sex & HoursPerWeek') sns.boxplot(x="native",y="age",data=dataset_train).set_title('Boxplot of Native & Age') sns.boxplot(x="native",y="educationno",data=dataset_train).set_title('Boxplot of Native & Educationno') sns.boxplot(x="native",y="capitalgain",data=dataset_train).set_title('Boxplot of Native & CapitalGain') sns.boxplot(x="native",y="capitalloss",data=dataset_train).set_title('Boxplot of Native & CapitalLoss') sns.boxplot(x="native",y="hoursperweek",data=dataset_train).set_title('Boxplot of Native & HoursPerWeek') # Scatterplot sns.scatterplot(x='age', y='educationno', data=dataset_train).set_title('Scatterplot Age & Educationno') sns.scatterplot(x='age', y='capitalgain', data=dataset_train).set_title('Scatterplot Age & Capital Gain') sns.scatterplot(x='age', y='capitalloss', data=dataset_train).set_title('Scatterplot Age & Capital Loss') sns.scatterplot(x='age', y='hoursperweek', data=dataset_train).set_title('Scatterplot Age & Hours Per Week') sns.scatterplot(x='educationno', y='capitalgain', data=dataset_train).set_title('Scatterplot Educationno & Capital Gain') sns.scatterplot(x='educationno', y='capitalloss', data=dataset_train).set_title('Scatterplot Educationno & Capital Loss') sns.scatterplot(x='educationno', y='hoursperweek', data=dataset_train).set_title('Scatterplot Educationno & Hours Per Week') sns.scatterplot(x='capitalgain', y='capitalloss', data=dataset_train).set_title('Scatterplot Capital Gain & Capital Loss') sns.scatterplot(x='capitalgain', y='hoursperweek', data=dataset_train).set_title('Scatterplot Capital Gain & Hours Per Week') sns.scatterplot(x='capitalloss', y='hoursperweek', data=dataset_train).set_title('Scatterplot Capital Loss & Hours Per Week') sns.pairplot(dataset_train) sns.pairplot(dataset_train, diag_kind = 'kde') sns.pairplot(dataset_train, hue='Salary') # Heatmap corr = dataset_train.corr() print(corr) sns.heatmap(corr, annot=True) string_columns=["workclass","education","maritalstatus","occupation","relationship","race","sex","native"] from sklearn.preprocessing import LabelEncoder labelencoder = LabelEncoder() for i in string_columns: dataset_train[i] = labelencoder.fit_transform(dataset_train[i]) dataset_test[i] = labelencoder.fit_transform(dataset_test[i]) # Encoding the categorical data ''' # X-Training data X_train.dtypes X_train_obj = X_train.select_dtypes(include=['object']).copy() X_train_obj = X_train_obj.columns.tolist() for var in X_train_obj: train_obj_list = pd.get_dummies(X_train[var],prefix=var) X_train = X_train.join(train_obj_list) X_train_col = X_train.columns.values.tolist() to_keep = [i for i in X_train_col if i not in X_train_obj] X_train = X_train[to_keep] X_train.columns.values # X_Testing data X_test.dtypes X_test_obj = X_test.select_dtypes(include=['object']).copy() X_test_obj = X_test_obj.columns.tolist() for var in X_test_obj: test_obj_list = pd.get_dummies(X_test[var],prefix=var) X_test = X_test.join(test_obj_list) X_test_col = X_test.columns.values.tolist() to_keep = [i for i in X_test_col if i not in X_test_obj] X_test = X_test[to_keep] X_test.columns.values ''' # Outliers from scipy import stats Z = np.abs(stats.zscore(dataset_train.iloc[:,0:-1])) print(np.where(Z>3)) print(Z[11][7]) df_out = dataset_train[(Z<3).all(axis=1)] # 4062 outliers are removed # Splitting the dataset colnames = dataset_train.columns len(colnames[0:13]) X_train = df_out[colnames[0:13]] Y_train = df_out[colnames[13]] X_test = dataset_test[colnames[0:13]] Y_test = dataset_test[colnames[13]] df_out.Salary.value_counts() # classes are imbalanced # Fiting Navie Bayes Classifier to training set from sklearn.naive_bayes import MultinomialNB as MNB from sklearn.naive_bayes import GaussianNB as GNB from sklearn.metrics import confusion_matrix, accuracy_score # Multinomial Navie Bayes classifier classifier_mb = MNB() classifier_mb.fit(X_train, Y_train) # Predicting results on trainset data train_pred_mb = classifier_mb.predict(X_train) train_cm_mb = confusion_matrix(Y_train, train_pred_mb) print(train_cm_mb) acc_train_mb = accuracy_score(Y_train, train_pred_mb) print(acc_train_mb) # 78% [76%] # Predicting results on testset data test_pred_mb = classifier_mb.predict(X_test) test_cm_mb = confusion_matrix(Y_test, test_pred_mb) print(test_cm_mb) acc_test_mb = accuracy_score(Y_test, test_pred_mb) print(acc_test_mb) # 77% # Gaussian Navie Bayes classifier classifier_gb = GNB() classifier_gb.fit(X_train, Y_train) # Predicting results on trainset data train_pred_gb = classifier_gb.predict(X_train) train_cm_gb = confusion_matrix(Y_train, train_pred_gb) print(train_cm_gb) acc_train_gb = accuracy_score(Y_train, train_pred_gb) print(acc_train_gb) # 78% [79%] # Predicting results on testset data test_pred_gb = classifier_gb.predict(X_test) test_cm_gb = confusion_matrix(Y_test, test_pred_gb) print(test_cm_gb) acc_test_gb = accuracy_score(Y_test, test_pred_gb) print(acc_test_gb) # 76% [79%] # Stratified Method from sklearn.model_selection import KFold, StratifiedKFold, cross_val_score metric_names = ['f1', 'roc_auc', 'average_precision', 'accuracy', 'precision', 'recall'] scores_df = pd.DataFrame(index=metric_names, columns=['Random-CV', 'Stratified-CV']) # to store the Scores cv = KFold(n_splits=3) scv = StratifiedKFold(n_splits=3) Y_train = Y_train.astype('category') Y_train = Y_train.cat.codes #Y_train['Salary'] = Y_train['Salary'].astype('category') #Y_train["Salary"] = Y_train["Salary"].cat.codes # Multinomial Navie Bayes classifier for metric in metric_names: score1 = cross_val_score(classifier_mb, X_train, Y_train, scoring=metric, cv=cv).mean() score2 = cross_val_score(classifier_mb, X_train, Y_train, scoring=metric, cv=scv).mean() scores_df.loc[metric] = [score1, score2] print(scores_df) # Gaussian Navie Bayes classifier for metric in metric_names: score1 = cross_val_score(classifier_gb, X_train, Y_train, scoring=metric, cv=cv).mean() score2 = cross_val_score(classifier_gb, X_train, Y_train, scoring=metric, cv=scv).mean() scores_df.loc[metric] = [score1, score2] print(scores_df)
# -*- coding:utf-8 -*- # # File Name: xxxx.py # Function: To xxxxx. # Created by: W. Wang (Kevin), ww288@cantab.net # Created on: 20xx/xx/xx # Revised hist: revised by _____ on ____/__/__ # import os import threading from pcmd.env import Env # conf/zhi_miner.ini class ParaCmdEnv(Env): instance = None mutex = threading.Lock() HOME_KEY = 'PARACMD_HOME' CONF_FILE = 'conf/paracmd.ini' def __init__(self): super(ParaCmdEnv, self).__init__(homeKey=ParaCmdEnv.HOME_KEY) self.load(file=ParaCmdEnv.CONF_FILE, relative=True) userConfFile = self.getConfItem(section='misc', option='user_conf') userHome = os.environ.get('HOME') userConfFile = userHome + '/' + userConfFile #print 'Path of user conf file: ' + userConfFile self.load(file=userConfFile, relative=False) @staticmethod def GetInstance(): if(ParaCmdEnv.instance==None): ParaCmdEnv.mutex.acquire() if(ParaCmdEnv.instance==None): ParaCmdEnv.instance = ParaCmdEnv() ParaCmdEnv.mutex.release() return ParaCmdEnv.instance
from django.db import models from django import forms from django.template import Context from django.template.loader import get_template from django.http import Http404 from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import generic from django.db.models import get_model from django.core.cache import cache from django.template.defaultfilters import slugify from treebeard.mp_tree import MP_Node settings = None try: import settings except: # if we can't import settings, it just means # they won't be able to get a list of available # pageblock classes settings = None class Hierarchy(models.Model): name = models.CharField(max_length=256) base_url = models.CharField(max_length=256,default="") @staticmethod def get_hierarchy(name): return Hierarchy.objects.get_or_create(name=name,defaults=dict(base_url="/"))[0] def get_absolute_url(self): return self.base_url def __unicode__(self): return self.name def get_root(self): # will create it if it doesn't exist try: return Section.objects.get(hierarchy=self,label="Root").get_root() except Section.DoesNotExist: return Section.add_root(label="Root",slug="",hierarchy=self) def get_top_level(self): return self.get_root().get_children() def get_section_from_path(self,path): if path.endswith("/"): path = path[:-1] root = self.get_root() current = root if path == "": return current for slug in path.split("/"): slugs = dict() for c in current.get_children(): slugs[c.slug] = c if slugs.has_key(slug): current = slugs[slug] else: raise Http404() return current def available_pageblocks(self): if hasattr(settings,'PAGEBLOCKS'): return [get_model(*pb.split('.')) for pb in settings.PAGEBLOCKS] else: return [] def get_first_leaf(self,section): if (section.is_leaf()): return section return self.get_first_leaf(section.get_children()[0]) def get_last_leaf(self,section): if (section.is_leaf()): return section return self.get_last_leaf(section.get_children()[-1]) class Section(MP_Node): label = models.CharField(max_length=256) slug = models.SlugField() hierarchy = models.ForeignKey(Hierarchy) def get_module(self): """ get the top level module that the section is in""" if self.is_root(): return None if self.depth == 2: return self return self.get_ancestors()[1] def is_first_child(self): return self.get_first_sibling().id == self.id def is_last_child(self): return self.get_last_sibling().id == self.id def closing_children(self): """ this returns the list of adjacent last children. we need this to know how many levels deep need to be closed when making the menus as flattened nested lists. look for 'closing_children' in a menu.html in a project that uses pagetree to see exactly what i mean. """ s = self while not s.is_root() and s.is_last_child(): yield s s = s.get_parent() def get_previous(self): # previous node in the depth-first traversal depth_first_traversal = self.get_root().get_annotated_list() for (i,(s,ai)) in enumerate(depth_first_traversal): if s.id == self.id: # make sure we don't return the root if i > 1 and not depth_first_traversal[i-1][0].is_root(): return depth_first_traversal[i-1][0] else: return None # made it through without finding ourselves? weird. return None def get_next(self): # next node in the depth-first traversal depth_first_traversal = self.get_root().get_annotated_list() for (i,(s,ai)) in enumerate(depth_first_traversal): if s.id == self.id: if i < len(depth_first_traversal) - 1: return depth_first_traversal[i+1][0] else: return None # made it through without finding ourselves? weird. return None def append_child(self,label,slug=''): if slug == '': slug = slugify(label) return self.add_child(label=label,slug=slug,hierarchy=self.hierarchy) def append_pageblock(self,label,content_object): neword = self.pageblock_set.count() + 1 return PageBlock.objects.create(section=self,label=label,ordinality=neword,content_object=content_object) def __unicode__(self): return self.label def get_absolute_url(self): if self.is_root(): return self.hierarchy.get_absolute_url() return self.get_parent().get_absolute_url() + self.slug + "/" def get_path(self): """ same as get_absolute_url, without the leading /""" return self.get_absolute_url()[1:] def add_child_section_form(self): class AddChildSectionForm(forms.Form): label = forms.CharField() return AddChildSectionForm() def renumber_pageblocks(self): i = 1 for block in self.pageblock_set.all(): block.ordinality = i block.save() i += 1 def edit_form(self): class EditSectionForm(forms.Form): label = forms.CharField(initial=self.label) slug = forms.CharField(initial=self.slug) return EditSectionForm() def update_children_order(self,children_ids): """children_ids is a list of Section ids for the children in the order that they should be set to. use with caution. if the ids in children_ids don't match up right it will break or do strange things. """ for section_id in children_ids: s = Section.objects.get(id=section_id) p = s.get_parent() s.move(p,pos="last-child") return def update_pageblocks_order(self,pageblock_ids): """pageblock_ids is a list of PageBlock ids for the children in the order that they should be set to. use with caution. if the ids in pageblock_ids don't match up right it will break or do strange things. """ for (i,id) in enumerate(pageblock_ids): sc = PageBlock.objects.get(id=id) sc.ordinality = i + 1 sc.save() def available_pageblocks(self): return self.hierarchy.available_pageblocks() def add_pageblock_form(self): class EditForm(forms.Form): label = forms.CharField() return EditForm() def get_first_leaf(self): if (self.is_leaf()): return self return self.get_children()[0].get_first_leaf() def get_last_leaf(self): if (self.is_leaf()): return self return self.get_children()[-1].get_last_leaf() def reset(self,user): """ clear a user's responses to all pageblocks on this page """ for p in self.pageblock_set.all(): if hasattr(p.block(),'needs_submit'): if p.block().needs_submit(): p.block().clear_user_submissions(user) def submit(self,request_data,user): """ store users's responses to the pageblocks on this page """ proceed = True for p in self.pageblock_set.all(): if hasattr(p.block(),'needs_submit'): if p.block().needs_submit(): prefix = "pageblock-%d-" % p.id data = dict() for k in request_data.keys(): if k.startswith(prefix): # handle lists for multi-selects v = request_data.getlist(k) if len(v) == 1: data[k[len(prefix):]] = request_data[k] else: data[k[len(prefix):]] = v p.block().submit(user,data) if hasattr(p.block(),'redirect_to_self_on_submit'): # semi bug here? # proceed will only be set by the last submittable # block on the page. previous ones get ignored. proceed = not p.block().redirect_to_self_on_submit() return proceed class PageBlock(models.Model): section = models.ForeignKey(Section) ordinality = models.PositiveIntegerField(default=1) label = models.CharField(max_length=256, blank=True, null=True) content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') class Meta: ordering = ('section','ordinality',) def __unicode__(self): return "%s [%d]: %s" % (self.section.label,self.ordinality,self.label) def block(self): return self.content_object def edit_label(self): """ provide a label for the pageblock to make the edit interface easier to read """ if hasattr(self.block(),'edit_label'): return self.block().edit_label() else: return self.block().display_name def render(self,**kwargs): if hasattr(self.content_object,"template_file"): t = get_template(getattr(self.content_object,"template_file")) d = kwargs d['block'] = self.content_object c = Context(d) return t.render(c) else: return self.content_object.render() def render_js(self,**kwargs): if hasattr(self.content_object,"js_template_file"): t = get_template(getattr(self.content_object,"js_template_file")) d = kwargs d['block'] = self.content_object c = Context(d) return t.render(c) elif hasattr(self.content_object,"js_render"): return self.content_object.js_render() else: return "" def render_css(self,**kwargs): if hasattr(self.content_object,"css_template_file"): t = get_template(getattr(self.content_object,"css_template_file")) d = kwargs d['block'] = self.content_object c = Context(d) return t.render(c) elif hasattr(self.content_object,"css_render"): return self.content_object.css_render() else: return "" def default_edit_form(self): class EditForm(forms.Form): label = forms.CharField(initial=self.label) return EditForm() def edit_form(self): return self.content_object.edit_form() def edit(self,vals,files): self.label = vals.get('label','') self.save() self.content_object.edit(vals,files) def delete(self): section = self.section super(PageBlock, self).delete() # Call the "real" delete() method section.renumber_pageblocks()
import random import os from subjects import SUBJECTS_BY_NAME import cards_loader subjects_db = {} def load_cards(): global subjects_db for subject_data in SUBJECTS_BY_NAME.values(): if not subject_data.cards_db: continue module_dir = os.path.abspath(os.path.dirname(__file__)) file_path = os.path.join(module_dir, subject_data.cards_db) csv_data = cards_loader.read_csv(file_path) loader = cards_loader.CardsLoader(csv_data) loader.analyze() print(f"Subject {subject_data.name}: loaded {len(loader.get_cards())} cards") subjects_db[subject_data.name] = loader def get_cards(subject, num_cards, topic=None): loader = subjects_db[subject] cards_objs = loader.get_cards()[:] if topic is not None: cards_objs = [obj for obj in cards_objs if obj.topic == topic] random.shuffle(cards_objs) if num_cards != -1: cards_objs = cards_objs[:num_cards] return loader.export_web_quiz(cards_objs) def get_topics(subject): return subjects_db[subject].get_topics()
import cv2 face_detector = cv2.CascadeClassifier('haarcascade_frontalface_default.xml') smile_detector = cv2.CascadeClassifier('haarcascade_smile.xml') webcam =cv2.VideoCapture(0) while True : successful_frame_read, frame = webcam.read() if not successful_frame_read: break frame_grayscale = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) faces = face_detector.detectMultiScale(frame_grayscale) for (x,y,w,h) in faces: cv2.rectangle(frame, (x,y), (x+w , y+h), (100, 200, 50), 4) the_face =frame[y:y+h, x:x+w] face_grayscale = cv2.cvtColor(the_face, cv2.COLOR_BGR2GRAY) smiles = smile_detector.detectMultiScale(face_grayscale, scaleFactor= 1.7,minNeighbors = 20) for (x_,y_,w_,h_) in smiles : #cv2.rectangle(the_face, (x_,y_), (x_+w_ , y_+h_), (50, 50, 200), 4) if len(smiles)>0: cv2.putText(frame, 'smiling', (x, y+h+40), fontScale=3, fontFace=cv2.FONT_HERSHEY_PLAIN, color=(255, 255, 45)) cv2.imshow('SMILE DETECTOR', frame) cv2.waitKey(1) webcam.release() cv2.destroyAllWindows() print("Code completed")
from numpy import random import matplotlib.pyplot as plt import seaborn as sns def normalize(distribution): s = 0 if isinstance(distribution, dict): for elem in distribution.values(): s += elem if s != 0: for k in distribution.keys(): distribution[k] /= s else: for elem in distribution: s += elem if s != 0: distribution /= s return distribution def nSample(distribution, values, n): rand = [random.random() for i in range(n)] rand.sort() samples = [] samplePos, distPos, cdf = 0, 0, distribution[0] while samplePos < n: if rand[samplePos] < cdf: samplePos += 1 samples.append(values[distPos]) else: distPos += 1 cdf += distribution[distPos] return samples def plot_convergence(array, legend): sns.set() for c in array: plt.plot(c) plt.legend(legend, loc='upper right') plt.show()
import requests import requests_cache from requests_html import HTML import microdata from urllib.parse import urljoin import datetime import logging import pprint requests_cache.install_cache("rtpplay-cc_cache") logging.basicConfig() logging.getLogger().setLevel(logging.INFO) def get_all_program_urls(): all_program_urls = [] page = 1 while True: url = f"https://www.rtp.pt/play/bg_l_pg/?listtype=az&page={page}&type=all" logging.info(f"Fetching {url}") r = requests.get(url) r.raise_for_status() items = microdata.get_items(r.text) if len(items) == 0: break for item in items: assert item.itemtype[0] == microdata.URI("http://schema.org/VideoObject") program_url = urljoin("https://www.rtp.pt/", item.url.string) all_program_urls.append(program_url) page += 1 return all_program_urls def get_program_info(program_url): logging.info(f"Fetching {program_url}") r = requests.get(program_url) r.raise_for_status() html = HTML(html=r.text) title = html.find("h1") # assume this is the title if not title: logging.warning(f"No title for {program_url}") return None program_info = {"url": program_url, "title": title[0].text} search_res = html.search("vtt: [['PT','{}','{}']]") if search_res: program_info["vtt_url"] = search_res[1] return program_info all_program_urls = get_all_program_urls() logging.info(f"Total programs found: {len(all_program_urls)}") # Generate HTML output print("<html>") print('<head><meta charset="utf-8"><head>') print("<body>") print("<h1>RTP Play - Programs with Subtitles</h1>") for program_url in all_program_urls: program_info = get_program_info(program_url) if program_info and program_info.get("vtt_url"): link_html = f'<a href="{program_info["url"]}">{program_info["title"]}</a>' print(f"<li>{link_html}</li>") print("</body>") print("<footer>") print( f'<p>Generated {datetime.datetime.utcnow().isoformat()} by <a href="https://twitter.com/jrcplus">@jrcplus</a></p>' ) print("</footer>") print("</html>")
#!/usr/bin/env python3 import gi gi.require_version('Gtk', '3.0') gi.require_version('Gst', '1.0') from gi.repository import Gtk, GObject, Gst, Gdk import cairo, math, time import colorsys import os.path import configparser #Default Button size WIDTH = 200 HEIGHT = 200 TESTFILE = os.path.join("test1.mp3") class JingleButton(Gtk.EventBox): #"""This Class describes a single jingle button""" def __init__(self, width, height, color, title, jingle): Gtk.EventBox.__init__(self) self.width = width # width of the jingle button self.height = height # height of the jingle button self.color = color # color, list with rgb floats 0<=r,g,b<=1 self.title = title # title to be displayed self.jingle = "file://" + os.path.join(os.path.dirname(os.path.abspath(__file__)), jingle) # filename of the jingle to be player # The DrawingArea is used to display the title and animation self.drawarea = Gtk.DrawingArea() self.drawarea.set_size_request(self.width,self.height) self.drawarea.connect("draw", self.draw) self.add(self.drawarea) #Connect the EventBox to the click event self.connect("button-press-event", self.on_clicked, "Hallo") #Only play the animation, when the button is pressed self.active = False self.position = 0 #set radius depending on button size self.radius = math.sqrt((self.width/2)**2+(self.height/2)**2) #initialize the player self.player = Gst.ElementFactory.make("playbin", "player") self.player.set_property('uri', self.jingle) self.player.connect("about_to_finish", self.on_finished) bus = self.player.get_bus() def draw(self, widget, cr): cr.set_source_rgb(self.color[0], self.color[1], self.color[2]) cr.rectangle(0,0,self.width,self.height) cr.fill_preserve() cr.set_source_rgb(0, 0, 0) cr.stroke() #move origin to center of Drawingarea cr.translate(self.width/2, self.height/2) cr.set_source_rgb(1,1,1) cr.select_font_face("Sans") cr.set_font_size(20) #get extents of text to center it self.extents = cr.text_extents(self.title) cr.move_to(-self.extents[2]/2,-self.extents[3]/2) cr.show_text(self.title) if self.active == True: cr.rotate(-math.pi/2) cr.set_source_rgba(1,1,1,0.25) cr.move_to(0,0) cr.line_to(self.radius,0) cr.arc_negative(0,0,self.radius,0,(self.percentage*3.6)*math.pi/180) cr.line_to(0,0) cr.fill() def animate(self): if self.active == False: return False else: if self.percentage > 99: self.player.set_state(Gst.State.NULL) self.active = False return False else: self.duration = self.player.query_duration(Gst.Format.TIME)[1] self.position = self.player.query_position(Gst.Format.TIME)[1] if self.duration != 0: self.percentage = (self.position / self.duration) * 100 self.drawarea.queue_draw() return True # called when the button is clicked def on_clicked(self, widget, event, data): if self.active == False: self.player.set_state(Gst.State.NULL) self.activate() else: self.deactivate() self.player.set_state(Gst.State.NULL) def activate(self): self.active = True self.percentage = 0 self.player.set_state(Gst.State.PLAYING) self.id = GObject.timeout_add(50, self.animate) def deactivate(self): GObject.source_remove(self.id) self.active = False self.drawarea.queue_draw() # called by about-to-finish-event of player def on_finished(self, player): # time.sleep(1) is needed, since about-to-finish is triggered while # file is still playing. Short Samples would then display # no animation at all, and program is likely to crash :( time.sleep(1) self.deactivate() # called when a message occurs on the bus def on_message(self, bus, message): t = message.type if t == Gst.Message.EOS: self.player.set_state(Gst.State.NULL) self.active = False elif t == Gst.Message.Error: self.player.set_state(Gst.State.NULL) err, debug = message.parse_error() print("Error: %s" % err, debug) self.active = False class JingleBank(Gtk.Window): def on_key_release(self, widget, ev, data=None): # Quit by pressing ESC if ev.keyval == Gdk.KEY_Escape: Gtk.main_quit() def __init__(self): Gtk.Window.__init__(self, title="JingleBank") Gst.init(None) #Read config file cfg = configparser.ConfigParser() cfg.read('settings.cfg') #Grid to organize the Buttons self.grid = Gtk.Grid() self.add(self.grid) #Set Button properties (will be replaced by configurable button dimensions) self.buttonwidth = int(cfg["GUI"]["ButtonWidth"]) self.buttonheight = int(cfg["GUI"]["ButtonHeight"]) #Filter for JINGLE sections in config and create for each a button buttons = ( x for x in cfg.sections() if x.startswith('JINGLE') ) for jingle in buttons: btncfg = cfg[jingle] self.grid.attach( JingleButton(self.buttonwidth, self.buttonheight, [float(btncfg["ColorR"]),float(btncfg["ColorG"]),float(btncfg["ColorB"])], btncfg["Title"], btncfg["File"]), int(btncfg["PosX"]), int(btncfg["PosY"]), 1, 1) #Key release handler self.connect("key-release-event", self.on_key_release) if __name__=="__main__": win = JingleBank() win.connect("delete-event", Gtk.main_quit) win.connect("destroy", Gtk.main_quit) win.show_all() Gtk.main()
''' Holds the base configuration options for charts. The options are in YAML format and then converted to a Python dictionary. Set Tab to 2 spaces. ''' import yaml # ------------------------------------ For Plotly Chart ----------------------------- plotly_opt = yaml.load( ''' renderTo: chart_container # the name of the div to render into data: [] # Trace data is programmatically added here layout: font: family: Open Sans, verdana, arial, sans-serif color: black paper_bgcolor: '#EEEEEE' hovermode: closest titlefont: size: 22 autosize: true margin: l: 65 r: 20 b: 10 t: 75 pad: 5 showlegend: true legend: orientation: h xanchor: center yanchor: top x: 0.5 y: -0.2 borderwidth: 1 xaxis: title: Date/Time titlefont: size: 14 yaxis: title: Value titlefont: size: 14 config: showLink: false displaylogo: false scrollZoom: true ''') def chart_container_html(title="Plotly Chart"): # Generate a container element and a hidden title return '<h2 id="report_title" hidden>{}</h2><div id="chart_container" style="border-style:solid; border-width:2px; border-color:#4572A7; flex-grow:1"></div>'.format(title)
import numpy as np from progressivis.core.utils import (slice_to_arange, indices_len, fix_loc) from . import Table from . import TableSelectedView from ..core.slot import SlotDescriptor from .module import TableModule from ..core.bitmap import bitmap from .mod_impl import ModuleImpl from .binop import ops from collections import OrderedDict class Percentiles(TableModule): """ """ parameters = [('accuracy', np.dtype(float), 0.5) ] def __init__(self, hist_index, scheduler=None, **kwds): """ """ self._add_slots(kwds, 'input_descriptors', [SlotDescriptor('table', type=Table, required=True), SlotDescriptor('percentiles', type=Table, required=True)]) super(Percentiles, self).__init__(scheduler=scheduler, **kwds) #self._impl = PercentilesImpl(self.params.accuracy, hist_index) self._accuracy = self.params.accuracy self._hist_index = hist_index self.default_step_size = 1000 def compute_percentiles(self, points, input_table): column = input_table[self._hist_index.column] hii = self._hist_index._impl def _filter_tsv(bm): return bm & input_table.selection def _no_filtering(bm): return bm _filter = _filter_tsv if isinstance(input_table, TableSelectedView) else _no_filtering len_ = len(input_table) k_points = [p*(len_+1)*0.01 for p in points.values()] max_k = max(k_points) ret_values = [] k_accuracy = self._accuracy * len_ * 0.01 acc = 0 lbm = len(hii.bitmaps) acc_list = np.empty(lbm, dtype=np.int64) sz_list = np.empty(lbm, dtype=np.int64) bm_list = [] for i, bm in enumerate(hii.bitmaps): fbm = _filter(bm) sz = len(fbm) acc += sz sz_list[i] = sz acc_list[i] = acc bm_list.append(fbm) if acc > max_k: break # just avoids unnecessary computes acc_list = acc_list[:i+1] #import pdb;pdb.set_trace() for k in k_points: i = (acc_list>=k).nonzero()[0][0] reminder = int(acc_list[i] - k) assert sz_list[i] > reminder >= 0 if sz_list[i] < k_accuracy: #print("the fast way") ret_values.append(column[bm_list[i][0]]) else: #print("the accurate way") values = column.loc[bm_list[i]] part = np.partition(values, reminder) ret_values.append(values[reminder]) return OrderedDict(zip(points.keys(), ret_values)) def run_step(self, run_number, step_size, howlong): input_slot = self.get_input_slot('table') input_slot.update(run_number) steps = 0 if input_slot.deleted.any(): input_slot.deleted.next(step_size) steps = 1 if input_slot.created.any(): input_slot.created.next(step_size) steps = 1 if input_slot.updated.any(): input_slot.updated.next(step_size) steps = 1 with input_slot.lock: input_table = input_slot.data() param = self.params percentiles_slot = self.get_input_slot('percentiles') percentiles_slot.update(run_number) percentiles_changed = False if percentiles_slot.deleted.any(): percentiles_slot.deleted.next() if percentiles_slot.updated.any(): percentiles_slot.updated.next() percentiles_changed = True if percentiles_slot.created.any(): percentiles_slot.created.next() percentiles_changed = True if len(percentiles_slot.data()) == 0: return self._return_run_step(self.state_blocked, steps_run=0) if steps==0 and not percentiles_changed: return self._return_run_step(self.state_blocked, steps_run=0) if not self._hist_index._impl: return self._return_run_step(self.state_blocked, steps_run=0) computed = self.compute_percentiles( percentiles_slot.data().last().to_dict(ordered=True), input_slot.data()) if not self._table: self._table = Table(name=None, dshape=percentiles_slot.data().dshape) self._table.add(computed) else: self._table.loc[0, :] = list(computed.values()) return self._return_run_step(self.next_state(input_slot), steps_run=steps)
import warnings from torch.optim import ASGD, SGD, Adadelta, Adagrad, Adam, Adamax, AdamW, RMSprop from torch.optim.lr_scheduler import ( CosineAnnealingLR, CosineAnnealingWarmRestarts, CyclicLR, ExponentialLR, LambdaLR, ReduceLROnPlateau, ) from .utils import adjust_optim_params EXTRA_OPTIM_LOOKUP = {} try: from torch_optimizer import ( PID, QHM, SGDW, AccSGD, AdaBelief, AdaBound, AdaMod, AdamP, Apollo, DiffGrad, Lamb, Lookahead, NovoGrad, QHAdam, RAdam, Ranger, RangerQH, RangerVA, Yogi, ) EXTRA_OPTIM_LOOKUP = { "accsgd": AccSGD, "adabound": AdaBound, "adabelief": AdaBelief, "adamp": AdamP, "apollo": Apollo, "adamod": AdaMod, "diffgrad": DiffGrad, "lamb": Lamb, "novograd": NovoGrad, "pid": PID, "qhadam": QHAdam, "qhm": QHM, "radam": RAdam, "sgwd": SGDW, "yogi": Yogi, "ranger": Ranger, "rangerqh": RangerQH, "rangerva": RangerVA, "lookahead": Lookahead, } except ModuleNotFoundError: warnings.warn( "`torch_optimizer` optimzers not available. To use them, install with " "`pip install torch-optimizer`." ) SCHED_LOOKUP = { "lambda": LambdaLR, "reduce_on_plateau": ReduceLROnPlateau, "cyclic": CyclicLR, "exponential": ExponentialLR, "cosine_annealing": CosineAnnealingLR, "cosine_annealing_warm": CosineAnnealingWarmRestarts, } OPTIM_LOOKUP = { "adam": Adam, "rmsprop": RMSprop, "sgd": SGD, "adadelta": Adadelta, "adagrad": Adagrad, "adamax": Adamax, "adamw": AdamW, "asgd": ASGD, **EXTRA_OPTIM_LOOKUP, } __all__ = [ "SCHED_LOOKUP", "OPTIM_LOOKUP", "LambdaLR", "ReduceLROnPlateau", "CosineAnnealingLR", "CosineAnnealingWarmRestarts", "CyclicLR", "ExponentialLR", "Adam", "RMSprop", "SGD", "Adadelta", "Adagrad", "Adamax", "AdamW", "ASGD", "AccSGD", "AdaBound", "AdaBelief", "AdamP", "Apollo", "AdaMod", "DiffGrad", "Lamb", "NovoGrad", "PID", "QHAdam", "QHM", "RAdam", "SGDW", "Yogi", "Ranger", "RangerQH", "RangerVA", "Lookahead", "adjust_optim_params", ]
#!/usr/bin/python3 # Webbrowser v1.0 # Written by Sina Meysami # from tkinter import * # pip install tk-tools import tkinterweb # pip install tkinterweb import sys class Browser(Tk): def __init__(self): super(Browser,self).__init__() self.title("Tk Browser") try: browser = tkinterweb.HtmlFrame(self) browser.load_website("https://google.com") browser.pack(fill="both",expand=True) except Exception: sys.exit() def main(): browser = Browser() browser.mainloop() if __name__ == "__main__": # Webbrowser v1.0 main()
from max.regex import RE_VALID_HASHTAG from max.regex import RE_VALID_TWITTER_USERNAME import re def stripHash(text): """ Returns the valid part of a hashtag input, lowercased """ return re.sub(RE_VALID_HASHTAG, r'\1', text).lower() def stripTwitterUsername(text): """ Returns the valid part of a twitter username input, lowercased """ return re.sub(RE_VALID_TWITTER_USERNAME, r'\1', text).lower()
import matplotlib.pyplot as plt import matplotlib import math from dataclasses import dataclass import itertools # stolen from matplotlib.ticker.LogFormatterExponent class LogFormatter(matplotlib.ticker.LogFormatter): def _num_to_string(self, x, vmin, vmax): fx = math.log(x) / math.log(self._base) if abs(fx) > 10000: s = '%1.0g' % fx elif abs(fx) < 1: s = '%1.0g' % fx else: fd = math.log(vmax - vmin) / math.log(self._base) s = self._pprint_val(fx, fd) return "$" + str(int(self._base)) + "^{" + s + "}$" _k = 1024 _m = _k*_k Q = [8, 16, 32, 64] N = [int(pow(2, 18)), int(pow(2, 20)), int(pow(2, 22)), int(pow(2, 24)), int(pow(2, 26))] # 256k 1M 4M 16M 64M M = [64*_k, 128*_k, 256*_k, 1*_m, 2*_m, 4*_m, 8*_m] B = [8*_k, 16*_k, 64*_k, 128*_k, 512*_k] ALL_PARAMS = ("q", "n", "m", "b") @dataclass class Row: q: int n: int m: int b: int time: int def load(name): arr = [] with open(f"results-{name}.txt") as f: for l in f: parts = l.split(" ") arr.append(Row(*(int(p.strip()) for p in parts))) return arr def filter(data, out_key, filter): arr = [] for row in data: if any(filter.get(key) and getattr(row, key) != filter[key] for key in ALL_PARAMS): continue arr.append(getattr(row, out_key)) return arr data_finn = load("finn") data_joshua = load("joshua") data_levin = load("levin") data_default = load("normal_mergesort") # plot one _filter = {"q": 64, "m": 8*_m, "b": 8*_k} x = filter(data_finn, "n", _filter) ax = plt.subplot(1, 1, 1) for data in (data_joshua, data_default): _data = filter(data, "time", _filter) ax.plot(x, _data) ax.scatter(x, _data) ax.grid() # ax.legend([f"$m=2^{{{int(math.log(m, 2))}}}$" for m in M]) plt.xlabel("Anzahl Elemente") plt.ylabel("Laufzeit in ms") plt.xscale("log") ax.get_xaxis().set_major_locator(matplotlib.ticker.LogLocator(base=2)) ax.get_xaxis().set_minor_locator(matplotlib.ticker.NullLocator()) ax.get_xaxis().set_major_formatter(LogFormatter(base=2)) ax.set_xticks(N) # plt.yscale("log") # ax.get_yaxis().set_major_locator(matplotlib.ticker.LogLocator(base=2)) # ax.get_yaxis().set_minor_locator(matplotlib.ticker.NullLocator()) # ax.get_yaxis().set_major_formatter(LogFormatter(base=2)) # ax.set_yticks(N) plt.title(", ".join(f"${k}=2^{{{int(math.log(v, 2))}}}$" for k, v in _filter.items() if v is not None)) plt.show() # # plot all # for q, n, m, b in itertools.product(Q + [None], N + [None], M + [None], B + [None]): # _filter = {"n": n, "q": q, "m": m, "b": b} # if list(_filter.values()).count(None) != 1: # continue # if m and b and (m/b) < 4: # continue # param = list(_filter.keys())[list(_filter.values()).index(None)] # x = filter(data_finn, param, _filter) # ax = plt.subplot(1, 1, 1) # for data in (data_levin, data_joshua, data_finn): # _data = filter(data, "time", _filter) # ax.plot(x, _data) # ax.scatter(x, _data) # ax.grid() # ax.legend(["Levin", "Joshua", "Finn"]) # plt.xscale("log") # plt.xlabel([p for p in ALL_PARAMS if _filter.get(p) is None][0].upper() + " in bytes") # plt.ylabel("Laufzeit in ms") # ax.get_xaxis().set_major_locator(matplotlib.ticker.LogLocator(base=2)) # ax.get_xaxis().set_minor_locator(matplotlib.ticker.NullLocator()) # ax.get_xaxis().set_major_formatter(LogFormatter(base=2)) # if q is None: # ax.set_xticks(Q) # elif n is None: # ax.set_xticks(N) # elif m is None: # ax.set_xticks(M) # elif b is None: # ax.set_xticks(B) # plt.title(", ".join(f"${k}=2^{{{int(math.log(v, 2))}}}$" for k, v in _filter.items() if v is not None)) # plt.savefig(f"img/{param}__" + "_".join(f"{k}_{v}" for k, v in _filter.items() if v is not None) + ".pdf") # plt.close()
import subprocess import time a = subprocess.check_output(["/opt/vc/bin/tvservice", "-s"], shell=False) print ("Erster Status ist: " + str(a)) time.sleep(5) subprocess.call(["/opt/vc/bin/tvservice", "-p"], shell=False) subprocess.call(["sudo", "/bin/chvt", "6"], shell=False) subprocess.call(["sudo", "/bin/chvt", "7"], shell=False) b = subprocess.check_output(["/opt/vc/bin/tvservice", "-s"], shell=False) print ("Zweiter Status ist: " + str(b)) time.sleep(5) subprocess.call(["/opt/vc/bin/tvservice", "-o"], shell=False) c = subprocess.check_output(["/opt/vc/bin/tvservice", "-s"], shell=False) print ("Dritter Status ist: " + str(c))
import asyncio import discord client = discord.Client() # 복사해 둔 토큰을 your_token에 넣어줍니당 token = "ODc2MzkwNTAzNjUyOTQ1OTMw.YRjYQg.S0dXPfBMDrAzXO8hSqXBeO0EEmo" # 봇이 구동되었을 때 동작되는 코드 @client.event async def on_ready(): print("봇연습#6890") #화면에 봇의 아이디, 닉네임이 출력되는 코드 print(client.user.name) print(client.user.id) print("===========") @client.event async def on_ready(): await client.change_presence(status=discord.Status.offline) game = discord.Game("시작하는 중...") await client.change_presence(status=discord.Status.online, activity=game) while True: game = discord.Game("안녕하세요? 챗봇입니다") await client.change_presence(status=discord.Status.online, activity=game) await asyncio.sleep(3) game = discord.Game("아직 베타 테스트 중이예요~") await client.change_presence(status=discord.Status.online, activity=game) await asyncio.sleep(3) # 디스코드에는 현재 본인이 어떤 게임을 플레이하는지 보여주는 기능이 있습니다. # 이 기능을 사용하여 봇의 상태를 간단하게 출력해줄 수 있습니다. # 봇이 새로운 메시지를 수신했을때 동작되는 코드입니다. @client.event async def on_message(message): if message.author.bot: #만약 메시지를 보낸사람이 봇일 경우에는 return None #동작하지 않고 무시합니다. id = message.author.id #id라는 변수에는 메시지를 보낸사람의 ID를 담습니다. channel = message.channel #channel이라는 변수에는 메시지를 받은 채널의 ID를 담습니다. if message.content.startswith('!안녕'): channel = message.channel await channel.send('안녕하세요? 오늘도 좋은하루 보내세요!') if message.content == "!임베드": embed = discord.Embed(title = "테스트봇의 도움말", description = ''' 예시''', color = 0xffffff) # 여기예요! 0xffffff중 ffffff를 #을 뺀 나머지 것들을 붙여넣기 해주세요! await message.channel.send(embed = embed) if message.content.startswith('!병신'): channel = message.channel await channel.send('병신새끼') client.run(token)
def choose_median(start, middle, end): # finish the method for finding the median pivot = [start, middle, end] pivot.sort() return pivot[1] def partition(lst, pivot, start, end): # add necessary modifications # don't forget to print the result of the partition! pivot = lst.index(pivot) print(f'index of pivot is {pivot}') j = start for i in range(start, end): if lst[i] <= lst[pivot]: j += 1 lst[i], lst[j] = lst[j], lst[i] lst[start], lst[j] = lst[j], lst[start] return j # read the input list # and call the methods lst = [int(n) for n in '3 6 5 2 4'.split()] my_pivot = choose_median(lst[0], lst[len(lst) // 2], lst[len(lst)-1]) print(f'pivot is {my_pivot}') partition(lst, my_pivot, 0, len(lst) - 1) print(f'list after partion {lst}')
''' 请实现一个函数用来判断字符串是否表示数值(包括整数和小数)。 例如,字符串"+100","5e2","-123","3.1416"和"-1E-16"都表示数值。 但是"12e","1a3.14","1.2.3","+-5"和"12e+4.3"都不是。 思路: 定义两个标志位,分别表示E或者e是否出现过,以及小数点.是否出现过。 1. 以e(或E)为分隔,获得两个子字符串;e之前的字符串小数点只能出现一次;e之后的字符串不允许出现小数点; 2. 符号位+或-只可能出现在两个子字符串的首位; 3. e(或E)、小数点.不能出现在末尾 ''' # -*- coding:utf-8 -*- class Solution: # s字符串 def isNumeric(self,s): isAllowDot = True isAllowE = True for i in range(len(s)): if s[i] in "+-" and (i==0 or s[i-1] in "eE") and i < len(s)-1: continue elif isAllowDot and s[i] == ".": isAllowDot = False if i >= len(s)-1 or s[i+1] not in "0123456789": return False elif isAllowE and s[i] in "Ee": isAllowDot = False isAllowE = False if i >= len(s)-1 or s[i+1] not in "0123456789+-": return False elif s[i] not in "0123456789": return False return True class Solution2: # s字符串 def isNumeric(self, s): # write code here if len(s) <= 0: return False # 分别标记是否出现过正负号、小数点、e,因为这几个需要特殊考虑 has_sign = False has_point = False has_e = False for i in range(len(s)): # 对于e的情况 if s[i] == 'E' or s[i] == 'e': # 不同出现两个e if has_e: return False # e不能出现在最后面,因为e后面要接数字 else: has_e = True if i == len(s) -1: return False # 对于符号位的情况 elif s[i] == '+' or s[i] == '-': # 如果前面已经出现过了符号位,那么这个符号位,必须是跟在e后面的 if has_sign: if s[i-1] != 'e' and s[i-1] != 'E': return False # 如果这是第一次出现符号位,而且出现的位置不是字符串第一个位置,那么就只能出现在e后面 else: has_sign = True if i > 0 and s[i-1] != 'e' and s[i-1] != 'E': return False # 对于小数点的情况 elif s[i] == '.': # 小数点不能出现两次;而且如果已经出现过e了,那么就不能再出现小数点,因为e后面只能是整数 if has_point or has_e: return False # 如果是第一次出现小数点,如果前面出现过e,那么还是不能出现小数点 else: has_point = True if i > 0 and (s[i-1] == 'e' or s[i-1] == 'E'): return False else: # 其他字符必须是‘0’到‘9’之间的 if s[i] < '0' or s[i] > '9': return False return True
import pytest import exercise_part1 import exercise_part2 def test_solve_part1() -> None: expected = 4 with open('test_input.txt') as f: assert exercise_part1.solve(f.read()) == expected @pytest.mark.parametrize( ('input_path', 'expected'), [ ('test_input.txt', 32), ('test_input2.txt', 126) ], ) def test_solve_part2(input_path: str, expected: int) -> None: with open(input_path) as f: assert exercise_part2.solve(f.read()) == expected
# derived off of example in Corey Schafer youtube channel # create decorator function def decorator_function(inner_function): def wrapper_function(): print("Running decorator1 before '{}'".format(inner_function.__name__)) return inner_function() return wrapper_function def display_function(): print('running display function') @decorator_function def display2_function(): print('running display2 function') # run the functions display = decorator_function(display_function) display() # run decorated function print() display2 = display2_function display2()
import media import fresh_tomatoes #define instances of Class Movie toy_story = media.Movie("Toy Story", "A story of a boy and his toys that come to life", "https://upload.wikimedia.org/wikipedia/en/1/13/Toy_Story.jpg", "https://www.youtube.com/watch?v=vwyZH85NQC4") #media = name of Python file. Movie = name of the class defined in file # calls the init function. Self = toy_story # print(toy_story.storyline) avatar = media.Movie("Avatar", "A marine on an alien planet", "http://upload.wikimedia.org/wikipedia/id/b/b0/Avatar-Teaser-Poster.jpg", "https://www.youtube.com/watch?v=6ziBFh3V1aM") #print(avatar.storyline) #avatar.show_trailer() lion_king = media.Movie("Lion King", "The life of a young cub", "https://upload.wikimedia.org/wikipedia/en/3/3d/The_Lion_King_poster.jpg", "https://www.youtube.com/watch?v=4sj1MT05lAA") # lion_king.show_trailer() wonder_woman = media.Movie("Wonder Woman", "Superhero stops villain from chemical attack to stop WW1", "https://upload.wikimedia.org/wikipedia/en/e/ed/Wonder_Woman_%282017_film%29.jpg", "https://www.youtube.com/watch?v=1Q8fG0TtVAY") fried_green_tomatoes = media.Movie("Fried Green Tomatoes", "Tells the story of a Depression-era friendship between two women", "https://upload.wikimedia.org/wikipedia/en/6/6e/Fried_Green_Tomatoes_%28poster%29.jpg", "https://www.youtube.com/watch?v=T2W0TeuHbJ0") forrest_gump = media.Movie("Forrest Gump", "Follows several decades of a slow-witted, but kind-hearted man from Alabama", "https://upload.wikimedia.org/wikipedia/en/6/67/Forrest_Gump_poster.jpg", "https://www.youtube.com/watch?v=bLvqoHBptjg") movies = [toy_story, avatar, lion_king, wonder_woman, fried_green_tomatoes, forrest_gump] # fresh_tomatoes.open_movies_page(movies) # print(media.Movie.VALID_RATINGS) print(media.Movie.__doc__) #Documentation of class print(media.Movie.__name__) #Name of class print(media.Movie.__module__) #Name of file module
from __future__ import print_function def cross_off(flags, prime): """ Cross of (set to False) those indexes that are divisible by `prime` """ i = prime * prime while i < len(flags): flags[i] = False i += prime def get_next_prime(flags, prime): """Find the index of the first True in flags after `prime`""" np = prime + 1 while np < len(flags) and flags[np] is False: np += 1 return np def generate_primes(n): """Generate a list of primes between 1 and n""" flags = [True for i in range(n)] flags[0] = False flags[1] = False prime = 2 while prime < n: cross_off(flags, prime) prime = get_next_prime(flags, prime) for i, e in enumerate(flags): if e is True: yield i def _test(): pass def _print(): primes = list(generate_primes(20)) print(primes) if __name__ == '__main__': _test() _print()
#!/usr/bin/env python import platform from os.path import abspath, dirname, join import sys from robot import run, rebot from robot.version import VERSION as rf_version from robotstatuschecker import process_output library_variants = ['Hybrid', 'Dynamic', 'ExtendExisting'] curdir = dirname(abspath(__file__)) outdir = join(curdir, 'results') tests = join(curdir, 'tests.robot') tests_types = join(curdir, 'tests_types.robot') sys.path.insert(0, join(curdir, '..', 'src')) python_version = platform.python_version() for variant in library_variants: output = join(outdir, 'lib-{}-python-{}-robot-{}.xml'.format(variant, python_version, rf_version)) rc = run(tests, name=variant, variable='LIBRARY:%sLibrary' % variant, output=output, report=None, log=None, loglevel='debug') if rc > 250: sys.exit(rc) process_output(output, verbose=False) output = join(outdir, 'lib-DynamicTypesLibrary-python-{}-robot-{}.xml'.format(python_version, rf_version)) exclude = "py310" if sys.version_info < (3, 10) else "" rc = run(tests_types, name='Types', output=output, report=None, log=None, loglevel='debug', exclude=exclude) if rc > 250: sys.exit(rc) process_output(output, verbose=False) print('\nCombining results.') library_variants.append('DynamicTypesLibrary') rc = rebot(*(join(outdir, 'lib-{}-python-{}-robot-{}.xml'.format(variant, python_version, rf_version)) for variant in library_variants), **dict(name='Acceptance Tests', outputdir=outdir, log='log-python-{}-robot-{}.html'.format(python_version, rf_version), report='report-python-{}-robot-{}.html'.format(python_version, rf_version))) if rc == 0: print('\nAll tests passed/failed as expected.') else: print('\n%d test%s failed.' % (rc, 's' if rc != 1 else '')) sys.exit(rc)
from django.views import generic from django.contrib.auth import mixins from django.db.models import Min, Max class ProfileTemplateView(mixins.LoginRequiredMixin, generic.TemplateView): template_name = 'accounts/profile.html' class IndexView(generic.TemplateView): template_name = 'index.html' def get_context_data(self, **kwargs): user = self.request.user if user.is_authenticated: value_dict = user.value_set.aggregate(Min('date'), Max('date')) date__min = value_dict['date__min'] date__max = value_dict['date__max'] if date__min and date__max: max_year = date__max.year max_month = date__max.month window_month = max_month - 3 min_year = max_year if window_month > 0 else (max_year - 1) min_month = window_month if window_month > 0 else (window_month + 12) asset_queryset = user.asset_set.filter(hide=False) row_list = [['Year/Month'] + list(asset_queryset.values_list('name', flat=True))] while min_year < max_year or min_year == max_year and min_month <= max_month: row = [f'{min_year}/{min_month}'] for asset in asset_queryset: value = asset.value_set.filter(date__year=min_year, date__month=min_month).first() if value is None: row.append('null') else: initial_price = (value.price - value.delta) if initial_price: row.append(value.delta / initial_price) else: row.append('null') row_list.append(row) if min_month < 12: min_month += 1 else: min_month = 1 min_year += 1 kwargs.update(dict(row_list=row_list)) return super().get_context_data(**kwargs)
#!/usr/bin/python3 import json import sys import dataclean as clean def main(): reader = open(sys.argv[1]) writer = open(sys.argv[2],"w") data = reader.readlines() for d in data : article = json.loads(d) text= article["text"] lines=text.replace('\n',"#") text=''.join(lines) text=clean.dataclean(text) writer.write(text+"\n") writer.close() reader.close() main()
################################################################################ # Authors: # # · Alejandro Santorum Varela - alejandro.santorum@estudiante.uam.es # # Date: April 15, 2019 # # File: crypto_util.py # # Project: Termail # # Version: 1.5 # ################################################################################ # Pseudo-random byte generator from Crypto.Random import get_random_bytes # Pseudo-random intenger generator from Crypto.Random.random import randint # Pseudo-random prime generator from Crypto.Util.number import getPrime # Symmetric cipher (AES) and asymmetric cipher (RSA) from Crypto.Cipher import AES, PKCS1_OAEP # Padding to cipher using AES in mode CBC from Crypto.Util.Padding import pad, unpad # Digital sign from Crypto.Signature import pkcs1_15 # Public and private keys for RSA algorithm from Crypto.PublicKey import RSA # Hash SHA256 from Crypto.Hash import SHA256 # Other from math import gcd import sys ################################################################ # generate_RSA_keys # Input: # - priv_key_file: file where private key is going to be stored # - publ_key_file: file where public key is going to be stored # Output: # - private key & public key generated # Description: # It generates a RSA public key and private key couple # Raises ValueError in error case ################################################################ def generate_RSA_keys(priv_key_file, publ_key_file): try: # Initializing RSA key = RSA.generate(2048) # Getting private key and saving it into a file private_key = key.exportKey() file_out = open(priv_key_file, "wb") file_out.write(private_key) file_out.close() # Getting public key and saving it into a file public_key = key.publickey().exportKey() file_out = open(publ_key_file, "wb") file_out.write(public_key) file_out.close() # Returning both keys successfully return private_key, public_key except: raise ValueError("ERROR: Unable to generate RSA keys") ################################################################ # digital_sign # Input: # - message: plaint text to be signed # - sender_priv_key_file: file where sender private key is stored # Output: # - signature (signed message) # Description: # It signes message's hash (hashed using SHA256) # Raises ValueError in error case ################################################################ def digital_sign(message, sender_priv_key_file): if sender_priv_key_file==None and sender_priv_key==None: raise ValueError("ERROR: No private RSA key provided") try: # Getting key from the file where it's stored key = RSA.import_key(open(sender_priv_key_file).read()) # Hashing the data with SHA256 h = SHA256.new(message) # Signature signature = pkcs1_15.new(key).sign(h) return signature except: raise ValueError("ERROR: Unable to sign the message") ################################################################ # encrypt_AES256_CBC # Input: # - message: message to encrypt # - digital_sign (optional): signature to be added at the beginning # of the message # - symm_key (optional): symmetric key to use. If it is not # provided it will create a 32 byte random key # Output: # - ciphered text (containing signature+message) # - iv # - used symmetric key # Description: # It puts together the signature with the message, and then encrypts # the text using AES 256 bits with IV of 16 bytes in CBC mode # Raises ValueError in error case ################################################################ SESSION_KEY_BYTES = 32 BLOCK_SIZE = 16 def encrypt_AES256_CBC(message, digital_sign=None, symm_key=None): try: # Concatenating signature+plain text if signature is provided if digital_sign != None: text = digital_sign+message else: text = message # Padding text, so its length is multiple of block size (16) text_pad = pad(text, BLOCK_SIZE) if symm_key == None: # Getting session key (symmetric key) of 32 bytes session_key = get_random_bytes(SESSION_KEY_BYTES) else: session_key = symm_key # Initialization vector of legth as the block size (16) iv = get_random_bytes(BLOCK_SIZE) # Symmetric AES256 Cipher cipher = AES.new(session_key, AES.MODE_CBC, iv=iv) ciphertext = cipher.encrypt(text_pad) # Returning ciphered text + symmetric key (session_key + iv) return ciphertext, iv, session_key except: raise ValueError("ERROR: Unable to cipher message using AES256 CBC mode") ################################################################ # encrypt_RSA2048 # Input: # - symm_key: symmetric key to be encrypted # - receiver_publ_key: RSA public key of the receiver of the message # Output: # - ciphered symmetric key # Description: # It cipheres a symmetric key using RSA 2048 bits to be deciphered # by a certain user # Raises ValueError in error case ################################################################ def encrypt_RSA2048(symm_key, receiver_publ_key): try: # Getting RSA cipher cipher_rsa = PKCS1_OAEP.new(receiver_publ_key) # Ciphering symmetric key cipherkey = cipher_rsa.encrypt(symm_key) return cipherkey except: raise ValueError("ERROR: Unable to cipher symmetric key using RSA2048") ################################################################ # decrypt_RSA2048 # Input: # - digital_envelope: text where a symmetric key is suppossed # to be encrypted # - priv_key_file: file where private key is stored # Output: # - decrypted symmetric key # Description: # It deciphers a symmetric key that has been ciphered using RSA2048 # Raises ValueError in error case ################################################################ def decrypt_RSA2048(digital_envelope, priv_key_file): try: # Getting private key of the receiver of the ciphered message priv_key = RSA.import_key(open(priv_key_file).read()) # Getting RSA decrypter cipher_rsa = PKCS1_OAEP.new(priv_key) # Deciphering symmetric key symm_key = cipher_rsa.decrypt(digital_envelope) return symm_key except: raise ValueError("ERROR: Unable to decipher symmetric key using RSA2048") ################################################################ # decrypt_AES256_CBC # Input: # - cipher_msg: message to be deciphered # - symm_key: symmetryc key used to cipher the message # - sign_flag (optional): flag that indicates the message contains # a signature, so the method separates the message and the sign # Output: # - deciphered text if sign_flag=0, or deciphered text + digital_sign # if sign_flag=1 # Description: # It decipheres a ciphered message using AES 256 bits with IV of # 16 bytes in CBC mode with the provided symmetric key # Raises ValueError in error case ################################################################ SIGN_SIZE = 256 def decrypt_AES256_CBC(cipher_msg, symm_key, sign_flag=0): try: # Getting Session key and Initialization vector session_key = symm_key iv = cipher_msg[:BLOCK_SIZE] cipher_msg = cipher_msg[BLOCK_SIZE:] # Getting AES256 decrypter cipher = AES.new(session_key, AES.MODE_CBC, iv=iv) # Getting plain text after deciphering text_pad = cipher.decrypt(cipher_msg) # Unpadding text = unpad(text_pad, BLOCK_SIZE) # Separating digital sign from message if sign_flag is ON (1) if sign_flag: digital_sign = text[:SIGN_SIZE] message = text[SIGN_SIZE:] return message, digital_sign else: return text except: raise ValueError("ERROR: Unable to decipher message using AES256 CBC mode") ################################################################ # verify_signature # Input: # - message: signed message # - digital_sign: sign of the provided message # - sender_publ_key: RSA public key of the message's sender # Output: # - True in case the signature is satisfied or it raises an # Exception if it does not match # Description: # It verifies if a digital sign of a message is truly correct, # providing sender's RSA public key. ################################################################ def verify_signature(message, digital_sign, sender_publ_key): try: # Hash message h = SHA256.new(message) # Checking if hash of the ciphered message is equal to the digital sign pkcs1_15.new(sender_publ_key).verify(h, digital_sign) return True except Exception as err: raise Exception("ERROR Verifying sign: "+str(err)) #return False ################################################################ # _check_coprime # Input: # - n: integer number # - m: another integer number # Output: # - True, if both numbers are coprimes. False otherwise # Description: # It checks if the two provided numbers are coprimes ################################################################ def _check_coprime(n,m): return gcd(n,m)==1 ################################################################ # get_element_in_Zp # Input: # - prime: a prime number # Output: # - a coprime number with 'prime' in range(2, prime) # Description: # It returns a element in Zp, what means it returns a coprime # number with the provided prime ################################################################ def get_element_in_Zp(prime): while 1: aux = randint(2,prime) if _check_coprime(aux,prime): return aux return -1 ################################################################ # get_random_nbit_prime # Input: # - n: integer number # Output: # - prime number of n bits # Description: # It returns a n-bit prime number ################################################################ def get_random_nbit_prime(n): return getPrime(n) ################################################################ # get_randint_range # Input: # - a: integer number # - b: integer number greater than a # Output: # - a random integer between a and b (both included) # Description: # It returns random integer number between a and b ################################################################ def get_randint_range(a,b): return randint(a,b)
import pygame import numpy as np from doom_py.CONFIGS import TILE_X, TILE_Y, MAX_DEPTH def gradientRect( window, leftbottom_colour, righttop_colour, target_rect, is_vertical=True ): """ Draw a horizontal-gradient filled rectangle covering <target_rect> """ colour_rect = pygame.Surface( ( 2, 2 ) ) # tiny! 2x2 bitmap if is_vertical: pygame.draw.line(colour_rect, leftbottom_colour, (0, 1), (1, 1)) # bottom colour line pygame.draw.line(colour_rect, righttop_colour, (0, 0), (1, 0)) # top colour line else: pygame.draw.line( colour_rect, leftbottom_colour, ( 0,0 ), ( 0,1 ) ) # left colour line pygame.draw.line( colour_rect, righttop_colour, ( 1,0 ), ( 1,1 ) ) # right colour line colour_rect = pygame.transform.smoothscale( colour_rect, ( target_rect.width, target_rect.height ) ) # stretch! window.blit( colour_rect, target_rect ) # paint it def to_index(pos): return np.int8(pos[0]//TILE_X), np.int8(pos[1]//TILE_Y) def mapping(pos): return int(pos[0]//TILE_X), int(pos[1]//TILE_Y) # check verticals/horizontals def check_intersection(x0, y0, ind0, ind1, step, coef1, coef2, is_in_region): inc = 1 if coef1 > 0 else -1 x = np.arange(ind0 + 1 if inc > 0 else ind0, ind1 + inc, inc) * step if coef1 != 0: depth = (x - x0) / coef1 y = y0 + depth * coef2 is_wall = is_in_region(x, y) if len(is_wall) > 0: if is_wall.any(): ind_wall = is_wall.argmax() else: ind_wall = len(is_wall)-1 return x[ind_wall], y[ind_wall], depth[ind_wall] else: return x0 + MAX_DEPTH * coef1, y0 + MAX_DEPTH * coef2, MAX_DEPTH else: return x0, y0 + inc*MAX_DEPTH, MAX_DEPTH
from flask import Blueprint, json, jsonify, request, current_app from ..model import Overtime, User, Department from .util import failed, login_required, success, Role, url, current_role, current_user bp = Blueprint('overtimes', __name__, url_prefix='/overtimes') @bp.route('/', methods=['GET']) @url def get_overtime(): staff_id = request.args.get('staffID') department_id = request.args.get('departmentID') charge_id = request.args.get('chargeID') if staff_id: # login_required(Role.Manager) return [o.to_staff() for o in User.ByID(staff_id).overtimes] elif charge_id: # login_required(Role.Manager) charge = User.ByID(charge_id) assert charge.role == Role.CHARGE return [o.to_charge() for u in charge.department.users for o in u.overtimes] elif department_id: # login_required(Role.Manager) return [o.to_charge() for u in Department.ByID(department_id).users for o in u.overtimes] else: # login_required(Role.Manager) return [o.dict() for o in Overtime.All()] @bp.route('/', methods=['POST']) @url def new_overtime(): info = request.get_json() current_user().new_overtime(info=info) @bp.route('/<int:ID>', methods=['PUT']) @url def change_ovetime(ID): permit = request.args.get('permit') reject = request.args.get('reject') if permit: # login_required() Overtime.ByID(ID).review(current_user(), True) elif reject: # login_required() Overtime.ByID(ID).review(current_user(), False) login_required(role=Role.CHARGE) @bp.route('/<int:ID>', methods=['DELETE']) @url def delete_overtime(ID): """ 删除一个加班请求。 只有当该加班请求没有被审批时才能由员工本人取消。 """ o = Overtime.ByID(ID) if o.status == 0 and o.staff.ID == current_user().ID: o.delete() else: raise Exception
""" Jude Ferrier - s1808200 - 31/10/20 Ex 1. Program to find the image of a position r within a cube of length l repeated over space and the closest image to the origin. """ import numpy as np def main(): # Inputs are asked for the coordinates of the vector and the length of the cubes that space is divided into rx = float(input("Input rx:")) ry = float(input("Input ry:")) rz = float(input("Input rz:")) r = np.array([rx, ry, rz]) l = float(input("Input l:")) # The image of the vector in the first cube with sides in positive x, y, z is created by taking the remainder of division r/l imager = np.mod(r, l) print ("Image of r in cube 0 <= x, y, z <= l:", imager) # Individual components are created to check which side of the axis planes the closes image will be on imagerx = np.mod(rx, l) imagery = np.mod(ry, l) imagerz = np.mod(rz, l) # Each component is checked individually against its image across each plane to see which is closer to the origin if np.abs(imagerx)>np.abs(imagerx-l): closestx = imagerx-l else: closestx = imagerx if np.abs(imagery)>np.abs(imagery-l): closesty = imagery-l else: closesty = imagery if np.abs(imagerz)>np.abs(imagerz-l): closestz = imagerz-l else: closestz = imagerz # Final set of closest componets are presented in an array print("The nearest image to the origin is at:", np.array([closestx, closesty, closestz])) main()
#List Slicing and searching #Mr Pinizzotto #May 6 #create a list of food items foodList = ["pizza", "tater tots", "wings", "sandwich", "falafel", "taco", "fries", "wings"] #regular printing print(foodList) #print first 3 (top 3) items print(foodList[:3]) #print middle items give start, and end (not including) print(foodList[2:5]) #everything but first print(foodList[1:]) #print every other one print(foodList[0:6:2]) print(foodList[1:6:2]) print() print() #check for doubles for x in range(len(foodList)): #set the current spot as the search item dupe = foodList[x] #looked in the rest of the list if dupe in foodList[x+1:]: print("Duplicate found!") print() print() while(True): searchItem = input("Which food do you want to look for in the list?").lower() if searchItem in foodList: print("Yes it is in the list!!") else: print("Not in the list")
# Generated by Django 2.0.9 on 2018-11-10 17:46 from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('shitty', '0002_auto_20181110_1744'), ] operations = [ migrations.AddField( model_name='profile', name='phone', field=models.CharField(blank=True, max_length=100, null=True), ), ]
from django import forms from django.core import validators class FormName(forms.Form): """docstring for F.""" name = forms.CharField() email = forms.EmailField() verify = forms.EmailField() text = forms.CharField(widget = forms.Textarea) def clean(self): all_clean_data = super().clean() email_data = all_clean_data['email'] verify_data = all_clean_data['verify'] if email_data != verify_data: raise forms.ValidationError(" Email not matching ")
from .strategy import StrategyInterface from ..orders import MarketOrder class TriangularArbitrage(StrategyInterface): def __init__(self, pairs, exchanges, strategy_parameters): """ pairs = currency pairs on which the strategy is ran exchanges = exchanges on which the strategy is ran strategy_parameters = all strategy parameters including: bidask = whether the fx conversion will consume the bid or ask cash = initial sum of cash cash_currency = currency of initial cash """ super(TriangularArbitrage, self).__init__(pairs, exchanges, strategy_parameters) self.bidask = strategy_parameters['bidask'] self.cash = strategy_parameters['cash'] self.cash_currency = strategy_parameters['cash_currency'] self.exchange = exchanges[0] if len(self.exchanges) > 1: self.log.error('Triangular Arbitrage only doable on one exchange at the moment.') raise ValueError('Only use one exchange.') if len(self.pairs) + len(self.bidask) != 6: self.log.error('It takes 3 to make a triangle.') raise ValueError('Provide 3 pairs and 3 buysells.') # add check on cash currency def get_data_live(self): return self.exchange.get_order_book(self.pairs, count=100) def __convert_cash_bid(self, pair, data_for_pair, cash, fee): for idx, row in data_for_pair.iterrows(): if row.depth_base >= cash: return cash * row.vwap * (1 - fee), fee * cash * row.vwap raise ValueError('Order book not deep enough for trade size.') def __convert_cash_ask(self, pair, data_for_pair, cash, fee): for idx, row in data_for_pair.iterrows(): if row.depth_quote >= cash: return cash / row.vwap * (1 - fee), fee * cash raise ValueError('Order book not deep enough for trade size.') def __get_order_book_side_from_buysell(self, pair): bidask = self.bidask[pair] if bidask == 'buy': return 'ask' elif bidask == 'sell': return 'bid' else: raise ValueError('Buysell flag not recognized.') def compute_signal(self, data): """ data = data containing the bids and asks of the pairs """ initial_cash = self.cash cash = initial_cash steps = [initial_cash] fees = [] for pair in self.pairs: bidask = self.__get_order_book_side_from_buysell(pair) if bidask == 'ask': cash, fee = self.__convert_cash_ask(pair, data[pair][bidask], cash, self.exchange.taker_fee) elif bidask == 'bid': cash, fee = self.__convert_cash_bid(pair, data[pair][bidask], cash, self.exchange.taker_fee) else: raise ValueError('Pairs should be either bid or ask.') steps.append(cash) fees.append(fee) return { 'cash': steps, 'fees': fees, 'initial_cash': initial_cash, 'final_cash': steps[-1], 'currency': self.cash_currency, 'pnl': steps[-1] - initial_cash } def print_signal(self, pnl): self.log.ok('Expected PNL: %.4f%s' % (pnl['pnl'], pnl['currency'])) def generate_orders(self, data, signal): if signal['pnl'] < 0: return [] else: orders = [] for pair in self.pairs: order_attributes = { 'quantity': 0, 'buysell': self.bidask[pair], 'leverage': 1, 'pair': pair, 'time_start': 0, 'time_end': 10, 'orderID': 0, 'userref': 0, 'validate': 1, } orders.append(MarketOrder(order_attributes)) return orders
#!/usr/bin/python # -*- coding: utf-8 -*- # python 2.7 # @Author: Moming def last_word(cmd): result = cmd[0] for i in range(len(cmd))[1 : ]: if cmd[i] >= result[0]: result = cmd[i] + result else: result = result + cmd[i] return result # main if __name__ == '__main__': fr = open('./A-large.in', 'r') fw = open('./result.in', 'w') T = int(fr.readline()) for i in range(T): cmd = fr.readline() fw.write('Case #%d:' % (i + 1)) cmd = last_word(cmd) fw.write(' %s' % cmd)
import allure class Test_002: def test002(self): with open(r"C:\Users\James\Desktop\app8\scripts\chy.png", "rb") as f: allure.attach("图片", f.read(), allure.attach_type.PNG)
import agros2d as a2d # PROBLEM problem = a2d.problem(clear=True) problem.coordinate_type = "axisymmetric" problem.mesh_type = "triangle" magnetic = a2d.field("magnetic") magnetic.analysis_type = "steadystate" magnetic.number_of_refinements = 2 magnetic.polynomial_order = 2 magnetic.solver = "linear" geometry = a2d.geometry magnetic.adaptivity_type = "hp-adaptivity" magnetic.adaptivity_parameters["tolerance"] = 0.2 magnetic.adaptivity_parameters["steps"] = 10 # MATERIAL DEFINITIONS magnetic.add_material("J+", {'magnetic_remanence_angle': 0.0, 'magnetic_velocity_y': 0.0, 'magnetic_current_density_external_real': 2000000.0, 'magnetic_permeability': 1.0, 'magnetic_conductivity': 0.0, 'magnetic_remanence': 0.0, 'magnetic_velocity_angular': 0.0, 'magnetic_velocity_x': 0.0}) magnetic.add_material("air", {'magnetic_remanence_angle': 0.0, 'magnetic_velocity_y': 0.0, 'magnetic_current_density_external_real': 0.0, 'magnetic_permeability': 1.0, 'magnetic_conductivity': 0.0, 'magnetic_remanence': 0.0, 'magnetic_velocity_angular': 0.0, 'magnetic_velocity_x': 0.0}) magnetic.add_material("control", {'magnetic_remanence_angle': 0.0, 'magnetic_velocity_y': 0.0, 'magnetic_current_density_external_real': 0.0, 'magnetic_permeability': 1.0, 'magnetic_conductivity': 0.0, 'magnetic_remanence': 0.0, 'magnetic_velocity_angular': 0.0, 'magnetic_velocity_x': 0.0}) # BOUNDARY DEFINITIONS magnetic.add_boundary("a0", "magnetic_potential", {'magnetic_potential_real': 0.0}) magnetic.add_boundary("n0", "magnetic_surface_current", {'magnetic_surface_current_real': 0.0}) # GEOMETRY geometry.add_edge(0.0, 0.14, 0.14, 0.14, boundaries={'magnetic': 'a0'}) geometry.add_edge(0.0, 0.005, 0.0, 0.14, boundaries={'magnetic': 'a0'}) geometry.add_edge(0.0, 0.0, 0.0, 0.005, boundaries={'magnetic': 'a0'}) geometry.add_edge(0.14, 0.14, 0.14, 0.0, boundaries={'magnetic': 'a0'}) geometry.add_edge(0.005, 0.0, 0.0, 0.0, boundaries={'magnetic': 'n0'}) geometry.add_edge(0.14, 0.0, 0.01099000000000001, 0.0, boundaries={'magnetic': 'n0'}) geometry.add_edge(0.00999000000000001, 0.0, 0.005, 0.0, boundaries={'magnetic': 'n0'}) geometry.add_edge(0.01099000000000001, 0.0, 0.00999000000000001, 0.0, boundaries={'magnetic': 'n0'}) geometry.add_edge(0.0, 0.005, 0.005, 0.005) geometry.add_edge(0.005, 0.005, 0.005, 0.0) geometry.add_edge(0.00999, 0.0015, 0.010760000000000002, 0.0015) geometry.add_edge(0.010760000000000002, 0.0015, 0.01099, 0.0015) geometry.add_edge(0.01099, 0.0015, 0.01099, 0.0) geometry.add_edge(0.00999, 0.0, 0.00999, 0.0015) geometry.add_edge(0.00976, 0.003, 0.01076, 0.003) geometry.add_edge(0.01076, 0.003, 0.01076, 0.0015) geometry.add_edge(0.009989999999999999, 0.0015, 0.00976, 0.0015) geometry.add_edge(0.00976, 0.0015, 0.00976, 0.003) geometry.add_edge(0.00869, 0.0045000000000000005, 0.008989999999999996, 0.0045000000000000005) geometry.add_edge(0.008989999999999996, 0.0045000000000000005, 0.009689999999999999, 0.0045000000000000005) geometry.add_edge(0.009689999999999999, 0.0045000000000000005, 0.009689999999999999, 0.003) geometry.add_edge(0.009689999999999999, 0.003, 0.00869, 0.003) geometry.add_edge(0.00869, 0.003, 0.00869, 0.0045000000000000005) geometry.add_edge(0.00899, 0.006, 0.00999, 0.006) geometry.add_edge(0.00999, 0.006, 0.00999, 0.0045000000000000005) geometry.add_edge(0.00999, 0.0045000000000000005, 0.009689999999999997, 0.0045000000000000005) geometry.add_edge(0.00899, 0.0045000000000000005, 0.00899, 0.006) geometry.add_edge(0.007070000000000001, 0.0075, 0.00807, 0.0075) geometry.add_edge(0.00807, 0.0075, 0.00807, 0.006) geometry.add_edge(0.00807, 0.006, 0.007070000000000001, 0.006) geometry.add_edge(0.007070000000000001, 0.006, 0.007070000000000001, 0.0075) geometry.add_edge(0.0053300000000000005, 0.009000000000000001, 0.0063300000000000006, 0.009000000000000001) geometry.add_edge(0.0063300000000000006, 0.009000000000000001, 0.0063300000000000006, 0.0075) geometry.add_edge(0.0063300000000000006, 0.0075, 0.0053300000000000005, 0.0075) geometry.add_edge(0.0053300000000000005, 0.0075, 0.0053300000000000005, 0.009000000000000001) geometry.add_edge(0.00197, 0.0105, 0.0029700000000000026, 0.0105) geometry.add_edge(0.0029700000000000004, 0.0105, 0.0029700000000000004, 0.009000000000000001) geometry.add_edge(0.0029700000000000004, 0.009000000000000001, 0.00197, 0.009000000000000001) geometry.add_edge(0.00197, 0.009000000000000001, 0.00197, 0.0105) geometry.add_edge(0.0035499999999999998, 0.012, 0.00455, 0.012) geometry.add_edge(0.00455, 0.012, 0.00455, 0.0105) geometry.add_edge(0.00455, 0.0105, 0.0035499999999999998, 0.0105) geometry.add_edge(0.0035499999999999998, 0.0105, 0.0035499999999999998, 0.012) geometry.add_edge(0.00642, 0.0135, 0.006820000000000006, 0.0135) geometry.add_edge(0.006820000000000006, 0.0135, 0.00742, 0.0135) geometry.add_edge(0.00742, 0.0135, 0.00742, 0.012) geometry.add_edge(0.00742, 0.012, 0.00642, 0.012) geometry.add_edge(0.00642, 0.012, 0.00642, 0.0135) geometry.add_edge(0.0068200000000000005, 0.015, 0.00782, 0.015) geometry.add_edge(0.00782, 0.015, 0.00782, 0.0135) geometry.add_edge(0.00782, 0.0135, 0.007420000000000005, 0.0135) geometry.add_edge(0.0068200000000000005, 0.0135, 0.0068200000000000005, 0.015) # BLOCK LABELS geometry.add_label(0.010740000000000001, 0.00075, materials = {'magnetic' : 'J+'}) geometry.add_label(0.01051, 0.0022500000000000003, materials = {'magnetic' : 'J+'}) geometry.add_label(0.00944, 0.00375, materials = {'magnetic' : 'J+'}) geometry.add_label(0.00974, 0.00525, materials = {'magnetic' : 'J+'}) geometry.add_label(0.00782, 0.00675, materials = {'magnetic' : 'J+'}) geometry.add_label(0.00608, 0.00825, materials = {'magnetic' : 'J+'}) geometry.add_label(0.0027199999999999998, 0.00975, materials = {'magnetic' : 'J+'}) geometry.add_label(0.0043, 0.01125, materials = {'magnetic' : 'J+'}) geometry.add_label(0.00717, 0.012750000000000001, materials = {'magnetic' : 'J+'}) geometry.add_label(0.00757, 0.01425, materials = {'magnetic' : 'J+'}) geometry.add_label(0.03, 0.03, materials = {'magnetic' : 'air'}) geometry.add_label(0.003, 0.001, materials = {'magnetic' : 'control'}) # SOLVE problem.solve() a2d.view.zoom_best_fit() f = open("solution_0.csv", "w") # POSTPROCESSING AND EXPORTING point = magnetic.local_values(1e-06, 1e-06)["Brz"] f.write("{}, 1e-06, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(1e-06, 1e-06)["Brr"] f.write("{}, 1e-06, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(1e-06, 0.00125075)["Brz"] f.write("{}, 1e-06, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(1e-06, 0.00125075)["Brr"] f.write("{}, 1e-06, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(1e-06, 0.0025004999999999997)["Brz"] f.write("{}, 1e-06, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(1e-06, 0.0025004999999999997)["Brr"] f.write("{}, 1e-06, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(1e-06, 0.00375025)["Brz"] f.write("{}, 1e-06, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(1e-06, 0.00375025)["Brr"] f.write("{}, 1e-06, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(1e-06, 0.005)["Brz"] f.write("{}, 1e-06, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(1e-06, 0.005)["Brr"] f.write("{}, 1e-06, 0.005, {}\n".format("Br", point)) point = magnetic.local_values(0.0005564444444444444, 1e-06)["Brz"] f.write("{}, 0.0005564444444444444, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(0.0005564444444444444, 1e-06)["Brr"] f.write("{}, 0.0005564444444444444, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(0.0005564444444444444, 0.00125075)["Brz"] f.write("{}, 0.0005564444444444444, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(0.0005564444444444444, 0.00125075)["Brr"] f.write("{}, 0.0005564444444444444, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(0.0005564444444444444, 0.0025004999999999997)["Brz"] f.write("{}, 0.0005564444444444444, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(0.0005564444444444444, 0.0025004999999999997)["Brr"] f.write("{}, 0.0005564444444444444, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(0.0005564444444444444, 0.00375025)["Brz"] f.write("{}, 0.0005564444444444444, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(0.0005564444444444444, 0.00375025)["Brr"] f.write("{}, 0.0005564444444444444, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(0.0005564444444444444, 0.005)["Brz"] f.write("{}, 0.0005564444444444444, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(0.0005564444444444444, 0.005)["Brr"] f.write("{}, 0.0005564444444444444, 0.005, {}\n".format("Br", point)) point = magnetic.local_values(0.0011118888888888888, 1e-06)["Brz"] f.write("{}, 0.0011118888888888888, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(0.0011118888888888888, 1e-06)["Brr"] f.write("{}, 0.0011118888888888888, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(0.0011118888888888888, 0.00125075)["Brz"] f.write("{}, 0.0011118888888888888, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(0.0011118888888888888, 0.00125075)["Brr"] f.write("{}, 0.0011118888888888888, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(0.0011118888888888888, 0.0025004999999999997)["Brz"] f.write("{}, 0.0011118888888888888, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(0.0011118888888888888, 0.0025004999999999997)["Brr"] f.write("{}, 0.0011118888888888888, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(0.0011118888888888888, 0.00375025)["Brz"] f.write("{}, 0.0011118888888888888, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(0.0011118888888888888, 0.00375025)["Brr"] f.write("{}, 0.0011118888888888888, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(0.0011118888888888888, 0.005)["Brz"] f.write("{}, 0.0011118888888888888, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(0.0011118888888888888, 0.005)["Brr"] f.write("{}, 0.0011118888888888888, 0.005, {}\n".format("Br", point)) point = magnetic.local_values(0.0016673333333333332, 1e-06)["Brz"] f.write("{}, 0.0016673333333333332, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(0.0016673333333333332, 1e-06)["Brr"] f.write("{}, 0.0016673333333333332, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(0.0016673333333333332, 0.00125075)["Brz"] f.write("{}, 0.0016673333333333332, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(0.0016673333333333332, 0.00125075)["Brr"] f.write("{}, 0.0016673333333333332, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(0.0016673333333333332, 0.0025004999999999997)["Brz"] f.write("{}, 0.0016673333333333332, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(0.0016673333333333332, 0.0025004999999999997)["Brr"] f.write("{}, 0.0016673333333333332, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(0.0016673333333333332, 0.00375025)["Brz"] f.write("{}, 0.0016673333333333332, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(0.0016673333333333332, 0.00375025)["Brr"] f.write("{}, 0.0016673333333333332, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(0.0016673333333333332, 0.005)["Brz"] f.write("{}, 0.0016673333333333332, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(0.0016673333333333332, 0.005)["Brr"] f.write("{}, 0.0016673333333333332, 0.005, {}\n".format("Br", point)) point = magnetic.local_values(0.0022227777777777775, 1e-06)["Brz"] f.write("{}, 0.0022227777777777775, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(0.0022227777777777775, 1e-06)["Brr"] f.write("{}, 0.0022227777777777775, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(0.0022227777777777775, 0.00125075)["Brz"] f.write("{}, 0.0022227777777777775, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(0.0022227777777777775, 0.00125075)["Brr"] f.write("{}, 0.0022227777777777775, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(0.0022227777777777775, 0.0025004999999999997)["Brz"] f.write("{}, 0.0022227777777777775, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(0.0022227777777777775, 0.0025004999999999997)["Brr"] f.write("{}, 0.0022227777777777775, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(0.0022227777777777775, 0.00375025)["Brz"] f.write("{}, 0.0022227777777777775, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(0.0022227777777777775, 0.00375025)["Brr"] f.write("{}, 0.0022227777777777775, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(0.0022227777777777775, 0.005)["Brz"] f.write("{}, 0.0022227777777777775, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(0.0022227777777777775, 0.005)["Brr"] f.write("{}, 0.0022227777777777775, 0.005, {}\n".format("Br", point)) point = magnetic.local_values(0.002778222222222222, 1e-06)["Brz"] f.write("{}, 0.002778222222222222, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(0.002778222222222222, 1e-06)["Brr"] f.write("{}, 0.002778222222222222, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(0.002778222222222222, 0.00125075)["Brz"] f.write("{}, 0.002778222222222222, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(0.002778222222222222, 0.00125075)["Brr"] f.write("{}, 0.002778222222222222, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(0.002778222222222222, 0.0025004999999999997)["Brz"] f.write("{}, 0.002778222222222222, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(0.002778222222222222, 0.0025004999999999997)["Brr"] f.write("{}, 0.002778222222222222, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(0.002778222222222222, 0.00375025)["Brz"] f.write("{}, 0.002778222222222222, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(0.002778222222222222, 0.00375025)["Brr"] f.write("{}, 0.002778222222222222, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(0.002778222222222222, 0.005)["Brz"] f.write("{}, 0.002778222222222222, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(0.002778222222222222, 0.005)["Brr"] f.write("{}, 0.002778222222222222, 0.005, {}\n".format("Br", point)) point = magnetic.local_values(0.003333666666666666, 1e-06)["Brz"] f.write("{}, 0.003333666666666666, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(0.003333666666666666, 1e-06)["Brr"] f.write("{}, 0.003333666666666666, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(0.003333666666666666, 0.00125075)["Brz"] f.write("{}, 0.003333666666666666, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(0.003333666666666666, 0.00125075)["Brr"] f.write("{}, 0.003333666666666666, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(0.003333666666666666, 0.0025004999999999997)["Brz"] f.write("{}, 0.003333666666666666, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(0.003333666666666666, 0.0025004999999999997)["Brr"] f.write("{}, 0.003333666666666666, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(0.003333666666666666, 0.00375025)["Brz"] f.write("{}, 0.003333666666666666, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(0.003333666666666666, 0.00375025)["Brr"] f.write("{}, 0.003333666666666666, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(0.003333666666666666, 0.005)["Brz"] f.write("{}, 0.003333666666666666, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(0.003333666666666666, 0.005)["Brr"] f.write("{}, 0.003333666666666666, 0.005, {}\n".format("Br", point)) point = magnetic.local_values(0.003889111111111111, 1e-06)["Brz"] f.write("{}, 0.003889111111111111, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(0.003889111111111111, 1e-06)["Brr"] f.write("{}, 0.003889111111111111, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(0.003889111111111111, 0.00125075)["Brz"] f.write("{}, 0.003889111111111111, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(0.003889111111111111, 0.00125075)["Brr"] f.write("{}, 0.003889111111111111, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(0.003889111111111111, 0.0025004999999999997)["Brz"] f.write("{}, 0.003889111111111111, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(0.003889111111111111, 0.0025004999999999997)["Brr"] f.write("{}, 0.003889111111111111, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(0.003889111111111111, 0.00375025)["Brz"] f.write("{}, 0.003889111111111111, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(0.003889111111111111, 0.00375025)["Brr"] f.write("{}, 0.003889111111111111, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(0.003889111111111111, 0.005)["Brz"] f.write("{}, 0.003889111111111111, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(0.003889111111111111, 0.005)["Brr"] f.write("{}, 0.003889111111111111, 0.005, {}\n".format("Br", point)) point = magnetic.local_values(0.004444555555555556, 1e-06)["Brz"] f.write("{}, 0.004444555555555556, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(0.004444555555555556, 1e-06)["Brr"] f.write("{}, 0.004444555555555556, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(0.004444555555555556, 0.00125075)["Brz"] f.write("{}, 0.004444555555555556, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(0.004444555555555556, 0.00125075)["Brr"] f.write("{}, 0.004444555555555556, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(0.004444555555555556, 0.0025004999999999997)["Brz"] f.write("{}, 0.004444555555555556, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(0.004444555555555556, 0.0025004999999999997)["Brr"] f.write("{}, 0.004444555555555556, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(0.004444555555555556, 0.00375025)["Brz"] f.write("{}, 0.004444555555555556, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(0.004444555555555556, 0.00375025)["Brr"] f.write("{}, 0.004444555555555556, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(0.004444555555555556, 0.005)["Brz"] f.write("{}, 0.004444555555555556, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(0.004444555555555556, 0.005)["Brr"] f.write("{}, 0.004444555555555556, 0.005, {}\n".format("Br", point)) point = magnetic.local_values(0.005, 1e-06)["Brz"] f.write("{}, 0.005, 1e-06, {}\n".format("Bz", point)) point = magnetic.local_values(0.005, 1e-06)["Brr"] f.write("{}, 0.005, 1e-06, {}\n".format("Br", point)) point = magnetic.local_values(0.005, 0.00125075)["Brz"] f.write("{}, 0.005, 0.00125075, {}\n".format("Bz", point)) point = magnetic.local_values(0.005, 0.00125075)["Brr"] f.write("{}, 0.005, 0.00125075, {}\n".format("Br", point)) point = magnetic.local_values(0.005, 0.0025004999999999997)["Brz"] f.write("{}, 0.005, 0.0025004999999999997, {}\n".format("Bz", point)) point = magnetic.local_values(0.005, 0.0025004999999999997)["Brr"] f.write("{}, 0.005, 0.0025004999999999997, {}\n".format("Br", point)) point = magnetic.local_values(0.005, 0.00375025)["Brz"] f.write("{}, 0.005, 0.00375025, {}\n".format("Bz", point)) point = magnetic.local_values(0.005, 0.00375025)["Brr"] f.write("{}, 0.005, 0.00375025, {}\n".format("Br", point)) point = magnetic.local_values(0.005, 0.005)["Brz"] f.write("{}, 0.005, 0.005, {}\n".format("Bz", point)) point = magnetic.local_values(0.005, 0.005)["Brr"] f.write("{}, 0.005, 0.005, {}\n".format("Br", point)) info = magnetic.solution_mesh_info() f.write("{}, {}\n".format("dofs", info["dofs"])) f.write("{}, {}\n".format("nodes", info["nodes"])) f.write("{}, {}\n".format("elements", info["elements"])) # CLOSING STEPS f.close()
from abc import abstractmethod from starfish.core.intensity_table.decoded_intensity_table import DecodedIntensityTable from starfish.core.morphology.binary_mask import BinaryMaskCollection from starfish.core.pipeline.algorithmbase import AlgorithmBase class AssignTargetsAlgorithm(metaclass=AlgorithmBase): """ AssignTargets assigns cell IDs to detected spots using an IntensityTable and SegmentationMaskCollection. """ @abstractmethod def run( self, masks: BinaryMaskCollection, decoded_intensity_table: DecodedIntensityTable, verbose: bool = False, in_place: bool = False, ) -> DecodedIntensityTable: """Performs target (e.g. gene) assignment given the spots and the regions.""" raise NotImplementedError()
class Solution: def numTrees(self, n: int) -> int: res = [1, 1] if n <= 1: return res[n] for i in range(2, n + 1): s = i - 1 ct = 0 for j in range(i): ct += res[s - j] * res[j] res.append(ct) return res[n]
from django.core.paginator import Paginator from django.shortcuts import render # Create your views here. from payment.models import PaymentStatus def home(request): page_length = 20 team_list = PaymentStatus.objects.order_by('university', 'team_name') # user_list = Profile.objects.order_by('-level_completed') paginator = Paginator(team_list, page_length) # Show 25 contacts per page page = request.GET.get('page') if page is None: page = 1 users = paginator.get_page(page) return render(request, 'payment_front_end/home.html', {'users': users,})
#!/usr/bin/env python # -*- coding: utf-8 -*- import json from alipay.aop.api.response.AlipayResponse import AlipayResponse from alipay.aop.api.domain.CplifeRoomInfoResp import CplifeRoomInfoResp class AlipayEcoCplifeRoominfoUploadResponse(AlipayResponse): def __init__(self): super(AlipayEcoCplifeRoominfoUploadResponse, self).__init__() self._community_id = None self._room_info_set = None @property def community_id(self): return self._community_id @community_id.setter def community_id(self, value): self._community_id = value @property def room_info_set(self): return self._room_info_set @room_info_set.setter def room_info_set(self, value): if isinstance(value, list): self._room_info_set = list() for i in value: if isinstance(i, CplifeRoomInfoResp): self._room_info_set.append(i) else: self._room_info_set.append(CplifeRoomInfoResp.from_alipay_dict(i)) def parse_response_content(self, response_content): response = super(AlipayEcoCplifeRoominfoUploadResponse, self).parse_response_content(response_content) if 'community_id' in response: self.community_id = response['community_id'] if 'room_info_set' in response: self.room_info_set = response['room_info_set']
# -*- coding: UTF-8 import requests import sys # Información api_key = '23e1395c903b1ffa6292125af3c216a1' # Petición def petition(api_key,number): data = requests.get("http://apilayer.net/api/validate?access_key=%s&number=%s&country_code&format=1" % (api_key, number)) for key, value in data.json().items(): print("%s: %s" % (key, value)) petition(api_key,sys.argv[1])
from .breakpoint import Breakpoint from .pesr_test import PESRTest from .sr_test import SRTest, SRTestRunner from .pe_test import PETest, PETestRunner from .pesr_test import PESRTest, PESRTestRunner
from __future__ import print_function import tensorflow as tf import time import numpy as np import math import libmr import urllib.request import os from abc import * import sys mean = {} def printProgress(current, total, prefix='', suffix='', barLength=100): percent = current*100 / float(total) assert percent <= 100 and percent >= 0, "Invaild total and current" progressed = int(percent * barLength / 100) bar = '#' * progressed + '-' * (barLength-progressed) sys.stdout.write('\r%s |%s| %s%s %s'%(prefix, bar, percent, '%', suffix)) if current == total: sys.stdout.write('\n') sys.stdout.flush() def time_cal(time): rt = '' T = {'h':0, 'm':0, 's':0} sl = 3600 for elem in T: T[elem] = int(time/sl) time -= T[elem]*sl sl /= 60 if T[elem]: rt += ("%d %s " %(T[elem], elem)) return rt class network(metaclass = ABCMeta): def __init__(self, x,y, numofclass,sess, weights_path, log_dir, verbose): self.X = x # input self.Y = y # label self.numofclass = numofclass self.verbose = verbose self.weights_path = weights_path self.log_dir = log_dir self.checkpoint(sess) self.param = [] def checkpoint(self, sess): # To determine loading weights or checkpoint ckpt = tf.train.get_checkpoint_state(self.log_dir) if ckpt and ckpt.model_checkpoint_path: if self.verbose : print("Restoring checkpoint..", end='') sess.restore(sess, "") if self.verbose : print("Done") else: self.load_weights(sess) #TODO : openMax # # ALGORITHM #2 # def openMax(self, sess): pass #TODO : Meta-Recognition # # get Meta-Recognition score. # @abstractmethod def get_meta_logits(self): pass def load_weights(self, sess): ## load pre-trained network weights if self.verbose : print("Loading pretrained model..", end='') weights = np.load(weight_path) weights_key = sorted(weights_key()) for i, k in enumerate(weights_key): if i == len(self.param): break if self.verbose: print("The shape of %s of the pretrained model is %s." " And the shape of %s of the model is %s" %(k, weights[k].shape, k, self.param[i].shape)) sess.run(self.param[i].assign(weights[k].reshape(self.param[i].shape))) if self.verbose: print("Done.") @abstractmethod def get_logits(self): #return logits pass @abstractmethod #from pre-trained layers, obtain feature. def get_feature(self): pass #TODO : get weight file # # Find weights file from the certain directory. # IF not being able to find it and URL for weight file is given, # download the file in the certain folder. # def get_model(self,url): model_path = os.getcwd() weight_path = './weights' if not os.path.exists(weight_path): os.makedirs(weight_path) os.chdir(weight_path) file_name = url.split('/')[-1] u = urllib.request.urlopen(url) file_meta = u.info() file_size = int(file_meta["Content-Length"]) if not os.path.exists(file_name) or os.stat(file_name).st_size != file_size: if self.verbose : print("There is no pretrained model.") start_time = time.time() with open(file_name, 'wb') as f: print("Download: %s Bytes: %s" % (file_name, file_size)) file_size_dl = 0 # downloaded file_block_size = 1024 * 64 # 64kb while True: buffer = u.read(file_block_size) if not buffer: break file_size_dl += len(buffer) f.write(buffer) printProgress(file_size_dl, file_size, 'Progress', 'Complete', 20) print("Download complete. it takes %s " %(time_cal(int(time.time()-start_time)))) else: print("There is pretrained model already.") return os.path.join(os.getcwd(), file_name) """ for debugging (with tensorboard) """ def add_activation_summary(var): if var is not None: tf.summary.histogram(var.op.name + "/activation", var) tf.summary.scalar(var.op.name + "/sparsity", tf.nn.zero_fraction(var)) """ define layers for simplicity """ def _max_pool2_(self, x, name): """ input - x : feature Output - feature max_pooled with strides 2 and "SAME" zero padding """ return tf.nn.max_pool(x, [1,2,2,1], [1,2,2,1], 'SAME', name=name) def init_variable(self,name, weights_shape, biases_shape, params, pretrained, trainable): with tf.variable_scope(name) as scope: w_init = tf.truncated_normal(shape = weights_shape, stddev=math.sqrt(2.0)/(params)) b_init = tf.constant(0.0, shape=biases_shape) weights = tf.get_variable('weights', initializer = w_init, trainable = trainable) biases = tf.get_variable('biases', initializer = b_init, trainable = trainable) if pretrained: self.param.append(weights) self.param.append(biases) return weights, biases def fc(self, x, output_dim, name, relu = True, dropout=True, drop_prob=0.5, pretrained =True, trainable=True): """ Inputs - x : input feature with [N, H, W, C] - output_dim : output dimension - name : name for fully connected layer Outputs - a matrix with [N, output_dim] """ shape = x.get_shape().as_list() x_reshaped = tf.reshape(x, [-1, (np.prod(np.array(shape[1:])))]) reshape_shape = x_reshaped.get_shape().as_list() weights_shape = [reshape_shape[-1], output_dim] biases_shape = [output_dim] weights, biases = init_variable(name, weights_shape, biases_shape, tf.size(weights_shape), pretrained, trainable) with tf.variable_scope(name) as scope: out = tf.matmul(x_reshaped, weights) out = tf.nn.bias_add(out, biases) if relu: out = tf.nn.relu(out, name = name+'_relu') if dropout: out = tf.nn.dropout(out, drop_prob) return out out = tf.matmul() def conv(self, x, num_filters, name, drop_prob=0.5, strides=1, padding='SAME', repeat=1, pretrained = True, ks=3, relu=True, dropout=False, trainable=False): """ Inputs - x : input feature - num_filters : # of filters - ks : kernel size - repeat : # of conv layers which repeat under same parameter(e.g. strides, num_filters, kernel size, and so on) - name : name for layer(s) - pretrained : Is there pre-trained weights for this layer(s). - trainable : Is this layer(s) trainable. Outputs - activation """ out = x param = [] # for load_weights function, it includes parameters to load weights scopes = [name+"_%d" %i for i in range(1, repeat+1)] for sc in scopes: channel = out.get_shape().as_list()[-1] weights_shape = [ks, ks, channel, num_filters] biases_shape = [num_filters] weights, biases = init_variable(sc, weights_shape, biases_shape, ks*ks*num_filters, pretrained, trainable) with tf.variable_scope(sc) as scope: out = tf.nn.conv2d(out, weights, strides=[1, strides, strides, 1], padding= padding) out = tf.nn.bias_add(out, biases) if relu: out = tf.nn.relu(out, name = sc+'_relu') if dropout: out = tf.nn.dropout(out, drop_prob) return out def batch_norm(self, x, n_out): # for mlp and conv layers pass class VGG16net(network): """ VGG16 network VGG16 Pretrained model file:https://www.cs.toronto.edu/~frossard/post/vgg16/ """ def __init__(self, x,y, numofclass, sess=None, weights_path=None, log_dir=None, verbose=False): super(VGG16net, self).__init__(x, y, numofclass, sess,weights_path, log_dir, verbose) if wegiths_path is None: weights_path = self.get_model('https://www.cs.toronto.edu/~frossard/vgg16/vgg16_weights.npz') self.get_feature() sess.run(tf.global_variables_initializer()) self.load_weights(sess) self.checkpoint(sess) def get_feature(self): if self.verbose : print("Creating model graph..", end='') """ VGG16net, pretrained model. """ x = self.X # conv1 : 64ch, st 1, pad 1, repeat 2 conv1 = self.conv(x, 64, name='conv1', repeat=2,relu=True) # pool1 : maxpool2, st 2 pool1 = self._max_pool2_(conv1, "pool1") # conv2 : 128ch, repeat 2 conv2 = self.conv(pool1, 128, name='conv2', repeat=2, relu=True) # pool2 : maxpool2, st 2 pool2 = self._max_pool2_(conv2, "pool2") # conv3 : 256ch, repeat 2 conv3 = self.conv(pool2, 256, name='conv3', repeat=3, relu=True) # pool3 : maxpool2, st 2 pool3 = self._max_pool2_(conv3, "pool3") # conv4 : 512ch, repeat 3 conv4 = self.conv(pool3, 512, name='conv4', repeat=3, relu=True) # pool4 : maxpool2, st 2 pool4 = self._max_pool2_(conv4, "pool4") # conv5 : 512ch, repeat 3 conv5 = self.conv(pool4, 512, name='conv5', repeat=3, relu=True) # pool5 : maxpool2, st 2 pool5 = self._max_pool2_(conv5, "pool5") # fc6 : 4096 fc1 = self.fc(pool5, 4096, 'fc1', relu=True, dropout=True) # fc7 : 4096 fc2 = self.fc(fc6, 4096, 'fc2', relu=True, dropout=True) # fc8 : depending on # of classes of the given dataset. fc3 = self.fc(fc7, self.numofclass, 'fc3', relu=False, dropout=False,trainable=True, pretrained=False) return fc3
# iSDAsoil Clay Content # https://developers.google.com/earth-engine/datasets/catalog/ISDASOIL_Africa_v1_clay_content # Clay content at soil depths of 0-20 cm and 20-50 cm,\npredicted mean and standard deviation. In areas of dense jungle (generally over central Africa), model accuracy is low and therefore artifacts such as banding (striping) might be seen.n. # Pixel values must be back-transformed with exp(x/10)-1. import ee from ee_plugin import Map iSDAsoil_CC_raw = ee.Image("ISDASOIL/Africa/v1/clay_content"); iSDAsoil_CC_converted = iSDAsoil_CC_raw.divide(10).exp().subtract(1); iSDAsoil_CC_vis = { "min": 0, "max": 20, "palette": ['081d58', '225ea8', '41b6c4', 'c7e9b4', 'edf8b1', 'ffffd9'] # "palette": ['000004', '3b0f6f', '8c2981', 'de4969', 'fe9f6d', 'fcfdbf'] #Magma } Map.addLayer(iSDAsoil_CC_converted.select(0), iSDAsoil_CC_vis, "Clay content, mean, 0-20 cm"); # Map.addLayer(iSDAsoil_OC_converted.select(1), iSDAsoil_OC_vis, "Clay content, mean, 20-50 cm");
from copy import copy from functools import partial from jinja2 import Environment, StrictUndefined from syn.base import Base, Attr, init_hook from syn.type import Dict, List, Callable from syn.five import STR from .base import resolve, ordered_macros, get_output, DEFAULT_JINJA_FILTERS, \ DEFAULT_JINJA_FUNCTIONS, fix_functions from .context import Context, BUILTIN_CONTEXTS from .task import Task #------------------------------------------------------------------------------- CP = 'copy_copy' UP = 'dict_update' AUP = 'assign_update' #------------------------------------------------------------------------------- INITIAL_MACROS = {} #------------------------------------------------------------------------------- # Copyable class Copyable(object): def copy(self, **kwargs): ret = copy(self) for attr in self._groups.copy_copy: setattr(ret, attr, copy(getattr(ret, attr))) return ret #------------------------------------------------------------------------------- # Updateable class Updateable(object): def _update_pre(self, other, **kwargs): pass def update(self, other, **kwargs): self._update_pre(other, **kwargs) for attr in self._groups.dict_update: getattr(self, attr).update(getattr(other, attr, {})) for attr in self._groups.assign_update: value = getattr(other, attr) if not value: value = getattr(self, attr) setattr(self, attr, value) self._update_post(other, **kwargs) def _update_post(self, other, **kwargs): pass #------------------------------------------------------------------------------- # Env class Env(Base, Copyable, Updateable): _groups = (UP, AUP) _attrs = dict(macros = Attr(Dict((STR, int, float, List((STR, int, float, list, dict)), Dict((STR, int, float, list, dict)))), init=lambda self: dict(), doc='Macro definitions', groups=(UP, CP)), contexts = Attr(Dict(Context), init=lambda self: dict(), doc='Execution context definitions', groups=(UP, CP)), tasks = Attr(Dict(Task), init=lambda self: dict(), doc='Task definitions', groups=(UP, CP)), secret_values = Attr(Dict(STR), init=lambda self: dict(), doc='Secret value store', groups=(UP, CP)), captures = Attr(Dict(STR), init=lambda self: dict(), doc='Commands to captures output of', groups=(UP, CP)), files = Attr(Dict(STR), init=lambda self: dict(), doc='File name macros', groups=(UP, CP)), settings = Attr(Dict(None), init=lambda self: dict(), doc='Global settings of various sorts', groups=(UP, CP)), jinja_filters = Attr(Dict(Callable), init=lambda self: \ dict(DEFAULT_JINJA_FILTERS), doc='Custom Jinja2 filters', groups=(UP, CP)), jinja_functions = Attr(Dict(Callable), init=lambda self: \ dict(DEFAULT_JINJA_FUNCTIONS), doc='Custom Jinja2 functions', groups=(UP, CP)), function_aliases = Attr(Dict(STR), init=lambda self: dict(), internal=True, groups=(UP, CP), doc='Jinja function aliases'), env = Attr(Dict((STR, int, float, List((STR, int, float, list, dict)), Dict((STR, int, float, list, dict)))), init=lambda self: dict(), doc='Current name resolution environment', groups=(UP, CP)), jenv = Attr(Environment, doc='Jinja2 environment', group='eq_exclude', init=lambda self: Environment(undefined=StrictUndefined)), default_task = Attr(STR, '', 'Task to run if no task is ' 'specified at the command line', group=AUP), default_context = Attr(Context, doc='Execution context to use ' 'if none is specified in task definition', group=AUP)) _opts = dict(init_validate = True) @init_hook def _init_populate(self): self.macros.update(INITIAL_MACROS) self.contexts.update(BUILTIN_CONTEXTS) if not hasattr(self, 'default_context'): self.default_context = self.contexts['null'] @init_hook def _set_jenv(self, **kwargs): filts = dict(self.jinja_filters) for name, filt in filts.items(): filts[name] = partial(filt, env=self) self.jenv.filters.update(filts) funcs = dict(self.jinja_functions) for name, func in funcs.items(): funcs[name] = partial(func, env=self) self.jenv.globals.update(funcs) def _update_post(self, other, **kwargs): self._set_jenv(**kwargs) def capture_value(self, cmd, **kwargs): out, code = get_output(cmd) # These are intended to be macro values, so newlines and extra # white space probably aren't desirable return out.strip() def macro_env(self, **kwargs): dct = dict(self.macros) dct.update(self.secret_values) dct.update(self.files) return dct def resolve_macros(self, **kwargs): env = self.macro_env(**kwargs) macros = dict(self.macros) macros.update(self.captures) # TODO: better error message if there is a cycle potential_problems = set(env) & set(self.jinja_functions) for name, template in ordered_macros(macros, jenv=self.jenv, funcs=self.jinja_functions): if name in self.macros: fixed = fix_functions(template, potential_problems, self) env[name] = resolve(fixed, env, jenv=self.jenv) if name in self.captures: cmd = resolve(template, env, jenv=self.jenv) env[name] = self.capture_value(cmd, **kwargs) self.env = env def resolve(self, template): return resolve(template, self.env, jenv=self.jenv) def validate(self): super(Env, self).validate() for name, ctx in self.contexts.items(): ctx.validate() for name, task in self.tasks.items(): task.validate() #------------------------------------------------------------------------------- # __all__ __all__ = ('Env',) #-------------------------------------------------------------------------------
from django import forms from django.core import validators class FormularioPacientes(forms.Form): rut = forms.CharField() nombre = forms.CharField() apellido = forms.CharField() email = forms.CharField() tutor = forms.CharField() direccion = forms.CharField() enfermedades = forms.CharField()
#!/usr/bin/env python3 # Copyright The OpenTelemetry 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. import argparse import logging import subprocess import sys import pkg_resources from opentelemetry.instrumentation.bootstrap_gen import ( default_instrumentations, libraries, ) from opentelemetry.instrumentation.version import __version__ logger = logging.getLogger(__name__) def _syscall(func): def wrapper(package=None): try: if package: return func(package) return func() except subprocess.SubprocessError as exp: cmd = getattr(exp, "cmd", None) if cmd: msg = f'Error calling system command "{" ".join(cmd)}"' if package: msg = f'{msg} for package "{package}"' raise RuntimeError(msg) return wrapper @_syscall def _sys_pip_install(package): # explicit upgrade strategy to override potential pip config subprocess.check_call( [ sys.executable, "-m", "pip", "install", "-U", "--upgrade-strategy", "only-if-needed", package, ] ) def _pip_check(): """Ensures none of the instrumentations have dependency conflicts. Clean check reported as: 'No broken requirements found.' Dependency conflicts are reported as: 'opentelemetry-instrumentation-flask 1.0.1 has requirement opentelemetry-sdk<2.0,>=1.0, but you have opentelemetry-sdk 0.5.' To not be too restrictive, we'll only check for relevant packages. """ with subprocess.Popen( [sys.executable, "-m", "pip", "check"], stdout=subprocess.PIPE ) as check_pipe: pip_check = check_pipe.communicate()[0].decode() pip_check_lower = pip_check.lower() for package_tup in libraries.values(): for package in package_tup: if package.lower() in pip_check_lower: raise RuntimeError(f"Dependency conflict found: {pip_check}") def _is_installed(req): if req in sys.modules: return True try: pkg_resources.get_distribution(req) except pkg_resources.DistributionNotFound: return False except pkg_resources.VersionConflict as exc: logger.warning( "instrumentation for package %s is available but version %s is installed. Skipping.", exc.req, exc.dist.as_requirement(), # pylint: disable=no-member ) return False return True def _find_installed_libraries(): libs = default_instrumentations[:] libs.extend( [ v["instrumentation"] for _, v in libraries.items() if _is_installed(v["library"]) ] ) return libs def _run_requirements(): logger.setLevel(logging.ERROR) print("\n".join(_find_installed_libraries()), end="") def _run_install(): for lib in _find_installed_libraries(): _sys_pip_install(lib) _pip_check() def run() -> None: action_install = "install" action_requirements = "requirements" parser = argparse.ArgumentParser( description=""" opentelemetry-bootstrap detects installed libraries and automatically installs the relevant instrumentation packages for them. """ ) parser.add_argument( "--version", help="print version information", action="version", version="%(prog)s " + __version__, ) parser.add_argument( "-a", "--action", choices=[action_install, action_requirements], default=action_requirements, help=""" install - uses pip to install the new requirements using to the currently active site-package. requirements - prints out the new requirements to stdout. Action can be piped and appended to a requirements.txt file. """, ) args = parser.parse_args() cmd = { action_install: _run_install, action_requirements: _run_requirements, }[args.action] cmd()
from tartiflette.types.exceptions.tartiflette import TartifletteError __all__ = ("TartifletteError",)
from django.contrib.gis.geos import Point from django.core.management.base import BaseCommand from optparse import make_option from os.path import basename from police.models import Crimepoint, Neighbourhood, Postcode from police.utils import config, utilities from police.utils.Polygon import Polygon from police.utils.ShpParser import ShpParser from police.utils.utilities import filter_crime_file from urlparse import urlsplit import csv import datetime import httplib2 import json import os import urllib2 import zipfile class Command(BaseCommand): help = 'Updates the police crime incident database' option_list = BaseCommand.option_list + ( make_option('-a', action='store_true', dest='all', default=False, help='Download, unzip, filter and store everything'), ) + ( make_option('-d', action='store_true', dest='download', default=False, help='Download'), ) + ( make_option('-u', action='store_true', dest='unzip', default=False, help='Unzip'), ) + ( make_option('-f', action='store_true', dest='filter', default=False, help='Filter'), ) + ( make_option('-s', action='store_true', dest='store', default=False, help='Store'), ) + ( make_option('-c', action='store_true', dest='clean', default=False, help='Clean everything'), ) + ( make_option('--city=', action='store', dest='city', default='None', help='Apply the operation only to the given city'), ) def handle(self, *args, **options): http = httplib2.Http() http.add_credentials(config.police_user, config.police_pass) response, content = http.request( "http://policeapi2.rkh.co.uk/api/crime-last-updated", "GET" ) police_date = json.loads(content)['date'] police_date = datetime.datetime.strptime(police_date, '%Y-%m-%d').date() print "Police database last update:", police_date try: file_date = os.path.getmtime(config.lastUpdatedFile) file_date = datetime.date.fromtimestamp(file_date) except: # If this is the first time file_date = datetime.datetime.strptime("2010-12-01", '%Y-%m-%d').date() print "Local database last update:", file_date if options['all']: print "Doing everything..." if police_date > file_date: self.update(file_date, police_date) self.unzip() self.filter_crimes(True) self.touch(config.lastUpdatedFile) else: print "The police crime database is up to date." elif options['download']: print "Downloading..." if police_date > file_date: self.update(file_date, police_date) else: print "There is nothing new to download." elif options['unzip']: print "Unzipping..." self.unzip() elif options['filter']: if options['city'] is not 'None': print "Filtering crimes for city:", options['city'] self.filter_crimes(c = options['city']) else: print "Filtering..." self.filter_crimes() elif options['store']: if options['city'] is not 'None': print "Storing crimes for city:", options['city'] self.store(options['city']) else: print "Storing..." self.store() self.touch(config.lastUpdatedFile) elif options['clean']: print "Cleaning..." self.clean() else: print "Doing nothing." def touch(self, filename, times = None): with file(filename, 'a'): os.utime(filename, times) def url2name(self, url): return basename(urlsplit(url)[2]) def download(self, url, localFileName = None): localName = self.url2name(url) req = urllib2.Request(url) try: r = urllib2.urlopen(req) if r.info().has_key('Content-Disposition'): # If the response has Content-Disposition, we take file name from it localName = r.info()['Content-Disposition'].split('filename=')[1] if localName[0] == '"' or localName[0] == "'": localName = localName[1:-1] elif r.url != url: # if we were redirected, the real file name we take from the final URL localName = self.url2name(r.url) if localFileName: # we can force to save the file as specified name localName = localFileName f = open(localName, 'wb') f.write(r.read()) f.close() except: print "Couldn't download file:",url def update(self, pastDate, newDate): while (pastDate < newDate): pastDate = utilities.addMonths(pastDate, 1) for pol in utilities.getAllPolice(): url = (config.police_data_url+ "%02d-%02d/%02d-%02d-%s-street.zip" % (pastDate.year, pastDate.month, pastDate.year, pastDate.month, pol)) print "Downloading:", url fn = config.dataDir+pol+"-"+str(pastDate)+".zip" if (not os.path.exists(fn)): self.download(url, fn) else: print "File exists:", fn print pastDate print newDate def unzip(self): allfiles = [f for f in os.listdir(config.dataDir) if os.path.isfile(os.path.join(config.dataDir,f)) and ".zip" in f] for f in allfiles: fn = config.dataDir+f try: os.system("unzip -j "+fn+" -d "+config.csvDir) except zipfile.BadZipfile as e: print "Could not unzip file:", fn def filter_crimes(self, store=False, city=None): if city is None: for city in config.allcities.keys(): polyFile = city+"_OSGB36_polygon.csv" polygon = None if city == "Greater London": polygon = Polygon(config.greater_london_out_dir+polyFile) else: polygon = Polygon(config.poly_dir+polyFile) crimeFiles = [f for f in os.listdir(config.csvDir) if os.path.isfile(os.path.join(config.csvDir,f)) and config.allcities[city][0] in f] for crimefile in crimeFiles: filter_crime_file(crimefile, polygon, config.csvDir, config.filteredDir, store) else: polyFile = city+"_OSGB36_polygon.csv" polygon = None if city == "Greater London": polygon = Polygon(config.greater_london_out_dir+polyFile) else: polygon = Polygon(config.poly_dir+polyFile) crimeFiles = [f for f in os.listdir(config.csvDir) if os.path.isfile(os.path.join(config.csvDir,f)) and config.allcities[city][0] in f] print crimeFiles for crimefile in crimeFiles: filter_crime_file(crimefile, polygon, config.csvDir, config.filteredDir, store) def store(self, city=None): c = '' if city is None else str(city) allfiles = [f for f in os.listdir(config.filteredDir) if os.path.isfile(os.path.join(config.filteredDir,f)) and (".csv" in f) and (c in f)] print "Storing crimes..." print "c:", c print "allfiles:", allfiles count = 0; for f in allfiles: ifile = open(config.filteredDir+f, "rb") reader = csv.reader(ifile) shp = ShpParser(None) print "Storing from file:", config.filteredDir+f for row in reader: entry = [] for col in row: entry.append(col) assert(len(entry) == 8) pts = shp.convert_point_to_WGS84(entry[3], entry[4]) point = Point(float(entry[3]), float(entry[4]), srid=27700) neighbourhoods = Neighbourhood.objects.filter(poly__intersects=point) nb = None if len(neighbourhoods) == 0: # Else the crime is not covered by any neighbouhood polygon (e.g. River thames) print "No neighbourhood found for point:", pts, "OSGB36:", point elif len(neighbourhoods) == 1: nb = neighbourhoods[0] else: # print "More than one polygons (",len(neighbourhoods),") found for point:", pts, "OSGB36:", point nb = neighbourhoods[0] # Convert to format YYYY-MM-DD by replacing all occurences of "/" with "-". d = entry[0] d = d.replace('/', '-') d += "-01" c = Crimepoint(crimecat=entry[6], pt = point, streetname=entry[5], month=d, neighbourhood=nb) c.save() count += 1 print "Stored", count, "crimes." ''' Delete all intermediate files: downloaded/zipped, unzipped/unfiltered, filtered ''' def clean(self): allfiles = [f for f in os.listdir(config.dataDir) if os.path.isfile(os.path.join(config.dataDir,f)) and ".zip" in f] for f in allfiles: fn = config.dataDir+f os.remove(fn) crimeFiles = [f for f in os.listdir(config.csvDir) if os.path.isfile(os.path.join(config.csvDir,f)) and ".csv" in f] for crimefile in crimeFiles: os.remove(config.csvDir+crimefile) allfiles = [f for f in os.listdir(config.filteredDir) if os.path.isfile(os.path.join(config.filteredDir,f)) and ".csv" in f] for f in allfiles: os.remove(config.filteredDir+f)
import itertools import tqdm def load_data(filename): initial = None transforms = {} for line in open(filename): line = line.strip() if not line: continue if line.startswith('initial state:'): initial = [c == '#' for c in line.split(': ')[1]] else: src, dst = line.split(' => ', 1) src = tuple(c == '#' for c in src) transforms[src] = (dst == '#') return (initial, transforms) def get_next_state(state, transforms): new_state = {} for i in state_range(state): seg = tuple([state.get(i + s, False) for s in range(-2, 3)]) new_state[i] = transforms.get(seg) # Trim from left offset = 0 for offset, key in enumerate(sorted(new_state)): if not new_state[key]: del new_state[key] else: break return (new_state, offset) def state_range(state): return range(min(state) - 2, max(state) + 2) def format_state(state): return ''.join(('#' if state.get(i) else '.') for i in state_range(state)) if __name__ == '__main__': state, transforms = load_data('input-day12.txt') state = dict(enumerate(state)) desired_generation = 50_000_000_000 - 1 # - 1 since we get the correct answer for p1 when gen == 19 offsets = [] scores = [] last_fmt_state = None for generation in range(desired_generation): state, offset = get_next_state(state, transforms) score = sum(index for (index, flag) in state.items() if flag) offsets.append(offset) scores.append(score) fmt_state = format_state(state) if generation == 19: print('g20 (part 1) score', score) if last_fmt_state == fmt_state: score_inc_per_generation = scores[-1] - scores[-2] score_at_desired_gen = score + score_inc_per_generation * (desired_generation - generation) print(generation, score_inc_per_generation, score_at_desired_gen) break last_fmt_state = fmt_state
#!/usr/bin/python # -*- coding: UTF-8 -*- a = "John"; b =21; print "%s 's friend %s is %d!" % ("Mike",a,b); # result """ Mike 's friend John is 21! """
#!/usr/bin/env python3 from socket import * import time import random s = socket(AF_INET, SOCK_STREAM) s.bind(("127.0.0.1", 7069)) s.listen(5) c,a = s.accept() counter = 0 while True: if counter != 0: time.sleep(int(4*random.random())) if counter == 0: c.send("System:\tHello, welcome to chatbot program. \nSystem:\tAre you importing messages from file? \nSystem:\tEnter only either \"yes\" or \"no\".".encode()) counter += 1 elif counter == 1: if data == "yes": c.send("System:\tImport file but currently not available. \nSystem:\tHello, are you male or female?".encode()) counter += 1 elif data == "no": c.send("System:\tHello, are you male or female?".encode()) counter += 1 else: c.send("System:\tPlease enter in the correct format ... \n".encode()) elif counter == 2: if data == "female": c.send("System:\tHow excellent! \nSystem:\tAre you a CS major?".encode()) elif data == "male": c.send("System:\tMe too. \nSystem:\tAre you CS major?".encode()) else: c.send("System:\tGreat! \nSystem:\tAnyways, are you CS major?".encode()) counter += 1 elif counter == 3: if data == "no": c.send("System:\tToo bad. \nSystem:\tAnyway, what's an animal you like, and two you don't?".encode()) elif data == "yes": c.send("System:\tExcellent, I am too. \nSystem:\tWhat's an animal you don't like, and two you don't?".encode()) else: c.send("System:\tCool! \nSystem:\tBy the way, what's an animal you like, and two you don't?".encode()) counter += 1 elif counter == 4: data1 = data.split(',') msg = "System:\t%s awesome, but i hate %s too. \nSystem:\tBye for now. \n***Enter \'e\' to exit program." % (data1[0].strip(), data1[-1].strip()) c.send(msg.encode()) counter += 1 else: c.send(''.encode()) data = c.recv(1000).decode().strip() if data == "e": print("Exiting...") c.send("e".encode()) c.close() break c.close()
# -*- coding: UTF-8 -*- from boto.s3.connection import S3Connection from boto.s3.key import Key import config as conf import logging import boto.sqs import boto.sns #准备S3服务 def gen_s3(): s3_conn = S3Connection(conf.LBW_AWS_ACCESS_KEY, conf.LBW_AWS_SECRET_KEY) pptstore_bucket = s3_conn.get_bucket(conf.BUCKET_NAME) k = Key(pptstore_bucket) return s3_conn, pptstore_bucket, k #准备S3服务 def gen_sqs(): sqs_conn = boto.sqs.connect_to_region(conf.TOKYO_REGION,\ aws_access_key_id = conf.LBW_AWS_ACCESS_KEY,\ aws_secret_access_key = conf.LBW_AWS_SECRET_KEY) q = sqs_conn.create_queue(conf.QUEUE_NAME) return sqs_conn, q #准备SNS服务 def gen_sns(): sns_conn = boto.sns.connect_to_region(conf.TOKYO_REGION,\ aws_access_key_id = conf.LBW_AWS_ACCESS_KEY,\ aws_secret_access_key = conf.LBW_AWS_SECRET_KEY) return sns_conn def gen_logger(): # 创建一个logger logger = logging.getLogger('liveppt') logger.setLevel(logging.DEBUG) # 创建一个handler,用于写入日志文件 fh = logging.FileHandler('test.log') fh.setLevel(logging.DEBUG) # 再创建一个handler,用于输出到控制台 ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # 定义handler的输出格式 formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') fh.setFormatter(formatter) ch.setFormatter(formatter) # 给logger添加handler logger.addHandler(fh) logger.addHandler(ch) return logger
v = float(input()) if (v >= 0.0 and v <= 25.0000): print("Intervalo [0,25]") elif (v >= 25.0001 and v <= 50.0000): print("Intervalo (25,50]") elif (v >= 50.0001 and v <= 75.0000): print("Intervalo (50,75]") elif (v >= 75.0001 and v <= 100.0000): print("Intervalo (75,100]") else: print("Fora de intervalo")
def areSimilar(a, b): k = [(x,y) for x, y in zip(a,b)] count = 0 mismatch = () for i in k: x = i[0] y = i[1] if x != y: if len(mismatch) == 0: mismatch = (x, y) elif mismatch[0] != y or mismatch[1] != x: return False else: count += 1 if count <= 1: return True return False if __name__ == '__main__': print(areSimilar([1, 2, 3], [2, 1, 3]))
# -*- coding: utf-8 -*- # Copyright 2005 Lars Wirzenius (liw@iki.fi) # Copyright © 2012 Andreas Beckmann (anbe@debian.org) # # This program is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by the # Free Software Foundation; either version 2 of the License, or (at your # option) any later version. # # This program is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General # Public License for more details. # # You should have received a copy of the GNU General Public License along with # this program. If not, see <https://www.gnu.org/licenses/> """Parser for Debian package relationship strings This module contains the class DependencyParser, which parses Debian package relationship strings (e.g., the Depends header). The class raises the DependencySyntaxError exception on syntactic errors. The result uses SimpleDependency objects. Lars Wirzenius <liw@iki.fi> """ import re class DependencySyntaxError(Exception): """Syntax error in package dependency declaration""" def __init__(self, msg, cursor): self._msg = "Error: %s: %s (text at error: '%s', full text being parsed: '%s')" % \ (cursor.get_position(), msg, cursor.get_text(10), cursor.get_full_text()) def __str__(self): return self._msg def __repr__(self): return self._msg class _Cursor: """Store an input string and a movable location in it""" def __init__(self, myinput): self._input = myinput self._len = len(self._input) self._pos = 0 def skip_whitespace(self): while self._pos < self._len and self._input[self._pos].isspace(): self.mynext() def at_end(self): """Are we at the end of the input?""" self.skip_whitespace() return self._pos >= self._len def mynext(self): """Move to the next character""" if self._pos < self._len: self._pos += 1 def get_char(self): """Return current character, None if at end""" if self._pos >= self._len: return None else: return self._input[self._pos] def get_full_text(self): return self._input def get_text(self, length): """Return up to length characters from the current position""" if self._pos >= self._len: return "" else: return self._input[self._pos:self._pos + length] def match(self, regexp): """Match a regular expression against the current position The cursor is advanced by the length of the match, if any. """ m = regexp.match(self._input[self._pos:]) if m: self._pos += len(m.group()) return m def match_literal(self, literal): """Match a literal string against the current position. Return True and move position if there is a match, else return False. """ if self.get_text(len(literal)) == literal: self._pos += len(literal) return True else: return False def get_position(self): """Return current position, as string""" return "pos %d" % self._pos class SimpleDependency: """Express simple dependency towards another package""" def __init__(self, name, operator, version, arch): self.name = name self.operator = operator self.version = version self.arch = arch def __repr__(self): return "<DEP: %s, %s, %s, %s>" % (self.name, self.operator, self.version, self.arch) class DependencyParser: """Parse Debian package relationship strings Debian packages have a rich language for expressing their relationships. See the Debian Policy Manual, chapter 7 ("Declaring relationships between packages"). This Python module implements a parser for strings expressing such relationships. Syntax of dependency fields (Pre-Depends, Depends, Recommends, Suggests, Conflicts, Provides, Replaces, Enhances, Build-Depends, Build-Depends-Indep, Build-Conflicts, Build-Conflicts-Indep), in a BNF-like form: depends-field ::= EMPTY | dependency ("," dependency)* dependency ::= possible-dependency ("|" possible-dependency)* possible-dependency ::= package-name version-dependency? arch-restriction? version-dependency ::= "(" relative-operator version-number ")" relative-operator ::= "<<" | "<=" | "=" | ">=" | ">>" | "<" | ">" version-number ::= epoch? upstream-version debian-revision? arch-restriction ::= "[" arch-name arch-name* "]" | "[" "!" arch-name ("!" arch-name)* "]" package-name ::= alphanumeric name-char name-char* ":any"? epoch ::= integer ":" upstream-version ::= alphanumeric version-char* -- policy says "should start with digit", but not all packages do debian-revision ::= "-" debian-version-char debian-version-char* arch-name ::= alphanumeric alphanumeric* EMPTY ::= "" integer ::= digit digit* alphanumeric ::= "a" | "b" | "c" | "d" | "e" | "f" | "g" | "h" | "i" | "j" | "k" | "l" | "m" | "n" | "o" | "p" | "q" | "r" | "s" | "t" | "u" | "v" | "w" | "x" | "y" | "z" | digit digit ::= "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" name-char ::= alphanumeric | "+" | "-" | "." | "_" version-char ::= alphanumeric | "." | "+" | "-" | ":" | "~" debian-version-char ::= alphanumeric | "." | "+" White space can occur between any tokens except inside package-name, version-number, or arch-name. Some of the headers restrict the syntax somewhat, e.g., Provides does not allow version-dependency, but this is not included in the syntax for simplicity. Note: Added "_" to name-char, because some packages (type-handling in particular) use Provides: headers with bogus package names. Note: Added upper case letters to name pattern, since it some of the Mozilla localization packages use or used them. """ def __init__(self, input_string): self._cursor = _Cursor(input_string) self._list = self._parse_dependencies() def get_dependencies(self): """Return parsed dependencies The result is a list of lists of SimpleDependency objects. Let's try that again. The result is a list of dependencies, corresponding to the comma-separated items in the dependency list. Each dependency is also a list, or SimpleDependency objects, representing alternative ways to fulfill the dependency; in other words, items separated by the vertical bar (|). For example, "foo, bar | foobar" would result in the following list: [[foo], [bar, foobar]]. """ return self._list def _parse_dependencies(self): vlist = [] dep = self._parse_dependency() while dep: vlist.append(dep) self._cursor.skip_whitespace() if self._cursor.at_end(): break if not self._cursor.match_literal(","): raise DependencySyntaxError("Expected comma", self._cursor) dep = self._parse_dependency() return vlist def _parse_dependency(self): vlist = [] dep = self._parse_possible_dependency() while dep: vlist.append(dep) self._cursor.skip_whitespace() if not self._cursor.match_literal("|"): break dep = self._parse_possible_dependency() return vlist def _parse_possible_dependency(self): name = self._parse_package_name() if not name: return None (op, version) = self._parse_version_dependency() arch = self._parse_arch_restriction() return SimpleDependency(name, op, version, arch) _name_pat = re.compile(r"[a-zA-Z0-9][a-zA-Z0-9+._-]+") # The MultiArch spec supports an ":any" modifier. Loosen the # accepted arch's, to avoid crashing. _any_suffix_pat = re.compile(r":[a-zA-Z0-9-]+") def _parse_package_name(self): self._cursor.skip_whitespace() if self._cursor.at_end(): return None m = self._cursor.match(self._name_pat) if not m: raise DependencySyntaxError("Expected a package name", self._cursor) if self._cursor.match(self._any_suffix_pat): pass return m.group() _op_pat = re.compile(r"(<<|<=|=|>=|>>|<(?![<=])|>(?![>=]))") _version_pat = re.compile(r"(?P<epoch>\d+:)?" + r"(?P<upstream>[a-zA-Z0-9+][a-zA-Z0-9.+:~-]*)" + r"(?P<debian>-[a-zA-Z0-9.+]+)?") def _parse_version_dependency(self): self._cursor.skip_whitespace() if self._cursor.get_char() == "(": self._cursor.mynext() self._cursor.skip_whitespace() opm = self._cursor.match(self._op_pat) if not opm: raise DependencySyntaxError("Expected a version relation " + "operator", self._cursor) operator = opm.group() if operator == "<": operator = "<=" elif operator == ">": operator = ">=" self._cursor.skip_whitespace() verm = self._cursor.match(self._version_pat) if not verm: raise DependencySyntaxError("Expected a version number", self._cursor) self._cursor.skip_whitespace() if self._cursor.get_char() != ")": raise DependencySyntaxError("Expected ')'", self._cursor) self._cursor.mynext() return opm.group(), verm.group() else: return None, None _arch_pat = re.compile(r"!?[a-zA-Z0-9-]+") def _parse_arch_restriction(self): self._cursor.skip_whitespace() if self._cursor.get_char() == "[": self.mynext() vlist = [] while True: self._cursor.skip_whitespace() if self._cursor.get_char() == "]": self._cursor.mynext() break m = self._cursor.match(self._arch_pat) if not m: raise DependencySyntaxError("Expected architecture name", self._cursor) vlist.append(m.group()) return vlist else: return None # vi:set et ts=4 sw=4 :
# nmap -v scanme.nmap.org import argparse , sys, logging logging.getLogger("scapy.runtime").setLevel(logging.ERROR) from scapy.all import * import datetime import socket from decimal import Decimal import tempfile import os import requests import tkinter from tkinter import messagebox def end(fl): API = "http://127.0.0.1:4020/API/v1/StopTrace" PARAMS = {'authkey':"vzkTx3652MKsLNmV4wH3oaGSzsfMGP"} r = requests.get(url = API, params = PARAMS) os.close(fl) exit() pkts = {} FIN = 0x01 SYN = 0x02 RST = 0x04 PSH = 0x08 ACK = 0x10 URG = 0x20 ECE = 0x40 CWR = 0x80 API = "http://127.0.0.1:4020/API/v1/StartTrace" PARAMS = {'authkey':"vzkTx3652MKsLNmV4wH3oaGSzsfMGP"} r = requests.get(url = API, params = PARAMS) lhf = 0 root = tkinter.Tk() root.withdraw() rootnum = 0 fl, filename = tempfile.mkstemp() while True: flujosdict = {} count = 0 lenght = 0 old_time = 0 flag_urg =0 flag_ack =0 flag_psh =0 flag_rst =0 flag_syn =0 flag_fin =0 API = "http://127.0.0.1:4020/API/v1/getTrace" PARAMS = {'authkey':"vzkTx3652MKsLNmV4wH3oaGSzsfMGP"} with requests.get(url = API, params = PARAMS, stream=True) as r: os.truncate(fl, lhf) os.lseek(fl, 0, 0) os.write(fl, r.content) lhf = len(r.content) try: pkts = rdpcap(filename) except: continue for pkt in pkts: if pkt.haslayer(IP): if pkt.haslayer(TCP): F = pkt[TCP].flags # this should give you an integer if F & URG: flag_urg=1 # FIN flag activated if F & ACK: flag_ack=1 # SYN flag activated # rest of the flags here if F & PSH: flag_psh=1 if F & RST: flag_rst=1 if F & SYN: flag_syn=1 if F & FIN: flag_fin=1 if flag_rst > 0: auxset =(pkt[IP].src, pkt[IP].dst , pkt[TCP].sport, pkt[TCP].dport) if auxset in flujosdict: flujosdict[auxset]+=1 else: flujosdict[auxset] = 0 for key,value in flujosdict.items(): if value <= 4: API = "http://127.0.0.1:4020/API/v1/postIPBlock" PARAMS = {'authkey':"vzkTx3652MKsLNmV4wH3oaGSzsfMGP", 'ip' :key[0], 'time' : "100"} with requests.post(url = API, data = PARAMS) as r: messagebox.showinfo("¡Alerta!", "Escaneo con NMAP detectado a la IP: " + key[0] + " desde la IP: " + key[1]) root.update() end(fl) os.close(fl)
from PyQt5 import QtGui, QtCore, QtWidgets from PyQt5.QtWidgets import * from tools import * #from tools.modeltool import * #from tools.tool import * #from tools.milltask import * #import pyqtgraph.opengl as gl #import pyqtgraph as pg from solids import * import sys from guifw.gui_elements import * #from modeldialog import * from pathdialog import * from taskdialog import * from grbldialog import * from objectviewer import * from gcode_editor import * class CAMGui(QtGui.QSplitter): def __init__(self): QtGui.QSplitter.__init__(self) self.editor = GcodeEditorWidget() self.objectviewer = ObjectViewer(editor=self.editor) #self.objectviewer = ObjectViewer() self.tabs=QtGui.QTabWidget() self.availablePathTools = OrderedDict([("Load GCode", PathTool), ("Thread milling", threading_tool.ThreadingTool)]) self.pathtab = PathDialog(viewer = self.objectviewer, tools=None, editor=self.editor, availablePathTools = self.availablePathTools) self.grbltab = GrblDialog(path_dialog=self.pathtab, editor=self.editor) #self.tabs.addTab(self.pathtab, "Path tools") #self.tabs.addTab(self.grbltab, "Machine") self.addWidget(self.grbltab) self.centerWidget = QtGui.QSplitter(Qt.Vertical) self.centerWidget.addWidget(self.objectviewer) self.centerWidget.addWidget(self.editor) self.addWidget(self.centerWidget) #self.addWidget(self.pathtab) self.setWindowTitle('Machine Interface') self.updateGeometry() self.resize(1200, 600) ## Display the widget as a new window app = QtGui.QApplication([]) camgui=CAMGui() camgui.show() if len(sys.argv)>1 and sys.argv[1]=="-f": camgui.showFullScreen() ## Start the Qt event loop app.exec_()
#!/usr/bin/env python # -*- coding: utf-8 -*- """ __title__ = "" __author__ = "altamob" __mtime__ = "2016/9/1" # code is far away from bugs with the god animal protecting I love animals. They taste delicious. ┏┓ ┏┓ ┏┛┻━━━┛┻┓ ┃ ☃ ┃ ┃ ┳┛ ┗┳ ┃ ┃ ┻ ┃ ┗━┓ ┏━┛ ┃ ┗━━━┓ ┃ 神兽保佑 ┣┓ ┃ 永无BUG! ┏┛ ┗┓┓┏━┳┓┏┛ ┃┫┫ ┃┫┫ ┗┻┛ ┗┻┛ """ import json import logging import sys import re from scrapy import Spider, Selector, Request from mm_spider.items import MmSpiderItem reload(sys) # Python2.5 初始化后会删除 sys.setdefaultencoding 这个方法,我们需要重新载入 sys.setdefaultencoding('utf-8') ''' { "expires_in": 2592000, "refresh_token": "22.46e3dad8d3296ccfd66b74bfa4775527.315360000.1800169524.1142366778-9221408", "access_token": "21.4648aa9c20aa9e29f2adcf50802f97a8.2592000.1487401524.1142366778-9221408", "session_secret": "28a9353539007e3af9ec3082215438bc", "session_key": "9mnRcAB1toUuhIxZXZmNMPE3JIRJAN/5kUpFT+Ms6y1tmo80AjYHEvLYqTFckGmvc2UNkRAmaAwYt9Mn6MJYbN7VQpMcTEOj2A==", "scope": "basic" } ''' class HbImageSpider(Spider): logger=logging.getLogger() """爬取w3school标签""" # log.start("log",loglevel='INFO') name = "huaban_boards" allowed_domains = ["huaban.com"] start_urls = [ "http://huaban.com/boards/favorite/beauty/" ] def parse(self, response): if "board_count" in response.meta: board_count = response.meta['board_count'] else: board_count=0 board_host = "http://huaban.com/boards/{0}/" next_url=response.url.split("?")[0]+"?iy2n3lr1&max={0}&limit=20&wfl=1" sites = response.body.split("\n") max_page=10 min_board_id=0 for site in sites: site = site.strip().strip(';') if site.startswith('app.page["boards"]'): json_str = site.split('=', 1)[-1] board_items = json.loads(json_str) for item in board_items: print item['board_id'] if min_board_id == 0 or min_board_id > item['board_id']: min_board_id=item['board_id'] url = board_host.format(item['board_id']) yield Request(url, meta={"count": 0,"max_page":max_page}, callback=self.parse_board) board_count+=1 board_url=next_url.format(min_board_id) if board_count==3: return yield Request(board_url, meta={"board_count": board_count}, callback=self.parse) def parse_board(self, response): self.logger.info('url:{0}'.format( response.url)) board_host = "http://huaban.com/boards/{0}/?iy2bf9u4&max={1}&limit=20&wfl=1" img_host = "http://img.hb.aicdn.com/" sites = response.body.split("\n") count = response.meta['count'] max_page=response.meta['max_page'] min_pin_id = 0 board_id = 0 for site in sites: site = site.strip().strip(';') if site.startswith('app.page["board"]'): json_str = site.split('=', 1)[-1] pint_items = json.loads(json_str) category_id=pint_items['category_id'] category_name=pint_items['category_name'] image_desc=pint_items['description'] title=pint_items['title'] for pin_item in pint_items['pins']: item = MmSpiderItem() item['board_id'] = pin_item['board_id'] item['category_id'] = category_id item['file_id'] = pin_item['file_id'] item['image_url'] = img_host + pin_item['file']['key'] item['category_name'] =category_name item['image_desc'] =image_desc item['title'] =title item['created_at']=pin_item['created_at'] if min_pin_id == 0 or min_pin_id > pin_item['pin_id']: min_pin_id = pin_item['pin_id'] board_id = pin_item['board_id'] yield item count += 1 if count == max_page: return if min_pin_id and board_id: next_url = board_host.format(board_id, min_pin_id) yield Request(next_url, meta={"count": count,"max_page":max_page}, callback=self.parse_board)
import os import re from collections import OrderedDict import nipype.interfaces.ants as ants import nipype.interfaces.fsl as fsl import nipype.interfaces.utility as util from CPAC.pipeline import nipype_pipeline_engine as pe from nipype.interfaces import afni from nipype import logging from CPAC.nuisance.utils.compcor import calc_compcor_components from CPAC.nuisance.utils.crc import encode as crc_encode from CPAC.utils.interfaces.fsl import Merge as fslMerge from CPAC.utils.interfaces.function import Function from CPAC.registration.utils import check_transforms, generate_inverse_transform_flags logger = logging.getLogger('nipype.workflow') def find_offending_time_points(fd_j_file_path=None, fd_p_file_path=None, dvars_file_path=None, fd_j_threshold=None, fd_p_threshold=None, dvars_threshold=None, number_of_previous_trs_to_censor=0, number_of_subsequent_trs_to_censor=0): """ Applies criterion in method to find time points whose FD or DVARS (or both) are above threshold. :param fd_j_file_path: path to TSV containing framewise displacement as a single column. If not specified, it will not be used. :param fd_p_file_path: path to TSV containing framewise displacement as a single column. If not specified, it will not be used. :param dvars_file_path: path to TSV containing DVARS as a single column. If not specified, it will not be used. :param fd_j_threshold: threshold to apply to framewise displacement (Jenkinson), it can be a value such as 0.2 or a floating point multiple of the standard deviation specified as, e.g. '1.5SD'. :param fd_p_threshold: threshold to apply to framewise displacement (Power), it can be a value such as 0.2 or a floating point multiple of the standard deviation specified as, e.g. '1.5SD'. :param dvars_threshold: threshold to apply to DVARS, can be a value such as 0.5 or a floating point multiple of the standard deviation specified as, e.g. '1.5SD'. :param number_of_previous_trs_to_censor: extent of censorship window before the censor. :param number_of_subsequent_trs_to_censor: extent of censorship window after the censor. :return: File path to TSV file containing the volumes to be censored. """ import numpy as np import os import re offending_time_points = set() time_course_len = 0 types = ['FDJ', 'FDP', 'DVARS'] file_paths = [fd_j_file_path, fd_p_file_path, dvars_file_path] thresholds = [fd_j_threshold, fd_p_threshold, dvars_threshold] #types = ['FDP', 'DVARS'] #file_paths = [fd_p_file_path, dvars_file_path] #thresholds = [fd_p_threshold, dvars_threshold] for type, file_path, threshold in zip(types, file_paths, thresholds): if not file_path: continue if not os.path.isfile(file_path): raise ValueError( "File {0} could not be found." .format(file_path) ) if not threshold: raise ValueError("Method requires the specification of a threshold, none received") metric = np.loadtxt(file_path) if type == 'DVARS': metric = np.array([0.0] + metric.tolist()) if not time_course_len: time_course_len = metric.shape[0] else: assert time_course_len == metric.shape[0], "Threshold metric files does not have same size." try: threshold_sd = \ re.match(r"([0-9]*\.*[0-9]*)\s*SD", str(threshold)) if threshold_sd: threshold_sd = float(threshold_sd.groups()[0]) threshold = metric.mean() + \ threshold_sd * metric.std() else: threshold = float(threshold) except: raise ValueError("Could not translate threshold {0} into a " "meaningful value".format(threshold)) offending_time_points |= \ set(np.where(metric > threshold)[0].tolist()) extended_censors = [] for censor in offending_time_points: extended_censors += list(range( (censor - number_of_previous_trs_to_censor), (censor + number_of_subsequent_trs_to_censor + 1))) extended_censors = [ censor for censor in np.unique(extended_censors) if 0 <= censor < time_course_len ] censor_vector = np.ones((time_course_len, 1)) censor_vector[extended_censors] = 0 out_file_path = os.path.join(os.getcwd(), "censors.tsv") np.savetxt( out_file_path, censor_vector, fmt='%d', header='censor', comments='' ) return out_file_path def compute_threshold(in_file, mask, threshold): return threshold def compute_pct_threshold(in_file, mask, threshold_pct): import nibabel as nb import numpy as np m = nb.load(mask).get_data().astype(bool) if not np.any(m): return 0.0 d = nb.load(in_file).get_data()[m] return np.percentile( d, 100.0 - threshold_pct ) def compute_sd_threshold(in_file, mask, threshold_sd): import nibabel as nb import numpy as np m = nb.load(mask).get_data().astype(bool) if not np.any(m): return 0.0 d = nb.load(in_file).get_data()[m] return d.mean() + threshold_sd * d.std() def temporal_variance_mask(threshold, by_slice=False, erosion=False, degree=1): threshold_method = "VAR" if isinstance(threshold, str): regex_match = { "SD": r"([0-9]+(\.[0-9]+)?)\s*SD", "PCT": r"([0-9]+(\.[0-9]+)?)\s*PCT", } for method, regex in regex_match.items(): matched = re.match(regex, threshold) if matched: threshold_method = method threshold_value = matched.groups()[0] try: threshold_value = float(threshold_value) except: raise ValueError("Error converting threshold value {0} from {1} to a " "floating point number. The threshold value can " "contain SD or PCT for selecting a threshold based on " "the variance distribution, otherwise it should be a " "floating point number.".format(threshold_value, threshold)) if threshold_value < 0: raise ValueError("Threshold value should be positive, instead of {0}." .format(threshold_value)) if threshold_method == "PCT" and threshold_value >= 100.0: raise ValueError("Percentile should be less than 100, received {0}." .format(threshold_value)) threshold = threshold_value wf = pe.Workflow(name='tcompcor') input_node = pe.Node(util.IdentityInterface(fields=['functional_file_path', 'mask_file_path']), name='inputspec') output_node = pe.Node(util.IdentityInterface(fields=['mask']), name='outputspec') # C-PAC default performs linear regression while nipype performs quadratic regression detrend = pe.Node(afni.Detrend(args='-polort {0}'.format(degree), outputtype='NIFTI'), name='detrend') wf.connect(input_node, 'functional_file_path', detrend, 'in_file') std = pe.Node(afni.TStat(args='-nzstdev', outputtype='NIFTI'), name='std') wf.connect(input_node, 'mask_file_path', std, 'mask') wf.connect(detrend, 'out_file', std, 'in_file') var = pe.Node(afni.Calc(expr='a*a', outputtype='NIFTI'), name='var') wf.connect(std, 'out_file', var, 'in_file_a') if by_slice: slices = pe.Node(fsl.Slice(), name='slicer') wf.connect(var, 'out_file', slices, 'in_file') mask_slices = pe.Node(fsl.Slice(), name='mask_slicer') wf.connect(input_node, 'mask_file_path', mask_slices, 'in_file') mapper = pe.MapNode(util.IdentityInterface(fields=['out_file', 'mask_file']), name='slice_mapper', iterfield=['out_file', 'mask_file']) wf.connect(slices, 'out_files', mapper, 'out_file') wf.connect(mask_slices, 'out_files', mapper, 'mask_file') else: mapper_list = pe.Node(util.Merge(1), name='slice_mapper_list') wf.connect(var, 'out_file', mapper_list, 'in1') mask_mapper_list = pe.Node(util.Merge(1), name='slice_mask_mapper_list') wf.connect(input_node, 'mask_file_path', mask_mapper_list, 'in1') mapper = pe.Node(util.IdentityInterface(fields=['out_file', 'mask_file']), name='slice_mapper') wf.connect(mapper_list, 'out', mapper, 'out_file') wf.connect(mask_mapper_list, 'out', mapper, 'mask_file') if threshold_method == "PCT": threshold_node = pe.MapNode(Function(input_names=['in_file', 'mask', 'threshold_pct'], output_names=['threshold'], function=compute_pct_threshold, as_module=True), name='threshold_value', iterfield=['in_file', 'mask']) threshold_node.inputs.threshold_pct = threshold_value wf.connect(mapper, 'out_file', threshold_node, 'in_file') wf.connect(mapper, 'mask_file', threshold_node, 'mask') elif threshold_method == "SD": threshold_node = pe.MapNode(Function(input_names=['in_file', 'mask', 'threshold_sd'], output_names=['threshold'], function=compute_sd_threshold, as_module=True), name='threshold_value', iterfield=['in_file', 'mask']) threshold_node.inputs.threshold_sd = threshold_value wf.connect(mapper, 'out_file', threshold_node, 'in_file') wf.connect(mapper, 'mask_file', threshold_node, 'mask') else: threshold_node = pe.MapNode(Function(input_names=['in_file', 'mask', 'threshold'], output_names=['threshold'], function=compute_threshold, as_module=True), name='threshold_value', iterfield=['in_file', 'mask']) threshold_node.inputs.threshold = threshold_value wf.connect(mapper, 'out_file', threshold_node, 'in_file') wf.connect(mapper, 'mask_file', threshold_node, 'mask') threshold_mask = pe.MapNode(interface=fsl.maths.Threshold(), name='threshold', iterfield=['in_file', 'thresh']) threshold_mask.inputs.args = '-bin' wf.connect(mapper, 'out_file', threshold_mask, 'in_file') wf.connect(threshold_node, 'threshold', threshold_mask, 'thresh') merge_slice_masks = pe.Node(interface=fslMerge(), name='merge_slice_masks') merge_slice_masks.inputs.dimension = 'z' wf.connect( threshold_mask, 'out_file', merge_slice_masks, 'in_files' ) wf.connect(merge_slice_masks, 'merged_file', output_node, 'mask') return wf def generate_summarize_tissue_mask(nuisance_wf, pipeline_resource_pool, regressor_descriptor, regressor_selector, csf_mask_exist, use_ants=True, ventricle_mask_exist=True, all_bold=False): """ Add tissue mask generation into pipeline according to the selector. :param nuisance_wf: Nuisance regressor workflow. :param pipeline_resource_pool: dictionary of available resources. :param regressor_descriptor: dictionary of steps to build, including keys: 'tissue', 'resolution', 'erosion' :param regressor_selector: dictionary with the original selector :return: the full path of the 3D nifti file containing the mask created by this operation. """ steps = [ key for key in ['tissue', 'resolution', 'erosion'] if key in regressor_descriptor ] full_mask_key = "_".join( regressor_descriptor[s] for s in steps ) for step_i, step in enumerate(steps): mask_key = "_".join( regressor_descriptor[s] for s in steps[:step_i+1] ) if mask_key in pipeline_resource_pool: continue node_mask_key = re.sub(r"[^\w]", "_", mask_key) prev_mask_key = "_".join( regressor_descriptor[s] for s in steps[:step_i] ) if step == 'tissue': pass elif step == 'resolution': if all_bold: pass if csf_mask_exist: mask_to_epi = pe.Node(interface=fsl.FLIRT(), name='{}_flirt'.format(node_mask_key), mem_gb=3.63, mem_x=(3767129957844731 / 1208925819614629174706176, 'in_file')) mask_to_epi.inputs.interp = 'nearestneighbour' if regressor_selector['extraction_resolution'] == "Functional": # apply anat2func matrix mask_to_epi.inputs.apply_xfm = True mask_to_epi.inputs.output_type = 'NIFTI_GZ' nuisance_wf.connect(*( pipeline_resource_pool['Functional_mean'] + (mask_to_epi, 'reference') )) nuisance_wf.connect(*( pipeline_resource_pool['Transformations']['anat_to_func_linear_xfm'] + (mask_to_epi, 'in_matrix_file') )) else: resolution = regressor_selector['extraction_resolution'] mask_to_epi.inputs.apply_isoxfm = resolution nuisance_wf.connect(*( pipeline_resource_pool['Anatomical_{}mm' .format(resolution)] + (mask_to_epi, 'reference') )) nuisance_wf.connect(*( pipeline_resource_pool[prev_mask_key] + (mask_to_epi, 'in_file') )) pipeline_resource_pool[mask_key] = \ (mask_to_epi, 'out_file') if full_mask_key.startswith('CerebrospinalFluid'): pipeline_resource_pool = generate_summarize_tissue_mask_ventricles_masking( nuisance_wf, pipeline_resource_pool, regressor_descriptor, regressor_selector, node_mask_key, csf_mask_exist, use_ants, ventricle_mask_exist ) elif step == 'erosion': erode_mask_node = pe.Node( afni.Calc(args='-b a+i -c a-i -d a+j -e a-j -f a+k -g a-k', expr='a*(1-amongst(0,b,c,d,e,f,g))', outputtype='NIFTI_GZ'), name='{}'.format(node_mask_key) ) nuisance_wf.connect(*( pipeline_resource_pool[prev_mask_key] + (erode_mask_node, 'in_file_a') )) pipeline_resource_pool[mask_key] = \ (erode_mask_node, 'out_file') return pipeline_resource_pool, full_mask_key def generate_summarize_tissue_mask_ventricles_masking(nuisance_wf, pipeline_resource_pool, regressor_descriptor, regressor_selector, mask_key, csf_mask_exist, use_ants=True, ventricle_mask_exist=True): if csf_mask_exist == False: logger.warning('Segmentation is Off, - therefore will be using ' 'lateral_ventricle_mask as CerebrospinalFluid_mask.') # Mask CSF with Ventricles if '{}_Unmasked'.format(mask_key) not in pipeline_resource_pool: if ventricle_mask_exist: ventricles_key = 'VentriclesToAnat' if 'resolution' in regressor_descriptor: ventricles_key += '_{}'.format(regressor_descriptor['resolution']) if ventricles_key not in pipeline_resource_pool: transforms = pipeline_resource_pool['Transformations'] if use_ants is True: # perform the transform using ANTS collect_linear_transforms = pe.Node(util.Merge(3), name='{}_ants_transforms'.format(ventricles_key)) nuisance_wf.connect(*(transforms['mni_to_anat_linear_xfm'] + (collect_linear_transforms, 'in1'))) # generate inverse transform flags, which depends on the number of transforms inverse_transform_flags = pe.Node(util.Function(input_names=['transform_list'], output_names=['inverse_transform_flags'], function=generate_inverse_transform_flags), name='{0}_inverse_transform_flags'.format(ventricles_key)) nuisance_wf.connect(collect_linear_transforms, 'out', inverse_transform_flags, 'transform_list') lat_ven_mni_to_anat = pe.Node( interface=ants.ApplyTransforms(), name='{}_ants'.format(ventricles_key), mem_gb=0.683, mem_x=(3811976743057169 / 302231454903657293676544, 'input_image')) lat_ven_mni_to_anat.inputs.interpolation = 'NearestNeighbor' lat_ven_mni_to_anat.inputs.dimension = 3 nuisance_wf.connect(inverse_transform_flags, 'inverse_transform_flags', lat_ven_mni_to_anat, 'invert_transform_flags') nuisance_wf.connect(collect_linear_transforms, 'out', lat_ven_mni_to_anat, 'transforms') nuisance_wf.connect(*(pipeline_resource_pool['Ventricles'] + (lat_ven_mni_to_anat, 'input_image'))) resolution = regressor_selector['extraction_resolution'] if csf_mask_exist: nuisance_wf.connect(*( pipeline_resource_pool[mask_key] + (lat_ven_mni_to_anat, 'reference_image'))) elif resolution == 'Functional': nuisance_wf.connect(*( pipeline_resource_pool['Functional_mean'] + (lat_ven_mni_to_anat, 'reference_image'))) else: nuisance_wf.connect(*( pipeline_resource_pool['Anatomical_{}mm'.format(resolution)] + (lat_ven_mni_to_anat, 'reference_image'))) pipeline_resource_pool[ventricles_key] = (lat_ven_mni_to_anat, 'output_image') else: # perform the transform using FLIRT lat_ven_mni_to_anat = pe.Node(interface=fsl.ApplyWarp(), name='{}_fsl_applywarp'.format(ventricles_key)) lat_ven_mni_to_anat.inputs.interp = 'nn' nuisance_wf.connect(*(transforms['mni_to_anat_linear_xfm'] + (lat_ven_mni_to_anat, 'field_file'))) nuisance_wf.connect(*(pipeline_resource_pool['Ventricles'] + (lat_ven_mni_to_anat, 'in_file'))) nuisance_wf.connect(*(pipeline_resource_pool[mask_key] + (lat_ven_mni_to_anat, 'ref_file'))) pipeline_resource_pool[ventricles_key] = (lat_ven_mni_to_anat, 'out_file') if csf_mask_exist: # reduce CSF mask to the lateral ventricles mask_csf_with_lat_ven = pe.Node(interface=afni.Calc(outputtype='NIFTI_GZ'), name='{}_Ventricles'.format(mask_key)) mask_csf_with_lat_ven.inputs.expr = 'a*b' mask_csf_with_lat_ven.inputs.out_file = 'csf_lat_ven_mask.nii.gz' nuisance_wf.connect(*(pipeline_resource_pool[ventricles_key] + (mask_csf_with_lat_ven, 'in_file_a'))) nuisance_wf.connect(*(pipeline_resource_pool[mask_key] + (mask_csf_with_lat_ven, 'in_file_b'))) pipeline_resource_pool['{}_Unmasked'.format(mask_key)] = pipeline_resource_pool[mask_key] pipeline_resource_pool[mask_key] = (mask_csf_with_lat_ven, 'out_file') else: pipeline_resource_pool[mask_key] = pipeline_resource_pool[ventricles_key] return pipeline_resource_pool class NuisanceRegressor(object): def __init__(self, selector): self.selector = selector if 'Bandpass' in self.selector: s = self.selector['Bandpass'] if type(s) is not dict or \ (not s.get('bottom_frequency') and not s.get('top_frequency')): del self.selector['Bandpass'] def get(self, key, default=None): return self.selector.get(key, default) def __contains__(self, key): return key in self.selector def __getitem__(self, key): return self.selector[key] @staticmethod def _derivative_params(selector): nr_repr = '' if not selector: return nr_repr if selector.get('include_squared'): nr_repr += 'S' if selector.get('include_delayed'): nr_repr += 'D' if selector.get('include_delayed_squared'): nr_repr += 'B' if selector.get('include_backdiff'): nr_repr += 'V' if selector.get('include_backdiff_squared'): nr_repr += 'C' return nr_repr @staticmethod def _summary_params(selector): summ = selector['summary'] methods = { 'PC': 'PC', 'DetrendPC': 'DPC', 'Mean': 'M', 'NormMean': 'NM', 'DetrendMean': 'DM', 'DetrendNormMean': 'DNM', } if type(summ) == dict: method = summ['method'] rep = methods[method] if method in ['DetrendPC', 'PC']: rep += "%d" % summ['components'] else: rep = methods[summ] return rep @staticmethod def encode(selector): regs = OrderedDict([ ('GreyMatter', 'GM'), ('WhiteMatter', 'WM'), ('CerebrospinalFluid', 'CSF'), ('tCompCor', 'tC'), ('aCompCor', 'aC'), ('GlobalSignal', 'G'), ('Motion', 'M'), ('Custom', 'T'), ('PolyOrt', 'P'), ('Bandpass', 'BP'), ('Censor', 'C') ]) tissues = ['GreyMatter', 'WhiteMatter', 'CerebrospinalFluid'] selectors_representations = [] # tC-1.5PT-PC5S-SDB # aC-WC-2mmE-PC5-SDB # WM-2mmE-PC5-SDB # CSF-2mmE-M-SDB # GM-2mmE-DNM-SDB # G-PC5-SDB # M-SDB # C-S-FD1.5SD-D1.5SD # P-2 # B-T0.01-B0.1 for r in regs.keys(): if r not in selector: continue s = selector[r] pieces = [regs[r]] if r in tissues: if s.get('extraction_resolution') and s['extraction_resolution'] != 'Functional': res = "%.2gmm" % s['extraction_resolution'] if s.get('erode_mask'): res += 'E' pieces += [res] pieces += [NuisanceRegressor._summary_params(s)] pieces += [NuisanceRegressor._derivative_params(s)] elif r == 'tCompCor': threshold = "" if s.get('by_slice'): threshold += 'S' t = s.get('threshold') if t: if type(t) != str: t = "%.2f" % t threshold += t if s.get('erode_mask'): threshold += 'E' if s.get('degree'): d = s.get('degree') threshold += str(d) pieces += [threshold] pieces += [NuisanceRegressor._summary_params(s)] pieces += [NuisanceRegressor._derivative_params(s)] elif r == 'aCompCor': if s.get('tissues'): pieces += ["+".join([regs[t] for t in sorted(s['tissues'])])] if s.get('extraction_resolution'): res = "%.2gmm" % s['extraction_resolution'] if s.get('erode_mask'): res += 'E' pieces += [res] pieces += [NuisanceRegressor._summary_params(s)] pieces += [NuisanceRegressor._derivative_params(s)] elif r == 'Custom': for ss in s: pieces += [ os.path.basename(ss['file'])[0:5] + crc_encode(ss['file']) ] elif r == 'GlobalSignal': pieces += [NuisanceRegressor._summary_params(s)] pieces += [NuisanceRegressor._derivative_params(s)] elif r == 'Motion': pieces += [NuisanceRegressor._derivative_params(s)] elif r == 'PolyOrt': pieces += ['%d' % s['degree']] elif r == 'Bandpass': if s.get('bottom_frequency'): pieces += ['B%.2g' % s['bottom_frequency']] if s.get('top_frequency'): pieces += ['T%.2g' % s['top_frequency']] elif r == 'Censor': censoring = { 'Kill': 'K', 'Zero': 'Z', 'Interpolate': 'I', 'SpikeRegression': 'S', } thresholds = { 'FD_J': 'FD-J', 'FD_P': 'FD-P', 'DVARS': 'DV', } pieces += [censoring[s['method']]] trs_range = ['0', '0'] if s.get('number_of_previous_trs_to_censor'): trs_range[0] = '%d' % s['number_of_previous_trs_to_censor'] if s.get('number_of_subsequent_trs_to_censor'): trs_range[1] = '%d' % s['number_of_subsequent_trs_to_censor'] pieces += ['+'.join(trs_range)] threshs = sorted(s['thresholds'], reverse=True, key=lambda d: d['type']) for st in threshs: thresh = thresholds[st['type']] if type(st['value']) == str: thresh += st['value'] else: thresh += "%.2g" % st['value'] pieces += [thresh] selectors_representations += ['-'.join([_f for _f in pieces if _f])] return "_".join(selectors_representations) def __repr__(self): return NuisanceRegressor.encode(self.selector)
from parglare import get_collector recognizer = get_collector() @recognizer('base.NUMERIC_ID') def number(input, pos): '''Check override''' pass @recognizer('base.COMMA') def comma_recognizer(input, pos): if input[pos] == ',': return input[pos:pos + 1]
from django.conf import settings from django import forms from django.http import HttpResponse, HttpResponseRedirect, Http404 from django.http import HttpRequest from django_mako_plus.controller import view_function import homepage.models as hmod from django_mako_plus.controller.router import get_renderer from django.views.decorators.csrf import csrf_exempt from django.contrib.admin import widgets from django.contrib.auth.decorators import permission_required from django.contrib.auth.models import Group, Permission, ContentType templater = get_renderer('events') ###################################################### ### Shows the list of events @view_function @permission_required('homepage.change_user', login_url='/homepage/login/') def process_request(request): params = {} events = hmod.Event.objects.all().order_by('start_date') params['events'] = events return templater.render_to_response(request, 'event.html', params) ###################################################### ### Edit a events @view_function @permission_required('homepage.change_user', login_url='/homepage/login/') def edit(request): params = {} try: event = hmod.Event.objects.get(id=request.urlparams[0]) except hmod.Event.DoesNotExist: return HttpResponseRedirect('/events/event/') form = EventEditForm(initial={ 'name': event.name, 'start_date': event.start_date, 'map_file_name': event.map_file_name, }) if request.method == 'POST': form = EventEditForm(request.POST) form.eventid = event.id if form.is_valid(): event.name = form.cleaned_data['name'] event.start_date = form.cleaned_data['start_date'] event.map_file_name = form.cleaned_data['map_file_name'] event.save() return HttpResponseRedirect('/events/event/') params['form'] = form params['events'] = event return templater.render_to_response(request, 'event.edit.html', params) class EventEditForm(forms.Form): name = forms.CharField(label='Name') start_date = forms.DateField(widget = widgets.AdminDateWidget) map_file_name = forms.CharField(label='Map File Name', required=True, max_length=100) #eventid from form.eventid = event.id def clean_name(self): event_count = hmod.Event.objects.filter(name=self.cleaned_data['name']).exclude(id=self.eventid).count() #self aka (this) calls form.eventid because this section of the area is IN the form if event_count >= 1: raise forms.ValidationError("We already have an event with that name. Please check the name and try again.") return self.cleaned_data['name'] ###################################################### ### Creates a new event @view_function @permission_required('homepage.change_user', login_url='/homepage/login/') def create(request): # params = {} event = hmod.Event() event.name = '' event.start_date = None event.map = '' event.save() return HttpResponseRedirect('/events/event.edit/{}'.format(event.id)) ###################################################### ### Deletes a new event @view_function @permission_required('homepage.change_user', login_url='/homepage/login/') def delete(request): try: event = hmod.Event.objects.get(id=request.urlparams[0]) except hmod.DoesNotExist: return HttpResponseRedirect('/events/event/') event.delete() return HttpResponseRedirect('/events/event/') ###################################################### ### Shows the list of events @view_function def view(request): params = {} events = hmod.Event.objects.all().order_by('start_date') params['events'] = events return templater.render_to_response(request, 'event.view.html', params) @view_function def details(request): params = {} events = hmod.Event.objects.all().filter(id=request.urlparams[0]) products = hmod.Product.objects.all() params['events'] = events params['products'] = products return templater.render_to_response(request, 'event.details.html', params)
from django.conf import settings from copy import copy from couchdb.client import ResourceNotFound class ModelMeta(object): GET_META_VIEW = """ function (record) { if ((record.Type == "model_meta") && (record.model == "%s")) { emit(record._id, record); } } """ def __init__(self, server, model_name): self.server = server self.model_name = model_name self._db = None def _init_db(self): if self._db: return try: self._db = self.server[settings.DATABASE_NAME] except ResourceNotFound: self._db = self.server.create(settings.DATABASE_NAME) def get_meta(self): self._init_db() result = self._db.query(ModelMeta.GET_META_VIEW % (self.model_name)) rows = result.rows if rows: return rows[0] return [] def set_meta(self, meta): self._init_db() meta_ = copy(meta) meta_['Type'] = 'model_meta' meta_['model'] = self.model_name self._db.create(meta_)
######################## ### Group # # Pedro Santos - 93221 # # Ricardo Cruz - 93118 # # Pedro Amaral - 93283 # ######################## import asyncio from bisect import insort_left class AgentNode: def __init__(self, state, parent, key, heuristic): self.state = state self.parent = parent self.key = key self.heuristic = heuristic def __str__(self): return "no(" + str(self.state) + "," + str(self.parent.state) + ")" #funcao para fazer sort sem usar sempre key def __lt__(self, other): return self.heuristic < other.heuristic def get_keys(self): if self.parent == None: return "" return self.parent.get_keys() + self.key class SearchAgent: def __init__(self, isWall): self.isWall = isWall #obter os moves possiveis do keeper async def getMoves(self, boxes, initial_pos): open_nodes = [initial_pos] visitedNodes = set() visitedNodes.add(initial_pos) await asyncio.sleep(0) # this should be 0 in your code and this is REQUIRED moves = [(1, 0), (-1, 0), (0, 1), (0, -1)] while open_nodes != []: node = open_nodes.pop(0) for movX, movY in moves: new_keeper_pos = (node[0]+movX, node[1]+movY) # não podem haver dois conjuntos de coordenadas iguais na solução if new_keeper_pos not in visitedNodes: # Se a posição nao estiver bloqueada por parede ou caixa if not self.isWall[new_keeper_pos[0]][new_keeper_pos[1]] and new_keeper_pos not in boxes: visitedNodes.add(new_keeper_pos) open_nodes.append(new_keeper_pos) return visitedNodes async def search(self, boxes, initial_pos, destination): root = AgentNode(initial_pos, None, None, None) open_nodes = [root] visitedNodes = set() visitedNodes.add(initial_pos) await asyncio.sleep(0) # this should be 0 in your code and this is REQUIRED while open_nodes != []: node = open_nodes.pop(0) if node.state == destination: return node.get_keys() moves = [("d", 1, 0), ("a", -1, 0), ("s", 0, 1), ("w", 0, -1)] for key, movX, movY in moves: new_keeper_pos = (node.state[0]+movX, node.state[1]+movY) # Se a posição não estiver bloqueada if not self.isWall[new_keeper_pos[0]][new_keeper_pos[1]] and new_keeper_pos not in boxes: # não podem haver dois conjuntos de coordenadas iguais na solução if new_keeper_pos not in visitedNodes: visitedNodes.add(new_keeper_pos) newnode = AgentNode(new_keeper_pos, node, key, abs(new_keeper_pos[0]-destination[0]) + abs(new_keeper_pos[1]-destination[1])) # Ao ordenar os nodes, garante que o node com menor custo está à frente na queue # e assim será sempre escolhido o node optimal para a solução insort_left(open_nodes, newnode) return None
from sklearn import datasets iris = datasets.load_iris() digits = datasets.load_digits() from sklearn import svm from sklearn.svm import SVC clf = svm.SVC(gamma=0.001,C=100.) clf.fit(digits.data[:-1], digits.target[:-1]) SVC(C=100.0, cache_size=200, class_weight=None, coef0=0.0, decision_function_shape='ovr', degree=3, gamma=0.001, kernel='rbf', max_iter=-1, probability=False, random_state=None, shrinking=True, tol=0.001, verbose=False) clf.predict(digits.data[-1:]) abs =array([8]) print(abs);
import json import os import sys import cookiecutter # Ensure cookiecutter is recent enough cookiecutter_min_version = '1.5.0' if cookiecutter.__version__ < cookiecutter_min_version: print("--------------------------------------------------------------") print("!! Your cookiecutter is too old, at least %s is required !!" % cookiecutter_min_version) print("--------------------------------------------------------------") sys.exit(1) # Ensure the selected repo name is usable repo_name = '{{ cookiecutter.repo_name }}' assert_msg = 'Repo name should be valid Python identifier!' if hasattr(repo_name, 'isidentifier'): assert repo_name.isidentifier(), assert_msg else: import re identifier_re = re.compile(r"[a-zA-Z_][a-zA-Z0-9_]*$") assert bool(identifier_re.match(repo_name)), assert_msg valid_cms_key = ['yes', 'no'] if "{{ cookiecutter.include_cms }}" not in valid_cms_key: print("Include CMS '{{ cookiecutter.include_cms }}' is not valid!") print("Valid include CMS keys are: %s" % ', '.join(valid_cms_key)) sys.exit(1) if "{{ cookiecutter.python_version }}" not in ['3.4', '3.5', '3.6']: print("Only allowed python version options are 3.4, 3.5 and 3.6.") sys.exit(1) def copy_cookiecutter_config(local_filename='.cookiecutterrc'): """ Copy cookiecutter replay for template to project dir, unless it already exists. This creates the initial .cookiecutterrc file when the project is first generated. """ replay_filename = os.path.expanduser('~/.cookiecutter_replay/django-project-template.json') if not os.path.exists(replay_filename) or os.path.exists(local_filename): # This happens when we're upgrading an existing project return with open(replay_filename, 'r') as f_in, open(local_filename, 'w') as f_out: json.dump(json.load(f_in), f_out, indent=4, sort_keys=True) copy_cookiecutter_config()
import pandas as pd # df1 = pd.read_csv('atlanta.csv', low_memory=False) # df2 = pd.read_csv('atlanta_old.csv', low_memory=False) # df = df2.merge(df1, on=['SKU'], how='left', indicator=True) # df_final = df.loc[df['_merge'] == 'left_only'] # df_final.to_csv('atlanta_final.csv', index= False) df1 = pd.read_csv('atlanta_2019-04-29.csv' , low_memory=False) df = df1.drop_duplicates(subset=['SKU']) df.to_csv('atlanta_dedupe_2019-4-29.csv', index=False)
from django.db import models # Create your models here. class MovieDetails(models.Model): movie_id = models.CharField(max_length=100) title = models.CharField(max_length=100) released_year = models.CharField(max_length=500) rating = models.DecimalField(decimal_places=2, max_digits=5) genres = models.CharField(max_length=500) def __str__(self): return self.title
#!/usr/bin/env python """ Assignment 1, Exercise 3, INF1340, Fall, 2015. Troubleshooting Car Issues. This module contains one function diagnose_car(). It is an expert system to interactive diagnose car issues. """ __author__ = 'Susan Sim' __email__ = "ses@drsusansim.org" __copyright__ = "2015 Susan Sim" __license__ = "MIT License" def diagnose_car(): # ans1, ans2, ans3, ans4, ans5 are the variables used to collect user response to the queries ans1 = raw_input("Is the car silent when you turn the key? Press [Y]Yes or [N]No") # if statement is used to provide a response to the user for a final answer or a possible further query if ans1 == "Y": ans2 = raw_input("Are the battery terminals corroded? Press [Y]Yes or [N]No") if ans2 == "Y": print("Clean terminals and try starting again.") elif ans2 == "N": print("Replace cables and try again.") else: print("Error") elif ans1 == "N": ans2 = raw_input("Does the car make a clicking noise? Press [Y]Yes or [N]No") if ans2 == "Y": print("Replace the battery.") elif ans2 == "N": ans3 = raw_input("Does the car crank up but fail to start? Press [Y]Yes or [N]No") if ans3 == "Y": print("Check spark plug connections.") elif ans3 == "N": ans4 = raw_input("Does the engine start and then die? Press [Y]Yes or [N]No" + " ") if ans4 == "Y": ans5 = raw_input("Does your car have fuel injection?Press [Y]Yes or [N]No" + " ") if ans5 == "Y": print("Get it in for service.") elif ans5 == "N": print("Check to ensure the choke is opening and closing.") else: print("Error") elif ans4 == "N": print("Engine is not getting enough fuel. Clean fuel pump.") else: print("Error") else: print("Error") else: print("Error") # Error is printed when the user does not press either "Y" or "N" #diagnose_car() """ Interactively queries the user with yes/no questions to identify a possible issue with a car. Test Case 1 Input_1: Y Expected Output1: Are the battery terminals corroded? Errors: None Input_2: Y Expected Output_1: Clean terminals and try starting again. Errors: None Test Case 2 Input_1: Y Expected Output_1: Are the battery terminals corroded? Error: None Input_2: N Expected Output_2: Replace cables and try again. Error: None Test Case 3 Input_1: N Expected Output_1: Does the car make a clicking noise? Error: None Input_2: Y Expected Output_2: Replace the battery. Error: None Test Case 4 Input_1: N Expected Output_1: Does the car make a clicking noise? Error: None Input_2: N Expected Output_2: Does the car crank up but fail to start? Error: None Input_3: Y Expected Output_3: Check spark plug connections. Error: None Test Case 5 Input_1: N Expected Output_1: Does the car make a clicking noise? Error: None Input_2: N Expected Output_2: Does the car crank up but fail to start? Error: None Input_3:N Expected Output_3: Does the engine start and then die? Error: None Input_4: N Expected Output_4: Engine is not getting enough fuel. Clean fuel pump. Error: None Test Case 6 Input_1: N Expected Output_1: Does the car make a clicking noise? Error: None Input_2: N Expected Output_2: Does the car crank up but fail to start? Error: None Input_3: N Expected Output_3: Does the engine start and then die? Error: None Input_4: Y Expected Output_4: Does your car have fuel injection? Error: None Input_5: N Expected Output_5: Check to ensure the choke is opening and closing. Error: Get it in service Solution: Yes and No are reversed on last two outcome nodes. Switch order and problem fixed. Test Case 7 Input_1: N Expected Output_1: Does the car make a clicking noise? Error: None Input_2: N Expected Output_2: Does the car crank up but fail to start? Error: None Input_3: N Expected Output_3: Does the engine start and then die? Error: None Input_4: Y Expected Output_4: Does your car have fuel injection? Error: None Input_5: N Expected Output_5: Check to ensure the choke is opening and closing. Error: None Test Case 8 Input_1: N Expected Output_1: Does the car make a clicking noise? Error: None Input_2: N Expected Output_2: Does the car crank up but fail to start? Error: None Input_3: N Expected Output_3: Does the engine start and then die? Error: None Input_4: Y Expected Output_4: Does your car have fuel injection? Error: None Input_5: Y Expected Output_5: Get it in for service. Error: None """
import math A,B,H,M = map(int,input().split()) h_deg = H*30 + M*0.5 m_deg = M*6 rad = math.radians(abs(h_deg - m_deg)) # 余弦定理 print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(rad))) # https://note.com/nanigashi/n/n09e6cc649a02 # 角度を求める # radian:円弧の長さから角度を求める方法 # https://kenyu-life.com/2019/01/09/rad/ # minute,hour = 6,30 # if H==0: # if minute*M > 180: # hour_angle = 0 # else: # hour_angle = 360 # else: # hour_angle = H*hour # angle = abs(minute*M - hour_angle) # print(angle) # print(math.sqrt(A**2 + B**2 - 2*A*B*math.cos(angle)))
s=input() def removex(s): if len(s)==0 or len(s)==1: return s if s[0]==s[1]: return s[0]+removex(s[2:]) else: return s[0]+removex(s[1:]) print(removex(s))
#!/usr/bin/python3 #-*-coding:utf-8-*- import config import pandas as pd import getpass from clickhouse_driver import Client import logging class Prepare_Data(): def __init__(self, host = 'localhost', port = '9000', user = 'default'): self.host = host self.port = port self.user = user def login_and_choose_database(self, database): ''' login clickhouse in notebooks. Using 'database' to choose target database you want. ''' self.client = Client(host = self.host, port = self.port, database = database, user = self.user) logging.info('login database: %s', database) def raw_query(self, query): ''' for adhoc query if needed ''' logging.info('run query: %s', query) ans = self.client.execute(query) return ans def create_table(self, table_name, columns, engine, ordered_column): ''' create table: table_name: your new table name; columns: columns for you new table including column's type; engine: e.g. MergeTree; ordered_column: needed for query 'sort by' ''' logging.info('create table: %s', table_name) sql = [ "CREATE TABLE IF NOT EXISTS " + table_name + '\n' " (" + columns + ")" + '\n' " ENGINE = " + engine +'\n' " ORDER BY " + ordered_column + '\n' ] query = ''.join(sql) print ('query overview: \n{}'.format(query)) self.client.execute(query) print ('show tables: \n{}'.format(self.client.execute('show tables;'))) def get_random_sample(self, current_table, new_table, num_cases, ordered_column, selected_columns, engine = 'MergeTree'): ''' random sample from current dataset current_table: origin whole table new_table: sampled table from origin num_cases: number of cases you want to sample ordered_column: new table's ordered column selected_columns: columns you want to keep when sampling ''' logging.info('create sample table: %s', new_table) sql = [ "CREATE TABLE IF NOT EXISTS " + new_table + '\n' " ENGINE = " + engine +'\n' " ORDER BY " + ordered_column + '\n' " AS SELECT " + selected_columns + '\n' " FROM " + current_table + '\n' " ORDER BY rand() \n" " LIMIT " + num_cases + '\n' ] query = ''.join(sql) print ('query overview: \n{}'.format(query)) self.client.execute(query) print ('show tables: \n{}'.format(self.client.execute('show tables;'))) def get_dataframe_head(self, table_name): ''' a quick overview of table in dataframe ''' sql = [ "SELECT * FROM " + table_name + '\n' " LIMIT 5"] query = ''.join(sql) res = self.client.execute(query) col_name = [] col_desc = self.client.execute('desc {}'.format(table_name)) for i in range(len(col_desc)): col_name.append(col_desc[i][0]) res_dataframe = pd.DataFrame(res, columns = col_name) display (res_dataframe) def merge_data(self, new_table, ordered_column, left_table_query,\ right_table_query, on_query, joined_method, engine = 'MergeTree'): ''' merge data: left table as a, right table as b; new_table: give name of the new table ordered_column: new table's ordered column left_table_query: define and rename columns of left table right_table_query: define and rename columns of right table on_query: define key_columns to join on joined_method: how to join the two selected tables: e.g. inner, left, right ''' logging.info('merge data: %s', new_table) sql = [ "CREATE TABLE IF NOT EXISTS " + new_table + '\n' "ENGINE = " + engine +'\n' "ORDER BY " + ordered_column + '\n' "AS SELECT * FROM ( \n" + left_table_query + ")a \n" + joined_method + "( \n" + right_table_query + ")b \n" "ON " + on_query + '\n' ] query = ''.join(sql) print ('query overview: \n{}'.format(query)) self.client.execute(query) print ('show tables: \n{}'.format(self.client.execute('show tables;'))) def check_res(self, table_kx, table_jh, columns_kx, columns_jh, columns_comp, header): ''' check res of final tables and compare the res with the answer given by jiaohang; table_kx: res table finished by craiditx table_jh: res table given by jiaohang columns_kx: columns selected from table: e.g. key columns + answers columns_jh: columns selected from table: e.g. key columns + answers columns_comp: the column you want to check header: header of the merged dataframe ''' sql_kx = ["SELECT " + columns_kx + " FROM " + table_kx] sql_jh = ["SELECT " + columns_jh + " FROM " + table_jh] print ('query overview: \n{0},\n{1}'.format(sql_kx, sql_jh)) query_kx = ''.join(sql_kx) query_jh = ''.join(sql_jh) res_kx = self.client.execute(query_kx) res_jh = self.client.execute(query_jh) res_kx_df = pd.DataFrame(res_kx, columns = header) res_jh_df = pd.DataFrame(res_jh, columns = header) res_comp = pd.merge(res_kx_df, res_jh_df, on = header[:-1], suffixes = ('_kx', '_jh'), how = 'inner') res_comp_unequal = res_comp[res_comp[columns_comp + '_kx'] != res_comp[columns_comp + '_jh']] print ('\ncheck merged shape: res_kx_df: {0}, res_jh_df: {1}, res_comp: {2}\n'\ .format(res_kx_df.shape[0], res_jh_df.shape[0], res_comp.shape[0])) print ('There are {} unequal cases. (check detail if >0)\n'.format(res_comp_unequal.shape[0])) print ('A glance of merged_data:') display (res_comp.head(5)) return res_kx_df, res_jh_df
#!/usr/local/bin/python import sys import recommendations1 if __name__ == '__main__': criteria = sys.argv[1] moviename = sys.argv[2] count = int(sys.argv[3]) if criteria not in [ "most", "least"]: print "Error arg 1 must be either most or least" sys.exit(1) prefs = recommendations1.loadMovieLens('../data') itemPrefs = recommendations1.transformPrefs(prefs) results = recommendations1.topMatches(itemPrefs,moviename,2000) if criteria == "most": for i in results[0:count]: #print i print i[0],i[1] if criteria == "least": results.reverse() for i in results[0:count]: #print i[0],i[1] print i
# List unpacking is a unique and helpful feature for list. basket = [1,2,3] print(basket) a,b,c, *other, d = [4,5,6,7,8,9,10] print(a) print(b) print(c) print(other) print(d)
import pandas as pd import os from csv import * import openpyxl from openpyxl import load_workbook from openpyxl.styles import Font, PatternFill, Border, Side import openpyxl.worksheet.worksheet def Get_Cells(path, sb): wb = load_workbook(path, data_only=True) ws = wb["Sheet1"] df = pd.read_excel(path) directory = 'ProgramFiles/Csv_files/style_data_csv/' + sb + "/sorted" # print(directory) for filename in os.listdir(directory): # print(directory+ "/"+ filename) f = open(directory + "/" + filename, 'r') csv_reader = reader(f) bw_num = filename.strip(".csv").split("_") for line in csv_reader: line_name = line[0] # print(line_name + "line_name") for val in range(len(df)): name = df['Name'][val] # print(name) if line_name == name: cell_val = str(colnum_string(int(bw_num[1]) + 1) + str(val + 2)) # print(cell_val) try: cell = ws[cell_val] if bw_num[0] == "Best": cell.font = Font(bold=True, size=22) cell.fill = PatternFill("solid", fgColor="00ff00") else: cell.font = Font(italic=True, size=22) cell.fill = PatternFill("solid", fgColor="ff0000") except ValueError: print(cell_val) wb.save(filename=path) def colnum_string(n): string = '' while n > 0: n, remainder = divmod(n - 1, 26) string = chr(65 + remainder) + string return string def Shade_NA(path, width): # load excel with its path # load excel with its path workbook = openpyxl.load_workbook(path) # print(workbook.get_sheet_names()) worksheet = workbook['Sheet1'] # print(worksheet.max_column) c = 2 thin_border = Border(left=Side(style='thin', color="000000"), right=Side(style='thin', color="000000"), top=Side(style='thin', color="000000"), bottom=Side(style='thin', color="000000")) for i in worksheet: for j in range(1, worksheet.max_column + 1): d = worksheet.cell(row=c, column=j) cell_val = str(colnum_string(j) + str(c)) worksheet.column_dimensions[colnum_string(j)].width = width # print(cell_val) try: if d.value.strip() == "NA" or d.value.strip() == "N/A": cell = worksheet[cell_val] cell.fill = PatternFill("solid", fgColor="000000") except (ValueError, AttributeError): continue try: worksheet[cell_val] = float(d.value) except (ValueError, AttributeError): x = 0 c = c + 1 workbook.save(filename=path) def insert_Columns(path, divider): workbook = openpyxl.load_workbook(path) # print(workbook.get_sheet_names()) worksheet = workbook['Sheet1'] columns = [5, 10, 15, 28, 31, 35, 39] for val in columns: worksheet.insert_cols(val) for j in columns: for c in range(1, len(worksheet['A']) + 1): d = worksheet.cell(row=j, column=j) cell_val = str(colnum_string(j) + str(c)) # print(cell_val) try: # print(cell_val) cell = worksheet[cell_val] cell.fill = PatternFill("solid", fgColor="000000") except (ValueError, AttributeError): continue worksheet.column_dimensions[colnum_string(j)].width = divider workbook.save(filename=path) def color(path): workbook = openpyxl.load_workbook(path) # print(workbook.get_sheet_names()) worksheet = workbook['Sheet1'] for j in range(9, 25): for c in range(2, len(worksheet['A']) + 1): d = worksheet.cell(row=c, column=j) cell_val = str(colnum_string(j) + str(c)) cell = worksheet[cell_val] try: return_val = float(d.value.rstrip("%")) if return_val > 0: cell.fill = PatternFill("solid", fgColor="00ff00") elif return_val <= 0: cell.fill = PatternFill("solid", fgColor="ff0000") except (ValueError, AttributeError): continue workbook.save(filename=path) def Highlight_Blue(path, fund_type): workbook = openpyxl.load_workbook(path) # print(workbook.get_sheet_names()) worksheet = workbook['Sheet1'] column = 4 foregin = {33, 34, 36, 37, 38} us = {33, 35, 36, 37, 38} bonds = {33, 34, 35, 38} f_bond = {33, 34, 35, 38} for c in range(2, len(worksheet['D']) + 1): d = worksheet.cell(row=c, column=column) Style_blue(bonds, c, d, foregin, fund_type, us, f_bond, worksheet) workbook.save(filename=path) def Style_blue(bonds, c, d, foregin, fund_type, us, f_bond, worksheet): if fund_type == "stock": if "Foreign" in d.value: for val in foregin: try: type_val = worksheet.cell(row=c, column=val).value if float(type_val) >= 7: cell_val = str(colnum_string(val) + str(c)) cell = worksheet[cell_val] cell.fill = PatternFill("solid", fgColor="add8e6") except ValueError: continue else: for val in us: try: type_val = worksheet.cell(row=c, column=val).value if float(type_val) >= 7: cell_val = str(colnum_string(val) + str(c)) cell = worksheet[cell_val] cell.fill = PatternFill("solid", fgColor="add8e6") except ValueError: continue else: if "Foreign" in d.value: for val in f_bond: try: type_val = worksheet.cell(row=c, column=val).value if float(type_val) >= 7: cell_val = str(colnum_string(val) + str(c)) cell = worksheet[cell_val] cell.fill = PatternFill("solid", fgColor="add8e6") except ValueError: continue else: for val in bonds: try: type_val = worksheet.cell(row=c, column=val).value if float(type_val) >= 7: cell_val = str(colnum_string(val) + str(c)) cell = worksheet[cell_val] cell.fill = PatternFill("solid", fgColor="add8e6") except ValueError: continue def Divider_width(divider): f_2 = open("width_dividers.txt", 'r') val = f_2.readline() try: divider_new = float(val.strip()) except ValueError: divider_new = divider if divider <= 0: divider_new = divider return divider_new, f_2 def Get_Cell_Width(width): f = open("width_cells.txt", 'r') val = f.readline() try: width_new = float(val.strip()) except ValueError: width_new = width if width <= 0: width_new = width return f, width_new def Fill_Borders(path): thin = Side(border_style="thin", color="000000") workbook = openpyxl.load_workbook(path) # print(workbook.get_sheet_names()) worksheet = workbook['Sheet1'] columns = worksheet.max_column for j in range(1, columns+1): for c in range(1, len(worksheet['A']) + 1): d = worksheet.cell(row=c, column=j) cell_val = str(colnum_string(j) + str(c)) cell = worksheet[cell_val] try: cell.border = Border(top=thin, left=thin, right=thin, bottom=thin) except (ValueError, AttributeError): continue workbook.save(filename=path) def Stylize_Data_Main(): path1 = "Stock_mutual_funds.xlsx" path2 = "Bond_Mutual_funds.xlsx" sb1 = 'stocks' sb2 = 'bonds' width = 15 divider = 5 f, width = Get_Cell_Width(width) divider, f_2 = Divider_width(divider) Get_Cells(path1, sb1) color(path1) Shade_NA(path1, width) Highlight_Blue(path1, "stock") insert_Columns(path1, divider) Fill_Borders(path1) Get_Cells(path2, sb2) color(path2) Shade_NA(path2, width) Highlight_Blue(path2, "bond") insert_Columns(path2, divider) Fill_Borders(path2) f.close() f_2.close()
from django.db import models from schedules import Schedule class Scan(models.Model): # Scans scan_date = models.DateTimeField() # data_do_scan schedule = models.ForeignKey(Schedule) # agendamento_id scan_finished_date = models.DateTimeField(null=True, blank=True) # data_conclusao error_description = models.CharField(max_length=255, null=True, blank=True) # error_description number_attempts = models.IntegerField(null=True, blank=True) # numero_tentativas status = models.CharField(max_length=20) scan_type = models.CharField(max_length=100) # the class name to extended objects created_at = models.DateTimeField() # created_at updated_at = models.DateTimeField() # updated_at hackalert_id = models.IntegerField(null=True, blank=True) class Meta: app_label = 'core'
# Copyright (C) 2017 Open Information Security Foundation # Copyright (c) 2011-2013 Jason Ish # # You can copy, redistribute or modify this Program under the terms of # the GNU General Public License version 2 as published by the Free # Software Foundation. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # version 2 along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA # 02110-1301, USA. from __future__ import print_function import sys import unittest import io import tempfile import suricata.update.rule class RuleTestCase(unittest.TestCase): def test_parse1(self): # Some mods have been made to this rule (flowbits) for the # purpose of testing. rule = suricata.update.rule.parse("""alert tcp $HOME_NET any -> $EXTERNAL_NET $HTTP_PORTS (msg:"ET CURRENT_EVENTS Request to .in FakeAV Campaign June 19 2012 exe or zip"; flow:established,to_server; content:"setup."; fast_pattern:only; http_uri; content:".in|0d 0a|"; flowbits:isset,somebit; flowbits:unset,otherbit; http_header; pcre:"/\/[a-f0-9]{16}\/([a-z0-9]{1,3}\/)?setup\.(exe|zip)$/U"; pcre:"/^Host\x3a\s.+\.in\r?$/Hmi"; metadata:stage,hostile_download; reference:url,isc.sans.edu/diary/+Vulnerabilityqueerprocessbrittleness/13501; classtype:trojan-activity; sid:2014929; rev:1;)""") self.assertEqual(rule.enabled, True) self.assertEqual(rule.action, "alert") self.assertEqual(rule.direction, "->") self.assertEqual(rule.sid, 2014929) self.assertEqual(rule.rev, 1) self.assertEqual(rule.msg, "ET CURRENT_EVENTS Request to .in FakeAV Campaign June 19 2012 exe or zip") self.assertEqual(len(rule.metadata), 2) self.assertEqual(rule.metadata[0], "stage") self.assertEqual(rule.metadata[1], "hostile_download") self.assertEqual(len(rule.flowbits), 2) self.assertEqual(rule.flowbits[0], "isset,somebit") self.assertEqual(rule.flowbits[1], "unset,otherbit") self.assertEqual(rule.classtype, "trojan-activity") def test_disable_rule(self): rule_buf = """# alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"some message";)""" rule = suricata.update.rule.parse(rule_buf) self.assertFalse(rule.enabled) self.assertEqual(rule.raw, """alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"some message";)""") self.assertEqual(str(rule), rule_buf) def test_parse_rule_double_commented(self): rule_buf = """## alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"some message";)""" rule = suricata.update.rule.parse(rule_buf) self.assertFalse(rule.enabled) self.assertEqual(rule.raw, """alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"some message";)""") def test_parse_rule_comments_and_spaces(self): rule_buf = """## #alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"some message";)""" rule = suricata.update.rule.parse(rule_buf) self.assertFalse(rule.enabled) self.assertEqual(rule.raw, """alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"some message";)""") def test_toggle_rule(self): rule_buf = """# alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"some message";)""" rule = suricata.update.rule.parse(rule_buf) self.assertFalse(rule.enabled) rule.enabled = True self.assertEqual(str(rule), """alert tcp $HOME_NET any -> $EXTERNAL_NET any (msg:"some message";)""") def test_parse_fileobj(self): rule_buf = ("""# alert tcp $HOME_NET any -> $EXTERNAL_NET any """ """(msg:"some message";)""") fileobj = io.StringIO() for i in range(2): fileobj.write(u"%s\n" % rule_buf) fileobj.seek(0) rules = suricata.update.rule.parse_fileobj(fileobj) self.assertEqual(2, len(rules)) def test_parse_file(self): rule_buf = ("""# alert tcp $HOME_NET any -> $EXTERNAL_NET any """ """(msg:"some message";)""") tmp = tempfile.NamedTemporaryFile() for i in range(2): tmp.write(("%s\n" % rule_buf).encode()) tmp.flush() rules = suricata.update.rule.parse_file(tmp.name) self.assertEqual(2, len(rules)) def test_parse_file_with_unicode(self): rules = suricata.update.rule.parse_file("./tests/rule-with-unicode.rules") def test_parse_decoder_rule(self): rule_string = """alert ( msg:"DECODE_NOT_IPV4_DGRAM"; sid:1; gid:116; rev:1; metadata:rule-type decode; classtype:protocol-command-decode;)""" rule = suricata.update.rule.parse(rule_string) self.assertEqual(rule["direction"], None) def test_multiline_rule(self): rule_string = u""" alert dnp3 any any -> any any (msg:"SURICATA DNP3 Request flood detected"; \ app-layer-event:dnp3.flooded; sid:2200104; rev:1;) """ rules = suricata.update.rule.parse_fileobj(io.StringIO(rule_string)) self.assertEqual(len(rules), 1) def test_parse_nomsg(self): rule_string = u"""alert ip any any -> any any (content:"uid=0|28|root|29|"; classtype:bad-unknown; sid:10000000; rev:1;)""" rule = suricata.update.rule.parse(rule_string) self.assertEqual("", rule["msg"]) def test_noalert(self): rule_string = u"""alert ip any any -> any any (content:"uid=0|28|root|29|"; classtype:bad-unknown; sid:10000000; rev:1;)""" rule = suricata.update.rule.parse(rule_string) self.assertFalse(rule["noalert"]) rule_string = u"""alert ip any any -> any any (content:"uid=0|28|root|29|"; classtype:bad-unknown; flowbits:noalert; sid:10000000; rev:1;)""" rule = suricata.update.rule.parse(rule_string) self.assertTrue(rule["noalert"]) def test_parse_message_with_semicolon(self): rule_string = u"""alert ip any any -> any any (msg:"TEST RULE\; and some"; content:"uid=0|28|root|29|"; tag:session,5,packets; classtype:bad-unknown; sid:10000000; rev:1;)""" rule = suricata.update.rule.parse(rule_string) self.assertIsNotNone(rule) self.assertEqual(rule.msg, "TEST RULE\; and some") # Look for the expected content. self.assertEqual("TEST RULE\; and some", rule["msg"]) def test_parse_message_with_colon(self): rule_string = u"""alert tcp 93.174.88.0/21 any -> $HOME_NET any (msg:"SN: Inbound TCP traffic from suspect network (AS29073 - NL)"; flags:S; reference:url,https://suspect-networks.io/networks/cidr/13/; threshold: type limit, track by_dst, seconds 30, count 1; classtype:misc-attack; sid:71918985; rev:1;)""" rule = suricata.update.rule.parse(rule_string) self.assertIsNotNone(rule) self.assertEqual( rule.msg, "SN: Inbound TCP traffic from suspect network (AS29073 - NL)") def test_parse_multiple_metadata(self): # metadata: former_category TROJAN; # metadata:affected_product Windows_XP_Vista_7_8_10_Server_32_64_Bit, attack_target Client_Endpoint, deployment Perimeter, tag Ransomware_Onion_Domain, tag Ransomware, signature_severity Major, created_at 2017_08_08, malware_family Crypton, malware_family Nemesis, performance_impact Low, updated_at 2017_08_08; rule_string = u"""alert udp $HOME_NET any -> any 53 (msg:"ET TROJAN CryptON/Nemesis/X3M Ransomware Onion Domain"; content:"|01 00 00 01 00 00 00 00 00 00|"; depth:10; offset:2; content:"|10|yvvu3fqglfceuzfu"; fast_pattern; distance:0; nocase; metadata: former_category TROJAN; reference:url,blog.emsisoft.com/2017/05/01/remove-cry128-ransomware-with-emsisofts-free-decrypter/; reference:url,www.cyber.nj.gov/threat-profiles/ransomware-variants/crypt-on; classtype:trojan-activity; sid:2024525; rev:2; metadata:affected_product Windows_XP_Vista_7_8_10_Server_32_64_Bit, attack_target Client_Endpoint, deployment Perimeter, tag Ransomware_Onion_Domain, tag Ransomware, signature_severity Major, created_at 2017_08_08, malware_family Crypton, malware_family Nemesis, performance_impact Low, updated_at 2017_08_08;)""" rule = suricata.update.rule.parse(rule_string) self.assertIsNotNone(rule) self.assertTrue("former_category TROJAN" in rule.metadata) self.assertTrue("updated_at 2017_08_08" in rule.metadata) def test_parse_option_missing_end(self): """Test parsing a rule where the last option is missing a semicolon. This was responsible for an infinite loop. """ rule_buf = u"""alert icmp any any -> $HOME_NET any (msg:"ICMP test detected"; gid:0; sid:10000001; rev:1; classtype: icmp-event; metadata:policy balanced-ips drop, policy connectivity-ips drop, policy security-ips drop)""" self.assertRaises( suricata.update.rule.NoEndOfOptionError, suricata.update.rule.parse, rule_buf) def test_parse_addr_list(self): """Test parsing rules where the addresses and parts are lists with spaces.""" rule = suricata.update.rule.parse("""alert any [$HOME_NET, $OTHER_NET] any -> any any (msg:"TEST"; sid:1; rev:1;)""") self.assertIsNotNone(rule) self.assertEqual(rule["source_addr"], "[$HOME_NET, $OTHER_NET]") rule = suricata.update.rule.parse("""alert any [$HOME_NET, $OTHER_NET] [1, 2, 3] -> any any (msg:"TEST"; sid:1; rev:1;)""") self.assertIsNotNone(rule) self.assertEqual(rule["source_port"], "[1, 2, 3]") rule = suricata.update.rule.parse("""alert any [$HOME_NET, $OTHER_NET] [1,2,3] -> [!$XNET, $YNET] any (msg:"TEST"; sid:1; rev:1;)""") self.assertIsNotNone(rule) self.assertEqual(rule["dest_addr"], "[!$XNET, $YNET]") rule = suricata.update.rule.parse("""alert any [$HOME_NET, $OTHER_NET] [1,2,3] -> [!$XNET, $YNET] [!2200, 5500] (msg:"TEST"; sid:1; rev:1;)""") self.assertIsNotNone(rule) self.assertEqual(rule["dest_port"], "[!2200, 5500]") def test_parse_no_rev(self): """Test that a rule with no revision gets assigned the default revision of 0.""" rule_string = u"""alert ip any any -> any any (content:"uid=0|28|root|29|"; classtype:bad-unknown; sid:10000000;)""" rule = suricata.update.rule.parse(rule_string) self.assertEqual(0, rule["rev"])
import datetime import time from collections import defaultdict from typing import Any, Dict, Mapping, Optional, Sequence, Set from django.conf import settings from django.utils.timezone import now as timezone_now from zerver.lib.timestamp import datetime_to_timestamp from zerver.models import PushDeviceToken, Realm, UserPresence, UserProfile, query_for_ids def get_presence_dicts_for_rows( all_rows: Sequence[Mapping[str, Any]], mobile_user_ids: Set[int], slim_presence: bool ) -> Dict[str, Dict[str, Any]]: if slim_presence: # Stringify user_id here, since it's gonna be turned # into a string anyway by JSON, and it keeps mypy happy. get_user_key = lambda row: str(row["user_profile_id"]) get_user_presence_info = get_modern_user_presence_info else: get_user_key = lambda row: row["user_profile__email"] get_user_presence_info = get_legacy_user_presence_info user_statuses: Dict[str, Dict[str, Any]] = {} for presence_row in all_rows: user_key = get_user_key(presence_row) last_active_time = user_presence_datetime_with_date_joined_default( presence_row["last_active_time"], presence_row["user_profile__date_joined"] ) last_connected_time = user_presence_datetime_with_date_joined_default( presence_row["last_connected_time"], presence_row["user_profile__date_joined"] ) info = get_user_presence_info( last_active_time, last_connected_time, ) user_statuses[user_key] = info return user_statuses def user_presence_datetime_with_date_joined_default( dt: Optional[datetime.datetime], date_joined: datetime.datetime ) -> datetime.datetime: """ Our data models support UserPresence objects not having None values for last_active_time/last_connected_time. The legacy API however has always sent timestamps, so for backward compatibility we cannot send such values through the API and need to default to a sane datetime. This helper functions expects to take a last_active_time or last_connected_time value and the date_joined of the user, which will serve as the default value if the first argument is None. """ if dt is None: return date_joined return dt def get_modern_user_presence_info( last_active_time: datetime.datetime, last_connected_time: datetime.datetime ) -> Dict[str, Any]: # TODO: Do further bandwidth optimizations to this structure. result = {} result["active_timestamp"] = datetime_to_timestamp(last_active_time) result["idle_timestamp"] = datetime_to_timestamp(last_connected_time) return result def get_legacy_user_presence_info( last_active_time: datetime.datetime, last_connected_time: datetime.datetime ) -> Dict[str, Any]: """ Reformats the modern UserPresence data structure so that legacy API clients can still access presence data. We expect this code to remain mostly unchanged until we can delete it. """ # Now we put things together in the legacy presence format with # one client + an `aggregated` field. # # TODO: Look at whether we can drop to just the "aggregated" field # if no clients look at the rest. most_recent_info = format_legacy_presence_dict(last_active_time, last_connected_time) result = {} # The word "aggregated" here is possibly misleading. # It's really just the most recent client's info. result["aggregated"] = dict( client=most_recent_info["client"], status=most_recent_info["status"], timestamp=most_recent_info["timestamp"], ) result["website"] = most_recent_info return result def format_legacy_presence_dict( last_active_time: datetime.datetime, last_connected_time: datetime.datetime ) -> Dict[str, Any]: """ This function assumes it's being called right after the presence object was updated, and is not meant to be used on old presence data. """ if ( last_active_time + datetime.timedelta(seconds=settings.PRESENCE_LEGACY_EVENT_OFFSET_FOR_ACTIVITY_SECONDS) >= last_connected_time ): status = UserPresence.LEGACY_STATUS_ACTIVE timestamp = datetime_to_timestamp(last_active_time) else: status = UserPresence.LEGACY_STATUS_IDLE timestamp = datetime_to_timestamp(last_connected_time) # This field was never used by clients of the legacy API, so we # just set it to a fixed value for API format compatibility. pushable = False return dict(client="website", status=status, timestamp=timestamp, pushable=pushable) def get_presence_for_user( user_profile_id: int, slim_presence: bool = False ) -> Dict[str, Dict[str, Any]]: query = UserPresence.objects.filter(user_profile_id=user_profile_id).values( "last_active_time", "last_connected_time", "user_profile__email", "user_profile_id", "user_profile__enable_offline_push_notifications", "user_profile__date_joined", ) presence_rows = list(query) mobile_user_ids: Set[int] = set() if PushDeviceToken.objects.filter(user_id=user_profile_id).exists(): # nocoverage # TODO: Add a test, though this is low priority, since we don't use mobile_user_ids yet. mobile_user_ids.add(user_profile_id) return get_presence_dicts_for_rows(presence_rows, mobile_user_ids, slim_presence) def get_presence_dict_by_realm( realm_id: int, slim_presence: bool = False ) -> Dict[str, Dict[str, Any]]: two_weeks_ago = timezone_now() - datetime.timedelta(weeks=2) query = UserPresence.objects.filter( realm_id=realm_id, last_connected_time__gte=two_weeks_ago, user_profile__is_active=True, user_profile__is_bot=False, ).values( "last_active_time", "last_connected_time", "user_profile__email", "user_profile_id", "user_profile__enable_offline_push_notifications", "user_profile__date_joined", ) presence_rows = list(query) mobile_query = PushDeviceToken.objects.distinct("user_id").values_list( "user_id", flat=True, ) user_profile_ids = [presence_row["user_profile_id"] for presence_row in presence_rows] if len(user_profile_ids) == 0: # This conditional is necessary because query_for_ids # throws an exception if passed an empty list. # # It's not clear this condition is actually possible, # though, because it shouldn't be possible to end up with # a realm with 0 active users. return {} mobile_query_ids = query_for_ids( query=mobile_query, user_ids=user_profile_ids, field="user_id", ) mobile_user_ids = set(mobile_query_ids) return get_presence_dicts_for_rows(presence_rows, mobile_user_ids, slim_presence) def get_presences_for_realm( realm: Realm, slim_presence: bool ) -> Dict[str, Dict[str, Dict[str, Any]]]: if realm.presence_disabled: # Return an empty dict if presence is disabled in this realm return defaultdict(dict) return get_presence_dict_by_realm(realm.id, slim_presence) def get_presence_response( requesting_user_profile: UserProfile, slim_presence: bool ) -> Dict[str, Any]: realm = requesting_user_profile.realm server_timestamp = time.time() presences = get_presences_for_realm(realm, slim_presence) return dict(presences=presences, server_timestamp=server_timestamp)
#시험 점수를 입력받아 90 ~ 100점은 A, 80 ~ 89점은 B, 70 ~ 79점은 C, 60 ~ 69점은 D, # 나머지 점수는 F를 출력하는 프로그램을 작성하시오 # 입: 첫째 줄에 시험 점수가 주어진다. 시험 점수는 0보다 크거나 같고, 100보다 작거나 같은 정수이다 point = int(input("시험 점수를 입력하세요 :: ")) if point >= 90 : print("A") elif point >=80: print("B") elif point >=70: print("C") elif point >=60: print("D") else: print("F")
from flask import render_template, request, redirect, session, url_for #necessary Imports import subprocess #module import for dealing with execution of console command from gdmApp import app import os from gatewayapp.configHandler import ConfigHandler confObject=ConfigHandler() #data=confObject.getDataForMain() #STORAGEFLAG=data['STORAGEFLAG'] #LOGGINGFLAG=data['LOGGINGFLAG'] #if STORAGEFLAG=='Active' and LOGGINGFLAG=='Active': # from .database import p1 as db path='/etc/gateway/certUploads/' ip="" try: ip=os.popen('ip addr show eth0').read().split("inet ")[1].split("/")[0] except: ip='Retrieving' mac="" try: mac=os.popen('ip addr show eth0').read().split("link/ether ")[1] except: mac='Retrieving' @app.route('/login',methods=['GET','POST']) #route for handling login def login(): if request.method=="POST": if request.form.get('user')=='admin' and request.form.get('pas')=='admin': session['logedIn']='admin' return redirect('/') return render_template('login.html',msg='Wrong Credentials') return render_template('login.html') @app.route('/logOut') #route for handling logout def logOut(): if 'logedIn' in session: session.pop('logedIn') #removing session return redirect(url_for('login')) @app.route('/') def home(): if 'logedIn' in session: #verifying user is logedIn or not node=confObject.getData("node") nodeData={'scanRate':node["SCAN_TIME"],'status':node["N_STATUS"]} cloud=confObject.getData("cloud") server=cloud["SERVER_TYPE"] serverType='' if server=='custom': serverType='Unsecured' else: serverType='Secured' cloudData={'server':server,'serverType':serverType,'hostAdd':cloud["HOST"],'port':cloud["PORT"],'status':cloud['C_STATUS'],'topic':cloud['PUBLISH_TOPIC'],'pubFlag':cloud['PUBFLAG']} deviceData=confObject.getData("device") return render_template('home.html',nodeData=nodeData,cloudData=cloudData,data=deviceData,ip=ip) return redirect(url_for('login')) @app.route('/deviceConfig',methods=['GET']) def deviceConfig(): if 'logedIn' in session: data=confObject.getData("device") return render_template('deviceConfig.html',ip=ip,data=data) return redirect(url_for('login')) @app.route('/deviceConfig/logSwitch',methods=['POST']) def logSwitcher(): if request.method=="POST": if 'logStatus' in request.form: confObject.updateData('device',{'LOGGINGFLAG':'Active'}) #subprocess.run(['/usr/sbin/control_scripts/restart_app.sh']) #subprocess.run(['/usr/sbin/control_scripts/restart_job.sh']) else: confObject.updateData('device',{'LOGGINGFLAG':'Inactive'}) #subprocess.run(['/usr/sbin/control_scripts/restart_app.sh']) #subprocess.run(['/usr/sbin/control_scripts/restart_job.sh']) return redirect(url_for('deviceConfig')) @app.route('/cloudConfig',methods=['GET','POST']) def cloudConfig(): if 'logedIn' in session: if request.method=="POST": #need db integration for here if 'status' in request.form: confObject.updateData('cloud',{'C_STATUS':request.form['status']}) #subprocess.run(['/usr/sbin/control_scripts/restart_app.sh']) #subprocess.run(['/usr/sbin/control_scripts/restart_job.sh']) server=request.form.get('server') if 'server' in request.form: di={'SERVER_TYPE':server,'HOST':request.form['hostAdd'],'PORT':request.form['port'],'PUBFLAG':'Inactive'} confObject.updateData('cloud',di) #subprocess.run(['/usr/sbin/control_scripts/restart_app.sh']) #subprocess.run(['/usr/sbin/control_scripts/restart_job.sh']) if server=='aws': root=request.files['rootFile'] #accessing the uploaded files pvtKey=request.files['pvtKey'] iotCert=request.files['iotCert'] root.save(path+'root.pem') #saving the uploaded files pvtKey.save(path+'key.pem.key') iotCert.save(path+'cert.pem.crt') cloud=confObject.getData("cloud") server=cloud['SERVER_TYPE'] serverType='' if server=='custom': serverType='Unsecured' else: serverType='Secured' cloudData={'server':server,'serverType':serverType,'hostAdd':cloud["HOST"],'port':cloud["PORT"],'status':cloud['C_STATUS'],'topic':cloud['PUBLISH_TOPIC'],'pubFlag':cloud['PUBFLAG']} return render_template('cloudConfig.html',cloudData=cloudData) return redirect(url_for('login')) @app.route('/nodeConfig',methods=['GET','POST']) def nodeConfig(): if 'logedIn' in session: if request.method=="POST": confObject.updateData('node',{'SCAN_TIME':request.form['scanRate'],'N_STATUS':request.form['status']}) #subprocess.run(['/usr/sbin/control_scripts/restart_app.sh']) #subprocess.run(['/usr/sbin/control_scripts/restart_job.sh']) nodeData=confObject.getData('node') nodeData={'scanRate':nodeData['SCAN_TIME'],'status':nodeData['N_STATUS']} return render_template('nodeConfig.html',nodeData=nodeData) return redirect(url_for('login')) @app.route('/netConfig',methods=['GET','POST']) def networkConfig(): if 'logedIn' in session: if request.method=="POST": ssid=request.form['ssid'] password="" if 'security' in request.form: password="none" security="none" else: password=request.form["passForWifi"] security="psk" confObject.updateData("network",{"TYPE":"WIFI","SSID":ssid,"PASSPHRASE":password,"SECURITY":security}) #subprocess.call(["/usr/sbin/control_scripts/restart_wifi.sh"]) confObject.networkWatcher() return render_template('networkConfig.html') return redirect(url_for('login')) #subprocess.run(['/usr/sbin/control_scripts/restart_app.sh']) #subprocess.run(['/usr/sbin/control_scripts/restart_job.sh']) @app.route('/debug') def debug(): if 'logedIn' in session: cmdKey=request.args.get('cmd') #extracting the command key from the html form if cmdKey: cmd={'1':['hciconfig'],'2':['btmgmt','--index','0','info'],'3':['btmgmt','--index','0','find','-l'],'4':['systemctl','status','apache2'],'5':['systemctl','status','app']} if cmdKey in cmd: data=subprocess.Popen(cmd[cmdKey],stdout=subprocess.PIPE).communicate()[0] #executing the command and getting the data into string format data=data.decode('utf-8') #decoding the binary the data into string data=data.split('\n') return render_template('debug.html',data=data) else: return render_template('debug.html',data=['Wrong/No command selected try again.']) return render_template('debug.html',data=None) return redirect(url_for('login')) @app.route('/reports') def reports(): if 'logedIn' in session: return render_template('reports.html') return redirect(url_for('login')) @app.route('/dataManager') def dataManager(): if 'logedIn' in session: data=db.getdata('HistoricalData') return render_template('dataManager.html',data=data,type='Historical Data') return redirect(url_for('login')) @app.route('/dataManager/offData') def offlineData(): if 'logedIn' in session: data=db.getdata('OfflineData') return render_template('dataManager.html',data=data,type='Offline Data') return redirect(url_for('login'))
import tkinter as tk import tkinter.ttk as ttk def combobox_selected(event): label_text.set(cbVar.get()) #Combobox 下拉選單是 tkinter 的 ttk 加強模組裡的元件 print('Combobox 測試') window = tk.Tk() # 設定主視窗大小 window.geometry('300x300') cbVar = tk.StringVar() cb = ttk.Combobox(window, textvariable = cbVar) #下拉式選單元件 cb['value'] = ("籃球","排球","足球","其他") #設定選項 cb.current(0) #預設第一個選項 cb.bind('<<ComboboxSelected>>', combobox_selected) #設定選取選項後執行的程式 cb.place(x=70, y=15) label_text = tk.StringVar() label1 = tk.Label(window, textvariable = label_text) label_text.set(cbVar.get()) label1.place(x = 80, y = 120) ''' import tkinter as tk from tkinter import ttk def show(): a.set(f'{box.current()}:{box.get()}') # 顯示索引值與內容 a = tk.StringVar() # 定義變數 a.set('') label = tk.Label(window, textvariable=a) # 建立標籤,內容為變數 label.pack() box = ttk.Combobox(window, width=15, values=['七龍珠','海賊王','鬼滅之刃','灌籃高手','排球少年']) box.pack() btn = tk.Button(window, text='顯示', command=show) # 建立按鈕,點擊按鈕時,執行 show 函式 btn.pack() ''' window.mainloop()
from django.shortcuts import render , render_to_response import cv2 from django.http import StreamingHttpResponse import os import numpy as np from django.views.decorators.csrf import csrf_exempt import json import base64 def home(request): return render(request, 'home.html') def second(request): return render(request, 'second.html') # cap = cv2.VideoCapture("http://192.168.0.4:8080/?action=stream") cap = cv2.VideoCapture("http://192.168.0.62:8080/?action=stream") #ROI 는 관심구역을 의미 def ROI_img(img, vertices): mask = np.zeros_like(img) # 0으로 이루어진 img와 같은 크기의 행렬을 만든다. cv2.fillPoly(mask, vertices, [255, 255, 255]) #mask에 vertices에 지정된 좌표 4개의 안쪽을 흰색으로 채워준다. roi = cv2.bitwise_and(img, mask) #둘다 0이 아닌경우에 return return roi def hough_line(img, rho, theta, threshold, min_line_len, max_line_gap): # 화면의 직선을 검출한다. 시작과 끝점 2개를 검출 # threshold 에 따라 정밀도와 직선검출을 조절한다. hough_lines = cv2.HoughLinesP(img, rho, theta, threshold, np.array([]), min_line_len, max_line_gap) #직선을 그릴 검은색 이미지를 생성한다. background_img = np.zeros((img.shape[0], img.shape[1], 3), np.uint8) # None 값이면 그리지않겠다. if(np.all(hough_lines) ==True): draw_hough_lines(background_img, hough_lines) return background_img def draw_hough_lines(img, lines, color=[0, 0, 255], thickness = 2): for line in lines: for x1, y1, x2, y2 in line: cv2.line(img, (x1, y1), (x2, y2), color, thickness) def weighted_img(init_img, added_img): return cv2.addWeighted(init_img, 1.0, added_img, 1.0, 0.0) def gen(): global cap print('Starting camera thread') while True: ret, frame = cap.read() if(ret): height, width = frame.shape[:2] img = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) img = cv2.GaussianBlur(img, (3, 3), 0) #가우시안 필터를 사용하여 노이즈 제거 3*3 img = cv2.Canny(img, 70, 210) #low = 70, high = 210 vertices = np.array([[(0, height/2 - 50), (width, height/2 - 50), (width, height/2 + 50), (0, height/2 + 50)]], np.int32) img = ROI_img(img, vertices) # 수평선 hough_lines = hough_line(img, 1, np.pi/180, 50, 50, 30) merged_img = weighted_img(frame, hough_lines) ret, jpeg = cv2.imencode('.jpg', merged_img) get_frame = jpeg.tobytes() yield (b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + get_frame + b'\r\n') def video_feed(request): return StreamingHttpResponse(gen(), content_type='multipart/x-mixed-replace; boundary=frame') # 배경제거 라이브러리 함수 fgbg = cv2.createBackgroundSubtractorMOG2(varThreshold=100) def gen2(): global cap global fgbg print('Detect Starting camera thread') while True: ret, frame = cap.read() fgmask = fgbg.apply(frame) # connectedComponentsWithStats를 사용하여 레이블링 nlabels, labels, stats, centroids = cv2.connectedComponentsWithStats(fgmask) for index, centroid in enumerate(centroids): if stats[index][0] == 0 and stats[index][1] == 0: continue if np.any(np.isnan(centroid)): continue x, y, width, height, area = stats[index] centerX, centerY = int(centroid[0]), int(centroid[1]) if area > 100: cv2.circle(frame, (centerX, centerY), 1, (0, 255, 0), 2) cv2.rectangle(frame, (x, y), (x + width, y + height), (0, 0, 255)) ret, jpeg2 = cv2.imencode('.jpg', frame) get_frame2 = jpeg2.tobytes() yield (b'--frame\r\n' b'Content-Type: image/jpeg\r\n\r\n' + get_frame2 + b'\r\n') def second_video_feed(request): return StreamingHttpResponse(gen2(), content_type='multipart/x-mixed-replace; boundary=frame')
adjective = input("Enter adjective word: ") while adjective.isalpha() != True: adjective = input("Your input is wrong can you enter adjective word again: ") city_name = input("Enter any city name: ") while city_name.isalpha() != True: city_name = input("Your input is wrong can you enter any city name again: ") noun = input("Enter noun: ") while noun.isalpha() != True: noun = input("Your input is wrong can you please enter noun again: ") second_noun = input("Enter second noun: ") while second_noun.isalpha() != True: second_noun = input("Your input is wrong can you please enter second noun again: ") third_noun = input("Enter third_noun: ") while third_noun.isalpha() != True: third_noun = input("Your input is wrong can you please enter third noun again: ") fourth_noum = input("Enter fourth_noun: ") while fourth_noum.isalpha() != True: fourth_noum = input("Your input is wrong can you please enter fourth noun again: ") action_verb = input("Enter action_verb: ") while action_verb.isalpha() != True: action_verb = input("Your input is wrong can you please enter action verb again: ") sport_noun = input("Enter sport_noun: ") while sport_noun.isalpha() != True: sport_noun = input("Your input is wrong can you please enter sport noun again: ") place = input("Enter place name: ") while place.isalpha() != True: place = input("Your input is wrong can you please enter place name again: ") food_one = input("Enter food name: ") while food_one.isalpha() != True: food_one = input("Your input is wrong can you please enter food name again: ") food_two = input("Enter another food name: ") while food_two.isalpha() != True: food_two = input("Your input is wrong can you please enter another food name again: ") drink_one = input("Enter drink name: ") while drink_one.isalpha() != True: drink_one = input("Your input is wrong can you please enter drink name again: ") drink_two = input("Enter another drink name: ") while drink_two.isalpha() != True: drink_two = input("Your input is wrong can you please enter another drink name again: ") story = ( "One day my " + adjective + " friend and I decided to go to the " + sport_noun + " game in " + city_name +". " + "We really wanted to see the "+ noun +" play the " + second_noun +". " + "So, we " + action_verb + " our " + third_noun + " down to the " + place + " and bought some " + fourth_noum + "s. " + "We got into the game and it was a lot of fun." + "We ate some " + food_one + " , " + food_two + " and drank some " + drink_one + " , " + drink_two + "." + "We had a great time! We plan to go ahead next year!" ) print (story)
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri Jan 1 22:20:04 2021 @author: arya """ import time start = time.time() import os from spacy.pipeline import EntityRuler import en_core_web_sm from multi_rake import Rake os.chdir('legalData/Train_tags') tagFiles = os.listdir() def sortTagsByCase(x): return(x[-8:]) tagFiles = sorted(tagFiles, key = sortTagsByCase) #sorted tag file names of train tags by case number os.chdir('/Users/arya/Desktop/DocumentTagging/legalData/Train_docs') trainFiles = os.listdir() def sortDocsByCase(y): return(y[-19:]) trainFiles = sorted(trainFiles, key = sortDocsByCase) #sorted doc file names of train docs by case statement number trainFiles.pop(0) trainTags = [] #to store given tags in a list form from tagFiles os.chdir('/Users/arya/Desktop/DocumentTagging/legalData/Train_tags') #given tags stored in trainTags as a list for i in range(0, (len(tagFiles))): raw = open(tagFiles[i]).read() trainTags.append(raw.split(",")) trainDocs = [] #to store key words from give docs and trainFiles in a list form os.chdir('/Users/arya/Desktop/DocumentTagging/legalData/Train_docs') #important keywords from trainFiles stored in trainDocs as a list rake = Rake(min_chars = 4, max_words = 3, min_freq = 2, language_code=None, # 'en' stopwords=None, # {'and', 'of'} lang_detect_threshold=50, max_words_unknown_lang=2, generated_stopwords_percentile=80, generated_stopwords_max_len=3, generated_stopwords_min_freq=2, ) docs = [] #to store opened trainFiles for i in range(0,len(trainFiles)): raw = open(trainFiles[i], encoding = "latin-1") txt = raw.read() docs.append(txt) #opening each file in trainFiles and storing it in docs wordsByRake =[] #to store key words from each docs after applying Rake for i in range(0,len(trainFiles)): wordsByRake.append(rake.apply(docs[i])) def listOfLists(lst): temp =[] for i in range(0,len(lst)): if(lst[i][1] > 4.0): #this can be changed according to the required number of tags temp.append(lst[i][0]) return [elem for elem in temp] for i in range(0,len(wordsByRake)): trainDocs.insert(i, listOfLists(wordsByRake[i])) wordsByRake = [] #to avoid memory usage docs = [] #to avoid memory usage nlp = en_core_web_sm.load() #loading the model ruler = EntityRuler(nlp) pattern = []; #to store the pattern for tagging each doc def labelDecider(txt,tag,count): patternDict = {} patternDict = {'label': str(tag) ,'pattern': txt[count]} return patternDict for i in range(0,len(trainDocs)): #0 to 80 docCount = 0; case = trainDocs[i] if(len(trainDocs[i]) != 0): if(len(trainTags[i]) == 1): #for docs with one lable tagCase = trainTags[i] while True: pattern.append(labelDecider(case,tagCase,docCount)) docCount = docCount + 1 if(docCount == len(trainDocs[i])): break else: #for docs with multiple labels: matching each label to each keyword of the doc for j in range(0,len(trainTags[i])): docCount = 0 tags = trainTags[i] while True: pattern.append(labelDecider(trainDocs[i],tags[j],docCount)) docCount = docCount + 1 if(docCount == len(trainDocs[i])): break #adding the pattern to the pipe ruler.add_patterns(pattern) nlp.add_pipe(ruler) # disabling default pipe names to add custom : ['tagger', 'parser', 'ner'] disabled pipe_exceptions = ['entity_ruler'] unaffected_pipes = [pipe for pipe in nlp.pipe_names if pipe not in pipe_exceptions] nlp.disable_pipes(*unaffected_pipes) #applying the model testPath = '/Users/arya/Desktop/DocumentTagging/testData/Test_docs/' os.chdir(testPath) testFiles = os.listdir() def sortTestByCase(x): return(x[-17:]) testFiles = sorted(testFiles, key = sortTestByCase) #sorted test file names of train tags by case number testFiles.pop(0) testDocs = [] for i in range(0,len(testFiles)): testDocs.append(open(testFiles[i], encoding = "latin-1").read()) separateTags = [] def tagSeparator(tup): separateTags.append(tup) finalTags = [] #to store the final tags generated for the test files for i in range(0,len(testDocs)): postModelTest = [nlp(text) for text in [testDocs[i]]] for j in range(0,len(postModelTest)): separateTags = [] for k in range(len(postModelTest[j].ents)): tagSeparator((postModelTest[j].ents[k].text,postModelTest[j].ents[k].label_)) finalTags.append(separateTags) #exporting tags as a csv file import pandas as pd df = pd.DataFrame(finalTags) os.chdir('/Users/arya/Desktop/DocumentTagging/') df.to_csv('outputTags.csv',header=False,index=False) end = time.time() print(end - start) #training the model #import random #from spacy.util import minibatch, compounding ##from pathlib import Path # ## TRAINING THE MODEL #with nlp.disable_pipes(*unaffected_pipes): # # # Training for 30 iterations # for iteration in range(30): # # # shuufling examples before every iteration # random.shuffle(TRAIN_DATA) # losses = {} # # batch up the examples using spaCy's minibatch # batches = minibatch(TRAIN_DATA, size=compounding(4.0, 32.0, 1.001)) # for batch in batches: # texts, annotations = zip(*batch) # nlp.update( # texts, # batch of texts # annotations, # batch of annotations # drop=0.5, # dropout - make it harder to memorise data # losses=losses, # ) # print("Losses", losses)
from tkinter import * from abc import ABCMeta, abstractmethod class ColleagueCheckbox(Checkbutton): def __init__(self, root, caption, state): Checkbutton.__init__(self, root, text=caption, variable=state) def set_mediator(self, mediator): self.mediator = mediator def set_colleague_enabled(self, enabled): self.configure(state=enabled) def item_state_changed(self, event): self.mediator.colleague_changed() class ColleagueButton(Button): def __init__(self, root, caption): Button.__init__(self, root, text=caption) def set_mediator(self, mediator): self.mediator = mediator def set_colleague_enabled(self, enabled): self.configure(state=enabled) class ColleagueTextField(Text): def __init__(self, root, columns): Text.__init__(self, root, height=columns) def set_mediator(self, mediator): self.mediator = mediator def set_colleague_enabled(self, enabled): self.configure(state=enabled) self.configure(bg = 'white' if enabled=='normal' else 'lightGray') def text_value_changed(self, event): self.mediator.colleague_changed() class LoginFrame(Frame): def __init__(self, title, master=None): Frame.__init__(self, master, bg='lightGray') self.master.title(title) self.pack() self.create_colleagues() self.colleague_changed() self.check_guest.grid(row=0, column=1) self.check_login.grid(row=0, column=2) Label(self, text='Username:').grid(row=1, column=1) self.text_user.grid(row=1, column=2) Label(self, text='Password:').grid(row=2, column=1) self.text_pass.grid(row=2, column=2) self.button_ok.grid(row=3, column=1) self.button_cancel.grid(row=3, column=2) def create_colleagues(self): self.guest_var = BooleanVar(value=False) self.login_var = BooleanVar(value=True) self.check_guest = ColleagueCheckbox(self, 'Guest', self.guest_var) self.check_login = ColleagueCheckbox(self, 'Login', self.login_var) self.text_user = ColleagueTextField(self, 10) self.text_pass = ColleagueTextField(self, 10) self.button_ok = ColleagueButton(self, 'OK') self.button_cancel = ColleagueButton(self, 'Cancel') self.check_guest.set_mediator(self) self.check_login.set_mediator(self) self.text_user.set_mediator(self) self.text_pass.set_mediator(self) self.button_ok.set_mediator(self) self.button_cancel.set_mediator(self) self.check_guest.bind('<Button-1>', self.check_guest.item_state_changed) self.check_login.bind('<Button-1>', self.check_login.item_state_changed) self.text_user.bind('<KeyRelease>', self.text_user.text_value_changed) self.text_pass.bind('<KeyRelease>', self.text_pass.text_value_changed) def colleague_changed(self): if self.guest_var.get(): self.text_user.set_colleague_enabled('disabled') self.text_pass.set_colleague_enabled('disabled') self.button_ok.set_colleague_enabled('normal') else: self.text_user.set_colleague_enabled('normal') self._userpass_changed() def _userpass_changed(self): if len(self.text_user.get("1.0",END))-1: self.text_pass.set_colleague_enabled('normal') if len(self.text_pass.get("1.0",END))-1: self.button_ok.set_colleague_enabled('normal') else: self.button_ok.set_colleague_enabled('disabled') else: self.text_pass.set_colleague_enabled('disabled') self.button_ok.set_colleague_enabled('disabled') if __name__=='__main__': frame = LoginFrame('Mediator Sample') frame.mainloop()
''' Write a program with 3 functions. Each function must call at least one other function and use the return value to do something. ''' def pos_neg(num): if num > 0: return -num elif num < 0: return -num else: return num def divide_3(num): return num / 3 def multiply_ten(num): return num * 10 print(multiply_ten(divide_3(pos_neg(-5))))
# -*- coding: utf-8 -*- """ Created on Wed Jul 19 18:24:47 2017 @author: jaewonkwon """ #!/usr/bin/env python import random #import json #import math def main_program(json_map,trail=[]): #first take the map and transform it to line objects #line_list_dict = json.loads(json_map) line_list = line_generator(json_map) test_crawler1 = crawler(200,0,"test1") test_crawler2 = crawler(200,0,"test2") test_crawler3 = crawler(200,0,"test2") additional_crawlers = [crawler(200,0,"test2"),crawler(200,0,"test2")] #crawler_moves= {} crawler1_moves =[] crawler2_moves =[] crawler3_moves =[] add_crawler_moves= [] crawler1_moves.append([test_crawler1.x, test_crawler1.y]) crawler2_moves.append([test_crawler2.x, test_crawler2.y]) crawler3_moves.append([test_crawler3.x, test_crawler3.y]) crawler1_update = True crawler1_reverse = False crawler2_update = True crawler2_reverse = False crawler3_update = True crawler3_reverse = False addCrawler_update= [] addCrawler_reverse = [] for addCrawler_num in range(len(additional_crawlers)): addCrawler_update.append(True) addCrawler_reverse.append(False) add_crawler_moves.append([]) add_crawler_moves[addCrawler_num].append([additional_crawlers[addCrawler_num].x, additional_crawlers[addCrawler_num].y]) if trail == []: rep = 0 for turn in range(4000): if (crawler1_update) == True: if (test_crawler1.y < 400 and (crawler1_reverse == False)): next_move = test_crawler1.next_move(line_list) test_crawler1.update(next_move) crawler1_moves.append(test_crawler1.list_current_location) trail.append(test_crawler1.list_current_location) if test_crawler1.y == 400: crawler1_reverse = True if (crawler1_reverse): next_move = test_crawler1.next_move(line_list,'default','reverse') test_crawler1.update(next_move) crawler1_moves.append(test_crawler1.list_current_location) trail.append(test_crawler1.list_current_location) if test_crawler1.y == 0: crawler1_update = False if (crawler2_update): if (test_crawler2.y < 400 and (crawler2_reverse == False)): next_move = test_crawler2.next_move(line_list) test_crawler2.update(next_move) crawler2_moves.append(test_crawler2.list_current_location) trail.append(test_crawler2.list_current_location) if test_crawler2.y == 400: crawler2_reverse = True if (crawler2_reverse): next_move = test_crawler2.next_move(line_list,'default','reverse') test_crawler2.update(next_move) crawler2_moves.append(test_crawler2.list_current_location) trail.append(test_crawler2.list_current_location) if test_crawler2.y == 0: crawler2_update = False if (crawler3_update) and (rep > 200): if (test_crawler3.y < 400 and (crawler3_reverse == False)): next_move = test_crawler3.next_move(line_list,trail) test_crawler3.update(next_move) crawler3_moves.append(test_crawler3.list_current_location) trail.append(test_crawler3.list_current_location) if test_crawler3.y == 400: crawler3_reverse = True if (crawler3_reverse): next_move = test_crawler3.next_move(line_list,trail,'reverse') test_crawler3.update(next_move) crawler3_moves.append(test_crawler3.list_current_location) trail.append(test_crawler3.list_current_location) if test_crawler3.y == 0: crawler3_update = False add_startreps = 300 for crawler_num in range(len(additional_crawlers)): #repeating the updating steps for every crawler in additional crawlers if (addCrawler_update[crawler_num]) and (rep > add_startreps): if (additional_crawlers[crawler_num].y < 400 and ( addCrawler_reverse[crawler_num]== False)): next_move = additional_crawlers[crawler_num].next_move(line_list,trail) additional_crawlers[crawler_num].update(next_move) add_crawler_moves[crawler_num].append( additional_crawlers[crawler_num].list_current_location) trail.append(additional_crawlers[crawler_num].list_current_location) if additional_crawlers[crawler_num].y == 400: addCrawler_reverse[crawler_num] = True if (addCrawler_reverse[crawler_num]): next_move = additional_crawlers[crawler_num].next_move( line_list,trail,'reverse') additional_crawlers[crawler_num].update(next_move) add_crawler_moves[crawler_num].append( additional_crawlers[crawler_num].list_current_location) trail.append(additional_crawlers[crawler_num].list_current_location) if additional_crawlers[crawler_num].y == 0: addCrawler_update[crawler_num] = False add_startreps+= 200 if ((crawler1_update == False) and (crawler2_update == False) and (crawler3_update == False) and (True not in addCrawler_update)): break rep += 1 crawler_moves= [{"trail": trail},{"moves": crawler1_moves}, {"moves": crawler2_moves}, {"moves": crawler3_moves}] for addCrawler_moves in add_crawler_moves: crawler_moves.append({"moves":addCrawler_moves}) return crawler_moves else: for turn in range(2000): for crawler_num in range(len(additional_crawlers)): if (addCrawler_update[crawler_num]): if (additional_crawlers[crawler_num].y < 400 and ( addCrawler_reverse[crawler_num]== False)): next_move = additional_crawlers[crawler_num].next_move(line_list,trail) additional_crawlers[crawler_num].update(next_move) add_crawler_moves[crawler_num].append( additional_crawlers[crawler_num].list_current_location) trail.append(additional_crawlers[crawler_num].list_current_location) if additional_crawlers[crawler_num].y == 400: addCrawler_reverse[crawler_num] = True if (addCrawler_reverse[crawler_num]): next_move = additional_crawlers[crawler_num].next_move( line_list,trail,'reverse') additional_crawlers[crawler_num].update(next_move) add_crawler_moves[crawler_num].append( additional_crawlers[crawler_num].list_current_location) trail.append(additional_crawlers[crawler_num].list_current_location) if additional_crawlers[crawler_num].y == 0: addCrawler_update[crawler_num] = False if (True not in addCrawler_update): break crawler_moves= [{"trail":trail}] for addCrawler_moves in add_crawler_moves: crawler_moves.append({"moves":addCrawler_moves}) return crawler_moves class point(object): def __init__(self,x, y): self.x = x self.y = y self.xy = self.x, self.y def distance(self, other): x_dist = (self.x - other.x)**2 y_dist = (self.y - other.y)**2 dist = (x_dist + y_dist)**(.5) return dist def __str__(self): return str(self.xy) def __repr__(self): return str(self.xy) class line(object): def __init__(self, start_point, end_point): self.start_point = start_point self.end_point = end_point if self.end_point.x == self.start_point.x: self.slope = 0 if self.end_point.x != self.start_point.x: self.slope = ((self.end_point.y - self.start_point.y)/( self.end_point.x - self.start_point.x)) self.b = (self.start_point.y - self.slope * (self.start_point.x)) if self.start_point.y >= self.end_point.y: self.line_max_y = self.start_point.y self.line_min_y = self.end_point.y elif self.start_point.y < self.end_point.y: self.line_max_y = self.end_point.y self.line_min_y = self.start_point.y if self.start_point.x >= self.end_point.x: self.line_max_x = self.start_point.x self.line_min_x = self.end_point.x elif self.start_point.x < self.end_point.x: self.line_max_x = self.end_point.x self.line_min_x = self.start_point.x def all_coordinates(self): return ([[self.start_point.x, self.start_point.y],[self.end_point.x, self.end_point.y]]) def get_y(self,x): if self.end_point.x == self.start_point.x: line_y = self.end_point.y return line_y else: line_y = (self.slope*(x) + self.b) return line_y def get_x(self,y): if self.end_point.x == self.start_point.x: return self.end_point.x else: line_x = ((y - self.b)/self.slope) return line_x def is_inside(self, x, y): expected_y = self.get_y(x) if y == expected_y: return True else: return False #be able to read the dictionary map and come up with coordinates class crawler(object): def __init__(self, x,y,name): self.x = x self.y = y self.current_location = point(x,y) self.name = str(name) self.start_location = point(x,y) self.list_current_location = [self.x,self.y] def random_move(self, option= 'random', trail = 'default', mode = 'default'): #this is reverse mode for the crawler that is coming back, #the concept of backward and forward will be reversed if mode == 'reverse': forward = point(self.x, self.y -1) backward = point(self.x, self.y + 1) if mode == 'default': forward = point(self.x, self.y + 1) backward = point(self.x, self.y - 1) #crawler can randomly move 1 step in a direction #crawler can only move left, right, forward, backward left = point(self.x - 1, self.y) right = point(self.x + 1, self.y) #direction_dict = {'0':'left', '1': 'right', '2': 'forward', '3':'backward'} possible_moves = [left,right,forward, backward] random_direction =random.randint(0,2) trail_possible = [left,right,forward] if (trail != 'default') and (option == 'random'): for trail_point in trail: if trail_point in trail_possible: trail_possible += [trail_point] random_direction = random.choice(trail_possible) return random_direction if (trail == 'default') and (option == 'random'): return possible_moves[random_direction] if option == 'backward': return possible_moves[3] if option == '0': return possible_moves[0] if option == '1': return possible_moves[1] if option == '2': return possible_moves[2] def is_next_move(self, random_move,line_list): is_next_move = True random_point = random_move for line_item in line_list: if random_point.y in range(line_item.line_min_y, line_item.line_max_y + 1): line_x =((line_item.get_x(random_point.y))) current_x = self.x next_x = random_point.x if next_x >= current_x: max_x = next_x min_x = current_x elif next_x < current_x: max_x = current_x min_x = next_x if ((line_x >= min_x) and (line_x <= max_x)): is_next_move = False return is_next_move if ((random_point.x >= line_item.line_min_x) and ( random_point.x <= line_item.line_max_x)): line_y =((line_item.get_y(random_point.x))) current_y = self.y next_y = random_point.y if next_y >= current_y: max_y = next_y min_y = current_y elif next_y < current_y: max_y = current_y min_y = next_y if ((line_y>= min_y) and (line_y <= max_y)): is_next_move = False return is_next_move return is_next_move def next_move(self, line_list,trail= 'default', mode = 'default'): left_move = self.random_move('0', mode) right_move = self.random_move('1', mode) forward_move = self.random_move('2',mode) next_move = None #if L,R,F options are not possible, we need to go back if ((self.is_next_move(left_move,line_list) == False) and (self.is_next_move(right_move, line_list) == False) and (self.is_next_move(forward_move, line_list) == False)): next_move= self.random_move('backward',mode) #now we know that one of them is possible, try getting a valid random move random_point = self.random_move('random',trail,mode) while self.is_next_move(random_point, line_list) == False: random_point= self.random_move('random', trail,mode) if self.is_next_move(random_point, line_list): next_move = random_point return next_move def update(self,other): self.x = other.x self.y = other.y self.current_location = other self.list_current_location = [other.x, other.y] def line_generator(line_dict): line_list = [] for line_item in line_dict: new_line = line_dict[line_item] new_line_start = point((new_line[0][0]),(new_line[0][1])) new_line_end = point((new_line[1][0]), (new_line[1][1])) line_list.append(line(new_line_start, new_line_end)) return line_list def test_crawler(): test_crawler = crawler(200,300,"test") test_line = line(point(246.66667,100), point(330,200)) test_line_list = [test_line] global test_list global test_trail for c in range(100): tcrawler_next = test_crawler.next_move(test_line_list) test_crawler.update(tcrawler_next) test_list.append(test_crawler.list_current_location) test_trail.append(test_crawler.list_current_location)
import boto3, json, pprint, requests, textwrap, time, logging, requests from datetime import datetime def get_cluster_dns(emr,cluster_id): response = emr.describe_cluster(ClusterId=cluster_id) return response['Cluster']['MasterPublicDnsName'] def wait_for_cluster_creation(emr,cluster_id): emr.get_waiter('cluster_running').wait(ClusterId=cluster_id) def terminate_cluster(emr,cluster_id): emr.terminate_job_flows(JobFlowIds=[cluster_id]) def get_public_ip(emr,cluster_id): instances = emr.list_instances(ClusterId=cluster_id, InstanceGroupTypes=['MASTER']) return instances['Instances'][0]['PublicIpAddress']
from ZeroScenarioHelper import * def main(): CreateScenaFile( "c0240.bin", # FileName "c0240", # MapName "c0240", # Location 0x000F, # MapIndex "ed7100", 0x00002000, # Flags ("", "", "", "", "", ""), # include 0x00, # PlaceNameNumber 0x00, # PreInitFunctionIndex b'\x00\xff\xff', # Unknown_51 # Information [0, 0, -1000, 0, 0, 2500, 34000, 262, 30, 45, 0, 360, 0, 0, 0, 0, 0, 1, 15, 0, 6, 0, 7], ) BuildStringList(( "c0240", # 0 "萨米", # 1 "金德尔", # 2 "金德尔", # 3 "布里吉塔", # 4 "卢威克老人", # 5 "卢威克老人", # 6 "奥丽加夫人", # 7 "奥丽加夫人", # 8 "搜查官", # 9 "搜查官", # 10 "伊莉娅", # 11 "伊莉娅", # 12 "莉夏", # 13 "修利", # 14 )) AddCharChip(( "chr/ch25600.itc", # 00 "chr/ch21800.itc", # 01 "chr/ch21802.itc", # 02 "chr/ch21600.itc", # 03 "chr/ch21602.itc", # 04 "chr/ch20100.itc", # 05 "chr/ch20102.itc", # 06 "chr/ch20300.itc", # 07 "chr/ch27600.itc", # 08 "chr/ch27800.itc", # 09 "apl/ch50386.itc", # 0A "chr/ch05200.itc", # 0B "chr/ch10000.itc", # 0C "chr/ch05102.itc", # 0D )) DeclNpc(9060, 10000, 18000, 45, 257, 0x0, 0, 0, 0, 0, 0, 0, 8, 255, 0) DeclNpc(3170, 1049, 60459, 90, 385, 0x0, 0, 1, 0, 0, 0, 0, 9, 255, 0) DeclNpc(-2009, 1149, 60479, 270, 341, 0x0, 0, 2, 0, 255, 255, 0, 10, 255, 0) DeclNpc(8470, 1019, 62380, 0, 257, 0x0, 0, 7, 0, 0, 0, 0, 11, 255, 0) DeclNpc(-45650, 1019, 60169, 180, 257, 0x0, 0, 3, 0, 0, 3, 0, 12, 255, 0) DeclNpc(-48700, 1200, 60400, 270, 469, 0x0, 0, 4, 0, 255, 255, 0, 13, 255, 0) DeclNpc(-39810, 1029, 62639, 0, 385, 0x0, 0, 5, 0, 0, 0, 0, 15, 255, 0) DeclNpc(7030, 150, 6969, 180, 341, 0x0, 0, 6, 0, 255, 255, 0, 16, 255, 0) DeclNpc(1539, 10000, 19700, 180, 385, 0x0, 0, 8, 0, 0, 0, 0, 17, 255, 0) DeclNpc(50069, 1049, 62479, 0, 401, 0x0, 0, 9, 0, 0, 0, 0, 18, 255, 0) DeclNpc(59099, 1549, 53029, 90, 469, 0x0, 0, 10, 0, 255, 255, 0, 19, 255, 0) DeclNpc(59099, 1549, 53029, 90, 503, 0x0, 0, 10, 0, 255, 255, 255, 255, 255, 0) DeclNpc(58290, 1029, 62500, 0, 389, 0x0, 0, 11, 0, 0, 0, 0, 20, 255, 0) DeclNpc(51930, 1049, 60970, 135, 389, 0x0, 0, 12, 0, 0, 0, 0, 21, 255, 0) DeclEvent(0x0000, 0, 24, 49.79999923706055, 51.150001525878906, 0.029999999329447746, 9.0, [0.3333333432674408, -0.0, 0.0, 0.0, -0.0, 0.5, -0.0, 0.0, 0.0, -0.0, 0.20000001788139343, 0.0, -16.600000381469727, -25.575000762939453, -0.0060000005178153515, 1.0]) DeclActor(0, 10000, 20600, 1000, 0, 11000, 20600, 0x007C, 0, 33, 0x0000) DeclActor(50350, 1050, 60430, 2000, 50350, 2000, 60430, 0x007C, 0, 34, 0x0000) DeclActor(58690, 1000, 52860, 3000, 58690, 2000, 52860, 0x007C, 0, 35, 0x0000) ScpFunction(( "Function_0_3B4", # 00, 0 "Function_1_46C", # 01, 1 "Function_2_497", # 02, 2 "Function_3_4C2", # 03, 3 "Function_4_4ED", # 04, 4 "Function_5_518", # 05, 5 "Function_6_543", # 06, 6 "Function_7_8B9", # 07, 7 "Function_8_B4F", # 08, 8 "Function_9_21BF", # 09, 9 "Function_10_22E2", # 0A, 10 "Function_11_34CA", # 0B, 11 "Function_12_4224", # 0C, 12 "Function_13_5170", # 0D, 13 "Function_14_52FD", # 0E, 14 "Function_15_53B9", # 0F, 15 "Function_16_5680", # 10, 16 "Function_17_621C", # 11, 17 "Function_18_64B8", # 12, 18 "Function_19_65DD", # 13, 19 "Function_20_6A9B", # 14, 20 "Function_21_6D09", # 15, 21 "Function_22_6F25", # 16, 22 "Function_23_7124", # 17, 23 "Function_24_7A9F", # 18, 24 "Function_25_7DD2", # 19, 25 "Function_26_8AD8", # 1A, 26 "Function_27_8B2E", # 1B, 27 "Function_28_8B4A", # 1C, 28 "Function_29_8B66", # 1D, 29 "Function_30_A9E3", # 1E, 30 "Function_31_AA10", # 1F, 31 "Function_32_AA36", # 20, 32 "Function_33_AA65", # 21, 33 "Function_34_AAB1", # 22, 34 "Function_35_AC92", # 23, 35 "Function_36_ADDD", # 24, 36 )) def Function_0_3B4(): pass label("Function_0_3B4") RunExpression(0x2, (scpexpr(EXPR_RAND), scpexpr(EXPR_PUSH_LONG, 0x8), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Switch( (scpexpr(EXPR_GET_RESULT, 0x2), scpexpr(EXPR_END)), (0, "loc_3F4"), (1, "loc_400"), (2, "loc_40C"), (3, "loc_418"), (4, "loc_424"), (5, "loc_430"), (6, "loc_43C"), (SWITCH_DEFAULT, "loc_448"), ) label("loc_3F4") OP_A0(0xFE, 1450, 0x0, 0xFB) Jump("loc_454") label("loc_400") OP_A0(0xFE, 1550, 0x0, 0xFB) Jump("loc_454") label("loc_40C") OP_A0(0xFE, 1600, 0x0, 0xFB) Jump("loc_454") label("loc_418") OP_A0(0xFE, 1400, 0x0, 0xFB) Jump("loc_454") label("loc_424") OP_A0(0xFE, 1650, 0x0, 0xFB) Jump("loc_454") label("loc_430") OP_A0(0xFE, 1350, 0x0, 0xFB) Jump("loc_454") label("loc_43C") OP_A0(0xFE, 1500, 0x0, 0xFB) Jump("loc_454") label("loc_448") OP_A0(0xFE, 1500, 0x0, 0xFB) Jump("loc_454") label("loc_454") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_46B") OP_A0(0xFE, 1500, 0x0, 0xFB) Jump("loc_454") label("loc_46B") Return() # Function_0_3B4 end def Function_1_46C(): pass label("Function_1_46C") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_496") OP_94(0xFE, 0xFFFFF858, 0x2A44, 0x866, 0x311A, 0x3E8) Sleep(300) Jump("Function_1_46C") label("loc_496") Return() # Function_1_46C end def Function_2_497(): pass label("Function_2_497") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_4C1") OP_94(0xFE, 0x852, 0xF01E, 0x1036, 0xE830, 0x3E8) Sleep(300) Jump("Function_2_497") label("loc_4C1") Return() # Function_2_497 end def Function_3_4C2(): pass label("Function_3_4C2") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_4EC") OP_94(0xFE, 0xFFFF4C46, 0xE4C0, 0xFFFF592A, 0xF078, 0x3E8) Sleep(300) Jump("Function_3_4C2") label("loc_4EC") Return() # Function_3_4C2 end def Function_4_4ED(): pass label("Function_4_4ED") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_517") OP_94(0xFE, 0xFFFF646A, 0xCA3A, 0xFFFF688E, 0xD386, 0x3E8) Sleep(300) Jump("Function_4_4ED") label("loc_517") Return() # Function_4_4ED end def Function_5_518(): pass label("Function_5_518") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_542") OP_94(0xFE, 0xDEF8, 0xD82C, 0xEBE6, 0xE2A4, 0x3E8) Sleep(300) Jump("Function_5_518") label("loc_542") Return() # Function_5_518 end def Function_6_543(): pass label("Function_6_543") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xE0, 0)), scpexpr(EXPR_END)), "loc_556") SetChrFlags(0xC, 0x80) Jump("loc_892") label("loc_556") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC3, 6)), scpexpr(EXPR_END)), "loc_564") Jump("loc_892") label("loc_564") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC2, 2)), scpexpr(EXPR_END)), "loc_577") SetChrFlags(0xB, 0x80) Jump("loc_892") label("loc_577") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_END)), "loc_596") SetChrPos(0xB, 11480, 1000, 54590, 0) Jump("loc_892") label("loc_596") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_5CA") ClearChrFlags(0x13, 0x80) ClearChrFlags(0x12, 0x80) SetChrPos(0x12, 59490, 700, 52910, 315) OP_A7(0x12, 0xFF, 0xFF, 0xFF, 0x0, 0x0) Jump("loc_892") label("loc_5CA") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA3, 3)), scpexpr(EXPR_END)), "loc_5E7") SetChrFlags(0x8, 0x80) SetChrFlags(0xC, 0x80) SetChrFlags(0xF, 0x80) Jump("loc_892") label("loc_5E7") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xAA, 2)), scpexpr(EXPR_END)), "loc_62B") SetChrPos(0x9, -990, 5000, 14750, 90) ClearChrFlags(0x9, 0x80) SetChrFlags(0xA, 0x80) SetChrPos(0xB, 400, 5000, 14750, 270) SetChrFlags(0xC, 0x80) SetChrFlags(0xF, 0x80) Jump("loc_892") label("loc_62B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 4)), scpexpr(EXPR_END)), "loc_65E") ClearChrFlags(0x9, 0x80) SetChrFlags(0xA, 0x80) SetChrPos(0xB, 4720, 1000, 60520, 270) SetChrFlags(0xC, 0x80) SetChrFlags(0xF, 0x80) Jump("loc_892") label("loc_65E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 2)), scpexpr(EXPR_END)), "loc_72F") SetChrFlags(0xC, 0x80) SetChrFlags(0xF, 0x80) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x1)"), scpexpr(EXPR_END)), "loc_68F") SetChrPos(0x8, 1420, 5000, 17800, 45) label("loc_68F") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x3)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_6F6") ClearChrFlags(0xC, 0x80) ClearChrFlags(0xE, 0x80) SetChrPos(0xC, -46140, 1030, 59110, 0) SetChrPos(0xE, -45740, 1030, 60980, 180) BeginChrThread(0xC, 0, 0, 0) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x7)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_6F6") SetChrFlags(0xC, 0x10) SetChrFlags(0xE, 0x10) label("loc_6F6") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_END)), "loc_72A") ClearChrFlags(0x12, 0x80) ClearChrFlags(0x14, 0x80) ClearChrFlags(0x15, 0x80) SetChrPos(0x12, 52530, 1050, 60070, 270) SetChrChipByIndex(0x12, 0xD) SetChrSubChip(0x12, 0x0) label("loc_72A") Jump("loc_892") label("loc_72F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 0)), scpexpr(EXPR_END)), "loc_747") SetChrFlags(0xC, 0x80) SetChrFlags(0xF, 0x80) Jump("loc_892") label("loc_747") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_796") SetChrPos(0x8, -210, 5000, 12250, 180) BeginChrThread(0x8, 0, 0, 1) SetChrFlags(0xB, 0x80) SetChrFlags(0xC, 0x80) ClearChrFlags(0xD, 0x80) SetChrPos(0xF, -49990, 1200, 61760, 180) ClearChrFlags(0x10, 0x80) ClearChrFlags(0x11, 0x80) Jump("loc_892") label("loc_796") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x82, 0)), scpexpr(EXPR_END)), "loc_7DC") SetChrPos(0x8, -210, 5000, 12250, 180) BeginChrThread(0x8, 0, 0, 1) ClearChrFlags(0x10, 0x80) ClearChrFlags(0x11, 0x80) SetChrPos(0x11, 58830, 1000, 56350, 180) BeginChrThread(0x11, 0, 0, 5) Jump("loc_892") label("loc_7DC") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 7)), scpexpr(EXPR_END)), "loc_801") SetChrPos(0xC, -39220, 1000, 52790, 90) BeginChrThread(0xC, 0, 0, 4) Jump("loc_892") label("loc_801") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 0)), scpexpr(EXPR_END)), "loc_80F") Jump("loc_892") label("loc_80F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x64, 1)), scpexpr(EXPR_END)), "loc_839") SetChrPos(0xB, 3570, 1000, 60560, 269) BeginChrThread(0xB, 0, 0, 2) SetChrFlags(0xA, 0x80) Jump("loc_892") label("loc_839") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x61, 1)), scpexpr(EXPR_END)), "loc_84C") SetChrFlags(0xB, 0x80) Jump("loc_892") label("loc_84C") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x60, 0)), scpexpr(EXPR_END)), "loc_87B") SetChrPos(0xC, -49940, 1050, 63990, 0) BeginChrThread(0xC, 0, 0, 0) ClearChrFlags(0xE, 0x80) SetChrFlags(0xF, 0x80) Jump("loc_892") label("loc_87B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x42, 5)), scpexpr(EXPR_END)), "loc_889") Jump("loc_892") label("loc_889") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x41, 6)), scpexpr(EXPR_END)), "loc_892") label("loc_892") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5C, 0)), scpexpr(EXPR_END)), "loc_8A6") ClearScenarioFlags(0x5C, 0) Event(0, 22) Jump("loc_8B8") label("loc_8A6") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5C, 1)), scpexpr(EXPR_END)), "loc_8B8") ClearScenarioFlags(0x5C, 1) SetScenarioFlags(0x1, 3) Event(0, 29) label("loc_8B8") Return() # Function_6_543 end def Function_7_8B9(): pass label("Function_7_8B9") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 3)), scpexpr(EXPR_END)), "loc_8CE") OP_50(0x1, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) ClearScenarioFlags(0x1, 3) label("loc_8CE") OP_52(0x12, 0x33, (scpexpr(EXPR_PUSH_LONG, 0x3E8), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_904") OP_52(0x12, 0x33, (scpexpr(EXPR_PUSH_LONG, 0x5DC), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_63(0x12, 0x0, 2000, 0x1C, 0x21, 0xFA, 0x0) label("loc_904") ClearMapObjFlags(0x2, 0x10) OP_66(0x0, 0x1) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC2, 2)), scpexpr(EXPR_END)), "loc_91C") Jump("loc_9AE") label("loc_91C") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_END)), "loc_92A") Jump("loc_9AE") label("loc_92A") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_942") SetMapObjFlags(0x2, 0x10) OP_65(0x0, 0x1) Jump("loc_9AE") label("loc_942") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 4)), scpexpr(EXPR_END)), "loc_950") Jump("loc_9AE") label("loc_950") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 2)), scpexpr(EXPR_END)), "loc_975") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x3)"), scpexpr(EXPR_END)), "loc_970") SetMapObjFlags(0x2, 0x10) OP_65(0x0, 0x1) label("loc_970") Jump("loc_9AE") label("loc_975") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 0)), scpexpr(EXPR_END)), "loc_983") Jump("loc_9AE") label("loc_983") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_99B") SetMapObjFlags(0x2, 0x10) OP_65(0x0, 0x1) Jump("loc_9AE") label("loc_99B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x82, 0)), scpexpr(EXPR_END)), "loc_9AE") SetMapObjFlags(0x2, 0x10) OP_65(0x0, 0x1) label("loc_9AE") SetMapObjFrame(0xFF, "huku_nugippa", 0x0, 0x1) SetMapObjFrame(0xFF, "model5", 0x0, 0x1) SetMapObjFrame(0xFF, "bed_event", 0x0, 0x1) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_END)), "loc_9EF") Jump("loc_A7A") label("loc_9EF") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_A34") SetMapObjFrame(0xFF, "bed_event", 0x1, 0x1) SetMapObjFrame(0xFF, "huku_nugippa", 0x1, 0x1) SetMapObjFrame(0xFF, "bed_normal", 0x0, 0x1) Jump("loc_A7A") label("loc_A34") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 4)), scpexpr(EXPR_END)), "loc_A42") Jump("loc_A7A") label("loc_A42") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 2)), scpexpr(EXPR_END)), "loc_A7A") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_A7A") SetMapObjFrame(0xFF, "huku_nugippa", 0x1, 0x1) SetMapObjFrame(0xFF, "model5", 0x1, 0x1) label("loc_A7A") OP_65(0x1, 0x1) OP_65(0x2, 0x1) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x1)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_AA7") OP_66(0x1, 0x1) OP_66(0x2, 0x1) label("loc_AA7") ModifyEventFlags(0, 0, 0x80) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x9)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_ACE") ModifyEventFlags(1, 0, 0x80) label("loc_ACE") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x1)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_AF0") OP_1B(0x8, 0x0, 0x24) label("loc_AF0") Jc((scpexpr(EXPR_PUSH_VALUE_INDEX, 0x4), scpexpr(EXPR_PUSH_LONG, 0x3), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_B0F") OP_10(0x0, 0x0) OP_10(0x8, 0x1) OP_10(0x7, 0x0) OP_10(0x9, 0x1) Jump("loc_B1B") label("loc_B0F") OP_10(0x0, 0x1) OP_10(0x8, 0x0) OP_10(0x7, 0x1) OP_10(0x9, 0x0) label("loc_B1B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x81, 5)), scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x81, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_B37") OP_7D(0xFF, 0xD2, 0xC8, 0x0, 0x0) Jump("loc_B4E") label("loc_B37") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xE0, 0)), scpexpr(EXPR_END)), "loc_B4E") OP_7D(0xFF, 0xD2, 0xC8, 0x0, 0x0) Jump("loc_B4E") label("loc_B4E") Return() # Function_7_8B9 end def Function_8_B4F(): pass label("Function_8_B4F") TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x3)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_FC7") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x4)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_F3D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_BD2") #C0001 ChrTalk( 0x101, ( "#0001F(好,开始询问线索吧。)\x02\x03", "#0000F打扰一下,\x01", "能占用您一点时间吗?\x02", ) ) CloseMessageWindow() label("loc_BD2") SetScenarioFlags(0x1, 2) FadeToDark(300, 0, 100) SetChrName("") #A0002 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "罗伊德等人就跟踪狂一事\x01", "向对方进行了询问。\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() #C0003 ChrTalk( 0xFE, ( "……你说的是跟踪狂那件事啊。\x01", "我作为这里的管理员,\x01", "警惕性一直很高。\x02", ) ) CloseMessageWindow() #C0004 ChrTalk( 0x102, ( "#0100F您亲眼见到过\x01", "跟踪狂吗?\x02", ) ) CloseMessageWindow() #C0005 ChrTalk( 0xFE, ( "我每天\x01", "都会到这里看看,\x01", "但基本没见过呢。\x02", ) ) CloseMessageWindow() #C0006 ChrTalk( 0xFE, "只有前些天看到过一次。\x02", ) CloseMessageWindow() #C0007 ChrTalk( 0xFE, ( "是个把帽檐压得很低的少年,\x01", "因为他很快就走掉了,\x01", "所以我也没有看得太清楚。\x02", ) ) CloseMessageWindow() #C0008 ChrTalk( 0x103, "#0200F您还能想起其它特征吗?\x02", ) CloseMessageWindow() #C0009 ChrTalk( 0xFE, "这个嘛……\x02", ) CloseMessageWindow() #C0010 ChrTalk( 0xFE, ( "非要说的话,\x01", "完全没有特征……也算是特征吧。\x02", ) ) CloseMessageWindow() OP_63(0x0, 0x0, 2000, 0x0, 0x1, 0xFA, 0x2) Sound(29, 0, 100, 0) OP_63(0x1, 0x0, 2000, 0x0, 0x1, 0xFA, 0x2) Sound(29, 0, 100, 0) OP_63(0x2, 0x0, 2000, 0x0, 0x1, 0xFA, 0x2) Sound(29, 0, 100, 0) OP_63(0x3, 0x0, 2000, 0x0, 0x1, 0xFA, 0x2) Sound(29, 0, 100, 0) Sleep(1000) #C0011 ChrTalk( 0xFE, ( "也不知是不是因为他穿着太过朴素,\x01", "反正我是一点特别的印象都没有。\x02", ) ) CloseMessageWindow() #C0012 ChrTalk( 0x104, "#0303F呃,竟然会这样……\x02", ) CloseMessageWindow() #C0013 ChrTalk( 0x101, ( "#0000F不过,从莉夏那里听来的情报\x01", "似乎没错……\x02", ) ) CloseMessageWindow() OP_29(0x1D, 0x1, 0x4) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x4)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x5)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x6)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x7)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x8)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_F38") #C0014 ChrTalk( 0x101, ( "#0000F好,调查就到此结束吧。\x02\x03", "先回伊莉娅小姐的房间,\x01", "整理一下目前的情报好了。\x02", ) ) CloseMessageWindow() #C0015 ChrTalk( 0x104, "#0300F好的,差不多也该拟定对策了!!\x02", ) CloseMessageWindow() ModifyEventFlags(1, 0, 0x80) OP_29(0x1D, 0x1, 0x9) label("loc_F38") Jump("loc_FC2") label("loc_F3D") #C0016 ChrTalk( 0xFE, ( "我看到的是一个\x01", "帽檐压得很低的少年,\x01", "没能看清他的长相。\x02", ) ) CloseMessageWindow() #C0017 ChrTalk( 0xFE, ( "另外,我记得\x01", "他的穿着打扮非常普通。\x02", ) ) CloseMessageWindow() #C0018 ChrTalk( 0xFE, "我连一点特别的印象都没有。\x02", ) CloseMessageWindow() label("loc_FC2") Jump("loc_21BB") label("loc_FC7") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xE0, 0)), scpexpr(EXPR_END)), "loc_10BA") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_105A") #C0019 ChrTalk( 0xFE, "好了,该工作了……\x02", ) CloseMessageWindow() #C0020 ChrTalk( 0xFE, ( "这也是为了把工资攒起来,\x01", "去看伊莉娅小姐的表演……\x02", ) ) CloseMessageWindow() #C0021 ChrTalk( 0xFE, ( "要是能买到下个月左右\x01", "的门票就好了~\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_10B5") label("loc_105A") #C0022 ChrTalk( 0xFE, ( "无论是做垃圾分类还是打扫水沟,\x01", "都是为了能见到伊莉娅小姐……\x02", ) ) CloseMessageWindow() #C0023 ChrTalk( 0xFE, "好了,再努力一下吧。\x02", ) CloseMessageWindow() label("loc_10B5") Jump("loc_21BB") label("loc_10BA") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC3, 6)), scpexpr(EXPR_END)), "loc_11E5") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1178") #C0024 ChrTalk( 0xFE, ( "前段时间,我第一次看到\x01", "住在三楼的人,虽然只是个背影。\x02", ) ) CloseMessageWindow() #C0025 ChrTalk( 0xFE, ( "因为她正往外走,\x01", "所以也没怎么看清楚……\x02", ) ) CloseMessageWindow() #C0026 ChrTalk( 0xFE, ( "不过,是个感觉很\x01", "普通的人。\x02", ) ) CloseMessageWindow() #C0027 ChrTalk( 0xFE, "虽然她的金发很漂亮。\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_11E0") label("loc_1178") #C0028 ChrTalk( 0xFE, ( "不过,对于爱打扮的女性来说,\x01", "也没什么大不了的。\x02", ) ) CloseMessageWindow() #C0029 ChrTalk( 0xFE, ( "嗯,从背影来看,\x01", "是个很普通的人呢,真意外啊。\x02", ) ) CloseMessageWindow() label("loc_11E0") Jump("loc_21BB") label("loc_11E5") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC2, 2)), scpexpr(EXPR_END)), "loc_12B1") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_126C") #C0030 ChrTalk( 0xFE, "好了,工作工作……\x02", ) CloseMessageWindow() #C0031 ChrTalk( 0xFE, ( "还得攒钱去看\x01", "彩虹剧团的表演呢。\x02", ) ) CloseMessageWindow() #C0032 ChrTalk( 0xFE, ( "我可是为了去看那个,\x01", "才会这么努力工作呢!\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_12AC") label("loc_126C") #C0033 ChrTalk( 0xFE, "这一切都是为了能见到伊莉娅小姐……\x02", ) CloseMessageWindow() #C0034 ChrTalk( 0xFE, "今天也要努力工作!\x02", ) CloseMessageWindow() label("loc_12AC") Jump("loc_21BB") label("loc_12B1") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_END)), "loc_1422") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_13C0") #C0035 ChrTalk( 0xFE, ( "那个住在三楼的人,最近似乎\x01", "留小孩在家里过夜呢。\x02", ) ) CloseMessageWindow() #C0036 ChrTalk( 0xFE, ( "我没和住在三楼的那位打过照面,\x01", "但时常能见到那个孩子。\x02", ) ) CloseMessageWindow() #C0037 ChrTalk( 0xFE, ( "戴着帽子,十三四岁左右,\x01", "是个挺好看的小孩子。\x02", ) ) CloseMessageWindow() OP_63(0xFE, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(500) #C0038 ChrTalk( 0xFE, ( "…………咦?\x01", "说起来,之前好像在哪里\x01", "见过那个孩子呢……\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_141D") label("loc_13C0") #C0039 ChrTalk( 0xFE, ( "嗯~好像在哪里\x01", "见到过那个孩子……\x02", ) ) CloseMessageWindow() #C0040 ChrTalk( 0xFE, ( "……呃,算了。\x01", "身为管理员,\x01", "管太多闲事也不好啊。\x02", ) ) CloseMessageWindow() label("loc_141D") Jump("loc_21BB") label("loc_1422") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_15B6") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_14CD") #C0041 ChrTalk( 0xFE, "唔……!!\x02", ) CloseMessageWindow() #C0042 ChrTalk( 0xFE, "伊莉娅小姐实在是太棒了!\x02", ) CloseMessageWindow() #C0043 ChrTalk( 0xFE, ( "另外……扮演『月之姬』\x01", "的那个演员也很厉害。\x02", ) ) CloseMessageWindow() #C0044 ChrTalk( 0xFE, ( "听说她还只是个新人,\x01", "但我已经完全迷上她了!\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_15B1") label("loc_14CD") #C0045 ChrTalk( 0xFE, ( "不过……伊莉娅小姐\x01", "究竟住在什么地方呢?\x02", ) ) CloseMessageWindow() #C0046 ChrTalk( 0xFE, ( "要是能知道她的住址,\x01", "我愿意一直追随到世界尽头!\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xBF, 3)), scpexpr(EXPR_OR), scpexpr(EXPR_END)), "loc_15B1") OP_63(0x0, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) Sound(23, 0, 100, 0) OP_63(0x1, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) Sound(23, 0, 100, 0) Sleep(1000) #C0047 ChrTalk( 0x101, ( "#0005F(她好像完全没注意住在三楼的就是\x01", " 伊莉娅小姐……)\x02", ) ) CloseMessageWindow() label("loc_15B1") Jump("loc_21BB") label("loc_15B6") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA3, 3)), scpexpr(EXPR_END)), "loc_15C4") Jump("loc_21BB") label("loc_15C4") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xAA, 2)), scpexpr(EXPR_END)), "loc_169B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_162E") #C0048 ChrTalk( 0xFE, ( "在刚才的那场游行中,\x01", "还有导力车在队伍里呢。\x02", ) ) CloseMessageWindow() #C0049 ChrTalk( 0xFE, "世界变得越来越先进了啊。\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_1696") label("loc_162E") #C0050 ChrTalk( 0xFE, ( "在我小时候,一说起游行,\x01", "只能想到花车而已呢。\x02", ) ) CloseMessageWindow() #C0051 ChrTalk( 0xFE, ( "……一想到这些,便不由自主地\x01", "感慨岁月的流逝啊。\x02", ) ) CloseMessageWindow() label("loc_1696") Jump("loc_21BB") label("loc_169B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 4)), scpexpr(EXPR_END)), "loc_1787") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1722") #C0052 ChrTalk( 0xFE, ( "住户们今天好像\x01", "全都出门了……\x02", ) ) CloseMessageWindow() #C0053 ChrTalk( 0xFE, "不过,这样也好。\x02", ) CloseMessageWindow() #C0054 ChrTalk( 0xFE, ( "免得一不小心听到\x01", "大家谈论观看新剧公演的感受。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_1782") label("loc_1722") #C0055 ChrTalk( 0xFE, ( "我明天要去看\x01", "彩虹剧团的新剧。\x02", ) ) CloseMessageWindow() #C0056 ChrTalk( 0xFE, ( "在那之前,绝对不要向我透露剧情哦。\x01", "我想体会那种新鲜感!\x02", ) ) CloseMessageWindow() label("loc_1782") Jump("loc_21BB") label("loc_1787") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 2)), scpexpr(EXPR_END)), "loc_1859") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1819") #C0057 ChrTalk( 0xFE, ( "不管大家有多兴奋欢乐,\x01", "我都得把管理员的工作完成才行!\x02", ) ) CloseMessageWindow() #C0058 ChrTalk( 0xFE, ( "这样就能在庆典的\x01", "最后一天休假,去看\x01", "彩虹剧团的表演了!\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_1854") label("loc_1819") #C0059 ChrTalk( 0xFE, ( "好啦,开始打扫……\x01", "这也是为了最后一天的休假而努力啊!\x02", ) ) CloseMessageWindow() label("loc_1854") Jump("loc_21BB") label("loc_1859") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 0)), scpexpr(EXPR_END)), "loc_1975") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1926") #C0060 ChrTalk( 0xFE, ( "彩虹剧团的\x01", "新剧终于公演了……\x02", ) ) CloseMessageWindow() #C0061 ChrTalk( 0xFE, ( "我买到的票是\x01", "纪念庆典最后一天的。\x02", ) ) CloseMessageWindow() #C0062 ChrTalk( 0xFE, ( "所以,在我亲眼欣赏过之前,\x01", "我决定不跟任何人说话。\x02", ) ) CloseMessageWindow() #C0063 ChrTalk( 0xFE, ( "要是一不小心知道了剧情,\x01", "魅力不就减半了嘛。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_1970") label("loc_1926") OP_63(0xFE, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(1000) #C0064 ChrTalk( 0xFE, ( "好啦,不要再和我说话了!\x01", "严禁透露剧情哦!\x02", ) ) CloseMessageWindow() label("loc_1970") Jump("loc_21BB") label("loc_1975") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_1B01") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1A85") #C0065 ChrTalk( 0xFE, ( "(紧张)……\x01", "啊啊,我现在就开始心跳加快啦……\x02", ) ) CloseMessageWindow() #C0066 ChrTalk( 0xFE, ( "马上就要到纪念庆典了……\x01", "到时就能看到伊莉娅小姐炫目的身影了……!\x02", ) ) CloseMessageWindow() #C0067 ChrTalk( 0xFE, ( "我今年也能看到舞台上的\x01", "伊莉娅小姐……⊥⊥⊥\x02", ) ) CloseMessageWindow() #C0068 ChrTalk( 0xFE, ( "…………哎呀,有什么事吗?\x01", "如果有事的话,\x01", "可以和我——管理员萨米说。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_1AFC") label("loc_1A85") #C0069 ChrTalk( 0xFE, ( "说起来,去三楼的那些人,\x01", "现在不知道走了没有。\x02", ) ) CloseMessageWindow() #C0070 ChrTalk( 0xFE, ( "三楼的那位住户今天也出门了。\x01", "她总是出门,\x01", "我都没和她见过面呢。\x02", ) ) CloseMessageWindow() label("loc_1AFC") Jump("loc_21BB") label("loc_1B01") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x82, 0)), scpexpr(EXPR_END)), "loc_1C34") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1BC8") #C0071 ChrTalk( 0xFE, ( "从早上起,就有客人\x01", "来找住在三楼的住户。\x02", ) ) CloseMessageWindow() #C0072 ChrTalk( 0xFE, ( "……但是,感觉有点奇怪呢。\x01", "那些人散发出一种居高临下的气场,\x01", "连我这个管理员都不让靠近那个房间。\x02", ) ) CloseMessageWindow() #C0073 ChrTalk( 0xFE, ( "莫非那些人\x01", "是警察吗?\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_1C2F") label("loc_1BC8") #C0074 ChrTalk( 0xFE, ( "……其实,我之前\x01", "就觉得三楼的住户\x01", "有点怪怪的。\x02", ) ) CloseMessageWindow() #C0075 ChrTalk( 0xFE, ( "因为她白天总是不在,\x01", "我连一次也没有见过她呢。\x02", ) ) CloseMessageWindow() label("loc_1C2F") Jump("loc_21BB") label("loc_1C34") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 7)), scpexpr(EXPR_END)), "loc_1D5A") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1CF2") #C0076 ChrTalk( 0xFE, "三楼的住户今天也出门了。\x02", ) CloseMessageWindow() #C0077 ChrTalk( 0xFE, ( "算了,也好……\x01", "反正我明天就能进去打扫了。\x02", ) ) CloseMessageWindow() #C0078 ChrTalk( 0xFE, ( "三楼的住户让我\x01", "每个月进去打扫房间一次。\x01", "这可是只有在高级公寓才能享受到的待遇哟。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_1D55") label("loc_1CF2") #C0079 ChrTalk( 0xFE, ( "我不太了解\x01", "住在三楼的人……\x02", ) ) CloseMessageWindow() #C0080 ChrTalk( 0xFE, ( "不过可以肯定\x01", "是个年轻女性。\x02", ) ) CloseMessageWindow() #C0081 ChrTalk( 0xFE, ( "因为她总是\x01", "把内衣晾出来嘛。\x02", ) ) CloseMessageWindow() label("loc_1D55") Jump("loc_21BB") label("loc_1D5A") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 0)), scpexpr(EXPR_END)), "loc_1E23") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1DDD") #C0082 ChrTalk( 0xFE, ( "好不容易买到了\x01", "彩虹剧团下个月的票。\x02", ) ) CloseMessageWindow() #C0083 ChrTalk( 0xFE, "虽然只是B等座位!\x02", ) CloseMessageWindow() #C0084 ChrTalk( 0xFE, ( "人也太多了!\x01", "我好不容易才抢到的~\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_1E1E") label("loc_1DDD") #C0085 ChrTalk( 0xFE, ( "不过,这样就能见到伊莉娅小姐了~\x01", "呵呵,我都已经等不及了~!\x02", ) ) CloseMessageWindow() label("loc_1E1E") Jump("loc_21BB") label("loc_1E23") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x64, 1)), scpexpr(EXPR_END)), "loc_1E76") #C0086 ChrTalk( 0xFE, ( "住在三楼的人\x01", "今天也是一大早就出门了。\x02", ) ) CloseMessageWindow() #C0087 ChrTalk( 0xFE, "她到底是什么来头呢~\x02", ) CloseMessageWindow() Jump("loc_21BB") label("loc_1E76") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x61, 1)), scpexpr(EXPR_END)), "loc_1F69") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1F26") #C0088 ChrTalk( 0xFE, ( "我很在意垃圾处理工作的,\x01", "不做好分类可不行啊。\x02", ) ) CloseMessageWindow() #C0089 ChrTalk( 0xFE, "不过……市里的垃圾回收还真是很随便呢。\x02", ) CloseMessageWindow() #C0090 ChrTalk( 0xFE, ( "经常把分类好的垃圾\x01", "混在一起收走。\x01", "真是气死我了!\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_1F64") label("loc_1F26") #C0091 ChrTalk( 0xFE, "我对垃圾分类很在意的。\x02", ) CloseMessageWindow() #C0092 ChrTalk( 0xFE, "你们也要多注意垃圾的分类哟。\x02", ) CloseMessageWindow() label("loc_1F64") Jump("loc_21BB") label("loc_1F69") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x60, 0)), scpexpr(EXPR_END)), "loc_2061") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_1FFE") #C0093 ChrTalk( 0xFE, "喂喂,听说了吗?\x02", ) CloseMessageWindow() #C0094 ChrTalk( 0xFE, ( "彩虹剧团新剧的门票\x01", "马上就要发售了。\x02", ) ) CloseMessageWindow() #C0095 ChrTalk( 0xFE, ( "我期待已久的伊莉娅小姐的英姿……⊥\x01", "啊,绝对要买到啊!\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_205C") label("loc_1FFE") #C0096 ChrTalk( 0xFE, ( "马上就要发售彩虹剧团\x01", "新剧的门票了。\x02", ) ) CloseMessageWindow() #C0097 ChrTalk( 0xFE, ( "为了与伊莉娅小姐相见,\x01", "就算熬夜排队也要购买~!\x02", ) ) CloseMessageWindow() label("loc_205C") Jump("loc_21BB") label("loc_2061") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x42, 5)), scpexpr(EXPR_END)), "loc_214B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_210F") #C0098 ChrTalk( 0xFE, "住在三楼的人总是不在家。\x02", ) CloseMessageWindow() #C0099 ChrTalk( 0xFE, ( "好像每天一大早就出去工作,\x01", "直到很晚才会回来……\x01", "连我也一次都没见过她呢。\x02", ) ) CloseMessageWindow() #C0100 ChrTalk( 0xFE, ( "不过她倒是每个月\x01", "都会按时交房租。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 0) Jump("loc_2146") label("loc_210F") #C0101 ChrTalk( 0xFE, ( "住在三楼的人总是不在家。\x01", "连我也一次都没见过她呢。\x02", ) ) CloseMessageWindow() label("loc_2146") Jump("loc_21BB") label("loc_214B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x41, 6)), scpexpr(EXPR_END)), "loc_21BB") #C0102 ChrTalk( 0xFE, ( "呀,您好。\x01", "我是这里的管理员萨米。\x02", ) ) CloseMessageWindow() #C0103 ChrTalk( 0xFE, ( "请问您要找哪位?\x01", "卢威克先生住在一楼,\x01", "金德尔先生则在二楼。\x02", ) ) CloseMessageWindow() label("loc_21BB") TalkEnd(0xFE) Return() # Function_8_B4F end def Function_9_21BF(): pass label("Function_9_21BF") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xE0, 0)), scpexpr(EXPR_END)), "loc_21D0") Jump("loc_22DE") label("loc_21D0") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC3, 6)), scpexpr(EXPR_END)), "loc_21DE") Jump("loc_22DE") label("loc_21DE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC2, 2)), scpexpr(EXPR_END)), "loc_21EC") Jump("loc_22DE") label("loc_21EC") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_END)), "loc_21FA") Jump("loc_22DE") label("loc_21FA") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_2208") Jump("loc_22DE") label("loc_2208") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA3, 3)), scpexpr(EXPR_END)), "loc_2216") Jump("loc_22DE") label("loc_2216") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xAA, 2)), scpexpr(EXPR_END)), "loc_225D") #C0104 ChrTalk( 0xFE, "……真是太精彩了。\x02", ) CloseMessageWindow() #C0105 ChrTalk( 0xFE, ( "今年的游行\x01", "实在是值得称赞。\x02", ) ) CloseMessageWindow() Jump("loc_22DE") label("loc_225D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 4)), scpexpr(EXPR_END)), "loc_22DE") #C0106 ChrTalk( 0xFE, ( "手头的工作已经都做完了,\x01", "我正要和妻子一起去看游行。\x02", ) ) CloseMessageWindow() #C0107 ChrTalk( 0xFE, ( "这可是为了克洛斯贝尔而举办的庆典。\x01", "我们也得玩得开心些啊。\x02", ) ) CloseMessageWindow() label("loc_22DE") TalkEnd(0xFE) Return() # Function_9_21BF end def Function_10_22E2(): pass label("Function_10_22E2") OP_52(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_52(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_52(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_52(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_52(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_2376") Jump("loc_23C0") label("loc_2376") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_2396") OP_52(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_23C0") label("loc_2396") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_23B6") OP_52(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_23C0") label("loc_23B6") OP_52(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_23C0") OP_52(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_52(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_52(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x3)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_2794") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x5)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_2703") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_2465") #C0108 ChrTalk( 0x101, ( "#0001F(好,开始询问线索吧。)\x02\x03", "#0000F不好意思,\x01", "能占用您一点时间吗?\x02", ) ) CloseMessageWindow() label("loc_2465") SetScenarioFlags(0x1, 2) FadeToDark(300, 0, 100) SetChrName("") #A0109 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "罗伊德等人就跟踪狂一事\x01", "向对方进行了询问。\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() #C0110 ChrTalk( 0xFE, ( "跟踪狂吗……\x01", "我听到过一些传言。\x02", ) ) CloseMessageWindow() #C0111 ChrTalk( 0xFE, ( "我平时总待在家里,\x01", "也没亲眼见过,\x01", "但是听到过可疑的声音。\x02", ) ) CloseMessageWindow() #C0112 ChrTalk( 0xFE, ( "就是从楼上传来\x01", "一种很奇怪的声音。\x02", ) ) CloseMessageWindow() #C0113 ChrTalk( 0xFE, ( "我记得住在三楼的人,\x01", "白天应该是不在家的。\x02", ) ) CloseMessageWindow() #C0114 ChrTalk( 0x101, "#0000F那是什么时候的事呢?\x02", ) CloseMessageWindow() #C0115 ChrTalk( 0xFE, "大概是纪念庆典刚开始的时候吧。\x02", ) CloseMessageWindow() #C0116 ChrTalk( 0xFE, "也就这两三天的事。\x02", ) CloseMessageWindow() #C0117 ChrTalk( 0x102, ( "#0108F(潜入伊莉娅小姐的房间,\x01", " 到底做了些什么呢?)\x02", ) ) CloseMessageWindow() #C0118 ChrTalk( 0x101, ( "#0001F(……是啊。\x01", " 房间里也没有任何\x01", " 被人弄乱的痕迹……)\x02", ) ) CloseMessageWindow() OP_29(0x1D, 0x1, 0x5) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x4)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x5)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x6)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x7)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x8)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_26FE") #C0119 ChrTalk( 0x101, ( "#0000F好,调查就到此结束吧。\x02\x03", "先回伊莉娅小姐的房间,\x01", "整理一下目前的情报好了。\x02", ) ) CloseMessageWindow() #C0120 ChrTalk( 0x104, "#0300F好的,差不多也该拟定对策了!!\x02", ) CloseMessageWindow() ModifyEventFlags(1, 0, 0x80) OP_29(0x1D, 0x1, 0x9) label("loc_26FE") Jump("loc_278F") label("loc_2703") #C0121 ChrTalk( 0xFE, ( "从楼上传来了可疑的声音,\x01", "也就这两三天的事吧。\x02", ) ) CloseMessageWindow() #C0122 ChrTalk( 0xFE, ( "我还以为楼上的人\x01", "在纪念庆典的时候\x01", "没出门呢。\x02", ) ) CloseMessageWindow() #C0123 ChrTalk( 0xFE, ( "难道……那就是\x01", "传闻中的跟踪狂吗?\x02", ) ) CloseMessageWindow() label("loc_278F") Jump("loc_34C2") label("loc_2794") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xE0, 0)), scpexpr(EXPR_END)), "loc_281F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_27F1") #C0124 ChrTalk( 0xFE, "……克洛斯贝尔的混蛋议员们……\x02", ) CloseMessageWindow() #C0125 ChrTalk( 0xFE, "真不像话,绝对不能原谅!\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_281A") label("loc_27F1") #C0126 ChrTalk( 0xFE, ( "应该把这些无能的议员\x01", "全给炒了鱿鱼!\x02", ) ) CloseMessageWindow() label("loc_281A") Jump("loc_34C2") label("loc_281F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC3, 6)), scpexpr(EXPR_END)), "loc_28B6") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_2891") #C0127 ChrTalk( 0xFE, "混账,竟然说设计得太自我了……?\x02", ) CloseMessageWindow() #C0128 ChrTalk( 0xFE, ( "他们为什么就是不懂\x01", "其中所蕴含的艺术性……!\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_28B1") label("loc_2891") #C0129 ChrTalk( 0xFE, "帝国派的那群混蛋议员……!\x02", ) CloseMessageWindow() label("loc_28B1") Jump("loc_34C2") label("loc_28B6") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC2, 2)), scpexpr(EXPR_END)), "loc_29BB") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_295A") #C0130 ChrTalk( 0xFE, ( "建造新市政厅大楼的预算\x01", "目前已经冻结了。\x02", ) ) CloseMessageWindow() #C0131 ChrTalk( 0xFE, ( "……议员们为了工程发包的问题,\x01", "彼此争论不休……\x02", ) ) CloseMessageWindow() #C0132 ChrTalk( 0xFE, ( "要是今年能重新\x01", "开始建造就好了……\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_29B6") label("loc_295A") #C0133 ChrTalk( 0xFE, ( "我对那栋大楼\x01", "有着自己的坚持。\x02", ) ) CloseMessageWindow() #C0134 ChrTalk( 0xFE, ( "今天准备审议这项工程的预算……\x01", "连我都紧张起来了……\x02", ) ) CloseMessageWindow() label("loc_29B6") Jump("loc_34C2") label("loc_29BB") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_END)), "loc_2AA1") SetChrSubChip(0xFE, 0x0) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_2A2C") #C0135 ChrTalk( 0xFE, ( "能在市长选举之前\x01", "盖完这栋建筑吗……\x02", ) ) CloseMessageWindow() #C0136 ChrTalk( 0xFE, ( "最近的客户\x01", "总是提出无理的要求啊……\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_2A9C") label("loc_2A2C") #C0137 ChrTalk( 0xFE, ( "四个月之后的市长选举期间\x01", "确实是举行落成典礼的最佳时期……\x02", ) ) CloseMessageWindow() #C0138 ChrTalk( 0xFE, ( "但工期实在是赶不及啊,\x01", "必须要去提提意见……\x02", ) ) CloseMessageWindow() label("loc_2A9C") Jump("loc_34C2") label("loc_2AA1") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_2B97") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_2B43") #C0139 ChrTalk( 0xFE, ( "从纪念庆典开始,\x01", "工作就接二连三地涌来……\x02", ) ) CloseMessageWindow() #C0140 ChrTalk( 0xFE, ( "看到自己设计的大楼正式动工,\x01", "虽然感到很开心,\x01", "但这么忙下去的话,我也会吃不消啊……\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_2B92") label("loc_2B43") #C0141 ChrTalk( 0xFE, "我是绝对不会妥协的。\x02", ) CloseMessageWindow() #C0142 ChrTalk( 0xFE, ( "很抱歉……我的工作已经排满了,\x01", "不再继续接单了。\x02", ) ) CloseMessageWindow() label("loc_2B92") Jump("loc_34C2") label("loc_2B97") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA3, 3)), scpexpr(EXPR_END)), "loc_2C53") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_2C1F") #C0143 ChrTalk( 0xFE, ( "唉呀,请不要\x01", "妨碍我啊。\x02", ) ) CloseMessageWindow() #C0144 ChrTalk( 0xFE, ( "我今天打算把剩下的工作\x01", "都解决掉。\x02", ) ) CloseMessageWindow() #C0145 ChrTalk( 0xFE, ( "……要是动作够快,\x01", "傍晚就会有空了。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_2C4E") label("loc_2C1F") #C0146 ChrTalk( 0xFE, ( "……赶紧把工作解决掉,傍晚\x01", "去陪老婆好了。\x02", ) ) CloseMessageWindow() label("loc_2C4E") Jump("loc_34C2") label("loc_2C53") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 6)), scpexpr(EXPR_END)), "loc_2CB0") #C0147 ChrTalk( 0xFE, "哎呀,有什么事吗?\x02", ) CloseMessageWindow() #C0148 ChrTalk( 0xFE, ( "抱歉,我还有设计的工作要做,\x01", "很抱歉,没空招待你。\x02", ) ) CloseMessageWindow() Jump("loc_34C2") label("loc_2CB0") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xAA, 2)), scpexpr(EXPR_END)), "loc_2CBE") Jump("loc_34C2") label("loc_2CBE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 4)), scpexpr(EXPR_END)), "loc_2CCC") Jump("loc_34C2") label("loc_2CCC") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 2)), scpexpr(EXPR_END)), "loc_2D23") #C0149 ChrTalk( 0xFE, "工作还没有做完呢。\x02", ) CloseMessageWindow() #C0150 ChrTalk( 0xFE, ( "……虽然对不住老婆,\x01", "但我现在真是走不开啊。\x02", ) ) CloseMessageWindow() Jump("loc_34C2") label("loc_2D23") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 0)), scpexpr(EXPR_END)), "loc_2D73") #C0151 ChrTalk( 0xFE, "怎么搞的,外面好吵啊……\x02", ) CloseMessageWindow() #C0152 ChrTalk( 0xFE, "这样的话,我都无法集中精神啊。\x02", ) CloseMessageWindow() Jump("loc_34C2") label("loc_2D73") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_2DD3") #C0153 ChrTalk( 0xFE, ( "好了,就差一点,\x01", "就能完成这幢大楼的设计图了……\x02", ) ) CloseMessageWindow() #C0154 ChrTalk( 0xFE, ( "得尽早拿给\x01", "客户过目啊。\x02", ) ) CloseMessageWindow() Jump("loc_34C2") label("loc_2DD3") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x82, 0)), scpexpr(EXPR_END)), "loc_2E77") #C0155 ChrTalk( 0xFE, ( "我的祖父和父亲\x01", "都是有名的建筑师。\x02", ) ) CloseMessageWindow() #C0156 ChrTalk( 0xFE, ( "克洛斯贝尔的市政厅\x01", "就是我祖父设计的。\x02", ) ) CloseMessageWindow() #C0157 ChrTalk( 0xFE, ( "说起来,那幢建筑\x01", "也已经有六十个年头了……\x01", "真是令人感慨万千啊。\x02", ) ) CloseMessageWindow() Jump("loc_34C2") label("loc_2E77") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 7)), scpexpr(EXPR_END)), "loc_2F75") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_2F26") #C0158 ChrTalk( 0xFE, ( "听说黑手党鲁巴彻的那些家伙\x01", "正在强买土地……\x02", ) ) CloseMessageWindow() #C0159 ChrTalk( 0xFE, ( "所谓强买土地,就是指为了得到建筑用地\x01", "而强行驱逐居民的违法行为。\x02", ) ) CloseMessageWindow() #C0160 ChrTalk( 0xFE, "真是群品行恶劣的家伙啊。\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_2F70") label("loc_2F26") #C0161 ChrTalk( 0xFE, ( "听说鲁巴彻的那群人\x01", "正在强买土地。\x02", ) ) CloseMessageWindow() #C0162 ChrTalk( 0xFE, ( "警察们就不能想办法\x01", "去管管吗?\x02", ) ) CloseMessageWindow() label("loc_2F70") Jump("loc_34C2") label("loc_2F75") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 0)), scpexpr(EXPR_END)), "loc_30B8") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_305D") #C0163 ChrTalk( 0xFE, ( "为了下个月做准备,克洛斯贝尔市里\x01", "所有的工地都加快了建设进程,\x02", ) ) CloseMessageWindow() #C0164 ChrTalk( 0xFE, ( "因为下个月将要举办七十周年的创立纪念庆典……\x01", "克洛斯贝尔市将受到世界各国的瞩目。\x02", ) ) CloseMessageWindow() #C0165 ChrTalk( 0xFE, ( "身为大楼的设计者,\x01", "这可是最好的自我展示机会呢。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_30B3") label("loc_305D") #C0166 ChrTalk( 0xFE, ( "下个月将会有很多大楼的\x01", "落成典礼吧。\x02", ) ) CloseMessageWindow() #C0167 ChrTalk( 0xFE, ( "感觉这里简直成了\x01", "世界顶级的繁荣之都啊。\x02", ) ) CloseMessageWindow() label("loc_30B3") Jump("loc_34C2") label("loc_30B8") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x64, 1)), scpexpr(EXPR_END)), "loc_30C6") Jump("loc_34C2") label("loc_30C6") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x61, 1)), scpexpr(EXPR_END)), "loc_31E4") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_3183") #C0168 ChrTalk( 0xFE, ( "你知道米修拉姆\x01", "开了一个主题公园吧?\x02", ) ) CloseMessageWindow() #C0169 ChrTalk( 0xFE, ( "据说,那个主题公园的主体部分\x01", "是由IBC的事业部负责的。\x02", ) ) CloseMessageWindow() #C0170 ChrTalk( 0xFE, ( "似乎还采用了\x01", "最新的建筑技术……\x01", "我也好想去见识一下呢。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_31DF") label("loc_3183") #C0171 ChrTalk( 0xFE, ( "我设计过很多酒店,\x01", "但还一次都没有去过主题公园。\x02", ) ) CloseMessageWindow() #C0172 ChrTalk( 0xFE, ( "嗯……好想看看\x01", "他们的设计作品呢。\x02", ) ) CloseMessageWindow() label("loc_31DF") Jump("loc_34C2") label("loc_31E4") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x60, 0)), scpexpr(EXPR_END)), "loc_325E") #C0173 ChrTalk( 0xFE, ( "呼,专心于设计,\x01", "一不小心就熬夜了。\x02", ) ) CloseMessageWindow() #C0174 ChrTalk( 0xFE, ( "不过这么一来,客人也会满意了吧。\x01", "呵呵,好期待明天的说明会啊。\x02", ) ) CloseMessageWindow() Jump("loc_34C2") label("loc_325E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x42, 5)), scpexpr(EXPR_END)), "loc_3378") SetChrSubChip(0xFE, 0x0) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_332A") #C0175 ChrTalk( 0xFE, ( "不过……那些家伙还真是令人头疼。\x01", "竟然完全无视\x01", "我的设计图……\x02", ) ) CloseMessageWindow() #C0176 ChrTalk( 0xFE, ( "让我设计新市政厅大楼的人\x01", "不就是他们吗!\x02", ) ) CloseMessageWindow() #C0177 ChrTalk( 0xFE, ( "我要去抗议……\x01", "擅自改变设计式样这种事\x01", "……我绝对不认可!\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_3373") label("loc_332A") #C0178 ChrTalk( 0xFE, ( "混蛋,这种破东西\x01", "叫什么改善方案啊。\x02", ) ) CloseMessageWindow() #C0179 ChrTalk( 0xFE, "太差劲了,实在是太差劲了!\x02", ) CloseMessageWindow() label("loc_3373") Jump("loc_34C2") label("loc_3378") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x41, 6)), scpexpr(EXPR_END)), "loc_34C2") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_3458") #C0180 ChrTalk( 0xFE, ( "正在建造的新市政厅大楼\x01", "是个高达四十层的超高建筑。\x02", ) ) CloseMessageWindow() #C0181 ChrTalk( 0xFE, ( "那可是一幢充满了\x01", "前所未有的崭新理念,\x01", "走在时代最前端的建筑物。\x02", ) ) CloseMessageWindow() #C0182 ChrTalk( 0xFE, ( "我负责设计大楼的\x01", "外观和办公区。\x01", "呵呵,真想赶快看到它完成时的样子啊。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 1) Jump("loc_34C2") label("loc_3458") #C0183 ChrTalk( 0xFE, ( "新建的市政厅大楼是高达四十层的\x01", "超高层建筑物。\x02", ) ) CloseMessageWindow() #C0184 ChrTalk( 0xFE, ( "设计它可真是一件大工程啊……\x01", "好期待它建成的那天。\x02", ) ) CloseMessageWindow() label("loc_34C2") SetChrSubChip(0xFE, 0x0) TalkEnd(0xFE) Return() # Function_10_22E2 end def Function_11_34CA(): pass label("Function_11_34CA") TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x3)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_37F3") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x6)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_37A5") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_354D") #C0185 ChrTalk( 0x101, ( "#0001F(好,开始询问线索吧。)\x02\x03", "#0000F打扰一下,\x01", "能占用您一点时间吗?\x02", ) ) CloseMessageWindow() label("loc_354D") SetScenarioFlags(0x1, 2) FadeToDark(300, 0, 100) SetChrName("") #A0186 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "罗伊德等人就跟踪狂一事\x01", "向对方进行了询问。\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() #C0187 ChrTalk( 0xFE, ( "跟踪狂吗?\x01", "真可怕啊……\x02", ) ) CloseMessageWindow() #C0188 ChrTalk( 0xFE, ( "不过我没有见过呢。\x01", "我经常出门去买东西,\x01", "但是一次也没见过……\x02", ) ) CloseMessageWindow() #C0189 ChrTalk( 0x103, ( "#0200F买东西……\x01", "时间一般是上午或晚上吗?\x02", ) ) CloseMessageWindow() #C0190 ChrTalk( 0xFE, ( "嗯,是的。\x01", "我基本都是在固定的时间出门。\x02", ) ) CloseMessageWindow() #C0191 ChrTalk( 0x102, "#0105F(正好是出入人员比较多的时间段呢。)\x02", ) CloseMessageWindow() #C0192 ChrTalk( 0x101, ( "#0001F(嗯,看起来,跟踪狂\x01", " 好像不会在那种时间出现……)\x02\x03", "(似乎是个很小心谨慎的家伙啊。)\x02", ) ) CloseMessageWindow() OP_29(0x1D, 0x1, 0x6) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x4)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x5)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x6)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x7)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x8)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_37A0") #C0193 ChrTalk( 0x101, ( "#0000F好,调查就到此结束吧。\x02\x03", "先回伊莉娅小姐的房间,\x01", "整理一下目前的情报好了。\x02", ) ) CloseMessageWindow() #C0194 ChrTalk( 0x104, "#0300F好的,差不多也该拟定对策了!!\x02", ) CloseMessageWindow() ModifyEventFlags(1, 0, 0x80) OP_29(0x1D, 0x1, 0x9) label("loc_37A0") Jump("loc_37EE") label("loc_37A5") #C0195 ChrTalk( 0xFE, "跟踪狂可真是吓人啊。\x02", ) CloseMessageWindow() #C0196 ChrTalk( 0xFE, ( "虽然我在出门买东西的时候\x01", "从没有看到过……\x02", ) ) CloseMessageWindow() label("loc_37EE") Jump("loc_4220") label("loc_37F3") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xE0, 0)), scpexpr(EXPR_END)), "loc_3846") #C0197 ChrTalk( 0xFE, "今天给他泡杯红茶好了。\x02", ) CloseMessageWindow() #C0198 ChrTalk( 0xFE, ( "喝杯红茶,\x01", "也许就能稍微放松一点吧。\x02", ) ) CloseMessageWindow() Jump("loc_4220") label("loc_3846") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC3, 6)), scpexpr(EXPR_END)), "loc_3932") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_38EE") #C0199 ChrTalk( 0xFE, ( "新市政厅大楼的预算\x01", "最后似乎还是没能通过。\x02", ) ) CloseMessageWindow() #C0200 ChrTalk( 0xFE, ( "在议员的听证会上,\x01", "被他们批评为\x01", "这项工程太过铺张浪费……\x02", ) ) CloseMessageWindow() #C0201 ChrTalk( 0xFE, "我老公为此发了很大的火呢。\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 2) Jump("loc_392D") label("loc_38EE") #C0202 ChrTalk( 0xFE, ( "这可真令人困扰啊……\x01", "我老公是那种对工作毫不懈怠的类型……\x02", ) ) CloseMessageWindow() label("loc_392D") Jump("loc_4220") label("loc_3932") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC2, 2)), scpexpr(EXPR_END)), "loc_3940") Jump("loc_4220") label("loc_3940") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_END)), "loc_3989") #C0203 ChrTalk( 0xFE, ( "最近接到了\x01", "很多的设计工作。\x02", ) ) CloseMessageWindow() #C0204 ChrTalk( 0xFE, "整理文件也挺累人呢。\x02", ) CloseMessageWindow() Jump("loc_4220") label("loc_3989") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_3A4E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_39EE") #C0205 ChrTalk( 0xFE, ( "我老公最近\x01", "工作非常繁忙。\x02", ) ) CloseMessageWindow() #C0206 ChrTalk( 0xFE, ( "……都不太跟我说话了,\x01", "真有点寂寞呢。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 2) Jump("loc_3A49") label("loc_39EE") #C0207 ChrTalk( 0xFE, "哎呀,不应该在意这种事情啦。\x02", ) CloseMessageWindow() #C0208 ChrTalk( 0xFE, ( "为了能让他顺利工作,\x01", "我得去给他沏上一杯温热的红茶。\x02", ) ) CloseMessageWindow() label("loc_3A49") Jump("loc_4220") label("loc_3A4E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA3, 3)), scpexpr(EXPR_END)), "loc_3AA0") #C0209 ChrTalk( 0xFE, ( "今晚我准备做\x01", "一顿丰盛的大餐。\x02", ) ) CloseMessageWindow() #C0210 ChrTalk( 0xFE, ( "呵呵,不好好\x01", "准备可不行呀。\x02", ) ) CloseMessageWindow() Jump("loc_4220") label("loc_3AA0") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 6)), scpexpr(EXPR_END)), "loc_3B36") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_3AF1") #C0211 ChrTalk( 0xFE, "矮个子的男孩吗……?\x02", ) CloseMessageWindow() #C0212 ChrTalk( 0xFE, "嗯,我没什么印象呢……\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 2) Jump("loc_3B31") label("loc_3AF1") #C0213 ChrTalk( 0xFE, ( "我们也去看了\x01", "游行……\x02", ) ) CloseMessageWindow() #C0214 ChrTalk( 0xFE, ( "不好意思,现在\x01", "一点印象也没有。\x02", ) ) CloseMessageWindow() label("loc_3B31") Jump("loc_4220") label("loc_3B36") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xAA, 2)), scpexpr(EXPR_END)), "loc_3B83") #C0215 ChrTalk( 0xFE, ( "呵呵,今年的游行活动\x01", "真是太棒了。\x02", ) ) CloseMessageWindow() #C0216 ChrTalk( 0xFE, "留下了美好的回忆。\x02", ) CloseMessageWindow() Jump("loc_4220") label("loc_3B83") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 4)), scpexpr(EXPR_END)), "loc_3C04") OP_4B(0x9, 0xFF) TurnDirection(0xB, 0x9, 0) #C0217 ChrTalk( 0x9, "咳咳,也该走了。\x02", ) CloseMessageWindow() #C0218 ChrTalk( 0x9, ( "要是不去看游行的话,\x01", "跟客户们的话题也会减少的。\x02", ) ) CloseMessageWindow() #C0219 ChrTalk( 0xFE, ( "呵呵……\x01", "嗯,走吧。\x02", ) ) CloseMessageWindow() OP_4C(0x9, 0xFF) Jump("loc_4220") label("loc_3C04") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 2)), scpexpr(EXPR_END)), "loc_3C67") #C0220 ChrTalk( 0xFE, "我老公就是这种一心工作的人。\x02", ) CloseMessageWindow() #C0221 ChrTalk( 0xFE, ( "我倒是不在乎啦,\x01", "只是希望他偶尔也能休息一下。\x02", ) ) CloseMessageWindow() Jump("loc_4220") label("loc_3C67") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 0)), scpexpr(EXPR_END)), "loc_3CBE") #C0222 ChrTalk( 0xFE, ( "哎呀,欢迎光临。\x01", "这里是金德尔设计事务所。\x02", ) ) CloseMessageWindow() #C0223 ChrTalk( 0xFE, "今天我们也照常营业。\x02", ) CloseMessageWindow() Jump("loc_4220") label("loc_3CBE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_3CCC") Jump("loc_4220") label("loc_3CCC") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x82, 0)), scpexpr(EXPR_END)), "loc_3DCD") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_3D7D") #C0224 ChrTalk( 0xFE, ( "IBC集团的建筑公司\x01", "是我们这里的熟客。\x02", ) ) CloseMessageWindow() #C0225 ChrTalk( 0xFE, ( "工地的负责人\x01", "来拜访过很多次,\x01", "跟我老公的关系不错呢。\x02", ) ) CloseMessageWindow() #C0226 ChrTalk( 0xFE, ( "不过每次都会喝酒,\x01", "真让人担心他的身体啊。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 2) Jump("loc_3DC8") label("loc_3D7D") #C0227 ChrTalk( 0xFE, ( "建筑公司的人总是\x01", "拉我老公一起喝酒。\x02", ) ) CloseMessageWindow() #C0228 ChrTalk( 0xFE, "希望他能多注意自己的身体呢。\x02", ) CloseMessageWindow() label("loc_3DC8") Jump("loc_4220") label("loc_3DCD") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 7)), scpexpr(EXPR_END)), "loc_3E23") #C0229 ChrTalk( 0xFE, ( "今天打算做老公\x01", "最爱吃的炖牛肉。\x02", ) ) CloseMessageWindow() #C0230 ChrTalk( 0xFE, ( "呵呵,我得赶快去\x01", "准备材料了。\x02", ) ) CloseMessageWindow() Jump("loc_4220") label("loc_3E23") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 0)), scpexpr(EXPR_END)), "loc_3E8A") #C0231 ChrTalk( 0xFE, ( "彩虹剧团的伊莉娅小姐\x01", "非常有人气呢。\x02", ) ) CloseMessageWindow() #C0232 ChrTalk( 0xFE, ( "因为萨米小姐\x01", "总是说起她,\x01", "连我都记下来了。\x02", ) ) CloseMessageWindow() Jump("loc_4220") label("loc_3E8A") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x64, 1)), scpexpr(EXPR_END)), "loc_3F65") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_3F2F") #C0233 ChrTalk( 0xFE, ( "得在老公回来之前\x01", "把室内打扫干净。\x02", ) ) CloseMessageWindow() #C0234 ChrTalk( 0xFE, ( "老公他……现在应该\x01", "正在中央广场的餐厅里\x01", "谈公事吧。\x02", ) ) CloseMessageWindow() #C0235 ChrTalk( 0xFE, ( "呵呵……这个死脑筋,\x01", "工作倒还挺忙的。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 2) Jump("loc_3F60") label("loc_3F2F") #C0236 ChrTalk( 0xFE, ( "好啦,我得趁着他不在家,\x01", "赶紧把房间收拾好。\x02", ) ) CloseMessageWindow() label("loc_3F60") Jump("loc_4220") label("loc_3F65") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x61, 1)), scpexpr(EXPR_END)), "loc_3F73") Jump("loc_4220") label("loc_3F73") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x60, 0)), scpexpr(EXPR_END)), "loc_4048") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_4008") #C0237 ChrTalk( 0xFE, ( "我老公又熬了一夜呢。\x01", "一旦开始设计新建筑,\x01", "就总是这样子……\x02", ) ) CloseMessageWindow() #C0238 ChrTalk( 0xFE, ( "呵呵,真拿他没办法啊。\x01", "没办法,我给他\x01", "泡杯热红茶吧。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 2) Jump("loc_4043") label("loc_4008") #C0239 ChrTalk( 0xFE, ( "我老公非常爱喝红茶呢。\x01", "每次熬夜之后,我都会泡给他喝。\x02", ) ) CloseMessageWindow() label("loc_4043") Jump("loc_4220") label("loc_4048") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x42, 5)), scpexpr(EXPR_END)), "loc_4121") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_40D0") #C0240 ChrTalk( 0xFE, ( "我老公只要一集中精神,\x01", "就完全注意不到周围的事了。\x02", ) ) CloseMessageWindow() #C0241 ChrTalk( 0xFE, ( "有时候还会\x01", "突然大吼出声……\x01", "请千万不要放在心上。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 2) Jump("loc_411C") label("loc_40D0") #C0242 ChrTalk( 0xFE, ( "我老公只要一集中精神,\x01", "就完全注意不到周围的事了。\x01", "请千万不要放在心上。\x02", ) ) CloseMessageWindow() label("loc_411C") Jump("loc_4220") label("loc_4121") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x41, 6)), scpexpr(EXPR_END)), "loc_4220") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_41D8") OP_63(0xFE, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(1000) #C0243 ChrTalk( 0xFE, ( "啊……不好意思。\x01", "我正在做饭呢。\x02", ) ) CloseMessageWindow() #C0244 ChrTalk( 0xFE, ( "这里是金德尔设计事务所。\x01", "如果是工作方面的事情,\x01", "就请跟我老公谈吧。\x02", ) ) CloseMessageWindow() #C0245 ChrTalk( 0xFE, "他现在好像正好有空。\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 2) Jump("loc_4220") label("loc_41D8") #C0246 ChrTalk( 0xFE, ( "这里是金德尔设计事务所。\x01", "如果是工作方面的事情,\x01", "就请跟我老公谈吧。\x02", ) ) CloseMessageWindow() label("loc_4220") TalkEnd(0xFE) Return() # Function_11_34CA end def Function_12_4224(): pass label("Function_12_4224") TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x3)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_480B") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x7)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_4797") OP_4B(0xC, 0xFF) OP_4B(0xE, 0xFF) #C0247 ChrTalk( 0xC, ( "哎呀呀,还想去外面\x01", "吃午饭呢。\x02", ) ) CloseMessageWindow() #C0248 ChrTalk( 0xE, ( "但早上都已经准备好了,\x01", "这也没办法啊。\x02", ) ) CloseMessageWindow() #C0249 ChrTalk( 0xE, "你就别抱怨啦。\x02", ) CloseMessageWindow() #C0250 ChrTalk( 0x101, ( "#0003F(感觉气氛不太妙啊……)\x02\x03", "#0000F打、打扰一下。\x01", "能占用您一点时间吗?\x02", ) ) CloseMessageWindow() OP_63(0xC, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0xE, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(500) TurnDirection(0xC, 0x0, 400) TurnDirection(0xE, 0x0, 400) Sleep(300) FadeToDark(300, 0, 100) SetChrName("") #A0251 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "罗伊德等人就跟踪狂一事\x01", "向对方进行了询问。\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() #C0252 ChrTalk( 0xC, "哦?跟踪狂吗?\x02", ) CloseMessageWindow() #C0253 ChrTalk( 0xC, ( "哎呀,这可真吓人啊。\x01", "这种事情应该赶快通知警察啊。\x02", ) ) CloseMessageWindow() #C0254 ChrTalk( 0xE, ( "不过,也许还是找游击士更好吧?\x01", "因为警察很难请得动嘛。\x02", ) ) CloseMessageWindow() #C0255 ChrTalk( 0x101, ( "#0000F呃,这个……\x01", "请问您有什么印象吗?\x02", ) ) CloseMessageWindow() #C0256 ChrTalk( 0xE, "嗯,我想想……\x02", ) CloseMessageWindow() #C0257 ChrTalk( 0xE, ( "我总是坐在玄关的\x01", "沙发上休息。\x02", ) ) CloseMessageWindow() #C0258 ChrTalk( 0xE, ( "但从没见过\x01", "什么可疑的人呢,\x01", "会不会是你们搞错了啊。\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x8)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_458D") OP_63(0x0, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) OP_63(0x1, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) OP_63(0x2, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) OP_63(0x3, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(1200) #C0259 ChrTalk( 0x104, "#0305F……………………!?\x02", ) CloseMessageWindow() #C0260 ChrTalk( 0x101, ( "#0003F(从没见过犯人\x01", " 从正门进来吗……)\x02\x03", "(这到底是怎么回事……)\x02", ) ) CloseMessageWindow() Jump("loc_46C5") label("loc_458D") OP_63(0x0, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x1, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x2, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x3, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(500) #C0261 ChrTalk( 0x104, "#0305F……竟然会这样………!\x02", ) CloseMessageWindow() #C0262 ChrTalk( 0x102, ( "#0103F(从没见过犯人\x01", " 从正门进来……)\x02\x03", "(也就是说,果然是从\x01", " 那条路线潜入的吗?)\x02", ) ) CloseMessageWindow() #C0263 ChrTalk( 0x103, ( "#0200F(是指后门吧。\x01", " 可能性似乎很高。)\x02", ) ) CloseMessageWindow() #C0264 ChrTalk( 0x101, ( "#0001F(……稍后制定对策的时候,\x01", " 重点注意一下这里吧。)\x02", ) ) CloseMessageWindow() SetScenarioFlags(0xBD, 4) label("loc_46C5") OP_29(0x1D, 0x1, 0x7) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x4)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x5)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x6)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x7)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x8)"), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_4780") #C0265 ChrTalk( 0x101, ( "#0000F好,调查就到此结束吧。\x02\x03", "先回伊莉娅小姐的房间,\x01", "整理一下目前的情报好了。\x02", ) ) CloseMessageWindow() #C0266 ChrTalk( 0x104, "#0300F好的,差不多也该拟定对策了!!\x02", ) CloseMessageWindow() ModifyEventFlags(1, 0, 0x80) OP_29(0x1D, 0x1, 0x9) label("loc_4780") OP_4C(0xC, 0xFF) OP_4C(0xE, 0xFF) ClearChrFlags(0xC, 0x10) ClearChrFlags(0xE, 0x10) Jump("loc_4806") label("loc_4797") #C0267 ChrTalk( 0xFE, "呵呵,跟踪狂真是很可怕啊。\x02", ) CloseMessageWindow() #C0268 ChrTalk( 0xFE, "赶快把这件事通报给警察吧。\x02", ) CloseMessageWindow() #C0269 ChrTalk( 0x101, ( "#0001F(这个人好像\x01", " 没有任何线索呢……)\x02", ) ) CloseMessageWindow() label("loc_4806") Jump("loc_516C") label("loc_480B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xE0, 0)), scpexpr(EXPR_END)), "loc_4819") Jump("loc_516C") label("loc_4819") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC3, 6)), scpexpr(EXPR_END)), "loc_48DE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_48A8") #C0270 ChrTalk( 0xFE, ( "我在后巷的一家古董店里\x01", "找到了好东西呢。\x02", ) ) CloseMessageWindow() #C0271 ChrTalk( 0xFE, "我们的结婚纪念日马上就要到了。\x02", ) CloseMessageWindow() #C0272 ChrTalk( 0xFE, ( "呵呵,\x01", "我老伴应该会很高兴吧。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_48D9") label("loc_48A8") #C0273 ChrTalk( 0xFE, ( "我老伴的性格很刁蛮,\x01", "要讨她欢心可不容易了。\x02", ) ) CloseMessageWindow() label("loc_48D9") Jump("loc_516C") label("loc_48DE") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC2, 2)), scpexpr(EXPR_END)), "loc_49D3") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_49A5") #C0274 ChrTalk( 0xFE, ( "能过上现在这种安稳的生活,\x01", "全靠我年轻时努力工作啊。\x02", ) ) CloseMessageWindow() #C0275 ChrTalk( 0xFE, ( "多亏了议员的\x01", "退休金给得很多啊。\x02", ) ) CloseMessageWindow() #C0276 ChrTalk( 0xFE, ( "但是我老伴可固执了。\x01", "就算我说要买下那个当做礼物,\x01", "她大概也不会同意吧……\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_49CE") label("loc_49A5") #C0277 ChrTalk( 0xFE, ( "唉,真是头疼啊。\x01", "我老伴可固执了……\x02", ) ) CloseMessageWindow() label("loc_49CE") Jump("loc_516C") label("loc_49D3") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_END)), "loc_4A95") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_4A61") #C0278 ChrTalk( 0xFE, ( "我老伴不让我重新\x01", "装修房子。\x02", ) ) CloseMessageWindow() #C0279 ChrTalk( 0xFE, ( "还不都是因为她\x01", "觉得麻烦,\x01", "所以我才代为负责的吗……\x02", ) ) CloseMessageWindow() #C0280 ChrTalk( 0xFE, "真是个任性的家伙啊。\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_4A90") label("loc_4A61") #C0281 ChrTalk( 0xFE, ( "哼,我家那位不但人很懒,\x01", "而且还很任性呢。\x02", ) ) CloseMessageWindow() label("loc_4A90") Jump("loc_516C") label("loc_4A95") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_4B75") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_4B14") TurnDirection(0xFE, 0x153, 0) #C0282 ChrTalk( 0xFE, "哎呀,真是个可爱的小姑娘啊。\x02", ) CloseMessageWindow() #C0283 ChrTalk( 0xFE, ( "刚搬到西街的吗?\x01", "算啦,总而言之,随时都可以过来玩哦。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_4B70") label("loc_4B14") #C0284 ChrTalk( 0xFE, ( "我又改换了一下\x01", "家里的装饰。\x02", ) ) CloseMessageWindow() #C0285 ChrTalk( 0xFE, ( "嗯,统一换成了明亮的颜色,\x01", "和纪念庆典的气氛很相配吧?\x02", ) ) CloseMessageWindow() label("loc_4B70") Jump("loc_516C") label("loc_4B75") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA3, 3)), scpexpr(EXPR_END)), "loc_4B83") Jump("loc_516C") label("loc_4B83") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xAA, 2)), scpexpr(EXPR_END)), "loc_4B91") Jump("loc_516C") label("loc_4B91") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 4)), scpexpr(EXPR_END)), "loc_4B9F") Jump("loc_516C") label("loc_4B9F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 2)), scpexpr(EXPR_END)), "loc_4BAD") Jump("loc_516C") label("loc_4BAD") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 0)), scpexpr(EXPR_END)), "loc_4BBB") Jump("loc_516C") label("loc_4BBB") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_4BC9") Jump("loc_516C") label("loc_4BC9") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x82, 0)), scpexpr(EXPR_END)), "loc_4C48") #C0286 ChrTalk( 0xFE, ( "好了,房间也收拾得差不多了……\x01", "泡杯茶好了。\x02", ) ) CloseMessageWindow() #C0287 ChrTalk( 0xFE, ( "我老伴整天沉迷于自己的爱好。\x01", "这些事情也只能\x01", "由我来负责了。\x02", ) ) CloseMessageWindow() Jump("loc_516C") label("loc_4C48") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 7)), scpexpr(EXPR_END)), "loc_4CA7") #C0288 ChrTalk( 0xFE, ( "打扫壁橱的时候,\x01", "东西全都掉下来了……\x02", ) ) CloseMessageWindow() #C0289 ChrTalk( 0xFE, "哎呀呀,过后收拾起来会很辛苦呢。\x02", ) CloseMessageWindow() Jump("loc_516C") label("loc_4CA7") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 0)), scpexpr(EXPR_END)), "loc_4D6E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_4D23") #C0290 ChrTalk( 0xFE, ( "纪念庆典就快到了,\x01", "每天心情都很好呢……\x02", ) ) CloseMessageWindow() #C0291 ChrTalk( 0xFE, ( "这气氛让我也坐不住了,\x01", "去买张新地毯\x01", "铺上好了。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_4D69") label("loc_4D23") #C0292 ChrTalk( 0xFE, ( "纪念庆典一来,\x01", "我也想换个心情呢。\x02", ) ) CloseMessageWindow() #C0293 ChrTalk( 0xFE, ( "打扫打扫房间\x01", "也挺不错的。\x02", ) ) CloseMessageWindow() label("loc_4D69") Jump("loc_516C") label("loc_4D6E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x64, 1)), scpexpr(EXPR_END)), "loc_4E7F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_4E06") #C0294 ChrTalk( 0xFE, ( "我在调整家具摆放时,\x01", "发现炉子上生了锈。\x02", ) ) CloseMessageWindow() #C0295 ChrTalk( 0xFE, ( "所以就按照原来的尺寸,\x01", "换了个新炉子。\x02", ) ) CloseMessageWindow() #C0296 ChrTalk( 0xFE, ( "正好有大小合适的,\x01", "真是太好了。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_4E7A") label("loc_4E06") #C0297 ChrTalk( 0xFE, ( "而且……我听店员说,\x01", "这种新型炉子的火力要比以前的强很多。\x02", ) ) CloseMessageWindow() #C0298 ChrTalk( 0xFE, ( "而且也没有令人心烦的锈迹了。\x01", "呵呵,真是太好了。\x02", ) ) CloseMessageWindow() label("loc_4E7A") Jump("loc_516C") label("loc_4E7F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x61, 1)), scpexpr(EXPR_END)), "loc_4F2B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_4EED") #C0299 ChrTalk( 0xFE, ( "桌子现在没有摆在\x01", "屋子的正中间。\x02", ) ) CloseMessageWindow() #C0300 ChrTalk( 0xFE, ( "这可不行……\x01", "我得重新再\x01", "好好量一下尺寸。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_4F26") label("loc_4EED") #C0301 ChrTalk( 0xFE, ( "桌子现在的位置让我不太舒服。\x01", "我得把它稍微移动一下。\x02", ) ) CloseMessageWindow() label("loc_4F26") Jump("loc_516C") label("loc_4F2B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x60, 0)), scpexpr(EXPR_END)), "loc_4FF2") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_4FAA") #C0302 ChrTalk( 0xFE, "噢噢,今天早上是个大晴天。\x02", ) CloseMessageWindow() #C0303 ChrTalk( 0xFE, ( "下次自治州议会上的讨论,\x01", "若也能像这天空一样爽朗,\x01", "该有多好啊。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_4FED") label("loc_4FAA") #C0304 ChrTalk( 0xFE, "好了,该给植物浇浇水了。\x02", ) CloseMessageWindow() #C0305 ChrTalk( 0xFE, ( "我老伴对这些东西\x01", "一点也不用心。\x02", ) ) CloseMessageWindow() label("loc_4FED") Jump("loc_516C") label("loc_4FF2") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x42, 5)), scpexpr(EXPR_END)), "loc_50C0") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5076") #C0306 ChrTalk( 0xFE, ( "老伴从早到晚,\x01", "一直在做她喜欢的手工。\x01", "一点也不干家务。\x02", ) ) CloseMessageWindow() #C0307 ChrTalk( 0xFE, ( "哎呀哎呀,这样的老伴\x01", "真是让人发愁啊……\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_50BB") label("loc_5076") #C0308 ChrTalk( 0xFE, ( "我老伴整天\x01", "沉迷于自己的兴趣。\x02", ) ) CloseMessageWindow() #C0309 ChrTalk( 0xFE, "她从以前开始就一直这么任性。\x02", ) CloseMessageWindow() label("loc_50BB") Jump("loc_516C") label("loc_50C0") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x41, 6)), scpexpr(EXPR_END)), "loc_516C") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5126") #C0310 ChrTalk( 0xFE, ( "嗯,为了转换心情,\x01", "我新买了些高级家具。\x02", ) ) CloseMessageWindow() #C0311 ChrTalk( 0xFE, "摆设差不多就这个样子吧。\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 3) Jump("loc_516C") label("loc_5126") #C0312 ChrTalk( 0xFE, ( "我刚把屋里的装潢\x01", "重新更换了一下。\x02", ) ) CloseMessageWindow() #C0313 ChrTalk( 0xFE, ( "一起来喝杯茶吗?\x01", "呵呵……\x02", ) ) CloseMessageWindow() label("loc_516C") TalkEnd(0xFE) Return() # Function_12_4224 end def Function_13_5170(): pass label("Function_13_5170") OP_52(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_52(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_52(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_52(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_52(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_5204") Jump("loc_524E") label("loc_5204") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_5224") OP_52(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_524E") label("loc_5224") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_5244") OP_52(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_524E") label("loc_5244") OP_52(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_524E") OP_52(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_52(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_52(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_52F5") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_528E") Call(0, 14) Jump("loc_52F5") label("loc_528E") #C0314 ChrTalk( 0xFE, ( "能像这样过上\x01", "宽裕的日子,\x01", "全都是因为有我的退休金……\x02", ) ) CloseMessageWindow() #C0315 ChrTalk( 0xFE, ( "老伴啊,难道你\x01", "已经忘记这一点了吗……?\x02", ) ) CloseMessageWindow() label("loc_52F5") SetChrSubChip(0xFE, 0x0) TalkEnd(0xFE) Return() # Function_13_5170 end def Function_14_52FD(): pass label("Function_14_52FD") SetChrSubChip(0xD, 0x0) SetChrSubChip(0xF, 0x0) #C0316 ChrTalk( 0xF, ( "……我说你啊,\x01", "你知道该怎么泡红茶吗?\x02", ) ) CloseMessageWindow() #C0317 ChrTalk( 0xD, ( "不就是把热水浇到茶叶上吗?\x01", "你看,这不是泡好了吗。\x02", ) ) CloseMessageWindow() #C0318 ChrTalk( 0xF, ( "太难喝了,\x01", "这种东西怎么能喝得下去啊。\x02", ) ) CloseMessageWindow() #C0319 ChrTalk( 0xD, "…………………………………\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 3) SetScenarioFlags(0x0, 4) Return() # Function_14_52FD end def Function_15_53B9(): pass label("Function_15_53B9") TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x3)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_5559") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x7)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_53F0") Call(0, 12) Return() label("loc_53F0") #C0320 ChrTalk( 0xFE, ( "我总是坐在玄关的\x01", "沙发上休息。\x02", ) ) CloseMessageWindow() #C0321 ChrTalk( 0xFE, ( "但从没见过什么\x01", "可疑的人呢,\x01", "会不会是你们搞错了啊。\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x8)"), scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xBD, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_5554") #C0322 ChrTalk( 0x104, "#0303F(……原来如此,真有一套啊。)\x02", ) CloseMessageWindow() #C0323 ChrTalk( 0x102, ( "#0100F(从没见过跟踪狂\x01", " 从玄关进来……)\x02\x03", "(也就是说,果然是从\x01", " 那条路线进来的吗?)\x02", ) ) CloseMessageWindow() #C0324 ChrTalk( 0x103, ( "#0200F(是指后门吧。\x01", " 很有可能呢。)\x02", ) ) CloseMessageWindow() #C0325 ChrTalk( 0x101, ( "#0001F(…………稍后制定对策的时候,\x01", " 重点注意一下这里吧。)\x02", ) ) CloseMessageWindow() SetScenarioFlags(0xBD, 4) label("loc_5554") Jump("loc_567C") label("loc_5559") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x60, 0)), scpexpr(EXPR_END)), "loc_5665") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5615") #C0326 ChrTalk( 0xFE, ( "我老伴直到五年前,\x01", "都是个议员。\x02", ) ) CloseMessageWindow() #C0327 ChrTalk( 0xFE, ( "虽然他只是个呆呆地\x01", "听着其他议员发表意见,\x01", "自己没什么主见的议员而已。\x02", ) ) CloseMessageWindow() #C0328 ChrTalk( 0xFE, ( "不过呢……\x01", "退休金倒是不少,\x01", "这点值得表扬呢。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_5660") label("loc_5615") #C0329 ChrTalk( 0xFE, ( "我老伴也就是个凑数的议员,\x01", "好在退休金挺多。\x02", ) ) CloseMessageWindow() #C0330 ChrTalk( 0xFE, "也就这点还值得表扬。\x02", ) CloseMessageWindow() label("loc_5660") Jump("loc_567C") label("loc_5665") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x42, 5)), scpexpr(EXPR_END)), "loc_5673") Jump("loc_567C") label("loc_5673") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x41, 6)), scpexpr(EXPR_END)), "loc_567C") label("loc_567C") TalkEnd(0xFE) Return() # Function_15_53B9 end def Function_16_5680(): pass label("Function_16_5680") OP_52(0x0, 0x5, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x4), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_52(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_52(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_52(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_52(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_5714") Jump("loc_575E") label("loc_5714") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_LSS), scpexpr(EXPR_END)), "loc_5734") OP_52(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_575E") label("loc_5734") Jc((scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_PUSH_LONG, 0x2), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_5754") OP_52(0xFE, 0x8, (scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Jump("loc_575E") label("loc_5754") OP_52(0xFE, 0x8, (scpexpr(EXPR_GET_CHR_WORK, 0xFE, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) label("loc_575E") OP_52(0xFE, 0x4, (scpexpr(EXPR_GET_CHR_WORK, 0x0, 0x5), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_52(0x0, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_52(0xFE, 0x5, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetChrFlags(0xFE, 0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xE0, 0)), scpexpr(EXPR_END)), "loc_5844") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_580A") #C0331 ChrTalk( 0xFE, ( "我老伴\x01", "买了部导力车……\x02", ) ) CloseMessageWindow() #C0332 ChrTalk( 0xFE, "又瞒着我乱花钱……!\x02", ) CloseMessageWindow() #C0333 ChrTalk( 0xFE, ( "真是自作主张啊,\x01", "我都不知道该说他什么好了……!\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_583F") label("loc_580A") #C0334 ChrTalk( 0xFE, ( "我都不知道要怎么说他\x01", "那铺张浪费的坏习惯了……!\x02", ) ) CloseMessageWindow() label("loc_583F") Jump("loc_6214") label("loc_5844") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC3, 6)), scpexpr(EXPR_END)), "loc_5954") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_58F9") #C0335 ChrTalk( 0xFE, ( "我老伴为了庆祝结婚纪念日,\x01", "送给我一个吊坠呢。\x02", ) ) CloseMessageWindow() #C0336 ChrTalk( 0xFE, "…………………………………\x02", ) CloseMessageWindow() #C0337 ChrTalk( 0xFE, ( "呼,那个人也是\x01", "有些优点的啊。\x02", ) ) CloseMessageWindow() #C0338 ChrTalk( 0xFE, "再怎么说,也是我看中的男人啊。\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_594F") label("loc_58F9") #C0339 ChrTalk( 0xFE, ( "当年啊,\x01", "他还真是个不错的好青年呢。\x02", ) ) CloseMessageWindow() #C0340 ChrTalk( 0xFE, ( "呵呵,现在似乎也能\x01", "看到一点当年的影子。\x02", ) ) CloseMessageWindow() label("loc_594F") Jump("loc_6214") label("loc_5954") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC2, 2)), scpexpr(EXPR_END)), "loc_59F4") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_59C0") #C0341 ChrTalk( 0xFE, ( "我老伴又想给家里\x01", "添置大件呢。\x02", ) ) CloseMessageWindow() #C0342 ChrTalk( 0xFE, ( "真是的……\x01", "这次又准备\x01", "买个吊灯回来吗……\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_59EF") label("loc_59C0") #C0343 ChrTalk( 0xFE, ( "我真受不了他那\x01", "喜欢装饰房间的无聊癖好啊。\x02", ) ) CloseMessageWindow() label("loc_59EF") Jump("loc_6214") label("loc_59F4") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xC0, 0)), scpexpr(EXPR_END)), "loc_5AE4") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5AA6") #C0344 ChrTalk( 0xFE, ( "自治州议会的会期\x01", "似乎又要拖延下去了。\x02", ) ) CloseMessageWindow() #C0345 ChrTalk( 0xFE, ( "……跟我老伴还是议员的时候相比,\x01", "真是没有一点变化啊。\x02", ) ) CloseMessageWindow() #C0346 ChrTalk( 0xFE, ( "就会给人们添麻烦,\x01", "总是发表一些任性的主张。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_5ADF") label("loc_5AA6") #C0347 ChrTalk( 0xFE, ( "我老伴现在会是这种性格,\x01", "肯定也是因为议员当太久了。\x02", ) ) CloseMessageWindow() label("loc_5ADF") Jump("loc_6214") label("loc_5AE4") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_5BE7") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5B94") #C0348 ChrTalk( 0xFE, ( "在克洛斯贝尔的上流社会里,\x01", "有不少人都爱好手工。\x02", ) ) CloseMessageWindow() #C0349 ChrTalk( 0xFE, ( "麦克道尔市长的夫人\x01", "生前也十分擅长做手工呢。\x02", ) ) CloseMessageWindow() #C0350 ChrTalk( 0xFE, ( "我会有这种爱好,\x01", "可能也是受了她的影响吧。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_5BE2") label("loc_5B94") #C0351 ChrTalk( 0xFE, ( "麦克道尔市长的夫人\x01", "生前特别擅长做手工。\x02", ) ) CloseMessageWindow() #C0352 ChrTalk( 0xFE, ( "不过她已经\x01", "过世很长时间了。\x02", ) ) CloseMessageWindow() label("loc_5BE2") Jump("loc_6214") label("loc_5BE7") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA3, 3)), scpexpr(EXPR_END)), "loc_5BF5") Jump("loc_6214") label("loc_5BF5") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xAA, 2)), scpexpr(EXPR_END)), "loc_5C03") Jump("loc_6214") label("loc_5C03") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA1, 4)), scpexpr(EXPR_END)), "loc_5C11") Jump("loc_6214") label("loc_5C11") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 2)), scpexpr(EXPR_END)), "loc_5C1F") Jump("loc_6214") label("loc_5C1F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 0)), scpexpr(EXPR_END)), "loc_5C2D") Jump("loc_6214") label("loc_5C2D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_5C9F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5C48") Call(0, 14) Jump("loc_5C9A") label("loc_5C48") #C0353 ChrTalk( 0xFE, ( "连泡红茶的方法\x01", "也搞不太清楚。\x02", ) ) CloseMessageWindow() #C0354 ChrTalk( 0xFE, ( "明明都不太会做家务,\x01", "还真是很有积极性啊。\x02", ) ) CloseMessageWindow() label("loc_5C9A") Jump("loc_6214") label("loc_5C9F") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x82, 0)), scpexpr(EXPR_END)), "loc_5D80") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5D2D") #C0355 ChrTalk( 0xFE, ( "今天早上\x01", "有几个男人走进来。\x02", ) ) CloseMessageWindow() #C0356 ChrTalk( 0xFE, ( "也不说话,\x01", "直接就上了三楼……\x02", ) ) CloseMessageWindow() #C0357 ChrTalk( 0xFE, ( "感觉不像是普通人啊,\x01", "到底是来干什么的呢?\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_5D7B") label("loc_5D2D") #C0358 ChrTalk( 0xFE, ( "那些男人啊,\x01", "根本就不像是要来\x01", "公寓找朋友玩的样子。\x02", ) ) CloseMessageWindow() #C0359 ChrTalk( 0xFE, "到底是什么人啊?\x02", ) CloseMessageWindow() label("loc_5D7B") Jump("loc_6214") label("loc_5D80") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 7)), scpexpr(EXPR_END)), "loc_5E50") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5E16") #C0360 ChrTalk( 0xFE, ( "我老伴又\x01", "做了些多余的事……\x02", ) ) CloseMessageWindow() #C0361 ChrTalk( 0xFE, ( "扫除这种事,\x01", "只要拜托萨米就好了嘛。\x02", ) ) CloseMessageWindow() #C0362 ChrTalk( 0xFE, ( "哼,就是因为做了不擅长的事,\x01", "才会搞成这样。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_5E4B") label("loc_5E16") #C0363 ChrTalk( 0xFE, ( "他总是做这些多余的事,\x01", "我真不知道该说什么才好。\x02", ) ) CloseMessageWindow() label("loc_5E4B") Jump("loc_6214") label("loc_5E50") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x80, 0)), scpexpr(EXPR_END)), "loc_5F3C") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_5EE1") #C0364 ChrTalk( 0xFE, ( "我啊,每年在纪念庆典的时候,\x01", "都会制作杯垫呢。\x02", ) ) CloseMessageWindow() #C0365 ChrTalk( 0xFE, "到今年也有二十年了。\x02", ) CloseMessageWindow() #C0366 ChrTalk( 0xFE, ( "没想到能坚持这么久,\x01", "真令人感慨啊。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_5F37") label("loc_5EE1") #C0367 ChrTalk( 0xFE, ( "克洛斯贝尔到今年\x01", "也已经是七十周岁了啊。\x02", ) ) CloseMessageWindow() #C0368 ChrTalk( 0xFE, ( "年纪是越来越大了啊……\x01", "真令人感慨。\x02", ) ) CloseMessageWindow() label("loc_5F37") Jump("loc_6214") label("loc_5F3C") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x64, 1)), scpexpr(EXPR_END)), "loc_5FA9") #C0369 ChrTalk( 0xFE, ( "我老伴在导力商店\x01", "买了新的导力炉回来。\x02", ) ) CloseMessageWindow() #C0370 ChrTalk( 0xFE, "又背着我乱花钱……\x02", ) CloseMessageWindow() #C0371 ChrTalk( 0xFE, "就不会干点别的事了吗?\x02", ) CloseMessageWindow() Jump("loc_6214") label("loc_5FA9") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x61, 1)), scpexpr(EXPR_END)), "loc_602E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_600A") #C0372 ChrTalk( 0xFE, ( "哎呀呀……\x01", "我老伴的坏毛病又发作了。\x02", ) ) CloseMessageWindow() #C0373 ChrTalk( 0xFE, ( "这下子\x01", "也没法做饭了啊。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_6029") label("loc_600A") #C0374 ChrTalk( 0xFE, ( "唉,今天也\x01", "到外面吃算了。\x02", ) ) CloseMessageWindow() label("loc_6029") Jump("loc_6214") label("loc_602E") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x60, 0)), scpexpr(EXPR_END)), "loc_603C") Jump("loc_6214") label("loc_603C") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x42, 5)), scpexpr(EXPR_END)), "loc_6130") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_60E3") #C0375 ChrTalk( 0xFE, ( "这间公寓啊,\x01", "可以让管理员\x01", "来帮忙打扫房间的。\x02", ) ) CloseMessageWindow() #C0376 ChrTalk( 0xFE, ( "我们家也拜托萨米\x01", "帮忙打扫房间和洗衣服。\x02", ) ) CloseMessageWindow() #C0377 ChrTalk( 0xFE, ( "这么一来,\x01", "我就有时间做自己想做的事了。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_612B") label("loc_60E3") #C0378 ChrTalk( 0xFE, ( "近些日子啊,\x01", "买东西也能送货上门了……\x01", "生活真是变得越来越便利了啊。\x02", ) ) CloseMessageWindow() label("loc_612B") Jump("loc_6214") label("loc_6130") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x41, 6)), scpexpr(EXPR_END)), "loc_6214") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_61C0") #C0379 ChrTalk( 0xFE, ( "我老伴又开始\x01", "折腾屋里的装潢了。\x02", ) ) CloseMessageWindow() #C0380 ChrTalk( 0xFE, ( "每到这时候,\x01", "就把我赶到屋子外面……\x02", ) ) CloseMessageWindow() #C0381 ChrTalk( 0xFE, ( "真是的,我都没办法\x01", "安心做手工了。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 4) Jump("loc_6214") label("loc_61C0") #C0382 ChrTalk( 0xFE, ( "我老伴退休以后,\x01", "好像闲得不行呢。\x02", ) ) CloseMessageWindow() #C0383 ChrTalk( 0xFE, ( "他那些浪费米拉的爱好,\x01", "真是令人头疼啊。\x02", ) ) CloseMessageWindow() label("loc_6214") SetChrSubChip(0xFE, 0x0) TalkEnd(0xFE) Return() # Function_16_5680 end def Function_17_621C(): pass label("Function_17_621C") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x8F, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_638D") #C0384 ChrTalk( 0xFE, ( "嗯,你们就是达德利\x01", "提过的那群家伙吗……\x02", ) ) CloseMessageWindow() #C0385 ChrTalk( 0xFE, ( "……你们妨碍了保安工作,\x01", "请赶快离开。\x02", ) ) CloseMessageWindow() OP_63(0x0, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x1, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x2, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x3, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(1000) #C0386 ChrTalk( 0x101, "#0005F哎……?\x02", ) CloseMessageWindow() #C0387 ChrTalk( 0xFE, ( "……这里是\x01", "伊莉娅·普拉提耶的家。\x02", ) ) CloseMessageWindow() #C0388 ChrTalk( 0xFE, ( "她的个人安全\x01", "由我们一科来保护。\x02", ) ) CloseMessageWindow() #C0389 ChrTalk( 0x104, ( "#0305F(搜查一科……\x01", " 这么快就开始行动了吗?)\x02", ) ) CloseMessageWindow() #C0390 ChrTalk( 0x101, "#0003F(真、真是名不虚传……)\x02", ) CloseMessageWindow() SetScenarioFlags(0x8F, 1) Jump("loc_64B4") label("loc_638D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 0)), scpexpr(EXPR_END)), "loc_639B") Jump("loc_64B4") label("loc_639B") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_6405") #C0391 ChrTalk( 0xFE, ( "……伊莉娅·普拉提耶\x01", "由我们一科来贴身保护。\x02", ) ) CloseMessageWindow() #C0392 ChrTalk( 0xFE, ( "特别任务支援科,\x01", "请不要给我们添麻烦。\x02", ) ) CloseMessageWindow() Jump("loc_64B4") label("loc_6405") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x82, 0)), scpexpr(EXPR_END)), "loc_64B4") #C0393 ChrTalk( 0xFE, ( "……从恐吓信上的内容来看,\x01", "犯人很有可能趁伊莉娅·普拉提耶\x01", "在舞台上表演时进行袭击。\x02", ) ) CloseMessageWindow() #C0394 ChrTalk( 0xFE, ( "但是,这并不意味着其它时候就一定安全。\x01", "一科将会进行\x01", "滴水不漏的保护工作。\x02", ) ) CloseMessageWindow() label("loc_64B4") TalkEnd(0xFE) Return() # Function_17_621C end def Function_18_64B8(): pass label("Function_18_64B8") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA0, 0)), scpexpr(EXPR_END)), "loc_64C9") Jump("loc_65D9") label("loc_64C9") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x83, 7)), scpexpr(EXPR_END)), "loc_6539") #C0395 ChrTalk( 0xFE, ( "嗯,屋外也很危险……\x01", "有可能从外面进行狙击。\x02", ) ) CloseMessageWindow() #C0396 ChrTalk( 0xFE, ( "在伊莉娅小姐回来之前,\x01", "先把周围清查一遍吧。\x02", ) ) CloseMessageWindow() Jump("loc_65D9") label("loc_6539") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x82, 0)), scpexpr(EXPR_END)), "loc_65D9") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 5)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_6585") #C0397 ChrTalk( 0xFE, "没有窃听器……\x02", ) CloseMessageWindow() #C0398 ChrTalk( 0xFE, ( "至少房间里面\x01", "是安全的。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x0, 5) Jump("loc_65D9") label("loc_6585") TurnDirection(0xFE, 0x0, 0) #C0399 ChrTalk( 0xFE, "……特别任务支援科?\x02", ) CloseMessageWindow() #C0400 ChrTalk( 0xFE, ( "哼,伊莉娅小姐就由我们\x01", "搜查一科负责贴身保护。\x02", ) ) CloseMessageWindow() label("loc_65D9") TalkEnd(0xFE) Return() # Function_18_64B8 end def Function_19_65DD(): pass label("Function_19_65DD") TalkBegin(0x12) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xA7, 6)), scpexpr(EXPR_END)), "loc_6938") OP_64(0x12) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 6)), scpexpr(EXPR_END)), "loc_66C9") #C0401 ChrTalk( 0x12, ( "呼啊……呼啊啊……\x02\x03", "嗯嗯……嗯~……!\x02", ) ) CloseMessageWindow() #C0402 ChrTalk( 0x153, ( "#1110F那么漂亮的大姐姐,\x01", "打的呼噜竟然这么响!\x02", ) ) CloseMessageWindow() #C0403 ChrTalk( 0x101, "#0006F(稍稍有点性感的感觉,真让人困扰啊……)\x02", ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "GetPartyIndex(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_66C4") #C0404 ChrTalk( 0x104, "#0309F(今天果然是个超级幸运日……!)\x02", ) CloseMessageWindow() label("loc_66C4") Jump("loc_6921") label("loc_66C9") #C0405 ChrTalk( 0x12, "呼啊……呼啊……\x02", ) CloseMessageWindow() OP_63(0x0, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) Sound(23, 0, 100, 0) OP_63(0x1, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) Sound(23, 0, 100, 0) Sleep(1000) OP_63(0x153, 0x0, 1700, 0x26, 0x27, 0xFA, 0x2) Sleep(1000) OP_64(0x153) #C0406 ChrTalk( 0x153, ( "#1110F哇……\x01", "好响的呼噜呀!\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x10)"), scpexpr(EXPR_END)), "loc_6781") #C0407 ChrTalk( 0x101, ( "#0006F房间还是\x01", "和以前一样乱……\x02", ) ) CloseMessageWindow() Jump("loc_67AA") label("loc_6781") #C0408 ChrTalk( 0x101, ( "#0006F而且,这房间\x01", "还真是好乱啊……\x02", ) ) CloseMessageWindow() label("loc_67AA") Jc((scpexpr(EXPR_EXEC_OP, "GetPartyIndex(0x1)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_67FE") #C0409 ChrTalk( 0x102, ( "#0100F和公演时舞台上那种\x01", "扣人心弦的紧张氛围完全不同呢……\x02", ) ) CloseMessageWindow() Jump("loc_691B") label("loc_67FE") Jc((scpexpr(EXPR_EXEC_OP, "GetPartyIndex(0x2)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_6846") #C0410 ChrTalk( 0x103, ( "#0200F她还是一如往常,\x01", "莫名地有些大叔气质呢。\x02", ) ) CloseMessageWindow() Jump("loc_691B") label("loc_6846") Jc((scpexpr(EXPR_EXEC_OP, "GetPartyIndex(0x3)"), scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_NEG), scpexpr(EXPR_GTR), scpexpr(EXPR_END)), "loc_691B") #C0411 ChrTalk( 0x104, ( "#0304F呵……这才是天下无敌的\x01", "伊莉娅·普拉提耶啊。\x02\x03", "#0309F没想到,竟然能亲眼看到\x01", "她的睡姿,今天真是太幸运了!\x02", ) ) CloseMessageWindow() OP_63(0x101, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) Sound(23, 0, 100, 0) Sleep(1000) #C0412 ChrTalk( 0x153, "#1111F???\x02", ) CloseMessageWindow() #C0413 ChrTalk( 0x101, "#0003F呃,琪雅听不懂也没关系的。\x02", ) CloseMessageWindow() label("loc_691B") SetScenarioFlags(0xBF, 3) SetScenarioFlags(0x0, 6) label("loc_6921") OP_63(0x12, 0x0, 2000, 0x1C, 0x21, 0xFA, 0x0) Jump("loc_6A97") label("loc_6938") OP_4B(0x15, 0xFF) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_69E7") #C0414 ChrTalk( 0x12, ( "#1700F好了,修利。\x01", "首先要教给你的是\x01", "训练的固定规矩哦。\x02\x03", "#1709F你要在早上五点以前\x01", "把我叫起来!\x02\x03", "#1705F啊……没有别的床了,一起睡吧?\x02", ) ) CloseMessageWindow() #C0415 ChrTalk( 0x15, "才不要!!\x02", ) CloseMessageWindow() SetScenarioFlags(0x0, 6) Jump("loc_6A93") label("loc_69E7") #C0416 ChrTalk( 0x15, ( "比起那个,给我讲讲关于舞台表演的事情吧,\x01", "关于那部新剧的……\x02", ) ) CloseMessageWindow() #C0417 ChrTalk( 0x12, ( "#1702F啊,舞台表演方面的事吗?\x01", "好呀,我这就和你说!\x02", ) ) CloseMessageWindow() OP_63(0x15, 0x0, 2000, 0x28, 0x2B, 0x64, 0x3) #C0418 ChrTalk( 0x15, "………………!(拼命点头)\x02", ) CloseMessageWindow() label("loc_6A93") OP_4C(0x15, 0xFF) label("loc_6A97") TalkEnd(0x12) Return() # Function_19_65DD end def Function_20_6A9B(): pass label("Function_20_6A9B") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0xB8, 4)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_6C20") #C0419 ChrTalk( 0x14, ( "#1802F各位,今天\x01", "真是给你们添麻烦了……\x02\x03", "#1809F非常感谢大家。\x01", "能圆满收场,真是太好了。\x02", ) ) CloseMessageWindow() #C0420 ChrTalk( 0x102, ( "#0109F我们也没想到\x01", "事情的发展会是这样。\x02", ) ) CloseMessageWindow() #C0421 ChrTalk( 0x14, ( "#1804F是啊……\x02\x03", "#1810F……我也有点理解\x01", "那孩子的心情。\x02\x03", "我在遇到伊莉娅小姐之前,\x01", "也曾经迷失了方向……\x02", ) ) CloseMessageWindow() #C0422 ChrTalk( 0x101, "#0005F莉夏……?\x02", ) CloseMessageWindow() #C0423 ChrTalk( 0x14, ( "#1804F啊,不……\x01", "没什么。\x02\x03", "#1802F修利和伊莉娅小姐\x01", "似乎住在一起了。\x01", "以后有空时,请再来探望她们吧。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0xB8, 4) Jump("loc_6D05") label("loc_6C20") #C0424 ChrTalk( 0x14, ( "#1808F修利似乎也\x01", "经历了不少事情,\x01", "也许没那么容易就能相处融洽。\x02\x03", "#1802F不过,我也会一起帮忙……\x01", "肯定没问题的。\x02", ) ) CloseMessageWindow() Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 7)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_6D02") #C0425 ChrTalk( 0x101, ( "#0000F是吗……\x01", "那么她们两个人\x01", "就拜托你啦,莉夏。\x02", ) ) CloseMessageWindow() OP_63(0x14, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(500) #C0426 ChrTalk( 0x14, "#1809F嗯,交给我吧!\x02", ) CloseMessageWindow() label("loc_6D02") SetScenarioFlags(0x0, 7) label("loc_6D05") TalkEnd(0xFE) Return() # Function_20_6A9B end def Function_21_6D09(): pass label("Function_21_6D09") TalkBegin(0xFE) Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0xC)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_6EB0") #C0427 ChrTalk( 0x101, ( "#0002F看起来,\x01", "情况好像还挺顺利的啊。\x02", ) ) CloseMessageWindow() #C0428 ChrTalk( 0xFE, "哼,也没什么……\x02", ) CloseMessageWindow() #C0429 ChrTalk( 0xFE, ( "就是说了些话嘛。\x01", "和演出有关的事,我都很感兴趣。\x01", "……光听就觉得很有趣了。\x02", ) ) CloseMessageWindow() #C0430 ChrTalk( 0x102, ( "#0100F(果然对表演\x01", " 很有兴趣啊。)\x02", ) ) CloseMessageWindow() #C0431 ChrTalk( 0x104, ( "#0304F(这不是也挺像个\x01", " 女孩子的嘛。)\x02", ) ) CloseMessageWindow() #C0432 ChrTalk( 0x103, "#0202F(是啊。)\x02", ) CloseMessageWindow() #C0433 ChrTalk( 0xFE, "啊,还有……\x02", ) CloseMessageWindow() TurnDirection(0x15, 0x101, 500) #C0434 ChrTalk( 0xFE, ( "你叫罗伊德吧?\x01", "给我记住了。\x02", ) ) CloseMessageWindow() #C0435 ChrTalk( 0xFE, ( "我绝对不会\x01", "忘记那次的仇恨!\x02", ) ) CloseMessageWindow() #C0436 ChrTalk( 0x101, ( "#0012F唔……那件事啊。\x01", "(真希望她能忘掉啊……)\x02", ) ) CloseMessageWindow() OP_29(0x1D, 0x1, 0xC) Jump("loc_6F21") label("loc_6EB0") #C0437 ChrTalk( 0xFE, ( "伊莉娅……小姐,\x01", "讲的事情都特别有趣。\x01", "光是听听,都觉得十分兴奋……\x02", ) ) CloseMessageWindow() #C0438 ChrTalk( 0xFE, ( "……不过她平时是个\x01", "特别邋遢的人呢。\x02", ) ) CloseMessageWindow() label("loc_6F21") TalkEnd(0xFE) Return() # Function_21_6D09 end def Function_22_6F25(): pass label("Function_22_6F25") EventBegin(0x0) Sound(103, 0, 100, 0) FadeToDark(0, 0, -1) OP_0D() OP_68(-170, 1280, 390, 0) MoveCamera(45, 21, 0, 0) OP_6E(400, 0) SetCameraDistance(22000, 0) SetChrPos(0x101, -600, 0, 150, 0) SetChrPos(0x102, 600, 0, 150, 0) SetChrPos(0x103, -600, 0, -1500, 0) SetChrPos(0x104, 600, 0, -1500, 0) def lambda_6FAF(): OP_9B(0x0, 0xFE, 0x0, 0x7D0, 0x4B0, 0x0) ExitThread() QueueWorkItem(0x0, 1, lambda_6FAF) def lambda_6FC4(): OP_9B(0x0, 0xFE, 0x0, 0x7D0, 0x4B0, 0x0) ExitThread() QueueWorkItem(0x1, 1, lambda_6FC4) def lambda_6FD9(): OP_9B(0x0, 0xFE, 0x0, 0x7D0, 0x4B0, 0x0) ExitThread() QueueWorkItem(0x2, 1, lambda_6FD9) def lambda_6FEE(): OP_9B(0x0, 0xFE, 0x0, 0x7D0, 0x4B0, 0x0) ExitThread() QueueWorkItem(0x3, 1, lambda_6FEE) OP_68(50, 1280, 1520, 2000) FadeToBright(1000, 0) OP_0D() Sleep(2000) #C0439 ChrTalk( 0x101, ( "#5P#0005F『雷森别墅』的\x01", "顶层……\x02", ) ) CloseMessageWindow() OP_5A() OP_68(1520, 11280, 18040, 3000) MoveCamera(45, 16, 0, 3000) Sleep(3200) #C0440 ChrTalk( 0x101, ( "#0000F那里就是伊莉娅小姐\x01", "的房间吧。\x02", ) ) CloseMessageWindow() OP_5A() Fade(500) OP_68(50, 1280, 1520, 0) MoveCamera(45, 21, 0, 0) OP_6E(400, 0) SetCameraDistance(22000, 0) OP_0D() #C0441 ChrTalk( 0x103, ( "#6P#0200F先去房间里\x01", "检查一下吧。\x02", ) ) CloseMessageWindow() #C0442 ChrTalk( 0x101, "#5P#0000F嗯,去看看吧。\x02", ) CloseMessageWindow() OP_5A() SetChrPos(0x0, 10, 30, 990, 0) OP_29(0x1D, 0x1, 0x2) OP_C7(0x0, 0x1000) EventEnd(0x5) Return() # Function_22_6F25 end def Function_23_7124(): pass label("Function_23_7124") EventBegin(0x0) Fade(500) OP_68(-270, 11270, 18770, 0) MoveCamera(45, 22, 0, 0) OP_6E(440, 0) SetCameraDistance(20500, 0) SetChrPos(0x101, -800, 10000, 19000, 0) SetChrPos(0x102, 200, 10000, 19000, 0) SetChrPos(0x103, -800, 10000, 17700, 0) SetChrPos(0x104, 200, 10000, 17700, 0) OP_0D() Sound(810, 0, 100, 0) Sleep(300) SetChrName("") #A0443 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "门上了锁。\x02", ) ) CloseMessageWindow() OP_57(0x0) OP_5A() #C0444 ChrTalk( 0x101, "#5P#0000F好了,钥匙在……\x02", ) CloseMessageWindow() OP_95(0x101, -140, 10030, 20150, 1000, 0x0) OP_93(0x101, 0x0, 0x1F4) Sleep(400) OP_63(0x101, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(600) #C0445 ChrTalk( 0x104, "#12P#0305F罗伊德,怎么了吗?\x02", ) CloseMessageWindow() #C0446 ChrTalk( 0x101, "#11P#0005F啊……\x02", ) CloseMessageWindow() OP_5A() OP_63(0x101, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x1) Sleep(1300) #C0447 ChrTalk( 0x101, "#11P#0001F有被人撬开过的痕迹。\x02", ) CloseMessageWindow() OP_63(0x104, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(12) OP_63(0x102, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(15) OP_63(0x103, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(1000) #C0448 ChrTalk( 0x101, ( "#11P#0003F只在钥匙孔边留有一点痕迹……\x01", "那个人的手法似乎很高超啊。\x02", ) ) CloseMessageWindow() #C0449 ChrTalk( 0x103, ( "#6P#0200F看起来,的确是\x01", "进入过房间啊。\x02", ) ) CloseMessageWindow() #C0450 ChrTalk( 0x102, ( "#12P#0101F果然……\x01", "必须要赶快把他抓到。\x02", ) ) CloseMessageWindow() #C0451 ChrTalk( 0x101, ( "#5P#0001F是啊,再这么下去,\x01", "也不利于跟踪狂\x01", "改过自新呢……\x02", ) ) CloseMessageWindow() Sleep(200) Sound(809, 0, 100, 0) Sleep(500) ClearMapObjFlags(0x2, 0x10) OP_71(0x2, 0x0, 0xA, 0x0, 0x0) Sound(103, 0, 100, 0) OP_79(0x2) OP_93(0x101, 0xB4, 0x190) Sleep(300) #C0452 ChrTalk( 0x101, ( "#5P#0001F各位,全力\x01", "进行调查吧!\x02", ) ) CloseMessageWindow() #C0453 ChrTalk( 0x104, "#12P#0300F好!\x02", ) CloseMessageWindow() FadeToDark(1000, 0, -1) OP_0D() SetMapObjFlags(0x2, 0x10) OP_65(0x0, 0x1) OP_68(49380, 1280, 51150, 0) MoveCamera(45, 28, 0, 0) OP_6E(560, 0) SetCameraDistance(14880, 0) SetChrPos(0x101, 49100, 0, 50000, 0) SetChrPos(0x102, 50200, 0, 50000, 0) SetChrPos(0x103, 49100, 0, 49000, 0) SetChrPos(0x104, 50200, 0, 49000, 0) def lambda_74AF(): OP_9B(0x0, 0xFE, 0x0, 0x7D0, 0x4B0, 0x0) ExitThread() QueueWorkItem(0x0, 1, lambda_74AF) def lambda_74C4(): OP_9B(0x0, 0xFE, 0x0, 0x7D0, 0x4B0, 0x0) ExitThread() QueueWorkItem(0x1, 1, lambda_74C4) def lambda_74D9(): OP_9B(0x0, 0xFE, 0x0, 0x7D0, 0x4B0, 0x0) ExitThread() QueueWorkItem(0x2, 1, lambda_74D9) def lambda_74EE(): OP_9B(0x0, 0xFE, 0x0, 0x7D0, 0x4B0, 0x0) ExitThread() QueueWorkItem(0x3, 1, lambda_74EE) FadeToBright(1000, 0) OP_0D() Sleep(2000) #C0454 ChrTalk( 0x104, ( "#12P#0300F真不愧是高级公寓的顶层,\x01", "房间真不错啊。\x02", ) ) CloseMessageWindow() #C0455 ChrTalk( 0x101, ( "#5P#0000F嗯,真不愧是伊莉娅小姐,\x01", "能一个人住在\x01", "这么宽敞的房间里……\x02", ) ) CloseMessageWindow() OP_63(0x101, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(500) #C0456 ChrTalk( 0x101, ( "#5P#0005F哎,房间里\x01", "好像稍微有点乱啊?\x02", ) ) CloseMessageWindow() OP_68(50860, 1280, 60190, 2200) Sleep(2600) Fade(500) OP_68(59700, 1280, 53950, 0) MoveCamera(53, 26, 0, 0) OP_68(59740, 1280, 53790, 2600) MoveCamera(37, 26, 0, 2600) Sleep(3000) #C0457 ChrTalk( 0x103, ( "#0200F葡萄酒杯、脱下之后\x01", "随便乱丢的衣服……\x02\x03", "#0203F这应该不是跟踪狂所为,\x01", "而是她自己搞的吧。\x02", ) ) CloseMessageWindow() #C0458 ChrTalk( 0x102, ( "#0100F这么一说,伊莉娅小姐\x01", "确实有种女中豪杰的气质……\x01", "这房间与她本人的感觉倒是挺相称的。\x02", ) ) CloseMessageWindow() #C0459 ChrTalk( 0x104, ( "#0306F唉,对于她的崇拜者来说,\x01", "大概会难以接受吧……\x02", ) ) CloseMessageWindow() Fade(500) OP_68(50120, 1280, 51750, 0) MoveCamera(41, 26, 0, 0) OP_6E(400, 0) SetCameraDistance(21500, 0) OP_93(0x0, 0x5A, 0x0) OP_93(0x1, 0x5A, 0x0) OP_93(0x2, 0x5A, 0x0) OP_93(0x3, 0x5A, 0x0) OP_0D() Sleep(300) def lambda_7771(): TurnDirection(0xFE, 0x104, 500) ExitThread() QueueWorkItem(0x101, 1, lambda_7771) def lambda_777E(): TurnDirection(0xFE, 0x101, 500) ExitThread() QueueWorkItem(0x104, 1, lambda_777E) def lambda_778B(): TurnDirection(0xFE, 0x103, 500) ExitThread() QueueWorkItem(0x102, 1, lambda_778B) def lambda_7798(): TurnDirection(0xFE, 0x102, 500) ExitThread() QueueWorkItem(0x103, 1, lambda_7798) Sleep(300) #C0460 ChrTalk( 0x101, ( "#5P#0001F总之,\x01", "先调查犯人的行踪吧。\x02\x03", "#0003F这次的首要目的当然是\x01", "把犯人捉住,并将他带到\x01", "伊莉娅小姐的面前……\x02\x03", "#0001F不过,在前期调查时\x01", "最好也要谨慎行事。\x02", ) ) CloseMessageWindow() OP_63(0x104, 0x0, 2000, 0x0, 0x1, 0xFA, 0x2) Sound(29, 0, 100, 0) OP_63(0x103, 0x0, 2000, 0x0, 0x1, 0xFA, 0x2) Sound(29, 0, 100, 0) Sleep(1400) #C0461 ChrTalk( 0x102, ( "#11P#0103F关于这次的跟踪狂事件,\x01", "我们只掌握到了一点模糊的目击情报而已。\x02\x03", "#0100F如果不将其当场抓获的话,\x01", "犯人完全可以一口咬定不是自己所为。\x02", ) ) CloseMessageWindow() #C0462 ChrTalk( 0x104, ( "#12P#0306F原来如此,\x01", "这可真有点麻烦啊。\x02", ) ) CloseMessageWindow() #C0463 ChrTalk( 0x103, ( "#6P#0200F也就是说,为了确保能将犯人抓获归案,\x01", "一定要预先确定犯人的体貌特征、行动模式,\x01", "以及侵入路线等事项,对吧?\x02", ) ) CloseMessageWindow() #C0464 ChrTalk( 0x101, ( "#5P#0000F是啊,总之先向这间公寓\x01", "内的住户询问一下吧。\x02", ) ) CloseMessageWindow() #C0465 ChrTalk( 0x104, ( "#12P#0300F同时也要搞清楚\x01", "公寓的内部结构。\x02\x03", "在问话的同时,\x01", "顺便在公寓内检查一圈吧。\x02", ) ) CloseMessageWindow() FadeToDark(1000, 0, -1) OP_0D() SetChrPos(0x0, 49850, 30, 51640, 0) ClearChrFlags(0xC, 0x80) ClearChrFlags(0xE, 0x80) SetChrPos(0xC, -46140, 1030, 59110, 0) SetChrPos(0xE, -45740, 1030, 60980, 180) BeginChrThread(0xC, 0, 0, 0) SetChrFlags(0xC, 0x10) SetChrFlags(0xE, 0x10) OP_29(0x1D, 0x1, 0x3) Sleep(500) EventEnd(0x5) Return() # Function_23_7124 end def Function_24_7A9F(): pass label("Function_24_7A9F") EventBegin(0x0) FadeToDark(0, 0, -1) OP_68(49570, 1280, 52340, 0) MoveCamera(44, 25, 0, 0) OP_6E(420, 0) SetCameraDistance(21470, 0) SetChrPos(0x101, 48900, 0, 53200, 135) SetChrPos(0x102, 50400, 0, 53200, 225) SetChrPos(0x103, 48900, 0, 51800, 45) SetChrPos(0x104, 50400, 0, 51800, 315) Sleep(500) FadeToBright(2000, 0) OP_0D() #C0466 ChrTalk( 0x101, ( "#5P#0003F犯人的特征,侵入公寓的路线……\x01", "基本已经搞清楚了。\x02", ) ) CloseMessageWindow() #C0467 ChrTalk( 0x103, ( "#6P#0200F是啊。\x02\x03", "犯人是戴着帽子的少年,\x01", "行动好像十分谨慎。\x02", ) ) CloseMessageWindow() #C0468 ChrTalk( 0x102, ( "#11P#0101F而且最近似乎多次\x01", "出入过这个房间。\x02\x03", "#0103F……但据伊莉娅小姐所说,\x01", "她好像并没有丢失什么东西……\x02", ) ) CloseMessageWindow() #C0469 ChrTalk( 0x104, ( "#12P#0306F不过跟踪狂这种人基本上\x01", "都没有什么明确的目的吧?\x02\x03", "#0301F此外,我们了解到的情报还有……\x01", "犯人恐怕是从\x01", "公寓的后门潜入进来的。\x02", ) ) CloseMessageWindow() #C0470 ChrTalk( 0x101, ( "#5P#0003F好,就以上述情报为基础,\x01", "准备伏击他吧。\x02\x03", "#0000F各位,能听我说一下吗?\x02", ) ) CloseMessageWindow() def lambda_7CFA(): TurnDirection(0xFE, 0x101, 500) ExitThread() QueueWorkItem(0x103, 1, lambda_7CFA) Sleep(10) def lambda_7D0A(): TurnDirection(0xFE, 0x101, 500) ExitThread() QueueWorkItem(0x102, 1, lambda_7D0A) Sleep(300) #C0471 ChrTalk( 0x103, ( "#12P#0205F罗伊德前辈,\x01", "你又想出什么计划了吗?\x02", ) ) CloseMessageWindow() #C0472 ChrTalk( 0x101, ( "#0000F对方虽然只是个少年,\x01", "但我们绝不能掉以轻心。\x02\x03", "为了确保能顺利将他捉拿归案,\x01", "我们应该制定一个计划。\x02", ) ) CloseMessageWindow() FadeToDark(2000, 0, -1) OP_0D() StopBGM(0xFA0) WaitBGM() OP_50(0x4C, (scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Call(0, 25) Return() # Function_24_7A9F end def Function_25_7DD2(): pass label("Function_25_7DD2") EventBegin(0x0) OP_68(-9520, 1270, 4050, 0) MoveCamera(45, 13, 0, 0) OP_6E(320, 0) SetCameraDistance(22920, 0) SetChrPos(0x8, 10310, 10000, 17660, 45) SetChrFlags(0x8, 0x8000) SetChrFlags(0x15, 0x8000) OP_52(0x15, 0x28, (scpexpr(EXPR_PUSH_LONG, 0xD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) LoadChrToIndex("chr/ch10100.itc", 0x1E) SetChrChipByIndex(0x15, 0x1E) SetChrSubChip(0x15, 0x0) OP_4B(0x15, 0xFF) SetChrFlags(0x102, 0x80) SetChrFlags(0x103, 0x80) SetChrFlags(0x104, 0x80) SetChrFlags(0x15, 0x80) OP_A7(0x101, 0xFF, 0xFF, 0xFF, 0x0, 0x0) PlayBGM("ed7302", 0) OP_50(0x4C, (scpexpr(EXPR_PUSH_LONG, 0x12E), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) SetCameraDistance(25420, 3000) FadeToBright(2000, 0) OP_0D() Sleep(1300) OP_68(9410, 11270, 15790, 6000) MoveCamera(45, 18, 0, 6000) OP_6E(320, 6000) SetCameraDistance(28920, 6000) Sleep(6800) OP_4B(0x8, 0xFF) #C0473 ChrTalk( 0x8, ( "#5P好啦,\x01", "走廊已经打扫完毕。\x02", ) ) CloseMessageWindow() OP_63(0x8, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(500) OP_93(0x8, 0xE1, 0x1F4) Sleep(300) #C0474 ChrTalk( 0x8, ( "#5P不好,因为明天有游行,\x01", "丢垃圾的时间\x01", "改到其它时段了。\x02", ) ) CloseMessageWindow() #C0475 ChrTalk( 0x8, ( "#5P我得去金德尔先生家\x01", "通知一声。\x02", ) ) CloseMessageWindow() BeginChrThread(0x8, 1, 0, 26) Sleep(4500) OP_68(-5680, 1250, 6550, 4200) MoveCamera(45, 22, 0, 4200) OP_6E(320, 4200) SetCameraDistance(31420, 4200) SetChrPos(0x15, -5900, 30, 6280, 180) ClearChrFlags(0x15, 0x80) ClearChrFlags(0x15, 0x4) OP_6F(0x1) Sleep(300) #N0476 NpcTalk( 0x15, "少年", "#5P………………………………\x02", ) CloseMessageWindow() OP_95(0x15, -7610, 30, 4530, 1900, 0x1) OP_95(0x15, -9430, 20, 4530, 1900, 0x1) def lambda_7FFF(): OP_95(0xFE, -9430, 1150, 6880, 1900, 0x0) ExitThread() QueueWorkItem(0x15, 1, lambda_7FFF) FadeToDark(1000, 0, -1) OP_0D() OP_68(-270, 11270, 18770, 0) MoveCamera(45, 22, 0, 0) OP_6E(440, 0) SetCameraDistance(20500, 0) SetChrPos(0x15, 2800, 10000, 18580, 270) def lambda_8063(): OP_95(0xFE, -250, 10000, 18580, 1700, 0x0) ExitThread() QueueWorkItem(0x15, 1, lambda_8063) FadeToBright(1000, 0) OP_0D() Sleep(700) EndChrThread(0x15, 0x1) OP_95(0x15, -250, 10020, 19710, 1700, 0x0) Sleep(300) #N0477 NpcTalk( 0x15, "少年", "#5P………………………………\x02", ) CloseMessageWindow() SetChrName("") #A0478 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "少年取出了铁丝,\x01", "熟练地将其插入到钥匙孔中。\x02", ) ) CloseMessageWindow() OP_57(0x0) OP_5A() Sound(833, 0, 100, 0) Sleep(1000) Sound(809, 0, 100, 0) Sleep(500) ClearMapObjFlags(0x2, 0x10) OP_71(0x2, 0x0, 0xA, 0x0, 0x0) Sound(103, 0, 100, 0) Sleep(200) #N0479 NpcTalk( 0x15, "少年", "#5P哼……太简单了。\x02", ) CloseMessageWindow() OP_95(0x15, -250, 10000, 22830, 1500, 0x0) FadeToDark(1000, 0, -1) OP_0D() SetMapObjFlags(0x2, 0x10) OP_68(50000, 1280, 51630, 0) MoveCamera(45, 24, 0, 0) OP_6E(440, 0) SetCameraDistance(21000, 0) SetChrPos(0x15, 50000, 30, 51630, 0) SetChrPos(0x102, 56790, 1000, 55420, 0) SetChrPos(0x103, 57110, 1000, 54440, 0) SetChrPos(0x104, 49770, 0, 50440, 0) SetChrPos(0x101, 56790, 1000, 55420, 0) FadeToBright(1000, 0) OP_0D() #N0480 NpcTalk( 0x15, "少年", "#5P好,今天我一定要……\x02", ) CloseMessageWindow() OP_93(0x15, 0x5A, 0x1F4) Sleep(400) OP_93(0x15, 0x0, 0x1F4) Sleep(200) #N0481 NpcTalk( 0x15, "少年", ( "#5P呃,还是\x01", "这么脏乱啊……\x02", ) ) CloseMessageWindow() OP_68(51840, 1280, 59480, 3000) OP_95(0x15, 50000, 1050, 57300, 1800, 0x0) #N0482 NpcTalk( 0x15, "少年", ( "#5P唉呀,又喝了\x01", "这么多。\x02", ) ) CloseMessageWindow() #N0483 NpcTalk( 0x15, "少年", ( "#5P……看到这么脏乱的房间,\x01", "连偷东西的心情都没了。\x01", "真是的……\x02", ) ) CloseMessageWindow() OP_68(55300, 1280, 61530, 3000) OP_95(0x15, 53730, 1030, 57300, 1600, 0x0) OP_95(0x15, 54180, 1030, 60610, 1600, 0x0) OP_93(0x15, 0x10E, 0x1F4) #N0484 NpcTalk( 0x15, "少年", "#5P那么……该偷点什么好呢?\x02", ) CloseMessageWindow() OP_63(0x15, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x1) Sleep(1300) #N0485 NpcTalk( 0x15, "少年", ( "#5P不,这种东西可不行。\x01", "……得找些更能让她着急的东西。\x02", ) ) CloseMessageWindow() OP_68(56080, 1280, 62450, 1000) OP_95(0x15, 54710, 1030, 61820, 1600, 0x0) #N0486 NpcTalk( 0x15, "少年", ( "#5P嘿,要不然,\x01", "干脆就撬开保险箱……\x02", ) ) CloseMessageWindow() ClearChrFlags(0x102, 0x80) ClearChrFlags(0x103, 0x80) ClearChrFlags(0x104, 0x80) #N0487 NpcTalk( 0x101, "声音", "#1P#4S──到此为止了!\x02", ) CloseMessageWindow() OP_63(0x15, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) OP_9C(0x15, 0x0, 0x0, 0x0, 0x320, 0x2EE0) Sleep(500) TurnDirection(0x15, 0x102, 500) OP_68(55910, 2280, 60270, 1200) MoveCamera(68, 24, 0, 1200) OP_6E(440, 1200) SetCameraDistance(21000, 1200) def lambda_8492(): OP_95(0xFE, 56540, 1030, 58700, 4000, 0x0) ExitThread() QueueWorkItem(0x102, 1, lambda_8492) def lambda_84AC(): OP_95(0xFE, 55760, 1000, 57400, 4000, 0x0) ExitThread() QueueWorkItem(0x103, 1, lambda_84AC) #N0488 NpcTalk( 0x15, "少年", "#5P什么……!?\x02", ) CloseMessageWindow() WaitChrThread(0x102, 1) #C0489 ChrTalk( 0x102, ( "#0105F想不到跟踪狂\x01", "竟然是这么一个普通的孩子……\x02", ) ) CloseMessageWindow() #C0490 ChrTalk( 0x103, ( "#0200F不过,犯罪的事实是不会改变的,\x01", "请你乖乖地束手就擒吧。\x02", ) ) CloseMessageWindow() #N0491 NpcTalk( 0x15, "少年", ( "#5P居、居然有埋伏……\x01", "可恶,大意了……!!\x02", ) ) CloseMessageWindow() #N0492 NpcTalk( 0x104, "青年的声音", "哦哦,别想逃跑哟。\x02", ) CloseMessageWindow() OP_93(0x15, 0xE1, 0x1F4) OP_68(51490, 880, 55350, 1500) MoveCamera(47, 24, 0, 1500) OP_6E(440, 1500) SetCameraDistance(21000, 1500) OP_95(0x104, 49860, 30, 52710, 1800, 0x0) #C0493 ChrTalk( 0x104, ( "#0300F#12P此路不通。\x01", "你就乖乖投降吧。\x02", ) ) CloseMessageWindow() OP_5A() Fade(500) OP_68(55210, 1280, 61550, 0) MoveCamera(47, 24, 0, 0) OP_6E(440, 0) SetCameraDistance(23500, 0) OP_0D() StopBGM(0xBB8) #N0494 NpcTalk( 0x15, "少年", "#5P可恶……我才不会被你们抓住呢!\x02", ) CloseMessageWindow() #N0495 NpcTalk( 0x15, "少年", "#5P怎么能被你们这些人……\x02", ) CloseMessageWindow() #N0496 NpcTalk( 0x15, "少年", ( "#5P我最讨厌\x01", "你们这种人了!!\x02", ) ) CloseMessageWindow() WaitBGM() Sleep(10) PlayBGM("ed7401", 0) OP_50(0x4C, (scpexpr(EXPR_PUSH_LONG, 0x191), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) OP_68(49830, 1950, 54370, 3000) MoveCamera(50, 19, 0, 3000) SetCameraDistance(24490, 3000) def lambda_870D(): OP_93(0x102, 0x10E, 0x1F4) ExitThread() QueueWorkItem(0x102, 1, lambda_870D) def lambda_871A(): OP_93(0x103, 0x10E, 0x1F4) ExitThread() QueueWorkItem(0x103, 1, lambda_871A) OP_95(0x15, 52040, 1030, 62670, 6000, 0x1) OP_95(0x15, 51770, 1000, 58240, 6000, 0x1) SetChrChip(0x0, 0x15, 0x32, 0x12C) Sleep(100) SetChrFlags(0x15, 0x4) OP_9D(0x15, 0xCA6C, 0x8FC, 0xD9DA, 0x578, 0x1388) Sound(804, 0, 100, 0) Sleep(200) OP_9D(0x15, 0xCAB2, 0x0, 0xC88C, 0x64, 0x1388) SetChrFlags(0x15, 0x4) Sound(814, 0, 100, 0) OP_95(0x15, 49910, 30, 51420, 7000, 0x0) def lambda_87B5(): OP_A7(0xFE, 0xFF, 0xFF, 0xFF, 0x0, 0x1F4) ExitThread() QueueWorkItem(0x15, 1, lambda_87B5) OP_63(0x104, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) OP_95(0x15, 49740, 0, 46610, 7000, 0x0) #C0497 ChrTalk( 0x104, "#12P#0305F什么……!?\x02", ) CloseMessageWindow() TurnDirection(0x104, 0x15, 500) Sleep(400) BeginChrThread(0x102, 1, 0, 27) BeginChrThread(0x103, 1, 0, 28) #C0498 ChrTalk( 0x104, ( "#6P#0301F混蛋……\x01", "动作倒是挺快啊。\x02", ) ) CloseMessageWindow() SetChrChip(0x1, 0x15, 0x0, 0x0) #C0499 ChrTalk( 0x103, "#11P#0201F兰迪前辈……!\x02", ) CloseMessageWindow() #C0500 ChrTalk( 0x102, "#5P#0101F兰迪,快追!\x02", ) CloseMessageWindow() TurnDirection(0x104, 0x102, 500) Sleep(200) #C0501 ChrTalk( 0x104, "#0307F#12P好!\x02", ) CloseMessageWindow() OP_93(0x104, 0xB4, 0x0) OP_93(0x102, 0xB4, 0x0) OP_93(0x103, 0xB4, 0x0) def lambda_88C0(): OP_9B(0x0, 0xFE, 0x0, 0x1388, 0x1388, 0x0) ExitThread() QueueWorkItem(0x104, 1, lambda_88C0) def lambda_88D5(): OP_9B(0x0, 0xFE, 0x0, 0x1388, 0x1388, 0x0) ExitThread() QueueWorkItem(0x102, 1, lambda_88D5) def lambda_88EA(): OP_9B(0x0, 0xFE, 0x0, 0x1388, 0x1388, 0x0) ExitThread() QueueWorkItem(0x103, 1, lambda_88EA) FadeToDark(1000, 0, -1) OP_0D() OP_68(-270, 11270, 18770, 0) MoveCamera(45, 22, 0, 0) OP_6E(440, 0) SetCameraDistance(20500, 0) SetChrPos(0x15, -200, 10000, 22910, 0) OP_A7(0x15, 0xFF, 0xFF, 0xFF, 0xFF, 0x0) ClearMapObjFlags(0x2, 0x10) OP_70(0x2, 0xA) def lambda_895E(): OP_95(0xFE, -200, 10000, 18300, 7000, 0x1) ExitThread() QueueWorkItem(0x15, 1, lambda_895E) OP_82(0xC8, 0x64, 0xBB8, 0x12C) Sound(103, 0, 100, 0) Sound(121, 0, 100, 0) Sound(818, 0, 80, 0) FadeToBright(250, 0) OP_0D() WaitChrThread(0x15, 1) OP_95(0x15, 7690, 10000, 18300, 7000, 0x0) def lambda_89BD(): OP_95(0xFE, 9100, 10030, 15930, 7000, 0x0) ExitThread() QueueWorkItem(0x15, 1, lambda_89BD) Fade(300) OP_68(-3140, 1250, 4150, 0) OP_68(-60, 1250, 1780, 1000) EndChrThread(0x15, 0x1) SetChrPos(0x15, -3510, 30, 3820, 135) OP_95(0x15, -310, 0, 620, 7000, 0x0) OP_93(0x15, 0xB4, 0x1F4) Sleep(400) Sound(103, 0, 100, 0) Sound(121, 0, 100, 0) FadeToDark(300, 0, 100) SetChrName("") #A0502 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "少年打开了房门。\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() #N0503 NpcTalk( 0x15, "少年", ( "#11P哼,这些笨蛋。\x01", "到这边找去吧……!\x02", ) ) CloseMessageWindow() OP_95(0x15, -5860, 0, 6840, 7000, 0x0) OP_95(0x15, -5860, 200, 12240, 7000, 0x0) FadeToDark(1000, 0, -1) OP_0D() SetScenarioFlags(0x5C, 2) NewScene("c020C", 0, 0, 0) IdleLoop() Return() # Function_25_7DD2 end def Function_26_8AD8(): pass label("Function_26_8AD8") OP_95(0x8, 9010, 10020, 15730, 2100, 0x0) OP_95(0x8, 8610, 7500, 10850, 2100, 0x0) OP_95(0x8, 1970, 5000, 10850, 2300, 0x0) OP_95(0x8, -2860, 5000, 17000, 2300, 0x0) SetChrFlags(0x8, 0x80) Return() # Function_26_8AD8 end def Function_27_8B2E(): pass label("Function_27_8B2E") OP_95(0x102, 49750, 1050, 57720, 5000, 0x0) OP_93(0x102, 0xB4, 0x1F4) Return() # Function_27_8B2E end def Function_28_8B4A(): pass label("Function_28_8B4A") OP_95(0x103, 50510, 1000, 56870, 5000, 0x0) OP_93(0x103, 0xB4, 0x1F4) Return() # Function_28_8B4A end def Function_29_8B66(): pass label("Function_29_8B66") EventBegin(0x0) FadeToDark(0, 0, -1) LoadChrToIndex("chr/ch10100.itc", 0x1E) LoadChrToIndex("chr/ch05100.itc", 0x1F) OP_68(48420, 2250, 52020, 0) MoveCamera(43, 12, 0, 0) OP_6E(540, 0) SetCameraDistance(16100, 0) OP_68(48360, 2250, 51810, 0) MoveCamera(43, 12, 0, 0) OP_6E(540, 0) SetCameraDistance(16100, 0) SetChrChipByIndex(0x15, 0x1E) SetChrSubChip(0x15, 0x0) SetChrChipByIndex(0x12, 0x1F) SetChrSubChip(0x12, 0x0) SetChrPos(0x101, 49320, 0, 50740, 0) SetChrPos(0x102, 52190, 0, 53090, 270) SetChrPos(0x104, 52150, 0, 51670, 270) SetChrPos(0x103, 50770, 0, 50780, 0) SetChrPos(0x12, 49730, 1000, 55910, 180) SetChrPos(0x14, 50950, 1000, 55970, 225) SetChrPos(0x15, 49800, 30, 52560, 0) ClearChrFlags(0x12, 0x80) ClearChrFlags(0x14, 0x80) ClearChrFlags(0x15, 0x80) ClearChrFlags(0x12, 0x4) OP_4B(0x12, 0xFF) OP_4B(0x14, 0xFF) OP_4B(0x15, 0xFF) SetChrName("") #A0504 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "罗伊德等人与伊莉娅进行联络,\x01", "告知犯人已经被逮捕了。\x02", ) ) CloseMessageWindow() #A0505 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "少年虽然做了短时间的挣扎,\x01", "但最终还是放弃抵抗,安静了下来。\x02", ) ) CloseMessageWindow() OP_57(0x0) OP_5A() PlayBGM("ed7111", 0) SetCameraDistance(15100, 2000) FadeToBright(2000, 0) OP_0D() OP_6F(0x10) Sleep(300) #C0506 ChrTalk( 0x12, ( "#5P#1705F哎……这么说,\x01", "你就是那个跟踪狂吗?\x02\x03", "#1700F个头比我想象中的还要小呢……\x01", "你不是克洛斯贝尔本地人吧?\x02", ) ) CloseMessageWindow() #C0507 ChrTalk( 0x101, ( "#12P#0006F是的,似乎出身于\x01", "边境的贫民区。\x02\x03", "#0001F只是,别说是事情的经过,\x01", "他连自己的名字也不肯说呢。\x02", ) ) CloseMessageWindow() #C0508 ChrTalk( 0x12, ( "#5P#1703F啊,是这样啊。\x02\x03", "#1700F……我说你啊,为什么\x01", "要缠着我呢?\x02\x03", "你是有什么想要的东西吗?\x02", ) ) CloseMessageWindow() OP_93(0x15, 0x13B, 0x190) Sleep(300) #N0509 NpcTalk( 0x15, "少年", "#6P哼,才没有……\x02", ) CloseMessageWindow() #N0510 NpcTalk( 0x15, "少年", ( "#6P我只是想\x01", "惹你生气而已。\x02", ) ) CloseMessageWindow() OP_63(0x12, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(3) OP_63(0x14, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x0, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(5) OP_63(0x1, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x2, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(4) OP_63(0x3, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(1000) #C0511 ChrTalk( 0x14, "#1805F#11P惹人生气……?\x02", ) CloseMessageWindow() StopBGM(0xFA0) OP_93(0x15, 0x0, 0x1F4) Sleep(300) #N0512 NpcTalk( 0x15, "少年", "#6P你们这群人懂什么……\x02", ) CloseMessageWindow() #N0513 NpcTalk( 0x15, "少年", ( "#6P住在这么好的地方,\x01", "每天都吃着美味的食物……\x02", ) ) CloseMessageWindow() Sleep(200) OP_82(0x96, 0x0, 0xBB8, 0x320) #N0514 NpcTalk( 0x15, "少年", ( "#6P#4S#N像你们这样的人,\x01", "又怎么能理解我这种住在垃圾堆一样的贫民区,\x01", "连温饱都成问题的穷人的心情!!\x02", ) ) CloseMessageWindow() Sleep(200) #C0515 ChrTalk( 0x101, "#12P#0005F…………………………!?\x02", ) CloseMessageWindow() #C0516 ChrTalk( 0x102, "#0108F…………………………\x02", ) CloseMessageWindow() WaitBGM() OP_93(0x15, 0x13B, 0x190) PlayBGM("ed7005", 0) Sleep(300) #N0517 NpcTalk( 0x15, "少年", ( "#6P……自从我来到克洛斯贝尔市之后,\x01", "就一直将这些事情看在眼里。\x02", ) ) CloseMessageWindow() #N0518 NpcTalk( 0x15, "少年", ( "#6P住在这里的都是些有钱人,\x01", "每天晚上挥霍着大把金钱,游玩享乐。\x02", ) ) CloseMessageWindow() #N0519 NpcTalk( 0x15, "少年", ( "#6P哈,随他们便吧。\x01", "反正我最讨厌那种人了。\x02", ) ) CloseMessageWindow() #N0520 NpcTalk( 0x15, "少年", ( "#6P……但是,那些家伙都说,\x01", "最高级的娱乐就是去看彩虹剧团的演出……\x01", "所以我就潜入了一次。\x02", ) ) CloseMessageWindow() #C0521 ChrTalk( 0x12, "#1705F#5P………哎……………?\x02", ) CloseMessageWindow() #C0522 ChrTalk( 0x103, ( "#11P#0200F你看了彩虹剧团的……\x01", "伊莉娅小姐的\x01", "表演了吗……?\x02", ) ) CloseMessageWindow() OP_93(0x15, 0x0, 0x1F4) Sleep(200) #N0523 NpcTalk( 0x15, "少年", ( "#6P我讨厌那些没有危机感,\x01", "整天悠哉度日的家伙。\x02", ) ) CloseMessageWindow() #N0524 NpcTalk( 0x15, "少年", ( "#6P在这其中,我最讨厌的……\x01", "#4S就是你了!!\x02", ) ) CloseMessageWindow() #N0525 NpcTalk( 0x15, "少年", ( "#6P站在那么美丽的舞台上,\x01", "演绎着那么动人的世界……\x02", ) ) CloseMessageWindow() #N0526 NpcTalk( 0x15, "少年", ( "#6P在谁都无法碰触到的地方,\x01", "散发着那么耀眼的光芒。\x02", ) ) CloseMessageWindow() #N0527 NpcTalk( 0x15, "少年", ( "#6P我就算一直拼搏到死,\x01", "也绝对无法触及得到……\x02", ) ) CloseMessageWindow() OP_63(0x15, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x1) Sleep(1500) #N0528 NpcTalk( 0x15, "少年", ( "#6P我就算努力工作,直到累死,\x01", "赚到的钱也不够买一张门票。\x02", ) ) CloseMessageWindow() Sleep(200) OP_82(0x96, 0x64, 0xBB8, 0x320) #N0529 NpcTalk( 0x15, "少年", ( "#6P#4S#N──没错吧!?\x01", "那种世界……就算我拼命到死,\x01", "也不可能靠近一步啊!!\x02", ) ) CloseMessageWindow() Sleep(300) OP_63(0x0, 0x0, 2000, 0x18, 0x1B, 0x190, 0x0) OP_63(0x1, 0x0, 2000, 0x18, 0x1B, 0x190, 0x0) OP_63(0x2, 0x0, 2000, 0x18, 0x1B, 0x190, 0x0) OP_63(0x3, 0x0, 2000, 0x18, 0x1B, 0x190, 0x0) OP_63(0x12, 0x0, 2000, 0x18, 0x1B, 0x190, 0x0) OP_63(0x14, 0x0, 2000, 0x18, 0x1B, 0x190, 0x0) Sleep(3200) OP_64(0x0) OP_64(0x1) OP_64(0x2) OP_64(0x3) OP_64(0x12) OP_64(0x14) Sleep(500) #C0530 ChrTalk( 0x104, ( "#11P#0303F………………………………\x01", "原来是这么回事啊……\x02", ) ) CloseMessageWindow() #C0531 ChrTalk( 0x101, ( "#12P#0008F来到克洛斯贝尔市……\x01", "看了伊莉娅小姐的表演……\x02\x03", "#0006F的确有可能会产生\x01", "这样的冲击呢。\x02", ) ) CloseMessageWindow() #C0532 ChrTalk( 0x14, ( "#1803F#11P……说得也是啊……\x02\x03", "#1808F克洛斯贝尔市的确\x01", "有着这样的一面。\x02\x03", "#1801F大都市的黑暗面……\x01", "有时会让人感觉绝望而无力……\x02", ) ) CloseMessageWindow() #C0533 ChrTalk( 0x12, ( "#1703F#5P………………………………\x02\x03", "#1700F算啦,不管怎么样,\x01", "也得把事情做个了结啊。\x02", ) ) CloseMessageWindow() OP_63(0x0, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x1, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x2, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x3, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x14, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x15, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(1000) def lambda_9670(): label("loc_9670") TurnDirection(0xFE, 0x12, 500) Yield() Jump("loc_9670") QueueWorkItem2(0x0, 1, lambda_9670) def lambda_9682(): label("loc_9682") TurnDirection(0xFE, 0x12, 500) Yield() Jump("loc_9682") QueueWorkItem2(0x1, 1, lambda_9682) def lambda_9694(): label("loc_9694") TurnDirection(0xFE, 0x12, 500) Yield() Jump("loc_9694") QueueWorkItem2(0x2, 1, lambda_9694) def lambda_96A6(): label("loc_96A6") TurnDirection(0xFE, 0x12, 500) Yield() Jump("loc_96A6") QueueWorkItem2(0x3, 1, lambda_96A6) def lambda_96B8(): label("loc_96B8") TurnDirection(0xFE, 0x12, 500) Yield() Jump("loc_96B8") QueueWorkItem2(0x14, 1, lambda_96B8) OP_68(48800, 2250, 51320, 2000) def lambda_96DB(): OP_95(0xFE, 49730, 0, 54230, 1000, 0x0) ExitThread() QueueWorkItem(0x12, 1, lambda_96DB) #C0534 ChrTalk( 0x102, "#11P#0105F伊莉娅小姐……?\x02", ) CloseMessageWindow() #C0535 ChrTalk( 0x101, "#12P#0011F那个,您打算……\x02", ) CloseMessageWindow() WaitChrThread(0x12, 1) #C0536 ChrTalk( 0x12, ( "#5P#1701F我叫伊莉娅·普拉提耶。\x01", "……你叫什么名字?\x02", ) ) CloseMessageWindow() #N0537 NpcTalk( 0x15, "少年", ( "#6P……………………………\x01", "……修利。\x02", ) ) CloseMessageWindow() #C0538 ChrTalk( 0x12, ( "#5P#1703F修利啊,我记住了。\x02\x03", "#1701F修利,你就暂时在\x01", "剧团里打杂吧。\x02\x03", "因为这种事用钱来赔偿\x01", "会很麻烦。\x01", "所以你就给我好好干活吧?\x02", ) ) CloseMessageWindow() OP_63(0x15, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(12) OP_63(0x14, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) OP_63(0x0, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(18) OP_63(0x1, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) OP_63(0x2, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(12) OP_63(0x3, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(1000) #C0539 ChrTalk( 0x15, "#6P……………什么…………\x02", ) CloseMessageWindow() #C0540 ChrTalk( 0x101, "#12P#0005F伊、伊莉娅小姐,您的意思是……?\x02", ) CloseMessageWindow() OP_93(0x12, 0x87, 0x190) Sleep(200) #C0541 ChrTalk( 0x12, ( "#5P#1706F抱歉哦,\x01", "虽然你们好不容易才抓到他。\x02\x03", "#1700F不过,这孩子暂时\x01", "就交给我收留吧。\x02", ) ) CloseMessageWindow() #C0542 ChrTalk( 0x104, "#11P#0302F也就是说,无罪释放吗?\x02", ) CloseMessageWindow() #C0543 ChrTalk( 0x103, ( "#11P#0202F哎呀呀,真是的。\x01", "……算了,既然伊莉娅小姐\x01", "都这么说了……\x02", ) ) CloseMessageWindow() #C0544 ChrTalk( 0x12, "#5P#1704F呵呵,还有啊。\x02", ) CloseMessageWindow() OP_93(0x12, 0xB4, 0x190) OP_95(0x12, 49900, 0, 53370, 1000, 0x0) Sleep(200) EndChrThread(0x0, 0x1) EndChrThread(0x1, 0x1) EndChrThread(0x2, 0x1) EndChrThread(0x3, 0x1) EndChrThread(0x14, 0x1) Sound(819, 0, 100, 0) OP_A6(0x15, 0x0, 0xF, 0xC8, 0xBB8) Sleep(300) FadeToDark(300, 0, 100) SetChrName("") #A0545 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "伊莉娅拍了拍少年的肩膀。\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() BeginChrThread(0x15, 1, 0, 30) #C0546 ChrTalk( 0x15, "#6P你……你干什么!?\x02", ) CloseMessageWindow() #C0547 ChrTalk( 0x12, ( "#5P#1709F嗯,跟我想的一样呢。\x02\x03", "#1700F不过,要是再长点\x01", "肌肉就更好了……\x02", ) ) CloseMessageWindow() EndChrThread(0x15, 0x1) Jc((scpexpr(EXPR_GET_CHR_WORK, 0x15, 0x4), scpexpr(EXPR_PUSH_LONG, 0x0), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_9B06") OP_93(0x15, 0x10E, 0x190) label("loc_9B06") Sleep(400) OP_93(0x15, 0x0, 0x1F4) Sleep(200) #C0548 ChrTalk( 0x12, ( "#5P#1702F修利,其实你\x01", "很有资质呢。\x02\x03", "#1709F如果努力锻炼的话,或许就能成为\x01", "与我和莉夏并驾齐驱的演员哦。\x02", ) ) CloseMessageWindow() OP_5A() OP_63(0x15, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) Sound(28, 0, 100, 0) Sleep(1000) #C0549 ChrTalk( 0x15, "#6P咦……\x02", ) CloseMessageWindow() OP_82(0x96, 0x0, 0xBB8, 0x12C) #C0550 ChrTalk( 0x15, "#6P#4S咦咦咦……!?\x02", ) CloseMessageWindow() #C0551 ChrTalk( 0x15, "#6P为、为什么我要……!?\x02", ) CloseMessageWindow() #C0552 ChrTalk( 0x102, ( "#11P#0102F这么一说……\x01", "这孩子的动作确实很敏捷呢。\x02", ) ) CloseMessageWindow() #C0553 ChrTalk( 0x104, ( "#11P#0300F是啊,步子轻盈得\x01", "令人惊讶。\x02\x03", "#0304F……原来如此,在这方面\x01", "很有素质啊。\x02", ) ) CloseMessageWindow() #C0554 ChrTalk( 0x12, ( "#5P#1702F嗯,就是这样啦。\x01", "总之,你就加入我们剧团吧。\x02\x03", "#1709F你是没有选择权的!\x02", ) ) CloseMessageWindow() OP_63(0x15, 0x0, 2000, 0x28, 0x2B, 0x64, 0x0) #C0555 ChrTalk( 0x15, ( "#6P我、我……\x01", "……可是,那个…………\x02", ) ) CloseMessageWindow() OP_5A() Sleep(700) OP_64(0x15) BeginChrThread(0x12, 2, 0, 31) Sleep(700) BeginChrThread(0x15, 2, 0, 31) Sleep(500) #C0556 ChrTalk( 0x14, ( "#1809F#5P呵呵……\x01", "真像伊莉娅小姐的行事风格。\x02\x03", "#1810F……我当时也是一样,\x01", "被这么强拉硬拽地招揽进了剧团。\x02", ) ) CloseMessageWindow() OP_5A() def lambda_9D9C(): OP_93(0xFE, 0x0, 0x15E) ExitThread() QueueWorkItem(0x102, 1, lambda_9D9C) Sleep(20) def lambda_9DAC(): OP_93(0xFE, 0x0, 0x15E) ExitThread() QueueWorkItem(0x103, 1, lambda_9DAC) Sleep(400) #C0557 ChrTalk( 0x101, ( "#12P#0002F是、是这样吗……\x02\x03", "#0004F不过,多亏了伊莉娅小姐,\x01", "事情似乎圆满收场了啊。\x02", ) ) CloseMessageWindow() #C0558 ChrTalk( 0x103, "#11P#0202F是啊。\x02", ) CloseMessageWindow() def lambda_9E29(): OP_93(0xFE, 0x10E, 0x15E) ExitThread() QueueWorkItem(0x102, 1, lambda_9E29) Sleep(20) def lambda_9E39(): OP_93(0xFE, 0x10E, 0x15E) ExitThread() QueueWorkItem(0x103, 1, lambda_9E39) Sleep(800) EndChrThread(0x12, 0x2) EndChrThread(0x15, 0x2) OP_64(0x12) OP_64(0x15) #C0559 ChrTalk( 0x12, "#1709F#5P好啦!不许反对~!\x02", ) CloseMessageWindow() #C0560 ChrTalk( 0x15, ( "#6P我、我还没有\x01", "同意吧!?\x02", ) ) CloseMessageWindow() OP_63(0x15, 0x0, 1900, 0x2C, 0x2F, 0x96, 0x1) Sound(25, 0, 100, 0) Sleep(200) BeginChrThread(0x12, 2, 0, 31) Sleep(600) FadeToDark(2000, 0, -1) OP_0D() StopBGM(0xFA0) EndChrThread(0x12, 0x2) OP_64(0x12) OP_68(-950, 11250, 18010, 0) MoveCamera(45, 25, 0, 0) OP_6E(440, 0) SetCameraDistance(22750, 0) SetChrPos(0x101, -660, 10000, 17460, 0) SetChrPos(0x102, 390, 10000, 17460, 0) SetChrPos(0x103, -660, 10000, 16030, 0) SetChrPos(0x104, 390, 10000, 16030, 0) SetChrPos(0x12, -730, 10030, 19740, 180) SetChrPos(0x14, 530, 10020, 19600, 180) SetChrPos(0x15, -280, 10020, 19200, 180) SetChrFlags(0x103, 0x4) WaitBGM() Sleep(10) PlayBGM("ed7106", 0) OP_50(0x1, (scpexpr(EXPR_PUSH_LONG, 0x6A), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) FadeToBright(1000, 0) OP_0D() #C0561 ChrTalk( 0x12, ( "#5P#1705F这就要走了吗?\x01", "可以先喝杯茶再走嘛。\x02", ) ) CloseMessageWindow() #C0562 ChrTalk( 0x101, ( "#0004F#6P不必了,\x01", "我们还有其它的工作。\x02\x03", "#0005F啊,对了。\x01", "钥匙得还给您。\x02", ) ) CloseMessageWindow() OP_95(0x101, -640, 10000, 18640, 1200, 0x0) FadeToDark(300, 0, 100) SetMessageWindowPos(-1, -1, -1, -1) SetChrName("") Sound(17, 0, 100, 0) #A0563 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_ITEM, 0x347), scpstr(SCPSTR_CODE_COLOR, 0x0), "归还了。\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) SetMessageWindowPos(14, 280, 60, 3) OP_5A() SubItemNumber(0x347, 1) OP_96(0x101, 0xFFFFFD6C, 0x2710, 0x44FC, 0x4B0, 0x0) #C0564 ChrTalk( 0x12, ( "#5P#1704F好,我收到了。\x02\x03", "#1700F这次真是麻烦你们啦,警察弟弟。\x01", "回去的路上要注意安全哦~\x02", ) ) CloseMessageWindow() #C0565 ChrTalk( 0x14, ( "#11P#1809F我也要向各位表示谢意。\x01", "真是谢谢大家了。\x02", ) ) CloseMessageWindow() #C0566 ChrTalk( 0x104, ( "#12P#0309F嗯,再见啦,\x01", "小莉夏!\x02", ) ) CloseMessageWindow() #C0567 ChrTalk( 0x102, ( "#12P#0102F伊莉娅小姐、莉夏小姐,\x01", "修利就麻烦两位照顾了。\x02", ) ) CloseMessageWindow() #C0568 ChrTalk( 0x103, ( "#12P#0204F虽然事件已经解决了,\x01", "但还是要注意门户安全啊。\x02", ) ) CloseMessageWindow() #C0569 ChrTalk( 0x101, ( "#0014F#6P哈哈……如果再有什么事,\x01", "欢迎来找我们支援科。\x02", ) ) CloseMessageWindow() WaitChrThread(0x101, 1) Sleep(200) def lambda_A1FC(): label("loc_A1FC") TurnDirection(0xFE, 0x101, 300) Yield() Jump("loc_A1FC") QueueWorkItem2(0x12, 1, lambda_A1FC) def lambda_A20E(): label("loc_A20E") TurnDirection(0xFE, 0x101, 300) Yield() Jump("loc_A20E") QueueWorkItem2(0x14, 1, lambda_A20E) OP_95(0x101, -600, 10000, 18360, 1000, 0x0) OP_93(0x101, 0x2D, 0x190) OP_93(0x15, 0xE1, 0x190) Sleep(300) #C0570 ChrTalk( 0x101, ( "#0000F#6P……那么告辞了。\x02\x03", "#0002F以后别再做这种事了哦。\x01", "是男人的话,就得学会知恩图报啊。\x02", ) ) CloseMessageWindow() OP_63(0x15, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) OP_68(930, 11250, 17540, 2800) def lambda_A2C6(): label("loc_A2C6") TurnDirection(0xFE, 0x101, 300) Yield() Jump("loc_A2C6") QueueWorkItem2(0x15, 1, lambda_A2C6) def lambda_A2D8(): OP_9B(0x0, 0xFE, 0x5A, 0xA28, 0x2BC, 0x0) ExitThread() QueueWorkItem(0x104, 1, lambda_A2D8) def lambda_A2ED(): OP_9B(0x0, 0xFE, 0x5A, 0xA28, 0x2BC, 0x0) ExitThread() QueueWorkItem(0x102, 1, lambda_A2ED) def lambda_A302(): OP_9B(0x0, 0xFE, 0x5A, 0xA28, 0x2BC, 0x0) ExitThread() QueueWorkItem(0x103, 1, lambda_A302) def lambda_A317(): OP_95(0xFE, 1870, 10000, 17460, 700, 0x0) ExitThread() QueueWorkItem(0x101, 1, lambda_A317) WaitChrThread(0x101, 1) WaitChrThread(0x102, 1) WaitChrThread(0x104, 1) WaitChrThread(0x103, 1) OP_64(0x15) #C0571 ChrTalk( 0x15, ( "#5P……我果然……\x01", "还是很讨厌你。\x02", ) ) CloseMessageWindow() Sleep(200) EndChrThread(0x101, 0x1) EndChrThread(0x102, 0x1) EndChrThread(0x103, 0x1) EndChrThread(0x104, 0x1) EndChrThread(0x12, 0x1) EndChrThread(0x14, 0x1) EndChrThread(0x15, 0x1) def lambda_A389(): TurnDirection(0xFE, 0x15, 400) ExitThread() QueueWorkItem(0x0, 1, lambda_A389) Sleep(12) def lambda_A399(): TurnDirection(0xFE, 0x15, 400) ExitThread() QueueWorkItem(0x1, 1, lambda_A399) def lambda_A3A6(): TurnDirection(0xFE, 0x15, 400) ExitThread() QueueWorkItem(0x2, 1, lambda_A3A6) Sleep(10) def lambda_A3B6(): TurnDirection(0xFE, 0x15, 400) ExitThread() QueueWorkItem(0x3, 1, lambda_A3B6) Sleep(300) #C0572 ChrTalk( 0x101, "#11P#0005F哎……\x02", ) CloseMessageWindow() OP_68(930, 11050, 18160, 2000) MoveCamera(349, 25, 0, 2000) Sleep(500) OP_95(0x15, 460, 10000, 18630, 3000, 0x0) OP_6F(0x79) Sleep(100) Fade(250) SetChrChipByIndex(0x15, 0xC) SetChrSubChip(0x15, 0x0) Sound(804, 0, 100, 0) OP_0D() Sleep(300) OP_82(0xC8, 0x0, 0xBB8, 0x12C) #C0573 ChrTalk( 0x15, "#5P#4S……我明明是女的啊!!\x02", ) CloseMessageWindow() Sleep(300) OP_82(0x12C, 0x0, 0xBB8, 0x1F4) #C0574 ChrTalk( 0x15, ( "#5P#4S你到底想耍我\x01", "到什么时候!!\x02", ) ) CloseMessageWindow() OP_63(0x101, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) OP_63(0x104, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) OP_63(0x102, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(1000) OP_64(0x101) OP_64(0x104) OP_64(0x102) Sleep(300) OP_82(0xC8, 0x0, 0x7D0, 0x12C) #C0575 ChrTalk( 0x101, "#6P#0011F啊,#4S哎哎哎哎哎哎哎哎哎……!?\x02", ) CloseMessageWindow() #C0576 ChrTalk( 0x104, ( "#12P#0305F是、是这样吗……!?\x02\x03", "#0301F唔,这么一说才发现,\x01", "长得的确很可爱啊……\x02", ) ) CloseMessageWindow() TurnDirection(0x103, 0x104, 500) Sleep(200) #C0577 ChrTalk( 0x103, ( "#6P#0205F哎,兰迪前辈\x01", "现在才注意到吗?\x02", ) ) CloseMessageWindow() TurnDirection(0x14, 0x104, 500) #C0578 ChrTalk( 0x14, ( "#5P#1809F不管怎么看,\x01", "修利也都是个\x01", "女孩子啊。\x02", ) ) CloseMessageWindow() #C0579 ChrTalk( 0x101, ( "#6P#0011F…………………………\x02\x03", "#0012F那个,抓你的时候,\x01", "我没有想到,所以就用了全力……\x02", ) ) CloseMessageWindow() OP_63(0x102, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x103, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x104, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x12, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) OP_63(0x14, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(800) def lambda_A69D(): TurnDirection(0xFE, 0x101, 500) ExitThread() QueueWorkItem(0x103, 1, lambda_A69D) def lambda_A6AA(): TurnDirection(0xFE, 0x101, 500) ExitThread() QueueWorkItem(0x102, 1, lambda_A6AA) def lambda_A6B7(): TurnDirection(0xFE, 0x101, 500) ExitThread() QueueWorkItem(0x14, 1, lambda_A6B7) #C0580 ChrTalk( 0x104, "#12P#0307F罗伊德,你……\x02", ) CloseMessageWindow() OP_63(0x15, 0x0, 2000, 0x28, 0x2B, 0x64, 0x0) OP_93(0x15, 0xE1, 0x190) Sleep(300) #C0581 ChrTalk( 0x15, ( "#11P所、所以都说了让你赶快放手啊!\x01", "你这个笨蛋……!\x02", ) ) CloseMessageWindow() TurnDirection(0x101, 0x104, 500) Sleep(500) def lambda_A741(): TurnDirection(0xFE, 0x12, 500) ExitThread() QueueWorkItem(0x101, 1, lambda_A741) OP_64(0x15) #C0582 ChrTalk( 0x101, ( "#6P#0011F可是,那个……抓她时的那种手感,\x01", "明明是个男的啊……!\x02", ) ) CloseMessageWindow() #C0583 ChrTalk( 0x102, ( "#11P#0111F哼……\x01", "连手感都还记得啊。\x02", ) ) CloseMessageWindow() #C0584 ChrTalk( 0x103, "#6P#0211F罗伊德前辈,你说了不该说的话哦。\x02", ) CloseMessageWindow() TurnDirection(0x101, 0x102, 500) Sleep(300) def lambda_A7F7(): TurnDirection(0xFE, 0x103, 500) ExitThread() QueueWorkItem(0x101, 1, lambda_A7F7) #C0585 ChrTalk( 0x101, "#5P#0012F哇啊啊,我不是这个意思……!\x02", ) CloseMessageWindow() #C0586 ChrTalk( 0x12, ( "#5P#1709F啊哈哈,只是摸一摸而已啦,\x01", "没什么大不了的!\x02", ) ) CloseMessageWindow() #C0587 ChrTalk( 0x14, "#5P#1806F罗伊德警官……\x02", ) CloseMessageWindow() OP_63(0x101, 0x0, 2000, 0x28, 0x2B, 0x64, 0x0) BeginChrThread(0x101, 1, 0, 32) #C0588 ChrTalk( 0x101, ( "#6P#0011F不、不是的!\x01", "我根本就没有打算要……!!\x02", ) ) CloseMessageWindow() SetCameraDistance(21750, 2000) FadeToDark(2000, 0, -1) OP_0D() Sound(9, 0, 100, 0) SetMessageWindowPos(-1, -1, -1, -1) SetChrName("") #A0589 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x2), "任务【调查跟踪狂!!】\x07\x00", "完成!\x02", ) ) CloseMessageWindow() OP_57(0x0) SetMessageWindowPos(14, 280, 60, 3) OP_64(0x101) EndChrThread(0x101, 0x1) SetChrPos(0x0, -280, 10020, 19290, 180) ClearChrFlags(0x103, 0x4) SetChrPos(0x12, 52530, 1050, 60070, 270) SetChrPos(0x14, 58290, 1030, 62500, 0) SetChrPos(0x15, 51930, 1050, 60970, 135) SetChrChipByIndex(0x12, 0xD) SetChrSubChip(0x12, 0x0) OP_4C(0x12, 0xFF) OP_4C(0x14, 0xFF) OP_4C(0x15, 0xFF) SetChrFlags(0xC, 0x80) SetChrBattleFlags(0xC, 0x8000) SetChrFlags(0xE, 0x80) SetChrBattleFlags(0xE, 0x8000) SetMapObjFrame(0xFF, "huku_nugippa", 0x0, 0x1) SetMapObjFrame(0xFF, "model5", 0x0, 0x1) OP_1B(0x8, 0xFF, 0xFFFF) OP_65(0x1, 0x1) OP_65(0x2, 0x1) OP_29(0x1D, 0x4, 0x10) OP_29(0x1D, 0x1, 0xA) OP_C7(0x1, 0x1000) Sleep(500) EventEnd(0x5) Return() # Function_29_8B66 end def Function_30_A9E3(): pass label("Function_30_A9E3") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_AA0F") OP_93(0xFE, 0x10E, 0x190) OP_93(0xFE, 0xB4, 0x190) OP_93(0xFE, 0x5A, 0x190) OP_93(0xFE, 0x0, 0x190) Jump("Function_30_A9E3") label("loc_AA0F") Return() # Function_30_A9E3 end def Function_31_AA10(): pass label("Function_31_AA10") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_AA35") OP_63(0xFE, 0x0, 2000, 0x26, 0x27, 0xFA, 0x2) Sleep(1500) Jump("Function_31_AA10") label("loc_AA35") Return() # Function_31_AA10 end def Function_32_AA36(): pass label("Function_32_AA36") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_AA64") TurnDirection(0xFE, 0x12, 500) Sleep(500) TurnDirection(0xFE, 0x102, 500) Sleep(500) TurnDirection(0xFE, 0x103, 500) Sleep(800) Jump("Function_32_AA36") label("loc_AA64") Return() # Function_32_AA36 end def Function_33_AA65(): pass label("Function_33_AA65") Jc((scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x2)"), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x1, 0x3)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_EXEC_OP, "OP_2A(0x1D, 0x0, 0x40)"), scpexpr(EXPR_EQUZ), scpexpr(EXPR_NEQUZ_I64), scpexpr(EXPR_END)), "loc_AA8B") Call(0, 23) Jump("loc_AAB0") label("loc_AA8B") TalkBegin(0xFF) Sound(810, 0, 100, 0) #A0590 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "似乎上了锁。\x07\x00\x02", ) ) CloseMessageWindow() OP_57(0x0) OP_5A() TalkEnd(0xFF) label("loc_AAB0") Return() # Function_33_AA65 end def Function_34_AAB1(): pass label("Function_34_AAB1") TalkBegin(0xFF) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 0)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_AC29") FadeToDark(300, 0, 100) SetChrName("") #A0591 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "葡萄酒瓶和酒杯\x01", "随意乱放在桌子上。\x02", ) ) CloseMessageWindow() #A0592 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "酒瓶里的酒喝得几乎见底了……\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() OP_63(0x0, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) Sound(23, 0, 100, 0) OP_63(0x1, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) Sound(23, 0, 100, 0) OP_63(0x2, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) Sound(23, 0, 100, 0) OP_63(0x3, 0x0, 2000, 0x10, 0x13, 0xFA, 0x1) Sound(23, 0, 100, 0) Sleep(1000) #C0593 ChrTalk( 0x101, ( "#0012F看样子,昨晚好像是\x01", "办了场酒会吧。\x02", ) ) CloseMessageWindow() #C0594 ChrTalk( 0x104, ( "#0300F不,伊莉娅·普拉提耶\x01", "的酒量似乎相当强。\x02\x03", "她平时就能\x01", "一个人喝这么多吧。\x02", ) ) CloseMessageWindow() #C0595 ChrTalk( 0x101, "#0005F呃,是这样吗……\x02", ) CloseMessageWindow() SetScenarioFlags(0x1, 0) Jump("loc_AC8E") label("loc_AC29") FadeToDark(300, 0, 100) SetChrName("") #A0596 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "葡萄酒瓶和酒杯\x01", "随意乱放在桌子上。\x02", ) ) CloseMessageWindow() #A0597 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "酒瓶里的酒喝得几乎见底了……\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() label("loc_AC8E") TalkEnd(0xFF) Return() # Function_34_AAB1 end def Function_35_AC92(): pass label("Function_35_AC92") TalkBegin(0xFF) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x1, 1)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_AD9E") FadeToDark(300, 0, 100) SetChrName("") #A0598 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "床上散乱堆放着\x01", "各种衣服……\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() #C0599 ChrTalk( 0x102, "#0106F这件明明是名牌……\x02", ) CloseMessageWindow() #C0600 ChrTalk( 0x103, "#0200F真是太乱了。\x02", ) CloseMessageWindow() #C0601 ChrTalk( 0x104, ( "#0303F大概是早上要出门时,慌慌张张从衣橱里\x01", "拿出来挑选,然后就直接乱扔在这里的吧。\x02", ) ) CloseMessageWindow() #C0602 ChrTalk( 0x101, ( "#0000F简直都能想象出\x01", "她临出门时的样子了。\x02", ) ) CloseMessageWindow() SetScenarioFlags(0x1, 1) Jump("loc_ADD9") label("loc_AD9E") FadeToDark(300, 0, 100) SetChrName("") #A0603 AnonymousTalk( 0xFF, ( scpstr(SCPSTR_CODE_COLOR, 0x5), "床上散乱堆放着\x01", "各种衣服……\x02", ) ) CloseMessageWindow() OP_57(0x0) FadeToBright(300, 0) OP_5A() label("loc_ADD9") TalkEnd(0xFF) Return() # Function_35_AC92 end def Function_36_ADDD(): pass label("Function_36_ADDD") EventBegin(0x1) #C0604 ChrTalk( 0x101, ( "#0000F现在还是专心调查\x01", "跟踪狂的事吧。\x02\x03", "毕竟伊莉娅小姐\x01", "连钥匙都交给我们了。\x02", ) ) CloseMessageWindow() Sleep(50) SetChrPos(0x0, -160, 30, 1350, 0) EventEnd(0x4) Return() # Function_36_ADDD end SaveToFile() Try(main)
# -*- coding: utf-8 -*- import scrapy from cnblogs.items import xici class XiciSpider(scrapy.Spider): name = 'xici' allowed_domains = ['xicidaili.com'] # page = 1 # basic_url = 'http://www.kuaidaili.com/free/intr/%d' # start_urls = [basic_url %page] def start_requests(self): basic_url = 'http://www.kuaidaili.com/free/intr/%d' for i in range(1,2): fullurl = basic_url %i yield scrapy.Request(fullurl,callback = self.parse) def parse(self, response): id_list = response.xpath('//tr')[1:] for ipp in id_list: item = xici() item['id_list'] = ipp.xpath('.//td[1]/text()').extract()[0] item['port'] = ipp.xpath('.//td[2]/text()').extract()[0] item['id_type'] = ipp.xpath('.//td[4]/text()').extract()[0] item['location'] = ipp.xpath('.//td[5]/text()').extract()[0] item['speed'] =ipp.xpath('.//td[6]/text()').extract()[0] item['update_time'] = ipp.xpath('.//td[7]/text()').extract()[0] yield item # while self.page <10: # self.page += 1 # yield scrapy.Request(self.basic_url % self.page ,callback = self.parse)
# -*- coding: utf-8 -*- """ Created on Sat Jun 27 15:17:40 2020 @author: hhyyz """ def findsmallest(arr): smallest=arr[0] smallest_index=0 ###重要 for i in range(len(arr)): if arr[i]<smallest: smallest=arr[i] smallest_index=i return smallest_index def selectionsort(arr): new=[] for i in range(len(arr)): smallest=findsmallest(arr) new.append(arr.pop(smallest)) #pop内传递的是index return new print(selectionsort([3,2,10,44,2,57,13]))
#!/usr/bin/env python3 import os import sys from enum import Enum from collections import defaultdict from functools import cache class Opcode(Enum): HALT = 99 ADD = 1 MULTIPLY = 2 STORE = 3 RETRIEVE = 4 JUMP_IF_TRUE = 5 JUMP_IF_FALSE = 6 LESS_THAN = 7 EQUALS = 8 class ParameterMode(Enum): POSITION_MODE = 0 IMMEDIATE_MODE = 1 class IntCodeComputer(): def __init__(self, program): self.program = program self.head = 0 @staticmethod def parse_opcode(value): digits = str(value) while len(digits) < 5: digits = '0' + digits opcode = int(digits[-2:]) parameter_modes = [int(x) for x in list(digits[:3])] parameter_modes.reverse() return opcode, parameter_modes @property def opcode(self): opcode_value = self.program[self.head] opcode, _ = IntCodeComputer.parse_opcode(opcode_value) return Opcode(opcode) def parameter_mode(self, n_parameter): opcode_value = self.program[self.head] _, parameter_modes = IntCodeComputer.parse_opcode(opcode_value) return ParameterMode(parameter_modes[n_parameter-1]) def read_parameter(self, n_parameter): param = self.program[self.head + n_parameter] if n_parameter == 3: return param param_mode = self.parameter_mode(n_parameter) if param_mode == ParameterMode.POSITION_MODE: return self.program[param] elif param_mode == ParameterMode.IMMEDIATE_MODE: return param @property def step_sise(self): return 4 def run(self, input=None): self.input = input self.output = 0 while self.opcode != Opcode.HALT: # print(self.opcode) # print(self.head) # print(self.program[self.head]) if self.opcode == Opcode.ADD: self.add() elif self.opcode == Opcode.MULTIPLY: self.multiply() elif self.opcode == Opcode.STORE: self.store() elif self.opcode == Opcode.RETRIEVE: self.retrieve() elif self.opcode == Opcode.JUMP_IF_TRUE: self.jump_if_true() elif self.opcode == Opcode.JUMP_IF_FALSE: self.jump_if_false() elif self.opcode == Opcode.LESS_THAN: self.less_than() elif self.opcode == Opcode.EQUALS: self.equals() else: raise Exception('Unkown Opcode') def store(self): parameter = self.program[self.head + 1] input = self.input self.program[parameter] = input if parameter != self.head: self.head += 2 def retrieve(self): parameter = self.program[self.head + 1] if self.parameter_mode(1) == ParameterMode.IMMEDIATE_MODE: self.output = parameter else: self.output = self.program[parameter] self.head += 2 def add(self): a = self.read_parameter(1) b = self.read_parameter(2) c = self.read_parameter(3) self.program[c] = a + b if c != self.head: self.head += 4 def multiply(self): a = self.read_parameter(1) b = self.read_parameter(2) c = self.read_parameter(3) self.program[c] = a * b if c != self.head: self.head += 4 def jump_if_true(self): a = self.read_parameter(1) b = self.read_parameter(2) if a != 0: self.head = b else: self.head += 3 def jump_if_false(self): a = self.read_parameter(1) b = self.read_parameter(2) if a == 0: self.head = b else: self.head += 3 def less_than(self): a = self.read_parameter(1) b = self.read_parameter(2) c = self.read_parameter(3) if a < b: self.program[c] = 1 else: self.program[c] = 0 if c != self.head: self.head += 4 def equals(self): a = self.read_parameter(1) b = self.read_parameter(2) c = self.read_parameter(3) if a == b: self.program[c] = 1 else: self.program[c] = 0 if c != self.head: self.head += 4 dir_path = os.path.dirname(os.path.realpath(__file__)) file = open(dir_path + "/input.txt", "r") lines = [line.strip() for line in file.readlines()] # lines = [ # 'COM)B', # 'B)C', # 'C)D', # 'D)E', # 'E)F', # 'B)G', # 'G)H', # 'D)I', # 'E)J', # 'J)K', # 'K)L', # ] G = defaultdict(list) for line in lines: left_node, right_node = line.split(')') G[left_node].append(right_node) G[right_node].append(left_node) def dfs(node, graph, visited, target_node='COM', edge_count=0): # print(node) if node in visited: return 0 if node == target_node: return edge_count visited.add(node) edge_count += 1 adj_nodes = graph[node] return dfs(adj_nodes[0], graph, visited, target_node, edge_count) def iter_dfs(node, graph, target_node='COM'): edge_count = 0 if node == target_node: return edge_count visited = set() visited.add(node) edge_count += 1 adj_nodes = graph[node] Q = [adj_nodes[0]] # print(node) while len(Q): n = Q.pop(0) # print(n) if n == target_node: break if n in visited: continue visited.add(node) edge_count += 1 adj_nodes = graph[n] Q.append(adj_nodes[0]) return edge_count # print(iter_dfs('D', G)) # print(iter_dfs('L', G)) # print(iter_dfs('I', G)) total_orbits = 0 for node in G.keys(): # print(node, iter_dfs(node, G)) # total_orbits += iter_dfs(node, G) total_orbits += dfs(node, G, set()) print(total_orbits)
import re def songDecoder(str_input): ''' Returns a proper string without WUB. Parameters: str_input (str):The string contains information that need to be decoded. Returns: (str): Readable string ''' return re.sub("(WUB)+", " ", str_input).strip()
from django.apps import AppConfig import os from .const import DATA_DIR, MODEL_DIR class AnalysisConfig(AppConfig): name = 'analysis' def ready(self): if not os.path.isdir(DATA_DIR): os.mkdir(DATA_DIR) if not os.path.isdir(MODEL_DIR): os.mkdir(MODEL_DIR)
# stdlib from typing import List # third party from result import Result # relative from ....telemetry import instrument from ...common.serde.serializable import serializable from .credentials import SyftVerifyKey from .document_store import BaseUIDStoreStash from .document_store import PartitionKey from .document_store import PartitionSettings from .document_store import QueryKeys from .project import Project from .request import Request from .response import SyftError ProjectUserVerifyKeyPartitionKey = PartitionKey( key="user_verify_key", type_=SyftVerifyKey ) @instrument @serializable(recursive_serde=True) class ProjectStash(BaseUIDStoreStash): object_type = Project settings: PartitionSettings = PartitionSettings( name=Project.__canonical_name__, object_type=Project ) def get_all_for_verify_key( self, verify_key: ProjectUserVerifyKeyPartitionKey ) -> Result[List[Request], SyftError]: if isinstance(verify_key, str): verify_key = SyftVerifyKey.from_string(verify_key) qks = QueryKeys(qks=[ProjectUserVerifyKeyPartitionKey.with_obj(verify_key)]) return self.query_all(qks=qks)
# Copyright 2009 New England Biolabs <davisp@neb.com> # # This file is part of the BioNEB package released # under the MIT license. # class StreamError(Exception): def __init__(self, filename, linenum, mesg): self.filename = filename self.linenum = linenum self.mesg = mesg def __repr__(self): return "%s(%s): %s" % (self.filename, self.linenum, self.mesg) def __str__(self): return repr(self) class Stream(object): def __init__(self, filename=None, stream=None): if filename is None and stream is None: raise ValueError("No data stream provided.") if filename is not None and stream is not None: self.filename = filename self.stream = stream elif filename is not None: self.filename = filename self.stream = open(filename) else: self.filename = stream.name self.stream = stream self.iter = iter(self.stream) self.linenum = 0 self.prev_line = None def __iter__(self): return self def next(self): if self.prev_line is not None: ret = self.prev_line self.prev_line = None return ret self.linenum += 1 return self.iter.next() def undo(self, line): self.prev_line = line def throw(self, mesg): raise StreamError(self.filename, self.linenum, mesg)
# -*- coding: utf-8 -*- """ Created on Tue Mar 2 14:05:07 2021 @author: shen """ import datetime import pandas as pd import pymysql import pymssql import numpy as np ####mssql ##商品提取数据 product_list = ['V']#['MA','PG','TA','ZC','CF','SR','RM','V','M','PP','L','I','C','AU','CU','ZN','AL','RU'] #郑商所:'MA','TA','ZC','CF','SR','RM' 大连交易所:'PG','V','M','PP','L','I','C' 上交所: 'AU','CU','ZN','AL','RU' #['etf_510050, 'etf_510300', 'etf_159919', 'index_000300'] sql语句改成 #from %s_option start_date = datetime.datetime(2021, 1, 1) end_date = datetime.datetime(2021, 3, 1) def processor_mssql(df): df["systemDate"] = df['systemDate'].astype(str).tolist() df.rename(columns={"time":"systemDate"}, inplace=True) #systemdate 2020-02-24 09:05:00 df["date"] = df["systemdate"].apply(lambda x:x.split(" ")[0]) #date 2020-02-24 df["day"] = df["systemDate"].apply(lambda x:x.split(" ")[0]) #time 09:05:00 09:10:00 df["time"] = df["systemDate"].apply(lambda x:x.split(" ")[1]) #time 09:05:00 09:10:00 #df["minite"] = df["systemDate"].apply(lambda x:int(x.split(" ")[1].split(":")[1]))#5 10 15... return df def get_eod(df): df_eod = df[df["time"]=="14:55:00"].copy() df_eod["1d_ret"] = np.log(df_eod["close_adj"]/df_eod["close_adj"].shift(1)) return df_eod conn_ssql=pymssql.connect(host="192.168.10.6",user="shengshen",password="shengshen",database="Option") list_of_dfs = {} for product in product_list: sql = "select systemDate, monthSymbol, monthDueTime, callVolume, putVolume,callPosition,putPosition " \ "from %s_future_option where systemDate>='%s' and systemDate<'%s' order by systemDate"%(product,start_date,end_date) # ssql_pre = pd.read_sql(sql, conn_ssql) mssql_df = processor_mssql(ssql_pre) list_of_dfs[product] = mssql_df #### mysql------------------------------------------------------------------------------------- product_list = ['PP','PG'] start_date = datetime.datetime(2020, 1, 1) def processor_mysql(df): df.rename(columns={"time":"systemdate"}, inplace=True) #systemdate 2020-02-24 09:05:00 df["close_adj"] = df["close"] * df["multiplier"] #multiplier df["date"] = df["systemdate"].apply(lambda x:x.split(" ")[0]) #date 2020-02-24 df["time"] = df["systemdate"].apply(lambda x:x.split(" ")[1]) #time 09:05:00 09:10:00 df["minite"] = df["systemdate"].apply(lambda x:int(x.split(" ")[1].split(":")[1]))#5 10 15... return df def end_of_day(df): df_5m = df[(df["time"]>"09:35:00") & (df["time"]<="23:00:00")].copy() #去掉开盘第一个时刻 df_5m = df_5m[df_5m["minite"]%5==0].copy() df_eod = df_5m[df_5m["time"]=="14:55:00"].copy() df_eod['year'] = df_eod["date"].apply(lambda x:x.split("-")[0]) return df_eod list_of_dfs = {} conn = pymysql.connect("192.168.10.6", "cta-reader", "cta-reader","datacenter_futures") for product in product_list: sql = "select time,close,multiplier,instrumentid from futures_5m_continuing2 where productid='%s' and time>='%s' order by time"%(product, start_date) df = pd.read_sql(sql, conn) list_of_dfs[product] = processor_mysql(df) #realtime 库-------------------------------------------------------------------------------------- conn_ssql=pymssql.connect(host="192.168.10.6",user="shengshen",password="shengshen",database="realtime_data") sql_ssql = "select distinct symbol from market where period = '5m'" all_symbol = pd.read_sql(sql_ssql, conn_ssql) #['000016.XSHG','000300.XSHG'] list_of_dfs = {} for symbol in all_symbol: sql = "select datetime, symbol, [close], volume from market where period = '5m' and symbol = '%s' order by datetime"%(symbol) list_of_dfs[symbol] = pd.read_sql(sql, conn_ssql)
text = input("Введите целое число: ") if text.isdigit(): number = int(text) prime = False if number % 2 == 0: prime = number == 2 elif number > 1: devider = 3 while devider ** 2 <= number and number % devider != 0 and number > 1: devider += 2 prime = devider ** 2 > number if prime: print(number, '- простое число') else: print(number, '- не простое число') else: print("Ошибка: введенные данные не являются целым числом.")