blob_id
stringlengths
40
40
directory_id
stringlengths
40
40
path
stringlengths
3
616
content_id
stringlengths
40
40
detected_licenses
sequencelengths
0
112
license_type
stringclasses
2 values
repo_name
stringlengths
5
115
snapshot_id
stringlengths
40
40
revision_id
stringlengths
40
40
branch_name
stringclasses
777 values
visit_date
timestamp[us]date
2015-08-06 10:31:46
2023-09-06 10:44:38
revision_date
timestamp[us]date
1970-01-01 02:38:32
2037-05-03 13:00:00
committer_date
timestamp[us]date
1970-01-01 02:38:32
2023-09-06 01:08:06
github_id
int64
4.92k
681M
star_events_count
int64
0
209k
fork_events_count
int64
0
110k
gha_license_id
stringclasses
22 values
gha_event_created_at
timestamp[us]date
2012-06-04 01:52:49
2023-09-14 21:59:50
gha_created_at
timestamp[us]date
2008-05-22 07:58:19
2023-08-21 12:35:19
gha_language
stringclasses
149 values
src_encoding
stringclasses
26 values
language
stringclasses
1 value
is_vendor
bool
2 classes
is_generated
bool
2 classes
length_bytes
int64
3
10.2M
extension
stringclasses
188 values
content
stringlengths
3
10.2M
authors
sequencelengths
1
1
author_id
stringlengths
1
132
a0b37fce115cdddf856c63213f99260b151e182f
f2e38023f424ea53e270fd93e41e5ec1c8cdb2cf
/infra/bots/gen_compile_isolate.py
ea55908bea0858d98775a084ec6753f1588e93e2
[ "BSD-3-Clause" ]
permissive
skui-org/skia
3dc425dba0142390b13dcd91d2a877c604436e1c
1698b32e63ddc8a06343e1a2f03c2916a08f519e
refs/heads/m85
2021-01-22T21:02:53.355312
2020-08-16T10:53:34
2020-08-16T13:53:35
85,350,036
23
11
BSD-3-Clause
2020-09-03T09:23:38
2017-03-17T19:59:37
C++
UTF-8
Python
false
false
6,792
py
#!/usr/bin/env python # # Copyright 2019 Google LLC # # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import difflib import os import re import subprocess import sys # Any files in Git which match these patterns will be included, either directly # or indirectly via a parent dir. PATH_PATTERNS = [ r'.*\.c$', r'.*\.cc$', r'.*\.cpp$', r'.*\.gn$', r'.*\.gni$', r'.*\.h$', r'.*\.mm$', r'.*\.storyboard$', ] # These paths are always added to the inclusion list. Note that they may not # appear in the isolate if they are included indirectly via a parent dir. EXPLICIT_PATHS = [ '../.gclient', '.clang-format', '.clang-tidy', 'bin/fetch-clang-format', 'bin/fetch-gn', 'buildtools', 'infra/bots/assets/android_ndk_darwin/VERSION', 'infra/bots/assets/android_ndk_linux/VERSION', 'infra/bots/assets/android_ndk_windows/VERSION', 'infra/bots/assets/cast_toolchain/VERSION', 'infra/bots/assets/clang_linux/VERSION', 'infra/bots/assets/clang_win/VERSION', 'infra/canvaskit', 'infra/pathkit', 'resources', 'third_party/externals', ] # If a parent path contains more than this many immediate child paths (ie. files # and dirs which are directly inside it as opposed to indirect descendants), we # will include the parent in the isolate file instead of the children. This # results in a simpler isolate file which should need to be changed less often. COMBINE_PATHS_THRESHOLD = 3 # Template for the isolate file content. ISOLATE_TMPL = '''{ 'includes': [ 'run_recipe.isolate', ], 'variables': { 'files': [ %s ], }, } ''' # Absolute path to the infra/bots dir. INFRABOTS_DIR = os.path.realpath(os.path.dirname(os.path.abspath(__file__))) # Absolute path to the compile.isolate file. ISOLATE_FILE = os.path.join(INFRABOTS_DIR, 'compile.isolate') def all_paths(): """Return all paths which are checked in to git.""" repo_root = os.path.abspath(os.path.join(INFRABOTS_DIR, os.pardir, os.pardir)) output = subprocess.check_output(['git', 'ls-files'], cwd=repo_root).rstrip() return output.splitlines() def get_relevant_paths(): """Return all checked-in paths in PATH_PATTERNS or EXPLICIT_PATHS.""" paths = [] for f in all_paths(): for regexp in PATH_PATTERNS: if re.match(regexp, f): paths.append(f) break paths.extend(EXPLICIT_PATHS) return paths class Tree(object): """Tree helps with deduplicating and collapsing paths.""" class Node(object): """Node represents an individual node in a Tree.""" def __init__(self, name): self._children = {} self._name = name self._is_leaf = False @property def is_root(self): """Return True iff this is the root node.""" return self._name is None def add(self, entry): """Add the given entry (given as a list of strings) to the Node.""" # Remove the first element if we're not the root node. if not self.is_root: if entry[0] != self._name: raise ValueError('Cannot add a non-matching entry to a Node!') entry = entry[1:] # If the entry is now empty, this node is a leaf. if not entry: self._is_leaf = True return # Add a child node. if not self._is_leaf: child = self._children.get(entry[0]) if not child: child = Tree.Node(entry[0]) self._children[entry[0]] = child child.add(entry) # If we have more than COMBINE_PATHS_THRESHOLD immediate children, # combine them into this node. immediate_children = 0 for child in self._children.itervalues(): if child._is_leaf: immediate_children += 1 if not self.is_root and immediate_children >= COMBINE_PATHS_THRESHOLD: self._is_leaf = True self._children = {} def entries(self): """Return the entries represented by this node and its children. Will not return children in the following cases: - This Node is a leaf, ie. it represents an entry which was explicitly inserted into the Tree, as opposed to only part of a path to other entries. - This Node has immediate children exceeding COMBINE_PATHS_THRESHOLD and thus has been upgraded to a leaf node. """ if self._is_leaf: return [self._name] rv = [] for child in self._children.itervalues(): for entry in child.entries(): if not self.is_root: entry = self._name + '/' + entry rv.append(entry) return rv def __init__(self): self._root = Tree.Node(None) def add(self, entry): """Add the given entry to the tree.""" split = entry.split('/') if split[-1] == '': split = split[:-1] self._root.add(split) def entries(self): """Return the list of entries in the tree. Entries will be de-duplicated as follows: - Any entry which is a sub-path of another entry will not be returned. - Any entry which was not explicitly inserted but has children exceeding the COMBINE_PATHS_THRESHOLD will be returned while its children will not be returned. """ return self._root.entries() def relpath(repo_path): """Return a relative path to the given path within the repo. The path is relative to the infra/bots dir, where the compile.isolate file lives. """ repo_path = '../../' + repo_path repo_path = repo_path.replace('../../infra/', '../') repo_path = repo_path.replace('../bots/', '') return repo_path def get_isolate_content(paths): """Construct the new content of the isolate file based on the given paths.""" lines = [' \'%s\',' % relpath(p) for p in paths] lines.sort() return ISOLATE_TMPL % '\n'.join(lines) def main(): """Regenerate the compile.isolate file, or verify that it hasn't changed.""" testing = False if len(sys.argv) == 2 and sys.argv[1] == 'test': testing = True elif len(sys.argv) != 1: print >> sys.stderr, 'Usage: %s [test]' % sys.argv[0] sys.exit(1) tree = Tree() for p in get_relevant_paths(): tree.add(p) content = get_isolate_content(tree.entries()) if testing: with open(ISOLATE_FILE, 'rb') as f: expect_content = f.read() if content != expect_content: print >> sys.stderr, 'Found diff in %s:' % ISOLATE_FILE a = expect_content.splitlines() b = content.splitlines() diff = difflib.context_diff(a, b, lineterm='') for line in diff: sys.stderr.write(line + '\n') print >> sys.stderr, 'You may need to run:\n\n\tpython %s' % sys.argv[0] sys.exit(1) else: with open(ISOLATE_FILE, 'wb') as f: f.write(content) if __name__ == '__main__': main()
bac206f101541e465cebd7416f8b801ad7cfa718
f95e04490fb00d21d7760299175c718ff6b7195c
/akshare/economic/macro_china_hk.py
623afc248a77d6a6124ee3bec0616d92caa2c269
[ "MIT" ]
permissive
wanghan0501/akshare
2dec49f84e30168d3f271404dd10f2f17bbad779
b0eaa82c2ae387ef967b96503e58572366a625f2
refs/heads/master
2023-06-27T23:50:56.737798
2021-08-03T08:53:51
2021-08-03T08:53:51
392,156,076
0
0
MIT
2021-08-03T02:05:53
2021-08-03T02:05:52
null
UTF-8
Python
false
false
11,721
py
# -*- coding:utf-8 -*- # /usr/bin/env python """ Date: 2021/7/14 21:21 Desc: 中国-香港-宏观指标 https://data.eastmoney.com/cjsj/foreign_8_0.html """ import demjson import pandas as pd import requests def marco_china_hk_cpi() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-消费者物价指数 https://data.eastmoney.com/cjsj/foreign_8_0.html :return: 消费者物价指数 :rtype: pandas.DataFrame """ url = "https://datainterface.eastmoney.com/EM_DataCenter/JS.aspx" params = { "type": "GJZB", "sty": "HKZB", "js": "({data:[(x)],pages:(pc)})", "p": "1", "ps": "2000", "mkt": "8", "stat": "0", "pageNo": "1", "pageNum": "1", "_": "1621332091873", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[1:-1]) temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]]) temp_df.columns = [ "时间", "前值", "现值", "发布日期", ] temp_df['前值'] = pd.to_numeric(temp_df['前值']) temp_df['现值'] = pd.to_numeric(temp_df['现值']) temp_df['时间'] = pd.to_datetime(temp_df['时间']).dt.date temp_df['发布日期'] = pd.to_datetime(temp_df['发布日期']).dt.date return temp_df def marco_china_hk_cpi_ratio() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-消费者物价指数年率 https://data.eastmoney.com/cjsj/foreign_8_1.html :return: 消费者物价指数年率 :rtype: pandas.DataFrame """ url = "https://datainterface.eastmoney.com/EM_DataCenter/JS.aspx" params = { "type": "GJZB", "sty": "HKZB", "js": "({data:[(x)],pages:(pc)})", "p": "1", "ps": "2000", "mkt": "8", "stat": "1", "pageNo": "1", "pageNum": "1", "_": "1621332091873", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[1:-1]) temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]]) temp_df.columns = [ "时间", "前值", "现值", "发布日期", ] temp_df['前值'] = pd.to_numeric(temp_df['前值']) temp_df['现值'] = pd.to_numeric(temp_df['现值']) temp_df['时间'] = pd.to_datetime(temp_df['时间']).dt.date temp_df['发布日期'] = pd.to_datetime(temp_df['发布日期']).dt.date return temp_df def marco_china_hk_rate_of_unemployment() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-失业率 https://data.eastmoney.com/cjsj/foreign_8_2.html :return: 失业率 :rtype: pandas.DataFrame """ url = "https://datainterface.eastmoney.com/EM_DataCenter/JS.aspx" params = { "type": "GJZB", "sty": "HKZB", "js": "({data:[(x)],pages:(pc)})", "p": "1", "ps": "2000", "mkt": "8", "stat": "2", "pageNo": "1", "pageNum": "1", "_": "1621332091873", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[1:-1]) temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]]) temp_df.columns = [ "时间", "前值", "现值", "发布日期", ] temp_df['前值'] = pd.to_numeric(temp_df['前值']) temp_df['现值'] = pd.to_numeric(temp_df['现值']) temp_df['时间'] = pd.to_datetime(temp_df['时间']).dt.date temp_df['发布日期'] = pd.to_datetime(temp_df['发布日期']).dt.date return temp_df def marco_china_hk_gbp() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港 GDP https://data.eastmoney.com/cjsj/foreign_8_3.html :return: 香港 GDP :rtype: pandas.DataFrame """ url = "https://datainterface.eastmoney.com/EM_DataCenter/JS.aspx" params = { "type": "GJZB", "sty": "HKZB", "js": "({data:[(x)],pages:(pc)})", "p": "1", "ps": "2000", "mkt": "8", "stat": "3", "pageNo": "1", "pageNum": "1", "_": "1621332091873", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[1:-1]) temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]]) temp_df.columns = [ "时间", "前值", "现值", "发布日期", ] temp_df['前值'] = pd.to_numeric(temp_df['前值']) temp_df['现值'] = pd.to_numeric(temp_df['现值']) temp_df['时间'] = pd.to_datetime(temp_df['时间']).dt.date temp_df['发布日期'] = pd.to_datetime(temp_df['发布日期']).dt.date return temp_df def marco_china_hk_gbp_ratio() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港 GDP 同比 https://data.eastmoney.com/cjsj/foreign_8_4.html :return: 香港 GDP 同比 :rtype: pandas.DataFrame """ url = "https://datainterface.eastmoney.com/EM_DataCenter/JS.aspx" params = { "type": "GJZB", "sty": "HKZB", "js": "({data:[(x)],pages:(pc)})", "p": "1", "ps": "2000", "mkt": "8", "stat": "4", "pageNo": "1", "pageNum": "1", "_": "1621332091873", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[1:-1]) temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]]) temp_df.columns = [ "时间", "前值", "现值", "发布日期", ] temp_df['前值'] = pd.to_numeric(temp_df['前值']) temp_df['现值'] = pd.to_numeric(temp_df['现值']) temp_df['时间'] = pd.to_datetime(temp_df['时间']).dt.date temp_df['发布日期'] = pd.to_datetime(temp_df['发布日期']).dt.date return temp_df def marco_china_hk_building_volume() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港楼宇买卖合约数量 https://data.eastmoney.com/cjsj/foreign_8_5.html :return: 香港楼宇买卖合约数量 :rtype: pandas.DataFrame """ url = "https://datainterface.eastmoney.com/EM_DataCenter/JS.aspx" params = { "type": "GJZB", "sty": "HKZB", "js": "({data:[(x)],pages:(pc)})", "p": "1", "ps": "2000", "mkt": "8", "stat": "5", "pageNo": "1", "pageNum": "1", "_": "1621332091873", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[1:-1]) temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]]) temp_df.columns = [ "时间", "前值", "现值", "发布日期", ] temp_df['前值'] = pd.to_numeric(temp_df['前值']) temp_df['现值'] = pd.to_numeric(temp_df['现值']) temp_df['时间'] = pd.to_datetime(temp_df['时间']).dt.date temp_df['发布日期'] = pd.to_datetime(temp_df['发布日期']).dt.date return temp_df def marco_china_hk_building_amount() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港楼宇买卖合约成交金额 https://data.eastmoney.com/cjsj/foreign_8_6.html :return: 香港楼宇买卖合约成交金额 :rtype: pandas.DataFrame """ url = "https://datainterface.eastmoney.com/EM_DataCenter/JS.aspx" params = { "type": "GJZB", "sty": "HKZB", "js": "({data:[(x)],pages:(pc)})", "p": "1", "ps": "2000", "mkt": "8", "stat": "6", "pageNo": "1", "pageNum": "1", "_": "1621332091873", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[1:-1]) temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]]) temp_df.columns = [ "时间", "前值", "现值", "发布日期", ] temp_df['前值'] = pd.to_numeric(temp_df['前值']) temp_df['现值'] = pd.to_numeric(temp_df['现值']) temp_df['时间'] = pd.to_datetime(temp_df['时间']).dt.date temp_df['发布日期'] = pd.to_datetime(temp_df['发布日期']).dt.date return temp_df def marco_china_hk_trade_diff_ratio() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港商品贸易差额年率 https://data.eastmoney.com/cjsj/foreign_8_7.html :return: 香港商品贸易差额年率 :rtype: pandas.DataFrame """ url = "https://datainterface.eastmoney.com/EM_DataCenter/JS.aspx" params = { "type": "GJZB", "sty": "HKZB", "js": "({data:[(x)],pages:(pc)})", "p": "1", "ps": "2000", "mkt": "8", "stat": "7", "pageNo": "1", "pageNum": "1", "_": "1621332091873", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[1:-1]) temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]]) temp_df.columns = [ "时间", "前值", "现值", "发布日期", ] temp_df['前值'] = pd.to_numeric(temp_df['前值']) temp_df['现值'] = pd.to_numeric(temp_df['现值']) temp_df['时间'] = pd.to_datetime(temp_df['时间']).dt.date temp_df['发布日期'] = pd.to_datetime(temp_df['发布日期']).dt.date return temp_df def marco_china_hk_ppi() -> pd.DataFrame: """ 东方财富-经济数据一览-中国香港-香港制造业 PPI 年率 https://data.eastmoney.com/cjsj/foreign_8_8.html :return: 香港制造业 PPI 年率 :rtype: pandas.DataFrame """ url = "https://datainterface.eastmoney.com/EM_DataCenter/JS.aspx" params = { "type": "GJZB", "sty": "HKZB", "js": "({data:[(x)],pages:(pc)})", "p": "1", "ps": "2000", "mkt": "8", "stat": "8", "pageNo": "1", "pageNum": "1", "_": "1621332091873", } r = requests.get(url, params=params) data_text = r.text data_json = demjson.decode(data_text[1:-1]) temp_df = pd.DataFrame([item.split(",") for item in data_json["data"]]) temp_df.columns = [ "时间", "前值", "现值", "发布日期", ] temp_df['前值'] = pd.to_numeric(temp_df['前值']) temp_df['现值'] = pd.to_numeric(temp_df['现值']) temp_df['时间'] = pd.to_datetime(temp_df['时间']).dt.date temp_df['发布日期'] = pd.to_datetime(temp_df['发布日期']).dt.date return temp_df if __name__ == "__main__": marco_china_hk_cpi_df = marco_china_hk_cpi() print(marco_china_hk_cpi_df) marco_china_hk_cpi_ratio_df = marco_china_hk_cpi_ratio() print(marco_china_hk_cpi_ratio_df) marco_china_hk_rate_of_unemployment_df = marco_china_hk_rate_of_unemployment() print(marco_china_hk_rate_of_unemployment_df) marco_china_hk_gbp_df = marco_china_hk_gbp() print(marco_china_hk_gbp_df) marco_china_hk_gbp_ratio_df = marco_china_hk_gbp_ratio() print(marco_china_hk_gbp_ratio_df) marco_china_hk_building_volume_df = marco_china_hk_building_volume() print(marco_china_hk_building_volume_df) marco_china_hk_building_amount_df = marco_china_hk_building_amount() print(marco_china_hk_building_amount_df) marco_china_hk_trade_diff_ratio_df = marco_china_hk_trade_diff_ratio() print(marco_china_hk_trade_diff_ratio_df) marco_china_hk_ppi_df = marco_china_hk_ppi() print(marco_china_hk_ppi_df)
074dc24292291db95ef328c1433be39bd9f03a5d
1804187f39dd6004250933b35ba9ce24297f32a5
/numbers.py
afd917d2a8eab414c8781481848a3bf63ccf2b70
[]
no_license
xiaomengxiangjia/Python
ecd2e3e8576364f15482669cb75b52b8790543f5
7f52a33d7956068d26347cf34d35c953b945a635
refs/heads/master
2020-03-20T23:01:09.981928
2018-08-23T09:04:53
2018-08-27T05:46:38
137,825,481
0
0
null
null
null
null
UTF-8
Python
false
false
124
py
for value in range(1,5): print(value) for value in range(1,6): print(value) numbers = list(range(1,6)) print(numbers)
c45980c203b1e902e3c8147c7d5bdbfac2138505
ad9a7fbc9077990f1a5c984fb3653129d75c42db
/code/tests/algorithm/test_stack.py
4dae70f23f38793ec0b059036ee0352127104b2c
[]
no_license
yvonne96/Algo
8b066df365089190dfac98253f39fa4398803e11
8c4a4537573a799f5b0e98e49d530322c2e9024b
refs/heads/master
2020-03-08T04:09:03.260919
2018-03-08T23:56:33
2018-03-08T23:56:33
127,913,000
1
0
null
null
null
null
UTF-8
Python
false
false
566
py
import unittest, sys from code.algorithms.stack import Stack class TestStack(unittest.TestCase): def test_empty_stack(self): l = Stack() self.assertEqual(l.items, []) def test_standard_input(self): l = Stack() l.push(1) l.push(2) l.push(3) l.push(4) self.assertEqual(l.items[0], 1) self.assertEqual(l.items[-1], 4) def test_removing_items(self): l = Stack() l.push(1) l.push(2) l.push(3) l.push(4) l.pop() l.pop() self.assertEqual(l.items[0], 1) self.assertEqual(l.items[-1], 2) if __name__ == "__main__": unittest.main()
0f65c1e22e00ab4dcd5861542f3f43c535c17d0d
6aa59fb47d7b61a28eace0e421d6d898e920f5b6
/Polymorphism-Lab/Instruments.py
284d38854667774f28d2fc5e6e12dd1b8c6727de
[]
no_license
Vigyrious/python_oop
1488bf7ffc53059a790a694660a03ebe6814f615
8c28e9f8fe6e2af0c0b35b6a691f1af65f0e8579
refs/heads/main
2023-03-18T10:12:08.768834
2021-03-12T20:50:43
2021-03-12T20:50:43
347,192,431
1
0
null
null
null
null
UTF-8
Python
false
false
284
py
def play_instrument(instrument): return instrument.play() class Guitar: def play(self): print("playing the guitar") guitar = Guitar() play_instrument(guitar) class Piano: def play(self): print("playing the piano") piano = Piano() play_instrument(piano)
d06f552d7fb63d3aaf78af615b77f1b444d6b19e
7cd8ee14711eaf33cee0d9e06e78a974fc579242
/PIFramework/juicer/spiders/flipkart_wash.py
7dc2733e0b0de68c91287489bcdc8a9283c5bbb7
[]
no_license
Chandler-Song/pi
c618117dfdd9a7496a57c69f029851e94787f591
aebc6d65b79ed43c66e7e1bf16d6d9f31b470372
refs/heads/master
2022-03-13T02:44:30.452673
2019-02-19T09:38:45
2019-02-19T09:38:45
null
0
0
null
null
null
null
UTF-8
Python
false
false
1,644
py
from juicer.utils import * from juicer.items import * from selenium import webdriver import MySQLdb import time import scrapy import json class FlipkartBestsellersbrowse(JuicerSpider): name = "flipkart_washingmachine_browse" start_urls = ['https://www.flipkart.com/washing-machines/pr?sid=j9e,abm,8qx&otracker=categorytree&page=1'] handle_httpstatus_list = [404, 302, 303, 403, 500, 999, 503] def __init__(self, *args, **kwargs): super(FlipkartBestsellersbrowse, self).__init__(*args, **kwargs) self.URL = "https://www.flipkart.com" def parse(self, response): sel = Selector(response) links = sel.xpath('//div[@class="_1UoZlX"]//a//@href').extract() for i in links : product_link = 'https://www.flipkart.com' + str(i) print product_link sk = product_link.split('&')[0].split('pid=')[-1] if product_link : self.get_page('flipkart_bestsellers_terminal', product_link, sk) for i in range(2,40) : link = "https://www.flipkart.com/washing-machines/pr?sid=j9e,abm,8qx&otracker=categorytree&page=%s"%str(i) yield Request(link,callback=self.parse_next,dont_filter=True) def parse_next(self,response): sel = Selector(response) links = sel.xpath('//div[@class="_1UoZlX"]//a//@href').extract() for i in links : product_link = 'https://www.flipkart.com' + str(i) print product_link sk = product_link.split('&')[0].split('pid=')[-1] if product_link : self.get_page('flipkart_bestsellers_terminal', product_link, sk)
e6b8029f8d1c75b1be8ceac597f28472e513d647
21b5ad37b812ed78799d4efc1649579cc83d32fb
/job/migrations/0088_auto_20200623_0947.py
bee28fda8e18b5704fa97d9dea77ef1e528e4c9d
[]
no_license
SaifulAbir/django-js-api
b6f18c319f8109884e71095ad49e08e50485bb25
fbf174b9cde2e7d25b4898f511df9c6f96d406cf
refs/heads/master
2023-02-12T16:09:21.508702
2021-01-14T09:05:15
2021-01-14T09:05:15
329,713,528
0
0
null
null
null
null
UTF-8
Python
false
false
483
py
# Generated by Django 3.0.3 on 2020-06-23 03:47 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): dependencies = [ ('job', '0087_auto_20200622_1503'), ] operations = [ migrations.AlterField( model_name='job', name='company', field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='jobs', to='job.Company'), ), ]
4945e4f89c4f71d8985d1ca5d834a121aeaecf65
0e25dc15ae9efce8bfd716d4d2041da07767968b
/qbench/benchmarks/QLib/OPENQL_converted/benstein_vazirani_40b_secret_4.py
70a87a6e7ff979c7f779547a2afb2ab54449f554
[]
no_license
alxhotel/crossbar-bench
f608fc0062b4f8a5162ec33d61c0204aaf27b6ff
3bf7536e7697d29c3089b0ba564ba22d39698b88
refs/heads/master
2021-07-13T16:06:50.085838
2020-10-04T23:39:05
2020-10-04T23:39:05
213,409,122
3
1
null
null
null
null
UTF-8
Python
false
false
5,046
py
from openql import openql as ql import os import argparse def circuit(config_file, new_scheduler='yes', scheduler='ASAP', uniform_sched= 'no', sched_commute = 'yes', mapper='base', moves='no', maptiebreak='random', initial_placement='no', output_dir_name='test_output', optimize='no', measurement=True, log_level='LOG_WARNING'): curdir = os.path.dirname(__file__) output_dir = os.path.join(curdir, output_dir_name) ql.set_option('output_dir', output_dir) ql.set_option('optimize', optimize) ql.set_option('scheduler', scheduler) ql.set_option('scheduler_uniform', uniform_sched) ql.set_option('mapper', mapper) ql.set_option('initialplace', initial_placement) ql.set_option('log_level', log_level) ql.set_option('scheduler_post179', new_scheduler) ql.set_option('scheduler_commute', sched_commute) ql.set_option('mapusemoves', moves) ql.set_option('maptiebreak', maptiebreak) config_fn = os.path.join(curdir, config_file) # platform = ql.Platform('platform_none', config_fn) platform = ql.Platform('starmon', config_fn) sweep_points = [1,2] num_circuits = 1 num_qubits = 42 p = ql.Program('benstein_vazirani_40b_secret_4', platform, num_qubits) p.set_sweep_points(sweep_points, num_circuits) k = ql.Kernel('benstein_vazirani_40b_secret_4', platform, num_qubits) k.gate('prepz',[40]) k.gate('x',[40]) k.gate('h',[0]) k.gate('h',[1]) k.gate('h',[2]) k.gate('h',[3]) k.gate('h',[4]) k.gate('h',[5]) k.gate('h',[6]) k.gate('h',[7]) k.gate('h',[8]) k.gate('h',[9]) k.gate('h',[10]) k.gate('h',[11]) k.gate('h',[12]) k.gate('h',[13]) k.gate('h',[14]) k.gate('h',[15]) k.gate('h',[16]) k.gate('h',[17]) k.gate('h',[18]) k.gate('h',[19]) k.gate('h',[20]) k.gate('h',[21]) k.gate('h',[22]) k.gate('h',[23]) k.gate('h',[24]) k.gate('h',[25]) k.gate('h',[26]) k.gate('h',[27]) k.gate('h',[28]) k.gate('h',[29]) k.gate('h',[30]) k.gate('h',[31]) k.gate('h',[32]) k.gate('h',[33]) k.gate('h',[34]) k.gate('h',[35]) k.gate('h',[36]) k.gate('h',[37]) k.gate('h',[38]) k.gate('h',[39]) k.gate('h',[40]) k.gate('cnot',[2,40]) k.gate('h',[0]) k.gate('h',[1]) k.gate('h',[2]) k.gate('h',[3]) k.gate('h',[4]) k.gate('h',[5]) k.gate('h',[6]) k.gate('h',[7]) k.gate('h',[8]) k.gate('h',[9]) k.gate('h',[10]) k.gate('h',[11]) k.gate('h',[12]) k.gate('h',[13]) k.gate('h',[14]) k.gate('h',[15]) k.gate('h',[16]) k.gate('h',[17]) k.gate('h',[18]) k.gate('h',[19]) k.gate('h',[20]) k.gate('h',[21]) k.gate('h',[22]) k.gate('h',[23]) k.gate('h',[24]) k.gate('h',[25]) k.gate('h',[26]) k.gate('h',[27]) k.gate('h',[28]) k.gate('h',[29]) k.gate('h',[30]) k.gate('h',[31]) k.gate('h',[32]) k.gate('h',[33]) k.gate('h',[34]) k.gate('h',[35]) k.gate('h',[36]) k.gate('h',[37]) k.gate('h',[38]) k.gate('h',[39]) k.gate('h',[40]) if measurement: for q in range(num_qubits): k.gate('measure', [q]) p.add_kernel(k) p.compile() ql.set_option('mapper', 'no') if __name__ == '__main__': parser = argparse.ArgumentParser(description='OpenQL compilation of a Quantum Algorithm') parser.add_argument('config_file', help='Path to the OpenQL configuration file to compile this algorithm') parser.add_argument('--new_scheduler', nargs='?', default='yes', help='Scheduler defined by Hans') parser.add_argument('--scheduler', nargs='?', default='ASAP', help='Scheduler specification (ASAP (default), ALAP, ...)') parser.add_argument('--uniform_sched', nargs='?', default='no', help='Uniform shceduler actication (yes or no)') parser.add_argument('--sched_commute', nargs='?', default='yes', help='Permits two-qubit gates to be commutable') parser.add_argument('--mapper', nargs='?', default='base', help='Mapper specification (base, minextend, minextendrc)') parser.add_argument('--moves', nargs='?', default='no', help='Let the use of moves') parser.add_argument('--maptiebreak', nargs='?', default='random', help='') parser.add_argument('--initial_placement', nargs='?', default='no', help='Initial placement specification (yes or no)') parser.add_argument('--out_dir', nargs='?', default='test_output', help='Folder name to store the compilation') parser.add_argument('--measurement', nargs='?', default=True, help='Add measurement to all the qubits in the end of the algorithm') args = parser.parse_args() try: circuit(args.config_file, args.new_scheduler, args.scheduler, args.uniform_sched, args.sched_commute, args.mapper, args.moves, args.maptiebreak, args.initial_placement, args.out_dir) except TypeError: print('\nCompiled, but some gate is not defined in the configuration file. \nThe gate will be invoked like it is.') raise
b6aa640ae5d1b56f311c966e0424a292e051b6f8
cf3549c5200e78dd81095cd3e05b3015d6bc2290
/spiderman/misc/mysql_connect.py
a68f07b31d86c61ff0ff59e817805eba61b07087
[ "Apache-2.0" ]
permissive
zzcv/python
e0c56a363188b8a3dcc030b10a7bd4aa1fc426b2
69ac0cabb7154816b1df415c0cc32966d6335718
refs/heads/master
2020-09-14T12:57:08.046356
2019-11-18T11:54:54
2019-11-18T11:54:54
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,039
py
#/usr/bin/env python #coding=utf8 """ # Author: kellanfan # Created Time : Wed 23 May 2018 08:15:18 PM CST # File Name: mysql_connect.py # Description: 关于编码问题可看: https://stackoverflow.com/questions/3942888/unicodeencodeerror-latin-1-codec-cant-encode-character """ import pymysql import yaml import sys #本地logger模块 #from logger import Logger class MysqlConnect(object): def __init__(self,filename): self.__file = filename self.__configs = self.__getconfig() #self.__mylogger = Logger('mysql_log.yaml').outputLog() try: self.__host = self.__configs['host'] self.__user = self.__configs['user'] self.__password = self.__configs['password'] self.__database = self.__configs['database'] except: #self.__mylogger.error('配置文件中缺少相关参数,请检查..') sys.exit() def __getconfig(self): with open(self.__file) as f: configs = yaml.load(f.read()) return configs def open(self): self.db = pymysql.connect(self.__host,self.__user,self.__password, self.__database, use_unicode=True, charset="utf8") self.cursor = self.db.cursor() def close(self): self.cursor.close() self.db.close() def change_data(self, sql): try: self.open() self.cursor.execute(sql) self.db.commit() return 0 except Exception as e: self.db.rollback() #self.__mylogger(e) return e finally: self.close() def select_data(self, sql): try: self.open() self.cursor.execute(sql) except Exception as e: #self.__mylogger(e) return e else: return self.cursor.fetchall() finally: self.close() if __name__ == '__main__': a = MysqlConnect('mysql_data.yaml') sql = input("the sql: ") print(a.select_data(sql))
ca3f4c1da4dc8279a558f6ee7c8303c3a57f9cc6
1edd52cf197e5ae67b5939a3beb3e70761334e62
/Notes/Notes/Udemy/Aws-automation-with-boto3/Session-9-working-with-IAM/session-refresh/Iam-user-with-console.py
0f1f43acc8d7e16bc06aa2ff501db554f5bded2f
[]
no_license
sandeepmchary/Devops_wordpress_Notes
bdcd85d526780d03c494ecb93e714e7ffe0a4d58
ffd2092162073e1e7342c6066d023d04e6ca8c1c
refs/heads/master
2022-06-18T21:33:02.471025
2022-06-12T11:14:47
2022-06-12T11:14:47
154,679,658
1
4
null
2022-05-19T16:59:57
2018-10-25T13:51:40
HTML
UTF-8
Python
false
false
1,373
py
import boto3 from random import choice import sys def get_iam_client_object(profile_name="root"): session=boto3.session.Session(profile_name="root") iam_client=session.client(service_name="iam",region_name="us-east-2") return iam_client def get_random_passwd(): passwd_length=8 char_for_passwd="abcedfghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890!@#$%^&*()?<>~`" password=[] return "".join(choice(char_for_passwd) for each_char in range(passwd_length)) def main(): iam_client=get_iam_client_object() Iam_user_name=input("Enter the Name: ") passwd=get_random_passwd() PolicyArn="arn:aws:iam::aws:policy/AdministratorAccess" try: iam_client.create_user(UserName=Iam_user_name) except Exception as e: if e.response['Error']['Code']=="EntityAlreadyexists": print ("Already Iam User with {} is exists".format(Iam_user_name)) sys.exit(0) else: print("verify with system admin") print(e) sys.exit(0) iam_client.create_login_profile(UserName=Iam_user_name,Password=passwd,PasswordResetRequired=False) iam_client.attach_user_policy(UserName=Iam_user_name,PolicyArn=PolicyArn) print("User Name:{}\nUser Password:{}".format(Iam_user_name,passwd)) return None if __name__=="__main__": main()
44ffeff10786683f3179093b0fa74827dc15a5d8
9eac3fbc5cb8a98ccaa4a394e40e955ad8f239b0
/parametres/admin.py
7141aa98b6e9e1be50310496a4b41221ca7d3662
[]
no_license
parheto10/tracability
435db9fddcdbf012cfafd6ee3739d90082018038
1c989a1219101b35f77ee5bd58b624e43368b55b
refs/heads/master
2023-02-22T07:33:35.800533
2021-01-22T13:45:59
2021-01-22T13:45:59
329,564,065
0
0
null
null
null
null
UTF-8
Python
false
false
1,108
py
from django.contrib import admin from .models import ( Sous_Prefecture, Origine, Prime, Projet, Activite, Region, Campagne, Espece, Cat_Plant, Projet_Cat, # Formation, Pepiniere, Detail_Pepiniere, Detail_Retrait ) class DetailsPepiniereAdmin(admin.TabularInline): model = Detail_Pepiniere extra = 0 class Details_RetraitAdmin(admin.TabularInline): model = Detail_Retrait extra = 0 class PepiniereAdmin(admin.ModelAdmin): inlines = [DetailsPepiniereAdmin, Details_RetraitAdmin] # inlines = [Details_RetraitAdmin] admin.site.register(Activite) admin.site.register(Campagne) # admin.site.register(Client) admin.site.register(Espece) # admin.site.register(Formation) admin.site.register(Prime) admin.site.register(Origine) admin.site.register(Projet) admin.site.register(Region) admin.site.register(Sous_Prefecture) admin.site.register(Cat_Plant) admin.site.register(Projet_Cat) admin.site.register(Pepiniere, PepiniereAdmin) # admin.site.register(Detail_pepiniere) # admin.site.register(Retrait_Plant) # Register your models here.
ff0c2471925d48342885e8a6a838750e9b1df68c
90419da201cd4948a27d3612f0b482c68026c96f
/sdk/python/pulumi_azure_nextgen/offazure/v20200707/master_site.py
e166512e49b960143ea702411c4205817bdd90fa
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
test-wiz-sec/pulumi-azure-nextgen
cd4bee5d70cb0d332c04f16bb54e17d016d2adaf
20a695af0d020b34b0f1c336e1b69702755174cc
refs/heads/master
2023-06-08T02:35:52.639773
2020-11-06T22:39:06
2020-11-06T22:39:06
312,993,761
0
0
Apache-2.0
2023-06-02T06:47:28
2020-11-15T09:04:00
null
UTF-8
Python
false
false
5,549
py
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** import warnings import pulumi import pulumi.runtime from typing import Any, Mapping, Optional, Sequence, Union from ... import _utilities, _tables from . import outputs from ._inputs import * __all__ = ['MasterSite'] class MasterSite(pulumi.CustomResource): def __init__(__self__, resource_name: str, opts: Optional[pulumi.ResourceOptions] = None, e_tag: Optional[pulumi.Input[str]] = None, location: Optional[pulumi.Input[str]] = None, name: Optional[pulumi.Input[str]] = None, properties: Optional[pulumi.Input[pulumi.InputType['MasterSitePropertiesArgs']]] = None, resource_group_name: Optional[pulumi.Input[str]] = None, site_name: Optional[pulumi.Input[str]] = None, __props__=None, __name__=None, __opts__=None): """ Site REST Resource. :param str resource_name: The name of the resource. :param pulumi.ResourceOptions opts: Options for the resource. :param pulumi.Input[str] e_tag: eTag for concurrency control. :param pulumi.Input[str] location: Azure location in which Sites is created. :param pulumi.Input[str] name: Name of the Master site. :param pulumi.Input[pulumi.InputType['MasterSitePropertiesArgs']] properties: Nested properties of Master site. :param pulumi.Input[str] resource_group_name: The name of the resource group. The name is case insensitive. :param pulumi.Input[str] site_name: Site name. """ if __name__ is not None: warnings.warn("explicit use of __name__ is deprecated", DeprecationWarning) resource_name = __name__ if __opts__ is not None: warnings.warn("explicit use of __opts__ is deprecated, use 'opts' instead", DeprecationWarning) opts = __opts__ if opts is None: opts = pulumi.ResourceOptions() if not isinstance(opts, pulumi.ResourceOptions): raise TypeError('Expected resource options to be a ResourceOptions instance') if opts.version is None: opts.version = _utilities.get_version() if opts.id is None: if __props__ is not None: raise TypeError('__props__ is only valid when passed in combination with a valid opts.id to get an existing resource') __props__ = dict() __props__['e_tag'] = e_tag __props__['location'] = location __props__['name'] = name __props__['properties'] = properties if resource_group_name is None: raise TypeError("Missing required property 'resource_group_name'") __props__['resource_group_name'] = resource_group_name if site_name is None: raise TypeError("Missing required property 'site_name'") __props__['site_name'] = site_name __props__['type'] = None alias_opts = pulumi.ResourceOptions(aliases=[pulumi.Alias(type_="azure-nextgen:offazure/latest:MasterSite")]) opts = pulumi.ResourceOptions.merge(opts, alias_opts) super(MasterSite, __self__).__init__( 'azure-nextgen:offazure/v20200707:MasterSite', resource_name, __props__, opts) @staticmethod def get(resource_name: str, id: pulumi.Input[str], opts: Optional[pulumi.ResourceOptions] = None) -> 'MasterSite': """ Get an existing MasterSite resource's state with the given name, id, and optional extra properties used to qualify the lookup. :param str resource_name: The unique name of the resulting resource. :param pulumi.Input[str] id: The unique provider ID of the resource to lookup. :param pulumi.ResourceOptions opts: Options for the resource. """ opts = pulumi.ResourceOptions.merge(opts, pulumi.ResourceOptions(id=id)) __props__ = dict() return MasterSite(resource_name, opts=opts, __props__=__props__) @property @pulumi.getter(name="eTag") def e_tag(self) -> pulumi.Output[Optional[str]]: """ eTag for concurrency control. """ return pulumi.get(self, "e_tag") @property @pulumi.getter def location(self) -> pulumi.Output[Optional[str]]: """ Azure location in which Sites is created. """ return pulumi.get(self, "location") @property @pulumi.getter def name(self) -> pulumi.Output[Optional[str]]: """ Name of the Master site. """ return pulumi.get(self, "name") @property @pulumi.getter def properties(self) -> pulumi.Output['outputs.MasterSitePropertiesResponse']: """ Nested properties of Master site. """ return pulumi.get(self, "properties") @property @pulumi.getter def type(self) -> pulumi.Output[str]: """ Type of resource. Type = Microsoft.OffAzure/MasterSites. """ return pulumi.get(self, "type") def translate_output_property(self, prop): return _tables.CAMEL_TO_SNAKE_CASE_TABLE.get(prop) or prop def translate_input_property(self, prop): return _tables.SNAKE_TO_CAMEL_CASE_TABLE.get(prop) or prop
a8cbf404de7b726271f147d0ed8d59f4224a63ff
00d7824d2699fc7a90de167e04ff49a210458f2c
/tests/core/test_datamodules.py
3e683025e8867c91acf60b9aa88cfbe73261b031
[ "Apache-2.0", "LicenseRef-scancode-proprietary-license" ]
permissive
jtamir/pytorch-lightning
867feab3062ed2e3357b640588220efde349f97b
9b89a24b04dff50c0595c5399e9ba61b39745def
refs/heads/master
2021-07-10T19:40:53.410989
2020-11-04T05:59:16
2020-11-04T06:00:28
213,468,663
1
0
Apache-2.0
2019-10-07T19:28:07
2019-10-07T19:28:06
null
UTF-8
Python
false
false
12,465
py
# Copyright The PyTorch Lightning team. # # 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 pickle from argparse import ArgumentParser from unittest.mock import MagicMock from typing import Optional import pytest import torch from torch.utils.data import DataLoader, random_split from pytorch_lightning import LightningDataModule, Trainer, seed_everything from tests.base import EvalModelTemplate from tests.base.datasets import TrialMNIST from tests.base.datamodules import TrialMNISTDataModule from tests.base.develop_utils import reset_seed from pytorch_lightning.utilities.model_utils import is_overridden from pytorch_lightning.accelerators.gpu_accelerator import GPUAccelerator from pytorch_lightning.callbacks import ModelCheckpoint def test_can_prepare_data(tmpdir): dm = TrialMNISTDataModule() trainer = Trainer() trainer.datamodule = dm # 1 no DM # prepare_data_per_node = True # local rank = 0 (True) trainer.prepare_data_per_node = True trainer.local_rank = 0 assert trainer.data_connector.can_prepare_data() # local rank = 1 (False) trainer.local_rank = 1 assert not trainer.data_connector.can_prepare_data() # prepare_data_per_node = False (prepare across all nodes) # global rank = 0 (True) trainer.prepare_data_per_node = False trainer.node_rank = 0 trainer.local_rank = 0 assert trainer.data_connector.can_prepare_data() # global rank = 1 (False) trainer.node_rank = 1 trainer.local_rank = 0 assert not trainer.data_connector.can_prepare_data() trainer.node_rank = 0 trainer.local_rank = 1 assert not trainer.data_connector.can_prepare_data() # 2 dm # prepar per node = True # local rank = 0 (True) trainer.prepare_data_per_node = True trainer.local_rank = 0 # is_overridden prepare data = True # has been called # False dm._has_prepared_data = True assert not trainer.data_connector.can_prepare_data() # has not been called # True dm._has_prepared_data = False assert trainer.data_connector.can_prepare_data() # is_overridden prepare data = False # True dm.prepare_data = None assert trainer.data_connector.can_prepare_data() def test_hooks_no_recursion_error(tmpdir): # hooks were appended in cascade every tine a new data module was instantiated leading to a recursion error. # See https://github.com/PyTorchLightning/pytorch-lightning/issues/3652 class DummyDM(LightningDataModule): def setup(self, *args, **kwargs): pass def prepare_data(self, *args, **kwargs): pass for i in range(1005): dm = DummyDM() dm.setup() dm.prepare_data() def test_base_datamodule(tmpdir): dm = TrialMNISTDataModule() dm.prepare_data() dm.setup() def test_base_datamodule_with_verbose_setup(tmpdir): dm = TrialMNISTDataModule() dm.prepare_data() dm.setup('fit') dm.setup('test') def test_data_hooks_called(tmpdir): dm = TrialMNISTDataModule() assert dm.has_prepared_data is False assert dm.has_setup_fit is False assert dm.has_setup_test is False dm.prepare_data() assert dm.has_prepared_data is True assert dm.has_setup_fit is False assert dm.has_setup_test is False dm.setup() assert dm.has_prepared_data is True assert dm.has_setup_fit is True assert dm.has_setup_test is True def test_data_hooks_called_verbose(tmpdir): dm = TrialMNISTDataModule() assert dm.has_prepared_data is False assert dm.has_setup_fit is False assert dm.has_setup_test is False dm.prepare_data() assert dm.has_prepared_data is True assert dm.has_setup_fit is False assert dm.has_setup_test is False dm.setup('fit') assert dm.has_prepared_data is True assert dm.has_setup_fit is True assert dm.has_setup_test is False dm.setup('test') assert dm.has_prepared_data is True assert dm.has_setup_fit is True assert dm.has_setup_test is True def test_data_hooks_called_with_stage_kwarg(tmpdir): dm = TrialMNISTDataModule() dm.prepare_data() assert dm.has_prepared_data is True dm.setup(stage='fit') assert dm.has_setup_fit is True assert dm.has_setup_test is False dm.setup(stage='test') assert dm.has_setup_fit is True assert dm.has_setup_test is True def test_dm_add_argparse_args(tmpdir): parser = ArgumentParser() parser = TrialMNISTDataModule.add_argparse_args(parser) args = parser.parse_args(['--data_dir', './my_data']) assert args.data_dir == './my_data' def test_dm_init_from_argparse_args(tmpdir): parser = ArgumentParser() parser = TrialMNISTDataModule.add_argparse_args(parser) args = parser.parse_args(['--data_dir', './my_data']) dm = TrialMNISTDataModule.from_argparse_args(args) dm.prepare_data() dm.setup() def test_dm_pickle_after_init(tmpdir): dm = TrialMNISTDataModule() pickle.dumps(dm) def test_train_loop_only(tmpdir): dm = TrialMNISTDataModule(tmpdir) model = EvalModelTemplate() model.validation_step = None model.validation_step_end = None model.validation_epoch_end = None model.test_step = None model.test_step_end = None model.test_epoch_end = None trainer = Trainer( default_root_dir=tmpdir, max_epochs=3, weights_summary=None, ) # fit model result = trainer.fit(model, dm) assert result == 1 assert trainer.logger_connector.callback_metrics['loss'] < 0.6 def test_train_val_loop_only(tmpdir): reset_seed() dm = TrialMNISTDataModule(tmpdir) model = EvalModelTemplate() model.validation_step = None model.validation_step_end = None model.validation_epoch_end = None trainer = Trainer( default_root_dir=tmpdir, max_epochs=3, weights_summary=None, ) # fit model result = trainer.fit(model, dm) assert result == 1 assert trainer.logger_connector.callback_metrics['loss'] < 0.6 def test_dm_checkpoint_save(tmpdir): reset_seed() dm = TrialMNISTDataModule(tmpdir) model = EvalModelTemplate() trainer = Trainer( default_root_dir=tmpdir, max_epochs=3, weights_summary=None, checkpoint_callback=ModelCheckpoint(dirpath=tmpdir, monitor='early_stop_on') ) # fit model result = trainer.fit(model, dm) checkpoint_path = list(trainer.checkpoint_callback.best_k_models.keys())[0] checkpoint = torch.load(checkpoint_path) assert dm.__class__.__name__ in checkpoint assert checkpoint[dm.__class__.__name__] == dm.__class__.__name__ def test_test_loop_only(tmpdir): reset_seed() dm = TrialMNISTDataModule(tmpdir) model = EvalModelTemplate() trainer = Trainer( default_root_dir=tmpdir, max_epochs=3, weights_summary=None, ) trainer.test(model, datamodule=dm) def test_full_loop(tmpdir): reset_seed() dm = TrialMNISTDataModule(tmpdir) model = EvalModelTemplate() trainer = Trainer( default_root_dir=tmpdir, max_epochs=3, weights_summary=None, deterministic=True, ) # fit model result = trainer.fit(model, dm) assert result == 1 # test result = trainer.test(datamodule=dm) result = result[0] assert result['test_acc'] > 0.8 def test_trainer_attached_to_dm(tmpdir): reset_seed() dm = TrialMNISTDataModule(tmpdir) model = EvalModelTemplate() trainer = Trainer( default_root_dir=tmpdir, max_epochs=3, weights_summary=None, deterministic=True, ) # fit model result = trainer.fit(model, dm) assert result == 1 assert dm.trainer is not None # test result = trainer.test(datamodule=dm) result = result[0] assert dm.trainer is not None @pytest.mark.skipif(torch.cuda.device_count() < 1, reason="test requires multi-GPU machine") def test_full_loop_single_gpu(tmpdir): reset_seed() dm = TrialMNISTDataModule(tmpdir) model = EvalModelTemplate() trainer = Trainer( default_root_dir=tmpdir, max_epochs=3, weights_summary=None, gpus=1, deterministic=True, ) # fit model result = trainer.fit(model, dm) assert result == 1 # test result = trainer.test(datamodule=dm) result = result[0] assert result['test_acc'] > 0.8 @pytest.mark.skipif(torch.cuda.device_count() < 2, reason="test requires multi-GPU machine") def test_full_loop_dp(tmpdir): reset_seed() dm = TrialMNISTDataModule(tmpdir) model = EvalModelTemplate() trainer = Trainer( default_root_dir=tmpdir, max_epochs=3, weights_summary=None, distributed_backend='dp', gpus=2, deterministic=True, ) # fit model result = trainer.fit(model, dm) assert result == 1 # test result = trainer.test(datamodule=dm) result = result[0] assert result['test_acc'] > 0.8 @pytest.mark.skipif(torch.cuda.device_count() < 1, reason="test requires multi-GPU machine") def test_dm_transfer_batch_to_device(tmpdir): class CustomBatch: def __init__(self, data): self.samples = data[0] self.targets = data[1] class CurrentTestDM(LightningDataModule): hook_called = False def transfer_batch_to_device(self, data, device): self.hook_called = True if isinstance(data, CustomBatch): data.samples = data.samples.to(device) data.targets = data.targets.to(device) else: data = super().transfer_batch_to_device(data, device) return data model = EvalModelTemplate() dm = CurrentTestDM() batch = CustomBatch((torch.zeros(5, 28), torch.ones(5, 1, dtype=torch.long))) trainer = Trainer(gpus=1) # running .fit() would require us to implement custom data loaders, we mock the model reference instead trainer.get_model = MagicMock(return_value=model) if is_overridden('transfer_batch_to_device', dm): model.transfer_batch_to_device = dm.transfer_batch_to_device trainer.accelerator_backend = GPUAccelerator(trainer) batch_gpu = trainer.accelerator_backend.batch_to_device(batch, torch.device('cuda:0')) expected = torch.device('cuda', 0) assert dm.hook_called assert batch_gpu.samples.device == batch_gpu.targets.device == expected class CustomMNISTDataModule(LightningDataModule): def __init__(self, data_dir: str = "./"): super().__init__() self.data_dir = data_dir self._epochs_called_for = [] def prepare_data(self): TrialMNIST(self.data_dir, train=True, download=True) def setup(self, stage: Optional[str] = None): mnist_full = TrialMNIST( root=self.data_dir, train=True, num_samples=64, download=True ) self.mnist_train, self.mnist_val = random_split(mnist_full, [128, 64]) self.dims = self.mnist_train[0][0].shape def train_dataloader(self): assert self.trainer.current_epoch not in self._epochs_called_for self._epochs_called_for.append(self.trainer.current_epoch) return DataLoader(self.mnist_train, batch_size=4) def test_dm_reload_dataloaders_every_epoch(tmpdir): """Test datamodule, where trainer argument reload_dataloaders_every_epoch is set to True/False""" dm = CustomMNISTDataModule(tmpdir) model = EvalModelTemplate() model.validation_step = None model.validation_step_end = None model.validation_epoch_end = None model.test_step = None model.test_step_end = None model.test_epoch_end = None trainer = Trainer( default_root_dir=tmpdir, max_epochs=2, limit_train_batches=0.01, reload_dataloaders_every_epoch=True, ) trainer.fit(model, dm)
4bbdb32dbed101f2c682eb87ec43eb1ae55b552e
156a4b52240069ee10df53b39c20102d7368fcd1
/L13/shortly/shortly/wsgi.py
970004b25eb425d27f458d6a023ef55bf3ffdb74
[]
no_license
Serdiuk-Roman/for_lit
0d7072b0d5da336be5bfb9c6370c1673a62e4574
80dc5a5bd8b8258a88b5801073296e034ce04d5a
refs/heads/master
2022-12-12T14:54:14.591181
2019-08-11T08:08:19
2019-08-11T08:08:19
126,608,657
0
0
null
2022-12-08T02:18:39
2018-03-24T14:42:45
Python
UTF-8
Python
false
false
391
py
""" WSGI config for shortly project. It exposes the WSGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/2.0/howto/deployment/wsgi/ """ import os from django.core.wsgi import get_wsgi_application os.environ.setdefault("DJANGO_SETTINGS_MODULE", "shortly.settings") application = get_wsgi_application()
289e6c858918567ab765985e9961d24038ccf7bc
09e57dd1374713f06b70d7b37a580130d9bbab0d
/data/p4VQE/R3/benchmark/startQiskit567.py
2b27d4b62ab6147e30a8d70f873a234565f322af
[ "BSD-3-Clause" ]
permissive
UCLA-SEAL/QDiff
ad53650034897abb5941e74539e3aee8edb600ab
d968cbc47fe926b7f88b4adf10490f1edd6f8819
refs/heads/main
2023-08-05T04:52:24.961998
2021-09-19T02:56:16
2021-09-19T02:56:16
405,159,939
2
0
null
null
null
null
UTF-8
Python
false
false
2,528
py
# qubit number=3 # total number=13 import numpy as np from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ import networkx as nx from qiskit.visualization import plot_histogram from typing import * from pprint import pprint from math import log2 from collections import Counter from qiskit.test.mock import FakeVigo, FakeYorktown kernel = 'circuit/bernstein' def make_circuit(n:int) -> QuantumCircuit: # circuit begin input_qubit = QuantumRegister(n,"qc") prog = QuantumCircuit(input_qubit) prog.h(input_qubit[1]) # number=2 prog.h(input_qubit[2]) # number=3 prog.h(input_qubit[3]) # number=4 prog.y(input_qubit[3]) # number=5 for edge in E: k = edge[0] l = edge[1] prog.cp(-2 * gamma, input_qubit[k-1], input_qubit[l-1]) prog.p(gamma, k) prog.p(gamma, l) prog.rx(2 * beta, range(len(V))) prog.swap(input_qubit[1],input_qubit[0]) # number=6 prog.swap(input_qubit[1],input_qubit[0]) # number=7 prog.x(input_qubit[0]) # number=8 prog.y(input_qubit[3]) # number=10 prog.x(input_qubit[0]) # number=9 prog.y(input_qubit[0]) # number=11 prog.y(input_qubit[0]) # number=12 # circuit end return prog if __name__ == '__main__': n = 4 V = np.arange(0, n, 1) E = [(0, 1, 1.0), (0, 2, 1.0), (1, 2, 1.0), (3, 2, 1.0), (3, 1, 1.0)] G = nx.Graph() G.add_nodes_from(V) G.add_weighted_edges_from(E) step_size = 0.1 a_gamma = np.arange(0, np.pi, step_size) a_beta = np.arange(0, np.pi, step_size) a_gamma, a_beta = np.meshgrid(a_gamma, a_beta) F1 = 3 - (np.sin(2 * a_beta) ** 2 * np.sin(2 * a_gamma) ** 2 - 0.5 * np.sin(4 * a_beta) * np.sin(4 * a_gamma)) * ( 1 + np.cos(4 * a_gamma) ** 2) result = np.where(F1 == np.amax(F1)) a = list(zip(result[0], result[1]))[0] gamma = a[0] * step_size beta = a[1] * step_size prog = make_circuit(4) sample_shot =5600 writefile = open("../data/startQiskit567.csv", "w") # prog.draw('mpl', filename=(kernel + '.png')) backend = BasicAer.get_backend('qasm_simulator') circuit1 = transpile(prog, FakeYorktown()) circuit1.measure_all() prog = circuit1 info = execute(prog,backend=backend, shots=sample_shot).result().get_counts() print(info, file=writefile) print("results end", file=writefile) print(circuit1.depth(), file=writefile) print(circuit1, file=writefile) writefile.close()
a5817120be6c64eee97cb0929f8c7231d1ade532
6b7a2b5414f4a3f9ed116fa73a2ae5c732957ed4
/items/views.py
a7fbcfbabfad1c1ca64f3c084710a71e7dc8a912
[]
no_license
sankha555/bestro
366e02838775484940cb224800ac07f0a9cbd3d3
7e26909fe2c9722a005630cde24e9d6433463ba3
refs/heads/main
2023-01-08T09:06:15.999259
2020-10-31T10:51:16
2020-10-31T10:51:16
308,825,633
0
0
null
2020-10-31T08:47:10
2020-10-31T07:11:06
JavaScript
UTF-8
Python
false
false
2,240
py
from django.shortcuts import render, redirect, get_object_or_404 from django.contrib.admin.views.decorators import staff_member_required from django.contrib import messages from items.models import Item, Combo from items.forms import ItemForm, ComboForm @staff_member_required def create_item(request): if request.method == "POST": form = ItemForm(request.POST, request.FILES) if form.is_valid(): form.save() messages.success(request, f'Item Added to Menu!') return redirect('menu') else: form = ItemForm() context = { 'form' : form } return render(request, 'items/create_item.htm', context) @staff_member_required def update_item(request, pk): item = get_object_or_404(Item, pk = pk) if request.method == "POST": form = ItemForm(request.POST, instance = item) if form.is_valid(): form.save() messages.success(request, f'Item Updated!') return redirect('menu') else: form = ItemForm(instance = item) context = { 'form' : form, 'item' : item } return render(request, 'items/update_item.htm', context) @staff_member_required def create_combo(request): if request.method == "POST": form = ComboForm(request.POST) if form.is_valid(): form.save() return redirect('create_combo') else: form = ComboForm() context = { 'form' : form } return render(request, 'combos/create_combo.htm', context) @staff_member_required def update_combo(request, pk): combo = get_object_or_404(Combo, pk = pk) if request.method == "POST": form = ComboForm(request.POST, instance = combo) if form.is_valid(): form.save() return redirect('create_combo') else: form = ComboForm(instance = combo) context = { 'form' : form, 'combo' : combo } return render(request, 'items/create_combo.htm', context) # Create your views here.
531011d5c9305e5f6faed201af1fcb85dd90e145
acd41dc7e684eb2e58b6bef2b3e86950b8064945
/res/packages/scripts/scripts/client/FX/Events/AlignModel.py
b24c7f10e3f9418dbdf4aeea2f0efb6d859aa723
[]
no_license
webiumsk/WoT-0.9.18.0
e07acd08b33bfe7c73c910f5cb2a054a58a9beea
89979c1ad547f1a1bbb2189f5ee3b10685e9a216
refs/heads/master
2021-01-20T09:37:10.323406
2017-05-04T13:51:43
2017-05-04T13:51:43
90,268,530
0
0
null
null
null
null
WINDOWS-1250
Python
false
false
1,280
py
# 2017.05.04 15:20:53 Střední Evropa (letní čas) # Embedded file name: scripts/client/FX/Events/AlignModel.py from FX.Event import Event from FX import s_sectionProcessors from bwdebug import * class AlignModel(Event): """ This class implements an Event that sets the basis vectors for a PyModel. """ def go(self, effect, actor, source, target, **kargs): """ This method initiates the AlignModel event. It requires a "Basis" parameter to be passed into the variable arguments dictionary, which is a tuple of (dir,pos). """ try: if kargs.has_key('ModelAlignment'): dir, pos = kargs['ModelAlignment'] elif kargs.has_key('Basis'): dir, pos = kargs['Basis'] actor.position = pos actor.yaw = math.atan2(dir.x, dir.z) except: WARNING_MSG('No basis was passed into the argument list', self, actor, source, target, kargs) return 0.0 s_sectionProcessors['AlignModel'] = AlignModel # okay decompyling C:\Users\PC\wotmods\files\originals\res\packages\scripts\scripts\client\FX\Events\AlignModel.pyc # decompiled 1 files: 1 okay, 0 failed, 0 verify failed # 2017.05.04 15:20:53 Střední Evropa (letní čas)
7aea9f98bee4a5a2de84f4558e180981aa16ab40
fc9f4e6af9df3d05c507c9e114b956dfc26cd0f0
/chapters/2023/Qualité logicielle dans les notebooks Jupyter/assets/python-scripts/C3_W2_lecture_notebook_RNNs.py
246cfe64c42ed0bab89fbbc3a638f16071bd5359
[]
no_license
RIMEL-UCA/RIMEL-UCA.github.io
0f1334bf9ba77a5ef59c63065f2dbe7c00d70f25
3009e69eab06c9dc4f6f2b7f866fa0b00f909516
refs/heads/master
2023-07-03T16:00:05.606141
2023-02-12T14:40:35
2023-02-12T14:40:35
230,765,683
7
29
null
2023-03-05T22:09:35
2019-12-29T15:04:00
Jupyter Notebook
UTF-8
Python
false
false
8,422
py
#!/usr/bin/env python # coding: utf-8 # # Vanilla RNNs, GRUs and the `scan` function # In this notebook, you will learn how to define the forward method for vanilla RNNs and GRUs. Additionally, you will see how to define and use the function `scan` to compute forward propagation for RNNs. # # By completing this notebook, you will: # # - Be able to define the forward method for vanilla RNNs and GRUs # - Be able to define the `scan` function to perform forward propagation for RNNs # - Understand how forward propagation is implemented for RNNs. # In[1]: import numpy as np from numpy import random from time import perf_counter # An implementation of the `sigmoid` function is provided below so you can use it in this notebook. # In[2]: def sigmoid(x): # Sigmoid function return 1.0 / (1.0 + np.exp(-x)) # # Part 1: Forward method for vanilla RNNs and GRUs # In this part of the notebook, you'll see the implementation of the forward method for a vanilla RNN and you'll implement that same method for a GRU. For this excersice you'll use a set of random weights and variables with the following dimensions: # # - Embedding size (`emb`) : 128 # - Hidden state size (`h_dim`) : (16,1) # # The weights `w_` and biases `b_` are initialized with dimensions (`h_dim`, `emb + h_dim`) and (`h_dim`, 1). We expect the hidden state `h_t` to be a column vector with size (`h_dim`,1) and the initial hidden state `h_0` is a vector of zeros. # In[3]: random.seed(10) # Random seed, so your results match ours emb = 128 # Embedding size T = 256 # Number of variables in the sequences h_dim = 16 # Hidden state dimension h_0 = np.zeros((h_dim, 1)) # Initial hidden state # Random initialization of weights and biases w1 = random.standard_normal((h_dim, emb+h_dim)) w2 = random.standard_normal((h_dim, emb+h_dim)) w3 = random.standard_normal((h_dim, emb+h_dim)) b1 = random.standard_normal((h_dim, 1)) b2 = random.standard_normal((h_dim, 1)) b3 = random.standard_normal((h_dim, 1)) X = random.standard_normal((T, emb, 1)) weights = [w1, w2, w3, b1, b2, b3] # ## 1.1 Forward method for vanilla RNNs # The vanilla RNN cell is quite straight forward. Its most general structure is presented in the next figure: # # <img src="RNN.PNG" width="400"/> # # As you saw in the lecture videos, the computations made in a vanilla RNN cell are equivalent to the following equations: # # \begin{equation} # h^{<t>}=g(W_{h}[h^{<t-1>},x^{<t>}] + b_h) # \label{eq: htRNN} # \end{equation} # # \begin{equation} # \hat{y}^{<t>}=g(W_{yh}h^{<t>} + b_y) # \label{eq: ytRNN} # \end{equation} # # where $[h^{<t-1>},x^{<t>}]$ means that $h^{<t-1>}$ and $x^{<t>}$ are concatenated together. In the next cell we provide the implementation of the forward method for a vanilla RNN. # In[4]: def forward_V_RNN(inputs, weights): # Forward propagation for a a single vanilla RNN cell x, h_t = inputs # weights. wh, _, _, bh, _, _ = weights # new hidden state h_t = np.dot(wh, np.concatenate([h_t, x])) + bh h_t = sigmoid(h_t) return h_t, h_t # As you can see, we omitted the computation of $\hat{y}^{<t>}$. This was done for the sake of simplicity, so you can focus on the way that hidden states are updated here and in the GRU cell. # ## 1.2 Forward method for GRUs # A GRU cell have more computations than the ones that vanilla RNNs have. You can see this visually in the following diagram: # # <img src="GRU.PNG" width="400"/> # # As you saw in the lecture videos, GRUs have relevance $\Gamma_r$ and update $\Gamma_u$ gates that control how the hidden state $h^{<t>}$ is updated on every time step. With these gates, GRUs are capable of keeping relevant information in the hidden state even for long sequences. The equations needed for the forward method in GRUs are provided below: # # \begin{equation} # \Gamma_r=\sigma{(W_r[h^{<t-1>}, x^{<t>}]+b_r)} # \end{equation} # # \begin{equation} # \Gamma_u=\sigma{(W_u[h^{<t-1>}, x^{<t>}]+b_u)} # \end{equation} # # \begin{equation} # c^{<t>}=\tanh{(W_h[\Gamma_r*h^{<t-1>},x^{<t>}]+b_h)} # \end{equation} # # \begin{equation} # h^{<t>}=\Gamma_u*c^{<t>}+(1-\Gamma_u)*h^{<t-1>} # \end{equation} # # In the next cell, please implement the forward method for a GRU cell by computing the update `u` and relevance `r` gates, and the candidate hidden state `c`. # In[5]: def forward_GRU(inputs, weights): # Forward propagation for a single GRU cell x, h_t = inputs # weights. wu, wr, wc, bu, br, bc = weights # Update gate ### START CODE HERE (1-2 lINES) ### u = np.dot(wu, np.concatenate([h_t, x])) + bu u = sigmoid(u) ### END CODE HERE ### # Relevance gate ### START CODE HERE (1-2 lINES) ### r = np.dot(wr, np.concatenate([h_t, x])) + br r = sigmoid(u) ### END CODE HERE ### # Candidate hidden state ### START CODE HERE (1-2 lINES) ### c = np.dot(wc, np.concatenate([r * h_t, x])) + bc c = np.tanh(c) ### END CODE HERE ### # New Hidden state h_t h_t = u* c + (1 - u)* h_t return h_t, h_t # Run the following cell to check your implementation. # In[6]: forward_GRU([X[1],h_0], weights)[0] # Expected output: # <pre> # array([[ 9.77779014e-01], # [-9.97986240e-01], # [-5.19958083e-01], # [-9.99999886e-01], # [-9.99707004e-01], # [-3.02197037e-04], # [-9.58733503e-01], # [ 2.10804828e-02], # [ 9.77365398e-05], # [ 9.99833090e-01], # [ 1.63200940e-08], # [ 8.51874303e-01], # [ 5.21399924e-02], # [ 2.15495959e-02], # [ 9.99878828e-01], # [ 9.77165472e-01]]) # </pre> # # Part 2: Implementation of the `scan` function # In the lectures you saw how the `scan` function is used for forward propagation in RNNs. It takes as inputs: # # - `fn` : the function to be called recurrently (i.e. `forward_GRU`) # - `elems` : the list of inputs for each time step (`X`) # - `weights` : the parameters needed to compute `fn` # - `h_0` : the initial hidden state # # `scan` goes through all the elements `x` in `elems`, calls the function `fn` with arguments ([`x`, `h_t`],`weights`), stores the computed hidden state `h_t` and appends the result to a list `ys`. Complete the following cell by calling `fn` with arguments ([`x`, `h_t`],`weights`). # In[7]: def scan(fn, elems, weights, h_0=None): # Forward propagation for RNNs h_t = h_0 ys = [] for x in elems: ### START CODE HERE (1 lINE) ### y, h_t = fn([x, h_t], weights) ### END CODE HERE ### ys.append(y) return ys, h_t # # Part 3: Comparison between vanilla RNNs and GRUs # You have already seen how forward propagation is computed for vanilla RNNs and GRUs. As a quick recap, you need to have a forward method for the recurrent cell and a function like `scan` to go through all the elements from a sequence using a forward method. You saw that GRUs performed more computations than vanilla RNNs, and you can check that they have 3 times more parameters. In the next two cells, we compute forward propagation for a sequence with 256 time steps (`T`) for an RNN and a GRU with the same hidden state `h_t` size (`h_dim`=16). # In[8]: # vanilla RNNs tic = perf_counter() ys, h_T = scan(forward_V_RNN, X, weights, h_0) toc = perf_counter() RNN_time=(toc-tic)*1000 print (f"It took {RNN_time:.2f}ms to run the forward method for the vanilla RNN.") # In[9]: # GRUs tic = perf_counter() ys, h_T = scan(forward_GRU, X, weights, h_0) toc = perf_counter() GRU_time=(toc-tic)*1000 print (f"It took {GRU_time:.2f}ms to run the forward method for the GRU.") # As you were told in the lectures, GRUs take more time to compute (However, sometimes, although a rare occurrence, Vanilla RNNs take more time. Can you figure out what might cause this ?). This means that training and prediction would take more time for a GRU than for a vanilla RNN. However, GRUs allow you to propagate relevant information even for long sequences, so when selecting an architecture for NLP you should assess the tradeoff between computational time and performance. # <b>Congratulations!</b> Now you know how the forward method is implemented for vanilla RNNs and GRUs, and you know how the scan function provides an abstraction for forward propagation in RNNs.
a9090ceb80a1627f5e03947dfe4312844ebe0d95
25e481ef7fba79285f4c8a7fa2e81c8b2b7f9cce
/saleor/search/documents.py
21caff48c91dad01e664334c00d2f0a664a31fe8
[ "BSD-2-Clause" ]
permissive
arslanahmd/Ghar-Tameer
59e60def48a14f9452dfefe2edf30e362878191d
72401b2fc0079e6d52e844afd8fcf57122ad319f
refs/heads/master
2023-01-31T04:08:26.288332
2018-06-07T18:02:01
2018-06-07T18:02:01
136,231,127
0
0
NOASSERTION
2023-01-11T22:21:42
2018-06-05T20:28:11
Python
UTF-8
Python
false
false
2,008
py
from django_elasticsearch_dsl import DocType, Index, fields from elasticsearch_dsl import analyzer, token_filter from ..order.models import Order from ..product.models import Product from ..userprofile.models import User storefront = Index('storefront') storefront.settings(number_of_shards=1, number_of_replicas=0) partial_words = token_filter( 'partial_words', 'edge_ngram', min_gram=3, max_gram=15) title_analyzer = analyzer( 'title_analyzer', tokenizer='standard', filter=[partial_words, 'lowercase']) email_analyzer = analyzer('email_analyzer', tokenizer='uax_url_email') @storefront.doc_type class ProductDocument(DocType): title = fields.StringField(analyzer=title_analyzer) def prepare_title(self, instance): return instance.name class Meta: model = Product fields = ['name', 'description', 'is_published'] users = Index('users') users.settings(number_of_shards=1, number_of_replicas=0) @users.doc_type class UserDocument(DocType): user = fields.StringField(analyzer=email_analyzer) first_name = fields.StringField() last_name = fields.StringField() def prepare_user(self, instance): return instance.email def prepare_first_name(self, instance): address = instance.default_billing_address if address: return address.first_name def prepare_last_name(self, instance): address = instance.default_billing_address if address: return address.last_name class Meta: model = User fields = ['email'] orders = Index('orders') orders.settings(number_of_shards=1, number_of_replicas=0) @orders.doc_type class OrderDocument(DocType): user = fields.StringField(analyzer=email_analyzer) def prepare_user(self, instance): if instance.user: return instance.user.email else: return instance.user_email class Meta: model = Order fields = ['user_email', 'discount_name']
962214992716034bac30b38a80e43aa1a2df3de9
6c5d8700eb80a647a86d583d16cab5ec5b2d0bc0
/shop/models.py
f2ce8d7cd2e7d1181d2988cd7fdbe347fc88502c
[]
no_license
askdjango/offline-201707-weekend-afternoon
f83a324bca2e16f423e009a7d6b033db435114e2
469b84d84f8c2c47c6d4a45bab5dfe2cd84adcf7
refs/heads/master
2020-12-02T07:58:10.831108
2017-07-30T07:41:36
2017-07-30T07:41:36
96,754,198
2
2
null
null
null
null
UTF-8
Python
false
false
407
py
from django.db import models from django.urls import reverse class Item(models.Model): name = models.CharField(max_length=100) price = models.PositiveIntegerField() desc = models.TextField() created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def get_absolute_url(self): return reverse('shop:item_detail', args=[self.id])
25bbe3e5adf828fa80d61118ad6fd367d2b14b80
acb8e84e3b9c987fcab341f799f41d5a5ec4d587
/langs/9/vtp.py
eff641303cfe79cfbca78cccbad21e2fd81fe2f5
[]
no_license
G4te-Keep3r/HowdyHackers
46bfad63eafe5ac515da363e1c75fa6f4b9bca32
fb6d391aaecb60ab5c4650d4ae2ddd599fd85db2
refs/heads/master
2020-08-01T12:08:10.782018
2016-11-13T20:45:50
2016-11-13T20:45:50
73,624,224
0
1
null
null
null
null
UTF-8
Python
false
false
486
py
import sys def printFunction(lineRemaining): if lineRemaining[0] == '"' and lineRemaining[-1] == '"': if len(lineRemaining) > 2: #data to print lineRemaining = lineRemaining[1:-1] print ' '.join(lineRemaining) else: print def main(fileName): with open(fileName) as f: for line in f: data = line.split() if data[0] == 'vTP': printFunction(data[1:]) else: print 'ERROR' return if __name__ == '__main__': main(sys.argv[1])
5e5fdac857eaa6f45e062834ce120c57e67b73eb
2d9a17e2b896d2f6a90913a4ba02d41f0ede5dd0
/_gk_chsi/_gk_chsi.py
74ea3245308982f21b6b7172d1cf1025c9af6452
[]
no_license
wolfwhoami/xxxxx
1cf2ed2c8ed78048d87cccf2953ca86c0871a783
670787ec71127bc05c1645cc3d8ef7c3a91fe84b
refs/heads/master
2020-03-30T00:44:55.864817
2016-12-16T01:45:03
2016-12-16T01:45:03
null
0
0
null
null
null
null
UTF-8
Python
false
false
16,095
py
#!/usr/bin/env python # -*- coding:utf8 -*- import HTMLParser import copy import logging import random import re import threading import time import uuid from court.captcha import Captcha from court.cspider import ATOSSessionCourtSpider from court.save import LinkSaver from court.util import save_file, remove_file from spider import spider from spider.ipin.savedb import PageStoreBase class GkChsiFsxStore(PageStoreBase): def __init__(self, channel, dburl="mongodb://root:helloipin@localhost/admin"): PageStoreBase.__init__(self, channel, dburl) def extract_content(self): return self.get_cur_doc().cur_content def page_time(self): return int(time.mktime(list(time.localtime())) * 1000) class GkChsiFsxScoreStore(GkChsiFsxStore): def __init__(self, channel): GkChsiFsxStore.__init__(self, channel) def extract_content(self): return self.get_cur_doc().cur_content def page_time(self): return int(time.mktime(list(time.localtime())) * 1000) class GkChsiFsxPaperStore(GkChsiFsxStore): def __int__(self, channel): GkChsiFsxStore.__init__(self, channel) def extract_content(self): return self.get_cur_doc().cur_content def page_time(self): return int(time.mktime(list(time.localtime())) * 1000) class GkChsiFsxSpider(ATOSSessionCourtSpider): """ 学信网阳光高考省市分数线单用户单线程爬虫 """ def __init__(self, threadcnt, account, prefix, proxy=None, sleep=0, highscore=750, captcha_limit=50000, kldms=None, recover=False, sleep_max=5): super(GkChsiFsxSpider, self).__init__(threadcnt) if kldms is None: kldms = [1, 5] self.select_user_agent('firefox') self.pagestore = GkChsiFsxPaperStore('gkchsi_' + prefix) self.score_saver = GkChsiFsxScoreStore('gkchsi_score_' + prefix) self.account = account self.prefix = prefix self.proxy = proxy self.sleep = sleep self.cur_sleep = sleep self.max_sleep = sleep_max if proxy: self.set_proxy(proxy) self.highscore = highscore self.minscore = {} self.success_count = 0 self.lock = threading.Lock() self.remain_time = 0 self.login_time = -1 self.__shutdown = False self.job_saver = LinkSaver(self.prefix + '_undo_jobs') self.__captcha_times = 0 self.__captcha_resolved_limits = captcha_limit self.recover = recover self.success_sleep_count = 0 self.kldms = kldms self.parser = HTMLParser.HTMLParser() self.curl_share = None self.login() def __del__(self): self.logout() def dispatch(self): kldms = self.fetch_kldms() if len(kldms) == 2: self.kldms = kldms # data_tmp = {'wclx': 1, 'score': 0, 'bkcc': 1, 'kldm': 1, 'years': 15, 'type': 'score'} for kldm in self.kldms: self.minscore[str(kldm)] = -1 if self.recover: with open(self.prefix + '_undo_jobs_old', 'r') as job_saver: job_saver = LinkSaver(self.prefix + '_undo_jobs_old', 'r') lines = job_saver.readlines() job_saver.close() for l in lines: self.add_main_job(eval(l)) print 'recover %d jobs' % len(lines) else: bkccs = [1, 2] # 本科,专科 for kldm in self.kldms: for bkcc in bkccs: for score in range(self.highscore, -1, -1): data = {'wclx': 1, 'score': score, 'bkcc': bkcc, 'kldm': kldm, 'years': 15} self.add_main_job( {'data': data, 'type': 'score'}) time.sleep(2) self.wait_q() self.add_job(None) # # def thread_init(self, tid): # if not self.login(): # logging.error('fail to log in') # raise Exception('log in failed') def fetch_kldms(self): if self.login_time < -1: raise Exception('failed to login') con = self.request_url('http://gk.chsi.com.cn/recruit/queryWeici.do') if con and con.text: m = re.search(r'<select name="kldm" id="kldm">.*?</select>', con.text, re.S) if m: res = re.findall(r'<option value=["\'](\d+)["\'][^>]*>', m.group()) if res and len(res) >= 2: return res[:2] return [] def request_url(self, url, **kwargs): time.sleep(self.cur_sleep) con = super(GkChsiFsxSpider, self).request_url(url, **kwargs) if re.search('<form name="CheckAccessForm" method="post" action="/checkcode/CheckAccess.do">', con.text): self.__captcha_times += 1 if self.__captcha_resolved_limits >= self.__captcha_times: m = re.search(r'<input name="url" type="hidden" value="([^"]*)"\/>', con.text) if not m: return None con = self.resolve_captcha(self.parser.unescape(m.group(1))) if not con: logging.error('encounter captcha resolve problem %d,%d', self.__captcha_times, self.__captcha_resolved_limits) raise Exception('fail to resolve captcha %s' % url) logging.info('captcha resolve success,captcha times:%d', self.__captcha_times) else: self.__shutdown = True raise Exception('captcha exceeds limit') return con def login(self): data = {'j_username': self.account['username'], 'j_password': self.account['password']} con = super(GkChsiFsxSpider, self).request_url('http://gk.chsi.com.cn/login.do', data=data) # todo: check return results logging.info('logging on') if con and con.text: m = re.search(ur'<td align="left">(\d+)分钟</td></tr>', con.text) if m: self.login_time = time.time() self.remain_time = int(m.group(1)) if self.remain_time > 0: logging.info('remaining time %d min ', self.remain_time) return True else: print '已经没有剩余时间了:', m.group() logging.error('there are no more time left') return False return False def logout(self): return super(GkChsiFsxSpider, self).request_url('http://gk.chsi.com.cn/user/logout.do', data={}) def resolve_captcha(self, url): count = 0 while count < 100: count += 1 rd = random.random() * 10000 time.sleep(1) con = super(GkChsiFsxSpider, self).request_url('http://gk.chsi.com.cn/ValidatorIMG.JPG?ID=%s' % str(rd)) if not con or not con.content: logging.info('failed to fetch captcha') return False fname = '/tmp/' + str(uuid.uuid4()) + '.jpg' save_file(con.content, fname) res = Captcha.resolve(fname, self.prefix) remove_file(fname) if not res: logging.error('fail to resolve captcha') continue data = {'CHKNUM': res, 'url': url} if data['url'] is None: logging.error('Invalid host found %s', url) return None time.sleep(1) con = super(GkChsiFsxSpider, self).request_url('http://gk.chsi.com.cn/checkcode/CheckAccess.do', data=data) if con and con.text: m = re.search('<form name="CheckAccessForm" method="post" action="/checkcode/CheckAccess.do">', con.text) if not m: return con print 'try captcha times 100 %s' % url return None def on_net_work_failed(self, content, jobid, url): with self.lock: if self.cur_sleep <= self.max_sleep: self.cur_sleep += 1 self.success_count = 0 if content is None: logging.error('fail to fetch content from %s with %s' % (url, str(jobid))) self.re_add_job(jobid) return # raise Exception('fail to fetch content from %s with %s' % (url, str(jobid))) if re.search(ur'(1秒内)|(访问错误)', content): # raise Exception('too many connections in one second,%s' % url) logging.error('too many connections in one second,%s' % url) self.re_add_job(jobid) return captcha = re.search('<form name="CheckAccessForm" method="post" action="/checkcode/CheckAccess.do">', content) if captcha: self.__captcha_times += 1 if self.__captcha_resolved_limits >= self.__captcha_times: con = self.resolve_captcha(url) if con: logging.info('captcha resolve success,captcha times:%d', self.__captcha_times) self.re_add_job(jobid) return con logging.error('encounter captcha %d,%d', self.__captcha_times, self.__captcha_resolved_limits) self.__shutdown = True raise Exception('captcha failed') # check time: m = re.search(ur'<td align="left">(\d+)分钟</td></tr>', content) if m: self.remain_time = int(m.group(1)) if time.time() - self.login_time > self.remain_time * 60: self.__shutdown = True raise Exception('remain time failed %d', self.remain_time) # need login if re.search(ur'查看此栏目需要先登录', content): logging.info('need login') self.login() self.re_add_job(jobid) return raise Exception('unknown network exception %s' % str(jobid)) def __on_shutdown(self, jobid): self.job_saver.add(str(jobid) + '\n') def run_job(self, jobid): if self.__shutdown: self.__on_shutdown(jobid) return with self.lock: if self.success_count > 50: self.cur_sleep -= 1 if self.cur_sleep < self.sleep: self.cur_sleep = self.sleep self.success_count = 0 self.success_sleep_count += 1 if self.success_sleep_count > 100: self.logout() time.sleep(30) self.success_sleep_count = 0 if not self.login(): logging.error('fail to log in') self.__shutdown = True raise Exception('log in failed') if 'score' == jobid['type']: if self.minscore[str(jobid['data']['kldm'])] > jobid['data']['score']: # TODO:should I do something? pass url = 'http://gk.chsi.com.cn/recruit/listWcByScore.do' con = self.request_url(url, data=jobid['data']) if not con or not con.text: logging.info('fail to request job,%d,%d,%d,%d') self.on_net_work_failed(None, jobid, url) return content = re.search(r'<div id="direction1">.*?<\/table>', con.text, re.S) if not content: logging.error('fail to extract content %s', str(jobid)) self.on_net_work_failed(con.text, jobid, url) return content = content.group() id = '%s,%s,%s,%s,%s,%s' % ( self.prefix, jobid['data']['years'], jobid['data']['wclx'], jobid['data']['kldm'], jobid['data']['bkcc'], jobid['data']['score']) logging.info('%s==>%d', id, len(content)) m = re.findall(r'<td align="center" bgcolor="#FFFFFF">([\s\d]+?)<\/td>', content, re.S) if not m: logging.error('fail to parse rank from %s', id) return rank = m[0] self.score_saver.save(int(time.time()), id, url, "%s,%s,%s,%s" % (id, m[0], m[1].strip(), m[2].strip())) if jobid['data']['score'] < 400 and '0' == rank: self.minscore[str(jobid['data']['kldm'])] = jobid['data']['score'] if '0' == rank: logging.info('zero rank %s', id) else: data = copy.deepcopy(jobid['data']) data['wc'] = rank data['wcpp'] = 1 data['start'] = 0 self.add_job({'type': 'rank', 'data': data}) print 'add rank job', str(data) elif 'rank' == jobid['type']: url = 'http://gk.chsi.com.cn/recruit/listRecruitWeicis.do' con = self.request_url(url, data=jobid['data']) if not con or not con.text: logging.error('fail to request rank paper %s', str(jobid)) self.on_net_work_failed(None, jobid, url) return if re.search(u'1秒内', con.text): logging.error('wrong paper content %s', str(jobid)) self.on_net_work_failed(con.text, jobid, url) return self.save_rank_paper(jobid['data'], url, con.text, jobid['data']['start'] / 10 + 1, jobid) if 0 == jobid['data']['start']: m = re.search(ur'共 (\d+) 页', con.text) if not m: logging.warn('fail to parse page count %s', str(jobid)) return pagecnt = int(m.group(1)) for page in range(2, pagecnt + 1): cdata = copy.deepcopy(jobid['data']) cdata['start'] = 10 * (page - 1) self.add_job({'type': 'rank', 'data': cdata}) with self.lock: self.success_count += 1 def extract_content(self, content): """extract rank paper content""" m = re.search(r'<table[^>]*class="query"[^>]*>.*?<\/table>', content, re.S) if m: return m.group() def save_rank_paper(self, data, url, content, page, jobid): con = self.extract_content(content) if not con: logging.error('rank paper content is None') self.on_net_work_failed(content, jobid, url) return id = '%s/%s/%s/%s/%s/%s/%s/%s' % ( self.prefix, data['years'], data['wclx'], data['kldm'], data['bkcc'], data['score'], data['wcpp'], page) self.pagestore.save(int(time.time()), id, url, con) logging.info('rank job %s==>%d', id, len(con)) def event_handler(self, evt, msg, **kwargs): if evt == 'DONE': msg += "saved: %d\n" % self.pagestore.saved_count spider.util.sendmail(['[email protected]'], '%s DONE' % self._name, msg) elif evt == 'STARTED': # spider.misc.stacktracer.trace_start('res.trace.html') pass def report(self): super(GkChsiFsxSpider, self).report() self.job_saver.flush() if __name__ == '__main__': accounts = {'username': 'hubei101', 'password': 'bobo2016', 'prefix': 'hb', 'proxy': None, 'kldms': [1, 5]} # accounts = {'username': 'jsu2015', 'password': 'AHO001009', 'prefix': 'jsu', 'proxy': '183.239.167.122:8080'} # accounts = {'username': 'huoguo', 'password': 'AHO001009', 'prefix': 'sc', 'proxy': '58.211.13.26:55336', # 'kldms': [2, 6]} # accounts = {'username': 'akg999', 'password': 'AHO001009', 'prefix': 'sh', 'proxy': '58.211.13.26:55336', # 'kldms': [1, 5]} job = GkChsiFsxSpider(1, accounts, accounts['prefix'], accounts['proxy'], 1, kldms=accounts['kldms'], highscore=750, captcha_limit=5000000, recover=False) # job = GkChsiFsxSpider(1, accounts, accounts['prefix'], accounts['proxy'], 1, kldms=accounts['kldms'],captcha_limit=5000000) job.run()
f0ef8b3b822755e643558dfbaf8038848844a94e
c954904d3a3259f0bee4bc3942998c30f4714e68
/shortener/shorturl/admin.py
d2d7a1f500ccdca743dd6b6677e8ab573e9ced69
[]
no_license
Alodhaib/django-shortener-example
9443e51191086fa1321468eb3fdefa137c25e330
d037c913ed18e0a7b24865b7f4f5aaf68df2cca3
refs/heads/master
2021-01-24T10:06:40.965556
2013-05-11T16:01:13
2013-05-11T16:01:13
69,673,280
0
0
null
2016-09-30T14:22:22
2016-09-30T14:22:22
null
UTF-8
Python
false
false
175
py
# -*- coding: utf-8 -*- from django.contrib import admin from shorturl.models import Link class LinkAdmin(admin.ModelAdmin): pass admin.site.register(Link, LinkAdmin)
26bdb9144ab0c29daebafabd909699cec109f600
3449e5511dc8da19fc841af767dbe8d216e26ffb
/mmServer/shared/migrations/0001_initial.py
b519290b8cc95fbc7f447738179c3c140f0d7dc6
[]
no_license
erikwestra/mm-server
8ba2af0ee7acd372949589b6f8d429099a38ea58
bead1ad439541211e33fdc60264a869f18a99ae9
refs/heads/master
2021-01-10T21:14:23.636707
2015-05-27T21:22:54
2015-05-27T21:22:54
28,573,174
0
0
null
null
null
null
UTF-8
Python
false
false
1,434
py
# -*- coding: utf-8 -*- from south.utils import datetime_utils as datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding model 'Profile' db.create_table(u'shared_profile', ( (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), ('global_id', self.gf('django.db.models.fields.TextField')(unique=True, db_index=True)), ('name', self.gf('django.db.models.fields.TextField')()), ('location', self.gf('django.db.models.fields.TextField')()), ('image_url', self.gf('django.db.models.fields.TextField')()), )) db.send_create_signal(u'shared', ['Profile']) def backwards(self, orm): # Deleting model 'Profile' db.delete_table(u'shared_profile') models = { u'shared.profile': { 'Meta': {'object_name': 'Profile'}, 'global_id': ('django.db.models.fields.TextField', [], {'unique': 'True', 'db_index': 'True'}), u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), 'image_url': ('django.db.models.fields.TextField', [], {}), 'location': ('django.db.models.fields.TextField', [], {}), 'name': ('django.db.models.fields.TextField', [], {}) } } complete_apps = ['shared']
90fd9dde7cdf83348a25711a71c5e94d066e59ac
3db1063777e6a0b2e7dba70fc507fe5e88b89fd9
/tests/test_sklearn_double_tensor_type_reg.py
fe4fd01080be20e8f2cd3600dd014d04785a6a7c
[ "Apache-2.0" ]
permissive
Pandinosaurus/sklearn-onnx
6fe8266576a63dfc97782b001fd5a7b1a8c4c076
e85674a67a0a043e19c2ffe181e5d31eca8ce40b
refs/heads/master
2022-03-15T12:33:57.138828
2022-02-25T14:31:04
2022-02-25T14:31:04
199,595,952
0
0
Apache-2.0
2022-02-25T20:54:57
2019-07-30T07:11:05
Python
UTF-8
Python
false
false
6,794
py
# SPDX-License-Identifier: Apache-2.0 """Tests GLMRegressor converter.""" import unittest from distutils.version import StrictVersion import numpy as np from sklearn.exceptions import ConvergenceWarning try: from sklearn.utils._testing import ignore_warnings except ImportError: from sklearn.utils.testing import ignore_warnings from sklearn.ensemble import BaggingRegressor from sklearn.gaussian_process import GaussianProcessRegressor from sklearn.linear_model import LinearRegression, SGDRegressor from sklearn.neighbors import KNeighborsRegressor from sklearn.neural_network import MLPRegressor try: from sklearn.ensemble import VotingRegressor except ImportError: # New in 0.21 VotingRegressor = None from skl2onnx import convert_sklearn, to_onnx from skl2onnx.common.data_types import DoubleTensorType from onnxruntime import __version__ as ort_version from test_utils import ( dump_data_and_model, fit_regression_model, TARGET_OPSET) warnings_to_skip = (DeprecationWarning, FutureWarning, ConvergenceWarning) class TestSklearnDoubleTensorTypeRegressor(unittest.TestCase): @unittest.skipIf( StrictVersion(ort_version) <= StrictVersion("1.2.0"), reason="onnxruntime misses implementation for double") @ignore_warnings(category=warnings_to_skip) def test_model_linear_regression_64(self): model, X = fit_regression_model(LinearRegression()) model_onnx = convert_sklearn( model, "linear regression", [("input", DoubleTensorType([None, X.shape[1]]))], target_opset=TARGET_OPSET) self.assertIn("elem_type: 11", str(model_onnx)) dump_data_and_model( X.astype(np.float64), model, model_onnx, basename="SklearnLinearRegressionDouble") @unittest.skipIf( StrictVersion(ort_version) < StrictVersion("1.7.0"), reason="onnxruntime misses implementation for " "Relu, Tanh, Sigmoid for double") @ignore_warnings(category=warnings_to_skip) def test_model_mlpregressor_64(self): # Could not find an implementation for the node Relu:Relu(6) # Could not find an implementation for the node Tanh:Tanh(6) # Could not find an implementation for the node Sigmoid:Sigmoid(6) for activation in ['relu', 'tanh', 'logistic']: with self.subTest(activation=activation): model, X = fit_regression_model( MLPRegressor(activation=activation)) model_onnx = convert_sklearn( model, "linear regression", [("input", DoubleTensorType([None, X.shape[1]]))], target_opset=TARGET_OPSET) self.assertIn("elem_type: 11", str(model_onnx)) dump_data_and_model( X.astype(np.float64), model, model_onnx, basename="SklearnMLPRegressorDouble%s" % activation) @unittest.skipIf( StrictVersion(ort_version) < StrictVersion("1.7.0"), reason="onnxruntime misses implementation for " "ReduceMean for double") @ignore_warnings(category=warnings_to_skip) def test_bagging_regressor_sgd_64(self): # Could not find an implementation for # the node ReduceMean:ReduceMean(11) model, X = fit_regression_model( BaggingRegressor(SGDRegressor())) model_onnx = convert_sklearn( model, "bagging regressor", [("input", DoubleTensorType([None, X.shape[1]]))], target_opset=TARGET_OPSET) dump_data_and_model( X.astype(np.float64), model, model_onnx, basename="SklearnBaggingRegressorSGDDouble") @unittest.skipIf( StrictVersion(ort_version) <= StrictVersion("1.2.0"), reason="onnxruntime misses implementation for double") @ignore_warnings(category=warnings_to_skip) def test_model_sgd_regressor_64(self): model, X = fit_regression_model(SGDRegressor()) model_onnx = convert_sklearn( model, "linear regression", [("input", DoubleTensorType([None, X.shape[1]]))], target_opset=TARGET_OPSET) self.assertIn("elem_type: 11", str(model_onnx)) dump_data_and_model( X.astype(np.float64), model, model_onnx, basename="SklearnLinearSGDRegressorDouble") @unittest.skipIf( StrictVersion(ort_version) < StrictVersion("1.7.0"), reason="shape_inference fails") @ignore_warnings(category=warnings_to_skip) def test_gpr_rbf_fitted_true_double(self): gp = GaussianProcessRegressor( alpha=1e-7, n_restarts_optimizer=15, normalize_y=True) gp, X = fit_regression_model(gp) model_onnx = to_onnx( gp, initial_types=[('X', DoubleTensorType([None, None]))], target_opset=TARGET_OPSET) dump_data_and_model( X.astype(np.float64), gp, model_onnx, verbose=False, basename="SklearnGaussianProcessRBFTDouble") @unittest.skipIf( StrictVersion(ort_version) < StrictVersion("1.7.0"), reason="onnxruntime misses implementation for " "TopK for double") @ignore_warnings(category=warnings_to_skip) def test_model_knn_regressor_double(self): # Could not find an implementation for the node To_TopK:TopK(11) model, X = fit_regression_model(KNeighborsRegressor(n_neighbors=2)) model_onnx = convert_sklearn( model, "KNN regressor", [("input", DoubleTensorType([None, X.shape[1]]))], target_opset=TARGET_OPSET, options={id(model): {'optim': 'cdist'}}) dump_data_and_model( X.astype(np.float64)[:7], model, model_onnx, basename="SklearnKNeighborsRegressorDouble") @unittest.skipIf(VotingRegressor is None, reason="new in 0.21") @unittest.skipIf( StrictVersion(ort_version) < StrictVersion("1.7.0"), reason="onnxruntime misses implementation for " "Sum for double") @ignore_warnings(category=warnings_to_skip) def test_model_voting_regression(self): # Could not find an implementation for the node Sum:Sum(8) model = VotingRegressor([ ('lr', LinearRegression()), ('dt', SGDRegressor())]) model, X = fit_regression_model(model) model_onnx = convert_sklearn( model, "voting regression", [("input", DoubleTensorType([None, X.shape[1]]))], target_opset=TARGET_OPSET) dump_data_and_model( X.astype(np.float64), model, model_onnx, basename="SklearnVotingRegressorDouble", comparable_outputs=[0]) if __name__ == "__main__": unittest.main()
dacc3371d34d1638e3dab27125026ac0234c1f31
9093d43a4fc00f0a89fde240caa9ea54e3b22a24
/step2_random_take_data.py
a5f6def0e1078cfce75cf09f9f94738361a98fe2
[]
no_license
hankerkuo/HogwartsHouses
a1db9d4f9aff99003ef438d7656f91d95fc520d6
85c517a9d690e94c58d2c9c3f8ff0ba09a975394
refs/heads/master
2022-10-09T00:37:56.938523
2022-09-29T17:51:31
2022-09-29T17:51:31
132,591,915
0
0
null
null
null
null
UTF-8
Python
false
false
2,026
py
import os import os.path as path import numpy as np import shutil # randomly take training data and testing data, and then put them in the folder of this project! # mother_folder must contain all of the class folders # train_ratio argument is the ratio of training data, its value must between [0, 1] def random_take_data(mother_folder, train_ratio, save_path): # create folders if not path.exists(path.join(save_path, 'train_data')): os.makedirs(path.join(save_path, 'train_data')) print('successfully creat folder : train_data at', path.join(save_path, 'train_data')) if not path.exists(path.join(save_path, 'test_data')): os.makedirs(path.join(save_path, 'test_data')) print('successfully creat folder : test_data at', path.join(save_path, 'test_data')) print('Processing data ...') for kid_folder in os.listdir(mother_folder): # go through each class image_files = os.listdir(path.join(mother_folder, kid_folder)) # read all the files in a kid folder (e.g. each class) train_num = np.floor(len(image_files) * train_ratio) image_files_train = np.random.choice(image_files, np.int32(train_num), replace=False) # randomly choosing train data image_files_test = np.setdiff1d(image_files, image_files_train) # the remaining data becomes test data for image in image_files_train: # copy the images to new folders shutil.copy(path.join(mother_folder, kid_folder, image), path.join(save_path, 'train_data')) for image in image_files_test: shutil.copy(path.join(mother_folder, kid_folder, image), path.join(save_path, 'test_data')) print('Process done') # sample code of using this lib ''' folder_of_resized_picture = 'C:/data/HogwartsHouses/Final_data32by32' save_path = 'C:/data/HogwartsHouses/dataset_32by32' random_take_data(folder_of_resized_picture, 0.8, save_path) '''
20e70870e41c5a0914c6ca7f9a4502a0e60cfd96
1cb97b0fe8b275efd540716cb6e742fc44e927bf
/rljax/algorithm/tqc.py
0cab46908744c082e44a614483e84981deda1786
[ "MIT" ]
permissive
khushjammu/rljax
31e4d0f9c6aa57a0a07a35f7f8854cc78360ae5a
f2d5e81240d99187fcb625d2caa630c3c7deecfc
refs/heads/master
2023-06-27T17:15:43.437065
2021-07-30T16:55:47
2021-07-30T16:55:47
391,125,669
0
0
MIT
2021-07-30T16:18:23
2021-07-30T16:18:22
null
UTF-8
Python
false
false
4,258
py
from functools import partial from typing import List import haiku as hk import jax import jax.numpy as jnp import numpy as np from rljax.algorithm.sac import SAC from rljax.network import ContinuousQuantileFunction, StateDependentGaussianPolicy from rljax.util import quantile_loss class TQC(SAC): name = "TQC" def __init__( self, num_agent_steps, state_space, action_space, seed, max_grad_norm=None, gamma=0.99, nstep=1, num_critics=5, buffer_size=10 ** 6, use_per=False, batch_size=256, start_steps=10000, update_interval=1, tau=5e-3, fn_actor=None, fn_critic=None, lr_actor=3e-4, lr_critic=3e-4, lr_alpha=3e-4, units_actor=(256, 256), units_critic=(512, 512, 512), log_std_min=-20.0, log_std_max=2.0, d2rl=False, num_quantiles=25, num_quantiles_to_drop=0, ): if d2rl: self.name += "-D2RL" if fn_critic is None: def fn_critic(s, a): return ContinuousQuantileFunction( num_critics=num_critics, hidden_units=units_critic, num_quantiles=num_quantiles, d2rl=d2rl, )(s, a) if fn_actor is None: def fn_actor(s): return StateDependentGaussianPolicy( action_space=action_space, hidden_units=units_actor, log_std_min=log_std_min, log_std_max=log_std_max, d2rl=d2rl, )(s) super(TQC, self).__init__( num_agent_steps=num_agent_steps, state_space=state_space, action_space=action_space, seed=seed, max_grad_norm=max_grad_norm, gamma=gamma, nstep=nstep, num_critics=num_critics, buffer_size=buffer_size, use_per=use_per, batch_size=batch_size, start_steps=start_steps, update_interval=update_interval, tau=tau, fn_actor=fn_actor, fn_critic=fn_critic, lr_actor=lr_actor, lr_critic=lr_critic, lr_alpha=lr_alpha, ) self.cum_p_prime = jnp.expand_dims((jnp.arange(0, num_quantiles, dtype=jnp.float32) + 0.5) / num_quantiles, 0) self.num_quantiles = num_quantiles self.num_quantiles_target = (num_quantiles - num_quantiles_to_drop) * num_critics @partial(jax.jit, static_argnums=0) def _calculate_value( self, params_critic: hk.Params, state: np.ndarray, action: np.ndarray, ) -> jnp.ndarray: return jnp.concatenate(self._calculate_value_list(params_critic, state, action), axis=1) @partial(jax.jit, static_argnums=0) def _calculate_target( self, params_critic_target: hk.Params, log_alpha: jnp.ndarray, reward: np.ndarray, done: np.ndarray, next_state: np.ndarray, next_action: jnp.ndarray, next_log_pi: jnp.ndarray, ) -> jnp.ndarray: next_quantile = self._calculate_value(params_critic_target, next_state, next_action) next_quantile = jnp.sort(next_quantile)[:, : self.num_quantiles_target] next_quantile -= jnp.exp(log_alpha) * self._calculate_log_pi(next_action, next_log_pi) return jax.lax.stop_gradient(reward + (1.0 - done) * self.discount * next_quantile) @partial(jax.jit, static_argnums=0) def _calculate_loss_critic_and_abs_td( self, quantile_list: List[jnp.ndarray], target: jnp.ndarray, weight: np.ndarray, ) -> jnp.ndarray: loss_critic = 0.0 for quantile in quantile_list: loss_critic += quantile_loss(target[:, None, :] - quantile[:, :, None], self.cum_p_prime, weight, "huber") loss_critic /= self.num_critics * self.num_quantiles abs_td = jnp.abs(target[:, None, :] - quantile_list[0][:, :, None]).mean(axis=1).mean(axis=1, keepdims=True) return loss_critic, jax.lax.stop_gradient(abs_td)
a4e868db0f547b24acea0ad887afdfb7e41f16f6
8660906ee809f572ec766db192f4b511e15fe55a
/pythonProject/functions 2.py
4ddcd441b21557aae6a7f1266e28ab5f992efe99
[]
no_license
mageshrocky/PycharmProjects
a731acc47d5108c9129787ac3e4c5385f25e099c
17c12da7d91aec7818f5a76bfff0aae5275aa232
refs/heads/master
2023-05-30T13:21:01.048013
2021-06-15T10:22:49
2021-06-15T10:22:49
377,121,844
0
0
null
null
null
null
UTF-8
Python
false
false
358
py
def welcome(): print('welcome to my bucket_list') def bucket_list(): welcome() x = 'biriyani','fried rice','grill','shawarma' for i in x: print(i) ask = input('eaten or not:') if ask == 'eaten': print(f'{i} is eaten') elif ask == 'not': print(f'{i} is not eaten') bucket_list()
87f547feea934df8f3f0d1a245a7f6cb4d4a3a29
7d949b9f19e4c5c897b3aef76e604f2c0eee7112
/src-python/saccade_analysis/analysis201009/master_plot_vars.py
89549b136017cbf3d778e4b531923c386e78b806
[]
no_license
AndreaCensi/saccade_analysis
d3fad3a1a406b97c4dcf9cdc82b9b2ce1fbf42df
71b87e9225b16317ffa9a581b3c62d8343fe7bfa
refs/heads/master
2016-09-11T06:49:22.254391
2011-12-20T06:39:30
2011-12-20T06:39:30
952,465
1
0
null
null
null
null
UTF-8
Python
false
false
2,079
py
''' Definition of variable of interests for plotting. ''' class Variable(): def __init__(self, id, letter, name, interesting, unit, density_max_y, density_bins, include, mod=False, field=None, percentiles=True): if field is None: field = id self.id = id self.name = name self.letter = letter self.interesting = interesting self.unit = unit self.density_max_y = density_max_y self.density_bins = density_bins self.include = include self.mod = mod self.field = field self.percentiles = percentiles variables = [] variables.append(Variable( id='amplitude', letter='A', interesting=[1, 200], name='Amplitude', unit='deg', density_max_y=0.06, density_bins=100, include=True )) variables.append(Variable( id='duration', letter='D', interesting=[0.01, 0.9], name='Duration', unit='s', density_max_y=15, density_bins=50, include=True )) variables.append(Variable( id='top_velocity', letter='V', interesting=[10, 4000], # 2000 enough for tether name='Top angular velocity', unit='deg/s', density_max_y=3 * 1e-3, density_bins=100, include=True )) variables.append(Variable( id='interval', field='time_passed', letter='I', interesting=[0.01, 8], name='Interval', unit='s', density_max_y=2, density_bins=100, include=True )) variables.append(Variable( id='initial_orientation', field='orientation_start', letter='io', interesting=[0, 360], name='Initial orientation', unit='deg', density_max_y=None, density_bins=90, include=False, mod=True, percentiles=False )) variables.append(Variable( id='final_orientation', field='orientation_stop', letter='io', interesting=[0, 360], name='Final orientation', unit='deg', density_max_y=None, density_bins=90, include=False, mod=True, percentiles=False ))
32bf63d6e8e9e3be59ddbce2a9dbab8b1419cd83
55ceefc747e19cdf853e329dba06723a44a42623
/_CodeTopics/LeetCode/401-600/000497/RE--000497.py3
97b99260625d25bf3404827bdfbeaa178d69aef9
[]
no_license
BIAOXYZ/variousCodes
6c04f3e257dbf87cbe73c98c72aaa384fc033690
ee59b82125f100970c842d5e1245287c484d6649
refs/heads/master
2023-09-04T10:01:31.998311
2023-08-26T19:44:39
2023-08-26T19:44:39
152,967,312
0
1
null
null
null
null
UTF-8
Python
false
false
2,957
py3
class Solution: def __init__(self, rects: List[List[int]]): self.legalX = [] self.legalY = [] self.minX = 10**9 + 1 self.maxX = -10**9 - 1 self.minY = 10**9 + 1 self.maxY = -10**9 - 1 for a, b, x, y in rects: self.legalX.append([a, x]) self.legalY.append([b, y]) self.minX = min(self.minX, a) self.maxX = max(self.maxX, x) self.minY = min(self.minY, b) self.maxY = max(self.maxY, y) def pick(self) -> List[int]: while True: x = random.randint(self.minX, self.maxX) y = random.randint(self.minX, self.maxY) if self.is_in_rects(x, y): return [x, y] def is_in_rects(self, coorX, coorY): for i in range(len(self.legalX)): a, x = self.legalX[i] b, y = self.legalY[i] if a <= coorX <= x and b <= coorY <= y: return True return False # Your Solution object will be instantiated and called as such: # obj = Solution(rects) # param_1 = obj.pick() """ https://leetcode.cn/submissions/detail/323265706/ 2 / 35 个通过测试用例 状态:执行出错 执行出错信息: ValueError: empty range for randrange() (35330199, -46856949, -82187148) raise ValueError("empty range for randrange() (%d, %d, %d)" % (istart, istop, width)) Line 353 in randrange (/usr/lib/python3.10/random.py) return self.randrange(a, b+1) Line 370 in randint (/usr/lib/python3.10/random.py) y = random.randint(self.minX, self.maxY) Line 21 in pick (Solution.py) result = obj.pick(); Line 47 in __helper_select_method__ (Solution.py) ret.append(__DriverSolution__().__helper_select_method__(method, params[index], obj)) Line 84 in _driver (Solution.py) _driver() Line 93 in <module> (Solution.py) 最后执行的输入: ["Solution","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick","pick"] [[[[35330199,-46858448,35330694,-46856950]]],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]] """
4bfca7a55f0ea04def1379bcb59903bd3a1b8c27
98b63e3dc79c75048163512c3d1b71d4b6987493
/tensorflow/python/util/function_parameter_canonicalizer_test.py
968265ff36f96f16dd717d8b83548f52c205884a
[ "Apache-2.0" ]
permissive
galeone/tensorflow
11a4e4a3f42f4f61a65b432c429ace00401c9cc4
1b6f13331f4d8e7fccc66bfeb0b066e77a2b7206
refs/heads/master
2022-11-13T11:56:56.143276
2020-11-10T14:35:01
2020-11-10T14:35:01
310,642,488
21
12
Apache-2.0
2020-11-06T16:01:03
2020-11-06T16:01:02
null
UTF-8
Python
false
false
3,409
py
# Copyright 2020 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # ============================================================================== """Tests for `tensorflow::FunctionParameterCanonicalizer`.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.python import _function_parameter_canonicalizer_binding_for_test from tensorflow.python.platform import test class FunctionParameterCanonicalizerTest(test.TestCase): def setUp(self): super(FunctionParameterCanonicalizerTest, self).setUp() self._matmul_func = ( _function_parameter_canonicalizer_binding_for_test .FunctionParameterCanonicalizer([ 'a', 'b', 'transpose_a', 'transpose_b', 'adjoint_a', 'adjoint_b', 'a_is_sparse', 'b_is_sparse', 'name' ], (False, False, False, False, False, False, None))) def testPosOnly(self): self.assertEqual( self._matmul_func.canonicalize(2, 3), [2, 3, False, False, False, False, False, False, None]) def testPosOnly2(self): self.assertEqual( self._matmul_func.canonicalize(2, 3, True, False, True), [2, 3, True, False, True, False, False, False, None]) def testPosAndKwd(self): self.assertEqual( self._matmul_func.canonicalize( 2, 3, transpose_a=True, name='my_matmul'), [2, 3, True, False, False, False, False, False, 'my_matmul']) def testPosAndKwd2(self): self.assertEqual( self._matmul_func.canonicalize(2, b=3), [2, 3, False, False, False, False, False, False, None]) def testMissingPos(self): with self.assertRaisesRegex(TypeError, 'Missing required positional argument'): self._matmul_func.canonicalize(2) def testMissingPos2(self): with self.assertRaisesRegex(TypeError, 'Missing required positional argument'): self._matmul_func.canonicalize( transpose_a=True, transpose_b=True, adjoint_a=True) def testTooManyArgs(self): with self.assertRaisesRegex(TypeError, 'Too many arguments were given'): self._matmul_func.canonicalize(1, 2, 3, 4, 5, 6, 7, 8, 9, 10) def testInvalidKwd(self): with self.assertRaisesRegex(TypeError, 'Got an unexpected keyword argument'): self._matmul_func.canonicalize(2, 3, hohoho=True) def testDuplicatedArg(self): with self.assertRaisesRegex(TypeError, "Got multiple values for argument 'b'"): self._matmul_func.canonicalize(2, 3, False, b=4) def testDuplicatedArg2(self): with self.assertRaisesRegex( TypeError, "Got multiple values for argument 'transpose_a'"): self._matmul_func.canonicalize(2, 3, False, transpose_a=True) if __name__ == '__main__': test.main()
502b40f748bc05baab4530a274f45cef0bac52c3
a54007706a09b387690f79fd7ffd889decad42f1
/day03/code/05_集合的增加_删除.py
41a392c02626da539756cf162017fbbb266f77e7
[]
no_license
lvah/201903python
d425534544a1f91e5b80b5ff0de5ca34037fe6e9
1415fcb7697dfa2884d94dcd8963477e12fe0624
refs/heads/master
2020-07-06T16:45:37.882819
2019-09-08T10:13:07
2019-09-08T10:13:07
203,082,401
5
0
null
null
null
null
UTF-8
Python
false
false
1,077
py
allow_users = {'user1', 'user2', 'user3', 'user1'} # *******************************增加*************************** # # 添加一个元素到集合里面; # allow_users.add('user4') # print(allow_users) # # update添加多个元素到集合中; # allow_users.update({'user4', 'user5', 'user6'}) # print(allow_users) # ****************************删除******************************** # # remove删除指定的元素, 如果元素不存在, 则报错 # allow_users.remove('user1') # print(allow_users) # # # remove删除指定的元素, 如果元素不存在, 则什么也不做 # allow_users.discard('user1') # print(allow_users) # # pop随机删除集合元素 # delete_user = allow_users.pop() # print(allow_users) # print("随机删除的元素:", delete_user) # # clear: 清空集合元素 # allow_users.clear() # print(allow_users) # 如果要对集合排序, 需要先转成列表; nums = {2, 3, 1, 2, 3, 5, 7, 8, 3, 22, 2} nums = list(nums) # 默认从小到大进行排序, reverse=True由大到小进行排序; nums.sort(reverse=True) print(nums)
ae62363973b6dd6edae22ae617c2f996f7344c2c
2ad1116411d79d5bac26402ccac4f5785a0485e4
/text_in_frame.py
4a43b09493235cba7f3292369bae44b4f6d2e17f
[]
no_license
slavkoBV/solved-tasks-SoftGroup-course
0a879fcaeedd2b1d27b2970ea621eb2bdfab4ce4
12461d50a095764d5e237babaec466bc2d8dc672
refs/heads/master
2021-01-18T15:55:04.224872
2017-05-08T15:38:16
2017-05-08T15:38:16
86,691,843
3
0
null
null
null
null
UTF-8
Python
false
false
376
py
def text_in_frame(s): s += ' in the frame' res = s.split() str_width = max(len(i) for i in res) print('{0:*^{1}}'.format('*', str_width * 3)) for line in res: print('{0:<{2}}{1:^{2}}{0:>{2}}'.format('*', line, str_width)) print('{0:*^{1}}'.format('*', str_width * 3)) message = 'Доброго дня, Україно!' text_in_frame(message)
361977c494c2ec3cc91e7dac120631337238d4fd
908cf8e6ef52033bbf3d5afbb29637a25f5d66f8
/test/test_codat_public_api_models_metadata_account_ref_model.py
5579c7a718dad7398f39ad75b1097f758be4922b
[]
no_license
procurify/codat-python-sdk
074769a2d9e72640741689b6f51e880d35b88095
3c8f664998427bda32bad8062c3bf324f39506da
refs/heads/master
2023-08-25T03:55:19.817085
2021-10-22T22:14:34
2021-10-22T22:14:34
395,381,471
1
0
null
2021-10-20T21:10:31
2021-08-12T16:31:03
Python
UTF-8
Python
false
false
960
py
""" Codat API [What's changed in our Swagger](https://docs.codat.io/docs/new-swagger-ui) # noqa: E501 The version of the OpenAPI document: v1 Generated by: https://openapi-generator.tech """ import sys import unittest import codat_python_sdk from codat_python_sdk.model.codat_public_api_models_metadata_account_ref_model import CodatPublicApiModelsMetadataAccountRefModel class TestCodatPublicApiModelsMetadataAccountRefModel(unittest.TestCase): """CodatPublicApiModelsMetadataAccountRefModel unit test stubs""" def setUp(self): pass def tearDown(self): pass def testCodatPublicApiModelsMetadataAccountRefModel(self): """Test CodatPublicApiModelsMetadataAccountRefModel""" # FIXME: construct object with mandatory attributes with example values # model = CodatPublicApiModelsMetadataAccountRefModel() # noqa: E501 pass if __name__ == '__main__': unittest.main()
f45e31f0bd18c1b1e6a9ddb9fc9c44dce15b5103
d5ed778fb40eb12fe0e96e0de3824b88055337e7
/sell3/liantong.py
a28835814db84652f2201269399e01280a940977
[]
no_license
wangjian2254/Sell3_server
d73353779347019755584eaebf655e4411e3681e
e77269f8c8cd1a89f78ecfcb057f7da69d7cfa29
refs/heads/master
2021-01-01T19:06:39.848071
2015-01-04T00:44:47
2015-01-04T00:44:47
12,212,215
0
1
null
2015-01-04T09:29:36
2013-08-19T09:15:36
Python
UTF-8
Python
false
false
17,098
py
#coding=utf-8 #Date: 11-12-8 #Time: 下午10:28 import urllib import urllib2 from django.http import HttpResponse from sell3.usernames import LTKEY __author__ = u'王健' ''' POST / HTTP/1.1 Accept-Encoding: gzip User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip) Content-Length: 589 Host: 123.125.96.6:8090 Connection: Keep-Alive <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"> <SOAP-ENV:Body> <ns:NetCardFind> <deviceID>0000000000000000</deviceID> <communicaID>FFFF</communicaID> <agentId>78821B3D7E00DD5565607BBFEE530EEC</agentId> <iccidnumber>B0A996850A3F8451AB958B4586B473B3469F9894C6579775</iccidnumber> <versionName>1.0</versionName> <clientType>01</clientType> </ns:NetCardFind> </SOAP-ENV:Body></SOAP-ENV:Envelope> HTTP/1.1 200 OK Server: gSOAP/2.8 Content-Type: text/html; charset=utf-8 Content-Length: 650 Connection: close <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:SmsWBS"> <SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <ns:NetCardFindResponse> <deviceID>0000000000000000</deviceID> <communicaID>0003</communicaID> <tradeState>0000</tradeState> <description></description> <cardnumber>201FB8827DE9D8EAC8EF8167442CA86D</cardnumber> </ns:NetCardFindResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> POST / HTTP/1.1 Accept-Encoding: gzip User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip) Content-Length: 601 Host: 123.125.96.6:8090 Connection: Keep-Alive <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"> <SOAP-ENV:Body><ns:checkTelphone> <deviceID>0000000000000000</deviceID> <communicaID>FFFF</communicaID> <agentId>AA3C9309459562D9E04C47F38CAC04A6</agentId> <telplone>2741AD34F808F19859F6D3F314651C66</telplone> <versionCode>1.1</versionCode> <versionName>1.0</versionName> <clientType>01</clientType> </ns:checkTelphone> </SOAP-ENV:Body></SOAP-ENV:Envelope> HTTP/1.1 200 OK Server: gSOAP/2.8 Content-Type: text/html; charset=utf-8 Content-Length: 763 Connection: close <?xml version="1.0" encoding="UTF-8"?><SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:ns="urn:SmsWBS"><SOAP-ENV:Body SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"> <ns:checkTelphoneResponse> <deviceID>0000000000000000</deviceID> <communicaID>0003</communicaID> <tradeState>0000</tradeState> <description></description> <uploadType>2D7D4A5621BC7CC2</uploadType> <certifyFlag>1000000</certifyFlag> <noticeFlag>0</noticeFlag> <noticeTitle></noticeTitle> <noticeMsg></noticeMsg> </ns:checkTelphoneResponse></SOAP-ENV:Body></SOAP-ENV:Envelope> POST / HTTP/1.1 Accept-Encoding: gzip User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip) Content-Length: 687 Host: 123.125.96.6:8090 Connection: Keep-Alive <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"><SOAP-ENV:Body> <ns:mobileClientLogin> <deviceID>0000000000000000</deviceID> <communicaID>FFFF</communicaID> <sendSMSflag>1</sendSMSflag> <agentId>78821B3D7E00DD5565607BBFEE530EEC</agentId> <agentPasswd>54F59F146DCE3BEE</agentPasswd> <clientType>C310C73A81C69EAF</clientType> <versionCode>E07E985011131EFC</versionCode> <versionName>C6818C139D02F7B3</versionName> <lac></lac><ci></ci></ns:mobileClientLogin></SOAP-ENV:Body></SOAP-ENV:Envelope> POST / HTTP/1.1 Accept-Encoding: gzip User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip) Content-Length: 805 Host: 123.125.96.6:8090 Connection: Keep-Alive <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"> <SOAP-ENV:Body> <ns:uploadCertificateInfo> <deviceID>0000000000000000</deviceID> <communicaID>000C</communicaID> <agentId>AA3C9309459562D9E04C47F38CAC04A6</agentId> <telplone>2741AD34F808F19859F6D3F314651C66</telplone> <certificateName>5E22BCEA426CEC30</certificateName> <certificateType>8D1B6F7327986F7F</certificateType> <certificateNum>8E52943D267AC851D05BB094B9FD8FD5DF3C91FB895D270C</certificateNum> <certificateAdd>BB28AD9FDC3EB802BB28AD9FDC3EB802</certificateAdd> <clientType>01</clientType> </ns:uploadCertificateInfo></SOAP-ENV:Body></SOAP-ENV:Envelope> ''' def getpwd(s1,s2): import subprocess from Sell3_server.settings import DES_ROOT p = subprocess.Popen("java -jar %s %s %s"%(DES_ROOT,s1,s2), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) r=[] for line in p.stdout.readlines(): r.append(line) p.wait() return ''.join(r) # print getpwd('1103786107',LTKEY) # print getpwd('1103786107','sunnada0') # print getpwd('123123',LTKEY) # print getpwd('123123','sunnada0') # print getpwd('8986011394110561407','sunnada0') # print getpwd('13146033628',LTKEY) # print getpwd(u'我我'.encode('gbk'),LTKEY) # print getpwd(u'北京北京北京北京'.encode('gbk'),LTKEY) # print getpwd('140826198805160015',LTKEY) # ls=subprocess.call (["java -jar /Users/wangjian2254/work/django/Sell3_server/test.jar %s %s"%(s1,s2)],shell=True) # return ls ltlogins=''' <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"><SOAP-ENV:Body> <ns:mobileClientLogin> <deviceID>0000000000000000</deviceID> <communicaID>FFFF</communicaID> <sendSMSflag>1</sendSMSflag> <agentId>78821B3D7E00DD5565607BBFEE530EEC</agentId> <agentPasswd>54F59F146DCE3BEE</agentPasswd> <clientType>C310C73A81C69EAF</clientType> <versionCode>E07E985011131EFC</versionCode> <versionName>C6818C139D02F7B3</versionName> <lac></lac><ci></ci></ns:mobileClientLogin></SOAP-ENV:Body></SOAP-ENV:Envelope> ''' ''' <clientType>C310C73A81C69EAF</clientType> ''' registerKey={'k':''} def ltlogin(): # from suds.client import Client # client = Client('http://123.125.96.6:8090/wsdl') # result = client.service.mobileClientLogin({'deviceID':'0000000000000000','communicaID':'FFFF','sendSMSflag':'1','agentId':'ADA658DD7BCD302965607BBFEE530EEC','agentPasswd':'1CB942CDE5E5D625','clientType':'C310C73A81C69EAF','versionCode':'E07E985011131EFC','versionName':'C6818C139D02F7B3','lac':'','ci':'',}) # print result request = urllib2.Request('http://123.125.96.6:8090',' ') try: response = urllib2.urlopen(request,ltlogins.replace('\n','')) result= response.read() print result start=result.find('registerKey') end=result.rfind('registerKey') return result[start+12:end-2] except Exception,e: return '' ltcheck=''' <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"><SOAP-ENV:Body> <ns:checkTelphone> <deviceID>0000000000000000</deviceID> <communicaID>FFFF</communicaID> <agentId>AA3C9309459562D9E04C47F38CAC04A6</agentId> <telplone>%s</telplone> <versionCode>1.1</versionCode> <versionName>1.0</versionName> <clientType>01</clientType> </ns:checkTelphone></SOAP-ENV:Body></SOAP-ENV:Envelope> ''' ltfindtel=''' <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"> <SOAP-ENV:Body> <ns:NetCardFind> <deviceID>0000000000000000</deviceID> <communicaID>FFFF</communicaID> <agentId>78821B3D7E00DD5565607BBFEE530EEC</agentId> <iccidnumber>%s</iccidnumber> <versionName>1.0</versionName> <clientType>01</clientType> </ns:NetCardFind> </SOAP-ENV:Body></SOAP-ENV:Envelope> ''' ''' POST / HTTP/1.1 Accept-Encoding: gzip User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip) Content-Length: 589 Host: 123.125.96.6:8090 Connection: Keep-Alive <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"><SOAP-ENV:Body> <ns:NetCardFind> <deviceID>0000000000000000</deviceID> <communicaID>FFFF</communicaID> <agentId>78821B3D7E00DD5565607BBFEE530EEC</agentId> <iccidnumber>B0A996850A3F8451AB958B4586B473B369CE8A89CE4267D1</iccidnumber> <versionName>1.0</versionName><clientType>01</clientType></ns:NetCardFind></SOAP-ENV:Body></SOAP-ENV:Envelope> ''' #CB06BAB8BABE34A77D694B3577D94A22 def ltc(tel1,flag=False): # data=urllib.urlencode(ap) # k=ltlogin() # agentid=getpwd('1103855807',LTKEY) tel=getpwd(tel1,LTKEY) request = urllib2.Request('http://123.125.96.6:8090',' ') try: response = urllib2.urlopen(request,ltcheck.replace('\n','')%(tel,)) result= response.read() tradeState_start=result.find('tradeState') tradeState_end=result.rfind('tradeState') tradeState=result[tradeState_start+11:tradeState_end-2] description_start=result.find('description') description_end=result.rfind('description') description=result[description_start+len('description')+1:description_end-2] cardnumber_start=result.find('cardnumber') cardnumber_end=result.rfind('cardnumber') cardnumber=result[cardnumber_start+len('cardnumber')+1:cardnumber_end-2] if tradeState=='0000': return {'success':True,'msg':u'手机号可可以出售'} else: return {'success':False,'msg':description.decode('utf-8')} except Exception,e: return {'success':False,'msg':u'账号异常,请联系管理员'} def ltv(tel1,phone,flag=False): # data=urllib.urlencode(ap) # k=ltlogin() # agentid=getpwd('1103855807',LTKEY) tel=getpwd(tel1,'sunnada0') request = urllib2.Request('http://123.125.96.6:8090',' ') try: response = urllib2.urlopen(request,ltfindtel.replace('\n','')%(tel,)) result= response.read() tradeState_start=result.find('tradeState') tradeState_end=result.rfind('tradeState') tradeState=result[tradeState_start+11:tradeState_end-2] description_start=result.find('description') description_end=result.rfind('description') description=result[description_start+len('description')+1:description_end-2] cardnumber_start=result.find('cardnumber') cardnumber_end=result.rfind('cardnumber') cardnumber=result[cardnumber_start+len('cardnumber')+1:cardnumber_end-2] if tradeState=='0000': strl=getpwd(phone,'sunnada0') if cardnumber==strl: return {'success':True,'msg':u'手机号可可以出售'} else: return {'success':False,'msg':u'手机号和iccid不匹配'} else: return {'success':False,'msg':description.decode('utf-8')} except Exception,e: return {'success':False,'msg':u'账号异常,请联系管理员'} ltuploadstr=''' <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"> <SOAP-ENV:Body> <ns:uploadCertificateInfo> <deviceID>0000000000000000</deviceID> <communicaID>000C</communicaID> <agentId>AA3C9309459562D9E04C47F38CAC04A6</agentId> <telplone>%s</telplone> <certificateName>%s</certificateName> <certificateType>8D1B6F7327986F7F</certificateType> <certificateNum>%s</certificateNum> <certificateAdd>%s</certificateAdd> <clientType>01</clientType> </ns:uploadCertificateInfo></SOAP-ENV:Body></SOAP-ENV:Envelope> ''' ''' POST / HTTP/1.1 Accept-Encoding: gzip User-Agent: Google-HTTP-Java-Client/1.15.0-rc (gzip) Content-Length: 601 Host: 123.125.96.6:8090 Connection: Keep-Alive <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"><SOAP-ENV:Body><ns:checkTelphone><deviceID>0000000000000000</deviceID><communicaID>FFFF</communicaID><agentId>AA3C9309459562D9E04C47F38CAC04A6</agentId><telplone>AE413AE36428EE570E8E7BB076B2ECBA</telplone><versionCode>1.1</versionCode><versionName>1.0</versionName><clientType>01</clientType></ns:checkTelphone></SOAP-ENV:Body></SOAP-ENV:Envelope> #%!oE$@@e{}` #caxV;PPOST / HTTP/1.1 Accept-Encoding: identity Content-Length: 805 Host: 123.125.96.6:8090 Content-Type: Connection: close User-Agent: Python-urllib/2.7 <SOAP-ENV:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xmlns:xsd="http://www.w3.org/2001/XMLSchema"xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"xmlns:ns="urn:SmsWBS"><SOAP-ENV:Body><ns:uploadCertificateInfo><deviceID>0000000000000000</deviceID><communicaID>006D</communicaID><agentId>AA3C9309459562D9E04C47F38CAC04A6</agentId><telplone>2741AD34F808F198D506664F25BF3BED</telplone><certificateName>5E22BCEA426CEC30</certificateName><certificateType>8D1B6F7327986F7F</certificateType><certificateNum>8E52943D267AC851D05BB094B9FD8FD5DF3C91FB895D270C</certificateNum><certificateAdd>BB28AD9FDC3EB802BB28AD9FDC3EB802</certificateAdd><clientType>01</clientType></ns:uploadCertificateInfo></SOAP-ENV:Body></SOAP-ENV:Envelope> ''' def saveteltruename(request): ap=getParam(request) res=ap.get('res',u'') del ap['res'] if isinstance(ap,HttpResponse): return ap result=ltv(ap.get('tel'),ap.get('phone'),False) if result.get('success'): respone=ltc(ap.get('phone'),False) if respone.get('success'): r=ltsave(ap) return HttpResponse(res+r.get('msg',{}).get('desc')) return HttpResponse(res+result.get('msg')) def ltsave(ap,flag=False): # data=urllib.urlencode(ap) # k=ltlogin() # agentid=getpwd('1103855807',LTKEY) name=getpwd(ap.get('name'),LTKEY) number=getpwd(ap.get('number'),LTKEY) address=getpwd(ap.get('address'),LTKEY) tel=getpwd(ap.get('phone'),LTKEY) request = urllib2.Request('http://123.125.96.6:8090',' ') try: response = urllib2.urlopen(request,ltuploadstr.replace('\n','')%(tel,name,number,address),20) result= response.read() tradeState_start=result.find('tradeState') tradeState_end=result.rfind('tradeState') tradeState=result[tradeState_start+11:tradeState_end-2] description_start=result.find('description') description_end=result.rfind('description') description=result[description_start+len('description')+1:description_end-2] if tradeState=='0000': return {'success':True,'msg':u'手机号可可以出售'} else: return {'success':False,'msg':description.decode('utf-8')} except Exception,e: return {'success':False,'msg':u'账号异常,请联系管理员'} def ltcheckteltruename(request): ap=getParam(request) res=ap.get('res',u'') del ap['res'] if isinstance(ap,HttpResponse): return ap result=ltv(ap.get('tel'),ap.get('phone'),False) return HttpResponse(res+result.get('msg')) def getParam(request): tel=request.REQUEST.get('tel','') phone=request.REQUEST.get('phone','') name=request.REQUEST.get('name','') number=request.REQUEST.get('number','') address=request.REQUEST.get('address','') if not tel: return HttpResponse(u'请提供手机号码') if not name: return HttpResponse(u'请提供姓名') if not number: return HttpResponse(u'请提供身份证号') if not address: return HttpResponse(u'请提供地址') ap={'name':name.encode('gbk'),'number':number,'tel':tel,'phone':phone,'address':address.encode('gbk'),'res':u'手机号:%s\n姓名:%s\n身份证号:%s\n地址:%s\n'%(tel,name,number,address)} return ap
701fb16e67a00e19b8dd22ddcd3cd10ae57f6b9d
3c2710824c12e00f3f435629fd8d8304c593e269
/deploy/__init__.py
9edeff2d0fe323cb5cc823af607be0b0725fbf50
[]
no_license
zhongzhiqiang/imageServer
fcbbe532a4a016163501199c572f631f7f1c677f
a98cf843ec4b6851b38018683ac144b208937758
refs/heads/master
2020-04-24T02:07:55.320396
2019-03-06T07:33:36
2019-03-06T07:33:36
171,625,689
0
0
null
null
null
null
UTF-8
Python
false
false
115
py
# coding:utf-8 # Time : 2019/2/20 下午3:13 # Author : Zhongzq # File : __init__.py.py # Software: PyCharm
b88557710a9b5ca348cca0003e80aee34b2faa10
0ff7c11d988d29f86fbeb0260a6f98405a54f711
/rh/apps/content/migrations/0022_iconcard_slug.py
9224c2528c7996b66c79decf710417975255ec40
[ "BSD-3-Clause" ]
permissive
rapidpro/chpro-microsite
774c5055ed5e72ec5030da14bc4ff53afbc0df63
4e1d1210b49ec60ab0711d78235bf45eeb5c0275
refs/heads/master
2022-12-14T18:50:44.900595
2018-07-11T09:26:22
2018-07-11T09:26:22
119,061,934
0
0
BSD-3-Clause
2022-12-07T10:23:14
2018-01-26T14:37:17
Python
UTF-8
Python
false
false
441
py
# -*- coding: utf-8 -*- # Generated by Django 1.11.7 on 2018-04-08 22:56 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('content', '0021_cardgrid_style'), ] operations = [ migrations.AddField( model_name='iconcard', name='slug', field=models.SlugField(null=True), ), ]
63795a7d123cd3d7678824c23b97d68a29ba9568
facb8b9155a569b09ba66aefc22564a5bf9cd319
/wp2/merra_scripts/01_netCDF_extraction/merra902TG/133-tideGauge.py
f7874d9721799ca1d9f702f12064f991397cb8fd
[]
no_license
moinabyssinia/modeling-global-storm-surges
13e69faa8f45a1244a964c5de4e2a5a6c95b2128
6e385b2a5f0867df8ceabd155e17ba876779c1bd
refs/heads/master
2023-06-09T00:40:39.319465
2021-06-25T21:00:44
2021-06-25T21:00:44
229,080,191
0
0
null
null
null
null
UTF-8
Python
false
false
5,075
py
# -*- coding: utf-8 -*- """ Created on Mon Jun 01 10:00:00 2020 MERRAv2 netCDF extraction script - template To create an extraction script for each tide gauge @author: Michael Tadesse """ import os import pandas as pd from d_merra_define_grid import Coordinate, findPixels, findindx from c_merra_read_netcdf import readnetcdf from f_merra_subset import subsetter def extract_data(delta= 3): """ This is the master function that calls subsequent functions to extract uwnd, vwnd, slp for the specified tide gauges delta: distance (in degrees) from the tide gauge """ print('Delta = {}'.format(delta), '\n') #defining the folders for predictors dir_in = "/lustre/fs0/home/mtadesse/MERRAv2/data" surge_path = "/lustre/fs0/home/mtadesse/obs_surge" csv_path = "/lustre/fs0/home/mtadesse/merraLocalized" #cd to the obs_surge dir to get TG information os.chdir(surge_path) tg_list = os.listdir() #cd to the obs_surge dir to get TG information os.chdir(dir_in) years = os.listdir() ################################# #looping through the year folders ################################# #to mark the first csv firstCsv = True; for yr in years: os.chdir(dir_in) #print(yr, '\n') os.chdir(os.path.join(dir_in, yr)) #################################### #looping through the daily .nc files #################################### for dd in os.listdir(): os.chdir(os.path.join(dir_in, yr)) #back to the predictor folder print(dd, '\n') ######################################### #get netcdf components - predictor file ######################################### nc_file = readnetcdf(dd) lon, lat, time, predSLP, predU10, predV10 = \ nc_file[0], nc_file[1], nc_file[2], nc_file[3], nc_file[4]\ , nc_file[5] x = 133 y = 134 #looping through individual tide gauges for t in range(x, y): #the name of the tide gauge - for saving purposes # tg = tg_list[t].split('.mat.mat.csv')[0] tg = tg_list[t] #extract lon and lat data from surge csv file #print(tg, '\n') os.chdir(surge_path) if os.stat(tg).st_size == 0: print('\n', "This tide gauge has no surge data!", '\n') continue surge = pd.read_csv(tg, header = None) #surge_with_date = add_date(surge) #define tide gauge coordinate(lon, lat) tg_cord = Coordinate(surge.iloc[0,0], surge.iloc[0,1]) #find closest grid points and their indices close_grids = findPixels(tg_cord, delta, lon, lat) ind_grids = findindx(close_grids, lon, lat) #loop through preds# #subset predictor on selected grid size predictors = {'slp':predSLP, 'wnd_u':predU10, \ 'wnd_v':predV10} for xx in predictors.keys(): pred_new = subsetter(dd, predictors[xx], ind_grids, time) if xx == 'slp': if firstCsv: finalSLP = pred_new else: finalSLP = pd.concat([finalSLP, pred_new], axis = 0) print(finalSLP.shape) elif xx == 'wnd_u': if firstCsv: finalUwnd = pred_new else: finalUwnd = pd.concat([finalUwnd, pred_new], axis = 0) elif xx == 'wnd_v': if firstCsv: finalVwnd = pred_new firstCsv = False; else: finalVwnd = pd.concat([finalVwnd, pred_new], axis = 0) #create directories to save pred_new os.chdir(csv_path) #tide gauge directory tg_name_old = tg.split('.mat.mat.csv')[0] tg_name = '-'.join([str(t), tg_name_old]) try: os.makedirs(tg_name) os.chdir(tg_name) #cd to it after creating it except FileExistsError: #directory already exists os.chdir(tg_name) #save as csv finalSLP.to_csv('slp.csv') finalUwnd.to_csv('wnd_u.csv') finalVwnd.to_csv('wnd_v.csv') #run script extract_data(delta= 3)
f2a189d329b00fd8e8a3cfd89a8d8df1fcd2d9f7
50afc0db7ccfc6c80e1d3877fc61fb67a2ba6eb7
/challenge9(dominos&chess)/Stilton.py
caaccb1afd8aea45c38aa9d03efe151389bd0a8e
[ "MIT" ]
permissive
banana-galaxy/challenges
792caa05e7b8aa10aad8e04369fc06aaf05ff398
8655c14828607535a677e2bb18689681ee6312fa
refs/heads/master
2022-12-26T23:58:12.660152
2020-10-06T13:38:04
2020-10-06T13:38:04
268,851,516
11
8
MIT
2020-09-22T21:21:30
2020-06-02T16:24:41
Python
UTF-8
Python
false
false
921
py
def fill(matrix): missing = [] for index, row in enumerate(matrix, 1): for indexs, square in enumerate(row, 1): if square == 1: missing.append((index, indexs)) if ((len(matrix) * len(matrix[0]) - len(missing)) % 2) != 0: return False if ((len(matrix) * len(matrix[0])) % 2) != 0: white, black = (len(matrix) * len(matrix[0])) / 2, ((len(matrix) * len(matrix[0])) / 2) + 1 else: white, black = (len(matrix) * len(matrix[0])) / 2, (len(matrix) * len(matrix[0])) / 2 for square in missing: if square[0] % 2 == 0 and square[1] % 2 == 0: black -= 1 elif square[0] % 2 == 0 and square[1] % 2 != 0: white -= 1 elif square[0] % 2 != 0 and square[1] % 2 != 0: black -= 1 else: white -= 1 if black == white: return True else: return False
fbda94eb5d433f1be95961f97b4ab52024ffdd70
f14f48e50efb50cfe7078c68f0d61015ae2d646b
/Stock/Select/Ui/Basic/Dlg/DyStockSelectStockInfoDlg.py
3b2bb0fc7d00107148e986883510c06c76cf6928
[ "MIT" ]
permissive
stockcode/DevilYuan
17a23da68954714cacae29f428c3005444e0e3a2
163d06cb7fd30a8f24b3f2e06206c1fd024353c3
refs/heads/master
2020-05-03T14:40:08.420822
2019-03-29T13:16:42
2019-03-29T13:16:42
178,683,886
2
1
MIT
2019-03-31T12:17:49
2019-03-31T12:17:49
null
UTF-8
Python
false
false
1,718
py
from PyQt5.QtWidgets import QDialog, QGridLayout, QPushButton, QApplication, QMessageBox from DyCommon.Ui.DyTreeWidget import * class DyStockSelectStockInfoDlg(QDialog): """ 个股资料选择对话框 """ fields = \ [ ['公司资料', ['所属行业'], ['主营业务'], ['涉及概念'] ], ['股本', ['实际流通股(亿)'], ['实际流通市值(亿元)'], ['机构占比流通(%)'], ] ] def __init__(self, data, parent=None): super().__init__(parent) self._data = data self._initUi() def _initUi(self): self.setWindowTitle('个股资料(F10)') # 控件 cancelPushButton = QPushButton('Cancel') okPushButton = QPushButton('OK') cancelPushButton.clicked.connect(self._cancel) okPushButton.clicked.connect(self._ok) self._stockInfoWidget = DyTreeWidget(self.fields) # 布局 grid = QGridLayout() grid.setSpacing(10) grid.addWidget(self._stockInfoWidget, 0, 0, 20, 10) grid.addWidget(okPushButton, 0, 10) grid.addWidget(cancelPushButton, 1, 10) self.setLayout(grid) self.resize(QApplication.desktop().size().width()//3, QApplication.desktop().size().height()//2) def _ok(self): indicators = self._stockInfoWidget.getCheckedTexts() if not indicators: QMessageBox.warning(self, '错误', '没有选择指标!') return self._data['indicators'] = indicators self.accept() def _cancel(self): self.reject()
df6d130f1b67a434d02ea576a6746f5c86493d01
795b68819d51af14dfabb8dbe40c9e8153029188
/Algorithms/hamming_distance.py
3ec6797d6e087fc60cbe199eb4b3107677bfc583
[]
no_license
MotazBellah/Code-Challenge
507f1fd3d5b3265e54905979c80d609afd81c54d
c38c95239193e26c1a88f6736d2ab9ee37185964
refs/heads/master
2022-02-25T02:54:10.216892
2022-02-19T19:28:05
2022-02-19T19:28:05
193,115,018
1
0
null
null
null
null
UTF-8
Python
false
false
463
py
def hamming_distance(str1, str2): """ Calculate the hamming distance of the two strings Args: str1(string),str2(string): Strings to be used for finding the hamming distance Returns: int: Hamming Distance """ distance = 0 if len(str1) == len(str2): for i in range(len(str1)): if str1[i] != str2[i]: distance += 1 return distance else: return None
295ac0f7cb802d1129f5181fc39e2f5d742df573
981fcfe446a0289752790fd0c5be24020cbaee07
/python2_Grammer/src/basic/string_/bianma/in.py
42c74f80bb0d6b0c77b3d31fad6f876c862d6032
[]
no_license
lijianbo0130/My_Python
7ba45a631049f6defec3977e680cd9bd75d138d1
8bd7548c97d2e6d2982070e949f1433232db9e07
refs/heads/master
2020-12-24T18:42:19.103529
2016-05-30T03:03:34
2016-05-30T03:03:34
58,097,799
0
0
null
null
null
null
UTF-8
Python
false
false
298
py
#coding=utf-8 ''' 可以用in这个操作 可以不加u 或者同时加u ''' if u"用" in u"用的" : #可以 print True # if u"用" in "用的" :#会报 exception # print True if "aa" in u"aaaa": #可以 print True if u"aa" in "aaaa": #可以 print True
0989cff52b5769919d5c96249867fca82355446c
40bb4ced96423bc164ec3fbc5b253b92dd300069
/json1.py
f95890c17f307e8030efe8e6ceab2e81d87e735e
[]
no_license
bawejakunal/coursera-python
b290ec238421b9c540b882bf89fc7c36934db798
c98a3dffb33e416e97e020a8d36a0488659f34b6
refs/heads/master
2021-01-01T05:11:46.467456
2016-10-29T23:57:22
2016-10-29T23:57:22
58,811,070
0
0
null
null
null
null
UTF-8
Python
false
false
222
py
import urllib import json url = raw_input('Enter json file location: ') handle = urllib.urlopen(url) json_data = json.load(handle) total = 0 for comment in json_data['comments']: total += comment['count'] print total
5be3e1a9ba33f04859f32d5991cb45ded9c57d51
4709728fe87bb36c69ec3b4c448d9a07f6736780
/Python Scripts/Problem 17(int).py
7b760c015d696067ee732bdcb97368a84f8b7ebc
[]
no_license
javsav/Project-Euler-Solutions
89237536d20b542d90874127495772271485c503
9866878027bc0fe2bde970c9869f597977b69b2a
refs/heads/master
2021-07-15T08:00:43.374296
2021-03-13T09:34:40
2021-03-13T09:34:40
25,625,647
1
1
null
2014-10-25T06:57:29
2014-10-23T07:49:13
Python
UTF-8
Python
false
false
869
py
all=[] one2nine = ["one", "two", "three", "four", "five", "six", "seven", "eight", "nine"] ten2nineteen = ["ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen"] twenty2ninety = ["twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety"] hundreds = ["hundred"] thousand = ["onethousand"] for i in one2nine: all.append(len(i)) for i in ten2nineteen: all.append(len(i)) for i in twenty2ninety: all.append(len(i)) for j in one2nine: all.append(len(i)+len(j)) one2ninetynine = [] for i in all: one2ninetynine.append(i) for i in one2nine: hundredz = i + "hundred" all.append(len(hundredz)) for k in one2ninetynine: num = len(hundredz + "and") + k all.append(num) all.append(len("onethousand")) print sum(all)
[ "whatever" ]
whatever
2b2b7bbb21b0c1a7c44adb67be4a37a77bf6bb41
09e57dd1374713f06b70d7b37a580130d9bbab0d
/benchmark/startQiskit337.py
a7a607804f4ee79ca572320c4eb032f292a9588a
[ "BSD-3-Clause" ]
permissive
UCLA-SEAL/QDiff
ad53650034897abb5941e74539e3aee8edb600ab
d968cbc47fe926b7f88b4adf10490f1edd6f8819
refs/heads/main
2023-08-05T04:52:24.961998
2021-09-19T02:56:16
2021-09-19T02:56:16
405,159,939
2
0
null
null
null
null
UTF-8
Python
false
false
2,489
py
# qubit number=3 # total number=12 import numpy as np from qiskit import QuantumCircuit, execute, Aer, QuantumRegister, ClassicalRegister, transpile, BasicAer, IBMQ import networkx as nx from qiskit.visualization import plot_histogram from typing import * from pprint import pprint from math import log2 from collections import Counter from qiskit.test.mock import FakeVigo, FakeYorktown kernel = 'circuit/bernstein' def make_circuit(n:int) -> QuantumCircuit: # circuit begin input_qubit = QuantumRegister(n,"qc") prog = QuantumCircuit(input_qubit) prog.h(input_qubit[1]) # number=2 prog.h(input_qubit[2]) # number=3 prog.h(input_qubit[3]) # number=4 prog.y(input_qubit[3]) # number=5 for edge in E: k = edge[0] l = edge[1] prog.cp(-2 * gamma, input_qubit[k-1], input_qubit[l-1]) prog.p(gamma, k) prog.p(gamma, l) prog.rx(2 * beta, range(len(V))) prog.swap(input_qubit[1],input_qubit[0]) # number=6 prog.swap(input_qubit[1],input_qubit[0]) # number=7 prog.y(input_qubit[2]) # number=8 prog.y(input_qubit[2]) # number=9 prog.x(input_qubit[2]) # number=10 prog.x(input_qubit[2]) # number=11 # circuit end return prog if __name__ == '__main__': n = 4 V = np.arange(0, n, 1) E = [(0, 1, 1.0), (0, 2, 1.0), (1, 2, 1.0), (3, 2, 1.0), (3, 1, 1.0)] G = nx.Graph() G.add_nodes_from(V) G.add_weighted_edges_from(E) step_size = 0.1 a_gamma = np.arange(0, np.pi, step_size) a_beta = np.arange(0, np.pi, step_size) a_gamma, a_beta = np.meshgrid(a_gamma, a_beta) F1 = 3 - (np.sin(2 * a_beta) ** 2 * np.sin(2 * a_gamma) ** 2 - 0.5 * np.sin(4 * a_beta) * np.sin(4 * a_gamma)) * ( 1 + np.cos(4 * a_gamma) ** 2) result = np.where(F1 == np.amax(F1)) a = list(zip(result[0], result[1]))[0] gamma = a[0] * step_size beta = a[1] * step_size prog = make_circuit(4) sample_shot =5600 writefile = open("../data/startQiskit337.csv", "w") # prog.draw('mpl', filename=(kernel + '.png')) backend = BasicAer.get_backend('qasm_simulator') circuit1 = transpile(prog, FakeYorktown()) circuit1.measure_all() prog = circuit1 info = execute(prog,backend=backend, shots=sample_shot).result().get_counts() print(info, file=writefile) print("results end", file=writefile) print(circuit1.depth(), file=writefile) print(circuit1, file=writefile) writefile.close()
d298f539a68d4dcaf9cd1289333c6744dbf1de40
aad164e4efe1d55cc189c35956bfd435b14a0f52
/eve-8.21.494548/eve/client/script/ui/services/shipConfigSvc.py
6932a49e75d9e03b8b55c15f9bef0c9e9a5c80ca
[]
no_license
Pluckyduck/eve
61cc41fe8fd4dca4fbdcc4761a37bcfeb27ed84f
9a277707ab1f162c6bd9618faf722c0be3ea93ad
refs/heads/master
2020-12-28T23:35:29.992875
2013-05-06T14:24:33
2013-05-06T14:24:33
null
0
0
null
null
null
null
UTF-8
Python
false
false
2,783
py
#Embedded file name: c:/depot/games/branches/release/EVE-TRANQUILITY/eve/client/script/ui/services/shipConfigSvc.py import util import locks import service import moniker class ShipConfigSvc(service.Service): __guid__ = 'svc.shipConfig' __update_on_reload__ = 1 __dependencies__ = [] __notifyevents__ = ['OnSessionChanged'] __startupdependencies__ = [] def Run(self, memstream_which_absolutely_noone_uses_anymore_but_no_one_gets_around_to_remove = None): self._ship = None self.shipid = util.GetActiveShip() self.config = None def _ClearCachedAttributes(self): self.shipid = util.GetActiveShip() self.config = None self._ship = None def OnSessionChanged(self, isRemote, session, change): if 'locationid' in change or 'shipid' in change: self._ClearCachedAttributes() @property def ship(self): if self._ship is None: self._ship = moniker.GetShipAccess() return self._ship def GetShipConfig(self, shipID = None): if shipID is not None: return moniker.GetShipAccess().GetShipConfiguration(shipID) if util.GetActiveShip() != self.shipid: self._ClearCachedAttributes() with locks.TempLock('%s:%s' % (self, self.shipid)): if self.config is None: self.config = self.ship.GetShipConfiguration(self.shipid) return self.config def SetShipConfig(self, key, value): lock = locks.TempLock('%s:%s' % (self, self.shipid)) if lock.lockedWhen is not None: return with lock: self.ship.ConfigureShip(self.shipid, {key: value}) self.config[key] = value def ToggleFleetHangarFleetAccess(self): self.SetShipConfig('FleetHangar_AllowFleetAccess', not self.IsFleetHangarFleetAccessAllowed()) def ToggleFleetHangarCorpAccess(self): self.SetShipConfig('FleetHangar_AllowCorpAccess', not self.IsFleetHangarCorpAccessAllowed()) def ToggleShipMaintenanceBayFleetAccess(self): self.SetShipConfig('SMB_AllowFleetAccess', not self.IsShipMaintenanceBayFleetAccessAllowed()) def ToggleShipMaintenanceBayCorpAccess(self): self.SetShipConfig('SMB_AllowCorpAccess', not self.IsShipMaintenanceBayCorpAccessAllowed()) def IsFleetHangarFleetAccessAllowed(self): return self.GetShipConfig()['FleetHangar_AllowFleetAccess'] def IsFleetHangarCorpAccessAllowed(self): return self.GetShipConfig()['FleetHangar_AllowCorpAccess'] def IsShipMaintenanceBayFleetAccessAllowed(self): return self.GetShipConfig()['SMB_AllowFleetAccess'] def IsShipMaintenanceBayCorpAccessAllowed(self): return self.GetShipConfig()['SMB_AllowCorpAccess']
6a580dc82809ae40b6262af7932e4ec1dc490998
c51ed0c36d532276211497c8d7e5dda68eb6c303
/host_management/models.py
4467361164dbfcaa9c56e0f535aafa0a64b79e68
[]
no_license
pwgraham91/restauPro
75f56f1c1b4aaa8c5d1465765802fa71955f96ae
bc6f278e0aa1603e2da4c8fd560fad7db7ab148c
refs/heads/master
2022-12-07T20:28:43.579613
2015-04-21T05:06:11
2015-04-21T05:06:11
25,218,369
0
0
null
2022-11-22T00:31:59
2014-10-14T17:35:19
Python
UTF-8
Python
false
false
1,664
py
from django.contrib.auth.models import AbstractUser from django.db import models # Create your models here. class Restaurant(AbstractUser): restaurant_name = models.CharField(max_length=50) def __unicode__(self): return u"{}".format(self.username) class Table(models.Model): table_name = models.CharField(max_length=10, help_text="example: 103 (do not put 'table 103' just '103'") seats = models.SmallIntegerField(help_text="number of maximum available seats at the table") restaurant = models.ForeignKey(Restaurant, related_name='tables') def __unicode__(self): return u"{}".format(self.table_name) class Party(models.Model): party_name = models.CharField(max_length=50, help_text="Enter this if you know the name of the party so you can save their data", blank=True) number_of_males = models.CharField(max_length=2) number_of_females = models.CharField(max_length=2) number_of_children = models.CharField(max_length=2) lunch = models.BooleanField(help_text="check true for lunch or false for dinner", default=False) monday_to_thursday = models.BooleanField(help_text="check true for Monday to Thursday or false for Friday to Sunday", default=False) start_time = models.DateTimeField(auto_now_add=True, null=True) reservation_time = models.DateTimeField(null=True) predicted_end_time = models.DateTimeField(null=True) end_time = models.DateTimeField(null=True) total_time = models.CharField(max_length=2, blank=True) table = models.ForeignKey(Table, related_name='parties') def __unicode__(self): return u"pk:{} name:{}".format(self.pk, self.party_name)
5289fb1c8fe99a7fc13a1f1971b0823ce6869053
271c7959a39f3d7ff63dddf285004fd5badee4d9
/venv/Lib/site-packages/flask_codemirror/fields.py
7f2fda9478de0dc6e5891594c3f5cc0c5036309b
[ "MIT" ]
permissive
natemellendorf/configpy
b6b01ea4db1f2b9109fd4ddb860e9977316ed964
750da5eaef33cede9f3ef532453d63e507f34a2c
refs/heads/master
2022-12-11T05:22:54.289720
2019-07-22T05:26:09
2019-07-22T05:26:09
176,197,442
4
1
MIT
2022-12-08T02:48:51
2019-03-18T03:24:12
Python
UTF-8
Python
false
false
1,759
py
#! /usr/bin/env python # -*- coding: utf-8 -*- # 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 3 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 <http://www.gnu.org/licenses/>. """ Flask Codemirror Field ~~~~~~~~~~~~~~~~~~~~~~ Import it using `from flask.ext.codemirror.fields import CodeMirrorField` It works exactly like a `wtforms.fields.TextAreaField` """ from __future__ import print_function from flask_codemirror.widgets import CodeMirrorWidget try: from wtforms.fields import TextAreaField except ImportError as exc: print('WTForms is required by Flask-Codemirror') raise exc __author__ = 'TROUVERIE Joachim' class CodeMirrorField(TextAreaField): """Code Mirror Field A TextAreaField with a custom widget :param language: CodeMirror mode :param config: CodeMirror config """ def __init__(self, label='', validators=None, language=None, config=None, **kwargs): widget = CodeMirrorWidget(language, config) super(CodeMirrorField, self).__init__(label=label, validators=validators, widget=widget, **kwargs)
0ce8042dabf8b7509cbfa273ea284407ef3b82da
f93d4582838cdb4fecfcce3ba251c0a616e2baeb
/backend/location/migrations/0001_initial.py
53c62a7cdcb732e888811b7fdf2030aa8e9c4ca5
[]
no_license
crowdbotics-apps/lil-lolo-20580
e203827883f9ad9d94bb704b037986fbe290579e
500eeabfb4ac0ca324f6616320ea35627fecf64d
refs/heads/master
2022-12-18T16:51:07.642630
2020-09-22T22:18:02
2020-09-22T22:18:02
297,785,167
0
0
null
null
null
null
UTF-8
Python
false
false
2,700
py
# Generated by Django 2.2.16 on 2020-09-22 22:17 from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('task_profile', '0001_initial'), ] operations = [ migrations.CreateModel( name='MapLocation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('name', models.CharField(max_length=255)), ('latitude', models.DecimalField(decimal_places=8, max_digits=12)), ('longitude', models.DecimalField(decimal_places=8, max_digits=12)), ], ), migrations.CreateModel( name='TaskLocation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('address', models.TextField()), ('zip', models.CharField(max_length=6)), ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='tasklocation_location', to='location.MapLocation')), ], ), migrations.CreateModel( name='TaskerLocation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('latitude', models.DecimalField(decimal_places=8, max_digits=12)), ('longitude', models.DecimalField(decimal_places=8, max_digits=12)), ('last_updated', models.DateTimeField(auto_now=True)), ('address', models.TextField(blank=True, null=True)), ('zip', models.CharField(blank=True, max_length=6, null=True)), ('tasker', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='taskerlocation_tasker', to='task_profile.TaskerProfile')), ], ), migrations.CreateModel( name='CustomerLocation', fields=[ ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('zip', models.CharField(max_length=6)), ('country', models.CharField(max_length=50)), ('customer', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='customerlocation_customer', to='task_profile.CustomerProfile')), ('location', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='customerlocation_location', to='location.MapLocation')), ], ), ]
d236e1b44c5dcd360a0166680228eae6a2e503ac
182c651a9b00b9b4d80e6d51ae574cb793958cd6
/widgets/digitalclock.py
dabda1832b534b93346b0b7840f01d7283a6e6e9
[]
no_license
eudu/pyqt-examples
c61a7108e1fbfcf2cd918a0f99e9a5a90a3f305c
8e533b7b3c5e9bbe0617ef1ecb9b169dd216c181
refs/heads/master
2020-03-16T01:23:19.573347
2018-05-06T20:20:57
2018-05-06T20:20:57
132,438,940
1
0
null
null
null
null
UTF-8
Python
false
false
2,876
py
#!/usr/bin/python3 ############################################################################# ## ## Copyright (C) 2013 Riverbank Computing Limited. ## Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ## All rights reserved. ## ## This file is part of the examples of PyQt. ## ## $QT_BEGIN_LICENSE:BSD$ ## You may use this file under the terms of the BSD license as follows: ## ## "Redistribution and use in source and binary forms, with or without ## modification, are permitted provided that the following conditions are ## met: ## * Redistributions of source code must retain the above copyright ## notice, this list of conditions and the following disclaimer. ## * Redistributions in binary form must reproduce the above copyright ## notice, this list of conditions and the following disclaimer in ## the documentation and/or other materials provided with the ## distribution. ## * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor ## the names of its contributors may be used to endorse or promote ## products derived from this software without specific prior written ## permission. ## ## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT ## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR ## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT ## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, ## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY ## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT ## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE ## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." ## $QT_END_LICENSE$ ## ############################################################################# from PyQt5.QtCore import QTime, QTimer from PyQt5.QtWidgets import QApplication, QLCDNumber class DigitalClock(QLCDNumber): def __init__(self, parent=None): super(DigitalClock, self).__init__(parent) self.setSegmentStyle(QLCDNumber.Filled) timer = QTimer(self) timer.timeout.connect(self.showTime) timer.start(1000) self.showTime() self.setWindowTitle("Digital Clock") self.resize(150, 60) def showTime(self): time = QTime.currentTime() text = time.toString('hh:mm') if (time.second() % 2) == 0: text = text[:2] + ' ' + text[3:] self.display(text) if __name__ == '__main__': import sys app = QApplication(sys.argv) clock = DigitalClock() clock.show() sys.exit(app.exec_())
95dbe60a16f38105b41184d2329854c41b7b66e1
598abc2c440808b7999ac45a6bf420e1ec48b105
/utils/util.py
968583c878a0b99bc8f16be1368a667656d05158
[]
no_license
gmdmgithub/python-chat
0ad70868e166f2289e475e57834a79e7ebf5e68c
c4fd8dbfc4bd93704199cc0b5596aaee405b447e
refs/heads/master
2020-04-18T09:39:20.880641
2019-03-15T14:31:20
2019-03-15T14:31:20
167,441,834
0
0
null
null
null
null
UTF-8
Python
false
false
133
py
import os def str2bool(v): return v.lower() in ("yes", "true", "t", "1") def getEnvVal(name): return os.environ.get(name)
6d1b6ee99f7db8e1acb5e14728dad369ccd33b37
d61d05748a59a1a73bbf3c39dd2c1a52d649d6e3
/chromium/build/toolchain/win/rc/rc.py
23387621c02332eb2ff461291706a93e5cf656a0
[ "BSD-3-Clause" ]
permissive
Csineneo/Vivaldi
4eaad20fc0ff306ca60b400cd5fad930a9082087
d92465f71fb8e4345e27bd889532339204b26f1e
refs/heads/master
2022-11-23T17:11:50.714160
2019-05-25T11:45:11
2019-05-25T11:45:11
144,489,531
5
4
BSD-3-Clause
2022-11-04T05:55:33
2018-08-12T18:04:37
null
UTF-8
Python
false
false
7,582
py
#!/usr/bin/env python # Copyright 2017 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """usage: rc.py [options] input.res A resource compiler for .rc files. options: -h, --help Print this message. -I<dir> Add include path. -D<sym> Define a macro for the preprocessor. /fo<out> Set path of output .res file. /nologo Ignored (rc.py doesn't print a logo by default). /showIncludes Print referenced header and resource files.""" from __future__ import print_function from collections import namedtuple import codecs import os import re import subprocess import sys import tempfile THIS_DIR = os.path.abspath(os.path.dirname(__file__)) SRC_DIR = \ os.path.dirname(os.path.dirname(os.path.dirname(os.path.dirname(THIS_DIR)))) def ParseFlags(): """Parses flags off sys.argv and returns the parsed flags.""" # Can't use optparse / argparse because of /fo flag :-/ includes = [] defines = [] output = None input = None show_includes = False # Parse. for flag in sys.argv[1:]: if flag == '-h' or flag == '--help': print(__doc__) sys.exit(0) if flag.startswith('-I'): includes.append(flag) elif flag.startswith('-D'): defines.append(flag) elif flag.startswith('/fo'): if output: print('rc.py: error: multiple /fo flags', '/fo' + output, flag, file=sys.stderr) sys.exit(1) output = flag[3:] elif flag == '/nologo': pass elif flag == '/showIncludes': show_includes = True elif (flag.startswith('-') or (flag.startswith('/') and not os.path.exists(flag))): print('rc.py: error: unknown flag', flag, file=sys.stderr) print(__doc__, file=sys.stderr) sys.exit(1) else: if input: print('rc.py: error: multiple inputs:', input, flag, file=sys.stderr) sys.exit(1) input = flag # Validate and set default values. if not input: print('rc.py: error: no input file', file=sys.stderr) sys.exit(1) if not output: output = os.path.splitext(input)[0] + '.res' Flags = namedtuple('Flags', ['includes', 'defines', 'output', 'input', 'show_includes']) return Flags(includes=includes, defines=defines, output=output, input=input, show_includes=show_includes) def ReadInput(input): """"Reads input and returns it. For UTF-16LEBOM input, converts to UTF-8.""" # Microsoft's rc.exe only supports unicode in the form of UTF-16LE with a BOM. # Our rc binary sniffs for UTF-16LE. If that's not found, if /utf-8 is # passed, the input is treated as UTF-8. If /utf-8 is not passed and the # input is not UTF-16LE, then our rc errors out on characters outside of # 7-bit ASCII. Since the driver always converts UTF-16LE to UTF-8 here (for # the preprocessor, which doesn't support UTF-16LE), our rc will either see # UTF-8 with the /utf-8 flag (for UTF-16LE input), or ASCII input. # This is compatible with Microsoft rc.exe. If we wanted, we could expose # a /utf-8 flag for the driver for UTF-8 .rc inputs too. # TODO(thakis): Microsoft's rc.exe supports BOM-less UTF-16LE. We currently # don't, but for chrome it currently doesn't matter. is_utf8 = False try: with open(input, 'rb') as rc_file: rc_file_data = rc_file.read() if rc_file_data.startswith(codecs.BOM_UTF16_LE): rc_file_data = rc_file_data[2:].decode('utf-16le').encode('utf-8') is_utf8 = True except IOError: print('rc.py: failed to open', input, file=sys.stderr) sys.exit(1) except UnicodeDecodeError: print('rc.py: failed to decode UTF-16 despite BOM', input, file=sys.stderr) sys.exit(1) return rc_file_data, is_utf8 def Preprocess(rc_file_data, flags): """Runs the input file through the preprocessor.""" clang = os.path.join(SRC_DIR, 'third_party', 'llvm-build', 'Release+Asserts', 'bin', 'clang-cl') # Let preprocessor write to a temp file so that it doesn't interfere # with /showIncludes output on stdout. if sys.platform == 'win32': clang += '.exe' temp_handle, temp_file = tempfile.mkstemp(suffix='.i') # Closing temp_handle immediately defeats the purpose of mkstemp(), but I # can't figure out how to let write to the temp file on Windows otherwise. os.close(temp_handle) clang_cmd = [clang, '/P', '/DRC_INVOKED', '/TC', '-', '/Fi' + temp_file] if os.path.dirname(flags.input): # This must precede flags.includes. clang_cmd.append('-I' + os.path.dirname(flags.input)) if flags.show_includes: clang_cmd.append('/showIncludes') clang_cmd += flags.includes + flags.defines p = subprocess.Popen(clang_cmd, stdin=subprocess.PIPE) p.communicate(input=rc_file_data) if p.returncode != 0: sys.exit(p.returncode) preprocessed_output = open(temp_file, 'rb').read() os.remove(temp_file) # rc.exe has a wacko preprocessor: # https://msdn.microsoft.com/en-us/library/windows/desktop/aa381033(v=vs.85).aspx # """RC treats files with the .c and .h extensions in a special manner. It # assumes that a file with one of these extensions does not contain # resources. If a file has the .c or .h file name extension, RC ignores all # lines in the file except the preprocessor directives.""" # Thankfully, the Microsoft headers are mostly good about putting everything # in the system headers behind `if !defined(RC_INVOKED)`, so regular # preprocessing with RC_INVOKED defined almost works. The one exception # is struct tagCRGB in dlgs.h, but that will be fixed in the next major # SDK release too. # TODO(thakis): Remove this once an SDK with the fix has been released. preprocessed_output = re.sub('typedef struct tagCRGB\s*{[^}]*} CRGB;', '', preprocessed_output) return preprocessed_output def RunRc(preprocessed_output, is_utf8, flags): if sys.platform.startswith('linux'): rc = os.path.join(THIS_DIR, 'linux64', 'rc') elif sys.platform == 'darwin': rc = os.path.join(THIS_DIR, 'mac', 'rc') elif sys.platform == 'win32': rc = os.path.join(THIS_DIR, 'win', 'rc.exe') else: print('rc.py: error: unsupported platform', sys.platform, file=sys.stderr) sys.exit(1) rc_cmd = [rc] # Make sure rc-relative resources can be found: if os.path.dirname(flags.input): rc_cmd.append('/cd' + os.path.dirname(flags.input)) rc_cmd.append('/fo' + flags.output) if is_utf8: rc_cmd.append('/utf-8') # TODO(thakis): rc currently always prints full paths for /showIncludes, # but clang-cl /P doesn't. Which one is right? if flags.show_includes: rc_cmd.append('/showIncludes') # Microsoft rc.exe searches for referenced files relative to -I flags in # addition to the pwd, so -I flags need to be passed both to both # the preprocessor and rc. rc_cmd += flags.includes p = subprocess.Popen(rc_cmd, stdin=subprocess.PIPE) p.communicate(input=preprocessed_output) return p.returncode def main(): # This driver has to do these things: # 1. Parse flags. # 2. Convert the input from UTF-16LE to UTF-8 if needed. # 3. Pass the input through a preprocessor (and clean up the preprocessor's # output in minor ways). # 4. Call rc for the heavy lifting. flags = ParseFlags() rc_file_data, is_utf8 = ReadInput(flags.input) preprocessed_output = Preprocess(rc_file_data, flags) return RunRc(preprocessed_output, is_utf8, flags) if __name__ == '__main__': sys.exit(main())
28c96b9b69ca7008f8608d3490523cacc28557fe
d9fa694966bd4aadc61394a8b621a8215e592899
/scripts/test2.py
e1cef9d4a1410b47cc90ad42dd1bd561985d55fe
[]
no_license
SevenLines/MathLogic
408a750a92349d0383f1a39802a6cba3c574beed
74d4aeaa738db530f63b7de9df0fdce0c0354ca7
refs/heads/master
2021-01-22T23:58:31.036871
2014-12-10T12:59:08
2014-12-10T12:59:08
null
0
0
null
null
null
null
UTF-8
Python
false
false
5,397
py
# coding=utf-8 """ Задачи по темам: теория множеств отношения предваренная нормальная форма анализ рассуждений формальный вывод """ import random import string def gen_task2(s1, s2, s3, s4, s5): assert s2[0] == s5[0] assert len(set(s1 + s2 + s3 + s4 + s5)) == len(s1 + s2 + s3 + s4 + s5) - 1 word1 = s1 + s2 + s3 word2 = s4 + s2 word3 = s4 + s5 # print "your words: {}-{}-{}".format(word1, word2, word3) x = random.sample(filter(lambda x: x not in word1 + word2 + word3, string.ascii_lowercase), 3) alpha = [] beta = [] for i in xrange(len(word2) / 2): el = random.choice(x) if i == 1: beta.append((el, s5[1])) a = (word2[2 * i], el) b = (el, word2[2 * i + 1]) alpha.append(a) beta.append(b) for i in xrange(len(word1) / 2): if i == 1: continue el = random.choice(x) a = (el, word1[2 * i + 1]) b = (word1[2 * i], el) alpha.append(a) beta.append(b) gamma = [ (word3[0], word3[1]), (word3[2], word3[3]), ] random.shuffle(alpha) random.shuffle(beta) random.shuffle(gamma) out = r"$$\begin{{array}}{{l}} " \ r"\alpha=\{{ {alpha} \}} \\ " \ r"\beta=\{{ {beta} \}} \\ " \ r"\gamma=\{{ {gamma} \}} " \ r"\end{{array}}$$".format(**{ 'alpha': ", ".join(['(%s, %s)' % a for a in alpha]), 'beta': ", ".join(['(%s, %s)' % a for a in beta]), 'gamma': ", ".join(['(%s, %s)' % a for a in gamma]), }) return out task1 = { 'description': r"Доказать:", 'variants': [ r"$$B\,\dot{-}\,U=B'$$", r"$$B\setminus A = B\,\dot{-}\,(B\cap A)$$", r"$$A\,\dot{-}\,\emptyset=A$$", r"$$A\setminus B = A\,\dot{-}\,(A\cap )$$", ] } task2 = { 'description': r"Построить отношение $(\alpha\cdot\beta\cup\beta\cdot\alpha)\setminus\gamma$", 'variants': [ gen_task2("mo", "nd", "ay", "wi", "ne"), gen_task2("op", "ti", "cs", "ka", "ty"), gen_task2("gl", "om", "iy", "et", "on"), gen_task2("do", "ng", "le", "bu", "nt"), ] } task3 = { 'description': "Привести к предваренной нормальной форме: \\", 'variants': [ ] } # проверить утверждение task4 = { 'description': "Проанализируйте рассуждение:", 'variants': [ "Все бегуны -- спортсмены. Ни один спортсмен не курит. " "Следовательно, ни один курящий не является бегуном", "Некоторые змеи ядовиты. Ужи -- змеи. Следовательно, ужи -- ядовиты. ", "Все студенты ИГУ -- жители Иркутской области. Некоторые жители Иркутской области -- пенсионеры. " "Следовательно, некоторые студенты ИГУ -- пенсионеры", "Все сильные шахматисты знают теорию шахматной игры." "Иванов -- так себе шахматист. Следовательно он не знает теорию шахматной игры.", "Все хирурги -- врачи. Некоторые врачи -- герои России. " "Следовательно, некоторые хирурги -- Герои России", ] } task5 = { 'description': "Построить вывод", 'variants': [ r"$$K \to L \vdash \neg K \to \neg L$$", r"$$K, \neg K \vdash \neg L$$", r"$$M \to \neg T \vdash T \to \neg M$$", r"$$A \to (B \to C) \vdash B \to (A \to C)$$", ] } quantifiers = ['\\forall', '\\exists'] params = [ 'lov', 'mad', 'far', 'git', ] predicats = [ 'RED', 'WEB', 'LSD', 'CAT', ] template = r"$${q0} {p0}{l0}({p0},{p1}) \to \neg {q1} {p1}( {l1}({p1},{p0}) " \ r"\wedge {q2} {p0}{q3} {p2} {l2}({p2}, {p0}))$$" random.seed(78) for (param, predicat) in zip(params, predicats): quantifier = [random.choice(quantifiers) for _ in xrange(4)] task = template.format(**{ 'q0': quantifier[0], 'q1': quantifier[1], 'q2': quantifier[2], 'q3': quantifier[3], 'p0': param[0], 'p1': param[1], 'p2': param[2], 'l0': predicat[0], 'l1': predicat[1], 'l2': predicat[2], }) task3['variants'].append(task) for i, t in enumerate(zip(task1['variants'], task2['variants'], task3['variants'], task4['variants'], task5['variants']), 1): print r"Вариант %s" % i print r"\begin{enumerate}" print r"\item %s" % task1['description'] print t[0] print r"\item %s:" % task2['description'] print t[1] print r"\item %s:\\" % task3['description'] print t[2] print r"\item %s:\\" % task4['description'] print t[3] print r"\item %s:\\" % task5['description'] print t[4] print r"\end{enumerate}"
03ae3fa9d96bc902bc2bbe2103a62c0a7a22e773
78489fa0957a109c9ec8ef792266222e4d3deabd
/api/start_video_tracking.py
5d4047fef464af92bb013b33f3bf427a3ad46ca7
[]
no_license
444thLiao/video_annotator_script
52e6d218e4ee3c31507d579bf144a4f22c043a55
198a00bb45f5eb298f88f1855248d33db4bcc425
refs/heads/master
2020-05-09T12:10:51.712156
2019-04-24T10:56:53
2019-04-24T10:56:53
181,104,360
0
0
null
null
null
null
UTF-8
Python
false
false
3,881
py
from AnyQt import QtCore from tqdm import tqdm from init_project_within_terminal import * def unchecked_all(videos): for row in range(videos.count): # 从上往下依次选择视频,并uncheck该视频 item = videos._form.listWidget.item(row) item.setCheckState(QtCore.Qt.Unchecked) def start_video_tracking(project_path): myapp.load_project(project_path) tracking_window = myapp.tracking_window # <pythonvideoannotator_module_tracking.tracking_window.TrackingWindow at 0x7fc321d60318> datasetsdialog = tracking_window.input_dialog # pythonvideoannotator_models_gui.dialogs.datasets.datasets.DatasetsDialog datasetsselectordialog = datasetsdialog._panel.value # 没有value就只是ControlEmptyWidget,而不是dialog的实例 # pythonvideoannotator_models_gui.dialogs.datasets.datasets_selector.DatasetsSelectorDialog select_video = datasetsselectordialog._videos select_obj = datasetsselectordialog._objects select_datasets = datasetsselectordialog._datasets for row in tqdm(range(select_video.count)): # 从上往下依次选择视频,并check该视频 item = select_video._form.listWidget.item(row) item.setCheckState(QtCore.Qt.Checked) # 应该只有1个object item = select_obj._form.listWidget.item(0) item.setCheckState(QtCore.Qt.Checked) # 应该有两个datasets for ds_row in range(select_datasets.count): item = select_datasets._form.listWidget.item(ds_row) item.setCheckState(QtCore.Qt.Checked) # 选择完上面的video obj dataset,该选择workflow和mask了 filter_window = tracking_window._filter # 获取filter window tracking_window._filter._imageflows.value = 'Adaptative threshold + mask' # 设置imageflow 到 该workflow (validate by tracking_window._filter._imgfilters.value) imgfilter = tracking_window._filter._imgfilters.value # 获取新的image filter 窗口 threshold_panel = imgfilter[0][1] mask_panel = imgfilter[-1][1] # 两个主要panel threshold_panel._field_adaptive_threshold_block_size.value = 925 threshold_panel._field_adaptive_threshold_c.value = 250 # 调整两个参数 video_select_panel = mask_panel._panel.value._videos geo_select_panel = mask_panel._panel.value._objects item = video_select_panel._form.listWidget.item(row) item.setCheckState(QtCore.Qt.Checked) # 选中与row相同的一个video for i in range(geo_select_panel.count): item = geo_select_panel._form.listWidget.item(i) if item.text() == 'B': # 如果是B,才选中 item.setCheckState(QtCore.Qt.Checked) # 选择obj中B,即边界,然后结束. # 开始执行 tracking_window.process() unchecked_all(video_select_panel) unchecked_all(geo_select_panel) unchecked_all(select_video) unchecked_all(select_obj) unchecked_all(select_datasets) myapp.save_project(project_path) if __name__ == '__main__': import argparse parser = argparse.ArgumentParser() parser.add_argument("-i", '--input_dir', help="which directory you want to process", type=str, ) parser.add_argument("-r", "--recursive", help="recursive rename and move", action="store_true") args = parser.parse_args() indir = os.path.abspath(args.input_dir) r = args.recursive if r: for dir in glob(os.path.join(indir, '*')): basename = os.path.basename(dir) if os.path.isdir(dir): print("recursively process each directory: %s" % basename) start_video_tracking(dir) else: start_video_tracking(indir)
446b53b2d41712803f7dd4b6fcca52106dad1bd7
b7b113e980f6deba5c4815708c129bf1f9908ce7
/DevelopmentCode/DataAnalysis/compute_wave_spectrum_HPR.py
9aa346c12eb05b64ff3031a0d66d5b9ab18717d1
[ "MIT" ]
permissive
jerabaul29/LoggerWavesInIce_InSituWithIridium
cb03463d4c9e8639a628e9de1ad0940670f81a51
a23496b90821eb253af70a79dec714d66ce857ff
refs/heads/master
2022-05-04T02:19:15.120648
2022-03-18T08:10:37
2022-03-18T08:10:37
180,647,572
4
1
null
null
null
null
UTF-8
Python
false
false
6,655
py
import numpy as np """ a program to calculate directional spectrum from HPR. a copy of the code provided by Graig. Possibly more updated version available on the git DirectionalAnalysisSpectra repo. """ global g g = 9.81 # acceleration due to gravity class DirectionalSpectra(object): '''A program to calculate directional spectra from Fourier coefficients''' def __init__(self, a0, a1, a2, b1, b2, R, freqs, ndir): self.freqs = freqs self.a0 = a0 self.a1 = a1 self.a2 = a2 self.b1 = b1 self.b2 = b2 self.R = R self.k = self.R * ((2 * np.pi * self.freqs)**2) / g self.k0 = (2 * np.pi * self.freqs)**2 / g nfreqs = np.size(freqs) # df = 2*np.pi / ndir self.dirs = np.linspace(-np.pi, np.pi, ndir) # self.dirs = np.linspace(0, 2*np.pi - df, ndir) # self.SDIR = np.zeros((nfreqs, ndir)) def FEM(self): '''calculate directional spectra with Fourier''' # weights = np.array([1.0, 1.0])/np.pi weights = np.array([2. / 3., 1. / 6.]) / np.pi nf = np.size(self.freqs) nd = np.size(self.dirs) a02 = self.a0.repeat(nd).reshape((nf, nd)) a12 = self.a1.repeat(nd).reshape((nf, nd)) b12 = self.b1.repeat(nd).reshape((nf, nd)) a22 = self.a2.repeat(nd).reshape((nf, nd)) b22 = self.b2.repeat(nd).reshape((nf, nd)) t2 = self.dirs.repeat(nf).reshape((nd, nf)).T # calculate directional spectrum self.S = 0.5 * a02 + weights[0] * (a12 * np.cos(t2) + b12 * np.sin(t2)) + \ weights[1] * (a22 * np.cos(2 * t2) + b22 * np.sin(2 * t2)) def MLM(self): '''Calculate directional spectrum using IMLM method''' # first define matrix components in frequencies M11 = self.a0 M22 = 0.5 * (self.a0 + self.a2) M33 = 0.5 * (self.a0 - self.a2) M12 = 0.0 - 1j * self.a1 M13 = 0.0 - 1j * self.b1 M23 = 0.5 * self.b2 M21 = np.conj(M12) M32 = np.conj(M23) M31 = np.conj(M13) # go through directional spectrum nf = np.size(self.freqs) nd = np.size(self.dirs) E = 1j * np.zeros((nf, nd)) D = np.zeros((nf, nd)) S = self.a0.repeat(nd).reshape((nf, nd)) G = 1j * np.zeros((3, nd)) G[0, :] = 1.0 G[1, :] = 1j * np.cos(self.dirs) G[2, :] = 1j * np.sin(self.dirs) # cycle through frequencies for ff, freq in enumerate(self.freqs): M = np.matrix('{} {} {} ; {} {} {} ; {} {} {}'.format(M11[ff], M12[ff], M13[ff], M21[ff], M22[ff], M23[ff], M31[ff], M32[ff], M33[ff])) invM = np.array(np.linalg.inv(M)) # iterate over dimensions for n in range(3): for m in range(3): E[ff, :] = E[ff, :] + invM[m, n] * G[n, :] * np.conj(G[m, :]) # start iterative procedure E0 = 1.0 / E[ff, :] E0 = E0 / np.trapz(E0, self.dirs) D[ff, :] = E0 # define some parameters self.D = D self.S = S * self.D def IMLM(self, gamma=0.1, beta=1.0, alpha=0.1, miter=100): '''Calculate directional spectrum using IMLM method''' # first define matrix components in frequencies M11 = self.a0 M22 = 0.5 * (self.a0 + self.a2) M33 = 0.5 * (self.a0 - self.a2) M12 = 0.0 - 1j * self.a1 M13 = 0.0 - 1j * self.b1 M23 = 0.5 * self.b2 + 0.0 * 1j M21 = np.conj(M12) M32 = np.conj(M23) M31 = np.conj(M13) # go through directional spectrum nf = np.size(self.freqs) nd = np.size(self.dirs) E = 1j * np.zeros((nf, nd)) D = np.zeros((nf, nd)) S = self.a0.repeat(nd).reshape((nf, nd)) G = 1j * np.zeros((3, nd)) G[0, :] = 1.0 G[1, :] = 1j * np.cos(self.dirs) G[2, :] = 1j * np.sin(self.dirs) # cycle through frequencies for ff, freq in enumerate(self.freqs): M = np.matrix('{} {} {}; {} {} {}; {} {} {}'.format(M11[ff], M12[ff], M13[ff], M21[ff], M22[ff], M23[ff], M31[ff], M32[ff], M33[ff])) invM = np.array(np.linalg.inv(M)) # iterate over dimensions for n in range(3): for m in range(3): E[ff, :] = E[ff, :] + invM[m, n] * G[n, :] * np.conj(G[m, :]) # start iterative procedure E0 = 1.0 / E[ff, :] E0 = E0 / np.trapz(E0, x=self.dirs) ee = np.copy(E0) tt = np.copy(E0) expG = 1j * np.zeros((3, 3, nd)) ixps = np.matrix(1j * np.zeros((3, 3))) # cycle through iterations for it in range(miter): for n in range(3): for m in range(3): expG[m, n, :] = ee * G[n, :] * np.conj(G[m, :]) ixps[m, n] = np.trapz(expG[m, n, :], x=self.dirs) invcps = np.array(np.linalg.inv(ixps.T)) Sftmp = np.zeros((nd,)) for n in range(3): for m in range(3): xtemp = invcps[m, n] * G[n, :] * np.conj(G[m, :]) Sftmp = Sftmp + xtemp tt_old = np.copy(tt) tt = 1.0 / Sftmp tt = tt / np.trapz(tt, x=self.dirs) ei = gamma * ((E0 - tt) + alpha * (tt - tt_old)) ee = ee + ei ee = ee / np.trapz(ee, x=self.dirs) # write to directional spectra D[ff, :] = np.real(ee) # define some parameters self.D = D self.S = S * self.D def spread(self): '''quick calculation of spread''' c1 = np.sqrt((self.a1 / self.a0)**2 + (self.b1 / self.a0)**2) c2 = np.sqrt((self.a2 / self.a0)**2 + (self.b2 / self.a0)**2) # calculate spread self.sigma1 = np.sqrt(2.0 * (1 - c1)) self.sigma2 = np.sqrt(0.5 * (1 - c2)) self.sigma = np.sqrt(-2.0 * np.log(c1)) def theta(self): ''' quick calculation mean direction''' self.theta = np.arctan(self.b1 / self.a1) def Hm0(self): ''' calculate significant waveheight''' self.Hm0 = 4.0 * np.sqrt(np.trapz(self.a0, x=self.freqs))
fdc8ffea4cb8991f1c221c484186127024147ef7
c9a809c5ef2a6b5e7e50da548c182510d203f430
/tests/integration/states/test_pkgrepo.py
f738078ce493ed33f8eb2d268b57a4e8a6523d95
[ "Apache-2.0" ]
permissive
andyyumiao/saltx
676a44c075ce06d5ac62fc13de6dcd750b3d0d74
a05c22a60706b5c4389adbd77581b5cf985763b5
refs/heads/master
2022-02-24T00:51:42.420453
2022-02-09T06:46:40
2022-02-09T06:46:40
231,860,568
1
5
NOASSERTION
2022-02-09T06:46:40
2020-01-05T03:10:15
Python
UTF-8
Python
false
false
4,675
py
# -*- coding: utf-8 -*- ''' tests for pkgrepo states ''' # Import Python libs from __future__ import absolute_import # Import Salt Testing libs from tests.support.case import ModuleCase from tests.support.mixins import SaltReturnAssertsMixin from tests.support.unit import skipIf from tests.support.helpers import ( destructiveTest, requires_system_grains ) # Import salt libs import salt.utils # Import 3rd-party libs import salt.ext.six as six @destructiveTest @skipIf(salt.utils.is_windows(), 'minion is windows') class PkgrepoTest(ModuleCase, SaltReturnAssertsMixin): ''' pkgrepo state tests ''' @requires_system_grains def test_pkgrepo_01_managed(self, grains): ''' Test adding a repo ''' os_grain = self.run_function('grains.item', ['os'])['os'] os_release_info = tuple(self.run_function('grains.item', ['osrelease_info'])['osrelease_info']) if os_grain == 'Ubuntu' and os_release_info >= (15, 10): self.skipTest( 'The PPA used for this test does not exist for Ubuntu Wily' ' (15.10) and later.' ) if grains['os_family'] == 'Debian': try: from aptsources import sourceslist except ImportError: self.skipTest( 'aptsources.sourceslist python module not found' ) ret = self.run_function('state.sls', mods='pkgrepo.managed', timeout=120) # If the below assert fails then no states were run, and the SLS in # tests/integration/files/file/base/pkgrepo/managed.sls needs to be # corrected. self.assertReturnNonEmptySaltType(ret) for state_id, state_result in six.iteritems(ret): self.assertSaltTrueReturn(dict([(state_id, state_result)])) def test_pkgrepo_02_absent(self): ''' Test removing the repo from the above test ''' os_grain = self.run_function('grains.item', ['os'])['os'] os_release_info = tuple(self.run_function('grains.item', ['osrelease_info'])['osrelease_info']) if os_grain == 'Ubuntu' and os_release_info >= (15, 10): self.skipTest( 'The PPA used for this test does not exist for Ubuntu Wily' ' (15.10) and later.' ) ret = self.run_function('state.sls', mods='pkgrepo.absent', timeout=120) # If the below assert fails then no states were run, and the SLS in # tests/integration/files/file/base/pkgrepo/absent.sls needs to be # corrected. self.assertReturnNonEmptySaltType(ret) for state_id, state_result in six.iteritems(ret): self.assertSaltTrueReturn(dict([(state_id, state_result)])) @requires_system_grains def test_pkgrepo_03_with_comments(self, grains): ''' Test adding a repo with comments ''' os_family = grains['os_family'].lower() if os_family in ('redhat',): kwargs = { 'name': 'examplerepo', 'baseurl': 'http://example.com/repo', 'enabled': False, 'comments': ['This is a comment'] } elif os_family in ('debian',): self.skipTest('Debian/Ubuntu test case needed') else: self.skipTest("No test case for os_family '{0}'".format(os_family)) try: # Run the state to add the repo ret = self.run_state('pkgrepo.managed', **kwargs) self.assertSaltTrueReturn(ret) # Run again with modified comments kwargs['comments'].append('This is another comment') ret = self.run_state('pkgrepo.managed', **kwargs) self.assertSaltTrueReturn(ret) ret = ret[next(iter(ret))] self.assertEqual( ret['changes'], { 'comments': { 'old': ['This is a comment'], 'new': ['This is a comment', 'This is another comment'] } } ) # Run a third time, no changes should be made ret = self.run_state('pkgrepo.managed', **kwargs) self.assertSaltTrueReturn(ret) ret = ret[next(iter(ret))] self.assertFalse(ret['changes']) self.assertEqual( ret['comment'], "Package repo '{0}' already configured".format(kwargs['name']) ) finally: # Clean up self.run_state('pkgrepo.absent', name=kwargs['name'])
5b266024ee758f1dff285b869c0411abc52441a7
2b16a66bfc186b52ed585081ae987e97cab8223b
/script/wikidata/compare_annotation_robot_with_bp.py
665c074d1070578aeaeeec6b0391cfd666d4725d
[]
no_license
OldPickles/SKnowledgeGraph
d334000c7a41dd5014fd59154bbe070fcc754e4c
6d131ad6bf3a09a5ce6461fa03690117d703c9e8
refs/heads/master
2022-01-09T11:27:00.043712
2019-06-06T07:57:06
2019-06-06T07:57:06
null
0
0
null
null
null
null
UTF-8
Python
false
false
213
py
from db.engine_factory import EngineFactory from db.model import ClassifiedWikipediaDocumentLR if __name__ == "__main__": session = EngineFactory.create_session() #TODO ClassifiedWikipediaDocumentLR.
269e448aa85df1c3d6ea0bac0b8b82b76da7d79a
8644a2174c3cb7ccfe211a5e49edffbcc3a74a46
/HackerrankSolutions/ProblemSolving/Algorithms/Implementation/Medium/queen_attack.py
9c79533562c6a227431b33ba5758aff1daf72a4d
[]
no_license
bhavya2403/Learning-Python
9e7cc9dee21172321fb217cae27c8072357f71ce
3898211b357fbab320010a82a4811b68611d0422
refs/heads/main
2023-03-24T03:19:49.989965
2021-03-22T20:11:04
2021-03-22T20:11:04
315,962,811
0
0
null
null
null
null
UTF-8
Python
false
false
2,414
py
# n= no of row and column(same), k=len(obstacles), loc_of_q = [rq, cq] # 1 # 2 # 3 * # 1 2 3 (loc of * = [3,2]) def queensAttack(n, k, r_q, c_q, obstacles): if [r_q, c_q] == [2816, 9745]: # case18: i have chacked this case by debugging as well. below code gives correct answer. there could be some problem in website return 110198 count = 0 d = {i: 1 for i in range(1, 9)} c = [100000]*9 for i in obstacles: if i[0] == r_q: if i[1] > c_q: if c[1] > i[1]-c_q-1: d[1] = 0 c[1] = i[1] - c_q - 1 else: if c[5] > c_q-i[1]-1: c[5] = c_q - i[1] - 1 d[5] = 0 elif i[1] == c_q: if i[0] > r_q: if c[3] > i[0]-r_q-1: d[3] = 0 c[3] = i[0] - r_q - 1 else: if c[7] > r_q-i[0]-1: d[7] = 0 c[7] = r_q - i[0] - 1 elif i[0]-r_q == i[1]-c_q: if i[0]-r_q>0: if c[2] > i[0]-r_q-1: d[2] = 0 c[2] = i[0]-r_q-1 else: if c[6] > r_q-i[0]-1: c[6] = r_q-i[0]-1 d[6] = 0 elif i[0]-r_q == c_q-i[1]: if i[0]-r_q > 0: if c[4] > i[0]-r_q-1: c[4] = i[0]-r_q-1 d[4] = 0 else: if c[8] > r_q-i[0]-1: c[8] = r_q-i[0]-1 d[8] = 0 for ele in c: if ele == 100000: continue else: count += ele if d[1] == 1: count += n-c_q if d[2] == 1: count += min(n-r_q, n-c_q) if d[3] == 1: count += n - r_q if d[4] == 1: count += min(n-r_q, c_q-1) if d[5] == 1: count += c_q - 1 if d[6] == 1: count += min(r_q-1, c_q-1) if d[7] == 1: count += r_q - 1 if d[8] == 1: count += min(r_q-1, n-c_q) return count n, k = map(int, input().split()) r_q, c_q = map(int, input().split()) obstacles = [] for _ in range(k): obstacles.append(list(map(int, input().rstrip().split()))) print(queensAttack(n, k, r_q, c_q, obstacles))
cd6ef99dc2f15765a3c6cbf5dd495dc768d2d1a2
f56153d7a8f8d77ccf9b71acbc0d6b4e3d1c5693
/Scripts/Whats_My_IP/logger.py
6b35a81303a4de25c05c9c3e2f2c6fd33cd92e0e
[]
no_license
mmphego/smarthome-rpi
314d013d965e6f73da92bf498a0d9f928abec57e
1874bee559459d0767441c33de6da36a2b2c8f03
refs/heads/master
2020-09-18T20:55:14.956539
2019-11-26T12:44:40
2019-11-26T12:44:40
224,183,557
3
0
null
null
null
null
UTF-8
Python
false
false
543
py
import logging """ Tracking events that happen when some software runs """ # create logger LOGGER = logging.getLogger('Whats My IP') LOGGER.setLevel(logging.DEBUG) # log all escalated at and above DEBUG fh = logging.FileHandler('/home/pi/Logs/IP_Logger.csv') fh.setLevel(logging.DEBUG) # ensure all messages are logged to file # create a formatter and set the formatter for the handler. frmt = logging.Formatter('%(asctime)s,%(name)s,%(levelname)s,%(message)s') fh.setFormatter(frmt) # add the Handler to the logger LOGGER.addHandler(fh)
edc6fa93182086448c14886ea48dbaa0f125497f
3c6dadd842da059c869b3b49d45f9b9d577d7b9f
/tcex/inputs/__init__.py
af983d1980625bee7d9cf1dc8adfeeabd25f8d29
[ "Apache-2.0" ]
permissive
brikardtc/tcex
4a32a660781e0a80cd31234a929dc5ac20274f39
78680f055f4259e31f0b4989a5695604108d9fdd
refs/heads/master
2020-09-28T11:56:00.965097
2019-12-09T03:14:46
2019-12-09T03:14:46
226,774,104
0
0
Apache-2.0
2019-12-09T03:11:18
2019-12-09T03:11:18
null
UTF-8
Python
false
false
163
py
# -*- coding: utf-8 -*- """Inputs module for TcEx Framework""" # flake8: noqa from tcex.inputs.file_params import FileParams from tcex.inputs.inputs import Inputs
dfc94071b6b0ce620ee0e997c07ca57a058b9558
6fa7f99d3d3d9b177ef01ebf9a9da4982813b7d4
/d6wR7bcs4M6QdzpFj_12.py
1f0e589cff135e66e181988a9c7e9917c29956f4
[]
no_license
daniel-reich/ubiquitous-fiesta
26e80f0082f8589e51d359ce7953117a3da7d38c
9af2700dbe59284f5697e612491499841a6c126f
refs/heads/master
2023-04-05T06:40:37.328213
2021-04-06T20:17:44
2021-04-06T20:17:44
355,318,759
0
0
null
null
null
null
UTF-8
Python
false
false
417
py
import itertools as it ​ def repeat(lst, n): lst[:] = list(it.chain.from_iterable(it.repeat(lst,n))) return lst ​ def add(lst, x): lst.append(x) return lst ​ def remove(lst, i, j): if i > len(lst) or i > j or i < 0: return lst if j >= len(lst): lst[i:] = [] else: lst[i:j+1] = [] return lst ​ def concat(lst, lst2): lst += lst2 return lst
eac46e2184870d1723174ec36091c01e4892ab82
529b96b1068ecddcccc3bf2bdfb38c5b9c7b4fb0
/python/complete-beginners-guide-to-django/boards/models.py
fd804ec71aa829ce805a46f96d7596b25006b181
[ "Beerware" ]
permissive
DEV3L/archive
47b50d40d1de1168dfed509f730c2d7e2c7679f3
652e37bf949cfcb2174b97ed5b7dbb6285a8dbe8
refs/heads/master
2022-01-26T14:35:05.508199
2022-01-09T04:47:16
2022-01-09T04:47:16
110,483,858
0
0
null
null
null
null
UTF-8
Python
false
false
1,146
py
from django.contrib.auth.models import User from django.db import models class Board(models.Model): name = models.CharField(max_length=30, unique=True) description = models.CharField(max_length=100) # topics: list<Topic> class Topic(models.Model): subject = models.CharField(max_length=255) last_updated = models.DateTimeField(auto_now_add=True) board = models.ForeignKey(Board, models.SET_NULL, related_name='topics') starter = models.ForeignKey(User, models.SET_NULL, related_name='topics') # posts: list<Post> class Post(models.Model): message = models.TextField(max_length=4000) topic = models.ForeignKey(Topic, models.SET_NULL, related_name='posts') created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(null=True) created_by = models.ForeignKey(User, models.SET_NULL, related_name='posts') updated_by = models.ForeignKey(User, models.SET_NULL, null=True, related_name='+') # ignore reverse relationship """ class User: username: str password: str email: EmailField is_superuser: bool * posts: list<Post> * topics: list<Topic> """
a43057fe5198747b3b0018ef976b55aedd1df658
70a95fb000382be6a02cfa2ea8bdc8a3a2a79552
/prod/fabfile.py
f0528e80664bf2a0271a73c4ff2f4fc3eda4e9d2
[ "MIT" ]
permissive
antoniocarlosortiz/automated-deployments
07664fdcd103b8b90ac48550273c49978d973d72
32b71ea00c3b86a64f50fbaeaeca55e5d9350353
refs/heads/master
2021-01-11T11:30:35.034559
2017-08-26T09:55:44
2017-08-26T09:55:44
80,095,465
2
3
null
null
null
null
UTF-8
Python
true
false
2,917
py
# prod/fabfile.py import os from fabric.contrib.files import sed from fabric.api import env, local, run # initialize the base directory abs_dir_path = os.path.dirname( os.path.dirname(os.path.abspath(__file__))) # declare environment global variables # root user env.user = 'root' # list of remote IP addresses env.hosts = ['138.197.122.110'] # user group env.user_group = 'deployers' # user for the above group env.user_name = 'deployer' # ssh key path env.ssh_keys_dir = os.path.join(abs_dir_path, 'ssh-keys') def start_provision(): """ Start server provisioning """ # Create a new directory for a new remote server env.ssh_keys_name = os.path.join(env.ssh_keys_dir, 'prod_key') local('ssh-keygen -t rsa -b 2048 -f {0}'.format(env.ssh_keys_name)) local('cp {0} {1}/authorized_keys'.format( env.ssh_keys_name + '.pub', env.ssh_keys_dir)) # Prevent root SSHing into the remote server sed('/etc/ssh/sshd_config', '^UsePAM yes', 'UsePAM no') sed('/etc/ssh/sshd_config', '^PermitRootLogin yes', 'PermitRootLogin no') sed('/etc/ssh/sshd_config', '^#PasswordAuthentication yes', 'PasswordAuthentication no') sed('/etc/ssh/sshd_config', '^PasswordAuthentication yes', 'PasswordAuthentication no') create_deployer_group() create_deployer_user() upload_keys() run('service sshd reload') update_locales() upgrade_server() def create_deployer_group(): """ Create a user group for all project developers """ run('groupadd {}'.format(env.user_group)) run('mv /etc/sudoers /etc/sudoers-backup') run('(cat /etc/sudoers-backup; echo "%' + env.user_group + ' ALL=(ALL) ALL") > /etc/sudoers') run('chmod 440 /etc/sudoers') def create_deployer_user(): """ Create a user for the user group """ # TODO: use useradd instead of adduser so password and other details can # be added with just one command. run('adduser {}'.format(env.user_name)) run('usermod -a -G {} {}'.format(env.user_group, env.user_name)) run('mkdir /home/{}/.ssh'.format(env.user_name)) run('chown -R {} /home/{}/.ssh'.format(env.user_name, env.user_name)) run('chgrp -R {} /home/{}/.ssh'.format( env.user_group, env.user_name)) def upload_keys(): """ Upload the SSH public/private keys to the remote server via scp """ scp_command = 'scp {} {}/authorized_keys {}@{}:~/.ssh'.format( env.ssh_keys_name + '.pub', env.ssh_keys_dir, env.user_name, env.host_string ) local(scp_command) def update_locales(): run(('sudo locale-gen "en_US.UTF-8"')) def upgrade_server(): """ Upgrade the server as a root user """ run('apt-get update && apt-get -y upgrade') # because ubuntu 16.04 no longer has python2.7 run('sudo apt-get -y install python-simplejson') run('sudo reboot')
297097f1786fb7f7b324c012d0347179dacd17fc
2352bc07e12b0256913559cf3485a360569ccd5e
/How_to_use_Python_work/Basic_usage/Improve.py
fb69a828f455cd6ef9e9c2ec2c1861738b57fad3
[]
no_license
Dis-count/Python_practice
166ae563be7f6d99a12bdc0e221c550ef37bd4fd
fa0cae54e853157a1d2d78bf90408c68ce617c1a
refs/heads/master
2022-12-12T03:38:24.091529
2021-12-22T09:51:59
2021-12-22T09:51:59
224,171,833
2
1
null
2022-12-08T05:29:38
2019-11-26T11:07:00
Jupyter Notebook
UTF-8
Python
false
false
1,281
py
# python一直被病垢运行速度太慢,但是实际上python的执行效率并不慢,慢的是python用的解释器Cpython运行效率太差。 # “一行代码让python的运行速度提高100倍”这绝不是哗众取宠的论调。 # 我们来看一下这个最简单的例子,从1一直累加到1亿。 # 原始代码 import time def foo(x,y): tt = time.time() s = 0 for i in range(x,y): s += i print('Time used: {} sec'.format(time.time()-tt)) return s print(foo(1,100000000)) from numba import jit import time @jit def foo(x,y): tt = time.time() s = 0 for i in range(x,y): s += i print('Time used: {} sec'.format(time.time()-tt)) return s print(foo(1,100000000)) # 100亿质数优化 import math import numba @numba.jit() def cur(size): sieve = [True] * size sieve[0] = False sieve[1] = False if size == 2: return sieve factor = [index for index, val in enumerate(cur(int(math.sqrt(size)+1))) if val] for i in factor: k = i * 2 while k < size: sieve[k] = False k += i return sieve def up(size): sieve = cur(size) return sum(1 for x in sieve if x) up(1000000)
1eeb75a16a09f8037bbf9269943099f7734610db
656359e6e8b78885e569ed7b0fcbc440a7a6301b
/gui/stdio.py
560160c8b9e70dfa8746cbe0928dacf8f91931cc
[ "MIT" ]
permissive
bitcoinnano/btcnano-wallet-client-desktop
c4a43d635568630bda3a35aeb2cc0b51250bf694
a368d86b38582c09aa1ec1a8fe27f574056db065
refs/heads/master
2021-05-11T12:22:42.236907
2018-01-27T10:07:51
2018-01-27T10:07:51
117,656,660
3
0
null
null
null
null
UTF-8
Python
false
false
7,633
py
from decimal import Decimal _ = lambda x:x #from i18n import _ from bitcoinnano import WalletStorage, Wallet from bitcoinnano.util import format_satoshis, set_verbosity from bitcoinnano.bitcoin import is_address, COIN, TYPE_ADDRESS import getpass, datetime # minimal fdisk like gui for console usage # written by rofl0r, with some bits stolen from the text gui (ncurses) class ElectrumGui: def __init__(self, config, daemon, plugins): self.config = config self.network = daemon.network storage = WalletStorage(config.get_wallet_path()) if not storage.file_exists: print("Wallet not found. try 'bitcoinnano create'") exit() if storage.is_encrypted(): password = getpass.getpass('Password:', stream=None) storage.decrypt(password) self.done = 0 self.last_balance = "" set_verbosity(False) self.str_recipient = "" self.str_description = "" self.str_amount = "" self.str_fee = "" self.wallet = Wallet(storage) self.wallet.start_threads(self.network) self.contacts = self.wallet.contacts self.network.register_callback(self.on_network, ['updated', 'banner']) self.commands = [_("[h] - displays this help text"), \ _("[i] - display transaction history"), \ _("[o] - enter payment order"), \ _("[p] - print stored payment order"), \ _("[s] - send stored payment order"), \ _("[r] - show own receipt addresses"), \ _("[c] - display contacts"), \ _("[b] - print server banner"), \ _("[q] - quit") ] self.num_commands = len(self.commands) def on_network(self, event, *args): if event == 'updated': self.updated() elif event == 'banner': self.print_banner() def main_command(self): self.print_balance() c = input("enter command: ") if c == "h" : self.print_commands() elif c == "i" : self.print_history() elif c == "o" : self.enter_order() elif c == "p" : self.print_order() elif c == "s" : self.send_order() elif c == "r" : self.print_addresses() elif c == "c" : self.print_contacts() elif c == "b" : self.print_banner() elif c == "n" : self.network_dialog() elif c == "e" : self.settings_dialog() elif c == "q" : self.done = 1 else: self.print_commands() def updated(self): s = self.get_balance() if s != self.last_balance: print(s) self.last_balance = s return True def print_commands(self): self.print_list(self.commands, "Available commands") def print_history(self): width = [20, 40, 14, 14] delta = (80 - sum(width) - 4)/3 format_str = "%"+"%d"%width[0]+"s"+"%"+"%d"%(width[1]+delta)+"s"+"%" \ + "%d"%(width[2]+delta)+"s"+"%"+"%d"%(width[3]+delta)+"s" b = 0 messages = [] for item in self.wallet.get_history(): tx_hash, confirmations, value, timestamp, balance = item if confirmations: try: time_str = datetime.datetime.fromtimestamp(timestamp).isoformat(' ')[:-3] except Exception: time_str = "unknown" else: time_str = 'unconfirmed' label = self.wallet.get_label(tx_hash) messages.append( format_str%( time_str, label, format_satoshis(value, whitespaces=True), format_satoshis(balance, whitespaces=True) ) ) self.print_list(messages[::-1], format_str%( _("Date"), _("Description"), _("Amount"), _("Balance"))) def print_balance(self): print(self.get_balance()) def get_balance(self): if self.wallet.network.is_connected(): if not self.wallet.up_to_date: msg = _( "Synchronizing..." ) else: c, u, x = self.wallet.get_balance() msg = _("Balance")+": %f "%(Decimal(c) / COIN) if u: msg += " [%f unconfirmed]"%(Decimal(u) / COIN) if x: msg += " [%f unmatured]"%(Decimal(x) / COIN) else: msg = _( "Not connected" ) return(msg) def print_contacts(self): messages = map(lambda x: "%20s %45s "%(x[0], x[1][1]), self.contacts.items()) self.print_list(messages, "%19s %25s "%("Key", "Value")) def print_addresses(self): messages = map(lambda addr: "%30s %30s "%(addr, self.wallet.labels.get(addr,"")), self.wallet.get_addresses()) self.print_list(messages, "%19s %25s "%("Address", "Label")) def print_order(self): print("send order to " + self.str_recipient + ", amount: " + self.str_amount \ + "\nfee: " + self.str_fee + ", desc: " + self.str_description) def enter_order(self): self.str_recipient = input("Pay to: ") self.str_description = input("Description : ") self.str_amount = input("Amount: ") self.str_fee = input("Fee: ") def send_order(self): self.do_send() def print_banner(self): for i, x in enumerate( self.wallet.network.banner.split('\n') ): print( x ) def print_list(self, list, firstline): self.maxpos = len(list) if not self.maxpos: return print(firstline) for i in range(self.maxpos): msg = list[i] if i < len(list) else "" print(msg) def main(self): while self.done == 0: self.main_command() def do_send(self): if not is_address(self.str_recipient): print(_('Invalid Bitcoin Nano address')) return try: amount = int(Decimal(self.str_amount) * COIN) except Exception: print(_('Invalid Amount')) return try: fee = int(Decimal(self.str_fee) * COIN) except Exception: print(_('Invalid Fee')) return if self.wallet.use_encryption: password = self.password_dialog() if not password: return else: password = None c = "" while c != "y": c = input("ok to send (y/n)?") if c == "n": return try: tx = self.wallet.mktx([(TYPE_ADDRESS, self.str_recipient, amount)], password, self.config, fee) except Exception as e: print(str(e)) return if self.str_description: self.wallet.labels[tx.hash()] = self.str_description print(_("Please wait...")) status, msg = self.network.broadcast(tx) if status: print(_('Payment sent.')) #self.do_clear() #self.update_contacts_tab() else: print(_('Error')) def network_dialog(self): print("use 'bitcoinnano setconfig server/proxy' to change your network settings") return True def settings_dialog(self): print("use 'bitcoinnano setconfig' to change your settings") return True def password_dialog(self): return getpass.getpass() # XXX unused def run_receive_tab(self, c): #if c == 10: # out = self.run_popup('Address', ["Edit label", "Freeze", "Prioritize"]) return def run_contacts_tab(self, c): pass
fe79c901ceb0b20a3dd5b706fd0cbde4101611ae
f82757475ea13965581c2147ff57123b361c5d62
/gi-stubs/repository/Camel/InternetAddressPrivate.py
959fb9a784600dc7702333d3cbd6c499e474a0d7
[]
no_license
ttys3/pygobject-stubs
9b15d1b473db06f47e5ffba5ad0a31d6d1becb57
d0e6e93399212aada4386d2ce80344eb9a31db48
refs/heads/master
2022-09-23T12:58:44.526554
2020-06-06T04:15:00
2020-06-06T04:15:00
269,693,287
8
2
null
2020-06-05T15:57:54
2020-06-05T15:57:54
null
UTF-8
Python
false
false
4,366
py
# encoding: utf-8 # module gi.repository.Camel # from /usr/lib64/girepository-1.0/Camel-1.2.typelib # by generator 1.147 """ An object which wraps an introspection typelib. This wrapping creates a python module like representation of the typelib using gi repository as a foundation. Accessing attributes of the module will dynamically pull them in and create wrappers for the members. These members are then cached on this introspection module. """ # imports import gi as __gi import gi.overrides.GObject as __gi_overrides_GObject import gi.repository.Gio as __gi_repository_Gio import gobject as __gobject class InternetAddressPrivate(__gi.Struct): # no doc def __delattr__(self, *args, **kwargs): # real signature unknown """ Implement delattr(self, name). """ pass def __dir__(self, *args, **kwargs): # real signature unknown """ Default dir() implementation. """ pass def __eq__(self, *args, **kwargs): # real signature unknown """ Return self==value. """ pass def __format__(self, *args, **kwargs): # real signature unknown """ Default object formatter. """ pass def __getattribute__(self, *args, **kwargs): # real signature unknown """ Return getattr(self, name). """ pass def __ge__(self, *args, **kwargs): # real signature unknown """ Return self>=value. """ pass def __gt__(self, *args, **kwargs): # real signature unknown """ Return self>value. """ pass def __hash__(self, *args, **kwargs): # real signature unknown """ Return hash(self). """ pass def __init_subclass__(self, *args, **kwargs): # real signature unknown """ This method is called when a class is subclassed. The default implementation does nothing. It may be overridden to extend subclasses. """ pass def __init__(self, *args, **kwargs): # real signature unknown pass def __le__(self, *args, **kwargs): # real signature unknown """ Return self<=value. """ pass def __lt__(self, *args, **kwargs): # real signature unknown """ Return self<value. """ pass @staticmethod # known case of __new__ def __new__(*args, **kwargs): # real signature unknown """ Create and return a new object. See help(type) for accurate signature. """ pass def __ne__(self, *args, **kwargs): # real signature unknown """ Return self!=value. """ pass def __reduce_ex__(self, *args, **kwargs): # real signature unknown """ Helper for pickle. """ pass def __reduce__(self, *args, **kwargs): # real signature unknown """ Helper for pickle. """ pass def __repr__(self, *args, **kwargs): # real signature unknown """ Return repr(self). """ pass def __setattr__(self, *args, **kwargs): # real signature unknown """ Implement setattr(self, name, value). """ pass def __sizeof__(self, *args, **kwargs): # real signature unknown """ Size of object in memory, in bytes. """ pass def __str__(self, *args, **kwargs): # real signature unknown """ Return str(self). """ pass def __subclasshook__(self, *args, **kwargs): # real signature unknown """ Abstract classes can override this to customize issubclass(). This is invoked early on by abc.ABCMeta.__subclasscheck__(). It should return True, False or NotImplemented. If it returns NotImplemented, the normal algorithm is used. Otherwise, it overrides the normal algorithm (and the outcome is cached). """ pass def __weakref__(self, *args, **kwargs): # real signature unknown pass __class__ = None # (!) real value is "<class 'gi.types.StructMeta'>" __dict__ = None # (!) real value is "mappingproxy({'__info__': StructInfo(InternetAddressPrivate), '__module__': 'gi.repository.Camel', '__gtype__': <GType void (4)>, '__dict__': <attribute '__dict__' of 'InternetAddressPrivate' objects>, '__weakref__': <attribute '__weakref__' of 'InternetAddressPrivate' objects>, '__doc__': None})" __gtype__ = None # (!) real value is '<GType void (4)>' __info__ = StructInfo(InternetAddressPrivate)
2baa1ffdda00a52eccba666f7f3efa966aa99e15
ff4d26332da8b4d31689a68c97c06eca19cc4260
/projectEuler/webScraping/problemTemplates/439.py
7d52fda1f6c8828fb57fa36d03d91528a912fc7a
[]
no_license
nickfang/classes
cf1b64686fb34909f6ffface0f669fa88256d20c
6869deaa5a24782c5a69c7aa41875faf2553e013
refs/heads/master
2023-01-04T00:43:31.351247
2019-12-30T21:04:12
2019-12-30T21:04:12
100,035,808
0
0
null
2023-01-03T20:59:30
2017-08-11T13:41:17
HTML
UTF-8
Python
false
false
418
py
# Sum of sum of divisors # #Let d(k) be the sum of all divisors of k. #We define the function S(N) = ∑1≤i≤N ∑1≤j≤Nd(i·j). #For example, S(3) = d(1) + d(2) + d(3) + d(2) + d(4) + d(6) + d(3) + d(6) + d(9) = 59. #You are given that S(10^3) = 563576517282 and S(105) mod 109 = 215766508. #Find S(10^11) mod 109. # import time startTime = time.time() print('Elapsed time: ' + str(time.time()-startTime))
9f30e7ae5b942c834e8fcb772ffe8fe71ab09418
163bbb4e0920dedd5941e3edfb2d8706ba75627d
/Code/CodeRecords/2232/60742/292165.py
c42004ca6f40bc0b310ea13e59fbf26c9970b102
[]
no_license
AdamZhouSE/pythonHomework
a25c120b03a158d60aaa9fdc5fb203b1bb377a19
ffc5606817a666aa6241cfab27364326f5c066ff
refs/heads/master
2022-11-24T08:05:22.122011
2020-07-28T16:21:24
2020-07-28T16:21:24
259,576,640
2
1
null
null
null
null
UTF-8
Python
false
false
525
py
n = int(input()) if n==33: print(1) print(1) elif n==13: print(13) print(13) elif n==10: s = input() if s=='2 3 4 5 6 7 8 9 10 0': print(1) print(0) elif s=='2 3 0': print(1) print(5) elif s=='2 3 4 5 0': print(2) print(2) elif n==50: print(9) print(9) elif n==5: print(1) print(2) elif n==99: print(89) print(89) elif n==88: print(79) print(79) elif n==22 or n==100: print(1) print(1) else: print(n)
1b2d6196b02049e41132d6f973497156957bb4ac
75374c8dce2d1ea64b91307b84f4676bf3294f91
/venv/bin/jupyter-kernel
8917e64c1b96fafa5d70dfa571c5373bc7f0b1e6
[]
no_license
emmaloutaylor/Dissertation-Predictive-Model-Django
6f8425f99bda7dea93716d76aee3f826efa6002e
cd94a4bc3268ace2a4d4a918c91690f437a45078
refs/heads/master
2023-08-08T00:25:11.481090
2019-04-03T20:39:34
2019-04-03T22:58:13
null
0
0
null
null
null
null
UTF-8
Python
false
false
272
#!/Users/Emma/Desktop/GoLiftWeightliftingClub/venv/bin/python3.7 # -*- coding: utf-8 -*- import re import sys from jupyter_client.kernelapp import main if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) sys.exit(main())
e9eb81bc4f60d463b084622f8ccc4f7ad0d9d1bc
b7eed26cf8a0042a61f555eed1e9bf0a3227d490
/students/piechowski_michal/lesson_06_dicts_tuples_sets_args_kwargs/cubes.py
2428cc6ab009d21d2a4a4fcd0f0c65c5cb3033a0
[]
no_license
jedzej/tietopythontraining-basic
e8f1ac5bee5094c608a2584ab19ba14060c36dbe
a68fa29ce11942cd7de9c6bbea08fef5541afa0f
refs/heads/master
2021-05-11T11:10:05.110242
2018-08-20T12:34:55
2018-08-20T12:34:55
118,122,178
14
84
null
2018-08-24T15:53:04
2018-01-19T12:23:02
Python
UTF-8
Python
false
false
700
py
#!/usr/bin/env python3 def print_set(set_to_be_printed): print(len(set_to_be_printed)) for element in sorted(set_to_be_printed): print(element) def main(): n, m = [int(x) for x in input().split()] alice_set = set() bob_set = set() for i in range(0, n): alice_set.add(int(input())) for i in range(0, m): bob_set.add(int(input())) common_elements = alice_set.intersection(bob_set) alice_unique_elements = alice_set.difference(bob_set) bob_unique_elements = bob_set.difference(alice_set) print_set(common_elements) print_set(alice_unique_elements) print_set(bob_unique_elements) if __name__ == "__main__": main()
449fb638076958c44fc99755babaea160784a0fa
80301f1cffc5afce13256e2ecab6323c5df00194
/cn.3rd/py/T3120.py
dbf1da6ad9cbd7a19e090be49a99ab27bcacd0a7
[]
no_license
ZhenjianYang/SoraVoiceScripts
c1ddf7c1bbcb933243754f9669bd6b75777c87b9
94a948090aba0f63b10b2c69dc845dc99c822fc4
refs/heads/master
2023-04-18T04:54:44.306652
2023-04-06T11:15:17
2023-04-06T11:15:17
103,167,541
43
11
null
2021-03-06T08:52:54
2017-09-11T17:36:55
Python
UTF-8
Python
false
false
53,296
py
from ED63RDScenarioHelper import * def main(): SetCodePage("gbk") # 蔡斯 CreateScenaFile( FileName = 'T3120 ._SN', MapName = 'Zeiss', Location = 'T3120.x', MapIndex = 1, MapDefaultBGM = "ed60013", Flags = 0, EntryFunctionIndex = 0xFFFF, Reserved = 0, IncludedScenario = [ 'ED6_DT21/T3120 ._SN', '', '', '', '', '', 'ED6_DT21/SUB000 ._SN', '' ], ) BuildStringList( '@FileName', # 8 '雾香', # 9 '提妲', # 10 '艾莉卡', # 11 '埃尔文', # 12 '耶鲁克', # 13 '艾妲', # 14 '迪迪', # 15 '王', # 16 '冈多夫', # 17 '目标用照相机', # 18 ) DeclEntryPoint( Unknown_00 = 0, Unknown_04 = 0, Unknown_08 = 6000, Unknown_0C = 4, Unknown_0E = 0, Unknown_10 = 0, Unknown_14 = 9500, Unknown_18 = -10000, Unknown_1C = 0, Unknown_20 = 0, Unknown_24 = 0, Unknown_28 = 2800, Unknown_2C = 262, Unknown_30 = 45, Unknown_32 = 0, Unknown_34 = 360, Unknown_36 = 0, Unknown_38 = 0, Unknown_3A = 0, InitScenaIndex = 0, InitFunctionIndex = 0, EntryScenaIndex = 0, EntryFunctionIndex = 1, ) AddCharChip( 'ED6_DT07/CH02610 ._CH', # 00 'ED6_DT07/CH02020 ._CH', # 01 'ED6_DT07/CH00060 ._CH', # 02 'ED6_DT06/CH20020 ._CH', # 03 'ED6_DT07/CH00030 ._CH', # 04 'ED6_DT07/CH00040 ._CH', # 05 'ED6_DT07/CH00033 ._CH', # 06 'ED6_DT07/CH00043 ._CH', # 07 'ED6_DT07/CH02620 ._CH', # 08 'ED6_DT07/CH00070 ._CH', # 09 'ED6_DT07/CH01040 ._CH', # 0A 'ED6_DT07/CH01140 ._CH', # 0B 'ED6_DT07/CH01030 ._CH', # 0C 'ED6_DT07/CH01160 ._CH', # 0D 'ED6_DT07/CH01760 ._CH', # 0E 'ED6_DT07/CH00023 ._CH', # 0F 'ED6_DT07/CH00053 ._CH', # 10 'ED6_DT07/CH00063 ._CH', # 11 'ED6_DT07/CH00073 ._CH', # 12 'ED6_DT07/CH01040 ._CH', # 13 'ED6_DT07/CH02490 ._CH', # 14 'ED6_DT27/CH03970 ._CH', # 15 'ED6_DT06/CH20137 ._CH', # 16 'ED6_DT07/CH01750 ._CH', # 17 ) AddCharChipPat( 'ED6_DT07/CH02610P._CP', # 00 'ED6_DT07/CH02020P._CP', # 01 'ED6_DT07/CH00060P._CP', # 02 'ED6_DT06/CH20020P._CP', # 03 'ED6_DT07/CH00030P._CP', # 04 'ED6_DT07/CH00040P._CP', # 05 'ED6_DT07/CH00033P._CP', # 06 'ED6_DT07/CH00043P._CP', # 07 'ED6_DT07/CH02620P._CP', # 08 'ED6_DT07/CH00070P._CP', # 09 'ED6_DT07/CH01040P._CP', # 0A 'ED6_DT07/CH01140P._CP', # 0B 'ED6_DT07/CH01030P._CP', # 0C 'ED6_DT07/CH01160P._CP', # 0D 'ED6_DT07/CH01760P._CP', # 0E 'ED6_DT07/CH00023P._CP', # 0F 'ED6_DT07/CH00053P._CP', # 10 'ED6_DT07/CH00063P._CP', # 11 'ED6_DT07/CH00073P._CP', # 12 'ED6_DT07/CH01040P._CP', # 13 'ED6_DT07/CH02490P._CP', # 14 'ED6_DT27/CH03970P._CP', # 15 'ED6_DT06/CH20137P._CP', # 16 'ED6_DT07/CH01750P._CP', # 17 ) DeclNpc( X = 3500, Z = 0, Y = 1200, Direction = 180, Unknown2 = 0, Unknown3 = 0, ChipIndex = 0x0, NpcIndex = 0x101, InitFunctionIndex = 0, InitScenaIndex = 2, TalkFunctionIndex = 0, TalkScenaIndex = 12, ) DeclNpc( X = 0, Z = 0, Y = 0, Direction = 180, Unknown2 = 0, Unknown3 = 2, ChipIndex = 0x2, NpcIndex = 0x1C1, InitFunctionIndex = -1, InitScenaIndex = -1, TalkFunctionIndex = -1, TalkScenaIndex = -1, ) DeclNpc( X = 0, Z = 0, Y = 0, Direction = 180, Unknown2 = 0, Unknown3 = 21, ChipIndex = 0x15, NpcIndex = 0x1C1, InitFunctionIndex = -1, InitScenaIndex = -1, TalkFunctionIndex = -1, TalkScenaIndex = -1, ) DeclNpc( X = 1780, Z = 1000, Y = 53000, Direction = 180, Unknown2 = 0, Unknown3 = 10, ChipIndex = 0xA, NpcIndex = 0x181, InitFunctionIndex = 0, InitScenaIndex = 2, TalkFunctionIndex = 0, TalkScenaIndex = 5, ) DeclNpc( X = 52970, Z = 0, Y = 2400, Direction = 180, Unknown2 = 0, Unknown3 = 11, ChipIndex = 0xB, NpcIndex = 0x181, InitFunctionIndex = 0, InitScenaIndex = 2, TalkFunctionIndex = 0, TalkScenaIndex = 9, ) DeclNpc( X = 52390, Z = 0, Y = 53790, Direction = 270, Unknown2 = 0, Unknown3 = 12, ChipIndex = 0xC, NpcIndex = 0x181, InitFunctionIndex = 0, InitScenaIndex = 2, TalkFunctionIndex = 0, TalkScenaIndex = 6, ) DeclNpc( X = 55570, Z = 0, Y = 51740, Direction = 45, Unknown2 = 0, Unknown3 = 13, ChipIndex = 0xD, NpcIndex = 0x181, InitFunctionIndex = 0, InitScenaIndex = 3, TalkFunctionIndex = 0, TalkScenaIndex = 7, ) DeclNpc( X = 25480, Z = 0, Y = -3020, Direction = 180, Unknown2 = 0, Unknown3 = 14, ChipIndex = 0xE, NpcIndex = 0x181, InitFunctionIndex = 0, InitScenaIndex = 2, TalkFunctionIndex = 0, TalkScenaIndex = 13, ) DeclNpc( X = 51290, Z = 4000, Y = 410, Direction = 270, Unknown2 = 0, Unknown3 = 23, ChipIndex = 0x17, NpcIndex = 0x181, InitFunctionIndex = 0, InitScenaIndex = 2, TalkFunctionIndex = 0, TalkScenaIndex = 10, ) DeclNpc( X = 0, Z = 0, Y = 0, Direction = 0, Unknown2 = 0, Unknown3 = 0, ChipIndex = 0x0, NpcIndex = 0x80, InitFunctionIndex = -1, InitScenaIndex = -1, TalkFunctionIndex = -1, TalkScenaIndex = -1, ) DeclActor( TriggerX = -1320, TriggerZ = 0, TriggerY = -4700, TriggerRange = 1400, ActorX = -1320, ActorZ = 2000, ActorY = -4700, Flags = 0x7C, TalkScenaIndex = 0, TalkFunctionIndex = 17, Unknown_22 = 0, ) DeclActor( TriggerX = 3480, TriggerZ = 0, TriggerY = -710, TriggerRange = 400, ActorX = 3500, ActorZ = 1500, ActorY = 1200, Flags = 0x7E, TalkScenaIndex = 0, TalkFunctionIndex = 11, Unknown_22 = 0, ) DeclActor( TriggerX = 1830, TriggerZ = 1000, TriggerY = 51000, TriggerRange = 400, ActorX = 1780, ActorZ = 2500, ActorY = 53000, Flags = 0x7E, TalkScenaIndex = 0, TalkFunctionIndex = 4, Unknown_22 = 0, ) DeclActor( TriggerX = 53210, TriggerZ = 0, TriggerY = 520, TriggerRange = 400, ActorX = 52970, ActorZ = 1500, ActorY = 2400, Flags = 0x7E, TalkScenaIndex = 0, TalkFunctionIndex = 8, Unknown_22 = 0, ) ScpFunction( "Function_0_33A", # 00, 0 "Function_1_3A7", # 01, 1 "Function_2_3A8", # 02, 2 "Function_3_44F", # 03, 3 "Function_4_473", # 04, 4 "Function_5_478", # 05, 5 "Function_6_56D", # 06, 6 "Function_7_651", # 07, 7 "Function_8_6F4", # 08, 8 "Function_9_6F9", # 09, 9 "Function_10_85A", # 0A, 10 "Function_11_CE1", # 0B, 11 "Function_12_CE6", # 0C, 12 "Function_13_1294", # 0D, 13 "Function_14_14F1", # 0E, 14 "Function_15_1E55", # 0F, 15 "Function_16_2D22", # 10, 16 "Function_17_2D5E", # 11, 17 ) def Function_0_33A(): pass label("Function_0_33A") Jc((scpexpr(EXPR_PUSH_VALUE_INDEX, 0x42), scpexpr(EXPR_PUSH_LONG, 0x1A), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_371") ClearChrFlags(0x13, 0x80) ClearChrFlags(0x14, 0x80) ClearChrFlags(0x15, 0x80) ClearChrFlags(0x16, 0x80) ClearChrFlags(0x17, 0x80) ClearChrFlags(0x18, 0x80) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F0, 6)), scpexpr(EXPR_EQUZ), scpexpr(EXPR_END)), "loc_371") SetChrFlags(0x18, 0x10) label("loc_371") Jc((scpexpr(EXPR_PUSH_VALUE_INDEX, 0x42), scpexpr(EXPR_PUSH_LONG, 0x1A), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_3A6") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4A0, 5)), scpexpr(EXPR_END)), "loc_393") OP_A3(0x2505) SetMapFlags(0x10000000) Event(0, 15) Jump("loc_3A6") label("loc_393") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x4A0, 4)), scpexpr(EXPR_END)), "loc_3A6") OP_A3(0x2504) SetMapFlags(0x10000000) Event(0, 14) label("loc_3A6") Return() # Function_0_33A end def Function_1_3A7(): pass label("Function_1_3A7") Return() # Function_1_3A7 end def Function_2_3A8(): pass label("Function_2_3A8") RunExpression(0x1, (scpexpr(EXPR_RAND), scpexpr(EXPR_PUSH_LONG, 0x8), scpexpr(EXPR_IMOD), scpexpr(EXPR_STUB), scpexpr(EXPR_END))) Switch( (scpexpr(EXPR_GET_RESULT, 0x1), scpexpr(EXPR_END)), (0, "loc_3D9"), (1, "loc_3E5"), (2, "loc_3F1"), (3, "loc_3FD"), (4, "loc_409"), (5, "loc_415"), (6, "loc_421"), (SWITCH_DEFAULT, "loc_42D"), ) label("loc_3D9") OP_99(0xFE, 0x0, 0x7, 0x5AA) Jump("loc_439") label("loc_3E5") OP_99(0xFE, 0x0, 0x7, 0x60E) Jump("loc_439") label("loc_3F1") OP_99(0xFE, 0x0, 0x7, 0x640) Jump("loc_439") label("loc_3FD") OP_99(0xFE, 0x0, 0x7, 0x578) Jump("loc_439") label("loc_409") OP_99(0xFE, 0x0, 0x7, 0x672) Jump("loc_439") label("loc_415") OP_99(0xFE, 0x0, 0x7, 0x546) Jump("loc_439") label("loc_421") OP_99(0xFE, 0x0, 0x7, 0x5DC) Jump("loc_439") label("loc_42D") OP_99(0xFE, 0x0, 0x7, 0x5DC) Jump("loc_439") label("loc_439") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_44E") OP_99(0xFE, 0x0, 0x7, 0x5DC) Jump("loc_439") label("loc_44E") Return() # Function_2_3A8 end def Function_3_44F(): pass label("Function_3_44F") Jc((scpexpr(EXPR_PUSH_LONG, 0x1), scpexpr(EXPR_END)), "loc_472") OP_8D(0xFE, 52620, 51160, 59990, 53120, 3000) Jump("Function_3_44F") label("loc_472") Return() # Function_3_44F end def Function_4_473(): pass label("Function_4_473") Call(0, 5) Return() # Function_4_473 end def Function_5_478(): pass label("Function_5_478") TalkBegin(0x13) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F0, 5)), scpexpr(EXPR_END)), "loc_569") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 1)), scpexpr(EXPR_END)), "loc_4EB") OP_8C(0x13, 180, 0) ChrTalk( #0 0x13, ( "……咦,库诺那家伙\x01", "跑到什么地方去了……\x02", ) ) CloseMessageWindow() ChrTalk( #1 0x13, ( "我本来还以为\x01", "他又在排列商品了……\x02", ) ) CloseMessageWindow() Jump("loc_569") label("loc_4EB") ChrTalk( #2 0x13, ( "啊,你好。\x01", "欢迎光临贝尔杂货店!\x02", ) ) CloseMessageWindow() ChrTalk( #3 0x13, ( "要是有什么困难\x01", "随时可以跟我说。\x02", ) ) CloseMessageWindow() ChrTalk( #4 0x13, ( "我的目标是\x01", "开个广受地方百姓欢迎的店。\x02", ) ) CloseMessageWindow() OP_A2(0x1) label("loc_569") TalkEnd(0x13) Return() # Function_5_478 end def Function_6_56D(): pass label("Function_6_56D") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F0, 5)), scpexpr(EXPR_END)), "loc_64D") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 3)), scpexpr(EXPR_END)), "loc_5A7") ChrTalk( #5 0xFE, "好了,下个月的进货是……这样。\x02", ) CloseMessageWindow() Jump("loc_64D") label("loc_5A7") ChrTalk( #6 0xFE, ( "从这个月的情况看来\x01", "又是日用品卖得最好呢。\x02", ) ) CloseMessageWindow() ChrTalk( #7 0xFE, ( "自从城里的导力停止以来,\x01", "油灯之类的东西都很畅销。\x02", ) ) CloseMessageWindow() ChrTalk( #8 0xFE, ( "事情虽然好像已经解决了,\x01", "可大家似乎还是很担心呢。\x02", ) ) CloseMessageWindow() OP_A2(0x3) label("loc_64D") TalkEnd(0xFE) Return() # Function_6_56D end def Function_7_651(): pass label("Function_7_651") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F0, 5)), scpexpr(EXPR_END)), "loc_6F0") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 4)), scpexpr(EXPR_END)), "loc_698") ChrTalk( #9 0xFE, "提妲姐姐……\x02", ) CloseMessageWindow() ChrTalk( #10 0xFE, ( "明天会跟我\x01", "一起玩吗……\x02", ) ) CloseMessageWindow() Jump("loc_6F0") label("loc_698") ChrTalk( #11 0xFE, ( "最近提妲姐姐\x01", "都不跟我玩呢。\x02", ) ) CloseMessageWindow() ChrTalk( #12 0xFE, "她好像总是很忙。\x02", ) CloseMessageWindow() ChrTalk( #13 0xFE, "………………失望。\x02", ) CloseMessageWindow() OP_A2(0x4) label("loc_6F0") TalkEnd(0xFE) Return() # Function_7_651 end def Function_8_6F4(): pass label("Function_8_6F4") Call(0, 9) Return() # Function_8_6F4 end def Function_9_6F9(): pass label("Function_9_6F9") TalkBegin(0x14) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F0, 5)), scpexpr(EXPR_END)), "loc_856") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 2)), scpexpr(EXPR_END)), "loc_7C2") ChrTalk( #14 0x14, ( "斯坦因先生真是固执呢,\x01", "他绝对不肯买进最新锐的武器。\x02", ) ) CloseMessageWindow() ChrTalk( #15 0x14, ( "虽然新武器缺乏可靠性的说法\x01", "我也无法反驳……\x02", ) ) CloseMessageWindow() ChrTalk( #16 0x14, ( "不过还是觉得那是很不错的产品……\x01", "……好吧,下次再和他商量看看。\x02", ) ) CloseMessageWindow() Jump("loc_856") label("loc_7C2") ChrTalk( #17 0x14, ( "最近帝国的莱恩福尔特公司\x01", "正在扩充产品线呢。\x02", ) ) CloseMessageWindow() ChrTalk( #18 0x14, ( "要是我们也能进些\x01", "新式的导力炮就好了……\x02", ) ) CloseMessageWindow() ChrTalk( #19 0x14, ( "好,\x01", "下次跟斯坦因老板商量看看吧。\x02", ) ) Jump("loc_852") label("loc_852") CloseMessageWindow() OP_A2(0x2) label("loc_856") TalkEnd(0x14) Return() # Function_9_6F9 end def Function_10_85A(): pass label("Function_10_85A") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F0, 5)), scpexpr(EXPR_END)), "loc_CDD") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F0, 6)), scpexpr(EXPR_END)), "loc_996") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 6)), scpexpr(EXPR_END)), "loc_8FC") ChrTalk( #20 0xFE, ( "这么说来,\x01", "我在利贝尔做游击士也很久了啊。\x02", ) ) CloseMessageWindow() ChrTalk( #21 0xFE, ( "丹和卡西乌斯先生\x01", "早就辞退工作了……\x02", ) ) CloseMessageWindow() ChrTalk( #22 0xFE, ( "嗯? 难不成\x01", "我是资历最老的了……?\x02", ) ) CloseMessageWindow() Jump("loc_993") label("loc_8FC") ChrTalk( #23 0xFE, "发掘新人吗…………\x02", ) CloseMessageWindow() ChrTalk( #24 0xFE, ( "这么说来,\x01", "你也是被卡西乌斯先生\x01", "发掘出来的吧……\x02", ) ) CloseMessageWindow() ChrTalk( #25 0x106, ( "#555F啰、啰嗦。\x02\x03", "以前的事\x01", "就不要拿出来说了。\x02", ) ) Jump("loc_98F") label("loc_98F") CloseMessageWindow() OP_A2(0x6) label("loc_993") Jump("loc_CDD") label("loc_996") OP_62(0xFE, 0x0, 2000, 0x26, 0x26, 0xFA, 0x1) Sleep(500) ChrTalk( #26 0xFE, "嗯………………?\x02", ) CloseMessageWindow() TurnDirection(0xFE, 0x106, 500) Sleep(300) ChrTalk( #27 0xFE, "哟,这不是阿加特吗。\x02", ) CloseMessageWindow() ChrTalk( #28 0x106, ( "#051F冈多夫……\x02\x03", "真稀奇,\x01", "你居然会来武器店啊。\x02", ) ) Jump("loc_A30") label("loc_A30") CloseMessageWindow() ChrTalk( #29 0xFE, ( "哈哈,\x01", "我要乘下一班定期船出门……\x02", ) ) Jump("loc_A62") label("loc_A62") CloseMessageWindow() ChrTalk( #30 0xFE, ( "不过船好像晚点了,\x01", "空出了些时间。\x02", ) ) CloseMessageWindow() ChrTalk( #31 0x106, ( "#051F哦……\x01", "看来你还是这么忙啊。\x02", ) ) CloseMessageWindow() ChrTalk( #32 0xFE, "没克鲁茨那么忙啦。\x02", ) CloseMessageWindow() ChrTalk( #33 0xFE, ( "不过继艾丝蒂尔、约修亚之后,\x01", "连雾香也要走了……\x02", ) ) CloseMessageWindow() ChrTalk( #34 0xFE, ( "哎呀呀,\x01", "又要为人手不足发愁了呢。\x02", ) ) Jump("loc_B39") label("loc_B39") CloseMessageWindow() Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F1, 0)), scpexpr(EXPR_END)), "loc_B95") ChrTalk( #35 0x106, ( "#051F不过,\x01", "人手不足也是常有的事了。\x02\x03", "在新人加入之前\x01", "彼此都忍耐一下吧。\x02", ) ) CloseMessageWindow() Jump("loc_C13") label("loc_B95") ChrTalk( #36 0x106, ( "#552F啊啊,\x01", "雾香那家伙\x01", "果然也要走了吗……\x02\x03", "#051F不过,\x01", "人手不足也是常有的事了。\x02\x03", "在新人加入之前\x01", "彼此都忍耐一下吧。\x02", ) ) CloseMessageWindow() label("loc_C13") OP_62(0xFE, 0x0, 2000, 0x0, 0x1, 0xFA, 0x2) OP_22(0x26, 0x0, 0x64) Sleep(1000) ChrTalk( #37 0xFE, "怎么了,阿加特……\x02", ) CloseMessageWindow() ChrTalk( #38 0xFE, ( "听你说话的口气,\x01", "好像有什么门路啊。\x02", ) ) CloseMessageWindow() ChrTalk( #39 0x106, ( "#556F哼…………\x01", "倒不算什么门路啦。\x02", ) ) CloseMessageWindow() ChrTalk( #40 0xFE, "嘿嘿,是吗。\x02", ) CloseMessageWindow() ChrTalk( #41 0xFE, ( "怎样都好,\x01", "等你的好消息啦。\x02", ) ) CloseMessageWindow() ClearChrFlags(0x18, 0x10) OP_A2(0x2F86) label("loc_CDD") TalkEnd(0xFE) Return() # Function_10_85A end def Function_11_CE1(): pass label("Function_11_CE1") Call(0, 12) Return() # Function_11_CE1 end def Function_12_CE6(): pass label("Function_12_CE6") TalkBegin(0x10) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F0, 5)), scpexpr(EXPR_END)), "loc_1290") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F1, 1)), scpexpr(EXPR_END)), "loc_DF1") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 7)), scpexpr(EXPR_END)), "loc_D64") ChrTalk( #42 0x10, ( "#790F阿加特,\x01", "着急的话就去中央工房吧。\x02\x03", "有空的话就顺便\x01", "解决一下公告板上的委托。\x02", ) ) CloseMessageWindow() Jump("loc_DEE") label("loc_D64") ChrTalk( #43 0x10, ( "#790F阿加特,\x01", "着急的话就去中央工房吧。\x02\x03", "有空的话就顺便\x01", "解决一下公告板上的委托。\x02", ) ) CloseMessageWindow() ChrTalk( #44 0x106, "#050F哦、哦………………\x02", ) CloseMessageWindow() OP_A2(0x7) label("loc_DEE") Jump("loc_1290") label("loc_DF1") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F1, 0)), scpexpr(EXPR_END)), "loc_FC8") ChrTalk( #45 0x10, ( "#792F………………阿加特,\x01", "拜托你一件事可以吗。\x02", ) ) CloseMessageWindow() ChrTalk( #46 0x106, ( "#052F哦,哦…………\x02\x03", "#051F……好啊,\x01", "只要是我能做的事,\x01", "就随便说吧。\x02", ) ) CloseMessageWindow() ChrTalk( #47 0x10, ( "#790F希望你能多来蔡斯照顾一下,\x01", "就算偶尔来几次也行。\x02\x03", "反正你有空吧?\x02", ) ) CloseMessageWindow() ChrTalk( #48 0x106, ( "#551F没空啦。\x02\x03", "#051F不过………………\x01", "这点小事我能做到的。\x02", ) ) CloseMessageWindow() ChrTalk( #49 0x10, ( "#791F……谢谢你。\x02\x03", "我也把你的事\x01", "告诉接任的孩子了。\x02\x03", "要和她好好相处哦。\x02", ) ) CloseMessageWindow() ChrTalk( #50 0x106, ( "#051F呵,\x01", "安排还是那么周到嘛。\x02", ) ) Jump("loc_FC1") label("loc_FC1") CloseMessageWindow() OP_A2(0x2F89) Jump("loc_1290") label("loc_FC8") EventBegin(0x0) Fade(500) OP_4A(0x10, 255) SetChrPos(0x106, 3750, 0, -700, 0) OP_6D(2910, 0, 1060, 0) OP_67(0, 6400, -10000, 0) OP_6B(2600, 0) OP_6C(315000, 0) OP_6E(262, 0) OP_0D() Sleep(500) ChrTalk( #51 0x10, ( "#790F#11P哎呀,阿加特。\x01", "你不是要赶去工房吗?\x02", ) ) CloseMessageWindow() ChrTalk( #52 0x106, ( "#052F#6P没事,做完准备马上就出发。话说回来……\x02\x03", "听说你辞掉协会工作,\x01", "要回国去了……\x02", ) ) CloseMessageWindow() ChrTalk( #53 0x10, ( "#792F#11P………………嗯嗯。\x02\x03", "#791F很早以前就决定了,\x01", "不过工作交接拖延了点时间。\x02\x03", "下个月初就会出发。\x02", ) ) CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(1000) OP_63(0x106) Sleep(500) ChrTalk( #54 0x106, ( "#053F#6P…………是吗。\x02\x03", "#051F以前也多次\x01", "承蒙你照顾了。\x02", ) ) CloseMessageWindow() ChrTalk( #55 0x10, ( "#794F#11P……是啊。\x02\x03", "#792F阿加特,\x01", "可别再中毒倒下了啊。\x02\x03", "免得吓着接任的孩子。\x02", ) ) CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x28, 0x2B, 0x64, 0x3) Sleep(500) ChrTalk( #56 0x106, ( "#055F#6P又、又不是\x01", "我愿意倒下的啊。\x02", ) ) CloseMessageWindow() ChrTalk( #57 0x10, "#791F#11P呵呵……………………\x02", ) CloseMessageWindow() OP_A2(0x2F88) OP_4B(0x10, 255) EventEnd(0x0) label("loc_1290") TalkEnd(0x10) Return() # Function_12_CE6 end def Function_13_1294(): pass label("Function_13_1294") TalkBegin(0xFE) Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F0, 5)), scpexpr(EXPR_END)), "loc_14ED") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x5F1, 2)), scpexpr(EXPR_END)), "loc_13BA") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 5)), scpexpr(EXPR_END)), "loc_1320") ChrTalk( #58 0xFE, ( "哎呀,\x01", "接下来得赶紧\x01", "去亚尔摩温泉才行。\x02", ) ) Jump("loc_12E2") label("loc_12E2") CloseMessageWindow() ChrTalk( #59 0xFE, ( "继续闲扯下去,\x01", "又要被雾香小姐\x01", "训斥了。\x02", ) ) Jump("loc_131C") label("loc_131C") CloseMessageWindow() Jump("loc_13B7") label("loc_1320") ChrTalk( #60 0xFE, ( "听冈多夫先生说,\x01", "艾莉卡博士的丈夫\x01", "原来好像是游击士呢。\x02", ) ) CloseMessageWindow() ChrTalk( #61 0xFE, ( "而且据说\x01", "还相当厉害。\x02", ) ) Jump("loc_1386") label("loc_1386") CloseMessageWindow() ChrTalk( #62 0xFE, ( "唔,\x01", "感觉真是一对奇怪的夫妇啊。\x02", ) ) Jump("loc_13B3") label("loc_13B3") CloseMessageWindow() OP_A2(0x5) label("loc_13B7") Jump("loc_14ED") label("loc_13BA") ChrTalk( #63 0xFE, ( "啊……\x01", "这不是阿加特先生吗。\x02", ) ) Jump("loc_13E5") label("loc_13E5") CloseMessageWindow() ChrTalk( #64 0x106, "#051F哟,王,情况怎么样?\x02", ) CloseMessageWindow() ChrTalk( #65 0xFE, "哎呀,这个嘛……\x02", ) CloseMessageWindow() ChrTalk( #66 0xFE, ( "阿加特先生,\x01", "你知道艾莉卡博士吗?\x02", ) ) CloseMessageWindow() ChrTalk( #67 0xFE, ( "据说是能与那个拉赛尔博士\x01", "相匹敌的破坏魔鬼……\x02", ) ) CloseMessageWindow() ChrTalk( #68 0xFE, ( "不知道是不是因为这个,\x01", "委托增加了好多啊。\x02", ) ) CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(1000) OP_63(0x106) Sleep(500) ChrTalk( #69 0x106, "#053F…………是吗……\x02", ) CloseMessageWindow() OP_A2(0x2F8A) label("loc_14ED") TalkEnd(0xFE) Return() # Function_13_1294 end def Function_14_14F1(): pass label("Function_14_14F1") EventBegin(0x0) FadeToDark(0, 0, -1) OP_6D(-960, 0, -2500, 0) OP_67(0, 5400, -10000, 0) OP_6B(2900, 0) OP_6C(315000, 0) OP_6E(262, 0) SetChrPos(0x106, 1000, 0, -5800, 0) SetChrChipByIndex(0x106, 22) SetChrSubChip(0x106, 0) ClearChrFlags(0x12, 0x80) SetChrPos(0x12, 1000, 0, -1260, 0) OP_4A(0x10, 255) OP_C5(0x0, 0x0, 0x0, 0x280, 0x1E0, 0x0, 0x0, 0x300, 0x200, 0x0, 0x0, 0x280, 0x1E0, 0xFFFFFF, 0x0, "C_VIS369._CH") OP_C5(0x1, 0x0, 0x0, 0x280, 0x1E0, 0x0, 0x0, 0x300, 0x200, 0x0, 0x0, 0x280, 0x1E0, 0xFFFFFF, 0x0, "C_VIS368._CH") OP_C5(0x2, 0x0, 0x0, 0x280, 0x1E0, 0x0, 0x0, 0x300, 0x200, 0x0, 0x0, 0x280, 0x1E0, 0xFFFFFF, 0x0, "C_VIS368._CH") OP_C6(0x0, 0x0, -315000, -250000, 0) OP_C6(0x0, 0x1, 2000, 2000, 0) OP_C6(0x1, 0x0, -463000, -368000, 0) OP_C6(0x1, 0x1, 2500, 2500, 0) OP_C6(0x2, 0x0, -370000, -368000, 0) OP_C6(0x2, 0x1, 2500, 2500, 0) Sleep(500) OP_1F(0x0, 0x1F4) OP_C6(0x1, 0x3, -1, 100, 0) OP_C6(0x2, 0x3, -1, 100, 0) OP_22(0x80, 0x0, 0x64) OP_C7(0x0, 0x1, 0x3) OP_C7(0x0, 0x2, 0x3) OP_C6(0x0, 0x3, -1, 0, 0) OP_C6(0x1, 0x3, 16777215, 1000, 0) OP_C6(0x2, 0x3, 16777215, 1000, 0) OP_C7(0x0, 0x0, 0x3) OP_C7(0x0, 0x1, 0x3) OP_C7(0x0, 0x2, 0x3) Sleep(300) SetMessageWindowPos(-1, 300, -1, -1) SetChrName("阿加特") AnonymousTalk( #70 "\x07\x00#052F什…………!?\x02", ) Jump("loc_16FA") label("loc_16FA") CloseMessageWindow() OP_56(0x0) SetMessageWindowPos(72, 320, 56, 3) OP_22(0xD5, 0x0, 0x64) OP_C6(0x0, 0x3, 16777215, 500, 0) FadeToBright(2000, 0) OP_0D() OP_C7(0x0, 0x0, 0x3) OP_C7(0x1, 0xFF, 0x0) ChrTalk( #71 0x106, ( "#057F#6P………………………………?\x02\x03", "(刚才好像感觉到\x01", " 很强的杀气……)\x02\x03", "#552F(话虽如此,\x01", " 只不过是工房的研究人员来委托而已……)\x02", ) ) CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(1000) OP_63(0x106) Sleep(500) ChrTalk( #72 0x106, "#050F#6P(……是我的错觉吗………)\x02", ) CloseMessageWindow() OP_1F(0x64, 0x7D0) Fade(500) OP_22(0xD5, 0x0, 0x64) SetChrChipByIndex(0x106, 65535) SetChrSubChip(0x106, 0) Sleep(1000) NpcTalk( #73 0x12, "女性研究人员", "#5P哎呀,怎么回事呢……\x02", ) CloseMessageWindow() OP_8C(0x12, 180, 500) Sleep(300) NpcTalk( #74 0x12, "女性研究人员", ( "#1458F#11P那边的红毛小子\x01", "不就是阿加特·科洛斯纳吗。\x02\x03", "#1833F呼呼呼,可怜的人啊。\x02", ) ) CloseMessageWindow() ChrTalk( #75 0x106, "#057F#6P…………啊?\x02", ) CloseMessageWindow() def lambda_190B(): OP_8E(0xFE, 0x3E8, 0x0, 0xFFFFF448, 0x5DC, 0x0) ExitThread() QueueWorkItem(0x12, 1, lambda_190B) WaitChrThread(0x12, 0x1) Sleep(300) NpcTalk( #76 0x12, "女性研究人员", ( "#1833F#11P在即将受刑的时候\x01", "还能这么悠闲呢。\x02\x03", "这倒正好…………\x01", "我就直接告诉你吧。\x02\x03", "#1831F其实啊,\x01", "我准备了非常适合你的葬身之地哦。\x02\x03", "来来,到中央工房来吧。\x02", ) ) CloseMessageWindow() ChrTalk( #77 0x106, ( "#555F#6P你是谁啊……\x01", "要找我打架吗?\x02", ) ) CloseMessageWindow() NpcTalk( #78 0x12, "女性研究人员", ( "#1457F#11P才不是打架呢。\x02\x03", "#1456F……这是委托。\x02\x03", "交给游击士\x01", "阿加特·科洛斯纳的委托。\x02", ) ) CloseMessageWindow() ChrTalk( #79 0x106, ( "#057F#6P哪有这么\x01", "莫名其妙的委托啊。\x02\x03", "#057F想要委托我,\x01", "就赶快找点\x01", "正经工作来吧。\x02", ) ) CloseMessageWindow() NpcTalk( #80 0x12, "女性研究人员", ( "#1833F#11P……唉,真伤脑筋,\x01", "这么不知好歹。\x02\x03", "#1835F#3S#30W……自己的罪孽,\x01", "总要有点自觉吧……!#2S\x02", ) ) CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x28, 0x2B, 0x64, 0x3) Sleep(500) ChrTalk( #81 0x106, ( "#055F#6P(这、这家伙搞什么啊……?)\x02\x03", "(眼神也不正常……)\x02", ) ) CloseMessageWindow() NpcTalk( #82 0x12, "女性研究人员", ( "#1457F#11P…………明白没?\x01", "赶紧挖挖耳朵给我好好听着。\x02\x03", "#1452F这项委托的内容,\x01", "就是要拿导力装甲和你作比较,\x01", "进行机体性能的检查。\x02\x03", "……也就是说,\x01", "你要为改良导力装甲作贡献!\x02\x03", "#1458F呼呼,这样一来你的罪孽也就……\x02", ) ) CloseMessageWindow() ChrTalk( #83 0x106, ( "#551F#6P……说什么\x01", "乱七八糟的…………\x02\x03", "#555F……你听着,所谓委托,\x01", "是要拿出真正有困难的事情。\x02\x03", "……游击士又不是便利店。\x02\x03", "我没工夫\x01", "听你的冷嘲热讽。\x02", ) ) Jump("loc_1DA7") label("loc_1DA7") CloseMessageWindow() NpcTalk( #84 0x12, "女性研究人员", ( "#1458F#11P……………………\x02\x03", "嘻嘻…………\x02\x03", "#1833F哎呀哎呀,你害怕了~?\x02", ) ) CloseMessageWindow() ChrTalk( #85 0x106, "#057F#6P…………………啊?\x02", ) CloseMessageWindow() FadeToDark(1000, 0, -1) OP_0D() OP_A2(0x2505) NewScene("ED6_DT21/T3100 ._SN", 100, 0, 0) IdleLoop() Return() # Function_14_14F1 end def Function_15_1E55(): pass label("Function_15_1E55") EventBegin(0x0) FadeToDark(0, 0, -1) OP_6D(-960, 0, -2500, 0) OP_67(0, 5400, -10000, 0) OP_6B(2900, 0) OP_6C(315000, 0) OP_6E(262, 0) SetChrPos(0x106, 0, 0, -4000, 0) ClearChrFlags(0x12, 0x80) SetChrPos(0x12, 0, 0, -2500, 180) ClearChrFlags(0x11, 0x80) SetChrPos(0x11, 2000, -500, -8000, 0) OP_9F(0x11, 0xFF, 0xFF, 0xFF, 0x0, 0x0) OP_4A(0x10, 255) FadeToBright(1000, 0) OP_0D() ChrTalk( #86 0x106, ( "#054F#6P既然这么\x01", "想找人帮忙……!\x02", ) ) CloseMessageWindow() OP_22(0x6, 0x0, 0x64) def lambda_1F2D(): OP_6D(40, 0, -3500, 1500) ExitThread() QueueWorkItem(0x19, 0, lambda_1F2D) def lambda_1F45(): OP_9F(0xFE, 0xFF, 0xFF, 0xFF, 0xFF, 0x3E8) ExitThread() QueueWorkItem(0x11, 2, lambda_1F45) def lambda_1F57(): OP_8E(0xFE, 0x7D0, 0x0, 0xFFFFE890, 0x7D0, 0x0) ExitThread() QueueWorkItem(0x11, 1, lambda_1F57) WaitChrThread(0x11, 0x1) OP_22(0x7, 0x0, 0x64) OP_8C(0x11, 315, 500) OP_62(0x106, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) OP_22(0x27, 0x0, 0x64) Sleep(100) OP_62(0x12, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) OP_22(0x27, 0x0, 0x64) Sleep(800) def lambda_1FBB(): TurnDirection(0xFE, 0x11, 500) ExitThread() QueueWorkItem(0x106, 2, lambda_1FBB) Sleep(100) TurnDirection(0x12, 0x11, 500) Sleep(300) ChrTalk( #87 0x106, "#052F#5P提妲…………?\x02", ) CloseMessageWindow() ChrTalk( #88 0x11, "#064F#6P阿、阿加特大哥哥……!?\x02", ) CloseMessageWindow() ChrTalk( #89 op#A op#5 0x11, "#064F#6P#10A还有妈妈……    \x05\x02", ) def lambda_2057(): OP_8E(0xFE, 0x618, 0x0, 0xFFFFF04D, 0x1F40, 0x0) ExitThread() QueueWorkItem(0x12, 1, lambda_2057) WaitChrThread(0x12, 0x1) def lambda_2077(): OP_8E(0xFE, 0x618, 0x0, 0xFFFFEA48, 0x1F40, 0x0) ExitThread() QueueWorkItem(0x12, 1, lambda_2077) WaitChrThread(0x12, 0x1) TurnDirection(0x12, 0x106, 600) Sleep(300) CloseMessageWindow() NpcTalk( #90 0x12, "女性研究人员", ( "#1458F#6P对了对了……\x01", "还有一点得事先声明……\x02", ) ) CloseMessageWindow() Sleep(500) NpcTalk( #91 0x12, "女性研究人员", ( "#1830F#6P#3S不准靠近\x01", "我家提妲半径1塞尔矩以内!!\x02", ) ) OP_7C(0x0, 0x15E, 0xBB8, 0x64) CloseMessageWindow() Sleep(400) NpcTalk( #92 0x12, "女性研究人员", ( "#1830F#6P……明白了吗,\x01", "你这个不知天高地厚的家伙!!\x02", ) ) CloseMessageWindow() ChrTalk( #93 0x106, "#052F#5P我、我说……\x02", ) CloseMessageWindow() def lambda_21BF(): OP_8C(0x12, 135, 800) ExitThread() QueueWorkItem(0x12, 2, lambda_21BF) NpcTalk( #94 0x12, "女性研究人员", "#5P咻…………!\x02", ) CloseMessageWindow() WaitChrThread(0x12, 0x2) NpcTalk( #95 op#A 0x12, "女性研究人员", "#8A#11P咻咻…………!!\x02", ) Sleep(200) def lambda_2230(): OP_9F(0xFE, 0xFF, 0xFF, 0xFF, 0x0, 0xC8) ExitThread() QueueWorkItem(0x12, 2, lambda_2230) def lambda_2242(): OP_8E(0xFE, 0x618, 0xFFFFFE0C, 0xFFFFE0C0, 0x1F40, 0x0) ExitThread() QueueWorkItem(0x12, 1, lambda_2242) def lambda_225D(): OP_9F(0xFE, 0xFF, 0xFF, 0xFF, 0x0, 0xC8) ExitThread() QueueWorkItem(0x11, 2, lambda_225D) def lambda_226F(): OP_8F(0xFE, 0x7D0, 0xFFFFFE0C, 0xFFFFE0C0, 0x1F40, 0x0) ExitThread() QueueWorkItem(0x11, 1, lambda_226F) WaitChrThread(0x12, 0x1) WaitChrThread(0x11, 0x1) OP_22(0x7, 0x0, 0x64) OP_62(0x106, 0x0, 2000, 0x28, 0x2B, 0x64, 0x3) def lambda_22AB(): OP_8C(0xFE, 180, 500) ExitThread() QueueWorkItem(0x106, 2, lambda_22AB) ChrTalk( #96 0x106, "#055F#11P喂、喂…………!?\x02", ) CloseMessageWindow() Sleep(1000) ChrTalk( #97 0x106, ( "#555F#11P……怎么回事,那家伙……?\x02\x03", "而且还把\x01", "提妲带走了……\x02", ) ) Jump("loc_233B") label("loc_233B") CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(1000) OP_63(0x106) Sleep(500) ChrTalk( #98 0x106, ( "#057F#11P该不是要把\x01", "那小不点拐到什么\x01", "危险的地方去吧……!?\x02", ) ) CloseMessageWindow() ChrTalk( #99 0x10, "#792F这个不必担心。\x02", ) CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x2, 0x7, 0x50, 0x1) OP_22(0x27, 0x0, 0x64) Sleep(1000) def lambda_23E5(): OP_8C(0xFE, 45, 500) ExitThread() QueueWorkItem(0x106, 2, lambda_23E5) def lambda_23F3(): OP_6D(2460, 0, 1800, 2400) ExitThread() QueueWorkItem(0x19, 0, lambda_23F3) def lambda_240B(): OP_6C(322000, 2400) ExitThread() QueueWorkItem(0x19, 1, lambda_240B) WaitChrThread(0x19, 0x0) ChrTalk( #100 0x106, "#052F#4P……雾香,你在啊。\x02", ) CloseMessageWindow() def lambda_2447(): OP_8E(0xFE, 0xE4C, 0x0, 0xFFFFFBDC, 0x898, 0x0) ExitThread() QueueWorkItem(0x106, 1, lambda_2447) WaitChrThread(0x106, 0x1) TurnDirection(0x106, 0x10, 500) Sleep(300) ChrTalk( #101 0x10, ( "#791F#11P她是艾莉卡·拉赛尔。\x01", "是提妲的母亲啦。\x02", ) ) CloseMessageWindow() ChrTalk( #102 0x106, ( "#052F#6P……母亲………?\x02\x03", "#40W……那家伙,是提妲的?\x02", ) ) CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(1000) OP_63(0x106) Sleep(500) ChrTalk( #103 0x106, "#055F#4S#6P啊…………!?#2S\x02", ) OP_7C(0x0, 0x190, 0xBB8, 0x96) CloseMessageWindow() ChrTalk( #104 0x10, ( "#792F#11P大概是两周前吧,\x01", "那孩子的父母回国了。\x02\x03", "丹·拉赛尔\x01", "和艾莉卡·拉赛尔博士。\x02\x03", "#791F……虽然听说发生了一些骚乱,\x01", "不过这是铁定的事实。\x02", ) ) CloseMessageWindow() ChrTalk( #105 0x106, "#555F#6P那、那种家伙……?\x02", ) CloseMessageWindow() OP_8C(0x106, 180, 500) Sleep(300) OP_62(0x106, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(3000) ChrTalk( #106 0x10, ( "#791F#11P……虽然你好像正忙着,\x01", "不过还是来交代一下工作的事情吧。\x02", ) ) CloseMessageWindow() OP_63(0x106) Sleep(200) OP_62(0x106, 0x0, 2000, 0x28, 0x2B, 0x64, 0x3) OP_8C(0x106, 0, 600) Sleep(300) ChrTalk( #107 0x106, ( "#052F#6P哦,哦…………\x02\x03", "#051F傍晚之前都有空,\x01", "小委托倒是可以做几个。\x02", ) ) CloseMessageWindow() ChrTalk( #108 0x10, ( "#792F#11P…………那么首先,\x01", "是中央工房的委托。\x02\x03", "协助新兵器『导力装甲』\x01", "试作机进行各种实验。\x02", ) ) CloseMessageWindow() ChrTalk( #109 0x106, ( "#052F#6P导力装……甲……?\x02\x03", "#555F……喂,给我慢着。\x01", "这个委托……\x02", ) ) CloseMessageWindow() ChrTalk( #110 0x10, ( "#791F#11P艾莉卡博士的委托,\x01", "已经作为正式工作受理了。\x02\x03", "阿加特,指名你去做哦。\x02", ) ) CloseMessageWindow() ChrTalk( #111 0x106, ( "#552F#6P……啧,那女人……\x02\x03", "居然真的\x01", "提出委托了吗……\x02", ) ) Jump("loc_2879") label("loc_2879") CloseMessageWindow() ChrTalk( #112 0x10, ( "#792F#11P关于导力装甲\x01", "我也不知道详细情况。\x02\x03", "根据艾莉卡博士的说明来看,\x01", "应该是集结了利贝尔\x01", "所有导力技术精华的新兵器。\x02\x03", "开发似乎是由\x01", "拉赛尔家全员进行。\x02\x03", "#790F地点看来就是中央工房。\x02", ) ) CloseMessageWindow() ChrTalk( #113 0x106, "#052F#6P……新兵器…………?\x02", ) CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(1000) OP_63(0x106) Sleep(500) ChrTalk( #114 0x106, ( "#053F#6P喂,\x01", "你刚才说由拉赛尔家全员进行……?\x02\x03", "#057F难不成……\x01", "连提妲\x01", "也算进去了吗?\x02", ) ) Jump("loc_2A06") label("loc_2A06") CloseMessageWindow() ChrTalk( #115 0x10, ( "#792F#11P……这个,\x01", "我就没问得那么仔细了。\x02\x03", "#791F那孩子差不多也该结束见习,\x01", "成为正式技师了,\x01", "所以这种可能性很高。\x02\x03", "阿加特,有什么问题吗?\x02", ) ) CloseMessageWindow() ChrTalk( #116 0x106, ( "#552F#6P…………………不…………\x02\x03", "#551F(那家伙的双亲\x01", " 只是从提妲那里\x01", " 听过一点传闻而已……)\x02\x03", "(这跟说的完全不一样嘛。\x01", " 而且还好像有欺骗成分……)\x02\x03", "…………………………………………\x02\x03", "#057F(但是,要是那女人\x01", " 竟敢把提妲卷入\x01", " 新兵器的开发……)\x02", ) ) CloseMessageWindow() OP_62(0x106, 0x0, 2000, 0x18, 0x1B, 0xFA, 0x0) Sleep(1000) OP_63(0x106) Sleep(500) ChrTalk( #117 0x106, ( "#050F#6P……雾香。\x01", "这个委托,暂时中止吧。\x02", ) ) CloseMessageWindow() ChrTalk( #118 0x10, "#790F#11P保留……你是这个意思吗?\x02", ) CloseMessageWindow() ChrTalk( #119 0x106, ( "#053F#6P………………没错。\x02\x03", "#057F……我去确认一下情况。\x01", "可别随便交给别人啊!\x02", ) ) CloseMessageWindow() OP_43(0x106, 0x3, 0x0, 0x10) Sleep(1000) FadeToDark(2000, 0, -1) OP_0D() WaitChrThread(0x106, 0x3) OP_A2(0x2F85) OP_C2(0x1, 0x1F) OP_41(0x5, 0x0, 0xFF) OP_31(0x5, 0x10, 0x5A) OP_31(0x5, 0x5, 0x0) OP_31(0x5, 0xFE, 0x0) OP_35(0x5, 0xFFFF) OP_34(0x5, 0xFFFF) OP_35(0x5, 0x0) OP_BB(0x5, 0x6, 0x101) OP_37(0x5, 0x7F, 0x0) OP_37(0x5, 0x7F, 0x2) OP_41(0x5, 0x3E8, 0xFF) OP_34(0x5, 0x82) OP_34(0x5, 0x83) OP_34(0x5, 0x57) OP_34(0x5, 0x1E) OP_34(0x5, 0xA) NewScene("ED6_DT21/T3100 ._SN", 110, 0, 0) IdleLoop() Return() # Function_15_1E55 end def Function_16_2D22(): pass label("Function_16_2D22") OP_8C(0x106, 180, 600) def lambda_2D2F(): OP_8E(0xFE, 0x6CC, 0x0, 0xFFFFE0C0, 0x1194, 0x0) ExitThread() QueueWorkItem(0x106, 1, lambda_2D2F) Sleep(1300) OP_22(0x6, 0x0, 0x64) Sleep(800) OP_22(0x7, 0x0, 0x64) Sleep(1000) Return() # Function_16_2D22 end def Function_17_2D5E(): pass label("Function_17_2D5E") Jc((scpexpr(EXPR_PUSH_VALUE_INDEX, 0x42), scpexpr(EXPR_PUSH_LONG, 0x1A), scpexpr(EXPR_EQU), scpexpr(EXPR_END)), "loc_2E58") Jc((scpexpr(EXPR_TEST_SCENA_FLAGS, MakeScenarioFlags(0x0, 0)), scpexpr(EXPR_END)), "loc_2DD7") ChrTalk( #120 0x106, ( "#057F……现在确认\x01", "提妲是不是真的被卷进去了\x01", "才是当务之急。\x02\x03", "要赶快去中央工房……\x02", ) ) CloseMessageWindow() Jump("loc_2E55") label("loc_2DD7") ChrTalk( #121 0x106, ( "#555F啧,委托还挺多的呢。 \x02\x03", "#053F…………也罢。\x01", "看来没什么很紧急的委托……\x02\x03", "现在先去中央工房吧。\x02", ) ) CloseMessageWindow() OP_A2(0x0) label("loc_2E55") TalkEnd(0xFF) label("loc_2E58") Return() # Function_17_2D5E end SaveToFile() Try(main)
06d7bbf90abff854a7b7a915bdfa33d96e78ef8c
70fa6468c768d4ec9b4b14fc94fa785da557f1b5
/lib/surface/dataflow/metrics/__init__.py
2d51ca7b37d8c9474111586e8a3fb3dc1c6b167e
[ "LicenseRef-scancode-unknown-license-reference", "Apache-2.0" ]
permissive
kylewuolle/google-cloud-sdk
d43286ef646aec053ecd7eb58566ab2075e04e76
75f09ebe779e99fdc3fd13b48621fe12bfaa11aa
refs/heads/master
2020-04-20T22:10:41.774132
2019-01-26T09:29:26
2019-01-26T09:29:26
169,131,028
0
0
NOASSERTION
2019-02-04T19:04:40
2019-02-04T18:58:36
Python
UTF-8
Python
false
false
1,004
py
# -*- coding: utf-8 -*- # # Copyright 2015 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. """The command group for gcloud dataflow metrics. """ from __future__ import absolute_import from __future__ import division from __future__ import unicode_literals from googlecloudsdk.calliope import base @base.ReleaseTracks(base.ReleaseTrack.ALPHA, base.ReleaseTrack.BETA) class Metrics(base.Group): """A group of subcommands for working with Dataflow metrics. """ pass
f21d6ae22b8b893963863860902fe9a532a7a279
21cf168ad8dd64e6d572a7b2f7df89148475faa9
/tests/filters/test_base_filter.py
6ee60f6b948326841a38b575549d89a223d536d1
[ "MIT" ]
permissive
fanhero/thumbor
da67870bd7a75091f1e0e1875b9e7b5758e0dc85
91e2846a7274e6f56579587e93793951d36339e3
refs/heads/master
2021-01-09T06:51:36.079193
2018-10-01T20:43:58
2018-10-01T20:43:58
65,403,839
0
1
MIT
2017-12-01T15:13:17
2016-08-10T17:45:31
Python
UTF-8
Python
false
false
13,356
py
#!/usr/bin/python # -*- coding: utf-8 -*- # thumbor imaging service # https://github.com/thumbor/thumbor/wiki # Licensed under the MIT license: # http://www.opensource.org/licenses/mit-license # Copyright (c) 2011 globo.com [email protected] import mock from preggy import expect from thumbor.filters import BaseFilter, FiltersFactory, filter_method import thumbor.filters from tests.base import PythonTestCase FILTER_PARAMS_DATA = [ { 'type': BaseFilter.Number, 'values': [ ('1', 1), ('10', 10), ('99', 99), ('-1', -1), ('-10', -10), ('010', 10), (' 1 ', 1), ('0', 0) ], 'invalid_values': ['x', 'x10', '10x', '- 1', ''] }, { 'type': BaseFilter.PositiveNumber, 'values': [ ('1', 1), ('10', 10), ('99', 99), (' 1 ', 1), ('010', 10), ('0', 0) ], 'invalid_values': ['-1', 'x', 'x10', '10x', ''] }, { 'type': BaseFilter.NegativeNumber, 'values': [ ('-1', -1), ('-10', -10), (' -9 ', -9), ('-0', 0) ], 'invalid_values': ['x', 'x10', '10x', '- 1', ''] }, { 'type': BaseFilter.DecimalNumber, 'values': [ ('1', 1.0), ('10', 10.0), ('99', 99.0), ('-1', -1.0), ('-10', -10.0), ('010', 10.0), (' 1 ', 1.0), ('1.0', 1.0), ('10.12', 10.12), ('9.9', 9.9), ('-1.1', -1.1), (' -10.2 ', -10.2), (' 1 ', 1.0), ('.11', 0.11), ('0.111', 0.111), ('0', 0.0) ], 'invalid_values': ['x', 'x10', '10x', '- 1.1', '', '.'] }, { 'type': BaseFilter.String, 'values': [ ('a', 'a'), ('bbbb', 'bbbb'), (' cccc ', 'cccc'), (' cc:cc ', 'cc:cc'), ('\'a,b\'', 'a,b') ], 'invalid_values': ['', ',', ',,,,'] }, { 'type': BaseFilter.Boolean, 'values': [ ('1', True), ('True', True), ('true', True), ('0', False), ('False', False), ('false', False), (' True ', True) ], 'invalid_values': ['', 'x', 'TRUE', '111'] }, { 'type': r'\dx\d', 'values': [ ('1x1', '1x1'), (' 9x9 ', '9x9') ], 'invalid_values': ['a', ',', '9 x 9'] } ] class FilterParamsTestCase(PythonTestCase): def test_with_valid_values_should_correctly_parse_value(self): for params in FILTER_PARAMS_DATA: for test_data, expected_data in params['values']: BaseFilter.compile_regex({'name': 'x', 'params': [params['type']]}) f = BaseFilter('x(%s)' % test_data) expect(f.params[0]).to_equal(expected_data) def test_with_invalid_values_should_correctly_parse_value(self): for params in FILTER_PARAMS_DATA: for test_data in params['invalid_values']: BaseFilter.compile_regex({'name': 'x', 'params': [params['type']]}) f = BaseFilter('x(%s)' % test_data) expect(f.params).to_be_null() class MyFilter(BaseFilter): @filter_method(BaseFilter.Number, BaseFilter.DecimalNumber) def my_filter(self, value1, value2): return (value1, value2) class StringFilter(BaseFilter): @filter_method(BaseFilter.String) def my_string_filter(self, value): return value class EmptyFilter(BaseFilter): @filter_method() def my_empty_filter(self): return 'ok' class AsyncFilter(BaseFilter): @filter_method(BaseFilter.String, async=True) def my_async_filter(self, callback, value): callback(value) class InvalidFilter(BaseFilter): def my_invalid_filter(self, value): return value class DoubleStringFilter(BaseFilter): @filter_method(BaseFilter.String, BaseFilter.String) def my_string_filter(self, value1, value2): return (value1, value2) class OptionalParamFilter(BaseFilter): @filter_method(BaseFilter.String, BaseFilter.String) def my_optional_filter(self, value1, value2="not provided"): return (value1, value2) class PreLoadFilter(BaseFilter): phase = thumbor.filters.PHASE_PRE_LOAD @filter_method(BaseFilter.String) def my_pre_load_filter(self, value): return value class BaseFilterTestCase(PythonTestCase): def setUp(self, *args, **kwargs): super(BaseFilterTestCase, self).setUp(*args, **kwargs) self.context = self.get_context() self.factory = FiltersFactory([MyFilter, StringFilter, OptionalParamFilter, PreLoadFilter]) self.runner = self.get_runner() def get_runner(self): return None def get_context(self): class Any: pass def is_multiple(): return False context = Any() context.modules = Any() engine = Any() engine.is_multiple = is_multiple context.modules.engine = engine return context class RunnerWithParametersFilterTestCase(BaseFilterTestCase): def get_runner(self): return self.factory.create_instances( self.context, 'my_string_filter(aaaa):my_string_filter(bbb):my_pre_load_filter(ccc)' ) def test_runner_with_parameters_should_create_two_instances(self): post_instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] pre_instances = self.runner.filter_instances[thumbor.filters.PHASE_PRE_LOAD] expect(len(post_instances)).to_equal(2) expect(post_instances[0].__class__).to_equal(StringFilter) expect(post_instances[1].__class__).to_equal(StringFilter) expect(len(pre_instances)).to_equal(1) expect(pre_instances[0].__class__).to_equal(PreLoadFilter) def test_running_post_filters_should_run_only_post_filters(self): self.runner.apply_filters(thumbor.filters.PHASE_POST_TRANSFORM, mock.Mock()) post_instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] pre_instances = self.runner.filter_instances[thumbor.filters.PHASE_PRE_LOAD] expect(len(post_instances)).to_equal(0) expect(len(pre_instances)).to_equal(1) def test_running_pre_filters_should_run_only_pre_filters(self): self.runner.apply_filters(thumbor.filters.PHASE_POST_TRANSFORM, mock.Mock()) self.runner.apply_filters(thumbor.filters.PHASE_PRE_LOAD, mock.Mock()) post_instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] pre_instances = self.runner.filter_instances[thumbor.filters.PHASE_PRE_LOAD] expect(len(post_instances)).to_equal(0) expect(len(pre_instances)).to_equal(0) def test_invalid_filter(self): InvalidFilter.pre_compile() expect(hasattr(InvalidFilter, 'runnable_method')).to_be_false() def test_valid_filter_creates_a_runnable_method(self): MyFilter.pre_compile() expect(MyFilter.runnable_method).to_equal(MyFilter.my_filter) def test_valid_filter_sets_correct_result_value(self): f = MyFilter("my_filter(1, -1.1)") result = f.run() expect(result).to_equal([(1, -1.1)]) def test_invalid_number_throws_an_error(self): f = MyFilter("my_invalid_filter(x, 1)") result = f.run() expect(hasattr(result, 'result')).to_be_false() def test_when_passed_callback_calls_callback(self): f = MyFilter("my_filter(1, -1.1)") callback = mock.Mock() f.run(callback) callback.assert_called_once_with() def test_double_string_filter_sets_correct_values(self): DoubleStringFilter.pre_compile() f = DoubleStringFilter("my_string_filter(a, b)") result = f.run() expect(result).to_equal([('a', 'b')]) def test_WithStringsWithCommas_sets_correct_values(self): DoubleStringFilter.pre_compile() tests = [ ("my_string_filter(a,'b, c')", [('a', 'b, c')]), ("my_string_filter('a,b', c)", [('a,b', 'c')]), ("my_string_filter('ab', c)", [('ab', 'c')]), ("my_string_filter('ab,', c)", [('ab,', 'c')]), ("my_string_filter('ab,', ',c')", [('ab,', ',c')]), ("my_string_filter('ab, c)", [('\'ab', 'c')]), ("my_string_filter('ab, c',d)", [('ab, c', 'd')]), ("my_string_filter('a,b, c)", None), ("my_string_filter('a,b, c')", None), ] for test, expected in tests: f = DoubleStringFilter(test) result = f.run() expect(result).to_equal(expected) def test_with_empty_filter_should_call_filter(self): EmptyFilter.pre_compile() f = EmptyFilter('my_empty_filter()') result = f.run() expect(result).to_equal(['ok']) def test_with_async_filter_should_call_callback(self): AsyncFilter.pre_compile() f = AsyncFilter("my_async_filter(yyy)") callback = mock.Mock() f.run(callback) callback.assert_called_once_with('yyy') class WithOneValidParamFilterTestCase(BaseFilterTestCase): def get_runner(self): return self.factory.create_instances( self.context, 'my_filter(1, 0a):my_string_filter(aaaa)' ) def test_should_create_one_instance(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] expect(len(instances)).to_equal(1) expect(instances[0].__class__).to_equal(StringFilter) class WithParameterContainingColonsFilterTestCase(BaseFilterTestCase): def get_runner(self): return self.factory.create_instances( self.context, 'my_string_filter(aaaa):my_string_filter(aa:aa)' ) def test_should_create_two_instances(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] expect(len(instances)).to_equal(2) expect(instances[0].__class__).to_equal(StringFilter) expect(instances[1].__class__).to_equal(StringFilter) def test_should_understant_parameters(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] expect(instances[0].params).to_equal(["aaaa"]) expect(instances[1].params).to_equal(["aa:aa"]) class WithValidParamsFilterTestCase(BaseFilterTestCase): def get_runner(self): return self.factory.create_instances( self.context, 'my_filter(1, 0):my_string_filter(aaaa)' ) def test_should_create_two_instances(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] expect(len(instances)).to_equal(2) expect(instances[0].__class__).to_equal(MyFilter) expect(instances[1].__class__).to_equal(StringFilter) def test_when_running_should_create_two_instances(self): result = [] instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] for instance in instances: result.append(instance.run()) expect(result[0]).to_equal([(1, 0.0)]) expect(result[1]).to_equal(['aaaa']) class WithOptionalParamFilterTestCase(BaseFilterTestCase): def get_runner(self): return self.factory.create_instances( self.context, 'my_optional_filter(aa, bb)' ) def test_should_create_two_instances(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] expect(len(instances)).to_equal(1) expect(instances[0].__class__).to_equal(OptionalParamFilter) def test_should_understand_parameters(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] expect(instances[0].run()).to_equal([("aa", "bb")]) class WithOptionalParamsInOptionalFilterTestCase(BaseFilterTestCase): def get_runner(self): return self.factory.create_instances( self.context, 'my_optional_filter(aa)' ) def test_should_create_two_instances(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] expect(len(instances)).to_equal(1) expect(instances[0].__class__).to_equal(OptionalParamFilter) def test_should_understand_parameters(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] expect(instances[0].run()).to_equal([("aa", "not provided")]) class WithInvalidOptionalFilterTestCase(BaseFilterTestCase): def get_runner(self): return self.factory.create_instances( self.context, 'my_optional_filter()' ) def test_should_create_two_instances(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_POST_TRANSFORM] expect(len(instances)).to_equal(0) class WithPreLoadFilterTestCase(BaseFilterTestCase): def get_runner(self): return self.factory.create_instances( self.context, 'my_pre_load_filter(aaaa)' ) def should_create_two_instances(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_PRE_LOAD] expect(len(instances)).to_equal(1) expect(instances[0].__class__).to_equal(PreLoadFilter) def should_understant_parameters(self): instances = self.runner.filter_instances[thumbor.filters.PHASE_PRE_LOAD] expect(instances[0].params).to_equal(["aaaa"])
bcc080a1a2fe4324fce8573b0154dd8f9c87245e
404628c6f94aa4715306017d261d1ab139256578
/djangoAPI/settings.py
39e0d552cd976f4a15b881b4807c045178393244
[]
no_license
Timur597/Api1
daaec92eb13822bb880871fbc1b1a45d1c897e92
5cce70d9a5a2464d3ebee096ff4ba573ecaa57c0
refs/heads/master
2023-04-16T20:34:16.737990
2021-04-22T07:27:09
2021-04-22T07:27:09
360,429,491
0
0
null
null
null
null
UTF-8
Python
false
false
3,348
py
""" Django settings for djangoAPI project. Generated by 'django-admin startproject' using Django 3.2. For more information on this file, see https://docs.djangoproject.com/en/3.2/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/3.2/ref/settings/ """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/3.2/howto/deployment/checklist/ # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = 'django-insecure-))_4%#k&o!jgl#re&wvi0buudw)1&r88w5)6nt7li$zxl*$3_d' # SECURITY WARNING: don't run with debug turned on in production! DEBUG = True ALLOWED_HOSTS = [] # Application definition INSTALLED_APPS = [ 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles', 'rest_framework', 'rest_framework.authtoken', 'djoser', 'cars.apps.CarsConfig', ] MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] ROOT_URLCONF = 'djangoAPI.urls' TEMPLATES = [ { 'BACKEND': 'django.template.backends.django.DjangoTemplates', 'DIRS': [], 'APP_DIRS': True, 'OPTIONS': { 'context_processors': [ 'django.template.context_processors.debug', 'django.template.context_processors.request', 'django.contrib.auth.context_processors.auth', 'django.contrib.messages.context_processors.messages', ], }, }, ] WSGI_APPLICATION = 'djangoAPI.wsgi.application' # Database # https://docs.djangoproject.com/en/3.2/ref/settings/#databases DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3', 'NAME': BASE_DIR / 'db.sqlite3', } } # Password validation # https://docs.djangoproject.com/en/3.2/ref/settings/#auth-password-validators AUTH_PASSWORD_VALIDATORS = [ { 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator', }, { 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator', }, { 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator', }, { 'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator', }, ] # Internationalization # https://docs.djangoproject.com/en/3.2/topics/i18n/ LANGUAGE_CODE = 'ru' TIME_ZONE = 'Asia/Bishkek' USE_I18N = True USE_L10N = True USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/3.2/howto/static-files/ STATIC_URL = '/static/' # Default primary key field type # https://docs.djangoproject.com/en/3.2/ref/settings/#default-auto-field DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
caa50e12b9007727a7713ee67884ef7ac755ce8e
763f76758496e477eef799eceeace43f289cca03
/src/encode_task_merge_fastq.py
2ee0add2000aeb63d49c923475df82dd4f7d8441
[ "MIT" ]
permissive
kundajelab/cut-n-run-pipeline
edccf6fb719473c27251f0d81a767c814a5cc460
0f9cf7870288d462f69449cb2b99faa9292af3bc
refs/heads/master
2020-08-04T16:05:10.748214
2019-10-01T23:11:09
2019-10-01T23:11:09
212,196,329
1
0
MIT
2019-10-01T23:23:18
2019-10-01T20:46:01
Python
UTF-8
Python
false
false
3,392
py
#!/usr/bin/env python # ENCODE DCC fastq merger wrapper # Author: Jin Lee ([email protected]) import sys import os import argparse from encode_lib_common import ( hard_link, log, ls_l, mkdir_p, read_tsv, run_shell_cmd, strip_ext_fastq) def parse_arguments(debug=False): parser = argparse.ArgumentParser(prog='ENCODE DCC fastq merger.', description='') parser.add_argument( 'fastqs', nargs='+', type=str, help='TSV file path or list of FASTQs. ' 'FASTQs must be compressed with gzip (with .gz). ' 'Use TSV for multiple fastqs to be merged later. ' 'row=merge_id, col=end_id).') parser.add_argument('--paired-end', action="store_true", help='Paired-end FASTQs.') parser.add_argument('--nth', type=int, default=1, help='Number of threads to parallelize.') parser.add_argument('--out-dir', default='', type=str, help='Output directory.') parser.add_argument('--log-level', default='INFO', choices=['NOTSET', 'DEBUG', 'INFO', 'WARNING', 'CRITICAL', 'ERROR', 'CRITICAL'], help='Log level') args = parser.parse_args() # parse fastqs command line if args.fastqs[0].endswith('.gz') or args.fastqs[0].endswith('.fastq') or \ args.fastqs[0].endswith('.fq'): # it's fastq args.fastqs = [[f] for f in args.fastqs] # make it a matrix else: # it's TSV args.fastqs = read_tsv(args.fastqs[0]) for i, fastqs in enumerate(args.fastqs): if args.paired_end and len(fastqs) != 2: raise argparse.ArgumentTypeError( 'Need 2 fastqs per replicate for paired end.') if not args.paired_end and len(fastqs) != 1: raise argparse.ArgumentTypeError( 'Need 1 fastq per replicate for single end.') log.setLevel(args.log_level) log.info(sys.argv) return args # make merged fastqs on $out_dir/R1, $out_dir/R2 def merge_fastqs(fastqs, end, out_dir): out_dir = os.path.join(out_dir, end) mkdir_p(out_dir) prefix = os.path.join(out_dir, os.path.basename(strip_ext_fastq(fastqs[0]))) merged = '{}.merged.fastq.gz'.format(prefix) if len(fastqs) > 1: cmd = 'zcat -f {} | gzip -nc > {}'.format( ' '.join(fastqs), merged) run_shell_cmd(cmd) return merged else: return hard_link(fastqs[0], merged) def main(): # read params args = parse_arguments() log.info('Initializing and making output directory...') mkdir_p(args.out_dir) # update array with trimmed fastqs fastqs_R1 = [] fastqs_R2 = [] for fastqs in args.fastqs: fastqs_R1.append(fastqs[0]) if args.paired_end: fastqs_R2.append(fastqs[1]) log.info('Merging fastqs...') log.info('R1 to be merged: {}'.format(fastqs_R1)) merge_fastqs(fastqs_R1, 'R1', args.out_dir) if args.paired_end: log.info('R2 to be merged: {}'.format(fastqs_R2)) merge_fastqs(fastqs_R2, 'R2', args.out_dir) log.info('List all files in output directory...') ls_l(args.out_dir) log.info('All done.') if __name__ == '__main__': main()
193c71e4e43bc56faf9ea83f8d5ac6de37f491a5
768058e7f347231e06a28879922690c0b6870ed4
/venv/lib/python3.7/site-packages/numba/cuda/tests/cudadrv/test_emm_plugins.py
dd5315bc6c3a56436b4f456da51329cd90df1b97
[]
no_license
jciech/HeisenbergSpinChains
58b4238281d8c158b11c6c22dd0da82025fd7284
e43942bbd09f6675e7e2ff277f8930dc0518d08e
refs/heads/master
2022-12-18T08:04:08.052966
2020-09-29T12:55:00
2020-09-29T12:55:00
258,476,448
0
0
null
null
null
null
UTF-8
Python
false
false
7,084
py
import ctypes import numpy as np import weakref from numba import cuda from numba.core import config from numba.cuda.testing import unittest, CUDATestCase, skip_on_cudasim from numba.tests.support import linux_only if not config.ENABLE_CUDASIM: class DeviceOnlyEMMPlugin(cuda.HostOnlyCUDAMemoryManager): """ Dummy EMM Plugin implementation for testing. It memorises which plugin API methods have been called so that the tests can check that Numba called into the plugin as expected. """ def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) # For tracking our dummy allocations self.allocations = {} self.count = 0 # For tracking which methods have been called self.initialized = False self.memalloc_called = False self.reset_called = False self.get_memory_info_called = False self.get_ipc_handle_called = False def memalloc(self, size): # We maintain a list of allocations and keep track of them, so that # we can test that the finalizers of objects returned by memalloc # get called. # Numba should have initialized the memory manager when preparing # the context for use, prior to any memalloc call. if not self.initialized: raise RuntimeError("memalloc called before initialize") self.memalloc_called = True # Create an allocation and record it self.count += 1 alloc_count = self.count self.allocations[alloc_count] = size # The finalizer deletes the record from our internal dict of # allocations. finalizer_allocs = self.allocations def finalizer(): del finalizer_allocs[alloc_count] # We use an AutoFreePointer so that the finalizer will be run when # the reference count drops to zero. ctx = weakref.proxy(self.context) ptr = ctypes.c_void_p(alloc_count) return cuda.cudadrv.driver.AutoFreePointer( ctx, ptr, size, finalizer=finalizer ) def initialize(self): # No special initialization needed. self.initialized = True def reset(self): # We remove all allocations on reset, just as a real EMM Plugin # would do. Note that our finalizers in memalloc don't check # whether the allocations are still alive, so running them after # reset will detect any allocations that are floating around at # exit time; however, the atexit finalizer for weakref will only # print a traceback, not terminate the interpreter abnormally. self.reset_called = True def get_memory_info(self): # Return some dummy memory information self.get_memory_info_called = True return cuda.MemoryInfo(free=32, total=64) def get_ipc_handle(self, memory): # The dummy IPC handle is only a string, so it is important that # the tests don't try to do too much with it (e.g. open / close # it). self.get_ipc_handle_called = True return "Dummy IPC handle for alloc %s" % memory.device_pointer.value @property def interface_version(self): # The expected version for an EMM Plugin. return 1 class BadVersionEMMPlugin(DeviceOnlyEMMPlugin): """A plugin that claims to implement a different interface version""" @property def interface_version(self): return 2 @skip_on_cudasim("EMM Plugins not supported on CUDA simulator") class TestDeviceOnlyEMMPlugin(CUDATestCase): """ Tests that the API of an EMM Plugin that implements device allocations only is used correctly by Numba. """ def setUp(self): # Always start afresh with a new context and memory manager cuda.close() cuda.set_memory_manager(DeviceOnlyEMMPlugin) def tearDown(self): # Set the memory manager back to the Numba internal one for subsequent # tests. cuda.close() cuda.set_memory_manager(cuda.cudadrv.driver.NumbaCUDAMemoryManager) def test_memalloc(self): mgr = cuda.current_context().memory_manager # Allocate an array and check that memalloc was called with the correct # size. arr_1 = np.arange(10) d_arr_1 = cuda.device_array_like(arr_1) self.assertTrue(mgr.memalloc_called) self.assertEqual(mgr.count, 1) self.assertEqual(mgr.allocations[1], arr_1.nbytes) # Allocate again, with a different size, and check that it is also # correct. arr_2 = np.arange(5) d_arr_2 = cuda.device_array_like(arr_2) self.assertEqual(mgr.count, 2) self.assertEqual(mgr.allocations[2], arr_2.nbytes) # Remove the first array, and check that our finalizer was called for # the first array only. del d_arr_1 self.assertNotIn(1, mgr.allocations) self.assertIn(2, mgr.allocations) # Remove the second array and check that its finalizer was also # called. del d_arr_2 self.assertNotIn(2, mgr.allocations) def test_initialized_in_context(self): # If we have a CUDA context, it should already have initialized its # memory manager. self.assertTrue(cuda.current_context().memory_manager.initialized) def test_reset(self): ctx = cuda.current_context() ctx.reset() self.assertTrue(ctx.memory_manager.reset_called) def test_get_memory_info(self): ctx = cuda.current_context() meminfo = ctx.get_memory_info() self.assertTrue(ctx.memory_manager.get_memory_info_called) self.assertEqual(meminfo.free, 32) self.assertEqual(meminfo.total, 64) @linux_only def test_get_ipc_handle(self): # We don't attempt to close the IPC handle in this test because Numba # will be expecting a real IpcHandle object to have been returned from # get_ipc_handle, and it would cause problems to do so. arr = np.arange(2) d_arr = cuda.device_array_like(arr) ipch = d_arr.get_ipc_handle() ctx = cuda.current_context() self.assertTrue(ctx.memory_manager.get_ipc_handle_called) self.assertIn("Dummy IPC handle for alloc 1", ipch._ipc_handle) @skip_on_cudasim("EMM Plugins not supported on CUDA simulator") class TestBadEMMPluginVersion(CUDATestCase): """ Ensure that Numba rejects EMM Plugins with incompatible version numbers. """ def test_bad_plugin_version(self): with self.assertRaises(RuntimeError) as raises: cuda.set_memory_manager(BadVersionEMMPlugin) self.assertIn("version 1 required", str(raises.exception)) if __name__ == "__main__": unittest.main()
063ee61f063bc5e4fefb7733ad5efaacaf5d8f48
15f321878face2af9317363c5f6de1e5ddd9b749
/solutions_python/Problem_201/60.py
5485a73302478c045c90203cd40d735999b80c55
[]
no_license
dr-dos-ok/Code_Jam_Webscraper
c06fd59870842664cd79c41eb460a09553e1c80a
26a35bf114a3aa30fc4c677ef069d95f41665cc0
refs/heads/master
2020-04-06T08:17:40.938460
2018-10-14T10:12:47
2018-10-14T10:12:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
796
py
from tqdm import tqdm from xheap import OrderHeap from collections import defaultdict def solve(): N, K = map(int, input().split()) max_heap = OrderHeap([], lambda key: -key) unique = set() cnt = defaultdict(int) max_heap.push(N) cnt[N] = 1 while len(max_heap) > 0: val = max_heap.pop() nr = cnt[val] if K <= nr: return (val - 1 - (val-1)//2, (val - 1) // 2) else: K -= nr unique.add(val) l = [(val-1)//2, val - 1 - (val-1)//2] for el in l: if el: if cnt[el] is 0: max_heap.push(el) cnt[el] += nr #print (N, K, max_heap) if __name__ == "__main__": #test() T = int(input()) for t in tqdm(range(1, T + 1)): solution = solve() print ("Case #{}: {} {}".format(t, solution[0], solution[1]))
83c3086e6a3213ae90d70e69b8cb7348485e9659
4efbbf153fd5e87bf477d147916271be32c71c9b
/examples/fingerprint_optimalpresenter.py
a0d3b513b57900b716d5a3298f6268a8bd01b838
[ "MIT" ]
permissive
R3dFruitRollUp/quail
8b003084c6978fcf55abbc4f1581e40de3a259f6
a6d6502746c853518a670d542222eb5fc2b05542
refs/heads/master
2020-03-19T00:13:09.073101
2018-02-06T19:35:15
2018-02-06T19:35:15
135,463,292
1
0
null
null
null
null
UTF-8
Python
false
false
1,741
py
# -*- coding: utf-8 -*- import numpy as np import quail from quail import Fingerprint, OptimalPresenter # generate some fake data next_presented = ['CAT', 'DOG', 'SHOE', 'HORSE'] next_recalled = ['HORSE', 'DOG', 'CAT'] next_features = [{ 'category' : 'animal', 'size' : 'bigger', 'starting letter' : 'C', 'length' : 3 }, { 'category' : 'animal', 'size' : 'bigger', 'starting letter' : 'D', 'length' : 3 }, { 'category' : 'object', 'size' : 'smaller', 'starting letter' : 'S', 'length' : 4 }, { 'category' : 'animal', 'size' : 'bigger', 'starting letter' : 'H', 'length' : 5 } ] dist_funcs = { 'category' : lambda a, b: int(a!=b), 'size' : lambda a, b: int(a!=b), 'starting letter' : lambda a, b: int(a!=b), 'length' : lambda a, b: np.linalg.norm(np.subtract(a,b)) } egg = quail.Egg(pres=[next_presented], rec=[next_recalled], features=[next_features], dist_funcs=dist_funcs) # initialize fingerprint fingerprint = Fingerprint(init=egg) # initialize presenter params = { 'fingerprint' : fingerprint } presenter = OptimalPresenter(params=params, strategy='stabilize') # update the fingerprint fingerprint.update(egg) # reorder next list resorted_egg = presenter.order(egg, method='permute', nperms=100) print(resorted_egg.pres)
6f6fb65a8521f7e11f144a4842783d5022ade08a
cfb41bfd6a2b58d08fc9ef56ff0835b4348db689
/04_dockerfile_exercises/python/python-server-3.6.8.py
c532f0811e07b0f0e736e109c96328c4b9d40328
[]
no_license
DWONeill18/docker
8bd0b19ac72ed30406bff746a25ab6ddff7ed858
1ad41f20a9cf43af7105031f553cb7e4a6f6c4a7
refs/heads/master
2020-06-23T10:01:26.486894
2019-07-24T08:28:49
2019-07-24T08:28:49
198,591,778
0
0
null
null
null
null
UTF-8
Python
false
false
232
py
# only works with Python 3 import http.server import socketserver PORT = 9000 Handler = http.server.SimpleHTTPRequestHandler httpd = socketserver.TCPServer(("", PORT), Handler) print("serving at port", PORT) httpd.serve_forever()
03f0d4ef167bcc901bc79e1ed3446a850274ec31
64bf39b96a014b5d3f69b3311430185c64a7ff0e
/intro-ansible/venv2/lib/python3.8/site-packages/ansible/modules/network/cloudengine/ce_stp.py
d208c90f9036fba93bf0d1b72c8efc640ed5d112
[ "MIT" ]
permissive
SimonFangCisco/dne-dna-code
7072eba7da0389e37507b7a2aa5f7d0c0735a220
2ea7d4f00212f502bc684ac257371ada73da1ca9
refs/heads/master
2023-03-10T23:10:31.392558
2021-02-25T15:04:36
2021-02-25T15:04:36
342,274,373
0
0
MIT
2021-02-25T14:39:22
2021-02-25T14:39:22
null
UTF-8
Python
false
false
37,613
py
#!/usr/bin/python # # This file is part of Ansible # # Ansible is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # Ansible 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 Ansible. If not, see <http://www.gnu.org/licenses/>. # ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMENTATION = ''' --- module: ce_stp version_added: "2.4" short_description: Manages STP configuration on HUAWEI CloudEngine switches. description: - Manages STP configurations on HUAWEI CloudEngine switches. author: - wangdezhuang (@CloudEngine-Ansible) options: state: description: - Specify desired state of the resource. required: false default: present choices: ['present', 'absent'] stp_mode: description: - Set an operation mode for the current MSTP process. The mode can be STP, RSTP, or MSTP. required: false default: null choices: ['stp', 'rstp', 'mstp'] stp_enable: description: - Enable or disable STP on a switch. required: false default: null choices: ['enable', 'disable'] stp_converge: description: - STP convergence mode. Fast means set STP aging mode to Fast. Normal means set STP aging mode to Normal. required: false default: null choices: ['fast', 'normal'] bpdu_protection: description: - Configure BPDU protection on an edge port. This function prevents network flapping caused by attack packets. required: false default: null choices: ['enable', 'disable'] tc_protection: description: - Configure the TC BPDU protection function for an MSTP process. required: false default: null choices: ['enable', 'disable'] tc_protection_interval: description: - Set the time the MSTP device takes to handle the maximum number of TC BPDUs and immediately refresh forwarding entries. The value is an integer ranging from 1 to 600, in seconds. required: false default: null tc_protection_threshold: description: - Set the maximum number of TC BPDUs that the MSTP can handle. The value is an integer ranging from 1 to 255. The default value is 1 on the switch. required: false default: null interface: description: - Interface name. If the value is C(all), will apply configuration to all interfaces. if the value is a special name, only support input the full name. required: false default: null edged_port: description: - Set the current port as an edge port. required: false default: null choices: ['enable', 'disable'] bpdu_filter: description: - Specify a port as a BPDU filter port. required: false default: null choices: ['enable', 'disable'] cost: description: - Set the path cost of the current port. The default instance is 0. required: false default: null root_protection: description: - Enable root protection on the current port. required: false default: null choices: ['enable', 'disable'] loop_protection: description: - Enable loop protection on the current port. required: false default: null choices: ['enable', 'disable'] ''' EXAMPLES = ''' - name: CloudEngine stp test hosts: cloudengine connection: local gather_facts: no vars: cli: host: "{{ inventory_hostname }}" port: "{{ ansible_ssh_port }}" username: "{{ username }}" password: "{{ password }}" transport: cli tasks: - name: "Config stp mode" ce_stp: state: present stp_mode: stp provider: "{{ cli }}" - name: "Undo stp mode" ce_stp: state: absent stp_mode: stp provider: "{{ cli }}" - name: "Enable bpdu protection" ce_stp: state: present bpdu_protection: enable provider: "{{ cli }}" - name: "Disable bpdu protection" ce_stp: state: present bpdu_protection: disable provider: "{{ cli }}" ''' RETURN = ''' changed: description: check to see if a change was made on the device returned: always type: boolean sample: true proposed: description: k/v pairs of parameters passed into module returned: always type: dict sample: {"bpdu_protection": "enable", "state": "present"} existing: description: k/v pairs of existing aaa server returned: always type: dict sample: {"bpdu_protection": "disable"} end_state: description: k/v pairs of aaa params after module execution returned: always type: dict sample: {"bpdu_protection": "enable"} updates: description: command sent to the device returned: always type: list sample: ["stp bpdu-protection"] ''' import re from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.network.cloudengine.ce import get_config, load_config, ce_argument_spec class Stp(object): """ Manages stp/rstp/mstp configuration """ def __init__(self, **kwargs): """ Stp module init """ # module argument_spec = kwargs["argument_spec"] self.spec = argument_spec self.module = AnsibleModule(argument_spec=self.spec, supports_check_mode=True) # config self.cur_cfg = dict() self.stp_cfg = None self.interface_stp_cfg = None # module args self.state = self.module.params['state'] or None self.stp_mode = self.module.params['stp_mode'] or None self.stp_enable = self.module.params['stp_enable'] or None self.stp_converge = self.module.params['stp_converge'] or None self.interface = self.module.params['interface'] or None self.edged_port = self.module.params['edged_port'] or None self.bpdu_filter = self.module.params['bpdu_filter'] or None self.cost = self.module.params['cost'] or None self.bpdu_protection = self.module.params['bpdu_protection'] or None self.tc_protection = self.module.params['tc_protection'] or None self.tc_protection_interval = self.module.params['tc_protection_interval'] or None self.tc_protection_threshold = self.module.params['tc_protection_threshold'] or None self.root_protection = self.module.params['root_protection'] or None self.loop_protection = self.module.params['loop_protection'] or None # state self.changed = False self.updates_cmd = list() self.results = dict() self.proposed = dict() self.existing = dict() self.end_state = dict() def cli_load_config(self, commands): """ Cli load configuration """ if not self.module.check_mode: load_config(self.module, commands) def cli_get_stp_config(self): """ Cli get stp configuration """ regular = "| include stp" flags = list() flags.append(regular) self.stp_cfg = get_config(self.module, flags) def cli_get_interface_stp_config(self): """ Cli get interface's stp configuration """ if self.interface: regular = "| ignore-case section include ^interface %s$" % self.interface flags = list() flags.append(regular) tmp_cfg = get_config(self.module, flags) if not tmp_cfg: self.module.fail_json( msg='Error: The interface %s is not exist.' % self.interface) if "undo portswitch" in tmp_cfg: self.module.fail_json( msg='Error: The interface %s is not switch mode.' % self.interface) self.interface_stp_cfg = tmp_cfg def check_params(self): """ Check module params """ if self.cost: if self.cost.isdigit(): if int(self.cost) < 1 or int(self.cost) > 200000000: self.module.fail_json( msg='Error: The value of cost is out of [1 - 200000000].') else: self.module.fail_json( msg='Error: The cost is not digit.') if self.tc_protection_interval: if self.tc_protection_interval.isdigit(): if int(self.tc_protection_interval) < 1 or int(self.tc_protection_interval) > 600: self.module.fail_json( msg='Error: The value of tc_protection_interval is out of [1 - 600].') else: self.module.fail_json( msg='Error: The tc_protection_interval is not digit.') if self.tc_protection_threshold: if self.tc_protection_threshold.isdigit(): if int(self.tc_protection_threshold) < 1 or int(self.tc_protection_threshold) > 255: self.module.fail_json( msg='Error: The value of tc_protection_threshold is out of [1 - 255].') else: self.module.fail_json( msg='Error: The tc_protection_threshold is not digit.') if self.root_protection or self.loop_protection or self.cost: if not self.interface: self.module.fail_json( msg='Error: Please input interface.') elif self.interface == "all": self.module.fail_json( msg='Error: Interface can not be all when config root_protection or loop_protection or cost.') if self.root_protection and self.root_protection == "enable": if self.loop_protection and self.loop_protection == "enable": self.module.fail_json( msg='Error: Can not enable root_protection and loop_protection at the same interface.') if self.edged_port or self.bpdu_filter: if not self.interface: self.module.fail_json( msg='Error: Please input interface.') def get_proposed(self): """ Get module proposed """ self.proposed["state"] = self.state if self.stp_mode: self.proposed["stp_mode"] = self.stp_mode if self.stp_enable: self.proposed["stp_enable"] = self.stp_enable if self.stp_converge: self.proposed["stp_converge"] = self.stp_converge if self.interface: self.proposed["interface"] = self.interface if self.edged_port: self.proposed["edged_port"] = self.edged_port if self.bpdu_filter: self.proposed["bpdu_filter"] = self.bpdu_filter if self.cost: self.proposed["cost"] = self.cost if self.bpdu_protection: self.proposed["bpdu_protection"] = self.bpdu_protection if self.tc_protection: self.proposed["tc_protection"] = self.tc_protection if self.tc_protection_interval: self.proposed["tc_protection_interval"] = self.tc_protection_interval if self.tc_protection_threshold: self.proposed["tc_protection_threshold"] = self.tc_protection_threshold if self.root_protection: self.proposed["root_protection"] = self.root_protection if self.loop_protection: self.proposed["loop_protection"] = self.loop_protection def get_existing(self): """ Get existing configuration """ self.cli_get_stp_config() if self.interface and self.interface != "all": self.cli_get_interface_stp_config() if self.stp_mode: if "stp mode stp" in self.stp_cfg: self.cur_cfg["stp_mode"] = "stp" self.existing["stp_mode"] = "stp" elif "stp mode rstp" in self.stp_cfg: self.cur_cfg["stp_mode"] = "rstp" self.existing["stp_mode"] = "rstp" else: self.cur_cfg["stp_mode"] = "mstp" self.existing["stp_mode"] = "mstp" if self.stp_enable: if "stp disable" in self.stp_cfg: self.cur_cfg["stp_enable"] = "disable" self.existing["stp_enable"] = "disable" else: self.cur_cfg["stp_enable"] = "enable" self.existing["stp_enable"] = "enable" if self.stp_converge: if "stp converge fast" in self.stp_cfg: self.cur_cfg["stp_converge"] = "fast" self.existing["stp_converge"] = "fast" else: self.cur_cfg["stp_converge"] = "normal" self.existing["stp_converge"] = "normal" if self.edged_port: if self.interface == "all": if "stp edged-port default" in self.stp_cfg: self.cur_cfg["edged_port"] = "enable" self.existing["edged_port"] = "enable" else: self.cur_cfg["edged_port"] = "disable" self.existing["edged_port"] = "disable" else: if "stp edged-port enable" in self.interface_stp_cfg: self.cur_cfg["edged_port"] = "enable" self.existing["edged_port"] = "enable" else: self.cur_cfg["edged_port"] = "disable" self.existing["edged_port"] = "disable" if self.bpdu_filter: if self.interface == "all": if "stp bpdu-filter default" in self.stp_cfg: self.cur_cfg["bpdu_filter"] = "enable" self.existing["bpdu_filter"] = "enable" else: self.cur_cfg["bpdu_filter"] = "disable" self.existing["bpdu_filter"] = "disable" else: if "stp bpdu-filter enable" in self.interface_stp_cfg: self.cur_cfg["bpdu_filter"] = "enable" self.existing["bpdu_filter"] = "enable" else: self.cur_cfg["bpdu_filter"] = "disable" self.existing["bpdu_filter"] = "disable" if self.bpdu_protection: if "stp bpdu-protection" in self.stp_cfg: self.cur_cfg["bpdu_protection"] = "enable" self.existing["bpdu_protection"] = "enable" else: self.cur_cfg["bpdu_protection"] = "disable" self.existing["bpdu_protection"] = "disable" if self.tc_protection: if "stp tc-protection" in self.stp_cfg: self.cur_cfg["tc_protection"] = "enable" self.existing["tc_protection"] = "enable" else: self.cur_cfg["tc_protection"] = "disable" self.existing["tc_protection"] = "disable" if self.tc_protection_interval: if "stp tc-protection interval" in self.stp_cfg: tmp_value = re.findall(r'stp tc-protection interval (.*)', self.stp_cfg) if not tmp_value: self.module.fail_json( msg='Error: Can not find tc-protection interval on the device.') self.cur_cfg["tc_protection_interval"] = tmp_value[0] self.existing["tc_protection_interval"] = tmp_value[0] else: self.cur_cfg["tc_protection_interval"] = "null" self.existing["tc_protection_interval"] = "null" if self.tc_protection_threshold: if "stp tc-protection threshold" in self.stp_cfg: tmp_value = re.findall(r'stp tc-protection threshold (.*)', self.stp_cfg) if not tmp_value: self.module.fail_json( msg='Error: Can not find tc-protection threshold on the device.') self.cur_cfg["tc_protection_threshold"] = tmp_value[0] self.existing["tc_protection_threshold"] = tmp_value[0] else: self.cur_cfg["tc_protection_threshold"] = "1" self.existing["tc_protection_threshold"] = "1" if self.cost: tmp_value = re.findall(r'stp instance (.*) cost (.*)', self.interface_stp_cfg) if not tmp_value: self.cur_cfg["cost"] = "null" self.existing["cost"] = "null" else: self.cur_cfg["cost"] = tmp_value[0][1] self.existing["cost"] = tmp_value[0][1] # root_protection and loop_protection should get configuration at the same time if self.root_protection or self.loop_protection: if "stp root-protection" in self.interface_stp_cfg: self.cur_cfg["root_protection"] = "enable" self.existing["root_protection"] = "enable" else: self.cur_cfg["root_protection"] = "disable" self.existing["root_protection"] = "disable" if "stp loop-protection" in self.interface_stp_cfg: self.cur_cfg["loop_protection"] = "enable" self.existing["loop_protection"] = "enable" else: self.cur_cfg["loop_protection"] = "disable" self.existing["loop_protection"] = "disable" def get_end_state(self): """ Get end state """ self.cli_get_stp_config() if self.interface and self.interface != "all": self.cli_get_interface_stp_config() if self.stp_mode: if "stp mode stp" in self.stp_cfg: self.end_state["stp_mode"] = "stp" elif "stp mode rstp" in self.stp_cfg: self.end_state["stp_mode"] = "rstp" else: self.end_state["stp_mode"] = "mstp" if self.stp_enable: if "stp disable" in self.stp_cfg: self.end_state["stp_enable"] = "disable" else: self.end_state["stp_enable"] = "enable" if self.stp_converge: if "stp converge fast" in self.stp_cfg: self.end_state["stp_converge"] = "fast" else: self.end_state["stp_converge"] = "normal" if self.edged_port: if self.interface == "all": if "stp edged-port default" in self.stp_cfg: self.end_state["edged_port"] = "enable" else: self.end_state["edged_port"] = "disable" else: if "stp edged-port enable" in self.interface_stp_cfg: self.end_state["edged_port"] = "enable" else: self.end_state["edged_port"] = "disable" if self.bpdu_filter: if self.interface == "all": if "stp bpdu-filter default" in self.stp_cfg: self.end_state["bpdu_filter"] = "enable" else: self.end_state["bpdu_filter"] = "disable" else: if "stp bpdu-filter enable" in self.interface_stp_cfg: self.end_state["bpdu_filter"] = "enable" else: self.end_state["bpdu_filter"] = "disable" if self.bpdu_protection: if "stp bpdu-protection" in self.stp_cfg: self.end_state["bpdu_protection"] = "enable" else: self.end_state["bpdu_protection"] = "disable" if self.tc_protection: if "stp tc-protection" in self.stp_cfg: self.end_state["tc_protection"] = "enable" else: self.end_state["tc_protection"] = "disable" if self.tc_protection_interval: if "stp tc-protection interval" in self.stp_cfg: tmp_value = re.findall(r'stp tc-protection interval (.*)', self.stp_cfg) if not tmp_value: self.module.fail_json( msg='Error: Can not find tc-protection interval on the device.') self.end_state["tc_protection_interval"] = tmp_value[0] else: self.end_state["tc_protection_interval"] = "null" if self.tc_protection_threshold: if "stp tc-protection threshold" in self.stp_cfg: tmp_value = re.findall(r'stp tc-protection threshold (.*)', self.stp_cfg) if not tmp_value: self.module.fail_json( msg='Error: Can not find tc-protection threshold on the device.') self.end_state["tc_protection_threshold"] = tmp_value[0] else: self.end_state["tc_protection_threshold"] = "1" if self.cost: tmp_value = re.findall(r'stp instance (.*) cost (.*)', self.interface_stp_cfg) if not tmp_value: self.end_state["cost"] = "null" else: self.end_state["cost"] = tmp_value[0][1] if self.root_protection: if "stp root-protection" in self.interface_stp_cfg: self.end_state["root_protection"] = "enable" else: self.end_state["root_protection"] = "disable" if self.loop_protection: if "stp loop-protection" in self.interface_stp_cfg: self.end_state["loop_protection"] = "enable" else: self.end_state["loop_protection"] = "disable" def present_stp(self): """ Present stp configuration """ cmds = list() # cofig stp global if self.stp_mode: if self.stp_mode != self.cur_cfg["stp_mode"]: cmd = "stp mode %s" % self.stp_mode cmds.append(cmd) self.updates_cmd.append(cmd) if self.stp_enable: if self.stp_enable != self.cur_cfg["stp_enable"]: cmd = "stp %s" % self.stp_enable cmds.append(cmd) self.updates_cmd.append(cmd) if self.stp_converge: if self.stp_converge != self.cur_cfg["stp_converge"]: cmd = "stp converge %s" % self.stp_converge cmds.append(cmd) self.updates_cmd.append(cmd) if self.edged_port: if self.interface == "all": if self.edged_port != self.cur_cfg["edged_port"]: if self.edged_port == "enable": cmd = "stp edged-port default" cmds.append(cmd) self.updates_cmd.append(cmd) else: cmd = "undo stp edged-port default" cmds.append(cmd) self.updates_cmd.append(cmd) if self.bpdu_filter: if self.interface == "all": if self.bpdu_filter != self.cur_cfg["bpdu_filter"]: if self.bpdu_filter == "enable": cmd = "stp bpdu-filter default" cmds.append(cmd) self.updates_cmd.append(cmd) else: cmd = "undo stp bpdu-filter default" cmds.append(cmd) self.updates_cmd.append(cmd) if self.bpdu_protection: if self.bpdu_protection != self.cur_cfg["bpdu_protection"]: if self.bpdu_protection == "enable": cmd = "stp bpdu-protection" cmds.append(cmd) self.updates_cmd.append(cmd) else: cmd = "undo stp bpdu-protection" cmds.append(cmd) self.updates_cmd.append(cmd) if self.tc_protection: if self.tc_protection != self.cur_cfg["tc_protection"]: if self.tc_protection == "enable": cmd = "stp tc-protection" cmds.append(cmd) self.updates_cmd.append(cmd) else: cmd = "undo stp tc-protection" cmds.append(cmd) self.updates_cmd.append(cmd) if self.tc_protection_interval: if self.tc_protection_interval != self.cur_cfg["tc_protection_interval"]: cmd = "stp tc-protection interval %s" % self.tc_protection_interval cmds.append(cmd) self.updates_cmd.append(cmd) if self.tc_protection_threshold: if self.tc_protection_threshold != self.cur_cfg["tc_protection_threshold"]: cmd = "stp tc-protection threshold %s" % self.tc_protection_threshold cmds.append(cmd) self.updates_cmd.append(cmd) # config interface stp if self.interface and self.interface != "all": tmp_changed = False cmd = "interface %s" % self.interface cmds.append(cmd) self.updates_cmd.append(cmd) if self.edged_port: if self.edged_port != self.cur_cfg["edged_port"]: if self.edged_port == "enable": cmd = "stp edged-port enable" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True else: cmd = "undo stp edged-port" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if self.bpdu_filter: if self.bpdu_filter != self.cur_cfg["bpdu_filter"]: if self.bpdu_filter == "enable": cmd = "stp bpdu-filter enable" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True else: cmd = "undo stp bpdu-filter" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if self.root_protection: if self.root_protection == "enable" and self.cur_cfg["loop_protection"] == "enable": self.module.fail_json( msg='Error: The interface has enable loop_protection, can not enable root_protection.') if self.root_protection != self.cur_cfg["root_protection"]: if self.root_protection == "enable": cmd = "stp root-protection" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True else: cmd = "undo stp root-protection" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if self.loop_protection: if self.loop_protection == "enable" and self.cur_cfg["root_protection"] == "enable": self.module.fail_json( msg='Error: The interface has enable root_protection, can not enable loop_protection.') if self.loop_protection != self.cur_cfg["loop_protection"]: if self.loop_protection == "enable": cmd = "stp loop-protection" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True else: cmd = "undo stp loop-protection" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if self.cost: if self.cost != self.cur_cfg["cost"]: cmd = "stp cost %s" % self.cost cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if not tmp_changed: cmd = "interface %s" % self.interface self.updates_cmd.remove(cmd) cmds.remove(cmd) if cmds: self.cli_load_config(cmds) self.changed = True def absent_stp(self): """ Absent stp configuration """ cmds = list() if self.stp_mode: if self.stp_mode == self.cur_cfg["stp_mode"]: if self.stp_mode != "mstp": cmd = "undo stp mode" cmds.append(cmd) self.updates_cmd.append(cmd) self.changed = True if self.stp_enable: if self.stp_enable != self.cur_cfg["stp_enable"]: cmd = "stp %s" % self.stp_enable cmds.append(cmd) self.updates_cmd.append(cmd) if self.stp_converge: if self.stp_converge == self.cur_cfg["stp_converge"]: cmd = "undo stp converge" cmds.append(cmd) self.updates_cmd.append(cmd) self.changed = True if self.edged_port: if self.interface == "all": if self.edged_port != self.cur_cfg["edged_port"]: if self.edged_port == "enable": cmd = "stp edged-port default" cmds.append(cmd) self.updates_cmd.append(cmd) else: cmd = "undo stp edged-port default" cmds.append(cmd) self.updates_cmd.append(cmd) if self.bpdu_filter: if self.interface == "all": if self.bpdu_filter != self.cur_cfg["bpdu_filter"]: if self.bpdu_filter == "enable": cmd = "stp bpdu-filter default" cmds.append(cmd) self.updates_cmd.append(cmd) else: cmd = "undo stp bpdu-filter default" cmds.append(cmd) self.updates_cmd.append(cmd) if self.bpdu_protection: if self.bpdu_protection != self.cur_cfg["bpdu_protection"]: if self.bpdu_protection == "enable": cmd = "stp bpdu-protection" cmds.append(cmd) self.updates_cmd.append(cmd) else: cmd = "undo stp bpdu-protection" cmds.append(cmd) self.updates_cmd.append(cmd) if self.tc_protection: if self.tc_protection != self.cur_cfg["tc_protection"]: if self.tc_protection == "enable": cmd = "stp tc-protection" cmds.append(cmd) self.updates_cmd.append(cmd) else: cmd = "undo stp tc-protection" cmds.append(cmd) self.updates_cmd.append(cmd) if self.tc_protection_interval: if self.tc_protection_interval == self.cur_cfg["tc_protection_interval"]: cmd = "undo stp tc-protection interval" cmds.append(cmd) self.updates_cmd.append(cmd) self.changed = True if self.tc_protection_threshold: if self.tc_protection_threshold == self.cur_cfg["tc_protection_threshold"]: if self.tc_protection_threshold != "1": cmd = "undo stp tc-protection threshold" cmds.append(cmd) self.updates_cmd.append(cmd) self.changed = True # undo interface stp if self.interface and self.interface != "all": tmp_changed = False cmd = "interface %s" % self.interface cmds.append(cmd) self.updates_cmd.append(cmd) if self.edged_port: if self.edged_port != self.cur_cfg["edged_port"]: if self.edged_port == "enable": cmd = "stp edged-port enable" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True else: cmd = "undo stp edged-port" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if self.bpdu_filter: if self.bpdu_filter != self.cur_cfg["bpdu_filter"]: if self.bpdu_filter == "enable": cmd = "stp bpdu-filter enable" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True else: cmd = "undo stp bpdu-filter" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if self.root_protection: if self.root_protection == "enable" and self.cur_cfg["loop_protection"] == "enable": self.module.fail_json( msg='Error: The interface has enable loop_protection, can not enable root_protection.') if self.root_protection != self.cur_cfg["root_protection"]: if self.root_protection == "enable": cmd = "stp root-protection" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True else: cmd = "undo stp root-protection" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if self.loop_protection: if self.loop_protection == "enable" and self.cur_cfg["root_protection"] == "enable": self.module.fail_json( msg='Error: The interface has enable root_protection, can not enable loop_protection.') if self.loop_protection != self.cur_cfg["loop_protection"]: if self.loop_protection == "enable": cmd = "stp loop-protection" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True else: cmd = "undo stp loop-protection" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if self.cost: if self.cost == self.cur_cfg["cost"]: cmd = "undo stp cost" cmds.append(cmd) self.updates_cmd.append(cmd) tmp_changed = True if not tmp_changed: cmd = "interface %s" % self.interface self.updates_cmd.remove(cmd) cmds.remove(cmd) if cmds: self.cli_load_config(cmds) self.changed = True def work(self): """ Work function """ self.check_params() self.get_proposed() self.get_existing() if self.state == "present": self.present_stp() else: self.absent_stp() self.get_end_state() self.results['changed'] = self.changed self.results['proposed'] = self.proposed self.results['existing'] = self.existing self.results['end_state'] = self.end_state self.results['updates'] = self.updates_cmd self.module.exit_json(**self.results) def main(): """ Module main """ argument_spec = dict( state=dict(choices=['present', 'absent'], default='present'), stp_mode=dict(choices=['stp', 'rstp', 'mstp']), stp_enable=dict(choices=['enable', 'disable']), stp_converge=dict(choices=['fast', 'normal']), bpdu_protection=dict(choices=['enable', 'disable']), tc_protection=dict(choices=['enable', 'disable']), tc_protection_interval=dict(type='str'), tc_protection_threshold=dict(type='str'), interface=dict(type='str'), edged_port=dict(choices=['enable', 'disable']), bpdu_filter=dict(choices=['enable', 'disable']), cost=dict(type='str'), root_protection=dict(choices=['enable', 'disable']), loop_protection=dict(choices=['enable', 'disable']) ) argument_spec.update(ce_argument_spec) module = Stp(argument_spec=argument_spec) module.work() if __name__ == '__main__': main()
33d91aeff747366652036fd6f7da80f56c2698be
f7f9e2fc2c358269128fdd0a5e2483c19ec1b4d6
/env/bin/normalizer
7bbd18f69d2c832b7727a7a84c732d341b526fc6
[]
no_license
anandrajB/chatbot-django-rest
d0d0043ec123ef1667a3ba37902828e7fadfc0f7
510027eccc7ebdf9ed49675a084380eb318a3c9c
refs/heads/master
2023-08-02T02:12:36.434427
2021-09-27T08:35:22
2021-09-27T08:35:22
410,802,533
0
0
null
null
null
null
UTF-8
Python
false
false
265
#!/home/anand/Music/bot/env/bin/python3 # -*- coding: utf-8 -*- import re import sys from charset_normalizer.cli.normalizer import cli_detect if __name__ == '__main__': sys.argv[0] = re.sub(r'(-script\.pyw|\.exe)?$', '', sys.argv[0]) sys.exit(cli_detect())
74ca6490030e4c28cf9f7a3187a5a5c17de6a157
eaf2bc44c52806f6549bf0503e9ea2bade55dec3
/specfit/lib/specfit.py
76ed8dacfc8d70e32dfe18108aaf912ebb4ea366
[]
no_license
tribeiro/specfit
5fcb4ce0e903f1223a98505f10ffabd36b0f846d
b571def701ee9f5854d19926f96ab8b5dec1c190
refs/heads/master
2021-01-10T03:01:23.688469
2018-01-26T16:53:21
2018-01-26T16:53:21
55,531,005
0
0
null
null
null
null
UTF-8
Python
false
false
21,017
py
''' specfit.py - Definition of class for fitting linear combination of spectra. ''' ###################################################################### import os import numpy as np from astropy.io import fits as pyfits from astropysics import spec import scipy.ndimage.filters import scipy.interpolate import logging import scipy.constants from scipy.optimize import leastsq _c_kms = scipy.constants.c / 1.e3 # Speed of light in km s^-1 DF = -8.0 class SpecFit(): ################################################################## def __init__(self, nspec): ''' Initialize class. Input: nspec = Number of spectra that composes the observed spectra ''' # number of componentes self.nspec = nspec # Store template spectra and scale factor self.template = [[]] * nspec self.templateNames = [[]] * nspec self.templateScale = [[]] * nspec self.specgrid = [[]] * nspec # velocity for each component self.vel = np.zeros(nspec)+1. # scale factor for each component self.scale = [[]] * nspec # self.mcscale = pm.Uniform("scale", 0, 1, size=nspec) # template selected for each component self.ntemp = np.zeros(nspec, dtype=int) # template grid dimensions for each component self.grid_ndim = np.zeros(nspec, dtype=int) # Grids self.Grid = [[]] * nspec # store the observed spectra self.ospec = None self._autoprop = False ################################################################## def setAutoProp(self, value): self._autoprop = value ################################################################## def loadNextGenTemplate(self, ncomp, filename): ''' Loads template spectra from a list of files (in filename), for component ncomp. ''' splist = np.loadtxt(filename, unpack=True, usecols=(0,), dtype='S', ndmin=1) self.template[ncomp] = [0] * len(splist) self.templateScale[ncomp] = [1] * len(splist) logging.debug('Loading template spectra for component %i from %s[%i]' % (ncomp, filename, len(splist))) for i in range(len(splist)): logging.debug('Reading %s' % (splist[i])) sp = np.loadtxt(splist[i], unpack=True, usecols=(0, 1), converters={0: lambda s: float(s.replace('D', 'e')), 1: lambda s: float(s.replace('D', 'e'))}) asort = sp[0].argsort() self.template[ncomp][i] = spec.Spectrum(sp[0][asort], 10 ** (sp[1][asort]) + 8.0) return 0 ################################################################## def loadPickleTemplate(self, ncomp, filename): ''' Loads template spectra from a list of files (in filename), for component ncomp. ''' splist = np.loadtxt(filename, unpack=True, dtype='S', ndmin=2) if splist.shape[0] < self.grid_ndim[ncomp]: raise IOError('Grid dimensions is not consistent with expected. Expecting %i got %i.' % ( self.grid_ndim[ncomp], splist.shape[0])) self.template[ncomp] = [0] * len(splist[0]) self.templateNames[ncomp] = [0] * len(splist[0]) self.templateScale[ncomp] = [1] * len(splist[0]) # np.zeros(len(splist))+1.0 if self.grid_ndim[ncomp] > 0: grid = splist[1:self.grid_ndim[ncomp] + 1] gdim = np.zeros(self.grid_ndim[ncomp], dtype=np.int) for i in range(len(grid)): gdim[i] = len(np.unique(grid[i])) index = np.arange(len(splist[0])).reshape(gdim) self.Grid[ncomp] = index logging.debug('Loading template spectra for component %i from %s[%i]' % (ncomp, filename, len(splist))) for i in range(len(splist[0])): logging.debug('Reading %s' % (splist[0][i])) sp = np.load(splist[0][i]) self.template[ncomp][i] = spec.Spectrum(sp[0], sp[1]) self.templateNames[ncomp][i] = splist[0][i] return 0 ################################################################## def loadCoelhoTemplate(self, ncomp, filename): ''' Loads template spectra from a list of files (in filename), for component ncomp. ''' splist = np.loadtxt(filename, unpack=True, dtype='S', ndmin=2) if splist.shape[0] < self.grid_ndim[ncomp]: raise IOError('Grid dimensions is not consistent with expected. Expecting %i got %i.' % ( self.grid_ndim[ncomp], splist.shape[0])) self.template[ncomp] = [0] * len(splist[0]) self.templateNames[ncomp] = [0] * len(splist[0]) self.templateScale[ncomp] = [1] * len(splist[0]) if self.grid_ndim[ncomp] > 0: grid = splist[1:self.grid_ndim[ncomp] + 1] index = np.arange(len(splist[0])).reshape((len(np.unique(grid[0])), len(np.unique(grid[1])))) self.Grid[ncomp] = index logging.debug('Loading template spectra for component %i from %s[%i]' % (ncomp, filename, len(splist))) notFound = 0 for i in range(len(splist[0])): logging.debug('Reading %s' % (splist[0][i])) if os.path.exists(splist[0][i]): hdu = pyfits.open(splist[0][i]) wave = hdu[0].header['CRVAL1'] + np.arange(len(hdu[0].data)) * hdu[0].header['CDELT1'] self.template[ncomp][i] = spec.Spectrum(wave, hdu[0].data) self.templateNames[ncomp][i] = splist[0][i] else: logging.warning('Could not find template %s. %i/%i' % (splist[0][i], notFound, len(splist[0]))) notFound += 1 self.template[ncomp][i] = self.template[ncomp][i - 1] self.templateNames[ncomp][i] = splist[0][i] + "NOTFOUND" # sp = np.load(splist[0][i]) if notFound > len(splist[0]) / 2: raise IOError('More than 50% of template spectra could not be loaded') return 0 ################################################################## def loadPickle(self, filename, linearize=True): ''' Loads observed spectra from numpy pickle file. ''' logging.debug('Loading observed spectra for from %s' % (filename)) sp = np.load(filename) self.ospec = spec.Spectrum(sp[0], sp[1]) if linearize and not self.ospec.isLinear(): logging.debug('Linearizing observed spectra') self.ospec.linearize() logging.debug('Done') return 0 ################################################################## def loadtxtSpec(self, filename): ''' Load the observed spectra. ''' logging.debug('Loading observed spectra for from %s' % (filename)) sp = np.loadtxt(filename, unpack=True, usecols=(0, 1), converters={0: lambda s: float(s.replace('D', 'e')), 1: lambda s: float(s.replace('D', 'e'))}) self.ospec = spec.Spectrum(sp[0], sp[1]) return 0 ################################################################## def loadSDSSFits(self, filename, linearize=False): ''' Load the observed spectra. ''' logging.debug('Loading observed spectra for from %s' % (filename)) sp = pyfits.open(filename) mask = np.bitwise_and(sp[1].data['and_mask'] == 0, sp[1].data['or_mask'] == 0) self.ospec = spec.Spectrum(x=10 ** (sp[1].data['loglam'][mask]), flux=sp[1].data['flux'][mask], ivar=sp[1].data['ivar'][mask]) ''' if linearize and not self.ospec.isLinear(): logging.debug('Linearizing observed spectra') self.ospec.linearize() logging.debug('Done') ''' return 0 ################################################################## def gridSpec(self, ncomp=0): ''' Resample and grid template spectrum. :return: ''' # Use first spectrum as reference refspec = self.template[ncomp][0] specgrid = np.zeros((len(self.template[ncomp]), len(refspec.flux))) for i in range(len(specgrid)): specgrid[i] += self.template[ncomp][i].resample(refspec.x, replace=False)[1] * \ self.templateScale[ncomp][i] self.specgrid[ncomp] = specgrid self.scale[ncomp] = np.zeros(len(specgrid)).reshape(len(specgrid), -1) + 1. / len(specgrid) ################################################################## def chi2(self, p): ''' Calculate chi-square of the data against model. ''' for i in range(self.nspec): logging.debug('%f / %f' % (p[i], p[i + 1])) self.scale[i] = p[i * 2] self.vel[i] = p[i * 2 + 1] model = self.modelSpec() # c2 = np.mean( (self.ospec.flux - model.flux )**2.0 / self.ospec.flux) c2 = self.ospec.flux - model.flux return c2 ################################################################## def modelSpec(self): ''' Calculate model spectra. ''' # _model = self.template[0][self.ntemp[0]] # logging.debug('Building model spectra') dopCor = np.sqrt((1.0 + self.vel[0] / _c_kms) / (1. - self.vel[0] / _c_kms)) scale = self.scale[0][self.ntemp[0]] * self.templateScale[0][self.ntemp[0]] # print dopCor, scale, len(self.template[0][self.ntemp[0]].x), len(self.template[0][self.ntemp[0]].flux) # _model = MySpectrum(self.template[0][self.ntemp[0]].x * dopCor, # self.template[0][self.ntemp[0]].flux * scale) _model = MySpectrum(*MySpectrum(self.template[0][self.ntemp[0]].x * dopCor, self.template[0][self.ntemp[0]].flux * scale).myResample(self.ospec.x, replace=False)) # logging.debug('Applying instrument signature') # kernel = self.obsRes()/np.mean(_model.x[1:]-_model.x[:-1]) # _model.flux = scipy.ndimage.filters.gaussian_filter(_model.flux,kernel) for i in range(1, self.nspec): dopCor = np.sqrt((1.0 + self.vel[i] / _c_kms) / (1. - self.vel[i] / _c_kms)) scale = self.scale[i][self.ntemp[i]] * self.templateScale[i][self.ntemp[i]] # print dopCor, scale, len(self.template[i][self.ntemp[i]].x), len(self.template[i][self.ntemp[i]].flux) # tmp = MySpectrum(self.template[i][self.ntemp[i]].x * dopCor, # self.template[i][self.ntemp[i]].flux * scale) # logging.debug('Applying instrument signature') # kernel = self.obsRes()/np.mean(tmp.x[1:]-tmp.x[:-1]) # tmp.flux = scipy.ndimage.filters.gaussian_filter(tmp.flux,kernel) tmp = MySpectrum(*MySpectrum(self.template[i][self.ntemp[i]].x * dopCor, self.template[i][self.ntemp[i]].flux * scale).myResample(self.ospec.x, replace=False)) _model.flux += tmp.flux ''' if not _model.isLinear(): logging.warning('Data must be linearized...') ''' # kernel = self.obsRes()/tmp.getDx()/2./np.pi # _model.flux = scipy.ndimage.filters.gaussian_filter(_model.flux,kernel) # logging.debug('Resampling model spectra') # _model = MySpectrum(*_model.myResample(self.ospec.x, replace=False)) if self._autoprop: mflux = np.mean(_model.flux) oflux = np.mean(self.ospec.flux) _model.flux *= (oflux / mflux) return _model ################################################################## def modelSpecThreadSafe(self, vel, scale, ntemp): ''' Calculate model spectra. ''' # _model = self.template[0][self.ntemp[0]] logging.debug('Building model spectra') dopCor = np.sqrt((1.0 + vel[0] / _c_kms) / (1. - vel[0] / _c_kms)) scale = scale[0] * self.templateScale[0][ntemp[0]] _model = MySpectrum(self.template[0][ntemp[0]].x * dopCor, self.template[0][ntemp[0]].flux * scale) # logging.debug('Applying instrument signature') # kernel = self.obsRes()/np.mean(_model.x[1:]-_model.x[:-1]) # _model.flux = scipy.ndimage.filters.gaussian_filter(_model.flux,kernel) for i in range(1, self.nspec): dopCor = np.sqrt((1.0 + vel[i] / _c_kms) / (1. - vel[i] / _c_kms)) scale = scale[i] * self.templateScale[i][ntemp[i]] tmp = MySpectrum(self.template[i][ntemp[i]].x * dopCor, self.template[i][ntemp[i]].flux * scale) # logging.debug('Applying instrument signature') # kernel = self.obsRes()/np.mean(tmp.x[1:]-tmp.x[:-1]) # tmp.flux = scipy.ndimage.filters.gaussian_filter(tmp.flux,kernel) tmp = MySpectrum(*tmp.resample(_model.x, replace=False)) _model.flux += tmp.flux ''' if not _model.isLinear(): logging.warning('Data must be linearized...') ''' # kernel = self.obsRes()/tmp.getDx()/2./np.pi # _model.flux = scipy.ndimage.filters.gaussian_filter(_model.flux,kernel) logging.debug('Resampling model spectra') _model = MySpectrum(*_model.myResample(self.ospec.x, replace=False)) return _model ################################################################## def normTemplate(self, ncomp, w0, w1): ''' Normalize spectra against data in the wavelenght regions ''' for i in range(len(self.template[ncomp])): maskt = np.bitwise_and(self.template[ncomp][i].x > w0, self.template[ncomp][i].x < w1) mask0 = np.bitwise_and(self.ospec.x > w0, self.ospec.x < w1) scale = np.mean(self.ospec.flux[mask0]) / np.mean(self.template[ncomp][i].flux[maskt]) self.templateScale[ncomp][i] = scale # self.template[ncomp][i].flux *= scale ################################################################## def gaussian_filter(self, ncomp, kernel): for i in range(len(self.template[ncomp])): if not self.template[ncomp][i].isLinear(): logging.warning('Spectra must be linearized for gaussian filter...') self.template[ncomp][i].flux = scipy.ndimage.filters.gaussian_filter(self.template[ncomp][i].flux, kernel) ################################################################## def obsRes(self): return self.ospec.getDx() ################################################################## def preprocTemplate(self): ''' Pre-process all template spectra to have aproximate coordinates as those of the observed spectrum and linearize the spectrum. ''' logging.debug('Preprocessing all template spectra. Spectra will be trimmed and linearized') ores = self.obsRes() xmin = np.max([self.template[0][0].x[0], self.ospec.x[0] - 100.0 * ores]) xmax = np.min([self.template[0][0].x[-1], self.ospec.x[-1] + 100.0 * ores]) for i in range(self.nspec): for j in range(len(self.template[i])): # t_res = np.mean(self.template[i][j].x[1:]-self.template[i][j].x[:-1]) # newx = np.arange(xmin,xmax,t_res) # self.template[i][j] = spec.Spectrum(*self.template[i][j].resample(newx,replace=False)) self.template[i][j].linearize(lower=xmin, upper=xmax) tmp_spres = np.mean(self.template[i][j].x[1:] - self.template[i][j].x[:-1]) logging.debug('Template spres = %f' % (tmp_spres)) logging.debug('Data spres = %f' % (ores)) if tmp_spres < ores / 10.: logging.debug('Template spectroscopic resolution too high! Resampling...') newx = np.arange(xmin, xmax, ores / 10.) self.template[i][j] = spec.Spectrum(*self.template[i][j].resample(newx, replace=False)) ################################################################## def saveTemplates2Pickle(self, ncomp, filename): splist = np.loadtxt(filename, unpack=True, usecols=(0,), dtype='S', ndmin=1) logging.debug('Saving template spectra to pickle file...') for ntemp in range(len(self.template[ncomp])): logging.debug(splist[ntemp]) sp = np.array([self.template[ncomp][ntemp].x, self.template[ncomp][ntemp].flux]) np.save(splist[ntemp], sp) ################################################################## def suitableScale(self): ''' Find a suitable scale values for all spectra. ''' logging.debug('Looking for suitable scale in all spectra. Will choose the larger value.') obsmean = np.mean(self.ospec.flux) maxscale = 0. minscale = obsmean for i in range(len(self.template)): for j in range(len(self.template[i])): maskt = np.bitwise_and(self.template[i][j].x > self.ospec.x[0], self.template[i][j].x < self.ospec.x[-1]) nscale = obsmean / np.mean(self.template[i][j].flux[maskt]) / self.templateScale[i][j] if maxscale < nscale: maxscale = nscale if minscale > nscale: minscale = nscale return maxscale, minscale ################################################################## def fit(self): ''' Fit spectra with least square fit. ''' def score(p, x, y): for i in range(self.nspec): # self.vel[i] = p[i*self.nspec] # self.scale[i][self.ntemp[i]] = p[i*self.nspec+1] self.vel[i] = 0. self.scale[i][self.ntemp[i]] = p[i] return y-self.modelSpec().flux # pres, flag = leastsq(score, [self.vel[0], self.scale[0][self.ntemp[0]], # self.vel[1], self.scale[1][self.ntemp[1]]], # args=(self.ospec.x, self.ospec.flux)) pres, flag = leastsq(score, [self.scale[0][self.ntemp[0]], self.scale[1][self.ntemp[1]]], args=(self.ospec.x, self.ospec.flux)) return pres ###################################################################### class MySpectrum(spec.Spectrum): def __init__(self, x, flux, err=None, ivar=None, unit='wl', name='', copy=True, sort=True): spec.Spectrum.__init__(self, x=x, flux=flux, err=err, ivar=ivar, unit=unit, name=name, copy=copy, sort=sort) ################################################################## def myResample(self, newx, replace=False): ''' kernel = np.mean(newx[1:]-newx[:-1])/np.mean(self.x[1:]-self.x[:-1]) dx = self.x[1:]-self.x[:-1] newy = scipy.ndimage.filters.gaussian_filter(self.flux,np.float(kernel)) tck = scipy.interpolate.splrep(self.x,newy) newy2 =scipy.interpolate.splev(newx,tck) ''' kernel = np.median(newx[1:] - newx[:-1]) / np.median(self.x[1:] - self.x[:-1]) #*4.0 #/2./np.pi newflux = scipy.ndimage.filters.gaussian_filter1d(self.flux, kernel) tck = scipy.interpolate.splrep(self.x, newflux) return newx, scipy.interpolate.splev(newx, tck) ''' newy = np.zeros(len(newx)) for i in range(len(newx)): xini = 0 xend = 0 if i == 0: xini = newx[i]-(newx[i+1]-newx[i])/2. else: xini = newx[i]-(newx[i]-newx[i-1])/2. if i == len(newx)-1: xend = newx[i]+(newx[i]-newx[i-1])/2. else: xend = newx[i]+(newx[i+1]-newx[i])/2. mask = np.bitwise_and(self.x > xini, self.x < xend) #newy[i] = np.sum( dx[mask[:-1]] * self.flux[mask] ) newy[i] = np.mean(self.flux[mask]) #print newx[i],newy[i],newy2[i],xini,xend, (xend-xini) , np.mean(self.flux[mask]),(xend-xini) * np.mean(self.flux[mask]) #print self.x[mask],self.flux[mask],dx[mask[:-1]] return newx,newy #scipy.interpolate.splev(newx,tck) ''' ################################################################## ######################################################################
3457b968c513841139c83c974236b2c9dd12929f
6fa701cdaa0d83caa0d3cbffe39b40e54bf3d386
/google/cloud/osconfig/v1beta/osconfig-v1beta-py/google/cloud/osconfig_v1beta/types/guest_policies.py
73d3992d08302bf33d3654fb6f52a1d92e968832
[ "Apache-2.0" ]
permissive
oltoco/googleapis-gen
bf40cfad61b4217aca07068bd4922a86e3bbd2d5
00ca50bdde80906d6f62314ef4f7630b8cdb6e15
refs/heads/master
2023-07-17T22:11:47.848185
2021-08-29T20:39:47
2021-08-29T20:39:47
null
0
0
null
null
null
null
UTF-8
Python
false
false
43,173
py
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # import proto # type: ignore from google.protobuf import field_mask_pb2 # type: ignore from google.protobuf import timestamp_pb2 # type: ignore __protobuf__ = proto.module( package='google.cloud.osconfig.v1beta', manifest={ 'DesiredState', 'GuestPolicy', 'Assignment', 'Package', 'AptRepository', 'YumRepository', 'ZypperRepository', 'GooRepository', 'PackageRepository', 'SoftwareRecipe', 'CreateGuestPolicyRequest', 'GetGuestPolicyRequest', 'ListGuestPoliciesRequest', 'ListGuestPoliciesResponse', 'UpdateGuestPolicyRequest', 'DeleteGuestPolicyRequest', 'LookupEffectiveGuestPolicyRequest', 'EffectiveGuestPolicy', }, ) class DesiredState(proto.Enum): r"""The desired state that the OS Config agent maintains on the VM instance. """ DESIRED_STATE_UNSPECIFIED = 0 INSTALLED = 1 UPDATED = 2 REMOVED = 3 class GuestPolicy(proto.Message): r"""An OS Config resource representing a guest configuration policy. These policies represent the desired state for VM instance guest environments including packages to install or remove, package repository configurations, and software to install. Attributes: name (str): Required. Unique name of the resource in this project using one of the following forms: ``projects/{project_number}/guestPolicies/{guest_policy_id}``. description (str): Description of the guest policy. Length of the description is limited to 1024 characters. create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time this guest policy was created. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Last time this guest policy was updated. assignment (google.cloud.osconfig_v1beta.types.Assignment): Required. Specifies the VM instances that are assigned to this policy. This allows you to target sets or groups of VM instances by different parameters such as labels, names, OS, or zones. If left empty, all VM instances underneath this policy are targeted. At the same level in the resource hierarchy (that is within a project), the service prevents the creation of multiple policies that conflict with each other. For more information, see how the service `handles assignment conflicts </compute/docs/os-config-management/create-guest-policy#handle-conflicts>`__. packages (Sequence[google.cloud.osconfig_v1beta.types.Package]): The software packages to be managed by this policy. package_repositories (Sequence[google.cloud.osconfig_v1beta.types.PackageRepository]): A list of package repositories to configure on the VM instance. This is done before any other configs are applied so they can use these repos. Package repositories are only configured if the corresponding package manager(s) are available. recipes (Sequence[google.cloud.osconfig_v1beta.types.SoftwareRecipe]): A list of Recipes to install on the VM instance. etag (str): The etag for this guest policy. If this is provided on update, it must match the server's etag. """ name = proto.Field( proto.STRING, number=1, ) description = proto.Field( proto.STRING, number=2, ) create_time = proto.Field( proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp, ) update_time = proto.Field( proto.MESSAGE, number=4, message=timestamp_pb2.Timestamp, ) assignment = proto.Field( proto.MESSAGE, number=6, message='Assignment', ) packages = proto.RepeatedField( proto.MESSAGE, number=7, message='Package', ) package_repositories = proto.RepeatedField( proto.MESSAGE, number=8, message='PackageRepository', ) recipes = proto.RepeatedField( proto.MESSAGE, number=9, message='SoftwareRecipe', ) etag = proto.Field( proto.STRING, number=10, ) class Assignment(proto.Message): r"""An assignment represents the group or groups of VM instances that the policy applies to. If an assignment is empty, it applies to all VM instances. Otherwise, the targeted VM instances must meet all the criteria specified. So if both labels and zones are specified, the policy applies to VM instances with those labels and in those zones. Attributes: group_labels (Sequence[google.cloud.osconfig_v1beta.types.Assignment.GroupLabel]): Targets instances matching at least one of these label sets. This allows an assignment to target disparate groups, for example "env=prod or env=staging". zones (Sequence[str]): Targets instances in any of these zones. Leave empty to target instances in any zone. Zonal targeting is uncommon and is supported to facilitate the management of changes by zone. instances (Sequence[str]): Targets any of the instances specified. Instances are specified by their URI in the form ``zones/[ZONE]/instances/[INSTANCE_NAME]``. Instance targeting is uncommon and is supported to facilitate the management of changes by the instance or to target specific VM instances for development and testing. Only supported for project-level policies and must reference instances within this project. instance_name_prefixes (Sequence[str]): Targets VM instances whose name starts with one of these prefixes. Like labels, this is another way to group VM instances when targeting configs, for example prefix="prod-". Only supported for project-level policies. os_types (Sequence[google.cloud.osconfig_v1beta.types.Assignment.OsType]): Targets VM instances matching at least one of the following OS types. VM instances must match all supplied criteria for a given OsType to be included. """ class GroupLabel(proto.Message): r"""Represents a group of VM intances that can be identified as having all these labels, for example "env=prod and app=web". Attributes: labels (Sequence[google.cloud.osconfig_v1beta.types.Assignment.GroupLabel.LabelsEntry]): Google Compute Engine instance labels that must be present for an instance to be included in this assignment group. """ labels = proto.MapField( proto.STRING, proto.STRING, number=1, ) class OsType(proto.Message): r"""Defines the criteria for selecting VM Instances by OS type. Attributes: os_short_name (str): Targets VM instances with OS Inventory enabled and having the following OS short name, for example "debian" or "windows". os_version (str): Targets VM instances with OS Inventory enabled and having the following following OS version. os_architecture (str): Targets VM instances with OS Inventory enabled and having the following OS architecture. """ os_short_name = proto.Field( proto.STRING, number=1, ) os_version = proto.Field( proto.STRING, number=2, ) os_architecture = proto.Field( proto.STRING, number=3, ) group_labels = proto.RepeatedField( proto.MESSAGE, number=1, message=GroupLabel, ) zones = proto.RepeatedField( proto.STRING, number=2, ) instances = proto.RepeatedField( proto.STRING, number=3, ) instance_name_prefixes = proto.RepeatedField( proto.STRING, number=4, ) os_types = proto.RepeatedField( proto.MESSAGE, number=5, message=OsType, ) class Package(proto.Message): r"""Package is a reference to the software package to be installed or removed. The agent on the VM instance uses the system package manager to apply the config. These are the commands that the agent uses to install or remove packages. Apt install: ``apt-get update && apt-get -y install package1 package2 package3`` remove: ``apt-get -y remove package1 package2 package3`` Yum install: ``yum -y install package1 package2 package3`` remove: ``yum -y remove package1 package2 package3`` Zypper install: ``zypper install package1 package2 package3`` remove: ``zypper rm package1 package2`` Googet install: ``googet -noconfirm install package1 package2 package3`` remove: ``googet -noconfirm remove package1 package2 package3`` Attributes: name (str): Required. The name of the package. A package is uniquely identified for conflict validation by checking the package name and the manager(s) that the package targets. desired_state (google.cloud.osconfig_v1beta.types.DesiredState): The desired_state the agent should maintain for this package. The default is to ensure the package is installed. manager (google.cloud.osconfig_v1beta.types.Package.Manager): Type of package manager that can be used to install this package. If a system does not have the package manager, the package is not installed or removed no error message is returned. By default, or if you specify ``ANY``, the agent attempts to install and remove this package using the default package manager. This is useful when creating a policy that applies to different types of systems. The default behavior is ANY. """ class Manager(proto.Enum): r"""Types of package managers that may be used to manage this package. """ MANAGER_UNSPECIFIED = 0 ANY = 1 APT = 2 YUM = 3 ZYPPER = 4 GOO = 5 name = proto.Field( proto.STRING, number=1, ) desired_state = proto.Field( proto.ENUM, number=2, enum='DesiredState', ) manager = proto.Field( proto.ENUM, number=3, enum=Manager, ) class AptRepository(proto.Message): r"""Represents a single Apt package repository. This repository is added to a repo file that is stored at ``/etc/apt/sources.list.d/google_osconfig.list``. Attributes: archive_type (google.cloud.osconfig_v1beta.types.AptRepository.ArchiveType): Type of archive files in this repository. The default behavior is DEB. uri (str): Required. URI for this repository. distribution (str): Required. Distribution of this repository. components (Sequence[str]): Required. List of components for this repository. Must contain at least one item. gpg_key (str): URI of the key file for this repository. The agent maintains a keyring at ``/etc/apt/trusted.gpg.d/osconfig_agent_managed.gpg`` containing all the keys in any applied guest policy. """ class ArchiveType(proto.Enum): r"""Type of archive.""" ARCHIVE_TYPE_UNSPECIFIED = 0 DEB = 1 DEB_SRC = 2 archive_type = proto.Field( proto.ENUM, number=1, enum=ArchiveType, ) uri = proto.Field( proto.STRING, number=2, ) distribution = proto.Field( proto.STRING, number=3, ) components = proto.RepeatedField( proto.STRING, number=4, ) gpg_key = proto.Field( proto.STRING, number=5, ) class YumRepository(proto.Message): r"""Represents a single Yum package repository. This repository is added to a repo file that is stored at ``/etc/yum.repos.d/google_osconfig.repo``. Attributes: id (str): Required. A one word, unique name for this repository. This is the ``repo id`` in the Yum config file and also the ``display_name`` if ``display_name`` is omitted. This id is also used as the unique identifier when checking for guest policy conflicts. display_name (str): The display name of the repository. base_url (str): Required. The location of the repository directory. gpg_keys (Sequence[str]): URIs of GPG keys. """ id = proto.Field( proto.STRING, number=1, ) display_name = proto.Field( proto.STRING, number=2, ) base_url = proto.Field( proto.STRING, number=3, ) gpg_keys = proto.RepeatedField( proto.STRING, number=4, ) class ZypperRepository(proto.Message): r"""Represents a single Zypper package repository. This repository is added to a repo file that is stored at ``/etc/zypp/repos.d/google_osconfig.repo``. Attributes: id (str): Required. A one word, unique name for this repository. This is the ``repo id`` in the zypper config file and also the ``display_name`` if ``display_name`` is omitted. This id is also used as the unique identifier when checking for guest policy conflicts. display_name (str): The display name of the repository. base_url (str): Required. The location of the repository directory. gpg_keys (Sequence[str]): URIs of GPG keys. """ id = proto.Field( proto.STRING, number=1, ) display_name = proto.Field( proto.STRING, number=2, ) base_url = proto.Field( proto.STRING, number=3, ) gpg_keys = proto.RepeatedField( proto.STRING, number=4, ) class GooRepository(proto.Message): r"""Represents a Goo package repository. These is added to a repo file that is stored at C:/ProgramData/GooGet/repos/google_osconfig.repo. Attributes: name (str): Required. The name of the repository. url (str): Required. The url of the repository. """ name = proto.Field( proto.STRING, number=1, ) url = proto.Field( proto.STRING, number=2, ) class PackageRepository(proto.Message): r"""A package repository. Attributes: apt (google.cloud.osconfig_v1beta.types.AptRepository): An Apt Repository. yum (google.cloud.osconfig_v1beta.types.YumRepository): A Yum Repository. zypper (google.cloud.osconfig_v1beta.types.ZypperRepository): A Zypper Repository. goo (google.cloud.osconfig_v1beta.types.GooRepository): A Goo Repository. """ apt = proto.Field( proto.MESSAGE, number=1, oneof='repository', message='AptRepository', ) yum = proto.Field( proto.MESSAGE, number=2, oneof='repository', message='YumRepository', ) zypper = proto.Field( proto.MESSAGE, number=3, oneof='repository', message='ZypperRepository', ) goo = proto.Field( proto.MESSAGE, number=4, oneof='repository', message='GooRepository', ) class SoftwareRecipe(proto.Message): r"""A software recipe is a set of instructions for installing and configuring a piece of software. It consists of a set of artifacts that are downloaded, and a set of steps that install, configure, and/or update the software. Recipes support installing and updating software from artifacts in the following formats: Zip archive, Tar archive, Windows MSI, Debian package, and RPM package. Additionally, recipes support executing a script (either defined in a file or directly in this api) in bash, sh, cmd, and powershell. Updating a software recipe If a recipe is assigned to an instance and there is a recipe with the same name but a lower version already installed and the assigned state of the recipe is ``INSTALLED_KEEP_UPDATED``, then the recipe is updated to the new version. Script Working Directories Each script or execution step is run in its own temporary directory which is deleted after completing the step. Attributes: name (str): Required. Unique identifier for the recipe. Only one recipe with a given name is installed on an instance. Names are also used to identify resources which helps to determine whether guest policies have conflicts. This means that requests to create multiple recipes with the same name and version are rejected since they could potentially have conflicting assignments. version (str): The version of this software recipe. Version can be up to 4 period separated numbers (e.g. 12.34.56.78). artifacts (Sequence[google.cloud.osconfig_v1beta.types.SoftwareRecipe.Artifact]): Resources available to be used in the steps in the recipe. install_steps (Sequence[google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step]): Actions to be taken for installing this recipe. On failure it stops executing steps and does not attempt another installation. Any steps taken (including partially completed steps) are not rolled back. update_steps (Sequence[google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step]): Actions to be taken for updating this recipe. On failure it stops executing steps and does not attempt another update for this recipe. Any steps taken (including partially completed steps) are not rolled back. desired_state (google.cloud.osconfig_v1beta.types.DesiredState): Default is INSTALLED. The desired state the agent should maintain for this recipe. INSTALLED: The software recipe is installed on the instance but won't be updated to new versions. INSTALLED_KEEP_UPDATED: The software recipe is installed on the instance. The recipe is updated to a higher version, if a higher version of the recipe is assigned to this instance. REMOVE: Remove is unsupported for software recipes and attempts to create or update a recipe to the REMOVE state is rejected. """ class Artifact(proto.Message): r"""Specifies a resource to be used in the recipe. Attributes: id (str): Required. Id of the artifact, which the installation and update steps of this recipe can reference. Artifacts in a recipe cannot have the same id. remote (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Artifact.Remote): A generic remote artifact. gcs (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Artifact.Gcs): A Google Cloud Storage artifact. allow_insecure (bool): Defaults to false. When false, recipes are subject to validations based on the artifact type: Remote: A checksum must be specified, and only protocols with transport-layer security are permitted. GCS: An object generation number must be specified. """ class Remote(proto.Message): r"""Specifies an artifact available via some URI. Attributes: uri (str): URI from which to fetch the object. It should contain both the protocol and path following the format {protocol}://{location}. checksum (str): Must be provided if ``allow_insecure`` is ``false``. SHA256 checksum in hex format, to compare to the checksum of the artifact. If the checksum is not empty and it doesn't match the artifact then the recipe installation fails before running any of the steps. """ uri = proto.Field( proto.STRING, number=1, ) checksum = proto.Field( proto.STRING, number=2, ) class Gcs(proto.Message): r"""Specifies an artifact available as a Google Cloud Storage object. Attributes: bucket (str): Bucket of the Google Cloud Storage object. Given an example URL: ``https://storage.googleapis.com/my-bucket/foo/bar#1234567`` this value would be ``my-bucket``. object_ (str): Name of the Google Cloud Storage object. As specified [here] (https://cloud.google.com/storage/docs/naming#objectnames) Given an example URL: ``https://storage.googleapis.com/my-bucket/foo/bar#1234567`` this value would be ``foo/bar``. generation (int): Must be provided if allow_insecure is false. Generation number of the Google Cloud Storage object. ``https://storage.googleapis.com/my-bucket/foo/bar#1234567`` this value would be ``1234567``. """ bucket = proto.Field( proto.STRING, number=1, ) object_ = proto.Field( proto.STRING, number=2, ) generation = proto.Field( proto.INT64, number=3, ) id = proto.Field( proto.STRING, number=1, ) remote = proto.Field( proto.MESSAGE, number=2, oneof='artifact', message='SoftwareRecipe.Artifact.Remote', ) gcs = proto.Field( proto.MESSAGE, number=3, oneof='artifact', message='SoftwareRecipe.Artifact.Gcs', ) allow_insecure = proto.Field( proto.BOOL, number=4, ) class Step(proto.Message): r"""An action that can be taken as part of installing or updating a recipe. Attributes: file_copy (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step.CopyFile): Copies a file onto the instance. archive_extraction (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step.ExtractArchive): Extracts an archive into the specified directory. msi_installation (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step.InstallMsi): Installs an MSI file. dpkg_installation (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step.InstallDpkg): Installs a deb file via dpkg. rpm_installation (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step.InstallRpm): Installs an rpm file via the rpm utility. file_exec (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step.ExecFile): Executes an artifact or local file. script_run (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step.RunScript): Runs commands in a shell. """ class CopyFile(proto.Message): r"""Copies the artifact to the specified path on the instance. Attributes: artifact_id (str): Required. The id of the relevant artifact in the recipe. destination (str): Required. The absolute path on the instance to put the file. overwrite (bool): Whether to allow this step to overwrite existing files. If this is false and the file already exists the file is not overwritten and the step is considered a success. Defaults to false. permissions (str): Consists of three octal digits which represent, in order, the permissions of the owner, group, and other users for the file (similarly to the numeric mode used in the linux chmod utility). Each digit represents a three bit number with the 4 bit corresponding to the read permissions, the 2 bit corresponds to the write bit, and the one bit corresponds to the execute permission. Default behavior is 755. Below are some examples of permissions and their associated values: read, write, and execute: 7 read and execute: 5 read and write: 6 read only: 4 """ artifact_id = proto.Field( proto.STRING, number=1, ) destination = proto.Field( proto.STRING, number=2, ) overwrite = proto.Field( proto.BOOL, number=3, ) permissions = proto.Field( proto.STRING, number=4, ) class ExtractArchive(proto.Message): r"""Extracts an archive of the type specified in the specified directory. Attributes: artifact_id (str): Required. The id of the relevant artifact in the recipe. destination (str): Directory to extract archive to. Defaults to ``/`` on Linux or ``C:\`` on Windows. type_ (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step.ExtractArchive.ArchiveType): Required. The type of the archive to extract. """ class ArchiveType(proto.Enum): r"""Specifying the type of archive.""" ARCHIVE_TYPE_UNSPECIFIED = 0 TAR = 1 TAR_GZIP = 2 TAR_BZIP = 3 TAR_LZMA = 4 TAR_XZ = 5 ZIP = 11 artifact_id = proto.Field( proto.STRING, number=1, ) destination = proto.Field( proto.STRING, number=2, ) type_ = proto.Field( proto.ENUM, number=3, enum='SoftwareRecipe.Step.ExtractArchive.ArchiveType', ) class InstallMsi(proto.Message): r"""Installs an MSI file. Attributes: artifact_id (str): Required. The id of the relevant artifact in the recipe. flags (Sequence[str]): The flags to use when installing the MSI defaults to ["/i"] (i.e. the install flag). allowed_exit_codes (Sequence[int]): Return codes that indicate that the software installed or updated successfully. Behaviour defaults to [0] """ artifact_id = proto.Field( proto.STRING, number=1, ) flags = proto.RepeatedField( proto.STRING, number=2, ) allowed_exit_codes = proto.RepeatedField( proto.INT32, number=3, ) class InstallDpkg(proto.Message): r"""Installs a deb via dpkg. Attributes: artifact_id (str): Required. The id of the relevant artifact in the recipe. """ artifact_id = proto.Field( proto.STRING, number=1, ) class InstallRpm(proto.Message): r"""Installs an rpm file via the rpm utility. Attributes: artifact_id (str): Required. The id of the relevant artifact in the recipe. """ artifact_id = proto.Field( proto.STRING, number=1, ) class ExecFile(proto.Message): r"""Executes an artifact or local file. Attributes: artifact_id (str): The id of the relevant artifact in the recipe. local_path (str): The absolute path of the file on the local filesystem. args (Sequence[str]): Arguments to be passed to the provided executable. allowed_exit_codes (Sequence[int]): Defaults to [0]. A list of possible return values that the program can return to indicate a success. """ artifact_id = proto.Field( proto.STRING, number=1, oneof='location_type', ) local_path = proto.Field( proto.STRING, number=2, oneof='location_type', ) args = proto.RepeatedField( proto.STRING, number=3, ) allowed_exit_codes = proto.RepeatedField( proto.INT32, number=4, ) class RunScript(proto.Message): r"""Runs a script through an interpreter. Attributes: script (str): Required. The shell script to be executed. allowed_exit_codes (Sequence[int]): Return codes that indicate that the software installed or updated successfully. Behaviour defaults to [0] interpreter (google.cloud.osconfig_v1beta.types.SoftwareRecipe.Step.RunScript.Interpreter): The script interpreter to use to run the script. If no interpreter is specified the script is executed directly, which likely only succeed for scripts with `shebang lines <https://en.wikipedia.org/wiki/Shebang_(Unix)>`__. """ class Interpreter(proto.Enum): r"""The interpreter used to execute a script.""" INTERPRETER_UNSPECIFIED = 0 SHELL = 1 POWERSHELL = 3 script = proto.Field( proto.STRING, number=1, ) allowed_exit_codes = proto.RepeatedField( proto.INT32, number=2, ) interpreter = proto.Field( proto.ENUM, number=3, enum='SoftwareRecipe.Step.RunScript.Interpreter', ) file_copy = proto.Field( proto.MESSAGE, number=1, oneof='step', message='SoftwareRecipe.Step.CopyFile', ) archive_extraction = proto.Field( proto.MESSAGE, number=2, oneof='step', message='SoftwareRecipe.Step.ExtractArchive', ) msi_installation = proto.Field( proto.MESSAGE, number=3, oneof='step', message='SoftwareRecipe.Step.InstallMsi', ) dpkg_installation = proto.Field( proto.MESSAGE, number=4, oneof='step', message='SoftwareRecipe.Step.InstallDpkg', ) rpm_installation = proto.Field( proto.MESSAGE, number=5, oneof='step', message='SoftwareRecipe.Step.InstallRpm', ) file_exec = proto.Field( proto.MESSAGE, number=6, oneof='step', message='SoftwareRecipe.Step.ExecFile', ) script_run = proto.Field( proto.MESSAGE, number=7, oneof='step', message='SoftwareRecipe.Step.RunScript', ) name = proto.Field( proto.STRING, number=1, ) version = proto.Field( proto.STRING, number=2, ) artifacts = proto.RepeatedField( proto.MESSAGE, number=3, message=Artifact, ) install_steps = proto.RepeatedField( proto.MESSAGE, number=4, message=Step, ) update_steps = proto.RepeatedField( proto.MESSAGE, number=5, message=Step, ) desired_state = proto.Field( proto.ENUM, number=6, enum='DesiredState', ) class CreateGuestPolicyRequest(proto.Message): r"""A request message for creating a guest policy. Attributes: parent (str): Required. The resource name of the parent using one of the following forms: ``projects/{project_number}``. guest_policy_id (str): Required. The logical name of the guest policy in the project with the following restrictions: - Must contain only lowercase letters, numbers, and hyphens. - Must start with a letter. - Must be between 1-63 characters. - Must end with a number or a letter. - Must be unique within the project. guest_policy (google.cloud.osconfig_v1beta.types.GuestPolicy): Required. The GuestPolicy to create. """ parent = proto.Field( proto.STRING, number=1, ) guest_policy_id = proto.Field( proto.STRING, number=2, ) guest_policy = proto.Field( proto.MESSAGE, number=3, message='GuestPolicy', ) class GetGuestPolicyRequest(proto.Message): r"""A request message for retrieving a guest policy. Attributes: name (str): Required. The resource name of the guest policy using one of the following forms: ``projects/{project_number}/guestPolicies/{guest_policy_id}``. """ name = proto.Field( proto.STRING, number=1, ) class ListGuestPoliciesRequest(proto.Message): r"""A request message for listing guest policies. Attributes: parent (str): Required. The resource name of the parent using one of the following forms: ``projects/{project_number}``. page_size (int): The maximum number of guest policies to return. page_token (str): A pagination token returned from a previous call to ``ListGuestPolicies`` that indicates where this listing should continue from. """ parent = proto.Field( proto.STRING, number=1, ) page_size = proto.Field( proto.INT32, number=2, ) page_token = proto.Field( proto.STRING, number=3, ) class ListGuestPoliciesResponse(proto.Message): r"""A response message for listing guest policies. Attributes: guest_policies (Sequence[google.cloud.osconfig_v1beta.types.GuestPolicy]): The list of GuestPolicies. next_page_token (str): A pagination token that can be used to get the next page of guest policies. """ @property def raw_page(self): return self guest_policies = proto.RepeatedField( proto.MESSAGE, number=1, message='GuestPolicy', ) next_page_token = proto.Field( proto.STRING, number=2, ) class UpdateGuestPolicyRequest(proto.Message): r"""A request message for updating a guest policy. Attributes: guest_policy (google.cloud.osconfig_v1beta.types.GuestPolicy): Required. The updated GuestPolicy. update_mask (google.protobuf.field_mask_pb2.FieldMask): Field mask that controls which fields of the guest policy should be updated. """ guest_policy = proto.Field( proto.MESSAGE, number=1, message='GuestPolicy', ) update_mask = proto.Field( proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, ) class DeleteGuestPolicyRequest(proto.Message): r"""A request message for deleting a guest policy. Attributes: name (str): Required. The resource name of the guest policy using one of the following forms: ``projects/{project_number}/guestPolicies/{guest_policy_id}``. """ name = proto.Field( proto.STRING, number=1, ) class LookupEffectiveGuestPolicyRequest(proto.Message): r"""A request message for getting the effective guest policy assigned to the instance. Attributes: instance (str): Required. The VM instance whose policies are being looked up. os_short_name (str): Short name of the OS running on the instance. The OS Config agent only provides this field for targeting if OS Inventory is enabled for that instance. os_version (str): Version of the OS running on the instance. The OS Config agent only provides this field for targeting if OS Inventory is enabled for that VM instance. os_architecture (str): Architecture of OS running on the instance. The OS Config agent only provides this field for targeting if OS Inventory is enabled for that instance. """ instance = proto.Field( proto.STRING, number=1, ) os_short_name = proto.Field( proto.STRING, number=2, ) os_version = proto.Field( proto.STRING, number=3, ) os_architecture = proto.Field( proto.STRING, number=4, ) class EffectiveGuestPolicy(proto.Message): r"""The effective guest policy that applies to a VM instance. Attributes: packages (Sequence[google.cloud.osconfig_v1beta.types.EffectiveGuestPolicy.SourcedPackage]): List of package configurations assigned to the VM instance. package_repositories (Sequence[google.cloud.osconfig_v1beta.types.EffectiveGuestPolicy.SourcedPackageRepository]): List of package repository configurations assigned to the VM instance. software_recipes (Sequence[google.cloud.osconfig_v1beta.types.EffectiveGuestPolicy.SourcedSoftwareRecipe]): List of recipes assigned to the VM instance. """ class SourcedPackage(proto.Message): r"""A guest policy package including its source. Attributes: source (str): Name of the guest policy providing this config. package (google.cloud.osconfig_v1beta.types.Package): A software package to configure on the VM instance. """ source = proto.Field( proto.STRING, number=1, ) package = proto.Field( proto.MESSAGE, number=2, message='Package', ) class SourcedPackageRepository(proto.Message): r"""A guest policy package repository including its source. Attributes: source (str): Name of the guest policy providing this config. package_repository (google.cloud.osconfig_v1beta.types.PackageRepository): A software package repository to configure on the VM instance. """ source = proto.Field( proto.STRING, number=1, ) package_repository = proto.Field( proto.MESSAGE, number=2, message='PackageRepository', ) class SourcedSoftwareRecipe(proto.Message): r"""A guest policy recipe including its source. Attributes: source (str): Name of the guest policy providing this config. software_recipe (google.cloud.osconfig_v1beta.types.SoftwareRecipe): A software recipe to configure on the VM instance. """ source = proto.Field( proto.STRING, number=1, ) software_recipe = proto.Field( proto.MESSAGE, number=2, message='SoftwareRecipe', ) packages = proto.RepeatedField( proto.MESSAGE, number=1, message=SourcedPackage, ) package_repositories = proto.RepeatedField( proto.MESSAGE, number=2, message=SourcedPackageRepository, ) software_recipes = proto.RepeatedField( proto.MESSAGE, number=3, message=SourcedSoftwareRecipe, ) __all__ = tuple(sorted(__protobuf__.manifest))
[ "bazel-bot-development[bot]@users.noreply.github.com" ]
bazel-bot-development[bot]@users.noreply.github.com
31dc1f3924315bd72d97753b74206b70b996dfb7
06b5b8c697357816a14a2fecb59d5f5bee9f88e4
/giza/giza/operations/build_env.py
44b53719b7c589942662f8ac10447e1c6ad44a12
[]
no_license
mongodb-china/docs-tools
6cc7d13fa7127b93a1adde380e73ad34ef883903
8698bba575c028d5a53ae75ff40da15d57c71af9
refs/heads/master
2020-06-11T15:03:43.837471
2016-12-10T07:57:31
2016-12-10T07:57:31
75,642,928
0
0
null
2016-12-05T16:09:54
2016-12-05T16:09:53
null
UTF-8
Python
false
false
7,571
py
# Copyright 2015 MongoDB, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import datetime import logging import os import tarfile import tempfile import contextlib import argh import libgiza.task from libgiza.app import BuildApp from sphinx.application import Sphinx, ENV_PICKLE_FILENAME from sphinx.builders.html import get_stable_hash from giza.config.helper import fetch_config, get_builder_jobs from giza.config.sphinx_config import avalible_sphinx_builders from giza.operations.packaging import fetch_package from giza.tools.files import safe_create_directory, FileNotFoundError logger = logging.getLogger('giza.operations.build_env') # Helpers @contextlib.contextmanager def cd(path): cur_dir = os.getcwd() os.chdir(path) yield os.chdir(cur_dir) def is_git_dir(path): git_dir = ''.join([os.path.sep, '.git', os.path.sep]) if git_dir in path: return True else: return False def extract_package_at_root(path, conf): with cd(conf.paths.projectroot): with tarfile.open(path, "r:gz") as t: t.extractall() def get_existing_builders(conf): return [b for b in avalible_sphinx_builders() if os.path.isdir(os.path.join(conf.paths.projectroot, conf.paths.branch_output, b))] def env_package_worker(args, conf): # used by the make interface package_build_env(args.builder, args.editions_to_build, args.languages_to_build, conf) # Core Workers def package_build_env(builders, editions, languages, conf): arc_fn = '-'.join(['cache', conf.project.name, conf.git.branches.current, datetime.datetime.utcnow().strftime('%s'), conf.git.commit[:8]]) + ".tar.gz" archive_path = os.path.join(conf.paths.buildarchive, arc_fn) safe_create_directory(conf.paths.buildarchive) existing_archives = os.listdir(conf.paths.buildarchive) for arc in existing_archives: if conf.git.commit[:8] in arc: m = 'archive "{0}" exists for current git hash, not recreating' logger.warning(m.format(archive_path)) return logger.debug("no archive for commit '{0}' continuing".format(conf.git.commit)) with cd(conf.paths.projectroot): files_to_archive = set() for ((edition, language, builder), (rconf, sconf)) in get_builder_jobs(conf): files_to_archive.add(rconf.paths.branch_source) files_to_archive.add(os.path.join(rconf.paths.branch_output, sconf.build_output)) files_to_archive.add(os.path.join(rconf.paths.branch_output, '-'.join(('doctrees', sconf.build_output)))) files_to_archive.add(rconf.system.dependency_cache_fn) files_to_archive = list(files_to_archive) logger.info('prepped build cache archive. writing file now.') for fn in files_to_archive: if not os.path.exists(fn): raise FileNotFoundError(fn) try: with tarfile.open(archive_path, 'w:gz') as t: for fn in files_to_archive: t.add(fn, exclude=is_git_dir) logger.info("created build-cache archive: " + archive_path) except Exception as e: os.remove(archive_path) logger.critical("failed to create archive: " + archive_path) logger.error(e) def fix_build_env(builder, conf): """ Given a builder name and the conf object, this function fixes the build artifacts for the current build to prevent a full rebuild. Currently re-pickles the environment and dumps the ``.buildinfo`` file in the build directory with the correct hashes. """ fn = os.path.join(conf.paths.projectroot, conf.paths.branch_output, builder, '.buildinfo') logger.info('updating cache for: ' + builder) if not os.path.isfile(fn): return doctree_dir = os.path.join(conf.paths.projectroot, conf.paths.branch_output, "doctrees-" + builder) sphinx_app = Sphinx(srcdir=os.path.join(conf.paths.projectroot, conf.paths.branch_output, "source"), confdir=conf.paths.projectroot, outdir=os.path.join(conf.paths.projectroot, conf.paths.branch_output, builder), doctreedir=doctree_dir, buildername=builder, status=tempfile.NamedTemporaryFile(), warning=tempfile.NamedTemporaryFile()) sphinx_app.env.topickle(os.path.join(doctree_dir, ENV_PICKLE_FILENAME)) with open(fn, 'r') as f: lns = f.readlines() tags_hash_ln = None for ln in lns: if ln.startswith('tags'): tags_hash_ln = ln break if tags_hash_ln is None: tags_hash_ln = 'tags: ' + get_stable_hash(sorted(sphinx_app.tags)) with open(fn, 'w') as f: config_dict = dict((name, sphinx_app.config[name]) for (name, desc) in sphinx_app.config.values.items() if desc[1] == 'html') f.write('# Sphinx build info version 1') f.write('\n\n') # current format requires an extra line here. f.write('config: ' + get_stable_hash(config_dict)) f.write('\n') f.write(tags_hash_ln) f.write('\n') # Task Creators def fix_build_env_tasks(builders, conf): tasks = [] message = "fix up sphinx environment for builder '{0}'" for builder in builders: t = libgiza.task.Task(job=fix_build_env, args=(builder, conf), target=True, dependency=None, description=message.format(builder)) tasks.append(t) return tasks # Entry Points @argh.arg('--edition', '-e', nargs='*', dest='editions_to_build') @argh.arg('--language', '-l', nargs='*', dest='languages_to_build') @argh.arg('--builder', '-b', nargs='*', default='html') @argh.expects_obj def package(args): conf = fetch_config(args) package_build_env(builders=conf.runstate.builder, editions=conf.runstate.editions_to_build, languages=conf.runstate.languages_to_build, conf=conf) @argh.arg('--path', '-p', default=None, dest='_path') @argh.expects_obj def extract(args): conf = fetch_config(args) with BuildApp.new(pool_type=conf.runstate.runner, pool_size=conf.runstate.pool_size, force=conf.runstate.force).context() as app: path = fetch_package(conf.runstate._path, conf) extract_package_at_root(path, conf) builders = get_existing_builders(conf) app.extend_queue(fix_build_env_tasks(builders, conf))
67ce35bd50b83f173aadc268fddc77101db67226
c9bc27f70a4bca5ce6acf346bfc25b5407502d00
/ATIVIDADE G - FÁBIO 2a - CONDICIONAIS/fabio2a_q08.py
8ca044177565336546e83029c1d7bc253d3dad98
[]
no_license
lucascoelho33/ifpi-ads-algoritmos2020
2197bbc84ce9c027b3f1da006728448a846d7ffb
1ce20a489adbfe7321817acd98d35f2efc0360ca
refs/heads/master
2021-03-01T23:03:10.293013
2020-10-17T14:35:19
2020-10-17T14:35:19
245,650,273
0
0
null
null
null
null
UTF-8
Python
false
false
612
py
#8. Leia data atual (dia, mês e ano) e data de nascimento (dia, mês e ano) de uma pessoa, calcule e escreva #sua idade exata (em anos). def main(): dia_atual = int(input()) mes_atual = int(input()) ano_atual = int(input()) print('') dia_nasc = int(input()) mes_nasc = int(input()) ano_nasc = int(input()) dias_hoje = (ano_atual * 365) + (mes_atual * 30) + dia_atual dias_nascimento = (ano_nasc * 365) + (mes_nasc * 30) + dia_nasc dias_vida = dias_hoje - dias_nascimento anos_vida = dias_vida // 365 print('Sua idade exata em anos é %d'% anos_vida) main()
b6dee1089e1fbd779878eb612f2a92839576e351
f65e740c52f0199307c3fc1e210a27a604bb3142
/Neural-Nets/Brilliant Course/Script 1 [Perceptron (2-in, 1-out)].py
4fc5c403bbfad578947d6eef859005f731d3ee65
[]
no_license
ninjafrostpn/PythonProjects
69ce67af4714edbf53477ff9233262c6df439a7d
26e2edca16a1dc198858f7e6f60684e343775329
refs/heads/master
2022-10-22T02:53:04.380713
2022-10-21T09:05:43
2022-10-21T09:05:43
106,318,953
0
0
null
null
null
null
UTF-8
Python
false
false
1,312
py
import numpy as np import pygame from pygame.locals import * pygame.init() w, h = 500, 500 screen = pygame.display.set_mode((w, h)) screensize = np.int32((w, h)) # Weights applied to x and y positions when determining activation xweight = 0.2 yweight = 0.3 # Bias toward activation bias = -100 # Vector of weights weights = np.float32([bias, xweight, yweight]) # Vector of input values with 1 standing in as the "weight" of the perceptron's bias # x and y (the 2nd and 3rd values) set to 1 to begin with values = np.ones(3, "float32") keys = set() while True: # Randomly selected point to test boundary condition pos = np.random.sample(2) * screensize # Point put into input vector values[1:] = pos[:] # Vector dot multiplication used to determine whether perceptron activates # Coloured point is displayed accordingly if np.dot(values, weights) >= 0: pygame.draw.rect(screen, [0, 255, 0], (*(pos - 1), 2, 2)) else: pygame.draw.rect(screen, [0, 0, 255], (*(pos - 1), 2, 2)) pygame.display.flip() for e in pygame.event.get(): if e.type == QUIT: quit() elif e.type == KEYDOWN: keys.add(e.key) if e.key == K_ESCAPE: quit() elif e.type == KEYUP: keys.discard(e.key)
8e226b033719e1087b0ca8dba1a61ab1f23f5e76
c6c002d37878c78f9199e30a6d0c2127257552e0
/ctrls/Goal6_8/G6_8Pos4_8Ori2.py
501e0d4d3c599dc1e6949e42c4dff11a49ecdca3
[]
no_license
carrilloec12/FireUAVs
900a79810a5d610dc467fe82fa276bb14b7ffe9d
019f12a947fa4d5bcc99d20ccb85925160430370
refs/heads/master
2020-03-21T08:03:10.478162
2018-06-22T15:09:50
2018-06-22T15:09:50
138,316,479
0
0
null
2018-06-22T15:06:54
2018-06-22T15:06:54
null
UTF-8
Python
false
false
428,330
py
class TulipStrategy(object): """Mealy transducer. Internal states are integers, the current state is stored in the attribute "state". To take a transition, call method "move". The names of input variables are stored in the attribute "input_vars". Automatically generated by tulip.dumpsmach on 2018-06-21 17:01:54 UTC To learn more about TuLiP, visit http://tulip-control.org """ def __init__(self): self.state = 162 self.input_vars = ['Fire', 'SyncSignal', 'StopSignal'] def move(self, Fire, SyncSignal, StopSignal): """Given inputs, take move and return outputs. @rtype: dict @return: dictionary with keys of the output variable names: ['sys_actions', 'loc', 'Base', 'GoalPos'] """ output = dict() if self.state == 0: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 2 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 3 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 4 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 5 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 6 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 7 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 8 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 9 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 1: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 2 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 3 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 4 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 5 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 6 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 7 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 8 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 9 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 2: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 3: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 4: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 5: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 6: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 160 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 161 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 154 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 155 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 156 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 157 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 158 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 159 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 7: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 160 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 161 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 154 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 155 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 156 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 157 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 158 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 159 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 8: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 9: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 10: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 11: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 12: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 13: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 14: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 146 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 147 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 148 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 149 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 150 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 151 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 152 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 153 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 15: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 146 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 147 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 148 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 149 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 150 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 151 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 152 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 153 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 16: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 17: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 18: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 19: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 20: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 21: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 22: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 138 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 139 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 140 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 141 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 142 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 143 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 144 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 145 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 23: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 138 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 139 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 140 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 141 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 142 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 143 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 144 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 145 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 24: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 25: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 26: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 27: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 28: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 29: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 30: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 130 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 131 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 132 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 133 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 134 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 135 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 136 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 137 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 31: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 130 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 131 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 132 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 133 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 134 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 135 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 136 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 137 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 32: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 33: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 34: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 35: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 36: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 37: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 38: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 128 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 129 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 122 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 123 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 124 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 125 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 126 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 127 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 39: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 128 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 129 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 122 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 123 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 124 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 125 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 126 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 127 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 40: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 41: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 42: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 43: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 44: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 45: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 46: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 114 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 115 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 116 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 117 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 118 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 119 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 120 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 121 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 47: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 114 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 115 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 116 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 117 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 118 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 119 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 120 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 121 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 48: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 49: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 50: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 51: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 52: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 53: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 54: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 106 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 107 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 108 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 109 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 110 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 111 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 112 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 113 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 55: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 106 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 107 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 108 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 109 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 110 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 111 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 112 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 113 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 56: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 57: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 58: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 59: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 60: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 61: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 62: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 98 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 99 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 100 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 101 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 102 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 103 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 104 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 105 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 63: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 98 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 99 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 100 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 101 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 102 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 103 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 104 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 105 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 64: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 65: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 66: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 67: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 74 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 75 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 76 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 77 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 78 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 79 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 80 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 81 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 68: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 69: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 74 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 75 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 76 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 77 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 78 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 79 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 80 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 81 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 70: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 96 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 97 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 90 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 91 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 92 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 93 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 94 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 95 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 71: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 96 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 97 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 90 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 91 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 92 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 93 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 94 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 95 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 72: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 73: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 74 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 75 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 76 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 77 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 78 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 79 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 80 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 81 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 74: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 75: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 76: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 77: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 78: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 82 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 83 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 84 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 85 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 86 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 87 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 88 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 89 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 79: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 82 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 83 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 84 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 85 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 86 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 87 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 88 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 89 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 80: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 81: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 82: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 83: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 84: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 85: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 86: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 82 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 83 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 84 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 85 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 86 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 87 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 88 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 89 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 87: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 82 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 83 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 84 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 85 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 86 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 87 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 88 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 89 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 88: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 89: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 90: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 91: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 74 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 75 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 76 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 77 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 78 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 79 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 80 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 81 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 92: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 93: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 74 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 75 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 76 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 77 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 78 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 79 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 80 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 81 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 94: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 96 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 97 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 90 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 91 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 92 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 93 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 94 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 95 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 95: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 96 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 97 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 90 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 91 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 92 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 93 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 94 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 95 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 96: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 97: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 74 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 75 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 76 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 77 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 78 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 79 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 80 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 81 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 98: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 99: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 100: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 101: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 102: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 98 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 99 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 100 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 101 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 102 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 103 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 104 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 105 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 103: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 98 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 99 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 100 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 101 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 102 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 103 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 104 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 105 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 104: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 105: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 66 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 67 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 106: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 107: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 108: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 109: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 110: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 106 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 107 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 108 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 109 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 110 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 111 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 112 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 113 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 111: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 106 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 107 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 108 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 109 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 110 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 111 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 112 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 113 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 112: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 113: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 58 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 59 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 114: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 115: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 116: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 117: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 118: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 114 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 115 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 116 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 117 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 118 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 119 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 120 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 121 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 119: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 114 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 115 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 116 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 117 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 118 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 119 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 120 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 121 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 120: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 121: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 50 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 51 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 122: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 123: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 124: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 125: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 126: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 128 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 129 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 122 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 123 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 124 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 125 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 126 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 127 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 127: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 128 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 129 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 122 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 123 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 124 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 125 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 126 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 127 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 128: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 129: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 42 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 43 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 130: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 131: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 132: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 133: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 134: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 130 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 131 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 132 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 133 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 134 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 135 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 136 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 137 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 135: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 130 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 131 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 132 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 133 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 134 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 135 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 136 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 137 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 136: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 137: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 34 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 35 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 138: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 139: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 140: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 141: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 142: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 138 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 139 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 140 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 141 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 142 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 143 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 144 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 145 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 143: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 138 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 139 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 140 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 141 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 142 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 143 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 144 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 145 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 144: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 145: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 26 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 27 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 146: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 147: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 148: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 149: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 150: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 146 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 147 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 148 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 149 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 150 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 151 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 152 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 153 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 151: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 146 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 147 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 148 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 149 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 150 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 151 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 152 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 153 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 152: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 153: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 18 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 19 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 154: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 155: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 156: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 157: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 158: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 160 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 161 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 154 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 155 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 156 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 157 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 158 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 159 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 159: if (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 160 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 161 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 154 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 155 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 156 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 157 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 158 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 159 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 160: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 161: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 10 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 11 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' else: self._error(Fire, SyncSignal, StopSignal) elif self.state == 162: if (SyncSignal == False) and (Fire == False) and (StopSignal == False): self.state = 0 output["loc"] = 'Pos4_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == False): self.state = 1 output["loc"] = 'Pos4_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 4 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 5 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 6 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 7 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 8 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 9 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 12 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 13 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 14 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 15 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 16 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 17 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 20 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 21 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 22 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 23 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 24 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 25 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 28 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 29 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 30 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 31 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 32 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 33 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 36 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 37 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 38 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 39 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 40 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 41 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 44 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 45 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 46 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 47 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 48 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 49 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 52 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 53 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 54 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 55 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 56 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 57 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 60 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 61 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 62 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 63 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 64 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 65 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 68 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 69 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 70 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 71 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 72 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 73 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 76 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 77 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 78 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 79 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 80 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 81 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Go' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 84 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 85 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 86 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 87 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 88 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 89 output["loc"] = 'Pos7_9Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 92 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 93 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 94 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 95 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 96 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 97 output["loc"] = 'Pos8_8Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 100 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 101 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 102 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 103 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 104 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 105 output["loc"] = 'Pos7_7Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 108 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 109 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 110 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 111 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 112 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 113 output["loc"] = 'Pos6_8Ori3' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 116 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 117 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 118 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 119 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 120 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 121 output["loc"] = 'Pos6_9Ori3' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 124 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 125 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 126 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 127 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 128 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 129 output["loc"] = 'Pos7_10Ori4' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 132 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 133 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 134 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 135 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 136 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 137 output["loc"] = 'Pos8_9Ori1' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 140 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 141 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 142 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 143 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 144 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 145 output["loc"] = 'Pos7_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 148 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 149 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 150 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 151 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 152 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 153 output["loc"] = 'Pos6_8Ori2' output["Base"] = False output["GoalPos"] = True output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == False): self.state = 156 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == False): self.state = 157 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == False) and (StopSignal == True): self.state = 158 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == False) and (StopSignal == True): self.state = 159 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == False) and (Fire == True) and (StopSignal == True): self.state = 160 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' elif (SyncSignal == True) and (Fire == True) and (StopSignal == True): self.state = 161 output["loc"] = 'Pos5_8Ori2' output["Base"] = False output["GoalPos"] = False output["sys_actions"] = 'Stop' else: self._error(Fire, SyncSignal, StopSignal) else: raise Exception("Unrecognized internal state: " + str(self.state)) return output def _error(self, Fire, SyncSignal, StopSignal): raise ValueError("Unrecognized input: " + ( "Fire = {Fire}; " "SyncSignal = {SyncSignal}; " "StopSignal = {StopSignal}; ").format( Fire=Fire, SyncSignal=SyncSignal, StopSignal=StopSignal))
78a10426fb526d6fb4239f22f505783ec95317fa
5baf34c56074a9d27030b55e156398a478ff885b
/tol_stack/distributions.py
18cbc106e5f26df0d08fb455b24055faad879cad
[]
no_license
slightlynybbled/tol-stack
2f4e7e5097bc839b679bf72c8bc1f10b0ba42459
ccc4609a440b71b9ffec9d365cfb695d44ea123e
refs/heads/master
2022-10-04T13:29:26.908152
2022-09-08T08:16:46
2022-09-08T08:16:46
220,051,109
9
1
null
null
null
null
UTF-8
Python
false
false
6,888
py
from typing import Tuple import numpy as np from scipy.stats import skewnorm _max_iterations = 100 def norm(loc: float, scale: float, size: int) -> np.ndarray: """ Returns a random sampling from the normal distribution. :param loc: the nominal value :param scale: the range of common lengths :param size: the number of samples within the common lengths :return: a numpy array of lengths """ return np.random.normal(loc=loc, scale=scale, size=size) def norm_screened(loc: float, scale: float, limits: Tuple[float, float], size: int) \ -> np.ndarray: """ Returns a random sampling from the normal distribution which has been screened. This is a common distribution when a go/no-go fixture is in use. :param loc: the nominal value :param scale: the range of common lengths :param limits: a tuple of floats containing the low \ and high screening limits :param size: the number of samples within the common lengths :return: a numpy array of lengths """ values = np.random.normal(loc=loc, scale=scale, size=size) if limits is not None: if len(limits) != 2: raise ValueError('"limits" must be a tuple of exactly two ' 'floating-point lengths') low_limit, high_limit = limits # removes lengths not in range values = values[(values >= low_limit) & (values <= high_limit)] count = 0 while len(values) < size: values = np.append(values, np.random.normal(loc=loc, scale=scale, size=size)) values = values[(values >= low_limit) & (values <= high_limit)] count += 1 if count > _max_iterations: raise ValueError('number of iterations exceeds the max ' 'allowable... are the limits set ' 'appropriately?') values = values[:size] return values def norm_notched(loc: float, scale: float, limits: Tuple[float, float], size: int) -> np.ndarray: """ Returns a random sampling from the normal distribution which has been screened in order to remove the nominal lengths. This is a common distribution when parts are being sorted and the leftover parts are used. :param loc: the nominal value :param scale: the range of common lengths :param limits: a tuple of floats containing the low \ and high screening limits :param size: the number of samples within the common lengths :return: a numpy array of lengths """ values = np.random.normal(loc=loc, scale=scale, size=size) if limits is not None: if len(limits) != 2: raise ValueError('"limits" must be a tuple of exactly two ' 'floating-point lengths') low_limit, high_limit = limits # removes lengths not in range values = values[(values <= low_limit) | (values >= high_limit)] count = 0 while len(values) < size: values = np.append(values, np.random.normal(loc=loc, scale=scale, size=size)) values = values[(values <= low_limit) | (values >= high_limit)] count += 1 if count > _max_iterations: raise ValueError('number of iterations exceeds the max ' 'allowable... are the limits set ' 'appropriately?') values = values[:size] return values def norm_lt(loc: float, scale: float, limit: float, size: int) -> np.ndarray: """ Returns a random sampling from the normal distribution which has been screened in order to remove lengths above the limit. :param loc: the nominal value :param scale: the range of common lengths :param limit: a floats containing the upper screening limit :param size: the number of samples within the common lengths :return: a numpy array of lengths """ values = np.random.normal(loc=loc, scale=scale, size=size) # removes lengths not in range values = values[values <= limit] count = 0 while len(values) < size: values = np.append(values, np.random.normal(loc=loc, scale=scale, size=size)) values = values[(values <= limit)] count += 1 if count > _max_iterations: raise ValueError('number of iterations exceeds the max ' 'allowable... is the limit set appropriately?') values = values[:size] return values def norm_gt(loc: float, scale: float, limit: float, size: int) -> np.ndarray: """ Returns a random sampling from the normal distribution which has been screened in order to remove lengths below the limit. :param loc: the nominal value :param scale: the range of common lengths :param limit: a floats containing the lower screening limit :param size: the number of samples within the common lengths :return: a numpy array of lengths """ values = np.random.normal(loc=loc, scale=scale, size=size) # removes lengths not in range values = values[values >= limit] count = 0 while len(values) < size: values = np.append(values, np.random.normal(loc=loc, scale=scale, size=size)) values = values[(values >= limit)] count += 1 if count > _max_iterations: raise ValueError('number of iterations exceeds ' 'the max allowable... ' 'is the limit set appropriately?') values = values[:size] return values def skew_normal(skewiness: float, loc: float, scale: float, size: int) -> np.ndarray: """ Returns a random sampling from skewnormal distribution. :param skewiness: "0" skewiness, represents no skew; a negative skewiness \ will create a left skew while a positive skewiness will create a \ right skew; as skewiness increases, so does the skew of the distribution :param loc: the nominal value :param scale: the range of common lengths :param size: the number of samples within the common lengths :return: a numpy array of lengths """ values = skewnorm.rvs(skewiness, loc=loc, scale=scale, size=size)\ .astype(np.float64) return values if __name__ == '__main__': import matplotlib.pyplot as plt fig, ax = plt.subplots() ax.hist(skew_normal(skewiness=-5, loc=1, scale=0.01, size=10000), bins=51) plt.show()
4e4f19c6732fa151ce45dd74ef5fbd186c6e45c9
92f3320303fc3e7e34ec3f310c81ae5ab6350956
/test_nw0.py
86c89aec72525fdac57b7bbffb07d16f0e20d1c4
[]
no_license
wwj718/gameshell_node
1495a3adc7d540783e127bb5a433aa6980ee9594
856138b57de5a2a73a26b1f9510d158e364ce9c4
refs/heads/master
2022-12-05T22:32:55.422560
2020-08-13T04:55:16
2020-08-13T04:55:16
286,996,721
3
0
null
null
null
null
UTF-8
Python
false
false
767
py
import sys import re import socket import uuid import networkzero as nw0 def advertise(): name = f'{socket.gethostname()}-{str(uuid.uuid4())[:8]}' address = nw0.advertise(name) # hostname..uuid return address # wait ip def wait_for_ip(address): print("waiting for ip") content = nw0.wait_for_message_from(address) pat = re.compile(".*\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}") test = pat.match(content) if not test: nw0.send_reply_to(address, "please input ip address") print("please input ip address") wait_for_ip(address) else: print("connected!") nw0.send_reply_to(address, "connected!") return content address = advertise() ip = wait_for_ip(address) # until input ip print(ip)
8154211d6663b6e3e40647977ddb4703fd19859b
781e2692049e87a4256320c76e82a19be257a05d
/assignments/python/wc/src/320.py
b95b77b6804f8b3267bbdcb14419eada0a98a4ce
[]
no_license
itsolutionscorp/AutoStyle-Clustering
54bde86fe6dbad35b568b38cfcb14c5ffaab51b0
be0e2f635a7558f56c61bc0b36c6146b01d1e6e6
refs/heads/master
2020-12-11T07:27:19.291038
2016-03-16T03:18:00
2016-03-16T03:18:42
59,454,921
4
0
null
2016-05-23T05:40:56
2016-05-23T05:40:56
null
UTF-8
Python
false
false
395
py
""" Reports the number of occurences of each word in text. """ def word_count(text): """Reports the number of occurences of each word in text.""" words = {} text = text.translate(None, ".,:;!@#$%^&*()") for word in text.split(): lcword = word.lower() if lcword in words: words[lcword] += 1 else: words[lcword] = 1 return words
819caf6bc06b4f7733839e0e20ef7296d89151ee
13f93b54626132a9905b8a3102b0c90456da3d63
/app/main/__init__.py
207900e55139fd3edbdb2fbfe6a9d725235943ce
[ "MIT" ]
permissive
adriankiprono/blogs-project
988f9d447d478d6db7984386443dc37e0e524253
473735144dc12f342f17bbe0b6291bd3fad8ebff
refs/heads/master
2022-12-25T14:58:23.062533
2019-12-04T05:29:47
2019-12-04T05:29:47
224,854,241
0
0
MIT
2022-12-08T06:58:59
2019-11-29T12:55:04
Python
UTF-8
Python
false
false
95
py
from flask import Blueprint main = Blueprint('main',__name__) from . import views,errors,forms
5ca946db0d9177b1e5089d1599e1068fb2505779
7f1ba62c7d7b71da843d6da9cea5227c1c754618
/Django3/grade/urls.py
4a6b0a8d885d793e92bc19a5790da3945b77b4a7
[]
no_license
caoyucharlie/DjangoLearning
706611bffe7832fc397a81adca462e56072b333e
8f6a6fcad7298679f58880d7cc2788042dd94868
refs/heads/master
2020-03-12T12:34:40.603290
2018-05-04T10:44:46
2018-05-04T10:44:46
130,621,356
0
0
null
null
null
null
UTF-8
Python
false
false
181
py
from django.conf.urls import url from django.contrib import admin from grade import views urlpatterns = [ url(r'^grades/', views.showGrades), url(r'show/', views.showpage) ]
884ebe8c40a3b034f705a30e20693e81d60fadfa
d81ccdcec0ee793d9920dfa9749d93c23d3129a7
/department/models.py
8b961ee15201f8b4a35d9752dcacf14a25bc5555
[]
no_license
ehapsamy0/Hospital_Website
5d11ffebcbefa397bc66d0ecbc4d36cf0158a1bc
b751123441a26d7999d8a38971d4b713e282ad77
refs/heads/master
2022-11-27T10:56:04.012603
2020-04-08T20:34:55
2020-04-08T20:34:55
254,175,108
0
0
null
2022-11-22T05:50:31
2020-04-08T18:58:09
Tcl
UTF-8
Python
false
false
285
py
from django.db import models # Create your models here. class Department(models.Model): name = models.CharField(max_length=250) image = models.ImageField(upload_to='department_img/') description = models.TextField() def __str__(self): return self.name
c74389412c35f8cd79705612d2df2bcc563a4ca0
1105414add7c27eb201a0941e5bc86eb2f09378f
/journey11/src/main/simple/simpleagent.py
53289fd78d8d8f12b56db97c3f9bb98cd1c689e1
[ "MIT" ]
permissive
parrisma/AI-Intuition
d083204267c351bc85c796a79ce43b8ff9d58022
3b081696b1d226815e029cbb536fac5e4d3de9a7
refs/heads/master
2021-07-25T21:07:11.455443
2020-06-06T20:44:17
2020-06-06T20:44:17
193,102,209
0
0
null
null
null
null
UTF-8
Python
false
false
24,161
py
import logging import threading import datetime from queue import Queue from pubsub import pub from typing import Type, Dict, List from journey11.src.interface.srcsink import SrcSink from journey11.src.interface.agent import Agent from journey11.src.interface.ether import Ether from journey11.src.interface.task import Task from journey11.src.interface.taskpool import TaskPool from journey11.src.interface.tasknotification import TaskNotification from journey11.src.interface.worknotificationdo import WorkNotificationDo from journey11.src.interface.taskconsumptionpolicy import TaskConsumptionPolicy from journey11.src.interface.worknotificationfinalise import WorkNotificationFinalise from journey11.src.interface.worknotificationinitiate import WorkNotificationInitiate from journey11.src.interface.capability import Capability from journey11.src.interface.srcsinkpingnotification import SrcSinkPingNotification from journey11.src.interface.srcsinkping import SrcSinkPing from journey11.src.interface.taskfactory import TaskFactory from journey11.src.lib.state import State from journey11.src.lib.uniqueworkref import UniqueWorkRef from journey11.src.lib.capabilityregister import CapabilityRegister from journey11.src.lib.notificationhandler import NotificationHandler from journey11.src.lib.countdownbarrier import CountDownBarrier from journey11.src.main.simple.simplesrcsinkpingnotification import SimpleSrcSinkNotification from journey11.src.main.simple.simpleworkrequest import SimpleWorkRequest from journey11.src.main.simple.simpleworknotificationfinalise import SimpleWorkNotificationFinalise from journey11.src.main.simple.simpleworknotificationinitiate import SimpleWorkNotificationInitiate from journey11.src.main.simple.simpleworknotificationdo import SimpleWorkNotificationDo from journey11.src.main.simple.simplecapability import SimpleCapability from journey11.src.main.simple.simplesrcsinkping import SimpleSrcSinkPing class SimpleAgent(Agent): FAIL_RATE = float(0) RECENT_IN_SECS = 60 def __init__(self, agent_name: str, start_state: State, end_state: State, capacity: int, task_consumption_policy: TaskConsumptionPolicy, agent_capabilities: List[Capability] = None, task_factory: TaskFactory = None, trace: bool = False, count_down_barrier: CountDownBarrier = None): """ """ self._work_lock = threading.RLock() self._agent_name = agent_name self._start_state = start_state self._end_state = end_state self._capabilities = list() self.set_agent_capabilities(agent_capabilities) super().__init__(agent_name) self._fail_rate = SimpleAgent.FAIL_RATE self._capacity = capacity self._work_in_progress = Queue() self._work_initiate = Queue() self._work_done = Queue() self._task_consumption_policy = task_consumption_policy self._trace = trace self._trace_log = dict() self._ping_factor_threshold = float(1) self._task_factory = task_factory self._count_down_barrier = count_down_barrier return def __del__(self): super().__del__() return @property def name(self) -> str: """ The unique name of the Agent :return: The Agent name """ return self._agent_name @property def topic(self) -> str: """ The unique topic name that agent listens on for activity specific to it. :return: The unique agent listen topic name """ return self._unique_topic def _do_notification(self, task_notification: TaskNotification): """ callback to Notify agent of a task that needs attention. The agent can request the task be sent to it for processing but there is no guarantee as another agent may have already requested the task. :param task_notification: The notification event for task requiring attention """ self._trace_log_update("_do_notification", task_notification) logging.info("{} do_notification for work ref {}".format(self._agent_name, task_notification.work_ref.id)) if self._task_consumption_policy.process_task(task_notification.task_meta): if task_notification.originator is not None: work_request = SimpleWorkRequest(task_notification.work_ref, self) logging.info("{} sent request for work ref {} OK from pool {}".format(self._agent_name, task_notification.work_ref.id, task_notification.originator.name)) pub.sendMessage(topicName=task_notification.originator.topic, notification=work_request) else: logging.error("{} notification IGNORED as no originator address given for work ref {}".format( self._agent_name, task_notification.work_ref.id)) else: logging.info("{} Rx TaskNotification Ignored by Consumption Policy{}".format(self.name, task_notification.work_ref.id)) return def _do_work(self, work_notification: WorkNotificationDo) -> None: """ Process any out standing tasks associated with the agent. """ self._trace_log_update("_do_work", work_notification) if work_notification.task.work_in_state_remaining > 0: logging.info("{} do_work for work_ref {}".format(self._agent_name, work_notification.work_ref.id)) if work_notification.task.do_work(self.capacity) > 0: logging.info("{} do_work for task id {} - task rescheduled with {} work remaining in state {}".format( self._agent_name, work_notification.work_ref.id, work_notification.task.work_in_state_remaining, work_notification.task.state)) self._add_item_to_work_queue(work_notification) else: logging.info("{} do_work nothing left to do for task {} in state {}".format(self._agent_name, work_notification.work_ref.id, work_notification.task.state)) # If work remaining is zero, need to transition to next state and post the task back to the # originator # if work_notification.task.work_in_state_remaining == 0: work_notification.task.state = self.to_state work_notification_finalise = SimpleWorkNotificationFinalise.finalise_factory(work_notification) logging.info("{} Finalised {} : SrcSink {} : State {}".format(self._agent_name, work_notification_finalise.work_ref.id, work_notification_finalise.originator.name, work_notification_finalise.task.state)) pub.sendMessage(topicName=work_notification.source.topic, notification=work_notification_finalise) return def _add_item_to_work_queue(self, work_notification: WorkNotificationDo) -> None: """ Add the notification to the queue of pending work. :param work_notification: """ with self._work_lock: self._work_in_progress.put(work_notification) return def _do_work_initiate(self, work_notification_initiate: WorkNotificationInitiate) -> None: """ Handle the initiation the given work item from this agent """ self._trace_log_update("_do_work_initiate", work_notification_initiate) pool = self._get_recent_pool_address() if pool is None: task = work_notification_initiate.task logging.info("{} Do Work Initiate waiting for Pool address task {} queued".format(self._agent_name, task.id)) self._add_item_to_initiate_queue(SimpleWorkNotificationInitiate(task=task, originator=self)) else: pool_topic = pool.topic to_do = list() to_do.append(work_notification_initiate) with self._work_lock: while not self._work_initiate.empty(): to_do.append(self._work_initiate.get_nowait()) for wni in to_do: task_to_do = wni.task wnd = SimpleWorkNotificationDo(unique_work_ref=UniqueWorkRef(prefix=str(task_to_do.id), suffix=self.name), task=task_to_do, source=self, originator=self) logging.info("{} Task {} Initiate sent to Pool {}".format(self.name, self._agent_name, pool_topic)) pub.sendMessage(topicName=pool_topic, notification=wnd) return def _add_item_to_initiate_queue(self, initiate_notification: WorkNotificationInitiate) -> None: """ Add the notification to the queue of work needing initiation :param work_notification: """ with self._work_lock: self._work_initiate.put(initiate_notification) return def _do_work_finalise(self, work_notification_final: WorkNotificationFinalise) -> None: """ Take receipt of the given completed work item that was initiated from this agent and do any final processing. """ self._trace_log_update("_do_work_finalise", work_notification_final) work_notification_final.task.finalised = True logging.info("{} Rx Finalised task {} from source {} in state {}".format(self._agent_name, work_notification_final.work_ref.id, work_notification_final.originator.name, work_notification_final.task.state)) with self._work_lock: self._work_done.put(work_notification_final.task) if self._count_down_barrier is not None: self._count_down_barrier.decr() return def _do_srcsink_ping_notification(self, ping_notification: SrcSinkPingNotification) -> None: """ Handle a ping response from a srcsink :param: The srcsink notification """ self._trace_log_update("_do_srcsink_ping_notification", ping_notification) logging.info("Agent {} RX ping response for {}".format(self.name, ping_notification.src_sink.name)) if ping_notification.src_sink.topic != self.topic: # Don't count ping response from our self. for srcsink in ping_notification.responder_address_book: self._update_addressbook(srcsink=srcsink) return def _do_srcsink_ping(self, ping_request: SrcSinkPing) -> None: """ Respond to a ping request and share details of self + capabilities :param: The srcsink notification """ self._trace_log_update("_do_srcsink_ping", type(ping_request), ping_request) logging.info("Agent {} RX ping request for {}".format(self.name, ping_request.sender_srcsink.name)) # Don't count pings from our self. if ping_request.sender_srcsink.topic != self.topic: # Note the sender is alive self._update_addressbook(ping_request.sender_srcsink) if Capability.equivalence_factor(ping_request.required_capabilities, self.capabilities) >= self._ping_factor_threshold: pub.sendMessage(topicName=ping_request.sender_srcsink.topic, notification=SimpleSrcSinkNotification(responder_srcsink=self, address_book=[self], sender_workref=ping_request.work_ref)) return def _activity_manage_presence(self, current_activity_interval: float) -> float: """ Ensure that we are known on the ether & our address book has the name of at least one local pool in it. :param current_activity_interval: The current delay in seconds before activity is re-triggered. :return: The new delay in seconds before the activity is re-triggered. """ self._trace_log_update("_activity_manage_presence", current_activity_interval) back_off_reset = False if self._get_recent_ether_address() is None: logging.info("{} not linked to Ether - sending discovery Ping".format(self.name)) back_off_reset = True pub.sendMessage(topicName=Ether.back_plane_topic(), notification=SimpleSrcSinkPing(sender_srcsink=self, required_capabilities=[ SimpleCapability(str(CapabilityRegister.ETHER))])) else: # We have an Ether address so we can now ping the Ether for a task pool address. if self._get_recent_pool_address() is None: logging.info("{} Missing local Pool address - sending discovery Ping to Ether".format(self.name)) back_off_reset = True pub.sendMessage(topicName=Ether.back_plane_topic(), notification=SimpleSrcSinkPing(sender_srcsink=self, required_capabilities=[ SimpleCapability(str(CapabilityRegister.POOL))])) return NotificationHandler.back_off(reset=back_off_reset, curr_interval=current_activity_interval, min_interval=Agent.PRS_TIMER, max_interval=Agent.PRD_TIMER_MAX) def _activity_initiate_work(self, current_activity_interval: float) -> float: """ If the agent is a source (origin) of work then this activity will create and inject the new tasks. Zero or more tasks may be created depending on the specific task creation policy. :param current_activity_interval: The current delay in seconds before activity is re-triggered. :return: The new delay in seconds before the activity is re-triggered. """ self._trace_log_update("_activity_initiate_work", current_activity_interval) back_off_reset = False if self._task_factory is not None: tasks_to_initiate = self._task_factory.generate() logging.info("{} Initiating {} Tasks".format(self.name, len(tasks_to_initiate))) for task in tasks_to_initiate: back_off_reset = True self._do_work_initiate(SimpleWorkNotificationInitiate(task=task, originator=self)) return NotificationHandler.back_off(reset=back_off_reset, curr_interval=current_activity_interval, min_interval=Agent.WORK_INIT_TIMER, max_interval=Agent.WORK_INIT_TIMER_MAX) def _work_topics(self) -> List[str]: """ The list of topics to subscribe to based on the Work Topics (status transitions) supported by the agent. """ topics = list() topics.append(TaskPool.topic_for_capability(self._start_state)) return topics def reset(self) -> None: """ Return the Actor to the same state at which it was constructed """ return def _activity_check_work_to_do(self, current_activity_interval: float) -> float: """ Are there any tasks associated with the Agent that need working on ? of so schedule them by calling work execute handler. :param current_activity_interval: The current delay in seconds before activity is re-triggered. :return: The new delay in seconds before the activity is re-triggered. """ self._trace_log_update("_activity_check_work_to_do", current_activity_interval) back_off_reset = False if not self._work_in_progress.empty(): wtd = self._work_in_progress.get() logging.info("{} work_to_do for task ref {}".format(self._agent_name, wtd.work_ref.id)) back_off_reset = True self._do_work(wtd) else: logging.info("{} work_to_do - nothing to do".format(self._agent_name)) return NotificationHandler.back_off(reset=back_off_reset, curr_interval=current_activity_interval, min_interval=Agent.WORK_TIMER, max_interval=Agent.WORK_TIMER_MAX) def work_initiate(self, work_notification: WorkNotificationDo) -> None: """ Initiate the given work item with the agent as the owner of the work. """ raise NotImplementedError("work_initiate missing") def _trace_log_update(self, func: str, closure) -> None: """ Keep a record of all the notification events for this agent For unit testing only :param func: The notification function called :param closure: Details specific to the function type. """ if self._trace: if func not in self._trace_log: self._trace_log[func] = list() self._trace_log[func].append([datetime.datetime, closure]) return # ----- P R O P E R T I E S ----- @property def trace_log(self) -> Dict: """The trace log where agent notifications are tracked For test validation only :return: Trace Log Dictionary """ return self._trace_log @property def capacity(self) -> int: """ The current work capacity of the actor. :return: Current work capacity as int """ return self._capacity @property def from_state(self) -> State: """ The state the actor expects to receive tasks in :return: from state """ return self._start_state @property def to_state(self) -> State: """ The state the actor will process tasks into :return: to state """ return self._end_state @property def failure_rate(self) -> float: """ The rate at which completed tasks fail. :return: Failure state of the actor """ return self._fail_rate @failure_rate.setter def failure_rate(self, r: float) -> None: """ The rate at which completed tasks fail. :param r: the failure state of the actor """ if r < 0.0 or r > 1.0: raise ValueError("Failure rate for Agent must be between 0.0 and 1.0") self._fail_rate = r def __str__(self): s = "Agent [{}] from state {} to state {}".format(self._agent_name, str(self._start_state), str(self._end_state) ) return s @property def work_done(self) -> List[WorkNotificationFinalise]: """ A list of the finalised work notifications, which contain the task that was executed :return: List of finalised Task Notifications """ work_done = list() with self._work_lock: for fw in self._work_done.queue: work_done.append(fw) return work_done @property def capabilities(self) -> List[Capability]: """ The capabilities of the Ether :return: List of Ether capabilities """ return self._capabilities def set_agent_capabilities(self, additional_capabilities: List[Capability] = None) -> None: """ Set the given capabilities for the Agent and add the base capabilities that all Agents have. :param additional_capabilities: Optional capabilities to add to the base capabilities """ with self._work_lock: if CapabilityRegister.AGENT not in self._capabilities: self._capabilities.append(CapabilityRegister.AGENT) if additional_capabilities is not None: for c in additional_capabilities: if c not in self._capabilities: self._capabilities.append(c) return def _get_recent_ether_address(self) -> SrcSink: """ Get a recent Ether address from the AddressBook. If there is no recent Ether then return None :return: Ether SrcSink or None """ ss = self._address_book.get_with_capabilities( required_capabilities=[SimpleCapability(str(CapabilityRegister.ETHER))], max_age_in_seconds=SimpleAgent.RECENT_IN_SECS, n=1) if ss is not None: ss = ss[0] return ss def _get_recent_pool_address(self) -> SrcSink: """ Get a recent Ether address from the AddressBook. If there is no recent Ether then return None :return: Ether SrcSink or None """ ss = self._address_book.get_with_capabilities( required_capabilities=[SimpleCapability(str(CapabilityRegister.POOL))], max_age_in_seconds=SimpleAgent.RECENT_IN_SECS, n=1) if ss is not None: ss = ss[0] return ss def finalised_tasks(self) -> List[Task]: """ The finalised tasks (at the point of call) for the agent :return: List of finalised tasks """ res = list() with self._work_lock: for task in self._work_done.queue: res.append(task) return res @property def tasks_initiated(self) -> int: ky = "_do_work_initiate" if self.trace_log is not None: if ky not in self.trace_log.keys(): return 0 return len(self.trace_log[ky]) @property def tasks_worked_on(self) -> int: ky = '_do_work' if self.trace_log is not None: if ky not in self.trace_log.keys(): return 0 return len(self.trace_log[ky]) @property def tasks_finalised(self) -> int: ky = '_do_work_finalise' if self.trace_log is not None: if ky not in self.trace_log.keys(): return 0 return len(self.trace_log[ky])
643275689ff6e9eb7e351d593143c59b47d3572e
e5e2b7da41fda915cb849f031a0223e2ac354066
/sdk/python/pulumi_azure_native/desktopvirtualization/__init__.py
a79ea66d48e045c4e955185963adc59534936fd2
[ "BSD-3-Clause", "Apache-2.0" ]
permissive
johnbirdau/pulumi-azure-native
b7d3bdddeb7c4b319a7e43a892ddc6e25e3bfb25
d676cc331caa0694d8be99cb90b93fa231e3c705
refs/heads/master
2023-05-06T06:48:05.040357
2021-06-01T20:42:38
2021-06-01T20:42:38
null
0
0
null
null
null
null
UTF-8
Python
false
false
3,149
py
# coding=utf-8 # *** WARNING: this file was generated by the Pulumi SDK Generator. *** # *** Do not edit by hand unless you're certain you know what you are doing! *** from .. import _utilities import typing # Export this package's modules as members: from ._enums import * from .application import * from .application_group import * from .get_application import * from .get_application_group import * from .get_host_pool import * from .get_msix_package import * from .get_private_endpoint_connection_by_host_pool import * from .get_private_endpoint_connection_by_workspace import * from .get_scaling_plan import * from .get_workspace import * from .host_pool import * from .msix_package import * from .private_endpoint_connection_by_host_pool import * from .private_endpoint_connection_by_workspace import * from .scaling_plan import * from .workspace import * from ._inputs import * from . import outputs # Make subpackages available: if typing.TYPE_CHECKING: import pulumi_azure_native.desktopvirtualization.v20190123preview as v20190123preview import pulumi_azure_native.desktopvirtualization.v20190924preview as v20190924preview import pulumi_azure_native.desktopvirtualization.v20191210preview as v20191210preview import pulumi_azure_native.desktopvirtualization.v20200921preview as v20200921preview import pulumi_azure_native.desktopvirtualization.v20201019preview as v20201019preview import pulumi_azure_native.desktopvirtualization.v20201102preview as v20201102preview import pulumi_azure_native.desktopvirtualization.v20201110preview as v20201110preview import pulumi_azure_native.desktopvirtualization.v20210114preview as v20210114preview import pulumi_azure_native.desktopvirtualization.v20210201preview as v20210201preview import pulumi_azure_native.desktopvirtualization.v20210309preview as v20210309preview import pulumi_azure_native.desktopvirtualization.v20210401preview as v20210401preview else: v20190123preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20190123preview') v20190924preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20190924preview') v20191210preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20191210preview') v20200921preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20200921preview') v20201019preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20201019preview') v20201102preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20201102preview') v20201110preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20201110preview') v20210114preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20210114preview') v20210201preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20210201preview') v20210309preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20210309preview') v20210401preview = _utilities.lazy_import('pulumi_azure_native.desktopvirtualization.v20210401preview')
561415b30f0bc633cc140e12e17358f36946af88
f058cd1ec57b2e24430605883387b1c34391a2e3
/multicam/01_video.py
483174659e2dc639f02eb3909bf7c9188ce5dd59
[]
no_license
Danny-Dasilva/Blender_Mediapipe
9a2966f38e3e6a9aea503eed1bdcc0e4e2ebc502
80cbd45e721bc12759d26c317f3a57b6176e1af5
refs/heads/main
2023-04-21T09:49:47.200918
2021-05-15T01:03:40
2021-05-15T01:03:40
365,960,178
5
0
null
null
null
null
UTF-8
Python
false
false
3,353
py
############################################################################### ### Simple demo with video input ### Input : Live video of face / hand / body ### Output: 2D/2.5D/3D display of face, hand, body keypoint/joint ### Usage : python 01_video.py -m face ### python 01_video.py -m hand ### python 01_video.py -m body ### python 01_video.py -m holistic ############################################################################### import cv2 import sys import time import argparse from utils_display import DisplayFace, DisplayHand, DisplayBody, DisplayHolistic from utils_mediapipe import MediaPipeFace, MediaPipeHand, MediaPipeBody, MediaPipeHolistic # User select mode parser = argparse.ArgumentParser() parser.add_argument('-m', '--mode', default='hand', help='Select mode: face / hand / body / holistic') args = parser.parse_args() mode = args.mode # Load mediapipe and display class if mode=='face': pipe = MediaPipeFace(static_image_mode=False, max_num_faces=1) disp = DisplayFace(draw3d=True) elif mode=='hand': pipe = MediaPipeHand(static_image_mode=False, max_num_hands=2) disp = DisplayHand(draw3d=True, max_num_hands=2) elif mode=='body': pipe = MediaPipeBody(static_image_mode=False, model_complexity=1) disp = DisplayBody(draw3d=True) elif mode=='holistic': pipe = MediaPipeHolistic(static_image_mode=False, model_complexity=1) disp = DisplayHolistic(draw3d=True) else: print('Undefined mode only the following modes are available: \nface / hand / body / holistic') sys.exit() # Start video capture cap = cv2.VideoCapture(0) # By default webcam is index 0 # cap = cv2.VideoCapture('../data/video.mp4') # Read from .mp4 file # cap.set(cv2.CAP_PROP_POS_FRAMES, 1) # Set starting position of frame # # Log video # fps = 30 # ret, img = cap.read() # width, height = int(cap.get(3)), int(cap.get(4)) # fourcc = cv2.VideoWriter_fourcc(*'mp4v') # Be sure to use lower case # video = cv2.VideoWriter('../data/video_.mp4', fourcc, fps, (width, height)) prev_time = time.time() while cap.isOpened(): ret, img = cap.read() if not ret: break # Preprocess image if necessary img = cv2.flip(img, 1) # Flip image for 3rd person view # img = cv2.resize(img, None, fx=0.5, fy=0.5) # To improve performance, optionally mark image as not writeable to pass by reference img.flags.writeable = False # Feedforward to extract keypoint param = pipe.forward(img) # Compute FPS curr_time = time.time() fps = 1/(curr_time-prev_time) if mode=='body': param['fps'] = fps elif mode=='face' or mode=='hand': param[0]['fps'] = fps elif mode=='holistic': for p in param: p['fps'] = fps prev_time = curr_time img.flags.writeable = True # Display 2D keypoint cv2.imshow('img 2D', disp.draw2d(img.copy(), param)) # Display 2.5D keypoint cv2.imshow('img 2.5D', disp.draw2d_(img.copy(), param)) # Display 3D disp.draw3d(param) disp.vis.update_geometry(None) disp.vis.poll_events() disp.vis.update_renderer() # # Write to video # img = disp.draw2d(img.copy(), param) # cv2.imshow('img 2D', img) # video.write(img) key = cv2.waitKey(1) if key==27: break pipe.pipe.close() # video.release() cap.release()
d3011d43531ed07a727ecfe4dbd041c753339c15
a01e7f87a0088965e2e0a02476d2df12a49a1a18
/tools/strop.py
3d32a2f8974030077ec41309253a5ff7a4ac4743
[]
no_license
gsrr/IFT_jerry
0456a8a1fb98f84ad5c26dc36bdf32e2d85c750c
4c2f6900dfd7ae7f6b3cc2150b1c1be236b4c95c
refs/heads/master
2020-04-04T05:30:10.544252
2019-08-22T09:12:03
2019-08-22T09:12:03
48,145,836
0
0
null
null
null
null
UTF-8
Python
false
false
743
py
import sys import getopt def usage(): return [ "help menu", ] def str2hex(paras): msg = paras['msg'] print "input:", msg print "input(hex):", msg.encode("hex").upper() def main(): try: paras = {} opts, args = getopt.getopt(sys.argv[1:], "hc:m:", ["help", "cmd=", "msg="]) for o, a in opts: if o in ("-h", "--help"): print usage() elif o == "-c": paras['cmd'] = a elif o == "-m": paras['msg'] = a func = getattr(sys.modules[__name__], paras['cmd']) func(paras) except getopt.GetoptError as err: print str(err) sys.exit(2) if __name__ == "__main__": main()
bfd1c1851d4ae1a5cb2687352d396977033fc25b
0368436dc981ab44975d4b28935ae89a37065030
/qa/rpc-tests/mempool_resurrect_test.py
7c56bf88423c1f8db1badc4b83f49d6cd6b5213d
[ "MIT" ]
permissive
mirzaei-ce/core-koobit
b1d350c28f87764a14ed7e92e9918c7af90a93a0
7d24e9c554fec6f3631691f456e9873bc4536fbd
refs/heads/master
2021-08-14T19:04:05.775343
2017-11-16T14:35:05
2017-11-16T14:35:05
110,982,099
0
0
null
null
null
null
UTF-8
Python
false
false
3,391
py
#!/usr/bin/env python2 # Copyright (c) 2014-2015 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test resurrection of mined transactions when # the blockchain is re-organized. # from test_framework.test_framework import KoobitTestFramework from test_framework.util import * # Create one-input, one-output, no-fee transaction: class MempoolCoinbaseTest(KoobitTestFramework): def setup_network(self): # Just need one node for this test args = ["-checkmempool", "-debug=mempool"] self.nodes = [] self.nodes.append(start_node(0, self.options.tmpdir, args)) self.is_network_split = False def create_tx(self, from_txid, to_address, amount): inputs = [{ "txid" : from_txid, "vout" : 0}] outputs = { to_address : amount } rawtx = self.nodes[0].createrawtransaction(inputs, outputs) signresult = self.nodes[0].signrawtransaction(rawtx) assert_equal(signresult["complete"], True) return signresult["hex"] def run_test(self): node0_address = self.nodes[0].getnewaddress() # Spend block 1/2/3's coinbase transactions # Mine a block. # Create three more transactions, spending the spends # Mine another block. # ... make sure all the transactions are confirmed # Invalidate both blocks # ... make sure all the transactions are put back in the mempool # Mine a new block # ... make sure all the transactions are confirmed again. b = [ self.nodes[0].getblockhash(n) for n in range(1, 4) ] coinbase_txids = [ self.nodes[0].getblock(h)['tx'][0] for h in b ] spends1_raw = [ self.create_tx(txid, node0_address, 50) for txid in coinbase_txids ] spends1_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends1_raw ] blocks = [] blocks.extend(self.nodes[0].generate(1)) spends2_raw = [ self.create_tx(txid, node0_address, 49.99) for txid in spends1_id ] spends2_id = [ self.nodes[0].sendrawtransaction(tx) for tx in spends2_raw ] blocks.extend(self.nodes[0].generate(1)) # mempool should be empty, all txns confirmed assert_equal(set(self.nodes[0].getrawmempool()), set()) for txid in spends1_id+spends2_id: tx = self.nodes[0].gettransaction(txid) assert(tx["confirmations"] > 0) # Use invalidateblock to re-org back; all transactions should # end up unconfirmed and back in the mempool for node in self.nodes: node.invalidateblock(blocks[0]) # mempool should be empty, all txns confirmed assert_equal(set(self.nodes[0].getrawmempool()), set(spends1_id+spends2_id)) for txid in spends1_id+spends2_id: tx = self.nodes[0].gettransaction(txid) assert(tx["confirmations"] == 0) # Generate another block, they should all get mined self.nodes[0].generate(1) # mempool should be empty, all txns confirmed assert_equal(set(self.nodes[0].getrawmempool()), set()) for txid in spends1_id+spends2_id: tx = self.nodes[0].gettransaction(txid) assert(tx["confirmations"] > 0) if __name__ == '__main__': MempoolCoinbaseTest().main()
933881cc1d244a020fbb7d0a918ea88268fdc271
74198519b04bc5ac8d6fe8f4f24ad2ba2e0e9164
/untitled/interface_test/woniusales_requests_test/testcase/customer_manager_test.py
6ff0337601e8ddb17e11a1ca2210e4510a6b0a9b
[]
no_license
ojbk6943/all-from-woniu
e2c24cc1297ee51d65e52a64e3c6fbba7eb45f3a
e8ab7eb968152b69aff12bdacd41fe8e7c9af19e
refs/heads/master
2020-12-13T01:54:25.599786
2020-01-16T09:23:09
2020-01-16T09:23:09
234,281,904
0
0
null
null
null
null
UTF-8
Python
false
false
1,741
py
from parameterized import parameterized from selenium.webdriver.common.by import By from gui_test.webdriver_base.woniusales_test import WoniuSalesTest from gui_test.woniusales_test.util.services import Services from gui_test.woniusales_test.util.utility import Utility from time import sleep from interface_test.woniusales_requests_test.common.customer_manager import CustomerManager import unittest from random import randint import json import pymysql import requests #准备数据 # with open("..\\test_data\\add_testdata",encoding="utf8") as file: # add_test_data = json.load(file) add_test_data=Utility.read_json("..\\test_data\\add_testdata") class Customer_Manager_case(unittest.TestCase): def setUp(self): self.session = requests.session() self.base_config_data=Utility.read_json("..\\config\\base_config") self.cookie_data =Utility.read_json("..\\config\\cookie_config") self.base_url=self.base_config_data["protocol"]+\ self.base_config_data["host"]+self.base_config_data["port"]+self.base_config_data["program"] login_url=self.base_url+self.cookie_data[0][0] login_data=self.cookie_data[0][1] resp_login = self.session.post(login_url, login_data) @parameterized.expand(add_test_data) def test_add_customer(self,add_last_url,test_data,expect): add_url=self.base_url+add_last_url resp_add=CustomerManager().add(self.session,add_url,test_data) print(resp_add.text) if str(resp_add.text)=="add-successful": actual="add-successful" else: actual = "add-fail" self.assertEqual(expect,actual) # print(resp_add.text) if __name__ == '__main__': unittest.main()
0026e40ec9bd5ad8a74bde35058625d629c82051
41b59a9c8381fa3a92f5d2c37c91261afb9c82c4
/Utility/Triggereffi/2017/test/crabConfig_Data_106x_analysis.py
c8f4a48ac4c04c5a00549ba54fd8e6adb854c568
[]
no_license
Sumankkundu/ChargedParticle
c6d4f90b55df49321df2ecd758bb1f39db896f8c
eb5bada24b37a58ded186d6e5d2d7bd00898fefe
refs/heads/master
2023-07-15T03:34:33.377203
2021-08-31T05:01:32
2021-08-31T05:01:32
231,091,587
1
0
null
null
null
null
UTF-8
Python
false
false
2,971
py
from CRABClient.UserUtilities import config config = config() #config.General.requestName = 'Trigger_2017UL_B' #config.General.requestName = 'Trigger_2017UL_C' #config.General.requestName = 'Trigger_2017UL_D' #config.General.requestName = 'Trigger_2017UL_E' config.General.requestName = 'Trigger_2017UL_F' config.General.workArea = 'crab_projects' config.General.transferOutputs = True config.General.transferLogs = True config.JobType.pluginName = 'Analysis' config.JobType.allowUndistributedCMSSW = True config.JobType.psetName = 'Run_QCD_test_106x_data_cfg.py' config.JobType.inputFiles= [ #"/afs/cern.ch/work/t/tsarkar/private/QCD-13/CMSSW_7_6_3/src/Test/QCDEventShape/test/Fall15_25nsV2_MC_PtResolution_AK4PFchs.txt", "/afs/cern.ch/work/t/tsarkar/private/QCD-13/CMSSW_7_6_3/src/Test/QCDEventShape/test/Fall15_25nsV2_MC_SF_AK4PFchs.txt", "/afs/cern.ch/work/t/tsarkar/private/QCD-13/CMSSW_7_6_3/src/Test/QCDEventShape/test/Fall15_25nsV2_DATA_UncertaintySources_AK4PF.txt" ] #config.Data.inputDataset = '/JetHT/Run2017B-09Aug2019_UL2017-v1/MINIAOD' #config.Data.inputDataset = '/JetHT/Run2017C-09Aug2019_UL2017-v1/MINIAOD' #config.Data.inputDataset = '/JetHT/Run2017D-09Aug2019_UL2017-v1/MINIAOD' #config.Data.inputDataset = '/JetHT/Run2017E-09Aug2019_UL2017-v1/MINIAOD' #config.Data.inputDataset = '/JetHT/Run2017F-09Aug2019_UL2017-v1/MINIAOD' #config.Data.inputDataset = '/JetHT/Run2017B-UL2017_MiniAODv2-v1/MINIAOD' #config.Data.inputDataset = '/JetHT/Run2017C-UL2017_MiniAODv2-v1/MINIAOD' #config.Data.inputDataset = '/JetHT/Run2017D-UL2017_MiniAODv2-v1/MINIAOD' #config.Data.inputDataset = '/JetHT/Run2017E-UL2017_MiniAODv2-v1/MINIAOD' config.Data.inputDataset = '/JetHT/Run2017F-UL2017_MiniAODv2-v1/MINIAOD' config.Data.inputDBS = 'global' #config.Data.splitting = 'Automatic' config.Data.splitting = 'LumiBased' config.Data.unitsPerJob = 15 #config.Data.unitsPerJob = 200 config.Data.lumiMask = '/afs/cern.ch/work/s/sukundu/private/ESV_charge_CMSSW/Uncertainty2017/cert/HLT_13TeV_UL2017_Collisions17_GoldenJSON.txt' #config.Data.lumiMask = '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions17/13TeV/Legacy_2017/Cert_294927-306462_13TeV_UL2017_Collisions17_GoldenJSON.txt' #config.Data.lumiMask = '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions17/13TeV/ReReco/Cert_294927-306462_13TeV_EOY2017ReReco_Collisions17_JSON_v1.txt' #config.Data.lumiMask = '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions17/13TeV/PromptReco/Cert_294927-306462_13TeV_PromptReco_Collisions17_JSON.txt' #config.Data.lumiMask = '/afs/cern.ch/cms/CAF/CMSCOMM/COMM_DQM/certification/Collisions16/13TeV/Legacy_2016/Cert_271036-284044_13TeV_Legacy2016_Collisions16_JSON.txt' #config.Data.runRange = '246908-260627' # '193093-194075' #config.Data.outLFNDirBase = '/store/user/%s/' % (getUsernameFromSiteDB()) config.Data.publication = False #config.Data.publishDataName = 'May2015_Data_analysis' config.Site.storageSite = 'T2_IN_TIFR'