hexsha
stringlengths 40
40
| size
int64 2
1.02M
| ext
stringclasses 10
values | lang
stringclasses 1
value | max_stars_repo_path
stringlengths 4
245
| max_stars_repo_name
stringlengths 6
130
| max_stars_repo_head_hexsha
stringlengths 40
40
| max_stars_repo_licenses
listlengths 1
10
| max_stars_count
int64 1
191k
⌀ | max_stars_repo_stars_event_min_datetime
stringlengths 24
24
⌀ | max_stars_repo_stars_event_max_datetime
stringlengths 24
24
⌀ | max_issues_repo_path
stringlengths 4
245
| max_issues_repo_name
stringlengths 6
130
| max_issues_repo_head_hexsha
stringlengths 40
40
| max_issues_repo_licenses
listlengths 1
10
| max_issues_count
int64 1
67k
⌀ | max_issues_repo_issues_event_min_datetime
stringlengths 24
24
⌀ | max_issues_repo_issues_event_max_datetime
stringlengths 24
24
⌀ | max_forks_repo_path
stringlengths 4
245
| max_forks_repo_name
stringlengths 6
130
| max_forks_repo_head_hexsha
stringlengths 40
40
| max_forks_repo_licenses
listlengths 1
10
| max_forks_count
int64 1
105k
⌀ | max_forks_repo_forks_event_min_datetime
stringlengths 24
24
⌀ | max_forks_repo_forks_event_max_datetime
stringlengths 24
24
⌀ | content
stringlengths 2
1.02M
| avg_line_length
float64 1
417k
| max_line_length
int64 1
987k
| alphanum_fraction
float64 0
1
| content_no_comment
stringlengths 0
1.01M
| is_comment_constant_removed
bool 1
class | is_sharp_comment_removed
bool 1
class |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
f70a111ad3d409ffefa00c4d03e4c96bc4459064
| 2,136
|
py
|
Python
|
qa/rpc-tests/getchaintips.py
|
mirzaei-ce/core-moselbit
|
7e8e723109f22b0fddfa227692b9492f48d12d7c
|
[
"MIT"
] | null | null | null |
qa/rpc-tests/getchaintips.py
|
mirzaei-ce/core-moselbit
|
7e8e723109f22b0fddfa227692b9492f48d12d7c
|
[
"MIT"
] | null | null | null |
qa/rpc-tests/getchaintips.py
|
mirzaei-ce/core-moselbit
|
7e8e723109f22b0fddfa227692b9492f48d12d7c
|
[
"MIT"
] | null | null | null |
#!/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.
# Exercise the getchaintips API. We introduce a network split, work
# on chains of different lengths, and join the network together again.
# This gives us two tips, verify that it works.
from test_framework.test_framework import MoselbitTestFramework
from test_framework.util import assert_equal
class GetChainTipsTest (MoselbitTestFramework):
def run_test (self):
MoselbitTestFramework.run_test (self)
tips = self.nodes[0].getchaintips ()
assert_equal (len (tips), 1)
assert_equal (tips[0]['branchlen'], 0)
assert_equal (tips[0]['height'], 200)
assert_equal (tips[0]['status'], 'active')
# Split the network and build two chains of different lengths.
self.split_network ()
self.nodes[0].generate(10)
self.nodes[2].generate(20)
self.sync_all ()
tips = self.nodes[1].getchaintips ()
assert_equal (len (tips), 1)
shortTip = tips[0]
assert_equal (shortTip['branchlen'], 0)
assert_equal (shortTip['height'], 210)
assert_equal (tips[0]['status'], 'active')
tips = self.nodes[3].getchaintips ()
assert_equal (len (tips), 1)
longTip = tips[0]
assert_equal (longTip['branchlen'], 0)
assert_equal (longTip['height'], 220)
assert_equal (tips[0]['status'], 'active')
# Join the network halves and check that we now have two tips
# (at least at the nodes that previously had the short chain).
self.join_network ()
tips = self.nodes[0].getchaintips ()
assert_equal (len (tips), 2)
assert_equal (tips[0], longTip)
assert_equal (tips[1]['branchlen'], 10)
assert_equal (tips[1]['status'], 'valid-fork')
tips[1]['branchlen'] = 0
tips[1]['status'] = 'active'
assert_equal (tips[1], shortTip)
if __name__ == '__main__':
GetChainTipsTest ().main ()
| 35.6
| 70
| 0.643727
|
from test_framework.test_framework import MoselbitTestFramework
from test_framework.util import assert_equal
class GetChainTipsTest (MoselbitTestFramework):
def run_test (self):
MoselbitTestFramework.run_test (self)
tips = self.nodes[0].getchaintips ()
assert_equal (len (tips), 1)
assert_equal (tips[0]['branchlen'], 0)
assert_equal (tips[0]['height'], 200)
assert_equal (tips[0]['status'], 'active')
self.split_network ()
self.nodes[0].generate(10)
self.nodes[2].generate(20)
self.sync_all ()
tips = self.nodes[1].getchaintips ()
assert_equal (len (tips), 1)
shortTip = tips[0]
assert_equal (shortTip['branchlen'], 0)
assert_equal (shortTip['height'], 210)
assert_equal (tips[0]['status'], 'active')
tips = self.nodes[3].getchaintips ()
assert_equal (len (tips), 1)
longTip = tips[0]
assert_equal (longTip['branchlen'], 0)
assert_equal (longTip['height'], 220)
assert_equal (tips[0]['status'], 'active')
self.join_network ()
tips = self.nodes[0].getchaintips ()
assert_equal (len (tips), 2)
assert_equal (tips[0], longTip)
assert_equal (tips[1]['branchlen'], 10)
assert_equal (tips[1]['status'], 'valid-fork')
tips[1]['branchlen'] = 0
tips[1]['status'] = 'active'
assert_equal (tips[1], shortTip)
if __name__ == '__main__':
GetChainTipsTest ().main ()
| true
| true
|
f70a125670f78eacba803b405bf1888af7478244
| 853
|
py
|
Python
|
aitlas/transforms/classification.py
|
tiendzung-le/aitlas
|
4725693a5c073cc80a617fb9bab5a1557c3c3270
|
[
"MIT"
] | 32
|
2020-12-04T19:48:19.000Z
|
2022-03-16T18:18:05.000Z
|
aitlas/transforms/classification.py
|
likyoo/aitlas
|
1c365e055c18e349e41670a4137c4d2b88671af9
|
[
"MIT"
] | 2
|
2021-04-11T17:09:14.000Z
|
2021-05-14T13:22:41.000Z
|
aitlas/transforms/classification.py
|
likyoo/aitlas
|
1c365e055c18e349e41670a4137c4d2b88671af9
|
[
"MIT"
] | 8
|
2021-04-06T22:06:27.000Z
|
2022-01-30T06:01:39.000Z
|
from torchvision import transforms
from ..base import BaseTransforms
class ResizeCenterCropFlipHVToTensor(BaseTransforms):
def __call__(self, sample):
data_transforms = transforms.Compose([
transforms.ToPILImage(),
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.RandomHorizontalFlip(),
transforms.RandomVerticalFlip(),
transforms.ToTensor(),
])
return data_transforms(sample)
class ResizeCenterCropToTensor(BaseTransforms):
def __call__(self, sample):
data_transforms = transforms.Compose([
transforms.ToPILImage(),
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
])
return data_transforms(sample)
| 28.433333
| 54
| 0.620164
|
from torchvision import transforms
from ..base import BaseTransforms
class ResizeCenterCropFlipHVToTensor(BaseTransforms):
def __call__(self, sample):
data_transforms = transforms.Compose([
transforms.ToPILImage(),
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.RandomHorizontalFlip(),
transforms.RandomVerticalFlip(),
transforms.ToTensor(),
])
return data_transforms(sample)
class ResizeCenterCropToTensor(BaseTransforms):
def __call__(self, sample):
data_transforms = transforms.Compose([
transforms.ToPILImage(),
transforms.Resize(256),
transforms.CenterCrop(224),
transforms.ToTensor(),
])
return data_transforms(sample)
| true
| true
|
f70a13330f3cce522d7d897373b4d306174ba6ee
| 1,393
|
py
|
Python
|
treefrog/setup.py
|
oberhamsi/FrameworkBenchmarks
|
660a66d51a9aad10b43c0660208fb13c098121af
|
[
"BSD-3-Clause"
] | 4
|
2015-01-22T02:13:03.000Z
|
2018-06-13T12:02:46.000Z
|
frameworks/C++/treefrog/setup.py
|
ratpack/FrameworkBenchmarks
|
81604309e46e382fe2ffb7970a87d728f20c8be6
|
[
"BSD-3-Clause"
] | null | null | null |
frameworks/C++/treefrog/setup.py
|
ratpack/FrameworkBenchmarks
|
81604309e46e382fe2ffb7970a87d728f20c8be6
|
[
"BSD-3-Clause"
] | null | null | null |
import subprocess
import sys
import setup_util
from os.path import expanduser
home = expanduser("~")
##############
# start(args)
##############
def start(args, logfile, errfile):
setup_util.replace_text("treefrog/config/database.ini", "HostName=.*", "HostName=" + args.database_host)
setup_util.replace_text("treefrog/config/application.ini", "MultiProcessingModule=.*", "MultiProcessingModule=hybrid")
# 1. Generate Makefile
# 2. Compile applicaton
# 3. Clean log files
# 4. Start TreeFrog
try:
subprocess.check_call("qmake -r CONFIG+=release", shell=True, cwd="treefrog", stderr=errfile, stdout=logfile)
subprocess.check_call("make clean", shell=True, cwd="treefrog", stderr=errfile, stdout=logfile)
subprocess.check_call("make -j8", shell=True, cwd="treefrog", stderr=errfile, stdout=logfile)
subprocess.check_call("rm -f log/*.log", shell=True, cwd="treefrog", stderr=errfile, stdout=logfile)
subprocess.check_call("treefrog -d " + home + "/FrameworkBenchmarks/treefrog", shell=True, stderr=errfile, stdout=logfile)
return 0
except subprocess.CalledProcessError:
return 1
##############
# stop()
##############
def stop(logfile, errfile):
try:
subprocess.call("treefrog -k abort " + home + "/FrameworkBenchmarks/treefrog", shell=True, stderr=errfile, stdout=logfile)
return 0
except subprocess.CalledProcessError:
return 1
| 35.717949
| 126
| 0.703518
|
import subprocess
import sys
import setup_util
from os.path import expanduser
home = expanduser("~")
onfig/application.ini", "MultiProcessingModule=.*", "MultiProcessingModule=hybrid")
try:
subprocess.check_call("qmake -r CONFIG+=release", shell=True, cwd="treefrog", stderr=errfile, stdout=logfile)
subprocess.check_call("make clean", shell=True, cwd="treefrog", stderr=errfile, stdout=logfile)
subprocess.check_call("make -j8", shell=True, cwd="treefrog", stderr=errfile, stdout=logfile)
subprocess.check_call("rm -f log/*.log", shell=True, cwd="treefrog", stderr=errfile, stdout=logfile)
subprocess.check_call("treefrog -d " + home + "/FrameworkBenchmarks/treefrog", shell=True, stderr=errfile, stdout=logfile)
return 0
except subprocess.CalledProcessError:
return 1
cept subprocess.CalledProcessError:
return 1
| true
| true
|
f70a13567965eaf01adcb5afda46bb9ab109f32e
| 1,339
|
py
|
Python
|
tests/int_pro_surveys.py
|
wfarah/frbpoppy
|
e575c49e6b4a69015a66d3f38a3459e0ffe4eb05
|
[
"MIT"
] | null | null | null |
tests/int_pro_surveys.py
|
wfarah/frbpoppy
|
e575c49e6b4a69015a66d3f38a3459e0ffe4eb05
|
[
"MIT"
] | null | null | null |
tests/int_pro_surveys.py
|
wfarah/frbpoppy
|
e575c49e6b4a69015a66d3f38a3459e0ffe4eb05
|
[
"MIT"
] | null | null | null |
"""Plot intensity profile of theoretical beam patterns."""
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import binned_statistic as bstat
from frbpoppy.survey import Survey
OBSERVATORIES = [('parkes', 'htru'),
('apertif', 'apertif')]
n = int(1e6)
for obs in OBSERVATORIES:
survey = obs[1]
pattern = obs[0]
s = Survey(survey, gain_pattern=pattern)
int_pro, offset = s.intensity_profile(n_gen=n)
# Sort the values
sorted_int = np.argsort(offset)
int_pro = int_pro[sorted_int]
offset = offset[sorted_int]
# Offset in degrees
offset = offset/60.
bins = 1e2
bin_means, bin_edges, bin_numbers = bstat(offset,
int_pro,
statistic='mean',
bins=bins)
bin_mins, _, _ = bstat(offset, int_pro, statistic='min', bins=bins)
bin_maxs, _, _ = bstat(offset, int_pro, statistic='max', bins=bins)
center = (bin_edges[:-1] + bin_edges[1:]) / 2
plt.plot(center, bin_means, label=pattern)
plt.fill_between(center, bin_mins, bin_maxs, alpha=0.2)
plt.xlabel(f'Offset ($\degree$)')
plt.ylabel('Intensity Profile')
plt.yscale('log')
plt.legend()
plt.tight_layout()
plt.savefig('plots/int_pro_surveys.pdf')
| 26.254902
| 71
| 0.612397
|
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import binned_statistic as bstat
from frbpoppy.survey import Survey
OBSERVATORIES = [('parkes', 'htru'),
('apertif', 'apertif')]
n = int(1e6)
for obs in OBSERVATORIES:
survey = obs[1]
pattern = obs[0]
s = Survey(survey, gain_pattern=pattern)
int_pro, offset = s.intensity_profile(n_gen=n)
sorted_int = np.argsort(offset)
int_pro = int_pro[sorted_int]
offset = offset[sorted_int]
offset = offset/60.
bins = 1e2
bin_means, bin_edges, bin_numbers = bstat(offset,
int_pro,
statistic='mean',
bins=bins)
bin_mins, _, _ = bstat(offset, int_pro, statistic='min', bins=bins)
bin_maxs, _, _ = bstat(offset, int_pro, statistic='max', bins=bins)
center = (bin_edges[:-1] + bin_edges[1:]) / 2
plt.plot(center, bin_means, label=pattern)
plt.fill_between(center, bin_mins, bin_maxs, alpha=0.2)
plt.xlabel(f'Offset ($\degree$)')
plt.ylabel('Intensity Profile')
plt.yscale('log')
plt.legend()
plt.tight_layout()
plt.savefig('plots/int_pro_surveys.pdf')
| true
| true
|
f70a13ae6569d81bdfa4c8e185bdd5411b6c5afb
| 273
|
py
|
Python
|
sciwing/modules/__init__.py
|
sean-dingxu/sciwing
|
75eca1ea43be165eab20cf8bd81bbc19cecda74c
|
[
"MIT"
] | 50
|
2019-09-13T10:32:29.000Z
|
2022-02-14T16:52:53.000Z
|
sciwing/modules/__init__.py
|
sean-dingxu/sciwing
|
75eca1ea43be165eab20cf8bd81bbc19cecda74c
|
[
"MIT"
] | 31
|
2019-09-03T11:06:03.000Z
|
2021-08-20T14:57:09.000Z
|
sciwing/modules/__init__.py
|
sean-dingxu/sciwing
|
75eca1ea43be165eab20cf8bd81bbc19cecda74c
|
[
"MIT"
] | 9
|
2019-09-16T03:25:15.000Z
|
2021-05-11T10:28:25.000Z
|
from sciwing.modules.embedders import *
from sciwing.modules.bow_encoder import BOW_Encoder
from sciwing.modules.lstm2vecencoder import LSTM2VecEncoder
from sciwing.modules.lstm2seqencoder import Lstm2SeqEncoder
from sciwing.modules.charlstm_encoder import CharLSTMEncoder
| 45.5
| 60
| 0.886447
|
from sciwing.modules.embedders import *
from sciwing.modules.bow_encoder import BOW_Encoder
from sciwing.modules.lstm2vecencoder import LSTM2VecEncoder
from sciwing.modules.lstm2seqencoder import Lstm2SeqEncoder
from sciwing.modules.charlstm_encoder import CharLSTMEncoder
| true
| true
|
f70a14c8089f951f793cbbb534fcff9da041bd68
| 5,154
|
py
|
Python
|
automation/services/watchdog/metrics.py
|
adong-corp/mina
|
4d2678444f3c2457f203bdf9b8ae0d6a9202ccfc
|
[
"Apache-2.0"
] | 1
|
2021-03-29T18:24:14.000Z
|
2021-03-29T18:24:14.000Z
|
automation/services/watchdog/metrics.py
|
adong-corp/mina
|
4d2678444f3c2457f203bdf9b8ae0d6a9202ccfc
|
[
"Apache-2.0"
] | null | null | null |
automation/services/watchdog/metrics.py
|
adong-corp/mina
|
4d2678444f3c2457f203bdf9b8ae0d6a9202ccfc
|
[
"Apache-2.0"
] | 1
|
2021-12-18T20:29:13.000Z
|
2021-12-18T20:29:13.000Z
|
import itertools
import datetime
import util
import asyncio
import random
import os
import sys
import traceback
import subprocess
import time
import json
import urllib.request
import ast
from google.cloud import storage
# ========================================================================
def collect_cluster_crashes(v1, namespace, cluster_crashes):
print('collecting cluster crashes / restarts')
pods = v1.list_namespaced_pod(namespace, watch=False)
containers = list(itertools.chain(*[ pod.to_dict()['status']['container_statuses'] for pod in pods.items ]))
mina_containers = list(filter(lambda c: c['name'] in [ 'coda', 'seed', 'coordinator', 'archive' ], containers))
def restarted_recently(c):
if c['restart_count'] == 0:
return False
terminated = c['last_state']['terminated']
if terminated is None:
return False
restart_time = terminated['started_at']
retart_age_seconds = (datetime.datetime.now(datetime.timezone.utc) - restart_time).total_seconds()
# restarted less than 30 minutes ago
return retart_age_seconds <= 30*60
recently_restarted_containers = list(filter(lambda c: restarted_recently(c), mina_containers))
fraction_recently_restarted = len(recently_restarted_containers)/len(mina_containers)
print(len(recently_restarted_containers), 'of', len(mina_containers), 'recently restarted')
cluster_crashes.set(fraction_recently_restarted)
# ========================================================================
def pods_with_no_new_logs(v1, namespace, nodes_with_no_new_logs):
print('counting pods with no new logs')
pods = v1.list_namespaced_pod(namespace, watch=False)
ten_minutes = 10 * 60
count = 0
for pod in pods.items:
containers = pod.status.container_statuses
mina_containers = list(filter(lambda c: c.name in [ 'coda', 'seed', 'coordinator' ], containers))
if len(mina_containers) != 0:
name = pod.metadata.name
recent_logs = v1.read_namespaced_pod_log(name=name, namespace=namespace, since_seconds=ten_minutes, container=mina_containers[0].name)
if len(recent_logs) == 0:
count += 1
total_count = len(pods.items)
fraction_no_new_logs = float(count) / float(total_count)
print(count, 'of', total_count, 'pods have no logs in the last 10 minutes')
nodes_with_no_new_logs.set(fraction_no_new_logs)
# ========================================================================
from node_status_metrics import collect_node_status_metrics
# ========================================================================
def check_google_storage_bucket(v1, namespace, recent_google_bucket_blocks):
print('checking google storage bucket')
bucket = 'mina_network_block_data'
now = time.time()
storage_client = storage.Client()
blobs = list(storage_client.list_blobs(bucket, prefix=namespace))
blob_ages = [ now - b.generation/1e6 for b in blobs ]
newest_age = min([ age for age in blob_ages ])
recent_google_bucket_blocks.set(newest_age)
# ========================================================================
def daemon_containers(v1, namespace):
pods = v1.list_namespaced_pod(namespace, watch=False)
for pod in pods.items:
containers = pod.status.container_statuses
for c in containers:
if c.name in [ 'coda', 'mina', 'seed']:
yield (pod.metadata.name, c.name)
def get_chain_id(v1, namespace):
for (pod_name, container_name) in daemon_containers(v1, namespace):
resp = util.exec_on_pod(v1, namespace, pod_name, container_name, 'mina client status --json')
try:
resp = resp.strip()
if resp[0] != '{':
#first line could be 'Using password from environment variable CODA_PRIVKEY_PASS'
resp = resp.split("\n", 1)[1]
resp_dict = ast.literal_eval(resp.strip())
print("Chain ID: {}".format(resp_dict['chain_id']))
return resp_dict['chain_id']
except Exception as e:
print("Exception when extracting chain id: {}\n mina client status response: {}".format(e, resp))
continue
def check_seed_list_up(v1, namespace, seeds_reachable):
print('checking seed list up')
seed_peers_list_url = os.environ.get('SEED_PEERS_URL')
with urllib.request.urlopen(seed_peers_list_url) as f:
contents = f.read().decode('utf-8')
seeds = ' '.join(contents.split('\n'))
#stdbuf -o0 is to disable buffering
chain_id = get_chain_id(v1, namespace)
if chain_id is None:
print('could not get chain id')
else:
command = 'stdbuf -o0 check_libp2p/check_libp2p ' + chain_id + ' ' + seeds
proc = subprocess.Popen(command,stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, text=True)
for line in proc.stderr.readlines():
print("check_libp2p error: {}".format(line))
val = proc.stdout.read()
print("check_libp2p output: {}".format(val))
proc.stdout.close()
proc.wait()
res = json.loads(val)
#checklibp2p returns whether or not the connection to a peerID errored
fraction_up = sum(res.values())/len(res.values())
seeds_reachable.set(fraction_up)
# ========================================================================
| 34.13245
| 140
| 0.658324
|
import itertools
import datetime
import util
import asyncio
import random
import os
import sys
import traceback
import subprocess
import time
import json
import urllib.request
import ast
from google.cloud import storage
def collect_cluster_crashes(v1, namespace, cluster_crashes):
print('collecting cluster crashes / restarts')
pods = v1.list_namespaced_pod(namespace, watch=False)
containers = list(itertools.chain(*[ pod.to_dict()['status']['container_statuses'] for pod in pods.items ]))
mina_containers = list(filter(lambda c: c['name'] in [ 'coda', 'seed', 'coordinator', 'archive' ], containers))
def restarted_recently(c):
if c['restart_count'] == 0:
return False
terminated = c['last_state']['terminated']
if terminated is None:
return False
restart_time = terminated['started_at']
retart_age_seconds = (datetime.datetime.now(datetime.timezone.utc) - restart_time).total_seconds()
return retart_age_seconds <= 30*60
recently_restarted_containers = list(filter(lambda c: restarted_recently(c), mina_containers))
fraction_recently_restarted = len(recently_restarted_containers)/len(mina_containers)
print(len(recently_restarted_containers), 'of', len(mina_containers), 'recently restarted')
cluster_crashes.set(fraction_recently_restarted)
def pods_with_no_new_logs(v1, namespace, nodes_with_no_new_logs):
print('counting pods with no new logs')
pods = v1.list_namespaced_pod(namespace, watch=False)
ten_minutes = 10 * 60
count = 0
for pod in pods.items:
containers = pod.status.container_statuses
mina_containers = list(filter(lambda c: c.name in [ 'coda', 'seed', 'coordinator' ], containers))
if len(mina_containers) != 0:
name = pod.metadata.name
recent_logs = v1.read_namespaced_pod_log(name=name, namespace=namespace, since_seconds=ten_minutes, container=mina_containers[0].name)
if len(recent_logs) == 0:
count += 1
total_count = len(pods.items)
fraction_no_new_logs = float(count) / float(total_count)
print(count, 'of', total_count, 'pods have no logs in the last 10 minutes')
nodes_with_no_new_logs.set(fraction_no_new_logs)
from node_status_metrics import collect_node_status_metrics
def check_google_storage_bucket(v1, namespace, recent_google_bucket_blocks):
print('checking google storage bucket')
bucket = 'mina_network_block_data'
now = time.time()
storage_client = storage.Client()
blobs = list(storage_client.list_blobs(bucket, prefix=namespace))
blob_ages = [ now - b.generation/1e6 for b in blobs ]
newest_age = min([ age for age in blob_ages ])
recent_google_bucket_blocks.set(newest_age)
def daemon_containers(v1, namespace):
pods = v1.list_namespaced_pod(namespace, watch=False)
for pod in pods.items:
containers = pod.status.container_statuses
for c in containers:
if c.name in [ 'coda', 'mina', 'seed']:
yield (pod.metadata.name, c.name)
def get_chain_id(v1, namespace):
for (pod_name, container_name) in daemon_containers(v1, namespace):
resp = util.exec_on_pod(v1, namespace, pod_name, container_name, 'mina client status --json')
try:
resp = resp.strip()
if resp[0] != '{':
resp = resp.split("\n", 1)[1]
resp_dict = ast.literal_eval(resp.strip())
print("Chain ID: {}".format(resp_dict['chain_id']))
return resp_dict['chain_id']
except Exception as e:
print("Exception when extracting chain id: {}\n mina client status response: {}".format(e, resp))
continue
def check_seed_list_up(v1, namespace, seeds_reachable):
print('checking seed list up')
seed_peers_list_url = os.environ.get('SEED_PEERS_URL')
with urllib.request.urlopen(seed_peers_list_url) as f:
contents = f.read().decode('utf-8')
seeds = ' '.join(contents.split('\n'))
chain_id = get_chain_id(v1, namespace)
if chain_id is None:
print('could not get chain id')
else:
command = 'stdbuf -o0 check_libp2p/check_libp2p ' + chain_id + ' ' + seeds
proc = subprocess.Popen(command,stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True, text=True)
for line in proc.stderr.readlines():
print("check_libp2p error: {}".format(line))
val = proc.stdout.read()
print("check_libp2p output: {}".format(val))
proc.stdout.close()
proc.wait()
res = json.loads(val)
fraction_up = sum(res.values())/len(res.values())
seeds_reachable.set(fraction_up)
| true
| true
|
f70a14e8b52c68a0c9a1982722017841cbfaa1df
| 4,343
|
py
|
Python
|
tests/test_tags.py
|
nomadixinc/django-money
|
2c04749110c78978d4f12fe42d8f28a7bc9014dd
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_tags.py
|
nomadixinc/django-money
|
2c04749110c78978d4f12fe42d8f28a7bc9014dd
|
[
"BSD-3-Clause"
] | null | null | null |
tests/test_tags.py
|
nomadixinc/django-money
|
2c04749110c78978d4f12fe42d8f28a7bc9014dd
|
[
"BSD-3-Clause"
] | 2
|
2019-08-29T04:51:29.000Z
|
2019-09-25T08:46:27.000Z
|
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template import Context, Template, TemplateSyntaxError
from django.utils.translation import override
import pytest
from djmoney.models.fields import MoneyPatched
from djmoney.templatetags.djmoney import MoneyLocalizeNode
from moneyed import Money
def render(template, context):
return Template(template).render(Context(context))
class TestMoneyLocalizeNode:
def test_repr(self):
assert repr(MoneyLocalizeNode(Money(5, 'EUR'))) == '<MoneyLocalizeNode 5 EUR>'
def test_invalid_instance(self):
with pytest.raises(Exception) as exc:
MoneyLocalizeNode(Money(5, 'EUR'), amount=15)
assert str(exc.value) == 'You can define either "money" or the "amount" and "currency".'
@pytest.mark.parametrize('template, context, error_text', (
(
'{% load djmoney %}{% money_localize "2.5" "PLN" as NEW_M and blabla %}{{NEW_M}}',
{},
'Wrong number of input data to the tag.'
),
(
'{% load djmoney %}{% money_localize money %}{{NEW_M}}',
{'money': 'Something else'},
'The variable "money" must be an instance of Money.'
),
(
'{% load djmoney %}{% money_localize amount currency %}',
{'amount': None, 'currency': 'PLN'},
'You must define both variables: amount and currency.'
)
))
def test_invalid_input(template, context, error_text):
with pytest.raises(TemplateSyntaxError) as exc:
render(template, context)
assert str(exc.value) == error_text
def assert_template(string, result, context=None):
context = context or {}
with override('pl'):
assert render(string, context) == result
@pytest.mark.parametrize(
'string, result, context',
(
(
'{% load djmoney %}{% money_localize "2.5" "PLN" as NEW_M %}{{NEW_M}}',
'2,50 zł',
{}
),
(
'{% load djmoney %}{% money_localize "2.5" "PLN" %}',
'2,50 zł',
{}
),
(
'{% load djmoney %}{% money_localize amount currency %}',
'2,60 zł',
{'amount': 2.6, 'currency': 'PLN'}
),
(
'{% load djmoney %}{% money_localize money as NEW_M %}{{NEW_M}}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money off as NEW_M %}{{NEW_M}}',
'2.30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money off as NEW_M %}{{NEW_M}}',
'0.00 zł',
{'money': Money(0, 'PLN')}
),
(
# with a tag template "money_localize"
'{% load djmoney %}{% money_localize money %}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
),
(
# without a tag template "money_localize"
'{{ money }}',
'2,30 zł',
{'money': MoneyPatched(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money off %}',
'2.30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money on %}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
)
)
)
def test_tag(string, result, context):
assert_template(string, result, context)
@pytest.mark.parametrize(
'string, result, context',
(
(
# money_localize has a default setting USE_L10N = True
'{% load djmoney %}{% money_localize money %}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
),
(
# without a tag template "money_localize"
'{{ money }}',
'2.30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money on %}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
),
)
)
def test_l10n_off(settings, string, result, context):
settings.USE_L10N = False
assert_template(string, result, context)
def test_forced_l10n():
mp = MoneyPatched(2.3, 'PLN')
mp.use_l10n = True
assert_template('{{ money }}', '2,30 zł', {'money': mp})
| 28.953333
| 96
| 0.521529
|
from __future__ import unicode_literals
from django.template import Context, Template, TemplateSyntaxError
from django.utils.translation import override
import pytest
from djmoney.models.fields import MoneyPatched
from djmoney.templatetags.djmoney import MoneyLocalizeNode
from moneyed import Money
def render(template, context):
return Template(template).render(Context(context))
class TestMoneyLocalizeNode:
def test_repr(self):
assert repr(MoneyLocalizeNode(Money(5, 'EUR'))) == '<MoneyLocalizeNode 5 EUR>'
def test_invalid_instance(self):
with pytest.raises(Exception) as exc:
MoneyLocalizeNode(Money(5, 'EUR'), amount=15)
assert str(exc.value) == 'You can define either "money" or the "amount" and "currency".'
@pytest.mark.parametrize('template, context, error_text', (
(
'{% load djmoney %}{% money_localize "2.5" "PLN" as NEW_M and blabla %}{{NEW_M}}',
{},
'Wrong number of input data to the tag.'
),
(
'{% load djmoney %}{% money_localize money %}{{NEW_M}}',
{'money': 'Something else'},
'The variable "money" must be an instance of Money.'
),
(
'{% load djmoney %}{% money_localize amount currency %}',
{'amount': None, 'currency': 'PLN'},
'You must define both variables: amount and currency.'
)
))
def test_invalid_input(template, context, error_text):
with pytest.raises(TemplateSyntaxError) as exc:
render(template, context)
assert str(exc.value) == error_text
def assert_template(string, result, context=None):
context = context or {}
with override('pl'):
assert render(string, context) == result
@pytest.mark.parametrize(
'string, result, context',
(
(
'{% load djmoney %}{% money_localize "2.5" "PLN" as NEW_M %}{{NEW_M}}',
'2,50 zł',
{}
),
(
'{% load djmoney %}{% money_localize "2.5" "PLN" %}',
'2,50 zł',
{}
),
(
'{% load djmoney %}{% money_localize amount currency %}',
'2,60 zł',
{'amount': 2.6, 'currency': 'PLN'}
),
(
'{% load djmoney %}{% money_localize money as NEW_M %}{{NEW_M}}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money off as NEW_M %}{{NEW_M}}',
'2.30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money off as NEW_M %}{{NEW_M}}',
'0.00 zł',
{'money': Money(0, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money %}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{{ money }}',
'2,30 zł',
{'money': MoneyPatched(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money off %}',
'2.30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money on %}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
)
)
)
def test_tag(string, result, context):
assert_template(string, result, context)
@pytest.mark.parametrize(
'string, result, context',
(
(
'{% load djmoney %}{% money_localize money %}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{{ money }}',
'2.30 zł',
{'money': Money(2.3, 'PLN')}
),
(
'{% load djmoney %}{% money_localize money on %}',
'2,30 zł',
{'money': Money(2.3, 'PLN')}
),
)
)
def test_l10n_off(settings, string, result, context):
settings.USE_L10N = False
assert_template(string, result, context)
def test_forced_l10n():
mp = MoneyPatched(2.3, 'PLN')
mp.use_l10n = True
assert_template('{{ money }}', '2,30 zł', {'money': mp})
| true
| true
|
f70a153b88783e9a6e3e8721963f8b862849cdcb
| 70
|
py
|
Python
|
rlutils/pytorch/__init__.py
|
vermouth1992/rlutils
|
a326373b9e39dbf147c6c4261b82a688d4dc3e78
|
[
"Apache-2.0"
] | null | null | null |
rlutils/pytorch/__init__.py
|
vermouth1992/rlutils
|
a326373b9e39dbf147c6c4261b82a688d4dc3e78
|
[
"Apache-2.0"
] | null | null | null |
rlutils/pytorch/__init__.py
|
vermouth1992/rlutils
|
a326373b9e39dbf147c6c4261b82a688d4dc3e78
|
[
"Apache-2.0"
] | null | null | null |
from . import distributions
from . import functional
from . import nn
| 17.5
| 27
| 0.785714
|
from . import distributions
from . import functional
from . import nn
| true
| true
|
f70a16364238c5a4f7f1a12687bc6b9e07edc599
| 970
|
py
|
Python
|
Searching and Sorting/Merge sort/Python/merge_sort.py
|
Subrato-oid/cs-algorithms
|
4a04fe49f513c439b641a8e4e783a98cd99dc909
|
[
"MIT"
] | 239
|
2019-10-07T11:01:56.000Z
|
2022-01-27T19:08:55.000Z
|
Searching and Sorting/Merge sort/Python/merge_sort.py
|
ashfreakingoyal/cs-algorithms
|
08f5aba5c3379e17d03b899fc36efcdccebd181c
|
[
"MIT"
] | 176
|
2019-10-07T06:59:49.000Z
|
2020-09-30T08:16:22.000Z
|
Searching and Sorting/Merge sort/Python/merge_sort.py
|
ashfreakingoyal/cs-algorithms
|
08f5aba5c3379e17d03b899fc36efcdccebd181c
|
[
"MIT"
] | 441
|
2019-10-07T07:34:08.000Z
|
2022-03-15T07:19:58.000Z
|
def mergesort(items):
if len(items) <= 1:
return items
mid = len(items) // 2
left = items[:mid]
right = items[mid:]
left = mergesort(left)
right = mergesort(right)
return merge(left, right)
def merge(left, right):
merged = []
left_index = 0
right_index = 0
while left_index < len(left) and right_index < len(right):
if left[left_index] > right[right_index]:
merged.append(right[right_index])
right_index += 1
else:
merged.append(left[left_index])
left_index += 1
merged += left[left_index:]
merged += right[right_index:]
return merged
test_list_1 = [8, 3, 1, 7, 0, 10, 2]
test_list_2 = [1, 0]
test_list_3 = [97, 98, 99]
print('{} to {}'.format(test_list_1, mergesort(test_list_1)))
print('{} to {}'.format(test_list_2, mergesort(test_list_2)))
print('{} to {}'.format(test_list_3, mergesort(test_list_3)))
| 25.526316
| 62
| 0.587629
|
def mergesort(items):
if len(items) <= 1:
return items
mid = len(items) // 2
left = items[:mid]
right = items[mid:]
left = mergesort(left)
right = mergesort(right)
return merge(left, right)
def merge(left, right):
merged = []
left_index = 0
right_index = 0
while left_index < len(left) and right_index < len(right):
if left[left_index] > right[right_index]:
merged.append(right[right_index])
right_index += 1
else:
merged.append(left[left_index])
left_index += 1
merged += left[left_index:]
merged += right[right_index:]
return merged
test_list_1 = [8, 3, 1, 7, 0, 10, 2]
test_list_2 = [1, 0]
test_list_3 = [97, 98, 99]
print('{} to {}'.format(test_list_1, mergesort(test_list_1)))
print('{} to {}'.format(test_list_2, mergesort(test_list_2)))
print('{} to {}'.format(test_list_3, mergesort(test_list_3)))
| true
| true
|
f70a168c3c1ea13d7bafe7bef9dcf39a28e655b8
| 151
|
py
|
Python
|
dependencies/bluebird-master/examples/followers.py
|
munyolec/Impact-of-Covid-19-on-Food-and-Air-Quality-in-Africa
|
fb5762b8a759aa5bc368edd6ea3ac714af853b1e
|
[
"MIT"
] | 2
|
2020-10-22T16:19:34.000Z
|
2020-12-19T15:51:00.000Z
|
dependencies/bluebird-master/examples/followers.py
|
munyolec/Impact-of-Covid-19-on-Food-and-Air-Quality-in-Africa
|
fb5762b8a759aa5bc368edd6ea3ac714af853b1e
|
[
"MIT"
] | null | null | null |
dependencies/bluebird-master/examples/followers.py
|
munyolec/Impact-of-Covid-19-on-Food-and-Air-Quality-in-Africa
|
fb5762b8a759aa5bc368edd6ea3ac714af853b1e
|
[
"MIT"
] | 6
|
2020-09-28T07:31:29.000Z
|
2020-09-29T10:51:50.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from bluebird import BlueBird
for username in BlueBird().get_followers('brunn3is'):
print(username)
| 21.571429
| 53
| 0.701987
|
from bluebird import BlueBird
for username in BlueBird().get_followers('brunn3is'):
print(username)
| true
| true
|
f70a176b0b06930bded82cfc3477e7bf3ca21f6b
| 18,419
|
py
|
Python
|
rancher.py
|
xl82602/xl
|
79c48d121f669ae0d95861f24e5efd58dd16de0c
|
[
"MIT"
] | null | null | null |
rancher.py
|
xl82602/xl
|
79c48d121f669ae0d95861f24e5efd58dd16de0c
|
[
"MIT"
] | null | null | null |
rancher.py
|
xl82602/xl
|
79c48d121f669ae0d95861f24e5efd58dd16de0c
|
[
"MIT"
] | null | null | null |
# !/usr/bin/env python
import re
import requests
import collections
import hashlib
import os
import json
import time
def _prefix(cmd):
prefix = os.path.basename(cmd.replace('-', '_'))
for i in ['.pyc', '.py', '-cli', '-tool', '-util']:
prefix = prefix.replace(i, '')
return prefix.upper()
PREFIX = _prefix(__file__)
CACHE_DIR = '~/.' + PREFIX.lower()
TIME = not os.environ.get('TIME_API') is None
DEFAULT_TIMEOUT = 45
LIST = 'list-'
CREATE = 'create-'
UPDATE = 'update-'
DELETE = 'delete-'
ACTION = 'action-'
TRIM = True
JSON = False
GET_METHOD = 'GET'
POST_METHOD = 'POST'
PUT_METHOD = 'PUT'
DELETE_METHOD = 'DELETE'
HEADERS = {'Accept': 'application/json'}
LIST_METHODS = {'__iter__': True, '__len__': True, '__getitem__': True}
def echo(fn):
def wrapped(*args, **kw):
ret = fn(*args, **kw)
print(fn.__name__, repr(ret))
return ret
return wrapped
def timed_url(fn):
def wrapped(*args, **kw):
if TIME:
start = time.time()
ret = fn(*args, **kw)
delta = time.time() - start
print(delta, args[1], fn.__name__)
return ret
else:
return fn(*args, **kw)
return wrapped
class RestObject(object):
def __init__(self):
pass
def __str__(self):
return self.__repr__()
def __repr__(self):
data = {}
for k, v in self.__dict__.items():
if self._is_public(k, v):
data[k] = v
return repr(data)
def __getattr__(self, k):
if self._is_list() and k in LIST_METHODS:
return getattr(self.data, k)
return getattr(self.__dict__, k)
def __getitem__(self, key):
return self.__dict__[key]
def __iter__(self):
if self._is_list():
return iter(self.data)
else:
data = {}
for k, v in self.__dict__.items():
if self._is_public(k, v):
data[k] = v
return iter(data.keys())
def __len__(self):
if self._is_list():
return len(self.data)
else:
data = {}
for k, v in self.__dict__.items():
if self._is_public(k, v):
data[k] = v
return len(data)
@staticmethod
def _is_public(k, v):
return not callable(v)
def _is_list(self):
return 'data' in self.__dict__ and isinstance(self.data, list)
def data_dict(self):
data = {}
for k, v in self.__dict__.items():
if self._is_public(k, v):
data[k] = v
return data
class Schema(object):
def __init__(self, text, obj):
self.text = text
self.types = {}
for t in obj:
if t.type != 'schema':
continue
self.types[t.id] = t
t.creatable = False
try:
if POST_METHOD in t.collectionMethods:
t.creatable = True
except AttributeError:
pass
t.updatable = False
try:
if PUT_METHOD in t.resourceMethods:
t.updatable = True
except AttributeError:
pass
t.deletable = False
try:
if DELETE_METHOD in t.resourceMethods:
t.deletable = True
except AttributeError:
pass
t.listable = False
try:
if GET_METHOD in t.collectionMethods:
t.listable = True
except AttributeError:
pass
if not hasattr(t, 'collectionFilters'):
t.collectionFilters = {}
def __str__(self):
return str(self.text)
def __repr(self):
return repr(self.text)
class ApiError(Exception):
def __init__(self, obj):
self.error = obj
try:
msg = '{} : {}\n\t{}'.format(obj.code, obj.message, obj)
super(ApiError, self).__init__(self, msg)
except Exception:
super(ApiError, self).__init__(self, 'API Error')
class ClientApiError(Exception):
pass
class Client(object):
def __init__(self, access_key=None, secret_key=None, url=None, cache=False,
cache_time=86400, strict=False, headers=None, token=None,
verify=True, **kw):
if verify == 'False':
verify = False
self._headers = HEADERS.copy()
if headers is not None:
for k, v in headers.items():
self._headers[k] = v
if token is not None:
self.token = token
self._headers['Authorization'] = 'Bearer ' + token
self._access_key = access_key
self._secret_key = secret_key
if self._access_key is None:
self._auth = None
else:
self._auth = (self._access_key, self._secret_key)
self._url = url
self._cache = cache
self._cache_time = cache_time
self._strict = strict
self.schema = None
self._session = requests.Session()
self._session.verify = verify
if not self._cache_time:
self._cache_time = 60 * 60 * 24 # 24 Hours
self._load_schemas()
def valid(self):
return self._url is not None and self.schema is not None
def object_hook(self, obj):
if isinstance(obj, list):
return [self.object_hook(x) for x in obj]
if isinstance(obj, dict):
result = RestObject()
for k, v in obj.items():
setattr(result, k, self.object_hook(v))
for link in ['next', 'prev']:
try:
url = getattr(result.pagination, link)
if url is not None:
setattr(result, link, lambda url=url: self._get(url))
except AttributeError:
pass
if hasattr(result, 'type') and isinstance(getattr(result, 'type'),
str):
if hasattr(result, 'links'):
for link_name, link in result.links.items():
def cb_link(_link=link, **kw):
return self._get(_link, data=kw)
if hasattr(result, link_name):
setattr(result, link_name + '_link', cb_link)
else:
setattr(result, link_name, cb_link)
if hasattr(result, 'actions'):
for link_name, link in result.actions.items():
def cb_action(_link_name=link_name, _result=result,
*args, **kw):
return self.action(_result, _link_name,
*args, **kw)
if hasattr(result, link_name):
setattr(result, link_name + '_action', cb_action)
else:
setattr(result, link_name, cb_action)
return result
return obj
def object_pairs_hook(self, pairs):
ret = collections.OrderedDict()
for k, v in pairs:
ret[k] = v
return self.object_hook(ret)
def _get(self, url, data=None):
return self._unmarshall(self._get_raw(url, data=data))
def _error(self, text):
raise ApiError(self._unmarshall(text))
@timed_url
def _get_raw(self, url, data=None):
r = self._get_response(url, data)
return r.text
def _get_response(self, url, data=None):
r = self._session.get(url, auth=self._auth, params=data,
headers=self._headers)
if r.status_code < 200 or r.status_code >= 300:
self._error(r.text)
return r
@timed_url
def _post(self, url, data=None):
r = self._session.post(url, auth=self._auth, data=self._marshall(data),
headers=self._headers)
if r.status_code < 200 or r.status_code >= 300:
self._error(r.text)
print(r.status_code)
return self._unmarshall(r.text)
@timed_url
def _put(self, url, data=None):
r = self._session.put(url, auth=self._auth, data=self._marshall(data),
headers=self._headers)
if r.status_code < 200 or r.status_code >= 300:
self._error(r.text)
return self._unmarshall(r.text)
@timed_url
def _delete(self, url):
r = self._session.delete(url, auth=self._auth, headers=self._headers)
if r.status_code < 200 or r.status_code >= 300:
self._error(r.text)
return self._unmarshall(r.text)
def _unmarshall(self, text):
if text is None or text == '':
return text
obj = json.loads(text, object_hook=self.object_hook,
object_pairs_hook=self.object_pairs_hook)
return obj
def _marshall(self, obj, indent=None, sort_keys=False):
if obj is None:
return None
return json.dumps(self._to_dict(obj), indent=indent, sort_keys=True)
def _load_schemas(self, force=False):
if self.schema and not force:
return
schema_text = self._get_cached_schema()
if force or not schema_text:
response = self._get_response(self._url)
schema_url = response.headers.get('X-API-Schemas')
if schema_url is not None and self._url != schema_url:
schema_text = self._get_raw(schema_url)
else:
schema_text = response.text
self._cache_schema(schema_text)
obj = self._unmarshall(schema_text)
schema = Schema(schema_text, obj)
if len(schema.types) > 0:
self._bind_methods(schema)
self.schema = schema
def reload_schema(self):
self._load_schemas(force=True)
def by_id(self, type, id, **kw):
id = str(id)
url = self.schema.types[type].links.collection
if url.endswith('/'):
url += id
else:
url = '/'.join([url, id])
try:
return self._get(url, self._to_dict(**kw))
except ApiError as e:
if e.error.status == 404:
return None
else:
raise e
def update_by_id(self, type, id, *args, **kw):
url = self.schema.types[type].links.collection
if url.endswith('/'):
url = url + id
else:
url = '/'.join([url, id])
return self._put_and_retry(url, *args, **kw)
def update(self, obj, *args, **kw):
url = obj.links.self
return self._put_and_retry(url, *args, **kw)
def _put_and_retry(self, url, *args, **kw):
retries = kw.get('retries', 3)
for i in range(retries):
try:
return self._put(url, data=self._to_dict(*args, **kw))
except ApiError as e:
if i == retries-1:
raise e
if e.error.status == 409:
time.sleep(.1)
else:
raise e
def _post_and_retry(self, url, *args, **kw):
retries = kw.get('retries', 3)
for i in range(retries):
try:
return self._post(url, data=self._to_dict(*args, **kw))
except ApiError as e:
if i == retries-1:
raise e
if e.error.status == 409:
time.sleep(.1)
else:
raise e
def _validate_list(self, type, **kw):
if not self._strict:
return
collection_filters = self.schema.types[type].collectionFilters
for k in kw:
if hasattr(collection_filters, k):
return
for filter_name, filter_value in collection_filters.items():
for m in filter_value.modifiers:
if k == '_'.join([filter_name, m]):
return
raise ClientApiError(k + ' is not searchable field')
def list(self, type, **kw):
if type not in self.schema.types:
raise ClientApiError(type + ' is not a valid type')
self._validate_list(type, **kw)
collection_url = self.schema.types[type].links.collection
return self._get(collection_url, data=self._to_dict(**kw))
def reload(self, obj):
return self.by_id(obj.type, obj.id)
def create(self, type, *args, **kw):
collection_url = self.schema.types[type].links.collection
return self._post(collection_url, data=self._to_dict(*args, **kw))
def delete(self, *args):
for i in args:
if isinstance(i, RestObject):
return self._delete(i.links.self)
def action(self, obj, action_name, *args, **kw):
url = getattr(obj.actions, action_name)
return self._post_and_retry(url, *args, **kw)
def _is_list(self, obj):
if isinstance(obj, list):
return True
if isinstance(obj, RestObject) and 'type' in obj.__dict__ and \
obj.type == 'collection':
return True
return False
def _to_value(self, value):
if isinstance(value, dict):
ret = {}
for k, v in value.items():
ret[k] = self._to_value(v)
return ret
if isinstance(value, list):
ret = []
for v in value:
ret.append(self._to_value(v))
return ret
if isinstance(value, RestObject):
ret = {}
for k, v in vars(value).items():
if not k.startswith('_') and \
not isinstance(v, RestObject) and not callable(v):
ret[k] = self._to_value(v)
elif not k.startswith('_') and isinstance(v, RestObject):
ret[k] = self._to_dict(v)
return ret
return value
def _to_dict(self, *args, **kw):
if len(kw) == 0 and len(args) == 1 and self._is_list(args[0]):
ret = []
for i in args[0]:
ret.append(self._to_dict(i))
return ret
ret = {}
for i in args:
value = self._to_value(i)
if isinstance(value, dict):
for k, v in value.items():
ret[k] = v
for k, v in kw.items():
ret[k] = self._to_value(v)
return ret
@staticmethod
def _type_name_variants(name):
ret = [name]
python_name = re.sub(r'([a-z])([A-Z])', r'\1_\2', name)
if python_name != name:
ret.append(python_name.lower())
return ret
def _bind_methods(self, schema):
bindings = [
('list', 'collectionMethods', GET_METHOD, self.list),
('by_id', 'collectionMethods', GET_METHOD, self.by_id),
('update_by_id', 'resourceMethods', PUT_METHOD, self.update_by_id),
('create', 'collectionMethods', POST_METHOD, self.create)
]
for type_name, typ in schema.types.items():
for name_variant in self._type_name_variants(type_name):
for method_name, type_collection, test_method, m in bindings:
# double lambda for lexical binding hack, I'm sure there's
# a better way to do this
def cb_bind(type_name=type_name, method=m):
def _cb(*args, **kw):
return method(type_name, *args, **kw)
return _cb
if test_method in getattr(typ, type_collection, []):
setattr(self, '_'.join([method_name, name_variant]),
cb_bind())
def _get_schema_hash(self):
h = hashlib.new('sha1')
h.update(self._url)
if self._access_key is not None:
h.update(self._access_key)
return h.hexdigest()
def _get_cached_schema_file_name(self):
if not self._cache:
return None
h = self._get_schema_hash()
cachedir = os.path.expanduser(CACHE_DIR)
if not cachedir:
return None
if not os.path.exists(cachedir):
os.mkdir(cachedir)
return os.path.join(cachedir, 'schema-' + h + '.json')
def _cache_schema(self, text):
cached_schema = self._get_cached_schema_file_name()
if not cached_schema:
return None
with open(cached_schema, 'w') as f:
f.write(text)
def _get_cached_schema(self):
if not self._cache:
return None
cached_schema = self._get_cached_schema_file_name()
if not cached_schema:
return None
if os.path.exists(cached_schema):
mod_time = os.path.getmtime(cached_schema)
if time.time() - mod_time < self._cache_time:
with open(cached_schema) as f:
data = f.read()
return data
return None
def wait_success(self, obj, timeout=-1):
obj = self.wait_transitioning(obj, timeout)
if obj.transitioning != 'no':
raise ClientApiError(obj.transitioningMessage)
return obj
def wait_transitioning(self, obj, timeout=-1, sleep=0.01):
timeout = _get_timeout(timeout)
start = time.time()
obj = self.reload(obj)
while obj.transitioning == 'yes':
time.sleep(sleep)
sleep *= 2
if sleep > 2:
sleep = 2
obj = self.reload(obj)
delta = time.time() - start
if delta > timeout:
msg = 'Timeout waiting for [{}:{}] to be done after {} seconds'
msg = msg.format(obj.type, obj.id, delta)
raise Exception(msg)
return obj
def _get_timeout(timeout):
if timeout == -1:
return DEFAULT_TIMEOUT
return timeout
if __name__ == '__main__':
print("This cli has been deprecated in favor of " +
"https://github.com/rancher/cli")
| 29.998371
| 79
| 0.525761
|
import re
import requests
import collections
import hashlib
import os
import json
import time
def _prefix(cmd):
prefix = os.path.basename(cmd.replace('-', '_'))
for i in ['.pyc', '.py', '-cli', '-tool', '-util']:
prefix = prefix.replace(i, '')
return prefix.upper()
PREFIX = _prefix(__file__)
CACHE_DIR = '~/.' + PREFIX.lower()
TIME = not os.environ.get('TIME_API') is None
DEFAULT_TIMEOUT = 45
LIST = 'list-'
CREATE = 'create-'
UPDATE = 'update-'
DELETE = 'delete-'
ACTION = 'action-'
TRIM = True
JSON = False
GET_METHOD = 'GET'
POST_METHOD = 'POST'
PUT_METHOD = 'PUT'
DELETE_METHOD = 'DELETE'
HEADERS = {'Accept': 'application/json'}
LIST_METHODS = {'__iter__': True, '__len__': True, '__getitem__': True}
def echo(fn):
def wrapped(*args, **kw):
ret = fn(*args, **kw)
print(fn.__name__, repr(ret))
return ret
return wrapped
def timed_url(fn):
def wrapped(*args, **kw):
if TIME:
start = time.time()
ret = fn(*args, **kw)
delta = time.time() - start
print(delta, args[1], fn.__name__)
return ret
else:
return fn(*args, **kw)
return wrapped
class RestObject(object):
def __init__(self):
pass
def __str__(self):
return self.__repr__()
def __repr__(self):
data = {}
for k, v in self.__dict__.items():
if self._is_public(k, v):
data[k] = v
return repr(data)
def __getattr__(self, k):
if self._is_list() and k in LIST_METHODS:
return getattr(self.data, k)
return getattr(self.__dict__, k)
def __getitem__(self, key):
return self.__dict__[key]
def __iter__(self):
if self._is_list():
return iter(self.data)
else:
data = {}
for k, v in self.__dict__.items():
if self._is_public(k, v):
data[k] = v
return iter(data.keys())
def __len__(self):
if self._is_list():
return len(self.data)
else:
data = {}
for k, v in self.__dict__.items():
if self._is_public(k, v):
data[k] = v
return len(data)
@staticmethod
def _is_public(k, v):
return not callable(v)
def _is_list(self):
return 'data' in self.__dict__ and isinstance(self.data, list)
def data_dict(self):
data = {}
for k, v in self.__dict__.items():
if self._is_public(k, v):
data[k] = v
return data
class Schema(object):
def __init__(self, text, obj):
self.text = text
self.types = {}
for t in obj:
if t.type != 'schema':
continue
self.types[t.id] = t
t.creatable = False
try:
if POST_METHOD in t.collectionMethods:
t.creatable = True
except AttributeError:
pass
t.updatable = False
try:
if PUT_METHOD in t.resourceMethods:
t.updatable = True
except AttributeError:
pass
t.deletable = False
try:
if DELETE_METHOD in t.resourceMethods:
t.deletable = True
except AttributeError:
pass
t.listable = False
try:
if GET_METHOD in t.collectionMethods:
t.listable = True
except AttributeError:
pass
if not hasattr(t, 'collectionFilters'):
t.collectionFilters = {}
def __str__(self):
return str(self.text)
def __repr(self):
return repr(self.text)
class ApiError(Exception):
def __init__(self, obj):
self.error = obj
try:
msg = '{} : {}\n\t{}'.format(obj.code, obj.message, obj)
super(ApiError, self).__init__(self, msg)
except Exception:
super(ApiError, self).__init__(self, 'API Error')
class ClientApiError(Exception):
pass
class Client(object):
def __init__(self, access_key=None, secret_key=None, url=None, cache=False,
cache_time=86400, strict=False, headers=None, token=None,
verify=True, **kw):
if verify == 'False':
verify = False
self._headers = HEADERS.copy()
if headers is not None:
for k, v in headers.items():
self._headers[k] = v
if token is not None:
self.token = token
self._headers['Authorization'] = 'Bearer ' + token
self._access_key = access_key
self._secret_key = secret_key
if self._access_key is None:
self._auth = None
else:
self._auth = (self._access_key, self._secret_key)
self._url = url
self._cache = cache
self._cache_time = cache_time
self._strict = strict
self.schema = None
self._session = requests.Session()
self._session.verify = verify
if not self._cache_time:
self._cache_time = 60 * 60 * 24
self._load_schemas()
def valid(self):
return self._url is not None and self.schema is not None
def object_hook(self, obj):
if isinstance(obj, list):
return [self.object_hook(x) for x in obj]
if isinstance(obj, dict):
result = RestObject()
for k, v in obj.items():
setattr(result, k, self.object_hook(v))
for link in ['next', 'prev']:
try:
url = getattr(result.pagination, link)
if url is not None:
setattr(result, link, lambda url=url: self._get(url))
except AttributeError:
pass
if hasattr(result, 'type') and isinstance(getattr(result, 'type'),
str):
if hasattr(result, 'links'):
for link_name, link in result.links.items():
def cb_link(_link=link, **kw):
return self._get(_link, data=kw)
if hasattr(result, link_name):
setattr(result, link_name + '_link', cb_link)
else:
setattr(result, link_name, cb_link)
if hasattr(result, 'actions'):
for link_name, link in result.actions.items():
def cb_action(_link_name=link_name, _result=result,
*args, **kw):
return self.action(_result, _link_name,
*args, **kw)
if hasattr(result, link_name):
setattr(result, link_name + '_action', cb_action)
else:
setattr(result, link_name, cb_action)
return result
return obj
def object_pairs_hook(self, pairs):
ret = collections.OrderedDict()
for k, v in pairs:
ret[k] = v
return self.object_hook(ret)
def _get(self, url, data=None):
return self._unmarshall(self._get_raw(url, data=data))
def _error(self, text):
raise ApiError(self._unmarshall(text))
@timed_url
def _get_raw(self, url, data=None):
r = self._get_response(url, data)
return r.text
def _get_response(self, url, data=None):
r = self._session.get(url, auth=self._auth, params=data,
headers=self._headers)
if r.status_code < 200 or r.status_code >= 300:
self._error(r.text)
return r
@timed_url
def _post(self, url, data=None):
r = self._session.post(url, auth=self._auth, data=self._marshall(data),
headers=self._headers)
if r.status_code < 200 or r.status_code >= 300:
self._error(r.text)
print(r.status_code)
return self._unmarshall(r.text)
@timed_url
def _put(self, url, data=None):
r = self._session.put(url, auth=self._auth, data=self._marshall(data),
headers=self._headers)
if r.status_code < 200 or r.status_code >= 300:
self._error(r.text)
return self._unmarshall(r.text)
@timed_url
def _delete(self, url):
r = self._session.delete(url, auth=self._auth, headers=self._headers)
if r.status_code < 200 or r.status_code >= 300:
self._error(r.text)
return self._unmarshall(r.text)
def _unmarshall(self, text):
if text is None or text == '':
return text
obj = json.loads(text, object_hook=self.object_hook,
object_pairs_hook=self.object_pairs_hook)
return obj
def _marshall(self, obj, indent=None, sort_keys=False):
if obj is None:
return None
return json.dumps(self._to_dict(obj), indent=indent, sort_keys=True)
def _load_schemas(self, force=False):
if self.schema and not force:
return
schema_text = self._get_cached_schema()
if force or not schema_text:
response = self._get_response(self._url)
schema_url = response.headers.get('X-API-Schemas')
if schema_url is not None and self._url != schema_url:
schema_text = self._get_raw(schema_url)
else:
schema_text = response.text
self._cache_schema(schema_text)
obj = self._unmarshall(schema_text)
schema = Schema(schema_text, obj)
if len(schema.types) > 0:
self._bind_methods(schema)
self.schema = schema
def reload_schema(self):
self._load_schemas(force=True)
def by_id(self, type, id, **kw):
id = str(id)
url = self.schema.types[type].links.collection
if url.endswith('/'):
url += id
else:
url = '/'.join([url, id])
try:
return self._get(url, self._to_dict(**kw))
except ApiError as e:
if e.error.status == 404:
return None
else:
raise e
def update_by_id(self, type, id, *args, **kw):
url = self.schema.types[type].links.collection
if url.endswith('/'):
url = url + id
else:
url = '/'.join([url, id])
return self._put_and_retry(url, *args, **kw)
def update(self, obj, *args, **kw):
url = obj.links.self
return self._put_and_retry(url, *args, **kw)
def _put_and_retry(self, url, *args, **kw):
retries = kw.get('retries', 3)
for i in range(retries):
try:
return self._put(url, data=self._to_dict(*args, **kw))
except ApiError as e:
if i == retries-1:
raise e
if e.error.status == 409:
time.sleep(.1)
else:
raise e
def _post_and_retry(self, url, *args, **kw):
retries = kw.get('retries', 3)
for i in range(retries):
try:
return self._post(url, data=self._to_dict(*args, **kw))
except ApiError as e:
if i == retries-1:
raise e
if e.error.status == 409:
time.sleep(.1)
else:
raise e
def _validate_list(self, type, **kw):
if not self._strict:
return
collection_filters = self.schema.types[type].collectionFilters
for k in kw:
if hasattr(collection_filters, k):
return
for filter_name, filter_value in collection_filters.items():
for m in filter_value.modifiers:
if k == '_'.join([filter_name, m]):
return
raise ClientApiError(k + ' is not searchable field')
def list(self, type, **kw):
if type not in self.schema.types:
raise ClientApiError(type + ' is not a valid type')
self._validate_list(type, **kw)
collection_url = self.schema.types[type].links.collection
return self._get(collection_url, data=self._to_dict(**kw))
def reload(self, obj):
return self.by_id(obj.type, obj.id)
def create(self, type, *args, **kw):
collection_url = self.schema.types[type].links.collection
return self._post(collection_url, data=self._to_dict(*args, **kw))
def delete(self, *args):
for i in args:
if isinstance(i, RestObject):
return self._delete(i.links.self)
def action(self, obj, action_name, *args, **kw):
url = getattr(obj.actions, action_name)
return self._post_and_retry(url, *args, **kw)
def _is_list(self, obj):
if isinstance(obj, list):
return True
if isinstance(obj, RestObject) and 'type' in obj.__dict__ and \
obj.type == 'collection':
return True
return False
def _to_value(self, value):
if isinstance(value, dict):
ret = {}
for k, v in value.items():
ret[k] = self._to_value(v)
return ret
if isinstance(value, list):
ret = []
for v in value:
ret.append(self._to_value(v))
return ret
if isinstance(value, RestObject):
ret = {}
for k, v in vars(value).items():
if not k.startswith('_') and \
not isinstance(v, RestObject) and not callable(v):
ret[k] = self._to_value(v)
elif not k.startswith('_') and isinstance(v, RestObject):
ret[k] = self._to_dict(v)
return ret
return value
def _to_dict(self, *args, **kw):
if len(kw) == 0 and len(args) == 1 and self._is_list(args[0]):
ret = []
for i in args[0]:
ret.append(self._to_dict(i))
return ret
ret = {}
for i in args:
value = self._to_value(i)
if isinstance(value, dict):
for k, v in value.items():
ret[k] = v
for k, v in kw.items():
ret[k] = self._to_value(v)
return ret
@staticmethod
def _type_name_variants(name):
ret = [name]
python_name = re.sub(r'([a-z])([A-Z])', r'\1_\2', name)
if python_name != name:
ret.append(python_name.lower())
return ret
def _bind_methods(self, schema):
bindings = [
('list', 'collectionMethods', GET_METHOD, self.list),
('by_id', 'collectionMethods', GET_METHOD, self.by_id),
('update_by_id', 'resourceMethods', PUT_METHOD, self.update_by_id),
('create', 'collectionMethods', POST_METHOD, self.create)
]
for type_name, typ in schema.types.items():
for name_variant in self._type_name_variants(type_name):
for method_name, type_collection, test_method, m in bindings:
def cb_bind(type_name=type_name, method=m):
def _cb(*args, **kw):
return method(type_name, *args, **kw)
return _cb
if test_method in getattr(typ, type_collection, []):
setattr(self, '_'.join([method_name, name_variant]),
cb_bind())
def _get_schema_hash(self):
h = hashlib.new('sha1')
h.update(self._url)
if self._access_key is not None:
h.update(self._access_key)
return h.hexdigest()
def _get_cached_schema_file_name(self):
if not self._cache:
return None
h = self._get_schema_hash()
cachedir = os.path.expanduser(CACHE_DIR)
if not cachedir:
return None
if not os.path.exists(cachedir):
os.mkdir(cachedir)
return os.path.join(cachedir, 'schema-' + h + '.json')
def _cache_schema(self, text):
cached_schema = self._get_cached_schema_file_name()
if not cached_schema:
return None
with open(cached_schema, 'w') as f:
f.write(text)
def _get_cached_schema(self):
if not self._cache:
return None
cached_schema = self._get_cached_schema_file_name()
if not cached_schema:
return None
if os.path.exists(cached_schema):
mod_time = os.path.getmtime(cached_schema)
if time.time() - mod_time < self._cache_time:
with open(cached_schema) as f:
data = f.read()
return data
return None
def wait_success(self, obj, timeout=-1):
obj = self.wait_transitioning(obj, timeout)
if obj.transitioning != 'no':
raise ClientApiError(obj.transitioningMessage)
return obj
def wait_transitioning(self, obj, timeout=-1, sleep=0.01):
timeout = _get_timeout(timeout)
start = time.time()
obj = self.reload(obj)
while obj.transitioning == 'yes':
time.sleep(sleep)
sleep *= 2
if sleep > 2:
sleep = 2
obj = self.reload(obj)
delta = time.time() - start
if delta > timeout:
msg = 'Timeout waiting for [{}:{}] to be done after {} seconds'
msg = msg.format(obj.type, obj.id, delta)
raise Exception(msg)
return obj
def _get_timeout(timeout):
if timeout == -1:
return DEFAULT_TIMEOUT
return timeout
if __name__ == '__main__':
print("This cli has been deprecated in favor of " +
"https://github.com/rancher/cli")
| true
| true
|
f70a179b3eddf190eaaa58dc66330aea22ba5acb
| 2,292
|
py
|
Python
|
MaxiNet/Frontend/distriopt_.py
|
Giuseppe1992/MaxiNet
|
fffb5ca383afb7f7f22de0646cced7f0182b86b5
|
[
"MIT"
] | null | null | null |
MaxiNet/Frontend/distriopt_.py
|
Giuseppe1992/MaxiNet
|
fffb5ca383afb7f7f22de0646cced7f0182b86b5
|
[
"MIT"
] | null | null | null |
MaxiNet/Frontend/distriopt_.py
|
Giuseppe1992/MaxiNet
|
fffb5ca383afb7f7f22de0646cced7f0182b86b5
|
[
"MIT"
] | null | null | null |
import json
import os
from mininet.topo import Topo
import subprocess
class Mapper(object):
def __init__(self, topo, physical_network_file, mapper):
self.topo = topo
self.physical_network_file = physical_network_file
self.mapper = mapper
self.topo_file = self.create_topo_file(topo)
self.mapping_json_path = self._run_python3_distriopt(virtual_topo_file=self.topo_file,
physical_topo_file=physical_network_file,
mapper=mapper)
@staticmethod
def check_valid_path(physical_network_file):
pass
def create_topo_file(self,topo):
assert isinstance(topo, Topo), "Invalid Network Format"
filename = os.tempnam()
json_topo={"nodes": {}, "links": {}}
for node in topo.nodes():
attrs = {"cores": topo.nodeInfo(node).get("cores", 1),
"memory": topo.nodeInfo(node).get("memory", 100)}
json_topo["nodes"][node] = attrs
for (u, v, attrs) in topo.iterLinks(withInfo=True):
rate = attrs["bw"]
edge_attrs = {"rate": rate}
json_topo["links"][" ".join((u,v))]= edge_attrs
with open(filename, "w") as f:
json.dump(json_topo, f)
return filename
def create_mapping(self):
with open(self.mapping_json_path, "r") as f:
mapping = json.load(f)
if "Infeasible" in mapping:
print("MAPPING INFEASIBLE")
exit(1)
elif "mapping" in mapping:
mapping = mapping["mapping"]
return mapping
else:
raise ValueError("Returned value by the script not managed {}".format(mapping))
def _run_python3_distriopt(self,virtual_topo_file, physical_topo_file, mapper, python3_script="/root/MaxiNet/MaxiNet/Frontend/distriopt_runner.py"):
python3_command = "python3 {} {} {} {}".format(python3_script,virtual_topo_file,physical_topo_file,mapper) # launch python3 script using bash
process = subprocess.Popen(python3_command.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
#return the temporary path for the mapping
return output
| 36.380952
| 152
| 0.609511
|
import json
import os
from mininet.topo import Topo
import subprocess
class Mapper(object):
def __init__(self, topo, physical_network_file, mapper):
self.topo = topo
self.physical_network_file = physical_network_file
self.mapper = mapper
self.topo_file = self.create_topo_file(topo)
self.mapping_json_path = self._run_python3_distriopt(virtual_topo_file=self.topo_file,
physical_topo_file=physical_network_file,
mapper=mapper)
@staticmethod
def check_valid_path(physical_network_file):
pass
def create_topo_file(self,topo):
assert isinstance(topo, Topo), "Invalid Network Format"
filename = os.tempnam()
json_topo={"nodes": {}, "links": {}}
for node in topo.nodes():
attrs = {"cores": topo.nodeInfo(node).get("cores", 1),
"memory": topo.nodeInfo(node).get("memory", 100)}
json_topo["nodes"][node] = attrs
for (u, v, attrs) in topo.iterLinks(withInfo=True):
rate = attrs["bw"]
edge_attrs = {"rate": rate}
json_topo["links"][" ".join((u,v))]= edge_attrs
with open(filename, "w") as f:
json.dump(json_topo, f)
return filename
def create_mapping(self):
with open(self.mapping_json_path, "r") as f:
mapping = json.load(f)
if "Infeasible" in mapping:
print("MAPPING INFEASIBLE")
exit(1)
elif "mapping" in mapping:
mapping = mapping["mapping"]
return mapping
else:
raise ValueError("Returned value by the script not managed {}".format(mapping))
def _run_python3_distriopt(self,virtual_topo_file, physical_topo_file, mapper, python3_script="/root/MaxiNet/MaxiNet/Frontend/distriopt_runner.py"):
python3_command = "python3 {} {} {} {}".format(python3_script,virtual_topo_file,physical_topo_file,mapper)
process = subprocess.Popen(python3_command.split(), stdout=subprocess.PIPE)
output, error = process.communicate()
return output
| true
| true
|
f70a17dff3a5f42dca4df45b96d57c4d84470ded
| 11,913
|
py
|
Python
|
code/python/TimeSeriesAPIforDigitalPortals/v3/fds/sdk/TimeSeriesAPIforDigitalPortals/model/inline_response2001.py
|
factset/enterprise-sdk
|
3fd4d1360756c515c9737a0c9a992c7451d7de7e
|
[
"Apache-2.0"
] | 6
|
2022-02-07T16:34:18.000Z
|
2022-03-30T08:04:57.000Z
|
code/python/TimeSeriesAPIforDigitalPortals/v3/fds/sdk/TimeSeriesAPIforDigitalPortals/model/inline_response2001.py
|
factset/enterprise-sdk
|
3fd4d1360756c515c9737a0c9a992c7451d7de7e
|
[
"Apache-2.0"
] | 2
|
2022-02-07T05:25:57.000Z
|
2022-03-07T14:18:04.000Z
|
code/python/TimeSeriesAPIforDigitalPortals/v3/fds/sdk/TimeSeriesAPIforDigitalPortals/model/inline_response2001.py
|
factset/enterprise-sdk
|
3fd4d1360756c515c9737a0c9a992c7451d7de7e
|
[
"Apache-2.0"
] | null | null | null |
"""
Time Series API For Digital Portals
Time series data, end-of-day or intraday, tick-by-tick or subsampled. Additional vendor-specific endpoints provide a modified interface for seamless integration with the ChartIQ chart library. # noqa: E501
The version of the OpenAPI document: 2
Generated by: https://openapi-generator.tech
"""
import re # noqa: F401
import sys # noqa: F401
from fds.sdk.TimeSeriesAPIforDigitalPortals.model_utils import ( # noqa: F401
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from fds.sdk.TimeSeriesAPIforDigitalPortals.exceptions import ApiAttributeError
def lazy_import():
from fds.sdk.TimeSeriesAPIforDigitalPortals.model.inline_response2001_data import InlineResponse2001Data
from fds.sdk.TimeSeriesAPIforDigitalPortals.model.inline_response2001_meta import InlineResponse2001Meta
globals()['InlineResponse2001Data'] = InlineResponse2001Data
globals()['InlineResponse2001Meta'] = InlineResponse2001Meta
class InlineResponse2001(ModelNormal):
"""NOTE: This class is auto generated by OpenAPI Generator.
Ref: https://openapi-generator.tech
Do not edit the class manually.
Attributes:
allowed_values (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
with a capitalized key describing the allowed value and an allowed
value. These dicts store the allowed enum values.
attribute_map (dict): The key is attribute name
and the value is json key in definition.
discriminator_value_class_map (dict): A dict to go from the discriminator
variable value to the discriminator class name.
validations (dict): The key is the tuple path to the attribute
and the for var_name this is (var_name,). The value is a dict
that stores validations for max_length, min_length, max_items,
min_items, exclusive_maximum, inclusive_maximum, exclusive_minimum,
inclusive_minimum, and regex.
additional_properties_type (tuple): A tuple of classes accepted
as additional properties values.
"""
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
"""
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type,) # noqa: E501
_nullable = False
@cached_property
def openapi_types():
"""
This must be a method because a model may have properties that are
of type self, this must run after the class is loaded
Returns
openapi_types (dict): The key is attribute name
and the value is attribute type.
"""
lazy_import()
return {
'data': (InlineResponse2001Data,), # noqa: E501
'meta': (InlineResponse2001Meta,), # noqa: E501
}
@cached_property
def discriminator():
return None
attribute_map = {
'data': 'data', # noqa: E501
'meta': 'meta', # noqa: E501
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs): # noqa: E501
"""InlineResponse2001 - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
data (InlineResponse2001Data): [optional] # noqa: E501
meta (InlineResponse2001Meta): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs): # noqa: E501
"""InlineResponse2001 - a model defined in OpenAPI
Keyword Args:
_check_type (bool): if True, values for parameters in openapi_types
will be type checked and a TypeError will be
raised if the wrong type is input.
Defaults to True
_path_to_item (tuple/list): This is a list of keys or values to
drill down to the model in received_data
when deserializing a response
_spec_property_naming (bool): True if the variable names in the input data
are serialized names, as specified in the OpenAPI document.
False if the variable names in the input data
are pythonic names, e.g. snake case (default)
_configuration (Configuration): the instance to use when
deserializing a file_type parameter.
If passed, type conversion is attempted
If omitted no type conversion is done.
_visited_composed_classes (tuple): This stores a tuple of
classes that we have traveled through so that
if we see that class again we will not use its
discriminator again.
When traveling through a discriminator, the
composed schema that is
is traveled through is added to this set.
For example if Animal has a discriminator
petType and we pass in "Dog", and the class Dog
allOf includes Animal, we move through Animal
once using the discriminator, and pick Dog.
Then in Dog, we will make an instance of the
Animal class but this time we won't travel
through its discriminator because we passed in
_visited_composed_classes = (Animal,)
data (InlineResponse2001Data): [optional] # noqa: E501
meta (InlineResponse2001Meta): [optional] # noqa: E501
"""
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
# discard variable.
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")
| 44.451493
| 210
| 0.583816
|
import re
import sys
from fds.sdk.TimeSeriesAPIforDigitalPortals.model_utils import (
ApiTypeError,
ModelComposed,
ModelNormal,
ModelSimple,
cached_property,
change_keys_js_to_python,
convert_js_args_to_python_args,
date,
datetime,
file_type,
none_type,
validate_get_composed_info,
OpenApiModel
)
from fds.sdk.TimeSeriesAPIforDigitalPortals.exceptions import ApiAttributeError
def lazy_import():
from fds.sdk.TimeSeriesAPIforDigitalPortals.model.inline_response2001_data import InlineResponse2001Data
from fds.sdk.TimeSeriesAPIforDigitalPortals.model.inline_response2001_meta import InlineResponse2001Meta
globals()['InlineResponse2001Data'] = InlineResponse2001Data
globals()['InlineResponse2001Meta'] = InlineResponse2001Meta
class InlineResponse2001(ModelNormal):
allowed_values = {
}
validations = {
}
@cached_property
def additional_properties_type():
lazy_import()
return (bool, date, datetime, dict, float, int, list, str, none_type,)
_nullable = False
@cached_property
def openapi_types():
lazy_import()
return {
'data': (InlineResponse2001Data,),
'meta': (InlineResponse2001Meta,),
}
@cached_property
def discriminator():
return None
attribute_map = {
'data': 'data',
'meta': 'meta',
}
read_only_vars = {
}
_composed_schemas = {}
@classmethod
@convert_js_args_to_python_args
def _from_openapi_data(cls, *args, **kwargs):
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
self = super(OpenApiModel, cls).__new__(cls)
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
continue
setattr(self, var_name, var_value)
return self
required_properties = set([
'_data_store',
'_check_type',
'_spec_property_naming',
'_path_to_item',
'_configuration',
'_visited_composed_classes',
])
@convert_js_args_to_python_args
def __init__(self, *args, **kwargs):
_check_type = kwargs.pop('_check_type', True)
_spec_property_naming = kwargs.pop('_spec_property_naming', False)
_path_to_item = kwargs.pop('_path_to_item', ())
_configuration = kwargs.pop('_configuration', None)
_visited_composed_classes = kwargs.pop('_visited_composed_classes', ())
if args:
raise ApiTypeError(
"Invalid positional arguments=%s passed to %s. Remove those invalid positional arguments." % (
args,
self.__class__.__name__,
),
path_to_item=_path_to_item,
valid_classes=(self.__class__,),
)
self._data_store = {}
self._check_type = _check_type
self._spec_property_naming = _spec_property_naming
self._path_to_item = _path_to_item
self._configuration = _configuration
self._visited_composed_classes = _visited_composed_classes + (self.__class__,)
for var_name, var_value in kwargs.items():
if var_name not in self.attribute_map and \
self._configuration is not None and \
self._configuration.discard_unknown_keys and \
self.additional_properties_type is None:
continue
setattr(self, var_name, var_value)
if var_name in self.read_only_vars:
raise ApiAttributeError(f"`{var_name}` is a read-only attribute. Use `from_openapi_data` to instantiate "
f"class with read only attributes.")
| true
| true
|
f70a182da31175046edd04dfca877dac25580027
| 323
|
py
|
Python
|
testes_basicos.py
|
renzon/pypraticot2
|
530c422ac0fd482e491db46cdf250145e0c22f60
|
[
"MIT"
] | 1
|
2017-07-16T00:16:31.000Z
|
2017-07-16T00:16:31.000Z
|
testes_basicos.py
|
renzon/pypraticot2
|
530c422ac0fd482e491db46cdf250145e0c22f60
|
[
"MIT"
] | null | null | null |
testes_basicos.py
|
renzon/pypraticot2
|
530c422ac0fd482e491db46cdf250145e0c22f60
|
[
"MIT"
] | null | null | null |
import unittest
def soma(param, param1):
return param + param1
class BasicoTests(unittest.TestCase):
def test_soma(self):
resultado = soma(1, 2)
self.assertEqual(3, resultado)
resultado = soma(3, 2)
self.assertEqual(5, resultado)
if __name__ == '__main__':
unittest.main()
| 17.944444
| 38
| 0.640867
|
import unittest
def soma(param, param1):
return param + param1
class BasicoTests(unittest.TestCase):
def test_soma(self):
resultado = soma(1, 2)
self.assertEqual(3, resultado)
resultado = soma(3, 2)
self.assertEqual(5, resultado)
if __name__ == '__main__':
unittest.main()
| true
| true
|
f70a187b86345725dacfb36b83a3c8c5937c9f30
| 8,106
|
py
|
Python
|
tests/test_colour_specification_box.py
|
feature-engineer/glymur
|
660b593ab7bfbb3036de5d15c3ecb43bef3bf919
|
[
"MIT"
] | 41
|
2015-04-06T21:36:55.000Z
|
2022-02-03T09:41:42.000Z
|
tests/test_colour_specification_box.py
|
feature-engineer/glymur
|
660b593ab7bfbb3036de5d15c3ecb43bef3bf919
|
[
"MIT"
] | 244
|
2015-01-01T03:41:54.000Z
|
2022-03-24T14:07:33.000Z
|
tests/test_colour_specification_box.py
|
feature-engineer/glymur
|
660b593ab7bfbb3036de5d15c3ecb43bef3bf919
|
[
"MIT"
] | 21
|
2015-03-06T12:57:27.000Z
|
2022-03-02T16:00:54.000Z
|
# -*- coding: utf-8 -*-
"""
Test suite specifically targeting ICC profiles
"""
# Standard library imports ...
from datetime import datetime
try:
import importlib.resources as ir
except ImportError: # pragma: no cover
# before 3.7
import importlib_resources as ir
import struct
import tempfile
import unittest
import warnings
# Third party library imports
import numpy as np
# Local imports
import glymur
from glymur import Jp2k
from glymur._iccprofile import _ICCProfile
from glymur.jp2box import (
ColourSpecificationBox, ContiguousCodestreamBox, FileTypeBox,
ImageHeaderBox, JP2HeaderBox, JPEG2000SignatureBox, InvalidJp2kError
)
from glymur.core import SRGB
from . import fixtures, data
class TestColourSpecificationBox(fixtures.TestCommon):
"""Test suite for colr box instantiation."""
def setUp(self):
super(TestColourSpecificationBox, self).setUp()
j2k = Jp2k(self.j2kfile)
codestream = j2k.get_codestream()
height = codestream.segment[1].ysiz
width = codestream.segment[1].xsiz
num_components = len(codestream.segment[1].xrsiz)
self.jp2b = JPEG2000SignatureBox()
self.ftyp = FileTypeBox()
self.jp2h = JP2HeaderBox()
self.jp2c = ContiguousCodestreamBox()
self.ihdr = ImageHeaderBox(height=height, width=width,
num_components=num_components)
self.icc_profile = ir.read_binary(data, 'sgray.icc')
def test_bad_method_printing(self):
"""
SCENARIO: An ICC profile is both too short and has an invalid method
value.
EXPECTED RESULT: Warnings are issued. Printing the string
representation should not error out.
"""
with ir.path(data, 'issue405.dat') as path:
with path.open('rb') as f:
f.seek(8)
with warnings.catch_warnings():
# Lots of things wrong with this file.
warnings.simplefilter('ignore')
box = ColourSpecificationBox.parse(f, length=80, offset=0)
str(box)
def test_colr_with_out_enum_cspace(self):
"""must supply an enumerated colorspace when writing"""
j2k = Jp2k(self.j2kfile)
boxes = [self.jp2b, self.ftyp, self.jp2h, self.jp2c]
boxes[2].box = [self.ihdr, ColourSpecificationBox(colorspace=None)]
with open(self.temp_jp2_filename, mode='wb') as tfile:
with self.assertRaises(InvalidJp2kError):
j2k.wrap(tfile.name, boxes=boxes)
def test_missing_colr_box(self):
"""jp2h must have a colr box"""
j2k = Jp2k(self.j2kfile)
boxes = [self.jp2b, self.ftyp, self.jp2h, self.jp2c]
boxes[2].box = [self.ihdr]
with open(self.temp_jp2_filename, mode='wb') as tfile:
with self.assertRaises(InvalidJp2kError):
j2k.wrap(tfile.name, boxes=boxes)
def test_bad_approx_jp2_field(self):
"""JP2 has requirements for approx field"""
j2k = Jp2k(self.j2kfile)
boxes = [self.jp2b, self.ftyp, self.jp2h, self.jp2c]
colr = ColourSpecificationBox(colorspace=SRGB, approximation=1)
boxes[2].box = [self.ihdr, colr]
with open(self.temp_jp2_filename, mode='wb') as tfile:
with self.assertRaises(InvalidJp2kError):
j2k.wrap(tfile.name, boxes=boxes)
def test_default_colr(self):
"""basic colr instantiation"""
colr = ColourSpecificationBox(colorspace=SRGB)
self.assertEqual(colr.method, glymur.core.ENUMERATED_COLORSPACE)
self.assertEqual(colr.precedence, 0)
self.assertEqual(colr.approximation, 0)
self.assertEqual(colr.colorspace, SRGB)
self.assertIsNone(colr.icc_profile)
def test_icc_profile(self):
"""basic colr box with ICC profile"""
colr = ColourSpecificationBox(icc_profile=self.icc_profile)
self.assertEqual(colr.method, glymur.core.ENUMERATED_COLORSPACE)
self.assertEqual(colr.precedence, 0)
self.assertEqual(colr.approximation, 0)
icc_profile = _ICCProfile(colr.icc_profile)
self.assertEqual(icc_profile.header['Version'], '2.1.0')
self.assertEqual(icc_profile.header['Color Space'], 'gray')
self.assertIsNone(icc_profile.header['Datetime'])
# Only True for version4
self.assertFalse('Profile Id' in icc_profile.header.keys())
def test_colr_with_bad_color(self):
"""
SCENARIO: A colr box has an invalid colorspace.
EXPECTED RESULT: An InvalidJp2kError is raised when attempting to
write the box.
"""
with self.assertWarns(UserWarning):
# A warning is issued due to the bad colorspace.
colr = ColourSpecificationBox(colorspace=-1, approximation=0)
with tempfile.TemporaryFile() as tfile:
with self.assertRaises(InvalidJp2kError):
colr.write(tfile)
def test_write_colr_with_bad_method(self):
"""
SCENARIO: A colr box has an invalid method value.
EXPECTED RESULT: InvalidJp2kError
"""
with warnings.catch_warnings():
warnings.simplefilter('ignore')
colr = ColourSpecificationBox(colorspace=SRGB, method=5)
with tempfile.TemporaryFile() as tfile:
with self.assertRaises(InvalidJp2kError):
colr.write(tfile)
class TestSuite(unittest.TestCase):
"""Test suite for ICC Profile code."""
def setUp(self):
self.buffer = ir.read_binary(data, 'sgray.icc')
def test_bad_rendering_intent(self):
"""
The rendering intent is not in the range 0-4.
It should be classified as 'unknown'
"""
intent = struct.pack('>I', 10)
self.buffer = self.buffer[:64] + intent + self.buffer[68:]
icc_profile = _ICCProfile(self.buffer)
self.assertEqual(icc_profile.header['Rendering Intent'], 'unknown')
def test_version4(self):
"""
ICC profile is version 4
"""
leadoff = struct.pack('>IIBB', 416, 0, 4, 0)
self.buffer = leadoff + self.buffer[10:]
icc_profile = _ICCProfile(self.buffer)
self.assertEqual(icc_profile.header['Version'], '4.0.0')
self.assertTrue('Profile Id' in icc_profile.header.keys())
def test_icc_profile(self):
"""
SCENARIO: The ColourDefinitionBox has an ICC profile.
EXPECTED RESULT: Verify the ICC profile metadata.
"""
with ir.path(data, 'text_GBR.jp2') as path:
with self.assertWarns(UserWarning):
# The brand is wrong, this is JPX, not JP2.
j = Jp2k(path)
box = j.box[3].box[1]
self.assertEqual(box.icc_profile_header['Size'], 1328)
self.assertEqual(box.icc_profile_header['Color Space'], 'RGB')
self.assertEqual(box.icc_profile_header['Connection Space'], 'XYZ')
self.assertEqual(box.icc_profile_header['Datetime'],
datetime(2009, 2, 25, 11, 26, 11))
self.assertEqual(box.icc_profile_header['File Signature'], 'acsp')
self.assertEqual(box.icc_profile_header['Platform'], 'APPL')
self.assertEqual(box.icc_profile_header['Flags'],
'not embedded, can be used independently')
self.assertEqual(box.icc_profile_header['Device Manufacturer'], 'appl')
self.assertEqual(box.icc_profile_header['Device Model'], '')
self.assertEqual(box.icc_profile_header['Device Attributes'],
('reflective, glossy, positive media polarity, '
'color media'))
self.assertEqual(box.icc_profile_header['Rendering Intent'],
'perceptual')
np.testing.assert_almost_equal(box.icc_profile_header['Illuminant'],
np.array([0.9642023, 1.0, 0.824905]),
decimal=6)
self.assertEqual(box.icc_profile_header['Creator'], 'appl')
| 37.878505
| 79
| 0.632618
|
from datetime import datetime
try:
import importlib.resources as ir
except ImportError:
import importlib_resources as ir
import struct
import tempfile
import unittest
import warnings
import numpy as np
import glymur
from glymur import Jp2k
from glymur._iccprofile import _ICCProfile
from glymur.jp2box import (
ColourSpecificationBox, ContiguousCodestreamBox, FileTypeBox,
ImageHeaderBox, JP2HeaderBox, JPEG2000SignatureBox, InvalidJp2kError
)
from glymur.core import SRGB
from . import fixtures, data
class TestColourSpecificationBox(fixtures.TestCommon):
def setUp(self):
super(TestColourSpecificationBox, self).setUp()
j2k = Jp2k(self.j2kfile)
codestream = j2k.get_codestream()
height = codestream.segment[1].ysiz
width = codestream.segment[1].xsiz
num_components = len(codestream.segment[1].xrsiz)
self.jp2b = JPEG2000SignatureBox()
self.ftyp = FileTypeBox()
self.jp2h = JP2HeaderBox()
self.jp2c = ContiguousCodestreamBox()
self.ihdr = ImageHeaderBox(height=height, width=width,
num_components=num_components)
self.icc_profile = ir.read_binary(data, 'sgray.icc')
def test_bad_method_printing(self):
with ir.path(data, 'issue405.dat') as path:
with path.open('rb') as f:
f.seek(8)
with warnings.catch_warnings():
warnings.simplefilter('ignore')
box = ColourSpecificationBox.parse(f, length=80, offset=0)
str(box)
def test_colr_with_out_enum_cspace(self):
j2k = Jp2k(self.j2kfile)
boxes = [self.jp2b, self.ftyp, self.jp2h, self.jp2c]
boxes[2].box = [self.ihdr, ColourSpecificationBox(colorspace=None)]
with open(self.temp_jp2_filename, mode='wb') as tfile:
with self.assertRaises(InvalidJp2kError):
j2k.wrap(tfile.name, boxes=boxes)
def test_missing_colr_box(self):
j2k = Jp2k(self.j2kfile)
boxes = [self.jp2b, self.ftyp, self.jp2h, self.jp2c]
boxes[2].box = [self.ihdr]
with open(self.temp_jp2_filename, mode='wb') as tfile:
with self.assertRaises(InvalidJp2kError):
j2k.wrap(tfile.name, boxes=boxes)
def test_bad_approx_jp2_field(self):
j2k = Jp2k(self.j2kfile)
boxes = [self.jp2b, self.ftyp, self.jp2h, self.jp2c]
colr = ColourSpecificationBox(colorspace=SRGB, approximation=1)
boxes[2].box = [self.ihdr, colr]
with open(self.temp_jp2_filename, mode='wb') as tfile:
with self.assertRaises(InvalidJp2kError):
j2k.wrap(tfile.name, boxes=boxes)
def test_default_colr(self):
colr = ColourSpecificationBox(colorspace=SRGB)
self.assertEqual(colr.method, glymur.core.ENUMERATED_COLORSPACE)
self.assertEqual(colr.precedence, 0)
self.assertEqual(colr.approximation, 0)
self.assertEqual(colr.colorspace, SRGB)
self.assertIsNone(colr.icc_profile)
def test_icc_profile(self):
colr = ColourSpecificationBox(icc_profile=self.icc_profile)
self.assertEqual(colr.method, glymur.core.ENUMERATED_COLORSPACE)
self.assertEqual(colr.precedence, 0)
self.assertEqual(colr.approximation, 0)
icc_profile = _ICCProfile(colr.icc_profile)
self.assertEqual(icc_profile.header['Version'], '2.1.0')
self.assertEqual(icc_profile.header['Color Space'], 'gray')
self.assertIsNone(icc_profile.header['Datetime'])
self.assertFalse('Profile Id' in icc_profile.header.keys())
def test_colr_with_bad_color(self):
with self.assertWarns(UserWarning):
colr = ColourSpecificationBox(colorspace=-1, approximation=0)
with tempfile.TemporaryFile() as tfile:
with self.assertRaises(InvalidJp2kError):
colr.write(tfile)
def test_write_colr_with_bad_method(self):
with warnings.catch_warnings():
warnings.simplefilter('ignore')
colr = ColourSpecificationBox(colorspace=SRGB, method=5)
with tempfile.TemporaryFile() as tfile:
with self.assertRaises(InvalidJp2kError):
colr.write(tfile)
class TestSuite(unittest.TestCase):
def setUp(self):
self.buffer = ir.read_binary(data, 'sgray.icc')
def test_bad_rendering_intent(self):
intent = struct.pack('>I', 10)
self.buffer = self.buffer[:64] + intent + self.buffer[68:]
icc_profile = _ICCProfile(self.buffer)
self.assertEqual(icc_profile.header['Rendering Intent'], 'unknown')
def test_version4(self):
leadoff = struct.pack('>IIBB', 416, 0, 4, 0)
self.buffer = leadoff + self.buffer[10:]
icc_profile = _ICCProfile(self.buffer)
self.assertEqual(icc_profile.header['Version'], '4.0.0')
self.assertTrue('Profile Id' in icc_profile.header.keys())
def test_icc_profile(self):
with ir.path(data, 'text_GBR.jp2') as path:
with self.assertWarns(UserWarning):
j = Jp2k(path)
box = j.box[3].box[1]
self.assertEqual(box.icc_profile_header['Size'], 1328)
self.assertEqual(box.icc_profile_header['Color Space'], 'RGB')
self.assertEqual(box.icc_profile_header['Connection Space'], 'XYZ')
self.assertEqual(box.icc_profile_header['Datetime'],
datetime(2009, 2, 25, 11, 26, 11))
self.assertEqual(box.icc_profile_header['File Signature'], 'acsp')
self.assertEqual(box.icc_profile_header['Platform'], 'APPL')
self.assertEqual(box.icc_profile_header['Flags'],
'not embedded, can be used independently')
self.assertEqual(box.icc_profile_header['Device Manufacturer'], 'appl')
self.assertEqual(box.icc_profile_header['Device Model'], '')
self.assertEqual(box.icc_profile_header['Device Attributes'],
('reflective, glossy, positive media polarity, '
'color media'))
self.assertEqual(box.icc_profile_header['Rendering Intent'],
'perceptual')
np.testing.assert_almost_equal(box.icc_profile_header['Illuminant'],
np.array([0.9642023, 1.0, 0.824905]),
decimal=6)
self.assertEqual(box.icc_profile_header['Creator'], 'appl')
| true
| true
|
f70a18b901a7364101fce9a3ef3981bb6655bbe2
| 11,412
|
py
|
Python
|
bls_py/keys.py
|
zebra-lucky/python-bls
|
f1adb3d57997bf67820dd62eb355a9cd1a82eb4d
|
[
"Apache-2.0"
] | 3
|
2020-07-25T00:37:31.000Z
|
2020-08-24T11:42:17.000Z
|
bls_py/keys.py
|
zebra-lucky/python-bls
|
f1adb3d57997bf67820dd62eb355a9cd1a82eb4d
|
[
"Apache-2.0"
] | null | null | null |
bls_py/keys.py
|
zebra-lucky/python-bls
|
f1adb3d57997bf67820dd62eb355a9cd1a82eb4d
|
[
"Apache-2.0"
] | 1
|
2019-12-09T09:02:05.000Z
|
2019-12-09T09:02:05.000Z
|
import sys
from copy import deepcopy
from random import SystemRandom
from .aggregation_info import AggregationInfo
from .ec import (AffinePoint, JacobianPoint, default_ec, generator_Fq,
hash_to_point_Fq2, hash_to_point_prehashed_Fq2, y_for_x)
from .fields import Fq
from .signature import Signature
from .threshold import Threshold
from .util import hash256, hmac256
RNG = SystemRandom()
class PublicKey:
"""
Public keys are G1 elements, which are elliptic curve points (x, y), where
each x, y is a 381 bit Fq element. The serialized represenentation is just
the x value, and thus 48 bytes. (With the 1st bit determining the valid y).
"""
PUBLIC_KEY_SIZE = 48
def __init__(self, value):
self.value = value
@staticmethod
def from_bytes(buffer):
bit1 = buffer[0] & 0x80
buffer = bytes([buffer[0] & 0x1f]) + buffer[1:]
x = Fq(default_ec.q, int.from_bytes(buffer, "big"))
y_values = y_for_x(Fq(default_ec.q, x))
y_values.sort()
y = y_values[0]
if bit1:
y = y_values[1]
return PublicKey(AffinePoint(x, y, False, default_ec).to_jacobian())
@staticmethod
def from_g1(g1_el):
assert type(g1_el) == JacobianPoint
return PublicKey(g1_el)
def get_fingerprint(self):
ser = self.serialize()
return int.from_bytes(hash256(ser)[:4], "big")
def serialize(self):
return self.value.serialize()
def size(self):
return self.PUBLIC_KEY_SIZE
def __eq__(self, other):
return self.value.serialize() == other.value.serialize()
def __hash__(self):
return int.from_bytes(self.value.serialize(), "big")
def __lt__(self, other):
return self.value.serialize() < other.value.serialize()
def __str__(self):
return "PublicKey(" + self.value.to_affine().__str__() + ")"
def __repr__(self):
return "PublicKey(" + self.value.to_affine().__repr__() + ")"
def __deepcopy__(self, memo):
return PublicKey.from_g1(deepcopy(self.value, memo))
class PrivateKey:
"""
Private keys are just random integers between 1 and the group order.
"""
PRIVATE_KEY_SIZE = 32
def __init__(self, value):
self.value = value
@staticmethod
def from_bytes(buffer):
return PrivateKey(int.from_bytes(buffer, "big"))
@staticmethod
def from_seed(seed):
hashed = hmac256(seed, b"BLS private key seed")
return PrivateKey(int.from_bytes(hashed, "big") % default_ec.n)
@staticmethod
def new_threshold(T, N):
"""
Create a new private key with associated data suitable for
T of N threshold signatures under a Joint-Feldman scheme.
After the dealing phase, one needs cooperation of T players
out of N in order to sign a message with the master key pair.
Return:
- poly[0] - your share of the master secret key
- commitments to your polynomial P
- secret_fragments[j] = P(j), to be sent to player j
(All N secret_fragments[j] can be combined to make a secret share.)
"""
assert 1 <= T <= N
g1 = generator_Fq()
poly = [Fq(default_ec.n, RNG.randint(1, default_ec.n - 1))
for _ in range(T)]
commitments = [g1 * c for c in poly]
secret_fragments = [sum(c * pow(x, i, default_ec.n) for i, c in enumerate(poly))
for x in range(1, N+1)]
return PrivateKey(poly[0]), commitments, secret_fragments
def get_public_key(self):
return PublicKey.from_g1((self.value * generator_Fq())
.to_jacobian())
def sign(self, m):
r = hash_to_point_Fq2(m).to_jacobian()
aggregation_info = AggregationInfo.from_msg(self.get_public_key(), m)
return Signature.from_g2(self.value * r, aggregation_info)
def sign_prehashed(self, h):
r = hash_to_point_prehashed_Fq2(h).to_jacobian()
aggregation_info = AggregationInfo.from_msg_hash(self.get_public_key(),
h)
return Signature.from_g2(self.value * r, aggregation_info)
def sign_threshold(self, m, player, players):
"""
As the given player out of a list of player indices,
return a signature share for the given message.
"""
assert player in players
r = hash_to_point_Fq2(m).to_jacobian()
i = players.index(player)
lambs = Threshold.lagrange_coeffs_at_zero(players)
return Signature.from_g2(self.value * (r * lambs[i]))
def __lt__(self, other):
return self.value < other.value
def __eq__(self, other):
return self.value == other.value
def __hash__(self):
return self.value
def serialize(self):
return self.value.to_bytes(self.PRIVATE_KEY_SIZE, "big")
def size(self):
return self.PRIVATE_KEY_SIZE
def __str__(self):
return "PrivateKey(" + hex(self.value) + ")"
def __repr__(self):
return "PrivateKey(" + hex(self.value) + ")"
class ExtendedPrivateKey:
version = 1
EXTENDED_PRIVATE_KEY_SIZE = 77
def __init__(self, version, depth, parent_fingerprint,
child_number, chain_code, private_key):
self.version = version
self.depth = depth
self.parent_fingerprint = parent_fingerprint
self.child_number = child_number
self.chain_code = chain_code
self.private_key = private_key
@staticmethod
def from_seed(seed):
i_left = hmac256(seed + bytes([0]), b"BLS HD seed")
i_right = hmac256(seed + bytes([1]), b"BLS HD seed")
sk_int = int.from_bytes(i_left, "big") % default_ec.n
sk = PrivateKey.from_bytes(
sk_int.to_bytes(PrivateKey.PRIVATE_KEY_SIZE, "big"))
return ExtendedPrivateKey(ExtendedPrivateKey.version, 0, 0,
0, i_right, sk)
def private_child(self, i):
if (self.depth >= 255):
raise Exception("Cannot go further than 255 levels")
# Hardened keys have i >= 2^31. Non-hardened have i < 2^31
hardened = (i >= (2 ** 31))
if (hardened):
hmac_input = self.private_key.serialize()
else:
hmac_input = self.private_key.get_public_key().serialize()
hmac_input += i.to_bytes(4, "big")
i_left = hmac256(hmac_input + bytes([0]), self.chain_code)
i_right = hmac256(hmac_input + bytes([1]), self.chain_code)
sk_int = ((int.from_bytes(i_left, "big") + self.private_key.value)
% default_ec.n)
sk = PrivateKey.from_bytes(
sk_int.to_bytes(PrivateKey.PRIVATE_KEY_SIZE, "big"))
return ExtendedPrivateKey(ExtendedPrivateKey.version, self.depth + 1,
self.private_key.get_public_key()
.get_fingerprint(), i,
i_right, sk)
def public_child(self, i):
return self.private_child(i).get_extended_public_key()
def get_extended_public_key(self):
serialized = (self.version.to_bytes(4, "big") +
bytes([self.depth]) +
self.parent_fingerprint.to_bytes(4, "big") +
self.child_number.to_bytes(4, "big") +
self.chain_code +
self.private_key.get_public_key().serialize())
return ExtendedPublicKey.from_bytes(serialized)
def get_private_key(self):
return self.private_key
def get_public_key(self):
return self.private_key.get_public_key()
def size(self):
return self.EXTENDED_PRIVATE_KEY_SIZE
def serialize(self):
return (self.version.to_bytes(4, "big") +
bytes([self.depth]) +
self.parent_fingerprint.to_bytes(4, "big") +
self.child_number.to_bytes(4, "big") +
self.chain_code +
self.private_key.serialize())
def __eq__(self, other):
return self.serialize() == other.serialize()
def __hash__(self):
return int.from_bytes(self.serialize())
class ExtendedPublicKey:
EXTENDED_PUBLIC_KEY_SIZE = 93
def __init__(self, version, depth, parent_fingerprint,
child_number, chain_code, public_key):
self.version = version
self.depth = depth
self.parent_fingerprint = parent_fingerprint
self.child_number = child_number
self.chain_code = chain_code
self.public_key = public_key
@staticmethod
def from_bytes(serialized):
version = int.from_bytes(serialized[:4], "big")
depth = int.from_bytes(serialized[4:5], "big")
parent_fingerprint = int.from_bytes(serialized[5:9], "big")
child_number = int.from_bytes(serialized[9:13], "big")
chain_code = serialized[13:45]
public_key = PublicKey.from_bytes(serialized[45:])
return ExtendedPublicKey(version, depth, parent_fingerprint,
child_number, chain_code, public_key)
def public_child(self, i):
if (self.depth >= 255):
raise Exception("Cannot go further than 255 levels")
# Hardened keys have i >= 2^31. Non-hardened have i < 2^31
if i >= (2 ** 31):
raise Exception("Cannot derive hardened children from public key")
hmac_input = self.public_key.serialize() + i.to_bytes(4, "big")
i_left = hmac256(hmac_input + bytes([0]), self.chain_code)
i_right = hmac256(hmac_input + bytes([1]), self.chain_code)
sk_left_int = (int.from_bytes(i_left, "big") % default_ec.n)
sk_left = PrivateKey.from_bytes(
sk_left_int.to_bytes(PrivateKey.PRIVATE_KEY_SIZE, "big"))
new_pk = PublicKey.from_g1(sk_left.get_public_key().value +
self.public_key.value)
return ExtendedPublicKey(self.version, self.depth + 1,
self.public_key.get_fingerprint(), i,
i_right, new_pk)
def get_public_key(self):
return self.public_key
def size(self):
return self.EXTENDED_PUBLIC_KEY_SIZE
def serialize(self):
return (self.version.to_bytes(4, "big") +
bytes([self.depth]) +
self.parent_fingerprint.to_bytes(4, "big") +
self.child_number.to_bytes(4, "big") +
self.chain_code +
self.public_key.serialize())
def __eq__(self, other):
return self.serialize() == other.serialize()
def __hash__(self):
return int.from_bytes(self.serialize())
"""
Copyright 2018 Chia Network 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.
"""
| 34.167665
| 88
| 0.616106
|
import sys
from copy import deepcopy
from random import SystemRandom
from .aggregation_info import AggregationInfo
from .ec import (AffinePoint, JacobianPoint, default_ec, generator_Fq,
hash_to_point_Fq2, hash_to_point_prehashed_Fq2, y_for_x)
from .fields import Fq
from .signature import Signature
from .threshold import Threshold
from .util import hash256, hmac256
RNG = SystemRandom()
class PublicKey:
PUBLIC_KEY_SIZE = 48
def __init__(self, value):
self.value = value
@staticmethod
def from_bytes(buffer):
bit1 = buffer[0] & 0x80
buffer = bytes([buffer[0] & 0x1f]) + buffer[1:]
x = Fq(default_ec.q, int.from_bytes(buffer, "big"))
y_values = y_for_x(Fq(default_ec.q, x))
y_values.sort()
y = y_values[0]
if bit1:
y = y_values[1]
return PublicKey(AffinePoint(x, y, False, default_ec).to_jacobian())
@staticmethod
def from_g1(g1_el):
assert type(g1_el) == JacobianPoint
return PublicKey(g1_el)
def get_fingerprint(self):
ser = self.serialize()
return int.from_bytes(hash256(ser)[:4], "big")
def serialize(self):
return self.value.serialize()
def size(self):
return self.PUBLIC_KEY_SIZE
def __eq__(self, other):
return self.value.serialize() == other.value.serialize()
def __hash__(self):
return int.from_bytes(self.value.serialize(), "big")
def __lt__(self, other):
return self.value.serialize() < other.value.serialize()
def __str__(self):
return "PublicKey(" + self.value.to_affine().__str__() + ")"
def __repr__(self):
return "PublicKey(" + self.value.to_affine().__repr__() + ")"
def __deepcopy__(self, memo):
return PublicKey.from_g1(deepcopy(self.value, memo))
class PrivateKey:
PRIVATE_KEY_SIZE = 32
def __init__(self, value):
self.value = value
@staticmethod
def from_bytes(buffer):
return PrivateKey(int.from_bytes(buffer, "big"))
@staticmethod
def from_seed(seed):
hashed = hmac256(seed, b"BLS private key seed")
return PrivateKey(int.from_bytes(hashed, "big") % default_ec.n)
@staticmethod
def new_threshold(T, N):
assert 1 <= T <= N
g1 = generator_Fq()
poly = [Fq(default_ec.n, RNG.randint(1, default_ec.n - 1))
for _ in range(T)]
commitments = [g1 * c for c in poly]
secret_fragments = [sum(c * pow(x, i, default_ec.n) for i, c in enumerate(poly))
for x in range(1, N+1)]
return PrivateKey(poly[0]), commitments, secret_fragments
def get_public_key(self):
return PublicKey.from_g1((self.value * generator_Fq())
.to_jacobian())
def sign(self, m):
r = hash_to_point_Fq2(m).to_jacobian()
aggregation_info = AggregationInfo.from_msg(self.get_public_key(), m)
return Signature.from_g2(self.value * r, aggregation_info)
def sign_prehashed(self, h):
r = hash_to_point_prehashed_Fq2(h).to_jacobian()
aggregation_info = AggregationInfo.from_msg_hash(self.get_public_key(),
h)
return Signature.from_g2(self.value * r, aggregation_info)
def sign_threshold(self, m, player, players):
assert player in players
r = hash_to_point_Fq2(m).to_jacobian()
i = players.index(player)
lambs = Threshold.lagrange_coeffs_at_zero(players)
return Signature.from_g2(self.value * (r * lambs[i]))
def __lt__(self, other):
return self.value < other.value
def __eq__(self, other):
return self.value == other.value
def __hash__(self):
return self.value
def serialize(self):
return self.value.to_bytes(self.PRIVATE_KEY_SIZE, "big")
def size(self):
return self.PRIVATE_KEY_SIZE
def __str__(self):
return "PrivateKey(" + hex(self.value) + ")"
def __repr__(self):
return "PrivateKey(" + hex(self.value) + ")"
class ExtendedPrivateKey:
version = 1
EXTENDED_PRIVATE_KEY_SIZE = 77
def __init__(self, version, depth, parent_fingerprint,
child_number, chain_code, private_key):
self.version = version
self.depth = depth
self.parent_fingerprint = parent_fingerprint
self.child_number = child_number
self.chain_code = chain_code
self.private_key = private_key
@staticmethod
def from_seed(seed):
i_left = hmac256(seed + bytes([0]), b"BLS HD seed")
i_right = hmac256(seed + bytes([1]), b"BLS HD seed")
sk_int = int.from_bytes(i_left, "big") % default_ec.n
sk = PrivateKey.from_bytes(
sk_int.to_bytes(PrivateKey.PRIVATE_KEY_SIZE, "big"))
return ExtendedPrivateKey(ExtendedPrivateKey.version, 0, 0,
0, i_right, sk)
def private_child(self, i):
if (self.depth >= 255):
raise Exception("Cannot go further than 255 levels")
hardened = (i >= (2 ** 31))
if (hardened):
hmac_input = self.private_key.serialize()
else:
hmac_input = self.private_key.get_public_key().serialize()
hmac_input += i.to_bytes(4, "big")
i_left = hmac256(hmac_input + bytes([0]), self.chain_code)
i_right = hmac256(hmac_input + bytes([1]), self.chain_code)
sk_int = ((int.from_bytes(i_left, "big") + self.private_key.value)
% default_ec.n)
sk = PrivateKey.from_bytes(
sk_int.to_bytes(PrivateKey.PRIVATE_KEY_SIZE, "big"))
return ExtendedPrivateKey(ExtendedPrivateKey.version, self.depth + 1,
self.private_key.get_public_key()
.get_fingerprint(), i,
i_right, sk)
def public_child(self, i):
return self.private_child(i).get_extended_public_key()
def get_extended_public_key(self):
serialized = (self.version.to_bytes(4, "big") +
bytes([self.depth]) +
self.parent_fingerprint.to_bytes(4, "big") +
self.child_number.to_bytes(4, "big") +
self.chain_code +
self.private_key.get_public_key().serialize())
return ExtendedPublicKey.from_bytes(serialized)
def get_private_key(self):
return self.private_key
def get_public_key(self):
return self.private_key.get_public_key()
def size(self):
return self.EXTENDED_PRIVATE_KEY_SIZE
def serialize(self):
return (self.version.to_bytes(4, "big") +
bytes([self.depth]) +
self.parent_fingerprint.to_bytes(4, "big") +
self.child_number.to_bytes(4, "big") +
self.chain_code +
self.private_key.serialize())
def __eq__(self, other):
return self.serialize() == other.serialize()
def __hash__(self):
return int.from_bytes(self.serialize())
class ExtendedPublicKey:
EXTENDED_PUBLIC_KEY_SIZE = 93
def __init__(self, version, depth, parent_fingerprint,
child_number, chain_code, public_key):
self.version = version
self.depth = depth
self.parent_fingerprint = parent_fingerprint
self.child_number = child_number
self.chain_code = chain_code
self.public_key = public_key
@staticmethod
def from_bytes(serialized):
version = int.from_bytes(serialized[:4], "big")
depth = int.from_bytes(serialized[4:5], "big")
parent_fingerprint = int.from_bytes(serialized[5:9], "big")
child_number = int.from_bytes(serialized[9:13], "big")
chain_code = serialized[13:45]
public_key = PublicKey.from_bytes(serialized[45:])
return ExtendedPublicKey(version, depth, parent_fingerprint,
child_number, chain_code, public_key)
def public_child(self, i):
if (self.depth >= 255):
raise Exception("Cannot go further than 255 levels")
if i >= (2 ** 31):
raise Exception("Cannot derive hardened children from public key")
hmac_input = self.public_key.serialize() + i.to_bytes(4, "big")
i_left = hmac256(hmac_input + bytes([0]), self.chain_code)
i_right = hmac256(hmac_input + bytes([1]), self.chain_code)
sk_left_int = (int.from_bytes(i_left, "big") % default_ec.n)
sk_left = PrivateKey.from_bytes(
sk_left_int.to_bytes(PrivateKey.PRIVATE_KEY_SIZE, "big"))
new_pk = PublicKey.from_g1(sk_left.get_public_key().value +
self.public_key.value)
return ExtendedPublicKey(self.version, self.depth + 1,
self.public_key.get_fingerprint(), i,
i_right, new_pk)
def get_public_key(self):
return self.public_key
def size(self):
return self.EXTENDED_PUBLIC_KEY_SIZE
def serialize(self):
return (self.version.to_bytes(4, "big") +
bytes([self.depth]) +
self.parent_fingerprint.to_bytes(4, "big") +
self.child_number.to_bytes(4, "big") +
self.chain_code +
self.public_key.serialize())
def __eq__(self, other):
return self.serialize() == other.serialize()
def __hash__(self):
return int.from_bytes(self.serialize())
| true
| true
|
f70a195622f84b2586afb783102fe8933f5e550b
| 3,683
|
py
|
Python
|
scripts/module/preparation/phastcons_score_list.py
|
Naoto-Imamachi/MIRAGE
|
448d7f2b62f0830c0abd3eb1435d16baffc5d3f9
|
[
"MIT"
] | 3
|
2017-01-16T03:31:38.000Z
|
2021-01-04T16:00:59.000Z
|
scripts/module/preparation/phastcons_score_list.py
|
Imamachi-n/MIRAGE
|
448d7f2b62f0830c0abd3eb1435d16baffc5d3f9
|
[
"MIT"
] | null | null | null |
scripts/module/preparation/phastcons_score_list.py
|
Imamachi-n/MIRAGE
|
448d7f2b62f0830c0abd3eb1435d16baffc5d3f9
|
[
"MIT"
] | null | null | null |
#!usr/bin/env python
import sys
import re
import shelve
from parameter.common_parameters import common_parameters
import utils.setting_utils as utils
utils.now_time("phastcons_score_list script starting...")
p = utils.Bunch(common_parameters)
def main():
utils.now_time("Input_file: " + p.phastcons_score_list_db_input)
utils.now_time("Reference_file: " + p.phastcons_score_list_reference)
utils.now_time("Output_file: " + p.phastcons_score_list_db_output)
output_merge = p.phastcons_score_list_db_output + 'phastCons46way_Refseq_for_MIRAGE_CDS.db' #'phastCons46way_miRBase_v21_hg38Tohg19_for_MIRAGE.db'
output_merge_shelve = shelve.open(output_merge)
#for x in ['chr21']:
for x in ['chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrX','chrY','chrM']:
ref_s = p.phastcons_score_list_reference #mirBase, Refseq etc...
ref_file = open(ref_s,'r')
input_s = p.phastcons_score_list_db_input + x + '.phastCons46way_Refseq_CDS.db' #'.phastCons46way_miRBase_v21_hg38Tohg19.db'
output_s = p.phastcons_score_list_db_output + x + '.phastCons46way_Refseq_for_MIRAGE_CDS.db' #'.phastCons46way_miRBase_v21_hg38Tohg19_for_MIRAGE.db'
input_shelve = shelve.open(input_s)
output_shelve = shelve.open(output_s)
score_list_dict = {}
for line in ref_file:
line = line.rstrip()
data = line.split("\t")
chrom = data[0]
if not chrom == x:
continue
strand = data[5]
if len(data) >= 12: #12bed format
exon_block = data[10].split(',')
exon_block.pop() #Remove the last item ''
exon_st = data[11].split(',')
exon_st.pop() #Remove the last item ''
name = data[3]
score_list_dict[name] = []
for y in range(len(exon_block)):
st = int(data[1]) + int(exon_st[y])
ed = int(data[1]) + int(exon_st[y]) + int(exon_block[y])
length = ed - st
for z in range(length):
score = input_shelve[str(st)]
score_list_dict[name].append(score)
st += 1
if strand == '-':
rev_score = score_list_dict[name][::-1]
score_list_dict[name] = rev_score
elif len(data) >= 3: #6bed format
st = int(data[1])
ed = int(data[2])
length = ed - st
name = data[3]
score_list_dict[name] = []
for z in range(length):
score = input_shelve[str(st)]
score_list_dict[name].append(score)
st += 1
if strand == '-':
rev_score = score_list_dict[name][::-1]
score_list_dict[name] = rev_score
else:
print('ERROR: Your BED format file have less than three column.')
print ('BED format file need to have at least three column [chr, st, ed]...')
sys.exit(1)
output_shelve.update(score_list_dict)
output_merge_shelve.update(score_list_dict)
input_shelve.close()
output_shelve.close()
utils.now_time("phastcons_score_list script was successfully finished!!")
output_merge_shelve.close()
if __name__ == '__main__':
main()
| 42.825581
| 204
| 0.55987
|
import sys
import re
import shelve
from parameter.common_parameters import common_parameters
import utils.setting_utils as utils
utils.now_time("phastcons_score_list script starting...")
p = utils.Bunch(common_parameters)
def main():
utils.now_time("Input_file: " + p.phastcons_score_list_db_input)
utils.now_time("Reference_file: " + p.phastcons_score_list_reference)
utils.now_time("Output_file: " + p.phastcons_score_list_db_output)
output_merge = p.phastcons_score_list_db_output + 'phastCons46way_Refseq_for_MIRAGE_CDS.db'
output_merge_shelve = shelve.open(output_merge)
for x in ['chr1','chr2','chr3','chr4','chr5','chr6','chr7','chr8','chr9','chr10','chr11','chr12','chr13','chr14','chr15','chr16','chr17','chr18','chr19','chr20','chr21','chr22','chrX','chrY','chrM']:
ref_s = p.phastcons_score_list_reference
ref_file = open(ref_s,'r')
input_s = p.phastcons_score_list_db_input + x + '.phastCons46way_Refseq_CDS.db'
output_s = p.phastcons_score_list_db_output + x + '.phastCons46way_Refseq_for_MIRAGE_CDS.db'
input_shelve = shelve.open(input_s)
output_shelve = shelve.open(output_s)
score_list_dict = {}
for line in ref_file:
line = line.rstrip()
data = line.split("\t")
chrom = data[0]
if not chrom == x:
continue
strand = data[5]
if len(data) >= 12:
exon_block = data[10].split(',')
exon_block.pop()
exon_st = data[11].split(',')
exon_st.pop()
name = data[3]
score_list_dict[name] = []
for y in range(len(exon_block)):
st = int(data[1]) + int(exon_st[y])
ed = int(data[1]) + int(exon_st[y]) + int(exon_block[y])
length = ed - st
for z in range(length):
score = input_shelve[str(st)]
score_list_dict[name].append(score)
st += 1
if strand == '-':
rev_score = score_list_dict[name][::-1]
score_list_dict[name] = rev_score
elif len(data) >= 3:
st = int(data[1])
ed = int(data[2])
length = ed - st
name = data[3]
score_list_dict[name] = []
for z in range(length):
score = input_shelve[str(st)]
score_list_dict[name].append(score)
st += 1
if strand == '-':
rev_score = score_list_dict[name][::-1]
score_list_dict[name] = rev_score
else:
print('ERROR: Your BED format file have less than three column.')
print ('BED format file need to have at least three column [chr, st, ed]...')
sys.exit(1)
output_shelve.update(score_list_dict)
output_merge_shelve.update(score_list_dict)
input_shelve.close()
output_shelve.close()
utils.now_time("phastcons_score_list script was successfully finished!!")
output_merge_shelve.close()
if __name__ == '__main__':
main()
| true
| true
|
f70a19951b85ac6ffcb76c0f7122a6358303f1e6
| 4,620
|
py
|
Python
|
docs/conf.py
|
UltronAI/habitat-sim
|
f8fd41a56b9ad2cbc4781d2a16291ca83ce91964
|
[
"MIT"
] | 1,457
|
2019-02-21T21:42:41.000Z
|
2022-03-29T13:34:28.000Z
|
docs/conf.py
|
UltronAI/habitat-sim
|
f8fd41a56b9ad2cbc4781d2a16291ca83ce91964
|
[
"MIT"
] | 1,131
|
2019-02-27T16:14:06.000Z
|
2022-03-31T15:41:24.000Z
|
docs/conf.py
|
UltronAI/habitat-sim
|
f8fd41a56b9ad2cbc4781d2a16291ca83ce91964
|
[
"MIT"
] | 316
|
2019-02-26T22:45:38.000Z
|
2022-03-26T04:55:32.000Z
|
# Copyright (c) Facebook, Inc. and its affiliates.
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import re
import sys
# TODO make this less brittle
sys.path = [
os.path.join(os.path.dirname(__file__), "../"),
# os.path.join(os.path.dirname(__file__), '../build-bundledmagnum/src/deps/magnum-bindings/src/python/')
] + sys.path
import habitat_sim
# TODO: remove once m.css handles class hierarchies better
habitat_sim.logging.HabitatSimFormatter.formatStack.__doc__ = ""
# Monkey patch the registry to be the _Registry class instead of the singleton for docs
habitat_sim.registry = type(habitat_sim.registry)
# TODO: remove once utils/__init__.py is removed again
habitat_sim.utils.__all__.remove("quat_from_angle_axis")
habitat_sim.utils.__all__.remove("quat_rotate_vector")
PROJECT_TITLE = "Habitat"
PROJECT_SUBTITLE = "Sim Docs"
PROJECT_LOGO = "habitat.svg"
FAVICON = "habitat-blue.png"
MAIN_PROJECT_URL = "/"
INPUT_MODULES = [habitat_sim]
INPUT_DOCS = ["docs.rst", "gfx.rst", "noise_models.rst"]
INPUT_PAGES = [
"pages/index.rst",
"pages/new-actions.rst",
"pages/attributesJSON.rst",
"pages/stereo-agent.rst",
"pages/lighting-setups.rst",
"pages/image-extractor.rst",
"pages/asset-viewer-tutorial.rst",
"pages/managed-rigid-object-tutorial.rst",
"pages/logging.rst",
]
PLUGINS = [
"m.abbr",
"m.code",
"m.components",
"m.dox",
"m.gh",
"m.htmlsanity",
"m.images",
"m.link",
"m.math",
"m.sphinx",
]
CLASS_INDEX_EXPAND_LEVELS = 2
NAME_MAPPING = {
# I have no idea what is going on with this thing -- it reports itself as
# being from the builtins module?
"quaternion": "quaternion.quaternion",
# TODO: remove once the inventory file contains this info
"_magnum": "magnum",
}
PYBIND11_COMPATIBILITY = True
ATTRS_COMPATIBILITY = True
OUTPUT = "../build/docs/habitat-sim/"
LINKS_NAVBAR1 = [
(
"Pages",
"pages",
[
("Add new actions", "new-actions"),
("Attributes JSON", "attributesJSON"),
("Stereo agent", "stereo-agent"),
("Lighting Setups", "lighting-setups"),
("Image extraction", "image-extractor"),
("View Assets in Habitat-sim", "asset-viewer-tutorial"),
("Managed Rigid Object Tutorial", "managed-rigid-object-tutorial"),
],
),
("Classes", "classes", []),
]
# When adding new pages / tutorials to LINKS_NAVBAR, the same option in
# Doxyfile-mcss needs to be updated accordingly to keep the C++ and Python
# navbar in sync.
LINKS_NAVBAR2 = [
("C++ API", "./cpp.html", []),
("Habitat Lab Docs", "../habitat-lab/index.html", []),
]
FINE_PRINT = f"""
| {PROJECT_TITLE} {PROJECT_SUBTITLE}. Copyright © 2021 Facebook AI Research.
| `Terms of Use </terms-of-use>`_ `Data Policy </data-policy>`_ `Cookie Policy </cookie-policy>`_
| Created with `m.css Python doc generator <https://mcss.mosra.cz/documentation/python/>`_."""
THEME_COLOR = "#478cc3"
STYLESHEETS = [
"https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600",
"theme.compiled.css",
]
M_SPHINX_INVENTORIES = [
("python.inv", "https://docs.python.org/3/", [], ["m-doc-external"]),
("numpy.inv", "https://docs.scipy.org/doc/numpy/", [], ["m-doc-external"]),
(
"quaternion.inv",
"https://quaternion.readthedocs.io/en/latest/",
[],
["m-doc-external"],
),
(
"magnum-bindings.inv",
"https://doc.magnum.graphics/python/",
[],
["m-doc-external"],
),
]
M_SPHINX_INVENTORY_OUTPUT = "objects.inv"
M_SPHINX_PARSE_DOCSTRINGS = True
M_HTMLSANITY_SMART_QUOTES = True
# Will people hate me if I enable this?
# M_HTMLSANITY_HYPHENATION = True
_hex_colors_src = re.compile(
r"""<span class="s2">"0x(?P<hex>[0-9a-f]{6})"</span>"""
)
_hex_colors_dst = r"""<span class="s2">"0x\g<hex>"</span><span class="m-code-color" style="background-color: #\g<hex>;"></span>"""
M_CODE_FILTERS_POST = {
("Python", "string_hex_colors"): lambda code: _hex_colors_src.sub(
_hex_colors_dst, code
)
}
M_DOX_TAGFILES = [
(
"corrade.tag",
"https://doc.magnum.graphics/corrade/",
["Corrade::"],
["m-doc-external"],
),
(
"magnum.tag",
"https://doc.magnum.graphics/magnum/",
["Magnum::"],
["m-doc-external"],
),
("../build/docs/habitat-cpp.tag", "../habitat-sim/", [], ["m-doc-external"]),
]
| 29.615385
| 140
| 0.640043
|
import os
import re
import sys
sys.path = [
os.path.join(os.path.dirname(__file__), "../"),
] + sys.path
import habitat_sim
habitat_sim.logging.HabitatSimFormatter.formatStack.__doc__ = ""
habitat_sim.registry = type(habitat_sim.registry)
habitat_sim.utils.__all__.remove("quat_from_angle_axis")
habitat_sim.utils.__all__.remove("quat_rotate_vector")
PROJECT_TITLE = "Habitat"
PROJECT_SUBTITLE = "Sim Docs"
PROJECT_LOGO = "habitat.svg"
FAVICON = "habitat-blue.png"
MAIN_PROJECT_URL = "/"
INPUT_MODULES = [habitat_sim]
INPUT_DOCS = ["docs.rst", "gfx.rst", "noise_models.rst"]
INPUT_PAGES = [
"pages/index.rst",
"pages/new-actions.rst",
"pages/attributesJSON.rst",
"pages/stereo-agent.rst",
"pages/lighting-setups.rst",
"pages/image-extractor.rst",
"pages/asset-viewer-tutorial.rst",
"pages/managed-rigid-object-tutorial.rst",
"pages/logging.rst",
]
PLUGINS = [
"m.abbr",
"m.code",
"m.components",
"m.dox",
"m.gh",
"m.htmlsanity",
"m.images",
"m.link",
"m.math",
"m.sphinx",
]
CLASS_INDEX_EXPAND_LEVELS = 2
NAME_MAPPING = {
"quaternion": "quaternion.quaternion",
"_magnum": "magnum",
}
PYBIND11_COMPATIBILITY = True
ATTRS_COMPATIBILITY = True
OUTPUT = "../build/docs/habitat-sim/"
LINKS_NAVBAR1 = [
(
"Pages",
"pages",
[
("Add new actions", "new-actions"),
("Attributes JSON", "attributesJSON"),
("Stereo agent", "stereo-agent"),
("Lighting Setups", "lighting-setups"),
("Image extraction", "image-extractor"),
("View Assets in Habitat-sim", "asset-viewer-tutorial"),
("Managed Rigid Object Tutorial", "managed-rigid-object-tutorial"),
],
),
("Classes", "classes", []),
]
LINKS_NAVBAR2 = [
("C++ API", "./cpp.html", []),
("Habitat Lab Docs", "../habitat-lab/index.html", []),
]
FINE_PRINT = f"""
| {PROJECT_TITLE} {PROJECT_SUBTITLE}. Copyright © 2021 Facebook AI Research.
| `Terms of Use </terms-of-use>`_ `Data Policy </data-policy>`_ `Cookie Policy </cookie-policy>`_
| Created with `m.css Python doc generator <https://mcss.mosra.cz/documentation/python/>`_."""
THEME_COLOR = "#478cc3"
STYLESHEETS = [
"https://fonts.googleapis.com/css?family=Source+Sans+Pro:400,400i,600,600i%7CSource+Code+Pro:400,400i,600",
"theme.compiled.css",
]
M_SPHINX_INVENTORIES = [
("python.inv", "https://docs.python.org/3/", [], ["m-doc-external"]),
("numpy.inv", "https://docs.scipy.org/doc/numpy/", [], ["m-doc-external"]),
(
"quaternion.inv",
"https://quaternion.readthedocs.io/en/latest/",
[],
["m-doc-external"],
),
(
"magnum-bindings.inv",
"https://doc.magnum.graphics/python/",
[],
["m-doc-external"],
),
]
M_SPHINX_INVENTORY_OUTPUT = "objects.inv"
M_SPHINX_PARSE_DOCSTRINGS = True
M_HTMLSANITY_SMART_QUOTES = True
_hex_colors_src = re.compile(
r"""<span class="s2">"0x(?P<hex>[0-9a-f]{6})"</span>"""
)
_hex_colors_dst = r"""<span class="s2">"0x\g<hex>"</span><span class="m-code-color" style="background-color: #\g<hex>;"></span>"""
M_CODE_FILTERS_POST = {
("Python", "string_hex_colors"): lambda code: _hex_colors_src.sub(
_hex_colors_dst, code
)
}
M_DOX_TAGFILES = [
(
"corrade.tag",
"https://doc.magnum.graphics/corrade/",
["Corrade::"],
["m-doc-external"],
),
(
"magnum.tag",
"https://doc.magnum.graphics/magnum/",
["Magnum::"],
["m-doc-external"],
),
("../build/docs/habitat-cpp.tag", "../habitat-sim/", [], ["m-doc-external"]),
]
| true
| true
|
f70a19f51fc1e4929dfce84168119a5e0a81eef7
| 15,349
|
py
|
Python
|
tests/components/monoprice/test_media_player.py
|
pdbogen/home-assistant
|
e602de55ac09be9ab8cbb354519a1b1b57fbe362
|
[
"Apache-2.0"
] | 2
|
2022-01-24T18:59:56.000Z
|
2022-02-04T22:12:48.000Z
|
tests/components/monoprice/test_media_player.py
|
pdbogen/home-assistant
|
e602de55ac09be9ab8cbb354519a1b1b57fbe362
|
[
"Apache-2.0"
] | 5
|
2021-02-08T20:55:25.000Z
|
2022-03-12T00:51:18.000Z
|
tests/components/monoprice/test_media_player.py
|
pdbogen/home-assistant
|
e602de55ac09be9ab8cbb354519a1b1b57fbe362
|
[
"Apache-2.0"
] | 1
|
2020-05-18T09:13:52.000Z
|
2020-05-18T09:13:52.000Z
|
"""The tests for Monoprice Media player platform."""
from collections import defaultdict
from serial import SerialException
from homeassistant.components.media_player.const import (
ATTR_INPUT_SOURCE,
ATTR_INPUT_SOURCE_LIST,
ATTR_MEDIA_VOLUME_LEVEL,
DOMAIN as MEDIA_PLAYER_DOMAIN,
SERVICE_SELECT_SOURCE,
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
SUPPORT_TURN_ON,
SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP,
)
from homeassistant.components.monoprice.const import (
CONF_SOURCES,
DOMAIN,
SERVICE_RESTORE,
SERVICE_SNAPSHOT,
)
from homeassistant.const import (
CONF_PORT,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
SERVICE_VOLUME_DOWN,
SERVICE_VOLUME_MUTE,
SERVICE_VOLUME_SET,
SERVICE_VOLUME_UP,
)
from homeassistant.helpers.entity_component import async_update_entity
from tests.async_mock import patch
from tests.common import MockConfigEntry
MOCK_CONFIG = {CONF_PORT: "fake port", CONF_SOURCES: {"1": "one", "3": "three"}}
MOCK_OPTIONS = {CONF_SOURCES: {"2": "two", "4": "four"}}
ZONE_1_ID = "media_player.zone_11"
ZONE_2_ID = "media_player.zone_12"
class AttrDict(dict):
"""Helper class for mocking attributes."""
def __setattr__(self, name, value):
"""Set attribute."""
self[name] = value
def __getattr__(self, item):
"""Get attribute."""
return self[item]
class MockMonoprice:
"""Mock for pymonoprice object."""
def __init__(self):
"""Init mock object."""
self.zones = defaultdict(
lambda: AttrDict(power=True, volume=0, mute=True, source=1)
)
def zone_status(self, zone_id):
"""Get zone status."""
status = self.zones[zone_id]
status.zone = zone_id
return AttrDict(status)
def set_source(self, zone_id, source_idx):
"""Set source for zone."""
self.zones[zone_id].source = source_idx
def set_power(self, zone_id, power):
"""Turn zone on/off."""
self.zones[zone_id].power = power
def set_mute(self, zone_id, mute):
"""Mute/unmute zone."""
self.zones[zone_id].mute = mute
def set_volume(self, zone_id, volume):
"""Set volume for zone."""
self.zones[zone_id].volume = volume
def restore_zone(self, zone):
"""Restore zone status."""
self.zones[zone.zone] = AttrDict(zone)
async def test_cannot_connect(hass):
"""Test connection error."""
with patch(
"homeassistant.components.monoprice.get_monoprice", side_effect=SerialException,
):
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
# setup_component(self.hass, DOMAIN, MOCK_CONFIG)
# self.hass.async_block_till_done()
await hass.async_block_till_done()
assert hass.states.get(ZONE_1_ID) is None
async def _setup_monoprice(hass, monoprice):
with patch(
"homeassistant.components.monoprice.get_monoprice", new=lambda *a: monoprice,
):
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
# setup_component(self.hass, DOMAIN, MOCK_CONFIG)
# self.hass.async_block_till_done()
await hass.async_block_till_done()
async def _setup_monoprice_with_options(hass, monoprice):
with patch(
"homeassistant.components.monoprice.get_monoprice", new=lambda *a: monoprice,
):
config_entry = MockConfigEntry(
domain=DOMAIN, data=MOCK_CONFIG, options=MOCK_OPTIONS
)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
# setup_component(self.hass, DOMAIN, MOCK_CONFIG)
# self.hass.async_block_till_done()
await hass.async_block_till_done()
async def _call_media_player_service(hass, name, data):
await hass.services.async_call(
MEDIA_PLAYER_DOMAIN, name, service_data=data, blocking=True
)
async def _call_homeassistant_service(hass, name, data):
await hass.services.async_call(
"homeassistant", name, service_data=data, blocking=True
)
async def _call_monoprice_service(hass, name, data):
await hass.services.async_call(DOMAIN, name, service_data=data, blocking=True)
async def test_service_calls_with_entity_id(hass):
"""Test snapshot save/restore service calls."""
await _setup_monoprice(hass, MockMonoprice())
# Changing media player to new state
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
# Saving existing values
await _call_monoprice_service(hass, SERVICE_SNAPSHOT, {"entity_id": ZONE_1_ID})
# Changing media player to new state
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 1.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "three"}
)
# Restoring other media player to its previous state
# The zone should not be restored
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": ZONE_2_ID})
await hass.async_block_till_done()
# Checking that values were not (!) restored
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 1.0
assert state.attributes[ATTR_INPUT_SOURCE] == "three"
# Restoring media player to its previous state
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": ZONE_1_ID})
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.0
assert state.attributes[ATTR_INPUT_SOURCE] == "one"
async def test_service_calls_with_all_entities(hass):
"""Test snapshot save/restore service calls."""
await _setup_monoprice(hass, MockMonoprice())
# Changing media player to new state
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
# Saving existing values
await _call_monoprice_service(hass, SERVICE_SNAPSHOT, {"entity_id": "all"})
# Changing media player to new state
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 1.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "three"}
)
# Restoring media player to its previous state
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": "all"})
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.0
assert state.attributes[ATTR_INPUT_SOURCE] == "one"
async def test_service_calls_without_relevant_entities(hass):
"""Test snapshot save/restore service calls."""
await _setup_monoprice(hass, MockMonoprice())
# Changing media player to new state
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
# Saving existing values
await _call_monoprice_service(hass, SERVICE_SNAPSHOT, {"entity_id": "all"})
# Changing media player to new state
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 1.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "three"}
)
# Restoring media player to its previous state
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": "light.demo"})
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 1.0
assert state.attributes[ATTR_INPUT_SOURCE] == "three"
async def test_restore_without_snapshort(hass):
"""Test restore when snapshot wasn't called."""
await _setup_monoprice(hass, MockMonoprice())
with patch.object(MockMonoprice, "restore_zone") as method_call:
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": ZONE_1_ID})
await hass.async_block_till_done()
assert not method_call.called
async def test_update(hass):
"""Test updating values from monoprice."""
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
# Changing media player to new state
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
monoprice.set_source(11, 3)
monoprice.set_volume(11, 38)
await async_update_entity(hass, ZONE_1_ID)
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 1.0
assert state.attributes[ATTR_INPUT_SOURCE] == "three"
async def test_failed_update(hass):
"""Test updating failure from monoprice."""
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
# Changing media player to new state
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
monoprice.set_source(11, 3)
monoprice.set_volume(11, 38)
with patch.object(MockMonoprice, "zone_status", side_effect=SerialException):
await async_update_entity(hass, ZONE_1_ID)
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.0
assert state.attributes[ATTR_INPUT_SOURCE] == "one"
async def test_empty_update(hass):
"""Test updating with no state from monoprice."""
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
# Changing media player to new state
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
monoprice.set_source(11, 3)
monoprice.set_volume(11, 38)
with patch.object(MockMonoprice, "zone_status", return_value=None):
await async_update_entity(hass, ZONE_1_ID)
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.0
assert state.attributes[ATTR_INPUT_SOURCE] == "one"
async def test_supported_features(hass):
"""Test supported features property."""
await _setup_monoprice(hass, MockMonoprice())
state = hass.states.get(ZONE_1_ID)
assert (
SUPPORT_VOLUME_MUTE
| SUPPORT_VOLUME_SET
| SUPPORT_VOLUME_STEP
| SUPPORT_TURN_ON
| SUPPORT_TURN_OFF
| SUPPORT_SELECT_SOURCE
== state.attributes["supported_features"]
)
async def test_source_list(hass):
"""Test source list property."""
await _setup_monoprice(hass, MockMonoprice())
state = hass.states.get(ZONE_1_ID)
# Note, the list is sorted!
assert state.attributes[ATTR_INPUT_SOURCE_LIST] == ["one", "three"]
async def test_source_list_with_options(hass):
"""Test source list property."""
await _setup_monoprice_with_options(hass, MockMonoprice())
state = hass.states.get(ZONE_1_ID)
# Note, the list is sorted!
assert state.attributes[ATTR_INPUT_SOURCE_LIST] == ["two", "four"]
async def test_select_source(hass):
"""Test source selection methods."""
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(
hass,
SERVICE_SELECT_SOURCE,
{"entity_id": ZONE_1_ID, ATTR_INPUT_SOURCE: "three"},
)
assert monoprice.zones[11].source == 3
# Trying to set unknown source
await _call_media_player_service(
hass,
SERVICE_SELECT_SOURCE,
{"entity_id": ZONE_1_ID, ATTR_INPUT_SOURCE: "no name"},
)
assert monoprice.zones[11].source == 3
async def test_unknown_source(hass):
"""Test behavior when device has unknown source."""
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
monoprice.set_source(11, 5)
await async_update_entity(hass, ZONE_1_ID)
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes.get(ATTR_INPUT_SOURCE) is None
async def test_turn_on_off(hass):
"""Test turning on the zone."""
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(hass, SERVICE_TURN_OFF, {"entity_id": ZONE_1_ID})
assert not monoprice.zones[11].power
await _call_media_player_service(hass, SERVICE_TURN_ON, {"entity_id": ZONE_1_ID})
assert monoprice.zones[11].power
async def test_mute_volume(hass):
"""Test mute functionality."""
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.5}
)
await _call_media_player_service(
hass, SERVICE_VOLUME_MUTE, {"entity_id": ZONE_1_ID, "is_volume_muted": False}
)
assert not monoprice.zones[11].mute
await _call_media_player_service(
hass, SERVICE_VOLUME_MUTE, {"entity_id": ZONE_1_ID, "is_volume_muted": True}
)
assert monoprice.zones[11].mute
async def test_volume_up_down(hass):
"""Test increasing volume by one."""
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
assert monoprice.zones[11].volume == 0
await _call_media_player_service(
hass, SERVICE_VOLUME_DOWN, {"entity_id": ZONE_1_ID}
)
# should not go below zero
assert monoprice.zones[11].volume == 0
await _call_media_player_service(hass, SERVICE_VOLUME_UP, {"entity_id": ZONE_1_ID})
assert monoprice.zones[11].volume == 1
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 1.0}
)
assert monoprice.zones[11].volume == 38
await _call_media_player_service(hass, SERVICE_VOLUME_UP, {"entity_id": ZONE_1_ID})
# should not go above 38
assert monoprice.zones[11].volume == 38
await _call_media_player_service(
hass, SERVICE_VOLUME_DOWN, {"entity_id": ZONE_1_ID}
)
assert monoprice.zones[11].volume == 37
| 31.844398
| 88
| 0.704671
|
from collections import defaultdict
from serial import SerialException
from homeassistant.components.media_player.const import (
ATTR_INPUT_SOURCE,
ATTR_INPUT_SOURCE_LIST,
ATTR_MEDIA_VOLUME_LEVEL,
DOMAIN as MEDIA_PLAYER_DOMAIN,
SERVICE_SELECT_SOURCE,
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
SUPPORT_TURN_ON,
SUPPORT_VOLUME_MUTE,
SUPPORT_VOLUME_SET,
SUPPORT_VOLUME_STEP,
)
from homeassistant.components.monoprice.const import (
CONF_SOURCES,
DOMAIN,
SERVICE_RESTORE,
SERVICE_SNAPSHOT,
)
from homeassistant.const import (
CONF_PORT,
SERVICE_TURN_OFF,
SERVICE_TURN_ON,
SERVICE_VOLUME_DOWN,
SERVICE_VOLUME_MUTE,
SERVICE_VOLUME_SET,
SERVICE_VOLUME_UP,
)
from homeassistant.helpers.entity_component import async_update_entity
from tests.async_mock import patch
from tests.common import MockConfigEntry
MOCK_CONFIG = {CONF_PORT: "fake port", CONF_SOURCES: {"1": "one", "3": "three"}}
MOCK_OPTIONS = {CONF_SOURCES: {"2": "two", "4": "four"}}
ZONE_1_ID = "media_player.zone_11"
ZONE_2_ID = "media_player.zone_12"
class AttrDict(dict):
def __setattr__(self, name, value):
self[name] = value
def __getattr__(self, item):
return self[item]
class MockMonoprice:
def __init__(self):
self.zones = defaultdict(
lambda: AttrDict(power=True, volume=0, mute=True, source=1)
)
def zone_status(self, zone_id):
status = self.zones[zone_id]
status.zone = zone_id
return AttrDict(status)
def set_source(self, zone_id, source_idx):
self.zones[zone_id].source = source_idx
def set_power(self, zone_id, power):
self.zones[zone_id].power = power
def set_mute(self, zone_id, mute):
self.zones[zone_id].mute = mute
def set_volume(self, zone_id, volume):
self.zones[zone_id].volume = volume
def restore_zone(self, zone):
self.zones[zone.zone] = AttrDict(zone)
async def test_cannot_connect(hass):
with patch(
"homeassistant.components.monoprice.get_monoprice", side_effect=SerialException,
):
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
assert hass.states.get(ZONE_1_ID) is None
async def _setup_monoprice(hass, monoprice):
with patch(
"homeassistant.components.monoprice.get_monoprice", new=lambda *a: monoprice,
):
config_entry = MockConfigEntry(domain=DOMAIN, data=MOCK_CONFIG)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
async def _setup_monoprice_with_options(hass, monoprice):
with patch(
"homeassistant.components.monoprice.get_monoprice", new=lambda *a: monoprice,
):
config_entry = MockConfigEntry(
domain=DOMAIN, data=MOCK_CONFIG, options=MOCK_OPTIONS
)
config_entry.add_to_hass(hass)
await hass.config_entries.async_setup(config_entry.entry_id)
await hass.async_block_till_done()
async def _call_media_player_service(hass, name, data):
await hass.services.async_call(
MEDIA_PLAYER_DOMAIN, name, service_data=data, blocking=True
)
async def _call_homeassistant_service(hass, name, data):
await hass.services.async_call(
"homeassistant", name, service_data=data, blocking=True
)
async def _call_monoprice_service(hass, name, data):
await hass.services.async_call(DOMAIN, name, service_data=data, blocking=True)
async def test_service_calls_with_entity_id(hass):
await _setup_monoprice(hass, MockMonoprice())
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
await _call_monoprice_service(hass, SERVICE_SNAPSHOT, {"entity_id": ZONE_1_ID})
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 1.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "three"}
)
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": ZONE_2_ID})
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 1.0
assert state.attributes[ATTR_INPUT_SOURCE] == "three"
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": ZONE_1_ID})
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.0
assert state.attributes[ATTR_INPUT_SOURCE] == "one"
async def test_service_calls_with_all_entities(hass):
await _setup_monoprice(hass, MockMonoprice())
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
await _call_monoprice_service(hass, SERVICE_SNAPSHOT, {"entity_id": "all"})
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 1.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "three"}
)
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": "all"})
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.0
assert state.attributes[ATTR_INPUT_SOURCE] == "one"
async def test_service_calls_without_relevant_entities(hass):
await _setup_monoprice(hass, MockMonoprice())
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
await _call_monoprice_service(hass, SERVICE_SNAPSHOT, {"entity_id": "all"})
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 1.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "three"}
)
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": "light.demo"})
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 1.0
assert state.attributes[ATTR_INPUT_SOURCE] == "three"
async def test_restore_without_snapshort(hass):
await _setup_monoprice(hass, MockMonoprice())
with patch.object(MockMonoprice, "restore_zone") as method_call:
await _call_monoprice_service(hass, SERVICE_RESTORE, {"entity_id": ZONE_1_ID})
await hass.async_block_till_done()
assert not method_call.called
async def test_update(hass):
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
monoprice.set_source(11, 3)
monoprice.set_volume(11, 38)
await async_update_entity(hass, ZONE_1_ID)
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 1.0
assert state.attributes[ATTR_INPUT_SOURCE] == "three"
async def test_failed_update(hass):
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
monoprice.set_source(11, 3)
monoprice.set_volume(11, 38)
with patch.object(MockMonoprice, "zone_status", side_effect=SerialException):
await async_update_entity(hass, ZONE_1_ID)
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.0
assert state.attributes[ATTR_INPUT_SOURCE] == "one"
async def test_empty_update(hass):
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
await _call_media_player_service(
hass, SERVICE_SELECT_SOURCE, {"entity_id": ZONE_1_ID, "source": "one"}
)
monoprice.set_source(11, 3)
monoprice.set_volume(11, 38)
with patch.object(MockMonoprice, "zone_status", return_value=None):
await async_update_entity(hass, ZONE_1_ID)
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_MEDIA_VOLUME_LEVEL] == 0.0
assert state.attributes[ATTR_INPUT_SOURCE] == "one"
async def test_supported_features(hass):
await _setup_monoprice(hass, MockMonoprice())
state = hass.states.get(ZONE_1_ID)
assert (
SUPPORT_VOLUME_MUTE
| SUPPORT_VOLUME_SET
| SUPPORT_VOLUME_STEP
| SUPPORT_TURN_ON
| SUPPORT_TURN_OFF
| SUPPORT_SELECT_SOURCE
== state.attributes["supported_features"]
)
async def test_source_list(hass):
await _setup_monoprice(hass, MockMonoprice())
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_INPUT_SOURCE_LIST] == ["one", "three"]
async def test_source_list_with_options(hass):
await _setup_monoprice_with_options(hass, MockMonoprice())
state = hass.states.get(ZONE_1_ID)
assert state.attributes[ATTR_INPUT_SOURCE_LIST] == ["two", "four"]
async def test_select_source(hass):
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(
hass,
SERVICE_SELECT_SOURCE,
{"entity_id": ZONE_1_ID, ATTR_INPUT_SOURCE: "three"},
)
assert monoprice.zones[11].source == 3
await _call_media_player_service(
hass,
SERVICE_SELECT_SOURCE,
{"entity_id": ZONE_1_ID, ATTR_INPUT_SOURCE: "no name"},
)
assert monoprice.zones[11].source == 3
async def test_unknown_source(hass):
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
monoprice.set_source(11, 5)
await async_update_entity(hass, ZONE_1_ID)
await hass.async_block_till_done()
state = hass.states.get(ZONE_1_ID)
assert state.attributes.get(ATTR_INPUT_SOURCE) is None
async def test_turn_on_off(hass):
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(hass, SERVICE_TURN_OFF, {"entity_id": ZONE_1_ID})
assert not monoprice.zones[11].power
await _call_media_player_service(hass, SERVICE_TURN_ON, {"entity_id": ZONE_1_ID})
assert monoprice.zones[11].power
async def test_mute_volume(hass):
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.5}
)
await _call_media_player_service(
hass, SERVICE_VOLUME_MUTE, {"entity_id": ZONE_1_ID, "is_volume_muted": False}
)
assert not monoprice.zones[11].mute
await _call_media_player_service(
hass, SERVICE_VOLUME_MUTE, {"entity_id": ZONE_1_ID, "is_volume_muted": True}
)
assert monoprice.zones[11].mute
async def test_volume_up_down(hass):
monoprice = MockMonoprice()
await _setup_monoprice(hass, monoprice)
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 0.0}
)
assert monoprice.zones[11].volume == 0
await _call_media_player_service(
hass, SERVICE_VOLUME_DOWN, {"entity_id": ZONE_1_ID}
)
assert monoprice.zones[11].volume == 0
await _call_media_player_service(hass, SERVICE_VOLUME_UP, {"entity_id": ZONE_1_ID})
assert monoprice.zones[11].volume == 1
await _call_media_player_service(
hass, SERVICE_VOLUME_SET, {"entity_id": ZONE_1_ID, "volume_level": 1.0}
)
assert monoprice.zones[11].volume == 38
await _call_media_player_service(hass, SERVICE_VOLUME_UP, {"entity_id": ZONE_1_ID})
assert monoprice.zones[11].volume == 38
await _call_media_player_service(
hass, SERVICE_VOLUME_DOWN, {"entity_id": ZONE_1_ID}
)
assert monoprice.zones[11].volume == 37
| true
| true
|
f70a1a3d6be3176f87e56f1573e0f4b1076b23a5
| 496
|
py
|
Python
|
pythontutorials/books/AutomateTheBoringStuff/Ch05/P2_characterCount.py
|
JoseALermaIII/python-tutorials
|
9d6cb78beec0bb55e27c49da1217317ba4d5f4fc
|
[
"MIT"
] | 2
|
2017-04-20T02:57:19.000Z
|
2018-10-12T20:15:47.000Z
|
pythontutorials/books/AutomateTheBoringStuff/Ch05/P2_characterCount.py
|
JoseALermaIII/python-tutorials
|
9d6cb78beec0bb55e27c49da1217317ba4d5f4fc
|
[
"MIT"
] | 8
|
2021-03-18T21:50:16.000Z
|
2022-03-11T23:38:01.000Z
|
pythontutorials/books/AutomateTheBoringStuff/Ch05/P2_characterCount.py
|
JoseALermaIII/python-tutorials
|
9d6cb78beec0bb55e27c49da1217317ba4d5f4fc
|
[
"MIT"
] | 3
|
2018-08-30T20:30:50.000Z
|
2022-01-18T13:40:51.000Z
|
"""Character count
This program counts how often each character appears in a string.
"""
def main():
message = 'It was a bright cold day in April, and the clocks were striking thirteen.'
"""str: Message to count characters."""
count = {}
"""dict: Characters as keys and counts as values."""
for character in message:
count.setdefault(character, 0)
count[character] = count[character] + 1
print(count)
if __name__ == '__main__':
main()
| 20.666667
| 89
| 0.637097
|
def main():
message = 'It was a bright cold day in April, and the clocks were striking thirteen.'
count = {}
for character in message:
count.setdefault(character, 0)
count[character] = count[character] + 1
print(count)
if __name__ == '__main__':
main()
| true
| true
|
f70a1cb6f5e5200cbb6e0cabbea4fdcec0c9ec6c
| 1,914
|
py
|
Python
|
roberta/scripts/convert_bert_text_classification_from_huggingface_to_uer.py
|
LiRunyi2001/cnSoftBei
|
72b90033ade1e926d3fb23621f5c67fa8eec9bb4
|
[
"MIT"
] | 1
|
2021-11-29T08:33:00.000Z
|
2021-11-29T08:33:00.000Z
|
roberta/scripts/convert_bert_text_classification_from_huggingface_to_uer.py
|
LiRunyi2001/cnSoftBei
|
72b90033ade1e926d3fb23621f5c67fa8eec9bb4
|
[
"MIT"
] | null | null | null |
roberta/scripts/convert_bert_text_classification_from_huggingface_to_uer.py
|
LiRunyi2001/cnSoftBei
|
72b90033ade1e926d3fb23621f5c67fa8eec9bb4
|
[
"MIT"
] | null | null | null |
import sys
import os
import torch
import argparse
import collections
uer_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, uer_dir)
from scripts.convert_bert_from_huggingface_to_uer import convert_bert_transformer_encoder_from_huggingface_to_uer
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--input_model_path", type=str, default="huggingface_model.bin",
help=".")
parser.add_argument("--output_model_path", type=str, default="pytorch_model.bin",
help=".")
parser.add_argument("--layers_num", type=int, default=12, help=".")
args = parser.parse_args()
path = args.input_model_path
input_model = torch.load(args.input_model_path, map_location='cpu')
output_model = collections.OrderedDict()
output_model["embedding.word_embedding.weight"] = input_model["bert.embeddings.word_embeddings.weight"]
output_model["embedding.position_embedding.weight"] = input_model["bert.embeddings.position_embeddings.weight"]
output_model["embedding.segment_embedding.weight"] = torch.cat((torch.Tensor([[0]*input_model["bert.embeddings.token_type_embeddings.weight"].size()[1]]), input_model["bert.embeddings.token_type_embeddings.weight"]), dim=0)
output_model["embedding.layer_norm.gamma"] = input_model["bert.embeddings.LayerNorm.weight"]
output_model["embedding.layer_norm.beta"] = input_model["bert.embeddings.LayerNorm.bias"]
convert_bert_transformer_encoder_from_huggingface_to_uer(input_model, output_model, args.layers_num)
output_model["output_layer_1.weight"] = input_model["bert.pooler.dense.weight"]
output_model["output_layer_1.bias"] = input_model["bert.pooler.dense.bias"]
output_model["output_layer_2.weight"] = input_model["classifier.weight"]
output_model["output_layer_2.bias"] = input_model["classifier.bias"]
torch.save(output_model, args.output_model_path)
| 47.85
| 223
| 0.795716
|
import sys
import os
import torch
import argparse
import collections
uer_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))
sys.path.insert(0, uer_dir)
from scripts.convert_bert_from_huggingface_to_uer import convert_bert_transformer_encoder_from_huggingface_to_uer
parser = argparse.ArgumentParser(formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument("--input_model_path", type=str, default="huggingface_model.bin",
help=".")
parser.add_argument("--output_model_path", type=str, default="pytorch_model.bin",
help=".")
parser.add_argument("--layers_num", type=int, default=12, help=".")
args = parser.parse_args()
path = args.input_model_path
input_model = torch.load(args.input_model_path, map_location='cpu')
output_model = collections.OrderedDict()
output_model["embedding.word_embedding.weight"] = input_model["bert.embeddings.word_embeddings.weight"]
output_model["embedding.position_embedding.weight"] = input_model["bert.embeddings.position_embeddings.weight"]
output_model["embedding.segment_embedding.weight"] = torch.cat((torch.Tensor([[0]*input_model["bert.embeddings.token_type_embeddings.weight"].size()[1]]), input_model["bert.embeddings.token_type_embeddings.weight"]), dim=0)
output_model["embedding.layer_norm.gamma"] = input_model["bert.embeddings.LayerNorm.weight"]
output_model["embedding.layer_norm.beta"] = input_model["bert.embeddings.LayerNorm.bias"]
convert_bert_transformer_encoder_from_huggingface_to_uer(input_model, output_model, args.layers_num)
output_model["output_layer_1.weight"] = input_model["bert.pooler.dense.weight"]
output_model["output_layer_1.bias"] = input_model["bert.pooler.dense.bias"]
output_model["output_layer_2.weight"] = input_model["classifier.weight"]
output_model["output_layer_2.bias"] = input_model["classifier.bias"]
torch.save(output_model, args.output_model_path)
| true
| true
|
f70a1cef52c255401bc34e7dbbce792978be7289
| 69,597
|
py
|
Python
|
sdk/lusid/api/data_types_api.py
|
finbourne/lusid-sdk-python-generated-preview
|
9c36c953e8149443a4390ed7f0c04d01211401b6
|
[
"MIT"
] | null | null | null |
sdk/lusid/api/data_types_api.py
|
finbourne/lusid-sdk-python-generated-preview
|
9c36c953e8149443a4390ed7f0c04d01211401b6
|
[
"MIT"
] | null | null | null |
sdk/lusid/api/data_types_api.py
|
finbourne/lusid-sdk-python-generated-preview
|
9c36c953e8149443a4390ed7f0c04d01211401b6
|
[
"MIT"
] | null | null | null |
# coding: utf-8
"""
LUSID API
FINBOURNE Technology # noqa: E501
The version of the OpenAPI document: 0.11.4425
Contact: info@finbourne.com
Generated by: https://openapi-generator.tech
"""
from __future__ import absolute_import
import re # noqa: F401
# python 2 and python 3 compatibility library
import six
from lusid.api_client import ApiClient
from lusid.exceptions import ( # noqa: F401
ApiTypeError,
ApiValueError
)
class DataTypesApi(object):
"""NOTE: This class is auto generated by OpenAPI Generator
Ref: https://openapi-generator.tech
Do not edit the class manually.
"""
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_data_type(self, **kwargs): # noqa: E501
"""[BETA] CreateDataType: Create data type definition # noqa: E501
Create a new data type definition Data types cannot be created in either the \"default\" or \"system\" scopes. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_data_type(async_req=True)
>>> result = thread.get()
:param create_data_type_request: The definition of the new data type
:type create_data_type_request: CreateDataTypeRequest
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: DataType
"""
kwargs['_return_http_data_only'] = True
return self.create_data_type_with_http_info(**kwargs) # noqa: E501
def create_data_type_with_http_info(self, **kwargs): # noqa: E501
"""[BETA] CreateDataType: Create data type definition # noqa: E501
Create a new data type definition Data types cannot be created in either the \"default\" or \"system\" scopes. # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.create_data_type_with_http_info(async_req=True)
>>> result = thread.get()
:param create_data_type_request: The definition of the new data type
:type create_data_type_request: CreateDataTypeRequest
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(DataType, status_code(int), headers(HTTPHeaderDict))
"""
local_var_params = locals()
all_params = [
'create_data_type_request'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method create_data_type" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'create_data_type_request' in local_var_params:
body_params = local_var_params['create_data_type_request']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json']) # noqa: E501
header_params['Accept-Encoding'] = "gzip, deflate, br"
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']) # noqa: E501
# set the LUSID header
header_params['X-LUSID-SDK-Language'] = 'Python'
header_params['X-LUSID-SDK-Version'] = '0.11.4425'
# Authentication setting
auth_settings = ['oauth2'] # noqa: E501
response_types_map = {
201: "DataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def get_data_type(self, scope, code, **kwargs): # noqa: E501
"""GetDataType: Get data type definition # noqa: E501
Get the definition of a specified data type # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_data_type(scope, code, async_req=True)
>>> result = thread.get()
:param scope: The scope of the data type (required)
:type scope: str
:param code: The code of the data type (required)
:type code: str
:param as_at: The asAt datetime at which to retrieve the data type definition. Defaults to return the latest version of the instrument definition if not specified.
:type as_at: datetime
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: DataType
"""
kwargs['_return_http_data_only'] = True
return self.get_data_type_with_http_info(scope, code, **kwargs) # noqa: E501
def get_data_type_with_http_info(self, scope, code, **kwargs): # noqa: E501
"""GetDataType: Get data type definition # noqa: E501
Get the definition of a specified data type # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_data_type_with_http_info(scope, code, async_req=True)
>>> result = thread.get()
:param scope: The scope of the data type (required)
:type scope: str
:param code: The code of the data type (required)
:type code: str
:param as_at: The asAt datetime at which to retrieve the data type definition. Defaults to return the latest version of the instrument definition if not specified.
:type as_at: datetime
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(DataType, status_code(int), headers(HTTPHeaderDict))
"""
local_var_params = locals()
all_params = [
'scope',
'code',
'as_at'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method get_data_type" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) > 64): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `get_data_type`, length must be less than or equal to `64`") # noqa: E501
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `get_data_type`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `get_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`") # noqa: E501
if self.api_client.client_side_validation and ('code' in local_var_params and # noqa: E501
len(local_var_params['code']) > 64): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `get_data_type`, length must be less than or equal to `64`") # noqa: E501
if self.api_client.client_side_validation and ('code' in local_var_params and # noqa: E501
len(local_var_params['code']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `get_data_type`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `get_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`") # noqa: E501
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope'] # noqa: E501
if 'code' in local_var_params:
path_params['code'] = local_var_params['code'] # noqa: E501
query_params = []
if 'as_at' in local_var_params and local_var_params['as_at'] is not None: # noqa: E501
query_params.append(('asAt', local_var_params['as_at'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json']) # noqa: E501
header_params['Accept-Encoding'] = "gzip, deflate, br"
# Authentication setting
auth_settings = ['oauth2'] # noqa: E501
response_types_map = {
200: "DataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}/{code}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def get_units_from_data_type(self, scope, code, **kwargs): # noqa: E501
"""[EARLY ACCESS] GetUnitsFromDataType: Get units from data type # noqa: E501
Get the definitions of the specified units associated bound to a specific data type # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_units_from_data_type(scope, code, async_req=True)
>>> result = thread.get()
:param scope: The scope of the data type (required)
:type scope: str
:param code: The code of the data type (required)
:type code: str
:param units: One or more unit identifiers for which the definition is being requested
:type units: list[str]
:param filter: Optional. Expression to filter the result set. For example, to filter on the Schema, use \"schema eq 'string'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
:type filter: str
:param as_at: Optional. The as at of the requested data type
:type as_at: datetime
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: ResourceListOfIUnitDefinitionDto
"""
kwargs['_return_http_data_only'] = True
return self.get_units_from_data_type_with_http_info(scope, code, **kwargs) # noqa: E501
def get_units_from_data_type_with_http_info(self, scope, code, **kwargs): # noqa: E501
"""[EARLY ACCESS] GetUnitsFromDataType: Get units from data type # noqa: E501
Get the definitions of the specified units associated bound to a specific data type # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.get_units_from_data_type_with_http_info(scope, code, async_req=True)
>>> result = thread.get()
:param scope: The scope of the data type (required)
:type scope: str
:param code: The code of the data type (required)
:type code: str
:param units: One or more unit identifiers for which the definition is being requested
:type units: list[str]
:param filter: Optional. Expression to filter the result set. For example, to filter on the Schema, use \"schema eq 'string'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
:type filter: str
:param as_at: Optional. The as at of the requested data type
:type as_at: datetime
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(ResourceListOfIUnitDefinitionDto, status_code(int), headers(HTTPHeaderDict))
"""
local_var_params = locals()
all_params = [
'scope',
'code',
'units',
'filter',
'as_at'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method get_units_from_data_type" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) > 64): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `get_units_from_data_type`, length must be less than or equal to `64`") # noqa: E501
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `get_units_from_data_type`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `get_units_from_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`") # noqa: E501
if self.api_client.client_side_validation and ('code' in local_var_params and # noqa: E501
len(local_var_params['code']) > 64): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `get_units_from_data_type`, length must be less than or equal to `64`") # noqa: E501
if self.api_client.client_side_validation and ('code' in local_var_params and # noqa: E501
len(local_var_params['code']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `get_units_from_data_type`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `get_units_from_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`") # noqa: E501
if self.api_client.client_side_validation and ('filter' in local_var_params and # noqa: E501
len(local_var_params['filter']) > 16384): # noqa: E501
raise ApiValueError("Invalid value for parameter `filter` when calling `get_units_from_data_type`, length must be less than or equal to `16384`") # noqa: E501
if self.api_client.client_side_validation and ('filter' in local_var_params and # noqa: E501
len(local_var_params['filter']) < 0): # noqa: E501
raise ApiValueError("Invalid value for parameter `filter` when calling `get_units_from_data_type`, length must be greater than or equal to `0`") # noqa: E501
if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(r'^[\s\S]*$', local_var_params['filter']): # noqa: E501
raise ApiValueError("Invalid value for parameter `filter` when calling `get_units_from_data_type`, must conform to the pattern `/^[\s\S]*$/`") # noqa: E501
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope'] # noqa: E501
if 'code' in local_var_params:
path_params['code'] = local_var_params['code'] # noqa: E501
query_params = []
if 'units' in local_var_params and local_var_params['units'] is not None: # noqa: E501
query_params.append(('units', local_var_params['units'])) # noqa: E501
collection_formats['units'] = 'multi' # noqa: E501
if 'filter' in local_var_params and local_var_params['filter'] is not None: # noqa: E501
query_params.append(('filter', local_var_params['filter'])) # noqa: E501
if 'as_at' in local_var_params and local_var_params['as_at'] is not None: # noqa: E501
query_params.append(('asAt', local_var_params['as_at'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json']) # noqa: E501
header_params['Accept-Encoding'] = "gzip, deflate, br"
# Authentication setting
auth_settings = ['oauth2'] # noqa: E501
response_types_map = {
200: "ResourceListOfIUnitDefinitionDto",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}/{code}/units', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def list_data_type_summaries(self, **kwargs): # noqa: E501
"""[EXPERIMENTAL] ListDataTypeSummaries: List all data type summaries, without the reference data # noqa: E501
List all data type summaries # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_data_type_summaries(async_req=True)
>>> result = thread.get()
:param as_at: The asAt datetime at which to list the data type summaries. Defaults to returning the latest version of each summary if not specified.
:type as_at: datetime
:param page: The pagination token to use to continue listing data type summaries. This value is returned from the previous call. If a pagination token is provided, the filter, effectiveAt and asAt fields must not have changed since the original request. Also, if set, a start value cannot be provided.
:type page: str
:param start: When paginating, skip this number of results.
:type start: int
:param limit: When paginating, limit the results to this number. Defaults to 100 if not specified.
:type limit: int
:param filter: Optional. Expression to filter the result set. For example, to filter on the Scope, use \"id.scope eq 'myscope'\", to filter on Schema, use \"schema eq 'string'\", to filter on AcceptableValues use \"acceptableValues any (~ eq 'value')\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
:type filter: str
:param sort_by: Sort the results by these fields. Use use the '-' sign to denote descending allocation e.g. -MyFieldName.
:type sort_by: list[str]
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: PagedResourceListOfDataTypeSummary
"""
kwargs['_return_http_data_only'] = True
return self.list_data_type_summaries_with_http_info(**kwargs) # noqa: E501
def list_data_type_summaries_with_http_info(self, **kwargs): # noqa: E501
"""[EXPERIMENTAL] ListDataTypeSummaries: List all data type summaries, without the reference data # noqa: E501
List all data type summaries # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_data_type_summaries_with_http_info(async_req=True)
>>> result = thread.get()
:param as_at: The asAt datetime at which to list the data type summaries. Defaults to returning the latest version of each summary if not specified.
:type as_at: datetime
:param page: The pagination token to use to continue listing data type summaries. This value is returned from the previous call. If a pagination token is provided, the filter, effectiveAt and asAt fields must not have changed since the original request. Also, if set, a start value cannot be provided.
:type page: str
:param start: When paginating, skip this number of results.
:type start: int
:param limit: When paginating, limit the results to this number. Defaults to 100 if not specified.
:type limit: int
:param filter: Optional. Expression to filter the result set. For example, to filter on the Scope, use \"id.scope eq 'myscope'\", to filter on Schema, use \"schema eq 'string'\", to filter on AcceptableValues use \"acceptableValues any (~ eq 'value')\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
:type filter: str
:param sort_by: Sort the results by these fields. Use use the '-' sign to denote descending allocation e.g. -MyFieldName.
:type sort_by: list[str]
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(PagedResourceListOfDataTypeSummary, status_code(int), headers(HTTPHeaderDict))
"""
local_var_params = locals()
all_params = [
'as_at',
'page',
'start',
'limit',
'filter',
'sort_by'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method list_data_type_summaries" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('page' in local_var_params and # noqa: E501
len(local_var_params['page']) > 500): # noqa: E501
raise ApiValueError("Invalid value for parameter `page` when calling `list_data_type_summaries`, length must be less than or equal to `500`") # noqa: E501
if self.api_client.client_side_validation and ('page' in local_var_params and # noqa: E501
len(local_var_params['page']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `page` when calling `list_data_type_summaries`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'page' in local_var_params and not re.search(r'^[a-zA-Z0-9\+\/]*={0,3}$', local_var_params['page']): # noqa: E501
raise ApiValueError("Invalid value for parameter `page` when calling `list_data_type_summaries`, must conform to the pattern `/^[a-zA-Z0-9\+\/]*={0,3}$/`") # noqa: E501
if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 5000: # noqa: E501
raise ApiValueError("Invalid value for parameter `limit` when calling `list_data_type_summaries`, must be a value less than or equal to `5000`") # noqa: E501
if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1: # noqa: E501
raise ApiValueError("Invalid value for parameter `limit` when calling `list_data_type_summaries`, must be a value greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and ('filter' in local_var_params and # noqa: E501
len(local_var_params['filter']) > 16384): # noqa: E501
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_type_summaries`, length must be less than or equal to `16384`") # noqa: E501
if self.api_client.client_side_validation and ('filter' in local_var_params and # noqa: E501
len(local_var_params['filter']) < 0): # noqa: E501
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_type_summaries`, length must be greater than or equal to `0`") # noqa: E501
if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(r'^[\s\S]*$', local_var_params['filter']): # noqa: E501
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_type_summaries`, must conform to the pattern `/^[\s\S]*$/`") # noqa: E501
collection_formats = {}
path_params = {}
query_params = []
if 'as_at' in local_var_params and local_var_params['as_at'] is not None: # noqa: E501
query_params.append(('asAt', local_var_params['as_at'])) # noqa: E501
if 'page' in local_var_params and local_var_params['page'] is not None: # noqa: E501
query_params.append(('page', local_var_params['page'])) # noqa: E501
if 'start' in local_var_params and local_var_params['start'] is not None: # noqa: E501
query_params.append(('start', local_var_params['start'])) # noqa: E501
if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
query_params.append(('limit', local_var_params['limit'])) # noqa: E501
if 'filter' in local_var_params and local_var_params['filter'] is not None: # noqa: E501
query_params.append(('filter', local_var_params['filter'])) # noqa: E501
if 'sort_by' in local_var_params and local_var_params['sort_by'] is not None: # noqa: E501
query_params.append(('sortBy', local_var_params['sort_by'])) # noqa: E501
collection_formats['sortBy'] = 'multi' # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json']) # noqa: E501
header_params['Accept-Encoding'] = "gzip, deflate, br"
# Authentication setting
auth_settings = ['oauth2'] # noqa: E501
response_types_map = {
200: "PagedResourceListOfDataTypeSummary",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def list_data_types(self, scope, **kwargs): # noqa: E501
"""ListDataTypes: List data types # noqa: E501
List all data types in a specified scope # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_data_types(scope, async_req=True)
>>> result = thread.get()
:param scope: The requested scope of the data types (required)
:type scope: str
:param as_at: The as at of the requested data types
:type as_at: datetime
:param include_system: Whether to additionally include those data types in the \"system\" scope
:type include_system: bool
:param sort_by: Optional. Order the results by these fields. Use use the '-' sign to denote descending order e.g. -MyFieldName
:type sort_by: list[str]
:param start: Optional. When paginating, skip this number of results
:type start: int
:param limit: Optional. When paginating, limit the number of returned results to this many.
:type limit: int
:param filter: Optional. Expression to filter the result set. For example, to filter on the Display Name, use \"displayName eq 'string'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
:type filter: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: ResourceListOfDataType
"""
kwargs['_return_http_data_only'] = True
return self.list_data_types_with_http_info(scope, **kwargs) # noqa: E501
def list_data_types_with_http_info(self, scope, **kwargs): # noqa: E501
"""ListDataTypes: List data types # noqa: E501
List all data types in a specified scope # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.list_data_types_with_http_info(scope, async_req=True)
>>> result = thread.get()
:param scope: The requested scope of the data types (required)
:type scope: str
:param as_at: The as at of the requested data types
:type as_at: datetime
:param include_system: Whether to additionally include those data types in the \"system\" scope
:type include_system: bool
:param sort_by: Optional. Order the results by these fields. Use use the '-' sign to denote descending order e.g. -MyFieldName
:type sort_by: list[str]
:param start: Optional. When paginating, skip this number of results
:type start: int
:param limit: Optional. When paginating, limit the number of returned results to this many.
:type limit: int
:param filter: Optional. Expression to filter the result set. For example, to filter on the Display Name, use \"displayName eq 'string'\" Read more about filtering results from LUSID here https://support.lusid.com/filtering-results-from-lusid.
:type filter: str
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(ResourceListOfDataType, status_code(int), headers(HTTPHeaderDict))
"""
local_var_params = locals()
all_params = [
'scope',
'as_at',
'include_system',
'sort_by',
'start',
'limit',
'filter'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method list_data_types" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) > 64): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `list_data_types`, length must be less than or equal to `64`") # noqa: E501
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `list_data_types`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `list_data_types`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`") # noqa: E501
if self.api_client.client_side_validation and ('filter' in local_var_params and # noqa: E501
len(local_var_params['filter']) > 16384): # noqa: E501
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_types`, length must be less than or equal to `16384`") # noqa: E501
if self.api_client.client_side_validation and ('filter' in local_var_params and # noqa: E501
len(local_var_params['filter']) < 0): # noqa: E501
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_types`, length must be greater than or equal to `0`") # noqa: E501
if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(r'^[\s\S]*$', local_var_params['filter']): # noqa: E501
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_types`, must conform to the pattern `/^[\s\S]*$/`") # noqa: E501
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope'] # noqa: E501
query_params = []
if 'as_at' in local_var_params and local_var_params['as_at'] is not None: # noqa: E501
query_params.append(('asAt', local_var_params['as_at'])) # noqa: E501
if 'include_system' in local_var_params and local_var_params['include_system'] is not None: # noqa: E501
query_params.append(('includeSystem', local_var_params['include_system'])) # noqa: E501
if 'sort_by' in local_var_params and local_var_params['sort_by'] is not None: # noqa: E501
query_params.append(('sortBy', local_var_params['sort_by'])) # noqa: E501
collection_formats['sortBy'] = 'multi' # noqa: E501
if 'start' in local_var_params and local_var_params['start'] is not None: # noqa: E501
query_params.append(('start', local_var_params['start'])) # noqa: E501
if 'limit' in local_var_params and local_var_params['limit'] is not None: # noqa: E501
query_params.append(('limit', local_var_params['limit'])) # noqa: E501
if 'filter' in local_var_params and local_var_params['filter'] is not None: # noqa: E501
query_params.append(('filter', local_var_params['filter'])) # noqa: E501
header_params = {}
form_params = []
local_var_files = {}
body_params = None
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json']) # noqa: E501
header_params['Accept-Encoding'] = "gzip, deflate, br"
# Authentication setting
auth_settings = ['oauth2'] # noqa: E501
response_types_map = {
200: "ResourceListOfDataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def update_data_type(self, scope, code, update_data_type_request, **kwargs): # noqa: E501
"""[EXPERIMENTAL] UpdateDataType: Update data type definition # noqa: E501
Update the definition of the specified existing data type Not all elements within a data type definition are modifiable due to the potential implications for data already stored against the types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_data_type(scope, code, update_data_type_request, async_req=True)
>>> result = thread.get()
:param scope: The scope of the data type (required)
:type scope: str
:param code: The code of the data type (required)
:type code: str
:param update_data_type_request: The updated definition of the data type (required)
:type update_data_type_request: UpdateDataTypeRequest
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: DataType
"""
kwargs['_return_http_data_only'] = True
return self.update_data_type_with_http_info(scope, code, update_data_type_request, **kwargs) # noqa: E501
def update_data_type_with_http_info(self, scope, code, update_data_type_request, **kwargs): # noqa: E501
"""[EXPERIMENTAL] UpdateDataType: Update data type definition # noqa: E501
Update the definition of the specified existing data type Not all elements within a data type definition are modifiable due to the potential implications for data already stored against the types # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_data_type_with_http_info(scope, code, update_data_type_request, async_req=True)
>>> result = thread.get()
:param scope: The scope of the data type (required)
:type scope: str
:param code: The code of the data type (required)
:type code: str
:param update_data_type_request: The updated definition of the data type (required)
:type update_data_type_request: UpdateDataTypeRequest
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(DataType, status_code(int), headers(HTTPHeaderDict))
"""
local_var_params = locals()
all_params = [
'scope',
'code',
'update_data_type_request'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method update_data_type" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'update_data_type_request' is set
if self.api_client.client_side_validation and ('update_data_type_request' not in local_var_params or # noqa: E501
local_var_params['update_data_type_request'] is None): # noqa: E501
raise ApiValueError("Missing the required parameter `update_data_type_request` when calling `update_data_type`") # noqa: E501
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) > 64): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `update_data_type`, length must be less than or equal to `64`") # noqa: E501
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `update_data_type`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `update_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`") # noqa: E501
if self.api_client.client_side_validation and ('code' in local_var_params and # noqa: E501
len(local_var_params['code']) > 64): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `update_data_type`, length must be less than or equal to `64`") # noqa: E501
if self.api_client.client_side_validation and ('code' in local_var_params and # noqa: E501
len(local_var_params['code']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `update_data_type`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `update_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`") # noqa: E501
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope'] # noqa: E501
if 'code' in local_var_params:
path_params['code'] = local_var_params['code'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'update_data_type_request' in local_var_params:
body_params = local_var_params['update_data_type_request']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json']) # noqa: E501
header_params['Accept-Encoding'] = "gzip, deflate, br"
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']) # noqa: E501
# set the LUSID header
header_params['X-LUSID-SDK-Language'] = 'Python'
header_params['X-LUSID-SDK-Version'] = '0.11.4425'
# Authentication setting
auth_settings = ['oauth2'] # noqa: E501
response_types_map = {
200: "DataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}/{code}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def update_reference_values(self, scope, code, field_value, **kwargs): # noqa: E501
"""[EXPERIMENTAL] UpdateReferenceValues: Update reference data on a data type # noqa: E501
Replaces the whole set of reference values # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_reference_values(scope, code, field_value, async_req=True)
>>> result = thread.get()
:param scope: The scope of the data type (required)
:type scope: str
:param code: The code of the data type (required)
:type code: str
:param field_value: The updated reference values (required)
:type field_value: list[FieldValue]
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: DataType
"""
kwargs['_return_http_data_only'] = True
return self.update_reference_values_with_http_info(scope, code, field_value, **kwargs) # noqa: E501
def update_reference_values_with_http_info(self, scope, code, field_value, **kwargs): # noqa: E501
"""[EXPERIMENTAL] UpdateReferenceValues: Update reference data on a data type # noqa: E501
Replaces the whole set of reference values # noqa: E501
This method makes a synchronous HTTP request by default. To make an
asynchronous HTTP request, please pass async_req=True
>>> thread = api.update_reference_values_with_http_info(scope, code, field_value, async_req=True)
>>> result = thread.get()
:param scope: The scope of the data type (required)
:type scope: str
:param code: The code of the data type (required)
:type code: str
:param field_value: The updated reference values (required)
:type field_value: list[FieldValue]
:param async_req: Whether to execute the request asynchronously.
:type async_req: bool, optional
:param _return_http_data_only: response data without head status code
and headers
:type _return_http_data_only: bool, optional
:param _preload_content: if False, the urllib3.HTTPResponse object will
be returned without reading/decoding response
data. Default is True.
:type _preload_content: bool, optional
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the authentication
in the spec for a single request.
:type _request_auth: dict, optional
:return: Returns the result object.
If the method is called asynchronously,
returns the request thread.
:rtype: tuple(DataType, status_code(int), headers(HTTPHeaderDict))
"""
local_var_params = locals()
all_params = [
'scope',
'code',
'field_value'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method update_reference_values" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
# verify the required parameter 'field_value' is set
if self.api_client.client_side_validation and ('field_value' not in local_var_params or # noqa: E501
local_var_params['field_value'] is None): # noqa: E501
raise ApiValueError("Missing the required parameter `field_value` when calling `update_reference_values`") # noqa: E501
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) > 64): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `update_reference_values`, length must be less than or equal to `64`") # noqa: E501
if self.api_client.client_side_validation and ('scope' in local_var_params and # noqa: E501
len(local_var_params['scope']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `update_reference_values`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']): # noqa: E501
raise ApiValueError("Invalid value for parameter `scope` when calling `update_reference_values`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`") # noqa: E501
if self.api_client.client_side_validation and ('code' in local_var_params and # noqa: E501
len(local_var_params['code']) > 64): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `update_reference_values`, length must be less than or equal to `64`") # noqa: E501
if self.api_client.client_side_validation and ('code' in local_var_params and # noqa: E501
len(local_var_params['code']) < 1): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `update_reference_values`, length must be greater than or equal to `1`") # noqa: E501
if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']): # noqa: E501
raise ApiValueError("Invalid value for parameter `code` when calling `update_reference_values`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`") # noqa: E501
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope'] # noqa: E501
if 'code' in local_var_params:
path_params['code'] = local_var_params['code'] # noqa: E501
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'field_value' in local_var_params:
body_params = local_var_params['field_value']
# HTTP header `Accept`
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json']) # noqa: E501
header_params['Accept-Encoding'] = "gzip, deflate, br"
# HTTP header `Content-Type`
header_params['Content-Type'] = self.api_client.select_header_content_type( # noqa: E501
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json']) # noqa: E501
# set the LUSID header
header_params['X-LUSID-SDK-Language'] = 'Python'
header_params['X-LUSID-SDK-Version'] = '0.11.4425'
# Authentication setting
auth_settings = ['oauth2'] # noqa: E501
response_types_map = {
200: "DataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}/{code}/referencedatavalues', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'), # noqa: E501
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
| 54.930545
| 409
| 0.61415
|
from __future__ import absolute_import
import re
import six
from lusid.api_client import ApiClient
from lusid.exceptions import (
ApiTypeError,
ApiValueError
)
class DataTypesApi(object):
def __init__(self, api_client=None):
if api_client is None:
api_client = ApiClient()
self.api_client = api_client
def create_data_type(self, **kwargs):
kwargs['_return_http_data_only'] = True
return self.create_data_type_with_http_info(**kwargs)
def create_data_type_with_http_info(self, **kwargs):
local_var_params = locals()
all_params = [
'create_data_type_request'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method create_data_type" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
collection_formats = {}
path_params = {}
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'create_data_type_request' in local_var_params:
body_params = local_var_params['create_data_type_request']
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json'])
header_params['Accept-Encoding'] = "gzip, deflate, br"
header_params['Content-Type'] = self.api_client.select_header_content_type(
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json'])
header_params['X-LUSID-SDK-Language'] = 'Python'
header_params['X-LUSID-SDK-Version'] = '0.11.4425'
auth_settings = ['oauth2']
response_types_map = {
201: "DataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes', 'POST',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'),
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def get_data_type(self, scope, code, **kwargs):
kwargs['_return_http_data_only'] = True
return self.get_data_type_with_http_info(scope, code, **kwargs)
def get_data_type_with_http_info(self, scope, code, **kwargs):
local_var_params = locals()
all_params = [
'scope',
'code',
'as_at'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method get_data_type" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) > 64):
raise ApiValueError("Invalid value for parameter `scope` when calling `get_data_type`, length must be less than or equal to `64`")
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) < 1):
raise ApiValueError("Invalid value for parameter `scope` when calling `get_data_type`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):
raise ApiValueError("Invalid value for parameter `scope` when calling `get_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")
if self.api_client.client_side_validation and ('code' in local_var_params and
len(local_var_params['code']) > 64):
raise ApiValueError("Invalid value for parameter `code` when calling `get_data_type`, length must be less than or equal to `64`")
if self.api_client.client_side_validation and ('code' in local_var_params and
len(local_var_params['code']) < 1):
raise ApiValueError("Invalid value for parameter `code` when calling `get_data_type`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):
raise ApiValueError("Invalid value for parameter `code` when calling `get_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope']
if 'code' in local_var_params:
path_params['code'] = local_var_params['code']
query_params = []
if 'as_at' in local_var_params and local_var_params['as_at'] is not None:
query_params.append(('asAt', local_var_params['as_at']))
header_params = {}
form_params = []
local_var_files = {}
body_params = None
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json'])
header_params['Accept-Encoding'] = "gzip, deflate, br"
auth_settings = ['oauth2']
response_types_map = {
200: "DataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}/{code}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'),
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def get_units_from_data_type(self, scope, code, **kwargs):
kwargs['_return_http_data_only'] = True
return self.get_units_from_data_type_with_http_info(scope, code, **kwargs)
def get_units_from_data_type_with_http_info(self, scope, code, **kwargs):
local_var_params = locals()
all_params = [
'scope',
'code',
'units',
'filter',
'as_at'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method get_units_from_data_type" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) > 64):
raise ApiValueError("Invalid value for parameter `scope` when calling `get_units_from_data_type`, length must be less than or equal to `64`")
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) < 1):
raise ApiValueError("Invalid value for parameter `scope` when calling `get_units_from_data_type`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):
raise ApiValueError("Invalid value for parameter `scope` when calling `get_units_from_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")
if self.api_client.client_side_validation and ('code' in local_var_params and
len(local_var_params['code']) > 64):
raise ApiValueError("Invalid value for parameter `code` when calling `get_units_from_data_type`, length must be less than or equal to `64`")
if self.api_client.client_side_validation and ('code' in local_var_params and
len(local_var_params['code']) < 1):
raise ApiValueError("Invalid value for parameter `code` when calling `get_units_from_data_type`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):
raise ApiValueError("Invalid value for parameter `code` when calling `get_units_from_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")
if self.api_client.client_side_validation and ('filter' in local_var_params and
len(local_var_params['filter']) > 16384):
raise ApiValueError("Invalid value for parameter `filter` when calling `get_units_from_data_type`, length must be less than or equal to `16384`")
if self.api_client.client_side_validation and ('filter' in local_var_params and
len(local_var_params['filter']) < 0):
raise ApiValueError("Invalid value for parameter `filter` when calling `get_units_from_data_type`, length must be greater than or equal to `0`")
if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(r'^[\s\S]*$', local_var_params['filter']):
raise ApiValueError("Invalid value for parameter `filter` when calling `get_units_from_data_type`, must conform to the pattern `/^[\s\S]*$/`")
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope']
if 'code' in local_var_params:
path_params['code'] = local_var_params['code']
query_params = []
if 'units' in local_var_params and local_var_params['units'] is not None:
query_params.append(('units', local_var_params['units']))
collection_formats['units'] = 'multi'
if 'filter' in local_var_params and local_var_params['filter'] is not None:
query_params.append(('filter', local_var_params['filter']))
if 'as_at' in local_var_params and local_var_params['as_at'] is not None:
query_params.append(('asAt', local_var_params['as_at']))
header_params = {}
form_params = []
local_var_files = {}
body_params = None
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json'])
header_params['Accept-Encoding'] = "gzip, deflate, br"
auth_settings = ['oauth2']
response_types_map = {
200: "ResourceListOfIUnitDefinitionDto",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}/{code}/units', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'),
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def list_data_type_summaries(self, **kwargs):
kwargs['_return_http_data_only'] = True
return self.list_data_type_summaries_with_http_info(**kwargs)
def list_data_type_summaries_with_http_info(self, **kwargs):
local_var_params = locals()
all_params = [
'as_at',
'page',
'start',
'limit',
'filter',
'sort_by'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method list_data_type_summaries" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('page' in local_var_params and
len(local_var_params['page']) > 500):
raise ApiValueError("Invalid value for parameter `page` when calling `list_data_type_summaries`, length must be less than or equal to `500`")
if self.api_client.client_side_validation and ('page' in local_var_params and
len(local_var_params['page']) < 1):
raise ApiValueError("Invalid value for parameter `page` when calling `list_data_type_summaries`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'page' in local_var_params and not re.search(r'^[a-zA-Z0-9\+\/]*={0,3}$', local_var_params['page']):
raise ApiValueError("Invalid value for parameter `page` when calling `list_data_type_summaries`, must conform to the pattern `/^[a-zA-Z0-9\+\/]*={0,3}$/`")
if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] > 5000:
raise ApiValueError("Invalid value for parameter `limit` when calling `list_data_type_summaries`, must be a value less than or equal to `5000`")
if self.api_client.client_side_validation and 'limit' in local_var_params and local_var_params['limit'] < 1:
raise ApiValueError("Invalid value for parameter `limit` when calling `list_data_type_summaries`, must be a value greater than or equal to `1`")
if self.api_client.client_side_validation and ('filter' in local_var_params and
len(local_var_params['filter']) > 16384):
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_type_summaries`, length must be less than or equal to `16384`")
if self.api_client.client_side_validation and ('filter' in local_var_params and
len(local_var_params['filter']) < 0):
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_type_summaries`, length must be greater than or equal to `0`")
if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(r'^[\s\S]*$', local_var_params['filter']):
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_type_summaries`, must conform to the pattern `/^[\s\S]*$/`")
collection_formats = {}
path_params = {}
query_params = []
if 'as_at' in local_var_params and local_var_params['as_at'] is not None:
query_params.append(('asAt', local_var_params['as_at']))
if 'page' in local_var_params and local_var_params['page'] is not None:
query_params.append(('page', local_var_params['page']))
if 'start' in local_var_params and local_var_params['start'] is not None:
query_params.append(('start', local_var_params['start']))
if 'limit' in local_var_params and local_var_params['limit'] is not None:
query_params.append(('limit', local_var_params['limit']))
if 'filter' in local_var_params and local_var_params['filter'] is not None:
query_params.append(('filter', local_var_params['filter']))
if 'sort_by' in local_var_params and local_var_params['sort_by'] is not None:
query_params.append(('sortBy', local_var_params['sort_by']))
collection_formats['sortBy'] = 'multi'
header_params = {}
form_params = []
local_var_files = {}
body_params = None
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json'])
header_params['Accept-Encoding'] = "gzip, deflate, br"
auth_settings = ['oauth2']
response_types_map = {
200: "PagedResourceListOfDataTypeSummary",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'),
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def list_data_types(self, scope, **kwargs):
kwargs['_return_http_data_only'] = True
return self.list_data_types_with_http_info(scope, **kwargs)
def list_data_types_with_http_info(self, scope, **kwargs):
local_var_params = locals()
all_params = [
'scope',
'as_at',
'include_system',
'sort_by',
'start',
'limit',
'filter'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method list_data_types" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) > 64):
raise ApiValueError("Invalid value for parameter `scope` when calling `list_data_types`, length must be less than or equal to `64`")
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) < 1):
raise ApiValueError("Invalid value for parameter `scope` when calling `list_data_types`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):
raise ApiValueError("Invalid value for parameter `scope` when calling `list_data_types`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")
if self.api_client.client_side_validation and ('filter' in local_var_params and
len(local_var_params['filter']) > 16384):
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_types`, length must be less than or equal to `16384`")
if self.api_client.client_side_validation and ('filter' in local_var_params and
len(local_var_params['filter']) < 0):
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_types`, length must be greater than or equal to `0`")
if self.api_client.client_side_validation and 'filter' in local_var_params and not re.search(r'^[\s\S]*$', local_var_params['filter']):
raise ApiValueError("Invalid value for parameter `filter` when calling `list_data_types`, must conform to the pattern `/^[\s\S]*$/`")
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope']
query_params = []
if 'as_at' in local_var_params and local_var_params['as_at'] is not None:
query_params.append(('asAt', local_var_params['as_at']))
if 'include_system' in local_var_params and local_var_params['include_system'] is not None:
query_params.append(('includeSystem', local_var_params['include_system']))
if 'sort_by' in local_var_params and local_var_params['sort_by'] is not None:
query_params.append(('sortBy', local_var_params['sort_by']))
collection_formats['sortBy'] = 'multi'
if 'start' in local_var_params and local_var_params['start'] is not None:
query_params.append(('start', local_var_params['start']))
if 'limit' in local_var_params and local_var_params['limit'] is not None:
query_params.append(('limit', local_var_params['limit']))
if 'filter' in local_var_params and local_var_params['filter'] is not None:
query_params.append(('filter', local_var_params['filter']))
header_params = {}
form_params = []
local_var_files = {}
body_params = None
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json'])
header_params['Accept-Encoding'] = "gzip, deflate, br"
auth_settings = ['oauth2']
response_types_map = {
200: "ResourceListOfDataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}', 'GET',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'),
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def update_data_type(self, scope, code, update_data_type_request, **kwargs):
kwargs['_return_http_data_only'] = True
return self.update_data_type_with_http_info(scope, code, update_data_type_request, **kwargs)
def update_data_type_with_http_info(self, scope, code, update_data_type_request, **kwargs):
local_var_params = locals()
all_params = [
'scope',
'code',
'update_data_type_request'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method update_data_type" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('update_data_type_request' not in local_var_params or
local_var_params['update_data_type_request'] is None):
raise ApiValueError("Missing the required parameter `update_data_type_request` when calling `update_data_type`")
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) > 64):
raise ApiValueError("Invalid value for parameter `scope` when calling `update_data_type`, length must be less than or equal to `64`")
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) < 1):
raise ApiValueError("Invalid value for parameter `scope` when calling `update_data_type`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):
raise ApiValueError("Invalid value for parameter `scope` when calling `update_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")
if self.api_client.client_side_validation and ('code' in local_var_params and
len(local_var_params['code']) > 64):
raise ApiValueError("Invalid value for parameter `code` when calling `update_data_type`, length must be less than or equal to `64`")
if self.api_client.client_side_validation and ('code' in local_var_params and
len(local_var_params['code']) < 1):
raise ApiValueError("Invalid value for parameter `code` when calling `update_data_type`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):
raise ApiValueError("Invalid value for parameter `code` when calling `update_data_type`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope']
if 'code' in local_var_params:
path_params['code'] = local_var_params['code']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'update_data_type_request' in local_var_params:
body_params = local_var_params['update_data_type_request']
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json'])
header_params['Accept-Encoding'] = "gzip, deflate, br"
header_params['Content-Type'] = self.api_client.select_header_content_type(
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json'])
header_params['X-LUSID-SDK-Language'] = 'Python'
header_params['X-LUSID-SDK-Version'] = '0.11.4425'
auth_settings = ['oauth2']
response_types_map = {
200: "DataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}/{code}', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'),
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
def update_reference_values(self, scope, code, field_value, **kwargs):
kwargs['_return_http_data_only'] = True
return self.update_reference_values_with_http_info(scope, code, field_value, **kwargs)
def update_reference_values_with_http_info(self, scope, code, field_value, **kwargs):
local_var_params = locals()
all_params = [
'scope',
'code',
'field_value'
]
all_params.extend(
[
'async_req',
'_return_http_data_only',
'_preload_content',
'_request_timeout',
'_request_auth'
]
)
for key, val in six.iteritems(local_var_params['kwargs']):
if key not in all_params:
raise ApiTypeError(
"Got an unexpected keyword argument '%s'"
" to method update_reference_values" % key
)
local_var_params[key] = val
del local_var_params['kwargs']
if self.api_client.client_side_validation and ('field_value' not in local_var_params or
local_var_params['field_value'] is None):
raise ApiValueError("Missing the required parameter `field_value` when calling `update_reference_values`")
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) > 64):
raise ApiValueError("Invalid value for parameter `scope` when calling `update_reference_values`, length must be less than or equal to `64`")
if self.api_client.client_side_validation and ('scope' in local_var_params and
len(local_var_params['scope']) < 1):
raise ApiValueError("Invalid value for parameter `scope` when calling `update_reference_values`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'scope' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['scope']):
raise ApiValueError("Invalid value for parameter `scope` when calling `update_reference_values`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")
if self.api_client.client_side_validation and ('code' in local_var_params and
len(local_var_params['code']) > 64):
raise ApiValueError("Invalid value for parameter `code` when calling `update_reference_values`, length must be less than or equal to `64`")
if self.api_client.client_side_validation and ('code' in local_var_params and
len(local_var_params['code']) < 1):
raise ApiValueError("Invalid value for parameter `code` when calling `update_reference_values`, length must be greater than or equal to `1`")
if self.api_client.client_side_validation and 'code' in local_var_params and not re.search(r'^[a-zA-Z0-9\-_]+$', local_var_params['code']):
raise ApiValueError("Invalid value for parameter `code` when calling `update_reference_values`, must conform to the pattern `/^[a-zA-Z0-9\-_]+$/`")
collection_formats = {}
path_params = {}
if 'scope' in local_var_params:
path_params['scope'] = local_var_params['scope']
if 'code' in local_var_params:
path_params['code'] = local_var_params['code']
query_params = []
header_params = {}
form_params = []
local_var_files = {}
body_params = None
if 'field_value' in local_var_params:
body_params = local_var_params['field_value']
header_params['Accept'] = self.api_client.select_header_accept(
['text/plain', 'application/json', 'text/json'])
header_params['Accept-Encoding'] = "gzip, deflate, br"
header_params['Content-Type'] = self.api_client.select_header_content_type(
['application/json-patch+json', 'application/json', 'text/json', 'application/*+json'])
header_params['X-LUSID-SDK-Language'] = 'Python'
header_params['X-LUSID-SDK-Version'] = '0.11.4425'
auth_settings = ['oauth2']
response_types_map = {
200: "DataType",
400: "LusidValidationProblemDetails",
}
return self.api_client.call_api(
'/api/datatypes/{scope}/{code}/referencedatavalues', 'PUT',
path_params,
query_params,
header_params,
body=body_params,
post_params=form_params,
files=local_var_files,
response_types_map=response_types_map,
auth_settings=auth_settings,
async_req=local_var_params.get('async_req'),
_return_http_data_only=local_var_params.get('_return_http_data_only'),
_preload_content=local_var_params.get('_preload_content', True),
_request_timeout=local_var_params.get('_request_timeout'),
collection_formats=collection_formats,
_request_auth=local_var_params.get('_request_auth'))
| true
| true
|
f70a1da1cd39a3e99fe038d88d3e890621cfe100
| 4,950
|
py
|
Python
|
napari/utils/progress.py
|
kolibril13/napari
|
b39647d94e587f0255b0d4cc3087855e160a8929
|
[
"BSD-3-Clause"
] | null | null | null |
napari/utils/progress.py
|
kolibril13/napari
|
b39647d94e587f0255b0d4cc3087855e160a8929
|
[
"BSD-3-Clause"
] | null | null | null |
napari/utils/progress.py
|
kolibril13/napari
|
b39647d94e587f0255b0d4cc3087855e160a8929
|
[
"BSD-3-Clause"
] | null | null | null |
import inspect
from typing import Iterable, Optional
from tqdm import tqdm
from ..utils.translations import trans
_tqdm_kwargs = {
p.name
for p in inspect.signature(tqdm.__init__).parameters.values()
if p.kind is not inspect.Parameter.VAR_KEYWORD and p.name != "self"
}
class progress(tqdm):
"""This class inherits from tqdm and provides an interface for
progress bars in the napari viewer. Progress bars can be created
directly by wrapping an iterable or by providing a total number
of expected updates.
See tqdm.tqdm API for valid args and kwargs:
https://tqdm.github.io/docs/tqdm/
Also, any keyword arguments to the :class:`ProgressBar` `QWidget`
are also accepted and will be passed to the ``ProgressBar``.
Examples
--------
>>> def long_running(steps=10, delay=0.1):
... for i in progress(range(steps)):
... sleep(delay)
it can also be used as a context manager:
>>> def long_running(steps=10, repeats=4, delay=0.1):
... with progress(range(steps)) as pbr:
... for i in pbr:
... sleep(delay)
or equivalently, using the `progrange` shorthand
... with progrange(steps) as pbr:
... for i in pbr:
... sleep(delay)
For manual updates:
>>> def manual_updates(total):
... pbr = progress(total=total)
... sleep(10)
... pbr.set_description("Step 1 Complete")
... pbr.update(1)
... # must call pbr.close() when using outside for loop
... # or context manager
... pbr.close()
"""
monitor_interval = 0 # set to 0 to disable the thread
def __init__(
self,
iterable: Optional[Iterable] = None,
desc: Optional[str] = None,
total: Optional[int] = None,
nest_under: Optional['progress'] = None,
*args,
**kwargs,
) -> None:
kwargs = kwargs.copy()
pbar_kwargs = {k: kwargs.pop(k) for k in set(kwargs) - _tqdm_kwargs}
self._group_token = None
# get progress bar added to viewer
try:
from .._qt.dialogs.activity_dialog import get_pbar
pbar = get_pbar(self, nest_under=nest_under, **pbar_kwargs)
except ImportError:
pbar = None
if pbar is not None:
kwargs['gui'] = True
self._pbar = pbar
super().__init__(iterable, desc, total, *args, **kwargs)
if not self._pbar:
return
if self.total is not None:
self._pbar.setRange(self.n, self.total)
self._pbar._set_value(self.n)
else:
self._pbar.setRange(0, 0)
self.total = 0
if desc:
self.set_description(desc)
else:
self.set_description(trans._("progress"))
def display(self, msg: str = None, pos: int = None) -> None:
"""Update the display."""
if not self._pbar:
return super().display(msg=msg, pos=pos)
if self.total != 0:
etas = str(self).split('|')[-1]
try:
self._pbar._set_value(self.n)
self._pbar._set_eta(etas)
except AttributeError:
pass
def increment_with_overflow(self):
"""Update if not exceeding total, else set indeterminate range."""
if self.n == self.total:
self.total = 0
if self._pbar:
self._pbar.setRange(0, 0)
else:
self.update(1)
def set_description(self, desc):
"""Update progress bar description"""
super().set_description(desc, refresh=True)
if self._pbar:
self._pbar._set_description(self.desc)
def close(self):
"""Closes and deletes the progress bar widget"""
if self.disable:
return
if self._pbar:
self.close_pbar()
super().close()
def close_pbar(self):
if self.disable or not self._pbar:
return
from napari._qt.widgets.qt_progress_bar import (
ProgressBar,
ProgressBarGroup,
)
parent_widget = self._pbar.parent()
self._pbar.close()
self._pbar.deleteLater()
if isinstance(parent_widget, ProgressBarGroup):
pbar_children = [
child
for child in parent_widget.children()
if isinstance(child, ProgressBar)
]
if not any(child.isVisible() for child in pbar_children):
parent_widget.close()
self._pbar = None
def progrange(*args, **kwargs):
"""Shorthand for `progress(range(*args), **kwargs)`.
Adds tqdm based progress bar to napari viewer, if it
exists, and returns the wrapped range object.
Returns
-------
progress
wrapped range object
"""
return progress(range(*args), **kwargs)
| 28.612717
| 76
| 0.571111
|
import inspect
from typing import Iterable, Optional
from tqdm import tqdm
from ..utils.translations import trans
_tqdm_kwargs = {
p.name
for p in inspect.signature(tqdm.__init__).parameters.values()
if p.kind is not inspect.Parameter.VAR_KEYWORD and p.name != "self"
}
class progress(tqdm):
monitor_interval = 0
def __init__(
self,
iterable: Optional[Iterable] = None,
desc: Optional[str] = None,
total: Optional[int] = None,
nest_under: Optional['progress'] = None,
*args,
**kwargs,
) -> None:
kwargs = kwargs.copy()
pbar_kwargs = {k: kwargs.pop(k) for k in set(kwargs) - _tqdm_kwargs}
self._group_token = None
try:
from .._qt.dialogs.activity_dialog import get_pbar
pbar = get_pbar(self, nest_under=nest_under, **pbar_kwargs)
except ImportError:
pbar = None
if pbar is not None:
kwargs['gui'] = True
self._pbar = pbar
super().__init__(iterable, desc, total, *args, **kwargs)
if not self._pbar:
return
if self.total is not None:
self._pbar.setRange(self.n, self.total)
self._pbar._set_value(self.n)
else:
self._pbar.setRange(0, 0)
self.total = 0
if desc:
self.set_description(desc)
else:
self.set_description(trans._("progress"))
def display(self, msg: str = None, pos: int = None) -> None:
if not self._pbar:
return super().display(msg=msg, pos=pos)
if self.total != 0:
etas = str(self).split('|')[-1]
try:
self._pbar._set_value(self.n)
self._pbar._set_eta(etas)
except AttributeError:
pass
def increment_with_overflow(self):
if self.n == self.total:
self.total = 0
if self._pbar:
self._pbar.setRange(0, 0)
else:
self.update(1)
def set_description(self, desc):
super().set_description(desc, refresh=True)
if self._pbar:
self._pbar._set_description(self.desc)
def close(self):
if self.disable:
return
if self._pbar:
self.close_pbar()
super().close()
def close_pbar(self):
if self.disable or not self._pbar:
return
from napari._qt.widgets.qt_progress_bar import (
ProgressBar,
ProgressBarGroup,
)
parent_widget = self._pbar.parent()
self._pbar.close()
self._pbar.deleteLater()
if isinstance(parent_widget, ProgressBarGroup):
pbar_children = [
child
for child in parent_widget.children()
if isinstance(child, ProgressBar)
]
if not any(child.isVisible() for child in pbar_children):
parent_widget.close()
self._pbar = None
def progrange(*args, **kwargs):
return progress(range(*args), **kwargs)
| true
| true
|
f70a1dbc606d62d87076fc535271675c9725e00f
| 579
|
py
|
Python
|
macronizer_cores/errors/routes.py
|
triethuynh2301/macronizer-project
|
b4cd234de603abc8f588c143ac1fdf56063390c5
|
[
"MIT"
] | null | null | null |
macronizer_cores/errors/routes.py
|
triethuynh2301/macronizer-project
|
b4cd234de603abc8f588c143ac1fdf56063390c5
|
[
"MIT"
] | null | null | null |
macronizer_cores/errors/routes.py
|
triethuynh2301/macronizer-project
|
b4cd234de603abc8f588c143ac1fdf56063390c5
|
[
"MIT"
] | null | null | null |
from flask import Blueprint, render_template
from macronizer_cores import db
# create error blueprint
errors = Blueprint('errors', __name__)
# SECTION - routes
# NOTE - app_errorhandler() is a method inherited from Blueprint that is equivalent to errorhandler() inherited from flask
@errors.app_errorhandler(404)
def page_not_found(e):
'''Handle 404 error'''
return render_template('errors/404.html'), 404
@errors.app_errorhandler(500)
def internal_server_error(e):
'''Handle 500 error'''
db.session.rollback()
return render_template('errors/500.html'), 500
| 25.173913
| 122
| 0.759931
|
from flask import Blueprint, render_template
from macronizer_cores import db
errors = Blueprint('errors', __name__)
@errors.app_errorhandler(404)
def page_not_found(e):
return render_template('errors/404.html'), 404
@errors.app_errorhandler(500)
def internal_server_error(e):
db.session.rollback()
return render_template('errors/500.html'), 500
| true
| true
|
f70a1df778a417b37e29bcfcd5700440004d378c
| 3,448
|
py
|
Python
|
src/api/bkuser_core/categories/migrations/0010_auto_20210803_1026.py
|
trueware/bk-user
|
8c633e0a3821beb839ed120c4514c5733e675862
|
[
"MIT"
] | null | null | null |
src/api/bkuser_core/categories/migrations/0010_auto_20210803_1026.py
|
trueware/bk-user
|
8c633e0a3821beb839ed120c4514c5733e675862
|
[
"MIT"
] | null | null | null |
src/api/bkuser_core/categories/migrations/0010_auto_20210803_1026.py
|
trueware/bk-user
|
8c633e0a3821beb839ed120c4514c5733e675862
|
[
"MIT"
] | 1
|
2021-12-31T06:48:41.000Z
|
2021-12-31T06:48:41.000Z
|
# -*- coding: utf-8 -*-
"""
TencentBlueKing is pleased to support the open source community by making 蓝鲸智云-用户管理(Bk-User) available.
Copyright (C) 2017-2021 THL A29 Limited, a Tencent company. All rights reserved.
Licensed under the MIT License (the "License"); you may not use this file except in compliance with the License.
You may obtain a copy of the License at http://opensource.org/licenses/MIT
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.
"""
# Generated by Django 3.2.5 on 2021-08-03 02:26
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('categories', '0009_auto_20210413_1702'),
]
operations = [
migrations.CreateModel(
name='SyncProgress',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(auto_now_add=True)),
('update_time', models.DateTimeField(auto_now=True)),
('task_id', models.UUIDField(db_index=True, verbose_name='任务id')),
('step', models.CharField(choices=[('users', '用户数据更新'), ('departments', '组织数据更新'), ('users_relationship', '用户间关系数据更新'), ('dept_user_relationship', '用户和组织关系数据更新')], max_length=32, verbose_name='同步步骤')),
('status', models.CharField(choices=[('successful', '成功'), ('failed', '失败'), ('running', '同步中')], default='running', max_length=16, verbose_name='状态')),
('successful_count', models.IntegerField(verbose_name='同步成功数量', default=0)),
('failed_count', models.IntegerField(verbose_name='同步失败数量', default=0)),
],
),
migrations.AlterField(
model_name='profilecategory',
name='type',
field=models.CharField(choices=[('local', '本地目录'), ('mad', 'Microsoft Active Directory'), ('ldap', 'OpenLDAP'), ('tof', 'TOF'), ('custom', '自定义目录'), ('pluggable', '可插拔目录')], max_length=32, verbose_name='类型'),
),
migrations.CreateModel(
name='SyncProgressLog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(auto_now_add=True)),
('update_time', models.DateTimeField(auto_now=True)),
('logs', models.TextField(verbose_name='日志')),
('failed_records', models.JSONField(default=list)),
('progress', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='log', to='categories.syncprogress')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='syncprogress',
name='category',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='categories.profilecategory', verbose_name='用户目录'),
),
migrations.AlterUniqueTogether(
name='syncprogress',
unique_together={('category', 'step', 'task_id')},
),
]
| 52.242424
| 220
| 0.632251
|
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('categories', '0009_auto_20210413_1702'),
]
operations = [
migrations.CreateModel(
name='SyncProgress',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(auto_now_add=True)),
('update_time', models.DateTimeField(auto_now=True)),
('task_id', models.UUIDField(db_index=True, verbose_name='任务id')),
('step', models.CharField(choices=[('users', '用户数据更新'), ('departments', '组织数据更新'), ('users_relationship', '用户间关系数据更新'), ('dept_user_relationship', '用户和组织关系数据更新')], max_length=32, verbose_name='同步步骤')),
('status', models.CharField(choices=[('successful', '成功'), ('failed', '失败'), ('running', '同步中')], default='running', max_length=16, verbose_name='状态')),
('successful_count', models.IntegerField(verbose_name='同步成功数量', default=0)),
('failed_count', models.IntegerField(verbose_name='同步失败数量', default=0)),
],
),
migrations.AlterField(
model_name='profilecategory',
name='type',
field=models.CharField(choices=[('local', '本地目录'), ('mad', 'Microsoft Active Directory'), ('ldap', 'OpenLDAP'), ('tof', 'TOF'), ('custom', '自定义目录'), ('pluggable', '可插拔目录')], max_length=32, verbose_name='类型'),
),
migrations.CreateModel(
name='SyncProgressLog',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('create_time', models.DateTimeField(auto_now_add=True)),
('update_time', models.DateTimeField(auto_now=True)),
('logs', models.TextField(verbose_name='日志')),
('failed_records', models.JSONField(default=list)),
('progress', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, related_name='log', to='categories.syncprogress')),
],
options={
'abstract': False,
},
),
migrations.AddField(
model_name='syncprogress',
name='category',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='categories.profilecategory', verbose_name='用户目录'),
),
migrations.AlterUniqueTogether(
name='syncprogress',
unique_together={('category', 'step', 'task_id')},
),
]
| true
| true
|
f70a1e8de15b92057b4e7a95a2e6ed9b32905846
| 38,568
|
py
|
Python
|
dev/Tools/build/waf-1.7.13/waflib/Task.py
|
raghnarx/lumberyard
|
1c52b941dcb7d94341fcf21275fe71ff67173ada
|
[
"AML"
] | 8
|
2019-10-07T16:33:47.000Z
|
2020-12-07T03:59:58.000Z
|
dev/Tools/build/waf-1.7.13/waflib/Task.py
|
29e7e280-0d1c-4bba-98fe-f7cd3ca7500a/lumberyard
|
1c52b941dcb7d94341fcf21275fe71ff67173ada
|
[
"AML"
] | null | null | null |
dev/Tools/build/waf-1.7.13/waflib/Task.py
|
29e7e280-0d1c-4bba-98fe-f7cd3ca7500a/lumberyard
|
1c52b941dcb7d94341fcf21275fe71ff67173ada
|
[
"AML"
] | 4
|
2019-08-05T07:25:46.000Z
|
2020-12-07T05:12:55.000Z
|
#!/usr/bin/env python
# encoding: utf-8
# Thomas Nagy, 2005-2010 (ita)
"""
Tasks represent atomic operations such as processes.
"""
import os, shutil, re, tempfile, time, pprint
from waflib import Context, Utils, Logs, Errors
from binascii import hexlify
# task states
NOT_RUN = 0
"""The task was not executed yet"""
MISSING = 1
"""The task has been executed but the files have not been created"""
CRASHED = 2
"""The task execution returned a non-zero exit status"""
EXCEPTION = 3
"""An exception occured in the task execution"""
SKIPPED = 8
"""The task did not have to be executed"""
SUCCESS = 9
"""The task was successfully executed"""
ASK_LATER = -1
"""The task is not ready to be executed"""
SKIP_ME = -2
"""The task does not need to be executed"""
RUN_ME = -3
"""The task must be executed"""
COMPILE_TEMPLATE_SHELL = '''
def f(tsk):
env = tsk.env
gen = tsk.generator
bld = gen.bld
wd = getattr(tsk, 'cwd', None)
p = env.get_flat
tsk.last_cmd = cmd = \'\'\' %s \'\'\' % s
return tsk.exec_command(cmd, cwd=wd, env=env.env or None)
'''
COMPILE_TEMPLATE_NOSHELL = '''
def f(tsk):
env = tsk.env
gen = tsk.generator
bld = gen.bld
wd = getattr(tsk, 'cwd', None)
def to_list(xx):
if isinstance(xx, str): return [xx]
return xx
tsk.last_cmd = lst = []
%s
lst = [x for x in lst if x]
return tsk.exec_command(lst, cwd=wd, env=env.env or None)
'''
def cache_outputs(cls):
"""
Task class decorator applied to all task classes by default unless they define the attribute 'nocache'::
from waflib import Task
class foo(Task.Task):
nocache = True
If bld.cache_global is defined and if the task instances produces output nodes,
the files will be copied into a folder in the cache directory
The files may also be retrieved from that folder, if it exists
"""
m1 = cls.run
def run(self):
bld = self.generator.bld
if bld.cache_global and not bld.nocache:
if self.can_retrieve_cache():
return 0
return m1(self)
cls.run = run
m2 = cls.post_run
def post_run(self):
bld = self.generator.bld
ret = m2(self)
if bld.cache_global and not bld.nocache:
self.put_files_cache()
return ret
cls.post_run = post_run
return cls
classes = {}
"class tasks created by user scripts or Waf tools are kept in this dict name -> class object"
class store_task_type(type):
"""
Metaclass: store the task classes into :py:const:`waflib.Task.classes`, or to the dict pointed
by the class attribute 'register'.
The attribute 'run_str' will be processed to compute a method 'run' on the task class
The decorator :py:func:`waflib.Task.cache_outputs` is also applied to the class
"""
def __init__(cls, name, bases, dict):
super(store_task_type, cls).__init__(name, bases, dict)
name = cls.__name__
if name.endswith('_task'):
name = name.replace('_task', '')
if name != 'evil' and name != 'TaskBase':
global classes
if getattr(cls, 'run_str', None):
# if a string is provided, convert it to a method
(f, dvars) = compile_fun(cls.run_str, cls.shell)
cls.hcode = cls.run_str
cls.run_str = None
cls.run = f
cls.vars = list(set(cls.vars + dvars))
cls.vars.sort()
elif getattr(cls, 'run', None) and not 'hcode' in cls.__dict__:
# getattr(cls, 'hcode') would look in the upper classes
cls.hcode = Utils.h_fun(cls.run)
if not getattr(cls, 'nocache', None):
cls = cache_outputs(cls)
# be creative
getattr(cls, 'register', classes)[name] = cls
evil = store_task_type('evil', (object,), {})
"Base class provided to avoid writing a metaclass, so the code can run in python 2.6 and 3.x unmodified"
class TaskBase(evil):
"""
Base class for all Waf tasks, which should be seen as an interface.
For illustration purposes, instances of this class will execute the attribute
'fun' in :py:meth:`waflib.Task.TaskBase.run`. When in doubt, create
subclasses of :py:class:`waflib.Task.Task` instead.
Subclasses should override these methods:
#. __str__: string to display to the user
#. runnable_status: ask the task if it should be run, skipped, or if we have to ask later
#. run: let threads execute the task
#. post_run: let threads update the data regarding the task (cache)
"""
color = 'GREEN'
"""Color for the console display, see :py:const:`waflib.Logs.colors_lst`"""
ext_in = []
"""File extensions that objects of this task class might use"""
ext_out = []
"""File extensions that objects of this task class might create"""
before = []
"""List of task class names to execute before instances of this class"""
after = []
"""List of task class names to execute after instances of this class"""
hcode = ''
"""String representing an additional hash for the class representation"""
def __init__(self, *k, **kw):
"""
The base task class requires a task generator, which will be itself if missing
"""
self.hasrun = NOT_RUN
try:
self.generator = kw['generator']
except KeyError:
self.generator = self
def __repr__(self):
"for debugging purposes"
return '\n\t{task %r: %s %s}' % (self.__class__.__name__, id(self), str(getattr(self, 'fun', '')))
def __str__(self):
"string to display to the user"
if hasattr(self, 'fun'):
return 'executing: %s\n' % self.fun.__name__
return self.__class__.__name__ + '\n'
def __hash__(self):
"Very fast hashing scheme but not persistent (replace/implement in subclasses and see :py:meth:`waflib.Task.Task.uid`)"
return id(self)
def exec_command(self, cmd, **kw):
"""
Wrapper for :py:meth:`waflib.Context.Context.exec_command` which sets a current working directory to ``build.variant_dir``
:return: the return code
:rtype: int
"""
bld = self.generator.bld
try:
if not kw.get('cwd', None):
kw['cwd'] = bld.cwd
except AttributeError:
bld.cwd = kw['cwd'] = bld.variant_dir
return bld.exec_command(cmd, **kw)
def runnable_status(self):
"""
State of the task
:return: a task state in :py:const:`waflib.Task.RUN_ME`, :py:const:`waflib.Task.SKIP_ME` or :py:const:`waflib.Task.ASK_LATER`.
:rtype: int
"""
return RUN_ME
def process(self):
"""
Assume that the task has had a new attribute ``master`` which is an instance of :py:class:`waflib.Runner.Parallel`.
Execute the task and then put it back in the queue :py:attr:`waflib.Runner.Parallel.out` (may be replaced by subclassing).
"""
m = self.master
if m.stop:
m.out.put(self)
return
# remove the task signature immediately before it is executed
# in case of failure the task will be executed again
try:
del self.generator.bld.task_sigs[self.uid()]
except KeyError:
pass
try:
self.generator.bld.returned_tasks.append(self)
self.log_display(self.generator.bld)
ret = self.run()
except Exception:
self.err_msg = Utils.ex_stack()
self.hasrun = EXCEPTION
# TODO cleanup
m.error_handler(self)
m.out.put(self)
return
if ret:
self.err_code = ret
self.hasrun = CRASHED
else:
try:
self.post_run()
except Errors.WafError:
pass
except Exception:
self.err_msg = Utils.ex_stack()
self.hasrun = EXCEPTION
else:
self.hasrun = SUCCESS
if self.hasrun != SUCCESS:
m.error_handler(self)
m.out.put(self)
def run(self):
"""
Called by threads to execute the tasks. The default is empty and meant to be overridden in subclasses.
It is a bad idea to create nodes in this method (so, no node.ant_glob)
:rtype: int
"""
if hasattr(self, 'fun'):
return self.fun(self)
return 0
def post_run(self):
"Update the cache files (executed by threads). Override in subclasses."
pass
def log_display(self, bld):
"Write the execution status on the context logger"
bld.to_log(self.display())
def display(self):
"""
Return an execution status for the console, the progress bar, or the IDE output.
:rtype: string
"""
col1 = Logs.colors(self.color)
col2 = Logs.colors.NORMAL
master = self.master
def cur():
# the current task position, computed as late as possible
tmp = -1
if hasattr(master, 'ready'):
tmp -= master.ready.qsize()
return master.processed + tmp
if self.generator.bld.progress_bar == 1:
return self.generator.bld.progress_line(cur(), master.total, col1, col2)
if self.generator.bld.progress_bar == 2:
ela = str(self.generator.bld.timer)
try:
ins = ','.join([n.name for n in self.inputs])
except AttributeError:
ins = ''
try:
outs = ','.join([n.name for n in self.outputs])
except AttributeError:
outs = ''
return '|Total %s|Current %s|Inputs %s|Outputs %s|Time %s|\n' % (master.total, cur(), ins, outs, ela)
s = str(self)
if not s:
return None
total = master.total
n = len(str(total))
fs = '[%%%dd/%%%dd] %%s%%s%%s' % (n, n)
return fs % (cur(), total, col1, s, col2)
def attr(self, att, default=None):
"""
Retrieve an attribute from the instance or from the class.
:param att: variable name
:type att: string
:param default: default value
"""
ret = getattr(self, att, self)
if ret is self: return getattr(self.__class__, att, default)
return ret
def hash_constraints(self):
"""
Identify a task type for all the constraints relevant for the scheduler: precedence, file production
:return: a hash value
:rtype: string
"""
cls = self.__class__
tup = (str(cls.before), str(cls.after), str(cls.ext_in), str(cls.ext_out), cls.__name__, cls.hcode)
h = hash(tup)
return h
def format_error(self):
"""
Error message to display to the user when a build fails
:rtype: string
"""
msg = getattr(self, 'last_cmd', '')
# Format msg to be better read-able
output = ''
for i in msg:
if not isinstance(i, str):
output += str(i) + ' '
else:
output += i + ' '
msg = output[:len(output)-1]
name = self.__class__.__name__.replace('_task', '') + ' (' + self.env['PLATFORM'] + '|' + self.env['CONFIGURATION'] + ')'
if getattr(self, "err_msg", None):
return self.err_msg
elif not self.hasrun:
return 'task in %r was not executed for some reason: %r' % (name, self)
elif self.hasrun == CRASHED:
try:
return ' -> task in %r failed (exit status %r): %r\n%r' % (name, self.err_code, self, msg)
except AttributeError:
return ' -> task in %r failed: %r\n%r' % (name, self, msg)
elif self.hasrun == MISSING:
return ' -> missing files in %r: %r\n%r' % (name, self, msg)
else:
return 'invalid status for task in %r: %r' % (name, self.hasrun)
def colon(self, var1, var2):
"""
private function for the moment
used for scriptlet expressions such as ${FOO_ST:FOO}, for example, if
env.FOO_ST = ['-a', '-b']
env.FOO = ['1', '2']
then the result will be ['-a', '-b', '1', '-a', '-b', '2']
"""
tmp = self.env[var1]
if isinstance(var2, str):
it = self.env[var2]
else:
it = var2
if isinstance(tmp, str):
return [tmp % x for x in it]
else:
if Logs.verbose and not tmp and it:
Logs.warn('Missing env variable %r for task %r (generator %r)' % (var1, self, self.generator))
lst = []
for y in it:
lst.extend(tmp)
lst.append(y)
return lst
class Task(TaskBase):
"""
This class deals with the filesystem (:py:class:`waflib.Node.Node`). The method :py:class:`waflib.Task.Task.runnable_status`
uses a hash value (from :py:class:`waflib.Task.Task.signature`) which is persistent from build to build. When the value changes,
the task has to be executed. The method :py:class:`waflib.Task.Task.post_run` will assign the task signature to the output
nodes (if present).
"""
vars = []
"""Variables to depend on (class attribute used for :py:meth:`waflib.Task.Task.sig_vars`)"""
shell = False
"""Execute the command with the shell (class attribute)"""
def __init__(self, *k, **kw):
TaskBase.__init__(self, *k, **kw)
self.env = kw['env']
"""ConfigSet object (make sure to provide one)"""
self.inputs = []
"""List of input nodes, which represent the files used by the task instance"""
self.outputs = []
"""List of output nodes, which represent the files created by the task instance"""
self.dep_nodes = []
"""List of additional nodes to depend on"""
self.run_after = set([])
"""Set of tasks that must be executed before this one"""
self.sig_debug_output = ''
"""String output detailing a signature mismatch"""
self.sig_implicit_debug_log = ''
"""String output to aggregate implicit deps for logging purposes"""
# Additionally, you may define the following
#self.dep_vars = 'PREFIX DATADIR'
def __str__(self):
"string to display to the user"
env = self.env
src_str = ' '.join([a.nice_path() for a in self.inputs])
tgt_str = ' '.join([a.nice_path() for a in self.outputs])
if self.outputs and self.inputs: sep = ' -> '
else: sep = ''
name = self.__class__.__name__.replace('_task', '') + ' (' + env['PLATFORM'] + '|' + env['CONFIGURATION'] + ')'
return '%s: %s%s%s\n' % (name, src_str, sep, tgt_str)
def __repr__(self):
"for debugging purposes"
try:
ins = ",".join([x.name for x in self.inputs])
outs = ",".join([x.name for x in self.outputs])
except AttributeError:
ins = ",".join([str(x) for x in self.inputs])
outs = ",".join([str(x) for x in self.outputs])
return "".join(['\n\t{task %r: ' % id(self), self.__class__.__name__, " ", ins, " -> ", outs, '}'])
def uid(self):
"""
Return an identifier used to determine if tasks are up-to-date. Since the
identifier will be stored between executions, it must be:
- unique: no two tasks return the same value (for a given build context)
- the same for a given task instance
By default, the node paths, the class name, and the function are used
as inputs to compute a hash.
The pointer to the object (python built-in 'id') will change between build executions,
and must be avoided in such hashes.
:return: hash value
:rtype: string
"""
try:
return self.uid_
except AttributeError:
# this is not a real hot zone, but we want to avoid surprises here
m = Utils.md5()
up = m.update
up(self.__class__.__name__.encode())
deplist = [k.abspath().encode() for k in self.inputs + self.outputs]
dep_bld_sigs_str = "".join(deplist)
up(dep_bld_sigs_str)
self.uid_ = m.digest()
return self.uid_
def set_inputs(self, inp):
"""
Append the nodes to the *inputs*
:param inp: input nodes
:type inp: node or list of nodes
"""
if isinstance(inp, list): self.inputs += inp
else: self.inputs.append(inp)
def set_outputs(self, out):
"""
Append the nodes to the *outputs*
:param out: output nodes
:type out: node or list of nodes
"""
if isinstance(out, list): self.outputs += out
else: self.outputs.append(out)
def set_run_after(self, task):
"""
Run this task only after *task*. Affect :py:meth:`waflib.Task.runnable_status`
You probably want to use tsk.run_after.add(task) directly
:param task: task
:type task: :py:class:`waflib.Task.Task`
"""
assert isinstance(task, TaskBase)
self.run_after.add(task)
def signature(self):
"""
Task signatures are stored between build executions, they are use to track the changes
made to the input nodes (not to the outputs!). The signature hashes data from various sources:
* explicit dependencies: files listed in the inputs (list of node objects) :py:meth:`waflib.Task.Task.sig_explicit_deps`
* implicit dependencies: list of nodes returned by scanner methods (when present) :py:meth:`waflib.Task.Task.sig_implicit_deps`
* hashed data: variables/values read from task.__class__.vars/task.env :py:meth:`waflib.Task.Task.sig_vars`
If the signature is expected to give a different result, clear the cache kept in ``self.cache_sig``::
from waflib import Task
class cls(Task.Task):
def signature(self):
sig = super(Task.Task, self).signature()
delattr(self, 'cache_sig')
return super(Task.Task, self).signature()
"""
try: return self.cache_sig
except AttributeError: pass
self.m = Utils.md5()
self.m.update(self.hcode.encode())
# explicit deps
exp_deps = self.sig_explicit_deps()
self.m.update(exp_deps)
# env vars
self.sig_vars()
# implicit deps / scanner results
if self.scan:
imp_deps = self.sig_implicit_deps()
self.m.update(imp_deps)
ret = self.cache_sig = self.m.digest()
return ret
def runnable_status(self):
"""
Override :py:meth:`waflib.Task.TaskBase.runnable_status` to determine if the task is ready
to be run (:py:attr:`waflib.Task.Task.run_after`)
"""
for t in self.run_after:
if not t.hasrun:
return ASK_LATER
bld = self.generator.bld
self.sig_debug_output = ""
# first compute the signature
try:
new_sig = self.signature()
except Errors.TaskNotReady:
return ASK_LATER
# compare the signature to a signature computed previously
key = self.uid()
try:
prev_sig = bld.task_sigs[key]
except KeyError:
Logs.debug("task: task %r must run as it was never run before or the task code changed" % self)
return RUN_ME
if new_sig != prev_sig:
if Logs.sig_delta:
sig_debug_path = os.path.join('TaskSigDeltaOutput','{}_{}_{}.log'.format(self.__class__.__name__, self.inputs[0].name.replace(".", ""), time.time()))
sig_debug_node = self.generator.bld.bldnode.find_or_declare(sig_debug_path)
sig_debug_node.write(self.sig_debug_output)
return RUN_ME
# compare the signatures of the outputs
for node in self.outputs:
try:
if node.sig != new_sig:
return RUN_ME
except AttributeError:
Logs.debug("task: task %r must run as the output nodes do not exist" % self)
return RUN_ME
return SKIP_ME
def post_run(self):
"""
Called after successful execution to update the cache data :py:class:`waflib.Node.Node` sigs
and :py:attr:`waflib.Build.BuildContext.task_sigs`.
The node signature is obtained from the task signature, but the output nodes may also get the signature
of their contents. See the class decorator :py:func:`waflib.Task.update_outputs` if you need this behaviour.
"""
bld = self.generator.bld
sig = self.signature()
for node in self.outputs:
# check if the node exists ..
try:
os.stat(node.abspath())
except OSError:
self.hasrun = MISSING
self.err_msg = '-> missing file: %r' % node.abspath()
raise Errors.WafError(self.err_msg)
# important, store the signature for the next run
node.sig = node.cache_sig = sig
bld.task_sigs[self.uid()] = self.cache_sig
def sig_explicit_deps(self):
"""
Used by :py:meth:`waflib.Task.Task.signature`, hash :py:attr:`waflib.Task.Task.inputs`
and :py:attr:`waflib.Task.Task.dep_nodes` signatures.
:rtype: hash value
"""
bld = self.generator.bld
bld_sigs = []
exp_output = ''
# the inputs
for x in self.inputs + self.dep_nodes:
try:
bld_sig = x.get_bld_sig()
if Logs.sig_delta:
exp_output += '{} {} {}\n'.format(x.name, x.abspath(), hexlify(bld_sig))
bld_sigs.append(bld_sig)
except (AttributeError, TypeError, IOError):
Logs.warn('Missing signature for node %r (required by %r)' % (x, self))
continue # skip adding the signature to the calculation, but continue adding other dependencies
# manual dependencies, they can slow down the builds
if bld.deps_man:
additional_deps = bld.deps_man
for x in self.inputs + self.outputs:
try:
d = additional_deps[id(x)]
except KeyError:
continue
for v in d:
v_name = v.name
if isinstance(v, bld.root.__class__):
try:
v = v.get_bld_sig()
except AttributeError:
raise Errors.WafError('Missing node signature for %r (required by %r)' % (v, self))
elif hasattr(v, '__call__'):
v = v() # dependency is a function, call it
if Logs.sig_delta:
exp_output += '{} {}\n'.format(v_name, hexlify(v))
bld_sigs.append(v)
dep_bld_sigs_str = "".join(bld_sigs)
m = Utils.md5()
m.update(dep_bld_sigs_str)
explicit_sig = m.digest()
if Logs.sig_delta:
key = self.uid()
prev_sig = bld.task_sigs.get((key, 'exp'), [])
if prev_sig and prev_sig != explicit_sig:
self.capture_signature_log('\nExplicit(Old):\n')
self.capture_signature_log(bld.last_build['exp_deps'].get(key,''))
self.capture_signature_log('\nExplicit(New):\n')
self.capture_signature_log(exp_output)
bld.last_build['exp_deps'][key] = exp_output
bld.task_sigs[(key, 'exp')] = explicit_sig
return explicit_sig
def sig_vars(self):
"""
Used by :py:meth:`waflib.Task.Task.signature`, hash :py:attr:`waflib.Task.Task.env` variables/values
:rtype: hash value
"""
bld = self.generator.bld
env = self.env
upd = self.m.update
key = self.uid()
# dependencies on the environment vars
act_sig = bld.hash_env_vars(env, self.__class__.vars)
upd(act_sig)
if Logs.sig_delta:
prev_act_sig = bld.task_sigs.get((key, 'env'), [])
prev_dep_sig = bld.task_sigs.get((key, 'dep_vars'), [])
bld.task_sigs[(key, 'env')] = act_sig
# additional variable dependencies, if provided
dep_vars = getattr(self, 'dep_vars', None)
dep_sig = ''
if dep_vars:
dep_sig = bld.hash_env_vars(env, dep_vars)
upd(dep_sig)
if Logs.sig_delta:
bld.task_sigs[(key, 'dep_vars')] = dep_sig
if prev_dep_sig and prev_dep_sig != dep_sig:
self.capture_signature_log('\nDep Vars:\n'+pprint.pformat(dep_vars))
if Logs.sig_delta:
if (prev_act_sig and prev_act_sig != act_sig) or (prev_dep_sig and prev_dep_sig != dep_sig):
self.capture_signature_log('\nEnv(Current):\n'+pprint.pformat(bld.debug_get_env_vars(env, self.__class__.vars)))
prev_env = bld.last_build['env'].get(key, {})
self.capture_signature_log('\nEnv(Last):\n'+pprint.pformat(prev_env))
bld.last_build['env'][key] = bld.debug_get_env_vars(env, self.__class__.vars)
return self.m.digest()
scan = None
"""
This method, when provided, returns a tuple containing:
* a list of nodes corresponding to real files
* a list of names for files not found in path_lst
For example::
from waflib.Task import Task
class mytask(Task):
def scan(self, node):
return ((), ())
The first and second lists are stored in :py:attr:`waflib.Build.BuildContext.node_deps` and
:py:attr:`waflib.Build.BuildContext.raw_deps` respectively.
"""
def sig_implicit_deps(self):
"""
Used by :py:meth:`waflib.Task.Task.signature` hashes node signatures obtained by scanning for dependencies (:py:meth:`waflib.Task.Task.scan`).
:rtype: hash value
"""
bld = self.generator.bld
# get the task signatures from previous runs
key = self.uid()
prev = bld.task_sigs.get((key, 'imp'), [])
# for issue #379
if prev:
try:
# if a dep is deleted, it will be missing. Don't warn, the signature will be different
sid = self.compute_sig_implicit_deps(False)
if prev == sid:
return prev
except Exception:
# when a file was renamed (IOError usually), remove the stale nodes (headers in folders without source files)
# this will break the order calculation for headers created during the build in the source directory (should be uncommon)
# the behaviour will differ when top != out
deps = bld.node_deps.get(self.uid(), [])
for x in deps:
if x.is_child_of(bld.srcnode):
try:
os.stat(x.abspath())
except OSError:
try:
del x.parent.children[x.name]
except KeyError:
pass
# the previous signature and the current signature don't match, delete the implicit deps, and cause a rescan below
del bld.task_sigs[(key, 'imp')]
# no previous run or the signature of the dependencies has changed, rescan the dependencies
(nodes, names) = self.scan()
if Logs.verbose:
Logs.debug('deps: scanner for %s returned %s %s' % (str(self), str(nodes), str(names)))
# store the dependencies in the cache
bld.node_deps[key] = nodes
bld.raw_deps[key] = names
# recompute the signature and return it
old_sig_debug_log = self.sig_implicit_debug_log
bld.task_sigs[(key, 'imp')] = sig = self.compute_sig_implicit_deps(False)
# Make the equality check since it's possible we didn't have a prior imp key but had prior nodes
# and said nodes didn't change
if Logs.sig_delta and old_sig_debug_log != self.sig_implicit_debug_log:
self.capture_signature_log('\nImplicit(Old):\n')
self.capture_signature_log(old_sig_debug_log)
self.capture_signature_log('\nImplicit(New):\n')
self.capture_signature_log(self.sig_implicit_debug_log)
return sig
def compute_sig_implicit_deps(self, warn_on_missing=True):
"""
Used by :py:meth:`waflib.Task.Task.sig_implicit_deps` for computing the actual hash of the
:py:class:`waflib.Node.Node` returned by the scanner.
:return: hash value
:rtype: string
"""
bld = self.generator.bld
self.are_implicit_nodes_ready()
self.sig_implicit_debug_log = ''
# scanner returns a node that does not have a signature
# just *ignore* the error and let them figure out from the compiler output
# waf -k behaviour
deps = bld.node_deps.get(self.uid(), [])
bld_sigs = []
for k in deps:
try:
bld_sig = k.get_bld_sig()
if Logs.sig_delta:
self.sig_implicit_debug_log += ('{} {}\n'.format(k.name, hexlify(bld_sig)))
except:
if warn_on_missing:
Logs.warn('Missing signature for node %r (dependency will not be tracked)' % k)
continue # skip adding the signature to the calculation, but continue adding other dependencies
bld_sigs.append(bld_sig)
dep_bld_sigs_str = "".join(bld_sigs)
m = Utils.md5()
m.update(dep_bld_sigs_str)
return m.digest()
def are_implicit_nodes_ready(self):
"""
For each node returned by the scanner, see if there is a task behind it, and force the build order
The performance impact on null builds is nearly invisible (1.66s->1.86s), but this is due to
agressive caching (1.86s->28s)
"""
bld = self.generator.bld
try:
cache = bld.dct_implicit_nodes
except AttributeError:
bld.dct_implicit_nodes = cache = {}
try:
dct = cache[bld.cur]
except KeyError:
dct = cache[bld.cur] = {}
for tsk in bld.cur_tasks:
for x in tsk.outputs:
dct[x] = tsk
# find any dependency that is not part of the run_after set already
deps = bld.node_deps.get(self.uid(), [])
deps_missing_from_runafter = [dct[i] for i in deps if i in dct and dct[i] not in self.run_after]
# verify that all tasks have not already run
for tsk in deps_missing_from_runafter:
if not tsk.hasrun:
#print "task is not ready..."
raise Errors.TaskNotReady('not ready')
# update the run_after tasks
self.run_after.update(deps_missing_from_runafter)
def capture_signature_log(self, output):
"""
Logging function to aggregate info on what caused the task signature to change between runs
"""
if hasattr(self, 'sig_debug_output'):
self.sig_debug_output += output
def can_retrieve_cache(self):
"""
Used by :py:meth:`waflib.Task.cache_outputs`
Retrieve build nodes from the cache
update the file timestamps to help cleaning the least used entries from the cache
additionally, set an attribute 'cached' to avoid re-creating the same cache files
Suppose there are files in `cache/dir1/file1` and `cache/dir2/file2`:
#. read the timestamp of dir1
#. try to copy the files
#. look at the timestamp again, if it has changed, the data may have been corrupt (cache update by another process)
#. should an exception occur, ignore the data
"""
if not getattr(self, 'outputs', None):
return None
sig = self.signature()
ssig = Utils.to_hex(self.uid()) + Utils.to_hex(sig)
# first try to access the cache folder for the task
dname = os.path.join(self.generator.bld.cache_global, ssig)
try:
t1 = os.stat(dname).st_mtime
except OSError:
return None
for node in self.outputs:
orig = os.path.join(dname, node.name)
try:
shutil.copy2(orig, node.abspath())
# mark the cache file as used recently (modified)
os.utime(orig, None)
except (OSError, IOError):
Logs.debug('task: failed retrieving file')
return None
# is it the same folder?
try:
t2 = os.stat(dname).st_mtime
except OSError:
return None
if t1 != t2:
return None
for node in self.outputs:
node.sig = sig
if self.generator.bld.progress_bar < 1:
self.generator.bld.to_log('restoring from cache %r\n' % node.abspath())
self.cached = True
return True
def put_files_cache(self):
"""
Used by :py:func:`waflib.Task.cache_outputs` to store the build files in the cache
"""
# file caching, if possible
# try to avoid data corruption as much as possible
if getattr(self, 'cached', None):
return None
if not getattr(self, 'outputs', None):
return None
sig = self.signature()
ssig = Utils.to_hex(self.uid()) + Utils.to_hex(sig)
dname = os.path.join(self.generator.bld.cache_global, ssig)
tmpdir = tempfile.mkdtemp(prefix=self.generator.bld.cache_global + os.sep + 'waf')
try:
shutil.rmtree(dname)
except Exception:
pass
try:
for node in self.outputs:
dest = os.path.join(tmpdir, node.name)
shutil.copy2(node.abspath(), dest)
except (OSError, IOError):
try:
shutil.rmtree(tmpdir)
except Exception:
pass
else:
try:
os.rename(tmpdir, dname)
except OSError:
try:
shutil.rmtree(tmpdir)
except Exception:
pass
else:
try:
os.chmod(dname, Utils.O755)
except Exception:
pass
def is_before(t1, t2):
"""
Return a non-zero value if task t1 is to be executed before task t2::
t1.ext_out = '.h'
t2.ext_in = '.h'
t2.after = ['t1']
t1.before = ['t2']
waflib.Task.is_before(t1, t2) # True
:param t1: task
:type t1: :py:class:`waflib.Task.TaskBase`
:param t2: task
:type t2: :py:class:`waflib.Task.TaskBase`
"""
to_list = Utils.to_list
for k in to_list(t2.ext_in):
if k in to_list(t1.ext_out):
return 1
if t1.__class__.__name__ in to_list(t2.after):
return 1
if t2.__class__.__name__ in to_list(t1.before):
return 1
return 0
def set_file_constraints(tasks):
"""
Adds tasks to the task 'run_after' attribute based on the task inputs and outputs
:param tasks: tasks
:type tasks: list of :py:class:`waflib.Task.TaskBase`
"""
ins = Utils.defaultdict(set)
outs = Utils.defaultdict(set)
for x in tasks:
for a in getattr(x, 'inputs', []) + getattr(x, 'dep_nodes', []):
ins[id(a)].add(x)
for a in getattr(x, 'outputs', []):
outs[id(a)].add(x)
links = set(ins.keys()).intersection(outs.keys())
for k in links:
for a in ins[k]:
a.run_after.update(outs[k])
def set_precedence_constraints(tasks):
"""
Add tasks to the task 'run_after' attribute based on the after/before/ext_out/ext_in attributes
:param tasks: tasks
:type tasks: list of :py:class:`waflib.Task.TaskBase`
"""
cstr_groups = Utils.defaultdict(list)
for x in tasks:
h = x.hash_constraints()
cstr_groups[h].append(x)
keys = list(cstr_groups.keys())
maxi = len(keys)
# this list should be short
for i in range(maxi):
t1 = cstr_groups[keys[i]][0]
for j in range(i + 1, maxi):
t2 = cstr_groups[keys[j]][0]
# add the constraints based on the comparisons
if is_before(t1, t2):
a = i
b = j
elif is_before(t2, t1):
a = j
b = i
else:
continue
aval = set(cstr_groups[keys[a]])
for x in cstr_groups[keys[b]]:
x.run_after.update(aval)
def funex(c):
"""
Compile a function by 'exec'
:param c: function to compile
:type c: string
:return: the function 'f' declared in the input string
:rtype: function
"""
dc = {}
exec(c, dc)
return dc['f']
reg_act = re.compile(r"(?P<backslash>\\)|(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)
def compile_fun_shell(line):
"""
Create a compiled function to execute a process with the shell
WARNING: this method may disappear anytime, so use compile_fun instead
"""
extr = []
def repl(match):
g = match.group
if g('dollar'): return "$"
elif g('backslash'): return '\\\\'
elif g('subst'): extr.append((g('var'), g('code'))); return "%s"
return None
line = reg_act.sub(repl, line) or line
parm = []
dvars = []
app = parm.append
for (var, meth) in extr:
if var == 'SRC':
if meth: app('tsk.inputs%s' % meth)
else: app('" ".join([a.path_from(bld.bldnode) for a in tsk.inputs])')
elif var == 'ABS_SRC':
if meth: app('tsk.inputs%s' % meth)
else: app('" ".join([\'"{}"\'.format(a.abspath()) for a in tsk.inputs])')
elif var == 'TGT':
if meth: app('tsk.outputs%s' % meth)
else: app('" ".join([a.path_from(bld.bldnode) for a in tsk.outputs])')
elif meth:
if meth.startswith(':'):
m = meth[1:]
if m == 'SRC':
m = '[a.path_from(bld.bldnode) for a in tsk.inputs]'
if m == 'ABS_SRC':
m = '[a.abspath() for a in tsk.inputs]'
elif m == 'TGT':
m = '[a.path_from(bld.bldnode) for a in tsk.outputs]'
elif m[:3] not in ('tsk', 'gen', 'bld'):
dvars.extend([var, meth[1:]])
m = '%r' % m
app('" ".join(tsk.colon(%r, %s))' % (var, m))
else:
app('%s%s' % (var, meth))
else:
if not var in dvars: dvars.append(var)
app("p('%s')" % var)
if parm: parm = "%% (%s) " % (',\n\t\t'.join(parm))
else: parm = ''
c = COMPILE_TEMPLATE_SHELL % (line, parm)
Logs.debug('action: %s' % c.strip().splitlines())
return (funex(c), dvars)
def compile_fun_noshell(line):
"""
Create a compiled function to execute a process without the shell
WARNING: this method may disappear anytime, so use compile_fun instead
"""
extr = []
def repl(match):
g = match.group
if g('dollar'): return "$"
elif g('subst'): extr.append((g('var'), g('code'))); return "<<|@|>>"
return None
line2 = reg_act.sub(repl, line)
params = line2.split('<<|@|>>')
assert(extr)
buf = []
dvars = []
app = buf.append
for x in range(len(extr)):
params[x] = params[x].strip()
if params[x]:
app("lst.extend(%r)" % params[x].split())
(var, meth) = extr[x]
if var == 'SRC':
if meth: app('lst.append(tsk.inputs%s)' % meth)
else: app("lst.extend([a.abspath() for a in tsk.inputs])")
elif var == 'TGT':
if meth: app('lst.append(tsk.outputs%s)' % meth)
else: app("lst.extend([a.abspath() for a in tsk.outputs])")
elif meth:
if meth.startswith(':'):
m = meth[1:]
if m == 'SRC':
m = '[a.abspath() for a in tsk.inputs]'
elif m == 'TGT':
m = '[a.abspath() for a in tsk.outputs]'
elif m[:3] not in ('tsk', 'gen', 'bld'):
dvars.extend([var, m])
m = '%r' % m
app('lst.extend(tsk.colon(%r, %s))' % (var, m))
else:
app('lst.extend(gen.to_list(%s%s))' % (var, meth))
else:
app('lst.extend(to_list(env[%r]))' % var)
if not var in dvars: dvars.append(var)
if extr:
if params[-1]:
app("lst.extend(%r)" % params[-1].split())
fun = COMPILE_TEMPLATE_NOSHELL % "\n\t".join(buf)
Logs.debug('action: %s' % fun.strip().splitlines())
return (funex(fun), dvars)
def compile_fun(line, shell=False):
"""
Parse a string expression such as "${CC} ${SRC} -o ${TGT}" and return a pair containing:
* the function created (compiled) for use as :py:meth:`waflib.Task.TaskBase.run`
* the list of variables that imply a dependency from self.env
for example::
from waflib.Task import compile_fun
compile_fun('cxx', '${CXX} -o ${TGT[0]} ${SRC} -I ${SRC[0].parent.bldpath()}')
def build(bld):
bld(source='wscript', rule='echo "foo\\${SRC[0].name}\\bar"')
The env variables (CXX, ..) on the task must not hold dicts (order)
The reserved keywords *TGT* and *SRC* represent the task input and output nodes
"""
if line.find('<') > 0 or line.find('>') > 0 or line.find('&&') > 0:
shell = True
if shell:
return compile_fun_shell(line)
else:
return compile_fun_noshell(line)
def task_factory(name, func=None, vars=None, color='GREEN', ext_in=[], ext_out=[], before=[], after=[], shell=False, scan=None):
"""
Deprecated. Return a new task subclass with the function ``run`` compiled from the line given.
Provided for compatibility with waf 1.4-1.5, when we did not have the metaclass to register new classes (will be removed in Waf 1.8)
:param func: method run
:type func: string or function
:param vars: list of variables to hash
:type vars: list of string
:param color: color to use
:type color: string
:param shell: when *func* is a string, enable/disable the use of the shell
:type shell: bool
:param scan: method scan
:type scan: function
:rtype: :py:class:`waflib.Task.Task`
"""
params = {
'vars': vars or [], # function arguments are static, and this one may be modified by the class
'color': color,
'name': name,
'ext_in': Utils.to_list(ext_in),
'ext_out': Utils.to_list(ext_out),
'before': Utils.to_list(before),
'after': Utils.to_list(after),
'shell': shell,
'scan': scan,
}
if isinstance(func, str):
params['run_str'] = func
else:
params['run'] = func
cls = type(Task)(name, (Task,), params)
global classes
classes[name] = cls
return cls
def always_run(cls):
"""
Task class decorator
Set all task instances of this class to be executed whenever a build is started
The task signature is calculated, but the result of the comparation between
task signatures is bypassed
"""
old = cls.runnable_status
def always(self):
ret = old(self)
if ret == SKIP_ME:
ret = RUN_ME
return ret
cls.runnable_status = always
return cls
def update_outputs(cls):
"""
Task class decorator
If you want to create files in the source directory. For example, to keep *foo.txt* in the source
directory, create it first and declare::
def build(bld):
bld(rule='cp ${SRC} ${TGT}', source='wscript', target='foo.txt', update_outputs=True)
"""
old_post_run = cls.post_run
def post_run(self):
old_post_run(self)
for node in self.outputs:
node.sig = node.cache_sig = Utils.h_file(node.abspath())
self.generator.bld.task_sigs[node.abspath()] = self.uid() # issue #1017
cls.post_run = post_run
old_runnable_status = cls.runnable_status
def runnable_status(self):
status = old_runnable_status(self)
if status != RUN_ME:
return status
try:
# by default, we check that the output nodes have the signature of the task
# perform a second check, returning 'SKIP_ME' as we are expecting that
# the signatures do not match
bld = self.generator.bld
prev_sig = bld.task_sigs[self.uid()]
if prev_sig == self.signature():
for x in self.outputs:
if not x.sig or bld.task_sigs[x.abspath()] != self.uid():
return RUN_ME
return SKIP_ME
except KeyError:
pass
except IndexError:
pass
except AttributeError:
pass
return RUN_ME
cls.runnable_status = runnable_status
return cls
| 28.675093
| 153
| 0.673538
|
import os, shutil, re, tempfile, time, pprint
from waflib import Context, Utils, Logs, Errors
from binascii import hexlify
NOT_RUN = 0
MISSING = 1
CRASHED = 2
EXCEPTION = 3
SKIPPED = 8
SUCCESS = 9
ASK_LATER = -1
SKIP_ME = -2
RUN_ME = -3
COMPILE_TEMPLATE_SHELL = '''
def f(tsk):
env = tsk.env
gen = tsk.generator
bld = gen.bld
wd = getattr(tsk, 'cwd', None)
p = env.get_flat
tsk.last_cmd = cmd = \'\'\' %s \'\'\' % s
return tsk.exec_command(cmd, cwd=wd, env=env.env or None)
'''
COMPILE_TEMPLATE_NOSHELL = '''
def f(tsk):
env = tsk.env
gen = tsk.generator
bld = gen.bld
wd = getattr(tsk, 'cwd', None)
def to_list(xx):
if isinstance(xx, str): return [xx]
return xx
tsk.last_cmd = lst = []
%s
lst = [x for x in lst if x]
return tsk.exec_command(lst, cwd=wd, env=env.env or None)
'''
def cache_outputs(cls):
m1 = cls.run
def run(self):
bld = self.generator.bld
if bld.cache_global and not bld.nocache:
if self.can_retrieve_cache():
return 0
return m1(self)
cls.run = run
m2 = cls.post_run
def post_run(self):
bld = self.generator.bld
ret = m2(self)
if bld.cache_global and not bld.nocache:
self.put_files_cache()
return ret
cls.post_run = post_run
return cls
classes = {}
class store_task_type(type):
def __init__(cls, name, bases, dict):
super(store_task_type, cls).__init__(name, bases, dict)
name = cls.__name__
if name.endswith('_task'):
name = name.replace('_task', '')
if name != 'evil' and name != 'TaskBase':
global classes
if getattr(cls, 'run_str', None):
(f, dvars) = compile_fun(cls.run_str, cls.shell)
cls.hcode = cls.run_str
cls.run_str = None
cls.run = f
cls.vars = list(set(cls.vars + dvars))
cls.vars.sort()
elif getattr(cls, 'run', None) and not 'hcode' in cls.__dict__:
cls.hcode = Utils.h_fun(cls.run)
if not getattr(cls, 'nocache', None):
cls = cache_outputs(cls)
getattr(cls, 'register', classes)[name] = cls
evil = store_task_type('evil', (object,), {})
class TaskBase(evil):
color = 'GREEN'
ext_in = []
ext_out = []
before = []
after = []
hcode = ''
def __init__(self, *k, **kw):
self.hasrun = NOT_RUN
try:
self.generator = kw['generator']
except KeyError:
self.generator = self
def __repr__(self):
return '\n\t{task %r: %s %s}' % (self.__class__.__name__, id(self), str(getattr(self, 'fun', '')))
def __str__(self):
if hasattr(self, 'fun'):
return 'executing: %s\n' % self.fun.__name__
return self.__class__.__name__ + '\n'
def __hash__(self):
return id(self)
def exec_command(self, cmd, **kw):
bld = self.generator.bld
try:
if not kw.get('cwd', None):
kw['cwd'] = bld.cwd
except AttributeError:
bld.cwd = kw['cwd'] = bld.variant_dir
return bld.exec_command(cmd, **kw)
def runnable_status(self):
return RUN_ME
def process(self):
m = self.master
if m.stop:
m.out.put(self)
return
try:
del self.generator.bld.task_sigs[self.uid()]
except KeyError:
pass
try:
self.generator.bld.returned_tasks.append(self)
self.log_display(self.generator.bld)
ret = self.run()
except Exception:
self.err_msg = Utils.ex_stack()
self.hasrun = EXCEPTION
m.error_handler(self)
m.out.put(self)
return
if ret:
self.err_code = ret
self.hasrun = CRASHED
else:
try:
self.post_run()
except Errors.WafError:
pass
except Exception:
self.err_msg = Utils.ex_stack()
self.hasrun = EXCEPTION
else:
self.hasrun = SUCCESS
if self.hasrun != SUCCESS:
m.error_handler(self)
m.out.put(self)
def run(self):
if hasattr(self, 'fun'):
return self.fun(self)
return 0
def post_run(self):
pass
def log_display(self, bld):
bld.to_log(self.display())
def display(self):
col1 = Logs.colors(self.color)
col2 = Logs.colors.NORMAL
master = self.master
def cur():
tmp = -1
if hasattr(master, 'ready'):
tmp -= master.ready.qsize()
return master.processed + tmp
if self.generator.bld.progress_bar == 1:
return self.generator.bld.progress_line(cur(), master.total, col1, col2)
if self.generator.bld.progress_bar == 2:
ela = str(self.generator.bld.timer)
try:
ins = ','.join([n.name for n in self.inputs])
except AttributeError:
ins = ''
try:
outs = ','.join([n.name for n in self.outputs])
except AttributeError:
outs = ''
return '|Total %s|Current %s|Inputs %s|Outputs %s|Time %s|\n' % (master.total, cur(), ins, outs, ela)
s = str(self)
if not s:
return None
total = master.total
n = len(str(total))
fs = '[%%%dd/%%%dd] %%s%%s%%s' % (n, n)
return fs % (cur(), total, col1, s, col2)
def attr(self, att, default=None):
ret = getattr(self, att, self)
if ret is self: return getattr(self.__class__, att, default)
return ret
def hash_constraints(self):
cls = self.__class__
tup = (str(cls.before), str(cls.after), str(cls.ext_in), str(cls.ext_out), cls.__name__, cls.hcode)
h = hash(tup)
return h
def format_error(self):
msg = getattr(self, 'last_cmd', '')
output = ''
for i in msg:
if not isinstance(i, str):
output += str(i) + ' '
else:
output += i + ' '
msg = output[:len(output)-1]
name = self.__class__.__name__.replace('_task', '') + ' (' + self.env['PLATFORM'] + '|' + self.env['CONFIGURATION'] + ')'
if getattr(self, "err_msg", None):
return self.err_msg
elif not self.hasrun:
return 'task in %r was not executed for some reason: %r' % (name, self)
elif self.hasrun == CRASHED:
try:
return ' -> task in %r failed (exit status %r): %r\n%r' % (name, self.err_code, self, msg)
except AttributeError:
return ' -> task in %r failed: %r\n%r' % (name, self, msg)
elif self.hasrun == MISSING:
return ' -> missing files in %r: %r\n%r' % (name, self, msg)
else:
return 'invalid status for task in %r: %r' % (name, self.hasrun)
def colon(self, var1, var2):
tmp = self.env[var1]
if isinstance(var2, str):
it = self.env[var2]
else:
it = var2
if isinstance(tmp, str):
return [tmp % x for x in it]
else:
if Logs.verbose and not tmp and it:
Logs.warn('Missing env variable %r for task %r (generator %r)' % (var1, self, self.generator))
lst = []
for y in it:
lst.extend(tmp)
lst.append(y)
return lst
class Task(TaskBase):
vars = []
shell = False
def __init__(self, *k, **kw):
TaskBase.__init__(self, *k, **kw)
self.env = kw['env']
self.inputs = []
self.outputs = []
self.dep_nodes = []
self.run_after = set([])
self.sig_debug_output = ''
self.sig_implicit_debug_log = ''
def __str__(self):
env = self.env
src_str = ' '.join([a.nice_path() for a in self.inputs])
tgt_str = ' '.join([a.nice_path() for a in self.outputs])
if self.outputs and self.inputs: sep = ' -> '
else: sep = ''
name = self.__class__.__name__.replace('_task', '') + ' (' + env['PLATFORM'] + '|' + env['CONFIGURATION'] + ')'
return '%s: %s%s%s\n' % (name, src_str, sep, tgt_str)
def __repr__(self):
try:
ins = ",".join([x.name for x in self.inputs])
outs = ",".join([x.name for x in self.outputs])
except AttributeError:
ins = ",".join([str(x) for x in self.inputs])
outs = ",".join([str(x) for x in self.outputs])
return "".join(['\n\t{task %r: ' % id(self), self.__class__.__name__, " ", ins, " -> ", outs, '}'])
def uid(self):
try:
return self.uid_
except AttributeError:
m = Utils.md5()
up = m.update
up(self.__class__.__name__.encode())
deplist = [k.abspath().encode() for k in self.inputs + self.outputs]
dep_bld_sigs_str = "".join(deplist)
up(dep_bld_sigs_str)
self.uid_ = m.digest()
return self.uid_
def set_inputs(self, inp):
if isinstance(inp, list): self.inputs += inp
else: self.inputs.append(inp)
def set_outputs(self, out):
if isinstance(out, list): self.outputs += out
else: self.outputs.append(out)
def set_run_after(self, task):
assert isinstance(task, TaskBase)
self.run_after.add(task)
def signature(self):
try: return self.cache_sig
except AttributeError: pass
self.m = Utils.md5()
self.m.update(self.hcode.encode())
exp_deps = self.sig_explicit_deps()
self.m.update(exp_deps)
self.sig_vars()
if self.scan:
imp_deps = self.sig_implicit_deps()
self.m.update(imp_deps)
ret = self.cache_sig = self.m.digest()
return ret
def runnable_status(self):
for t in self.run_after:
if not t.hasrun:
return ASK_LATER
bld = self.generator.bld
self.sig_debug_output = ""
try:
new_sig = self.signature()
except Errors.TaskNotReady:
return ASK_LATER
key = self.uid()
try:
prev_sig = bld.task_sigs[key]
except KeyError:
Logs.debug("task: task %r must run as it was never run before or the task code changed" % self)
return RUN_ME
if new_sig != prev_sig:
if Logs.sig_delta:
sig_debug_path = os.path.join('TaskSigDeltaOutput','{}_{}_{}.log'.format(self.__class__.__name__, self.inputs[0].name.replace(".", ""), time.time()))
sig_debug_node = self.generator.bld.bldnode.find_or_declare(sig_debug_path)
sig_debug_node.write(self.sig_debug_output)
return RUN_ME
for node in self.outputs:
try:
if node.sig != new_sig:
return RUN_ME
except AttributeError:
Logs.debug("task: task %r must run as the output nodes do not exist" % self)
return RUN_ME
return SKIP_ME
def post_run(self):
bld = self.generator.bld
sig = self.signature()
for node in self.outputs:
try:
os.stat(node.abspath())
except OSError:
self.hasrun = MISSING
self.err_msg = '-> missing file: %r' % node.abspath()
raise Errors.WafError(self.err_msg)
node.sig = node.cache_sig = sig
bld.task_sigs[self.uid()] = self.cache_sig
def sig_explicit_deps(self):
bld = self.generator.bld
bld_sigs = []
exp_output = ''
for x in self.inputs + self.dep_nodes:
try:
bld_sig = x.get_bld_sig()
if Logs.sig_delta:
exp_output += '{} {} {}\n'.format(x.name, x.abspath(), hexlify(bld_sig))
bld_sigs.append(bld_sig)
except (AttributeError, TypeError, IOError):
Logs.warn('Missing signature for node %r (required by %r)' % (x, self))
continue
if bld.deps_man:
additional_deps = bld.deps_man
for x in self.inputs + self.outputs:
try:
d = additional_deps[id(x)]
except KeyError:
continue
for v in d:
v_name = v.name
if isinstance(v, bld.root.__class__):
try:
v = v.get_bld_sig()
except AttributeError:
raise Errors.WafError('Missing node signature for %r (required by %r)' % (v, self))
elif hasattr(v, '__call__'):
v = v()
if Logs.sig_delta:
exp_output += '{} {}\n'.format(v_name, hexlify(v))
bld_sigs.append(v)
dep_bld_sigs_str = "".join(bld_sigs)
m = Utils.md5()
m.update(dep_bld_sigs_str)
explicit_sig = m.digest()
if Logs.sig_delta:
key = self.uid()
prev_sig = bld.task_sigs.get((key, 'exp'), [])
if prev_sig and prev_sig != explicit_sig:
self.capture_signature_log('\nExplicit(Old):\n')
self.capture_signature_log(bld.last_build['exp_deps'].get(key,''))
self.capture_signature_log('\nExplicit(New):\n')
self.capture_signature_log(exp_output)
bld.last_build['exp_deps'][key] = exp_output
bld.task_sigs[(key, 'exp')] = explicit_sig
return explicit_sig
def sig_vars(self):
bld = self.generator.bld
env = self.env
upd = self.m.update
key = self.uid()
act_sig = bld.hash_env_vars(env, self.__class__.vars)
upd(act_sig)
if Logs.sig_delta:
prev_act_sig = bld.task_sigs.get((key, 'env'), [])
prev_dep_sig = bld.task_sigs.get((key, 'dep_vars'), [])
bld.task_sigs[(key, 'env')] = act_sig
dep_vars = getattr(self, 'dep_vars', None)
dep_sig = ''
if dep_vars:
dep_sig = bld.hash_env_vars(env, dep_vars)
upd(dep_sig)
if Logs.sig_delta:
bld.task_sigs[(key, 'dep_vars')] = dep_sig
if prev_dep_sig and prev_dep_sig != dep_sig:
self.capture_signature_log('\nDep Vars:\n'+pprint.pformat(dep_vars))
if Logs.sig_delta:
if (prev_act_sig and prev_act_sig != act_sig) or (prev_dep_sig and prev_dep_sig != dep_sig):
self.capture_signature_log('\nEnv(Current):\n'+pprint.pformat(bld.debug_get_env_vars(env, self.__class__.vars)))
prev_env = bld.last_build['env'].get(key, {})
self.capture_signature_log('\nEnv(Last):\n'+pprint.pformat(prev_env))
bld.last_build['env'][key] = bld.debug_get_env_vars(env, self.__class__.vars)
return self.m.digest()
scan = None
def sig_implicit_deps(self):
bld = self.generator.bld
key = self.uid()
prev = bld.task_sigs.get((key, 'imp'), [])
f prev:
try:
sid = self.compute_sig_implicit_deps(False)
if prev == sid:
return prev
except Exception:
# when a file was renamed (IOError usually), remove the stale nodes (headers in folders without source files)
# this will break the order calculation for headers created during the build in the source directory (should be uncommon)
# the behaviour will differ when top != out
deps = bld.node_deps.get(self.uid(), [])
for x in deps:
if x.is_child_of(bld.srcnode):
try:
os.stat(x.abspath())
except OSError:
try:
del x.parent.children[x.name]
except KeyError:
pass
# the previous signature and the current signature don't match, delete the implicit deps, and cause a rescan below
del bld.task_sigs[(key, 'imp')]
(nodes, names) = self.scan()
if Logs.verbose:
Logs.debug('deps: scanner for %s returned %s %s' % (str(self), str(nodes), str(names)))
bld.node_deps[key] = nodes
bld.raw_deps[key] = names
old_sig_debug_log = self.sig_implicit_debug_log
bld.task_sigs[(key, 'imp')] = sig = self.compute_sig_implicit_deps(False)
if Logs.sig_delta and old_sig_debug_log != self.sig_implicit_debug_log:
self.capture_signature_log('\nImplicit(Old):\n')
self.capture_signature_log(old_sig_debug_log)
self.capture_signature_log('\nImplicit(New):\n')
self.capture_signature_log(self.sig_implicit_debug_log)
return sig
def compute_sig_implicit_deps(self, warn_on_missing=True):
bld = self.generator.bld
self.are_implicit_nodes_ready()
self.sig_implicit_debug_log = ''
# scanner returns a node that does not have a signature
# just *ignore* the error and let them figure out from the compiler output
# waf -k behaviour
deps = bld.node_deps.get(self.uid(), [])
bld_sigs = []
for k in deps:
try:
bld_sig = k.get_bld_sig()
if Logs.sig_delta:
self.sig_implicit_debug_log += ('{} {}\n'.format(k.name, hexlify(bld_sig)))
except:
if warn_on_missing:
Logs.warn('Missing signature for node %r (dependency will not be tracked)' % k)
continue # skip adding the signature to the calculation, but continue adding other dependencies
bld_sigs.append(bld_sig)
dep_bld_sigs_str = "".join(bld_sigs)
m = Utils.md5()
m.update(dep_bld_sigs_str)
return m.digest()
def are_implicit_nodes_ready(self):
bld = self.generator.bld
try:
cache = bld.dct_implicit_nodes
except AttributeError:
bld.dct_implicit_nodes = cache = {}
try:
dct = cache[bld.cur]
except KeyError:
dct = cache[bld.cur] = {}
for tsk in bld.cur_tasks:
for x in tsk.outputs:
dct[x] = tsk
# find any dependency that is not part of the run_after set already
deps = bld.node_deps.get(self.uid(), [])
deps_missing_from_runafter = [dct[i] for i in deps if i in dct and dct[i] not in self.run_after]
# verify that all tasks have not already run
for tsk in deps_missing_from_runafter:
if not tsk.hasrun:
#print "task is not ready..."
raise Errors.TaskNotReady('not ready')
# update the run_after tasks
self.run_after.update(deps_missing_from_runafter)
def capture_signature_log(self, output):
if hasattr(self, 'sig_debug_output'):
self.sig_debug_output += output
def can_retrieve_cache(self):
if not getattr(self, 'outputs', None):
return None
sig = self.signature()
ssig = Utils.to_hex(self.uid()) + Utils.to_hex(sig)
# first try to access the cache folder for the task
dname = os.path.join(self.generator.bld.cache_global, ssig)
try:
t1 = os.stat(dname).st_mtime
except OSError:
return None
for node in self.outputs:
orig = os.path.join(dname, node.name)
try:
shutil.copy2(orig, node.abspath())
# mark the cache file as used recently (modified)
os.utime(orig, None)
except (OSError, IOError):
Logs.debug('task: failed retrieving file')
return None
# is it the same folder?
try:
t2 = os.stat(dname).st_mtime
except OSError:
return None
if t1 != t2:
return None
for node in self.outputs:
node.sig = sig
if self.generator.bld.progress_bar < 1:
self.generator.bld.to_log('restoring from cache %r\n' % node.abspath())
self.cached = True
return True
def put_files_cache(self):
# file caching, if possible
# try to avoid data corruption as much as possible
if getattr(self, 'cached', None):
return None
if not getattr(self, 'outputs', None):
return None
sig = self.signature()
ssig = Utils.to_hex(self.uid()) + Utils.to_hex(sig)
dname = os.path.join(self.generator.bld.cache_global, ssig)
tmpdir = tempfile.mkdtemp(prefix=self.generator.bld.cache_global + os.sep + 'waf')
try:
shutil.rmtree(dname)
except Exception:
pass
try:
for node in self.outputs:
dest = os.path.join(tmpdir, node.name)
shutil.copy2(node.abspath(), dest)
except (OSError, IOError):
try:
shutil.rmtree(tmpdir)
except Exception:
pass
else:
try:
os.rename(tmpdir, dname)
except OSError:
try:
shutil.rmtree(tmpdir)
except Exception:
pass
else:
try:
os.chmod(dname, Utils.O755)
except Exception:
pass
def is_before(t1, t2):
to_list = Utils.to_list
for k in to_list(t2.ext_in):
if k in to_list(t1.ext_out):
return 1
if t1.__class__.__name__ in to_list(t2.after):
return 1
if t2.__class__.__name__ in to_list(t1.before):
return 1
return 0
def set_file_constraints(tasks):
ins = Utils.defaultdict(set)
outs = Utils.defaultdict(set)
for x in tasks:
for a in getattr(x, 'inputs', []) + getattr(x, 'dep_nodes', []):
ins[id(a)].add(x)
for a in getattr(x, 'outputs', []):
outs[id(a)].add(x)
links = set(ins.keys()).intersection(outs.keys())
for k in links:
for a in ins[k]:
a.run_after.update(outs[k])
def set_precedence_constraints(tasks):
cstr_groups = Utils.defaultdict(list)
for x in tasks:
h = x.hash_constraints()
cstr_groups[h].append(x)
keys = list(cstr_groups.keys())
maxi = len(keys)
# this list should be short
for i in range(maxi):
t1 = cstr_groups[keys[i]][0]
for j in range(i + 1, maxi):
t2 = cstr_groups[keys[j]][0]
# add the constraints based on the comparisons
if is_before(t1, t2):
a = i
b = j
elif is_before(t2, t1):
a = j
b = i
else:
continue
aval = set(cstr_groups[keys[a]])
for x in cstr_groups[keys[b]]:
x.run_after.update(aval)
def funex(c):
dc = {}
exec(c, dc)
return dc['f']
reg_act = re.compile(r"(?P<backslash>\\)|(?P<dollar>\$\$)|(?P<subst>\$\{(?P<var>\w+)(?P<code>.*?)\})", re.M)
def compile_fun_shell(line):
extr = []
def repl(match):
g = match.group
if g('dollar'): return "$"
elif g('backslash'): return '\\\\'
elif g('subst'): extr.append((g('var'), g('code'))); return "%s"
return None
line = reg_act.sub(repl, line) or line
parm = []
dvars = []
app = parm.append
for (var, meth) in extr:
if var == 'SRC':
if meth: app('tsk.inputs%s' % meth)
else: app('" ".join([a.path_from(bld.bldnode) for a in tsk.inputs])')
elif var == 'ABS_SRC':
if meth: app('tsk.inputs%s' % meth)
else: app('" ".join([\'"{}"\'.format(a.abspath()) for a in tsk.inputs])')
elif var == 'TGT':
if meth: app('tsk.outputs%s' % meth)
else: app('" ".join([a.path_from(bld.bldnode) for a in tsk.outputs])')
elif meth:
if meth.startswith(':'):
m = meth[1:]
if m == 'SRC':
m = '[a.path_from(bld.bldnode) for a in tsk.inputs]'
if m == 'ABS_SRC':
m = '[a.abspath() for a in tsk.inputs]'
elif m == 'TGT':
m = '[a.path_from(bld.bldnode) for a in tsk.outputs]'
elif m[:3] not in ('tsk', 'gen', 'bld'):
dvars.extend([var, meth[1:]])
m = '%r' % m
app('" ".join(tsk.colon(%r, %s))' % (var, m))
else:
app('%s%s' % (var, meth))
else:
if not var in dvars: dvars.append(var)
app("p('%s')" % var)
if parm: parm = "%% (%s) " % (',\n\t\t'.join(parm))
else: parm = ''
c = COMPILE_TEMPLATE_SHELL % (line, parm)
Logs.debug('action: %s' % c.strip().splitlines())
return (funex(c), dvars)
def compile_fun_noshell(line):
extr = []
def repl(match):
g = match.group
if g('dollar'): return "$"
elif g('subst'): extr.append((g('var'), g('code'))); return "<<|@|>>"
return None
line2 = reg_act.sub(repl, line)
params = line2.split('<<|@|>>')
assert(extr)
buf = []
dvars = []
app = buf.append
for x in range(len(extr)):
params[x] = params[x].strip()
if params[x]:
app("lst.extend(%r)" % params[x].split())
(var, meth) = extr[x]
if var == 'SRC':
if meth: app('lst.append(tsk.inputs%s)' % meth)
else: app("lst.extend([a.abspath() for a in tsk.inputs])")
elif var == 'TGT':
if meth: app('lst.append(tsk.outputs%s)' % meth)
else: app("lst.extend([a.abspath() for a in tsk.outputs])")
elif meth:
if meth.startswith(':'):
m = meth[1:]
if m == 'SRC':
m = '[a.abspath() for a in tsk.inputs]'
elif m == 'TGT':
m = '[a.abspath() for a in tsk.outputs]'
elif m[:3] not in ('tsk', 'gen', 'bld'):
dvars.extend([var, m])
m = '%r' % m
app('lst.extend(tsk.colon(%r, %s))' % (var, m))
else:
app('lst.extend(gen.to_list(%s%s))' % (var, meth))
else:
app('lst.extend(to_list(env[%r]))' % var)
if not var in dvars: dvars.append(var)
if extr:
if params[-1]:
app("lst.extend(%r)" % params[-1].split())
fun = COMPILE_TEMPLATE_NOSHELL % "\n\t".join(buf)
Logs.debug('action: %s' % fun.strip().splitlines())
return (funex(fun), dvars)
def compile_fun(line, shell=False):
if line.find('<') > 0 or line.find('>') > 0 or line.find('&&') > 0:
shell = True
if shell:
return compile_fun_shell(line)
else:
return compile_fun_noshell(line)
def task_factory(name, func=None, vars=None, color='GREEN', ext_in=[], ext_out=[], before=[], after=[], shell=False, scan=None):
params = {
'vars': vars or [], # function arguments are static, and this one may be modified by the class
'color': color,
'name': name,
'ext_in': Utils.to_list(ext_in),
'ext_out': Utils.to_list(ext_out),
'before': Utils.to_list(before),
'after': Utils.to_list(after),
'shell': shell,
'scan': scan,
}
if isinstance(func, str):
params['run_str'] = func
else:
params['run'] = func
cls = type(Task)(name, (Task,), params)
global classes
classes[name] = cls
return cls
def always_run(cls):
old = cls.runnable_status
def always(self):
ret = old(self)
if ret == SKIP_ME:
ret = RUN_ME
return ret
cls.runnable_status = always
return cls
def update_outputs(cls):
old_post_run = cls.post_run
def post_run(self):
old_post_run(self)
for node in self.outputs:
node.sig = node.cache_sig = Utils.h_file(node.abspath())
self.generator.bld.task_sigs[node.abspath()] = self.uid() # issue #1017
cls.post_run = post_run
old_runnable_status = cls.runnable_status
def runnable_status(self):
status = old_runnable_status(self)
if status != RUN_ME:
return status
try:
# by default, we check that the output nodes have the signature of the task
# perform a second check, returning 'SKIP_ME' as we are expecting that
# the signatures do not match
bld = self.generator.bld
prev_sig = bld.task_sigs[self.uid()]
if prev_sig == self.signature():
for x in self.outputs:
if not x.sig or bld.task_sigs[x.abspath()] != self.uid():
return RUN_ME
return SKIP_ME
except KeyError:
pass
except IndexError:
pass
except AttributeError:
pass
return RUN_ME
cls.runnable_status = runnable_status
return cls
| true
| true
|
f70a1f7c570d346ca9264fc6af83f1d197354756
| 2,526
|
py
|
Python
|
foampy/tests/test_dictionaries.py
|
petebachant/foamPy
|
ff74ab13f982b31e8ef0d1f379425db08f03924c
|
[
"MIT"
] | 8
|
2017-11-22T03:37:32.000Z
|
2021-11-23T08:57:15.000Z
|
foampy/tests/test_dictionaries.py
|
Carlopasquinucci/foamPy
|
ff74ab13f982b31e8ef0d1f379425db08f03924c
|
[
"MIT"
] | 45
|
2015-02-11T23:09:59.000Z
|
2017-07-24T22:24:31.000Z
|
foampy/tests/test_dictionaries.py
|
Carlopasquinucci/foamPy
|
ff74ab13f982b31e8ef0d1f379425db08f03924c
|
[
"MIT"
] | 7
|
2015-05-05T21:41:54.000Z
|
2020-09-30T14:29:54.000Z
|
"""Tests for the `dictionaries` module."""
from __future__ import division, print_function, absolute_import
import foampy
from foampy.dictionaries import *
def test_replace_value():
"""Test the `replace_value` function."""
print("\nTesting dictionaries.replace_value")
orig = read_single_line_value(dictname="blockMeshDict",
keyword="convertToMeters",
casedir="./test", dtype=int)
replace_value("test/system/blockMeshDict", "convertToMeters", 555)
assert read_single_line_value(dictname="blockMeshDict",
keyword="convertToMeters",
casedir="./test") == 555
replace_value("test/system/blockMeshDict", "convertToMeters", orig)
assert read_single_line_value(dictname="blockMeshDict",
keyword="convertToMeters",
casedir="./test") == orig
def test_build_header():
"""Test the `dictionaries.build_header` function."""
print("\nTesting dictionaries.build_header")
h = build_header("blockMeshDict", incl_foamfile=True)
print(h)
assert h == r"""/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}"""
h = build_header("blockMeshDict", incl_foamfile=False)
print(h)
assert h == r"""/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/"""
| 48.576923
| 99
| 0.407759
|
from __future__ import division, print_function, absolute_import
import foampy
from foampy.dictionaries import *
def test_replace_value():
print("\nTesting dictionaries.replace_value")
orig = read_single_line_value(dictname="blockMeshDict",
keyword="convertToMeters",
casedir="./test", dtype=int)
replace_value("test/system/blockMeshDict", "convertToMeters", 555)
assert read_single_line_value(dictname="blockMeshDict",
keyword="convertToMeters",
casedir="./test") == 555
replace_value("test/system/blockMeshDict", "convertToMeters", orig)
assert read_single_line_value(dictname="blockMeshDict",
keyword="convertToMeters",
casedir="./test") == orig
def test_build_header():
print("\nTesting dictionaries.build_header")
h = build_header("blockMeshDict", incl_foamfile=True)
print(h)
assert h == r"""/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/
FoamFile
{
version 2.0;
format ascii;
class dictionary;
object blockMeshDict;
}"""
h = build_header("blockMeshDict", incl_foamfile=False)
print(h)
assert h == r"""/*--------------------------------*- C++ -*----------------------------------*\
| ========= | |
| \\ / F ield | OpenFOAM: The Open Source CFD Toolbox |
| \\ / O peration | Version: 2.3.x |
| \\ / A nd | Web: www.OpenFOAM.org |
| \\/ M anipulation | |
\*---------------------------------------------------------------------------*/"""
| true
| true
|
f70a1f932d120296d5c3e1b50f097d31b797cbbf
| 1,957
|
py
|
Python
|
Python/Templates/Web/ProjectTemplates/Python/Web/WorkerRoleProject/worker.py
|
awesome-archive/PTVS
|
c0cd34196ddf53b4ca755d72da5351f4e2ffdfb9
|
[
"Apache-2.0"
] | 1
|
2019-06-05T19:16:49.000Z
|
2019-06-05T19:16:49.000Z
|
Python/Templates/Web/ProjectTemplates/Python/Web/WorkerRoleProject/worker.py
|
willv84/PTVS
|
42b834efec9dd1510dc83cdec28c93ee3110b5f2
|
[
"Apache-2.0"
] | 2
|
2019-06-05T18:13:41.000Z
|
2019-06-05T20:13:16.000Z
|
Python/Templates/Web/ProjectTemplates/Python/Web/WorkerRoleProject/worker.py
|
RaymonGulati1/PTVS
|
ee1d09f2a94be4e21016f7579205bb65ec82c616
|
[
"Apache-2.0"
] | 2
|
2018-03-02T19:55:14.000Z
|
2019-02-14T22:37:28.000Z
|
import os
from time import sleep
#
# The azure library provides access to services made available by the
# Microsoft Azure platform, such as storage and messaging.
#
# See https://go.microsoft.com/fwlink/?linkid=254360 for documentation and
# example code.
#
from azure.servicebus import ServiceBusService
from azure.storage import CloudStorageAccount
#
# The CloudStorageAccount provides factory methods for the queue, table, and
# blob services.
#
# See https://go.microsoft.com/fwlink/?linkid=246933 for Storage documentation.
#
STORAGE_ACCOUNT_NAME = '__paste_your_storage_account_name_here__'
STORAGE_ACCOUNT_KEY = '__paste_your_storage_key_here__'
if os.environ.get('EMULATED', '').lower() == 'true':
# Running in the emulator, so use the development storage account
storage_account = CloudStorageAccount(None, None)
else:
storage_account = CloudStorageAccount(STORAGE_ACCOUNT_NAME, STORAGE_ACCOUNT_KEY)
blob_service = storage_account.create_blob_service()
table_service = storage_account.create_table_service()
queue_service = storage_account.create_queue_service()
#
# Service Bus is a messaging solution for applications. It sits between
# components of your applications and enables them to exchange messages in a
# loosely coupled way for improved scale and resiliency.
#
# See https://go.microsoft.com/fwlink/?linkid=246934 for Service Bus documentation.
#
SERVICE_BUS_NAMESPACE = '__paste_your_service_bus_namespace_here__'
SERVICE_BUS_KEY = '__paste_your_service_bus_key_here__'
bus_service = ServiceBusService(SERVICE_BUS_NAMESPACE, SERVICE_BUS_KEY, issuer='owner')
if __name__ == '__main__':
while True:
#
# Write your worker process here.
#
# You will probably want to call a blocking function such as
# bus_service.receive_queue_message('queue name', timeout=seconds)
# to avoid consuming 100% CPU time while your worker has no work.
#
sleep(1.0)
| 34.946429
| 87
| 0.771589
|
import os
from time import sleep
from azure.servicebus import ServiceBusService
from azure.storage import CloudStorageAccount
STORAGE_ACCOUNT_NAME = '__paste_your_storage_account_name_here__'
STORAGE_ACCOUNT_KEY = '__paste_your_storage_key_here__'
if os.environ.get('EMULATED', '').lower() == 'true':
storage_account = CloudStorageAccount(None, None)
else:
storage_account = CloudStorageAccount(STORAGE_ACCOUNT_NAME, STORAGE_ACCOUNT_KEY)
blob_service = storage_account.create_blob_service()
table_service = storage_account.create_table_service()
queue_service = storage_account.create_queue_service()
SERVICE_BUS_NAMESPACE = '__paste_your_service_bus_namespace_here__'
SERVICE_BUS_KEY = '__paste_your_service_bus_key_here__'
bus_service = ServiceBusService(SERVICE_BUS_NAMESPACE, SERVICE_BUS_KEY, issuer='owner')
if __name__ == '__main__':
while True:
sleep(1.0)
| true
| true
|
f70a2161483120e67364fec4846701e21f94c6f8
| 1,509
|
py
|
Python
|
mmdet/models/bbox_heads/mgan_head.py
|
zjplab/Pedestron
|
07e1a2cee82b57e1584b0c744f5b44f1ae92be73
|
[
"Apache-2.0"
] | null | null | null |
mmdet/models/bbox_heads/mgan_head.py
|
zjplab/Pedestron
|
07e1a2cee82b57e1584b0c744f5b44f1ae92be73
|
[
"Apache-2.0"
] | null | null | null |
mmdet/models/bbox_heads/mgan_head.py
|
zjplab/Pedestron
|
07e1a2cee82b57e1584b0c744f5b44f1ae92be73
|
[
"Apache-2.0"
] | null | null | null |
import torch.nn as nn
from ..registry import HEADS
from ..utils import ConvModule
from mmdetection.core import auto_fp16
@HEADS.register_module
class MGANHead(nn.Module):
def __init__(self,
num_convs=2,
roi_feat_size=7,
in_channels=512,
conv_out_channels=512,
conv_cfg=None,
norm_cfg=None):
super(MGANHead, self).__init__()
self.num_convs = num_convs
self.roi_feat_size = roi_feat_size
self.in_channels = in_channels
self.conv_out_channels = conv_out_channels
self.conv_cfg = conv_cfg
self.norm_cfg = norm_cfg
self.fp16_enabled = False
self.convs = nn.ModuleList()
for i in range(self.num_convs):
in_channels = (
self.in_channels if i == 0 else self.conv_out_channels)
self.convs.append(
ConvModule(
in_channels,
self.conv_out_channels,
3,
padding=1,
conv_cfg=conv_cfg,
norm_cfg=norm_cfg))
logits_in_channel = self.conv_out_channels
self.conv_logits = nn.Conv2d(logits_in_channel, 1, 1)
self.relu = nn.ReLU(inplace=True)
self.debug_imgs = None
@auto_fp16()
def forward(self, x):
for conv in self.convs:
x = conv(x)
x = self.conv_logits(x).sigmoid() * x
return x
| 28.471698
| 71
| 0.55666
|
import torch.nn as nn
from ..registry import HEADS
from ..utils import ConvModule
from mmdetection.core import auto_fp16
@HEADS.register_module
class MGANHead(nn.Module):
def __init__(self,
num_convs=2,
roi_feat_size=7,
in_channels=512,
conv_out_channels=512,
conv_cfg=None,
norm_cfg=None):
super(MGANHead, self).__init__()
self.num_convs = num_convs
self.roi_feat_size = roi_feat_size
self.in_channels = in_channels
self.conv_out_channels = conv_out_channels
self.conv_cfg = conv_cfg
self.norm_cfg = norm_cfg
self.fp16_enabled = False
self.convs = nn.ModuleList()
for i in range(self.num_convs):
in_channels = (
self.in_channels if i == 0 else self.conv_out_channels)
self.convs.append(
ConvModule(
in_channels,
self.conv_out_channels,
3,
padding=1,
conv_cfg=conv_cfg,
norm_cfg=norm_cfg))
logits_in_channel = self.conv_out_channels
self.conv_logits = nn.Conv2d(logits_in_channel, 1, 1)
self.relu = nn.ReLU(inplace=True)
self.debug_imgs = None
@auto_fp16()
def forward(self, x):
for conv in self.convs:
x = conv(x)
x = self.conv_logits(x).sigmoid() * x
return x
| true
| true
|
f70a218a22117f560b2fb24add1cdcdeacc100ed
| 273
|
py
|
Python
|
weread/redisTool.py
|
songjiang951130/JD-Coin
|
03e2183435e6e8e4cf109fa7286d15cf5f6933da
|
[
"Apache-2.0"
] | 5
|
2019-08-01T10:35:48.000Z
|
2019-12-15T02:58:01.000Z
|
weread/redisTool.py
|
songjiang951130/JD-Coin
|
03e2183435e6e8e4cf109fa7286d15cf5f6933da
|
[
"Apache-2.0"
] | 1
|
2020-01-21T08:38:24.000Z
|
2020-01-21T08:38:24.000Z
|
weread/redisTool.py
|
songjiang951130/JD-Coin
|
03e2183435e6e8e4cf109fa7286d15cf5f6933da
|
[
"Apache-2.0"
] | 7
|
2019-08-28T11:36:15.000Z
|
2022-01-16T14:55:41.000Z
|
import redis
host = '127.0.0.1'
port = 6379
client = redis.Redis(host=host, port=port)
client.set("redis", "value111", None, 1000)
print(str(client.get("redis")))
if client.get("redis1") != None and len(client.get("redis1")) > 0:
print("sss")
else:
print("no")
| 18.2
| 66
| 0.641026
|
import redis
host = '127.0.0.1'
port = 6379
client = redis.Redis(host=host, port=port)
client.set("redis", "value111", None, 1000)
print(str(client.get("redis")))
if client.get("redis1") != None and len(client.get("redis1")) > 0:
print("sss")
else:
print("no")
| true
| true
|
f70a21ed38d44e8d3f866d610001a211b803b1ce
| 7,189
|
py
|
Python
|
src/onegov/election_day/path.py
|
politbuero-kampagnen/onegov-cloud
|
20148bf321b71f617b64376fe7249b2b9b9c4aa9
|
[
"MIT"
] | null | null | null |
src/onegov/election_day/path.py
|
politbuero-kampagnen/onegov-cloud
|
20148bf321b71f617b64376fe7249b2b9b9c4aa9
|
[
"MIT"
] | null | null | null |
src/onegov/election_day/path.py
|
politbuero-kampagnen/onegov-cloud
|
20148bf321b71f617b64376fe7249b2b9b9c4aa9
|
[
"MIT"
] | null | null | null |
from onegov.ballot import Ballot
from onegov.ballot import BallotCollection
from onegov.ballot import Candidate
from onegov.ballot import CandidateCollection
from onegov.ballot import Election
from onegov.ballot import ElectionCollection
from onegov.ballot import ElectionCompound
from onegov.ballot import ElectionCompoundCollection
from onegov.ballot import List
from onegov.ballot import ListCollection
from onegov.ballot import Vote
from onegov.ballot import VoteCollection
from onegov.core.converters import extended_date_converter
from onegov.core.i18n import SiteLocale
from onegov.election_day import ElectionDayApp
from onegov.election_day.collections import ArchivedResultCollection
from onegov.election_day.collections import DataSourceCollection
from onegov.election_day.collections import DataSourceItemCollection
from onegov.election_day.collections import EmailSubscriberCollection
from onegov.election_day.collections import ScreenCollection
from onegov.election_day.collections import SearchableArchivedResultCollection
from onegov.election_day.collections import SmsSubscriberCollection
from onegov.election_day.collections import SubscriberCollection
from onegov.election_day.collections import UploadTokenCollection
from onegov.election_day.models import DataSource
from onegov.election_day.models import DataSourceItem
from onegov.election_day.models import Principal
from onegov.election_day.models import Screen
from onegov.election_day.models import Subscriber
from onegov.election_day.models import UploadToken
from onegov.user import Auth
from uuid import UUID
@ElectionDayApp.path(
model=Auth,
path='/auth'
)
def get_auth(request, to='/'):
return Auth.from_request(request, to)
@ElectionDayApp.path(
model=Principal,
path='/'
)
def get_principal(app):
return app.principal
@ElectionDayApp.path(
model=ElectionCollection,
path='/manage/elections',
converters=dict(
page=int
)
)
def get_manage_elections(app, page=0):
return ElectionCollection(app.session(), page=page)
@ElectionDayApp.path(
model=ElectionCompoundCollection,
path='/manage/election-compounds',
converters=dict(
page=int
)
)
def get_manage_election_compsites(app, page=0):
return ElectionCompoundCollection(app.session(), page=page)
@ElectionDayApp.path(
model=VoteCollection,
path='/manage/votes',
converters=dict(
page=int
)
)
def get_manage_votes(app, page=0):
return VoteCollection(app.session(), page=page)
@ElectionDayApp.path(
model=SmsSubscriberCollection,
path='/manage/subscribers/sms',
converters=dict(
page=int
)
)
def get_manage_sms_subscribers(app, page=0, term=None):
return SmsSubscriberCollection(app.session(), page=page, term=term)
@ElectionDayApp.path(
model=EmailSubscriberCollection,
path='/manage/subscribers/email',
converters=dict(
page=int
)
)
def get_manage_email_subscribers(app, page=0, term=None):
return EmailSubscriberCollection(app.session(), page=page, term=term)
@ElectionDayApp.path(
model=UploadTokenCollection,
path='/manage/upload-tokens'
)
def get_manage_upload_tokens(app):
return UploadTokenCollection(app.session())
@ElectionDayApp.path(
model=DataSourceCollection,
path='/manage/sources',
converters=dict(
page=int
)
)
def get_manage_data_sources(app, page=0):
return DataSourceCollection(app.session(), page=page)
@ElectionDayApp.path(
model=DataSourceItemCollection,
path='/manage/source/{id}/items',
converters=dict(
id=UUID,
page=int
)
)
def get_manage_data_source_items(app, id, page=0):
return DataSourceItemCollection(app.session(), id, page=page)
@ElectionDayApp.path(
model=Election,
path='/election/{id}',
)
def get_election(app, id):
return ElectionCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=Candidate,
path='/candidate/{id}',
converters=dict(
id=UUID
)
)
def get_candidate(app, id):
return CandidateCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=List,
path='/list/{id}',
converters=dict(
id=UUID
)
)
def get_list(app, id):
return ListCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=ElectionCompound,
path='/elections/{id}'
)
def get_election_compound(app, id):
return ElectionCompoundCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=Vote,
path='/vote/{id}'
)
def get_vote(app, id):
return VoteCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=Ballot,
path='/ballot/{id}',
converters=dict(
id=UUID
)
)
def get_ballot(app, id):
return BallotCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=Subscriber,
path='/subscriber/{id}',
converters=dict(
id=UUID
)
)
def get_subscriber(app, id):
return SubscriberCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=UploadToken,
path='/upload-token/{id}',
converters=dict(
id=UUID
)
)
def get_upload_token(app, id):
return UploadTokenCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=DataSource,
path='/data-source/{id}',
converters=dict(
id=UUID
)
)
def get_data_source(app, id):
return DataSourceCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=DataSourceItem,
path='/data-source-item/{id}',
converters=dict(
id=UUID
)
)
def get_data_source_item(app, id):
return DataSourceItemCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=ArchivedResultCollection,
path='/archive/{date}'
)
def get_archive_by_year(app, date):
return ArchivedResultCollection(app.session(), date)
@ElectionDayApp.path(
model=SearchableArchivedResultCollection,
path='archive-search/{item_type}',
converters=dict(
from_date=extended_date_converter,
to_date=extended_date_converter,
domains=[str],
answers=[str],
page=int
)
)
def get_archive_search(
app,
from_date=None,
to_date=None,
answers=None,
item_type=None,
domains=None,
term=None,
page=0
):
return SearchableArchivedResultCollection.for_item_type(
app.session(),
item_type,
to_date=to_date,
from_date=from_date,
answers=answers,
domains=domains,
term=term,
page=page
)
@ElectionDayApp.path(
model=SiteLocale,
path='/locale/{locale}'
)
def get_locale(request, app, locale, to=None):
to = to or request.link(app.principal)
return SiteLocale.for_path(app, locale, to)
@ElectionDayApp.path(
model=ScreenCollection,
path='/manage/screens',
converters=dict(
page=int
)
)
def get_manage_screens(app, page=0):
return ScreenCollection(app.session(), page)
@ElectionDayApp.path(
model=Screen,
path='/screen/{number}',
converters=dict(
number=int
)
)
def get_screen(app, number):
return ScreenCollection(app.session()).by_number(number)
| 23.340909
| 78
| 0.717346
|
from onegov.ballot import Ballot
from onegov.ballot import BallotCollection
from onegov.ballot import Candidate
from onegov.ballot import CandidateCollection
from onegov.ballot import Election
from onegov.ballot import ElectionCollection
from onegov.ballot import ElectionCompound
from onegov.ballot import ElectionCompoundCollection
from onegov.ballot import List
from onegov.ballot import ListCollection
from onegov.ballot import Vote
from onegov.ballot import VoteCollection
from onegov.core.converters import extended_date_converter
from onegov.core.i18n import SiteLocale
from onegov.election_day import ElectionDayApp
from onegov.election_day.collections import ArchivedResultCollection
from onegov.election_day.collections import DataSourceCollection
from onegov.election_day.collections import DataSourceItemCollection
from onegov.election_day.collections import EmailSubscriberCollection
from onegov.election_day.collections import ScreenCollection
from onegov.election_day.collections import SearchableArchivedResultCollection
from onegov.election_day.collections import SmsSubscriberCollection
from onegov.election_day.collections import SubscriberCollection
from onegov.election_day.collections import UploadTokenCollection
from onegov.election_day.models import DataSource
from onegov.election_day.models import DataSourceItem
from onegov.election_day.models import Principal
from onegov.election_day.models import Screen
from onegov.election_day.models import Subscriber
from onegov.election_day.models import UploadToken
from onegov.user import Auth
from uuid import UUID
@ElectionDayApp.path(
model=Auth,
path='/auth'
)
def get_auth(request, to='/'):
return Auth.from_request(request, to)
@ElectionDayApp.path(
model=Principal,
path='/'
)
def get_principal(app):
return app.principal
@ElectionDayApp.path(
model=ElectionCollection,
path='/manage/elections',
converters=dict(
page=int
)
)
def get_manage_elections(app, page=0):
return ElectionCollection(app.session(), page=page)
@ElectionDayApp.path(
model=ElectionCompoundCollection,
path='/manage/election-compounds',
converters=dict(
page=int
)
)
def get_manage_election_compsites(app, page=0):
return ElectionCompoundCollection(app.session(), page=page)
@ElectionDayApp.path(
model=VoteCollection,
path='/manage/votes',
converters=dict(
page=int
)
)
def get_manage_votes(app, page=0):
return VoteCollection(app.session(), page=page)
@ElectionDayApp.path(
model=SmsSubscriberCollection,
path='/manage/subscribers/sms',
converters=dict(
page=int
)
)
def get_manage_sms_subscribers(app, page=0, term=None):
return SmsSubscriberCollection(app.session(), page=page, term=term)
@ElectionDayApp.path(
model=EmailSubscriberCollection,
path='/manage/subscribers/email',
converters=dict(
page=int
)
)
def get_manage_email_subscribers(app, page=0, term=None):
return EmailSubscriberCollection(app.session(), page=page, term=term)
@ElectionDayApp.path(
model=UploadTokenCollection,
path='/manage/upload-tokens'
)
def get_manage_upload_tokens(app):
return UploadTokenCollection(app.session())
@ElectionDayApp.path(
model=DataSourceCollection,
path='/manage/sources',
converters=dict(
page=int
)
)
def get_manage_data_sources(app, page=0):
return DataSourceCollection(app.session(), page=page)
@ElectionDayApp.path(
model=DataSourceItemCollection,
path='/manage/source/{id}/items',
converters=dict(
id=UUID,
page=int
)
)
def get_manage_data_source_items(app, id, page=0):
return DataSourceItemCollection(app.session(), id, page=page)
@ElectionDayApp.path(
model=Election,
path='/election/{id}',
)
def get_election(app, id):
return ElectionCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=Candidate,
path='/candidate/{id}',
converters=dict(
id=UUID
)
)
def get_candidate(app, id):
return CandidateCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=List,
path='/list/{id}',
converters=dict(
id=UUID
)
)
def get_list(app, id):
return ListCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=ElectionCompound,
path='/elections/{id}'
)
def get_election_compound(app, id):
return ElectionCompoundCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=Vote,
path='/vote/{id}'
)
def get_vote(app, id):
return VoteCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=Ballot,
path='/ballot/{id}',
converters=dict(
id=UUID
)
)
def get_ballot(app, id):
return BallotCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=Subscriber,
path='/subscriber/{id}',
converters=dict(
id=UUID
)
)
def get_subscriber(app, id):
return SubscriberCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=UploadToken,
path='/upload-token/{id}',
converters=dict(
id=UUID
)
)
def get_upload_token(app, id):
return UploadTokenCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=DataSource,
path='/data-source/{id}',
converters=dict(
id=UUID
)
)
def get_data_source(app, id):
return DataSourceCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=DataSourceItem,
path='/data-source-item/{id}',
converters=dict(
id=UUID
)
)
def get_data_source_item(app, id):
return DataSourceItemCollection(app.session()).by_id(id)
@ElectionDayApp.path(
model=ArchivedResultCollection,
path='/archive/{date}'
)
def get_archive_by_year(app, date):
return ArchivedResultCollection(app.session(), date)
@ElectionDayApp.path(
model=SearchableArchivedResultCollection,
path='archive-search/{item_type}',
converters=dict(
from_date=extended_date_converter,
to_date=extended_date_converter,
domains=[str],
answers=[str],
page=int
)
)
def get_archive_search(
app,
from_date=None,
to_date=None,
answers=None,
item_type=None,
domains=None,
term=None,
page=0
):
return SearchableArchivedResultCollection.for_item_type(
app.session(),
item_type,
to_date=to_date,
from_date=from_date,
answers=answers,
domains=domains,
term=term,
page=page
)
@ElectionDayApp.path(
model=SiteLocale,
path='/locale/{locale}'
)
def get_locale(request, app, locale, to=None):
to = to or request.link(app.principal)
return SiteLocale.for_path(app, locale, to)
@ElectionDayApp.path(
model=ScreenCollection,
path='/manage/screens',
converters=dict(
page=int
)
)
def get_manage_screens(app, page=0):
return ScreenCollection(app.session(), page)
@ElectionDayApp.path(
model=Screen,
path='/screen/{number}',
converters=dict(
number=int
)
)
def get_screen(app, number):
return ScreenCollection(app.session()).by_number(number)
| true
| true
|
f70a220499257b977fc553bef7627d7bfd552431
| 31,854
|
py
|
Python
|
selfdrive/controls/controlsd.py
|
jauderho/openpilot
|
9720dbe9b94a409d1540ec624b1deb29a5f37c8b
|
[
"MIT"
] | null | null | null |
selfdrive/controls/controlsd.py
|
jauderho/openpilot
|
9720dbe9b94a409d1540ec624b1deb29a5f37c8b
|
[
"MIT"
] | 65
|
2021-06-28T21:29:20.000Z
|
2021-09-16T21:19:17.000Z
|
selfdrive/controls/controlsd.py
|
jauderho/openpilot
|
9720dbe9b94a409d1540ec624b1deb29a5f37c8b
|
[
"MIT"
] | null | null | null |
#!/usr/bin/env python3
import os
import math
from numbers import Number
from cereal import car, log
from common.numpy_fast import clip
from common.realtime import sec_since_boot, config_realtime_process, Priority, Ratekeeper, DT_CTRL
from common.profiler import Profiler
from common.params import Params, put_nonblocking
import cereal.messaging as messaging
from selfdrive.config import Conversions as CV
from selfdrive.swaglog import cloudlog
from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.car.car_helpers import get_car, get_startup_event, get_one_can
from selfdrive.controls.lib.lane_planner import CAMERA_OFFSET
from selfdrive.controls.lib.drive_helpers import update_v_cruise, initialize_v_cruise
from selfdrive.controls.lib.drive_helpers import get_lag_adjusted_curvature
from selfdrive.controls.lib.longcontrol import LongControl
from selfdrive.controls.lib.latcontrol_pid import LatControlPID
from selfdrive.controls.lib.latcontrol_indi import LatControlINDI
from selfdrive.controls.lib.latcontrol_lqr import LatControlLQR
from selfdrive.controls.lib.latcontrol_angle import LatControlAngle
from selfdrive.controls.lib.events import Events, ET
from selfdrive.controls.lib.alertmanager import AlertManager, set_offroad_alert
from selfdrive.controls.lib.vehicle_model import VehicleModel
from selfdrive.locationd.calibrationd import Calibration
from selfdrive.hardware import HARDWARE, TICI, EON
from selfdrive.manager.process_config import managed_processes
SOFT_DISABLE_TIME = 3 # seconds
LDW_MIN_SPEED = 31 * CV.MPH_TO_MS
LANE_DEPARTURE_THRESHOLD = 0.1
STEER_ANGLE_SATURATION_TIMEOUT = 1.0 / DT_CTRL
STEER_ANGLE_SATURATION_THRESHOLD = 2.5 # Degrees
REPLAY = "REPLAY" in os.environ
SIMULATION = "SIMULATION" in os.environ
NOSENSOR = "NOSENSOR" in os.environ
IGNORE_PROCESSES = {"rtshield", "uploader", "deleter", "loggerd", "logmessaged", "tombstoned",
"logcatd", "proclogd", "clocksd", "updated", "timezoned", "manage_athenad"} | \
{k for k, v in managed_processes.items() if not v.enabled}
ACTUATOR_FIELDS = set(car.CarControl.Actuators.schema.fields.keys())
ThermalStatus = log.DeviceState.ThermalStatus
State = log.ControlsState.OpenpilotState
PandaType = log.PandaState.PandaType
Desire = log.LateralPlan.Desire
LaneChangeState = log.LateralPlan.LaneChangeState
LaneChangeDirection = log.LateralPlan.LaneChangeDirection
EventName = car.CarEvent.EventName
ButtonEvent = car.CarState.ButtonEvent
SafetyModel = car.CarParams.SafetyModel
IGNORED_SAFETY_MODES = [SafetyModel.silent, SafetyModel.noOutput]
class Controls:
def __init__(self, sm=None, pm=None, can_sock=None):
config_realtime_process(4 if TICI else 3, Priority.CTRL_HIGH)
# Setup sockets
self.pm = pm
if self.pm is None:
self.pm = messaging.PubMaster(['sendcan', 'controlsState', 'carState',
'carControl', 'carEvents', 'carParams'])
self.camera_packets = ["roadCameraState", "driverCameraState"]
if TICI:
self.camera_packets.append("wideRoadCameraState")
params = Params()
self.joystick_mode = params.get_bool("JoystickDebugMode")
joystick_packet = ['testJoystick'] if self.joystick_mode else []
self.sm = sm
if self.sm is None:
ignore = ['driverCameraState', 'managerState'] if SIMULATION else None
self.sm = messaging.SubMaster(['deviceState', 'pandaStates', 'peripheralState', 'modelV2', 'liveCalibration',
'driverMonitoringState', 'longitudinalPlan', 'lateralPlan', 'liveLocationKalman',
'managerState', 'liveParameters', 'radarState'] + self.camera_packets + joystick_packet,
ignore_alive=ignore, ignore_avg_freq=['radarState', 'longitudinalPlan'])
self.can_sock = can_sock
if can_sock is None:
can_timeout = None if os.environ.get('NO_CAN_TIMEOUT', False) else 100
self.can_sock = messaging.sub_sock('can', timeout=can_timeout)
if TICI:
self.log_sock = messaging.sub_sock('androidLog')
# wait for one pandaState and one CAN packet
print("Waiting for CAN messages...")
get_one_can(self.can_sock)
self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'])
# read params
self.is_metric = params.get_bool("IsMetric")
self.is_ldw_enabled = params.get_bool("IsLdwEnabled")
community_feature_toggle = params.get_bool("CommunityFeaturesToggle")
openpilot_enabled_toggle = params.get_bool("OpenpilotEnabledToggle")
passive = params.get_bool("Passive") or not openpilot_enabled_toggle
# detect sound card presence and ensure successful init
sounds_available = HARDWARE.get_sound_card_online()
car_recognized = self.CP.carName != 'mock'
controller_available = self.CI.CC is not None and not passive and not self.CP.dashcamOnly
community_feature = self.CP.communityFeature or \
self.CP.fingerprintSource == car.CarParams.FingerprintSource.can
community_feature_disallowed = community_feature and (not community_feature_toggle)
self.read_only = not car_recognized or not controller_available or \
self.CP.dashcamOnly or community_feature_disallowed
if self.read_only:
safety_config = car.CarParams.SafetyConfig.new_message()
safety_config.safetyModel = car.CarParams.SafetyModel.noOutput
self.CP.safetyConfigs = [safety_config]
# Write CarParams for radard
cp_bytes = self.CP.to_bytes()
params.put("CarParams", cp_bytes)
put_nonblocking("CarParamsCache", cp_bytes)
self.CC = car.CarControl.new_message()
self.AM = AlertManager()
self.events = Events()
self.LoC = LongControl(self.CP)
self.VM = VehicleModel(self.CP)
if self.CP.steerControlType == car.CarParams.SteerControlType.angle:
self.LaC = LatControlAngle(self.CP)
elif self.CP.lateralTuning.which() == 'pid':
self.LaC = LatControlPID(self.CP, self.CI)
elif self.CP.lateralTuning.which() == 'indi':
self.LaC = LatControlINDI(self.CP)
elif self.CP.lateralTuning.which() == 'lqr':
self.LaC = LatControlLQR(self.CP)
self.initialized = False
self.state = State.disabled
self.enabled = False
self.active = False
self.can_rcv_error = False
self.soft_disable_timer = 0
self.v_cruise_kph = 255
self.v_cruise_kph_last = 0
self.mismatch_counter = 0
self.cruise_mismatch_counter = 0
self.can_rcv_error_counter = 0
self.last_blinker_frame = 0
self.saturated_count = 0
self.distance_traveled = 0
self.last_functional_fan_frame = 0
self.events_prev = []
self.current_alert_types = [ET.PERMANENT]
self.logged_comm_issue = False
self.button_timers = {ButtonEvent.Type.decelCruise: 0, ButtonEvent.Type.accelCruise: 0}
self.last_actuators = car.CarControl.Actuators.new_message()
# TODO: no longer necessary, aside from process replay
self.sm['liveParameters'].valid = True
self.startup_event = get_startup_event(car_recognized, controller_available, len(self.CP.carFw) > 0)
if not sounds_available:
self.events.add(EventName.soundsUnavailable, static=True)
if community_feature_disallowed and car_recognized and not self.CP.dashcamOnly:
self.events.add(EventName.communityFeatureDisallowed, static=True)
if not car_recognized:
self.events.add(EventName.carUnrecognized, static=True)
if len(self.CP.carFw) > 0:
set_offroad_alert("Offroad_CarUnrecognized", True)
else:
set_offroad_alert("Offroad_NoFirmware", True)
elif self.read_only:
self.events.add(EventName.dashcamMode, static=True)
elif self.joystick_mode:
self.events.add(EventName.joystickDebug, static=True)
self.startup_event = None
# controlsd is driven by can recv, expected at 100Hz
self.rk = Ratekeeper(100, print_delay_threshold=None)
self.prof = Profiler(False) # off by default
def update_events(self, CS):
"""Compute carEvents from carState"""
self.events.clear()
self.events.add_from_msg(CS.events)
self.events.add_from_msg(self.sm['driverMonitoringState'].events)
# Handle startup event
if self.startup_event is not None:
self.events.add(self.startup_event)
self.startup_event = None
# Don't add any more events if not initialized
if not self.initialized:
self.events.add(EventName.controlsInitializing)
return
# Create events for battery, temperature, disk space, and memory
if EON and (self.sm['peripheralState'].pandaType != PandaType.uno) and \
self.sm['deviceState'].batteryPercent < 1 and self.sm['deviceState'].chargingError:
# at zero percent battery, while discharging, OP should not allowed
self.events.add(EventName.lowBattery)
if self.sm['deviceState'].thermalStatus >= ThermalStatus.red:
self.events.add(EventName.overheat)
if self.sm['deviceState'].freeSpacePercent < 7 and not SIMULATION:
# under 7% of space free no enable allowed
self.events.add(EventName.outOfSpace)
# TODO: make tici threshold the same
if self.sm['deviceState'].memoryUsagePercent > (90 if TICI else 65) and not SIMULATION:
self.events.add(EventName.lowMemory)
# TODO: enable this once loggerd CPU usage is more reasonable
#cpus = list(self.sm['deviceState'].cpuUsagePercent)[:(-1 if EON else None)]
#if max(cpus, default=0) > 95 and not SIMULATION:
# self.events.add(EventName.highCpuUsage)
# Alert if fan isn't spinning for 5 seconds
if self.sm['peripheralState'].pandaType in [PandaType.uno, PandaType.dos]:
if self.sm['peripheralState'].fanSpeedRpm == 0 and self.sm['deviceState'].fanSpeedPercentDesired > 50:
if (self.sm.frame - self.last_functional_fan_frame) * DT_CTRL > 5.0:
self.events.add(EventName.fanMalfunction)
else:
self.last_functional_fan_frame = self.sm.frame
# Handle calibration status
cal_status = self.sm['liveCalibration'].calStatus
if cal_status != Calibration.CALIBRATED:
if cal_status == Calibration.UNCALIBRATED:
self.events.add(EventName.calibrationIncomplete)
else:
self.events.add(EventName.calibrationInvalid)
# Handle lane change
if self.sm['lateralPlan'].laneChangeState == LaneChangeState.preLaneChange:
direction = self.sm['lateralPlan'].laneChangeDirection
if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \
(CS.rightBlindspot and direction == LaneChangeDirection.right):
self.events.add(EventName.laneChangeBlocked)
else:
if direction == LaneChangeDirection.left:
self.events.add(EventName.preLaneChangeLeft)
else:
self.events.add(EventName.preLaneChangeRight)
elif self.sm['lateralPlan'].laneChangeState in [LaneChangeState.laneChangeStarting,
LaneChangeState.laneChangeFinishing]:
self.events.add(EventName.laneChange)
if not CS.canValid:
self.events.add(EventName.canError)
for i, pandaState in enumerate(self.sm['pandaStates']):
# All pandas must match the list of safetyConfigs, and if outside this list, must be silent or noOutput
if i < len(self.CP.safetyConfigs):
safety_mismatch = pandaState.safetyModel != self.CP.safetyConfigs[i].safetyModel or pandaState.safetyParam != self.CP.safetyConfigs[i].safetyParam
else:
safety_mismatch = pandaState.safetyModel not in IGNORED_SAFETY_MODES
if safety_mismatch or self.mismatch_counter >= 200:
self.events.add(EventName.controlsMismatch)
if log.PandaState.FaultType.relayMalfunction in pandaState.faults:
self.events.add(EventName.relayMalfunction)
# Check for HW or system issues
if len(self.sm['radarState'].radarErrors):
self.events.add(EventName.radarFault)
elif not self.sm.valid["pandaStates"]:
self.events.add(EventName.usbError)
elif not self.sm.all_alive_and_valid() or self.can_rcv_error:
self.events.add(EventName.commIssue)
if not self.logged_comm_issue:
invalid = [s for s, valid in self.sm.valid.items() if not valid]
not_alive = [s for s, alive in self.sm.alive.items() if not alive]
cloudlog.event("commIssue", invalid=invalid, not_alive=not_alive)
self.logged_comm_issue = True
else:
self.logged_comm_issue = False
if not self.sm['liveParameters'].valid:
self.events.add(EventName.vehicleModelInvalid)
if not self.sm['lateralPlan'].mpcSolutionValid:
self.events.add(EventName.plannerError)
if not self.sm['liveLocationKalman'].sensorsOK and not NOSENSOR:
if self.sm.frame > 5 / DT_CTRL: # Give locationd some time to receive all the inputs
self.events.add(EventName.sensorDataInvalid)
if not self.sm['liveLocationKalman'].posenetOK:
self.events.add(EventName.posenetInvalid)
if not self.sm['liveLocationKalman'].deviceStable:
self.events.add(EventName.deviceFalling)
for pandaState in self.sm['pandaStates']:
if log.PandaState.FaultType.relayMalfunction in pandaState.faults:
self.events.add(EventName.relayMalfunction)
if not REPLAY:
# Check for mismatch between openpilot and car's PCM
cruise_mismatch = CS.cruiseState.enabled and (not self.enabled or not self.CP.pcmCruise)
self.cruise_mismatch_counter = self.cruise_mismatch_counter + 1 if cruise_mismatch else 0
if self.cruise_mismatch_counter > int(3. / DT_CTRL):
self.events.add(EventName.cruiseMismatch)
# Check for FCW
stock_long_is_braking = self.enabled and not self.CP.openpilotLongitudinalControl and CS.aEgo < -1.5
model_fcw = self.sm['modelV2'].meta.hardBrakePredicted and not CS.brakePressed and not stock_long_is_braking
planner_fcw = self.sm['longitudinalPlan'].fcw and self.enabled
if planner_fcw or model_fcw:
self.events.add(EventName.fcw)
if TICI:
logs = messaging.drain_sock(self.log_sock, wait_for_one=False)
messages = []
for m in logs:
try:
messages.append(m.androidLog.message)
except UnicodeDecodeError:
pass
for err in ["ERROR_CRC", "ERROR_ECC", "ERROR_STREAM_UNDERFLOW", "APPLY FAILED"]:
for m in messages:
if err not in m:
continue
csid = m.split("CSID:")[-1].split(" ")[0]
evt = {"0": EventName.roadCameraError, "1": EventName.wideRoadCameraError,
"2": EventName.driverCameraError}.get(csid, None)
if evt is not None:
self.events.add(evt)
# TODO: fix simulator
if not SIMULATION:
if not NOSENSOR:
if not self.sm['liveLocationKalman'].gpsOK and (self.distance_traveled > 1000):
# Not show in first 1 km to allow for driving out of garage. This event shows after 5 minutes
self.events.add(EventName.noGps)
if not self.sm.all_alive(self.camera_packets):
self.events.add(EventName.cameraMalfunction)
if self.sm['modelV2'].frameDropPerc > 20:
self.events.add(EventName.modeldLagging)
if self.sm['liveLocationKalman'].excessiveResets:
self.events.add(EventName.localizerMalfunction)
# Check if all manager processes are running
not_running = {p.name for p in self.sm['managerState'].processes if not p.running}
if self.sm.rcv_frame['managerState'] and (not_running - IGNORE_PROCESSES):
self.events.add(EventName.processNotRunning)
# Only allow engagement with brake pressed when stopped behind another stopped car
speeds = self.sm['longitudinalPlan'].speeds
if len(speeds) > 1:
v_future = speeds[-1]
else:
v_future = 100.0
if CS.brakePressed and v_future >= self.CP.vEgoStarting \
and self.CP.openpilotLongitudinalControl and CS.vEgo < 0.3:
self.events.add(EventName.noTarget)
def data_sample(self):
"""Receive data from sockets and update carState"""
# Update carState from CAN
can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True)
CS = self.CI.update(self.CC, can_strs)
self.sm.update(0)
all_valid = CS.canValid and self.sm.all_alive_and_valid()
if not self.initialized and (all_valid or self.sm.frame * DT_CTRL > 3.5 or SIMULATION):
if not self.read_only:
self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan'])
self.initialized = True
Params().put_bool("ControlsReady", True)
# Check for CAN timeout
if not can_strs:
self.can_rcv_error_counter += 1
self.can_rcv_error = True
else:
self.can_rcv_error = False
# When the panda and controlsd do not agree on controls_allowed
# we want to disengage openpilot. However the status from the panda goes through
# another socket other than the CAN messages and one can arrive earlier than the other.
# Therefore we allow a mismatch for two samples, then we trigger the disengagement.
if not self.enabled:
self.mismatch_counter = 0
# All pandas not in silent mode must have controlsAllowed when openpilot is enabled
if any(not ps.controlsAllowed and self.enabled for ps in self.sm['pandaStates']
if ps.safetyModel not in IGNORED_SAFETY_MODES):
self.mismatch_counter += 1
self.distance_traveled += CS.vEgo * DT_CTRL
return CS
def state_transition(self, CS):
"""Compute conditional state transitions and execute actions on state transitions"""
self.v_cruise_kph_last = self.v_cruise_kph
# if stock cruise is completely disabled, then we can use our own set speed logic
if not self.CP.pcmCruise:
self.v_cruise_kph = update_v_cruise(self.v_cruise_kph, CS.buttonEvents, self.button_timers, self.enabled, self.is_metric)
elif self.CP.pcmCruise and CS.cruiseState.enabled:
self.v_cruise_kph = CS.cruiseState.speed * CV.MS_TO_KPH
# decrement the soft disable timer at every step, as it's reset on
# entrance in SOFT_DISABLING state
self.soft_disable_timer = max(0, self.soft_disable_timer - 1)
self.current_alert_types = [ET.PERMANENT]
# ENABLED, PRE ENABLING, SOFT DISABLING
if self.state != State.disabled:
# user and immediate disable always have priority in a non-disabled state
if self.events.any(ET.USER_DISABLE):
self.state = State.disabled
self.current_alert_types.append(ET.USER_DISABLE)
elif self.events.any(ET.IMMEDIATE_DISABLE):
self.state = State.disabled
self.current_alert_types.append(ET.IMMEDIATE_DISABLE)
else:
# ENABLED
if self.state == State.enabled:
if self.events.any(ET.SOFT_DISABLE):
self.state = State.softDisabling
self.soft_disable_timer = int(SOFT_DISABLE_TIME / DT_CTRL)
self.current_alert_types.append(ET.SOFT_DISABLE)
# SOFT DISABLING
elif self.state == State.softDisabling:
if not self.events.any(ET.SOFT_DISABLE):
# no more soft disabling condition, so go back to ENABLED
self.state = State.enabled
elif self.events.any(ET.SOFT_DISABLE) and self.soft_disable_timer > 0:
self.current_alert_types.append(ET.SOFT_DISABLE)
elif self.soft_disable_timer <= 0:
self.state = State.disabled
# PRE ENABLING
elif self.state == State.preEnabled:
if not self.events.any(ET.PRE_ENABLE):
self.state = State.enabled
else:
self.current_alert_types.append(ET.PRE_ENABLE)
# DISABLED
elif self.state == State.disabled:
if self.events.any(ET.ENABLE):
if self.events.any(ET.NO_ENTRY):
self.current_alert_types.append(ET.NO_ENTRY)
else:
if self.events.any(ET.PRE_ENABLE):
self.state = State.preEnabled
else:
self.state = State.enabled
self.current_alert_types.append(ET.ENABLE)
self.v_cruise_kph = initialize_v_cruise(CS.vEgo, CS.buttonEvents, self.v_cruise_kph_last)
# Check if actuators are enabled
self.active = self.state == State.enabled or self.state == State.softDisabling
if self.active:
self.current_alert_types.append(ET.WARNING)
# Check if openpilot is engaged
self.enabled = self.active or self.state == State.preEnabled
def state_control(self, CS):
"""Given the state, this function returns an actuators packet"""
# Update VehicleModel
params = self.sm['liveParameters']
x = max(params.stiffnessFactor, 0.1)
sr = max(params.steerRatio, 0.1)
self.VM.update_params(x, sr)
lat_plan = self.sm['lateralPlan']
long_plan = self.sm['longitudinalPlan']
actuators = car.CarControl.Actuators.new_message()
actuators.longControlState = self.LoC.long_control_state
if CS.leftBlinker or CS.rightBlinker:
self.last_blinker_frame = self.sm.frame
# State specific actions
if not self.active:
self.LaC.reset()
self.LoC.reset(v_pid=CS.vEgo)
if not self.joystick_mode:
# accel PID loop
pid_accel_limits = self.CI.get_pid_accel_limits(self.CP, CS.vEgo, self.v_cruise_kph * CV.KPH_TO_MS)
actuators.accel = self.LoC.update(self.active, CS, self.CP, long_plan, pid_accel_limits)
# Steering PID loop and lateral MPC
lat_active = self.active and not CS.steerWarning and not CS.steerError and CS.vEgo > self.CP.minSteerSpeed
desired_curvature, desired_curvature_rate = get_lag_adjusted_curvature(self.CP, CS.vEgo,
lat_plan.psis,
lat_plan.curvatures,
lat_plan.curvatureRates)
actuators.steer, actuators.steeringAngleDeg, lac_log = self.LaC.update(lat_active, CS, self.CP, self.VM, params, self.last_actuators,
desired_curvature, desired_curvature_rate)
else:
lac_log = log.ControlsState.LateralDebugState.new_message()
if self.sm.rcv_frame['testJoystick'] > 0 and self.active:
actuators.accel = 4.0*clip(self.sm['testJoystick'].axes[0], -1, 1)
steer = clip(self.sm['testJoystick'].axes[1], -1, 1)
# max angle is 45 for angle-based cars
actuators.steer, actuators.steeringAngleDeg = steer, steer * 45.
lac_log.active = True
lac_log.steeringAngleDeg = CS.steeringAngleDeg
lac_log.output = steer
lac_log.saturated = abs(steer) >= 0.9
# Check for difference between desired angle and angle for angle based control
angle_control_saturated = self.CP.steerControlType == car.CarParams.SteerControlType.angle and \
abs(actuators.steeringAngleDeg - CS.steeringAngleDeg) > STEER_ANGLE_SATURATION_THRESHOLD
if angle_control_saturated and not CS.steeringPressed and self.active:
self.saturated_count += 1
else:
self.saturated_count = 0
# Send a "steering required alert" if saturation count has reached the limit
if (lac_log.saturated and not CS.steeringPressed) or \
(self.saturated_count > STEER_ANGLE_SATURATION_TIMEOUT):
if len(lat_plan.dPathPoints):
# Check if we deviated from the path
# TODO use desired vs actual curvature
left_deviation = actuators.steer > 0 and lat_plan.dPathPoints[0] < -0.20
right_deviation = actuators.steer < 0 and lat_plan.dPathPoints[0] > 0.20
if left_deviation or right_deviation:
self.events.add(EventName.steerSaturated)
# Ensure no NaNs/Infs
for p in ACTUATOR_FIELDS:
attr = getattr(actuators, p)
if not isinstance(attr, Number):
continue
if not math.isfinite(attr):
cloudlog.error(f"actuators.{p} not finite {actuators.to_dict()}")
setattr(actuators, p, 0.0)
return actuators, lac_log
def update_button_timers(self, buttonEvents):
# increment timer for buttons still pressed
for k in self.button_timers.keys():
if self.button_timers[k] > 0:
self.button_timers[k] += 1
for b in buttonEvents:
if b.type.raw in self.button_timers:
self.button_timers[b.type.raw] = 1 if b.pressed else 0
def publish_logs(self, CS, start_time, actuators, lac_log):
"""Send actuators and hud commands to the car, send controlsstate and MPC logging"""
CC = car.CarControl.new_message()
CC.enabled = self.enabled
CC.active = self.active
CC.actuators = actuators
orientation_value = self.sm['liveLocationKalman'].orientationNED.value
if len(orientation_value) > 2:
CC.roll = orientation_value[0]
CC.pitch = orientation_value[1]
CC.cruiseControl.cancel = CS.cruiseState.enabled and (not self.enabled or not self.CP.pcmCruise)
if self.joystick_mode and self.sm.rcv_frame['testJoystick'] > 0 and self.sm['testJoystick'].buttons[0]:
CC.cruiseControl.cancel = True
hudControl = CC.hudControl
hudControl.setSpeed = float(self.v_cruise_kph * CV.KPH_TO_MS)
hudControl.speedVisible = self.enabled
hudControl.lanesVisible = self.enabled
hudControl.leadVisible = self.sm['longitudinalPlan'].hasLead
hudControl.rightLaneVisible = True
hudControl.leftLaneVisible = True
recent_blinker = (self.sm.frame - self.last_blinker_frame) * DT_CTRL < 5.0 # 5s blinker cooldown
ldw_allowed = self.is_ldw_enabled and CS.vEgo > LDW_MIN_SPEED and not recent_blinker \
and not self.active and self.sm['liveCalibration'].calStatus == Calibration.CALIBRATED
model_v2 = self.sm['modelV2']
desire_prediction = model_v2.meta.desirePrediction
if len(desire_prediction) and ldw_allowed:
right_lane_visible = self.sm['lateralPlan'].rProb > 0.5
left_lane_visible = self.sm['lateralPlan'].lProb > 0.5
l_lane_change_prob = desire_prediction[Desire.laneChangeLeft - 1]
r_lane_change_prob = desire_prediction[Desire.laneChangeRight - 1]
lane_lines = model_v2.laneLines
l_lane_close = left_lane_visible and (lane_lines[1].y[0] > -(1.08 + CAMERA_OFFSET))
r_lane_close = right_lane_visible and (lane_lines[2].y[0] < (1.08 - CAMERA_OFFSET))
hudControl.leftLaneDepart = bool(l_lane_change_prob > LANE_DEPARTURE_THRESHOLD and l_lane_close)
hudControl.rightLaneDepart = bool(r_lane_change_prob > LANE_DEPARTURE_THRESHOLD and r_lane_close)
if hudControl.rightLaneDepart or hudControl.leftLaneDepart:
self.events.add(EventName.ldw)
clear_event = ET.WARNING if ET.WARNING not in self.current_alert_types else None
alerts = self.events.create_alerts(self.current_alert_types, [self.CP, self.sm, self.is_metric, self.soft_disable_timer])
self.AM.add_many(self.sm.frame, alerts)
self.AM.process_alerts(self.sm.frame, clear_event)
hudControl.visualAlert = self.AM.visual_alert
if not self.read_only and self.initialized:
# send car controls over can
self.last_actuators, can_sends = self.CI.apply(CC)
self.pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=CS.canValid))
CC.actuatorsOutput = self.last_actuators
force_decel = (self.sm['driverMonitoringState'].awarenessStatus < 0.) or \
(self.state == State.softDisabling)
# Curvature & Steering angle
params = self.sm['liveParameters']
steer_angle_without_offset = math.radians(CS.steeringAngleDeg - params.angleOffsetDeg)
curvature = -self.VM.calc_curvature(steer_angle_without_offset, CS.vEgo, params.roll)
# controlsState
dat = messaging.new_message('controlsState')
dat.valid = CS.canValid
controlsState = dat.controlsState
controlsState.alertText1 = self.AM.alert_text_1
controlsState.alertText2 = self.AM.alert_text_2
controlsState.alertSize = self.AM.alert_size
controlsState.alertStatus = self.AM.alert_status
controlsState.alertBlinkingRate = self.AM.alert_rate
controlsState.alertType = self.AM.alert_type
controlsState.alertSound = self.AM.audible_alert
controlsState.canMonoTimes = list(CS.canMonoTimes)
controlsState.longitudinalPlanMonoTime = self.sm.logMonoTime['longitudinalPlan']
controlsState.lateralPlanMonoTime = self.sm.logMonoTime['lateralPlan']
controlsState.enabled = self.enabled
controlsState.active = self.active
controlsState.curvature = curvature
controlsState.state = self.state
controlsState.engageable = not self.events.any(ET.NO_ENTRY)
controlsState.longControlState = self.LoC.long_control_state
controlsState.vPid = float(self.LoC.v_pid)
controlsState.vCruise = float(self.v_cruise_kph)
controlsState.upAccelCmd = float(self.LoC.pid.p)
controlsState.uiAccelCmd = float(self.LoC.pid.i)
controlsState.ufAccelCmd = float(self.LoC.pid.f)
controlsState.cumLagMs = -self.rk.remaining * 1000.
controlsState.startMonoTime = int(start_time * 1e9)
controlsState.forceDecel = bool(force_decel)
controlsState.canErrorCounter = self.can_rcv_error_counter
lat_tuning = self.CP.lateralTuning.which()
if self.joystick_mode:
controlsState.lateralControlState.debugState = lac_log
elif self.CP.steerControlType == car.CarParams.SteerControlType.angle:
controlsState.lateralControlState.angleState = lac_log
elif lat_tuning == 'pid':
controlsState.lateralControlState.pidState = lac_log
elif lat_tuning == 'lqr':
controlsState.lateralControlState.lqrState = lac_log
elif lat_tuning == 'indi':
controlsState.lateralControlState.indiState = lac_log
self.pm.send('controlsState', dat)
# carState
car_events = self.events.to_msg()
cs_send = messaging.new_message('carState')
cs_send.valid = CS.canValid
cs_send.carState = CS
cs_send.carState.events = car_events
self.pm.send('carState', cs_send)
# carEvents - logged every second or on change
if (self.sm.frame % int(1. / DT_CTRL) == 0) or (self.events.names != self.events_prev):
ce_send = messaging.new_message('carEvents', len(self.events))
ce_send.carEvents = car_events
self.pm.send('carEvents', ce_send)
self.events_prev = self.events.names.copy()
# carParams - logged every 50 seconds (> 1 per segment)
if (self.sm.frame % int(50. / DT_CTRL) == 0):
cp_send = messaging.new_message('carParams')
cp_send.carParams = self.CP
self.pm.send('carParams', cp_send)
# carControl
cc_send = messaging.new_message('carControl')
cc_send.valid = CS.canValid
cc_send.carControl = CC
self.pm.send('carControl', cc_send)
# copy CarControl to pass to CarInterface on the next iteration
self.CC = CC
def step(self):
start_time = sec_since_boot()
self.prof.checkpoint("Ratekeeper", ignore=True)
# Sample data from sockets and get a carState
CS = self.data_sample()
self.prof.checkpoint("Sample")
self.update_events(CS)
if not self.read_only and self.initialized:
# Update control state
self.state_transition(CS)
self.prof.checkpoint("State transition")
# Compute actuators (runs PID loops and lateral MPC)
actuators, lac_log = self.state_control(CS)
self.prof.checkpoint("State Control")
# Publish data
self.publish_logs(CS, start_time, actuators, lac_log)
self.prof.checkpoint("Sent")
self.update_button_timers(CS.buttonEvents)
def controlsd_thread(self):
while True:
self.step()
self.rk.monitor_time()
self.prof.display()
def main(sm=None, pm=None, logcan=None):
controls = Controls(sm, pm, logcan)
controls.controlsd_thread()
if __name__ == "__main__":
main()
| 42.134921
| 154
| 0.706567
|
import os
import math
from numbers import Number
from cereal import car, log
from common.numpy_fast import clip
from common.realtime import sec_since_boot, config_realtime_process, Priority, Ratekeeper, DT_CTRL
from common.profiler import Profiler
from common.params import Params, put_nonblocking
import cereal.messaging as messaging
from selfdrive.config import Conversions as CV
from selfdrive.swaglog import cloudlog
from selfdrive.boardd.boardd import can_list_to_can_capnp
from selfdrive.car.car_helpers import get_car, get_startup_event, get_one_can
from selfdrive.controls.lib.lane_planner import CAMERA_OFFSET
from selfdrive.controls.lib.drive_helpers import update_v_cruise, initialize_v_cruise
from selfdrive.controls.lib.drive_helpers import get_lag_adjusted_curvature
from selfdrive.controls.lib.longcontrol import LongControl
from selfdrive.controls.lib.latcontrol_pid import LatControlPID
from selfdrive.controls.lib.latcontrol_indi import LatControlINDI
from selfdrive.controls.lib.latcontrol_lqr import LatControlLQR
from selfdrive.controls.lib.latcontrol_angle import LatControlAngle
from selfdrive.controls.lib.events import Events, ET
from selfdrive.controls.lib.alertmanager import AlertManager, set_offroad_alert
from selfdrive.controls.lib.vehicle_model import VehicleModel
from selfdrive.locationd.calibrationd import Calibration
from selfdrive.hardware import HARDWARE, TICI, EON
from selfdrive.manager.process_config import managed_processes
SOFT_DISABLE_TIME = 3
LDW_MIN_SPEED = 31 * CV.MPH_TO_MS
LANE_DEPARTURE_THRESHOLD = 0.1
STEER_ANGLE_SATURATION_TIMEOUT = 1.0 / DT_CTRL
STEER_ANGLE_SATURATION_THRESHOLD = 2.5
REPLAY = "REPLAY" in os.environ
SIMULATION = "SIMULATION" in os.environ
NOSENSOR = "NOSENSOR" in os.environ
IGNORE_PROCESSES = {"rtshield", "uploader", "deleter", "loggerd", "logmessaged", "tombstoned",
"logcatd", "proclogd", "clocksd", "updated", "timezoned", "manage_athenad"} | \
{k for k, v in managed_processes.items() if not v.enabled}
ACTUATOR_FIELDS = set(car.CarControl.Actuators.schema.fields.keys())
ThermalStatus = log.DeviceState.ThermalStatus
State = log.ControlsState.OpenpilotState
PandaType = log.PandaState.PandaType
Desire = log.LateralPlan.Desire
LaneChangeState = log.LateralPlan.LaneChangeState
LaneChangeDirection = log.LateralPlan.LaneChangeDirection
EventName = car.CarEvent.EventName
ButtonEvent = car.CarState.ButtonEvent
SafetyModel = car.CarParams.SafetyModel
IGNORED_SAFETY_MODES = [SafetyModel.silent, SafetyModel.noOutput]
class Controls:
def __init__(self, sm=None, pm=None, can_sock=None):
config_realtime_process(4 if TICI else 3, Priority.CTRL_HIGH)
self.pm = pm
if self.pm is None:
self.pm = messaging.PubMaster(['sendcan', 'controlsState', 'carState',
'carControl', 'carEvents', 'carParams'])
self.camera_packets = ["roadCameraState", "driverCameraState"]
if TICI:
self.camera_packets.append("wideRoadCameraState")
params = Params()
self.joystick_mode = params.get_bool("JoystickDebugMode")
joystick_packet = ['testJoystick'] if self.joystick_mode else []
self.sm = sm
if self.sm is None:
ignore = ['driverCameraState', 'managerState'] if SIMULATION else None
self.sm = messaging.SubMaster(['deviceState', 'pandaStates', 'peripheralState', 'modelV2', 'liveCalibration',
'driverMonitoringState', 'longitudinalPlan', 'lateralPlan', 'liveLocationKalman',
'managerState', 'liveParameters', 'radarState'] + self.camera_packets + joystick_packet,
ignore_alive=ignore, ignore_avg_freq=['radarState', 'longitudinalPlan'])
self.can_sock = can_sock
if can_sock is None:
can_timeout = None if os.environ.get('NO_CAN_TIMEOUT', False) else 100
self.can_sock = messaging.sub_sock('can', timeout=can_timeout)
if TICI:
self.log_sock = messaging.sub_sock('androidLog')
print("Waiting for CAN messages...")
get_one_can(self.can_sock)
self.CI, self.CP = get_car(self.can_sock, self.pm.sock['sendcan'])
self.is_metric = params.get_bool("IsMetric")
self.is_ldw_enabled = params.get_bool("IsLdwEnabled")
community_feature_toggle = params.get_bool("CommunityFeaturesToggle")
openpilot_enabled_toggle = params.get_bool("OpenpilotEnabledToggle")
passive = params.get_bool("Passive") or not openpilot_enabled_toggle
sounds_available = HARDWARE.get_sound_card_online()
car_recognized = self.CP.carName != 'mock'
controller_available = self.CI.CC is not None and not passive and not self.CP.dashcamOnly
community_feature = self.CP.communityFeature or \
self.CP.fingerprintSource == car.CarParams.FingerprintSource.can
community_feature_disallowed = community_feature and (not community_feature_toggle)
self.read_only = not car_recognized or not controller_available or \
self.CP.dashcamOnly or community_feature_disallowed
if self.read_only:
safety_config = car.CarParams.SafetyConfig.new_message()
safety_config.safetyModel = car.CarParams.SafetyModel.noOutput
self.CP.safetyConfigs = [safety_config]
cp_bytes = self.CP.to_bytes()
params.put("CarParams", cp_bytes)
put_nonblocking("CarParamsCache", cp_bytes)
self.CC = car.CarControl.new_message()
self.AM = AlertManager()
self.events = Events()
self.LoC = LongControl(self.CP)
self.VM = VehicleModel(self.CP)
if self.CP.steerControlType == car.CarParams.SteerControlType.angle:
self.LaC = LatControlAngle(self.CP)
elif self.CP.lateralTuning.which() == 'pid':
self.LaC = LatControlPID(self.CP, self.CI)
elif self.CP.lateralTuning.which() == 'indi':
self.LaC = LatControlINDI(self.CP)
elif self.CP.lateralTuning.which() == 'lqr':
self.LaC = LatControlLQR(self.CP)
self.initialized = False
self.state = State.disabled
self.enabled = False
self.active = False
self.can_rcv_error = False
self.soft_disable_timer = 0
self.v_cruise_kph = 255
self.v_cruise_kph_last = 0
self.mismatch_counter = 0
self.cruise_mismatch_counter = 0
self.can_rcv_error_counter = 0
self.last_blinker_frame = 0
self.saturated_count = 0
self.distance_traveled = 0
self.last_functional_fan_frame = 0
self.events_prev = []
self.current_alert_types = [ET.PERMANENT]
self.logged_comm_issue = False
self.button_timers = {ButtonEvent.Type.decelCruise: 0, ButtonEvent.Type.accelCruise: 0}
self.last_actuators = car.CarControl.Actuators.new_message()
self.sm['liveParameters'].valid = True
self.startup_event = get_startup_event(car_recognized, controller_available, len(self.CP.carFw) > 0)
if not sounds_available:
self.events.add(EventName.soundsUnavailable, static=True)
if community_feature_disallowed and car_recognized and not self.CP.dashcamOnly:
self.events.add(EventName.communityFeatureDisallowed, static=True)
if not car_recognized:
self.events.add(EventName.carUnrecognized, static=True)
if len(self.CP.carFw) > 0:
set_offroad_alert("Offroad_CarUnrecognized", True)
else:
set_offroad_alert("Offroad_NoFirmware", True)
elif self.read_only:
self.events.add(EventName.dashcamMode, static=True)
elif self.joystick_mode:
self.events.add(EventName.joystickDebug, static=True)
self.startup_event = None
self.rk = Ratekeeper(100, print_delay_threshold=None)
self.prof = Profiler(False)
def update_events(self, CS):
self.events.clear()
self.events.add_from_msg(CS.events)
self.events.add_from_msg(self.sm['driverMonitoringState'].events)
if self.startup_event is not None:
self.events.add(self.startup_event)
self.startup_event = None
if not self.initialized:
self.events.add(EventName.controlsInitializing)
return
# Create events for battery, temperature, disk space, and memory
if EON and (self.sm['peripheralState'].pandaType != PandaType.uno) and \
self.sm['deviceState'].batteryPercent < 1 and self.sm['deviceState'].chargingError:
# at zero percent battery, while discharging, OP should not allowed
self.events.add(EventName.lowBattery)
if self.sm['deviceState'].thermalStatus >= ThermalStatus.red:
self.events.add(EventName.overheat)
if self.sm['deviceState'].freeSpacePercent < 7 and not SIMULATION:
# under 7% of space free no enable allowed
self.events.add(EventName.outOfSpace)
# TODO: make tici threshold the same
if self.sm['deviceState'].memoryUsagePercent > (90 if TICI else 65) and not SIMULATION:
self.events.add(EventName.lowMemory)
# TODO: enable this once loggerd CPU usage is more reasonable
#cpus = list(self.sm['deviceState'].cpuUsagePercent)[:(-1 if EON else None)]
#if max(cpus, default=0) > 95 and not SIMULATION:
# self.events.add(EventName.highCpuUsage)
# Alert if fan isn't spinning for 5 seconds
if self.sm['peripheralState'].pandaType in [PandaType.uno, PandaType.dos]:
if self.sm['peripheralState'].fanSpeedRpm == 0 and self.sm['deviceState'].fanSpeedPercentDesired > 50:
if (self.sm.frame - self.last_functional_fan_frame) * DT_CTRL > 5.0:
self.events.add(EventName.fanMalfunction)
else:
self.last_functional_fan_frame = self.sm.frame
cal_status = self.sm['liveCalibration'].calStatus
if cal_status != Calibration.CALIBRATED:
if cal_status == Calibration.UNCALIBRATED:
self.events.add(EventName.calibrationIncomplete)
else:
self.events.add(EventName.calibrationInvalid)
if self.sm['lateralPlan'].laneChangeState == LaneChangeState.preLaneChange:
direction = self.sm['lateralPlan'].laneChangeDirection
if (CS.leftBlindspot and direction == LaneChangeDirection.left) or \
(CS.rightBlindspot and direction == LaneChangeDirection.right):
self.events.add(EventName.laneChangeBlocked)
else:
if direction == LaneChangeDirection.left:
self.events.add(EventName.preLaneChangeLeft)
else:
self.events.add(EventName.preLaneChangeRight)
elif self.sm['lateralPlan'].laneChangeState in [LaneChangeState.laneChangeStarting,
LaneChangeState.laneChangeFinishing]:
self.events.add(EventName.laneChange)
if not CS.canValid:
self.events.add(EventName.canError)
for i, pandaState in enumerate(self.sm['pandaStates']):
if i < len(self.CP.safetyConfigs):
safety_mismatch = pandaState.safetyModel != self.CP.safetyConfigs[i].safetyModel or pandaState.safetyParam != self.CP.safetyConfigs[i].safetyParam
else:
safety_mismatch = pandaState.safetyModel not in IGNORED_SAFETY_MODES
if safety_mismatch or self.mismatch_counter >= 200:
self.events.add(EventName.controlsMismatch)
if log.PandaState.FaultType.relayMalfunction in pandaState.faults:
self.events.add(EventName.relayMalfunction)
if len(self.sm['radarState'].radarErrors):
self.events.add(EventName.radarFault)
elif not self.sm.valid["pandaStates"]:
self.events.add(EventName.usbError)
elif not self.sm.all_alive_and_valid() or self.can_rcv_error:
self.events.add(EventName.commIssue)
if not self.logged_comm_issue:
invalid = [s for s, valid in self.sm.valid.items() if not valid]
not_alive = [s for s, alive in self.sm.alive.items() if not alive]
cloudlog.event("commIssue", invalid=invalid, not_alive=not_alive)
self.logged_comm_issue = True
else:
self.logged_comm_issue = False
if not self.sm['liveParameters'].valid:
self.events.add(EventName.vehicleModelInvalid)
if not self.sm['lateralPlan'].mpcSolutionValid:
self.events.add(EventName.plannerError)
if not self.sm['liveLocationKalman'].sensorsOK and not NOSENSOR:
if self.sm.frame > 5 / DT_CTRL:
self.events.add(EventName.sensorDataInvalid)
if not self.sm['liveLocationKalman'].posenetOK:
self.events.add(EventName.posenetInvalid)
if not self.sm['liveLocationKalman'].deviceStable:
self.events.add(EventName.deviceFalling)
for pandaState in self.sm['pandaStates']:
if log.PandaState.FaultType.relayMalfunction in pandaState.faults:
self.events.add(EventName.relayMalfunction)
if not REPLAY:
cruise_mismatch = CS.cruiseState.enabled and (not self.enabled or not self.CP.pcmCruise)
self.cruise_mismatch_counter = self.cruise_mismatch_counter + 1 if cruise_mismatch else 0
if self.cruise_mismatch_counter > int(3. / DT_CTRL):
self.events.add(EventName.cruiseMismatch)
# Check for FCW
stock_long_is_braking = self.enabled and not self.CP.openpilotLongitudinalControl and CS.aEgo < -1.5
model_fcw = self.sm['modelV2'].meta.hardBrakePredicted and not CS.brakePressed and not stock_long_is_braking
planner_fcw = self.sm['longitudinalPlan'].fcw and self.enabled
if planner_fcw or model_fcw:
self.events.add(EventName.fcw)
if TICI:
logs = messaging.drain_sock(self.log_sock, wait_for_one=False)
messages = []
for m in logs:
try:
messages.append(m.androidLog.message)
except UnicodeDecodeError:
pass
for err in ["ERROR_CRC", "ERROR_ECC", "ERROR_STREAM_UNDERFLOW", "APPLY FAILED"]:
for m in messages:
if err not in m:
continue
csid = m.split("CSID:")[-1].split(" ")[0]
evt = {"0": EventName.roadCameraError, "1": EventName.wideRoadCameraError,
"2": EventName.driverCameraError}.get(csid, None)
if evt is not None:
self.events.add(evt)
# TODO: fix simulator
if not SIMULATION:
if not NOSENSOR:
if not self.sm['liveLocationKalman'].gpsOK and (self.distance_traveled > 1000):
# Not show in first 1 km to allow for driving out of garage. This event shows after 5 minutes
self.events.add(EventName.noGps)
if not self.sm.all_alive(self.camera_packets):
self.events.add(EventName.cameraMalfunction)
if self.sm['modelV2'].frameDropPerc > 20:
self.events.add(EventName.modeldLagging)
if self.sm['liveLocationKalman'].excessiveResets:
self.events.add(EventName.localizerMalfunction)
# Check if all manager processes are running
not_running = {p.name for p in self.sm['managerState'].processes if not p.running}
if self.sm.rcv_frame['managerState'] and (not_running - IGNORE_PROCESSES):
self.events.add(EventName.processNotRunning)
# Only allow engagement with brake pressed when stopped behind another stopped car
speeds = self.sm['longitudinalPlan'].speeds
if len(speeds) > 1:
v_future = speeds[-1]
else:
v_future = 100.0
if CS.brakePressed and v_future >= self.CP.vEgoStarting \
and self.CP.openpilotLongitudinalControl and CS.vEgo < 0.3:
self.events.add(EventName.noTarget)
def data_sample(self):
# Update carState from CAN
can_strs = messaging.drain_sock_raw(self.can_sock, wait_for_one=True)
CS = self.CI.update(self.CC, can_strs)
self.sm.update(0)
all_valid = CS.canValid and self.sm.all_alive_and_valid()
if not self.initialized and (all_valid or self.sm.frame * DT_CTRL > 3.5 or SIMULATION):
if not self.read_only:
self.CI.init(self.CP, self.can_sock, self.pm.sock['sendcan'])
self.initialized = True
Params().put_bool("ControlsReady", True)
# Check for CAN timeout
if not can_strs:
self.can_rcv_error_counter += 1
self.can_rcv_error = True
else:
self.can_rcv_error = False
# When the panda and controlsd do not agree on controls_allowed
# we want to disengage openpilot. However the status from the panda goes through
# another socket other than the CAN messages and one can arrive earlier than the other.
# Therefore we allow a mismatch for two samples, then we trigger the disengagement.
if not self.enabled:
self.mismatch_counter = 0
# All pandas not in silent mode must have controlsAllowed when openpilot is enabled
if any(not ps.controlsAllowed and self.enabled for ps in self.sm['pandaStates']
if ps.safetyModel not in IGNORED_SAFETY_MODES):
self.mismatch_counter += 1
self.distance_traveled += CS.vEgo * DT_CTRL
return CS
def state_transition(self, CS):
self.v_cruise_kph_last = self.v_cruise_kph
# if stock cruise is completely disabled, then we can use our own set speed logic
if not self.CP.pcmCruise:
self.v_cruise_kph = update_v_cruise(self.v_cruise_kph, CS.buttonEvents, self.button_timers, self.enabled, self.is_metric)
elif self.CP.pcmCruise and CS.cruiseState.enabled:
self.v_cruise_kph = CS.cruiseState.speed * CV.MS_TO_KPH
# decrement the soft disable timer at every step, as it's reset on
self.soft_disable_timer = max(0, self.soft_disable_timer - 1)
self.current_alert_types = [ET.PERMANENT]
if self.state != State.disabled:
if self.events.any(ET.USER_DISABLE):
self.state = State.disabled
self.current_alert_types.append(ET.USER_DISABLE)
elif self.events.any(ET.IMMEDIATE_DISABLE):
self.state = State.disabled
self.current_alert_types.append(ET.IMMEDIATE_DISABLE)
else:
if self.state == State.enabled:
if self.events.any(ET.SOFT_DISABLE):
self.state = State.softDisabling
self.soft_disable_timer = int(SOFT_DISABLE_TIME / DT_CTRL)
self.current_alert_types.append(ET.SOFT_DISABLE)
elif self.state == State.softDisabling:
if not self.events.any(ET.SOFT_DISABLE):
self.state = State.enabled
elif self.events.any(ET.SOFT_DISABLE) and self.soft_disable_timer > 0:
self.current_alert_types.append(ET.SOFT_DISABLE)
elif self.soft_disable_timer <= 0:
self.state = State.disabled
elif self.state == State.preEnabled:
if not self.events.any(ET.PRE_ENABLE):
self.state = State.enabled
else:
self.current_alert_types.append(ET.PRE_ENABLE)
elif self.state == State.disabled:
if self.events.any(ET.ENABLE):
if self.events.any(ET.NO_ENTRY):
self.current_alert_types.append(ET.NO_ENTRY)
else:
if self.events.any(ET.PRE_ENABLE):
self.state = State.preEnabled
else:
self.state = State.enabled
self.current_alert_types.append(ET.ENABLE)
self.v_cruise_kph = initialize_v_cruise(CS.vEgo, CS.buttonEvents, self.v_cruise_kph_last)
self.active = self.state == State.enabled or self.state == State.softDisabling
if self.active:
self.current_alert_types.append(ET.WARNING)
self.enabled = self.active or self.state == State.preEnabled
def state_control(self, CS):
params = self.sm['liveParameters']
x = max(params.stiffnessFactor, 0.1)
sr = max(params.steerRatio, 0.1)
self.VM.update_params(x, sr)
lat_plan = self.sm['lateralPlan']
long_plan = self.sm['longitudinalPlan']
actuators = car.CarControl.Actuators.new_message()
actuators.longControlState = self.LoC.long_control_state
if CS.leftBlinker or CS.rightBlinker:
self.last_blinker_frame = self.sm.frame
if not self.active:
self.LaC.reset()
self.LoC.reset(v_pid=CS.vEgo)
if not self.joystick_mode:
pid_accel_limits = self.CI.get_pid_accel_limits(self.CP, CS.vEgo, self.v_cruise_kph * CV.KPH_TO_MS)
actuators.accel = self.LoC.update(self.active, CS, self.CP, long_plan, pid_accel_limits)
lat_active = self.active and not CS.steerWarning and not CS.steerError and CS.vEgo > self.CP.minSteerSpeed
desired_curvature, desired_curvature_rate = get_lag_adjusted_curvature(self.CP, CS.vEgo,
lat_plan.psis,
lat_plan.curvatures,
lat_plan.curvatureRates)
actuators.steer, actuators.steeringAngleDeg, lac_log = self.LaC.update(lat_active, CS, self.CP, self.VM, params, self.last_actuators,
desired_curvature, desired_curvature_rate)
else:
lac_log = log.ControlsState.LateralDebugState.new_message()
if self.sm.rcv_frame['testJoystick'] > 0 and self.active:
actuators.accel = 4.0*clip(self.sm['testJoystick'].axes[0], -1, 1)
steer = clip(self.sm['testJoystick'].axes[1], -1, 1)
actuators.steer, actuators.steeringAngleDeg = steer, steer * 45.
lac_log.active = True
lac_log.steeringAngleDeg = CS.steeringAngleDeg
lac_log.output = steer
lac_log.saturated = abs(steer) >= 0.9
angle_control_saturated = self.CP.steerControlType == car.CarParams.SteerControlType.angle and \
abs(actuators.steeringAngleDeg - CS.steeringAngleDeg) > STEER_ANGLE_SATURATION_THRESHOLD
if angle_control_saturated and not CS.steeringPressed and self.active:
self.saturated_count += 1
else:
self.saturated_count = 0
if (lac_log.saturated and not CS.steeringPressed) or \
(self.saturated_count > STEER_ANGLE_SATURATION_TIMEOUT):
if len(lat_plan.dPathPoints):
left_deviation = actuators.steer > 0 and lat_plan.dPathPoints[0] < -0.20
right_deviation = actuators.steer < 0 and lat_plan.dPathPoints[0] > 0.20
if left_deviation or right_deviation:
self.events.add(EventName.steerSaturated)
for p in ACTUATOR_FIELDS:
attr = getattr(actuators, p)
if not isinstance(attr, Number):
continue
if not math.isfinite(attr):
cloudlog.error(f"actuators.{p} not finite {actuators.to_dict()}")
setattr(actuators, p, 0.0)
return actuators, lac_log
def update_button_timers(self, buttonEvents):
for k in self.button_timers.keys():
if self.button_timers[k] > 0:
self.button_timers[k] += 1
for b in buttonEvents:
if b.type.raw in self.button_timers:
self.button_timers[b.type.raw] = 1 if b.pressed else 0
def publish_logs(self, CS, start_time, actuators, lac_log):
CC = car.CarControl.new_message()
CC.enabled = self.enabled
CC.active = self.active
CC.actuators = actuators
orientation_value = self.sm['liveLocationKalman'].orientationNED.value
if len(orientation_value) > 2:
CC.roll = orientation_value[0]
CC.pitch = orientation_value[1]
CC.cruiseControl.cancel = CS.cruiseState.enabled and (not self.enabled or not self.CP.pcmCruise)
if self.joystick_mode and self.sm.rcv_frame['testJoystick'] > 0 and self.sm['testJoystick'].buttons[0]:
CC.cruiseControl.cancel = True
hudControl = CC.hudControl
hudControl.setSpeed = float(self.v_cruise_kph * CV.KPH_TO_MS)
hudControl.speedVisible = self.enabled
hudControl.lanesVisible = self.enabled
hudControl.leadVisible = self.sm['longitudinalPlan'].hasLead
hudControl.rightLaneVisible = True
hudControl.leftLaneVisible = True
recent_blinker = (self.sm.frame - self.last_blinker_frame) * DT_CTRL < 5.0
ldw_allowed = self.is_ldw_enabled and CS.vEgo > LDW_MIN_SPEED and not recent_blinker \
and not self.active and self.sm['liveCalibration'].calStatus == Calibration.CALIBRATED
model_v2 = self.sm['modelV2']
desire_prediction = model_v2.meta.desirePrediction
if len(desire_prediction) and ldw_allowed:
right_lane_visible = self.sm['lateralPlan'].rProb > 0.5
left_lane_visible = self.sm['lateralPlan'].lProb > 0.5
l_lane_change_prob = desire_prediction[Desire.laneChangeLeft - 1]
r_lane_change_prob = desire_prediction[Desire.laneChangeRight - 1]
lane_lines = model_v2.laneLines
l_lane_close = left_lane_visible and (lane_lines[1].y[0] > -(1.08 + CAMERA_OFFSET))
r_lane_close = right_lane_visible and (lane_lines[2].y[0] < (1.08 - CAMERA_OFFSET))
hudControl.leftLaneDepart = bool(l_lane_change_prob > LANE_DEPARTURE_THRESHOLD and l_lane_close)
hudControl.rightLaneDepart = bool(r_lane_change_prob > LANE_DEPARTURE_THRESHOLD and r_lane_close)
if hudControl.rightLaneDepart or hudControl.leftLaneDepart:
self.events.add(EventName.ldw)
clear_event = ET.WARNING if ET.WARNING not in self.current_alert_types else None
alerts = self.events.create_alerts(self.current_alert_types, [self.CP, self.sm, self.is_metric, self.soft_disable_timer])
self.AM.add_many(self.sm.frame, alerts)
self.AM.process_alerts(self.sm.frame, clear_event)
hudControl.visualAlert = self.AM.visual_alert
if not self.read_only and self.initialized:
self.last_actuators, can_sends = self.CI.apply(CC)
self.pm.send('sendcan', can_list_to_can_capnp(can_sends, msgtype='sendcan', valid=CS.canValid))
CC.actuatorsOutput = self.last_actuators
force_decel = (self.sm['driverMonitoringState'].awarenessStatus < 0.) or \
(self.state == State.softDisabling)
params = self.sm['liveParameters']
steer_angle_without_offset = math.radians(CS.steeringAngleDeg - params.angleOffsetDeg)
curvature = -self.VM.calc_curvature(steer_angle_without_offset, CS.vEgo, params.roll)
dat = messaging.new_message('controlsState')
dat.valid = CS.canValid
controlsState = dat.controlsState
controlsState.alertText1 = self.AM.alert_text_1
controlsState.alertText2 = self.AM.alert_text_2
controlsState.alertSize = self.AM.alert_size
controlsState.alertStatus = self.AM.alert_status
controlsState.alertBlinkingRate = self.AM.alert_rate
controlsState.alertType = self.AM.alert_type
controlsState.alertSound = self.AM.audible_alert
controlsState.canMonoTimes = list(CS.canMonoTimes)
controlsState.longitudinalPlanMonoTime = self.sm.logMonoTime['longitudinalPlan']
controlsState.lateralPlanMonoTime = self.sm.logMonoTime['lateralPlan']
controlsState.enabled = self.enabled
controlsState.active = self.active
controlsState.curvature = curvature
controlsState.state = self.state
controlsState.engageable = not self.events.any(ET.NO_ENTRY)
controlsState.longControlState = self.LoC.long_control_state
controlsState.vPid = float(self.LoC.v_pid)
controlsState.vCruise = float(self.v_cruise_kph)
controlsState.upAccelCmd = float(self.LoC.pid.p)
controlsState.uiAccelCmd = float(self.LoC.pid.i)
controlsState.ufAccelCmd = float(self.LoC.pid.f)
controlsState.cumLagMs = -self.rk.remaining * 1000.
controlsState.startMonoTime = int(start_time * 1e9)
controlsState.forceDecel = bool(force_decel)
controlsState.canErrorCounter = self.can_rcv_error_counter
lat_tuning = self.CP.lateralTuning.which()
if self.joystick_mode:
controlsState.lateralControlState.debugState = lac_log
elif self.CP.steerControlType == car.CarParams.SteerControlType.angle:
controlsState.lateralControlState.angleState = lac_log
elif lat_tuning == 'pid':
controlsState.lateralControlState.pidState = lac_log
elif lat_tuning == 'lqr':
controlsState.lateralControlState.lqrState = lac_log
elif lat_tuning == 'indi':
controlsState.lateralControlState.indiState = lac_log
self.pm.send('controlsState', dat)
car_events = self.events.to_msg()
cs_send = messaging.new_message('carState')
cs_send.valid = CS.canValid
cs_send.carState = CS
cs_send.carState.events = car_events
self.pm.send('carState', cs_send)
if (self.sm.frame % int(1. / DT_CTRL) == 0) or (self.events.names != self.events_prev):
ce_send = messaging.new_message('carEvents', len(self.events))
ce_send.carEvents = car_events
self.pm.send('carEvents', ce_send)
self.events_prev = self.events.names.copy()
if (self.sm.frame % int(50. / DT_CTRL) == 0):
cp_send = messaging.new_message('carParams')
cp_send.carParams = self.CP
self.pm.send('carParams', cp_send)
cc_send = messaging.new_message('carControl')
cc_send.valid = CS.canValid
cc_send.carControl = CC
self.pm.send('carControl', cc_send)
self.CC = CC
def step(self):
start_time = sec_since_boot()
self.prof.checkpoint("Ratekeeper", ignore=True)
CS = self.data_sample()
self.prof.checkpoint("Sample")
self.update_events(CS)
if not self.read_only and self.initialized:
self.state_transition(CS)
self.prof.checkpoint("State transition")
actuators, lac_log = self.state_control(CS)
self.prof.checkpoint("State Control")
self.publish_logs(CS, start_time, actuators, lac_log)
self.prof.checkpoint("Sent")
self.update_button_timers(CS.buttonEvents)
def controlsd_thread(self):
while True:
self.step()
self.rk.monitor_time()
self.prof.display()
def main(sm=None, pm=None, logcan=None):
controls = Controls(sm, pm, logcan)
controls.controlsd_thread()
if __name__ == "__main__":
main()
| true
| true
|
f70a23e92e05e9cf9eeb8ad1955f0041146b7b6f
| 169
|
py
|
Python
|
78_pr9_06.py
|
AmreshTripathy/Python
|
e86420fef7f52da393be5b50ac2f13bddfeb3306
|
[
"Apache-2.0"
] | 4
|
2021-05-27T05:06:09.000Z
|
2021-06-12T17:12:47.000Z
|
78_pr9_06.py
|
AmreshTripathy/Python
|
e86420fef7f52da393be5b50ac2f13bddfeb3306
|
[
"Apache-2.0"
] | null | null | null |
78_pr9_06.py
|
AmreshTripathy/Python
|
e86420fef7f52da393be5b50ac2f13bddfeb3306
|
[
"Apache-2.0"
] | null | null | null |
with open('log.txt') as f:
text = f.read().lower()
if ('python' in text):
print ('Yes, Python is present')
else:
print ('No, Python is not present')
| 21.125
| 40
| 0.573964
|
with open('log.txt') as f:
text = f.read().lower()
if ('python' in text):
print ('Yes, Python is present')
else:
print ('No, Python is not present')
| true
| true
|
f70a243e4446ed30e1ab6f3bb466a27d6919e8aa
| 9,213
|
py
|
Python
|
game_demos/trials.py
|
LocoBunny04/Vroom-Vroom-BTS-Edition
|
6432ad6dc2578bb060543dbe91a6dafbd3a8bd52
|
[
"MIT"
] | null | null | null |
game_demos/trials.py
|
LocoBunny04/Vroom-Vroom-BTS-Edition
|
6432ad6dc2578bb060543dbe91a6dafbd3a8bd52
|
[
"MIT"
] | null | null | null |
game_demos/trials.py
|
LocoBunny04/Vroom-Vroom-BTS-Edition
|
6432ad6dc2578bb060543dbe91a6dafbd3a8bd52
|
[
"MIT"
] | null | null | null |
from PIL import Image, ImageTk
import random as rand
import turtle as trtl
# import required module
from playsound import playsound
import tkinter.messagebox
from pynput.keyboard import Key, Listener
import glob
#import prgm_image
# prgm_image_list = []
# for filename in glob.glob('/Users/khaase/Desktop/VroomFold/prgm_gif/'): #assuming gif
# im=prgm_image.open(filename)
# prgm_image_list.append(im)
wn = trtl.Screen()
#si = tk.Tk()
si = trtl.Turtle()
caller = trtl.Turtle()
st = trtl.Turtle()
rSt = trtl.Turtle()
user = trtl.Turtle()
point = trtl.Turtle()
atmpt = trtl.Turtle()
frac = trtl.Turtle()
#score = trtl.Turtle()
count = 0
rP = False #count for times restart btn is pressed
alpha = False
digit = False
caller_list = ['abrupt stop', 'speed bump','right','left','go']
caller_txt = []
#Message ="Abrupt stop = DOWN speed bump = SHIFT right = RIGHT left = LEFT go =UP"
#tkinter.messagebox.showinfo('Directions','Press "Go" to start\nabrupt stop = DOWN\nspeed bump = Return\n right = RIGHT\n left = LEFT\n go =UP\n')
#playsound('vvvcopy.wav', False)
attempt = 0
frac.ht()
atmpt.ht()
user_txt = ''
lead = ''
#wn = tk.Tk()
#wn.screensize("400x400")
# --- Window Creator ---
wn.title("Vroom Vroom: BTS EditionT")
#wn.window_height(150)
wn.setup(height=500,width=500)
wn.bgpic('prgm_image/runbtsback.gif')
wn_msg = trtl.textinput('Directions','Press "Go" to start\nabrupt stop = DOWN\nspeed bump = Return\n right = RIGHT\n left = LEFT\n go =UP\nEnter your Name for Leaderboard')
for m in wn_msg:
if m.isalpha():
alpha = True
if m.isdigit():
digit = True
if wn_msg.isdigit():
wn_msg = trtl.textinput('Directions','Press "Go" to start\nabrupt stop = DOWN\nspeed bump = Return\n right = RIGHT\n left = LEFT\n go =UP\nEnter your Name for Leaderboard')
msg_input = str(wn_msg)
#while wn_msg != wn_msg.isalpha() == False:
#wn_msg = trtl.textinput('Directions','Press "Go" to start\nabrupt stop = DOWN\nspeed bump = Return\n right = RIGHT\n left = LEFT\n go =UP\nEnter your Name for Leaderboard')
while wn_msg != msg_input:
wn_msg = trtl.textinput('Directions','Press "Go" to start\nabrupt stop = DOWN\nspeed bump = Return\n right = RIGHT\n left = LEFT\n go =UP\nEnter your Name for Leaderboard')
#caller_img ="huh_resize.gif"
#user_label = Label(wn,prgm_image=caller_img)
# ---prgm_images ---
as_img = 'prgm_image/as_resize.gif'
wn.addshape(as_img)
sb_img = "prgm_image/vSb_resize_tsp.gif"
wn.addshape(sb_img)
r_img = "prgm_image/right_resize.gif"
wn.addshape(r_img)
l_img = "prgm_image/vL_resize_tsp.gif"
wn.addshape(l_img)
go_img = "prgm_image/go_resize.gif"
wn.addshape(go_img)
caller_img = "prgm_image/huh_resize.gif"
wn.addshape(caller_img)
restart_pic = "prgm_image/restart_resize_tsp.gif"
wn.addshape(restart_pic)
start_pic = "prgm_image/st_resized.gif"
wn.addshape(start_pic)
user_pic = "prgm_image/plyr_resize_tsp.gif"
wn.addshape(user_pic)
point.ht()
#caller.ht()
# --- Functions ---
x = -191
y = 180
caller.pu()
caller.goto(x,y)
si.pu()
si.ht()
si.goto(-120,150)
rSt.shape(restart_pic)
rSt.pu()
rSt.goto(0,180)
rSt.ht()
st.shape(start_pic)
st.pu()
st.goto(0,180)
user.shape(user_pic)
user.pu()
user.goto(0,-50)
point.pu(); point.goto(145,176);atmpt.pu();atmpt.goto(160,160);frac.pu();frac.goto(165,188); frac.pd();frac.goto(150,168)
def startPress(x, y):
global attempt, count
global rP
point.clear()
caller.shape(caller_img);user.shape(user_pic)
#caller.st()
st.ht()
rSt.st()
#print('playing sound using native player')
#playsound('vvvcopy.wav')
attempt = 0
count = 0
wn.delay(100)
si.clear()
rP = False
# callerChoose()
gameMain()
# callerSoundOs()
def rStPress(x, y):
global point
global count
global attempt, rP, wn_msg, user
#print("restart cliicked")
caller.shape(caller_img)
rP = True
rSt.ht()
rst_trace(rP)
# st.st()
si.clear();point.clear();atmpt.clear()
#attempt = 0; count = 0
user.shape(user_pic)
wn_msg = ''
wn_msg = trtl.textinput('Leaderboard','Enter your Name to add to the Leaderboard')
si.clear()
wn.delay(500)
# while rP == True:
# break
# if rP == False:
# print("end")
gameMain()
# callerChoose()
st.ht()
rSt.st()
# gameMain()
def callerChoose():
global point
global caller_txt
si.ht()
caller_txt = rand.choice(caller_list)
si.write(caller_txt,font=("Arial",15))
print(caller_txt)
callerSoundOs()
wn.delay(10)
playsound('audio/vvvSoftfade.wav', False)
wn.delay(100)
whilePoint()
point.clear()
point.ht()
print ('point: ', count)
#wn.delay(10)
#si.ht()
def usL():
global user_txt
user_txt = 'left'
user.shape(l_img)
def usR():
global user_txt
user_txt = 'right'
user.shape(r_img)
def usAS():
global user_txt
user_txt = 'abrupt stop'
user.shape(as_img)
def usSB():
global user_txt
user_txt = 'speed bump'
user.shape(sb_img)
def usGo():
global user_txt
user_txt = 'go'
user.shape(go_img)
def callerSoundOs():
global caller_txt
#print("cSOs")
#caller_pic = "huh_resize.gif"
if caller_txt == caller_list[0]:
#print("ab")
cAs(),playsound('audio/vDa_ASSoft.wav')
elif caller_txt == caller_list[1]:
#print("sb")
cSb(),playsound('audio/vS_sbsoft.wav')
elif caller_txt == caller_list[2]:
#print("r")
cR(),playsound('audio/vRsoft.wav')
elif caller_txt == caller_list[3]:
#print("l")
cL(),playsound('audio/vLsoft.wav')
#vroomVroom_wn.addshape(caller_pic)
#caller.shape(caller_pic)
elif caller_txt == caller_list[4]:
#print("g")
cGo(),playsound('audio/vUp_goSoft.wav')
#user change
def abruptStop():
global user_txt
user.shape(as_img)
print('user',user_txt)
usAS()
def speedBump():
global user_txt
user.shape(sb_img)
print('user',user_txt)
usSB()
def rightTurn():
global user_txt
user.shape(r_img)
print('user',user_txt)
usR()
def leftTurn():
global user_txt
user.shape(l_img)
print('user',user_txt)
usL()
def goFD():
global user_txt
user.shape(go_img)
print('user',user_txt)
usGo()
#caller change
def cAs():
caller.shape(as_img)
print('caller',caller_txt)
def cSb():
caller.shape(sb_img)
print('caller',caller_txt)
def cR():
caller.shape(r_img)
print('caller',caller_txt)
def cL():
caller.shape(l_img)
print('caller',caller_txt)
def cGo():
caller.shape(go_img)
print('caller',caller_txt)
def whilePoint():
global count, attempt
global user_txt, caller_txt
# wn.delay(200)
# print(user_txt,"wP")
# print(caller_txt,"wP")
point.ht()
if user_txt == caller_txt:
wn.delay(150)
attempt += 1
count = int(count)
count += 1
point.clear(); atmpt.clear()
atmpt.write(str(attempt),font=("Arial",15)),point.write(str(count),font=("Arial",15))
wn.delay(50)
user.shape(user_pic)
else:
wn.delay(150)
attempt += 1
count = int(count)
count -= 1
ah = str(count)
point.clear(); atmpt.clear()
atmpt.write(str(attempt),font=("Arial",15)),point.write(ah,font=("Arial",15))
wn.delay(50)
user.shape(user_pic)
#atmpt.clear()
#attempt +=1;#atmpt.write(str(attempt),font=("Arial",15))
#print('attempt',attempt)
si.clear()
point.ht()
gameMain()
def rst_trace(rP):
global lead, count, attempt
if rP:
name = wn_msg
name += ' '
#print("rst_btn pressed")
print(rP)
count = str(count)
attempt = str(attempt)
lead = name + str( '' + count + '/' + attempt + '\n')
print(lead)
f = open("Leaderboard.txt","a") #'password' always have to be a str
f.write(lead) #checks to see if code is a completed string consisting of letters and numbers
f.close()
count = 0
attempt = 0
gameMain()
rSt.st()
# wn.onkeypress(rightTurn,'Right')
# wn.onkeypress(leftTurn,'Left')
# wn.onkeypress(goFD,'Up')
# wn.onkeypress(abruptStop,'Down')
# rP = False
def gameMain():
global count, attempt
caller.shape(caller_img);user.shape(user_pic)
# caller.st()
si.ht()
wn.onkeypress(rightTurn,'Right')
wn.onkeypress(leftTurn,'Left')
wn.onkeypress(goFD,'Up')
wn.onkeypress(abruptStop,'Down')
#point.st()
#caller.shapesize(10)
# for t in attempt:
if attempt < 100:
wn.delay(200)
point.ht()
callerChoose()
point.clear()
atmpt.clear()
else:
print("You've reached 100 attempts: ")
exit()
# break
# count = 0
# attempt = 0
# user.shape(user_pic)
# caller.shape(caller_img)
# point.clear()
# atmpt.clear()
# wn.delay(200)
# callerChoose()
# gameMain()
st.onclick(startPress)
rSt.onclick(rStPress)
wn.onkeypress(speedBump,'Return')
#wn.onkeypress(gameMain,'BackSpace')
wn.listen()
wn.mainloop()
| 24.437666
| 177
| 0.629762
|
from PIL import Image, ImageTk
import random as rand
import turtle as trtl
from playsound import playsound
import tkinter.messagebox
from pynput.keyboard import Key, Listener
import glob
Screen()
si = trtl.Turtle()
caller = trtl.Turtle()
st = trtl.Turtle()
rSt = trtl.Turtle()
user = trtl.Turtle()
point = trtl.Turtle()
atmpt = trtl.Turtle()
frac = trtl.Turtle()
count = 0
rP = False
alpha = False
digit = False
caller_list = ['abrupt stop', 'speed bump','right','left','go']
caller_txt = []
attempt = 0
frac.ht()
atmpt.ht()
user_txt = ''
lead = ''
wn.title("Vroom Vroom: BTS EditionT")
wn.setup(height=500,width=500)
wn.bgpic('prgm_image/runbtsback.gif')
wn_msg = trtl.textinput('Directions','Press "Go" to start\nabrupt stop = DOWN\nspeed bump = Return\n right = RIGHT\n left = LEFT\n go =UP\nEnter your Name for Leaderboard')
for m in wn_msg:
if m.isalpha():
alpha = True
if m.isdigit():
digit = True
if wn_msg.isdigit():
wn_msg = trtl.textinput('Directions','Press "Go" to start\nabrupt stop = DOWN\nspeed bump = Return\n right = RIGHT\n left = LEFT\n go =UP\nEnter your Name for Leaderboard')
msg_input = str(wn_msg)
while wn_msg != msg_input:
wn_msg = trtl.textinput('Directions','Press "Go" to start\nabrupt stop = DOWN\nspeed bump = Return\n right = RIGHT\n left = LEFT\n go =UP\nEnter your Name for Leaderboard')
as_img = 'prgm_image/as_resize.gif'
wn.addshape(as_img)
sb_img = "prgm_image/vSb_resize_tsp.gif"
wn.addshape(sb_img)
r_img = "prgm_image/right_resize.gif"
wn.addshape(r_img)
l_img = "prgm_image/vL_resize_tsp.gif"
wn.addshape(l_img)
go_img = "prgm_image/go_resize.gif"
wn.addshape(go_img)
caller_img = "prgm_image/huh_resize.gif"
wn.addshape(caller_img)
restart_pic = "prgm_image/restart_resize_tsp.gif"
wn.addshape(restart_pic)
start_pic = "prgm_image/st_resized.gif"
wn.addshape(start_pic)
user_pic = "prgm_image/plyr_resize_tsp.gif"
wn.addshape(user_pic)
point.ht()
x = -191
y = 180
caller.pu()
caller.goto(x,y)
si.pu()
si.ht()
si.goto(-120,150)
rSt.shape(restart_pic)
rSt.pu()
rSt.goto(0,180)
rSt.ht()
st.shape(start_pic)
st.pu()
st.goto(0,180)
user.shape(user_pic)
user.pu()
user.goto(0,-50)
point.pu(); point.goto(145,176);atmpt.pu();atmpt.goto(160,160);frac.pu();frac.goto(165,188); frac.pd();frac.goto(150,168)
def startPress(x, y):
global attempt, count
global rP
point.clear()
caller.shape(caller_img);user.shape(user_pic)
st.ht()
rSt.st()
attempt = 0
count = 0
wn.delay(100)
si.clear()
rP = False
gameMain()
def rStPress(x, y):
global point
global count
global attempt, rP, wn_msg, user
caller.shape(caller_img)
rP = True
rSt.ht()
rst_trace(rP)
si.clear();point.clear();atmpt.clear()
user.shape(user_pic)
wn_msg = ''
wn_msg = trtl.textinput('Leaderboard','Enter your Name to add to the Leaderboard')
si.clear()
wn.delay(500)
gameMain()
st.ht()
rSt.st()
def callerChoose():
global point
global caller_txt
si.ht()
caller_txt = rand.choice(caller_list)
si.write(caller_txt,font=("Arial",15))
print(caller_txt)
callerSoundOs()
wn.delay(10)
playsound('audio/vvvSoftfade.wav', False)
wn.delay(100)
whilePoint()
point.clear()
point.ht()
print ('point: ', count)
def usL():
global user_txt
user_txt = 'left'
user.shape(l_img)
def usR():
global user_txt
user_txt = 'right'
user.shape(r_img)
def usAS():
global user_txt
user_txt = 'abrupt stop'
user.shape(as_img)
def usSB():
global user_txt
user_txt = 'speed bump'
user.shape(sb_img)
def usGo():
global user_txt
user_txt = 'go'
user.shape(go_img)
def callerSoundOs():
global caller_txt
if caller_txt == caller_list[0]:
cAs(),playsound('audio/vDa_ASSoft.wav')
elif caller_txt == caller_list[1]:
cSb(),playsound('audio/vS_sbsoft.wav')
elif caller_txt == caller_list[2]:
cR(),playsound('audio/vRsoft.wav')
elif caller_txt == caller_list[3]:
cL(),playsound('audio/vLsoft.wav')
elif caller_txt == caller_list[4]:
cGo(),playsound('audio/vUp_goSoft.wav')
def abruptStop():
global user_txt
user.shape(as_img)
print('user',user_txt)
usAS()
def speedBump():
global user_txt
user.shape(sb_img)
print('user',user_txt)
usSB()
def rightTurn():
global user_txt
user.shape(r_img)
print('user',user_txt)
usR()
def leftTurn():
global user_txt
user.shape(l_img)
print('user',user_txt)
usL()
def goFD():
global user_txt
user.shape(go_img)
print('user',user_txt)
usGo()
def cAs():
caller.shape(as_img)
print('caller',caller_txt)
def cSb():
caller.shape(sb_img)
print('caller',caller_txt)
def cR():
caller.shape(r_img)
print('caller',caller_txt)
def cL():
caller.shape(l_img)
print('caller',caller_txt)
def cGo():
caller.shape(go_img)
print('caller',caller_txt)
def whilePoint():
global count, attempt
global user_txt, caller_txt
point.ht()
if user_txt == caller_txt:
wn.delay(150)
attempt += 1
count = int(count)
count += 1
point.clear(); atmpt.clear()
atmpt.write(str(attempt),font=("Arial",15)),point.write(str(count),font=("Arial",15))
wn.delay(50)
user.shape(user_pic)
else:
wn.delay(150)
attempt += 1
count = int(count)
count -= 1
ah = str(count)
point.clear(); atmpt.clear()
atmpt.write(str(attempt),font=("Arial",15)),point.write(ah,font=("Arial",15))
wn.delay(50)
user.shape(user_pic)
Main()
def rst_trace(rP):
global lead, count, attempt
if rP:
name = wn_msg
name += ' '
print(rP)
count = str(count)
attempt = str(attempt)
lead = name + str( '' + count + '/' + attempt + '\n')
print(lead)
f = open("Leaderboard.txt","a")
f.write(lead)
f.close()
count = 0
attempt = 0
gameMain()
rSt.st()
def gameMain():
global count, attempt
caller.shape(caller_img);user.shape(user_pic)
si.ht()
wn.onkeypress(rightTurn,'Right')
wn.onkeypress(leftTurn,'Left')
wn.onkeypress(goFD,'Up')
wn.onkeypress(abruptStop,'Down')
if attempt < 100:
wn.delay(200)
point.ht()
callerChoose()
point.clear()
atmpt.clear()
else:
print("You've reached 100 attempts: ")
exit()
# break
# count = 0
# attempt = 0
# user.shape(user_pic)
# caller.shape(caller_img)
# point.clear()
# atmpt.clear()
# wn.delay(200)
# callerChoose()
# gameMain()
st.onclick(startPress)
rSt.onclick(rStPress)
wn.onkeypress(speedBump,'Return')
#wn.onkeypress(gameMain,'BackSpace')
wn.listen()
wn.mainloop()
| true
| true
|
f70a25425109eb80765b11c658857ded6d821f1e
| 7,576
|
py
|
Python
|
weather_sp/splitter_pipeline/file_splitters.py
|
shriekdj/weather-tools
|
882b832a3ae7fdaff432cfec5915e94919bd4262
|
[
"Apache-2.0"
] | null | null | null |
weather_sp/splitter_pipeline/file_splitters.py
|
shriekdj/weather-tools
|
882b832a3ae7fdaff432cfec5915e94919bd4262
|
[
"Apache-2.0"
] | null | null | null |
weather_sp/splitter_pipeline/file_splitters.py
|
shriekdj/weather-tools
|
882b832a3ae7fdaff432cfec5915e94919bd4262
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2021 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
#
# https://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 abc
import logging
import shutil
import tempfile
import typing as t
from contextlib import contextmanager
import apache_beam.metrics as metrics
import netCDF4 as nc
import pygrib
from apache_beam.io.filesystems import FileSystems
from .file_name_utils import OutFileInfo
logger = logging.getLogger(__name__)
class SplitKey(t.NamedTuple):
levelType: str
shortname: str
def __str__(self):
if not self.levelType:
return f'field {self.shortname}'
return f'{self.levelType} - field {self.shortname}'
class FileSplitter(abc.ABC):
"""Base class for weather file splitters."""
def __init__(self, input_path: str, output_info: OutFileInfo,
force_split: bool = False, level: int = logging.INFO):
self.input_path = input_path
self.output_info = output_info
self.force_split = force_split
self.logger = logging.getLogger(f'{__name__}.{type(self).__name__}')
self.logger.setLevel(level)
self.logger.debug('Splitter for path=%s, output base=%s',
self.input_path, self.output_info)
@abc.abstractmethod
def split_data(self) -> None:
raise NotImplementedError()
@contextmanager
def _copy_to_local_file(self) -> t.Iterator[t.IO]:
with FileSystems().open(self.input_path) as source_file:
with tempfile.NamedTemporaryFile() as dest_file:
shutil.copyfileobj(source_file, dest_file)
dest_file.flush()
yield dest_file
def _copy_dataset_to_storage(self, src_file: t.IO, target: str):
with FileSystems().create(target) as dest_file:
shutil.copyfileobj(src_file, dest_file)
def _get_output_file_path(self, key: SplitKey) -> str:
split_keys = key._asdict()
if self.output_info.output_dir and key.levelType:
split_keys['levelType'] = f'{key.levelType}_'
return self.output_info.file_name_template.format(**split_keys)
def should_skip(self):
"""Skip splitting if the data was already split."""
if self.force_split:
return False
for match in FileSystems().match([
self._get_output_file_path(SplitKey('', '**')),
self._get_output_file_path(SplitKey('**', '**')),
]):
if len(match.metadata_list) > 0:
return True
return False
class GribSplitter(FileSplitter):
def split_data(self) -> None:
outputs = dict()
if self.should_skip():
metrics.Metrics.counter('file_splitters', 'skipped').inc()
self.logger.info('Skipping %s, file already split.', repr(self.input_path))
return
with self._open_grib_locally() as grbs:
for grb in grbs:
key = SplitKey(grb.typeOfLevel, grb.shortName)
if key not in outputs:
metrics.Metrics.counter('file_splitters',
f'grib: {key}').inc()
outputs[key] = self._open_outfile(key)
outputs[key].write(grb.tostring())
outputs[key].flush()
for out in outputs.values():
out.close()
self.logger.info('split %s into %d files', self.input_path, len(outputs))
@contextmanager
def _open_grib_locally(self) -> t.Iterator[t.Iterator[pygrib.gribmessage]]:
with self._copy_to_local_file() as local_file:
yield pygrib.open(local_file.name)
def _open_outfile(self, key: SplitKey):
return FileSystems.create(self._get_output_file_path(key))
class NetCdfSplitter(FileSplitter):
def split_data(self) -> None:
if self.should_skip():
metrics.Metrics.counter('file_splitters', 'skipped').inc()
self.logger.info('Skipping %s, file already split.', repr(self.input_path))
return
with self._open_dataset_locally() as nc_data:
fields = [var for var in nc_data.variables.keys() if
var not in nc_data.dimensions.keys()]
for field in fields:
self._create_netcdf_dataset_for_variable(nc_data, field)
self.logger.info('split %s into %d files', self.input_path, len(fields))
@contextmanager
def _open_dataset_locally(self) -> t.Iterator[nc.Dataset]:
with self._copy_to_local_file() as local_file:
yield nc.Dataset(local_file.name, 'r')
def _create_netcdf_dataset_for_variable(self, dataset: nc.Dataset,
variable: str) -> None:
metrics.Metrics.counter('file_splitters',
f'netcdf output for {variable}').inc()
with tempfile.NamedTemporaryFile() as temp_file:
with nc.Dataset(temp_file.name, 'w',
format=dataset.file_format) as dest:
dest.setncatts(dataset.__dict__)
for name, dim in dataset.dimensions.items():
dest.createDimension(
name,
(len(dim) if not dim.isunlimited() else None))
include = [var for var in dataset.dimensions.keys()]
include.append(variable)
for name, var in dataset.variables.items():
if name in include:
var = dataset.variables[name]
dest.createVariable(name, var.datatype, var.dimensions)
# copy variable attributes all at once via dictionary
dest[name].setncatts(dataset[name].__dict__)
dest[name][:] = dataset[name][:]
temp_file.flush()
self._copy_dataset_to_storage(temp_file,
self._get_output_file_path(
SplitKey('', variable)))
class DrySplitter(FileSplitter):
def split_data(self) -> None:
self.logger.info('input file: %s - output scheme: %s',
self.input_path, self._get_output_file_path(SplitKey('level', 'shortname')))
def get_splitter(file_path: str, output_info: OutFileInfo, dry_run: bool, force_split: bool = False) -> FileSplitter:
if dry_run:
return DrySplitter(file_path, output_info)
with FileSystems.open(file_path) as f:
header = f.read(4)
if b'GRIB' in header:
metrics.Metrics.counter('get_splitter', 'grib').inc()
return GribSplitter(file_path, output_info, force_split)
# See the NetCDF Spec docs:
# https://docs.unidata.ucar.edu/netcdf-c/current/faq.html#How-can-I-tell-which-format-a-netCDF-file-uses
if b'CDF' in header or b'HDF' in header:
metrics.Metrics.counter('get_splitter', 'netcdf').inc()
return NetCdfSplitter(file_path, output_info, force_split)
raise ValueError(f'cannot determine if file {file_path!r} is Grib or NetCDF.')
| 38.653061
| 117
| 0.619192
|
import abc
import logging
import shutil
import tempfile
import typing as t
from contextlib import contextmanager
import apache_beam.metrics as metrics
import netCDF4 as nc
import pygrib
from apache_beam.io.filesystems import FileSystems
from .file_name_utils import OutFileInfo
logger = logging.getLogger(__name__)
class SplitKey(t.NamedTuple):
levelType: str
shortname: str
def __str__(self):
if not self.levelType:
return f'field {self.shortname}'
return f'{self.levelType} - field {self.shortname}'
class FileSplitter(abc.ABC):
def __init__(self, input_path: str, output_info: OutFileInfo,
force_split: bool = False, level: int = logging.INFO):
self.input_path = input_path
self.output_info = output_info
self.force_split = force_split
self.logger = logging.getLogger(f'{__name__}.{type(self).__name__}')
self.logger.setLevel(level)
self.logger.debug('Splitter for path=%s, output base=%s',
self.input_path, self.output_info)
@abc.abstractmethod
def split_data(self) -> None:
raise NotImplementedError()
@contextmanager
def _copy_to_local_file(self) -> t.Iterator[t.IO]:
with FileSystems().open(self.input_path) as source_file:
with tempfile.NamedTemporaryFile() as dest_file:
shutil.copyfileobj(source_file, dest_file)
dest_file.flush()
yield dest_file
def _copy_dataset_to_storage(self, src_file: t.IO, target: str):
with FileSystems().create(target) as dest_file:
shutil.copyfileobj(src_file, dest_file)
def _get_output_file_path(self, key: SplitKey) -> str:
split_keys = key._asdict()
if self.output_info.output_dir and key.levelType:
split_keys['levelType'] = f'{key.levelType}_'
return self.output_info.file_name_template.format(**split_keys)
def should_skip(self):
if self.force_split:
return False
for match in FileSystems().match([
self._get_output_file_path(SplitKey('', '**')),
self._get_output_file_path(SplitKey('**', '**')),
]):
if len(match.metadata_list) > 0:
return True
return False
class GribSplitter(FileSplitter):
def split_data(self) -> None:
outputs = dict()
if self.should_skip():
metrics.Metrics.counter('file_splitters', 'skipped').inc()
self.logger.info('Skipping %s, file already split.', repr(self.input_path))
return
with self._open_grib_locally() as grbs:
for grb in grbs:
key = SplitKey(grb.typeOfLevel, grb.shortName)
if key not in outputs:
metrics.Metrics.counter('file_splitters',
f'grib: {key}').inc()
outputs[key] = self._open_outfile(key)
outputs[key].write(grb.tostring())
outputs[key].flush()
for out in outputs.values():
out.close()
self.logger.info('split %s into %d files', self.input_path, len(outputs))
@contextmanager
def _open_grib_locally(self) -> t.Iterator[t.Iterator[pygrib.gribmessage]]:
with self._copy_to_local_file() as local_file:
yield pygrib.open(local_file.name)
def _open_outfile(self, key: SplitKey):
return FileSystems.create(self._get_output_file_path(key))
class NetCdfSplitter(FileSplitter):
def split_data(self) -> None:
if self.should_skip():
metrics.Metrics.counter('file_splitters', 'skipped').inc()
self.logger.info('Skipping %s, file already split.', repr(self.input_path))
return
with self._open_dataset_locally() as nc_data:
fields = [var for var in nc_data.variables.keys() if
var not in nc_data.dimensions.keys()]
for field in fields:
self._create_netcdf_dataset_for_variable(nc_data, field)
self.logger.info('split %s into %d files', self.input_path, len(fields))
@contextmanager
def _open_dataset_locally(self) -> t.Iterator[nc.Dataset]:
with self._copy_to_local_file() as local_file:
yield nc.Dataset(local_file.name, 'r')
def _create_netcdf_dataset_for_variable(self, dataset: nc.Dataset,
variable: str) -> None:
metrics.Metrics.counter('file_splitters',
f'netcdf output for {variable}').inc()
with tempfile.NamedTemporaryFile() as temp_file:
with nc.Dataset(temp_file.name, 'w',
format=dataset.file_format) as dest:
dest.setncatts(dataset.__dict__)
for name, dim in dataset.dimensions.items():
dest.createDimension(
name,
(len(dim) if not dim.isunlimited() else None))
include = [var for var in dataset.dimensions.keys()]
include.append(variable)
for name, var in dataset.variables.items():
if name in include:
var = dataset.variables[name]
dest.createVariable(name, var.datatype, var.dimensions)
dest[name].setncatts(dataset[name].__dict__)
dest[name][:] = dataset[name][:]
temp_file.flush()
self._copy_dataset_to_storage(temp_file,
self._get_output_file_path(
SplitKey('', variable)))
class DrySplitter(FileSplitter):
def split_data(self) -> None:
self.logger.info('input file: %s - output scheme: %s',
self.input_path, self._get_output_file_path(SplitKey('level', 'shortname')))
def get_splitter(file_path: str, output_info: OutFileInfo, dry_run: bool, force_split: bool = False) -> FileSplitter:
if dry_run:
return DrySplitter(file_path, output_info)
with FileSystems.open(file_path) as f:
header = f.read(4)
if b'GRIB' in header:
metrics.Metrics.counter('get_splitter', 'grib').inc()
return GribSplitter(file_path, output_info, force_split)
metrics.Metrics.counter('get_splitter', 'netcdf').inc()
return NetCdfSplitter(file_path, output_info, force_split)
raise ValueError(f'cannot determine if file {file_path!r} is Grib or NetCDF.')
| true
| true
|
f70a259508b1b45d8cb1c78e697950e6b5a3fd78
| 11,877
|
py
|
Python
|
bionic/datatypes.py
|
square/bionic
|
357da8e2806996427e0aa6efd08f7ea8c5198f9b
|
[
"Apache-2.0"
] | 98
|
2019-08-29T21:38:44.000Z
|
2022-01-26T04:59:57.000Z
|
bionic/datatypes.py
|
square/bionic
|
357da8e2806996427e0aa6efd08f7ea8c5198f9b
|
[
"Apache-2.0"
] | 143
|
2019-09-11T15:32:17.000Z
|
2021-06-08T21:48:30.000Z
|
bionic/datatypes.py
|
square/bionic
|
357da8e2806996427e0aa6efd08f7ea8c5198f9b
|
[
"Apache-2.0"
] | 20
|
2019-09-13T18:13:03.000Z
|
2021-12-03T19:51:01.000Z
|
"""
Contains various data structures used by Bionic's infrastructure.
"""
import attr
from .utils.misc import ImmutableSequence, ImmutableMapping
@attr.s(frozen=True)
class EntityDefinition:
"""
Describes the immutable properties of an entity. These properties generally have
to do with the entity's "contract": the assumptions other parts of the system can
make about its value. However, this does *not* include the way the entity's value
is determined; this is configured separately and can be changed more easily.
Attributes
----------
name: string
The name of the entity.
protocol: Protocol
The protocol to use when serializing and deserializing entity values on disk.
doc: string
A human-readable description of the entity.
optional_should_memoize: boolean or None
Whether the entity should be memoized, or None if the global default should be
used.
optional_should_persist: boolean or None
Whether the entity should be persisted, or None if the global default should be
used
needs_caching: boolean
Indicates that some kind of caching needs to be enabled for this entity (either
persistence or memoization).
"""
name = attr.ib()
protocol = attr.ib()
doc = attr.ib()
optional_should_memoize = attr.ib()
optional_should_persist = attr.ib()
needs_caching = attr.ib(default=False)
@attr.s(frozen=True)
class DescriptorMetadata:
"""
Holds extra data we might need when working with a descriptor.
Similar to an EntityDefinition, but can apply to non-entity descriptors, and also
incorporates information from the global configuration. (For example,
EntityDefinition has an `optional_should_memoize` field which describes the
user's memoization preferences, if any; this class has a `should_memoize` field
which describes what we'll actually do, based on both user preferences and the
global configuration.)
Attributes
----------
protocol: Protocol
The protocol to use when serializing and deserializing descriptor values on
disk.
doc: string
A human-readable description of the descriptor.
should_memoize: boolean
Whether the value should be memoized for the lifetime of its Flow instance.
should_memoize_for_query: boolean
Whether the value should be memoized for the lifetime of a Flow.get() call.
(Only relevant if ``should_memoize`` is False.)
should_persist: boolean
Whether the value should be persisted.
is_composite: boolean
Whether the value contains other descriptor values. (If so, it's desirable to
get it out of memory quickly.)
"""
protocol = attr.ib()
doc = attr.ib()
should_memoize = attr.ib(default=False)
should_memoize_for_query = attr.ib(default=False)
should_persist = attr.ib(default=False)
is_composite = attr.ib(default=True)
@attr.s(frozen=True)
class TaskKey:
"""
A unique identifier for a Task.
"""
dnode = attr.ib()
case_key = attr.ib()
def evolve(self, **kwargs):
return attr.evolve(self, **kwargs)
def __str__(self):
args_str = ", ".join(f"{name}={value}" for name, value in self.case_key.items())
return f"{self.dnode.to_descriptor(near_commas=True)}({args_str})"
@attr.s(frozen=True)
class Task:
"""
A unit of work. Can have dependencies, which are referred to via their
TaskKeys.
Attributes
----------
key: TaskKey
Key corresponding to the output value computed by this task.
dep_keys: list of TaskKeys
Keys corresponding to the input values required by this task.
compute_func: function taking a single ``dep_values`` argument
Generates output values based on the passed input values.
is_simple_lookup: boolean
Whether this task consists of simply looking up the fixed value of an entity;
used to determine what message to log when this task is computed.
"""
key = attr.ib()
dep_keys = attr.ib(converter=tuple)
compute_func = attr.ib()
is_simple_lookup = attr.ib(default=False)
def compute(self, dep_values):
return self.compute_func(dep_values)
@property
def can_be_serialized(self):
return not self.is_simple_lookup
def evolve(self, **kwargs):
return attr.evolve(self, **kwargs)
def __repr__(self):
return f"Task({self.key!r}, {self.dep_keys!r})"
@attr.s(frozen=True)
class Result:
"""
Represents one value for one entity.
"""
task_key = attr.ib()
value = attr.ib()
local_artifact = attr.ib()
value_is_missing = attr.ib(default=False)
def __repr__(self):
return f"Result({self.task_key!r}, {self.value!r})"
@attr.s(frozen=True)
class Artifact:
"""
Represents a serialized, file-like artifact, either on a local filesystem or in a
cloud object store.
"""
url: str = attr.ib()
content_hash: str = attr.ib()
def evolve(self, **kwargs):
return attr.evolve(self, **kwargs)
class CaseKeySpace(ImmutableSequence):
"""
A set of CaseKey names (without values) -- represents a space of possible
CaseKeys.
"""
def __init__(self, names=None):
if names is None:
names = []
super(CaseKeySpace, self).__init__(sorted(names))
def union(self, other):
return CaseKeySpace(set(self).union(other))
def intersection(self, other):
return CaseKeySpace(name for name in self if name in other)
def difference(self, other):
return CaseKeySpace(name for name in self if name not in other)
def select(self, case_key):
return case_key.project(self)
@classmethod
def union_all(cls, spaces):
if not spaces:
return CaseKeySpace([])
names = set()
for space in spaces:
names = names.union(space)
return CaseKeySpace(names)
@classmethod
def intersection_all(cls, spaces):
if not spaces:
raise ValueError("Can't take the intersection of zero spaces")
names = None
for space in spaces:
if names is None:
names = set(spaces)
else:
names = names.intersection(space)
return CaseKeySpace(names)
def __repr__(self):
return f'CaseKeySpace({", ".join(repr(name) for name in self)})'
class CaseKey(ImmutableMapping):
"""
A collection of name-token pairs that uniquely identifies a case.
"""
def __init__(self, name_token_pairs):
tokens_by_name = {name: token for name, token in name_token_pairs}
super(CaseKey, self).__init__(tokens_by_name)
self._name_token_pairs = name_token_pairs
self.tokens = tokens_by_name
self.space = CaseKeySpace(list(tokens_by_name.keys()))
self.missing_names = [
# None is a sentinel value used to indicate that no value is available.
# Normally I would prefer to represent missing-ness out-of-band by making the
# `missing_names` field the source of truth here, but the relational methods like
# `project` are cleaner when we use a sentinel value.
name
for name, token in name_token_pairs
if token is None
]
self.has_missing_values = len(self.missing_names) > 0
def project(self, key_space):
return CaseKey(
[
(name, token)
for name, token in self._name_token_pairs
if name in key_space
]
)
def drop(self, key_space):
return CaseKey(
[
(name, token)
for name, token in self._name_token_pairs
if name not in key_space
]
)
def merge(self, other):
tokens_by_name = {name: token for name, token in self._name_token_pairs}
for name, token in other._name_token_pairs:
if name in tokens_by_name:
assert token == tokens_by_name[name]
else:
tokens_by_name[name] = token
return CaseKey([(name, token) for name, token in tokens_by_name.items()])
def __repr__(self):
args_str = ", ".join(f"{name}={token}" for name, token in self.items())
return f"CaseKey({args_str})"
class ResultGroup(ImmutableSequence):
"""
Represents a collection of Results, distinguished by their CaseKeys. Each
CaseKey should have the same set of names.
"""
def __init__(self, results, key_space):
super(ResultGroup, self).__init__(results)
self.key_space = key_space
def __repr__(self):
return f"ResultGroup({list(self)!r})"
def str_from_version_value(value):
if value is None:
return "0"
elif isinstance(value, int):
return str(value)
elif isinstance(value, str):
return value
else:
raise ValueError(f"Version values must be str, int, or None: got {value!r}")
# The CodeVersion and CodeFingerprint classs are used (indirectly) by
# persistence.ArtifactMetadataRecord and can be serialized to YAML and stored in the
# persistent cache. That means if we add new fields to them, we also need to update
# persistence.CACHE_SCHEMA_VERSION.
# TODO Should we just move these classes to persistence.py as well?
@attr.s(frozen=True)
class CodeVersion:
"""
Contains the user-designated version of a piece of code, consisting of a
major and a minor version string, and a boolean that indicates whether it
includes the bytecode. The convention is that changing the major version
indicates a functional change, while changing the minor version indicates a
nonfunctional change. If ``includes_bytecode`` is True, then the major version
is understood to implicitly include the bytecode of the code as well.
"""
major: str = attr.ib(converter=str_from_version_value)
minor: str = attr.ib(converter=str_from_version_value)
includes_bytecode: bool = attr.ib(converter=attr.converters.default_if_none(True))
@attr.s(frozen=True)
class CodeVersioningPolicy:
"""
Contains the version of the user entity function with any additional settings
related to the version. For now, we only have one setting that affects the
analysis-time behavior of the version.
"""
version: CodeVersion = attr.ib()
suppress_bytecode_warnings: bool = attr.ib(
converter=attr.converters.default_if_none(False)
)
@attr.s(frozen=True)
class CodeFingerprint:
"""
A collection of characteristics attempting to uniquely identify a function.
Attributes
----------
version: CodeVersion
A version identifier provided by the user.
bytecode_hash: str
A hash of the function's Python bytecode.
orig_flow_name: str
The name of the flow in which this function was originally defined.
is_identity: bool
If True, indicates that this function is equivalent to the identity function:
it takes one argument and returns it unchanged.
"""
version: CodeVersion = attr.ib()
bytecode_hash: str = attr.ib()
orig_flow_name: str = attr.ib()
is_identity: bool = attr.ib(default=False)
@attr.s(frozen=True)
class VersioningPolicy:
"""
Encodes the versioning rules to use when computing entity values.
"""
check_for_bytecode_errors = attr.ib()
treat_bytecode_as_functional = attr.ib()
ignore_bytecode_exceptions = attr.ib()
@attr.s(frozen=True)
class FunctionAttributes:
"""
Describes properties of a Python function.
"""
code_fingerprint = attr.ib()
code_versioning_policy = attr.ib()
changes_per_run = attr.ib()
aip_task_config = attr.ib()
| 31.337731
| 93
| 0.66473
|
import attr
from .utils.misc import ImmutableSequence, ImmutableMapping
@attr.s(frozen=True)
class EntityDefinition:
name = attr.ib()
protocol = attr.ib()
doc = attr.ib()
optional_should_memoize = attr.ib()
optional_should_persist = attr.ib()
needs_caching = attr.ib(default=False)
@attr.s(frozen=True)
class DescriptorMetadata:
protocol = attr.ib()
doc = attr.ib()
should_memoize = attr.ib(default=False)
should_memoize_for_query = attr.ib(default=False)
should_persist = attr.ib(default=False)
is_composite = attr.ib(default=True)
@attr.s(frozen=True)
class TaskKey:
dnode = attr.ib()
case_key = attr.ib()
def evolve(self, **kwargs):
return attr.evolve(self, **kwargs)
def __str__(self):
args_str = ", ".join(f"{name}={value}" for name, value in self.case_key.items())
return f"{self.dnode.to_descriptor(near_commas=True)}({args_str})"
@attr.s(frozen=True)
class Task:
key = attr.ib()
dep_keys = attr.ib(converter=tuple)
compute_func = attr.ib()
is_simple_lookup = attr.ib(default=False)
def compute(self, dep_values):
return self.compute_func(dep_values)
@property
def can_be_serialized(self):
return not self.is_simple_lookup
def evolve(self, **kwargs):
return attr.evolve(self, **kwargs)
def __repr__(self):
return f"Task({self.key!r}, {self.dep_keys!r})"
@attr.s(frozen=True)
class Result:
task_key = attr.ib()
value = attr.ib()
local_artifact = attr.ib()
value_is_missing = attr.ib(default=False)
def __repr__(self):
return f"Result({self.task_key!r}, {self.value!r})"
@attr.s(frozen=True)
class Artifact:
url: str = attr.ib()
content_hash: str = attr.ib()
def evolve(self, **kwargs):
return attr.evolve(self, **kwargs)
class CaseKeySpace(ImmutableSequence):
def __init__(self, names=None):
if names is None:
names = []
super(CaseKeySpace, self).__init__(sorted(names))
def union(self, other):
return CaseKeySpace(set(self).union(other))
def intersection(self, other):
return CaseKeySpace(name for name in self if name in other)
def difference(self, other):
return CaseKeySpace(name for name in self if name not in other)
def select(self, case_key):
return case_key.project(self)
@classmethod
def union_all(cls, spaces):
if not spaces:
return CaseKeySpace([])
names = set()
for space in spaces:
names = names.union(space)
return CaseKeySpace(names)
@classmethod
def intersection_all(cls, spaces):
if not spaces:
raise ValueError("Can't take the intersection of zero spaces")
names = None
for space in spaces:
if names is None:
names = set(spaces)
else:
names = names.intersection(space)
return CaseKeySpace(names)
def __repr__(self):
return f'CaseKeySpace({", ".join(repr(name) for name in self)})'
class CaseKey(ImmutableMapping):
def __init__(self, name_token_pairs):
tokens_by_name = {name: token for name, token in name_token_pairs}
super(CaseKey, self).__init__(tokens_by_name)
self._name_token_pairs = name_token_pairs
self.tokens = tokens_by_name
self.space = CaseKeySpace(list(tokens_by_name.keys()))
self.missing_names = [
# None is a sentinel value used to indicate that no value is available.
# Normally I would prefer to represent missing-ness out-of-band by making the
# `missing_names` field the source of truth here, but the relational methods like
# `project` are cleaner when we use a sentinel value.
name
for name, token in name_token_pairs
if token is None
]
self.has_missing_values = len(self.missing_names) > 0
def project(self, key_space):
return CaseKey(
[
(name, token)
for name, token in self._name_token_pairs
if name in key_space
]
)
def drop(self, key_space):
return CaseKey(
[
(name, token)
for name, token in self._name_token_pairs
if name not in key_space
]
)
def merge(self, other):
tokens_by_name = {name: token for name, token in self._name_token_pairs}
for name, token in other._name_token_pairs:
if name in tokens_by_name:
assert token == tokens_by_name[name]
else:
tokens_by_name[name] = token
return CaseKey([(name, token) for name, token in tokens_by_name.items()])
def __repr__(self):
args_str = ", ".join(f"{name}={token}" for name, token in self.items())
return f"CaseKey({args_str})"
class ResultGroup(ImmutableSequence):
def __init__(self, results, key_space):
super(ResultGroup, self).__init__(results)
self.key_space = key_space
def __repr__(self):
return f"ResultGroup({list(self)!r})"
def str_from_version_value(value):
if value is None:
return "0"
elif isinstance(value, int):
return str(value)
elif isinstance(value, str):
return value
else:
raise ValueError(f"Version values must be str, int, or None: got {value!r}")
# The CodeVersion and CodeFingerprint classs are used (indirectly) by
# persistence.ArtifactMetadataRecord and can be serialized to YAML and stored in the
# persistent cache. That means if we add new fields to them, we also need to update
# persistence.CACHE_SCHEMA_VERSION.
# TODO Should we just move these classes to persistence.py as well?
@attr.s(frozen=True)
class CodeVersion:
major: str = attr.ib(converter=str_from_version_value)
minor: str = attr.ib(converter=str_from_version_value)
includes_bytecode: bool = attr.ib(converter=attr.converters.default_if_none(True))
@attr.s(frozen=True)
class CodeVersioningPolicy:
version: CodeVersion = attr.ib()
suppress_bytecode_warnings: bool = attr.ib(
converter=attr.converters.default_if_none(False)
)
@attr.s(frozen=True)
class CodeFingerprint:
version: CodeVersion = attr.ib()
bytecode_hash: str = attr.ib()
orig_flow_name: str = attr.ib()
is_identity: bool = attr.ib(default=False)
@attr.s(frozen=True)
class VersioningPolicy:
check_for_bytecode_errors = attr.ib()
treat_bytecode_as_functional = attr.ib()
ignore_bytecode_exceptions = attr.ib()
@attr.s(frozen=True)
class FunctionAttributes:
code_fingerprint = attr.ib()
code_versioning_policy = attr.ib()
changes_per_run = attr.ib()
aip_task_config = attr.ib()
| true
| true
|
f70a25b71d5f45ade2f220d3d461d927e22f6bd6
| 677
|
py
|
Python
|
rqt_ocare/scripts/capture_image.py
|
SiChiTong/ros_ocare_nav
|
5df256ae9f398cb05f3d0d8c9be124fed5fc2c26
|
[
"Apache-2.0"
] | null | null | null |
rqt_ocare/scripts/capture_image.py
|
SiChiTong/ros_ocare_nav
|
5df256ae9f398cb05f3d0d8c9be124fed5fc2c26
|
[
"Apache-2.0"
] | null | null | null |
rqt_ocare/scripts/capture_image.py
|
SiChiTong/ros_ocare_nav
|
5df256ae9f398cb05f3d0d8c9be124fed5fc2c26
|
[
"Apache-2.0"
] | 1
|
2018-08-17T03:31:44.000Z
|
2018-08-17T03:31:44.000Z
|
import paramiko
from time import localtime, strftime
# Create a ssh client
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('ocare', username='taiwanet', password='qwe7891')
file_name = strftime("/home/taiwanet/capture_image/%Y%m%d_%H%M%S.jpg", localtime())
stdin, stdout, stderr = client.exec_command('fswebcam --no-banner -d /dev/video1 brightness=112 -s Contrast=37 -s Gamma=50% -s Saturation=51 -s Sharpness=20 -p YUYV -S 5 -D 1 -r 1280x960 --jpeg 100 '+ file_name)
print('Capture Image \''+file_name+'\' successful! ')
for line in stderr:
print(line)
for line in stdout:
print(line)
client.close()
| 28.208333
| 211
| 0.731167
|
import paramiko
from time import localtime, strftime
client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect('ocare', username='taiwanet', password='qwe7891')
file_name = strftime("/home/taiwanet/capture_image/%Y%m%d_%H%M%S.jpg", localtime())
stdin, stdout, stderr = client.exec_command('fswebcam --no-banner -d /dev/video1 brightness=112 -s Contrast=37 -s Gamma=50% -s Saturation=51 -s Sharpness=20 -p YUYV -S 5 -D 1 -r 1280x960 --jpeg 100 '+ file_name)
print('Capture Image \''+file_name+'\' successful! ')
for line in stderr:
print(line)
for line in stdout:
print(line)
client.close()
| true
| true
|
f70a26b73ab91ee81563001d95d271815374a2a3
| 29,966
|
py
|
Python
|
HotSpotMap.py
|
bucaps/HotSpotMap
|
655d83d98316acbf9328519850268f548ae44af4
|
[
"MIT"
] | null | null | null |
HotSpotMap.py
|
bucaps/HotSpotMap
|
655d83d98316acbf9328519850268f548ae44af4
|
[
"MIT"
] | null | null | null |
HotSpotMap.py
|
bucaps/HotSpotMap
|
655d83d98316acbf9328519850268f548ae44af4
|
[
"MIT"
] | null | null | null |
# HotSpotMap: A python based temperature (thermal) map generation
# tool for HotSpot-6.0 (http://lava.cs.virginia.edu/HotSpot/)
# This tool uses python's turtle library
#
# Author: Gaurav Kothari (gkothar1@binghamton.edu) Copyright 2021
#
# This tool generates:
# 1) Floor-plan image (using floor-plan file)
# 2) Thermal map (using floor-plan file and steady temperature file)
# 3) Fine grained thermal map (using floor-plan file and grid steady temperature file)
#
# Supports 2D and 3D stacked systems
# Supports output formats: '.eps' and '.pdf'
import os
import time
import subprocess
import tkinter
import turtle
import tempfile
import numpy as np
import matplotlib
from matplotlib import cm
from matplotlib.colors import LinearSegmentedColormap
import argparse
from sys import argv
# To represent each floor-plan unit
class FloorplanUnit():
def __init__(self, name, width, height, xpos, ypos, temp=0):
self.name = name
self.width = width
self.height = height
self.xpos = xpos
self.ypos = ypos
self.temp = temp # temperature
msg_prefix = " HotSpotMap:"
# Home co-ordinates for drawing the chip floor-plan
# Note: turtle's default home co-ordinates are (0,0)
# For drawing the floor-plan, we will start from (-w/2,-h/2), where
# w = width of the chip, h = height of the chip
chip_home_xpos = 0
chip_home_ypos = 0
# Inspired from HotSpot 6.0
def get_chip_width(flp_units):
min_x = flp_units[0].xpos
max_x = flp_units[0].xpos + flp_units[0].width
for i in range(1, len(flp_units)):
if flp_units[i].xpos < min_x:
min_x = flp_units[i].xpos
if (flp_units[i].xpos + flp_units[i].width) > max_x:
max_x = flp_units[i].xpos + flp_units[i].width
return (max_x - min_x) * 1e3
# Inspired from HotSpot 6.0
def get_chip_height(flp_units):
min_y = flp_units[0].ypos
max_y = flp_units[0].ypos + flp_units[0].height
for i in range(1, len(flp_units)):
if flp_units[i].ypos < min_y:
min_y = flp_units[i].ypos
if (flp_units[i].ypos + flp_units[i].height) > max_y:
max_y = flp_units[i].ypos + flp_units[i].height
return (max_y - min_y) * 1e3
def get_pos_from_chip_home(xpos, ypos):
return (chip_home_xpos + xpos, chip_home_ypos + ypos)
# Only for 3D systems, collect all the output files
# (for every layer) to combine them later as a single PDF
output_3d_files = []
#
# Functions related to Turtle
#
def turtle_setup(config):
# setup screen
ts = turtle.Screen()
cw = (config.chip_width * 1e-3 * config.zoom_by)
ch = (config.chip_height * 1e-3 * config.zoom_by)
ts.reset()
ts.colormode(255)
ts.tracer(0, 0)
global chip_home_xpos
chip_home_xpos = -(cw / 2)
global chip_home_ypos
chip_home_ypos = -(ch / 2)
# create turtle cursor
t = turtle.Turtle()
t.pen(shown=False)
t.pensize(0.5)
t.hideturtle()
t.penup()
t.setpos(chip_home_xpos, chip_home_ypos)
return t
def turtle_save_image(config):
ts = turtle.getscreen()
eps_file = os.path.join(
config.output_dir, "{f}-{a}.eps".format(f=config.output_file,
a=config.action))
pdf_file = os.path.join(
config.output_dir, "{f}-{a}.pdf".format(f=config.output_file,
a=config.action))
canvas = ts.getcanvas()
canvas.config(width=config.chip_width * 1e-3 * config.zoom_by,
height=config.chip_height * 1e-3 * config.zoom_by)
canvas.postscript(file=eps_file)
print("{p} Generated eps file: {f}".format(p=msg_prefix, f=eps_file))
cmd = "ps2pdf {i} {o}".format(i=eps_file, o=pdf_file)
process = subprocess.Popen(cmd, shell=True)
process.wait()
print("{p} Generated pdf file: {f}".format(p=msg_prefix, f=pdf_file))
if config.model_3d:
output_3d_files.append(pdf_file)
def turtle_draw_unit(t,
xpos,
ypos,
width,
height,
config,
name,
border_color="",
fill_color="",
hide_names=True):
xpos *= config.zoom_by
ypos *= config.zoom_by
pos = get_pos_from_chip_home(xpos, ypos)
xpos = pos[0]
ypos = pos[1]
width *= config.zoom_by
height *= config.zoom_by
t.penup()
t.setpos(xpos, ypos)
t.color(border_color, fill_color)
if fill_color:
t.begin_fill()
t.pendown()
t.forward(width)
t.left(90)
t.forward(height)
t.left(90)
t.forward(width)
t.left(90)
t.forward(height)
t.left(90)
if fill_color:
t.end_fill()
t.penup()
if name and (hide_names == False):
t.setpos(xpos + (width / 2), ypos + (height / 2))
t.pendown()
t.color("black")
print_name = name
if config.print_area:
area = (width / config.zoom_by) * (height /
config.zoom_by) * 1e6 # mm2
area = round(area, 3)
print_name += " ({a})".format(a=area)
t.write(print_name,
align="center",
font=(config.font, config.font_size, config.font_weight))
t.penup()
def draw_chip_dimensions(t, config):
# draw height scale on left of the floor-plan
arrow_height = 15
xpos = -30
ypos = 0
t.penup()
t.color("black")
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.left(90)
t.pendown()
t.forward(config.chip_height * 1e-3 * config.zoom_by)
temp = t.pos()
t.left(135)
t.forward(arrow_height)
t.setpos(temp)
t.right(270)
t.forward(arrow_height)
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.pendown()
t.left(90)
t.forward(arrow_height)
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.right(270)
t.pendown()
t.forward(arrow_height)
t.right(135) # reset
t.penup()
canvas = turtle.getcanvas()
xpos = -45
ypos = (config.chip_height * 1e-3 * config.zoom_by) / 2
pos = get_pos_from_chip_home(xpos, ypos)
canvas.create_text(pos[0],
pos[1],
text="Height {h} mm".format(h=config.chip_height),
angle=90,
font=(config.font, config.font_size,
config.font_weight))
# draw width scale on top of the floor-plan
xpos = 0
ypos = (config.chip_height * 1e-3 * config.zoom_by) + 30
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.pendown()
t.forward(config.chip_width * 1e-3 * config.zoom_by)
temp = t.pos()
t.left(135)
t.forward(arrow_height)
t.setpos(temp)
t.right(270)
t.forward(arrow_height)
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.pendown()
t.left(90)
t.forward(arrow_height)
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.right(270)
t.pendown()
t.forward(arrow_height)
t.penup()
canvas = turtle.getcanvas()
xpos = (config.chip_width * 1e-3 * config.zoom_by) / 2
ypos = -45
pos = get_pos_from_chip_home(xpos, ypos)
canvas.create_text(pos[0],
pos[1],
text="Width {w} mm".format(w=config.chip_width),
angle=0,
font=(config.font, config.font_size,
config.font_weight))
#
# Function related to temperature color bar
#
# Colors used for temperature map
colors = [
"#ff0000",
"#ff3300",
"#ff6600",
"#ff9900",
"#ffcc00",
"#ffff00",
"#ccff00",
"#99ff00",
"#66ff00",
"#33ff00",
"#00ff00",
"#00ff33",
"#00ff66",
"#00ff99",
"#00ffcc",
"#00ffff",
"#00ccff",
"#0099ff",
"#0066ff",
"#0033ff",
"#0000ff",
]
# Color map for temperatures
def get_chip_temp_cmap():
global colors
colors.reverse()
cmap = matplotlib.colors.LinearSegmentedColormap.from_list(
"chipTemp", colors)
return cmap
def draw_color_bar(t, config, colors, temp_min, temp_max):
xpos = ((config.chip_width + 0.05) * 1e-3)
ypos = 0
color_bar_max_height = config.chip_height * 1e-3
color_cell_width = color_bar_max_height / len(colors)
color_cell_height = color_cell_width
temp_cell_width = color_cell_width * 3
temp_cell_height = color_cell_height
interval = len(colors)
temp_values = np.linspace(temp_min,
temp_max,
num=int(interval),
endpoint=True)
temp_values = [round(val, 2) for val in temp_values]
i = 0
for color in colors:
# draw the temperature value
turtle_draw_unit(t,
xpos,
ypos,
temp_cell_width,
temp_cell_height,
config,
name="{f}K".format(f=temp_values[i]),
border_color="",
fill_color="",
hide_names=False)
# color cell
turtle_draw_unit(t,
xpos + temp_cell_width,
ypos,
color_cell_width,
color_cell_height,
config,
name="",
border_color="black",
fill_color=color)
ypos += color_cell_height
i += 1
#
# Functions related to drawing chip floor-plan
#
# Checks if floor-plan has duplicated units
def check_duplicated_flp_units(flp_units_names):
flp_units_namesSet = set(flp_units_names)
if len(flp_units_namesSet) != len(flp_units_names):
print("{p} warning! duplicated floor-plan units detected".format(
p=msg_prefix))
def draw_floorplan(config, t):
start = time.time()
file = open(config.floor_plan, "r")
flp = file.readlines()
flp_units = []
flp_units_names = []
for line in flp:
if "#" in line or line == "\n" or not line:
continue
line = line.split("\t")
flp_units_names.append(line[0])
flp_units.append(
FloorplanUnit(line[0], float(line[1]), float(line[2]),
float(line[3]), float(line[4])))
check_duplicated_flp_units(flp_units_names)
print("{p} Drawing floor-plan".format(p=msg_prefix))
print(
"{p} Reading floor-plan file {f}: found {u} units, {w} mm chip-width, {h} mm chip-height"
.format(f=config.floor_plan,
p=msg_prefix,
u=len(flp_units),
w=config.chip_width,
h=config.chip_height))
file.close()
for unit in flp_units:
turtle_draw_unit(turtle,
unit.xpos,
unit.ypos,
unit.width,
unit.height,
config,
name=unit.name,
border_color="black",
fill_color="",
hide_names=config.hide_names)
end = time.time()
print("{p} Finished drawing floor-plan in {t} seconds".format(
p=msg_prefix, t=round((end - start), 2)))
#
# Functions related to draw the temperature maps
#
# This parses the given temperature file and extracts
# min and max temperatures (for steady and grid steady file)
def get_temperature_file_config(temperature_file, grid_steady_file_3d=""):
file = open(temperature_file, "r")
lines = file.readlines()
temperatures = []
for line in lines:
if line == "\n" or not line:
continue
line = line.split("\t")
if len(line) == 1:
continue # for 3D grid steady file, skip layer header
temperatures.append(float(line[1]))
file.close()
grid_steady_config = []
grid_steady_config.append(str(min(temperatures)))
grid_steady_config.append(str(max(temperatures)))
return grid_steady_config
def draw_grid_steady_thermal_map(config, turtle, grid_steady_file_3d=""):
start = time.time()
temperature_limit_file = config.temperature_file
if config.model_3d:
# for 3D systems, use the original grid-steady file containing
# the temperature data for all the layers to extract min and max
# temperatures, because all the layers must use the same color range
temperature_limit_file = grid_steady_file_3d
# find min and max temperatures reported in grid steady file
grid_steady_config = get_temperature_file_config(temperature_limit_file)
rows = config.grid_rows
cols = config.grid_cols
temp_min = float(grid_steady_config[0])
temp_max = float(grid_steady_config[1])
print(
"{p} Reading grid steady file {f}, with {r} rows, {c} cols, {min} min-temp, {max} max-temp"
.format(p=msg_prefix,
f=config.temperature_file,
r=rows,
c=cols,
min=temp_min,
max=temp_max))
# normalize temperature range between 0 and 1, which will be used to fetch color from color map
norm_temp_range = matplotlib.colors.Normalize(vmin=temp_min, vmax=temp_max)
# generate color map
cmap = get_chip_temp_cmap()
global colors
draw_color_bar(turtle, config, colors, temp_min, temp_max)
grid_cell_width = (config.chip_width * 1e-3) / cols
grid_cell_height = (config.chip_height * 1e-3) / rows
file = open(config.temperature_file, "r")
lines = file.readlines()
xpos = 0
ypos = (config.chip_height * 1e-3) - grid_cell_height
print("{p} Drawing temperature grid".format(p=msg_prefix))
next_col = 0
for line in lines:
if line == "\n" or not line:
continue
else:
line = line.split("\t")
col = line[0] # column number
temp = float(
line[1]) # temperature of the cell at current row and column
color = matplotlib.colors.rgb2hex(cmap(norm_temp_range(temp)))
turtle_draw_unit(turtle,
xpos,
ypos,
grid_cell_width,
grid_cell_height,
config,
name="",
border_color=color,
fill_color=color)
xpos += grid_cell_width
next_col += 1
if next_col == config.grid_cols:
# one complete row is finished
xpos = 0
next_col = 0
ypos -= grid_cell_height
file.close()
end = time.time()
print("{p} Finished drawing temperature grid in {t} seconds".format(
p=msg_prefix, t=round((end - start), 2)))
def draw_steady_thermal_map(config, turtle):
start = time.time()
# find min and max temperatures reported in steady file
steady_config = get_temperature_file_config(config.temperature_file)
temp_min = float(steady_config[0])
temp_max = float(steady_config[1])
print("{p} Reading steady file {f}, found {min} min-temp, {max} max-temp".
format(p=msg_prefix,
f=config.temperature_file,
min=temp_min,
max=temp_max))
# normalize temperature range between 0 and 1, which will be used to fetch color from color map
norm_temp_range = matplotlib.colors.Normalize(vmin=temp_min, vmax=temp_max)
# generate color map
cmap = get_chip_temp_cmap()
draw_color_bar(turtle, config, colors, temp_min, temp_max)
# read all the floor-plan units
file = open(config.floor_plan, "r")
flp = file.readlines()
flp_units = []
for line in flp:
if "#" in line or line == "\n":
continue
line = line.split("\t")
flp_units.append(
FloorplanUnit(line[0], float(line[1]), float(line[2]),
float(line[3]), float(line[4])))
file.close()
file = open(config.temperature_file, "r")
lines = file.readlines()
for line in lines:
line = line.split("\t")
name = line[0]
temp = float(line[1])
# for 3D steady temperature file, each unit is appended with prefix layer_<layer>_
# we need to remove that prefix
if config.model_3d and "layer_" in name:
name = name[name.find("_") + 1:]
name = name[name.find("_") + 1:]
for unit in flp_units:
if unit.name == name:
color = matplotlib.colors.rgb2hex(cmap(norm_temp_range(temp)))
turtle_draw_unit(turtle,
unit.xpos,
unit.ypos,
unit.width,
unit.height,
config,
name=unit.name,
border_color="black",
fill_color=color,
hide_names=config.hide_names)
file.close()
end = time.time()
print("{p} Finished steady temperature map in {t} seconds".format(
p=msg_prefix, t=round((end - start), 2)))
#
# Function related to parse file for 3D system (such as LCF and grid-steady file)
#
# Parse HotSpot's layer configuration file (lcf) for 3D systems
# For 3D systems, config.floor_plan is the lCF
def read_lcf(config):
file = open(config.floor_plan, "r")
lines = file.readlines()
config_lines = [
] # To store lcf after removing all the comments and blank lines
for line in lines:
if "#" in line or not line or line == "\n":
continue
config_lines.append(line)
file.close()
layer_num_pos = 0 # pos of layer number for the corresponding layer
has_power_pos = 2 # pos of power dissipation flag for the corresponding layer
floor_plan_file_pos = 6 # pos of floor plan file for the corresponding layer
current_line = 0
current_layer = []
lcf_home_dir = os.path.dirname(config.floor_plan)
lcf_breakdown_list = []
while current_line < len(config_lines):
if current_line and ((current_line % 7) == 0):
temp = []
temp.append(current_layer[layer_num_pos].rstrip())
temp.append(current_layer[has_power_pos].rstrip())
temp.append(
os.path.join(lcf_home_dir,
current_layer[floor_plan_file_pos].rstrip()))
lcf_breakdown_list.append(temp)
current_layer.clear()
current_layer.append(config_lines[current_line])
current_line += 1
print("{p} Finished reading lcf file: {f}, found {flp} floor-plan files".
format(p=msg_prefix,
f=config.floor_plan,
flp=len(lcf_breakdown_list)))
return lcf_breakdown_list
def extract_grid_temperatures_for_layer(config, temperature_file, layer):
file = open(temperature_file, "r")
lines = file.readlines()
file.close()
# remove all the empty lines
cleaned_lines = []
for line in lines:
if line == "\n" or not line:
continue
cleaned_lines.append(line)
line_num = 0
look_for_layer = "layer_{l}".format(l=layer)
while cleaned_lines[line_num].rstrip() != look_for_layer:
line_num += 1
print(
"{p} Grid temperature data for layer {l} starts at line {n} in file: {f}"
.format(p=msg_prefix, l=layer, n=line_num, f=temperature_file))
# grid temperatures for current layer start at line_num
line_num += 1 # skip the header line for this layer
file = open("temp.grid.steady", "w")
# we will read grid_rows x grid_cols line from this line onwards
lines_read = line_num
lines_to_read = line_num + (config.grid_rows * config.grid_cols)
while lines_read < lines_to_read:
current_line = cleaned_lines[lines_read]
file.write("{l}\n".format(l=current_line.rstrip()))
lines_read += 1
file.close()
# For 2D systems
def main_2d(config):
turtle = turtle_setup(config)
if config.action == "flp":
draw_floorplan(config, turtle)
else:
if config.action == "grid-steady":
draw_grid_steady_thermal_map(config, turtle)
draw_floorplan(
config, turtle
) # This will superimpose floor-plan onto temperature grid
else:
draw_steady_thermal_map(config, turtle)
if config.print_chip_dim:
draw_chip_dimensions(turtle, config)
turtle_save_image(config)
# For 3D stacked systems
def main_3d(config):
lcf_breakdown_list = read_lcf(config)
output_file_bkp = config.output_file
temperature_file_bkp = config.temperature_file
for lcf_layer in lcf_breakdown_list:
layer = int(lcf_layer[0]) # layer number
# override the config parameters
config.floor_plan = lcf_layer[2]
config.output_file = output_file_bkp
config.output_file += "-layer-{l}".format(l=layer)
turtle = turtle_setup(config)
print("{s} Processing layer {l} with floor-plan: {f}".format(
s=msg_prefix, l=layer, f=config.floor_plan))
if config.action == "flp":
draw_floorplan(config, turtle)
else:
if config.action == "grid-steady":
extract_grid_temperatures_for_layer(config,
temperature_file_bkp,
layer)
# this file has extracted grid temperatures for current layer
config.temperature_file = "temp.grid.steady"
draw_grid_steady_thermal_map(config, turtle,
temperature_file_bkp)
draw_floorplan(
config, turtle
) # this will superimpose floor-plan onto temperature grid
os.remove("temp.grid.steady")
else:
draw_steady_thermal_map(config, turtle)
if config.print_chip_dim:
draw_chip_dimensions(turtle, config)
turtle_save_image(config)
print("")
if config.concat:
# this code block combines all the files
# generated for each layer into a single PDF
output_file_list_str = ""
for file in output_3d_files:
output_file_list_str += "{f} ".format(f=file)
final_concat_output = os.path.join(
config.output_dir, "{p}-{a}-concat.pdf".format(p=output_file_bkp,a=config.action))
pdfjam = "pdfjam --nup {n}x1 --landscape {files} -o {output}".format(
n=len(output_3d_files),
files=output_file_list_str,
output=final_concat_output)
print("{p} Executing {c}".format(p=msg_prefix, c=pdfjam))
process = subprocess.Popen(pdfjam, shell=True)
process.wait()
stdout, stderr = process.communicate()
if stdout:
print(stdout)
if stderr:
print(stderr)
def setup_chip_dimensions(config):
floor_plan_file = config.floor_plan
if config.model_3d:
lcf_breakdown_list = read_lcf(config)
# index 0 in lcf_breakdown_list is the 1st layer in 3D system
# index 2 in 1st layer is the floor-plan file for that layer
# for stacked 3D system, all layers must have equal dimensions, so pick any 1 layer
floor_plan_file = lcf_breakdown_list[0][2]
file = open(floor_plan_file, "r")
flp = file.readlines()
flp_units = []
file.close()
for line in flp:
if "#" in line or line == "\n" or not line:
continue
line = line.split("\t")
flp_units.append(
FloorplanUnit(line[0], float(line[1]), float(line[2]),
float(line[3]), float(line[4])))
config.chip_height = round(get_chip_height(flp_units), 5)
config.chip_width = round(get_chip_width(flp_units), 5)
print("{p} Calculated chip's width as {w} mm and chip's height as {h} mm".
format(p=msg_prefix, w=config.chip_width, h=config.chip_height))
def parse_command_line():
version = 2.0
description = "A python based temperature (thermal) map generation tool for HotSpot-6.0 (http://lava.cs.virginia.edu/HotSpot/), Author: Gaurav Kothari (gkothar1@binghamton.edu) v{v}".format(
v=version)
parser = argparse.ArgumentParser(description=description)
parser.add_argument("-a",
"--action",
action="store",
dest="action",
required=True,
choices=["flp", "steady", "grid-steady"],
help="Action type")
parser.add_argument("-3D",
"--model-3D",
action="store_true",
dest="model_3d",
required=False,
default=False,
help="To indicate a 3D system")
parser.add_argument("-f",
"--flp",
action="store",
dest="floor_plan",
required=True,
help="Floor-plan file")
parser.add_argument(
"-t",
"--temperature",
action="store",
dest="temperature_file",
required=("steady" in argv) or ("grid-steady" in argv),
help=
"Steady temperature file or Grid steady temperature file based on action"
)
parser.add_argument("-r",
"--row",
action="store",
dest="grid_rows",
type=int,
required=("grid-steady" in argv),
help="Number of rows in grid-steady model")
parser.add_argument("-c",
"--col",
action="store",
dest="grid_cols",
type=int,
required=("grid-steady" in argv),
help="Number of columns in grid-steady model")
parser.add_argument("-ft",
"--font",
action="store",
dest="font",
required=False,
default="Ubuntu",
help="Font family")
parser.add_argument("-fts",
"--font-size",
action="store",
dest="font_size",
required=False,
default=9,
type=int,
help="Font size")
parser.add_argument("-ftw",
"--font-weight",
action="store",
dest="font_weight",
required=False,
default="normal",
help="Font weight")
parser.add_argument("-o",
"--output-file",
action="store",
dest="output_file",
required=True,
help="Output file name prefix")
parser.add_argument("-d",
"--output-directory",
action="store",
dest="output_dir",
required=False,
default=os.getcwd(),
help="Output directory")
parser.add_argument("-hn",
"--hide-names",
action="store_true",
dest="hide_names",
required=False,
default=False,
help="Hide names on floor-plan")
parser.add_argument("-z",
"--zoom-by",
action="store",
dest="zoom_by",
type=int,
required=False,
default=75000,
help="Zoom factor")
parser.add_argument("-pcd",
"--print-chip-dim",
action="store_true",
dest="print_chip_dim",
required=False,
default=False,
help="Draw chip' width and height scale")
parser.add_argument("-concat",
"--concat-3D",
action="store_true",
dest="concat",
required=False,
default=False,
help="Combines the images generated for all layer into a single PDF")
parser.add_argument(
"-pa",
"--print-area",
action="store_true",
dest="print_area",
required=False,
default=False,
help=
"Print unit's area (mm2) alongside its name, rounded to three decimal places"
)
args = parser.parse_args()
print("{p} {d}".format(p=msg_prefix, d=description))
print("")
return args
def main():
config = parse_command_line()
# before we start drawing images, first quickly read floor-plan file
# and calculate the chip's width and height
setup_chip_dimensions(config)
if config.model_3d:
main_3d(config)
else:
main_2d(config)
if __name__ == "__main__":
main()
| 31.743644
| 194
| 0.553961
|
#
# Author: Gaurav Kothari (gkothar1@binghamton.edu) Copyright 2021
#
# This tool generates:
# 1) Floor-plan image (using floor-plan file)
# 2) Thermal map (using floor-plan file and steady temperature file)
# 3) Fine grained thermal map (using floor-plan file and grid steady temperature file)
#
# Supports 2D and 3D stacked systems
# Supports output formats: '.eps' and '.pdf'
import os
import time
import subprocess
import tkinter
import turtle
import tempfile
import numpy as np
import matplotlib
from matplotlib import cm
from matplotlib.colors import LinearSegmentedColormap
import argparse
from sys import argv
# To represent each floor-plan unit
class FloorplanUnit():
def __init__(self, name, width, height, xpos, ypos, temp=0):
self.name = name
self.width = width
self.height = height
self.xpos = xpos
self.ypos = ypos
self.temp = temp # temperature
msg_prefix = " HotSpotMap:"
# Home co-ordinates for drawing the chip floor-plan
# Note: turtle's default home co-ordinates are (0,0)
chip_home_xpos = 0
chip_home_ypos = 0
def get_chip_width(flp_units):
min_x = flp_units[0].xpos
max_x = flp_units[0].xpos + flp_units[0].width
for i in range(1, len(flp_units)):
if flp_units[i].xpos < min_x:
min_x = flp_units[i].xpos
if (flp_units[i].xpos + flp_units[i].width) > max_x:
max_x = flp_units[i].xpos + flp_units[i].width
return (max_x - min_x) * 1e3
def get_chip_height(flp_units):
min_y = flp_units[0].ypos
max_y = flp_units[0].ypos + flp_units[0].height
for i in range(1, len(flp_units)):
if flp_units[i].ypos < min_y:
min_y = flp_units[i].ypos
if (flp_units[i].ypos + flp_units[i].height) > max_y:
max_y = flp_units[i].ypos + flp_units[i].height
return (max_y - min_y) * 1e3
def get_pos_from_chip_home(xpos, ypos):
return (chip_home_xpos + xpos, chip_home_ypos + ypos)
output_3d_files = []
def turtle_setup(config):
ts = turtle.Screen()
cw = (config.chip_width * 1e-3 * config.zoom_by)
ch = (config.chip_height * 1e-3 * config.zoom_by)
ts.reset()
ts.colormode(255)
ts.tracer(0, 0)
global chip_home_xpos
chip_home_xpos = -(cw / 2)
global chip_home_ypos
chip_home_ypos = -(ch / 2)
t = turtle.Turtle()
t.pen(shown=False)
t.pensize(0.5)
t.hideturtle()
t.penup()
t.setpos(chip_home_xpos, chip_home_ypos)
return t
def turtle_save_image(config):
ts = turtle.getscreen()
eps_file = os.path.join(
config.output_dir, "{f}-{a}.eps".format(f=config.output_file,
a=config.action))
pdf_file = os.path.join(
config.output_dir, "{f}-{a}.pdf".format(f=config.output_file,
a=config.action))
canvas = ts.getcanvas()
canvas.config(width=config.chip_width * 1e-3 * config.zoom_by,
height=config.chip_height * 1e-3 * config.zoom_by)
canvas.postscript(file=eps_file)
print("{p} Generated eps file: {f}".format(p=msg_prefix, f=eps_file))
cmd = "ps2pdf {i} {o}".format(i=eps_file, o=pdf_file)
process = subprocess.Popen(cmd, shell=True)
process.wait()
print("{p} Generated pdf file: {f}".format(p=msg_prefix, f=pdf_file))
if config.model_3d:
output_3d_files.append(pdf_file)
def turtle_draw_unit(t,
xpos,
ypos,
width,
height,
config,
name,
border_color="",
fill_color="",
hide_names=True):
xpos *= config.zoom_by
ypos *= config.zoom_by
pos = get_pos_from_chip_home(xpos, ypos)
xpos = pos[0]
ypos = pos[1]
width *= config.zoom_by
height *= config.zoom_by
t.penup()
t.setpos(xpos, ypos)
t.color(border_color, fill_color)
if fill_color:
t.begin_fill()
t.pendown()
t.forward(width)
t.left(90)
t.forward(height)
t.left(90)
t.forward(width)
t.left(90)
t.forward(height)
t.left(90)
if fill_color:
t.end_fill()
t.penup()
if name and (hide_names == False):
t.setpos(xpos + (width / 2), ypos + (height / 2))
t.pendown()
t.color("black")
print_name = name
if config.print_area:
area = (width / config.zoom_by) * (height /
config.zoom_by) * 1e6
area = round(area, 3)
print_name += " ({a})".format(a=area)
t.write(print_name,
align="center",
font=(config.font, config.font_size, config.font_weight))
t.penup()
def draw_chip_dimensions(t, config):
arrow_height = 15
xpos = -30
ypos = 0
t.penup()
t.color("black")
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.left(90)
t.pendown()
t.forward(config.chip_height * 1e-3 * config.zoom_by)
temp = t.pos()
t.left(135)
t.forward(arrow_height)
t.setpos(temp)
t.right(270)
t.forward(arrow_height)
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.pendown()
t.left(90)
t.forward(arrow_height)
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.right(270)
t.pendown()
t.forward(arrow_height)
t.right(135)
t.penup()
canvas = turtle.getcanvas()
xpos = -45
ypos = (config.chip_height * 1e-3 * config.zoom_by) / 2
pos = get_pos_from_chip_home(xpos, ypos)
canvas.create_text(pos[0],
pos[1],
text="Height {h} mm".format(h=config.chip_height),
angle=90,
font=(config.font, config.font_size,
config.font_weight))
xpos = 0
ypos = (config.chip_height * 1e-3 * config.zoom_by) + 30
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.pendown()
t.forward(config.chip_width * 1e-3 * config.zoom_by)
temp = t.pos()
t.left(135)
t.forward(arrow_height)
t.setpos(temp)
t.right(270)
t.forward(arrow_height)
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.pendown()
t.left(90)
t.forward(arrow_height)
t.penup()
t.setpos(get_pos_from_chip_home(xpos, ypos))
t.right(270)
t.pendown()
t.forward(arrow_height)
t.penup()
canvas = turtle.getcanvas()
xpos = (config.chip_width * 1e-3 * config.zoom_by) / 2
ypos = -45
pos = get_pos_from_chip_home(xpos, ypos)
canvas.create_text(pos[0],
pos[1],
text="Width {w} mm".format(w=config.chip_width),
angle=0,
font=(config.font, config.font_size,
config.font_weight))
colors = [
"#ff0000",
"#ff3300",
"#ff6600",
"#ff9900",
"#ffcc00",
"#ffff00",
"#ccff00",
"#99ff00",
"#66ff00",
"#33ff00",
"#00ff00",
"#00ff33",
"#00ff66",
"#00ff99",
"#00ffcc",
"#00ffff",
"#00ccff",
"#0099ff",
"#0066ff",
"#0033ff",
"#0000ff",
]
def get_chip_temp_cmap():
global colors
colors.reverse()
cmap = matplotlib.colors.LinearSegmentedColormap.from_list(
"chipTemp", colors)
return cmap
def draw_color_bar(t, config, colors, temp_min, temp_max):
xpos = ((config.chip_width + 0.05) * 1e-3)
ypos = 0
color_bar_max_height = config.chip_height * 1e-3
color_cell_width = color_bar_max_height / len(colors)
color_cell_height = color_cell_width
temp_cell_width = color_cell_width * 3
temp_cell_height = color_cell_height
interval = len(colors)
temp_values = np.linspace(temp_min,
temp_max,
num=int(interval),
endpoint=True)
temp_values = [round(val, 2) for val in temp_values]
i = 0
for color in colors:
turtle_draw_unit(t,
xpos,
ypos,
temp_cell_width,
temp_cell_height,
config,
name="{f}K".format(f=temp_values[i]),
border_color="",
fill_color="",
hide_names=False)
turtle_draw_unit(t,
xpos + temp_cell_width,
ypos,
color_cell_width,
color_cell_height,
config,
name="",
border_color="black",
fill_color=color)
ypos += color_cell_height
i += 1
def check_duplicated_flp_units(flp_units_names):
flp_units_namesSet = set(flp_units_names)
if len(flp_units_namesSet) != len(flp_units_names):
print("{p} warning! duplicated floor-plan units detected".format(
p=msg_prefix))
def draw_floorplan(config, t):
start = time.time()
file = open(config.floor_plan, "r")
flp = file.readlines()
flp_units = []
flp_units_names = []
for line in flp:
if "#" in line or line == "\n" or not line:
continue
line = line.split("\t")
flp_units_names.append(line[0])
flp_units.append(
FloorplanUnit(line[0], float(line[1]), float(line[2]),
float(line[3]), float(line[4])))
check_duplicated_flp_units(flp_units_names)
print("{p} Drawing floor-plan".format(p=msg_prefix))
print(
"{p} Reading floor-plan file {f}: found {u} units, {w} mm chip-width, {h} mm chip-height"
.format(f=config.floor_plan,
p=msg_prefix,
u=len(flp_units),
w=config.chip_width,
h=config.chip_height))
file.close()
for unit in flp_units:
turtle_draw_unit(turtle,
unit.xpos,
unit.ypos,
unit.width,
unit.height,
config,
name=unit.name,
border_color="black",
fill_color="",
hide_names=config.hide_names)
end = time.time()
print("{p} Finished drawing floor-plan in {t} seconds".format(
p=msg_prefix, t=round((end - start), 2)))
def get_temperature_file_config(temperature_file, grid_steady_file_3d=""):
file = open(temperature_file, "r")
lines = file.readlines()
temperatures = []
for line in lines:
if line == "\n" or not line:
continue
line = line.split("\t")
if len(line) == 1:
continue
temperatures.append(float(line[1]))
file.close()
grid_steady_config = []
grid_steady_config.append(str(min(temperatures)))
grid_steady_config.append(str(max(temperatures)))
return grid_steady_config
def draw_grid_steady_thermal_map(config, turtle, grid_steady_file_3d=""):
start = time.time()
temperature_limit_file = config.temperature_file
if config.model_3d:
temperature_limit_file = grid_steady_file_3d
grid_steady_config = get_temperature_file_config(temperature_limit_file)
rows = config.grid_rows
cols = config.grid_cols
temp_min = float(grid_steady_config[0])
temp_max = float(grid_steady_config[1])
print(
"{p} Reading grid steady file {f}, with {r} rows, {c} cols, {min} min-temp, {max} max-temp"
.format(p=msg_prefix,
f=config.temperature_file,
r=rows,
c=cols,
min=temp_min,
max=temp_max))
norm_temp_range = matplotlib.colors.Normalize(vmin=temp_min, vmax=temp_max)
cmap = get_chip_temp_cmap()
global colors
draw_color_bar(turtle, config, colors, temp_min, temp_max)
grid_cell_width = (config.chip_width * 1e-3) / cols
grid_cell_height = (config.chip_height * 1e-3) / rows
file = open(config.temperature_file, "r")
lines = file.readlines()
xpos = 0
ypos = (config.chip_height * 1e-3) - grid_cell_height
print("{p} Drawing temperature grid".format(p=msg_prefix))
next_col = 0
for line in lines:
if line == "\n" or not line:
continue
else:
line = line.split("\t")
col = line[0]
temp = float(
line[1])
color = matplotlib.colors.rgb2hex(cmap(norm_temp_range(temp)))
turtle_draw_unit(turtle,
xpos,
ypos,
grid_cell_width,
grid_cell_height,
config,
name="",
border_color=color,
fill_color=color)
xpos += grid_cell_width
next_col += 1
if next_col == config.grid_cols:
xpos = 0
next_col = 0
ypos -= grid_cell_height
file.close()
end = time.time()
print("{p} Finished drawing temperature grid in {t} seconds".format(
p=msg_prefix, t=round((end - start), 2)))
def draw_steady_thermal_map(config, turtle):
start = time.time()
steady_config = get_temperature_file_config(config.temperature_file)
temp_min = float(steady_config[0])
temp_max = float(steady_config[1])
print("{p} Reading steady file {f}, found {min} min-temp, {max} max-temp".
format(p=msg_prefix,
f=config.temperature_file,
min=temp_min,
max=temp_max))
norm_temp_range = matplotlib.colors.Normalize(vmin=temp_min, vmax=temp_max)
cmap = get_chip_temp_cmap()
draw_color_bar(turtle, config, colors, temp_min, temp_max)
file = open(config.floor_plan, "r")
flp = file.readlines()
flp_units = []
for line in flp:
if "#" in line or line == "\n":
continue
line = line.split("\t")
flp_units.append(
FloorplanUnit(line[0], float(line[1]), float(line[2]),
float(line[3]), float(line[4])))
file.close()
file = open(config.temperature_file, "r")
lines = file.readlines()
for line in lines:
line = line.split("\t")
name = line[0]
temp = float(line[1])
if config.model_3d and "layer_" in name:
name = name[name.find("_") + 1:]
name = name[name.find("_") + 1:]
for unit in flp_units:
if unit.name == name:
color = matplotlib.colors.rgb2hex(cmap(norm_temp_range(temp)))
turtle_draw_unit(turtle,
unit.xpos,
unit.ypos,
unit.width,
unit.height,
config,
name=unit.name,
border_color="black",
fill_color=color,
hide_names=config.hide_names)
file.close()
end = time.time()
print("{p} Finished steady temperature map in {t} seconds".format(
p=msg_prefix, t=round((end - start), 2)))
# For 3D systems, config.floor_plan is the lCF
def read_lcf(config):
file = open(config.floor_plan, "r")
lines = file.readlines()
config_lines = [
] # To store lcf after removing all the comments and blank lines
for line in lines:
if "#" in line or not line or line == "\n":
continue
config_lines.append(line)
file.close()
layer_num_pos = 0 # pos of layer number for the corresponding layer
has_power_pos = 2 # pos of power dissipation flag for the corresponding layer
floor_plan_file_pos = 6 # pos of floor plan file for the corresponding layer
current_line = 0
current_layer = []
lcf_home_dir = os.path.dirname(config.floor_plan)
lcf_breakdown_list = []
while current_line < len(config_lines):
if current_line and ((current_line % 7) == 0):
temp = []
temp.append(current_layer[layer_num_pos].rstrip())
temp.append(current_layer[has_power_pos].rstrip())
temp.append(
os.path.join(lcf_home_dir,
current_layer[floor_plan_file_pos].rstrip()))
lcf_breakdown_list.append(temp)
current_layer.clear()
current_layer.append(config_lines[current_line])
current_line += 1
print("{p} Finished reading lcf file: {f}, found {flp} floor-plan files".
format(p=msg_prefix,
f=config.floor_plan,
flp=len(lcf_breakdown_list)))
return lcf_breakdown_list
def extract_grid_temperatures_for_layer(config, temperature_file, layer):
file = open(temperature_file, "r")
lines = file.readlines()
file.close()
# remove all the empty lines
cleaned_lines = []
for line in lines:
if line == "\n" or not line:
continue
cleaned_lines.append(line)
line_num = 0
look_for_layer = "layer_{l}".format(l=layer)
while cleaned_lines[line_num].rstrip() != look_for_layer:
line_num += 1
print(
"{p} Grid temperature data for layer {l} starts at line {n} in file: {f}"
.format(p=msg_prefix, l=layer, n=line_num, f=temperature_file))
# grid temperatures for current layer start at line_num
line_num += 1 # skip the header line for this layer
file = open("temp.grid.steady", "w")
# we will read grid_rows x grid_cols line from this line onwards
lines_read = line_num
lines_to_read = line_num + (config.grid_rows * config.grid_cols)
while lines_read < lines_to_read:
current_line = cleaned_lines[lines_read]
file.write("{l}\n".format(l=current_line.rstrip()))
lines_read += 1
file.close()
# For 2D systems
def main_2d(config):
turtle = turtle_setup(config)
if config.action == "flp":
draw_floorplan(config, turtle)
else:
if config.action == "grid-steady":
draw_grid_steady_thermal_map(config, turtle)
draw_floorplan(
config, turtle
) # This will superimpose floor-plan onto temperature grid
else:
draw_steady_thermal_map(config, turtle)
if config.print_chip_dim:
draw_chip_dimensions(turtle, config)
turtle_save_image(config)
# For 3D stacked systems
def main_3d(config):
lcf_breakdown_list = read_lcf(config)
output_file_bkp = config.output_file
temperature_file_bkp = config.temperature_file
for lcf_layer in lcf_breakdown_list:
layer = int(lcf_layer[0]) # layer number
# override the config parameters
config.floor_plan = lcf_layer[2]
config.output_file = output_file_bkp
config.output_file += "-layer-{l}".format(l=layer)
turtle = turtle_setup(config)
print("{s} Processing layer {l} with floor-plan: {f}".format(
s=msg_prefix, l=layer, f=config.floor_plan))
if config.action == "flp":
draw_floorplan(config, turtle)
else:
if config.action == "grid-steady":
extract_grid_temperatures_for_layer(config,
temperature_file_bkp,
layer)
# this file has extracted grid temperatures for current layer
config.temperature_file = "temp.grid.steady"
draw_grid_steady_thermal_map(config, turtle,
temperature_file_bkp)
draw_floorplan(
config, turtle
) # this will superimpose floor-plan onto temperature grid
os.remove("temp.grid.steady")
else:
draw_steady_thermal_map(config, turtle)
if config.print_chip_dim:
draw_chip_dimensions(turtle, config)
turtle_save_image(config)
print("")
if config.concat:
# this code block combines all the files
# generated for each layer into a single PDF
output_file_list_str = ""
for file in output_3d_files:
output_file_list_str += "{f} ".format(f=file)
final_concat_output = os.path.join(
config.output_dir, "{p}-{a}-concat.pdf".format(p=output_file_bkp,a=config.action))
pdfjam = "pdfjam --nup {n}x1 --landscape {files} -o {output}".format(
n=len(output_3d_files),
files=output_file_list_str,
output=final_concat_output)
print("{p} Executing {c}".format(p=msg_prefix, c=pdfjam))
process = subprocess.Popen(pdfjam, shell=True)
process.wait()
stdout, stderr = process.communicate()
if stdout:
print(stdout)
if stderr:
print(stderr)
def setup_chip_dimensions(config):
floor_plan_file = config.floor_plan
if config.model_3d:
lcf_breakdown_list = read_lcf(config)
# index 0 in lcf_breakdown_list is the 1st layer in 3D system
# index 2 in 1st layer is the floor-plan file for that layer
# for stacked 3D system, all layers must have equal dimensions, so pick any 1 layer
floor_plan_file = lcf_breakdown_list[0][2]
file = open(floor_plan_file, "r")
flp = file.readlines()
flp_units = []
file.close()
for line in flp:
if "#" in line or line == "\n" or not line:
continue
line = line.split("\t")
flp_units.append(
FloorplanUnit(line[0], float(line[1]), float(line[2]),
float(line[3]), float(line[4])))
config.chip_height = round(get_chip_height(flp_units), 5)
config.chip_width = round(get_chip_width(flp_units), 5)
print("{p} Calculated chip's width as {w} mm and chip's height as {h} mm".
format(p=msg_prefix, w=config.chip_width, h=config.chip_height))
def parse_command_line():
version = 2.0
description = "A python based temperature (thermal) map generation tool for HotSpot-6.0 (http://lava.cs.virginia.edu/HotSpot/), Author: Gaurav Kothari (gkothar1@binghamton.edu) v{v}".format(
v=version)
parser = argparse.ArgumentParser(description=description)
parser.add_argument("-a",
"--action",
action="store",
dest="action",
required=True,
choices=["flp", "steady", "grid-steady"],
help="Action type")
parser.add_argument("-3D",
"--model-3D",
action="store_true",
dest="model_3d",
required=False,
default=False,
help="To indicate a 3D system")
parser.add_argument("-f",
"--flp",
action="store",
dest="floor_plan",
required=True,
help="Floor-plan file")
parser.add_argument(
"-t",
"--temperature",
action="store",
dest="temperature_file",
required=("steady" in argv) or ("grid-steady" in argv),
help=
"Steady temperature file or Grid steady temperature file based on action"
)
parser.add_argument("-r",
"--row",
action="store",
dest="grid_rows",
type=int,
required=("grid-steady" in argv),
help="Number of rows in grid-steady model")
parser.add_argument("-c",
"--col",
action="store",
dest="grid_cols",
type=int,
required=("grid-steady" in argv),
help="Number of columns in grid-steady model")
parser.add_argument("-ft",
"--font",
action="store",
dest="font",
required=False,
default="Ubuntu",
help="Font family")
parser.add_argument("-fts",
"--font-size",
action="store",
dest="font_size",
required=False,
default=9,
type=int,
help="Font size")
parser.add_argument("-ftw",
"--font-weight",
action="store",
dest="font_weight",
required=False,
default="normal",
help="Font weight")
parser.add_argument("-o",
"--output-file",
action="store",
dest="output_file",
required=True,
help="Output file name prefix")
parser.add_argument("-d",
"--output-directory",
action="store",
dest="output_dir",
required=False,
default=os.getcwd(),
help="Output directory")
parser.add_argument("-hn",
"--hide-names",
action="store_true",
dest="hide_names",
required=False,
default=False,
help="Hide names on floor-plan")
parser.add_argument("-z",
"--zoom-by",
action="store",
dest="zoom_by",
type=int,
required=False,
default=75000,
help="Zoom factor")
parser.add_argument("-pcd",
"--print-chip-dim",
action="store_true",
dest="print_chip_dim",
required=False,
default=False,
help="Draw chip' width and height scale")
parser.add_argument("-concat",
"--concat-3D",
action="store_true",
dest="concat",
required=False,
default=False,
help="Combines the images generated for all layer into a single PDF")
parser.add_argument(
"-pa",
"--print-area",
action="store_true",
dest="print_area",
required=False,
default=False,
help=
"Print unit's area (mm2) alongside its name, rounded to three decimal places"
)
args = parser.parse_args()
print("{p} {d}".format(p=msg_prefix, d=description))
print("")
return args
def main():
config = parse_command_line()
# before we start drawing images, first quickly read floor-plan file
# and calculate the chip's width and height
setup_chip_dimensions(config)
if config.model_3d:
main_3d(config)
else:
main_2d(config)
if __name__ == "__main__":
main()
| true
| true
|
f70a26e07705cfcdd4b9700935899358780391f1
| 2,001
|
py
|
Python
|
setup.py
|
felixfire/LiteWQL
|
8b47d1617041f1e9505bdbee713536a13a3ef88e
|
[
"Apache-2.0"
] | null | null | null |
setup.py
|
felixfire/LiteWQL
|
8b47d1617041f1e9505bdbee713536a13a3ef88e
|
[
"Apache-2.0"
] | null | null | null |
setup.py
|
felixfire/LiteWQL
|
8b47d1617041f1e9505bdbee713536a13a3ef88e
|
[
"Apache-2.0"
] | null | null | null |
import os
from setuptools import setup, find_packages
def read(fn):
path = os.path.join(os.path.dirname(__file__), fn)
try:
file = open(path, encoding='utf-8')
except TypeError:
file = open(path)
return file.read()
setup(
name='litewql',
version=__import__('litewql').VERSION,
description='Lite web queries language',
long_description=read('README.md'),
long_description_content_type="text/markdown",
author='Vadim Sharay',
author_email='vadimsharay@gmail.com',
packages=find_packages(exclude=['tests']),
zip_safe=False,
include_package_data=True,
install_requires=[
"regex"
],
classifiers=[
'Development Status :: 2 - Pre-Alpha',
# 'Development Status :: 3 - Alpha',
# 'Development Status :: 4 - Beta',
# 'Development Status :: 5 - Production/Stable',
# 'Development Status :: 6 - Mature',
# 'Development Status :: 7 - Inactive',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Operating System :: MacOS',
'Operating System :: Unix',
'Programming Language :: Python',
# 'Programming Language :: Python :: 2',
# 'Programming Language :: Python :: 2.7',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
"Programming Language :: Python :: Implementation :: PyPy3",
'Topic :: Software Development :: Libraries'
]
)
| 35.732143
| 72
| 0.575212
|
import os
from setuptools import setup, find_packages
def read(fn):
path = os.path.join(os.path.dirname(__file__), fn)
try:
file = open(path, encoding='utf-8')
except TypeError:
file = open(path)
return file.read()
setup(
name='litewql',
version=__import__('litewql').VERSION,
description='Lite web queries language',
long_description=read('README.md'),
long_description_content_type="text/markdown",
author='Vadim Sharay',
author_email='vadimsharay@gmail.com',
packages=find_packages(exclude=['tests']),
zip_safe=False,
include_package_data=True,
install_requires=[
"regex"
],
classifiers=[
'Development Status :: 2 - Pre-Alpha',
'Intended Audience :: Developers',
'Intended Audience :: End Users/Desktop',
'Intended Audience :: Information Technology',
'Intended Audience :: Science/Research',
'Intended Audience :: System Administrators',
'License :: OSI Approved :: BSD License',
'Operating System :: POSIX',
'Operating System :: MacOS',
'Operating System :: Unix',
'Programming Language :: Python',
'Programming Language :: Python :: 3',
'Programming Language :: Python :: 3.4',
'Programming Language :: Python :: 3.5',
'Programming Language :: Python :: 3.6',
'Programming Language :: Python :: 3.7',
"Programming Language :: Python :: Implementation :: PyPy3",
'Topic :: Software Development :: Libraries'
]
)
| true
| true
|
f70a27ec88c165e9fe3b4e47800e5ac9b23f1af0
| 18,393
|
py
|
Python
|
pythonProject1/venv/Lib/site-packages/jsonlint/validators.py
|
mjtomlinson/CNE330_Python_1_Final_Project
|
05020806860937ef37b9a0ad2e27de4897a606de
|
[
"CC0-1.0"
] | null | null | null |
pythonProject1/venv/Lib/site-packages/jsonlint/validators.py
|
mjtomlinson/CNE330_Python_1_Final_Project
|
05020806860937ef37b9a0ad2e27de4897a606de
|
[
"CC0-1.0"
] | null | null | null |
pythonProject1/venv/Lib/site-packages/jsonlint/validators.py
|
mjtomlinson/CNE330_Python_1_Final_Project
|
05020806860937ef37b9a0ad2e27de4897a606de
|
[
"CC0-1.0"
] | null | null | null |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import re
import uuid
from jsonlint.compat import string_types, text_type
__all__ = (
'DataRequired', 'data_required', 'Email', 'email', 'EqualTo', 'equal_to',
'IPAddress', 'ip_address', 'InputRequired', 'input_required', 'Length',
'length', 'NumberRange', 'number_range', 'Optional', 'optional',
'Regexp', 'regexp', 'URL', 'url', 'AnyOf',
'any_of', 'NoneOf', 'none_of', 'MacAddress', 'mac_address', 'UUID'
)
class ValidationError(ValueError):
"""
Raised when a validator fails to validate its input.
"""
def __init__(self, message='', *args, **kwargs):
ValueError.__init__(self, message, *args, **kwargs)
class StopValidation(Exception):
"""
Causes the validation chain to stop.
If StopValidation is raised, no more validators in the validation chain are
called. If raised with a message, the message will be added to the errors
list.
"""
def __init__(self, message='', *args, **kwargs):
Exception.__init__(self, message, *args, **kwargs)
class EqualTo(object):
"""
Compares the values of two fields.
:param fieldname:
The name of the other field to compare to.
:param message:
Error message to raise in case of a validation error. Can be
interpolated with `%(other_label)s` and `%(other_name)s` to provide a
more helpful error.
"""
def __init__(self, fieldname, message=None):
self.fieldname = fieldname
self.message = message
def __call__(self, form, field):
try:
other = form[self.fieldname]
except KeyError:
raise ValidationError(field.gettext("Invalid field name '%s'.") % self.fieldname)
if field.data != other.data:
d = {
'other_label': hasattr(other, 'label') and other.label.text or self.fieldname,
'other_name': self.fieldname
}
message = self.message
if message is None:
message = field.gettext('Field must be equal to %(other_name)s.')
raise ValidationError(message % d)
class Length(object):
"""
Validates the length of a string.
:param min:
The minimum required length of the string. If not provided, minimum
length will not be checked.
:param max:
The maximum length of the string. If not provided, maximum length
will not be checked.
:param message:
Error message to raise in case of a validation error. Can be
interpolated using `%(min)d` and `%(max)d` if desired. Useful defaults
are provided depending on the existence of min and max.
"""
def __init__(self, min=-1, max=-1, message=None):
assert min != -1 or max != -1, 'At least one of `min` or `max` must be specified.'
assert max == -1 or min <= max, '`min` cannot be more than `max`.'
self.min = min
self.max = max
self.message = message
def __call__(self, form, field):
l = field.data and len(field.data) or 0
if l < self.min or self.max != -1 and l > self.max:
message = self.message
if message is None:
if self.max == -1:
message = field.ngettext('Field must be at least %(min)d character long.',
'Field must be at least %(min)d characters long.', self.min)
elif self.min == -1:
message = field.ngettext('Field cannot be longer than %(max)d character.',
'Field cannot be longer than %(max)d characters.', self.max)
else:
message = field.gettext('Field must be between %(min)d and %(max)d characters long.')
raise ValidationError(message % dict(min=self.min, max=self.max, length=l))
class NumberRange(object):
"""
Validates that a number is of a minimum and/or maximum value, inclusive.
This will work with any comparable number type, such as floats and
decimals, not just integers.
:param min:
The minimum required value of the number. If not provided, minimum
value will not be checked.
:param max:
The maximum value of the number. If not provided, maximum value
will not be checked.
:param message:
Error message to raise in case of a validation error. Can be
interpolated using `%(min)s` and `%(max)s` if desired. Useful defaults
are provided depending on the existence of min and max.
"""
def __init__(self, min=None, max=None, message=None):
self.min = min
self.max = max
self.message = message
def __call__(self, form, field):
data = field.data
if data is None or (self.min is not None and data < self.min) or \
(self.max is not None and data > self.max):
message = self.message
if message is None:
# we use %(min)s interpolation to support floats, None, and
# Decimals without throwing a formatting exception.
if self.max is None:
message = field.gettext('Number must be at least %(min)s.')
elif self.min is None:
message = field.gettext('Number must be at most %(max)s.')
else:
message = field.gettext('Number must be between %(min)s and %(max)s.')
raise ValidationError(message % dict(min=self.min, max=self.max))
class Optional(object):
"""
Allows empty input and stops the validation chain from continuing.
If input is empty, also removes prior errors (such as processing errors)
from the field.
:param strip_whitespace:
If True (the default) also stop the validation chain on input which
consists of only whitespace.
"""
field_flags = ('optional', )
def __init__(self, strip_whitespace=True):
if strip_whitespace:
self.string_check = lambda s: s.strip()
else:
self.string_check = lambda s: s
def __call__(self, form, field):
if not field.raw_data or isinstance(field.raw_data[0], string_types) and not self.string_check(field.raw_data[0]):
field.errors[:] = []
raise StopValidation()
class DataRequired(object):
"""
Checks the field's data is 'truthy' otherwise stops the validation chain.
This validator checks that the ``data`` attribute on the field is a 'true'
value (effectively, it does ``if field.data``.) Furthermore, if the data
is a string type, a string containing only whitespace characters is
considered false.
If the data is empty, also removes prior errors (such as processing errors)
from the field.
**NOTE** this validator used to be called `Required` but the way it behaved
(requiring coerced data, not input data) meant it functioned in a way
which was not symmetric to the `Optional` validator and furthermore caused
confusion with certain fields which coerced data to 'falsey' values like
``0``, ``Decimal(0)``, ``time(0)`` etc. Unless a very specific reason
exists, we recommend using the :class:`InputRequired` instead.
:param message:
Error message to raise in case of a validation error.
"""
field_flags = ('required', )
def __init__(self, message=None):
self.message = message
def __call__(self, form, field):
if not field.data or isinstance(field.data, string_types) and not field.data.strip():
if self.message is None:
message = field.gettext('This field is required.')
else:
message = self.message
field.errors[:] = []
raise StopValidation(message)
class InputRequired(object):
"""
Validates that input was provided for this field.
Note there is a distinction between this and DataRequired in that
InputRequired looks that form-input data was provided, and DataRequired
looks at the post-coercion data.
"""
field_flags = ('required', )
def __init__(self, message=None):
self.message = message
def __call__(self, form, field):
if not field.raw_data or not field.raw_data[0]:
if self.message is None:
message = field.gettext('This field is required.')
else:
message = self.message
field.errors[:] = []
raise StopValidation(message)
class Regexp(object):
"""
Validates the field against a user provided regexp.
:param regex:
The regular expression string to use. Can also be a compiled regular
expression pattern.
:param flags:
The regexp flags to use, for example re.IGNORECASE. Ignored if
`regex` is not a string.
:param message:
Error message to raise in case of a validation error.
"""
def __init__(self, regex, flags=0, message=None):
if isinstance(regex, string_types):
regex = re.compile(regex, flags)
self.regex = regex
self.message = message
def __call__(self, form, field, message=None):
match = self.regex.match(field.data or '')
if not match:
if message is None:
if self.message is None:
message = field.gettext('Invalid input.')
else:
message = self.message
raise ValidationError(message)
return match
class Email(Regexp):
"""
Validates an email address. Note that this uses a very primitive regular
expression and should only be used in instances where you later verify by
other means, such as email activation or lookups.
:param message:
Error message to raise in case of a validation error.
"""
def __init__(self, message=None):
self.validate_hostname = HostnameValidation(
require_tld=True,
)
super(Email, self).__init__(r'^.+@([^.@][^@]+)$', re.IGNORECASE, message)
def __call__(self, form, field):
message = self.message
if message is None:
message = field.gettext('Invalid email address.')
match = super(Email, self).__call__(form, field, message)
if not self.validate_hostname(match.group(1)):
raise ValidationError(message)
class IPAddress(object):
"""
Validates an IP address.
:param ipv4:
If True, accept IPv4 addresses as valid (default True)
:param ipv6:
If True, accept IPv6 addresses as valid (default False)
:param message:
Error message to raise in case of a validation error.
"""
def __init__(self, ipv4=True, ipv6=False, message=None):
if not ipv4 and not ipv6:
raise ValueError('IP Address Validator must have at least one of ipv4 or ipv6 enabled.')
self.ipv4 = ipv4
self.ipv6 = ipv6
self.message = message
def __call__(self, form, field):
value = field.data
valid = False
if value:
valid = (self.ipv4 and self.check_ipv4(value)) or (self.ipv6 and self.check_ipv6(value))
if not valid:
message = self.message
if message is None:
message = field.gettext('Invalid IP address.')
raise ValidationError(message)
@classmethod
def check_ipv4(cls, value):
parts = value.split('.')
if len(parts) == 4 and all(x.isdigit() for x in parts):
numbers = list(int(x) for x in parts)
return all(num >= 0 and num < 256 for num in numbers)
return False
@classmethod
def check_ipv6(cls, value):
parts = value.split(':')
if len(parts) > 8:
return False
num_blank = 0
for part in parts:
if not part:
num_blank += 1
else:
try:
value = int(part, 16)
except ValueError:
return False
else:
if value < 0 or value >= 65536:
return False
if num_blank < 2:
return True
elif num_blank == 2 and not parts[0] and not parts[1]:
return True
return False
class MacAddress(Regexp):
"""
Validates a MAC address.
:param message:
Error message to raise in case of a validation error.
"""
def __init__(self, message=None):
pattern = r'^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'
super(MacAddress, self).__init__(pattern, message=message)
def __call__(self, form, field):
message = self.message
if message is None:
message = field.gettext('Invalid Mac address.')
super(MacAddress, self).__call__(form, field, message)
class URL(Regexp):
"""
Simple regexp based url validation. Much like the email validator, you
probably want to validate the url later by other means if the url must
resolve.
:param require_tld:
If true, then the domain-name portion of the URL must contain a .tld
suffix. Set this to false if you want to allow domains like
`localhost`.
:param message:
Error message to raise in case of a validation error.
"""
def __init__(self, require_tld=True, message=None):
regex = r'^[a-z]+://(?P<host>[^/:]+)(?P<port>:[0-9]+)?(?P<path>\/.*)?$'
super(URL, self).__init__(regex, re.IGNORECASE, message)
self.validate_hostname = HostnameValidation(
require_tld=require_tld,
allow_ip=True,
)
def __call__(self, form, field):
message = self.message
if message is None:
message = field.gettext('Invalid URL.')
match = super(URL, self).__call__(form, field, message)
if not self.validate_hostname(match.group('host')):
raise ValidationError(message)
class UUID(object):
"""
Validates a UUID.
:param message:
Error message to raise in case of a validation error.
"""
def __init__(self, message=None):
self.message = message
def __call__(self, form, field):
message = self.message
if message is None:
message = field.gettext('Invalid UUID.')
try:
uuid.UUID(field.data)
except ValueError:
raise ValidationError(message)
class AnyOf(object):
"""
Compares the incoming data to a sequence of valid inputs.
:param values:
A sequence of valid inputs.
:param message:
Error message to raise in case of a validation error. `%(values)s`
contains the list of values.
:param values_formatter:
Function used to format the list of values in the error message.
"""
def __init__(self, values, message=None, values_formatter=None):
self.values = values
self.message = message
if values_formatter is None:
values_formatter = self.default_values_formatter
self.values_formatter = values_formatter
def __call__(self, form, field):
if field.data not in self.values:
message = self.message
if message is None:
message = field.gettext('Invalid value, must be one of: %(values)s.')
raise ValidationError(message % dict(values=self.values_formatter(self.values)))
@staticmethod
def default_values_formatter(values):
return ', '.join(text_type(x) for x in values)
class NoneOf(object):
"""
Compares the incoming data to a sequence of invalid inputs.
:param values:
A sequence of invalid inputs.
:param message:
Error message to raise in case of a validation error. `%(values)s`
contains the list of values.
:param values_formatter:
Function used to format the list of values in the error message.
"""
def __init__(self, values, message=None, values_formatter=None):
self.values = values
self.message = message
if values_formatter is None:
values_formatter = self.default_values_formatter
self.values_formatter = values_formatter
def __call__(self, form, field):
if field.data in self.values:
message = self.message
if message is None:
message = field.gettext('Invalid value, can\'t be any of: %(values)s.')
raise ValidationError(message % dict(values=self.values_formatter(self.values)))
@staticmethod
def default_values_formatter(v):
return ', '.join(text_type(x) for x in v)
class HostnameValidation(object):
"""
Helper class for checking hostnames for validation.
This is not a validator in and of itself, and as such is not exported.
"""
hostname_part = re.compile(r'^(xn-|[a-z0-9]+)(-[a-z0-9]+)*$', re.IGNORECASE)
tld_part = re.compile(r'^([a-z]{2,20}|xn--([a-z0-9]+-)*[a-z0-9]+)$', re.IGNORECASE)
def __init__(self, require_tld=True, allow_ip=False):
self.require_tld = require_tld
self.allow_ip = allow_ip
def __call__(self, hostname):
if self.allow_ip:
if IPAddress.check_ipv4(hostname) or IPAddress.check_ipv6(hostname):
return True
# Encode out IDNA hostnames. This makes further validation easier.
hostname = hostname.encode('idna')
# Turn back into a string in Python 3x
if not isinstance(hostname, string_types):
hostname = hostname.decode('ascii')
# Check that all labels in the hostname are valid
parts = hostname.split('.')
for part in parts:
if not part or len(part) > 63:
return False
if not self.hostname_part.match(part):
return False
if self.require_tld:
if len(parts) < 2 or not self.tld_part.match(parts[-1]):
return False
return True
email = Email
equal_to = EqualTo
ip_address = IPAddress
mac_address = MacAddress
length = Length
number_range = NumberRange
optional = Optional
input_required = InputRequired
data_required = DataRequired
regexp = Regexp
url = URL
any_of = AnyOf
none_of = NoneOf
| 33.810662
| 122
| 0.610558
|
from __future__ import unicode_literals
import re
import uuid
from jsonlint.compat import string_types, text_type
__all__ = (
'DataRequired', 'data_required', 'Email', 'email', 'EqualTo', 'equal_to',
'IPAddress', 'ip_address', 'InputRequired', 'input_required', 'Length',
'length', 'NumberRange', 'number_range', 'Optional', 'optional',
'Regexp', 'regexp', 'URL', 'url', 'AnyOf',
'any_of', 'NoneOf', 'none_of', 'MacAddress', 'mac_address', 'UUID'
)
class ValidationError(ValueError):
def __init__(self, message='', *args, **kwargs):
ValueError.__init__(self, message, *args, **kwargs)
class StopValidation(Exception):
def __init__(self, message='', *args, **kwargs):
Exception.__init__(self, message, *args, **kwargs)
class EqualTo(object):
def __init__(self, fieldname, message=None):
self.fieldname = fieldname
self.message = message
def __call__(self, form, field):
try:
other = form[self.fieldname]
except KeyError:
raise ValidationError(field.gettext("Invalid field name '%s'.") % self.fieldname)
if field.data != other.data:
d = {
'other_label': hasattr(other, 'label') and other.label.text or self.fieldname,
'other_name': self.fieldname
}
message = self.message
if message is None:
message = field.gettext('Field must be equal to %(other_name)s.')
raise ValidationError(message % d)
class Length(object):
def __init__(self, min=-1, max=-1, message=None):
assert min != -1 or max != -1, 'At least one of `min` or `max` must be specified.'
assert max == -1 or min <= max, '`min` cannot be more than `max`.'
self.min = min
self.max = max
self.message = message
def __call__(self, form, field):
l = field.data and len(field.data) or 0
if l < self.min or self.max != -1 and l > self.max:
message = self.message
if message is None:
if self.max == -1:
message = field.ngettext('Field must be at least %(min)d character long.',
'Field must be at least %(min)d characters long.', self.min)
elif self.min == -1:
message = field.ngettext('Field cannot be longer than %(max)d character.',
'Field cannot be longer than %(max)d characters.', self.max)
else:
message = field.gettext('Field must be between %(min)d and %(max)d characters long.')
raise ValidationError(message % dict(min=self.min, max=self.max, length=l))
class NumberRange(object):
def __init__(self, min=None, max=None, message=None):
self.min = min
self.max = max
self.message = message
def __call__(self, form, field):
data = field.data
if data is None or (self.min is not None and data < self.min) or \
(self.max is not None and data > self.max):
message = self.message
if message is None:
if self.max is None:
message = field.gettext('Number must be at least %(min)s.')
elif self.min is None:
message = field.gettext('Number must be at most %(max)s.')
else:
message = field.gettext('Number must be between %(min)s and %(max)s.')
raise ValidationError(message % dict(min=self.min, max=self.max))
class Optional(object):
field_flags = ('optional', )
def __init__(self, strip_whitespace=True):
if strip_whitespace:
self.string_check = lambda s: s.strip()
else:
self.string_check = lambda s: s
def __call__(self, form, field):
if not field.raw_data or isinstance(field.raw_data[0], string_types) and not self.string_check(field.raw_data[0]):
field.errors[:] = []
raise StopValidation()
class DataRequired(object):
field_flags = ('required', )
def __init__(self, message=None):
self.message = message
def __call__(self, form, field):
if not field.data or isinstance(field.data, string_types) and not field.data.strip():
if self.message is None:
message = field.gettext('This field is required.')
else:
message = self.message
field.errors[:] = []
raise StopValidation(message)
class InputRequired(object):
field_flags = ('required', )
def __init__(self, message=None):
self.message = message
def __call__(self, form, field):
if not field.raw_data or not field.raw_data[0]:
if self.message is None:
message = field.gettext('This field is required.')
else:
message = self.message
field.errors[:] = []
raise StopValidation(message)
class Regexp(object):
def __init__(self, regex, flags=0, message=None):
if isinstance(regex, string_types):
regex = re.compile(regex, flags)
self.regex = regex
self.message = message
def __call__(self, form, field, message=None):
match = self.regex.match(field.data or '')
if not match:
if message is None:
if self.message is None:
message = field.gettext('Invalid input.')
else:
message = self.message
raise ValidationError(message)
return match
class Email(Regexp):
def __init__(self, message=None):
self.validate_hostname = HostnameValidation(
require_tld=True,
)
super(Email, self).__init__(r'^.+@([^.@][^@]+)$', re.IGNORECASE, message)
def __call__(self, form, field):
message = self.message
if message is None:
message = field.gettext('Invalid email address.')
match = super(Email, self).__call__(form, field, message)
if not self.validate_hostname(match.group(1)):
raise ValidationError(message)
class IPAddress(object):
def __init__(self, ipv4=True, ipv6=False, message=None):
if not ipv4 and not ipv6:
raise ValueError('IP Address Validator must have at least one of ipv4 or ipv6 enabled.')
self.ipv4 = ipv4
self.ipv6 = ipv6
self.message = message
def __call__(self, form, field):
value = field.data
valid = False
if value:
valid = (self.ipv4 and self.check_ipv4(value)) or (self.ipv6 and self.check_ipv6(value))
if not valid:
message = self.message
if message is None:
message = field.gettext('Invalid IP address.')
raise ValidationError(message)
@classmethod
def check_ipv4(cls, value):
parts = value.split('.')
if len(parts) == 4 and all(x.isdigit() for x in parts):
numbers = list(int(x) for x in parts)
return all(num >= 0 and num < 256 for num in numbers)
return False
@classmethod
def check_ipv6(cls, value):
parts = value.split(':')
if len(parts) > 8:
return False
num_blank = 0
for part in parts:
if not part:
num_blank += 1
else:
try:
value = int(part, 16)
except ValueError:
return False
else:
if value < 0 or value >= 65536:
return False
if num_blank < 2:
return True
elif num_blank == 2 and not parts[0] and not parts[1]:
return True
return False
class MacAddress(Regexp):
def __init__(self, message=None):
pattern = r'^(?:[0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$'
super(MacAddress, self).__init__(pattern, message=message)
def __call__(self, form, field):
message = self.message
if message is None:
message = field.gettext('Invalid Mac address.')
super(MacAddress, self).__call__(form, field, message)
class URL(Regexp):
def __init__(self, require_tld=True, message=None):
regex = r'^[a-z]+://(?P<host>[^/:]+)(?P<port>:[0-9]+)?(?P<path>\/.*)?$'
super(URL, self).__init__(regex, re.IGNORECASE, message)
self.validate_hostname = HostnameValidation(
require_tld=require_tld,
allow_ip=True,
)
def __call__(self, form, field):
message = self.message
if message is None:
message = field.gettext('Invalid URL.')
match = super(URL, self).__call__(form, field, message)
if not self.validate_hostname(match.group('host')):
raise ValidationError(message)
class UUID(object):
def __init__(self, message=None):
self.message = message
def __call__(self, form, field):
message = self.message
if message is None:
message = field.gettext('Invalid UUID.')
try:
uuid.UUID(field.data)
except ValueError:
raise ValidationError(message)
class AnyOf(object):
def __init__(self, values, message=None, values_formatter=None):
self.values = values
self.message = message
if values_formatter is None:
values_formatter = self.default_values_formatter
self.values_formatter = values_formatter
def __call__(self, form, field):
if field.data not in self.values:
message = self.message
if message is None:
message = field.gettext('Invalid value, must be one of: %(values)s.')
raise ValidationError(message % dict(values=self.values_formatter(self.values)))
@staticmethod
def default_values_formatter(values):
return ', '.join(text_type(x) for x in values)
class NoneOf(object):
def __init__(self, values, message=None, values_formatter=None):
self.values = values
self.message = message
if values_formatter is None:
values_formatter = self.default_values_formatter
self.values_formatter = values_formatter
def __call__(self, form, field):
if field.data in self.values:
message = self.message
if message is None:
message = field.gettext('Invalid value, can\'t be any of: %(values)s.')
raise ValidationError(message % dict(values=self.values_formatter(self.values)))
@staticmethod
def default_values_formatter(v):
return ', '.join(text_type(x) for x in v)
class HostnameValidation(object):
hostname_part = re.compile(r'^(xn-|[a-z0-9]+)(-[a-z0-9]+)*$', re.IGNORECASE)
tld_part = re.compile(r'^([a-z]{2,20}|xn--([a-z0-9]+-)*[a-z0-9]+)$', re.IGNORECASE)
def __init__(self, require_tld=True, allow_ip=False):
self.require_tld = require_tld
self.allow_ip = allow_ip
def __call__(self, hostname):
if self.allow_ip:
if IPAddress.check_ipv4(hostname) or IPAddress.check_ipv6(hostname):
return True
# Encode out IDNA hostnames. This makes further validation easier.
hostname = hostname.encode('idna')
# Turn back into a string in Python 3x
if not isinstance(hostname, string_types):
hostname = hostname.decode('ascii')
# Check that all labels in the hostname are valid
parts = hostname.split('.')
for part in parts:
if not part or len(part) > 63:
return False
if not self.hostname_part.match(part):
return False
if self.require_tld:
if len(parts) < 2 or not self.tld_part.match(parts[-1]):
return False
return True
email = Email
equal_to = EqualTo
ip_address = IPAddress
mac_address = MacAddress
length = Length
number_range = NumberRange
optional = Optional
input_required = InputRequired
data_required = DataRequired
regexp = Regexp
url = URL
any_of = AnyOf
none_of = NoneOf
| true
| true
|
f70a284e5edac34ac2e87eccb11a9a4ed65666e9
| 7,722
|
py
|
Python
|
sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys.py
|
anuchandy/azure-sdk-for-python
|
589b9890554ebf261aa2184e8f1c6507f01a207c
|
[
"MIT"
] | null | null | null |
sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys.py
|
anuchandy/azure-sdk-for-python
|
589b9890554ebf261aa2184e8f1c6507f01a207c
|
[
"MIT"
] | null | null | null |
sdk/keyvault/azure-keyvault-keys/tests/test_samples_keys.py
|
anuchandy/azure-sdk-for-python
|
589b9890554ebf261aa2184e8f1c6507f01a207c
|
[
"MIT"
] | null | null | null |
# ------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT License.
# ------------------------------------
from __future__ import print_function
import functools
import hashlib
import os
from azure.core.exceptions import ResourceNotFoundError
from devtools_testutils import ResourceGroupPreparer, KeyVaultPreparer
from keys_preparer import VaultClientPreparer
from keys_test_case import KeyVaultTestCase
def print(*args):
assert all(arg is not None for arg in args)
def test_create_key_client():
vault_url = "vault_url"
# pylint:disable=unused-variable
# [START create_key_client]
from azure.identity import DefaultAzureCredential
from azure.keyvault.keys import KeyClient
# Create a KeyClient using default Azure credentials
credential = DefaultAzureCredential()
key_client = KeyClient(vault_url, credential)
# [END create_key_client]
class TestExamplesKeyVault(KeyVaultTestCase):
@ResourceGroupPreparer(random_name_enabled=True)
@KeyVaultPreparer(enable_soft_delete=True)
@VaultClientPreparer()
def test_example_key_crud_operations(self, vault_client, **kwargs):
from dateutil import parser as date_parse
key_client = vault_client.keys
# [START create_key]
from dateutil import parser as date_parse
expires_on = date_parse.parse("2050-02-02T08:00:00.000Z")
# create a key with optional arguments
key = key_client.create_key("key-name", "RSA-HSM", expires_on=expires_on)
print(key.name)
print(key.id)
print(key.key_type)
print(key.properties.expires_on)
# [END create_key]
# [START create_rsa_key]
key_size = 2048
key_ops = ["encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey"]
# create an rsa key with size specification
# RSA key can be created with default size of '2048'
key = key_client.create_rsa_key("key-name", hardware_protected=True, size=key_size, key_operations=key_ops)
print(key.id)
print(key.name)
print(key.key_type)
print(key.key_operations)
# [END create_rsa_key]
# [START create_ec_key]
key_curve = "P-256"
# create an EC (Elliptic curve) key with curve specification
# EC key can be created with default curve of 'P-256'
ec_key = key_client.create_ec_key("key-name", curve=key_curve)
print(ec_key.id)
print(ec_key.properties.version)
print(ec_key.key_type)
print(ec_key.key.crv)
# [END create_ec_key]
# [START get_key]
# get the latest version of a key
key = key_client.get_key("key-name")
# alternatively, specify a version
key_version = key.properties.version
key = key_client.get_key("key-name", key_version)
print(key.id)
print(key.name)
print(key.properties.version)
print(key.key_type)
print(key.properties.vault_url)
# [END get_key]
# [START update_key]
# update attributes of an existing key
expires_on = date_parse.parse("2050-01-02T08:00:00.000Z")
tags = {"foo": "updated tag"}
updated_key = key_client.update_key_properties(key.name, expires_on=expires_on, tags=tags)
print(updated_key.properties.version)
print(updated_key.properties.updated_on)
print(updated_key.properties.expires_on)
print(updated_key.properties.tags)
print(key.key_type)
# [END update_key]
# [START delete_key]
# delete a key
deleted_key_poller = key_client.begin_delete_key("key-name")
deleted_key = deleted_key_poller.result()
print(deleted_key.name)
# if the vault has soft-delete enabled, the key's deleted_date,
# scheduled purge date and recovery id are set
print(deleted_key.deleted_date)
print(deleted_key.scheduled_purge_date)
print(deleted_key.recovery_id)
# if you want to block until deletion is complete, call wait() on the poller
deleted_key_poller.wait()
# [END delete_key]
@ResourceGroupPreparer(random_name_enabled=True)
@KeyVaultPreparer(enable_soft_delete=True)
@VaultClientPreparer()
def test_example_key_list_operations(self, vault_client, **kwargs):
key_client = vault_client.keys
for i in range(4):
key_client.create_ec_key("key{}".format(i))
for i in range(4):
key_client.create_rsa_key("key{}".format(i))
# [START list_keys]
# get an iterator of keys
keys = key_client.list_properties_of_keys()
for key in keys:
print(key.id)
print(key.name)
# [END list_keys]
# [START list_properties_of_key_versions]
# get an iterator of a key's versions
key_versions = key_client.list_properties_of_key_versions("key-name")
for key in key_versions:
print(key.id)
print(key.name)
# [END list_properties_of_key_versions]
# [START list_deleted_keys]
# get an iterator of deleted keys (requires soft-delete enabled for the vault)
deleted_keys = key_client.list_deleted_keys()
for key in deleted_keys:
print(key.id)
print(key.name)
print(key.scheduled_purge_date)
print(key.recovery_id)
print(key.deleted_date)
# [END list_deleted_keys]
@ResourceGroupPreparer(random_name_enabled=True)
@KeyVaultPreparer()
@VaultClientPreparer()
def test_example_keys_backup_restore(self, vault_client, **kwargs):
key_client = vault_client.keys
created_key = key_client.create_key("keyrec", "RSA")
key_name = created_key.name
# [START backup_key]
# backup key
key_backup = key_client.backup_key(key_name)
# returns the raw bytes of the backed up key
print(key_backup)
# [END backup_key]
key_client.begin_delete_key(key_name).wait()
# [START restore_key_backup]
# restore a key backup
restored_key = key_client.restore_key_backup(key_backup)
print(restored_key.id)
print(restored_key.properties.version)
# [END restore_key_backup]
@ResourceGroupPreparer(random_name_enabled=True)
@KeyVaultPreparer(enable_soft_delete=True)
@VaultClientPreparer()
def test_example_keys_recover(self, vault_client, **kwargs):
key_client = vault_client.keys
created_key = key_client.create_key("key-name", "RSA")
key_client.begin_delete_key(created_key.name).wait()
# [START get_deleted_key]
# get a deleted key (requires soft-delete enabled for the vault)
deleted_key = key_client.get_deleted_key("key-name")
print(deleted_key.name)
# if the vault has soft-delete enabled, the key's deleted_date
# scheduled purge date and recovery id are set
print(deleted_key.deleted_date)
print(deleted_key.scheduled_purge_date)
print(deleted_key.recovery_id)
# [END get_deleted_key]
# [START recover_deleted_key]
# recover a deleted key to its latest version (requires soft-delete enabled for the vault)
recover_key_poller = key_client.begin_recover_deleted_key("key-name")
recovered_key = recover_key_poller.result()
print(recovered_key.id)
print(recovered_key.name)
# if you want to block until key is recovered server-side, call wait() on the poller
recover_key_poller.wait()
# [END recover_deleted_key]
| 31.909091
| 115
| 0.662264
|
from __future__ import print_function
import functools
import hashlib
import os
from azure.core.exceptions import ResourceNotFoundError
from devtools_testutils import ResourceGroupPreparer, KeyVaultPreparer
from keys_preparer import VaultClientPreparer
from keys_test_case import KeyVaultTestCase
def print(*args):
assert all(arg is not None for arg in args)
def test_create_key_client():
vault_url = "vault_url"
from azure.identity import DefaultAzureCredential
from azure.keyvault.keys import KeyClient
credential = DefaultAzureCredential()
key_client = KeyClient(vault_url, credential)
class TestExamplesKeyVault(KeyVaultTestCase):
@ResourceGroupPreparer(random_name_enabled=True)
@KeyVaultPreparer(enable_soft_delete=True)
@VaultClientPreparer()
def test_example_key_crud_operations(self, vault_client, **kwargs):
from dateutil import parser as date_parse
key_client = vault_client.keys
from dateutil import parser as date_parse
expires_on = date_parse.parse("2050-02-02T08:00:00.000Z")
key = key_client.create_key("key-name", "RSA-HSM", expires_on=expires_on)
print(key.name)
print(key.id)
print(key.key_type)
print(key.properties.expires_on)
key_size = 2048
key_ops = ["encrypt", "decrypt", "sign", "verify", "wrapKey", "unwrapKey"]
key = key_client.create_rsa_key("key-name", hardware_protected=True, size=key_size, key_operations=key_ops)
print(key.id)
print(key.name)
print(key.key_type)
print(key.key_operations)
key_curve = "P-256"
ec_key = key_client.create_ec_key("key-name", curve=key_curve)
print(ec_key.id)
print(ec_key.properties.version)
print(ec_key.key_type)
print(ec_key.key.crv)
key = key_client.get_key("key-name")
key_version = key.properties.version
key = key_client.get_key("key-name", key_version)
print(key.id)
print(key.name)
print(key.properties.version)
print(key.key_type)
print(key.properties.vault_url)
expires_on = date_parse.parse("2050-01-02T08:00:00.000Z")
tags = {"foo": "updated tag"}
updated_key = key_client.update_key_properties(key.name, expires_on=expires_on, tags=tags)
print(updated_key.properties.version)
print(updated_key.properties.updated_on)
print(updated_key.properties.expires_on)
print(updated_key.properties.tags)
print(key.key_type)
deleted_key_poller = key_client.begin_delete_key("key-name")
deleted_key = deleted_key_poller.result()
print(deleted_key.name)
# scheduled purge date and recovery id are set
print(deleted_key.deleted_date)
print(deleted_key.scheduled_purge_date)
print(deleted_key.recovery_id)
# if you want to block until deletion is complete, call wait() on the poller
deleted_key_poller.wait()
# [END delete_key]
@ResourceGroupPreparer(random_name_enabled=True)
@KeyVaultPreparer(enable_soft_delete=True)
@VaultClientPreparer()
def test_example_key_list_operations(self, vault_client, **kwargs):
key_client = vault_client.keys
for i in range(4):
key_client.create_ec_key("key{}".format(i))
for i in range(4):
key_client.create_rsa_key("key{}".format(i))
# [START list_keys]
# get an iterator of keys
keys = key_client.list_properties_of_keys()
for key in keys:
print(key.id)
print(key.name)
# [END list_keys]
# [START list_properties_of_key_versions]
# get an iterator of a key's versions
key_versions = key_client.list_properties_of_key_versions("key-name")
for key in key_versions:
print(key.id)
print(key.name)
deleted_keys = key_client.list_deleted_keys()
for key in deleted_keys:
print(key.id)
print(key.name)
print(key.scheduled_purge_date)
print(key.recovery_id)
print(key.deleted_date)
@ResourceGroupPreparer(random_name_enabled=True)
@KeyVaultPreparer()
@VaultClientPreparer()
def test_example_keys_backup_restore(self, vault_client, **kwargs):
key_client = vault_client.keys
created_key = key_client.create_key("keyrec", "RSA")
key_name = created_key.name
key_backup = key_client.backup_key(key_name)
print(key_backup)
key_client.begin_delete_key(key_name).wait()
restored_key = key_client.restore_key_backup(key_backup)
print(restored_key.id)
print(restored_key.properties.version)
@ResourceGroupPreparer(random_name_enabled=True)
@KeyVaultPreparer(enable_soft_delete=True)
@VaultClientPreparer()
def test_example_keys_recover(self, vault_client, **kwargs):
key_client = vault_client.keys
created_key = key_client.create_key("key-name", "RSA")
key_client.begin_delete_key(created_key.name).wait()
deleted_key = key_client.get_deleted_key("key-name")
print(deleted_key.name)
# scheduled purge date and recovery id are set
print(deleted_key.deleted_date)
print(deleted_key.scheduled_purge_date)
print(deleted_key.recovery_id)
# [END get_deleted_key]
# [START recover_deleted_key]
# recover a deleted key to its latest version (requires soft-delete enabled for the vault)
recover_key_poller = key_client.begin_recover_deleted_key("key-name")
recovered_key = recover_key_poller.result()
print(recovered_key.id)
print(recovered_key.name)
# if you want to block until key is recovered server-side, call wait() on the poller
recover_key_poller.wait()
# [END recover_deleted_key]
| true
| true
|
f70a286e808fcd8fa7820662a35bec224fa63036
| 6,751
|
py
|
Python
|
selection/truncated/chi.py
|
Xiaoying-Tian/selective-inference
|
a20c5ad3f527beb709d5b8d7301016640738b092
|
[
"BSD-3-Clause"
] | null | null | null |
selection/truncated/chi.py
|
Xiaoying-Tian/selective-inference
|
a20c5ad3f527beb709d5b8d7301016640738b092
|
[
"BSD-3-Clause"
] | null | null | null |
selection/truncated/chi.py
|
Xiaoying-Tian/selective-inference
|
a20c5ad3f527beb709d5b8d7301016640738b092
|
[
"BSD-3-Clause"
] | 1
|
2019-07-13T04:14:12.000Z
|
2019-07-13T04:14:12.000Z
|
"""
This module implements the class `truncated_chi2` which
performs (conditional) UMPU tests for Gaussians
restricted to a set of intervals.
"""
import numpy as np
import mpmath as mp
from scipy.stats import chi, chi2
from .base import truncated, find_root
class truncated_chi(truncated):
"""
>>> from intervals import intervals
>>> I = intervals.intersection(intervals((-1, 6)), \
intervals(( 0, 7)), \
~intervals((1, 4)))
>>> distr = trunc_chi(I, 3, 2.)
>>> print distr.cdf(0)
0.0
>>> z = distr.quantile(distr.cdf(5.))
>>> np.abs(z - 5) < 1e-2
True
"""
def __init__(self, I, k, scale = 1.):
"""
Create a new object for a truncated_chi distribution
Parameters
----------
I : intervals
The intervals the distribution is truncated to
k : int
Number of degree of freedom of the distribution
scale : float
The distribution is \sim scale * \chi_k
"""
self._k = k
self._scale = scale
truncated.__init__(self, I)
def _cdf_notTruncated(self, a, b, dps):
"""
Compute the probability of being in the interval (a, b)
for a variable with a chi distribution (not truncated)
Parameters
----------
a, b : float
Bounds of the interval. Can be infinite.
dps : int
Decimal precision (decimal places). Used in mpmath
Returns
-------
p : float
The probability of being in the intervals (a, b)
P( a < X < b)
for a non truncated variable
"""
scale = self._scale
k = self._k
dps_temp = mp.mp.dps
mp.mp.dps = dps
a = max(0, a)
b = max(0, b)
sf = mp.gammainc(1./2 * k,
1./2*((a/scale)**2),
1./2*((b/scale)**2),
regularized=True)
mp.mp.dps = dps_temp
return sf
def _pdf_notTruncated(self, z, dps):
scale = self._scale
k = self._k
dps = self._dps
return chi.pdf(z/scale, k)
def _quantile_notTruncated(self, q, tol=1.e-6):
"""
Compute the quantile for the non truncated distribution
Parameters
----------
q : float
quantile you want to compute. Between 0 and 1
tol : float
precision for the output
Returns
-------
x : float
x such that P(X < x) = q
"""
scale = self._scale
k = self._k
dps = self._dps
z_approx = scale * chi.ppf(q, k)
epsilon = scale * 0.001
lb = z_approx - epsilon
ub = z_approx + epsilon
f = lambda z: self._cdf_notTruncated(-np.inf, z, dps)
z = find_root(f, q, lb, ub, tol)
return z
class truncated_chi2(truncated):
"""
>>> from intervals import intervals
>>> I = intervals.intersection(intervals((-1, 6)), \
intervals(( 0, 7)), \
~intervals((1, 4)))
>>> distr = trunc_chi(I, 3, 2.)
>>> print distr.cdf(0)
0.0
>>> z = distr.quantile(distr.cdf(5.))
>>> np.abs(z - 5) < 1e-2
True
"""
def __init__(self, I, k, scale = 1.):
"""
Create a new object for a truncated_chi distribution
Parameters
----------
I : intervals
The intervals the distribution is truncated to
k : int
Number of degree of freedom of the distribution
scale : float
The distribution is \sim scale * \chi_k
"""
self._k = k
self._scale = scale
truncated.__init__(self, I)
def _cdf_notTruncated(self, a, b, dps):
"""
Compute the probability of being in the interval (a, b)
for a variable with a chi distribution (not truncated)
Parameters
----------
a, b : float
Bounds of the interval. Can be infinite.
dps : int
Decimal precision (decimal places). Used in mpmath
Returns
-------
p : float
The probability of being in the intervals (a, b)
P( a < X < b)
for a non truncated variable
"""
scale = self._scale
k = self._k
dps_temp = mp.mp.dps
mp.mp.dps = dps
a = max(0, a)
b = max(0, b)
cdf = mp.gammainc(1./2 * k,
1./2*(a/scale),
1./2*(b/scale),
regularized=True)
mp.mp.dps = dps_temp
return cdf
def _pdf_notTruncated(self, z, dps):
scale = self._scale
k = self._k
dps = self._dps
return chi2.pdf(z/scale, k)
def _quantile_notTruncated(self, q, tol=1.e-6):
"""
Compute the quantile for the non truncated distribution
Parameters
----------
q : float
quantile you want to compute. Between 0 and 1
tol : float
precision for the output
Returns
-------
x : float
x such that P(X < x) = q
"""
scale = self._scale
k = self._k
dps = self._dps
z_approx = scale * chi.ppf(q, k)
epsilon = scale * 0.001
lb = z_approx - epsilon
ub = z_approx + epsilon
f = lambda z: self._cdf_notTruncated(-np.inf, z, dps)
z = find_root(f, q, lb, ub, tol)
return z
def _pdf_notTruncated(self, z, dps):
scale = self._scale
k = self._k
#dps = self._dps
return chi2.pdf(z/scale, k)
def _quantile_notTruncated(self, q, tol=1.e-6):
"""
Compute the quantile for the non truncated distribution
Parameters
----------
q : float
quantile you want to compute. Between 0 and 1
tol : float
precision for the output
Returns
-------
x : float
x such that P(X < x) = q
"""
scale = self._scale
k = self._k
dps = self._dps
z_approx = scale * chi2.ppf(q, k)
epsilon = scale * 0.001
lb = z_approx - epsilon
ub = z_approx + epsilon
f = lambda z: self._cdf_notTruncated(-np.inf, z, dps)
z = find_root(f, q, lb, ub, tol)
return z
import doctest
doctest.testmod()
| 23.359862
| 63
| 0.483484
|
import numpy as np
import mpmath as mp
from scipy.stats import chi, chi2
from .base import truncated, find_root
class truncated_chi(truncated):
def __init__(self, I, k, scale = 1.):
self._k = k
self._scale = scale
truncated.__init__(self, I)
def _cdf_notTruncated(self, a, b, dps):
scale = self._scale
k = self._k
dps_temp = mp.mp.dps
mp.mp.dps = dps
a = max(0, a)
b = max(0, b)
sf = mp.gammainc(1./2 * k,
1./2*((a/scale)**2),
1./2*((b/scale)**2),
regularized=True)
mp.mp.dps = dps_temp
return sf
def _pdf_notTruncated(self, z, dps):
scale = self._scale
k = self._k
dps = self._dps
return chi.pdf(z/scale, k)
def _quantile_notTruncated(self, q, tol=1.e-6):
scale = self._scale
k = self._k
dps = self._dps
z_approx = scale * chi.ppf(q, k)
epsilon = scale * 0.001
lb = z_approx - epsilon
ub = z_approx + epsilon
f = lambda z: self._cdf_notTruncated(-np.inf, z, dps)
z = find_root(f, q, lb, ub, tol)
return z
class truncated_chi2(truncated):
def __init__(self, I, k, scale = 1.):
self._k = k
self._scale = scale
truncated.__init__(self, I)
def _cdf_notTruncated(self, a, b, dps):
scale = self._scale
k = self._k
dps_temp = mp.mp.dps
mp.mp.dps = dps
a = max(0, a)
b = max(0, b)
cdf = mp.gammainc(1./2 * k,
1./2*(a/scale),
1./2*(b/scale),
regularized=True)
mp.mp.dps = dps_temp
return cdf
def _pdf_notTruncated(self, z, dps):
scale = self._scale
k = self._k
dps = self._dps
return chi2.pdf(z/scale, k)
def _quantile_notTruncated(self, q, tol=1.e-6):
scale = self._scale
k = self._k
dps = self._dps
z_approx = scale * chi.ppf(q, k)
epsilon = scale * 0.001
lb = z_approx - epsilon
ub = z_approx + epsilon
f = lambda z: self._cdf_notTruncated(-np.inf, z, dps)
z = find_root(f, q, lb, ub, tol)
return z
def _pdf_notTruncated(self, z, dps):
scale = self._scale
k = self._k
return chi2.pdf(z/scale, k)
def _quantile_notTruncated(self, q, tol=1.e-6):
scale = self._scale
k = self._k
dps = self._dps
z_approx = scale * chi2.ppf(q, k)
epsilon = scale * 0.001
lb = z_approx - epsilon
ub = z_approx + epsilon
f = lambda z: self._cdf_notTruncated(-np.inf, z, dps)
z = find_root(f, q, lb, ub, tol)
return z
import doctest
doctest.testmod()
| true
| true
|
f70a2a25224545676e5b981a65f639ab405c76b0
| 595
|
py
|
Python
|
pwny/commands/generic/upload.py
|
EntySec/Pwny
|
d6a8a5edee171dcd3bf3ea1ec49b0ffb03d38531
|
[
"MIT"
] | 7
|
2021-11-12T23:14:19.000Z
|
2022-01-16T21:27:42.000Z
|
pwny/commands/generic/upload.py
|
YurinDoctrine/Pwny
|
1c89a1a2a574c28cf92b5817b3d5dfb3dd4032be
|
[
"MIT"
] | null | null | null |
pwny/commands/generic/upload.py
|
YurinDoctrine/Pwny
|
1c89a1a2a574c28cf92b5817b3d5dfb3dd4032be
|
[
"MIT"
] | 7
|
2021-11-10T16:52:57.000Z
|
2022-02-09T17:11:57.000Z
|
#!/usr/bin/env python3
#
# This command requires HatSploit: https://hatsploit.netlify.app
# Current source: https://github.com/EntySec/HatSploit
#
from hatsploit.lib.command import Command
class HatSploitCommand(Command):
details = {
'Category': "transfer",
'Name': "upload",
'Authors': [
'Ivan Nikolsky (enty8080) - command developer'
],
'Description': "Upload local file.",
'Usage': "upload <local_file> <remote_path>",
'MinArgs': 2
}
def run(self, argc, argv):
self.session.upload(argv[1], argv[2])
| 23.8
| 64
| 0.608403
|
from hatsploit.lib.command import Command
class HatSploitCommand(Command):
details = {
'Category': "transfer",
'Name': "upload",
'Authors': [
'Ivan Nikolsky (enty8080) - command developer'
],
'Description': "Upload local file.",
'Usage': "upload <local_file> <remote_path>",
'MinArgs': 2
}
def run(self, argc, argv):
self.session.upload(argv[1], argv[2])
| true
| true
|
f70a2b0e9261046b6a2a3a6a7ffdf762b0fb67a7
| 1,618
|
py
|
Python
|
mlp_uk_learning.py
|
lujiammy/coronavirus-machine-learning
|
4af16b1c51a89a81206262b50a9bcf4d9b679853
|
[
"BSD-3-Clause"
] | null | null | null |
mlp_uk_learning.py
|
lujiammy/coronavirus-machine-learning
|
4af16b1c51a89a81206262b50a9bcf4d9b679853
|
[
"BSD-3-Clause"
] | null | null | null |
mlp_uk_learning.py
|
lujiammy/coronavirus-machine-learning
|
4af16b1c51a89a81206262b50a9bcf4d9b679853
|
[
"BSD-3-Clause"
] | null | null | null |
import numpy as np
np.random.seed(1337)
from keras.models import Sequential
from keras.layers import Dense
import matplotlib.pyplot as plt
model = Sequential()
model.add(Dense(units=50, input_dim=1, activation='relu'))
model.add(Dense(units=50, activation='relu'))
model.add(Dense(units=1, activation='sigmoid'))
model.add(Dense(units=1, activation='linear'))
model.compile(optimizer='adam', loss='mean_squared_error')
model.summary()
# uk corona
import json
url = 'https://api.covid19uk.live/historyfigures'
def read_url_to_json(url):
import urllib.request as request
webpage = request.urlopen(url)
get_data = webpage.read()
data = json.loads(get_data)
return data
read_data = read_url_to_json(url)
each_data = read_data['data']
uk_comfirmed_data = []
for each in each_data:
uk_comfirmed_data.append(each['confirmed'])
uk_date_length = len(uk_comfirmed_data)
uk_dates = list(range(1, uk_date_length + 1))
uk_comfirmed_data = np.array(uk_comfirmed_data)
uk_dates = np.array(uk_dates)
uk_absorb_amount = uk_comfirmed_data[uk_date_length-1]
uk_comfirmed_data_norm = uk_comfirmed_data / uk_absorb_amount
# fit model
model.fit(uk_dates, uk_comfirmed_data_norm, epochs=10000, shuffle=False)
uk_comfirmed_data_predict = model.predict(uk_dates)
uk_comfirmed_data_predict = uk_comfirmed_data_predict * uk_absorb_amount
fig2 = plt.figure(figsize=(7, 5))
plt.scatter(uk_dates, uk_comfirmed_data, label='Real Confirmed')
plt.plot(uk_dates, uk_comfirmed_data_predict, label='Predict Result')
plt.title('UK Confirmed VS Dates')
plt.xlabel('Dates')
plt.ylabel('Amount')
plt.legend()
plt.show()
| 27.423729
| 72
| 0.776885
|
import numpy as np
np.random.seed(1337)
from keras.models import Sequential
from keras.layers import Dense
import matplotlib.pyplot as plt
model = Sequential()
model.add(Dense(units=50, input_dim=1, activation='relu'))
model.add(Dense(units=50, activation='relu'))
model.add(Dense(units=1, activation='sigmoid'))
model.add(Dense(units=1, activation='linear'))
model.compile(optimizer='adam', loss='mean_squared_error')
model.summary()
import json
url = 'https://api.covid19uk.live/historyfigures'
def read_url_to_json(url):
import urllib.request as request
webpage = request.urlopen(url)
get_data = webpage.read()
data = json.loads(get_data)
return data
read_data = read_url_to_json(url)
each_data = read_data['data']
uk_comfirmed_data = []
for each in each_data:
uk_comfirmed_data.append(each['confirmed'])
uk_date_length = len(uk_comfirmed_data)
uk_dates = list(range(1, uk_date_length + 1))
uk_comfirmed_data = np.array(uk_comfirmed_data)
uk_dates = np.array(uk_dates)
uk_absorb_amount = uk_comfirmed_data[uk_date_length-1]
uk_comfirmed_data_norm = uk_comfirmed_data / uk_absorb_amount
model.fit(uk_dates, uk_comfirmed_data_norm, epochs=10000, shuffle=False)
uk_comfirmed_data_predict = model.predict(uk_dates)
uk_comfirmed_data_predict = uk_comfirmed_data_predict * uk_absorb_amount
fig2 = plt.figure(figsize=(7, 5))
plt.scatter(uk_dates, uk_comfirmed_data, label='Real Confirmed')
plt.plot(uk_dates, uk_comfirmed_data_predict, label='Predict Result')
plt.title('UK Confirmed VS Dates')
plt.xlabel('Dates')
plt.ylabel('Amount')
plt.legend()
plt.show()
| true
| true
|
f70a2b37f6f06bf07a52a01197f2deb18fbace0e
| 6,051
|
py
|
Python
|
diplom_test/main.py
|
CrackedSTone/algorithm-detects-liver-pathology
|
d52d08e4e6931b3502f083f20d6332f7b6839a3b
|
[
"Apache-2.0"
] | 8
|
2019-04-09T07:11:26.000Z
|
2020-02-27T16:51:26.000Z
|
diplom_test/main.py
|
il-yanko/algorithm-detects-liver-pathology
|
d52d08e4e6931b3502f083f20d6332f7b6839a3b
|
[
"Apache-2.0"
] | null | null | null |
diplom_test/main.py
|
il-yanko/algorithm-detects-liver-pathology
|
d52d08e4e6931b3502f083f20d6332f7b6839a3b
|
[
"Apache-2.0"
] | 2
|
2019-04-04T07:13:02.000Z
|
2020-02-06T04:58:34.000Z
|
#!/usr/bin/python3
# -*- coding: utf-8 -*-
from PyQt5.uic import loadUi
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
#from matplotlib.backends.backend_qt5agg import (NavigationToolbar2QT as NavigationToolbar)
import matplotlib.image as mpimg
import sys
import radiomics_single as rs
qtCreatorFile = "design/diplom.ui" # Enter file here.
class MatplotlibWidget(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
loadUi(qtCreatorFile, self)
self.FlagLoaded = False
self.setWindowTitle("Texture Analysis for Diffuse Liver Diseases")
self.buttonLoader.clicked.connect(self.choose_file)
self.buttonAnalyze.clicked.connect(self.analyze)
#self.addToolBar(NavigationToolbar(self.MplWidget.canvas, self))
self.setWindowIcon(QIcon("app.ico"))
mainMenu = self.menuBar()
fileMenu = mainMenu.addMenu('File')
helpMenu = mainMenu.addMenu('Help')
buttonLoaderMenu = QAction('Download', self)
buttonLoaderMenu.setShortcut('Ctrl+D')
buttonLoaderMenu.setStatusTip('Download the region of the interest')
buttonLoaderMenu.triggered.connect(self.choose_file)
fileMenu.addAction(buttonLoaderMenu)
buttonAnalyzeMenu = QAction('Analysis', self)
buttonAnalyzeMenu.setShortcut('Ctrl+A')
buttonAnalyzeMenu.setStatusTip('Analyse the loaded region of the interest')
buttonAnalyzeMenu.triggered.connect(self.analyze)
fileMenu.addAction(buttonAnalyzeMenu)
buttonExit = QAction('Quit', self)
buttonExit.setShortcut('Ctrl+Q')
buttonExit.setStatusTip('Quit out of application')
buttonExit.triggered.connect(sys.exit)
fileMenu.addAction(buttonExit)
buttonLaunch = QAction('How to run', self)
buttonLaunch.setStatusTip('Get info about how to run the application')
self.msgBox1 = QMessageBox(self)
self.msgBox1.setIcon(QMessageBox.Information)
self.msgBox1.setWindowTitle("How to run")
self.msgBox1.setText("To run the classifier:\n1) push the button <Choose an image>\n2) push the button <Analyse>")
buttonLaunch.triggered.connect(self.msgBox1.exec_)
helpMenu.addAction(buttonLaunch)
buttonInfo = QAction('Application', self)
buttonInfo.setStatusTip('Get info about the application')
self.msgBox2 = QMessageBox(self)
self.msgBox2.setIcon(QMessageBox.Information)
self.msgBox2.setWindowTitle("Application")
self.msgBox2.setText("This application give an ability to load ROI and predict a probable presence of diffuse liver diseases.")
buttonInfo.triggered.connect(self.msgBox2.exec_)
helpMenu.addAction(buttonInfo)
buttonInfo = QAction('Developer', self)
buttonInfo.setStatusTip('Get info about the developer')
self.msgBox3 = QMessageBox(self)
self.msgBox3.setIcon(QMessageBox.Information)
self.msgBox3.setWindowTitle("Developer")
self.msgBox3.setText("This application was developed by Illia Yankovyi, the student of the 4th year"
"\nNTUU Igor Sikorsky Kyiv Polytechnic Institute:"
"\nFaculty of Biomedical Engineering (FBME)\n"
"\nAcademic unit:BS-52 group\n"
"\nSupervisor: Nastenko I., M.D., Candidate of Engineering Sciences, Senior Research Fellow.")
buttonInfo.triggered.connect(self.msgBox3.exec_)
helpMenu.addAction(buttonInfo)
self.labelTitle.setText('Classifier of Diffuse Liver Diseases')
font = QFont()
font.setPointSize(20)
font.setBold(True)
self.labelTitle.setFont(font)
self.labelTitle.setAlignment(Qt.AlignCenter)
self.buttonAnalyze.setText('Analyze Image')
self.buttonLoader.setText('Download Image')
self.labelResult.setText('To get a prediction:\n\n1) Download the region of interest;\n2) Run the analysis.')
def analyze(self):
if (self.FlagLoaded):
self.labelResult.setText(rs.signle_prediction(self.path))
else:
self.labelResult.setText("Image was not chosen!\n\nPlease choose the image\nbefore running the Analysis")
self.msgBox4 = QMessageBox(self)
self.msgBox4.setIcon(QMessageBox.Warning)
self.msgBox4.setWindowTitle("Error! Image was not chosen.")
self.msgBox4.setText(
"Image was not chosen! Please choose the image before running the Analysis.")
self.msgBox4.exec_()
def choose_file(self):
options = QFileDialog.Options()
fileName, _ = QFileDialog.getOpenFileName(self, "Choose an image", "",
"Image (*.bmp *.png *.jpeg *.jpg)", options=options)
extensions = ['png', 'jpg', 'jpeg', 'bmp']
fileExtension = (fileName.split('.'))[-1].lower()
if fileName:
if fileExtension in extensions:
self.path = fileName
self.img = mpimg.imread(self.path)
self.MplWidget.canvas.axes.clear()
self.MplWidget.canvas.axes.imshow(self.img)
self.MplWidget.canvas.axes.set_title('Chosen image')
self.MplWidget.canvas.draw()
self.FlagLoaded = True
else:
self.labelResult.setText("Chosen filetype is not supported.\nSupported filetypes:\nBMP, PNG, JPEG, JPG")
self.msgBox5 = QMessageBox(self)
self.msgBox5.setIcon(QMessageBox.Warning)
self.msgBox5.setWindowTitle("Error! Chosen filetype is not supported.")
self.msgBox5.setText(
"Chosen filetype is not supported.\nSupported filetypes:\nBMP, PNG, JPEG, JPG.")
self.msgBox5.exec_()
if __name__ == "__main__":
app = QApplication([])
window = MatplotlibWidget()
window.show()
sys.exit(app.exec_())
| 44.492647
| 135
| 0.653611
|
from PyQt5.uic import loadUi
from PyQt5.QtGui import *
from PyQt5.QtWidgets import *
from PyQt5.QtCore import *
import matplotlib.image as mpimg
import sys
import radiomics_single as rs
qtCreatorFile = "design/diplom.ui"
class MatplotlibWidget(QMainWindow):
def __init__(self):
QMainWindow.__init__(self)
loadUi(qtCreatorFile, self)
self.FlagLoaded = False
self.setWindowTitle("Texture Analysis for Diffuse Liver Diseases")
self.buttonLoader.clicked.connect(self.choose_file)
self.buttonAnalyze.clicked.connect(self.analyze)
self.setWindowIcon(QIcon("app.ico"))
mainMenu = self.menuBar()
fileMenu = mainMenu.addMenu('File')
helpMenu = mainMenu.addMenu('Help')
buttonLoaderMenu = QAction('Download', self)
buttonLoaderMenu.setShortcut('Ctrl+D')
buttonLoaderMenu.setStatusTip('Download the region of the interest')
buttonLoaderMenu.triggered.connect(self.choose_file)
fileMenu.addAction(buttonLoaderMenu)
buttonAnalyzeMenu = QAction('Analysis', self)
buttonAnalyzeMenu.setShortcut('Ctrl+A')
buttonAnalyzeMenu.setStatusTip('Analyse the loaded region of the interest')
buttonAnalyzeMenu.triggered.connect(self.analyze)
fileMenu.addAction(buttonAnalyzeMenu)
buttonExit = QAction('Quit', self)
buttonExit.setShortcut('Ctrl+Q')
buttonExit.setStatusTip('Quit out of application')
buttonExit.triggered.connect(sys.exit)
fileMenu.addAction(buttonExit)
buttonLaunch = QAction('How to run', self)
buttonLaunch.setStatusTip('Get info about how to run the application')
self.msgBox1 = QMessageBox(self)
self.msgBox1.setIcon(QMessageBox.Information)
self.msgBox1.setWindowTitle("How to run")
self.msgBox1.setText("To run the classifier:\n1) push the button <Choose an image>\n2) push the button <Analyse>")
buttonLaunch.triggered.connect(self.msgBox1.exec_)
helpMenu.addAction(buttonLaunch)
buttonInfo = QAction('Application', self)
buttonInfo.setStatusTip('Get info about the application')
self.msgBox2 = QMessageBox(self)
self.msgBox2.setIcon(QMessageBox.Information)
self.msgBox2.setWindowTitle("Application")
self.msgBox2.setText("This application give an ability to load ROI and predict a probable presence of diffuse liver diseases.")
buttonInfo.triggered.connect(self.msgBox2.exec_)
helpMenu.addAction(buttonInfo)
buttonInfo = QAction('Developer', self)
buttonInfo.setStatusTip('Get info about the developer')
self.msgBox3 = QMessageBox(self)
self.msgBox3.setIcon(QMessageBox.Information)
self.msgBox3.setWindowTitle("Developer")
self.msgBox3.setText("This application was developed by Illia Yankovyi, the student of the 4th year"
"\nNTUU Igor Sikorsky Kyiv Polytechnic Institute:"
"\nFaculty of Biomedical Engineering (FBME)\n"
"\nAcademic unit:BS-52 group\n"
"\nSupervisor: Nastenko I., M.D., Candidate of Engineering Sciences, Senior Research Fellow.")
buttonInfo.triggered.connect(self.msgBox3.exec_)
helpMenu.addAction(buttonInfo)
self.labelTitle.setText('Classifier of Diffuse Liver Diseases')
font = QFont()
font.setPointSize(20)
font.setBold(True)
self.labelTitle.setFont(font)
self.labelTitle.setAlignment(Qt.AlignCenter)
self.buttonAnalyze.setText('Analyze Image')
self.buttonLoader.setText('Download Image')
self.labelResult.setText('To get a prediction:\n\n1) Download the region of interest;\n2) Run the analysis.')
def analyze(self):
if (self.FlagLoaded):
self.labelResult.setText(rs.signle_prediction(self.path))
else:
self.labelResult.setText("Image was not chosen!\n\nPlease choose the image\nbefore running the Analysis")
self.msgBox4 = QMessageBox(self)
self.msgBox4.setIcon(QMessageBox.Warning)
self.msgBox4.setWindowTitle("Error! Image was not chosen.")
self.msgBox4.setText(
"Image was not chosen! Please choose the image before running the Analysis.")
self.msgBox4.exec_()
def choose_file(self):
options = QFileDialog.Options()
fileName, _ = QFileDialog.getOpenFileName(self, "Choose an image", "",
"Image (*.bmp *.png *.jpeg *.jpg)", options=options)
extensions = ['png', 'jpg', 'jpeg', 'bmp']
fileExtension = (fileName.split('.'))[-1].lower()
if fileName:
if fileExtension in extensions:
self.path = fileName
self.img = mpimg.imread(self.path)
self.MplWidget.canvas.axes.clear()
self.MplWidget.canvas.axes.imshow(self.img)
self.MplWidget.canvas.axes.set_title('Chosen image')
self.MplWidget.canvas.draw()
self.FlagLoaded = True
else:
self.labelResult.setText("Chosen filetype is not supported.\nSupported filetypes:\nBMP, PNG, JPEG, JPG")
self.msgBox5 = QMessageBox(self)
self.msgBox5.setIcon(QMessageBox.Warning)
self.msgBox5.setWindowTitle("Error! Chosen filetype is not supported.")
self.msgBox5.setText(
"Chosen filetype is not supported.\nSupported filetypes:\nBMP, PNG, JPEG, JPG.")
self.msgBox5.exec_()
if __name__ == "__main__":
app = QApplication([])
window = MatplotlibWidget()
window.show()
sys.exit(app.exec_())
| true
| true
|
f70a2b644457fe1530f88e063abd293d2c32dfdb
| 10,084
|
py
|
Python
|
tests/asp/cautious/hamiltonian.test.04.asp.gringo.cautious.asp.test.py
|
bernardocuteri/wasp
|
05c8f961776dbdbf7afbf905ee00fc262eba51ad
|
[
"Apache-2.0"
] | 19
|
2015-12-03T08:53:45.000Z
|
2022-03-31T02:09:43.000Z
|
tests/asp/cautious/hamiltonian.test.04.asp.gringo.cautious.asp.test.py
|
bernardocuteri/wasp
|
05c8f961776dbdbf7afbf905ee00fc262eba51ad
|
[
"Apache-2.0"
] | 80
|
2017-11-25T07:57:32.000Z
|
2018-06-10T19:03:30.000Z
|
tests/asp/cautious/hamiltonian.test.04.asp.gringo.cautious.asp.test.py
|
bernardocuteri/wasp
|
05c8f961776dbdbf7afbf905ee00fc262eba51ad
|
[
"Apache-2.0"
] | 6
|
2015-01-15T07:51:48.000Z
|
2020-06-18T14:47:48.000Z
|
input = """
1 2 0 0
1 3 0 0
1 4 0 0
1 5 0 0
1 6 0 0
1 7 0 0
1 8 0 0
1 9 0 0
1 10 0 0
1 11 0 0
1 12 0 0
1 13 0 0
1 14 0 0
1 15 0 0
1 16 0 0
1 17 0 0
1 18 0 0
1 19 0 0
1 20 0 0
1 21 0 0
1 22 0 0
1 23 0 0
1 24 0 0
1 25 0 0
1 26 0 0
1 27 0 0
1 28 0 0
1 29 0 0
1 30 0 0
1 31 0 0
1 32 0 0
1 33 0 0
1 34 0 0
1 35 0 0
1 36 0 0
1 37 0 0
1 38 0 0
1 39 0 0
1 40 0 0
1 41 0 0
1 42 0 0
1 43 0 0
1 44 0 0
1 45 0 0
1 46 0 0
1 47 0 0
1 48 0 0
1 49 0 0
1 50 0 0
1 51 0 0
1 52 0 0
1 53 2 1 54 55
1 54 2 1 53 55
1 55 0 0
1 56 2 1 57 58
1 57 2 1 56 58
1 58 0 0
1 59 2 1 60 61
1 60 2 1 59 61
1 61 0 0
1 62 2 1 63 64
1 63 2 1 62 64
1 64 0 0
1 65 2 1 66 67
1 66 2 1 65 67
1 67 0 0
1 68 2 1 69 70
1 69 2 1 68 70
1 70 0 0
1 71 2 1 72 73
1 72 2 1 71 73
1 73 0 0
1 74 2 1 75 76
1 75 2 1 74 76
1 76 0 0
1 77 2 1 78 79
1 78 2 1 77 79
1 79 0 0
1 80 2 1 81 82
1 81 2 1 80 82
1 82 0 0
1 83 2 1 84 85
1 84 2 1 83 85
1 85 0 0
1 86 2 1 87 88
1 87 2 1 86 88
1 88 0 0
1 89 2 1 90 91
1 90 2 1 89 91
1 91 0 0
1 92 2 1 93 94
1 93 2 1 92 94
1 94 0 0
1 95 2 1 96 97
1 96 2 1 95 97
1 97 0 0
1 98 2 1 99 100
1 99 2 1 98 100
1 100 0 0
1 101 2 1 102 103
1 102 2 1 101 103
1 103 0 0
1 104 2 1 105 106
1 105 2 1 104 106
1 106 0 0
1 107 2 1 108 109
1 108 2 1 107 109
1 109 0 0
1 110 2 1 111 112
1 111 2 1 110 112
1 112 0 0
1 113 2 1 114 115
1 114 2 1 113 115
1 115 0 0
1 116 2 1 117 118
1 117 2 1 116 118
1 118 0 0
1 119 2 1 120 121
1 120 2 1 119 121
1 121 0 0
1 122 2 1 123 124
1 123 2 1 122 124
1 124 0 0
1 125 2 1 126 127
1 126 2 1 125 127
1 127 0 0
1 128 2 1 129 130
1 129 2 1 128 130
1 130 0 0
1 131 2 1 132 133
1 132 2 1 131 133
1 133 0 0
1 134 2 1 135 136
1 135 2 1 134 136
1 136 0 0
1 137 2 1 138 139
1 138 2 1 137 139
1 139 0 0
1 140 2 1 141 142
1 141 2 1 140 142
1 142 0 0
1 143 2 1 144 145
1 144 2 1 143 145
1 145 0 0
1 146 2 1 147 148
1 147 2 1 146 148
1 148 0 0
1 149 2 1 150 151
1 150 2 1 149 151
1 151 0 0
1 152 2 1 153 154
1 153 2 1 152 154
1 154 0 0
1 155 2 1 156 157
1 156 2 1 155 157
1 157 0 0
1 158 2 1 159 160
1 159 2 1 158 160
1 160 0 0
1 161 2 1 162 163
1 162 2 1 161 163
1 163 0 0
1 164 2 1 165 166
1 165 2 1 164 166
1 166 0 0
1 167 2 1 168 169
1 168 2 1 167 169
1 169 0 0
1 170 2 1 171 172
1 171 2 1 170 172
1 172 0 0
1 173 1 0 65
1 174 1 0 74
1 175 1 0 71
1 176 1 0 68
1 177 2 0 173 53
1 178 2 0 173 62
1 179 2 0 173 59
1 175 2 0 173 56
1 174 2 0 176 89
1 177 2 0 176 86
1 177 2 0 175 95
1 174 2 0 175 98
1 179 2 0 175 101
1 173 2 0 175 92
1 176 2 0 174 119
1 180 2 0 174 128
1 179 2 0 174 125
1 175 2 0 174 122
1 177 2 0 174 116
1 173 2 0 177 65
1 174 2 0 177 74
1 175 2 0 177 71
1 176 2 0 177 68
1 173 2 0 179 131
1 178 2 0 179 146
1 180 2 0 179 143
1 174 2 0 179 140
1 181 2 0 179 137
1 175 2 0 179 134
1 182 2 0 180 149
1 179 2 0 180 158
1 174 2 0 180 155
1 181 2 0 180 152
1 173 2 0 178 161
1 179 2 0 178 170
1 181 2 0 178 167
1 182 2 0 178 164
1 181 2 0 182 77
1 178 2 0 182 83
1 180 2 0 182 80
1 179 2 0 181 107
1 180 2 0 181 110
1 178 2 0 181 113
1 182 2 0 181 104
1 1 2 0 62 53
1 1 2 0 59 53
1 1 2 0 56 53
1 1 2 0 53 56
1 1 2 0 62 56
1 1 2 0 59 56
1 1 2 0 53 59
1 1 2 0 62 59
1 1 2 0 56 59
1 1 2 0 53 62
1 1 2 0 59 62
1 1 2 0 56 62
1 1 2 0 74 65
1 1 2 0 71 65
1 1 2 0 68 65
1 1 2 0 65 68
1 1 2 0 74 68
1 1 2 0 71 68
1 1 2 0 65 71
1 1 2 0 74 71
1 1 2 0 68 71
1 1 2 0 65 74
1 1 2 0 71 74
1 1 2 0 68 74
1 1 2 0 83 77
1 1 2 0 80 77
1 1 2 0 77 80
1 1 2 0 83 80
1 1 2 0 77 83
1 1 2 0 80 83
1 1 2 0 89 86
1 1 2 0 86 89
1 1 2 0 95 92
1 1 2 0 98 92
1 1 2 0 101 92
1 1 2 0 98 95
1 1 2 0 101 95
1 1 2 0 92 95
1 1 2 0 95 98
1 1 2 0 101 98
1 1 2 0 92 98
1 1 2 0 95 101
1 1 2 0 98 101
1 1 2 0 92 101
1 1 2 0 107 104
1 1 2 0 110 104
1 1 2 0 113 104
1 1 2 0 110 107
1 1 2 0 113 107
1 1 2 0 104 107
1 1 2 0 107 110
1 1 2 0 113 110
1 1 2 0 104 110
1 1 2 0 107 113
1 1 2 0 110 113
1 1 2 0 104 113
1 1 2 0 119 116
1 1 2 0 128 116
1 1 2 0 125 116
1 1 2 0 122 116
1 1 2 0 128 119
1 1 2 0 125 119
1 1 2 0 122 119
1 1 2 0 116 119
1 1 2 0 119 122
1 1 2 0 128 122
1 1 2 0 125 122
1 1 2 0 116 122
1 1 2 0 119 125
1 1 2 0 128 125
1 1 2 0 122 125
1 1 2 0 116 125
1 1 2 0 119 128
1 1 2 0 125 128
1 1 2 0 122 128
1 1 2 0 116 128
1 1 2 0 146 131
1 1 2 0 143 131
1 1 2 0 140 131
1 1 2 0 137 131
1 1 2 0 134 131
1 1 2 0 131 134
1 1 2 0 146 134
1 1 2 0 143 134
1 1 2 0 140 134
1 1 2 0 137 134
1 1 2 0 131 137
1 1 2 0 146 137
1 1 2 0 143 137
1 1 2 0 140 137
1 1 2 0 134 137
1 1 2 0 131 140
1 1 2 0 146 140
1 1 2 0 143 140
1 1 2 0 137 140
1 1 2 0 134 140
1 1 2 0 131 143
1 1 2 0 146 143
1 1 2 0 140 143
1 1 2 0 137 143
1 1 2 0 134 143
1 1 2 0 131 146
1 1 2 0 143 146
1 1 2 0 140 146
1 1 2 0 137 146
1 1 2 0 134 146
1 1 2 0 158 149
1 1 2 0 155 149
1 1 2 0 152 149
1 1 2 0 149 152
1 1 2 0 158 152
1 1 2 0 155 152
1 1 2 0 149 155
1 1 2 0 158 155
1 1 2 0 152 155
1 1 2 0 149 158
1 1 2 0 155 158
1 1 2 0 152 158
1 1 2 0 170 161
1 1 2 0 167 161
1 1 2 0 164 161
1 1 2 0 161 164
1 1 2 0 170 164
1 1 2 0 167 164
1 1 2 0 161 167
1 1 2 0 170 167
1 1 2 0 164 167
1 1 2 0 161 170
1 1 2 0 167 170
1 1 2 0 164 170
1 1 2 0 86 53
1 1 2 0 95 53
1 1 2 0 116 53
1 1 2 0 134 56
1 1 2 0 122 56
1 1 2 0 71 56
1 1 2 0 101 59
1 1 2 0 170 59
1 1 2 0 158 59
1 1 2 0 125 59
1 1 2 0 107 59
1 1 2 0 146 62
1 1 2 0 113 62
1 1 2 0 83 62
1 1 2 0 92 65
1 1 2 0 161 65
1 1 2 0 131 65
1 1 2 0 119 68
1 1 2 0 56 71
1 1 2 0 134 71
1 1 2 0 122 71
1 1 2 0 89 74
1 1 2 0 155 74
1 1 2 0 140 74
1 1 2 0 98 74
1 1 2 0 167 77
1 1 2 0 152 77
1 1 2 0 137 77
1 1 2 0 110 80
1 1 2 0 143 80
1 1 2 0 128 80
1 1 2 0 62 83
1 1 2 0 146 83
1 1 2 0 113 83
1 1 2 0 95 86
1 1 2 0 116 86
1 1 2 0 53 86
1 1 2 0 155 89
1 1 2 0 140 89
1 1 2 0 98 89
1 1 2 0 74 89
1 1 2 0 161 92
1 1 2 0 131 92
1 1 2 0 65 92
1 1 2 0 86 95
1 1 2 0 116 95
1 1 2 0 53 95
1 1 2 0 89 98
1 1 2 0 155 98
1 1 2 0 140 98
1 1 2 0 74 98
1 1 2 0 170 101
1 1 2 0 158 101
1 1 2 0 125 101
1 1 2 0 107 101
1 1 2 0 59 101
1 1 2 0 164 104
1 1 2 0 149 104
1 1 2 0 101 107
1 1 2 0 170 107
1 1 2 0 158 107
1 1 2 0 125 107
1 1 2 0 59 107
1 1 2 0 143 110
1 1 2 0 128 110
1 1 2 0 80 110
1 1 2 0 62 113
1 1 2 0 146 113
1 1 2 0 83 113
1 1 2 0 86 116
1 1 2 0 95 116
1 1 2 0 53 116
1 1 2 0 68 119
1 1 2 0 56 122
1 1 2 0 134 122
1 1 2 0 71 122
1 1 2 0 101 125
1 1 2 0 170 125
1 1 2 0 158 125
1 1 2 0 107 125
1 1 2 0 59 125
1 1 2 0 110 128
1 1 2 0 143 128
1 1 2 0 80 128
1 1 2 0 92 131
1 1 2 0 161 131
1 1 2 0 65 131
1 1 2 0 56 134
1 1 2 0 122 134
1 1 2 0 71 134
1 1 2 0 77 137
1 1 2 0 167 137
1 1 2 0 152 137
1 1 2 0 89 140
1 1 2 0 155 140
1 1 2 0 98 140
1 1 2 0 74 140
1 1 2 0 110 143
1 1 2 0 128 143
1 1 2 0 80 143
1 1 2 0 62 146
1 1 2 0 113 146
1 1 2 0 83 146
1 1 2 0 104 149
1 1 2 0 164 149
1 1 2 0 77 152
1 1 2 0 167 152
1 1 2 0 137 152
1 1 2 0 89 155
1 1 2 0 140 155
1 1 2 0 98 155
1 1 2 0 74 155
1 1 2 0 101 158
1 1 2 0 170 158
1 1 2 0 125 158
1 1 2 0 107 158
1 1 2 0 59 158
1 1 2 0 92 161
1 1 2 0 131 161
1 1 2 0 65 161
1 1 2 0 104 164
1 1 2 0 149 164
1 1 2 0 77 167
1 1 2 0 152 167
1 1 2 0 137 167
1 1 2 0 101 170
1 1 2 0 158 170
1 1 2 0 125 170
1 1 2 0 107 170
1 1 2 0 59 170
1 1 1 1 173
1 1 1 1 173
1 1 1 1 173
1 1 1 1 173
1 1 1 1 177
1 1 1 1 177
1 1 1 1 177
1 1 1 1 177
1 1 1 1 182
1 1 1 1 182
1 1 1 1 182
1 1 1 1 176
1 1 1 1 176
1 1 1 1 175
1 1 1 1 175
1 1 1 1 175
1 1 1 1 175
1 1 1 1 181
1 1 1 1 181
1 1 1 1 181
1 1 1 1 181
1 1 1 1 174
1 1 1 1 174
1 1 1 1 174
1 1 1 1 174
1 1 1 1 174
1 1 1 1 179
1 1 1 1 179
1 1 1 1 179
1 1 1 1 179
1 1 1 1 179
1 1 1 1 179
1 1 1 1 180
1 1 1 1 180
1 1 1 1 180
1 1 1 1 180
1 1 1 1 178
1 1 1 1 178
1 1 1 1 178
1 1 1 1 178
0
43 vertex(0)
44 vertex(1)
45 vertex(2)
46 vertex(3)
47 vertex(4)
48 vertex(5)
49 vertex(6)
50 vertex(7)
51 vertex(8)
52 vertex(9)
3 arc(0,1)
4 arc(0,4)
5 arc(0,7)
6 arc(0,9)
7 arc(1,0)
8 arc(1,3)
9 arc(1,4)
10 arc(1,6)
11 arc(2,5)
12 arc(2,8)
13 arc(2,9)
14 arc(3,1)
15 arc(3,6)
16 arc(4,0)
17 arc(4,1)
18 arc(4,6)
19 arc(4,7)
20 arc(5,2)
21 arc(5,7)
22 arc(5,8)
23 arc(5,9)
24 arc(6,1)
25 arc(6,3)
26 arc(6,4)
27 arc(6,7)
28 arc(6,8)
29 arc(7,0)
30 arc(7,4)
31 arc(7,5)
32 arc(7,6)
33 arc(7,8)
34 arc(7,9)
35 arc(8,2)
36 arc(8,5)
37 arc(8,6)
38 arc(8,7)
39 arc(9,0)
40 arc(9,2)
41 arc(9,5)
42 arc(9,7)
173 reached(0)
174 reached(6)
175 reached(4)
176 reached(3)
177 reached(1)
178 reached(9)
179 reached(7)
180 reached(8)
181 reached(5)
182 reached(2)
54 out_hm(0,1)
57 out_hm(0,4)
60 out_hm(0,7)
63 out_hm(0,9)
66 out_hm(1,0)
69 out_hm(1,3)
72 out_hm(1,4)
75 out_hm(1,6)
78 out_hm(2,5)
81 out_hm(2,8)
84 out_hm(2,9)
87 out_hm(3,1)
90 out_hm(3,6)
93 out_hm(4,0)
96 out_hm(4,1)
99 out_hm(4,6)
102 out_hm(4,7)
105 out_hm(5,2)
108 out_hm(5,7)
111 out_hm(5,8)
114 out_hm(5,9)
117 out_hm(6,1)
120 out_hm(6,3)
123 out_hm(6,4)
126 out_hm(6,7)
129 out_hm(6,8)
132 out_hm(7,0)
135 out_hm(7,4)
138 out_hm(7,5)
141 out_hm(7,6)
144 out_hm(7,8)
147 out_hm(7,9)
150 out_hm(8,2)
153 out_hm(8,5)
156 out_hm(8,6)
159 out_hm(8,7)
162 out_hm(9,0)
165 out_hm(9,2)
168 out_hm(9,5)
171 out_hm(9,7)
53 in_hm(0,1)
56 in_hm(0,4)
59 in_hm(0,7)
62 in_hm(0,9)
65 in_hm(1,0)
68 in_hm(1,3)
71 in_hm(1,4)
74 in_hm(1,6)
77 in_hm(2,5)
80 in_hm(2,8)
83 in_hm(2,9)
86 in_hm(3,1)
89 in_hm(3,6)
92 in_hm(4,0)
95 in_hm(4,1)
98 in_hm(4,6)
101 in_hm(4,7)
104 in_hm(5,2)
107 in_hm(5,7)
110 in_hm(5,8)
113 in_hm(5,9)
116 in_hm(6,1)
119 in_hm(6,3)
122 in_hm(6,4)
125 in_hm(6,7)
128 in_hm(6,8)
131 in_hm(7,0)
134 in_hm(7,4)
137 in_hm(7,5)
140 in_hm(7,6)
143 in_hm(7,8)
146 in_hm(7,9)
149 in_hm(8,2)
152 in_hm(8,5)
155 in_hm(8,6)
158 in_hm(8,7)
161 in_hm(9,0)
164 in_hm(9,2)
167 in_hm(9,5)
170 in_hm(9,7)
2 start(1)
0
B+
0
B-
1
0
1
"""
output = """
{start(1), arc(0,1), arc(0,4), arc(0,7), arc(0,9), arc(1,0), arc(1,3), arc(1,4), arc(1,6), arc(2,5), arc(2,8), arc(2,9), arc(3,1), arc(3,6), arc(4,0), arc(4,1), arc(4,6), arc(4,7), arc(5,2), arc(5,7), arc(5,8), arc(5,9), arc(6,1), arc(6,3), arc(6,4), arc(6,7), arc(6,8), arc(7,0), arc(7,4), arc(7,5), arc(7,6), arc(7,8), arc(7,9), arc(8,2), arc(8,5), arc(8,6), arc(8,7), arc(9,0), arc(9,2), arc(9,5), arc(9,7), vertex(0), vertex(1), vertex(2), vertex(3), vertex(4), vertex(5), vertex(6), vertex(7), vertex(8), vertex(9), reached(0), reached(6), reached(4), reached(3), reached(1), reached(9), reached(7), reached(8), reached(5), reached(2), out_hm(6,1), out_hm(1,6)}
"""
| 15.050746
| 666
| 0.615728
|
input = """
1 2 0 0
1 3 0 0
1 4 0 0
1 5 0 0
1 6 0 0
1 7 0 0
1 8 0 0
1 9 0 0
1 10 0 0
1 11 0 0
1 12 0 0
1 13 0 0
1 14 0 0
1 15 0 0
1 16 0 0
1 17 0 0
1 18 0 0
1 19 0 0
1 20 0 0
1 21 0 0
1 22 0 0
1 23 0 0
1 24 0 0
1 25 0 0
1 26 0 0
1 27 0 0
1 28 0 0
1 29 0 0
1 30 0 0
1 31 0 0
1 32 0 0
1 33 0 0
1 34 0 0
1 35 0 0
1 36 0 0
1 37 0 0
1 38 0 0
1 39 0 0
1 40 0 0
1 41 0 0
1 42 0 0
1 43 0 0
1 44 0 0
1 45 0 0
1 46 0 0
1 47 0 0
1 48 0 0
1 49 0 0
1 50 0 0
1 51 0 0
1 52 0 0
1 53 2 1 54 55
1 54 2 1 53 55
1 55 0 0
1 56 2 1 57 58
1 57 2 1 56 58
1 58 0 0
1 59 2 1 60 61
1 60 2 1 59 61
1 61 0 0
1 62 2 1 63 64
1 63 2 1 62 64
1 64 0 0
1 65 2 1 66 67
1 66 2 1 65 67
1 67 0 0
1 68 2 1 69 70
1 69 2 1 68 70
1 70 0 0
1 71 2 1 72 73
1 72 2 1 71 73
1 73 0 0
1 74 2 1 75 76
1 75 2 1 74 76
1 76 0 0
1 77 2 1 78 79
1 78 2 1 77 79
1 79 0 0
1 80 2 1 81 82
1 81 2 1 80 82
1 82 0 0
1 83 2 1 84 85
1 84 2 1 83 85
1 85 0 0
1 86 2 1 87 88
1 87 2 1 86 88
1 88 0 0
1 89 2 1 90 91
1 90 2 1 89 91
1 91 0 0
1 92 2 1 93 94
1 93 2 1 92 94
1 94 0 0
1 95 2 1 96 97
1 96 2 1 95 97
1 97 0 0
1 98 2 1 99 100
1 99 2 1 98 100
1 100 0 0
1 101 2 1 102 103
1 102 2 1 101 103
1 103 0 0
1 104 2 1 105 106
1 105 2 1 104 106
1 106 0 0
1 107 2 1 108 109
1 108 2 1 107 109
1 109 0 0
1 110 2 1 111 112
1 111 2 1 110 112
1 112 0 0
1 113 2 1 114 115
1 114 2 1 113 115
1 115 0 0
1 116 2 1 117 118
1 117 2 1 116 118
1 118 0 0
1 119 2 1 120 121
1 120 2 1 119 121
1 121 0 0
1 122 2 1 123 124
1 123 2 1 122 124
1 124 0 0
1 125 2 1 126 127
1 126 2 1 125 127
1 127 0 0
1 128 2 1 129 130
1 129 2 1 128 130
1 130 0 0
1 131 2 1 132 133
1 132 2 1 131 133
1 133 0 0
1 134 2 1 135 136
1 135 2 1 134 136
1 136 0 0
1 137 2 1 138 139
1 138 2 1 137 139
1 139 0 0
1 140 2 1 141 142
1 141 2 1 140 142
1 142 0 0
1 143 2 1 144 145
1 144 2 1 143 145
1 145 0 0
1 146 2 1 147 148
1 147 2 1 146 148
1 148 0 0
1 149 2 1 150 151
1 150 2 1 149 151
1 151 0 0
1 152 2 1 153 154
1 153 2 1 152 154
1 154 0 0
1 155 2 1 156 157
1 156 2 1 155 157
1 157 0 0
1 158 2 1 159 160
1 159 2 1 158 160
1 160 0 0
1 161 2 1 162 163
1 162 2 1 161 163
1 163 0 0
1 164 2 1 165 166
1 165 2 1 164 166
1 166 0 0
1 167 2 1 168 169
1 168 2 1 167 169
1 169 0 0
1 170 2 1 171 172
1 171 2 1 170 172
1 172 0 0
1 173 1 0 65
1 174 1 0 74
1 175 1 0 71
1 176 1 0 68
1 177 2 0 173 53
1 178 2 0 173 62
1 179 2 0 173 59
1 175 2 0 173 56
1 174 2 0 176 89
1 177 2 0 176 86
1 177 2 0 175 95
1 174 2 0 175 98
1 179 2 0 175 101
1 173 2 0 175 92
1 176 2 0 174 119
1 180 2 0 174 128
1 179 2 0 174 125
1 175 2 0 174 122
1 177 2 0 174 116
1 173 2 0 177 65
1 174 2 0 177 74
1 175 2 0 177 71
1 176 2 0 177 68
1 173 2 0 179 131
1 178 2 0 179 146
1 180 2 0 179 143
1 174 2 0 179 140
1 181 2 0 179 137
1 175 2 0 179 134
1 182 2 0 180 149
1 179 2 0 180 158
1 174 2 0 180 155
1 181 2 0 180 152
1 173 2 0 178 161
1 179 2 0 178 170
1 181 2 0 178 167
1 182 2 0 178 164
1 181 2 0 182 77
1 178 2 0 182 83
1 180 2 0 182 80
1 179 2 0 181 107
1 180 2 0 181 110
1 178 2 0 181 113
1 182 2 0 181 104
1 1 2 0 62 53
1 1 2 0 59 53
1 1 2 0 56 53
1 1 2 0 53 56
1 1 2 0 62 56
1 1 2 0 59 56
1 1 2 0 53 59
1 1 2 0 62 59
1 1 2 0 56 59
1 1 2 0 53 62
1 1 2 0 59 62
1 1 2 0 56 62
1 1 2 0 74 65
1 1 2 0 71 65
1 1 2 0 68 65
1 1 2 0 65 68
1 1 2 0 74 68
1 1 2 0 71 68
1 1 2 0 65 71
1 1 2 0 74 71
1 1 2 0 68 71
1 1 2 0 65 74
1 1 2 0 71 74
1 1 2 0 68 74
1 1 2 0 83 77
1 1 2 0 80 77
1 1 2 0 77 80
1 1 2 0 83 80
1 1 2 0 77 83
1 1 2 0 80 83
1 1 2 0 89 86
1 1 2 0 86 89
1 1 2 0 95 92
1 1 2 0 98 92
1 1 2 0 101 92
1 1 2 0 98 95
1 1 2 0 101 95
1 1 2 0 92 95
1 1 2 0 95 98
1 1 2 0 101 98
1 1 2 0 92 98
1 1 2 0 95 101
1 1 2 0 98 101
1 1 2 0 92 101
1 1 2 0 107 104
1 1 2 0 110 104
1 1 2 0 113 104
1 1 2 0 110 107
1 1 2 0 113 107
1 1 2 0 104 107
1 1 2 0 107 110
1 1 2 0 113 110
1 1 2 0 104 110
1 1 2 0 107 113
1 1 2 0 110 113
1 1 2 0 104 113
1 1 2 0 119 116
1 1 2 0 128 116
1 1 2 0 125 116
1 1 2 0 122 116
1 1 2 0 128 119
1 1 2 0 125 119
1 1 2 0 122 119
1 1 2 0 116 119
1 1 2 0 119 122
1 1 2 0 128 122
1 1 2 0 125 122
1 1 2 0 116 122
1 1 2 0 119 125
1 1 2 0 128 125
1 1 2 0 122 125
1 1 2 0 116 125
1 1 2 0 119 128
1 1 2 0 125 128
1 1 2 0 122 128
1 1 2 0 116 128
1 1 2 0 146 131
1 1 2 0 143 131
1 1 2 0 140 131
1 1 2 0 137 131
1 1 2 0 134 131
1 1 2 0 131 134
1 1 2 0 146 134
1 1 2 0 143 134
1 1 2 0 140 134
1 1 2 0 137 134
1 1 2 0 131 137
1 1 2 0 146 137
1 1 2 0 143 137
1 1 2 0 140 137
1 1 2 0 134 137
1 1 2 0 131 140
1 1 2 0 146 140
1 1 2 0 143 140
1 1 2 0 137 140
1 1 2 0 134 140
1 1 2 0 131 143
1 1 2 0 146 143
1 1 2 0 140 143
1 1 2 0 137 143
1 1 2 0 134 143
1 1 2 0 131 146
1 1 2 0 143 146
1 1 2 0 140 146
1 1 2 0 137 146
1 1 2 0 134 146
1 1 2 0 158 149
1 1 2 0 155 149
1 1 2 0 152 149
1 1 2 0 149 152
1 1 2 0 158 152
1 1 2 0 155 152
1 1 2 0 149 155
1 1 2 0 158 155
1 1 2 0 152 155
1 1 2 0 149 158
1 1 2 0 155 158
1 1 2 0 152 158
1 1 2 0 170 161
1 1 2 0 167 161
1 1 2 0 164 161
1 1 2 0 161 164
1 1 2 0 170 164
1 1 2 0 167 164
1 1 2 0 161 167
1 1 2 0 170 167
1 1 2 0 164 167
1 1 2 0 161 170
1 1 2 0 167 170
1 1 2 0 164 170
1 1 2 0 86 53
1 1 2 0 95 53
1 1 2 0 116 53
1 1 2 0 134 56
1 1 2 0 122 56
1 1 2 0 71 56
1 1 2 0 101 59
1 1 2 0 170 59
1 1 2 0 158 59
1 1 2 0 125 59
1 1 2 0 107 59
1 1 2 0 146 62
1 1 2 0 113 62
1 1 2 0 83 62
1 1 2 0 92 65
1 1 2 0 161 65
1 1 2 0 131 65
1 1 2 0 119 68
1 1 2 0 56 71
1 1 2 0 134 71
1 1 2 0 122 71
1 1 2 0 89 74
1 1 2 0 155 74
1 1 2 0 140 74
1 1 2 0 98 74
1 1 2 0 167 77
1 1 2 0 152 77
1 1 2 0 137 77
1 1 2 0 110 80
1 1 2 0 143 80
1 1 2 0 128 80
1 1 2 0 62 83
1 1 2 0 146 83
1 1 2 0 113 83
1 1 2 0 95 86
1 1 2 0 116 86
1 1 2 0 53 86
1 1 2 0 155 89
1 1 2 0 140 89
1 1 2 0 98 89
1 1 2 0 74 89
1 1 2 0 161 92
1 1 2 0 131 92
1 1 2 0 65 92
1 1 2 0 86 95
1 1 2 0 116 95
1 1 2 0 53 95
1 1 2 0 89 98
1 1 2 0 155 98
1 1 2 0 140 98
1 1 2 0 74 98
1 1 2 0 170 101
1 1 2 0 158 101
1 1 2 0 125 101
1 1 2 0 107 101
1 1 2 0 59 101
1 1 2 0 164 104
1 1 2 0 149 104
1 1 2 0 101 107
1 1 2 0 170 107
1 1 2 0 158 107
1 1 2 0 125 107
1 1 2 0 59 107
1 1 2 0 143 110
1 1 2 0 128 110
1 1 2 0 80 110
1 1 2 0 62 113
1 1 2 0 146 113
1 1 2 0 83 113
1 1 2 0 86 116
1 1 2 0 95 116
1 1 2 0 53 116
1 1 2 0 68 119
1 1 2 0 56 122
1 1 2 0 134 122
1 1 2 0 71 122
1 1 2 0 101 125
1 1 2 0 170 125
1 1 2 0 158 125
1 1 2 0 107 125
1 1 2 0 59 125
1 1 2 0 110 128
1 1 2 0 143 128
1 1 2 0 80 128
1 1 2 0 92 131
1 1 2 0 161 131
1 1 2 0 65 131
1 1 2 0 56 134
1 1 2 0 122 134
1 1 2 0 71 134
1 1 2 0 77 137
1 1 2 0 167 137
1 1 2 0 152 137
1 1 2 0 89 140
1 1 2 0 155 140
1 1 2 0 98 140
1 1 2 0 74 140
1 1 2 0 110 143
1 1 2 0 128 143
1 1 2 0 80 143
1 1 2 0 62 146
1 1 2 0 113 146
1 1 2 0 83 146
1 1 2 0 104 149
1 1 2 0 164 149
1 1 2 0 77 152
1 1 2 0 167 152
1 1 2 0 137 152
1 1 2 0 89 155
1 1 2 0 140 155
1 1 2 0 98 155
1 1 2 0 74 155
1 1 2 0 101 158
1 1 2 0 170 158
1 1 2 0 125 158
1 1 2 0 107 158
1 1 2 0 59 158
1 1 2 0 92 161
1 1 2 0 131 161
1 1 2 0 65 161
1 1 2 0 104 164
1 1 2 0 149 164
1 1 2 0 77 167
1 1 2 0 152 167
1 1 2 0 137 167
1 1 2 0 101 170
1 1 2 0 158 170
1 1 2 0 125 170
1 1 2 0 107 170
1 1 2 0 59 170
1 1 1 1 173
1 1 1 1 173
1 1 1 1 173
1 1 1 1 173
1 1 1 1 177
1 1 1 1 177
1 1 1 1 177
1 1 1 1 177
1 1 1 1 182
1 1 1 1 182
1 1 1 1 182
1 1 1 1 176
1 1 1 1 176
1 1 1 1 175
1 1 1 1 175
1 1 1 1 175
1 1 1 1 175
1 1 1 1 181
1 1 1 1 181
1 1 1 1 181
1 1 1 1 181
1 1 1 1 174
1 1 1 1 174
1 1 1 1 174
1 1 1 1 174
1 1 1 1 174
1 1 1 1 179
1 1 1 1 179
1 1 1 1 179
1 1 1 1 179
1 1 1 1 179
1 1 1 1 179
1 1 1 1 180
1 1 1 1 180
1 1 1 1 180
1 1 1 1 180
1 1 1 1 178
1 1 1 1 178
1 1 1 1 178
1 1 1 1 178
0
43 vertex(0)
44 vertex(1)
45 vertex(2)
46 vertex(3)
47 vertex(4)
48 vertex(5)
49 vertex(6)
50 vertex(7)
51 vertex(8)
52 vertex(9)
3 arc(0,1)
4 arc(0,4)
5 arc(0,7)
6 arc(0,9)
7 arc(1,0)
8 arc(1,3)
9 arc(1,4)
10 arc(1,6)
11 arc(2,5)
12 arc(2,8)
13 arc(2,9)
14 arc(3,1)
15 arc(3,6)
16 arc(4,0)
17 arc(4,1)
18 arc(4,6)
19 arc(4,7)
20 arc(5,2)
21 arc(5,7)
22 arc(5,8)
23 arc(5,9)
24 arc(6,1)
25 arc(6,3)
26 arc(6,4)
27 arc(6,7)
28 arc(6,8)
29 arc(7,0)
30 arc(7,4)
31 arc(7,5)
32 arc(7,6)
33 arc(7,8)
34 arc(7,9)
35 arc(8,2)
36 arc(8,5)
37 arc(8,6)
38 arc(8,7)
39 arc(9,0)
40 arc(9,2)
41 arc(9,5)
42 arc(9,7)
173 reached(0)
174 reached(6)
175 reached(4)
176 reached(3)
177 reached(1)
178 reached(9)
179 reached(7)
180 reached(8)
181 reached(5)
182 reached(2)
54 out_hm(0,1)
57 out_hm(0,4)
60 out_hm(0,7)
63 out_hm(0,9)
66 out_hm(1,0)
69 out_hm(1,3)
72 out_hm(1,4)
75 out_hm(1,6)
78 out_hm(2,5)
81 out_hm(2,8)
84 out_hm(2,9)
87 out_hm(3,1)
90 out_hm(3,6)
93 out_hm(4,0)
96 out_hm(4,1)
99 out_hm(4,6)
102 out_hm(4,7)
105 out_hm(5,2)
108 out_hm(5,7)
111 out_hm(5,8)
114 out_hm(5,9)
117 out_hm(6,1)
120 out_hm(6,3)
123 out_hm(6,4)
126 out_hm(6,7)
129 out_hm(6,8)
132 out_hm(7,0)
135 out_hm(7,4)
138 out_hm(7,5)
141 out_hm(7,6)
144 out_hm(7,8)
147 out_hm(7,9)
150 out_hm(8,2)
153 out_hm(8,5)
156 out_hm(8,6)
159 out_hm(8,7)
162 out_hm(9,0)
165 out_hm(9,2)
168 out_hm(9,5)
171 out_hm(9,7)
53 in_hm(0,1)
56 in_hm(0,4)
59 in_hm(0,7)
62 in_hm(0,9)
65 in_hm(1,0)
68 in_hm(1,3)
71 in_hm(1,4)
74 in_hm(1,6)
77 in_hm(2,5)
80 in_hm(2,8)
83 in_hm(2,9)
86 in_hm(3,1)
89 in_hm(3,6)
92 in_hm(4,0)
95 in_hm(4,1)
98 in_hm(4,6)
101 in_hm(4,7)
104 in_hm(5,2)
107 in_hm(5,7)
110 in_hm(5,8)
113 in_hm(5,9)
116 in_hm(6,1)
119 in_hm(6,3)
122 in_hm(6,4)
125 in_hm(6,7)
128 in_hm(6,8)
131 in_hm(7,0)
134 in_hm(7,4)
137 in_hm(7,5)
140 in_hm(7,6)
143 in_hm(7,8)
146 in_hm(7,9)
149 in_hm(8,2)
152 in_hm(8,5)
155 in_hm(8,6)
158 in_hm(8,7)
161 in_hm(9,0)
164 in_hm(9,2)
167 in_hm(9,5)
170 in_hm(9,7)
2 start(1)
0
B+
0
B-
1
0
1
"""
output = """
{start(1), arc(0,1), arc(0,4), arc(0,7), arc(0,9), arc(1,0), arc(1,3), arc(1,4), arc(1,6), arc(2,5), arc(2,8), arc(2,9), arc(3,1), arc(3,6), arc(4,0), arc(4,1), arc(4,6), arc(4,7), arc(5,2), arc(5,7), arc(5,8), arc(5,9), arc(6,1), arc(6,3), arc(6,4), arc(6,7), arc(6,8), arc(7,0), arc(7,4), arc(7,5), arc(7,6), arc(7,8), arc(7,9), arc(8,2), arc(8,5), arc(8,6), arc(8,7), arc(9,0), arc(9,2), arc(9,5), arc(9,7), vertex(0), vertex(1), vertex(2), vertex(3), vertex(4), vertex(5), vertex(6), vertex(7), vertex(8), vertex(9), reached(0), reached(6), reached(4), reached(3), reached(1), reached(9), reached(7), reached(8), reached(5), reached(2), out_hm(6,1), out_hm(1,6)}
"""
| true
| true
|
f70a2bc707361296f106a19a66ca8ea96965d277
| 5,861
|
py
|
Python
|
favs_v1.py
|
dostarora97/Twitter-Fav-Media-Scraper
|
3fba8d0f882e4b75726beeffdcf069e57544a931
|
[
"MIT"
] | null | null | null |
favs_v1.py
|
dostarora97/Twitter-Fav-Media-Scraper
|
3fba8d0f882e4b75726beeffdcf069e57544a931
|
[
"MIT"
] | null | null | null |
favs_v1.py
|
dostarora97/Twitter-Fav-Media-Scraper
|
3fba8d0f882e4b75726beeffdcf069e57544a931
|
[
"MIT"
] | null | null | null |
import json, base64, requests
from jinja2 import Environment, FileSystemLoader
from pathlib import Path
import webbrowser
import tweepy
import sys
class Twitter:
def __init__(self, auth, Bearer_Token=None):
self.auth = auth
self.Bearer_Token = Bearer_Token
if self.auth is None:
raise ValueError("API Authorisation keys needed.")
if (self.auth.get("API_key", None) == None) or (self.auth.get("API_secret_key", None) == None):
raise ValueError("'API_key' and 'API_scret_key' not specified")
Path().absolute().joinpath("data").mkdir(parents=True, exist_ok=True)
def GET_BearerToken(self):
credentials = self.auth["API_key"] + ":" + self.auth["API_secret_key"]
b64_creds = base64.b64encode(credentials.encode()).decode()
headers = {
"Authorization" : "Basic " + b64_creds,
"Content-Type" : "application/x-www-form-urlencoded",
"charset" : "UTF-8"
}
payload = {
"grant_type" : "client_credentials"
}
r = requests.post(
"https://api.twitter.com/oauth2/token",
headers=headers,
data=payload
)
self.Bearer_Token = r.json()
later_use = input("Save Bearer Token for later use? [y/n] : ")
if (later_use.lower() == "y"):
with open("Bearer_Token.json", "w", encoding="UTF-8") as bt_file:
json.dump(self.Bearer_Token, bt_file)
print("Saved to Bearer_Token.json")
return self.Bearer_Token
def GET_Favourites(self, screen_name, count, Bearer_Token=None):
if Bearer_Token == None:
print("Bearer Token not specified.\n Using from Class Instance.")
Bearer_Token = self.Bearer_Token
if Bearer_Token == None:
raise ValueError("Class instance not initialized Bearer_Token")
headers = {
"Authorization" : Bearer_Token["token_type"] +
" " +
Bearer_Token["access_token"]
}
payload = {
"screen_name" : screen_name,
"count" : count,
"tweet_mode" : "extended"
}
r = requests.get(
"https://api.twitter.com/1.1/favorites/list.json",
headers=headers,
params=payload
)
favs = r.json()
with open("data/favs.json", "w", encoding='UTF-8') as favs_file:
json.dump(favs, favs_file, indent=4, ensure_ascii=False)
print("{} Favourite Tweets Captured".format(len(favs)))
return favs
def GET_MediaTweets(self, favs=None):
if favs == None :
with open("data/favs.json", "r", encoding="UTF-8") as fav_file:
favs = json.load(fav_file)
media_tweets = []
for tweet in favs:
extended_entity = tweet.get("extended_entities", None)
if extended_entity != None:
media_tweet = {}
media_tweet["created_at"] = tweet["created_at"]
media_tweet["media"] = tweet["extended_entities"]["media"]
media_tweets.append(media_tweet)
with open("data/media_tweets.json", "w", encoding="UTF-8") as media_tweets_file:
json.dump(media_tweets, media_tweets_file, indent=4, ensure_ascii=False)
print("{} Tweets with Media".format(len(media_tweets)))
return media_tweets
def GET_Media(self, media_tweets=None):
if media_tweets == None:
with open("data/media_tweets.json", "r", encoding="UTF-8") as media_tweets_file:
media_tweets = json.load(media_tweets_file)
custom_media_list = []
for tweet in media_tweets:
media_ele_list = tweet["media"]
for media_ele in media_ele_list:
custom_media_ele = {}
custom_media_ele["created_at"] = tweet["created_at"]
custom_media_ele["type"] = media_ele["type"]
custom_media_ele["id"] = media_ele["id_str"]
if custom_media_ele["type"] == "video" or custom_media_ele["type"] == "animated_gif":
variants = {}
for video_variants in media_ele["video_info"]["variants"]:
if video_variants["content_type"] == "video/mp4":
variants[video_variants["bitrate"]] = video_variants["url"]
max_bitrate = max(variants.keys())
custom_media_ele["url"] = variants[max_bitrate]
else:
custom_media_ele["url"] = media_ele["media_url"]
custom_media_list.append(custom_media_ele)
with open("data/media.json", "w", encoding="UTF-8") as media_file:
json.dump(custom_media_list, media_file, indent=4, ensure_ascii=False)
print("{} Media".format(len(custom_media_list)))
return custom_media_list
def visualize(self, media=None):
if media == None:
with open("data/media.json", "r", encoding="UTF-8") as media_file:
media_list = json.load(media_file)
else:
media_list = media
file_loader = FileSystemLoader('Templates')
env = Environment(loader=file_loader)
template = env.get_template('media.html')
output = template.render(media_list=media_list)
with open("./data/media.html", "w") as index_file:
index_file.write(output)
webbrowser.open("data\\media.html")
with open("auth.json", "r") as auth_file:
auth = json.load(auth_file)
twpy = Twitter(auth)
twpy.visualize(
twpy.GET_Media(
twpy.GET_MediaTweets(
twpy.GET_Favourites(
"Twitter", 200, twpy.GET_BearerToken()
)
)
)
)
| 35.737805
| 103
| 0.576693
|
import json, base64, requests
from jinja2 import Environment, FileSystemLoader
from pathlib import Path
import webbrowser
import tweepy
import sys
class Twitter:
def __init__(self, auth, Bearer_Token=None):
self.auth = auth
self.Bearer_Token = Bearer_Token
if self.auth is None:
raise ValueError("API Authorisation keys needed.")
if (self.auth.get("API_key", None) == None) or (self.auth.get("API_secret_key", None) == None):
raise ValueError("'API_key' and 'API_scret_key' not specified")
Path().absolute().joinpath("data").mkdir(parents=True, exist_ok=True)
def GET_BearerToken(self):
credentials = self.auth["API_key"] + ":" + self.auth["API_secret_key"]
b64_creds = base64.b64encode(credentials.encode()).decode()
headers = {
"Authorization" : "Basic " + b64_creds,
"Content-Type" : "application/x-www-form-urlencoded",
"charset" : "UTF-8"
}
payload = {
"grant_type" : "client_credentials"
}
r = requests.post(
"https://api.twitter.com/oauth2/token",
headers=headers,
data=payload
)
self.Bearer_Token = r.json()
later_use = input("Save Bearer Token for later use? [y/n] : ")
if (later_use.lower() == "y"):
with open("Bearer_Token.json", "w", encoding="UTF-8") as bt_file:
json.dump(self.Bearer_Token, bt_file)
print("Saved to Bearer_Token.json")
return self.Bearer_Token
def GET_Favourites(self, screen_name, count, Bearer_Token=None):
if Bearer_Token == None:
print("Bearer Token not specified.\n Using from Class Instance.")
Bearer_Token = self.Bearer_Token
if Bearer_Token == None:
raise ValueError("Class instance not initialized Bearer_Token")
headers = {
"Authorization" : Bearer_Token["token_type"] +
" " +
Bearer_Token["access_token"]
}
payload = {
"screen_name" : screen_name,
"count" : count,
"tweet_mode" : "extended"
}
r = requests.get(
"https://api.twitter.com/1.1/favorites/list.json",
headers=headers,
params=payload
)
favs = r.json()
with open("data/favs.json", "w", encoding='UTF-8') as favs_file:
json.dump(favs, favs_file, indent=4, ensure_ascii=False)
print("{} Favourite Tweets Captured".format(len(favs)))
return favs
def GET_MediaTweets(self, favs=None):
if favs == None :
with open("data/favs.json", "r", encoding="UTF-8") as fav_file:
favs = json.load(fav_file)
media_tweets = []
for tweet in favs:
extended_entity = tweet.get("extended_entities", None)
if extended_entity != None:
media_tweet = {}
media_tweet["created_at"] = tweet["created_at"]
media_tweet["media"] = tweet["extended_entities"]["media"]
media_tweets.append(media_tweet)
with open("data/media_tweets.json", "w", encoding="UTF-8") as media_tweets_file:
json.dump(media_tweets, media_tweets_file, indent=4, ensure_ascii=False)
print("{} Tweets with Media".format(len(media_tweets)))
return media_tweets
def GET_Media(self, media_tweets=None):
if media_tweets == None:
with open("data/media_tweets.json", "r", encoding="UTF-8") as media_tweets_file:
media_tweets = json.load(media_tweets_file)
custom_media_list = []
for tweet in media_tweets:
media_ele_list = tweet["media"]
for media_ele in media_ele_list:
custom_media_ele = {}
custom_media_ele["created_at"] = tweet["created_at"]
custom_media_ele["type"] = media_ele["type"]
custom_media_ele["id"] = media_ele["id_str"]
if custom_media_ele["type"] == "video" or custom_media_ele["type"] == "animated_gif":
variants = {}
for video_variants in media_ele["video_info"]["variants"]:
if video_variants["content_type"] == "video/mp4":
variants[video_variants["bitrate"]] = video_variants["url"]
max_bitrate = max(variants.keys())
custom_media_ele["url"] = variants[max_bitrate]
else:
custom_media_ele["url"] = media_ele["media_url"]
custom_media_list.append(custom_media_ele)
with open("data/media.json", "w", encoding="UTF-8") as media_file:
json.dump(custom_media_list, media_file, indent=4, ensure_ascii=False)
print("{} Media".format(len(custom_media_list)))
return custom_media_list
def visualize(self, media=None):
if media == None:
with open("data/media.json", "r", encoding="UTF-8") as media_file:
media_list = json.load(media_file)
else:
media_list = media
file_loader = FileSystemLoader('Templates')
env = Environment(loader=file_loader)
template = env.get_template('media.html')
output = template.render(media_list=media_list)
with open("./data/media.html", "w") as index_file:
index_file.write(output)
webbrowser.open("data\\media.html")
with open("auth.json", "r") as auth_file:
auth = json.load(auth_file)
twpy = Twitter(auth)
twpy.visualize(
twpy.GET_Media(
twpy.GET_MediaTweets(
twpy.GET_Favourites(
"Twitter", 200, twpy.GET_BearerToken()
)
)
)
)
| true
| true
|
f70a2d293516b125f2a84d6c3115ac2d0c17eb1b
| 20,126
|
py
|
Python
|
homeassistant/components/group/__init__.py
|
veresspeter/home-assistant
|
a3c22c6eec2c77a28a8fa859e899984269708666
|
[
"Apache-2.0"
] | 2
|
2018-02-14T07:29:46.000Z
|
2018-02-20T08:15:51.000Z
|
homeassistant/components/group/__init__.py
|
veresspeter/home-assistant
|
a3c22c6eec2c77a28a8fa859e899984269708666
|
[
"Apache-2.0"
] | 3
|
2021-09-08T03:43:17.000Z
|
2022-03-12T01:01:30.000Z
|
homeassistant/components/group/__init__.py
|
veresspeter/home-assistant
|
a3c22c6eec2c77a28a8fa859e899984269708666
|
[
"Apache-2.0"
] | 1
|
2020-04-12T17:17:42.000Z
|
2020-04-12T17:17:42.000Z
|
"""
Provide the functionality to group entities.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/group/
"""
import asyncio
import logging
import voluptuous as vol
from homeassistant import core as ha
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_ICON, CONF_NAME, STATE_CLOSED, STATE_HOME,
STATE_NOT_HOME, STATE_OFF, STATE_ON, STATE_OPEN, STATE_LOCKED,
STATE_UNLOCKED, STATE_OK, STATE_PROBLEM, STATE_UNKNOWN,
ATTR_ASSUMED_STATE, SERVICE_RELOAD)
from homeassistant.core import callback
from homeassistant.loader import bind_hass
from homeassistant.helpers.entity import Entity, async_generate_entity_id
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.event import async_track_state_change
import homeassistant.helpers.config_validation as cv
from homeassistant.util.async_ import run_coroutine_threadsafe
DOMAIN = 'group'
ENTITY_ID_FORMAT = DOMAIN + '.{}'
CONF_ENTITIES = 'entities'
CONF_VIEW = 'view'
CONF_CONTROL = 'control'
ATTR_ADD_ENTITIES = 'add_entities'
ATTR_AUTO = 'auto'
ATTR_CONTROL = 'control'
ATTR_ENTITIES = 'entities'
ATTR_ICON = 'icon'
ATTR_NAME = 'name'
ATTR_OBJECT_ID = 'object_id'
ATTR_ORDER = 'order'
ATTR_VIEW = 'view'
ATTR_VISIBLE = 'visible'
SERVICE_SET_VISIBILITY = 'set_visibility'
SERVICE_SET = 'set'
SERVICE_REMOVE = 'remove'
CONTROL_TYPES = vol.In(['hidden', None])
SET_VISIBILITY_SERVICE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
vol.Required(ATTR_VISIBLE): cv.boolean
})
RELOAD_SERVICE_SCHEMA = vol.Schema({})
SET_SERVICE_SCHEMA = vol.Schema({
vol.Required(ATTR_OBJECT_ID): cv.slug,
vol.Optional(ATTR_NAME): cv.string,
vol.Optional(ATTR_VIEW): cv.boolean,
vol.Optional(ATTR_ICON): cv.string,
vol.Optional(ATTR_CONTROL): CONTROL_TYPES,
vol.Optional(ATTR_VISIBLE): cv.boolean,
vol.Exclusive(ATTR_ENTITIES, 'entities'): cv.entity_ids,
vol.Exclusive(ATTR_ADD_ENTITIES, 'entities'): cv.entity_ids,
})
REMOVE_SERVICE_SCHEMA = vol.Schema({
vol.Required(ATTR_OBJECT_ID): cv.slug,
})
_LOGGER = logging.getLogger(__name__)
def _conf_preprocess(value):
"""Preprocess alternative configuration formats."""
if not isinstance(value, dict):
value = {CONF_ENTITIES: value}
return value
GROUP_SCHEMA = vol.Schema({
vol.Optional(CONF_ENTITIES): vol.Any(cv.entity_ids, None),
CONF_VIEW: cv.boolean,
CONF_NAME: cv.string,
CONF_ICON: cv.icon,
CONF_CONTROL: CONTROL_TYPES,
})
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({cv.match_all: vol.All(_conf_preprocess, GROUP_SCHEMA)})
}, extra=vol.ALLOW_EXTRA)
# List of ON/OFF state tuples for groupable states
_GROUP_TYPES = [(STATE_ON, STATE_OFF), (STATE_HOME, STATE_NOT_HOME),
(STATE_OPEN, STATE_CLOSED), (STATE_LOCKED, STATE_UNLOCKED),
(STATE_PROBLEM, STATE_OK)]
def _get_group_on_off(state):
"""Determine the group on/off states based on a state."""
for states in _GROUP_TYPES:
if state in states:
return states
return None, None
@bind_hass
def is_on(hass, entity_id):
"""Test if the group state is in its ON-state."""
state = hass.states.get(entity_id)
if state:
group_on, _ = _get_group_on_off(state.state)
# If we found a group_type, compare to ON-state
return group_on is not None and state.state == group_on
return False
@bind_hass
def reload(hass):
"""Reload the automation from config."""
hass.add_job(async_reload, hass)
@callback
@bind_hass
def async_reload(hass):
"""Reload the automation from config."""
hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_RELOAD))
@bind_hass
def set_visibility(hass, entity_id=None, visible=True):
"""Hide or shows a group."""
data = {ATTR_ENTITY_ID: entity_id, ATTR_VISIBLE: visible}
hass.services.call(DOMAIN, SERVICE_SET_VISIBILITY, data)
@bind_hass
def set_group(hass, object_id, name=None, entity_ids=None, visible=None,
icon=None, view=None, control=None, add=None):
"""Create/Update a group."""
hass.add_job(
async_set_group, hass, object_id, name, entity_ids, visible, icon,
view, control, add)
@callback
@bind_hass
def async_set_group(hass, object_id, name=None, entity_ids=None, visible=None,
icon=None, view=None, control=None, add=None):
"""Create/Update a group."""
data = {
key: value for key, value in [
(ATTR_OBJECT_ID, object_id),
(ATTR_NAME, name),
(ATTR_ENTITIES, entity_ids),
(ATTR_VISIBLE, visible),
(ATTR_ICON, icon),
(ATTR_VIEW, view),
(ATTR_CONTROL, control),
(ATTR_ADD_ENTITIES, add),
] if value is not None
}
hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_SET, data))
@bind_hass
def remove(hass, name):
"""Remove a user group."""
hass.add_job(async_remove, hass, name)
@callback
@bind_hass
def async_remove(hass, object_id):
"""Remove a user group."""
data = {ATTR_OBJECT_ID: object_id}
hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_REMOVE, data))
@bind_hass
def expand_entity_ids(hass, entity_ids):
"""Return entity_ids with group entity ids replaced by their members.
Async friendly.
"""
found_ids = []
for entity_id in entity_ids:
if not isinstance(entity_id, str):
continue
entity_id = entity_id.lower()
try:
# If entity_id points at a group, expand it
domain, _ = ha.split_entity_id(entity_id)
if domain == DOMAIN:
child_entities = get_entity_ids(hass, entity_id)
if entity_id in child_entities:
child_entities = list(child_entities)
child_entities.remove(entity_id)
found_ids.extend(
ent_id for ent_id
in expand_entity_ids(hass, child_entities)
if ent_id not in found_ids)
else:
if entity_id not in found_ids:
found_ids.append(entity_id)
except AttributeError:
# Raised by split_entity_id if entity_id is not a string
pass
return found_ids
@bind_hass
def get_entity_ids(hass, entity_id, domain_filter=None):
"""Get members of this group.
Async friendly.
"""
group = hass.states.get(entity_id)
if not group or ATTR_ENTITY_ID not in group.attributes:
return []
entity_ids = group.attributes[ATTR_ENTITY_ID]
if not domain_filter:
return entity_ids
domain_filter = domain_filter.lower() + '.'
return [ent_id for ent_id in entity_ids
if ent_id.startswith(domain_filter)]
async def async_setup(hass, config):
"""Set up all groups found defined in the configuration."""
component = hass.data.get(DOMAIN)
if component is None:
component = hass.data[DOMAIN] = EntityComponent(_LOGGER, DOMAIN, hass)
await _async_process_config(hass, config, component)
async def reload_service_handler(service):
"""Remove all user-defined groups and load new ones from config."""
auto = list(filter(lambda e: not e.user_defined, component.entities))
conf = await component.async_prepare_reload()
if conf is None:
return
await _async_process_config(hass, conf, component)
await component.async_add_entities(auto)
hass.services.async_register(
DOMAIN, SERVICE_RELOAD, reload_service_handler,
schema=RELOAD_SERVICE_SCHEMA)
async def groups_service_handler(service):
"""Handle dynamic group service functions."""
object_id = service.data[ATTR_OBJECT_ID]
entity_id = ENTITY_ID_FORMAT.format(object_id)
group = component.get_entity(entity_id)
# new group
if service.service == SERVICE_SET and group is None:
entity_ids = service.data.get(ATTR_ENTITIES) or \
service.data.get(ATTR_ADD_ENTITIES) or None
extra_arg = {attr: service.data[attr] for attr in (
ATTR_VISIBLE, ATTR_ICON, ATTR_VIEW, ATTR_CONTROL
) if service.data.get(attr) is not None}
await Group.async_create_group(
hass, service.data.get(ATTR_NAME, object_id),
object_id=object_id,
entity_ids=entity_ids,
user_defined=False,
**extra_arg
)
return
if group is None:
_LOGGER.warning("%s:Group '%s' doesn't exist!",
service.service, object_id)
return
# update group
if service.service == SERVICE_SET:
need_update = False
if ATTR_ADD_ENTITIES in service.data:
delta = service.data[ATTR_ADD_ENTITIES]
entity_ids = set(group.tracking) | set(delta)
await group.async_update_tracked_entity_ids(entity_ids)
if ATTR_ENTITIES in service.data:
entity_ids = service.data[ATTR_ENTITIES]
await group.async_update_tracked_entity_ids(entity_ids)
if ATTR_NAME in service.data:
group.name = service.data[ATTR_NAME]
need_update = True
if ATTR_VISIBLE in service.data:
group.visible = service.data[ATTR_VISIBLE]
need_update = True
if ATTR_ICON in service.data:
group.icon = service.data[ATTR_ICON]
need_update = True
if ATTR_CONTROL in service.data:
group.control = service.data[ATTR_CONTROL]
need_update = True
if ATTR_VIEW in service.data:
group.view = service.data[ATTR_VIEW]
need_update = True
if need_update:
await group.async_update_ha_state()
return
# remove group
if service.service == SERVICE_REMOVE:
await component.async_remove_entity(entity_id)
hass.services.async_register(
DOMAIN, SERVICE_SET, groups_service_handler,
schema=SET_SERVICE_SCHEMA)
hass.services.async_register(
DOMAIN, SERVICE_REMOVE, groups_service_handler,
schema=REMOVE_SERVICE_SCHEMA)
async def visibility_service_handler(service):
"""Change visibility of a group."""
visible = service.data.get(ATTR_VISIBLE)
tasks = []
for group in component.async_extract_from_service(service,
expand_group=False):
group.visible = visible
tasks.append(group.async_update_ha_state())
if tasks:
await asyncio.wait(tasks, loop=hass.loop)
hass.services.async_register(
DOMAIN, SERVICE_SET_VISIBILITY, visibility_service_handler,
schema=SET_VISIBILITY_SERVICE_SCHEMA)
return True
async def _async_process_config(hass, config, component):
"""Process group configuration."""
for object_id, conf in config.get(DOMAIN, {}).items():
name = conf.get(CONF_NAME, object_id)
entity_ids = conf.get(CONF_ENTITIES) or []
icon = conf.get(CONF_ICON)
view = conf.get(CONF_VIEW)
control = conf.get(CONF_CONTROL)
# Don't create tasks and await them all. The order is important as
# groups get a number based on creation order.
await Group.async_create_group(
hass, name, entity_ids, icon=icon, view=view,
control=control, object_id=object_id)
class Group(Entity):
"""Track a group of entity ids."""
def __init__(self, hass, name, order=None, visible=True, icon=None,
view=False, control=None, user_defined=True, entity_ids=None):
"""Initialize a group.
This Object has factory function for creation.
"""
self.hass = hass
self._name = name
self._state = STATE_UNKNOWN
self._icon = icon
self.view = view
if entity_ids:
self.tracking = tuple(ent_id.lower() for ent_id in entity_ids)
else:
self.tracking = tuple()
self.group_on = None
self.group_off = None
self.visible = visible
self.control = control
self.user_defined = user_defined
self._order = order
self._assumed_state = False
self._async_unsub_state_changed = None
@staticmethod
def create_group(hass, name, entity_ids=None, user_defined=True,
visible=True, icon=None, view=False, control=None,
object_id=None):
"""Initialize a group."""
return run_coroutine_threadsafe(
Group.async_create_group(
hass, name, entity_ids, user_defined, visible, icon, view,
control, object_id),
hass.loop).result()
@staticmethod
async def async_create_group(hass, name, entity_ids=None,
user_defined=True, visible=True, icon=None,
view=False, control=None, object_id=None):
"""Initialize a group.
This method must be run in the event loop.
"""
group = Group(
hass, name,
order=len(hass.states.async_entity_ids(DOMAIN)),
visible=visible, icon=icon, view=view, control=control,
user_defined=user_defined, entity_ids=entity_ids
)
group.entity_id = async_generate_entity_id(
ENTITY_ID_FORMAT, object_id or name, hass=hass)
# If called before the platform async_setup is called (test cases)
component = hass.data.get(DOMAIN)
if component is None:
component = hass.data[DOMAIN] = \
EntityComponent(_LOGGER, DOMAIN, hass)
await component.async_add_entities([group], True)
return group
@property
def should_poll(self):
"""No need to poll because groups will update themselves."""
return False
@property
def name(self):
"""Return the name of the group."""
return self._name
@name.setter
def name(self, value):
"""Set Group name."""
self._name = value
@property
def state(self):
"""Return the state of the group."""
return self._state
@property
def icon(self):
"""Return the icon of the group."""
return self._icon
@icon.setter
def icon(self, value):
"""Set Icon for group."""
self._icon = value
@property
def hidden(self):
"""If group should be hidden or not."""
if self.visible and not self.view:
return False
return True
@property
def state_attributes(self):
"""Return the state attributes for the group."""
data = {
ATTR_ENTITY_ID: self.tracking,
ATTR_ORDER: self._order,
}
if not self.user_defined:
data[ATTR_AUTO] = True
if self.view:
data[ATTR_VIEW] = True
if self.control:
data[ATTR_CONTROL] = self.control
return data
@property
def assumed_state(self):
"""Test if any member has an assumed state."""
return self._assumed_state
def update_tracked_entity_ids(self, entity_ids):
"""Update the member entity IDs."""
run_coroutine_threadsafe(
self.async_update_tracked_entity_ids(entity_ids), self.hass.loop
).result()
async def async_update_tracked_entity_ids(self, entity_ids):
"""Update the member entity IDs.
This method must be run in the event loop.
"""
await self.async_stop()
self.tracking = tuple(ent_id.lower() for ent_id in entity_ids)
self.group_on, self.group_off = None, None
await self.async_update_ha_state(True)
self.async_start()
@callback
def async_start(self):
"""Start tracking members.
This method must be run in the event loop.
"""
if self._async_unsub_state_changed is None:
self._async_unsub_state_changed = async_track_state_change(
self.hass, self.tracking, self._async_state_changed_listener
)
async def async_stop(self):
"""Unregister the group from Home Assistant.
This method must be run in the event loop.
"""
if self._async_unsub_state_changed:
self._async_unsub_state_changed()
self._async_unsub_state_changed = None
async def async_update(self):
"""Query all members and determine current group state."""
self._state = STATE_UNKNOWN
self._async_update_group_state()
async def async_added_to_hass(self):
"""Callback when added to HASS."""
if self.tracking:
self.async_start()
async def async_will_remove_from_hass(self):
"""Callback when removed from HASS."""
if self._async_unsub_state_changed:
self._async_unsub_state_changed()
self._async_unsub_state_changed = None
async def _async_state_changed_listener(self, entity_id, old_state,
new_state):
"""Respond to a member state changing.
This method must be run in the event loop.
"""
# removed
if self._async_unsub_state_changed is None:
return
self._async_update_group_state(new_state)
await self.async_update_ha_state()
@property
def _tracking_states(self):
"""Return the states that the group is tracking."""
states = []
for entity_id in self.tracking:
state = self.hass.states.get(entity_id)
if state is not None:
states.append(state)
return states
@callback
def _async_update_group_state(self, tr_state=None):
"""Update group state.
Optionally you can provide the only state changed since last update
allowing this method to take shortcuts.
This method must be run in the event loop.
"""
# To store current states of group entities. Might not be needed.
states = None
gr_state = self._state
gr_on = self.group_on
gr_off = self.group_off
# We have not determined type of group yet
if gr_on is None:
if tr_state is None:
states = self._tracking_states
for state in states:
gr_on, gr_off = \
_get_group_on_off(state.state)
if gr_on is not None:
break
else:
gr_on, gr_off = _get_group_on_off(tr_state.state)
if gr_on is not None:
self.group_on, self.group_off = gr_on, gr_off
# We cannot determine state of the group
if gr_on is None:
return
if tr_state is None or ((gr_state == gr_on and
tr_state.state == gr_off) or
tr_state.state not in (gr_on, gr_off)):
if states is None:
states = self._tracking_states
if any(state.state == gr_on for state in states):
self._state = gr_on
else:
self._state = gr_off
elif tr_state.state in (gr_on, gr_off):
self._state = tr_state.state
if tr_state is None or self._assumed_state and \
not tr_state.attributes.get(ATTR_ASSUMED_STATE):
if states is None:
states = self._tracking_states
self._assumed_state = any(
state.attributes.get(ATTR_ASSUMED_STATE) for state
in states)
elif tr_state.attributes.get(ATTR_ASSUMED_STATE):
self._assumed_state = True
| 30.915515
| 79
| 0.626851
|
import asyncio
import logging
import voluptuous as vol
from homeassistant import core as ha
from homeassistant.const import (
ATTR_ENTITY_ID, CONF_ICON, CONF_NAME, STATE_CLOSED, STATE_HOME,
STATE_NOT_HOME, STATE_OFF, STATE_ON, STATE_OPEN, STATE_LOCKED,
STATE_UNLOCKED, STATE_OK, STATE_PROBLEM, STATE_UNKNOWN,
ATTR_ASSUMED_STATE, SERVICE_RELOAD)
from homeassistant.core import callback
from homeassistant.loader import bind_hass
from homeassistant.helpers.entity import Entity, async_generate_entity_id
from homeassistant.helpers.entity_component import EntityComponent
from homeassistant.helpers.event import async_track_state_change
import homeassistant.helpers.config_validation as cv
from homeassistant.util.async_ import run_coroutine_threadsafe
DOMAIN = 'group'
ENTITY_ID_FORMAT = DOMAIN + '.{}'
CONF_ENTITIES = 'entities'
CONF_VIEW = 'view'
CONF_CONTROL = 'control'
ATTR_ADD_ENTITIES = 'add_entities'
ATTR_AUTO = 'auto'
ATTR_CONTROL = 'control'
ATTR_ENTITIES = 'entities'
ATTR_ICON = 'icon'
ATTR_NAME = 'name'
ATTR_OBJECT_ID = 'object_id'
ATTR_ORDER = 'order'
ATTR_VIEW = 'view'
ATTR_VISIBLE = 'visible'
SERVICE_SET_VISIBILITY = 'set_visibility'
SERVICE_SET = 'set'
SERVICE_REMOVE = 'remove'
CONTROL_TYPES = vol.In(['hidden', None])
SET_VISIBILITY_SERVICE_SCHEMA = vol.Schema({
vol.Optional(ATTR_ENTITY_ID): cv.entity_ids,
vol.Required(ATTR_VISIBLE): cv.boolean
})
RELOAD_SERVICE_SCHEMA = vol.Schema({})
SET_SERVICE_SCHEMA = vol.Schema({
vol.Required(ATTR_OBJECT_ID): cv.slug,
vol.Optional(ATTR_NAME): cv.string,
vol.Optional(ATTR_VIEW): cv.boolean,
vol.Optional(ATTR_ICON): cv.string,
vol.Optional(ATTR_CONTROL): CONTROL_TYPES,
vol.Optional(ATTR_VISIBLE): cv.boolean,
vol.Exclusive(ATTR_ENTITIES, 'entities'): cv.entity_ids,
vol.Exclusive(ATTR_ADD_ENTITIES, 'entities'): cv.entity_ids,
})
REMOVE_SERVICE_SCHEMA = vol.Schema({
vol.Required(ATTR_OBJECT_ID): cv.slug,
})
_LOGGER = logging.getLogger(__name__)
def _conf_preprocess(value):
if not isinstance(value, dict):
value = {CONF_ENTITIES: value}
return value
GROUP_SCHEMA = vol.Schema({
vol.Optional(CONF_ENTITIES): vol.Any(cv.entity_ids, None),
CONF_VIEW: cv.boolean,
CONF_NAME: cv.string,
CONF_ICON: cv.icon,
CONF_CONTROL: CONTROL_TYPES,
})
CONFIG_SCHEMA = vol.Schema({
DOMAIN: vol.Schema({cv.match_all: vol.All(_conf_preprocess, GROUP_SCHEMA)})
}, extra=vol.ALLOW_EXTRA)
_GROUP_TYPES = [(STATE_ON, STATE_OFF), (STATE_HOME, STATE_NOT_HOME),
(STATE_OPEN, STATE_CLOSED), (STATE_LOCKED, STATE_UNLOCKED),
(STATE_PROBLEM, STATE_OK)]
def _get_group_on_off(state):
for states in _GROUP_TYPES:
if state in states:
return states
return None, None
@bind_hass
def is_on(hass, entity_id):
state = hass.states.get(entity_id)
if state:
group_on, _ = _get_group_on_off(state.state)
return group_on is not None and state.state == group_on
return False
@bind_hass
def reload(hass):
hass.add_job(async_reload, hass)
@callback
@bind_hass
def async_reload(hass):
hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_RELOAD))
@bind_hass
def set_visibility(hass, entity_id=None, visible=True):
data = {ATTR_ENTITY_ID: entity_id, ATTR_VISIBLE: visible}
hass.services.call(DOMAIN, SERVICE_SET_VISIBILITY, data)
@bind_hass
def set_group(hass, object_id, name=None, entity_ids=None, visible=None,
icon=None, view=None, control=None, add=None):
hass.add_job(
async_set_group, hass, object_id, name, entity_ids, visible, icon,
view, control, add)
@callback
@bind_hass
def async_set_group(hass, object_id, name=None, entity_ids=None, visible=None,
icon=None, view=None, control=None, add=None):
data = {
key: value for key, value in [
(ATTR_OBJECT_ID, object_id),
(ATTR_NAME, name),
(ATTR_ENTITIES, entity_ids),
(ATTR_VISIBLE, visible),
(ATTR_ICON, icon),
(ATTR_VIEW, view),
(ATTR_CONTROL, control),
(ATTR_ADD_ENTITIES, add),
] if value is not None
}
hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_SET, data))
@bind_hass
def remove(hass, name):
hass.add_job(async_remove, hass, name)
@callback
@bind_hass
def async_remove(hass, object_id):
data = {ATTR_OBJECT_ID: object_id}
hass.async_add_job(hass.services.async_call(DOMAIN, SERVICE_REMOVE, data))
@bind_hass
def expand_entity_ids(hass, entity_ids):
found_ids = []
for entity_id in entity_ids:
if not isinstance(entity_id, str):
continue
entity_id = entity_id.lower()
try:
domain, _ = ha.split_entity_id(entity_id)
if domain == DOMAIN:
child_entities = get_entity_ids(hass, entity_id)
if entity_id in child_entities:
child_entities = list(child_entities)
child_entities.remove(entity_id)
found_ids.extend(
ent_id for ent_id
in expand_entity_ids(hass, child_entities)
if ent_id not in found_ids)
else:
if entity_id not in found_ids:
found_ids.append(entity_id)
except AttributeError:
pass
return found_ids
@bind_hass
def get_entity_ids(hass, entity_id, domain_filter=None):
group = hass.states.get(entity_id)
if not group or ATTR_ENTITY_ID not in group.attributes:
return []
entity_ids = group.attributes[ATTR_ENTITY_ID]
if not domain_filter:
return entity_ids
domain_filter = domain_filter.lower() + '.'
return [ent_id for ent_id in entity_ids
if ent_id.startswith(domain_filter)]
async def async_setup(hass, config):
component = hass.data.get(DOMAIN)
if component is None:
component = hass.data[DOMAIN] = EntityComponent(_LOGGER, DOMAIN, hass)
await _async_process_config(hass, config, component)
async def reload_service_handler(service):
auto = list(filter(lambda e: not e.user_defined, component.entities))
conf = await component.async_prepare_reload()
if conf is None:
return
await _async_process_config(hass, conf, component)
await component.async_add_entities(auto)
hass.services.async_register(
DOMAIN, SERVICE_RELOAD, reload_service_handler,
schema=RELOAD_SERVICE_SCHEMA)
async def groups_service_handler(service):
object_id = service.data[ATTR_OBJECT_ID]
entity_id = ENTITY_ID_FORMAT.format(object_id)
group = component.get_entity(entity_id)
if service.service == SERVICE_SET and group is None:
entity_ids = service.data.get(ATTR_ENTITIES) or \
service.data.get(ATTR_ADD_ENTITIES) or None
extra_arg = {attr: service.data[attr] for attr in (
ATTR_VISIBLE, ATTR_ICON, ATTR_VIEW, ATTR_CONTROL
) if service.data.get(attr) is not None}
await Group.async_create_group(
hass, service.data.get(ATTR_NAME, object_id),
object_id=object_id,
entity_ids=entity_ids,
user_defined=False,
**extra_arg
)
return
if group is None:
_LOGGER.warning("%s:Group '%s' doesn't exist!",
service.service, object_id)
return
# update group
if service.service == SERVICE_SET:
need_update = False
if ATTR_ADD_ENTITIES in service.data:
delta = service.data[ATTR_ADD_ENTITIES]
entity_ids = set(group.tracking) | set(delta)
await group.async_update_tracked_entity_ids(entity_ids)
if ATTR_ENTITIES in service.data:
entity_ids = service.data[ATTR_ENTITIES]
await group.async_update_tracked_entity_ids(entity_ids)
if ATTR_NAME in service.data:
group.name = service.data[ATTR_NAME]
need_update = True
if ATTR_VISIBLE in service.data:
group.visible = service.data[ATTR_VISIBLE]
need_update = True
if ATTR_ICON in service.data:
group.icon = service.data[ATTR_ICON]
need_update = True
if ATTR_CONTROL in service.data:
group.control = service.data[ATTR_CONTROL]
need_update = True
if ATTR_VIEW in service.data:
group.view = service.data[ATTR_VIEW]
need_update = True
if need_update:
await group.async_update_ha_state()
return
# remove group
if service.service == SERVICE_REMOVE:
await component.async_remove_entity(entity_id)
hass.services.async_register(
DOMAIN, SERVICE_SET, groups_service_handler,
schema=SET_SERVICE_SCHEMA)
hass.services.async_register(
DOMAIN, SERVICE_REMOVE, groups_service_handler,
schema=REMOVE_SERVICE_SCHEMA)
async def visibility_service_handler(service):
visible = service.data.get(ATTR_VISIBLE)
tasks = []
for group in component.async_extract_from_service(service,
expand_group=False):
group.visible = visible
tasks.append(group.async_update_ha_state())
if tasks:
await asyncio.wait(tasks, loop=hass.loop)
hass.services.async_register(
DOMAIN, SERVICE_SET_VISIBILITY, visibility_service_handler,
schema=SET_VISIBILITY_SERVICE_SCHEMA)
return True
async def _async_process_config(hass, config, component):
for object_id, conf in config.get(DOMAIN, {}).items():
name = conf.get(CONF_NAME, object_id)
entity_ids = conf.get(CONF_ENTITIES) or []
icon = conf.get(CONF_ICON)
view = conf.get(CONF_VIEW)
control = conf.get(CONF_CONTROL)
# Don't create tasks and await them all. The order is important as
await Group.async_create_group(
hass, name, entity_ids, icon=icon, view=view,
control=control, object_id=object_id)
class Group(Entity):
def __init__(self, hass, name, order=None, visible=True, icon=None,
view=False, control=None, user_defined=True, entity_ids=None):
self.hass = hass
self._name = name
self._state = STATE_UNKNOWN
self._icon = icon
self.view = view
if entity_ids:
self.tracking = tuple(ent_id.lower() for ent_id in entity_ids)
else:
self.tracking = tuple()
self.group_on = None
self.group_off = None
self.visible = visible
self.control = control
self.user_defined = user_defined
self._order = order
self._assumed_state = False
self._async_unsub_state_changed = None
@staticmethod
def create_group(hass, name, entity_ids=None, user_defined=True,
visible=True, icon=None, view=False, control=None,
object_id=None):
return run_coroutine_threadsafe(
Group.async_create_group(
hass, name, entity_ids, user_defined, visible, icon, view,
control, object_id),
hass.loop).result()
@staticmethod
async def async_create_group(hass, name, entity_ids=None,
user_defined=True, visible=True, icon=None,
view=False, control=None, object_id=None):
group = Group(
hass, name,
order=len(hass.states.async_entity_ids(DOMAIN)),
visible=visible, icon=icon, view=view, control=control,
user_defined=user_defined, entity_ids=entity_ids
)
group.entity_id = async_generate_entity_id(
ENTITY_ID_FORMAT, object_id or name, hass=hass)
component = hass.data.get(DOMAIN)
if component is None:
component = hass.data[DOMAIN] = \
EntityComponent(_LOGGER, DOMAIN, hass)
await component.async_add_entities([group], True)
return group
@property
def should_poll(self):
return False
@property
def name(self):
return self._name
@name.setter
def name(self, value):
self._name = value
@property
def state(self):
return self._state
@property
def icon(self):
return self._icon
@icon.setter
def icon(self, value):
self._icon = value
@property
def hidden(self):
if self.visible and not self.view:
return False
return True
@property
def state_attributes(self):
data = {
ATTR_ENTITY_ID: self.tracking,
ATTR_ORDER: self._order,
}
if not self.user_defined:
data[ATTR_AUTO] = True
if self.view:
data[ATTR_VIEW] = True
if self.control:
data[ATTR_CONTROL] = self.control
return data
@property
def assumed_state(self):
return self._assumed_state
def update_tracked_entity_ids(self, entity_ids):
run_coroutine_threadsafe(
self.async_update_tracked_entity_ids(entity_ids), self.hass.loop
).result()
async def async_update_tracked_entity_ids(self, entity_ids):
await self.async_stop()
self.tracking = tuple(ent_id.lower() for ent_id in entity_ids)
self.group_on, self.group_off = None, None
await self.async_update_ha_state(True)
self.async_start()
@callback
def async_start(self):
if self._async_unsub_state_changed is None:
self._async_unsub_state_changed = async_track_state_change(
self.hass, self.tracking, self._async_state_changed_listener
)
async def async_stop(self):
if self._async_unsub_state_changed:
self._async_unsub_state_changed()
self._async_unsub_state_changed = None
async def async_update(self):
self._state = STATE_UNKNOWN
self._async_update_group_state()
async def async_added_to_hass(self):
if self.tracking:
self.async_start()
async def async_will_remove_from_hass(self):
if self._async_unsub_state_changed:
self._async_unsub_state_changed()
self._async_unsub_state_changed = None
async def _async_state_changed_listener(self, entity_id, old_state,
new_state):
if self._async_unsub_state_changed is None:
return
self._async_update_group_state(new_state)
await self.async_update_ha_state()
@property
def _tracking_states(self):
states = []
for entity_id in self.tracking:
state = self.hass.states.get(entity_id)
if state is not None:
states.append(state)
return states
@callback
def _async_update_group_state(self, tr_state=None):
states = None
gr_state = self._state
gr_on = self.group_on
gr_off = self.group_off
if gr_on is None:
if tr_state is None:
states = self._tracking_states
for state in states:
gr_on, gr_off = \
_get_group_on_off(state.state)
if gr_on is not None:
break
else:
gr_on, gr_off = _get_group_on_off(tr_state.state)
if gr_on is not None:
self.group_on, self.group_off = gr_on, gr_off
if gr_on is None:
return
if tr_state is None or ((gr_state == gr_on and
tr_state.state == gr_off) or
tr_state.state not in (gr_on, gr_off)):
if states is None:
states = self._tracking_states
if any(state.state == gr_on for state in states):
self._state = gr_on
else:
self._state = gr_off
elif tr_state.state in (gr_on, gr_off):
self._state = tr_state.state
if tr_state is None or self._assumed_state and \
not tr_state.attributes.get(ATTR_ASSUMED_STATE):
if states is None:
states = self._tracking_states
self._assumed_state = any(
state.attributes.get(ATTR_ASSUMED_STATE) for state
in states)
elif tr_state.attributes.get(ATTR_ASSUMED_STATE):
self._assumed_state = True
| true
| true
|
f70a2e7f346ccb9b2190e341229230510a747e62
| 15,142
|
py
|
Python
|
openstack_dashboard/dashboards/project/firewalls/tables.py
|
timpricecatalyst/horizon
|
8279ae0ed464e62e1c91e78341342160f8a07172
|
[
"Apache-2.0"
] | null | null | null |
openstack_dashboard/dashboards/project/firewalls/tables.py
|
timpricecatalyst/horizon
|
8279ae0ed464e62e1c91e78341342160f8a07172
|
[
"Apache-2.0"
] | null | null | null |
openstack_dashboard/dashboards/project/firewalls/tables.py
|
timpricecatalyst/horizon
|
8279ae0ed464e62e1c91e78341342160f8a07172
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2013, Big Switch Networks, 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 logging
from django.core.urlresolvers import reverse
from django.template import defaultfilters as filters
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
from openstack_dashboard import api
from openstack_dashboard import policy
LOG = logging.getLogger(__name__)
class AddRuleLink(tables.LinkAction):
name = "addrule"
verbose_name = _("Add Rule")
url = "horizon:project:firewalls:addrule"
classes = ("ajax-modal",)
icon = "plus"
policy_rules = (("network", "create_firewall_rule"),)
class AddPolicyLink(tables.LinkAction):
name = "addpolicy"
verbose_name = _("Add Policy")
url = "horizon:project:firewalls:addpolicy"
classes = ("ajax-modal", "btn-addpolicy",)
icon = "plus"
policy_rules = (("network", "create_firewall_policy"),)
class AddFirewallLink(tables.LinkAction):
name = "addfirewall"
verbose_name = _("Create Firewall")
url = "horizon:project:firewalls:addfirewall"
classes = ("ajax-modal",)
icon = "plus"
policy_rules = (("network", "create_firewall"),)
class DeleteRuleLink(policy.PolicyTargetMixin, tables.DeleteAction):
name = "deleterule"
policy_rules = (("network", "delete_firewall_rule"),)
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Rule",
u"Delete Rules",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Scheduled deletion of Rule",
u"Scheduled deletion of Rules",
count
)
def allowed(self, request, datum=None):
if datum and datum.policy:
return False
return True
def delete(self, request, obj_id):
try:
api.fwaas.rule_delete(request, obj_id)
except Exception as e:
exceptions.handle(request, _('Unable to delete rule. %s') % e)
class DeletePolicyLink(policy.PolicyTargetMixin, tables.DeleteAction):
name = "deletepolicy"
policy_rules = (("network", "delete_firewall_policy"),)
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Policy",
u"Delete Policies",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Scheduled deletion of Policy",
u"Scheduled deletion of Policies",
count
)
def delete(self, request, obj_id):
try:
api.fwaas.policy_delete(request, obj_id)
except Exception as e:
exceptions.handle(request, _('Unable to delete policy. %s') % e)
class DeleteFirewallLink(policy.PolicyTargetMixin,
tables.DeleteAction):
name = "deletefirewall"
policy_rules = (("network", "delete_firewall"),)
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Firewall",
u"Delete Firewalls",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Scheduled deletion of Firewall",
u"Scheduled deletion of Firewalls",
count
)
def delete(self, request, obj_id):
try:
api.fwaas.firewall_delete(request, obj_id)
except Exception as e:
exceptions.handle(request, _('Unable to delete firewall. %s') % e)
class UpdateRuleLink(policy.PolicyTargetMixin, tables.LinkAction):
name = "updaterule"
verbose_name = _("Edit Rule")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "update_firewall_rule"),)
def get_link_url(self, rule):
base_url = reverse("horizon:project:firewalls:updaterule",
kwargs={'rule_id': rule.id})
return base_url
class UpdatePolicyLink(policy.PolicyTargetMixin, tables.LinkAction):
name = "updatepolicy"
verbose_name = _("Edit Policy")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "update_firewall_policy"),)
def get_link_url(self, policy):
base_url = reverse("horizon:project:firewalls:updatepolicy",
kwargs={'policy_id': policy.id})
return base_url
class UpdateFirewallLink(policy.PolicyTargetMixin, tables.LinkAction):
name = "updatefirewall"
verbose_name = _("Edit Firewall")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "update_firewall"),)
def get_link_url(self, firewall):
base_url = reverse("horizon:project:firewalls:updatefirewall",
kwargs={'firewall_id': firewall.id})
return base_url
def allowed(self, request, firewall):
if firewall.status in ("PENDING_CREATE",
"PENDING_UPDATE",
"PENDING_DELETE"):
return False
return True
class InsertRuleToPolicyLink(policy.PolicyTargetMixin,
tables.LinkAction):
name = "insertrule"
verbose_name = _("Insert Rule")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "get_firewall_policy"),
("network", "insert_rule"),)
def get_link_url(self, policy):
base_url = reverse("horizon:project:firewalls:insertrule",
kwargs={'policy_id': policy.id})
return base_url
class RemoveRuleFromPolicyLink(policy.PolicyTargetMixin,
tables.LinkAction):
name = "removerule"
verbose_name = _("Remove Rule")
classes = ("ajax-modal", "btn-danger",)
policy_rules = (("network", "get_firewall_policy"),
("network", "remove_rule"),)
def get_link_url(self, policy):
base_url = reverse("horizon:project:firewalls:removerule",
kwargs={'policy_id': policy.id})
return base_url
def allowed(self, request, policy):
if len(policy.rules) > 0:
return True
return False
class AddRouterToFirewallLink(policy.PolicyTargetMixin,
tables.LinkAction):
name = "addrouter"
verbose_name = _("Add Router")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "get_firewall"),
("network", "add_router"),)
def get_link_url(self, firewall):
base_url = reverse("horizon:project:firewalls:addrouter",
kwargs={'firewall_id': firewall.id})
return base_url
def allowed(self, request, firewall):
if not api.neutron.is_extension_supported(request,
'fwaasrouterinsertion'):
return False
tenant_id = firewall['tenant_id']
available_routers = api.fwaas.firewall_unassociated_routers_list(
request, tenant_id)
return bool(available_routers)
class RemoveRouterFromFirewallLink(policy.PolicyTargetMixin,
tables.LinkAction):
name = "removerouter"
verbose_name = _("Remove Router")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "get_firewall"),
("network", "remove_router"),)
def get_link_url(self, firewall):
base_url = reverse("horizon:project:firewalls:removerouter",
kwargs={'firewall_id': firewall.id})
return base_url
def allowed(self, request, firewall):
if not api.neutron.is_extension_supported(request,
'fwaasrouterinsertion'):
return False
return bool(firewall['router_ids'])
def get_rules_name(datum):
return ', '.join([rule.name or rule.id[:13]
for rule in datum.rules])
def get_routers_name(firewall):
if firewall.routers:
return ', '.join(router.name_or_id for router in firewall.routers)
def get_policy_name(datum):
if datum.policy:
return datum.policy.name or datum.policy.id
def get_policy_link(datum):
if datum.policy:
return reverse('horizon:project:firewalls:policydetails',
kwargs={'policy_id': datum.policy.id})
class RulesTable(tables.DataTable):
ACTION_DISPLAY_CHOICES = (
("Allow", pgettext_lazy("Action Name of a Firewall Rule", u"ALLOW")),
("Deny", pgettext_lazy("Action Name of a Firewall Rule", u"DENY")),
)
name = tables.Column("name_or_id",
verbose_name=_("Name"),
link="horizon:project:firewalls:ruledetails")
description = tables.Column('description', verbose_name=_('Description'))
protocol = tables.Column("protocol",
filters=(lambda v: filters.default(v, _("ANY")),
filters.upper,),
verbose_name=_("Protocol"))
source_ip_address = tables.Column("source_ip_address",
verbose_name=_("Source IP"))
source_port = tables.Column("source_port",
verbose_name=_("Source Port"))
destination_ip_address = tables.Column("destination_ip_address",
verbose_name=_("Destination IP"))
destination_port = tables.Column("destination_port",
verbose_name=_("Destination Port"))
action = tables.Column("action",
display_choices=ACTION_DISPLAY_CHOICES,
verbose_name=_("Action"))
shared = tables.Column("shared",
verbose_name=_("Shared"),
filters=(filters.yesno, filters.capfirst))
enabled = tables.Column("enabled",
verbose_name=_("Enabled"),
filters=(filters.yesno, filters.capfirst))
firewall_policy_id = tables.Column(get_policy_name,
link=get_policy_link,
verbose_name=_("In Policy"))
class Meta(object):
name = "rulestable"
verbose_name = _("Rules")
table_actions = (AddRuleLink, DeleteRuleLink)
row_actions = (UpdateRuleLink, DeleteRuleLink)
class PoliciesTable(tables.DataTable):
name = tables.Column("name_or_id",
verbose_name=_("Name"),
link="horizon:project:firewalls:policydetails")
description = tables.Column('description', verbose_name=_('Description'))
firewall_rules = tables.Column(get_rules_name,
verbose_name=_("Rules"))
shared = tables.Column("shared",
verbose_name=_("Shared"),
filters=(filters.yesno, filters.capfirst))
audited = tables.Column("audited",
verbose_name=_("Audited"),
filters=(filters.yesno, filters.capfirst))
class Meta(object):
name = "policiestable"
verbose_name = _("Policies")
table_actions = (AddPolicyLink, DeletePolicyLink)
row_actions = (UpdatePolicyLink, InsertRuleToPolicyLink,
RemoveRuleFromPolicyLink, DeletePolicyLink)
class FirewallsTable(tables.DataTable):
STATUS_DISPLAY_CHOICES = (
("Active", pgettext_lazy("Current status of a Firewall",
u"Active")),
("Down", pgettext_lazy("Current status of a Firewall",
u"Down")),
("Error", pgettext_lazy("Current status of a Firewall",
u"Error")),
("Created", pgettext_lazy("Current status of a Firewall",
u"Created")),
("Pending_Create", pgettext_lazy("Current status of a Firewall",
u"Pending Create")),
("Pending_Update", pgettext_lazy("Current status of a Firewall",
u"Pending Update")),
("Pending_Delete", pgettext_lazy("Current status of a Firewall",
u"Pending Delete")),
("Inactive", pgettext_lazy("Current status of a Firewall",
u"Inactive")),
)
ADMIN_STATE_DISPLAY_CHOICES = (
("UP", pgettext_lazy("Admin state of a Firewall", u"UP")),
("DOWN", pgettext_lazy("Admin state of a Firewall", u"DOWN")),
)
name = tables.Column("name_or_id",
verbose_name=_("Name"),
link="horizon:project:firewalls:firewalldetails")
description = tables.Column('description', verbose_name=_('Description'))
firewall_policy_id = tables.Column(get_policy_name,
link=get_policy_link,
verbose_name=_("Policy"))
router_ids = tables.Column(get_routers_name,
verbose_name=_("Associated Routers"))
status = tables.Column("status",
verbose_name=_("Status"),
display_choices=STATUS_DISPLAY_CHOICES)
admin_state = tables.Column("admin_state",
verbose_name=_("Admin State"),
display_choices=ADMIN_STATE_DISPLAY_CHOICES)
class Meta(object):
name = "firewallstable"
verbose_name = _("Firewalls")
table_actions = (AddFirewallLink, DeleteFirewallLink)
row_actions = (UpdateFirewallLink, DeleteFirewallLink,
AddRouterToFirewallLink, RemoveRouterFromFirewallLink)
def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs):
super(FirewallsTable, self).__init__(
request, data=data,
needs_form_wrapper=needs_form_wrapper, **kwargs)
try:
if not api.neutron.is_extension_supported(request,
'fwaasrouterinsertion'):
del self.columns['router_ids']
except Exception as e:
msg = _('Failed to verify extension support %(reason)s') % {
'reason': e}
LOG.error(msg)
exceptions.handle(request, msg)
| 37.112745
| 78
| 0.58975
|
import logging
from django.core.urlresolvers import reverse
from django.template import defaultfilters as filters
from django.utils.translation import pgettext_lazy
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import ungettext_lazy
from horizon import exceptions
from horizon import tables
from openstack_dashboard import api
from openstack_dashboard import policy
LOG = logging.getLogger(__name__)
class AddRuleLink(tables.LinkAction):
name = "addrule"
verbose_name = _("Add Rule")
url = "horizon:project:firewalls:addrule"
classes = ("ajax-modal",)
icon = "plus"
policy_rules = (("network", "create_firewall_rule"),)
class AddPolicyLink(tables.LinkAction):
name = "addpolicy"
verbose_name = _("Add Policy")
url = "horizon:project:firewalls:addpolicy"
classes = ("ajax-modal", "btn-addpolicy",)
icon = "plus"
policy_rules = (("network", "create_firewall_policy"),)
class AddFirewallLink(tables.LinkAction):
name = "addfirewall"
verbose_name = _("Create Firewall")
url = "horizon:project:firewalls:addfirewall"
classes = ("ajax-modal",)
icon = "plus"
policy_rules = (("network", "create_firewall"),)
class DeleteRuleLink(policy.PolicyTargetMixin, tables.DeleteAction):
name = "deleterule"
policy_rules = (("network", "delete_firewall_rule"),)
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Rule",
u"Delete Rules",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Scheduled deletion of Rule",
u"Scheduled deletion of Rules",
count
)
def allowed(self, request, datum=None):
if datum and datum.policy:
return False
return True
def delete(self, request, obj_id):
try:
api.fwaas.rule_delete(request, obj_id)
except Exception as e:
exceptions.handle(request, _('Unable to delete rule. %s') % e)
class DeletePolicyLink(policy.PolicyTargetMixin, tables.DeleteAction):
name = "deletepolicy"
policy_rules = (("network", "delete_firewall_policy"),)
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Policy",
u"Delete Policies",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Scheduled deletion of Policy",
u"Scheduled deletion of Policies",
count
)
def delete(self, request, obj_id):
try:
api.fwaas.policy_delete(request, obj_id)
except Exception as e:
exceptions.handle(request, _('Unable to delete policy. %s') % e)
class DeleteFirewallLink(policy.PolicyTargetMixin,
tables.DeleteAction):
name = "deletefirewall"
policy_rules = (("network", "delete_firewall"),)
@staticmethod
def action_present(count):
return ungettext_lazy(
u"Delete Firewall",
u"Delete Firewalls",
count
)
@staticmethod
def action_past(count):
return ungettext_lazy(
u"Scheduled deletion of Firewall",
u"Scheduled deletion of Firewalls",
count
)
def delete(self, request, obj_id):
try:
api.fwaas.firewall_delete(request, obj_id)
except Exception as e:
exceptions.handle(request, _('Unable to delete firewall. %s') % e)
class UpdateRuleLink(policy.PolicyTargetMixin, tables.LinkAction):
name = "updaterule"
verbose_name = _("Edit Rule")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "update_firewall_rule"),)
def get_link_url(self, rule):
base_url = reverse("horizon:project:firewalls:updaterule",
kwargs={'rule_id': rule.id})
return base_url
class UpdatePolicyLink(policy.PolicyTargetMixin, tables.LinkAction):
name = "updatepolicy"
verbose_name = _("Edit Policy")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "update_firewall_policy"),)
def get_link_url(self, policy):
base_url = reverse("horizon:project:firewalls:updatepolicy",
kwargs={'policy_id': policy.id})
return base_url
class UpdateFirewallLink(policy.PolicyTargetMixin, tables.LinkAction):
name = "updatefirewall"
verbose_name = _("Edit Firewall")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "update_firewall"),)
def get_link_url(self, firewall):
base_url = reverse("horizon:project:firewalls:updatefirewall",
kwargs={'firewall_id': firewall.id})
return base_url
def allowed(self, request, firewall):
if firewall.status in ("PENDING_CREATE",
"PENDING_UPDATE",
"PENDING_DELETE"):
return False
return True
class InsertRuleToPolicyLink(policy.PolicyTargetMixin,
tables.LinkAction):
name = "insertrule"
verbose_name = _("Insert Rule")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "get_firewall_policy"),
("network", "insert_rule"),)
def get_link_url(self, policy):
base_url = reverse("horizon:project:firewalls:insertrule",
kwargs={'policy_id': policy.id})
return base_url
class RemoveRuleFromPolicyLink(policy.PolicyTargetMixin,
tables.LinkAction):
name = "removerule"
verbose_name = _("Remove Rule")
classes = ("ajax-modal", "btn-danger",)
policy_rules = (("network", "get_firewall_policy"),
("network", "remove_rule"),)
def get_link_url(self, policy):
base_url = reverse("horizon:project:firewalls:removerule",
kwargs={'policy_id': policy.id})
return base_url
def allowed(self, request, policy):
if len(policy.rules) > 0:
return True
return False
class AddRouterToFirewallLink(policy.PolicyTargetMixin,
tables.LinkAction):
name = "addrouter"
verbose_name = _("Add Router")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "get_firewall"),
("network", "add_router"),)
def get_link_url(self, firewall):
base_url = reverse("horizon:project:firewalls:addrouter",
kwargs={'firewall_id': firewall.id})
return base_url
def allowed(self, request, firewall):
if not api.neutron.is_extension_supported(request,
'fwaasrouterinsertion'):
return False
tenant_id = firewall['tenant_id']
available_routers = api.fwaas.firewall_unassociated_routers_list(
request, tenant_id)
return bool(available_routers)
class RemoveRouterFromFirewallLink(policy.PolicyTargetMixin,
tables.LinkAction):
name = "removerouter"
verbose_name = _("Remove Router")
classes = ("ajax-modal", "btn-update",)
policy_rules = (("network", "get_firewall"),
("network", "remove_router"),)
def get_link_url(self, firewall):
base_url = reverse("horizon:project:firewalls:removerouter",
kwargs={'firewall_id': firewall.id})
return base_url
def allowed(self, request, firewall):
if not api.neutron.is_extension_supported(request,
'fwaasrouterinsertion'):
return False
return bool(firewall['router_ids'])
def get_rules_name(datum):
return ', '.join([rule.name or rule.id[:13]
for rule in datum.rules])
def get_routers_name(firewall):
if firewall.routers:
return ', '.join(router.name_or_id for router in firewall.routers)
def get_policy_name(datum):
if datum.policy:
return datum.policy.name or datum.policy.id
def get_policy_link(datum):
if datum.policy:
return reverse('horizon:project:firewalls:policydetails',
kwargs={'policy_id': datum.policy.id})
class RulesTable(tables.DataTable):
ACTION_DISPLAY_CHOICES = (
("Allow", pgettext_lazy("Action Name of a Firewall Rule", u"ALLOW")),
("Deny", pgettext_lazy("Action Name of a Firewall Rule", u"DENY")),
)
name = tables.Column("name_or_id",
verbose_name=_("Name"),
link="horizon:project:firewalls:ruledetails")
description = tables.Column('description', verbose_name=_('Description'))
protocol = tables.Column("protocol",
filters=(lambda v: filters.default(v, _("ANY")),
filters.upper,),
verbose_name=_("Protocol"))
source_ip_address = tables.Column("source_ip_address",
verbose_name=_("Source IP"))
source_port = tables.Column("source_port",
verbose_name=_("Source Port"))
destination_ip_address = tables.Column("destination_ip_address",
verbose_name=_("Destination IP"))
destination_port = tables.Column("destination_port",
verbose_name=_("Destination Port"))
action = tables.Column("action",
display_choices=ACTION_DISPLAY_CHOICES,
verbose_name=_("Action"))
shared = tables.Column("shared",
verbose_name=_("Shared"),
filters=(filters.yesno, filters.capfirst))
enabled = tables.Column("enabled",
verbose_name=_("Enabled"),
filters=(filters.yesno, filters.capfirst))
firewall_policy_id = tables.Column(get_policy_name,
link=get_policy_link,
verbose_name=_("In Policy"))
class Meta(object):
name = "rulestable"
verbose_name = _("Rules")
table_actions = (AddRuleLink, DeleteRuleLink)
row_actions = (UpdateRuleLink, DeleteRuleLink)
class PoliciesTable(tables.DataTable):
name = tables.Column("name_or_id",
verbose_name=_("Name"),
link="horizon:project:firewalls:policydetails")
description = tables.Column('description', verbose_name=_('Description'))
firewall_rules = tables.Column(get_rules_name,
verbose_name=_("Rules"))
shared = tables.Column("shared",
verbose_name=_("Shared"),
filters=(filters.yesno, filters.capfirst))
audited = tables.Column("audited",
verbose_name=_("Audited"),
filters=(filters.yesno, filters.capfirst))
class Meta(object):
name = "policiestable"
verbose_name = _("Policies")
table_actions = (AddPolicyLink, DeletePolicyLink)
row_actions = (UpdatePolicyLink, InsertRuleToPolicyLink,
RemoveRuleFromPolicyLink, DeletePolicyLink)
class FirewallsTable(tables.DataTable):
STATUS_DISPLAY_CHOICES = (
("Active", pgettext_lazy("Current status of a Firewall",
u"Active")),
("Down", pgettext_lazy("Current status of a Firewall",
u"Down")),
("Error", pgettext_lazy("Current status of a Firewall",
u"Error")),
("Created", pgettext_lazy("Current status of a Firewall",
u"Created")),
("Pending_Create", pgettext_lazy("Current status of a Firewall",
u"Pending Create")),
("Pending_Update", pgettext_lazy("Current status of a Firewall",
u"Pending Update")),
("Pending_Delete", pgettext_lazy("Current status of a Firewall",
u"Pending Delete")),
("Inactive", pgettext_lazy("Current status of a Firewall",
u"Inactive")),
)
ADMIN_STATE_DISPLAY_CHOICES = (
("UP", pgettext_lazy("Admin state of a Firewall", u"UP")),
("DOWN", pgettext_lazy("Admin state of a Firewall", u"DOWN")),
)
name = tables.Column("name_or_id",
verbose_name=_("Name"),
link="horizon:project:firewalls:firewalldetails")
description = tables.Column('description', verbose_name=_('Description'))
firewall_policy_id = tables.Column(get_policy_name,
link=get_policy_link,
verbose_name=_("Policy"))
router_ids = tables.Column(get_routers_name,
verbose_name=_("Associated Routers"))
status = tables.Column("status",
verbose_name=_("Status"),
display_choices=STATUS_DISPLAY_CHOICES)
admin_state = tables.Column("admin_state",
verbose_name=_("Admin State"),
display_choices=ADMIN_STATE_DISPLAY_CHOICES)
class Meta(object):
name = "firewallstable"
verbose_name = _("Firewalls")
table_actions = (AddFirewallLink, DeleteFirewallLink)
row_actions = (UpdateFirewallLink, DeleteFirewallLink,
AddRouterToFirewallLink, RemoveRouterFromFirewallLink)
def __init__(self, request, data=None, needs_form_wrapper=None, **kwargs):
super(FirewallsTable, self).__init__(
request, data=data,
needs_form_wrapper=needs_form_wrapper, **kwargs)
try:
if not api.neutron.is_extension_supported(request,
'fwaasrouterinsertion'):
del self.columns['router_ids']
except Exception as e:
msg = _('Failed to verify extension support %(reason)s') % {
'reason': e}
LOG.error(msg)
exceptions.handle(request, msg)
| true
| true
|
f70a2ff0fe97cee77266ee49f1205c3ffb0ee1ba
| 11,290
|
py
|
Python
|
strategies/hitoshi.py
|
Jbuxofplenty/quant
|
2ef24012963e9ead6193e0f421c63fb009c78f80
|
[
"MIT"
] | null | null | null |
strategies/hitoshi.py
|
Jbuxofplenty/quant
|
2ef24012963e9ead6193e0f421c63fb009c78f80
|
[
"MIT"
] | null | null | null |
strategies/hitoshi.py
|
Jbuxofplenty/quant
|
2ef24012963e9ead6193e0f421c63fb009c78f80
|
[
"MIT"
] | null | null | null |
from zipline.pipeline import Pipeline
from zipline.api import attach_pipeline, pipeline_output
from zipline.pipeline.data.equity_pricing import USEquityPricing
from zipline.pipeline.data import morningstar
from zipline.pipeline.factors import SimpleMovingAverage, AverageDollarVolume
from zipline.pipeline.filters.morningstar import IsPrimaryShare
import numpy as np # needed for NaN handling
import math # ceil and floor are useful for rounding
from itertools import cycle
def initialize(context):
# set_commission(commission.PerShare(cost=0.01, min_trade_cost=1.50))
set_slippage(
slippage.VolumeShareSlippage(
volume_limit=.20,
price_impact=0.0))
# set_slippage(slippage.FixedSlippage(spread=0.00))
set_commission(commission.PerTrade(cost=0.00))
# set_slippage(slippage.FixedSlippage(spread=0.00))
set_long_only()
context.MaxCandidates = 100
context.MaxBuyOrdersAtOnce = 30
context.MyLeastPrice = 3.00
context.MyMostPrice = 25.00
context.MyFireSalePrice = context.MyLeastPrice
context.MyFireSaleAge = 6
# over simplistic tracking of position age
context.age = {}
print(len(context.portfolio.positions))
# Rebalance
EveryThisManyMinutes = 10
TradingDayHours = 6.5
TradingDayMinutes = int(TradingDayHours * 60)
for minutez in xrange(
1,
TradingDayMinutes,
EveryThisManyMinutes
):
schedule_function(
my_rebalance,
date_rules.every_day(),
time_rules.market_open(
minutes=minutez))
# Prevent excessive logging of canceled orders at market close.
schedule_function(
cancel_open_orders,
date_rules.every_day(),
time_rules.market_close(
hours=0,
minutes=1))
# Record variables at the end of each day.
schedule_function(
my_record_vars,
date_rules.every_day(),
time_rules.market_close())
# Create our pipeline and attach it to our algorithm.
my_pipe = make_pipeline(context)
attach_pipeline(my_pipe, 'my_pipeline')
def make_pipeline(context):
"""
Create our pipeline.
"""
# Filter for primary share equities. IsPrimaryShare is a built-in filter.
primary_share = IsPrimaryShare()
# Equities listed as common stock (as opposed to, say, preferred stock).
# 'ST00000001' indicates common stock.
common_stock = morningstar.share_class_reference.security_type.latest.eq(
'ST00000001')
# Non-depositary receipts. Recall that the ~ operator inverts filters,
# turning Trues into Falses and vice versa
not_depositary = ~morningstar.share_class_reference.is_depositary_receipt.latest
# Equities not trading over-the-counter.
not_otc = ~morningstar.share_class_reference.exchange_id.latest.startswith(
'OTC')
# Not when-issued equities.
not_wi = ~morningstar.share_class_reference.symbol.latest.endswith('.WI')
# Equities without LP in their name, .matches does a match using a regular
# expression
not_lp_name = ~morningstar.company_reference.standard_name.latest.matches(
'.* L[. ]?P.?$')
# Equities with a null value in the limited_partnership Morningstar
# fundamental field.
not_lp_balance_sheet = morningstar.balance_sheet.limited_partnership.latest.isnull()
# Equities whose most recent Morningstar market cap is not null have
# fundamental data and therefore are not ETFs.
have_market_cap = morningstar.valuation.market_cap.latest.notnull()
# At least a certain price
price = USEquityPricing.close.latest
AtLeastPrice = (price >= context.MyLeastPrice)
AtMostPrice = (price <= context.MyMostPrice)
# Filter for stocks that pass all of our previous filters.
tradeable_stocks = (
primary_share
& common_stock
& not_depositary
& not_otc
& not_wi
& not_lp_name
& not_lp_balance_sheet
& have_market_cap
& AtLeastPrice
& AtMostPrice
)
LowVar = 6
HighVar = 40
log.info(
'''
Algorithm initialized variables:
context.MaxCandidates %s
LowVar %s
HighVar %s''' %
(context.MaxCandidates, LowVar, HighVar))
# High dollar volume filter.
base_universe = AverageDollarVolume(
window_length=20,
mask=tradeable_stocks
).percentile_between(LowVar, HighVar)
# Short close price average.
ShortAvg = SimpleMovingAverage(
inputs=[USEquityPricing.close],
window_length=3,
mask=base_universe
)
# Long close price average.
LongAvg = SimpleMovingAverage(
inputs=[USEquityPricing.close],
window_length=45,
mask=base_universe
)
percent_difference = (ShortAvg - LongAvg) / LongAvg
# Filter to select securities to long.
stocks_worst = percent_difference.bottom(context.MaxCandidates)
securities_to_trade = (stocks_worst)
return Pipeline(
columns={
'stocks_worst': stocks_worst
},
screen=(securities_to_trade),
)
def my_compute_weights(context):
"""
Compute ordering weights.
"""
# Compute even target weights for our long positions and short positions.
stocks_worst_weight = 1.00 / len(context.stocks_worst)
return stocks_worst_weight
def before_trading_start(context, data):
# Gets our pipeline output every day.
context.output = pipeline_output('my_pipeline')
context.stocks_worst = context.output[
context.output['stocks_worst']].index.tolist()
context.stocks_worst_weight = my_compute_weights(context)
context.MyCandidate = cycle(context.stocks_worst)
context.LowestPrice = context.MyLeastPrice # reset beginning of day
print(len(context.portfolio.positions))
for stock in context.portfolio.positions:
CurrPrice = float(data.current([stock], 'price'))
if CurrPrice < context.LowestPrice:
context.LowestPrice = CurrPrice
if stock in context.age:
context.age[stock] += 1
else:
context.age[stock] = 1
for stock in context.age:
if stock not in context.portfolio.positions:
context.age[stock] = 0
message = 'stock.symbol: {symbol} : age: {age}'
log.info(message.format(symbol=stock.symbol, age=context.age[stock]))
pass
def my_rebalance(context, data):
BuyFactor = .99
SellFactor = 1.01
cash = context.portfolio.cash
cancel_open_buy_orders(context, data)
# Order sell at profit target in hope that somebody actually buys it
for stock in context.portfolio.positions:
if not get_open_orders(stock):
StockShares = context.portfolio.positions[stock].amount
CurrPrice = float(data.current([stock], 'price'))
CostBasis = float(context.portfolio.positions[stock].cost_basis)
SellPrice = float(
make_div_by_05(
CostBasis *
SellFactor,
buy=False))
if np.isnan(SellPrice):
pass # probably best to wait until nan goes away
elif (stock in context.age and context.age[stock] == 1):
pass
elif (
stock in context.age
and context.MyFireSaleAge <= context.age[stock]
and (
context.MyFireSalePrice > CurrPrice
or CostBasis > CurrPrice
)
):
if (stock in context.age and context.age[stock] < 2):
pass
elif stock not in context.age:
context.age[stock] = 1
else:
SellPrice = float(
make_div_by_05(.95 * CurrPrice, buy=False))
order(stock, -StockShares,
style=LimitOrder(SellPrice)
)
else:
if (stock in context.age and context.age[stock] < 2):
pass
elif stock not in context.age:
context.age[stock] = 1
else:
order(stock, -StockShares,
style=LimitOrder(SellPrice)
)
WeightThisBuyOrder = float(1.00 / context.MaxBuyOrdersAtOnce)
for ThisBuyOrder in range(context.MaxBuyOrdersAtOnce):
stock = context.MyCandidate.next()
PH = data.history([stock], 'price', 20, '1d')
PH_Avg = float(PH.mean())
CurrPrice = float(data.current([stock], 'price'))
if np.isnan(CurrPrice):
pass # probably best to wait until nan goes away
else:
if CurrPrice > float(1.25 * PH_Avg):
BuyPrice = float(CurrPrice)
else:
BuyPrice = float(CurrPrice * BuyFactor)
BuyPrice = float(make_div_by_05(BuyPrice, buy=True))
StockShares = int(WeightThisBuyOrder * cash / BuyPrice)
order(stock, StockShares,
style=LimitOrder(BuyPrice)
)
# if cents not divisible by .05, round down if buy, round up if sell
def make_div_by_05(s, buy=False):
s *= 20.00
s = math.floor(s) if buy else math.ceil(s)
s /= 20.00
return s
def my_record_vars(context, data):
"""
Record variables at the end of each day.
"""
# Record our variables.
record(leverage=context.account.leverage)
record(positions=len(context.portfolio.positions))
if 0 < len(context.age):
MaxAge = context.age[max(
context.age.keys(), key=(lambda k: context.age[k]))]
print(MaxAge)
record(MaxAge=MaxAge)
record(LowestPrice=context.LowestPrice)
def log_open_order(StockToLog):
oo = get_open_orders()
if len(oo) == 0:
return
for stock, orders in oo.iteritems():
if stock == StockToLog:
for o in orders:
message = 'Found open order for {amount} shares in {stock}'
log.info(message.format(amount=o.amount, stock=stock))
def log_open_orders():
oo = get_open_orders()
if len(oo) == 0:
return
for stock, orders in oo.iteritems():
for o in orders:
message = 'Found open order for {amount} shares in {stock}'
log.info(message.format(amount=o.amount, stock=stock))
def cancel_open_buy_orders(context, data):
oo = get_open_orders()
if len(oo) == 0:
return
for stock, orders in oo.iteritems():
for o in orders:
# message = 'Canceling order of {amount} shares in {stock}'
# log.info(message.format(amount=o.amount, stock=stock))
if 0 < o.amount: # it is a buy order
cancel_order(o)
def cancel_open_orders(context, data):
oo = get_open_orders()
if len(oo) == 0:
return
for stock, orders in oo.iteritems():
for o in orders:
# message = 'Canceling order of {amount} shares in {stock}'
# log.info(message.format(amount=o.amount, stock=stock))
cancel_order(o)
# This is the every minute stuff
def handle_data(context, data):
pass
| 31.713483
| 88
| 0.628787
|
from zipline.pipeline import Pipeline
from zipline.api import attach_pipeline, pipeline_output
from zipline.pipeline.data.equity_pricing import USEquityPricing
from zipline.pipeline.data import morningstar
from zipline.pipeline.factors import SimpleMovingAverage, AverageDollarVolume
from zipline.pipeline.filters.morningstar import IsPrimaryShare
import numpy as np
import math
from itertools import cycle
def initialize(context):
set_slippage(
slippage.VolumeShareSlippage(
volume_limit=.20,
price_impact=0.0))
set_commission(commission.PerTrade(cost=0.00))
set_long_only()
context.MaxCandidates = 100
context.MaxBuyOrdersAtOnce = 30
context.MyLeastPrice = 3.00
context.MyMostPrice = 25.00
context.MyFireSalePrice = context.MyLeastPrice
context.MyFireSaleAge = 6
context.age = {}
print(len(context.portfolio.positions))
EveryThisManyMinutes = 10
TradingDayHours = 6.5
TradingDayMinutes = int(TradingDayHours * 60)
for minutez in xrange(
1,
TradingDayMinutes,
EveryThisManyMinutes
):
schedule_function(
my_rebalance,
date_rules.every_day(),
time_rules.market_open(
minutes=minutez))
schedule_function(
cancel_open_orders,
date_rules.every_day(),
time_rules.market_close(
hours=0,
minutes=1))
schedule_function(
my_record_vars,
date_rules.every_day(),
time_rules.market_close())
my_pipe = make_pipeline(context)
attach_pipeline(my_pipe, 'my_pipeline')
def make_pipeline(context):
primary_share = IsPrimaryShare()
common_stock = morningstar.share_class_reference.security_type.latest.eq(
'ST00000001')
not_depositary = ~morningstar.share_class_reference.is_depositary_receipt.latest
not_otc = ~morningstar.share_class_reference.exchange_id.latest.startswith(
'OTC')
not_wi = ~morningstar.share_class_reference.symbol.latest.endswith('.WI')
not_lp_name = ~morningstar.company_reference.standard_name.latest.matches(
'.* L[. ]?P.?$')
not_lp_balance_sheet = morningstar.balance_sheet.limited_partnership.latest.isnull()
have_market_cap = morningstar.valuation.market_cap.latest.notnull()
price = USEquityPricing.close.latest
AtLeastPrice = (price >= context.MyLeastPrice)
AtMostPrice = (price <= context.MyMostPrice)
tradeable_stocks = (
primary_share
& common_stock
& not_depositary
& not_otc
& not_wi
& not_lp_name
& not_lp_balance_sheet
& have_market_cap
& AtLeastPrice
& AtMostPrice
)
LowVar = 6
HighVar = 40
log.info(
'''
Algorithm initialized variables:
context.MaxCandidates %s
LowVar %s
HighVar %s''' %
(context.MaxCandidates, LowVar, HighVar))
base_universe = AverageDollarVolume(
window_length=20,
mask=tradeable_stocks
).percentile_between(LowVar, HighVar)
ShortAvg = SimpleMovingAverage(
inputs=[USEquityPricing.close],
window_length=3,
mask=base_universe
)
LongAvg = SimpleMovingAverage(
inputs=[USEquityPricing.close],
window_length=45,
mask=base_universe
)
percent_difference = (ShortAvg - LongAvg) / LongAvg
stocks_worst = percent_difference.bottom(context.MaxCandidates)
securities_to_trade = (stocks_worst)
return Pipeline(
columns={
'stocks_worst': stocks_worst
},
screen=(securities_to_trade),
)
def my_compute_weights(context):
stocks_worst_weight = 1.00 / len(context.stocks_worst)
return stocks_worst_weight
def before_trading_start(context, data):
context.output = pipeline_output('my_pipeline')
context.stocks_worst = context.output[
context.output['stocks_worst']].index.tolist()
context.stocks_worst_weight = my_compute_weights(context)
context.MyCandidate = cycle(context.stocks_worst)
context.LowestPrice = context.MyLeastPrice
print(len(context.portfolio.positions))
for stock in context.portfolio.positions:
CurrPrice = float(data.current([stock], 'price'))
if CurrPrice < context.LowestPrice:
context.LowestPrice = CurrPrice
if stock in context.age:
context.age[stock] += 1
else:
context.age[stock] = 1
for stock in context.age:
if stock not in context.portfolio.positions:
context.age[stock] = 0
message = 'stock.symbol: {symbol} : age: {age}'
log.info(message.format(symbol=stock.symbol, age=context.age[stock]))
pass
def my_rebalance(context, data):
BuyFactor = .99
SellFactor = 1.01
cash = context.portfolio.cash
cancel_open_buy_orders(context, data)
for stock in context.portfolio.positions:
if not get_open_orders(stock):
StockShares = context.portfolio.positions[stock].amount
CurrPrice = float(data.current([stock], 'price'))
CostBasis = float(context.portfolio.positions[stock].cost_basis)
SellPrice = float(
make_div_by_05(
CostBasis *
SellFactor,
buy=False))
if np.isnan(SellPrice):
pass
elif (stock in context.age and context.age[stock] == 1):
pass
elif (
stock in context.age
and context.MyFireSaleAge <= context.age[stock]
and (
context.MyFireSalePrice > CurrPrice
or CostBasis > CurrPrice
)
):
if (stock in context.age and context.age[stock] < 2):
pass
elif stock not in context.age:
context.age[stock] = 1
else:
SellPrice = float(
make_div_by_05(.95 * CurrPrice, buy=False))
order(stock, -StockShares,
style=LimitOrder(SellPrice)
)
else:
if (stock in context.age and context.age[stock] < 2):
pass
elif stock not in context.age:
context.age[stock] = 1
else:
order(stock, -StockShares,
style=LimitOrder(SellPrice)
)
WeightThisBuyOrder = float(1.00 / context.MaxBuyOrdersAtOnce)
for ThisBuyOrder in range(context.MaxBuyOrdersAtOnce):
stock = context.MyCandidate.next()
PH = data.history([stock], 'price', 20, '1d')
PH_Avg = float(PH.mean())
CurrPrice = float(data.current([stock], 'price'))
if np.isnan(CurrPrice):
pass
else:
if CurrPrice > float(1.25 * PH_Avg):
BuyPrice = float(CurrPrice)
else:
BuyPrice = float(CurrPrice * BuyFactor)
BuyPrice = float(make_div_by_05(BuyPrice, buy=True))
StockShares = int(WeightThisBuyOrder * cash / BuyPrice)
order(stock, StockShares,
style=LimitOrder(BuyPrice)
)
def make_div_by_05(s, buy=False):
s *= 20.00
s = math.floor(s) if buy else math.ceil(s)
s /= 20.00
return s
def my_record_vars(context, data):
record(leverage=context.account.leverage)
record(positions=len(context.portfolio.positions))
if 0 < len(context.age):
MaxAge = context.age[max(
context.age.keys(), key=(lambda k: context.age[k]))]
print(MaxAge)
record(MaxAge=MaxAge)
record(LowestPrice=context.LowestPrice)
def log_open_order(StockToLog):
oo = get_open_orders()
if len(oo) == 0:
return
for stock, orders in oo.iteritems():
if stock == StockToLog:
for o in orders:
message = 'Found open order for {amount} shares in {stock}'
log.info(message.format(amount=o.amount, stock=stock))
def log_open_orders():
oo = get_open_orders()
if len(oo) == 0:
return
for stock, orders in oo.iteritems():
for o in orders:
message = 'Found open order for {amount} shares in {stock}'
log.info(message.format(amount=o.amount, stock=stock))
def cancel_open_buy_orders(context, data):
oo = get_open_orders()
if len(oo) == 0:
return
for stock, orders in oo.iteritems():
for o in orders:
if 0 < o.amount:
cancel_order(o)
def cancel_open_orders(context, data):
oo = get_open_orders()
if len(oo) == 0:
return
for stock, orders in oo.iteritems():
for o in orders:
cancel_order(o)
def handle_data(context, data):
pass
| true
| true
|
f70a302ee61e2a2b81f906bd03d8d41979bc5a07
| 476
|
py
|
Python
|
client/graphics_settings.py
|
V1ad0S/splendor-game
|
2ea0af6b76decc30573f3f90953b28e6eafd1a00
|
[
"BSD-2-Clause"
] | null | null | null |
client/graphics_settings.py
|
V1ad0S/splendor-game
|
2ea0af6b76decc30573f3f90953b28e6eafd1a00
|
[
"BSD-2-Clause"
] | null | null | null |
client/graphics_settings.py
|
V1ad0S/splendor-game
|
2ea0af6b76decc30573f3f90953b28e6eafd1a00
|
[
"BSD-2-Clause"
] | null | null | null |
FPS = 10
SCREEN_SIZE = (1200, 800)
CARDFIELD_COORDS = [(230, 120), (700, 520)]
BANK_COORDS = [(970, 160), (70, 350)]
BACKGROUND = (140, 122, 230)
WHITE = (255, 255, 255)
GREY = (128, 128, 128)
GREEN = (0, 128, 0)
YELLOW = (180, 180, 0)
BLACK = (0, 0, 0)
COLORS = {
"1": [(53, 59, 72), (47, 54, 64),],
"2": [(245, 246, 250), (220, 221, 225)],
"3": [(232, 65, 24), (194, 54, 22)],
"4": [(76, 209, 55), (68, 189, 50)],
"5": [(72, 126, 176), (64, 115, 158)]
}
| 26.444444
| 44
| 0.493697
|
FPS = 10
SCREEN_SIZE = (1200, 800)
CARDFIELD_COORDS = [(230, 120), (700, 520)]
BANK_COORDS = [(970, 160), (70, 350)]
BACKGROUND = (140, 122, 230)
WHITE = (255, 255, 255)
GREY = (128, 128, 128)
GREEN = (0, 128, 0)
YELLOW = (180, 180, 0)
BLACK = (0, 0, 0)
COLORS = {
"1": [(53, 59, 72), (47, 54, 64),],
"2": [(245, 246, 250), (220, 221, 225)],
"3": [(232, 65, 24), (194, 54, 22)],
"4": [(76, 209, 55), (68, 189, 50)],
"5": [(72, 126, 176), (64, 115, 158)]
}
| true
| true
|
f70a3034af8425987ad286b9f46e1099208fe785
| 7,746
|
py
|
Python
|
tests/libs/io_peripherals/test_spi.py
|
izm51/obniz-python-sdk
|
40a738b5fe2c0a415cdc09f46d28c143982bfb07
|
[
"MIT"
] | 11
|
2019-03-22T12:02:11.000Z
|
2021-01-21T04:57:18.000Z
|
tests/libs/io_peripherals/test_spi.py
|
izm51/obniz-python-sdk
|
40a738b5fe2c0a415cdc09f46d28c143982bfb07
|
[
"MIT"
] | 5
|
2019-03-02T08:28:25.000Z
|
2021-02-02T22:06:37.000Z
|
tests/libs/io_peripherals/test_spi.py
|
izm51/obniz-python-sdk
|
40a738b5fe2c0a415cdc09f46d28c143982bfb07
|
[
"MIT"
] | 3
|
2019-07-20T06:55:09.000Z
|
2019-12-04T05:05:00.000Z
|
from time import sleep
import pytest
from ...utils import assert_finished, assert_send, receive_json
class TestPeripheralSPI:
def test_start(self, obniz):
obniz.spi0.start(
{"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master", "mosi": 1}
)
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io1": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io1": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz,
[
{
"spi0": {
"clk": 0,
"clock": 1000000,
"miso": 2,
"mode": "master",
"mosi": 1,
}
}
],
)
assert_finished(obniz)
def test_start_with_gnd(self, obniz):
obniz.spi0.start(
{
"clk": 0,
"frequency": 1000000,
"miso": 2,
"mode": "master",
"mosi": 1,
"gnd": 7,
}
)
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io1": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io1": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(obniz, [{"io7": False}])
# assert_send(obniz, [
# {
# display: {
# pin_assign: {
# '7': {
# module_name: 'spi0',
# pin_name: 'gnd',
# },
# },
# },
# },
# ])
assert_send(
obniz,
[
{
"spi0": {
"clk": 0,
"clock": 1000000,
"miso": 2,
"mode": "master",
"mosi": 1,
}
}
],
)
assert_finished(obniz)
def test_write(self, obniz):
obniz.spi0.start({"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master"})
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz, [{"spi0": {"clk": 0, "clock": 1000000, "miso": 2, "mode": "master"}}]
)
def callback(value):
assert value == [0x61, 0xF2]
assert_finished(obniz)
obniz.spi0.write_wait([0x12, 0x98])
assert_send(obniz, [{"spi0": {"data": [0x12, 0x98], "read": True}}])
sleep(0.01)
receive_json(obniz, [{"spi0": {"data": [0x61, 0xF2]}}])
def test_write_over_32_to_lt_1_0_3(self, obniz):
firmver_ver = obniz.firmware_ver
obniz.firmware_ver = "1.0.2"
obniz.spi0.start({"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master"})
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz, [{"spi0": {"clk": 0, "clock": 1000000, "miso": 2, "mode": "master"}}]
)
data = []
for i in range(0, 33):
data.append(i)
def callback(value):
pass
with pytest.raises(
Exception,
match="with your obniz 1.0.2. spi max length=32byte but yours 33. "
+ "Please update obniz firmware",
):
obniz.spi0.write_wait(data)
assert_finished(obniz)
obniz.firmware_ver = firmver_ver
def test_write_over_32_to_gte_1_0_3(self, obniz):
firmver_ver = obniz.firmware_ver
obniz.firmware_ver = "1.0.3"
obniz.spi0.start({"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master"})
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz, [{"spi0": {"clk": 0, "clock": 1000000, "miso": 2, "mode": "master"}}]
)
data = []
for i in range(0, 33):
data.append(i)
def callback(value):
assert value == data
assert_finished(obniz)
obniz.spi0.write_wait(data)
assert_send(obniz, [{"spi0": {"data": data, "read": True}}])
sleep(0.01)
receive_json(obniz, [{"spi0": {"data": data}}])
obniz.firmware_ver = firmver_ver
# it.skip('SPI send 2byte and receive 3byte', function() {
# obniz.spi0.start({
# "clk": 0,
# "frequency": 1000000,
# "miso": 2,
# "mode": 'master',
# "mosi": 1,
# })
# assert_send(obniz, [{ "io0": { "output_type": 'push-pull5v' } }])
# assert_send(obniz, [{ "io1": { "output_type": 'push-pull5v' } }])
# assert_send(obniz, [{ "io2": { "output_type": 'push-pull5v' } }])
# assert_send(obniz, [{ "io0": { "pull_type": 'float' } }])
# assert_send(obniz, [{ "io1": { "pull_type": 'float' } }])
# assert_send(obniz, [{ "io2": { "pull_type": 'float' } }])
# assert_send(obniz, [
# { "spi0": { "clk": 0, "clock": 1000000, "miso": 2, "mode": 'master', "mosi": 1 } },
# ])
# r = obniz.spi0.write_wait([0x12, 0x98]).then(
# function(value) {
# expect(value).to.be.deep.equal([0x61, 0xf2])
# assert_finished(obniz)
# }.bind(self)
# )
# assert_send(obniz, [{ "spi0": { "data": [0x12, 0x98], "read": True } }])
# setTimeout(
# function() {
# receive_json(obniz, [
# { "spi0": { "data": [0x61, 0xf2, 0x34] } },
# ])
# }.bind(self),
# 10
# )
# return r
# })
def test_end(self, obniz):
obniz.spi0.start(
{"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master", "mosi": 1}
)
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io1": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io1": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz,
[
{
"spi0": {
"clk": 0,
"clock": 1000000,
"miso": 2,
"mode": "master",
"mosi": 1,
}
}
],
)
assert_finished(obniz)
obniz.spi0.end()
assert_send(obniz, [{"spi0": None}])
assert_finished(obniz)
| 34.274336
| 95
| 0.449781
|
from time import sleep
import pytest
from ...utils import assert_finished, assert_send, receive_json
class TestPeripheralSPI:
def test_start(self, obniz):
obniz.spi0.start(
{"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master", "mosi": 1}
)
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io1": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io1": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz,
[
{
"spi0": {
"clk": 0,
"clock": 1000000,
"miso": 2,
"mode": "master",
"mosi": 1,
}
}
],
)
assert_finished(obniz)
def test_start_with_gnd(self, obniz):
obniz.spi0.start(
{
"clk": 0,
"frequency": 1000000,
"miso": 2,
"mode": "master",
"mosi": 1,
"gnd": 7,
}
)
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io1": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io1": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(obniz, [{"io7": False}])
assert_send(
obniz,
[
{
"spi0": {
"clk": 0,
"clock": 1000000,
"miso": 2,
"mode": "master",
"mosi": 1,
}
}
],
)
assert_finished(obniz)
def test_write(self, obniz):
obniz.spi0.start({"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master"})
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz, [{"spi0": {"clk": 0, "clock": 1000000, "miso": 2, "mode": "master"}}]
)
def callback(value):
assert value == [0x61, 0xF2]
assert_finished(obniz)
obniz.spi0.write_wait([0x12, 0x98])
assert_send(obniz, [{"spi0": {"data": [0x12, 0x98], "read": True}}])
sleep(0.01)
receive_json(obniz, [{"spi0": {"data": [0x61, 0xF2]}}])
def test_write_over_32_to_lt_1_0_3(self, obniz):
firmver_ver = obniz.firmware_ver
obniz.firmware_ver = "1.0.2"
obniz.spi0.start({"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master"})
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz, [{"spi0": {"clk": 0, "clock": 1000000, "miso": 2, "mode": "master"}}]
)
data = []
for i in range(0, 33):
data.append(i)
def callback(value):
pass
with pytest.raises(
Exception,
match="with your obniz 1.0.2. spi max length=32byte but yours 33. "
+ "Please update obniz firmware",
):
obniz.spi0.write_wait(data)
assert_finished(obniz)
obniz.firmware_ver = firmver_ver
def test_write_over_32_to_gte_1_0_3(self, obniz):
firmver_ver = obniz.firmware_ver
obniz.firmware_ver = "1.0.3"
obniz.spi0.start({"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master"})
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz, [{"spi0": {"clk": 0, "clock": 1000000, "miso": 2, "mode": "master"}}]
)
data = []
for i in range(0, 33):
data.append(i)
def callback(value):
assert value == data
assert_finished(obniz)
obniz.spi0.write_wait(data)
assert_send(obniz, [{"spi0": {"data": data, "read": True}}])
sleep(0.01)
receive_json(obniz, [{"spi0": {"data": data}}])
obniz.firmware_ver = firmver_ver
def test_end(self, obniz):
obniz.spi0.start(
{"clk": 0, "frequency": 1000000, "miso": 2, "mode": "master", "mosi": 1}
)
assert_send(obniz, [{"io0": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io1": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io2": {"output_type": "push-pull5v"}}])
assert_send(obniz, [{"io0": {"pull_type": "float"}}])
assert_send(obniz, [{"io1": {"pull_type": "float"}}])
assert_send(obniz, [{"io2": {"pull_type": "float"}}])
assert_send(
obniz,
[
{
"spi0": {
"clk": 0,
"clock": 1000000,
"miso": 2,
"mode": "master",
"mosi": 1,
}
}
],
)
assert_finished(obniz)
obniz.spi0.end()
assert_send(obniz, [{"spi0": None}])
assert_finished(obniz)
| true
| true
|
f70a32b071692b6617364de30b9da8d0250e8356
| 10,584
|
py
|
Python
|
data/src/transform.py
|
cytopia/metrics-server-prom
|
3777ba9357bf14538f7608d4a2b877b7d50960a0
|
[
"MIT"
] | 25
|
2018-08-20T03:29:45.000Z
|
2021-05-23T15:52:38.000Z
|
data/src/transform.py
|
LINK-HOPE/metrics-server-prom
|
3777ba9357bf14538f7608d4a2b877b7d50960a0
|
[
"MIT"
] | 4
|
2019-03-01T03:09:16.000Z
|
2020-01-18T14:24:46.000Z
|
data/src/transform.py
|
LINK-HOPE/metrics-server-prom
|
3777ba9357bf14538f7608d4a2b877b7d50960a0
|
[
"MIT"
] | 7
|
2018-08-20T12:45:31.000Z
|
2019-12-04T02:16:14.000Z
|
# -*- coding: utf-8 -*-
'''
Auther: cytopia
License: MIT
Transformer for kubernetes-incubator/metrics-server from json
into Prometheus readable format.
'''
import os
import json
import re
import time
import requests
import subprocess
from flask import Flask
from flask import Response
'''
Globals that specify at which url metrics for nodes and pods can be found
'''
PROXY = 'http://127.0.0.1:8080'
URL_NODES = PROXY + '/apis/metrics.k8s.io/v1beta1/nodes'
URL_PODS = PROXY + '/apis/metrics.k8s.io/v1beta1/pods'
def shell_exec(command):
'''
Execute raw shell command and return exit code and output
Args:
command (str): Command to execute
Returns:
tuple (int, str, str): Returns exit code, stdout and stderr
'''
# Get absolute path of bash
bash = os.popen('command -v bash').read().rstrip('\r\n')
# Execute
cpt = subprocess.Popen(
command,
executable=bash,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
# Get stdout, stderr and return code
stdout, stderr = cpt.communicate()
return_code = 0 #cpt.returncode
return return_code, stdout, stderr
def json2dict(data):
'''
Safely convert a potential JSON string into a dict
Args:
data (str): Valid or invalid JSON string.
Returns:
dict: Returns dict of string or empty dict in case of invalid JSON input.
'''
json_object = dict()
try:
json_object = json.loads(data)
except ValueError:
pass
return json_object
def val2base(string):
'''
Transforms an arbitrary string value into a prometheus valid base (int|float) type by best guess:
https://prometheus.io/docs/instrumenting/exposition_formats/#comments-help-text-and-type-information
https://golang.org/pkg/strconv/#ParseFloat
https://golang.org/pkg/strconv/#ParseInt
Currently able to handle values of:
15Ki
15Mi
15Gi
1m0s
5m
Args:
string (str): metrics-server metrics value
Returns:
int|float|string: transformed value or initial value if no transformation regex was found.
'''
# Transform KiloByte into Bytes
val = re.search('^([0-9]+)Ki$', string, re.IGNORECASE)
if val and val.group(1):
return int(val.group(1)) * 1024
# Transform Megabytes into Bytes
val = re.search('^([0-9]+)Mi$', string, re.IGNORECASE)
if val and val.group(1):
return int(val.group(1)) * (1024*1024)
# Transform Gigabytes into Bytes
val = re.search('^([0-9]+)Gi$', string, re.IGNORECASE)
if val and val.group(1):
return int(val.group(1)) * (1024*1024*1024)
# Transform Terrabytes into Bytes
val = re.search('^([0-9]+)Ti$', string, re.IGNORECASE)
if val and val.group(1):
return int(val.group(1)) * (1024*1024*1024*1024)
# Transform hours, minutes and seconds into seconds
val = re.search('^(([0-9]+)\s*h\s*)?(([0-9]+)\s*m\s*)?(([0-9]+)\s*s\s*)?$', string, re.IGNORECASE)
if val and (val.group(2) or val.group(4) or val.group(6)):
return (
(int(val.group(2) or 0) * 60 * 60) +
(int(val.group(4) or 0) * 60) +
(int(val.group(6) or 0))
)
# Otherwise return value as it came in
return string
def trans_node_metrics(string):
'''
Transforms metrics-server node metrics (in the form of a JSON string) into Prometheus
readable metrics format (text-based).
https://prometheus.io/docs/instrumenting/exposition_formats/
https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form
Args:
string (str): Valid or invalid JSON string.
Returns:
str: Returns newline separated node metrics ready for Prometheus to pull.
'''
data = json2dict(string)
cpu = []
mem = []
cpu.append('# HELP kube_metrics_server_node_cpu The CPU time of a node in seconds.')
cpu.append('# TYPE kube_metrics_server_node_cpu gauge')
mem.append('# HELP kube_metrics_server_node_mem The memory of a node in Bytes.')
mem.append('# TYPE kube_metrics_server_node_mem gauge')
tpl = 'kube_metrics_server_node_{}{{node="{}"}} {}'
for node in data.get('items', []):
lbl = {
'node': node.get('metadata', []).get('name', '')
}
val = {
'cpu': node.get('usage', []).get('cpu', ''),
'mem': node.get('usage', []).get('memory', '')
}
cpu.append(tpl.format('cpu', lbl['node'], val2base(val['cpu'])))
mem.append(tpl.format('mem', lbl['node'], val2base(val['mem'])))
return '\n'.join(cpu + mem)
def trans_pod_metrics(string):
'''
Transforms metrics-server pod metrics (in the form of a JSON string) into Prometheus
readable metrics format (text-based).
https://prometheus.io/docs/instrumenting/exposition_formats/
https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form
Args:
string (str): Valid or invalid JSON string.
Returns:
str: Returns newline separated node metrics ready for Prometheus to pull.
'''
data = json2dict(string)
more = get_pod_metrics_from_cli()
cpu = []
mem = []
cpu.append('# HELP kube_metrics_server_pod_cpu The CPU time of a pod in seconds.')
cpu.append('# TYPE kube_metrics_server_pod_cpu gauge')
mem.append('# HELP kube_metrics_server_pod_mem The memory of a pod in Bytes.')
mem.append('# TYPE kube_metrics_server_pod_mem gauge')
tpl = 'kube_metrics_server_pod_{}{{node="{}",pod="{}",ip="{}",container="{}",namespace="{}"}} {}'
for pod in data.get('items', []):
lbl = {
'pod': pod.get('metadata', []).get('name', ''),
'ns': pod.get('metadata', []).get('namespace', '')
}
# Loop over defined container in each pod
for container in pod.get('containers', []):
lbl['cont'] = container.get('name', '')
val = {
'cpu': container.get('usage', []).get('cpu', ''),
'mem': container.get('usage', []).get('memory', '')
}
cpu.append(tpl.format(
'cpu',
more[lbl['pod']]['node'],
lbl['pod'],
more[lbl['pod']]['ip'],
lbl['cont'],
lbl['ns'],
val2base(val['cpu'])
))
mem.append(tpl.format(
'mem',
more[lbl['pod']]['node'],
lbl['pod'],
more[lbl['pod']]['ip'],
lbl['cont'],
lbl['ns'],
val2base(val['mem'])
))
return '\n'.join(cpu + mem)
def get_pod_metrics_from_cli():
'''
Get pod metrics via CLI (allows to have node for enriching the data)
Returns
data: Dictionary of additional pod metrics
'''
data = dict()
command = 'kubectl get pods -o wide --no-headers --all-namespaces'
ret, out, err = shell_exec(command)
# 1:NS | 2:Name | 3:Ready | 4:Status | 5:Restarts | 6:Age | 7:IP | 8:Node | 9: NOMINATED NODE
reg = re.compile(r"^([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ \n]+)[^\n]*$")
for line in out.splitlines():
line = line.decode("utf-8")
line = reg.match(line)
data[line.group(2)] = {
'ns': line.group(1),
'name': line.group(2),
'ready': line.group(3),
'status': line.group(4),
'restarts': line.group(5),
'age': line.group(6),
'ip': line.group(7),
'node': line.group(8)
}
return data
application = Flask(__name__) # pylint: disable=invalid-name
@application.route("/metrics")
def metrics():
'''
This function is the /metrics http entrypoint and will itself do two callbacks
to the running kubectl proxy in order to gather node and pod metrics from specified
kubernetes api urls. Current output is JSON and we must therefore transform both results
into Prometheus readable format:
https://prometheus.io/docs/instrumenting/exposition_formats/
https://en.wikipedia.org/wiki/Extended_Backus%E2%80%93Naur_form
'''
# Get info from K8s API
req = {
'nodes': requests.get(URL_NODES),
'pods': requests.get(URL_PODS)
}
# Object to JSON text
json = {
'nodes': req['nodes'].text,
'pods': req['pods'].text
}
# Convert to Prometheus format
prom = {
'nodes': trans_node_metrics(json['nodes']),
'pods': trans_pod_metrics(json['pods'])
}
get_pod_metrics_from_cli()
# Return response
return Response(prom['nodes'] + '\n' + prom['pods'], status=200, mimetype='text/plain')
@application.route("/healthz")
def healthz():
'''
This function is the /healthz http entrypoint and will itself do two callbacks
in order to determine the health of node and pod metric endpoints.
Returns:
Response: Flask Response object that will handle returning http header and body.
If one of the pages (nodes or pods metrics by metrics-server) fails,
it will report an overall failure and respond with 503 (service unavailable).
If both a good, it will respond with 200.
'''
req = {
'nodes': requests.get(URL_NODES),
'pods': requests.get(URL_PODS)
}
health = 'ok'
status = 200
if req['nodes'].status_code != 200:
health = 'failed'
status = 503
if req['pods'].status_code != 200:
health = 'failed'
status = 503
return Response(health, status=status, mimetype='text/plain')
@application.route("/")
def index():
'''
This function is the / http entrypoint and will simply provide a link to
the metrics and health page. This is done, because all metrics endpoints I have encountered
so far also do it exactly this way.
Returns:
Response: Flask Response object that will handle returning http header and body.
Returns default Prometheus endpoint index page (http 200) with links
to /healthz and /metrics.
'''
return '''
<html>
<head><title>metrics-server-prom</title></head>
<body>
<h1>metrics-server-prom</h1>
<ul>
<li><a href='/metrics'>metrics</a></li>
<li><a href='/healthz'>healthz</a></li>
</ul>
</body>
</html>
'''
if __name__ == "__main__":
application.run(host='0.0.0.0')
| 31.406528
| 112
| 0.590231
|
import os
import json
import re
import time
import requests
import subprocess
from flask import Flask
from flask import Response
PROXY = 'http://127.0.0.1:8080'
URL_NODES = PROXY + '/apis/metrics.k8s.io/v1beta1/nodes'
URL_PODS = PROXY + '/apis/metrics.k8s.io/v1beta1/pods'
def shell_exec(command):
bash = os.popen('command -v bash').read().rstrip('\r\n')
cpt = subprocess.Popen(
command,
executable=bash,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE
)
stdout, stderr = cpt.communicate()
return_code = 0
return return_code, stdout, stderr
def json2dict(data):
json_object = dict()
try:
json_object = json.loads(data)
except ValueError:
pass
return json_object
def val2base(string):
val = re.search('^([0-9]+)Ki$', string, re.IGNORECASE)
if val and val.group(1):
return int(val.group(1)) * 1024
val = re.search('^([0-9]+)Mi$', string, re.IGNORECASE)
if val and val.group(1):
return int(val.group(1)) * (1024*1024)
val = re.search('^([0-9]+)Gi$', string, re.IGNORECASE)
if val and val.group(1):
return int(val.group(1)) * (1024*1024*1024)
val = re.search('^([0-9]+)Ti$', string, re.IGNORECASE)
if val and val.group(1):
return int(val.group(1)) * (1024*1024*1024*1024)
val = re.search('^(([0-9]+)\s*h\s*)?(([0-9]+)\s*m\s*)?(([0-9]+)\s*s\s*)?$', string, re.IGNORECASE)
if val and (val.group(2) or val.group(4) or val.group(6)):
return (
(int(val.group(2) or 0) * 60 * 60) +
(int(val.group(4) or 0) * 60) +
(int(val.group(6) or 0))
)
return string
def trans_node_metrics(string):
data = json2dict(string)
cpu = []
mem = []
cpu.append('# HELP kube_metrics_server_node_cpu The CPU time of a node in seconds.')
cpu.append('# TYPE kube_metrics_server_node_cpu gauge')
mem.append('# HELP kube_metrics_server_node_mem The memory of a node in Bytes.')
mem.append('# TYPE kube_metrics_server_node_mem gauge')
tpl = 'kube_metrics_server_node_{}{{node="{}"}} {}'
for node in data.get('items', []):
lbl = {
'node': node.get('metadata', []).get('name', '')
}
val = {
'cpu': node.get('usage', []).get('cpu', ''),
'mem': node.get('usage', []).get('memory', '')
}
cpu.append(tpl.format('cpu', lbl['node'], val2base(val['cpu'])))
mem.append(tpl.format('mem', lbl['node'], val2base(val['mem'])))
return '\n'.join(cpu + mem)
def trans_pod_metrics(string):
data = json2dict(string)
more = get_pod_metrics_from_cli()
cpu = []
mem = []
cpu.append('# HELP kube_metrics_server_pod_cpu The CPU time of a pod in seconds.')
cpu.append('# TYPE kube_metrics_server_pod_cpu gauge')
mem.append('# HELP kube_metrics_server_pod_mem The memory of a pod in Bytes.')
mem.append('# TYPE kube_metrics_server_pod_mem gauge')
tpl = 'kube_metrics_server_pod_{}{{node="{}",pod="{}",ip="{}",container="{}",namespace="{}"}} {}'
for pod in data.get('items', []):
lbl = {
'pod': pod.get('metadata', []).get('name', ''),
'ns': pod.get('metadata', []).get('namespace', '')
}
for container in pod.get('containers', []):
lbl['cont'] = container.get('name', '')
val = {
'cpu': container.get('usage', []).get('cpu', ''),
'mem': container.get('usage', []).get('memory', '')
}
cpu.append(tpl.format(
'cpu',
more[lbl['pod']]['node'],
lbl['pod'],
more[lbl['pod']]['ip'],
lbl['cont'],
lbl['ns'],
val2base(val['cpu'])
))
mem.append(tpl.format(
'mem',
more[lbl['pod']]['node'],
lbl['pod'],
more[lbl['pod']]['ip'],
lbl['cont'],
lbl['ns'],
val2base(val['mem'])
))
return '\n'.join(cpu + mem)
def get_pod_metrics_from_cli():
data = dict()
command = 'kubectl get pods -o wide --no-headers --all-namespaces'
ret, out, err = shell_exec(command)
reg = re.compile(r"^([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ ]+)\s+([^ \n]+)[^\n]*$")
for line in out.splitlines():
line = line.decode("utf-8")
line = reg.match(line)
data[line.group(2)] = {
'ns': line.group(1),
'name': line.group(2),
'ready': line.group(3),
'status': line.group(4),
'restarts': line.group(5),
'age': line.group(6),
'ip': line.group(7),
'node': line.group(8)
}
return data
application = Flask(__name__)
@application.route("/metrics")
def metrics():
req = {
'nodes': requests.get(URL_NODES),
'pods': requests.get(URL_PODS)
}
json = {
'nodes': req['nodes'].text,
'pods': req['pods'].text
}
prom = {
'nodes': trans_node_metrics(json['nodes']),
'pods': trans_pod_metrics(json['pods'])
}
get_pod_metrics_from_cli()
return Response(prom['nodes'] + '\n' + prom['pods'], status=200, mimetype='text/plain')
@application.route("/healthz")
def healthz():
req = {
'nodes': requests.get(URL_NODES),
'pods': requests.get(URL_PODS)
}
health = 'ok'
status = 200
if req['nodes'].status_code != 200:
health = 'failed'
status = 503
if req['pods'].status_code != 200:
health = 'failed'
status = 503
return Response(health, status=status, mimetype='text/plain')
@application.route("/")
def index():
return '''
<html>
<head><title>metrics-server-prom</title></head>
<body>
<h1>metrics-server-prom</h1>
<ul>
<li><a href='/metrics'>metrics</a></li>
<li><a href='/healthz'>healthz</a></li>
</ul>
</body>
</html>
'''
if __name__ == "__main__":
application.run(host='0.0.0.0')
| true
| true
|
f70a33367f3433244e2fb21596526fdea288e07e
| 1,454
|
py
|
Python
|
projects/g3h2-cc/src/get_places_web_api.py
|
keybrl/xdu-coursework
|
9d0e905bef28c18d87d3b97643de0d32f9f08ee0
|
[
"MIT"
] | null | null | null |
projects/g3h2-cc/src/get_places_web_api.py
|
keybrl/xdu-coursework
|
9d0e905bef28c18d87d3b97643de0d32f9f08ee0
|
[
"MIT"
] | null | null | null |
projects/g3h2-cc/src/get_places_web_api.py
|
keybrl/xdu-coursework
|
9d0e905bef28c18d87d3b97643de0d32f9f08ee0
|
[
"MIT"
] | null | null | null |
from flask import Flask, request
from hbase_manager import HBaseRecord
import json
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/')
@app.route('/test')
@app.route('/hello')
def hello():
return 'Hello World!'
@app.route('/get_places', methods=['GET', 'POST'])
def get_places():
if request.method == 'GET':
data = request.args
else:
if request.headers.get('Content-Type') == 'application/json':
data = json.loads(request.data.decode())
else:
data = request.form
eid = data.get('eid')
start_time = data.get('start_time')
end_time = data.get('end_time')
if not eid or not start_time or not end_time:
return '参数格式错误', 400
records = app.config.get('hbase').get_places(eid, start_time, end_time)
if not records:
return '[]', 200, {'Content-Type': 'application/json'}
result = []
for record in records:
eid, timestamp, place_id = record[0].split('##')
result.append({
'eid': eid,
'timestamp': timestamp,
'place_id': place_id,
'place_name': record[1],
'longitude': record[2],
'latitude': record[3]
})
return json.dumps(result), 200, {'Content-Type': 'application/json'}
if __name__ == '__main__':
app.config['hbase'] = HBaseRecord('http://cc-keybrl-node0:2048')
app.run(host='0.0.0.0', port=8080, debug=False)
| 26.925926
| 75
| 0.597662
|
from flask import Flask, request
from hbase_manager import HBaseRecord
import json
from flask_cors import CORS
app = Flask(__name__)
CORS(app)
@app.route('/')
@app.route('/test')
@app.route('/hello')
def hello():
return 'Hello World!'
@app.route('/get_places', methods=['GET', 'POST'])
def get_places():
if request.method == 'GET':
data = request.args
else:
if request.headers.get('Content-Type') == 'application/json':
data = json.loads(request.data.decode())
else:
data = request.form
eid = data.get('eid')
start_time = data.get('start_time')
end_time = data.get('end_time')
if not eid or not start_time or not end_time:
return '参数格式错误', 400
records = app.config.get('hbase').get_places(eid, start_time, end_time)
if not records:
return '[]', 200, {'Content-Type': 'application/json'}
result = []
for record in records:
eid, timestamp, place_id = record[0].split('##')
result.append({
'eid': eid,
'timestamp': timestamp,
'place_id': place_id,
'place_name': record[1],
'longitude': record[2],
'latitude': record[3]
})
return json.dumps(result), 200, {'Content-Type': 'application/json'}
if __name__ == '__main__':
app.config['hbase'] = HBaseRecord('http://cc-keybrl-node0:2048')
app.run(host='0.0.0.0', port=8080, debug=False)
| true
| true
|
f70a3389e6b510962dd2e9884d65750d6c632971
| 16
|
py
|
Python
|
projects/aio-pika/test.py
|
fleimgruber/python
|
2e735762c73651cffc027ca850b2a58d87d54b49
|
[
"Unlicense"
] | 25
|
2021-10-30T19:54:59.000Z
|
2022-03-29T06:11:02.000Z
|
projects/aio-pika/test.py
|
fleimgruber/python
|
2e735762c73651cffc027ca850b2a58d87d54b49
|
[
"Unlicense"
] | 21
|
2021-10-19T01:09:38.000Z
|
2022-03-24T16:08:53.000Z
|
projects/aio-pika/test.py
|
fleimgruber/python
|
2e735762c73651cffc027ca850b2a58d87d54b49
|
[
"Unlicense"
] | 3
|
2022-01-25T20:25:13.000Z
|
2022-03-08T02:58:50.000Z
|
import aio_pika
| 8
| 15
| 0.875
|
import aio_pika
| true
| true
|
f70a34b972e266ad9d856336955145e38c0df274
| 5,389
|
py
|
Python
|
Tests/ML/test_config_helpers.py
|
csiebler/InnerEye-DeepLearning
|
e33ec7518803347629b786f64786409e1e2e1be5
|
[
"MIT"
] | null | null | null |
Tests/ML/test_config_helpers.py
|
csiebler/InnerEye-DeepLearning
|
e33ec7518803347629b786f64786409e1e2e1be5
|
[
"MIT"
] | null | null | null |
Tests/ML/test_config_helpers.py
|
csiebler/InnerEye-DeepLearning
|
e33ec7518803347629b786f64786409e1e2e1be5
|
[
"MIT"
] | null | null | null |
# ------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License (MIT). See LICENSE in the repo root for license information.
# ------------------------------------------------------------------------------------------
from typing import List, Optional
import pytest
import torch
from InnerEye.ML.common import ModelExecutionMode
from InnerEye.ML.config import SegmentationModelBase, equally_weighted_classes
from InnerEye.ML.models.architectures.base_model import BaseSegmentationModel
from Tests.ML.configs.DummyModel import DummyModel
def test_validate_inference_stride_size() -> None:
SegmentationModelBase.validate_inference_stride_size(inference_stride_size=(5, 3, 1), output_size=(5, 3, 1))
SegmentationModelBase.validate_inference_stride_size(inference_stride_size=(5, 3, 1), output_size=None)
with pytest.raises(ValueError):
SegmentationModelBase.validate_inference_stride_size(inference_stride_size=(5, 3, 1), output_size=(3, 3, 3))
SegmentationModelBase.validate_inference_stride_size(inference_stride_size=(5, 3, 0), output_size=None)
def test_inference_stride_size_setter() -> None:
"""Tests setter function raises an error when stride size is larger than output patch size"""
test_output_size = (7, 3, 5)
test_stride_size = (3, 3, 3)
test_fail_stride_size = (1, 1, 9)
model = IdentityModel()
model_config = SegmentationModelBase(test_crop_size=test_output_size, should_validate=False)
model_config.inference_stride_size = test_stride_size
assert model_config.inference_stride_size == test_stride_size
model_config.set_derived_model_properties(model)
assert model_config.inference_stride_size == test_stride_size
model_config.inference_stride_size = None
model_config.set_derived_model_properties(model)
assert model_config.inference_stride_size == test_output_size
with pytest.raises(ValueError):
model_config.inference_stride_size = test_fail_stride_size
def test_crop_size() -> None:
"""Checks if test crop size is equal to train crop size if it's not specified at init time"""
model_config = DummyModel()
assert model_config.test_crop_size == model_config.crop_size
def test_set_model_config_attributes() -> None:
"""Tests setter function for model config attributes"""
train_output_size = (3, 5, 3)
test_output_size = (7, 7, 7)
model = IdentityModel()
model_config = SegmentationModelBase(crop_size=train_output_size,
test_crop_size=test_output_size,
should_validate=False)
model_config.set_derived_model_properties(model)
assert model_config.inference_stride_size == test_output_size
# noinspection PyArgumentList
def test_get_output_size() -> None:
"""Tests config properties related to output tensor size"""
train_output_size = (5, 5, 5)
test_output_size = (7, 7, 7)
model_config = SegmentationModelBase(crop_size=train_output_size,
test_crop_size=test_output_size,
should_validate=False)
assert model_config.get_output_size(execution_mode=ModelExecutionMode.TRAIN) is None
assert model_config.get_output_size(execution_mode=ModelExecutionMode.TEST) is None
model = IdentityModel()
model_config.set_derived_model_properties(model)
assert model_config.get_output_size(execution_mode=ModelExecutionMode.TRAIN) == train_output_size
assert model_config.get_output_size(execution_mode=ModelExecutionMode.TEST) == test_output_size
class IdentityModel(BaseSegmentationModel):
def __init__(self) -> None:
super().__init__(input_channels=1, name='IdentityModel')
def forward(self, x: torch.Tensor) -> torch.Tensor: # type: ignore
# returns the input as it is
return x
def get_all_child_layers(self) -> List[torch.nn.Module]:
return list()
@pytest.mark.parametrize(["num_fg_classes", "background_weight", "expected"],
[
(1, 0.2, [0.2, 0.8]),
(1, None, [0.5] * 2),
(9, None, [0.1] * 10),
(3, None, [1 / 4] * 4),
(3, 0.4, [0.4, 0.2, 0.2, 0.2]),
])
def test_equally_weighted_classes(num_fg_classes: int, background_weight: Optional[float],
expected: List[float]) -> None:
classes = [""] * num_fg_classes
actual = equally_weighted_classes(classes, background_weight)
assert isinstance(actual, list)
assert len(actual) == num_fg_classes + 1
assert sum(actual) == pytest.approx(1.0)
assert actual == pytest.approx(expected)
@pytest.mark.parametrize(["num_fg_clases", "background_weight"],
[
(0, 0.5),
(1, 1.0),
(1, -0.1)
])
def test_equally_weighted_classes_fails(num_fg_clases: int, background_weight: Optional[float]) -> None:
classes = [""] * num_fg_clases
with pytest.raises(ValueError):
equally_weighted_classes(classes, background_weight)
| 43.813008
| 116
| 0.656523
|
from typing import List, Optional
import pytest
import torch
from InnerEye.ML.common import ModelExecutionMode
from InnerEye.ML.config import SegmentationModelBase, equally_weighted_classes
from InnerEye.ML.models.architectures.base_model import BaseSegmentationModel
from Tests.ML.configs.DummyModel import DummyModel
def test_validate_inference_stride_size() -> None:
SegmentationModelBase.validate_inference_stride_size(inference_stride_size=(5, 3, 1), output_size=(5, 3, 1))
SegmentationModelBase.validate_inference_stride_size(inference_stride_size=(5, 3, 1), output_size=None)
with pytest.raises(ValueError):
SegmentationModelBase.validate_inference_stride_size(inference_stride_size=(5, 3, 1), output_size=(3, 3, 3))
SegmentationModelBase.validate_inference_stride_size(inference_stride_size=(5, 3, 0), output_size=None)
def test_inference_stride_size_setter() -> None:
test_output_size = (7, 3, 5)
test_stride_size = (3, 3, 3)
test_fail_stride_size = (1, 1, 9)
model = IdentityModel()
model_config = SegmentationModelBase(test_crop_size=test_output_size, should_validate=False)
model_config.inference_stride_size = test_stride_size
assert model_config.inference_stride_size == test_stride_size
model_config.set_derived_model_properties(model)
assert model_config.inference_stride_size == test_stride_size
model_config.inference_stride_size = None
model_config.set_derived_model_properties(model)
assert model_config.inference_stride_size == test_output_size
with pytest.raises(ValueError):
model_config.inference_stride_size = test_fail_stride_size
def test_crop_size() -> None:
model_config = DummyModel()
assert model_config.test_crop_size == model_config.crop_size
def test_set_model_config_attributes() -> None:
train_output_size = (3, 5, 3)
test_output_size = (7, 7, 7)
model = IdentityModel()
model_config = SegmentationModelBase(crop_size=train_output_size,
test_crop_size=test_output_size,
should_validate=False)
model_config.set_derived_model_properties(model)
assert model_config.inference_stride_size == test_output_size
def test_get_output_size() -> None:
train_output_size = (5, 5, 5)
test_output_size = (7, 7, 7)
model_config = SegmentationModelBase(crop_size=train_output_size,
test_crop_size=test_output_size,
should_validate=False)
assert model_config.get_output_size(execution_mode=ModelExecutionMode.TRAIN) is None
assert model_config.get_output_size(execution_mode=ModelExecutionMode.TEST) is None
model = IdentityModel()
model_config.set_derived_model_properties(model)
assert model_config.get_output_size(execution_mode=ModelExecutionMode.TRAIN) == train_output_size
assert model_config.get_output_size(execution_mode=ModelExecutionMode.TEST) == test_output_size
class IdentityModel(BaseSegmentationModel):
def __init__(self) -> None:
super().__init__(input_channels=1, name='IdentityModel')
def forward(self, x: torch.Tensor) -> torch.Tensor:
return x
def get_all_child_layers(self) -> List[torch.nn.Module]:
return list()
@pytest.mark.parametrize(["num_fg_classes", "background_weight", "expected"],
[
(1, 0.2, [0.2, 0.8]),
(1, None, [0.5] * 2),
(9, None, [0.1] * 10),
(3, None, [1 / 4] * 4),
(3, 0.4, [0.4, 0.2, 0.2, 0.2]),
])
def test_equally_weighted_classes(num_fg_classes: int, background_weight: Optional[float],
expected: List[float]) -> None:
classes = [""] * num_fg_classes
actual = equally_weighted_classes(classes, background_weight)
assert isinstance(actual, list)
assert len(actual) == num_fg_classes + 1
assert sum(actual) == pytest.approx(1.0)
assert actual == pytest.approx(expected)
@pytest.mark.parametrize(["num_fg_clases", "background_weight"],
[
(0, 0.5),
(1, 1.0),
(1, -0.1)
])
def test_equally_weighted_classes_fails(num_fg_clases: int, background_weight: Optional[float]) -> None:
classes = [""] * num_fg_clases
with pytest.raises(ValueError):
equally_weighted_classes(classes, background_weight)
| true
| true
|
f70a350d94c8f84c2a1a642e7372f88ae185dfa0
| 363
|
py
|
Python
|
todos/admin.py
|
DanylovAlex1/TodoList
|
8b8d9b1ee3f76759acab6bcbbc5d491606a17d9e
|
[
"MIT"
] | null | null | null |
todos/admin.py
|
DanylovAlex1/TodoList
|
8b8d9b1ee3f76759acab6bcbbc5d491606a17d9e
|
[
"MIT"
] | 5
|
2021-03-30T14:16:11.000Z
|
2021-09-22T19:31:29.000Z
|
todos/admin.py
|
DanylovAlex1/TodoList
|
8b8d9b1ee3f76759acab6bcbbc5d491606a17d9e
|
[
"MIT"
] | null | null | null |
from django.contrib import admin
from .models import Board,TodoList
@admin.register(Board)
class BoardAdmin(admin.ModelAdmin):
search_fields = ['title']
list_display = ('title',)
@admin.register(TodoList)
class TodoAdmin(admin.ModelAdmin):
search_fields = ['title','created']
list_display = ('title','done')
list_filter = ('done','user')
| 21.352941
| 39
| 0.702479
|
from django.contrib import admin
from .models import Board,TodoList
@admin.register(Board)
class BoardAdmin(admin.ModelAdmin):
search_fields = ['title']
list_display = ('title',)
@admin.register(TodoList)
class TodoAdmin(admin.ModelAdmin):
search_fields = ['title','created']
list_display = ('title','done')
list_filter = ('done','user')
| true
| true
|
f70a351b09d4a490b7e6481dfa8c3e12bdd186e9
| 685
|
py
|
Python
|
DBCalls/urls.py
|
EdgarBodiaj/EMT-Storage
|
90c7b42b43c5925bcbb1941412efe0b15fb446f0
|
[
"MIT"
] | null | null | null |
DBCalls/urls.py
|
EdgarBodiaj/EMT-Storage
|
90c7b42b43c5925bcbb1941412efe0b15fb446f0
|
[
"MIT"
] | null | null | null |
DBCalls/urls.py
|
EdgarBodiaj/EMT-Storage
|
90c7b42b43c5925bcbb1941412efe0b15fb446f0
|
[
"MIT"
] | null | null | null |
from django.urls import path
from DBCalls.views import CollectionView, ExhibitView, ModuleView, QuestionView
urlpatterns = [
path('Questions/<str:qID>', QuestionView.as_view(), name='questionview'),
path('Questions/', QuestionView.as_view(), name='questionview'),
path('Modules/<str:mID>', ModuleView.as_view(), name='moduleview'),
path('Modules/', ModuleView.as_view(), name='moduleview'),
path('Exhibits/<str:eID>', ExhibitView.as_view(), name='exhibitview'),
path('Exhibits/', ExhibitView.as_view(), name='exhibitview'),
path('<str:cID>/', CollectionView.as_view(), name='collectionview'),
path('', CollectionView.as_view(), name='collectionview')
]
| 52.692308
| 79
| 0.706569
|
from django.urls import path
from DBCalls.views import CollectionView, ExhibitView, ModuleView, QuestionView
urlpatterns = [
path('Questions/<str:qID>', QuestionView.as_view(), name='questionview'),
path('Questions/', QuestionView.as_view(), name='questionview'),
path('Modules/<str:mID>', ModuleView.as_view(), name='moduleview'),
path('Modules/', ModuleView.as_view(), name='moduleview'),
path('Exhibits/<str:eID>', ExhibitView.as_view(), name='exhibitview'),
path('Exhibits/', ExhibitView.as_view(), name='exhibitview'),
path('<str:cID>/', CollectionView.as_view(), name='collectionview'),
path('', CollectionView.as_view(), name='collectionview')
]
| true
| true
|
f70a366b486949f8b542768f83c5593f35c86520
| 735
|
py
|
Python
|
pytglib/api/functions/cancel_upload_file.py
|
iTeam-co/pytglib
|
e5e75e0a85f89b77762209b32a61b0a883c0ae61
|
[
"MIT"
] | 6
|
2019-10-30T08:57:27.000Z
|
2021-02-08T14:17:43.000Z
|
pytglib/api/functions/cancel_upload_file.py
|
iTeam-co/python-telegram
|
e5e75e0a85f89b77762209b32a61b0a883c0ae61
|
[
"MIT"
] | 1
|
2021-08-19T05:44:10.000Z
|
2021-08-19T07:14:56.000Z
|
pytglib/api/functions/cancel_upload_file.py
|
iTeam-co/python-telegram
|
e5e75e0a85f89b77762209b32a61b0a883c0ae61
|
[
"MIT"
] | 5
|
2019-12-04T05:30:39.000Z
|
2021-05-21T18:23:32.000Z
|
from ..utils import Object
class CancelUploadFile(Object):
"""
Stops the uploading of a file. Supported only for files uploaded by using uploadFile. For other files the behavior is undefined
Attributes:
ID (:obj:`str`): ``CancelUploadFile``
Args:
file_id (:obj:`int`):
Identifier of the file to stop uploading
Returns:
Ok
Raises:
:class:`telegram.Error`
"""
ID = "cancelUploadFile"
def __init__(self, file_id, extra=None, **kwargs):
self.extra = extra
self.file_id = file_id # int
@staticmethod
def read(q: dict, *args) -> "CancelUploadFile":
file_id = q.get('file_id')
return CancelUploadFile(file_id)
| 22.272727
| 132
| 0.614966
|
from ..utils import Object
class CancelUploadFile(Object):
ID = "cancelUploadFile"
def __init__(self, file_id, extra=None, **kwargs):
self.extra = extra
self.file_id = file_id
@staticmethod
def read(q: dict, *args) -> "CancelUploadFile":
file_id = q.get('file_id')
return CancelUploadFile(file_id)
| true
| true
|
f70a38fcf4fc8f443b09e280076b04f3e02c71ef
| 1,359
|
py
|
Python
|
var/spack/repos/builtin/packages/cblas/package.py
|
kkauder/spack
|
6ae8d5c380c1f42094b05d38be26b03650aafb39
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2
|
2019-02-10T13:47:48.000Z
|
2019-04-17T13:05:17.000Z
|
var/spack/repos/builtin/packages/cblas/package.py
|
kkauder/spack
|
6ae8d5c380c1f42094b05d38be26b03650aafb39
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 32
|
2020-12-15T17:29:20.000Z
|
2022-03-21T15:08:31.000Z
|
var/spack/repos/builtin/packages/cblas/package.py
|
kkauder/spack
|
6ae8d5c380c1f42094b05d38be26b03650aafb39
|
[
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 2
|
2021-04-07T18:27:09.000Z
|
2022-03-31T22:52:38.000Z
|
# Copyright 2013-2021 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Cblas(Package):
"""The BLAS (Basic Linear Algebra Subprograms) are routines that
provide standard building blocks for performing basic vector and
matrix operations."""
homepage = "http://www.netlib.org/blas/_cblas/"
# tarball has no version, but on the date below, this MD5 was correct.
version('2015-06-06', sha256='0f6354fd67fabd909baf57ced2ef84e962db58fae126e4f41b21dd4fec60a2a3',
url='http://www.netlib.org/blas/blast-forum/cblas.tgz')
depends_on('blas')
parallel = False
def patch(self):
mf = FileFilter('Makefile.in')
mf.filter('^BLLIB =.*', 'BLLIB = {0}'.format(
' '.join(self.spec['blas'].libs.libraries)))
mf.filter('^CC =.*', 'CC = cc')
mf.filter('^FC =.*', 'FC = fc')
def install(self, spec, prefix):
make('all')
mkdirp(prefix.lib)
mkdirp(prefix.include)
# Rename the generated lib file to libcblas.a
install('lib/cblas_LINUX.a', prefix.lib.join('libcblas.a'))
install('include/cblas.h', prefix.include)
install('include/cblas_f77.h', prefix.include)
| 33.975
| 100
| 0.647535
|
from spack import *
class Cblas(Package):
homepage = "http://www.netlib.org/blas/_cblas/"
version('2015-06-06', sha256='0f6354fd67fabd909baf57ced2ef84e962db58fae126e4f41b21dd4fec60a2a3',
url='http://www.netlib.org/blas/blast-forum/cblas.tgz')
depends_on('blas')
parallel = False
def patch(self):
mf = FileFilter('Makefile.in')
mf.filter('^BLLIB =.*', 'BLLIB = {0}'.format(
' '.join(self.spec['blas'].libs.libraries)))
mf.filter('^CC =.*', 'CC = cc')
mf.filter('^FC =.*', 'FC = fc')
def install(self, spec, prefix):
make('all')
mkdirp(prefix.lib)
mkdirp(prefix.include)
install('lib/cblas_LINUX.a', prefix.lib.join('libcblas.a'))
install('include/cblas.h', prefix.include)
install('include/cblas_f77.h', prefix.include)
| true
| true
|
f70a3adb0d09aaaa54de4dcfc4ac9602759c5e44
| 8,766
|
py
|
Python
|
src/oauth/views.py
|
ResearchHub/ResearchHub-Backend-Open
|
d36dca33afae2d442690694bb2ab17180d84bcd3
|
[
"MIT"
] | 18
|
2021-05-20T13:20:16.000Z
|
2022-02-11T02:40:18.000Z
|
src/oauth/views.py
|
ResearchHub/ResearchHub-Backend-Open
|
d36dca33afae2d442690694bb2ab17180d84bcd3
|
[
"MIT"
] | 109
|
2021-05-21T20:14:23.000Z
|
2022-03-31T20:56:10.000Z
|
src/oauth/views.py
|
ResearchHub/ResearchHub-Backend-Open
|
d36dca33afae2d442690694bb2ab17180d84bcd3
|
[
"MIT"
] | 4
|
2021-05-17T13:47:53.000Z
|
2022-02-12T10:48:21.000Z
|
import requests
from allauth.socialaccount.helpers import render_authentication_error
from allauth.socialaccount.models import SocialLogin, SocialAccount
from allauth.socialaccount.providers.base import ProviderException
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from allauth.socialaccount.providers.orcid.provider import OrcidProvider
from allauth.socialaccount.providers.orcid.views import OrcidOAuth2Adapter
from allauth.socialaccount.providers.oauth2.client import (
OAuth2Error,
OAuth2Client
)
from allauth.socialaccount.providers.oauth2.views import (
AuthError,
OAuth2LoginView,
OAuth2CallbackView,
PermissionDenied,
RequestException
)
from allauth.utils import (
get_request_param,
)
from allauth.account.signals import user_signed_up, user_logged_in
from allauth.account import app_settings
from rest_auth.registration.views import SocialLoginView
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from django.dispatch import receiver
from mailchimp_marketing import Client
from oauth.serializers import SocialLoginSerializer
from oauth.adapters import GoogleOAuth2AdapterIdToken
from oauth.helpers import complete_social_login
from oauth.exceptions import LoginError
from oauth.utils import get_orcid_names
from researchhub.settings import (
GOOGLE_REDIRECT_URL,
GOOGLE_YOLO_REDIRECT_URL,
keys,
MAILCHIMP_SERVER,
MAILCHIMP_LIST_ID,
RECAPTCHA_SECRET_KEY,
RECAPTCHA_VERIFY_URL
)
from user.models import Author
from user.utils import merge_author_profiles
from utils import sentry
from utils.http import http_request, RequestMethods
from utils.throttles import captcha_unlock
from utils.siftscience import events_api
@api_view([RequestMethods.POST])
@permission_classes([AllowAny])
def captcha_verify(request):
verify_request = requests.post(
RECAPTCHA_VERIFY_URL,
{
'secret': RECAPTCHA_SECRET_KEY,
'response': request.data.get('response')
}
)
status = verify_request.status_code
req_json = verify_request.json()
data = {'success': req_json.get('success')}
if req_json.get("error-codes"):
data['errors'] = req_json.get('error-codes')
if data['success']:
# turn off throttling
captcha_unlock(request)
return Response(data, status=status)
class GoogleLogin(SocialLoginView):
adapter_class = GoogleOAuth2Adapter
callback_url = GOOGLE_REDIRECT_URL
client_class = OAuth2Client
serializer_class = SocialLoginSerializer
class GoogleYoloLogin(SocialLoginView):
adapter_class = GoogleOAuth2AdapterIdToken
callback_url = GOOGLE_YOLO_REDIRECT_URL
client_class = OAuth2Client
serializer_class = SocialLoginSerializer
class CallbackView(OAuth2CallbackView):
"""
This class is copied from allauth/socialaccount/providers/oauth2/views.py
but uses a custom method for `complete_social_login`
"""
permission_classes = (AllowAny,)
def dispatch(self, request, *args, **kwargs):
if 'error' in request.GET or 'code' not in request.GET:
# Distinguish cancel from error
auth_error = request.GET.get('error', None)
if auth_error == self.adapter.login_cancelled_error:
error = AuthError.CANCELLED
else:
error = AuthError.UNKNOWN
return render_authentication_error(
request,
self.adapter.provider_id,
error=error)
app = self.adapter.get_provider().get_app(self.request)
client = self.get_client(request, app)
try:
try:
access_token = client.get_access_token(request.GET['code'])
except Exception:
access_token = client.get_access_token(
request.GET['credential']
)
token = self.adapter.parse_token(access_token)
token.app = app
login = self.adapter.complete_login(request,
app,
token,
response=access_token)
login.token = token
if self.adapter.provider_id != OrcidProvider.id:
if self.adapter.supports_state:
login.state = SocialLogin \
.verify_and_unstash_state(
request,
get_request_param(request, 'state'))
else:
login.state = SocialLogin.unstash_state(request)
return complete_social_login(request, login)
except (PermissionDenied,
OAuth2Error,
RequestException,
ProviderException) as e:
return render_authentication_error(
request,
self.adapter.provider_id,
exception=e
)
google_callback = CallbackView.adapter_view(GoogleOAuth2Adapter)
google_yolo_login = OAuth2LoginView.adapter_view(GoogleOAuth2AdapterIdToken)
google_yolo_callback = CallbackView.adapter_view(GoogleOAuth2AdapterIdToken)
orcid_callback = CallbackView.adapter_view(OrcidOAuth2Adapter)
@api_view([RequestMethods.POST])
@permission_classes([IsAuthenticated])
def orcid_connect(request):
success = False
status = 400
try:
orcid = request.data.get('orcid')
access_token = request.data.get('access_token')
url = f'https://pub.orcid.org/v3.0/{orcid}/record'
headers = {
'Accept': 'application/json',
'Authorization': f'Bearer {access_token}'
}
# Raise for status because we need to make sure we can authenticate
# correctly with orcid. Without this check, anyone could make a post
# request to connect any other orcid account to their own.
response = http_request(RequestMethods.GET, url=url, headers=headers)
response.raise_for_status()
user = request.user
save_orcid_author(user, orcid, response.json())
events_api.track_account(user, request, update=True)
success = True
status = 201
data = {
'success': success,
'orcid_profile': f'https://orcid.org/{orcid}'
}
except Exception as e:
data = str(e)
sentry.log_error(e)
print(e)
return Response(data, status=status)
def save_orcid_author(user, orcid_id, orcid_data):
orcid_account = SocialAccount.objects.create(
user=user,
uid=orcid_id,
provider=OrcidProvider.id,
extra_data=orcid_data
)
update_author_profile(user, orcid_id, orcid_data, orcid_account)
def update_author_profile(user, orcid_id, orcid_data, orcid_account):
first_name, last_name = get_orcid_names(orcid_data)
try:
author = Author.objects.get(orcid_id=orcid_id)
except Author.DoesNotExist:
user.author_profile.orcid_id = orcid_id
else:
user.author_profile = merge_author_profiles(
author,
user.author_profile
)
user.author_profile.orcid_account = orcid_account
user.author_profile.first_name = first_name
user.author_profile.last_name = last_name
user.author_profile.save()
user.save()
@receiver(user_signed_up)
@receiver(user_logged_in)
def user_signed_up_(request, user, **kwargs):
"""
After a user signs up with social account, set their profile image.
"""
queryset = SocialAccount.objects.filter(
provider='google',
user=user
)
if queryset.exists():
if queryset.count() > 1:
raise Exception(
f'Expected 1 item in the queryset. Found {queryset.count()}.'
)
google_account = queryset.first()
url = google_account.extra_data.get('picture', None)
if user.author_profile and not user.author_profile.profile_image:
user.author_profile.profile_image = url
user.author_profile.save()
return None
else:
return None
@receiver(user_signed_up)
def mailchimp_add_user(request, user, **kwargs):
"""Adds user email to MailChimp"""
mailchimp = Client()
mailchimp.set_config({
'api_key': keys.MAILCHIMP_KEY,
'server': MAILCHIMP_SERVER
})
try:
member_info = {'email_address': user.email, 'status': 'subscribed'}
mailchimp.lists.add_list_member(MAILCHIMP_LIST_ID, member_info)
except Exception as error:
sentry.log_error(error, message=error.text)
| 32.708955
| 77
| 0.671344
|
import requests
from allauth.socialaccount.helpers import render_authentication_error
from allauth.socialaccount.models import SocialLogin, SocialAccount
from allauth.socialaccount.providers.base import ProviderException
from allauth.socialaccount.providers.google.views import GoogleOAuth2Adapter
from allauth.socialaccount.providers.orcid.provider import OrcidProvider
from allauth.socialaccount.providers.orcid.views import OrcidOAuth2Adapter
from allauth.socialaccount.providers.oauth2.client import (
OAuth2Error,
OAuth2Client
)
from allauth.socialaccount.providers.oauth2.views import (
AuthError,
OAuth2LoginView,
OAuth2CallbackView,
PermissionDenied,
RequestException
)
from allauth.utils import (
get_request_param,
)
from allauth.account.signals import user_signed_up, user_logged_in
from allauth.account import app_settings
from rest_auth.registration.views import SocialLoginView
from rest_framework.decorators import api_view, permission_classes
from rest_framework.permissions import AllowAny, IsAuthenticated
from rest_framework.response import Response
from django.dispatch import receiver
from mailchimp_marketing import Client
from oauth.serializers import SocialLoginSerializer
from oauth.adapters import GoogleOAuth2AdapterIdToken
from oauth.helpers import complete_social_login
from oauth.exceptions import LoginError
from oauth.utils import get_orcid_names
from researchhub.settings import (
GOOGLE_REDIRECT_URL,
GOOGLE_YOLO_REDIRECT_URL,
keys,
MAILCHIMP_SERVER,
MAILCHIMP_LIST_ID,
RECAPTCHA_SECRET_KEY,
RECAPTCHA_VERIFY_URL
)
from user.models import Author
from user.utils import merge_author_profiles
from utils import sentry
from utils.http import http_request, RequestMethods
from utils.throttles import captcha_unlock
from utils.siftscience import events_api
@api_view([RequestMethods.POST])
@permission_classes([AllowAny])
def captcha_verify(request):
verify_request = requests.post(
RECAPTCHA_VERIFY_URL,
{
'secret': RECAPTCHA_SECRET_KEY,
'response': request.data.get('response')
}
)
status = verify_request.status_code
req_json = verify_request.json()
data = {'success': req_json.get('success')}
if req_json.get("error-codes"):
data['errors'] = req_json.get('error-codes')
if data['success']:
captcha_unlock(request)
return Response(data, status=status)
class GoogleLogin(SocialLoginView):
adapter_class = GoogleOAuth2Adapter
callback_url = GOOGLE_REDIRECT_URL
client_class = OAuth2Client
serializer_class = SocialLoginSerializer
class GoogleYoloLogin(SocialLoginView):
adapter_class = GoogleOAuth2AdapterIdToken
callback_url = GOOGLE_YOLO_REDIRECT_URL
client_class = OAuth2Client
serializer_class = SocialLoginSerializer
class CallbackView(OAuth2CallbackView):
permission_classes = (AllowAny,)
def dispatch(self, request, *args, **kwargs):
if 'error' in request.GET or 'code' not in request.GET:
auth_error = request.GET.get('error', None)
if auth_error == self.adapter.login_cancelled_error:
error = AuthError.CANCELLED
else:
error = AuthError.UNKNOWN
return render_authentication_error(
request,
self.adapter.provider_id,
error=error)
app = self.adapter.get_provider().get_app(self.request)
client = self.get_client(request, app)
try:
try:
access_token = client.get_access_token(request.GET['code'])
except Exception:
access_token = client.get_access_token(
request.GET['credential']
)
token = self.adapter.parse_token(access_token)
token.app = app
login = self.adapter.complete_login(request,
app,
token,
response=access_token)
login.token = token
if self.adapter.provider_id != OrcidProvider.id:
if self.adapter.supports_state:
login.state = SocialLogin \
.verify_and_unstash_state(
request,
get_request_param(request, 'state'))
else:
login.state = SocialLogin.unstash_state(request)
return complete_social_login(request, login)
except (PermissionDenied,
OAuth2Error,
RequestException,
ProviderException) as e:
return render_authentication_error(
request,
self.adapter.provider_id,
exception=e
)
google_callback = CallbackView.adapter_view(GoogleOAuth2Adapter)
google_yolo_login = OAuth2LoginView.adapter_view(GoogleOAuth2AdapterIdToken)
google_yolo_callback = CallbackView.adapter_view(GoogleOAuth2AdapterIdToken)
orcid_callback = CallbackView.adapter_view(OrcidOAuth2Adapter)
@api_view([RequestMethods.POST])
@permission_classes([IsAuthenticated])
def orcid_connect(request):
success = False
status = 400
try:
orcid = request.data.get('orcid')
access_token = request.data.get('access_token')
url = f'https://pub.orcid.org/v3.0/{orcid}/record'
headers = {
'Accept': 'application/json',
'Authorization': f'Bearer {access_token}'
}
response = http_request(RequestMethods.GET, url=url, headers=headers)
response.raise_for_status()
user = request.user
save_orcid_author(user, orcid, response.json())
events_api.track_account(user, request, update=True)
success = True
status = 201
data = {
'success': success,
'orcid_profile': f'https://orcid.org/{orcid}'
}
except Exception as e:
data = str(e)
sentry.log_error(e)
print(e)
return Response(data, status=status)
def save_orcid_author(user, orcid_id, orcid_data):
orcid_account = SocialAccount.objects.create(
user=user,
uid=orcid_id,
provider=OrcidProvider.id,
extra_data=orcid_data
)
update_author_profile(user, orcid_id, orcid_data, orcid_account)
def update_author_profile(user, orcid_id, orcid_data, orcid_account):
first_name, last_name = get_orcid_names(orcid_data)
try:
author = Author.objects.get(orcid_id=orcid_id)
except Author.DoesNotExist:
user.author_profile.orcid_id = orcid_id
else:
user.author_profile = merge_author_profiles(
author,
user.author_profile
)
user.author_profile.orcid_account = orcid_account
user.author_profile.first_name = first_name
user.author_profile.last_name = last_name
user.author_profile.save()
user.save()
@receiver(user_signed_up)
@receiver(user_logged_in)
def user_signed_up_(request, user, **kwargs):
queryset = SocialAccount.objects.filter(
provider='google',
user=user
)
if queryset.exists():
if queryset.count() > 1:
raise Exception(
f'Expected 1 item in the queryset. Found {queryset.count()}.'
)
google_account = queryset.first()
url = google_account.extra_data.get('picture', None)
if user.author_profile and not user.author_profile.profile_image:
user.author_profile.profile_image = url
user.author_profile.save()
return None
else:
return None
@receiver(user_signed_up)
def mailchimp_add_user(request, user, **kwargs):
mailchimp = Client()
mailchimp.set_config({
'api_key': keys.MAILCHIMP_KEY,
'server': MAILCHIMP_SERVER
})
try:
member_info = {'email_address': user.email, 'status': 'subscribed'}
mailchimp.lists.add_list_member(MAILCHIMP_LIST_ID, member_info)
except Exception as error:
sentry.log_error(error, message=error.text)
| true
| true
|
f70a3b29166669d3eedb262309f7bbc995dcd9f8
| 5,438
|
py
|
Python
|
httphoneypot/tcp_handler.py
|
muratti66/python-honeypots
|
ce3d4f8dcb36c29e6fab00bd8a93ba2de0dfc108
|
[
"MIT"
] | null | null | null |
httphoneypot/tcp_handler.py
|
muratti66/python-honeypots
|
ce3d4f8dcb36c29e6fab00bd8a93ba2de0dfc108
|
[
"MIT"
] | 1
|
2021-09-18T00:11:46.000Z
|
2021-09-18T00:13:04.000Z
|
httphoneypot/tcp_handler.py
|
muratti66/python-honeypots
|
ce3d4f8dcb36c29e6fab00bd8a93ba2de0dfc108
|
[
"MIT"
] | 1
|
2021-05-06T21:11:27.000Z
|
2021-05-06T21:11:27.000Z
|
import socket # Networking support
import time # Current time
from library import id_generate
host = None
port = None
log_th = None
conf_th = None
header_th = None
command_w_th = None
data_w_th = None
class HTTPServer:
def __init__(self):
global host, port, log_th, conf_th, header_th, command_w_th, data_w_th
self.host = host
self.port = port
self.conf_th_ic = conf_th
self.header_th_ic = header_th
self.command_w_th_inc = command_w_th
self.data_w_th_inc = data_w_th
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.log_th = log_th
self.id = None
self.client_ip = None
self.client_port = None
self.hostname = conf_th.get_item(q_key='general').get('hostname')
self.http_queue_size = int(conf_th.get_item(q_key='general').get('http_queue_size'))
self.http_recv_size = int(conf_th.get_item(q_key='general').get('http_recv_size'))
self.server_header_information = conf_th.get_item(q_key='general').get('server_header_information')
self.html_message = conf_th.get_item(q_key='general').get('html_message')
self.post_message = conf_th.get_item(q_key='general').get('post_after_message')
self.sleep_between = int(conf_th.get_item(q_key='general').get('sleep_between'))
self.no_answer = int(conf_th.get_item(q_key='general').get('no_answer'))
def activate_server(self):
try:
self.socket.bind((self.host, self.port))
except Exception as e:
self.log_th.log_error("Warning: Could not aquite port:" + str(self.port) + "\n")
graceful_shutdown(s=self.socket)
self._wait_for_connections()
def shutdown(self):
try:
self.log_th.log_info("Shutting down the server")
self.socket.shutdown()
except Exception as e:
self.log_th.log_error("Warning: could not shut down the socket. Maybe it was already closed? : " + e)
def _gen_headers(self, code):
h = ''
if code == 200:
h = 'HTTP/1.1 200 OK\n'
elif code == 404:
h = 'HTTP/1.1 404 Not Found\n'
current_date = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
h += 'Date: ' + current_date + ' GMT' + '\n'
h += 'Server: ' + self.server_header_information + '\n'
# h += 'Connection: close\n\n'
h += '\n\n'
return h
def _wait_for_connections(self):
while True:
self.socket.listen(self.http_queue_size) # maximum number of queued connections
conn, addr = self.socket.accept()
self.client_ip = addr.__getitem__(0)
self.client_port = addr.__getitem__(1)
self.id = id_generate(size=16)
self.log_th.log_info('{}:{} connected'.format(self.client_ip, self.client_port))
header_th.write_header(ip=addr.__getitem__(0), qid=self.id)
if self.no_answer != 0:
while True:
conn.recv(self.http_recv_size)
if self.sleep_between != 0:
time.sleep(self.sleep_between)
data = conn.recv(self.http_recv_size)
string = bytes.decode(data)
request_method = string.split(' ')[0]
file_requested = string.split(' ')
file_requested = file_requested[1]
file_requested = file_requested.split('?')[0]
if file_requested == '/':
file_requested = '/index.html'
url_path = "http://" + self.hostname + ":" + str(self.port) + file_requested
commands = "Request : " + request_method + ", Access Path : " + url_path
self.command_w_th_inc.write_commands(data=commands, qid=self.id)
self.log_th.log_info('{} - {} client request {} - {} '.format(
self.id, self.client_ip, request_method, url_path))
self.data_w_th_inc.write_data(data=string, qid=self.id)
response_headers = self._gen_headers(200)
if file_requested.split('/')[1] == 'robots.txt':
response_content = 'User-agent: *' + '\n' + 'Disallow: /' + '\n'
response_content = response_content.encode()
elif file_requested.split('/')[1] == 'favicon.ico':
response_headers = self._gen_headers(404)
response_content = ''.encode()
elif request_method == 'POST':
response_content = self.post_message.encode()
else:
response_content = self.html_message.encode()
server_response = response_headers.encode()
server_response += response_content
conn.send(server_response)
self.log_th.log_info('{}:{} disconnected'.format(self.client_ip, self.client_port))
conn.shutdown(socket.SHUT_RD)
conn.close()
def graceful_shutdown(s, sig, dummy):
s.socket.shutdown()
import sys
sys.exit(1)
def server_init(log_set, conf_set, header_set, commands_w_set, data_w_set):
global log_th, conf_th, header_th, command_w_th, data_w_th, host, port
log_th = log_set
conf_th = conf_set
header_th = header_set
command_w_th = commands_w_set
data_w_th = data_w_set
host = conf_set.get_item(q_key='general').get('sock_ip')
port = int(conf_set.get_item(q_key='general').get('port'))
| 39.405797
| 113
| 0.610886
|
import socket
import time
from library import id_generate
host = None
port = None
log_th = None
conf_th = None
header_th = None
command_w_th = None
data_w_th = None
class HTTPServer:
def __init__(self):
global host, port, log_th, conf_th, header_th, command_w_th, data_w_th
self.host = host
self.port = port
self.conf_th_ic = conf_th
self.header_th_ic = header_th
self.command_w_th_inc = command_w_th
self.data_w_th_inc = data_w_th
self.socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.log_th = log_th
self.id = None
self.client_ip = None
self.client_port = None
self.hostname = conf_th.get_item(q_key='general').get('hostname')
self.http_queue_size = int(conf_th.get_item(q_key='general').get('http_queue_size'))
self.http_recv_size = int(conf_th.get_item(q_key='general').get('http_recv_size'))
self.server_header_information = conf_th.get_item(q_key='general').get('server_header_information')
self.html_message = conf_th.get_item(q_key='general').get('html_message')
self.post_message = conf_th.get_item(q_key='general').get('post_after_message')
self.sleep_between = int(conf_th.get_item(q_key='general').get('sleep_between'))
self.no_answer = int(conf_th.get_item(q_key='general').get('no_answer'))
def activate_server(self):
try:
self.socket.bind((self.host, self.port))
except Exception as e:
self.log_th.log_error("Warning: Could not aquite port:" + str(self.port) + "\n")
graceful_shutdown(s=self.socket)
self._wait_for_connections()
def shutdown(self):
try:
self.log_th.log_info("Shutting down the server")
self.socket.shutdown()
except Exception as e:
self.log_th.log_error("Warning: could not shut down the socket. Maybe it was already closed? : " + e)
def _gen_headers(self, code):
h = ''
if code == 200:
h = 'HTTP/1.1 200 OK\n'
elif code == 404:
h = 'HTTP/1.1 404 Not Found\n'
current_date = time.strftime("%a, %d %b %Y %H:%M:%S", time.localtime())
h += 'Date: ' + current_date + ' GMT' + '\n'
h += 'Server: ' + self.server_header_information + '\n'
h += '\n\n'
return h
def _wait_for_connections(self):
while True:
self.socket.listen(self.http_queue_size)
conn, addr = self.socket.accept()
self.client_ip = addr.__getitem__(0)
self.client_port = addr.__getitem__(1)
self.id = id_generate(size=16)
self.log_th.log_info('{}:{} connected'.format(self.client_ip, self.client_port))
header_th.write_header(ip=addr.__getitem__(0), qid=self.id)
if self.no_answer != 0:
while True:
conn.recv(self.http_recv_size)
if self.sleep_between != 0:
time.sleep(self.sleep_between)
data = conn.recv(self.http_recv_size)
string = bytes.decode(data)
request_method = string.split(' ')[0]
file_requested = string.split(' ')
file_requested = file_requested[1]
file_requested = file_requested.split('?')[0]
if file_requested == '/':
file_requested = '/index.html'
url_path = "http://" + self.hostname + ":" + str(self.port) + file_requested
commands = "Request : " + request_method + ", Access Path : " + url_path
self.command_w_th_inc.write_commands(data=commands, qid=self.id)
self.log_th.log_info('{} - {} client request {} - {} '.format(
self.id, self.client_ip, request_method, url_path))
self.data_w_th_inc.write_data(data=string, qid=self.id)
response_headers = self._gen_headers(200)
if file_requested.split('/')[1] == 'robots.txt':
response_content = 'User-agent: *' + '\n' + 'Disallow: /' + '\n'
response_content = response_content.encode()
elif file_requested.split('/')[1] == 'favicon.ico':
response_headers = self._gen_headers(404)
response_content = ''.encode()
elif request_method == 'POST':
response_content = self.post_message.encode()
else:
response_content = self.html_message.encode()
server_response = response_headers.encode()
server_response += response_content
conn.send(server_response)
self.log_th.log_info('{}:{} disconnected'.format(self.client_ip, self.client_port))
conn.shutdown(socket.SHUT_RD)
conn.close()
def graceful_shutdown(s, sig, dummy):
s.socket.shutdown()
import sys
sys.exit(1)
def server_init(log_set, conf_set, header_set, commands_w_set, data_w_set):
global log_th, conf_th, header_th, command_w_th, data_w_th, host, port
log_th = log_set
conf_th = conf_set
header_th = header_set
command_w_th = commands_w_set
data_w_th = data_w_set
host = conf_set.get_item(q_key='general').get('sock_ip')
port = int(conf_set.get_item(q_key='general').get('port'))
| true
| true
|
f70a3b7d8b4bc2d328e9192f92e41eb807c618df
| 1,328
|
py
|
Python
|
dwellingplace/tests/test_models_utils.py
|
dwelling-place/xlsx-merger
|
fa2343a3acbf3fc7f8b76b30f6ccbc7dc03282ed
|
[
"MIT"
] | null | null | null |
dwellingplace/tests/test_models_utils.py
|
dwelling-place/xlsx-merger
|
fa2343a3acbf3fc7f8b76b30f6ccbc7dc03282ed
|
[
"MIT"
] | 56
|
2016-11-05T01:55:22.000Z
|
2016-11-07T00:30:10.000Z
|
dwellingplace/tests/test_models_utils.py
|
dwelling-place/xlsx-merger
|
fa2343a3acbf3fc7f8b76b30f6ccbc7dc03282ed
|
[
"MIT"
] | 2
|
2016-11-05T13:42:53.000Z
|
2016-11-05T13:59:09.000Z
|
# pylint: disable=unused-argument,unused-variable,expression-not-assigned
import os
from datetime import datetime
import pytest
from expecter import expect
import xlrd
from dwellingplace.models._utils import parse_xlsx_into_dicts, get_value
DATA = os.path.join(os.path.dirname(__file__), "data")
def test_load():
xl = xlrd.open_workbook(os.path.join(DATA, 'sample.xlsx'))
output = list(parse_xlsx_into_dicts(xl))
assert output[0]['Curb Appeal'] == 4.3
assert output[0]['Date'] == datetime(2016, 9, 1)
def describe_get_value():
@pytest.fixture
def datum():
return dict(
_int=1,
_float=2.3,
_float_percent=0.5,
_str="Hello, world!",
_bool=True,
_date=datetime(2016, 11, 5),
)
def when_int(datum):
expect(get_value(datum, '_int')) == (1, None)
def when_float(datum):
expect(get_value(datum, '_float')) == (2.3, None)
def when_float_as_a_percentage(datum):
expect(get_value(datum, '_float_percent')) == \
(0.5, {'num_format': "0.00%"})
def when_bool(datum):
expect(get_value(datum, '_bool')) == (True, None)
def when_date(datum):
expect(get_value(datum, '_date')) == \
(datetime(2016, 11, 5), {'num_format': "mmm yyyy"})
| 25.538462
| 73
| 0.614458
|
import os
from datetime import datetime
import pytest
from expecter import expect
import xlrd
from dwellingplace.models._utils import parse_xlsx_into_dicts, get_value
DATA = os.path.join(os.path.dirname(__file__), "data")
def test_load():
xl = xlrd.open_workbook(os.path.join(DATA, 'sample.xlsx'))
output = list(parse_xlsx_into_dicts(xl))
assert output[0]['Curb Appeal'] == 4.3
assert output[0]['Date'] == datetime(2016, 9, 1)
def describe_get_value():
@pytest.fixture
def datum():
return dict(
_int=1,
_float=2.3,
_float_percent=0.5,
_str="Hello, world!",
_bool=True,
_date=datetime(2016, 11, 5),
)
def when_int(datum):
expect(get_value(datum, '_int')) == (1, None)
def when_float(datum):
expect(get_value(datum, '_float')) == (2.3, None)
def when_float_as_a_percentage(datum):
expect(get_value(datum, '_float_percent')) == \
(0.5, {'num_format': "0.00%"})
def when_bool(datum):
expect(get_value(datum, '_bool')) == (True, None)
def when_date(datum):
expect(get_value(datum, '_date')) == \
(datetime(2016, 11, 5), {'num_format': "mmm yyyy"})
| true
| true
|
f70a3c094cf154b93d675ca8458f3581ca522c8f
| 2,286
|
py
|
Python
|
tests/test_cdkitchen.py
|
thomascaillier/recipe-scrapers
|
564940c0a588bb34455af499754b1be46d690c7b
|
[
"MIT"
] | 1
|
2021-02-07T17:48:09.000Z
|
2021-02-07T17:48:09.000Z
|
tests/test_cdkitchen.py
|
thomascaillier/recipe-scrapers
|
564940c0a588bb34455af499754b1be46d690c7b
|
[
"MIT"
] | null | null | null |
tests/test_cdkitchen.py
|
thomascaillier/recipe-scrapers
|
564940c0a588bb34455af499754b1be46d690c7b
|
[
"MIT"
] | null | null | null |
from tests import ScraperTest
from recipe_scrapers.cdkitchen import CdKitchen
class TestCdKitchen(ScraperTest):
scraper_class = CdKitchen
def test_host(self):
self.assertEqual("cdkitchen.com", self.harvester_class.host())
def test_canonical_url(self):
self.assertEqual(
"https://www.cdkitchen.com/recipes/recs/473/Veal-Steak-Vesuvio92364.shtml",
self.harvester_class.canonical_url(),
)
def test_title(self):
self.assertEqual("Veal Steak Vesuvio", self.harvester_class.title())
def test_total_time(self):
self.assertEqual(45, self.harvester_class.total_time())
def test_yields(self):
self.assertEqual("4 serving(s)", self.harvester_class.yields())
def test_ingredients(self):
self.assertCountEqual(
[
"2 veal shoulder arm or blade steaks, cut 1 inch thick",
"2 baking potatoes, cut lengthwise into 8 wedges",
"1 lemon, cut lengthwise into 8 wedges",
"1/2 cup frozen peas, cooked",
"Seasoning",
"2 tablespoons olive oil",
"3 cloves garlic, minced",
"1 teaspoon dried oregano",
"1/2 teaspoon black pepper",
],
self.harvester_class.ingredients(),
)
def test_instructions(self):
return self.assertEqual(
"Combine seasoning ingredients. Brush 1/2 of seasoning on veal steaks. Toss remaining seasoning with potatoes.\nPlace steaks and potatoes on rack in broiler pan so surface of veal is 3 to 4 inches from heat. Squeeze juice from lemon wedges over steaks and potatoes; place wedges on rack. Broil 26 to 28 minutes for medium doneness, turning steaks, potatoes and lemon once. Remove steaks.\nContinue broiling potatoes and lemon 3 to 5 minutes or until lightly browned. Carve veal; season with salt. Serve with potatoes, lemon and peas.",
self.harvester_class.instructions(),
)
def test_image(self):
self.assertEqual(
"https://cdn.cdkitchen.com/recipes/images/sharing/25/veal-steak-vesuvio-63237-small.png",
self.harvester_class.image(),
)
| 41.563636
| 548
| 0.635171
|
from tests import ScraperTest
from recipe_scrapers.cdkitchen import CdKitchen
class TestCdKitchen(ScraperTest):
scraper_class = CdKitchen
def test_host(self):
self.assertEqual("cdkitchen.com", self.harvester_class.host())
def test_canonical_url(self):
self.assertEqual(
"https://www.cdkitchen.com/recipes/recs/473/Veal-Steak-Vesuvio92364.shtml",
self.harvester_class.canonical_url(),
)
def test_title(self):
self.assertEqual("Veal Steak Vesuvio", self.harvester_class.title())
def test_total_time(self):
self.assertEqual(45, self.harvester_class.total_time())
def test_yields(self):
self.assertEqual("4 serving(s)", self.harvester_class.yields())
def test_ingredients(self):
self.assertCountEqual(
[
"2 veal shoulder arm or blade steaks, cut 1 inch thick",
"2 baking potatoes, cut lengthwise into 8 wedges",
"1 lemon, cut lengthwise into 8 wedges",
"1/2 cup frozen peas, cooked",
"Seasoning",
"2 tablespoons olive oil",
"3 cloves garlic, minced",
"1 teaspoon dried oregano",
"1/2 teaspoon black pepper",
],
self.harvester_class.ingredients(),
)
def test_instructions(self):
return self.assertEqual(
"Combine seasoning ingredients. Brush 1/2 of seasoning on veal steaks. Toss remaining seasoning with potatoes.\nPlace steaks and potatoes on rack in broiler pan so surface of veal is 3 to 4 inches from heat. Squeeze juice from lemon wedges over steaks and potatoes; place wedges on rack. Broil 26 to 28 minutes for medium doneness, turning steaks, potatoes and lemon once. Remove steaks.\nContinue broiling potatoes and lemon 3 to 5 minutes or until lightly browned. Carve veal; season with salt. Serve with potatoes, lemon and peas.",
self.harvester_class.instructions(),
)
def test_image(self):
self.assertEqual(
"https://cdn.cdkitchen.com/recipes/images/sharing/25/veal-steak-vesuvio-63237-small.png",
self.harvester_class.image(),
)
| true
| true
|
f70a3c5c50783abc4ba51130c8dd1408e60f7f6c
| 157
|
py
|
Python
|
boa3_test/test_sc/list_test/AppendAnyValue.py
|
hal0x2328/neo3-boa
|
6825a3533384cb01660773050719402a9703065b
|
[
"Apache-2.0"
] | 25
|
2020-07-22T19:37:43.000Z
|
2022-03-08T03:23:55.000Z
|
boa3_test/test_sc/list_test/AppendAnyValue.py
|
hal0x2328/neo3-boa
|
6825a3533384cb01660773050719402a9703065b
|
[
"Apache-2.0"
] | 419
|
2020-04-23T17:48:14.000Z
|
2022-03-31T13:17:45.000Z
|
boa3_test/test_sc/list_test/AppendAnyValue.py
|
hal0x2328/neo3-boa
|
6825a3533384cb01660773050719402a9703065b
|
[
"Apache-2.0"
] | 15
|
2020-05-21T21:54:24.000Z
|
2021-11-18T06:17:24.000Z
|
from typing import Any, List
from boa3.builtin import public
@public
def Main() -> List[Any]:
a: List[Any] = [1, 2, 3]
a.append('4')
return a
| 14.272727
| 31
| 0.611465
|
from typing import Any, List
from boa3.builtin import public
@public
def Main() -> List[Any]:
a: List[Any] = [1, 2, 3]
a.append('4')
return a
| true
| true
|
f70a3f7b6707ea59fcb33953a4b50ce4c44c13b1
| 1,245
|
py
|
Python
|
discordbot/economy/currencies.py
|
elan17/GamestonkTerminal
|
f958f8275dc15ffaf30c1f0652f5b033725b7f10
|
[
"MIT"
] | 1,835
|
2021-05-09T02:55:06.000Z
|
2022-03-29T12:37:05.000Z
|
discordbot/economy/currencies.py
|
elan17/GamestonkTerminal
|
f958f8275dc15ffaf30c1f0652f5b033725b7f10
|
[
"MIT"
] | 569
|
2021-05-09T15:59:41.000Z
|
2022-03-29T12:25:16.000Z
|
discordbot/economy/currencies.py
|
elan17/GamestonkTerminal
|
f958f8275dc15ffaf30c1f0652f5b033725b7f10
|
[
"MIT"
] | 268
|
2021-05-10T21:46:50.000Z
|
2022-03-28T09:18:38.000Z
|
import discord
from gamestonk_terminal.economy import wsj_model
import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import logger
async def currencies_command(ctx):
"""Currencies overview [Wall St. Journal]"""
try:
# Retrieve data
df_data = wsj_model.global_currencies()
# Debug user output
if cfg.DEBUG:
logger.debug(df_data.to_string())
# Output data
if df_data.empty:
df_data_str = "No currencies data available"
else:
df_data_str = "```" + df_data.to_string(index=False) + "```"
embed = discord.Embed(
title="Economy: [WSJ] Currencies",
description=df_data_str,
colour=cfg.COLOR,
)
embed.set_author(
name=cfg.AUTHOR_NAME,
icon_url=cfg.AUTHOR_ICON_URL,
)
await ctx.send(embed=embed)
except Exception as e:
embed = discord.Embed(
title="ERROR Economy: [WSJ] Currencies",
colour=cfg.COLOR,
description=e,
)
embed.set_author(
name=cfg.AUTHOR_NAME,
icon_url=cfg.AUTHOR_ICON_URL,
)
await ctx.send(embed=embed)
| 24.9
| 72
| 0.583936
|
import discord
from gamestonk_terminal.economy import wsj_model
import discordbot.config_discordbot as cfg
from discordbot.run_discordbot import logger
async def currencies_command(ctx):
try:
df_data = wsj_model.global_currencies()
if cfg.DEBUG:
logger.debug(df_data.to_string())
if df_data.empty:
df_data_str = "No currencies data available"
else:
df_data_str = "```" + df_data.to_string(index=False) + "```"
embed = discord.Embed(
title="Economy: [WSJ] Currencies",
description=df_data_str,
colour=cfg.COLOR,
)
embed.set_author(
name=cfg.AUTHOR_NAME,
icon_url=cfg.AUTHOR_ICON_URL,
)
await ctx.send(embed=embed)
except Exception as e:
embed = discord.Embed(
title="ERROR Economy: [WSJ] Currencies",
colour=cfg.COLOR,
description=e,
)
embed.set_author(
name=cfg.AUTHOR_NAME,
icon_url=cfg.AUTHOR_ICON_URL,
)
await ctx.send(embed=embed)
| true
| true
|
f70a3fdda0f1ba058b58e70b31982a27c4121cac
| 1,039
|
py
|
Python
|
magnumclient/v1/stats_shell.py
|
gyliu513/python-magnumclient
|
c0d368360831cd29affa47e77eba4e81e4c6f0f8
|
[
"Apache-2.0"
] | 29
|
2015-04-17T12:06:04.000Z
|
2019-05-03T06:27:17.000Z
|
magnumclient/v1/stats_shell.py
|
gyliu513/python-magnumclient
|
c0d368360831cd29affa47e77eba4e81e4c6f0f8
|
[
"Apache-2.0"
] | 2
|
2016-01-19T14:45:58.000Z
|
2016-11-17T16:30:18.000Z
|
magnumclient/v1/stats_shell.py
|
gyliu513/python-magnumclient
|
c0d368360831cd29affa47e77eba4e81e4c6f0f8
|
[
"Apache-2.0"
] | 26
|
2015-08-17T19:28:56.000Z
|
2020-07-10T08:12:07.000Z
|
# 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.
from magnumclient.common import cliutils as utils
from magnumclient.i18n import _
@utils.arg('--project-id',
required=False,
metavar='<project-id>',
help=_('Project ID'))
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
def do_stats_list(cs, args):
"""Show stats for the given project_id"""
opts = {
'project_id': args.project_id
}
stats = cs.stats.list(**opts)
utils.print_dict(stats._info)
| 34.633333
| 78
| 0.696824
|
from magnumclient.common import cliutils as utils
from magnumclient.i18n import _
@utils.arg('--project-id',
required=False,
metavar='<project-id>',
help=_('Project ID'))
@utils.deprecated(utils.MAGNUM_CLIENT_DEPRECATION_WARNING)
def do_stats_list(cs, args):
opts = {
'project_id': args.project_id
}
stats = cs.stats.list(**opts)
utils.print_dict(stats._info)
| true
| true
|
f70a413c4399a3a45411b582acef1ae95872414b
| 4,704
|
py
|
Python
|
save_features.py
|
Codelegant92/STC-ProtoNet
|
f3e77bb1b363b0338cda6f1701bfabe0cd3accbe
|
[
"MIT"
] | null | null | null |
save_features.py
|
Codelegant92/STC-ProtoNet
|
f3e77bb1b363b0338cda6f1701bfabe0cd3accbe
|
[
"MIT"
] | null | null | null |
save_features.py
|
Codelegant92/STC-ProtoNet
|
f3e77bb1b363b0338cda6f1701bfabe0cd3accbe
|
[
"MIT"
] | null | null | null |
import numpy as np
import torch
from torch.autograd import Variable
import os
import glob
import h5py
import configs
import backbone
from data.datamgr import SimpleDataManager
from methods.baselinetrain import BaselineTrain
from methods.baselinefinetune import BaselineFinetune
from methods.protonet import ProtoNet
from methods.matchingnet import MatchingNet
from methods.relationnet import RelationNet
from methods.maml import MAML
from io_utils import model_dict, parse_args, get_resume_file, get_best_file, get_assigned_file
def save_features(model, data_loader, outfile ):
f = h5py.File(outfile, 'w')
max_count = len(data_loader)*data_loader.batch_size
all_labels = f.create_dataset('all_labels',(max_count,), dtype='i')
all_feats=None
count=0
for i, (x,y) in enumerate(data_loader):
if i%10 == 0:
print('{:d}/{:d}'.format(i, len(data_loader)))
x = x.cuda()
x_var = Variable(x)
feats = model(x_var)
if all_feats is None:
all_feats = f.create_dataset('all_feats', [max_count] + list( feats.size()[1:]) , dtype='f')
all_feats[count:count+feats.size(0)] = feats.data.cpu().numpy()
all_labels[count:count+feats.size(0)] = y.cpu().numpy()
count = count + feats.size(0)
count_var = f.create_dataset('count', (1,), dtype='i')
count_var[0] = count
f.close()
if __name__ == '__main__':
params = parse_args('save_features')
assert params.method != 'maml' and params.method != 'maml_approx', 'maml do not support save_feature and run'
if 'Conv' in params.model:
image_size = 40
split = params.split
loadfile = configs.data_dir[params.dataset] + split + '.json'
loadfile_unk = configs.data_dir[params.dataset] + split + '_unk.json'
loadfile_sil = configs.data_dir[params.dataset] + split + '_sil.json'
checkpoint_dir = '%s/checkpoints/%s/%s_%s_regularizer' %(configs.save_dir, params.dataset, params.model, params.method)
#checkpoint_dir = '%s/checkpoints/%s/%s_%s' %(configs.save_dir, params.dataset, params.model, params.method)
if params.train_aug:
checkpoint_dir += '_aug'
if not params.method in ['baseline', 'baseline++'] :
if params.train_n_way != -1:
checkpoint_dir += '_%d-way_' %( params.train_n_way )
else:
checkpoint_dir += '_random-way_'
if params.train_n_shot != -1:
checkpoint_dir += '%d-shot' % ( params.train_n_shot )
else:
checkpoint_dir += 'random-shot'
if params.save_iter != -1:
modelfile = get_assigned_file(checkpoint_dir,params.save_iter)
# elif params.method in ['baseline', 'baseline++'] :
# modelfile = get_resume_file(checkpoint_dir) #comment in 2019/08/03 updates as the validation of baseline/baseline++ is added
else:
modelfile = get_best_file(checkpoint_dir, params.test_n_way)
if params.save_iter != -1:
outfile = os.path.join( checkpoint_dir.replace("checkpoints","features"), split + "_" + str(params.save_iter)+ ".hdf5")
else:
outfile = os.path.join( checkpoint_dir.replace("checkpoints","features"), split + ".hdf5")
#outfile = os.path.join( checkpoint_dir.replace("checkpoints","features"), split + "_test_random-way.hdf5")
datamgr = SimpleDataManager(image_size, batch_size = 64)
data_loader = datamgr.get_data_loader(loadfile, [loadfile_unk, loadfile_sil], aug = False)
if params.method in ['relationnet', 'relationnet_softmax']:
if params.model == 'Conv4':
model = backbone.Conv4NP()
elif params.model == 'Conv6':
model = backbone.Conv6NP()
elif params.model == 'Conv4S':
model = backbone.Conv4SNP()
else:
model = model_dict[params.model]( flatten = False )
elif params.method in ['maml' , 'maml_approx']:
raise ValueError('MAML do not support save feature')
else:
model = model_dict[params.model]()
model = model.cuda()
tmp = torch.load(modelfile)
state = tmp['state']
state_keys = list(state.keys())
for i, key in enumerate(state_keys):
if "feature." in key:
newkey = key.replace("feature.","") # an architecture model has attribute 'feature', load architecture feature to backbone by casting name from 'feature.trunk.xx' to 'trunk.xx'
state[newkey] = state.pop(key)
else:
state.pop(key)
model.load_state_dict(state)
model.eval()
dirname = os.path.dirname(outfile)
if not os.path.isdir(dirname):
os.makedirs(dirname)
save_features(model, data_loader, outfile)
| 39.864407
| 191
| 0.6554
|
import numpy as np
import torch
from torch.autograd import Variable
import os
import glob
import h5py
import configs
import backbone
from data.datamgr import SimpleDataManager
from methods.baselinetrain import BaselineTrain
from methods.baselinefinetune import BaselineFinetune
from methods.protonet import ProtoNet
from methods.matchingnet import MatchingNet
from methods.relationnet import RelationNet
from methods.maml import MAML
from io_utils import model_dict, parse_args, get_resume_file, get_best_file, get_assigned_file
def save_features(model, data_loader, outfile ):
f = h5py.File(outfile, 'w')
max_count = len(data_loader)*data_loader.batch_size
all_labels = f.create_dataset('all_labels',(max_count,), dtype='i')
all_feats=None
count=0
for i, (x,y) in enumerate(data_loader):
if i%10 == 0:
print('{:d}/{:d}'.format(i, len(data_loader)))
x = x.cuda()
x_var = Variable(x)
feats = model(x_var)
if all_feats is None:
all_feats = f.create_dataset('all_feats', [max_count] + list( feats.size()[1:]) , dtype='f')
all_feats[count:count+feats.size(0)] = feats.data.cpu().numpy()
all_labels[count:count+feats.size(0)] = y.cpu().numpy()
count = count + feats.size(0)
count_var = f.create_dataset('count', (1,), dtype='i')
count_var[0] = count
f.close()
if __name__ == '__main__':
params = parse_args('save_features')
assert params.method != 'maml' and params.method != 'maml_approx', 'maml do not support save_feature and run'
if 'Conv' in params.model:
image_size = 40
split = params.split
loadfile = configs.data_dir[params.dataset] + split + '.json'
loadfile_unk = configs.data_dir[params.dataset] + split + '_unk.json'
loadfile_sil = configs.data_dir[params.dataset] + split + '_sil.json'
checkpoint_dir = '%s/checkpoints/%s/%s_%s_regularizer' %(configs.save_dir, params.dataset, params.model, params.method)
if params.train_aug:
checkpoint_dir += '_aug'
if not params.method in ['baseline', 'baseline++'] :
if params.train_n_way != -1:
checkpoint_dir += '_%d-way_' %( params.train_n_way )
else:
checkpoint_dir += '_random-way_'
if params.train_n_shot != -1:
checkpoint_dir += '%d-shot' % ( params.train_n_shot )
else:
checkpoint_dir += 'random-shot'
if params.save_iter != -1:
modelfile = get_assigned_file(checkpoint_dir,params.save_iter)
)
if params.save_iter != -1:
outfile = os.path.join( checkpoint_dir.replace("checkpoints","features"), split + "_" + str(params.save_iter)+ ".hdf5")
else:
outfile = os.path.join( checkpoint_dir.replace("checkpoints","features"), split + ".hdf5")
datamgr = SimpleDataManager(image_size, batch_size = 64)
data_loader = datamgr.get_data_loader(loadfile, [loadfile_unk, loadfile_sil], aug = False)
if params.method in ['relationnet', 'relationnet_softmax']:
if params.model == 'Conv4':
model = backbone.Conv4NP()
elif params.model == 'Conv6':
model = backbone.Conv6NP()
elif params.model == 'Conv4S':
model = backbone.Conv4SNP()
else:
model = model_dict[params.model]( flatten = False )
elif params.method in ['maml' , 'maml_approx']:
raise ValueError('MAML do not support save feature')
else:
model = model_dict[params.model]()
model = model.cuda()
tmp = torch.load(modelfile)
state = tmp['state']
state_keys = list(state.keys())
for i, key in enumerate(state_keys):
if "feature." in key:
newkey = key.replace("feature.","")
state[newkey] = state.pop(key)
else:
state.pop(key)
model.load_state_dict(state)
model.eval()
dirname = os.path.dirname(outfile)
if not os.path.isdir(dirname):
os.makedirs(dirname)
save_features(model, data_loader, outfile)
| true
| true
|
f70a42127de469f4bdda2525a0f76c5003a06eef
| 10,055
|
py
|
Python
|
contrib/spendfrom/spendfrom.py
|
wargo32/NewYorkCoin
|
f057bd7649ea2512aab427bb3f3cdd014de68fa1
|
[
"MIT"
] | 2
|
2018-02-07T15:48:59.000Z
|
2022-02-15T23:16:17.000Z
|
contrib/spendfrom/spendfrom.py
|
wargo32/NewYorkCoin
|
f057bd7649ea2512aab427bb3f3cdd014de68fa1
|
[
"MIT"
] | null | null | null |
contrib/spendfrom/spendfrom.py
|
wargo32/NewYorkCoin
|
f057bd7649ea2512aab427bb3f3cdd014de68fa1
|
[
"MIT"
] | 3
|
2015-01-26T17:07:07.000Z
|
2022-02-15T23:19:06.000Z
|
#!/usr/bin/env python
#
# Use the raw transactions API to spend bitcoins received on particular addresses,
# and send any change back to that same address.
#
# Example usage:
# spendfrom.py # Lists available funds
# spendfrom.py --from=ADDRESS --to=ADDRESS --amount=11.00
#
# Assumes it will talk to a bitcoind or Bitcoin-Qt running
# on localhost.
#
# Depends on jsonrpc
#
from decimal import *
import getpass
import math
import os
import os.path
import platform
import sys
import time
from jsonrpc import ServiceProxy, json
BASE_FEE=Decimal("0.001")
def check_json_precision():
"""Make sure json library being used does not lose precision converting BTC values"""
n = Decimal("20000000.00000003")
satoshis = int(json.loads(json.dumps(float(n)))*1.0e8)
if satoshis != 2000000000000003:
raise RuntimeError("JSON encode/decode loses precision")
def determine_db_dir():
"""Return the default location of the bitcoin data directory"""
if platform.system() == "Darwin":
return os.path.expanduser("~/Library/Application Support/Bitcoin/")
elif platform.system() == "Windows":
return os.path.join(os.environ['APPDATA'], "Bitcoin")
return os.path.expanduser("~/.bitcoin")
def read_bitcoin_config(dbdir):
"""Read the bitcoin.conf file from dbdir, returns dictionary of settings"""
from ConfigParser import SafeConfigParser
class FakeSecHead(object):
def __init__(self, fp):
self.fp = fp
self.sechead = '[all]\n'
def readline(self):
if self.sechead:
try: return self.sechead
finally: self.sechead = None
else:
s = self.fp.readline()
if s.find('#') != -1:
s = s[0:s.find('#')].strip() +"\n"
return s
config_parser = SafeConfigParser()
config_parser.readfp(FakeSecHead(open(os.path.join(dbdir, "bitcoin.conf"))))
return dict(config_parser.items("all"))
def connect_JSON(config):
"""Connect to a bitcoin JSON-RPC server"""
testnet = config.get('testnet', '0')
testnet = (int(testnet) > 0) # 0/1 in config file, convert to True/False
if not 'rpcport' in config:
config['rpcport'] = 118823 if testnet else 18823
connect = "http://%s:%s@127.0.0.1:%s"%(config['rpcuser'], config['rpcpassword'], config['rpcport'])
try:
result = ServiceProxy(connect)
# ServiceProxy is lazy-connect, so send an RPC command mostly to catch connection errors,
# but also make sure the bitcoind we're talking to is/isn't testnet:
if result.getmininginfo()['testnet'] != testnet:
sys.stderr.write("RPC server at "+connect+" testnet setting mismatch\n")
sys.exit(1)
return result
except:
sys.stderr.write("Error connecting to RPC server at "+connect+"\n")
sys.exit(1)
def unlock_wallet(bitcoind):
info = bitcoind.getinfo()
if 'unlocked_until' not in info:
return True # wallet is not encrypted
t = int(info['unlocked_until'])
if t <= time.time():
try:
passphrase = getpass.getpass("Wallet is locked; enter passphrase: ")
bitcoind.walletpassphrase(passphrase, 5)
except:
sys.stderr.write("Wrong passphrase\n")
info = bitcoind.getinfo()
return int(info['unlocked_until']) > time.time()
def list_available(bitcoind):
address_summary = dict()
address_to_account = dict()
for info in bitcoind.listreceivedbyaddress(0):
address_to_account[info["address"]] = info["account"]
unspent = bitcoind.listunspent(0)
for output in unspent:
# listunspent doesn't give addresses, so:
rawtx = bitcoind.getrawtransaction(output['txid'], 1)
vout = rawtx["vout"][output['vout']]
pk = vout["scriptPubKey"]
# This code only deals with ordinary pay-to-bitcoin-address
# or pay-to-script-hash outputs right now; anything exotic is ignored.
if pk["type"] != "pubkeyhash" and pk["type"] != "scripthash":
continue
address = pk["addresses"][0]
if address in address_summary:
address_summary[address]["total"] += vout["value"]
address_summary[address]["outputs"].append(output)
else:
address_summary[address] = {
"total" : vout["value"],
"outputs" : [output],
"account" : address_to_account.get(address, "")
}
return address_summary
def select_coins(needed, inputs):
# Feel free to improve this, this is good enough for my simple needs:
outputs = []
have = Decimal("0.0")
n = 0
while have < needed and n < len(inputs):
outputs.append({ "txid":inputs[n]["txid"], "vout":inputs[n]["vout"]})
have += inputs[n]["amount"]
n += 1
return (outputs, have-needed)
def create_tx(bitcoind, fromaddresses, toaddress, amount, fee):
all_coins = list_available(bitcoind)
total_available = Decimal("0.0")
needed = amount+fee
potential_inputs = []
for addr in fromaddresses:
if addr not in all_coins:
continue
potential_inputs.extend(all_coins[addr]["outputs"])
total_available += all_coins[addr]["total"]
if total_available < needed:
sys.stderr.write("Error, only %f BTC available, need %f\n"%(total_available, needed));
sys.exit(1)
#
# Note:
# Python's json/jsonrpc modules have inconsistent support for Decimal numbers.
# Instead of wrestling with getting json.dumps() (used by jsonrpc) to encode
# Decimals, I'm casting amounts to float before sending them to bitcoind.
#
outputs = { toaddress : float(amount) }
(inputs, change_amount) = select_coins(needed, potential_inputs)
if change_amount > BASE_FEE: # don't bother with zero or tiny change
change_address = fromaddresses[-1]
if change_address in outputs:
outputs[change_address] += float(change_amount)
else:
outputs[change_address] = float(change_amount)
rawtx = bitcoind.createrawtransaction(inputs, outputs)
signed_rawtx = bitcoind.signrawtransaction(rawtx)
if not signed_rawtx["complete"]:
sys.stderr.write("signrawtransaction failed\n")
sys.exit(1)
txdata = signed_rawtx["hex"]
return txdata
def compute_amount_in(bitcoind, txinfo):
result = Decimal("0.0")
for vin in txinfo['vin']:
in_info = bitcoind.getrawtransaction(vin['txid'], 1)
vout = in_info['vout'][vin['vout']]
result = result + vout['value']
return result
def compute_amount_out(txinfo):
result = Decimal("0.0")
for vout in txinfo['vout']:
result = result + vout['value']
return result
def sanity_test_fee(bitcoind, txdata_hex, max_fee):
class FeeError(RuntimeError):
pass
try:
txinfo = bitcoind.decoderawtransaction(txdata_hex)
total_in = compute_amount_in(bitcoind, txinfo)
total_out = compute_amount_out(txinfo)
if total_in-total_out > max_fee:
raise FeeError("Rejecting transaction, unreasonable fee of "+str(total_in-total_out))
tx_size = len(txdata_hex)/2
kb = tx_size/1000 # integer division rounds down
if kb > 1 and fee < BASE_FEE:
raise FeeError("Rejecting no-fee transaction, larger than 1000 bytes")
if total_in < 0.01 and fee < BASE_FEE:
raise FeeError("Rejecting no-fee, tiny-amount transaction")
# Exercise for the reader: compute transaction priority, and
# warn if this is a very-low-priority transaction
except FeeError as err:
sys.stderr.write((str(err)+"\n"))
sys.exit(1)
def main():
import optparse
parser = optparse.OptionParser(usage="%prog [options]")
parser.add_option("--from", dest="fromaddresses", default=None,
help="addresses to get bitcoins from")
parser.add_option("--to", dest="to", default=None,
help="address to get send bitcoins to")
parser.add_option("--amount", dest="amount", default=None,
help="amount to send")
parser.add_option("--fee", dest="fee", default="0.0",
help="fee to include")
parser.add_option("--datadir", dest="datadir", default=determine_db_dir(),
help="location of bitcoin.conf file with RPC username/password (default: %default)")
parser.add_option("--testnet", dest="testnet", default=False, action="store_true",
help="Use the test network")
parser.add_option("--dry_run", dest="dry_run", default=False, action="store_true",
help="Don't broadcast the transaction, just create and print the transaction data")
(options, args) = parser.parse_args()
check_json_precision()
config = read_bitcoin_config(options.datadir)
if options.testnet: config['testnet'] = True
bitcoind = connect_JSON(config)
if options.amount is None:
address_summary = list_available(bitcoind)
for address,info in address_summary.iteritems():
n_transactions = len(info['outputs'])
if n_transactions > 1:
print("%s %.8f %s (%d transactions)"%(address, info['total'], info['account'], n_transactions))
else:
print("%s %.8f %s"%(address, info['total'], info['account']))
else:
fee = Decimal(options.fee)
amount = Decimal(options.amount)
while unlock_wallet(bitcoind) == False:
pass # Keep asking for passphrase until they get it right
txdata = create_tx(bitcoind, options.fromaddresses.split(","), options.to, amount, fee)
sanity_test_fee(bitcoind, txdata, amount*Decimal("0.01"))
if options.dry_run:
print(txdata)
else:
txid = bitcoind.sendrawtransaction(txdata)
print(txid)
if __name__ == '__main__':
main()
| 37.518657
| 111
| 0.632322
|
mport *
import getpass
import math
import os
import os.path
import platform
import sys
import time
from jsonrpc import ServiceProxy, json
BASE_FEE=Decimal("0.001")
def check_json_precision():
n = Decimal("20000000.00000003")
satoshis = int(json.loads(json.dumps(float(n)))*1.0e8)
if satoshis != 2000000000000003:
raise RuntimeError("JSON encode/decode loses precision")
def determine_db_dir():
if platform.system() == "Darwin":
return os.path.expanduser("~/Library/Application Support/Bitcoin/")
elif platform.system() == "Windows":
return os.path.join(os.environ['APPDATA'], "Bitcoin")
return os.path.expanduser("~/.bitcoin")
def read_bitcoin_config(dbdir):
from ConfigParser import SafeConfigParser
class FakeSecHead(object):
def __init__(self, fp):
self.fp = fp
self.sechead = '[all]\n'
def readline(self):
if self.sechead:
try: return self.sechead
finally: self.sechead = None
else:
s = self.fp.readline()
if s.find('#') != -1:
s = s[0:s.find('#')].strip() +"\n"
return s
config_parser = SafeConfigParser()
config_parser.readfp(FakeSecHead(open(os.path.join(dbdir, "bitcoin.conf"))))
return dict(config_parser.items("all"))
def connect_JSON(config):
testnet = config.get('testnet', '0')
testnet = (int(testnet) > 0)
if not 'rpcport' in config:
config['rpcport'] = 118823 if testnet else 18823
connect = "http://%s:%s@127.0.0.1:%s"%(config['rpcuser'], config['rpcpassword'], config['rpcport'])
try:
result = ServiceProxy(connect)
if result.getmininginfo()['testnet'] != testnet:
sys.stderr.write("RPC server at "+connect+" testnet setting mismatch\n")
sys.exit(1)
return result
except:
sys.stderr.write("Error connecting to RPC server at "+connect+"\n")
sys.exit(1)
def unlock_wallet(bitcoind):
info = bitcoind.getinfo()
if 'unlocked_until' not in info:
return True
t = int(info['unlocked_until'])
if t <= time.time():
try:
passphrase = getpass.getpass("Wallet is locked; enter passphrase: ")
bitcoind.walletpassphrase(passphrase, 5)
except:
sys.stderr.write("Wrong passphrase\n")
info = bitcoind.getinfo()
return int(info['unlocked_until']) > time.time()
def list_available(bitcoind):
address_summary = dict()
address_to_account = dict()
for info in bitcoind.listreceivedbyaddress(0):
address_to_account[info["address"]] = info["account"]
unspent = bitcoind.listunspent(0)
for output in unspent:
rawtx = bitcoind.getrawtransaction(output['txid'], 1)
vout = rawtx["vout"][output['vout']]
pk = vout["scriptPubKey"]
# This code only deals with ordinary pay-to-bitcoin-address
# or pay-to-script-hash outputs right now; anything exotic is ignored.
if pk["type"] != "pubkeyhash" and pk["type"] != "scripthash":
continue
address = pk["addresses"][0]
if address in address_summary:
address_summary[address]["total"] += vout["value"]
address_summary[address]["outputs"].append(output)
else:
address_summary[address] = {
"total" : vout["value"],
"outputs" : [output],
"account" : address_to_account.get(address, "")
}
return address_summary
def select_coins(needed, inputs):
# Feel free to improve this, this is good enough for my simple needs:
outputs = []
have = Decimal("0.0")
n = 0
while have < needed and n < len(inputs):
outputs.append({ "txid":inputs[n]["txid"], "vout":inputs[n]["vout"]})
have += inputs[n]["amount"]
n += 1
return (outputs, have-needed)
def create_tx(bitcoind, fromaddresses, toaddress, amount, fee):
all_coins = list_available(bitcoind)
total_available = Decimal("0.0")
needed = amount+fee
potential_inputs = []
for addr in fromaddresses:
if addr not in all_coins:
continue
potential_inputs.extend(all_coins[addr]["outputs"])
total_available += all_coins[addr]["total"]
if total_available < needed:
sys.stderr.write("Error, only %f BTC available, need %f\n"%(total_available, needed));
sys.exit(1)
#
# Note:
# Python's json/jsonrpc modules have inconsistent support for Decimal numbers.
#
outputs = { toaddress : float(amount) }
(inputs, change_amount) = select_coins(needed, potential_inputs)
if change_amount > BASE_FEE: # don't bother with zero or tiny change
change_address = fromaddresses[-1]
if change_address in outputs:
outputs[change_address] += float(change_amount)
else:
outputs[change_address] = float(change_amount)
rawtx = bitcoind.createrawtransaction(inputs, outputs)
signed_rawtx = bitcoind.signrawtransaction(rawtx)
if not signed_rawtx["complete"]:
sys.stderr.write("signrawtransaction failed\n")
sys.exit(1)
txdata = signed_rawtx["hex"]
return txdata
def compute_amount_in(bitcoind, txinfo):
result = Decimal("0.0")
for vin in txinfo['vin']:
in_info = bitcoind.getrawtransaction(vin['txid'], 1)
vout = in_info['vout'][vin['vout']]
result = result + vout['value']
return result
def compute_amount_out(txinfo):
result = Decimal("0.0")
for vout in txinfo['vout']:
result = result + vout['value']
return result
def sanity_test_fee(bitcoind, txdata_hex, max_fee):
class FeeError(RuntimeError):
pass
try:
txinfo = bitcoind.decoderawtransaction(txdata_hex)
total_in = compute_amount_in(bitcoind, txinfo)
total_out = compute_amount_out(txinfo)
if total_in-total_out > max_fee:
raise FeeError("Rejecting transaction, unreasonable fee of "+str(total_in-total_out))
tx_size = len(txdata_hex)/2
kb = tx_size/1000
if kb > 1 and fee < BASE_FEE:
raise FeeError("Rejecting no-fee transaction, larger than 1000 bytes")
if total_in < 0.01 and fee < BASE_FEE:
raise FeeError("Rejecting no-fee, tiny-amount transaction")
except FeeError as err:
sys.stderr.write((str(err)+"\n"))
sys.exit(1)
def main():
import optparse
parser = optparse.OptionParser(usage="%prog [options]")
parser.add_option("--from", dest="fromaddresses", default=None,
help="addresses to get bitcoins from")
parser.add_option("--to", dest="to", default=None,
help="address to get send bitcoins to")
parser.add_option("--amount", dest="amount", default=None,
help="amount to send")
parser.add_option("--fee", dest="fee", default="0.0",
help="fee to include")
parser.add_option("--datadir", dest="datadir", default=determine_db_dir(),
help="location of bitcoin.conf file with RPC username/password (default: %default)")
parser.add_option("--testnet", dest="testnet", default=False, action="store_true",
help="Use the test network")
parser.add_option("--dry_run", dest="dry_run", default=False, action="store_true",
help="Don't broadcast the transaction, just create and print the transaction data")
(options, args) = parser.parse_args()
check_json_precision()
config = read_bitcoin_config(options.datadir)
if options.testnet: config['testnet'] = True
bitcoind = connect_JSON(config)
if options.amount is None:
address_summary = list_available(bitcoind)
for address,info in address_summary.iteritems():
n_transactions = len(info['outputs'])
if n_transactions > 1:
print("%s %.8f %s (%d transactions)"%(address, info['total'], info['account'], n_transactions))
else:
print("%s %.8f %s"%(address, info['total'], info['account']))
else:
fee = Decimal(options.fee)
amount = Decimal(options.amount)
while unlock_wallet(bitcoind) == False:
pass # Keep asking for passphrase until they get it right
txdata = create_tx(bitcoind, options.fromaddresses.split(","), options.to, amount, fee)
sanity_test_fee(bitcoind, txdata, amount*Decimal("0.01"))
if options.dry_run:
print(txdata)
else:
txid = bitcoind.sendrawtransaction(txdata)
print(txid)
if __name__ == '__main__':
main()
| true
| true
|
f70a42ac70d545eee6852b70f3027dbfa760d2d2
| 1,054
|
py
|
Python
|
unicodeit/export_data.py
|
TWolczanski/unicodeit
|
0c5e616d8dd494db3f9b7dcb3981b47da79d4f80
|
[
"LPPL-1.3c",
"MIT"
] | null | null | null |
unicodeit/export_data.py
|
TWolczanski/unicodeit
|
0c5e616d8dd494db3f9b7dcb3981b47da79d4f80
|
[
"LPPL-1.3c",
"MIT"
] | null | null | null |
unicodeit/export_data.py
|
TWolczanski/unicodeit
|
0c5e616d8dd494db3f9b7dcb3981b47da79d4f80
|
[
"LPPL-1.3c",
"MIT"
] | null | null | null |
import sys
from .data import REPLACEMENTS, COMBININGMARKS, SUBSUPERSCRIPTS
if __name__ == "__main__":
outname = 'ts_src/data.ts'
if len(sys.argv) == 2:
outname = sys.argv[1]
with open(outname, 'w') as f:
f.write('// autogenerated with python -m unicodeit.export_data\n\n')
f.write('export const replacements = [\n')
for l, u in REPLACEMENTS:
l = l.replace('\\', '\\\\')
l = l.replace('\'', '\\\'')
f.write(' [\'{}\', \'{}\'],\n'.format(l, u))
f.write('];\n\n')
f.write('export const combiningmarks = [\n')
for l, u in COMBININGMARKS:
l = l.replace('\\', '\\\\')
l = l.replace('\'', '\\\'')
f.write(' [\'{}\', \'{}\'],\n'
''.format(l, u.encode('ascii', 'backslashreplace').decode()))
f.write('];\n\n')
f.write('export const subsuperscripts = [\n')
for l, u in SUBSUPERSCRIPTS:
f.write(' [\'{}\', \'{}\'],\n'.format(l, u))
f.write('];\n')
| 31.939394
| 81
| 0.468691
|
import sys
from .data import REPLACEMENTS, COMBININGMARKS, SUBSUPERSCRIPTS
if __name__ == "__main__":
outname = 'ts_src/data.ts'
if len(sys.argv) == 2:
outname = sys.argv[1]
with open(outname, 'w') as f:
f.write('// autogenerated with python -m unicodeit.export_data\n\n')
f.write('export const replacements = [\n')
for l, u in REPLACEMENTS:
l = l.replace('\\', '\\\\')
l = l.replace('\'', '\\\'')
f.write(' [\'{}\', \'{}\'],\n'.format(l, u))
f.write('];\n\n')
f.write('export const combiningmarks = [\n')
for l, u in COMBININGMARKS:
l = l.replace('\\', '\\\\')
l = l.replace('\'', '\\\'')
f.write(' [\'{}\', \'{}\'],\n'
''.format(l, u.encode('ascii', 'backslashreplace').decode()))
f.write('];\n\n')
f.write('export const subsuperscripts = [\n')
for l, u in SUBSUPERSCRIPTS:
f.write(' [\'{}\', \'{}\'],\n'.format(l, u))
f.write('];\n')
| true
| true
|
f70a42c5e95c543c5c1c2d154ee73266e8144626
| 1,415
|
py
|
Python
|
tests/pkplatform_test.py
|
radiasoft/pykern
|
bf5946e20d77d13ceab387c33ac75c59b6579de6
|
[
"Apache-2.0"
] | 8
|
2016-10-26T13:23:44.000Z
|
2022-03-02T22:03:01.000Z
|
tests/pkplatform_test.py
|
radiasoft/pykern
|
bf5946e20d77d13ceab387c33ac75c59b6579de6
|
[
"Apache-2.0"
] | 124
|
2016-03-01T15:32:54.000Z
|
2022-03-31T17:42:40.000Z
|
tests/pkplatform_test.py
|
radiasoft/pykern
|
bf5946e20d77d13ceab387c33ac75c59b6579de6
|
[
"Apache-2.0"
] | 10
|
2015-05-09T14:17:36.000Z
|
2020-02-10T18:42:53.000Z
|
# -*- coding: utf-8 -*-
u"""pytest for `pykern.pkplatform`
:copyright: Copyright (c) 2015 Bivio Software, Inc. All Rights Reserved.
:license: http://www.apache.org/licenses/LICENSE-2.0.html
"""
from __future__ import absolute_import, division, print_function
import pytest
def test_conformance1():
"""Verify the platforms based on other calls"""
import re
import sys
import platform
from pykern import pkplatform
if platform.system() == 'Linux':
assert pkplatform.is_linux()
assert pkplatform.is_unix()
assert not pkplatform.is_darwin()
assert not pkplatform.is_windows()
elif platform.system().startswith('CYGWIN'):
assert not pkplatform.is_linux()
assert pkplatform.is_unix()
assert not pkplatform.is_darwin()
assert pkplatform.is_windows()
elif platform.system() == 'Windows':
assert not pkplatform.is_linux()
assert not pkplatform.is_unix()
assert not pkplatform.is_darwin()
assert pkplatform.is_windows()
elif platform.system() == 'Darwin':
assert not pkplatform.is_linux()
assert pkplatform.is_unix()
assert pkplatform.is_darwin()
assert not pkplatform.is_windows()
else:
assert not pkplatform.is_windows()
assert not pkplatform.is_darwin()
assert not pkplatform.is_linux()
# Not sure if it would be unix
| 33.690476
| 73
| 0.671378
|
from __future__ import absolute_import, division, print_function
import pytest
def test_conformance1():
import re
import sys
import platform
from pykern import pkplatform
if platform.system() == 'Linux':
assert pkplatform.is_linux()
assert pkplatform.is_unix()
assert not pkplatform.is_darwin()
assert not pkplatform.is_windows()
elif platform.system().startswith('CYGWIN'):
assert not pkplatform.is_linux()
assert pkplatform.is_unix()
assert not pkplatform.is_darwin()
assert pkplatform.is_windows()
elif platform.system() == 'Windows':
assert not pkplatform.is_linux()
assert not pkplatform.is_unix()
assert not pkplatform.is_darwin()
assert pkplatform.is_windows()
elif platform.system() == 'Darwin':
assert not pkplatform.is_linux()
assert pkplatform.is_unix()
assert pkplatform.is_darwin()
assert not pkplatform.is_windows()
else:
assert not pkplatform.is_windows()
assert not pkplatform.is_darwin()
assert not pkplatform.is_linux()
| true
| true
|
f70a43d947ac006e0f9243ec8a817607c8cc6d8c
| 61,521
|
py
|
Python
|
skyportal/tests/api/test_photometry.py
|
LSSTDESC/skyportal
|
1a433aae67b26ffd3516e65e0fdbf866b4751486
|
[
"BSD-3-Clause"
] | null | null | null |
skyportal/tests/api/test_photometry.py
|
LSSTDESC/skyportal
|
1a433aae67b26ffd3516e65e0fdbf866b4751486
|
[
"BSD-3-Clause"
] | null | null | null |
skyportal/tests/api/test_photometry.py
|
LSSTDESC/skyportal
|
1a433aae67b26ffd3516e65e0fdbf866b4751486
|
[
"BSD-3-Clause"
] | null | null | null |
import math
import numpy as np
import sncosmo
from baselayer.app.env import load_env
from skyportal.models import DBSession, Token
from skyportal.tests import api
_, cfg = load_env()
PHOT_DETECTION_THRESHOLD = cfg["misc.photometry_detection_threshold_nsigma"]
def test_token_user_post_get_photometry_data(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['ra'] is None
assert data['data']['dec'] is None
assert data['data']['ra_unc'] is None
assert data['data']['dec_unc'] is None
np.testing.assert_allclose(
data['data']['flux'], 12.24 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_token_user_post_put_photometry_data(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401, 59402],
"mag": [19.2, 19.3, np.random.uniform(19, 20)],
"magerr": [0.05, 0.06, np.random.uniform(0.01, 0.1)],
"limiting_mag": [20.0, 20.1, 20.2],
"magsys": ["ab", "ab", "ab"],
"filter": ["ztfr", "ztfg", "ztfr"],
"ra": [42.01, 42.01, 42.02],
"dec": [42.02, 42.01, 42.03],
"origin": [None, "lol", "lol"],
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
ids = data["data"]["ids"]
assert len(ids) == 3
# POSTing photometry that contains the same first two points should fail:
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401, 59402],
"mag": [19.2, 19.3, np.random.uniform(19, 20)],
"magerr": [0.05, 0.06, np.random.uniform(0.01, 0.1)],
"limiting_mag": [20.0, 20.1, 20.2],
"magsys": ["ab", "ab", "ab"],
"filter": ["ztfr", "ztfg", "ztfr"],
"ra": [42.01, 42.01, 42.02],
"dec": [42.02, 42.01, 42.03],
"origin": [None, "lol", "lol"],
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
# PUTing photometry that contains
# the same first point, the second point with a different origin, and a new third point should succeed
# only the last two points will be ingested
status, data = api(
'PUT',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401, 59402],
"mag": [19.2, 19.3, np.random.uniform(19, 20)],
"magerr": [0.05, 0.06, np.random.uniform(0.01, 0.1)],
"limiting_mag": [20.0, 20.1, 20.2],
"magsys": ["ab", "ab", "ab"],
"filter": ["ztfr", "ztfg", "ztfr"],
"ra": [42.01, 42.01, 42.02],
"dec": [42.02, 42.01, 42.03],
"origin": [None, "omg", "lol"],
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
new_ids = data["data"]["ids"]
assert len(new_ids) == 3
assert len(set(new_ids).intersection(set(ids))) == 1
def test_token_user_post_put_get_photometry_data(
upload_data_token_two_groups, public_source, public_group, public_group2, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401, 59402],
"mag": [19.2, 19.3, np.random.uniform(19, 20)],
"magerr": [0.05, 0.06, np.random.uniform(0.01, 0.1)],
"limiting_mag": [20.0, 20.1, 20.2],
"magsys": ["ab", "ab", "ab"],
"filter": ["ztfr", "ztfg", "ztfr"],
"ra": [42.01, 42.01, 42.02],
"dec": [42.02, 42.01, 42.03],
"origin": [None, "lol", "lol"],
'group_ids': [public_group.id],
},
token=upload_data_token_two_groups,
)
assert status == 200
assert data['status'] == 'success'
ids = data["data"]["ids"]
assert len(ids) == 3
status, data = api(
'GET', f'photometry/{ids[0]}?format=flux', token=upload_data_token_two_groups
)
assert status == 200
assert data['status'] == 'success'
group_ids = [g["id"] for g in data['data']['groups']]
assert len(group_ids) == 2
assert public_group.id in group_ids
# PUTing photometry that contains
# the same first point, the second point with a different origin, and a new third point should succeed
# only the last two points will be ingested
status, data = api(
'PUT',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401],
"mag": [19.2, 19.3],
"magerr": [0.05, 0.06],
"limiting_mag": [20.0, 20.1],
"magsys": ["ab", "ab"],
"filter": ["ztfr", "ztfg"],
"ra": [42.01, 42.01],
"dec": [42.02, 42.01],
"origin": [None, "lol"],
'group_ids': [public_group.id, public_group2.id],
},
token=upload_data_token_two_groups,
)
assert status == 200
assert data['status'] == 'success'
new_ids = data["data"]["ids"]
assert len(new_ids) == 2
assert len(set(new_ids).intersection(set(ids))) == 2
status, data = api(
'GET', f'photometry/{ids[0]}?format=flux', token=upload_data_token_two_groups
)
assert status == 200
assert data['status'] == 'success'
group_ids = [g["id"] for g in data['data']['groups']]
assert len(group_ids) == 3
token_object = (
DBSession()
.query(Token)
.filter(Token.id == upload_data_token_two_groups)
.first()
)
assert sorted(group_ids) == sorted(
[
public_group.id,
public_group2.id,
token_object.created_by.single_user_group.id,
]
)
def test_post_photometry_multiple_groups(
upload_data_token_two_groups,
public_source_two_groups,
public_group,
public_group2,
ztf_camera,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id, public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['ra'] is None
assert data['data']['dec'] is None
assert data['data']['ra_unc'] is None
assert data['data']['dec_unc'] is None
assert len(data['data']['groups']) == 3
np.testing.assert_allclose(
data['data']['flux'], 12.24 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_post_photometry_all_groups(
upload_data_token_two_groups,
super_admin_token,
public_source_two_groups,
public_group,
public_group2,
ztf_camera,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': "all",
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET',
f'photometry/{photometry_id}?format=flux',
token=super_admin_token,
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['ra'] is None
assert data['data']['dec'] is None
assert data['data']['ra_unc'] is None
assert data['data']['dec_unc'] is None
assert len(data['data']['groups']) == 2
assert data['data']['groups'][0]['name'] == cfg['misc']['public_group_name']
np.testing.assert_allclose(
data['data']['flux'], 12.24 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_retrieve_photometry_group_membership_posted_by_other(
upload_data_token_two_groups,
view_only_token,
public_source_two_groups,
public_group,
public_group2,
ztf_camera,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id, public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=view_only_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['ra'] is None
assert data['data']['dec'] is None
assert data['data']['ra_unc'] is None
assert data['data']['dec_unc'] is None
np.testing.assert_allclose(
data['data']['flux'], 12.24 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_retrieve_photometry_error_group_membership_posted_by_other(
upload_data_token_two_groups,
view_only_token,
public_source_two_groups,
public_group,
public_group2,
ztf_camera,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=view_only_token
)
# `view_only_token only` belongs to `public_group`, not `public_group2`
assert status == 400
assert data['status'] == 'error'
assert "Insufficient permissions" in data['message']
def test_can_post_photometry_no_groups(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']['groups']) == 1
def test_can_post_photometry_empty_groups_list(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']['groups']) == 1
def test_token_user_post_mag_photometry_data_and_convert(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 21.0,
'magerr': 0.2,
'limiting_mag': 22.3,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
ab = sncosmo.get_magsystem('ab')
vega = sncosmo.get_magsystem('vega')
correction = 2.5 * np.log10(vega.zpbandflux('ztfg') / ab.zpbandflux('ztfg'))
np.testing.assert_allclose(
data['data']['flux'], 10 ** (-0.4 * (21.0 - correction - 23.9))
)
np.testing.assert_allclose(
data['data']['fluxerr'], 0.2 / (2.5 / np.log(10)) * data['data']['flux']
)
status, data = api('GET', f'photometry/{photometry_id}', token=upload_data_token)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['mag'], 21.0 - correction)
np.testing.assert_allclose(data['data']['magerr'], 0.2)
def test_token_user_post_and_get_different_systems_mag(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 21.0,
'magerr': 0.2,
'limiting_mag': 22.3,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET',
f'photometry/{photometry_id}?format=mag&magsys=vega',
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['magsys'] == 'vega'
ab = sncosmo.get_magsystem('ab')
vega = sncosmo.get_magsystem('vega')
correction = 2.5 * np.log10(vega.zpbandflux('ztfg') / ab.zpbandflux('ztfg'))
np.testing.assert_allclose(data['data']['mag'], 21.0)
np.testing.assert_allclose(data['data']['magerr'], 0.2)
np.testing.assert_allclose(data['data']['limiting_mag'], 22.3)
status, data = api(
'GET',
f'photometry/{photometry_id}?format=mag&magsys=ab',
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['mag'], 21.0 - correction)
np.testing.assert_allclose(data['data']['magerr'], 0.2)
np.testing.assert_allclose(data['data']['limiting_mag'], 22.3 - correction)
def test_token_user_post_and_get_different_systems_flux(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 21.0,
'magerr': 0.2,
'limiting_mag': 22.3,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET',
f'photometry/{photometry_id}?format=flux&magsys=vega',
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
ab = sncosmo.get_magsystem('ab')
vega = sncosmo.get_magsystem('vega')
correction = 2.5 * np.log10(vega.zpbandflux('ztfg') / ab.zpbandflux('ztfg'))
np.testing.assert_allclose(
data['data']['flux'], 10 ** (-0.4 * (21 - correction - 23.9))
)
np.testing.assert_allclose(
data['data']['fluxerr'], 0.2 / (2.5 / np.log(10)) * data['data']['flux']
)
np.testing.assert_allclose(data['data']['zp'], 23.9 + correction)
status, data = api(
'GET',
f'photometry/{photometry_id}?format=flux&magsys=ab',
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(
data['data']['flux'], 10 ** (-0.4 * (21 - correction - 23.9))
)
np.testing.assert_allclose(
data['data']['fluxerr'], 0.2 / (2.5 / np.log(10)) * data['data']['flux']
)
np.testing.assert_allclose(data['data']['zp'], 23.9)
def test_token_user_mixed_photometry_post(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 21.0,
'magerr': [0.2, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][1]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 10 ** (-0.4 * (21.0 - 23.9)))
np.testing.assert_allclose(
data['data']['fluxerr'], 0.1 / (2.5 / np.log(10)) * data['data']['flux']
)
# should fail as len(mag) != len(magerr)
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': [21.0],
'magerr': [0.2, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_mixed_mag_none_photometry_post(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': [0.2, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': [21.3, None],
'magerr': [0.2, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': [21.3, None],
'magerr': [None, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_post_photometry_limits(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': None,
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['flux'] is None
np.testing.assert_allclose(
data['data']['fluxerr'], 10 ** (-0.4 * (22.3 - 23.9)) / PHOT_DETECTION_THRESHOLD
)
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': None,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['flux'] is None
np.testing.assert_allclose(
data['data']['fluxerr'], 0.031 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_token_user_post_invalid_filter(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': None,
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'bessellv',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_post_photometry_data_series(
upload_data_token, public_source, ztf_camera, public_group
):
# valid request
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000.0, 58001.0, 58002.0],
'instrument_id': ztf_camera.id,
'flux': [12.24, 15.24, 12.24],
'fluxerr': [0.031, 0.029, 0.030],
'filter': ['ztfg', 'ztfg', 'ztfg'],
'zp': [25.0, 30.0, 21.2],
'magsys': ['ab', 'ab', 'ab'],
'ra': 264.1947917,
'dec': [50.5478333, 50.5478333 + 0.00001, 50.5478333],
'dec_unc': 0.2,
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']['ids']) == 3
photometry_id = data['data']['ids'][1]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert np.allclose(data['data']['flux'], 15.24 * 10 ** (-0.4 * (30 - 23.9)))
assert np.allclose(data['data']['dec'], 50.5478333 + 0.00001)
assert np.allclose(data['data']['dec_unc'], 0.2)
assert data['data']['ra_unc'] is None
# invalid request
status, data = api(
'POST',
'photometry',
data=[
{
'obj_id': str(public_source.id),
'mjd': 58000,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'filter': 'ztfg',
'zp': 25.0,
'magsys': 'ab',
'group_ids': [public_group.id],
},
{
'obj_id': str(public_source.id),
'mjd': 58001,
'instrument_id': ztf_camera.id,
'flux': 15.24,
'fluxerr': 0.031,
'filter': 'ztfg',
'zp': 30.0,
'magsys': 'ab',
'group_ids': [public_group.id],
},
{
'obj_id': str(public_source.id),
'mjd': 58002,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'filter': 'ztfg',
'zp': 21.2,
'magsys': 'vega',
'group_ids': [public_group.id],
},
],
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_post_photometry_no_access_token(
view_only_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=view_only_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_update_photometry(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api(
'PATCH',
f'photometry/{photometry_id}',
data={
'obj_id': str(public_source.id),
'flux': 11.0,
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
np.testing.assert_allclose(data['data']['flux'], 11.0 * 10 ** (-0.4 * (25 - 23.9)))
def test_token_user_cannot_update_unowned_photometry(
upload_data_token, manage_sources_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api(
'PATCH',
f'photometry/{photometry_id}',
data={
'obj_id': str(public_source.id),
'flux': 11.0,
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
},
token=manage_sources_token,
)
assert status == 400
def test_token_user_update_photometry_groups(
upload_data_token_two_groups,
manage_sources_token_two_groups,
public_source_two_groups,
ztf_camera,
public_group,
public_group2,
view_only_token,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id, public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=view_only_token
)
assert status == 200
assert data['status'] == 'success'
status, data = api(
'PATCH',
f'photometry/{photometry_id}',
data={
'obj_id': str(public_source.id),
'flux': 11.0,
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=view_only_token
)
assert status == 400
assert data['status'] == 'error'
assert "Insufficient permissions" in data["message"]
def test_user_can_delete_owned_photometry_data(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api('DELETE', f'photometry/{photometry_id}', token=upload_data_token)
assert status == 200
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 400
def test_user_cannot_delete_unowned_photometry_data(
upload_data_token, manage_sources_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api(
'DELETE', f'photometry/{photometry_id}', token=manage_sources_token
)
assert status == 400
def test_admin_can_delete_unowned_photometry_data(
upload_data_token, super_admin_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api('DELETE', f'photometry/{photometry_id}', token=super_admin_token)
assert status == 200
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 400
def test_token_user_retrieving_source_photometry_and_convert(
view_only_token, public_source
):
status, data = api(
'GET',
f'sources/{public_source.id}/photometry?format=flux&magsys=ab',
token=view_only_token,
)
assert status == 200
assert data['status'] == 'success'
assert isinstance(data['data'], list)
assert 'mjd' in data['data'][0]
assert 'ra_unc' in data['data'][0]
data['data'] = sorted(data['data'], key=lambda d: d['mjd'])
mag1_ab = -2.5 * np.log10(data['data'][0]['flux']) + data['data'][0]['zp']
magerr1_ab = 2.5 / np.log(10) * data['data'][0]['fluxerr'] / data['data'][0]['flux']
maglast_ab = -2.5 * np.log10(data['data'][-1]['flux']) + data['data'][-1]['zp']
magerrlast_ab = (
2.5 / np.log(10) * data['data'][-1]['fluxerr'] / data['data'][-1]['flux']
)
status, data = api(
'GET',
f'sources/{public_source.id}/photometry?format=mag&magsys=ab',
token=view_only_token,
)
assert status == 200
assert data['status'] == 'success'
data['data'] = sorted(data['data'], key=lambda d: d['mjd'])
assert np.allclose(mag1_ab, data['data'][0]['mag'])
assert np.allclose(magerr1_ab, data['data'][0]['magerr'])
assert np.allclose(maglast_ab, data['data'][-1]['mag'])
assert np.allclose(magerrlast_ab, data['data'][-1]['magerr'])
status, data = api(
'GET',
f'sources/{public_source.id}/photometry?format=flux&magsys=vega',
token=view_only_token,
)
data['data'] = sorted(data['data'], key=lambda d: d['mjd'])
mag1_vega = -2.5 * np.log10(data['data'][0]['flux']) + data['data'][0]['zp']
magerr1_vega = (
2.5 / np.log(10) * data['data'][0]['fluxerr'] / data['data'][0]['flux']
)
maglast_vega = -2.5 * np.log10(data['data'][-1]['flux']) + data['data'][-1]['zp']
magerrlast_vega = (
2.5 / np.log(10) * data['data'][-1]['fluxerr'] / data['data'][-1]['flux']
)
assert status == 200
assert data['status'] == 'success'
ab = sncosmo.get_magsystem('ab')
vega = sncosmo.get_magsystem('vega')
vega_to_ab = {
filter: 2.5 * np.log10(ab.zpbandflux(filter) / vega.zpbandflux(filter))
for filter in ['ztfg', 'ztfr', 'ztfi']
}
assert np.allclose(mag1_ab, mag1_vega + vega_to_ab[data['data'][0]['filter']])
assert np.allclose(magerr1_ab, magerr1_vega)
assert np.allclose(
maglast_ab, maglast_vega + vega_to_ab[data['data'][-1]['filter']]
)
assert np.allclose(magerrlast_ab, magerrlast_vega)
def test_token_user_retrieve_null_photometry(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': None,
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['flux'] is None
np.testing.assert_allclose(
data['data']['fluxerr'], 10 ** (-0.4 * (22.3 - 23.9)) / PHOT_DETECTION_THRESHOLD
)
status, data = api(
'GET', f'photometry/{photometry_id}?format=mag', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['mag'] is None
assert data['data']['magerr'] is None
def test_token_user_big_post(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000 + i for i in range(50000)],
'instrument_id': ztf_camera.id,
'mag': np.random.uniform(low=18, high=22, size=50000).tolist(),
'magerr': np.random.uniform(low=0.1, high=0.3, size=50000).tolist(),
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
def test_token_user_get_range_photometry(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000.0, 58500.0, 59000.0],
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
status, data = api(
'GET',
'photometry/range',
token=upload_data_token,
data={'instrument_ids': [ztf_camera.id], 'max_date': '2018-05-15T00:00:00'},
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']) == 1
status, data = api(
'GET',
'photometry/range?format=flux&magsys=vega',
token=upload_data_token,
data={'instrument_ids': [ztf_camera.id], 'max_date': '2019-02-01T00:00:00'},
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']) == 2
def test_reject_photometry_inf(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000.0, 58500.0, 59000.0],
'instrument_id': ztf_camera.id,
'flux': math.inf,
'fluxerr': math.inf,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': math.inf,
'magerr': math.inf,
'limiting_mag': 22.3,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 2.0,
'magerr': 23.0,
'limiting_mag': math.inf,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': None,
'limiting_mag': -math.inf,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000.0, 58500.0, 59000.0],
'instrument_id': ztf_camera.id,
'flux': None,
'fluxerr': math.inf,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_post_to_foreign_group_and_retrieve(
upload_data_token, public_source_two_groups, public_group2, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source_two_groups.id),
'mjd': [58000.0, 58500.0, 59000.0],
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
def test_problematic_photometry_1263(
upload_data_token, public_source, public_group, ztf_camera, public_group2
):
payload = {
"obj_id": public_source.id,
"group_ids": [public_group.id, public_group2.id],
"magsys": "ab",
"zp": 23.9,
"instrument_id": ztf_camera.id,
'mjd': [
59145.46447,
59149.50347,
59149.50347,
59150.50872,
59150.50872,
59152.51631,
59155.50801,
59152.51631,
59155.50801,
59156.48479,
59156.48479,
59126.48693,
59128.46834,
59130.50257,
59135.47329,
59137.4758,
59139.45454,
59141.47449,
59143.50987,
59143.50987,
59145.46447,
59145.50556,
59150.52806,
59150.52806,
59151.52116,
59151.52116,
59152.48332,
59152.48332,
59155.50022,
59155.50022,
59156.5383,
59126.53144,
59128.51928,
59130.53196,
59135.51196,
59137.51334,
59139.51507,
59141.51422,
59143.48529,
59143.48529,
59145.50556,
],
'filter': [
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
],
'flux': [
105.4095462,
100.4989583,
100.4986052,
97.45052422,
97.45411937,
91.71425204,
81.08011148,
91.71489652,
81.08110854,
59.37327478,
59.37452643,
None,
None,
None,
73.17457336,
82.20150344,
89.14970986,
102.1692537,
98.6103674,
98.60984771,
105.4086204,
100.8602976,
94.84847105,
94.85063718,
104.8945366,
104.8961951,
101.6093671,
101.6061542,
82.34545782,
82.34560248,
72.48165796,
None,
None,
None,
61.60270207,
72.73101786,
83.83015488,
98.70066264,
99.85275375,
99.84977174,
100.8608292,
],
'fluxerr': [
8.416851743,
10.10817406,
10.10811785,
11.74314252,
11.74356103,
11.40505647,
10.61680918,
11.40514417,
10.61696199,
10.6736128,
10.67382477,
13.51668635,
18.71327665,
9.509339593,
9.374956127,
9.638764985,
11.98599464,
10.42671307,
9.666542673,
9.666476165,
8.41682049,
8.680180822,
9.926401394,
9.926617677,
8.494021784,
8.494115051,
9.984017125,
9.983686084,
7.964270439,
7.964306468,
8.499519049,
12.65289244,
11.39803573,
9.771246706,
7.839855173,
7.592658663,
8.674127848,
8.965488502,
7.69135795,
7.691126885,
8.680212034,
],
}
status, data = api(
'POST',
'photometry',
data=payload,
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
payload = {
"obj_id": public_source.id,
"group_ids": "all",
"magsys": "ab",
"instrument_id": ztf_camera.id,
"filter": [
"ztfr",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
"ztfr",
"ztfr",
"ztfg",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
],
"mjd": [
59130.53195599979,
59135.473286999855,
59135.51195599977,
59137.47579859989,
59137.51334490022,
59139.45453700004,
59139.51506939996,
59141.474490699824,
59141.51422449993,
59143.48528939998,
59143.50987270009,
59145.46446759999,
59145.50555559993,
59149.50347220013,
59150.50871529989,
59150.52805559989,
59151.52115740022,
59152.4833217999,
59152.516307900194,
59155.50021990016,
59155.5080093001,
59156.4847916998,
59156.53829859989,
],
"limiting_mag": [
19.67770004272461,
20.11709976196289,
20.059200286865234,
20.281099319458008,
20.224000930786133,
19.809099197387695,
20.236799240112305,
20.57659912109375,
20.31290054321289,
20.414499282836914,
20.680700302124023,
20.57069969177246,
20.48349952697754,
20.242000579833984,
20.642900466918945,
20.029699325561523,
20.11090087890625,
19.808948516845703,
19.819171905517578,
19.9112606048584,
19.913991928100586,
19.600677490234375,
20.005773544311523,
],
"mag": [
None,
19.239099502563477,
19.426000595092773,
19.11280059814453,
19.24570083618164,
19.024700164794922,
19.09149932861328,
18.876699447631836,
18.914199829101562,
18.901599884033203,
18.915199279785156,
18.84280014038086,
18.89069938659668,
18.89459991455078,
18.92799949645996,
18.957399368286133,
18.848100662231445,
18.882665634155273,
18.993907928466797,
19.110898971557617,
19.127714157104492,
19.466022491455078,
19.24942970275879,
],
"magerr": [
None,
0.1391019970178604,
0.13817599415779114,
0.12731100618839264,
0.11334399878978729,
0.1459749937057495,
0.11234399676322937,
0.11080300062894821,
0.09862300008535385,
0.0836310014128685,
0.1064319983124733,
0.08669500052928925,
0.09344000369310379,
0.10920300334692001,
0.13083499670028687,
0.11362800002098083,
0.08791899681091309,
0.1066831648349762,
0.13501590490341187,
0.10501029342412949,
0.14216870069503784,
0.19518424570560455,
0.12731821835041046,
],
"ra": [
None,
134.5934039,
134.5934169,
134.5933773,
134.593404,
134.593372,
134.5933825,
134.5933984,
134.5933945,
134.5933917,
134.5933988,
134.5933848,
134.5933991,
134.5933909,
134.5934048,
134.5934296,
134.5934341,
134.593388,
134.5933606,
134.5933857,
134.5933939,
134.5933847,
134.5933954,
],
"dec": [
None,
15.0412865,
15.041256,
15.0412686,
15.0412482,
15.0412709,
15.0412572,
15.0412656,
15.0412765,
15.0412744,
15.0412673,
15.041271,
15.0412726,
15.0413061,
15.0412751,
15.041267,
15.0412856,
15.0412655,
15.0412913,
15.0412952,
15.0412737,
15.0411913,
15.0412605,
],
}
status, data = api(
'POST',
'photometry',
data=payload,
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
payload['group_ids'] = 'all'
status, data = api(
'PUT',
'photometry',
data=payload,
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
for id in data['data']['ids']:
status, data = api(
'GET', f'photometry/{id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']['groups']) == 2
def test_problematic_photometry_1276(
public_source, public_group, super_admin_token, ztf_camera
):
payload = {
"obj_id": public_source.id,
"group_ids": [public_group.id],
"magsys": "ab",
"instrument_id": ztf_camera.id,
"filter": [
"ztfg",
"ztfr",
"ztfr",
"ztfr",
"ztfr",
"ztfr",
"ztfr",
"ztfr",
"ztfg",
"ztfr",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
"ztfr",
"ztfr",
"ztfg",
"ztfg",
"ztfg",
"ztfg",
"ztfr",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
],
"mjd": [
59123.41299769981,
59129.472291700076,
59134.451203700155,
59136.46903940011,
59136.46903940011,
59139.295057899784,
59139.295057899784,
59139.295057899784,
59139.389629600104,
59141.36341439979,
59141.36341439979,
59141.414189800154,
59141.414189800154,
59143.318460599985,
59143.39145829994,
59145.34545140015,
59145.34545140015,
59145.34545140015,
59145.41583329998,
59145.41583329998,
59149.4703819002,
59151.32671299996,
59151.33918979997,
59153.33692129981,
59153.404351899866,
59155.220972199924,
59155.290161999874,
59157.360347200185,
59157.433634299785,
],
"limiting_mag": [
19.396099090576172,
20.23240089416504,
20.129100799560547,
20.493600845336914,
20.493600845336914,
20.422000885009766,
20.422000885009766,
20.422000885009766,
20.272199630737305,
20.18910026550293,
20.18910026550293,
20.846799850463867,
20.846799850463867,
20.624300003051758,
20.854000091552734,
20.628799438476562,
20.628799438476562,
20.628799438476562,
20.840900421142578,
20.840900421142578,
20.32859992980957,
19.60849952697754,
19.705799102783203,
19.47800064086914,
19.409400939941406,
19.462600708007812,
19.77630043029785,
19.678672790527344,
19.754121780395508,
],
"mag": [
18.43560028076172,
17.338199615478516,
16.25189971923828,
16.011999130249023,
16.09589958190918,
15.974100112915039,
15.891500473022461,
15.891500473022461,
None,
15.753999710083008,
15.819600105285645,
18.528499603271484,
18.57939910888672,
15.781000137329102,
18.309499740600586,
15.692399978637695,
15.692399978637695,
15.790599822998047,
18.305700302124023,
18.31529998779297,
18.13994026184082,
18.040000915527344,
15.505499839782715,
15.569299697875977,
17.812599182128906,
18.046100616455078,
None,
17.95865249633789,
15.475956916809082,
],
"magerr": [
0.18098600208759308,
0.12704600393772125,
0.03412500023841858,
0.018530000001192093,
0.09321600198745728,
0.1358170062303543,
0.017785999923944473,
0.017785999923944473,
None,
0.017010999843478203,
0.0650859996676445,
0.1969199925661087,
0.08772700279951096,
0.05595200136303902,
0.17250700294971466,
0.0137339998036623,
0.0137339998036623,
0.06520400196313858,
0.06727799773216248,
0.13235700130462646,
0.12975013256072998,
0.11010699719190598,
0.04597700014710426,
0.049855999648571014,
0.10752200335264206,
0.13239599764347076,
None,
0.139614999294281,
0.042450759559869766,
],
"ra": [
56.0478815,
56.0468989,
56.0478,
56.0478343,
56.0480658,
56.0475873,
56.047908,
56.0480877,
None,
56.0476469,
56.0477499,
56.047177,
56.0469751,
56.0480999,
56.0470656,
56.0477652,
56.0476761,
56.0476218,
56.0469908,
56.0472491,
56.0467978,
56.0472009,
56.0478524,
56.0476997,
56.0471999,
56.0476057,
None,
56.0473734,
56.0477336,
],
"dec": [
71.6368125,
71.6367721,
71.6367167,
71.6367615,
71.6367048,
71.6368681,
71.6368457,
71.6368389,
None,
71.6367596,
71.6365229,
71.6367611,
71.6368439,
71.6367764,
71.6368222,
71.6367943,
71.6368108,
71.6367366,
71.6368412,
71.6367895,
71.6368039,
71.6367984,
71.6367866,
71.6367788,
71.6368348,
71.6367571,
None,
71.6367753,
71.6367119,
],
}
status, data = api(
'PUT',
'photometry',
data=payload,
token=super_admin_token,
)
assert status == 400
assert data['status'] == 'error'
| 28.117459
| 106
| 0.508087
|
import math
import numpy as np
import sncosmo
from baselayer.app.env import load_env
from skyportal.models import DBSession, Token
from skyportal.tests import api
_, cfg = load_env()
PHOT_DETECTION_THRESHOLD = cfg["misc.photometry_detection_threshold_nsigma"]
def test_token_user_post_get_photometry_data(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['ra'] is None
assert data['data']['dec'] is None
assert data['data']['ra_unc'] is None
assert data['data']['dec_unc'] is None
np.testing.assert_allclose(
data['data']['flux'], 12.24 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_token_user_post_put_photometry_data(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401, 59402],
"mag": [19.2, 19.3, np.random.uniform(19, 20)],
"magerr": [0.05, 0.06, np.random.uniform(0.01, 0.1)],
"limiting_mag": [20.0, 20.1, 20.2],
"magsys": ["ab", "ab", "ab"],
"filter": ["ztfr", "ztfg", "ztfr"],
"ra": [42.01, 42.01, 42.02],
"dec": [42.02, 42.01, 42.03],
"origin": [None, "lol", "lol"],
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
ids = data["data"]["ids"]
assert len(ids) == 3
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401, 59402],
"mag": [19.2, 19.3, np.random.uniform(19, 20)],
"magerr": [0.05, 0.06, np.random.uniform(0.01, 0.1)],
"limiting_mag": [20.0, 20.1, 20.2],
"magsys": ["ab", "ab", "ab"],
"filter": ["ztfr", "ztfg", "ztfr"],
"ra": [42.01, 42.01, 42.02],
"dec": [42.02, 42.01, 42.03],
"origin": [None, "lol", "lol"],
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'PUT',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401, 59402],
"mag": [19.2, 19.3, np.random.uniform(19, 20)],
"magerr": [0.05, 0.06, np.random.uniform(0.01, 0.1)],
"limiting_mag": [20.0, 20.1, 20.2],
"magsys": ["ab", "ab", "ab"],
"filter": ["ztfr", "ztfg", "ztfr"],
"ra": [42.01, 42.01, 42.02],
"dec": [42.02, 42.01, 42.03],
"origin": [None, "omg", "lol"],
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
new_ids = data["data"]["ids"]
assert len(new_ids) == 3
assert len(set(new_ids).intersection(set(ids))) == 1
def test_token_user_post_put_get_photometry_data(
upload_data_token_two_groups, public_source, public_group, public_group2, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401, 59402],
"mag": [19.2, 19.3, np.random.uniform(19, 20)],
"magerr": [0.05, 0.06, np.random.uniform(0.01, 0.1)],
"limiting_mag": [20.0, 20.1, 20.2],
"magsys": ["ab", "ab", "ab"],
"filter": ["ztfr", "ztfg", "ztfr"],
"ra": [42.01, 42.01, 42.02],
"dec": [42.02, 42.01, 42.03],
"origin": [None, "lol", "lol"],
'group_ids': [public_group.id],
},
token=upload_data_token_two_groups,
)
assert status == 200
assert data['status'] == 'success'
ids = data["data"]["ids"]
assert len(ids) == 3
status, data = api(
'GET', f'photometry/{ids[0]}?format=flux', token=upload_data_token_two_groups
)
assert status == 200
assert data['status'] == 'success'
group_ids = [g["id"] for g in data['data']['groups']]
assert len(group_ids) == 2
assert public_group.id in group_ids
status, data = api(
'PUT',
'photometry',
data={
'obj_id': str(public_source.id),
'instrument_id': ztf_camera.id,
"mjd": [59400, 59401],
"mag": [19.2, 19.3],
"magerr": [0.05, 0.06],
"limiting_mag": [20.0, 20.1],
"magsys": ["ab", "ab"],
"filter": ["ztfr", "ztfg"],
"ra": [42.01, 42.01],
"dec": [42.02, 42.01],
"origin": [None, "lol"],
'group_ids': [public_group.id, public_group2.id],
},
token=upload_data_token_two_groups,
)
assert status == 200
assert data['status'] == 'success'
new_ids = data["data"]["ids"]
assert len(new_ids) == 2
assert len(set(new_ids).intersection(set(ids))) == 2
status, data = api(
'GET', f'photometry/{ids[0]}?format=flux', token=upload_data_token_two_groups
)
assert status == 200
assert data['status'] == 'success'
group_ids = [g["id"] for g in data['data']['groups']]
assert len(group_ids) == 3
token_object = (
DBSession()
.query(Token)
.filter(Token.id == upload_data_token_two_groups)
.first()
)
assert sorted(group_ids) == sorted(
[
public_group.id,
public_group2.id,
token_object.created_by.single_user_group.id,
]
)
def test_post_photometry_multiple_groups(
upload_data_token_two_groups,
public_source_two_groups,
public_group,
public_group2,
ztf_camera,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id, public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['ra'] is None
assert data['data']['dec'] is None
assert data['data']['ra_unc'] is None
assert data['data']['dec_unc'] is None
assert len(data['data']['groups']) == 3
np.testing.assert_allclose(
data['data']['flux'], 12.24 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_post_photometry_all_groups(
upload_data_token_two_groups,
super_admin_token,
public_source_two_groups,
public_group,
public_group2,
ztf_camera,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': "all",
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET',
f'photometry/{photometry_id}?format=flux',
token=super_admin_token,
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['ra'] is None
assert data['data']['dec'] is None
assert data['data']['ra_unc'] is None
assert data['data']['dec_unc'] is None
assert len(data['data']['groups']) == 2
assert data['data']['groups'][0]['name'] == cfg['misc']['public_group_name']
np.testing.assert_allclose(
data['data']['flux'], 12.24 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_retrieve_photometry_group_membership_posted_by_other(
upload_data_token_two_groups,
view_only_token,
public_source_two_groups,
public_group,
public_group2,
ztf_camera,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id, public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=view_only_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['ra'] is None
assert data['data']['dec'] is None
assert data['data']['ra_unc'] is None
assert data['data']['dec_unc'] is None
np.testing.assert_allclose(
data['data']['flux'], 12.24 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_retrieve_photometry_error_group_membership_posted_by_other(
upload_data_token_two_groups,
view_only_token,
public_source_two_groups,
public_group,
public_group2,
ztf_camera,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=view_only_token
)
assert status == 400
assert data['status'] == 'error'
assert "Insufficient permissions" in data['message']
def test_can_post_photometry_no_groups(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']['groups']) == 1
def test_can_post_photometry_empty_groups_list(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']['groups']) == 1
def test_token_user_post_mag_photometry_data_and_convert(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 21.0,
'magerr': 0.2,
'limiting_mag': 22.3,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
ab = sncosmo.get_magsystem('ab')
vega = sncosmo.get_magsystem('vega')
correction = 2.5 * np.log10(vega.zpbandflux('ztfg') / ab.zpbandflux('ztfg'))
np.testing.assert_allclose(
data['data']['flux'], 10 ** (-0.4 * (21.0 - correction - 23.9))
)
np.testing.assert_allclose(
data['data']['fluxerr'], 0.2 / (2.5 / np.log(10)) * data['data']['flux']
)
status, data = api('GET', f'photometry/{photometry_id}', token=upload_data_token)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['mag'], 21.0 - correction)
np.testing.assert_allclose(data['data']['magerr'], 0.2)
def test_token_user_post_and_get_different_systems_mag(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 21.0,
'magerr': 0.2,
'limiting_mag': 22.3,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET',
f'photometry/{photometry_id}?format=mag&magsys=vega',
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['magsys'] == 'vega'
ab = sncosmo.get_magsystem('ab')
vega = sncosmo.get_magsystem('vega')
correction = 2.5 * np.log10(vega.zpbandflux('ztfg') / ab.zpbandflux('ztfg'))
np.testing.assert_allclose(data['data']['mag'], 21.0)
np.testing.assert_allclose(data['data']['magerr'], 0.2)
np.testing.assert_allclose(data['data']['limiting_mag'], 22.3)
status, data = api(
'GET',
f'photometry/{photometry_id}?format=mag&magsys=ab',
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['mag'], 21.0 - correction)
np.testing.assert_allclose(data['data']['magerr'], 0.2)
np.testing.assert_allclose(data['data']['limiting_mag'], 22.3 - correction)
def test_token_user_post_and_get_different_systems_flux(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 21.0,
'magerr': 0.2,
'limiting_mag': 22.3,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET',
f'photometry/{photometry_id}?format=flux&magsys=vega',
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
ab = sncosmo.get_magsystem('ab')
vega = sncosmo.get_magsystem('vega')
correction = 2.5 * np.log10(vega.zpbandflux('ztfg') / ab.zpbandflux('ztfg'))
np.testing.assert_allclose(
data['data']['flux'], 10 ** (-0.4 * (21 - correction - 23.9))
)
np.testing.assert_allclose(
data['data']['fluxerr'], 0.2 / (2.5 / np.log(10)) * data['data']['flux']
)
np.testing.assert_allclose(data['data']['zp'], 23.9 + correction)
status, data = api(
'GET',
f'photometry/{photometry_id}?format=flux&magsys=ab',
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(
data['data']['flux'], 10 ** (-0.4 * (21 - correction - 23.9))
)
np.testing.assert_allclose(
data['data']['fluxerr'], 0.2 / (2.5 / np.log(10)) * data['data']['flux']
)
np.testing.assert_allclose(data['data']['zp'], 23.9)
def test_token_user_mixed_photometry_post(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 21.0,
'magerr': [0.2, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][1]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 10 ** (-0.4 * (21.0 - 23.9)))
np.testing.assert_allclose(
data['data']['fluxerr'], 0.1 / (2.5 / np.log(10)) * data['data']['flux']
)
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': [21.0],
'magerr': [0.2, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_mixed_mag_none_photometry_post(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': [0.2, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': [21.3, None],
'magerr': [0.2, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': [21.3, None],
'magerr': [None, 0.1],
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_post_photometry_limits(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': None,
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['flux'] is None
np.testing.assert_allclose(
data['data']['fluxerr'], 10 ** (-0.4 * (22.3 - 23.9)) / PHOT_DETECTION_THRESHOLD
)
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': None,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['flux'] is None
np.testing.assert_allclose(
data['data']['fluxerr'], 0.031 * 10 ** (-0.4 * (25.0 - 23.9))
)
def test_token_user_post_invalid_filter(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': None,
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'bessellv',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_post_photometry_data_series(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000.0, 58001.0, 58002.0],
'instrument_id': ztf_camera.id,
'flux': [12.24, 15.24, 12.24],
'fluxerr': [0.031, 0.029, 0.030],
'filter': ['ztfg', 'ztfg', 'ztfg'],
'zp': [25.0, 30.0, 21.2],
'magsys': ['ab', 'ab', 'ab'],
'ra': 264.1947917,
'dec': [50.5478333, 50.5478333 + 0.00001, 50.5478333],
'dec_unc': 0.2,
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']['ids']) == 3
photometry_id = data['data']['ids'][1]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert np.allclose(data['data']['flux'], 15.24 * 10 ** (-0.4 * (30 - 23.9)))
assert np.allclose(data['data']['dec'], 50.5478333 + 0.00001)
assert np.allclose(data['data']['dec_unc'], 0.2)
assert data['data']['ra_unc'] is None
status, data = api(
'POST',
'photometry',
data=[
{
'obj_id': str(public_source.id),
'mjd': 58000,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'filter': 'ztfg',
'zp': 25.0,
'magsys': 'ab',
'group_ids': [public_group.id],
},
{
'obj_id': str(public_source.id),
'mjd': 58001,
'instrument_id': ztf_camera.id,
'flux': 15.24,
'fluxerr': 0.031,
'filter': 'ztfg',
'zp': 30.0,
'magsys': 'ab',
'group_ids': [public_group.id],
},
{
'obj_id': str(public_source.id),
'mjd': 58002,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'filter': 'ztfg',
'zp': 21.2,
'magsys': 'vega',
'group_ids': [public_group.id],
},
],
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_post_photometry_no_access_token(
view_only_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=view_only_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_update_photometry(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api(
'PATCH',
f'photometry/{photometry_id}',
data={
'obj_id': str(public_source.id),
'flux': 11.0,
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
np.testing.assert_allclose(data['data']['flux'], 11.0 * 10 ** (-0.4 * (25 - 23.9)))
def test_token_user_cannot_update_unowned_photometry(
upload_data_token, manage_sources_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api(
'PATCH',
f'photometry/{photometry_id}',
data={
'obj_id': str(public_source.id),
'flux': 11.0,
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
},
token=manage_sources_token,
)
assert status == 400
def test_token_user_update_photometry_groups(
upload_data_token_two_groups,
manage_sources_token_two_groups,
public_source_two_groups,
ztf_camera,
public_group,
public_group2,
view_only_token,
):
upload_data_token = upload_data_token_two_groups
public_source = public_source_two_groups
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id, public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=view_only_token
)
assert status == 200
assert data['status'] == 'success'
status, data = api(
'PATCH',
f'photometry/{photometry_id}',
data={
'obj_id': str(public_source.id),
'flux': 11.0,
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=view_only_token
)
assert status == 400
assert data['status'] == 'error'
assert "Insufficient permissions" in data["message"]
def test_user_can_delete_owned_photometry_data(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api('DELETE', f'photometry/{photometry_id}', token=upload_data_token)
assert status == 200
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 400
def test_user_cannot_delete_unowned_photometry_data(
upload_data_token, manage_sources_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api(
'DELETE', f'photometry/{photometry_id}', token=manage_sources_token
)
assert status == 400
def test_admin_can_delete_unowned_photometry_data(
upload_data_token, super_admin_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfi',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
np.testing.assert_allclose(data['data']['flux'], 12.24 * 10 ** (-0.4 * (25 - 23.9)))
status, data = api('DELETE', f'photometry/{photometry_id}', token=super_admin_token)
assert status == 200
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 400
def test_token_user_retrieving_source_photometry_and_convert(
view_only_token, public_source
):
status, data = api(
'GET',
f'sources/{public_source.id}/photometry?format=flux&magsys=ab',
token=view_only_token,
)
assert status == 200
assert data['status'] == 'success'
assert isinstance(data['data'], list)
assert 'mjd' in data['data'][0]
assert 'ra_unc' in data['data'][0]
data['data'] = sorted(data['data'], key=lambda d: d['mjd'])
mag1_ab = -2.5 * np.log10(data['data'][0]['flux']) + data['data'][0]['zp']
magerr1_ab = 2.5 / np.log(10) * data['data'][0]['fluxerr'] / data['data'][0]['flux']
maglast_ab = -2.5 * np.log10(data['data'][-1]['flux']) + data['data'][-1]['zp']
magerrlast_ab = (
2.5 / np.log(10) * data['data'][-1]['fluxerr'] / data['data'][-1]['flux']
)
status, data = api(
'GET',
f'sources/{public_source.id}/photometry?format=mag&magsys=ab',
token=view_only_token,
)
assert status == 200
assert data['status'] == 'success'
data['data'] = sorted(data['data'], key=lambda d: d['mjd'])
assert np.allclose(mag1_ab, data['data'][0]['mag'])
assert np.allclose(magerr1_ab, data['data'][0]['magerr'])
assert np.allclose(maglast_ab, data['data'][-1]['mag'])
assert np.allclose(magerrlast_ab, data['data'][-1]['magerr'])
status, data = api(
'GET',
f'sources/{public_source.id}/photometry?format=flux&magsys=vega',
token=view_only_token,
)
data['data'] = sorted(data['data'], key=lambda d: d['mjd'])
mag1_vega = -2.5 * np.log10(data['data'][0]['flux']) + data['data'][0]['zp']
magerr1_vega = (
2.5 / np.log(10) * data['data'][0]['fluxerr'] / data['data'][0]['flux']
)
maglast_vega = -2.5 * np.log10(data['data'][-1]['flux']) + data['data'][-1]['zp']
magerrlast_vega = (
2.5 / np.log(10) * data['data'][-1]['fluxerr'] / data['data'][-1]['flux']
)
assert status == 200
assert data['status'] == 'success'
ab = sncosmo.get_magsystem('ab')
vega = sncosmo.get_magsystem('vega')
vega_to_ab = {
filter: 2.5 * np.log10(ab.zpbandflux(filter) / vega.zpbandflux(filter))
for filter in ['ztfg', 'ztfr', 'ztfi']
}
assert np.allclose(mag1_ab, mag1_vega + vega_to_ab[data['data'][0]['filter']])
assert np.allclose(magerr1_ab, magerr1_vega)
assert np.allclose(
maglast_ab, maglast_vega + vega_to_ab[data['data'][-1]['filter']]
)
assert np.allclose(magerrlast_ab, magerrlast_vega)
def test_token_user_retrieve_null_photometry(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': None,
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['flux'] is None
np.testing.assert_allclose(
data['data']['fluxerr'], 10 ** (-0.4 * (22.3 - 23.9)) / PHOT_DETECTION_THRESHOLD
)
status, data = api(
'GET', f'photometry/{photometry_id}?format=mag', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert data['data']['mag'] is None
assert data['data']['magerr'] is None
def test_token_user_big_post(
upload_data_token, public_source, ztf_camera, public_group
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000 + i for i in range(50000)],
'instrument_id': ztf_camera.id,
'mag': np.random.uniform(low=18, high=22, size=50000).tolist(),
'magerr': np.random.uniform(low=0.1, high=0.3, size=50000).tolist(),
'limiting_mag': 22.3,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
def test_token_user_get_range_photometry(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000.0, 58500.0, 59000.0],
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
status, data = api(
'GET',
'photometry/range',
token=upload_data_token,
data={'instrument_ids': [ztf_camera.id], 'max_date': '2018-05-15T00:00:00'},
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']) == 1
status, data = api(
'GET',
'photometry/range?format=flux&magsys=vega',
token=upload_data_token,
data={'instrument_ids': [ztf_camera.id], 'max_date': '2019-02-01T00:00:00'},
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']) == 2
def test_reject_photometry_inf(
upload_data_token, public_source, public_group, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000.0, 58500.0, 59000.0],
'instrument_id': ztf_camera.id,
'flux': math.inf,
'fluxerr': math.inf,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': math.inf,
'magerr': math.inf,
'limiting_mag': 22.3,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': 2.0,
'magerr': 23.0,
'limiting_mag': math.inf,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': 58000.0,
'instrument_id': ztf_camera.id,
'mag': None,
'magerr': None,
'limiting_mag': -math.inf,
'magsys': 'vega',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source.id),
'mjd': [58000.0, 58500.0, 59000.0],
'instrument_id': ztf_camera.id,
'flux': None,
'fluxerr': math.inf,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group.id],
},
token=upload_data_token,
)
assert status == 400
assert data['status'] == 'error'
def test_token_user_post_to_foreign_group_and_retrieve(
upload_data_token, public_source_two_groups, public_group2, ztf_camera
):
status, data = api(
'POST',
'photometry',
data={
'obj_id': str(public_source_two_groups.id),
'mjd': [58000.0, 58500.0, 59000.0],
'instrument_id': ztf_camera.id,
'flux': 12.24,
'fluxerr': 0.031,
'zp': 25.0,
'magsys': 'ab',
'filter': 'ztfg',
'group_ids': [public_group2.id],
},
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
photometry_id = data['data']['ids'][0]
status, data = api(
'GET', f'photometry/{photometry_id}?format=flux', token=upload_data_token
)
assert status == 200
def test_problematic_photometry_1263(
upload_data_token, public_source, public_group, ztf_camera, public_group2
):
payload = {
"obj_id": public_source.id,
"group_ids": [public_group.id, public_group2.id],
"magsys": "ab",
"zp": 23.9,
"instrument_id": ztf_camera.id,
'mjd': [
59145.46447,
59149.50347,
59149.50347,
59150.50872,
59150.50872,
59152.51631,
59155.50801,
59152.51631,
59155.50801,
59156.48479,
59156.48479,
59126.48693,
59128.46834,
59130.50257,
59135.47329,
59137.4758,
59139.45454,
59141.47449,
59143.50987,
59143.50987,
59145.46447,
59145.50556,
59150.52806,
59150.52806,
59151.52116,
59151.52116,
59152.48332,
59152.48332,
59155.50022,
59155.50022,
59156.5383,
59126.53144,
59128.51928,
59130.53196,
59135.51196,
59137.51334,
59139.51507,
59141.51422,
59143.48529,
59143.48529,
59145.50556,
],
'filter': [
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfg',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
'ztfr',
],
'flux': [
105.4095462,
100.4989583,
100.4986052,
97.45052422,
97.45411937,
91.71425204,
81.08011148,
91.71489652,
81.08110854,
59.37327478,
59.37452643,
None,
None,
None,
73.17457336,
82.20150344,
89.14970986,
102.1692537,
98.6103674,
98.60984771,
105.4086204,
100.8602976,
94.84847105,
94.85063718,
104.8945366,
104.8961951,
101.6093671,
101.6061542,
82.34545782,
82.34560248,
72.48165796,
None,
None,
None,
61.60270207,
72.73101786,
83.83015488,
98.70066264,
99.85275375,
99.84977174,
100.8608292,
],
'fluxerr': [
8.416851743,
10.10817406,
10.10811785,
11.74314252,
11.74356103,
11.40505647,
10.61680918,
11.40514417,
10.61696199,
10.6736128,
10.67382477,
13.51668635,
18.71327665,
9.509339593,
9.374956127,
9.638764985,
11.98599464,
10.42671307,
9.666542673,
9.666476165,
8.41682049,
8.680180822,
9.926401394,
9.926617677,
8.494021784,
8.494115051,
9.984017125,
9.983686084,
7.964270439,
7.964306468,
8.499519049,
12.65289244,
11.39803573,
9.771246706,
7.839855173,
7.592658663,
8.674127848,
8.965488502,
7.69135795,
7.691126885,
8.680212034,
],
}
status, data = api(
'POST',
'photometry',
data=payload,
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
payload = {
"obj_id": public_source.id,
"group_ids": "all",
"magsys": "ab",
"instrument_id": ztf_camera.id,
"filter": [
"ztfr",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
"ztfr",
"ztfr",
"ztfg",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
],
"mjd": [
59130.53195599979,
59135.473286999855,
59135.51195599977,
59137.47579859989,
59137.51334490022,
59139.45453700004,
59139.51506939996,
59141.474490699824,
59141.51422449993,
59143.48528939998,
59143.50987270009,
59145.46446759999,
59145.50555559993,
59149.50347220013,
59150.50871529989,
59150.52805559989,
59151.52115740022,
59152.4833217999,
59152.516307900194,
59155.50021990016,
59155.5080093001,
59156.4847916998,
59156.53829859989,
],
"limiting_mag": [
19.67770004272461,
20.11709976196289,
20.059200286865234,
20.281099319458008,
20.224000930786133,
19.809099197387695,
20.236799240112305,
20.57659912109375,
20.31290054321289,
20.414499282836914,
20.680700302124023,
20.57069969177246,
20.48349952697754,
20.242000579833984,
20.642900466918945,
20.029699325561523,
20.11090087890625,
19.808948516845703,
19.819171905517578,
19.9112606048584,
19.913991928100586,
19.600677490234375,
20.005773544311523,
],
"mag": [
None,
19.239099502563477,
19.426000595092773,
19.11280059814453,
19.24570083618164,
19.024700164794922,
19.09149932861328,
18.876699447631836,
18.914199829101562,
18.901599884033203,
18.915199279785156,
18.84280014038086,
18.89069938659668,
18.89459991455078,
18.92799949645996,
18.957399368286133,
18.848100662231445,
18.882665634155273,
18.993907928466797,
19.110898971557617,
19.127714157104492,
19.466022491455078,
19.24942970275879,
],
"magerr": [
None,
0.1391019970178604,
0.13817599415779114,
0.12731100618839264,
0.11334399878978729,
0.1459749937057495,
0.11234399676322937,
0.11080300062894821,
0.09862300008535385,
0.0836310014128685,
0.1064319983124733,
0.08669500052928925,
0.09344000369310379,
0.10920300334692001,
0.13083499670028687,
0.11362800002098083,
0.08791899681091309,
0.1066831648349762,
0.13501590490341187,
0.10501029342412949,
0.14216870069503784,
0.19518424570560455,
0.12731821835041046,
],
"ra": [
None,
134.5934039,
134.5934169,
134.5933773,
134.593404,
134.593372,
134.5933825,
134.5933984,
134.5933945,
134.5933917,
134.5933988,
134.5933848,
134.5933991,
134.5933909,
134.5934048,
134.5934296,
134.5934341,
134.593388,
134.5933606,
134.5933857,
134.5933939,
134.5933847,
134.5933954,
],
"dec": [
None,
15.0412865,
15.041256,
15.0412686,
15.0412482,
15.0412709,
15.0412572,
15.0412656,
15.0412765,
15.0412744,
15.0412673,
15.041271,
15.0412726,
15.0413061,
15.0412751,
15.041267,
15.0412856,
15.0412655,
15.0412913,
15.0412952,
15.0412737,
15.0411913,
15.0412605,
],
}
status, data = api(
'POST',
'photometry',
data=payload,
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
payload['group_ids'] = 'all'
status, data = api(
'PUT',
'photometry',
data=payload,
token=upload_data_token,
)
assert status == 200
assert data['status'] == 'success'
for id in data['data']['ids']:
status, data = api(
'GET', f'photometry/{id}?format=flux', token=upload_data_token
)
assert status == 200
assert data['status'] == 'success'
assert len(data['data']['groups']) == 2
def test_problematic_photometry_1276(
public_source, public_group, super_admin_token, ztf_camera
):
payload = {
"obj_id": public_source.id,
"group_ids": [public_group.id],
"magsys": "ab",
"instrument_id": ztf_camera.id,
"filter": [
"ztfg",
"ztfr",
"ztfr",
"ztfr",
"ztfr",
"ztfr",
"ztfr",
"ztfr",
"ztfg",
"ztfr",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
"ztfr",
"ztfr",
"ztfg",
"ztfg",
"ztfg",
"ztfg",
"ztfr",
"ztfr",
"ztfg",
"ztfg",
"ztfr",
"ztfg",
"ztfr",
],
"mjd": [
59123.41299769981,
59129.472291700076,
59134.451203700155,
59136.46903940011,
59136.46903940011,
59139.295057899784,
59139.295057899784,
59139.295057899784,
59139.389629600104,
59141.36341439979,
59141.36341439979,
59141.414189800154,
59141.414189800154,
59143.318460599985,
59143.39145829994,
59145.34545140015,
59145.34545140015,
59145.34545140015,
59145.41583329998,
59145.41583329998,
59149.4703819002,
59151.32671299996,
59151.33918979997,
59153.33692129981,
59153.404351899866,
59155.220972199924,
59155.290161999874,
59157.360347200185,
59157.433634299785,
],
"limiting_mag": [
19.396099090576172,
20.23240089416504,
20.129100799560547,
20.493600845336914,
20.493600845336914,
20.422000885009766,
20.422000885009766,
20.422000885009766,
20.272199630737305,
20.18910026550293,
20.18910026550293,
20.846799850463867,
20.846799850463867,
20.624300003051758,
20.854000091552734,
20.628799438476562,
20.628799438476562,
20.628799438476562,
20.840900421142578,
20.840900421142578,
20.32859992980957,
19.60849952697754,
19.705799102783203,
19.47800064086914,
19.409400939941406,
19.462600708007812,
19.77630043029785,
19.678672790527344,
19.754121780395508,
],
"mag": [
18.43560028076172,
17.338199615478516,
16.25189971923828,
16.011999130249023,
16.09589958190918,
15.974100112915039,
15.891500473022461,
15.891500473022461,
None,
15.753999710083008,
15.819600105285645,
18.528499603271484,
18.57939910888672,
15.781000137329102,
18.309499740600586,
15.692399978637695,
15.692399978637695,
15.790599822998047,
18.305700302124023,
18.31529998779297,
18.13994026184082,
18.040000915527344,
15.505499839782715,
15.569299697875977,
17.812599182128906,
18.046100616455078,
None,
17.95865249633789,
15.475956916809082,
],
"magerr": [
0.18098600208759308,
0.12704600393772125,
0.03412500023841858,
0.018530000001192093,
0.09321600198745728,
0.1358170062303543,
0.017785999923944473,
0.017785999923944473,
None,
0.017010999843478203,
0.0650859996676445,
0.1969199925661087,
0.08772700279951096,
0.05595200136303902,
0.17250700294971466,
0.0137339998036623,
0.0137339998036623,
0.06520400196313858,
0.06727799773216248,
0.13235700130462646,
0.12975013256072998,
0.11010699719190598,
0.04597700014710426,
0.049855999648571014,
0.10752200335264206,
0.13239599764347076,
None,
0.139614999294281,
0.042450759559869766,
],
"ra": [
56.0478815,
56.0468989,
56.0478,
56.0478343,
56.0480658,
56.0475873,
56.047908,
56.0480877,
None,
56.0476469,
56.0477499,
56.047177,
56.0469751,
56.0480999,
56.0470656,
56.0477652,
56.0476761,
56.0476218,
56.0469908,
56.0472491,
56.0467978,
56.0472009,
56.0478524,
56.0476997,
56.0471999,
56.0476057,
None,
56.0473734,
56.0477336,
],
"dec": [
71.6368125,
71.6367721,
71.6367167,
71.6367615,
71.6367048,
71.6368681,
71.6368457,
71.6368389,
None,
71.6367596,
71.6365229,
71.6367611,
71.6368439,
71.6367764,
71.6368222,
71.6367943,
71.6368108,
71.6367366,
71.6368412,
71.6367895,
71.6368039,
71.6367984,
71.6367866,
71.6367788,
71.6368348,
71.6367571,
None,
71.6367753,
71.6367119,
],
}
status, data = api(
'PUT',
'photometry',
data=payload,
token=super_admin_token,
)
assert status == 400
assert data['status'] == 'error'
| true
| true
|
f70a4532147a8e522aa5d500dd931c3e3804b846
| 573
|
py
|
Python
|
61. Rotate List.py
|
XinchaoGou/MyLeetCode
|
bba0ab077374f7da2cb1a990266bc59fa7ddf23c
|
[
"MIT"
] | null | null | null |
61. Rotate List.py
|
XinchaoGou/MyLeetCode
|
bba0ab077374f7da2cb1a990266bc59fa7ddf23c
|
[
"MIT"
] | null | null | null |
61. Rotate List.py
|
XinchaoGou/MyLeetCode
|
bba0ab077374f7da2cb1a990266bc59fa7ddf23c
|
[
"MIT"
] | null | null | null |
# Definition for singly-linked list.
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
if not (head and head.next and k) :
return head
fast = head
cnt = 1
while fast.next:
fast = fast.next
cnt += 1
fast.next = head
slow = head
for i in range(cnt - k%cnt - 1):
slow = slow.next
second = slow.next
slow.next = None
return second
| 26.045455
| 62
| 0.518325
|
class ListNode:
def __init__(self, x):
self.val = x
self.next = None
class Solution:
def rotateRight(self, head: ListNode, k: int) -> ListNode:
if not (head and head.next and k) :
return head
fast = head
cnt = 1
while fast.next:
fast = fast.next
cnt += 1
fast.next = head
slow = head
for i in range(cnt - k%cnt - 1):
slow = slow.next
second = slow.next
slow.next = None
return second
| true
| true
|
f70a459630f112b441d070f0a66321d5095da078
| 524
|
py
|
Python
|
src/python/pants/backend/python/tasks2/select_interpreter.py
|
oseemann/pants
|
628c83d5ab2706b0f64d69568c57a718ec7c5e2a
|
[
"Apache-2.0"
] | null | null | null |
src/python/pants/backend/python/tasks2/select_interpreter.py
|
oseemann/pants
|
628c83d5ab2706b0f64d69568c57a718ec7c5e2a
|
[
"Apache-2.0"
] | null | null | null |
src/python/pants/backend/python/tasks2/select_interpreter.py
|
oseemann/pants
|
628c83d5ab2706b0f64d69568c57a718ec7c5e2a
|
[
"Apache-2.0"
] | null | null | null |
# coding=utf-8
# Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.python.tasks import SelectInterpreter
from pants.base.deprecated import deprecated_module
deprecated_module('1.7.0.dev0', 'Use pants.backend.python.tasks instead')
SelectInterpreter = SelectInterpreter
| 34.933333
| 93
| 0.780534
|
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
from pants.backend.python.tasks import SelectInterpreter
from pants.base.deprecated import deprecated_module
deprecated_module('1.7.0.dev0', 'Use pants.backend.python.tasks instead')
SelectInterpreter = SelectInterpreter
| true
| true
|
f70a46062b1e1e15ef57f684873bcfe3c44c06da
| 1,117
|
py
|
Python
|
sources/table-maker.py
|
Nemo-Nowane/math-tools
|
b3518a309ec9cb137ff3e48e0384172243cf0a5f
|
[
"MIT"
] | 2
|
2019-11-12T16:47:57.000Z
|
2019-11-12T16:47:59.000Z
|
sources/table-maker.py
|
Nemo-Nowane/math-tools
|
b3518a309ec9cb137ff3e48e0384172243cf0a5f
|
[
"MIT"
] | null | null | null |
sources/table-maker.py
|
Nemo-Nowane/math-tools
|
b3518a309ec9cb137ff3e48e0384172243cf0a5f
|
[
"MIT"
] | null | null | null |
import sys #For CLI input
from decimal import Decimal, getcontext
"""I wanted to avoid importing this module but, the floats were messing up like
>>> 1-0.8
0.19999999999999996
So, I used it. Round function could helped. But using that produce -0.000, which seemed unaesthetic to me."""
getcontext().prec= 3 #Useless, since used %.3f at end.
inputlist = list(map(float,sys.argv[1:]))#Putting almk input in a list
u = inputlist.pop(-3)#Lower limit and starting point
v = inputlist.pop(-2) #Upper limit
s = inputlist.pop(-1) #Step deviation
def table (start, end, step, coefficient_list):
y = 0
xlist=[]
fxlist=[]
x = start
while start<= x and x<= end:
for j in range(len(coefficient_list)):
y = coefficient_list[j]*x**(len(coefficient_list) -1 -j) + y
xlist.append(x)
fxlist.append(y)
y = 0
x = float(Decimal(x) + Decimal(step))
print ("x\tf(x)")
for i in range(len(xlist)): #Printing in two columns, each column is 1 tab appart. (As long as the value of x lesser than 7 character.
print ( "%.3f\t%.3f" %(xlist[i], fxlist[i]))
table(u,v,s,inputlist)
| 38.517241
| 137
| 0.666965
|
import sys
from decimal import Decimal, getcontext
getcontext().prec= 3
inputlist = list(map(float,sys.argv[1:]))
u = inputlist.pop(-3)
v = inputlist.pop(-2)
s = inputlist.pop(-1)
def table (start, end, step, coefficient_list):
y = 0
xlist=[]
fxlist=[]
x = start
while start<= x and x<= end:
for j in range(len(coefficient_list)):
y = coefficient_list[j]*x**(len(coefficient_list) -1 -j) + y
xlist.append(x)
fxlist.append(y)
y = 0
x = float(Decimal(x) + Decimal(step))
print ("x\tf(x)")
for i in range(len(xlist)):
print ( "%.3f\t%.3f" %(xlist[i], fxlist[i]))
table(u,v,s,inputlist)
| true
| true
|
f70a4626dec6d64168d77420b7c15b1bac91957f
| 2,549
|
py
|
Python
|
src/adventofcode2020/solutions/day02.py
|
RoelAdriaans/adventofcode2020
|
e111c9fee52da6866f7b8b09a7e9c0fea8cc043e
|
[
"MIT"
] | 2
|
2020-12-01T07:58:31.000Z
|
2020-12-02T10:27:07.000Z
|
src/adventofcode2020/solutions/day02.py
|
RoelAdriaans/adventofcode2020
|
e111c9fee52da6866f7b8b09a7e9c0fea8cc043e
|
[
"MIT"
] | 57
|
2020-12-04T15:58:46.000Z
|
2022-03-31T04:08:01.000Z
|
src/adventofcode2020/solutions/day02.py
|
RoelAdriaans/adventofcode2020
|
e111c9fee52da6866f7b8b09a7e9c0fea8cc043e
|
[
"MIT"
] | null | null | null |
import re
from typing import NamedTuple
from adventofcode2020.utils.abstract import FileReaderSolution
class PassPol(NamedTuple):
at_least: int
at_most: int
letter: str
password: str
class Day02:
@staticmethod
def split(input_password) -> PassPol:
"""
Input `7-9 r: rrrkrrrrrnrrmj`, output is PassPol namedtuple
"""
results = re.match(r"(\d*)-(\d*) (.): (\w*)", input_password)
# Make mypy happy
assert results
passpol = PassPol(
at_least=int(results[1]),
at_most=int(results[2]),
letter=results[3],
password=results[4],
)
return passpol
class Day02PartA(Day02, FileReaderSolution):
def validate_passwords(self, policy: PassPol) -> bool:
"""
Validate that `password` is valid, with the PassPol policy list
"""
at_least = policy.at_least
at_most = policy.at_most
letter = policy.letter
# `letter` must be `at_least` time in the list, and at most `at_most` times
counts = policy.password.count(letter)
if counts < at_least:
# To little
return False
if counts > at_most:
# To much
return False
return True
def solve(self, input_data: str) -> int:
password_list = [
self.split(x.strip()) for x in input_data.split("\n") if len(x.strip()) >= 1
]
results = [self.validate_passwords(policy=x) for x in password_list]
return sum(results)
class Day02PartB(Day02, FileReaderSolution):
def validate_passwords(self, policy: PassPol) -> bool:
"""
Validate that `password` is valid, with the PassPol policy list
"""
first_char = policy.at_least
second_char = policy.at_most
letter = policy.letter
# `letter` must be at place first_char - 1 and second_char - 1,
# since it's 1-indexed and not zero indexed
# Exactly one of these positions must contain the given letter, xor.
if (policy.password[first_char - 1] == letter) ^ (
policy.password[second_char - 1] == letter
):
return True
else:
return False
def solve(self, input_data: str) -> int:
password_list = [
self.split(x.strip()) for x in input_data.split("\n") if len(x.strip()) >= 1
]
results = [self.validate_passwords(policy=x) for x in password_list]
return sum(results)
| 28.640449
| 88
| 0.587681
|
import re
from typing import NamedTuple
from adventofcode2020.utils.abstract import FileReaderSolution
class PassPol(NamedTuple):
at_least: int
at_most: int
letter: str
password: str
class Day02:
@staticmethod
def split(input_password) -> PassPol:
results = re.match(r"(\d*)-(\d*) (.): (\w*)", input_password)
assert results
passpol = PassPol(
at_least=int(results[1]),
at_most=int(results[2]),
letter=results[3],
password=results[4],
)
return passpol
class Day02PartA(Day02, FileReaderSolution):
def validate_passwords(self, policy: PassPol) -> bool:
at_least = policy.at_least
at_most = policy.at_most
letter = policy.letter
counts = policy.password.count(letter)
if counts < at_least:
return False
if counts > at_most:
return False
return True
def solve(self, input_data: str) -> int:
password_list = [
self.split(x.strip()) for x in input_data.split("\n") if len(x.strip()) >= 1
]
results = [self.validate_passwords(policy=x) for x in password_list]
return sum(results)
class Day02PartB(Day02, FileReaderSolution):
def validate_passwords(self, policy: PassPol) -> bool:
first_char = policy.at_least
second_char = policy.at_most
letter = policy.letter
# Exactly one of these positions must contain the given letter, xor.
if (policy.password[first_char - 1] == letter) ^ (
policy.password[second_char - 1] == letter
):
return True
else:
return False
def solve(self, input_data: str) -> int:
password_list = [
self.split(x.strip()) for x in input_data.split("\n") if len(x.strip()) >= 1
]
results = [self.validate_passwords(policy=x) for x in password_list]
return sum(results)
| true
| true
|
f70a4652ff4811a1690ee2590252d416d5140e59
| 253
|
py
|
Python
|
Ex02.py
|
RODRIGOKTK/Python-exercicios
|
f7985f2c277aae8b158bdeea4f2493febaaf06c5
|
[
"Unlicense"
] | null | null | null |
Ex02.py
|
RODRIGOKTK/Python-exercicios
|
f7985f2c277aae8b158bdeea4f2493febaaf06c5
|
[
"Unlicense"
] | null | null | null |
Ex02.py
|
RODRIGOKTK/Python-exercicios
|
f7985f2c277aae8b158bdeea4f2493febaaf06c5
|
[
"Unlicense"
] | null | null | null |
# Escreva um programa que leia um valor em metros e o exiba convertido em milímetros
n1=int(input('Coloque o(s) valor(es): '))
print ('O valor em metros: ', n1)
print ('O valore em centimetros: ', n1 * 100)
print ('O valor em milimetros: ', n1*1000)
| 50.6
| 85
| 0.687747
|
n1=int(input('Coloque o(s) valor(es): '))
print ('O valor em metros: ', n1)
print ('O valore em centimetros: ', n1 * 100)
print ('O valor em milimetros: ', n1*1000)
| true
| true
|
f70a469dab614ac4ee0bb8cf077e95026dc130fb
| 3,201
|
py
|
Python
|
mars/services/cluster/worker/locator.py
|
hxri/mars
|
f7864f00911883b94800b63856f0e57648d3d9b4
|
[
"Apache-2.0"
] | 2,413
|
2018-12-06T09:37:11.000Z
|
2022-03-30T15:47:39.000Z
|
mars/services/cluster/worker/locator.py
|
hxri/mars
|
f7864f00911883b94800b63856f0e57648d3d9b4
|
[
"Apache-2.0"
] | 1,335
|
2018-12-07T03:06:18.000Z
|
2022-03-31T11:45:57.000Z
|
mars/services/cluster/worker/locator.py
|
hxri/mars
|
f7864f00911883b94800b63856f0e57648d3d9b4
|
[
"Apache-2.0"
] | 329
|
2018-12-07T03:12:41.000Z
|
2022-03-29T21:49:57.000Z
|
# Copyright 1999-2021 Alibaba Group Holding Ltd.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import logging
from typing import List
from .... import oscar as mo
from ..core import NodeRole, NodeStatus
from ..locator import SupervisorLocatorActor
logger = logging.getLogger(__name__)
class WorkerSupervisorLocatorActor(SupervisorLocatorActor):
_node_role = NodeRole.WORKER
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._node_info_ref = None
@classmethod
def default_uid(cls):
return SupervisorLocatorActor.__name__
async def _set_supervisors(self, supervisors: List[str]):
await super()._set_supervisors(supervisors)
if supervisors and self._node_info_ref is None:
from ..supervisor.node_info import NodeInfoCollectorActor
supervisor_addr = self.get_supervisor(
NodeInfoCollectorActor.default_uid())
try:
self._node_info_ref = await mo.actor_ref(
uid=NodeInfoCollectorActor.default_uid(), address=supervisor_addr
)
except (OSError, mo.ServerClosed, mo.ActorNotExist):
self._node_info_ref = None
async def _get_supervisors_from_backend(self, filter_ready: bool = True):
try:
assert self._node_info_ref is not None
statuses = {NodeStatus.READY} if filter_ready \
else {NodeStatus.READY, NodeStatus.STARTING}
infos = await self._node_info_ref.get_nodes_info(
role=NodeRole.SUPERVISOR, statuses=statuses)
return list(infos)
except (AssertionError, OSError,
mo.ServerClosed, mo.ActorNotExist):
self._node_info_ref = None
return await self._backend.get_supervisors(filter_ready=filter_ready)
async def _watch_supervisor_from_node_info(self):
assert self._node_info_ref is not None
version = None
while True:
version, infos = await self._node_info_ref.watch_nodes(
role=NodeRole.SUPERVISOR, version=version)
yield list(infos)
async def _watch_supervisors_from_backend(self):
while True:
try:
async for supervisors in self._watch_supervisor_from_node_info():
yield supervisors
except (AssertionError, OSError,
mo.ServerClosed, mo.ActorNotExist):
self._node_info_ref = None
async for supervisors in self._backend.watch_supervisors():
yield supervisors
if self._node_info_ref is not None:
break
| 38.566265
| 85
| 0.663855
|
import logging
from typing import List
from .... import oscar as mo
from ..core import NodeRole, NodeStatus
from ..locator import SupervisorLocatorActor
logger = logging.getLogger(__name__)
class WorkerSupervisorLocatorActor(SupervisorLocatorActor):
_node_role = NodeRole.WORKER
def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
self._node_info_ref = None
@classmethod
def default_uid(cls):
return SupervisorLocatorActor.__name__
async def _set_supervisors(self, supervisors: List[str]):
await super()._set_supervisors(supervisors)
if supervisors and self._node_info_ref is None:
from ..supervisor.node_info import NodeInfoCollectorActor
supervisor_addr = self.get_supervisor(
NodeInfoCollectorActor.default_uid())
try:
self._node_info_ref = await mo.actor_ref(
uid=NodeInfoCollectorActor.default_uid(), address=supervisor_addr
)
except (OSError, mo.ServerClosed, mo.ActorNotExist):
self._node_info_ref = None
async def _get_supervisors_from_backend(self, filter_ready: bool = True):
try:
assert self._node_info_ref is not None
statuses = {NodeStatus.READY} if filter_ready \
else {NodeStatus.READY, NodeStatus.STARTING}
infos = await self._node_info_ref.get_nodes_info(
role=NodeRole.SUPERVISOR, statuses=statuses)
return list(infos)
except (AssertionError, OSError,
mo.ServerClosed, mo.ActorNotExist):
self._node_info_ref = None
return await self._backend.get_supervisors(filter_ready=filter_ready)
async def _watch_supervisor_from_node_info(self):
assert self._node_info_ref is not None
version = None
while True:
version, infos = await self._node_info_ref.watch_nodes(
role=NodeRole.SUPERVISOR, version=version)
yield list(infos)
async def _watch_supervisors_from_backend(self):
while True:
try:
async for supervisors in self._watch_supervisor_from_node_info():
yield supervisors
except (AssertionError, OSError,
mo.ServerClosed, mo.ActorNotExist):
self._node_info_ref = None
async for supervisors in self._backend.watch_supervisors():
yield supervisors
if self._node_info_ref is not None:
break
| true
| true
|
f70a497308aed482c7aaf58eb8e46ae4b8a07125
| 1,869
|
py
|
Python
|
feature_extraction/other_features.py
|
smolendawid/ubaar-competition
|
28de972d6beb13343c537fc030101be672a852a3
|
[
"Apache-2.0"
] | null | null | null |
feature_extraction/other_features.py
|
smolendawid/ubaar-competition
|
28de972d6beb13343c537fc030101be672a852a3
|
[
"Apache-2.0"
] | null | null | null |
feature_extraction/other_features.py
|
smolendawid/ubaar-competition
|
28de972d6beb13343c537fc030101be672a852a3
|
[
"Apache-2.0"
] | null | null | null |
import pandas as pd
from sklearn.preprocessing import LabelEncoder
def categorical_features(data, features):
features['vehicleType'] = data['vehicleType']
features['vehicleOption'] = data['vehicleOption']
features['vehicleTypeOption'] = [a + '_' + b for a, b in zip(data['vehicleType'].values,
data['vehicleOption'].values)]
cat_columns_clusters = ['cluster_dest_db', 'cluster_src_db', 'cluster_src_km', 'cluster_dest_km']
cat_columns_date = ['day', 'month']
cat_columns = ['vehicleType', 'vehicleOption', 'vehicleTypeOption']
# cat_columns += cat_columns_clusters
# cat_columns += cat_columns_date
features = pd.get_dummies(features, columns=cat_columns, drop_first=True)
features['day'] = LabelEncoder().fit_transform(features['day'])
features['month'] = LabelEncoder().fit_transform(features['month'])
return features
def raw_features(data, features):
features['weight'] = data['weight']
features['distanceKM'] = data['distanceKM']
features['taxiDurationMin'] = data['taxiDurationMin']
features['sourceLatitude'] = data['sourceLatitude']
features['sourceLongitude'] = data['sourceLongitude']
features['destinationLatitude'] = data['destinationLatitude']
features['destinationLongitude'] = data['destinationLongitude']
features['src_dest'] = (data['SourceState'] == data['destinationState'])
features['ave_speed'] = data['distanceKM'] / data['taxiDurationMin']
import numpy as np
features['weight_dur'] = np.log((data['taxiDurationMin'] + 30 * data['weight']))
features['weight_dist_dur'] = np.log(1. + (10. + data['weight']) * (100. + data['distanceKM']) *
(1000. + data['taxiDurationMin']))
features['price'] = data['price']
return features
| 39.765957
| 101
| 0.657036
|
import pandas as pd
from sklearn.preprocessing import LabelEncoder
def categorical_features(data, features):
features['vehicleType'] = data['vehicleType']
features['vehicleOption'] = data['vehicleOption']
features['vehicleTypeOption'] = [a + '_' + b for a, b in zip(data['vehicleType'].values,
data['vehicleOption'].values)]
cat_columns_clusters = ['cluster_dest_db', 'cluster_src_db', 'cluster_src_km', 'cluster_dest_km']
cat_columns_date = ['day', 'month']
cat_columns = ['vehicleType', 'vehicleOption', 'vehicleTypeOption']
features = pd.get_dummies(features, columns=cat_columns, drop_first=True)
features['day'] = LabelEncoder().fit_transform(features['day'])
features['month'] = LabelEncoder().fit_transform(features['month'])
return features
def raw_features(data, features):
features['weight'] = data['weight']
features['distanceKM'] = data['distanceKM']
features['taxiDurationMin'] = data['taxiDurationMin']
features['sourceLatitude'] = data['sourceLatitude']
features['sourceLongitude'] = data['sourceLongitude']
features['destinationLatitude'] = data['destinationLatitude']
features['destinationLongitude'] = data['destinationLongitude']
features['src_dest'] = (data['SourceState'] == data['destinationState'])
features['ave_speed'] = data['distanceKM'] / data['taxiDurationMin']
import numpy as np
features['weight_dur'] = np.log((data['taxiDurationMin'] + 30 * data['weight']))
features['weight_dist_dur'] = np.log(1. + (10. + data['weight']) * (100. + data['distanceKM']) *
(1000. + data['taxiDurationMin']))
features['price'] = data['price']
return features
| true
| true
|
f70a4a0a16f7da68ca08d7e7084d6510f50b54c1
| 324
|
py
|
Python
|
pirates/minigame/DistributedLockAI.py
|
Willy5s/Pirates-Online-Rewritten
|
7434cf98d9b7c837d57c181e5dabd02ddf98acb7
|
[
"BSD-3-Clause"
] | 81
|
2018-04-08T18:14:24.000Z
|
2022-01-11T07:22:15.000Z
|
pirates/minigame/DistributedLockAI.py
|
Willy5s/Pirates-Online-Rewritten
|
7434cf98d9b7c837d57c181e5dabd02ddf98acb7
|
[
"BSD-3-Clause"
] | 4
|
2018-09-13T20:41:22.000Z
|
2022-01-08T06:57:00.000Z
|
pirates/minigame/DistributedLockAI.py
|
Willy5s/Pirates-Online-Rewritten
|
7434cf98d9b7c837d57c181e5dabd02ddf98acb7
|
[
"BSD-3-Clause"
] | 26
|
2018-05-26T12:49:27.000Z
|
2021-09-11T09:11:59.000Z
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.directnotify import DirectNotifyGlobal
class DistributedLockAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLockAI')
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
| 40.5
| 77
| 0.82716
|
from direct.distributed.DistributedObjectAI import DistributedObjectAI
from direct.directnotify import DirectNotifyGlobal
class DistributedLockAI(DistributedObjectAI):
notify = DirectNotifyGlobal.directNotify.newCategory('DistributedLockAI')
def __init__(self, air):
DistributedObjectAI.__init__(self, air)
| true
| true
|
f70a4a6c1279c72c79f69db92d9b3c7c9e801c66
| 258,530
|
py
|
Python
|
instances/passenger_demand/pas-20210422-1717-int4e-1/60.py
|
LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure
|
bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11
|
[
"BSD-3-Clause"
] | null | null | null |
instances/passenger_demand/pas-20210422-1717-int4e-1/60.py
|
LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure
|
bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11
|
[
"BSD-3-Clause"
] | null | null | null |
instances/passenger_demand/pas-20210422-1717-int4e-1/60.py
|
LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure
|
bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11
|
[
"BSD-3-Clause"
] | null | null | null |
"""
PASSENGERS
"""
numPassengers = 7667
passenger_arriving = (
(2, 0, 1, 3, 1, 1, 2, 1, 0, 1, 0, 0, 0, 3, 1, 3, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0), # 0
(2, 2, 4, 2, 0, 1, 0, 1, 2, 0, 0, 1, 0, 4, 6, 1, 2, 3, 0, 1, 1, 1, 0, 0, 0, 0), # 1
(2, 2, 3, 3, 0, 2, 0, 1, 1, 0, 1, 0, 0, 2, 1, 4, 2, 2, 0, 3, 1, 1, 0, 0, 1, 0), # 2
(6, 1, 2, 1, 3, 1, 0, 1, 2, 1, 0, 0, 0, 2, 1, 2, 3, 1, 0, 0, 1, 0, 1, 0, 1, 0), # 3
(2, 5, 3, 5, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 5, 1, 1, 2, 1, 1, 1, 0, 1, 2, 0, 0), # 4
(2, 2, 3, 1, 1, 1, 0, 1, 1, 0, 2, 0, 0, 1, 1, 1, 1, 1, 3, 3, 2, 0, 0, 0, 1, 0), # 5
(4, 5, 1, 4, 0, 2, 0, 1, 1, 2, 2, 1, 0, 4, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0), # 6
(1, 2, 3, 6, 0, 1, 2, 1, 0, 0, 2, 1, 0, 1, 2, 2, 1, 5, 1, 0, 4, 2, 0, 3, 0, 0), # 7
(1, 4, 1, 3, 1, 2, 1, 0, 0, 1, 0, 0, 0, 4, 3, 4, 4, 1, 0, 0, 0, 2, 0, 2, 1, 0), # 8
(4, 0, 1, 2, 1, 2, 2, 1, 1, 1, 0, 0, 0, 3, 5, 2, 3, 2, 3, 1, 3, 0, 0, 1, 0, 0), # 9
(1, 0, 0, 4, 2, 2, 2, 1, 0, 0, 1, 0, 0, 7, 3, 4, 0, 0, 5, 1, 2, 0, 2, 0, 0, 0), # 10
(3, 3, 3, 4, 3, 1, 0, 0, 2, 1, 0, 0, 0, 5, 3, 4, 1, 1, 1, 1, 2, 1, 3, 1, 0, 0), # 11
(3, 3, 4, 2, 3, 0, 0, 1, 2, 2, 1, 0, 0, 2, 3, 3, 4, 3, 3, 0, 1, 0, 0, 1, 0, 0), # 12
(3, 3, 1, 1, 3, 1, 1, 0, 2, 2, 1, 1, 0, 4, 4, 1, 2, 1, 1, 0, 2, 3, 3, 1, 0, 0), # 13
(3, 2, 3, 3, 1, 1, 1, 1, 1, 1, 0, 0, 0, 3, 2, 2, 6, 7, 2, 3, 1, 1, 0, 1, 1, 0), # 14
(6, 1, 1, 2, 2, 1, 0, 1, 2, 0, 0, 0, 0, 3, 4, 4, 0, 4, 1, 3, 0, 2, 1, 0, 0, 0), # 15
(4, 3, 0, 3, 0, 1, 3, 1, 1, 2, 1, 1, 0, 2, 6, 2, 3, 2, 2, 2, 0, 1, 2, 0, 0, 0), # 16
(5, 11, 1, 7, 4, 2, 0, 1, 3, 0, 1, 0, 0, 3, 1, 5, 2, 6, 0, 1, 2, 1, 0, 0, 0, 0), # 17
(6, 4, 2, 4, 1, 1, 2, 0, 0, 0, 0, 0, 0, 5, 2, 0, 1, 5, 0, 1, 0, 0, 0, 2, 2, 0), # 18
(6, 6, 3, 3, 4, 0, 2, 2, 2, 1, 0, 1, 0, 3, 3, 5, 2, 4, 3, 0, 1, 1, 0, 0, 1, 0), # 19
(8, 6, 3, 4, 2, 2, 4, 3, 3, 1, 0, 1, 0, 3, 0, 1, 4, 3, 1, 3, 1, 2, 3, 2, 0, 0), # 20
(5, 4, 2, 6, 2, 2, 1, 1, 4, 2, 3, 0, 0, 4, 4, 2, 2, 8, 4, 1, 2, 0, 0, 2, 0, 0), # 21
(3, 4, 4, 3, 4, 1, 1, 0, 1, 2, 1, 0, 0, 3, 2, 0, 1, 2, 2, 2, 1, 1, 2, 2, 0, 0), # 22
(1, 2, 5, 4, 3, 0, 2, 4, 3, 2, 0, 0, 0, 7, 5, 2, 3, 6, 3, 2, 3, 3, 1, 0, 0, 0), # 23
(2, 8, 1, 3, 1, 3, 1, 3, 2, 1, 1, 1, 0, 6, 5, 0, 3, 2, 3, 1, 0, 1, 4, 1, 0, 0), # 24
(7, 3, 3, 3, 3, 0, 1, 0, 2, 1, 1, 0, 0, 4, 0, 2, 4, 4, 4, 0, 0, 0, 1, 0, 1, 0), # 25
(4, 0, 2, 3, 2, 4, 1, 1, 1, 2, 1, 0, 0, 5, 1, 3, 2, 1, 1, 1, 0, 0, 1, 0, 0, 0), # 26
(5, 4, 6, 4, 1, 1, 1, 2, 3, 2, 4, 0, 0, 3, 4, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0), # 27
(3, 5, 4, 2, 3, 2, 1, 1, 2, 0, 2, 1, 0, 3, 4, 6, 2, 6, 1, 1, 0, 1, 0, 1, 0, 0), # 28
(3, 4, 2, 9, 0, 2, 2, 2, 4, 1, 0, 0, 0, 5, 3, 3, 1, 5, 2, 0, 2, 1, 2, 0, 0, 0), # 29
(6, 4, 1, 2, 4, 1, 1, 3, 1, 0, 1, 1, 0, 5, 4, 3, 2, 2, 1, 3, 0, 3, 1, 0, 3, 0), # 30
(1, 4, 4, 5, 1, 2, 2, 2, 3, 1, 1, 0, 0, 9, 4, 1, 4, 4, 1, 1, 1, 5, 2, 0, 0, 0), # 31
(8, 4, 5, 0, 3, 1, 1, 1, 1, 1, 1, 1, 0, 3, 1, 4, 1, 5, 2, 1, 3, 0, 0, 1, 0, 0), # 32
(3, 6, 2, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 4, 8, 2, 4, 7, 2, 5, 1, 1, 3, 1, 0, 0), # 33
(5, 4, 3, 2, 4, 1, 4, 2, 0, 0, 1, 0, 0, 2, 5, 9, 4, 2, 1, 4, 0, 2, 1, 0, 0, 0), # 34
(3, 3, 3, 2, 4, 3, 2, 3, 2, 0, 0, 0, 0, 5, 3, 1, 3, 0, 1, 1, 1, 1, 1, 0, 0, 0), # 35
(4, 3, 2, 8, 3, 2, 2, 1, 2, 0, 0, 0, 0, 3, 2, 2, 5, 3, 1, 1, 0, 2, 0, 0, 0, 0), # 36
(5, 2, 2, 2, 7, 1, 0, 3, 2, 1, 0, 0, 0, 7, 2, 4, 1, 4, 4, 3, 0, 3, 0, 2, 0, 0), # 37
(2, 6, 4, 10, 3, 1, 3, 0, 4, 0, 0, 1, 0, 3, 2, 4, 0, 3, 1, 0, 2, 2, 0, 0, 0, 0), # 38
(3, 2, 5, 1, 5, 3, 4, 1, 0, 0, 2, 0, 0, 4, 4, 3, 3, 5, 4, 1, 0, 0, 1, 0, 1, 0), # 39
(3, 5, 1, 5, 1, 2, 4, 3, 2, 2, 0, 0, 0, 1, 5, 1, 1, 3, 2, 0, 0, 1, 1, 0, 1, 0), # 40
(3, 1, 2, 7, 5, 1, 2, 1, 1, 1, 0, 0, 0, 0, 3, 5, 3, 6, 4, 1, 2, 1, 1, 0, 0, 0), # 41
(5, 3, 4, 4, 4, 3, 1, 0, 1, 1, 1, 0, 0, 4, 4, 1, 4, 2, 1, 3, 0, 2, 1, 1, 0, 0), # 42
(3, 9, 6, 6, 3, 2, 5, 4, 1, 4, 0, 0, 0, 1, 1, 4, 2, 2, 0, 2, 2, 0, 1, 2, 1, 0), # 43
(2, 2, 1, 3, 1, 2, 4, 0, 2, 0, 2, 0, 0, 3, 4, 2, 1, 2, 1, 3, 2, 1, 2, 0, 0, 0), # 44
(8, 6, 1, 3, 3, 2, 3, 0, 1, 0, 0, 1, 0, 4, 8, 2, 3, 4, 2, 3, 0, 1, 1, 1, 0, 0), # 45
(5, 6, 2, 0, 2, 1, 1, 2, 0, 0, 0, 1, 0, 6, 3, 3, 3, 4, 2, 1, 1, 1, 2, 1, 0, 0), # 46
(6, 5, 3, 5, 4, 2, 0, 2, 1, 2, 2, 0, 0, 0, 3, 3, 2, 6, 2, 2, 2, 0, 2, 0, 0, 0), # 47
(3, 6, 0, 3, 5, 2, 1, 2, 3, 1, 0, 0, 0, 4, 4, 4, 0, 3, 2, 1, 2, 2, 1, 0, 0, 0), # 48
(4, 3, 5, 7, 3, 2, 1, 1, 2, 1, 0, 0, 0, 2, 4, 3, 1, 4, 2, 1, 1, 2, 2, 0, 0, 0), # 49
(5, 7, 1, 3, 6, 2, 0, 1, 2, 1, 1, 1, 0, 7, 4, 3, 2, 3, 5, 4, 0, 0, 1, 0, 1, 0), # 50
(5, 3, 3, 7, 2, 1, 3, 0, 0, 0, 0, 0, 0, 1, 4, 1, 4, 3, 1, 0, 2, 2, 3, 1, 1, 0), # 51
(1, 4, 4, 9, 3, 4, 1, 1, 2, 0, 2, 0, 0, 3, 5, 3, 1, 6, 1, 0, 0, 0, 1, 0, 0, 0), # 52
(4, 3, 4, 3, 5, 2, 2, 2, 4, 1, 1, 2, 0, 2, 7, 2, 3, 2, 2, 1, 0, 1, 1, 1, 0, 0), # 53
(7, 6, 7, 4, 5, 2, 2, 2, 0, 0, 0, 1, 0, 5, 1, 2, 1, 3, 4, 2, 2, 1, 0, 0, 0, 0), # 54
(5, 4, 2, 5, 4, 0, 2, 1, 1, 0, 0, 0, 0, 3, 2, 3, 3, 5, 1, 3, 0, 1, 0, 0, 0, 0), # 55
(3, 3, 4, 4, 4, 2, 0, 1, 1, 0, 1, 0, 0, 5, 3, 2, 1, 3, 5, 0, 2, 0, 2, 1, 0, 0), # 56
(3, 4, 0, 5, 2, 3, 1, 1, 3, 1, 0, 1, 0, 4, 3, 7, 1, 2, 2, 1, 1, 2, 0, 0, 0, 0), # 57
(7, 3, 6, 3, 2, 0, 4, 0, 1, 0, 0, 0, 0, 6, 3, 2, 0, 2, 0, 3, 3, 2, 0, 0, 0, 0), # 58
(5, 6, 5, 3, 4, 1, 3, 2, 1, 0, 0, 0, 0, 4, 1, 0, 1, 3, 1, 0, 0, 2, 0, 1, 1, 0), # 59
(7, 4, 4, 4, 2, 0, 0, 0, 2, 1, 3, 0, 0, 0, 6, 0, 1, 4, 0, 1, 1, 2, 2, 1, 0, 0), # 60
(5, 1, 0, 3, 0, 0, 1, 0, 4, 1, 1, 0, 0, 1, 5, 3, 1, 3, 1, 2, 3, 3, 1, 1, 1, 0), # 61
(5, 3, 2, 4, 2, 3, 1, 1, 3, 0, 0, 0, 0, 6, 4, 5, 1, 2, 2, 2, 1, 1, 3, 1, 0, 0), # 62
(7, 3, 8, 5, 3, 0, 1, 1, 1, 1, 0, 1, 0, 3, 1, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0), # 63
(5, 4, 1, 4, 3, 1, 5, 1, 2, 2, 0, 0, 0, 6, 1, 2, 5, 3, 1, 1, 0, 1, 2, 1, 0, 0), # 64
(2, 3, 4, 3, 2, 3, 3, 2, 2, 1, 0, 0, 0, 5, 3, 1, 3, 3, 1, 0, 1, 0, 1, 2, 1, 0), # 65
(3, 6, 6, 6, 3, 0, 5, 1, 1, 1, 0, 0, 0, 6, 2, 3, 0, 4, 4, 5, 0, 1, 1, 0, 0, 0), # 66
(1, 3, 3, 8, 2, 0, 2, 2, 3, 2, 1, 0, 0, 7, 2, 2, 1, 1, 1, 0, 0, 0, 2, 1, 0, 0), # 67
(6, 5, 1, 2, 4, 2, 0, 1, 2, 1, 0, 0, 0, 4, 3, 5, 3, 3, 0, 1, 1, 3, 1, 0, 0, 0), # 68
(4, 1, 2, 3, 7, 0, 3, 4, 1, 4, 0, 0, 0, 2, 3, 2, 2, 7, 1, 4, 0, 1, 0, 0, 0, 0), # 69
(6, 5, 6, 1, 5, 1, 0, 0, 2, 1, 1, 0, 0, 3, 4, 1, 2, 3, 1, 1, 0, 0, 1, 0, 0, 0), # 70
(4, 6, 3, 4, 4, 0, 0, 0, 1, 1, 0, 1, 0, 3, 3, 2, 1, 3, 2, 0, 0, 1, 0, 0, 3, 0), # 71
(3, 3, 2, 7, 2, 0, 0, 3, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, 1, 4, 1, 0, 0, 0, 0, 0), # 72
(4, 4, 4, 2, 3, 1, 2, 0, 1, 2, 0, 1, 0, 5, 3, 1, 1, 5, 1, 2, 1, 1, 0, 0, 1, 0), # 73
(2, 1, 6, 2, 4, 3, 1, 1, 1, 1, 0, 0, 0, 2, 3, 1, 3, 3, 1, 2, 0, 4, 0, 1, 1, 0), # 74
(4, 2, 3, 2, 4, 1, 0, 0, 3, 1, 0, 0, 0, 3, 8, 5, 0, 5, 1, 1, 1, 0, 1, 4, 0, 0), # 75
(4, 3, 6, 6, 2, 1, 1, 2, 2, 1, 1, 0, 0, 11, 3, 2, 4, 3, 2, 0, 2, 2, 1, 0, 0, 0), # 76
(3, 8, 4, 2, 4, 2, 0, 1, 1, 0, 1, 0, 0, 4, 3, 3, 4, 2, 0, 1, 2, 1, 0, 0, 0, 0), # 77
(2, 5, 5, 1, 0, 2, 3, 1, 3, 2, 1, 0, 0, 4, 5, 3, 2, 2, 1, 4, 1, 2, 0, 0, 1, 0), # 78
(3, 3, 3, 1, 0, 1, 1, 1, 2, 0, 0, 2, 0, 3, 2, 4, 0, 8, 1, 1, 1, 1, 2, 1, 0, 0), # 79
(3, 3, 2, 3, 2, 2, 1, 2, 1, 3, 0, 0, 0, 4, 4, 3, 1, 4, 0, 2, 1, 0, 3, 4, 0, 0), # 80
(2, 2, 3, 2, 2, 1, 0, 0, 3, 1, 0, 1, 0, 2, 4, 3, 5, 6, 1, 4, 1, 0, 0, 1, 1, 0), # 81
(6, 4, 4, 2, 3, 0, 2, 0, 4, 0, 0, 0, 0, 3, 1, 3, 3, 4, 6, 1, 0, 3, 3, 1, 0, 0), # 82
(2, 6, 4, 2, 3, 1, 3, 1, 3, 1, 0, 0, 0, 6, 0, 2, 0, 3, 2, 0, 0, 2, 2, 0, 0, 0), # 83
(4, 5, 7, 1, 3, 1, 1, 0, 2, 1, 1, 0, 0, 4, 3, 3, 3, 6, 3, 1, 0, 2, 1, 1, 0, 0), # 84
(2, 3, 6, 4, 2, 1, 1, 1, 2, 0, 0, 1, 0, 9, 1, 0, 3, 4, 1, 3, 1, 2, 1, 1, 0, 0), # 85
(3, 8, 4, 3, 2, 1, 2, 0, 3, 0, 1, 0, 0, 2, 2, 1, 2, 4, 2, 2, 3, 2, 2, 1, 0, 0), # 86
(4, 3, 2, 4, 1, 1, 2, 0, 2, 0, 0, 0, 0, 2, 8, 4, 4, 2, 3, 1, 1, 0, 0, 2, 0, 0), # 87
(9, 0, 2, 4, 2, 0, 1, 0, 2, 1, 0, 0, 0, 0, 4, 4, 4, 1, 1, 1, 0, 2, 1, 2, 0, 0), # 88
(6, 3, 2, 4, 7, 4, 1, 0, 3, 2, 0, 2, 0, 4, 5, 2, 4, 4, 2, 1, 1, 1, 1, 1, 0, 0), # 89
(5, 3, 3, 5, 4, 2, 1, 1, 4, 0, 0, 0, 0, 5, 5, 1, 2, 4, 4, 0, 0, 2, 3, 0, 0, 0), # 90
(5, 4, 0, 2, 4, 1, 1, 0, 2, 2, 0, 0, 0, 4, 6, 2, 3, 6, 0, 4, 1, 2, 1, 0, 1, 0), # 91
(5, 5, 4, 2, 3, 1, 2, 2, 1, 0, 0, 0, 0, 6, 3, 2, 2, 2, 1, 1, 1, 0, 2, 0, 0, 0), # 92
(3, 1, 4, 4, 1, 1, 3, 2, 2, 0, 2, 0, 0, 4, 5, 1, 3, 1, 0, 2, 0, 0, 1, 1, 0, 0), # 93
(5, 4, 11, 4, 4, 1, 0, 1, 3, 1, 0, 0, 0, 5, 6, 2, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0), # 94
(5, 4, 2, 1, 4, 3, 1, 0, 0, 1, 0, 0, 0, 0, 2, 1, 0, 2, 1, 1, 0, 2, 0, 0, 0, 0), # 95
(5, 4, 4, 3, 3, 1, 2, 1, 2, 0, 1, 1, 0, 6, 2, 2, 0, 3, 3, 0, 2, 1, 1, 2, 0, 0), # 96
(1, 4, 1, 3, 5, 1, 1, 1, 3, 1, 0, 0, 0, 3, 5, 2, 1, 1, 2, 3, 0, 2, 1, 1, 0, 0), # 97
(5, 0, 7, 5, 3, 0, 1, 0, 3, 0, 2, 1, 0, 4, 1, 3, 3, 1, 2, 2, 0, 4, 2, 1, 0, 0), # 98
(6, 4, 2, 2, 5, 2, 1, 4, 2, 1, 0, 0, 0, 4, 3, 3, 1, 3, 3, 0, 0, 2, 1, 0, 2, 0), # 99
(5, 2, 1, 2, 2, 0, 0, 3, 0, 0, 1, 1, 0, 6, 4, 1, 1, 3, 1, 1, 3, 1, 0, 0, 1, 0), # 100
(2, 5, 6, 4, 2, 0, 2, 2, 1, 0, 0, 1, 0, 4, 5, 2, 2, 1, 5, 0, 0, 3, 3, 0, 0, 0), # 101
(3, 5, 6, 7, 5, 1, 0, 0, 4, 1, 0, 1, 0, 6, 2, 4, 1, 2, 3, 2, 0, 3, 0, 1, 0, 0), # 102
(5, 2, 3, 5, 3, 1, 2, 0, 4, 0, 0, 1, 0, 3, 2, 0, 3, 1, 1, 1, 1, 0, 0, 3, 0, 0), # 103
(6, 5, 6, 4, 3, 1, 2, 1, 3, 1, 0, 0, 0, 8, 2, 3, 2, 0, 1, 4, 0, 1, 1, 0, 0, 0), # 104
(4, 4, 6, 6, 1, 0, 3, 1, 1, 0, 0, 0, 0, 4, 1, 4, 1, 4, 2, 6, 2, 0, 0, 0, 0, 0), # 105
(1, 6, 2, 5, 4, 2, 1, 0, 2, 1, 1, 0, 0, 1, 3, 4, 2, 3, 1, 0, 1, 1, 0, 0, 0, 0), # 106
(0, 5, 4, 2, 5, 1, 0, 1, 1, 0, 1, 1, 0, 4, 5, 3, 0, 2, 3, 0, 1, 0, 2, 1, 0, 0), # 107
(3, 5, 4, 2, 2, 1, 1, 1, 3, 0, 1, 0, 0, 4, 4, 2, 2, 2, 1, 2, 0, 0, 2, 2, 0, 0), # 108
(5, 2, 3, 2, 2, 1, 1, 1, 2, 1, 1, 0, 0, 2, 6, 2, 4, 5, 0, 3, 1, 2, 1, 1, 0, 0), # 109
(5, 4, 5, 1, 1, 3, 1, 1, 0, 1, 1, 0, 0, 7, 2, 1, 0, 1, 2, 0, 0, 1, 1, 0, 0, 0), # 110
(1, 4, 2, 1, 3, 0, 4, 2, 1, 0, 0, 1, 0, 2, 2, 2, 5, 2, 3, 2, 0, 0, 3, 0, 0, 0), # 111
(3, 5, 3, 6, 2, 0, 1, 1, 0, 1, 0, 0, 0, 3, 2, 2, 0, 2, 1, 1, 0, 2, 0, 1, 0, 0), # 112
(1, 2, 1, 2, 2, 2, 0, 1, 5, 1, 0, 0, 0, 2, 3, 2, 0, 3, 2, 1, 1, 1, 0, 0, 0, 0), # 113
(5, 2, 1, 6, 2, 0, 1, 0, 2, 1, 0, 0, 0, 4, 4, 1, 2, 1, 2, 2, 1, 1, 2, 0, 1, 0), # 114
(3, 8, 1, 8, 2, 0, 1, 2, 2, 1, 0, 0, 0, 6, 2, 3, 3, 3, 1, 2, 2, 2, 1, 1, 1, 0), # 115
(2, 1, 1, 4, 3, 2, 3, 1, 2, 0, 2, 0, 0, 4, 3, 1, 0, 2, 3, 1, 0, 2, 3, 1, 0, 0), # 116
(4, 5, 2, 5, 3, 2, 0, 1, 5, 0, 0, 1, 0, 6, 3, 1, 1, 5, 2, 2, 0, 2, 2, 0, 1, 0), # 117
(2, 5, 4, 8, 1, 4, 1, 0, 1, 1, 2, 0, 0, 2, 6, 2, 2, 1, 0, 3, 1, 2, 0, 1, 0, 0), # 118
(2, 2, 1, 3, 2, 0, 0, 0, 1, 0, 0, 0, 0, 4, 3, 1, 2, 1, 2, 2, 2, 2, 0, 1, 0, 0), # 119
(0, 1, 1, 4, 2, 2, 1, 0, 1, 0, 1, 0, 0, 3, 4, 1, 1, 2, 0, 0, 0, 2, 0, 0, 0, 0), # 120
(3, 0, 2, 2, 2, 2, 2, 0, 2, 0, 0, 0, 0, 3, 1, 3, 1, 3, 0, 1, 0, 3, 1, 0, 1, 0), # 121
(2, 2, 4, 1, 3, 0, 1, 0, 1, 0, 1, 0, 0, 3, 6, 4, 1, 1, 2, 1, 0, 1, 2, 0, 0, 0), # 122
(1, 3, 5, 4, 3, 0, 4, 0, 2, 0, 0, 0, 0, 7, 3, 3, 2, 1, 0, 0, 2, 0, 0, 0, 0, 0), # 123
(4, 3, 2, 6, 3, 4, 0, 2, 1, 0, 0, 0, 0, 4, 0, 1, 2, 2, 2, 3, 0, 2, 1, 1, 1, 0), # 124
(1, 0, 0, 4, 2, 2, 1, 0, 0, 0, 0, 0, 0, 3, 2, 3, 0, 2, 1, 2, 1, 1, 1, 1, 0, 0), # 125
(0, 1, 3, 3, 1, 2, 1, 1, 2, 2, 0, 0, 0, 5, 3, 3, 4, 4, 2, 0, 0, 2, 2, 1, 0, 0), # 126
(2, 3, 0, 5, 6, 1, 1, 1, 1, 2, 1, 0, 0, 0, 3, 2, 1, 4, 4, 2, 2, 1, 0, 0, 0, 0), # 127
(1, 1, 5, 5, 3, 2, 0, 0, 1, 1, 0, 1, 0, 2, 1, 5, 1, 4, 1, 2, 2, 2, 2, 1, 1, 0), # 128
(1, 2, 3, 3, 5, 1, 1, 2, 1, 0, 0, 0, 0, 6, 1, 1, 2, 2, 3, 3, 0, 2, 1, 0, 0, 0), # 129
(6, 2, 3, 2, 3, 4, 1, 1, 1, 1, 0, 0, 0, 7, 1, 3, 1, 2, 1, 3, 1, 1, 2, 0, 0, 0), # 130
(5, 5, 0, 4, 4, 1, 2, 0, 2, 2, 0, 0, 0, 4, 1, 0, 2, 1, 0, 0, 2, 3, 0, 2, 0, 0), # 131
(2, 2, 2, 4, 2, 2, 0, 1, 1, 1, 1, 0, 0, 5, 2, 4, 4, 0, 0, 5, 1, 2, 1, 3, 0, 0), # 132
(3, 1, 3, 7, 2, 2, 2, 1, 2, 0, 2, 0, 0, 4, 4, 2, 2, 3, 0, 0, 2, 0, 1, 1, 0, 0), # 133
(2, 4, 4, 0, 2, 0, 4, 0, 1, 0, 0, 0, 0, 1, 3, 1, 1, 3, 0, 1, 0, 3, 2, 0, 0, 0), # 134
(3, 1, 3, 5, 4, 1, 3, 0, 3, 1, 0, 0, 0, 4, 3, 2, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0), # 135
(8, 2, 3, 2, 2, 2, 2, 0, 3, 0, 0, 0, 0, 3, 2, 2, 0, 4, 0, 1, 0, 2, 2, 0, 0, 0), # 136
(2, 1, 4, 5, 2, 3, 1, 2, 1, 0, 0, 2, 0, 7, 0, 2, 3, 4, 1, 2, 1, 1, 2, 1, 0, 0), # 137
(2, 3, 6, 2, 2, 0, 2, 0, 1, 1, 0, 0, 0, 2, 2, 6, 2, 4, 1, 1, 0, 0, 3, 2, 0, 0), # 138
(2, 4, 3, 4, 1, 0, 1, 1, 1, 0, 0, 1, 0, 5, 3, 1, 1, 4, 1, 1, 2, 0, 1, 1, 0, 0), # 139
(6, 3, 2, 3, 2, 3, 0, 2, 1, 0, 0, 0, 0, 0, 3, 4, 1, 3, 1, 1, 0, 4, 1, 1, 0, 0), # 140
(7, 6, 2, 0, 4, 0, 2, 0, 1, 2, 0, 0, 0, 5, 4, 2, 2, 4, 0, 0, 1, 2, 1, 0, 0, 0), # 141
(6, 1, 1, 5, 5, 6, 1, 0, 1, 0, 1, 1, 0, 3, 1, 2, 1, 2, 4, 2, 0, 1, 0, 0, 0, 0), # 142
(7, 3, 2, 3, 2, 3, 0, 1, 1, 0, 0, 1, 0, 2, 2, 3, 2, 3, 0, 3, 1, 6, 0, 2, 0, 0), # 143
(4, 0, 2, 3, 3, 1, 1, 0, 2, 1, 1, 0, 0, 3, 0, 1, 3, 2, 0, 0, 3, 1, 2, 0, 1, 0), # 144
(6, 2, 4, 2, 3, 1, 1, 3, 4, 0, 1, 1, 0, 1, 2, 1, 1, 4, 1, 0, 0, 1, 0, 3, 0, 0), # 145
(4, 1, 4, 4, 2, 1, 1, 0, 0, 0, 1, 0, 0, 10, 1, 2, 1, 1, 0, 2, 0, 0, 2, 0, 1, 0), # 146
(1, 3, 1, 1, 3, 2, 1, 2, 1, 1, 0, 0, 0, 0, 3, 2, 2, 0, 1, 0, 1, 1, 0, 0, 0, 0), # 147
(6, 1, 1, 5, 4, 1, 0, 1, 2, 0, 0, 0, 0, 4, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 0, 0), # 148
(5, 4, 0, 4, 2, 0, 3, 0, 0, 0, 1, 1, 0, 5, 3, 1, 2, 4, 1, 1, 1, 0, 1, 2, 1, 0), # 149
(2, 2, 5, 5, 2, 2, 0, 1, 1, 1, 0, 0, 0, 2, 1, 2, 4, 2, 1, 2, 0, 1, 0, 1, 0, 0), # 150
(5, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 8, 3, 2, 4, 3, 2, 0, 3, 1, 2, 1, 0, 0), # 151
(6, 3, 4, 2, 3, 0, 4, 0, 3, 0, 1, 0, 0, 3, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 0), # 152
(3, 0, 1, 2, 2, 1, 1, 2, 0, 0, 1, 0, 0, 1, 2, 1, 4, 4, 1, 2, 1, 3, 1, 2, 0, 0), # 153
(4, 1, 2, 4, 1, 3, 0, 2, 2, 0, 2, 1, 0, 1, 8, 1, 0, 1, 3, 4, 0, 1, 1, 1, 1, 0), # 154
(3, 3, 4, 1, 3, 2, 0, 1, 1, 0, 0, 0, 0, 6, 4, 2, 1, 3, 1, 0, 0, 1, 1, 0, 2, 0), # 155
(2, 2, 2, 8, 2, 1, 2, 1, 1, 3, 1, 0, 0, 3, 1, 3, 1, 2, 1, 0, 0, 2, 0, 0, 0, 0), # 156
(7, 0, 5, 5, 3, 2, 1, 1, 1, 1, 0, 0, 0, 4, 2, 4, 3, 4, 2, 0, 0, 0, 1, 1, 0, 0), # 157
(4, 3, 2, 3, 2, 0, 1, 0, 2, 0, 1, 0, 0, 4, 4, 1, 0, 4, 2, 1, 0, 0, 0, 0, 0, 0), # 158
(4, 0, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 3, 0, 1, 1, 2, 0, 0, 0, 2, 0, 3, 0, 0), # 159
(1, 0, 0, 2, 3, 4, 0, 1, 2, 1, 0, 1, 0, 7, 3, 2, 0, 3, 3, 2, 0, 0, 0, 0, 0, 0), # 160
(5, 0, 3, 2, 2, 3, 3, 1, 1, 2, 0, 0, 0, 4, 3, 1, 0, 5, 0, 1, 0, 1, 0, 1, 0, 0), # 161
(2, 0, 2, 3, 2, 0, 0, 1, 0, 0, 0, 0, 0, 2, 1, 2, 2, 2, 0, 1, 0, 1, 1, 0, 0, 0), # 162
(3, 3, 1, 6, 5, 1, 1, 1, 0, 1, 1, 1, 0, 5, 4, 1, 0, 3, 0, 0, 0, 2, 1, 0, 0, 0), # 163
(4, 3, 4, 3, 2, 1, 1, 1, 3, 1, 1, 0, 0, 3, 2, 3, 2, 5, 0, 0, 1, 3, 0, 0, 0, 0), # 164
(4, 0, 1, 5, 2, 0, 0, 0, 3, 0, 0, 0, 0, 4, 3, 3, 1, 3, 1, 0, 4, 1, 2, 1, 0, 0), # 165
(2, 2, 1, 2, 2, 3, 1, 0, 1, 0, 0, 0, 0, 5, 2, 1, 1, 3, 0, 2, 1, 2, 1, 3, 0, 0), # 166
(3, 1, 3, 2, 4, 3, 1, 0, 0, 0, 0, 0, 0, 9, 2, 2, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0), # 167
(1, 1, 6, 1, 2, 1, 0, 1, 1, 0, 0, 1, 0, 7, 3, 2, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0), # 168
(0, 0, 5, 5, 2, 0, 2, 1, 0, 1, 1, 0, 0, 4, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0), # 169
(1, 3, 1, 1, 3, 0, 0, 1, 0, 0, 0, 1, 0, 2, 1, 5, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0), # 170
(5, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 2, 0, 2, 5, 1, 2, 0, 0, 0, 0, 0, 0), # 171
(3, 0, 2, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 2, 2, 1, 1, 2, 1, 1, 1, 2, 2, 0, 0, 0), # 172
(2, 1, 1, 3, 0, 1, 0, 1, 2, 0, 0, 0, 0, 2, 2, 1, 2, 1, 2, 2, 0, 4, 2, 1, 1, 0), # 173
(0, 1, 3, 4, 3, 0, 1, 2, 2, 0, 0, 0, 0, 1, 3, 1, 1, 2, 0, 1, 0, 0, 2, 0, 0, 0), # 174
(2, 2, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0), # 175
(2, 2, 1, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 1, 0, 2, 1, 1, 0, 0, 0, 0), # 176
(1, 0, 3, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 3, 2, 0, 2, 1, 0, 0, 1, 2, 0, 0, 0), # 177
(2, 0, 1, 0, 0, 0, 0, 2, 0, 1, 0, 1, 0, 4, 2, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0), # 178
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 179
)
station_arriving_intensity = (
(2.0083462313487073, 2.2101154238772667, 2.0845132918450027, 2.485867109545373, 2.2218742430438447, 1.2554619728149357, 1.6584142461495661, 1.8612704691917692, 2.436039624867203, 1.583206006208948, 1.6821060655542412, 1.9591660313224695, 2.0335520850313453), # 0
(2.1417308608079897, 2.3560242776579035, 2.222138636532061, 2.6500577013106468, 2.3689961349896946, 1.3383934336170222, 1.7677875765054776, 1.9838054891622834, 2.5968981305331638, 1.68759227691086, 1.7932384543824527, 2.088486664325742, 2.1679166589759418), # 1
(2.2746892035918926, 2.5013540683563917, 2.3592169142189654, 2.813595081865918, 2.5155851894998977, 1.420994045804978, 1.8767274031842818, 2.105850099161768, 2.7571147227510195, 1.7915655100082184, 1.9039292595105253, 2.217293060821222, 2.301745931283876), # 2
(2.406703117258625, 2.645528200774579, 2.4952043477279418, 2.9758305630128294, 2.661064670400761, 1.5029362490340452, 1.9848014566591823, 2.226920462997803, 2.916054064368437, 1.8947130793704723, 2.013739364730953, 2.3450742739721844, 2.4345091225016904), # 3
(2.537254459366393, 2.78797007971431, 2.6295571598812146, 3.136115456553028, 2.804857841518597, 1.5838924829594672, 2.0915774674033836, 2.3465327444779662, 3.073080818233083, 1.9966223588670715, 2.12222965383623, 2.4713193569419056, 2.565675453175927), # 4
(2.6658250874734044, 2.9281031099774353, 2.7617315735010073, 3.2938010742881576, 2.946387966679712, 1.6635351872364859, 2.1966231658900894, 2.464203107409837, 3.227559647192624, 2.0968807223674655, 2.228961010618853, 2.595517362893659, 2.694714143853131), # 5
(2.7918968591378666, 3.0653506963658006, 2.8911838114095465, 3.448238728019861, 3.0850783097104175, 1.7415368015203456, 2.299506282592505, 2.5794477156009954, 3.378855214094726, 2.1950755437411034, 2.333494318871313, 2.7171573449907234, 2.821094415079843), # 6
(2.9149516319179876, 3.1991362436812527, 3.017370096429054, 3.598779729549785, 3.2203521344370216, 1.8175697654662883, 2.399794547983834, 2.691782732859021, 3.526332181787058, 2.290794196857435, 2.4353904623861076, 2.8357283563963716, 2.944285487402608), # 7
(3.034471263371974, 3.32888315672564, 3.1397466513817585, 3.744775390679571, 3.3516327046858345, 1.891306518729556, 2.497055692537279, 2.80072432299149, 3.6693552131172824, 2.38362405558591, 2.5342103249557284, 2.950719450273881, 3.063756581367967), # 8
(3.149937611058034, 3.4540148403008093, 3.2577696990898817, 3.8855770232108675, 3.478343284283164, 1.9624195009653935, 2.590857446726048, 2.9057886498059853, 3.8072889709330697, 2.473152493795977, 2.629514790372671, 3.0616196797865256, 3.178976917522465), # 9
(3.2608325325343728, 3.573954699208606, 3.3708954623756497, 4.020535938945315, 3.5999071370553204, 2.030581151829043, 2.680767541023342, 3.0064918771100846, 3.939498118082086, 2.5589668853570857, 2.7208647424294297, 3.167918098097581, 3.2894157164126443), # 10
(3.3666378853592023, 3.6881261382508828, 3.4785801640612863, 4.149003449684559, 3.7157475268286135, 2.0954639109757474, 2.7663537059023664, 3.102350168711366, 4.065347317411997, 2.6406546041386876, 2.8078210649184996, 3.269103758370324, 3.394542198585045), # 11
(3.466835527090725, 3.795952562229479, 3.580280026969016, 4.270330867230245, 3.825287717429351, 2.156740218060748, 2.8471836718363246, 3.1928796884174084, 4.184201231770472, 2.717803024010229, 2.8899446416323737, 3.3646657137680274, 3.493825584586214), # 12
(3.5609073152871504, 3.896857375946248, 3.6754512739210647, 4.383869503384018, 3.9279509726838406, 2.2140825127392896, 2.9228251692984224, 3.2775966000357926, 4.295424524005173, 2.789999518841162, 2.9667963563635475, 3.4540930174539684, 3.586735094962694), # 13
(3.6483351075066865, 3.9902639842030356, 3.763550127739659, 4.488970669947517, 4.023160556418396, 2.2671632346666137, 2.9928459287618647, 3.3560170673740988, 4.398381856963769, 2.8568314625009337, 3.0379370929045137, 3.536874722591424, 3.6727399502610254), # 14
(3.728600761307542, 4.075595791801687, 3.844032811247017, 4.584985678722394, 4.110339732459323, 2.315654823497965, 3.0568136806998503, 3.4276572542399024, 4.4924378934939275, 2.9178862288589964, 3.1029277350477678, 3.6124998823436685, 3.7513093710277525), # 15
(3.8011861342479203, 4.152276203544053, 3.91635554726537, 4.671265841510286, 4.188911764632933, 2.359229718888584, 3.1142961555855906, 3.4920333244407846, 4.5769572964433145, 2.9727511917847984, 3.161329166585805, 3.680457549873976, 3.8219125778094183), # 16
(3.86557308388603, 4.219728624231979, 3.979974558616941, 4.747162470112845, 4.2582999167655355, 2.3975603604937143, 3.1648610838922844, 3.5486614417843274, 4.651304728659594, 3.021013725147787, 3.2127022713111195, 3.740236778345622, 3.8840187911525663), # 17
(3.921243467780082, 4.27737645866731, 4.034346068123952, 4.8120268763317116, 4.317927452683436, 2.4303191879686015, 3.2080761960931405, 3.5970577700781043, 4.7148448529904385, 3.0622612028174148, 3.2566079330162037, 3.791326620921886, 3.9370972316037385), # 18
(3.9676791434882794, 4.3246431116518975, 4.078926298608631, 4.8652103719685265, 4.3672176362129465, 2.4571786409684835, 3.2435092226613578, 3.6367384731296983, 4.766942332283512, 3.0960809986631315, 3.2926070354935515, 3.8332161307660386, 3.9806171197094784), # 19
(4.0043619685688325, 4.360951987987585, 4.113171472893201, 4.906064268824942, 4.405593731180377, 2.4778111591486076, 3.270727894070145, 3.667219714746687, 4.80696182938648, 3.1220604865543837, 3.32026046253566, 3.8653943610413566, 4.01404767601633), # 20
(4.030773800579946, 4.385726492476223, 4.136537813799888, 4.933939878702595, 4.432479001412036, 2.4918891821642144, 3.289299940792704, 3.6880176587366496, 4.834268007147009, 3.139787040360622, 3.339129097935024, 3.8873503649111174, 4.036858121070831), # 21
(4.046396497079832, 4.398390029919658, 4.148481544150914, 4.948188513403135, 4.44729671073423, 2.499085149670547, 3.29879309330224, 3.698648468907166, 4.848225528412766, 3.148848033951297, 3.348773825484136, 3.898573195538596, 4.048517675419531), # 22
(4.052157345337056, 4.399889437585734, 4.149969272976681, 4.949972325102881, 4.451092822413039, 2.5, 3.2999216009037355, 3.6997975308641977, 4.849970493827161, 3.149916909007773, 3.349983214864696, 3.8999590306355736, 4.05), # 23
(4.056404965213662, 4.399014814814815, 4.149725925925926, 4.949752777777778, 4.453243045445941, 2.5, 3.299301525054467, 3.6982, 4.849736666666667, 3.14926024691358, 3.3498498316498324, 3.8996345679012343, 4.05), # 24
(4.060562892084632, 4.397290809327846, 4.149245541838135, 4.949318415637861, 4.455345978237801, 2.5, 3.298079561042524, 3.6950617283950624, 4.849274691358025, 3.1479675354366714, 3.349585359770545, 3.898994055784179, 4.05), # 25
(4.0646308076192135, 4.394743758573389, 4.148534705075447, 4.948674176954732, 4.457401547368442, 2.5, 3.2962746873234887, 3.6904419753086426, 4.84859049382716, 3.14606028349337, 3.349192193540342, 3.8980462734339287, 4.05), # 26
(4.068608393486655, 4.3914, 4.1476, 4.947825, 4.459409679417686, 2.5, 3.2939058823529415, 3.6844, 4.84769, 3.14356, 3.3486727272727275, 3.8968000000000007, 4.05), # 27
(4.0724953313562, 4.387285871056242, 4.146448010973937, 4.946775823045268, 4.461370300965361, 2.5, 3.2909921245864604, 3.6769950617283955, 4.846579135802469, 3.1404881938728852, 3.3480293552812075, 3.895264014631916, 4.05), # 28
(4.0762913028971, 4.382427709190672, 4.145085322359397, 4.94553158436214, 4.463283338591288, 2.5, 3.2875523924796264, 3.6682864197530862, 4.845263827160494, 3.1368663740283496, 3.3472644718792868, 3.893447096479195, 4.05), # 29
(4.079995989778599, 4.376851851851852, 4.143518518518518, 4.944097222222222, 4.4651487188752945, 2.5, 3.2836056644880176, 3.658333333333333, 4.84375, 3.1327160493827164, 3.3463804713804715, 3.8913580246913577, 4.05), # 30
(4.083609073669943, 4.370584636488341, 4.141754183813443, 4.94247767489712, 4.466966368397204, 2.5, 3.279170919067216, 3.6471950617283952, 4.842043580246914, 3.1280587288523094, 3.3453797480982668, 3.8890055784179247, 4.05), # 31
(4.087130236240382, 4.363652400548697, 4.13979890260631, 4.940677880658437, 4.468736213736839, 2.5, 3.2742671346727996, 3.6349308641975315, 4.840150493827161, 3.1229159213534525, 3.344264696346178, 3.886398536808414, 4.05), # 32
(4.090559159159159, 4.356081481481481, 4.13765925925926, 4.938702777777777, 4.470458181474025, 2.5, 3.2689132897603486, 3.6216000000000004, 4.838076666666667, 3.1173091358024694, 3.3430377104377103, 3.8835456790123453, 4.05), # 33
(4.093895524095524, 4.347898216735254, 4.135341838134431, 4.936557304526749, 4.472132198188587, 2.5, 3.263128362785444, 3.6072617283950614, 4.835828024691359, 3.111259881115684, 3.34170118468637, 3.880455784179241, 4.05), # 34
(4.097139012718723, 4.339128943758573, 4.132853223593965, 4.9342463991769545, 4.473758190460348, 2.5, 3.2569313322036635, 3.5919753086419757, 4.833410493827161, 3.1047896662094194, 3.3402575134056613, 3.8771376314586194, 4.05), # 35
(4.100289306698002, 4.3298, 4.1302, 4.931775, 4.475336084869134, 2.5, 3.250341176470588, 3.5758000000000005, 4.83083, 3.0979200000000002, 3.338709090909091, 3.8736000000000006, 4.05), # 36
(4.10334608770261, 4.319937722908093, 4.127388751714678, 4.92914804526749, 4.476865807994769, 2.5, 3.2433768740417976, 3.558795061728395, 4.828092469135803, 3.09067239140375, 3.337058311510164, 3.869851668952904, 4.05), # 37
(4.1063090374017905, 4.3095684499314135, 4.124426063100137, 4.92637047325103, 4.478347286417076, 2.5, 3.2360574033728717, 3.5410197530864203, 4.825203827160494, 3.0830683493369917, 3.3353075695223846, 3.86590141746685, 4.05), # 38
(4.109177837464794, 4.298718518518519, 4.121318518518519, 4.923447222222222, 4.479780446715881, 2.5, 3.2284017429193903, 3.5225333333333335, 4.822170000000001, 3.0751293827160495, 3.3334592592592593, 3.861758024691358, 4.05), # 39
(4.111952169560865, 4.2874142661179695, 4.118072702331961, 4.920383230452675, 4.481165215471008, 2.5, 3.2204288711369324, 3.503395061728396, 4.818996913580247, 3.066877000457248, 3.3315157750342936, 3.8574302697759495, 4.05), # 40
(4.114631715359251, 4.275682030178326, 4.114695198902607, 4.917183436213993, 4.482501519262281, 2.5, 3.212157766481078, 3.4836641975308646, 4.8156904938271605, 3.058332711476909, 3.329479511160993, 3.852926931870142, 4.05), # 41
(4.1172161565292, 4.263548148148149, 4.111192592592594, 4.9138527777777785, 4.483789284669523, 2.5, 3.2036074074074072, 3.4634, 4.812256666666667, 3.0495180246913582, 3.3273528619528623, 3.848256790123457, 4.05), # 42
(4.119705174739957, 4.251038957475995, 4.1075714677640605, 4.910396193415639, 4.485028438272561, 2.5, 3.1947967723715003, 3.4426617283950622, 4.808701358024692, 3.0404544490169183, 3.3251382217234067, 3.8434286236854143, 4.05), # 43
(4.122098451660771, 4.238180795610425, 4.10383840877915, 4.906818621399178, 4.486218906651218, 2.5, 3.185744839828936, 3.4215086419753096, 4.805030493827161, 3.031163493369913, 3.322837984786133, 3.838451211705533, 4.05), # 44
(4.1243956689608865, 4.2250000000000005, 4.1000000000000005, 4.903125, 4.487360616385319, 2.5, 3.1764705882352944, 3.4000000000000004, 4.80125, 3.021666666666667, 3.3204545454545453, 3.833333333333333, 4.05), # 45
(4.126596508309553, 4.211522908093278, 4.096062825788752, 4.8993202674897125, 4.488453494054687, 2.5, 3.1669929960461554, 3.3781950617283956, 4.797365802469136, 3.0119854778235027, 3.3179902980421496, 3.828083767718336, 4.05), # 46
(4.128700651376014, 4.19777585733882, 4.092033470507545, 4.895409362139918, 4.489497466239147, 2.5, 3.1573310417170988, 3.356153086419753, 4.793383827160494, 3.0021414357567444, 3.3154476368624515, 3.82271129401006, 4.05), # 47
(4.130707779829518, 4.183785185185186, 4.087918518518519, 4.891397222222223, 4.490492459518524, 2.5, 3.1475037037037037, 3.333933333333334, 4.78931, 2.992156049382716, 3.312828956228956, 3.8172246913580246, 4.05), # 48
(4.132617575339315, 4.169577229080932, 4.083724554183814, 4.887288786008231, 4.491438400472643, 2.5, 3.137529960461551, 3.3115950617283954, 4.78515024691358, 2.9820508276177415, 3.3101366504551692, 3.8116327389117517, 4.05), # 49
(4.134429719574647, 4.155178326474624, 4.07945816186557, 4.883088991769547, 4.492335215681326, 2.5, 3.12742879044622, 3.2891975308641976, 4.78091049382716, 2.9718472793781436, 3.307373113854595, 3.8059442158207597, 4.05), # 50
(4.136143894204764, 4.140614814814815, 4.075125925925926, 4.8788027777777785, 4.4931828317244, 2.5, 3.11721917211329, 3.2668, 4.776596666666667, 2.961566913580247, 3.304540740740741, 3.8001679012345684, 4.05), # 51
(4.137759780898912, 4.125913031550069, 4.070734430727024, 4.874435082304527, 4.493981175181686, 2.5, 3.1069200839183413, 3.2444617283950614, 4.772214691358025, 2.951231239140375, 3.301641925427111, 3.7943125743026984, 4.05), # 52
(4.139277061326338, 4.1110993141289445, 4.0662902606310025, 4.869990843621399, 4.4947301726330116, 2.5, 3.0965505043169532, 3.222241975308642, 4.767770493827161, 2.9408617649748514, 3.2986790622272104, 3.7883870141746687, 4.05), # 53
(4.140695417156286, 4.0962000000000005, 4.0618, 4.865475, 4.495429750658201, 2.5, 3.086129411764706, 3.2001999999999997, 4.76327, 2.93048, 3.295654545454545, 3.7824, 4.05), # 54
(4.142014530058009, 4.081241426611797, 4.057270233196159, 4.860892489711934, 4.496079835837076, 2.5, 3.075675784717179, 3.178395061728395, 4.758719135802469, 2.920107453132145, 3.292570769422621, 3.7763603109282124, 4.05), # 55
(4.143234081700749, 4.066249931412894, 4.052707544581619, 4.8562482510288065, 4.496680354749464, 2.5, 3.0652086016299527, 3.1568864197530866, 4.754123827160494, 2.909765633287609, 3.2894301284449434, 3.770276726108825, 4.05), # 56
(4.144353753753753, 4.051251851851852, 4.048118518518519, 4.851547222222223, 4.497231233975187, 2.5, 3.0547468409586056, 3.135733333333334, 4.749490000000001, 2.8994760493827165, 3.286235016835017, 3.764158024691358, 4.05), # 57
(4.145373227886272, 4.036273525377229, 4.043509739368999, 4.846794341563786, 4.49773240009407, 2.5, 3.044309481158719, 3.1149950617283952, 4.744823580246914, 2.889260210333791, 3.2829878289063483, 3.7580129858253315, 4.05), # 58
(4.146292185767549, 4.0213412894375855, 4.038887791495199, 4.841994547325103, 4.498183779685938, 2.5, 3.0339155006858713, 3.094730864197531, 4.740130493827161, 2.8791396250571566, 3.27969095897244, 3.7518503886602654, 4.05), # 59
(4.147110309066831, 4.006481481481482, 4.034259259259259, 4.837152777777778, 4.498585299330615, 2.5, 3.0235838779956428, 3.075, 4.7354166666666675, 2.869135802469136, 3.2763468013468016, 3.745679012345679, 4.05), # 60
(4.147827279453366, 3.9917204389574765, 4.02963072702332, 4.832273971193416, 4.498936885607924, 2.5, 3.0133335915436135, 3.0558617283950618, 4.730688024691358, 2.859270251486054, 3.2729577503429357, 3.7395076360310933, 4.05), # 61
(4.148442778596402, 3.977084499314129, 4.025008779149521, 4.827363065843622, 4.499238465097694, 2.5, 3.0031836197853625, 3.0373753086419755, 4.725950493827161, 2.8495644810242347, 3.2695262002743486, 3.7333450388660268, 4.05), # 62
(4.148956488165184, 3.9626, 4.0204, 4.822425000000001, 4.499489964379743, 2.5, 2.9931529411764703, 3.0196000000000005, 4.72121, 2.84004, 3.266054545454546, 3.7272, 4.05), # 63
(4.149368089828959, 3.948293278463649, 4.0158109739369, 4.817464711934157, 4.499691310033899, 2.5, 2.983260534172517, 3.0025950617283956, 4.716472469135803, 2.8307183173296755, 3.2625451801970318, 3.7210812985825337, 4.05), # 64
(4.149677265256975, 3.934190672153635, 4.01124828532236, 4.812487139917696, 4.499842428639987, 2.5, 2.9735253772290813, 2.9864197530864196, 4.711743827160494, 2.821620941929584, 3.2590004988153143, 3.7149977137631454, 4.05), # 65
(4.149883696118478, 3.920318518518519, 4.006718518518519, 4.8074972222222225, 4.499943246777829, 2.5, 2.963966448801743, 2.971133333333334, 4.7070300000000005, 2.8127693827160494, 3.2554228956228957, 3.7089580246913587, 4.05), # 66
(4.149987064082717, 3.9067031550068587, 4.002228257887517, 4.8024998971193416, 4.499993691027252, 2.5, 2.9546027273460824, 2.956795061728396, 4.702336913580247, 2.804185148605396, 3.2518147649332843, 3.7029710105166895, 4.05), # 67
(4.14991664579233, 3.8932994557281293, 3.9977623799725652, 4.797456696188943, 4.499951182118938, 2.49995360463344, 2.9454060779318585, 2.943337540009145, 4.6976351394604485, 2.7958481766588665, 3.2481143954161507, 3.697012008759897, 4.0499500600137175), # 68
(4.149256682769726, 3.879698207885305, 3.99319537037037, 4.792113405797101, 4.499564270152505, 2.4995868312757206, 2.9361072725386457, 2.9300395061728395, 4.692719135802469, 2.787522556281772, 3.243945135566188, 3.69088758934373, 4.049554398148149), # 69
(4.147954315023558, 3.865836983937342, 3.9885073731138543, 4.7864348497047775, 4.498799725651577, 2.4988645023624447, 2.926664053824548, 2.916780978509374, 4.687561156835849, 2.779167809785094, 3.239259554610432, 3.6845691045171236, 4.048772933813444), # 70
(4.146027864257172, 3.851724067436612, 3.9837000342935527, 4.7804294015029525, 4.497667231501654, 2.497798323426307, 2.9170806638155953, 2.9035663465935073, 4.6821688843164155, 2.770784143737056, 3.2340749483135447, 3.678061174885086, 4.047615955075446), # 71
(4.143495652173914, 3.8373677419354837, 3.9787749999999997, 4.774105434782609, 4.496176470588235, 2.4964000000000004, 2.907361344537815, 2.8904, 4.676550000000001, 2.7623717647058825, 3.228408612440192, 3.671368421052632, 4.04609375), # 72
(4.140376000477128, 3.8227762909863268, 3.973733916323731, 4.767471323134729, 4.494337125796821, 2.494681237616217, 2.897510338017237, 2.8772863283036125, 4.670712185642433, 2.7539308792597974, 3.2222778427550356, 3.6644954636247675, 4.04421660665295), # 73
(4.136687230870161, 3.807957998141511, 3.968578429355281, 4.760535440150295, 4.49215888001291, 2.4926537418076515, 2.887531886279889, 2.864229721079104, 4.664663122999543, 2.745461693967025, 3.2156999350227427, 3.657446923206507, 4.041994813100138), # 74
(4.13244766505636, 3.7929211469534048, 3.963310185185185, 4.75330615942029, 4.489651416122005, 2.4903292181069965, 2.8774302313518003, 2.8512345679012348, 4.65841049382716, 2.736964415395788, 3.2086921850079744, 3.650227420402859, 4.039438657407408), # 75
(4.127675624739071, 3.77767402097438, 3.957930829903978, 4.745791854535695, 4.486824417009602, 2.4877193720469446, 2.8672096152589983, 2.8383052583447648, 4.651961979881116, 2.7284392501143118, 3.2012718884753966, 3.6428415758188333, 4.036558427640603), # 76
(4.122389431621637, 3.7622249037568043, 3.952442009602194, 4.738000899087493, 4.483687565561204, 2.4848359091601893, 2.8568742800275118, 2.825446181984454, 4.645325262917239, 2.71988640469082, 3.193456341189675, 3.6352940100594426, 4.03336441186557), # 77
(4.1166074074074075, 3.7465820788530473, 3.9468453703703705, 4.729941666666667, 4.48025054466231, 2.481690534979424, 2.84642846768337, 2.812661728395062, 4.638508024691357, 2.7113060856935367, 3.1852628389154707, 3.6275893437296953, 4.029866898148149), # 78
(4.110347873799726, 3.730753829815479, 3.94114255829904, 4.721622530864198, 4.476523037198419, 2.4782949550373417, 2.8358764202526006, 2.7999562871513493, 4.631517946959305, 2.7026984996906855, 3.176708677417449, 3.619732197434602, 4.026076174554183), # 79
(4.103629152501939, 3.714748440196469, 3.9353352194787377, 4.713051865271068, 4.4725147260550315, 2.474660874866636, 2.8252223797612324, 2.7873342478280754, 4.624362711476909, 2.6940638532504906, 3.1678111524602754, 3.611727191779174, 4.02200252914952), # 80
(4.096469565217392, 3.6985741935483873, 3.929425, 4.704238043478262, 4.468235294117647, 2.4708, 2.8144705882352943, 2.7748000000000004, 4.61705, 2.6854023529411766, 3.1585875598086126, 3.603578947368421, 4.01765625), # 81
(4.088887433649431, 3.682239373423603, 3.9234135459533612, 4.695189439076758, 4.463694424271766, 2.466724035970127, 2.8036252877008145, 2.762357933241884, 4.6095874942844075, 2.6767142053309665, 3.1490551952271253, 3.5952920848073546, 4.013047625171469), # 82
(4.080901079501402, 3.6657522633744857, 3.9173025034293554, 4.685914425657542, 4.458901799402889, 2.4624446883097093, 2.7926907201838214, 2.7500124371284866, 4.6019828760859625, 2.6679996169880846, 3.1392313544804775, 3.586871224700985, 4.008186942729767), # 83
(4.072528824476651, 3.649121146953405, 3.9110935185185185, 4.676421376811595, 4.453867102396514, 2.4579736625514403, 2.7816711277103434, 2.7377679012345677, 4.5942438271604935, 2.6592587944807557, 3.1291333333333333, 3.578320987654321, 4.003084490740741), # 84
(4.063788990278524, 3.6323543077127307, 3.904788237311385, 4.666718666129898, 4.448600016138143, 2.4533226642280144, 2.77057075230641, 2.7256287151348886, 4.586378029263831, 2.6504919443772024, 3.1187784275503576, 3.569645994272375, 3.9977505572702334), # 85
(4.054699898610365, 3.6154600292048324, 3.8983883058984916, 4.656814667203436, 4.443110223513274, 2.4485033988721234, 2.7593938359980483, 2.7135992684042067, 4.578393164151807, 2.6416992732456497, 3.108183932896214, 3.5608508651601576, 3.992195430384088), # 86
(4.045279871175523, 3.5984465949820788, 3.8918953703703703, 4.6467177536231885, 4.437407407407409, 2.443527572016461, 2.7481446208112876, 2.701683950617284, 4.570296913580248, 2.632880987654321, 3.097367145135566, 3.551940220922677, 3.9864293981481485), # 87
(4.035547229677343, 3.5813222885968403, 3.8853110768175583, 4.63643629898014, 4.431501250706044, 2.4384068891937205, 2.7368273487721564, 2.68988715134888, 4.562096959304984, 2.6240372941714405, 3.0863453600330795, 3.542918682164946, 3.9804627486282587), # 88
(4.025520295819169, 3.564095393601487, 3.87863707133059, 4.625978676865271, 4.425401436294683, 2.4331530559365953, 2.7254462619066833, 2.678213260173754, 4.553800983081848, 2.615168399365233, 3.0751358733534175, 3.533790869491974, 3.9743057698902606), # 89
(4.015217391304348, 3.546774193548387, 3.871875, 4.615353260869566, 4.419117647058824, 2.427777777777778, 2.7140056022408965, 2.6666666666666665, 4.545416666666667, 2.6062745098039217, 3.0637559808612442, 3.524561403508772, 3.9679687500000003), # 90
(4.004656837836225, 3.529366971989911, 3.8650265089163236, 4.604568424584005, 4.412659565883966, 2.4222927602499618, 2.7025096118008247, 2.6552517604023778, 4.536951691815273, 2.5973558320557304, 3.052222978321224, 3.5152349048203497, 3.961461977023319), # 91
(3.9938569571181493, 3.511882012478429, 3.858093244170096, 4.593632541599571, 4.406036875655611, 2.4167097088858407, 2.690962532612497, 2.6439729309556474, 4.528413740283494, 2.588412572688884, 3.0405541614980214, 3.5058159940317193, 3.954795739026063), # 92
(3.982836070853462, 3.4943275985663087, 3.851076851851852, 4.582553985507247, 4.399259259259259, 2.411040329218107, 2.6793686067019404, 2.632834567901235, 4.519810493827161, 2.579444938271605, 3.0287668261563, 3.496309291747888, 3.9479803240740736), # 93
(3.971612500745512, 3.476712013805921, 3.8439789780521267, 4.571341129898014, 4.392336399580408, 2.4052963267794545, 2.6677320760951844, 2.621841060813901, 4.511149634202104, 2.570453135372119, 3.016878268060724, 3.4867194185738697, 3.9410260202331964), # 94
(3.960204568497644, 3.4590435417496352, 3.8368012688614543, 4.560002348362856, 4.3852779795045596, 2.399489407102576, 2.6560571828182575, 2.6109967992684044, 4.502438843164152, 2.5614373705586484, 3.0049057829759587, 3.477050995114672, 3.933943115569273), # 95
(3.948630595813205, 3.4413304659498216, 3.829545370370371, 4.548546014492754, 4.378093681917211, 2.3936312757201645, 2.6443481688971886, 2.6003061728395065, 4.493685802469136, 2.5523978503994194, 2.992866666666667, 3.4673086419753094, 3.9267418981481486), # 96
(3.936908904395539, 3.4235810699588485, 3.82221292866941, 4.53698050187869, 4.370793189703866, 2.3877336381649137, 2.6326092763580053, 2.5897735711019667, 4.484898193872886, 2.543334781462654, 2.980778214897513, 3.457496979760788, 3.919432656035666), # 97
(3.925057815947994, 3.4058036373290856, 3.814805589849108, 4.525314184111648, 4.363386185750021, 2.3818081999695173, 2.6208447472267373, 2.5794033836305443, 4.476083699131229, 2.534248370316577, 2.9686577234331626, 3.4476206290761193, 3.9120256772976685), # 98
(3.9130956521739133, 3.3880064516129034, 3.8073250000000005, 4.513555434782609, 4.355882352941177, 2.3758666666666666, 2.6090588235294123, 2.5692000000000004, 4.46725, 2.525138823529412, 2.956522488038278, 3.437684210526316, 3.9045312500000002), # 99
(3.901040734776645, 3.3701977963626706, 3.79977280521262, 4.501712627482555, 4.348291374162834, 2.3699207437890566, 2.597255747292058, 2.559167809785094, 4.458404778235026, 2.5160063476693835, 2.944389804477524, 3.427692344716387, 3.896959662208505), # 100
(3.888911385459534, 3.3523859551307584, 3.792150651577504, 4.4897941358024696, 4.340622932300493, 2.3639821368693794, 2.585439760540705, 2.549311202560585, 4.449555715592136, 2.5068511493047154, 2.932276968515565, 3.4176496522513413, 3.8893212019890258), # 101
(3.8767259259259266, 3.3345792114695345, 3.784460185185185, 4.477808333333334, 4.332886710239651, 2.3580625514403297, 2.5736151053013803, 2.539634567901235, 4.440710493827161, 2.4976734350036316, 2.9202012759170657, 3.4075607537361927, 3.881626157407408), # 102
(3.864502677879168, 3.316785848931369, 3.7767030521262, 4.46576359366613, 4.325092390865811, 2.3521736930345987, 2.561786023600112, 2.530142295381802, 4.43187679469593, 2.488473411334356, 2.9081800224466896, 3.397430269775949, 3.873884816529492), # 103
(3.852259963022604, 3.2990141510686315, 3.7688808984910835, 4.453668290391842, 4.317249657064472, 2.3463272671848805, 2.5499567574629305, 2.5208387745770464, 4.4230622999542755, 2.4792512848651125, 2.8962305038691003, 3.3872628209756215, 3.8661074674211253), # 104
(3.840016103059581, 3.2812724014336916, 3.7609953703703702, 4.441530797101449, 4.309368191721133, 2.3405349794238686, 2.5381315489158633, 2.511728395061729, 4.414274691358025, 2.4700072621641254, 2.8843700159489636, 3.3770630279402214, 3.858304398148148), # 105
(3.8277894196934454, 3.2635688835789196, 3.7530481138545952, 4.429359487385937, 4.301457677721294, 2.3348085352842554, 2.526314639984938, 2.5028155464106083, 4.405521650663008, 2.460741549799618, 2.872615854450942, 3.3668355112747577, 3.850485896776406), # 106
(3.8155982346275423, 3.2459118810566845, 3.745040775034294, 4.417162734836285, 4.293527797950456, 2.329159640298735, 2.5145102726961848, 2.494104618198446, 4.396810859625058, 2.4514543543398157, 2.860985315139701, 3.356584891584242, 3.842662251371742), # 107
(3.8034608695652175, 3.2283096774193556, 3.7369750000000006, 4.404948913043479, 4.285588235294117, 2.3236000000000003, 2.5027226890756302, 2.4856000000000003, 4.38815, 2.4421458823529414, 2.8494956937799043, 3.346315789473685, 3.8348437500000006), # 108
(3.7913956462098173, 3.210770556219302, 3.72885243484225, 4.392726395598497, 4.27764867263778, 2.318141319920744, 2.490956131149305, 2.4773060813900325, 4.379546753543667, 2.432816340407219, 2.838164286136216, 3.336032825548095, 3.8270406807270234), # 109
(3.7794208862646865, 3.193302801008895, 3.7206747256515786, 4.380503556092324, 4.269718792866942, 2.3127953055936596, 2.4792148409432357, 2.4692272519433014, 4.371008802011889, 2.4234659350708734, 2.8270083879733003, 3.3257406204124855, 3.819263331618656), # 110
(3.7675549114331726, 3.175914695340502, 3.712443518518519, 4.368288768115942, 4.261808278867103, 2.3075736625514405, 2.4675030604834527, 2.461367901234568, 4.362543827160494, 2.414094872912128, 2.8160452950558215, 3.3154437946718653, 3.811521990740741), # 111
(3.75581604341862, 3.1586145227664937, 3.7041604595336084, 4.356090405260333, 4.253926813523764, 2.3024880963267798, 2.4558250317959835, 2.453732418838592, 4.354159510745313, 2.4047033604992065, 2.805292303148444, 3.3051469689312443, 3.803826946159122), # 112
(3.744201689481218, 3.141439447514381, 3.6958471313008276, 4.343933552996816, 4.246070272069482, 2.2975479076858054, 2.444210385462708, 2.4463410275122426, 4.345885124503448, 2.395321894645092, 2.7947695624611466, 3.2948771746017713, 3.7961775603372887), # 113
(3.732592359160026, 3.1245588734102143, 3.6876182700086475, 4.331915768510934, 4.238157341826531, 2.2927418434119606, 2.432807283364232, 2.439284503802048, 4.3378476142852245, 2.386126067165113, 2.784497734845279, 3.28476486884519, 3.788510165664014), # 114
(3.720953961201598, 3.107978879473219, 3.679478773082927, 4.320033802072712, 4.230163071155441, 2.2880574049995057, 2.421623860076625, 2.4325610617114837, 4.330049991467516, 2.377130131195231, 2.7744618045708376, 3.2748150330235406, 3.7808026526641507), # 115
(3.709271949295054, 3.091675312516681, 3.6714128759935494, 4.3082664601065614, 4.222075410553511, 2.283483550914839, 2.4106419270111576, 2.4261521251595974, 4.322472535691133, 2.368317343379819, 2.7646423725085927, 3.2650092789949383, 3.7730429039023563), # 116
(3.697531777129509, 3.0756240193538886, 3.6634048142103945, 4.296592549036897, 4.213882310518044, 2.279009239624356, 2.399843295579101, 2.420039118065434, 4.315095526596881, 2.3596709603632515, 2.755020039529313, 3.2553292186175002, 3.76521880194329), # 117
(3.6857188983940845, 3.0598008467981295, 3.655438823203347, 4.284990875288133, 4.205571721546337, 2.2746234295944556, 2.3892097771917262, 2.414203464348039, 4.307899243825574, 2.3511742387899037, 2.74557540650377, 3.24575646374934, 3.75731822935161), # 118
(3.673818766777897, 3.044181641662692, 3.6474991384422895, 4.273440245284682, 4.197131594135689, 2.270315079291533, 2.3787231832603024, 2.408626587926458, 4.300863967018017, 2.342810435304149, 2.7362890743027313, 3.236272626248574, 3.749329068691973), # 119
(3.6618168359700647, 3.0287422507608635, 3.639569995397105, 4.261919465450958, 4.188549878783399, 2.266073147181986, 2.3683653251961014, 2.403289912719737, 4.293969975815023, 2.334562806550362, 2.7271416437969664, 3.226859317973319, 3.741239202529039), # 120
(3.6496985596597074, 3.0134585209059317, 3.631635629537675, 4.250407342211374, 4.179814525986767, 2.261886591732212, 2.358118014410392, 2.398174862646923, 4.2871975498573995, 2.3264146091729185, 2.7181137158572466, 3.217498150781689, 3.7330365134274643), # 121
(3.6374493915359416, 2.9983062989111846, 3.6236802763338845, 4.238882681990343, 4.170913486243093, 2.2577443714086076, 2.347963062314447, 2.3932628616270595, 4.2805269687859555, 2.318349099816191, 2.7091858913543407, 3.2081707365318004, 3.7247088839519082), # 122
(3.6250547852878876, 2.9832614315899098, 3.6156881712556146, 4.227324291212278, 4.161834710049677, 2.25363544467757, 2.3378822803195356, 2.3885353335791932, 4.273938512241502, 2.310349535124555, 2.700338771159018, 3.198858687081769, 3.716244196667029), # 123
(3.612500194604662, 2.968299765755395, 3.607643549772748, 4.215710976301595, 4.152566147903815, 2.2495487700054957, 2.327857479836928, 2.3839737024223706, 4.267412459864846, 2.3023991717423846, 2.691552956142048, 3.1895436142897102, 3.7076303341374848), # 124
(3.5997710731753836, 2.9533971482209282, 3.5995306473551696, 4.204021543682704, 4.143095750302809, 2.2454733058587824, 2.3178704722778956, 2.3795593920756364, 4.260929091296798, 2.2944812663140537, 2.6828090471742008, 3.1802071300137396, 3.6988551789279316), # 125
(3.5868528746891712, 2.938529425799798, 3.5913336994727594, 4.192234799780022, 4.133411467743957, 2.241398010703827, 2.307903069053708, 2.375273826458037, 4.254468686178167, 2.286579075483937, 2.6740876451262454, 3.170830846111974, 3.6899066136030316), # 126
(3.5737310528351447, 2.92367244530529, 3.583036941595402, 4.18032955101796, 4.123501250724559, 2.237311843007026, 2.2979370815756375, 2.3710984294886184, 4.248011524149763, 2.2786758558964095, 2.6653693508689518, 3.1613963744425266, 3.6807725207274395), # 127
(3.5603910613024183, 2.908802053550694, 3.57462460919298, 4.168284603820933, 4.113353049741916, 2.2332037612347775, 2.287954321254953, 2.367014625086425, 4.241537884852394, 2.2707548641958453, 2.6566347652730897, 3.1518853268635154, 3.671440782865815), # 128
(3.546818353780113, 2.8938940973492966, 3.566080937735376, 4.156078764613353, 4.102954815293325, 2.229062723853478, 2.2779365995029255, 2.363003837170504, 4.23502804792687, 2.2627993570266183, 2.6478644892094287, 3.1422793152330546, 3.6618992825828154), # 129
(3.532998383957347, 2.8789244235143867, 3.5573901626924718, 4.143690839819635, 4.092294497876085, 2.2248776893295235, 2.267865727730825, 2.3590474896599, 4.228462293014, 2.254792591033103, 2.639039123548738, 3.1325599514092612, 3.6521359024430993), # 130
(3.5189166055232377, 2.863868878859251, 3.5485365195341525, 4.1310996358641905, 4.081360047987498, 2.2206376161293124, 2.2577235173499237, 2.35512700647366, 4.2218208997545945, 2.246717822859674, 2.6301392691617873, 3.1227088472502498, 3.6421385250113247), # 131
(3.504558472166904, 2.8487033101971777, 3.5395042437302986, 4.118283959171435, 4.070139416124862, 2.216331462719241, 2.24749177977149, 2.3512238115308293, 4.215084147789462, 2.2385583091507057, 2.6211455269193458, 3.112707614614137, 3.6318950328521504), # 132
(3.4899094375774653, 2.833403564341454, 3.5302775707507936, 4.105222616165781, 4.058620552785475, 2.2119481875657065, 2.237152326406796, 2.347319328750453, 4.2082323167594105, 2.230297306550573, 2.6120384976921844, 3.102537865359037, 3.6213933085302346), # 133
(3.474954955444038, 2.8179454881053694, 3.5208407360655216, 4.091894413271642, 4.046791408466637, 2.207476749135106, 2.2266869686671114, 2.3433949820515774, 4.201245686305252, 2.2219180717036493, 2.6027987823510714, 3.0921812113430667, 3.6106212346102335), # 134
(3.4596804794557414, 2.8023049283022097, 3.5111779751443635, 4.078278156913432, 4.034639933665648, 2.202906105893837, 2.2160775179637073, 2.339432195353248, 4.194104536067792, 2.2134038612543105, 2.593406981766777, 3.081619264424341, 3.599566693656808), # 135
(3.444071463301694, 2.786457731745264, 3.5012735234572037, 4.064352653515562, 4.022154078879807, 2.198225216308296, 2.205305785707854, 2.335412392574511, 4.186789145687842, 2.204737931846929, 2.583843696810071, 3.0708336364609767, 3.5882175682346147), # 136
(3.4281133606710137, 2.770379745247819, 3.4911116164739244, 4.0500967095024505, 4.0093217946064135, 2.1934230388448794, 2.1943535833108223, 2.3313169976344117, 4.179279794806213, 2.195903540125881, 2.5740895283517222, 3.059805939311088, 3.5765617409083106), # 137
(3.4117916252528193, 2.7540468156231634, 3.480676489664407, 4.0354891312985055, 3.9961310313427676, 2.1884885319699854, 2.1832027221838817, 2.327127434451996, 4.1715567630637125, 2.186883942735539, 2.564125077262501, 3.048517784832791, 3.5645870942425564), # 138
(3.3950917107362275, 2.7374347896845848, 3.469952378498536, 4.020508725328144, 3.9825697395861663, 2.1834106541500105, 2.171835013738304, 2.32282512694631, 4.163600330101149, 2.177662396320279, 2.5539309444131764, 3.0369507848842026, 3.5522815108020076), # 139
(3.3779990708103593, 2.72051951424537, 3.458923518446195, 4.005134298015778, 3.968625869833912, 2.1781783638513517, 2.1602322693853586, 2.3183914990363985, 4.155390775559333, 2.1682221575244744, 2.5434877306745176, 3.0250865513234366, 3.539632873151326), # 140
(3.3604991591643323, 2.7032768361188086, 3.4475741449772643, 3.989344655785821, 3.9542873725833014, 2.172780619540406, 2.148376300536318, 2.3138079746413083, 4.146908379079072, 2.1585464829925005, 2.5327760369172956, 3.01290669600861, 3.5266290638551654), # 141
(3.3425774294872626, 2.6856826021181863, 3.4358884935616283, 3.9731186050626883, 3.939542198331635, 2.167206379683571, 2.1362489186024507, 2.3090559776800847, 4.138133420301177, 2.1486186293687313, 2.521776464012279, 3.000392830797838, 3.5132579654781866), # 142
(3.32421933546827, 2.6677126590567926, 3.4238507996691703, 3.95643495227079, 3.9243782975762116, 2.1614446027472427, 2.1238319349950276, 2.3041169320717727, 4.129046178866459, 2.138421853297541, 2.5104696128302373, 2.987526567549236, 3.499507460585047), # 143
(3.305410330796474, 2.6493428537479145, 3.411445298769771, 3.939272503834543, 3.9087836208143316, 2.1554842471978186, 2.1111071611253194, 2.2989722617354196, 4.119626934415724, 2.127939411423304, 2.4988360842419404, 2.9742895181209197, 3.485365431740406), # 144
(3.286135869160991, 2.63054903300484, 3.3986562263333155, 3.921610066178358, 3.892746118543293, 2.149314271501696, 2.0980564084045974, 2.2936033905900706, 4.109855966589782, 2.117154560390395, 2.486856479118158, 2.9606632943710056, 3.47081976150892), # 145
(3.2663814042509403, 2.6113070436408568, 3.385467817829687, 3.9034264457266503, 3.8762537412603972, 2.1429236341252724, 2.084661488244132, 2.287991742554771, 4.099713555029442, 2.106050556843188, 2.4745113983296596, 2.946629508157608, 3.4558583324552474), # 146
(3.24613238975544, 2.5915927324692523, 3.371864308728764, 3.884700448903832, 3.859294439462941, 2.136301293534943, 2.0709042120551926, 2.282118741548566, 4.089179979375516, 2.0946106574260583, 2.4617814427472147, 2.9321697713388444, 3.4404690271440472), # 147
(3.2253742793636087, 2.5713819463033154, 3.357829934500433, 3.8654108821343187, 3.8418561636482247, 2.129436208197107, 2.0567663912490506, 2.275965811490503, 4.078235519268811, 2.0828181187833787, 2.448647213241593, 2.9172656957728282, 3.4246397281399767), # 148
(3.204092526764565, 2.5506505319563324, 3.3433489306145776, 3.845536551842521, 3.8239268643135484, 2.12231733657816, 2.0422298372369765, 2.2695143762996266, 4.066860454350135, 2.0706561975595252, 2.435089310683564, 2.901898893317677, 3.408358318007695), # 149
(3.182272585647426, 2.5293743362415917, 3.328405532541078, 3.825056264452855, 3.8054944919562104, 2.1149336371444996, 2.0272763614302405, 2.2627458598949826, 4.055035064260301, 2.0581081503988705, 2.4210883359438973, 2.8860509758315054, 3.3916126793118586), # 150
(3.15989990970131, 2.5075292059723817, 3.312983975749817, 3.803948826389732, 3.786546997073511, 2.107274068362522, 2.011887775240113, 2.2556416861956174, 4.042739628640116, 2.0451572339457913, 2.406624889893362, 2.869703555172429, 3.3743906946171274), # 151
(3.1369599526153373, 2.485090987961989, 3.297068495710681, 3.7821930440775677, 3.7670723301627476, 2.0993275886986256, 1.996045890077866, 2.2481832791205765, 4.029954427130388, 2.03178670484466, 2.3916795734027287, 2.8528382431985637, 3.356680246488159), # 152
(3.1134381680786243, 2.462035529023703, 3.2806433278935474, 3.759767723940773, 3.7470584417212223, 2.0910831566192063, 1.9797325173547677, 2.240352062588905, 4.01665973937193, 2.0179798197398515, 2.3762329873427666, 2.835436651768026, 3.338469217489611), # 153
(3.0893200097802915, 2.43833867597081, 3.2636927077683033, 3.736651672403764, 3.726493282246232, 2.082529730590662, 1.9629294684820913, 2.232129460519649, 4.002835845005547, 2.0037198352757413, 2.360265732584245, 2.81748039273893, 3.319745490186143), # 154
(3.0645909314094544, 2.413976275616598, 3.2462008708048304, 3.7128236958909513, 3.7053648022350787, 2.0736562690793887, 1.9456185548711045, 2.2234968968318545, 3.9884630236720513, 1.9889900080967018, 2.343758409997933, 2.798951077969393, 3.3004969471424106), # 155
(3.0392363866552325, 2.3889241747743553, 3.2281520524730105, 3.68826260082675, 3.6836609521850594, 2.0644517305517844, 1.92778158793308, 2.2144357954445675, 3.9735215550122507, 1.9737735948471091, 2.3266916204546018, 2.7798303193175293, 3.280711470923074), # 156
(3.013241829206745, 2.3631582202573695, 3.209530488242727, 3.662947193635575, 3.661369682593474, 2.0549050734742456, 1.9094003790792877, 2.204927580276833, 3.9579917186669555, 1.9580538521713367, 2.3090459648250197, 2.760099728641455, 3.2603769440927906), # 157
(2.985872378562096, 2.3361812483089035, 3.1894367815609423, 3.6359078326604974, 3.637472442348399, 2.044409790526844, 1.890042688371143, 2.194318780939749, 3.9406648366396393, 1.9413463665164574, 2.290238301015577, 2.739039825677736, 3.238594343766138), # 158
(2.9529147067913613, 2.305226127839791, 3.162695127361195, 3.6015908635153817, 3.6060765239126513, 2.0294758592028415, 1.8672851053542865, 2.178885413105753, 3.914570904488858, 1.9209123976394982, 2.2669667742475976, 2.7125450094732435, 3.210171058768078), # 159
(2.913948837961724, 2.2700386914162856, 3.1287683831823556, 3.559431004163544, 3.5665680525387184, 2.0097365184190736, 1.8408974993535137, 2.158239675810939, 3.8789700908914604, 1.8964822607451575, 2.238903803443816, 2.680200779555139, 3.1745682435574323), # 160
(2.869288821834384, 2.2308483472321874, 3.0880187887641237, 3.509829001502691, 3.5193572497128454, 1.9854308966281256, 1.8110725784027506, 2.132640213243912, 3.834331906799607, 1.8682632772683752, 2.206296661839883, 2.6423069875630283, 3.132149617927639), # 161
(2.8192487081705426, 2.1878845034812957, 3.0408085838461982, 3.4531856024305307, 3.464854336921282, 1.9567981222825823, 1.7780030505359237, 2.102345669593281, 3.781125863165455, 1.8364627686440926, 2.1693926226714484, 2.5991634851365175, 3.0832789016721334), # 162
(2.7641425467313994, 2.1413765683574097, 2.987500008168281, 3.3899015538447737, 3.4034695356502755, 1.924077323835029, 1.7418816237869603, 2.06761468904765, 3.7198214709411626, 1.80128805630725, 2.1284389591741633, 2.5510701239152134, 3.0283198145843517), # 163
(2.704284387278154, 2.0915539500543283, 2.9284553014700707, 3.320377602643127, 3.3356130673860758, 1.8875076297380518, 1.7029010061897865, 2.0287059157956278, 3.6508882410788894, 1.7629464616927875, 2.0836829445836784, 2.4983267555387214, 2.9676360764577314), # 164
(2.639988279572007, 2.038646056765853, 2.8640367034912675, 3.245014495723301, 3.2616951536149297, 1.8473281684442346, 1.6612539057783289, 1.9858779940258184, 3.574795684530792, 1.7216453062356454, 2.0353718521356448, 2.441233231646648, 2.901591407085708), # 165
(2.571568273374159, 1.9828822966857818, 2.7946064539715714, 3.1642129799830006, 3.1821260158230857, 1.8037780684061635, 1.6171330305865146, 1.939389567926831, 3.4920133122490293, 1.677591911370765, 1.9837529550657118, 2.3800894038786007, 2.830549526261718), # 166
(2.4993384184458094, 1.9244920780079149, 2.720526792650682, 3.0783738023199376, 3.097315875496792, 1.7570964580764235, 1.57073108864827, 1.8894992816872707, 3.40301063518576, 1.6309935985330857, 1.929073526609531, 2.3151951238741835, 2.7548741537791983), # 167
(2.4236127645481584, 1.8637048089260515, 2.6421599592682994, 2.9878977096318184, 3.007674954122297, 1.7075224659075996, 1.5222407879975217, 1.836465779495744, 3.308257164293142, 1.5820576891575489, 1.8715808400027525, 2.2468502432730046, 2.674929009431585), # 168
(2.344705361442406, 1.8007498976339917, 2.5598681935641237, 2.8931854488163533, 2.913613473185848, 1.655295220352278, 1.4718548366681967, 1.780547705540858, 3.2082224105233355, 1.5309915046790947, 1.8115221684810274, 2.175354613714669, 2.591077813012314), # 169
(2.2629302588897535, 1.735856752325535, 2.474013735277854, 2.794637766771248, 2.8155416541736935, 1.6006538498630427, 1.4197659426942213, 1.722003704011219, 3.1033758848284956, 1.4780023665326631, 1.7491447852800066, 2.1010080868387835, 2.503684284314822), # 170
(2.1786015066514, 1.6692547811944802, 2.3849588241491912, 2.6926554103942144, 2.7138697185720826, 1.5438374828924795, 1.3661668141095222, 1.6610924190954333, 2.9941870981607828, 1.4232975961531955, 1.6846959636353394, 2.0241105142849545, 2.413112143132546), # 171
(2.092033154488546, 1.6011733924346279, 2.2930656999178347, 2.5876391265829586, 2.6090078878672616, 1.4850852478931735, 1.3112501589480263, 1.5980724949821083, 2.8811255614723543, 1.367084514975632, 1.6184229767826777, 1.9449617476927885, 2.3197251092589215), # 172
(2.003539252162392, 1.531841994239777, 2.198696602323485, 2.4799896622351905, 2.5013663835454807, 1.42463627331771, 1.25520868524366, 1.5332025758598495, 2.7646607857153693, 1.3095704444349128, 1.5505730979576713, 1.86386163870189, 2.223886902487385), # 173
(1.9134338494341376, 1.4614899948037272, 2.102213771105841, 2.3701077642486164, 2.3913554270929867, 1.362729687618674, 1.1982351010303502, 1.4667413059172643, 2.6452622818419855, 1.2509627059659787, 1.4813936003959711, 1.7811100389518673, 2.1259612426113734), # 174
(1.8220309960649823, 1.3903468023202779, 2.003979446004603, 2.258394179520947, 2.2793852399960275, 1.2996046192486514, 1.1405221143420232, 1.3989473293429584, 2.5233995608043625, 1.1914686210037697, 1.4111317573332278, 1.6970068000823257, 2.026311849424323), # 175
(1.7296447418161276, 1.3186418249832292, 1.9043558667594713, 2.14524965494989, 2.165866043740852, 1.2355001966602268, 1.082262433212606, 1.3300792903255396, 2.399542133554657, 1.1312955109832268, 1.340034842005092, 1.6118517737328717, 1.9253024427196697), # 176
(1.636589136448773, 1.2466044709863806, 1.8037052731101455, 2.031074937433153, 2.0512080598137095, 1.1706555483059853, 1.0236487656760251, 1.2603958330536131, 2.274159511045028, 1.0706506973392897, 1.2683501276472144, 1.5259448115431116, 1.82329674229085), # 177
(1.5431782297241188, 1.1744641485235314, 1.7023899047963256, 1.9162707738684466, 1.9358215097008455, 1.105309802638513, 0.964873819766207, 1.1901556017157862, 2.147721204227634, 1.0097415015069, 1.196324887495245, 1.439585765152651, 1.7206584679313008), # 178
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 179
)
passenger_arriving_acc = (
(2, 0, 1, 3, 1, 1, 2, 1, 0, 1, 0, 0, 0, 3, 1, 3, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0), # 0
(4, 2, 5, 5, 1, 2, 2, 2, 2, 1, 0, 1, 0, 7, 7, 4, 3, 3, 1, 1, 1, 2, 0, 0, 0, 0), # 1
(6, 4, 8, 8, 1, 4, 2, 3, 3, 1, 1, 1, 0, 9, 8, 8, 5, 5, 1, 4, 2, 3, 0, 0, 1, 0), # 2
(12, 5, 10, 9, 4, 5, 2, 4, 5, 2, 1, 1, 0, 11, 9, 10, 8, 6, 1, 4, 3, 3, 1, 0, 2, 0), # 3
(14, 10, 13, 14, 4, 5, 2, 4, 6, 2, 1, 2, 0, 12, 14, 11, 9, 8, 2, 5, 4, 3, 2, 2, 2, 0), # 4
(16, 12, 16, 15, 5, 6, 2, 5, 7, 2, 3, 2, 0, 13, 15, 12, 10, 9, 5, 8, 6, 3, 2, 2, 3, 0), # 5
(20, 17, 17, 19, 5, 8, 2, 6, 8, 4, 5, 3, 0, 17, 16, 13, 10, 10, 6, 9, 7, 3, 3, 3, 3, 0), # 6
(21, 19, 20, 25, 5, 9, 4, 7, 8, 4, 7, 4, 0, 18, 18, 15, 11, 15, 7, 9, 11, 5, 3, 6, 3, 0), # 7
(22, 23, 21, 28, 6, 11, 5, 7, 8, 5, 7, 4, 0, 22, 21, 19, 15, 16, 7, 9, 11, 7, 3, 8, 4, 0), # 8
(26, 23, 22, 30, 7, 13, 7, 8, 9, 6, 7, 4, 0, 25, 26, 21, 18, 18, 10, 10, 14, 7, 3, 9, 4, 0), # 9
(27, 23, 22, 34, 9, 15, 9, 9, 9, 6, 8, 4, 0, 32, 29, 25, 18, 18, 15, 11, 16, 7, 5, 9, 4, 0), # 10
(30, 26, 25, 38, 12, 16, 9, 9, 11, 7, 8, 4, 0, 37, 32, 29, 19, 19, 16, 12, 18, 8, 8, 10, 4, 0), # 11
(33, 29, 29, 40, 15, 16, 9, 10, 13, 9, 9, 4, 0, 39, 35, 32, 23, 22, 19, 12, 19, 8, 8, 11, 4, 0), # 12
(36, 32, 30, 41, 18, 17, 10, 10, 15, 11, 10, 5, 0, 43, 39, 33, 25, 23, 20, 12, 21, 11, 11, 12, 4, 0), # 13
(39, 34, 33, 44, 19, 18, 11, 11, 16, 12, 10, 5, 0, 46, 41, 35, 31, 30, 22, 15, 22, 12, 11, 13, 5, 0), # 14
(45, 35, 34, 46, 21, 19, 11, 12, 18, 12, 10, 5, 0, 49, 45, 39, 31, 34, 23, 18, 22, 14, 12, 13, 5, 0), # 15
(49, 38, 34, 49, 21, 20, 14, 13, 19, 14, 11, 6, 0, 51, 51, 41, 34, 36, 25, 20, 22, 15, 14, 13, 5, 0), # 16
(54, 49, 35, 56, 25, 22, 14, 14, 22, 14, 12, 6, 0, 54, 52, 46, 36, 42, 25, 21, 24, 16, 14, 13, 5, 0), # 17
(60, 53, 37, 60, 26, 23, 16, 14, 22, 14, 12, 6, 0, 59, 54, 46, 37, 47, 25, 22, 24, 16, 14, 15, 7, 0), # 18
(66, 59, 40, 63, 30, 23, 18, 16, 24, 15, 12, 7, 0, 62, 57, 51, 39, 51, 28, 22, 25, 17, 14, 15, 8, 0), # 19
(74, 65, 43, 67, 32, 25, 22, 19, 27, 16, 12, 8, 0, 65, 57, 52, 43, 54, 29, 25, 26, 19, 17, 17, 8, 0), # 20
(79, 69, 45, 73, 34, 27, 23, 20, 31, 18, 15, 8, 0, 69, 61, 54, 45, 62, 33, 26, 28, 19, 17, 19, 8, 0), # 21
(82, 73, 49, 76, 38, 28, 24, 20, 32, 20, 16, 8, 0, 72, 63, 54, 46, 64, 35, 28, 29, 20, 19, 21, 8, 0), # 22
(83, 75, 54, 80, 41, 28, 26, 24, 35, 22, 16, 8, 0, 79, 68, 56, 49, 70, 38, 30, 32, 23, 20, 21, 8, 0), # 23
(85, 83, 55, 83, 42, 31, 27, 27, 37, 23, 17, 9, 0, 85, 73, 56, 52, 72, 41, 31, 32, 24, 24, 22, 8, 0), # 24
(92, 86, 58, 86, 45, 31, 28, 27, 39, 24, 18, 9, 0, 89, 73, 58, 56, 76, 45, 31, 32, 24, 25, 22, 9, 0), # 25
(96, 86, 60, 89, 47, 35, 29, 28, 40, 26, 19, 9, 0, 94, 74, 61, 58, 77, 46, 32, 32, 24, 26, 22, 9, 0), # 26
(101, 90, 66, 93, 48, 36, 30, 30, 43, 28, 23, 9, 0, 97, 78, 61, 59, 78, 46, 34, 32, 24, 26, 22, 9, 0), # 27
(104, 95, 70, 95, 51, 38, 31, 31, 45, 28, 25, 10, 0, 100, 82, 67, 61, 84, 47, 35, 32, 25, 26, 23, 9, 0), # 28
(107, 99, 72, 104, 51, 40, 33, 33, 49, 29, 25, 10, 0, 105, 85, 70, 62, 89, 49, 35, 34, 26, 28, 23, 9, 0), # 29
(113, 103, 73, 106, 55, 41, 34, 36, 50, 29, 26, 11, 0, 110, 89, 73, 64, 91, 50, 38, 34, 29, 29, 23, 12, 0), # 30
(114, 107, 77, 111, 56, 43, 36, 38, 53, 30, 27, 11, 0, 119, 93, 74, 68, 95, 51, 39, 35, 34, 31, 23, 12, 0), # 31
(122, 111, 82, 111, 59, 44, 37, 39, 54, 31, 28, 12, 0, 122, 94, 78, 69, 100, 53, 40, 38, 34, 31, 24, 12, 0), # 32
(125, 117, 84, 113, 61, 46, 38, 40, 55, 31, 28, 12, 0, 126, 102, 80, 73, 107, 55, 45, 39, 35, 34, 25, 12, 0), # 33
(130, 121, 87, 115, 65, 47, 42, 42, 55, 31, 29, 12, 0, 128, 107, 89, 77, 109, 56, 49, 39, 37, 35, 25, 12, 0), # 34
(133, 124, 90, 117, 69, 50, 44, 45, 57, 31, 29, 12, 0, 133, 110, 90, 80, 109, 57, 50, 40, 38, 36, 25, 12, 0), # 35
(137, 127, 92, 125, 72, 52, 46, 46, 59, 31, 29, 12, 0, 136, 112, 92, 85, 112, 58, 51, 40, 40, 36, 25, 12, 0), # 36
(142, 129, 94, 127, 79, 53, 46, 49, 61, 32, 29, 12, 0, 143, 114, 96, 86, 116, 62, 54, 40, 43, 36, 27, 12, 0), # 37
(144, 135, 98, 137, 82, 54, 49, 49, 65, 32, 29, 13, 0, 146, 116, 100, 86, 119, 63, 54, 42, 45, 36, 27, 12, 0), # 38
(147, 137, 103, 138, 87, 57, 53, 50, 65, 32, 31, 13, 0, 150, 120, 103, 89, 124, 67, 55, 42, 45, 37, 27, 13, 0), # 39
(150, 142, 104, 143, 88, 59, 57, 53, 67, 34, 31, 13, 0, 151, 125, 104, 90, 127, 69, 55, 42, 46, 38, 27, 14, 0), # 40
(153, 143, 106, 150, 93, 60, 59, 54, 68, 35, 31, 13, 0, 151, 128, 109, 93, 133, 73, 56, 44, 47, 39, 27, 14, 0), # 41
(158, 146, 110, 154, 97, 63, 60, 54, 69, 36, 32, 13, 0, 155, 132, 110, 97, 135, 74, 59, 44, 49, 40, 28, 14, 0), # 42
(161, 155, 116, 160, 100, 65, 65, 58, 70, 40, 32, 13, 0, 156, 133, 114, 99, 137, 74, 61, 46, 49, 41, 30, 15, 0), # 43
(163, 157, 117, 163, 101, 67, 69, 58, 72, 40, 34, 13, 0, 159, 137, 116, 100, 139, 75, 64, 48, 50, 43, 30, 15, 0), # 44
(171, 163, 118, 166, 104, 69, 72, 58, 73, 40, 34, 14, 0, 163, 145, 118, 103, 143, 77, 67, 48, 51, 44, 31, 15, 0), # 45
(176, 169, 120, 166, 106, 70, 73, 60, 73, 40, 34, 15, 0, 169, 148, 121, 106, 147, 79, 68, 49, 52, 46, 32, 15, 0), # 46
(182, 174, 123, 171, 110, 72, 73, 62, 74, 42, 36, 15, 0, 169, 151, 124, 108, 153, 81, 70, 51, 52, 48, 32, 15, 0), # 47
(185, 180, 123, 174, 115, 74, 74, 64, 77, 43, 36, 15, 0, 173, 155, 128, 108, 156, 83, 71, 53, 54, 49, 32, 15, 0), # 48
(189, 183, 128, 181, 118, 76, 75, 65, 79, 44, 36, 15, 0, 175, 159, 131, 109, 160, 85, 72, 54, 56, 51, 32, 15, 0), # 49
(194, 190, 129, 184, 124, 78, 75, 66, 81, 45, 37, 16, 0, 182, 163, 134, 111, 163, 90, 76, 54, 56, 52, 32, 16, 0), # 50
(199, 193, 132, 191, 126, 79, 78, 66, 81, 45, 37, 16, 0, 183, 167, 135, 115, 166, 91, 76, 56, 58, 55, 33, 17, 0), # 51
(200, 197, 136, 200, 129, 83, 79, 67, 83, 45, 39, 16, 0, 186, 172, 138, 116, 172, 92, 76, 56, 58, 56, 33, 17, 0), # 52
(204, 200, 140, 203, 134, 85, 81, 69, 87, 46, 40, 18, 0, 188, 179, 140, 119, 174, 94, 77, 56, 59, 57, 34, 17, 0), # 53
(211, 206, 147, 207, 139, 87, 83, 71, 87, 46, 40, 19, 0, 193, 180, 142, 120, 177, 98, 79, 58, 60, 57, 34, 17, 0), # 54
(216, 210, 149, 212, 143, 87, 85, 72, 88, 46, 40, 19, 0, 196, 182, 145, 123, 182, 99, 82, 58, 61, 57, 34, 17, 0), # 55
(219, 213, 153, 216, 147, 89, 85, 73, 89, 46, 41, 19, 0, 201, 185, 147, 124, 185, 104, 82, 60, 61, 59, 35, 17, 0), # 56
(222, 217, 153, 221, 149, 92, 86, 74, 92, 47, 41, 20, 0, 205, 188, 154, 125, 187, 106, 83, 61, 63, 59, 35, 17, 0), # 57
(229, 220, 159, 224, 151, 92, 90, 74, 93, 47, 41, 20, 0, 211, 191, 156, 125, 189, 106, 86, 64, 65, 59, 35, 17, 0), # 58
(234, 226, 164, 227, 155, 93, 93, 76, 94, 47, 41, 20, 0, 215, 192, 156, 126, 192, 107, 86, 64, 67, 59, 36, 18, 0), # 59
(241, 230, 168, 231, 157, 93, 93, 76, 96, 48, 44, 20, 0, 215, 198, 156, 127, 196, 107, 87, 65, 69, 61, 37, 18, 0), # 60
(246, 231, 168, 234, 157, 93, 94, 76, 100, 49, 45, 20, 0, 216, 203, 159, 128, 199, 108, 89, 68, 72, 62, 38, 19, 0), # 61
(251, 234, 170, 238, 159, 96, 95, 77, 103, 49, 45, 20, 0, 222, 207, 164, 129, 201, 110, 91, 69, 73, 65, 39, 19, 0), # 62
(258, 237, 178, 243, 162, 96, 96, 78, 104, 50, 45, 21, 0, 225, 208, 164, 129, 203, 111, 91, 69, 73, 67, 40, 19, 0), # 63
(263, 241, 179, 247, 165, 97, 101, 79, 106, 52, 45, 21, 0, 231, 209, 166, 134, 206, 112, 92, 69, 74, 69, 41, 19, 0), # 64
(265, 244, 183, 250, 167, 100, 104, 81, 108, 53, 45, 21, 0, 236, 212, 167, 137, 209, 113, 92, 70, 74, 70, 43, 20, 0), # 65
(268, 250, 189, 256, 170, 100, 109, 82, 109, 54, 45, 21, 0, 242, 214, 170, 137, 213, 117, 97, 70, 75, 71, 43, 20, 0), # 66
(269, 253, 192, 264, 172, 100, 111, 84, 112, 56, 46, 21, 0, 249, 216, 172, 138, 214, 118, 97, 70, 75, 73, 44, 20, 0), # 67
(275, 258, 193, 266, 176, 102, 111, 85, 114, 57, 46, 21, 0, 253, 219, 177, 141, 217, 118, 98, 71, 78, 74, 44, 20, 0), # 68
(279, 259, 195, 269, 183, 102, 114, 89, 115, 61, 46, 21, 0, 255, 222, 179, 143, 224, 119, 102, 71, 79, 74, 44, 20, 0), # 69
(285, 264, 201, 270, 188, 103, 114, 89, 117, 62, 47, 21, 0, 258, 226, 180, 145, 227, 120, 103, 71, 79, 75, 44, 20, 0), # 70
(289, 270, 204, 274, 192, 103, 114, 89, 118, 63, 47, 22, 0, 261, 229, 182, 146, 230, 122, 103, 71, 80, 75, 44, 23, 0), # 71
(292, 273, 206, 281, 194, 103, 114, 92, 118, 63, 47, 22, 0, 264, 232, 185, 147, 231, 123, 107, 72, 80, 75, 44, 23, 0), # 72
(296, 277, 210, 283, 197, 104, 116, 92, 119, 65, 47, 23, 0, 269, 235, 186, 148, 236, 124, 109, 73, 81, 75, 44, 24, 0), # 73
(298, 278, 216, 285, 201, 107, 117, 93, 120, 66, 47, 23, 0, 271, 238, 187, 151, 239, 125, 111, 73, 85, 75, 45, 25, 0), # 74
(302, 280, 219, 287, 205, 108, 117, 93, 123, 67, 47, 23, 0, 274, 246, 192, 151, 244, 126, 112, 74, 85, 76, 49, 25, 0), # 75
(306, 283, 225, 293, 207, 109, 118, 95, 125, 68, 48, 23, 0, 285, 249, 194, 155, 247, 128, 112, 76, 87, 77, 49, 25, 0), # 76
(309, 291, 229, 295, 211, 111, 118, 96, 126, 68, 49, 23, 0, 289, 252, 197, 159, 249, 128, 113, 78, 88, 77, 49, 25, 0), # 77
(311, 296, 234, 296, 211, 113, 121, 97, 129, 70, 50, 23, 0, 293, 257, 200, 161, 251, 129, 117, 79, 90, 77, 49, 26, 0), # 78
(314, 299, 237, 297, 211, 114, 122, 98, 131, 70, 50, 25, 0, 296, 259, 204, 161, 259, 130, 118, 80, 91, 79, 50, 26, 0), # 79
(317, 302, 239, 300, 213, 116, 123, 100, 132, 73, 50, 25, 0, 300, 263, 207, 162, 263, 130, 120, 81, 91, 82, 54, 26, 0), # 80
(319, 304, 242, 302, 215, 117, 123, 100, 135, 74, 50, 26, 0, 302, 267, 210, 167, 269, 131, 124, 82, 91, 82, 55, 27, 0), # 81
(325, 308, 246, 304, 218, 117, 125, 100, 139, 74, 50, 26, 0, 305, 268, 213, 170, 273, 137, 125, 82, 94, 85, 56, 27, 0), # 82
(327, 314, 250, 306, 221, 118, 128, 101, 142, 75, 50, 26, 0, 311, 268, 215, 170, 276, 139, 125, 82, 96, 87, 56, 27, 0), # 83
(331, 319, 257, 307, 224, 119, 129, 101, 144, 76, 51, 26, 0, 315, 271, 218, 173, 282, 142, 126, 82, 98, 88, 57, 27, 0), # 84
(333, 322, 263, 311, 226, 120, 130, 102, 146, 76, 51, 27, 0, 324, 272, 218, 176, 286, 143, 129, 83, 100, 89, 58, 27, 0), # 85
(336, 330, 267, 314, 228, 121, 132, 102, 149, 76, 52, 27, 0, 326, 274, 219, 178, 290, 145, 131, 86, 102, 91, 59, 27, 0), # 86
(340, 333, 269, 318, 229, 122, 134, 102, 151, 76, 52, 27, 0, 328, 282, 223, 182, 292, 148, 132, 87, 102, 91, 61, 27, 0), # 87
(349, 333, 271, 322, 231, 122, 135, 102, 153, 77, 52, 27, 0, 328, 286, 227, 186, 293, 149, 133, 87, 104, 92, 63, 27, 0), # 88
(355, 336, 273, 326, 238, 126, 136, 102, 156, 79, 52, 29, 0, 332, 291, 229, 190, 297, 151, 134, 88, 105, 93, 64, 27, 0), # 89
(360, 339, 276, 331, 242, 128, 137, 103, 160, 79, 52, 29, 0, 337, 296, 230, 192, 301, 155, 134, 88, 107, 96, 64, 27, 0), # 90
(365, 343, 276, 333, 246, 129, 138, 103, 162, 81, 52, 29, 0, 341, 302, 232, 195, 307, 155, 138, 89, 109, 97, 64, 28, 0), # 91
(370, 348, 280, 335, 249, 130, 140, 105, 163, 81, 52, 29, 0, 347, 305, 234, 197, 309, 156, 139, 90, 109, 99, 64, 28, 0), # 92
(373, 349, 284, 339, 250, 131, 143, 107, 165, 81, 54, 29, 0, 351, 310, 235, 200, 310, 156, 141, 90, 109, 100, 65, 28, 0), # 93
(378, 353, 295, 343, 254, 132, 143, 108, 168, 82, 54, 29, 0, 356, 316, 237, 201, 310, 157, 142, 91, 110, 101, 65, 28, 0), # 94
(383, 357, 297, 344, 258, 135, 144, 108, 168, 83, 54, 29, 0, 356, 318, 238, 201, 312, 158, 143, 91, 112, 101, 65, 28, 0), # 95
(388, 361, 301, 347, 261, 136, 146, 109, 170, 83, 55, 30, 0, 362, 320, 240, 201, 315, 161, 143, 93, 113, 102, 67, 28, 0), # 96
(389, 365, 302, 350, 266, 137, 147, 110, 173, 84, 55, 30, 0, 365, 325, 242, 202, 316, 163, 146, 93, 115, 103, 68, 28, 0), # 97
(394, 365, 309, 355, 269, 137, 148, 110, 176, 84, 57, 31, 0, 369, 326, 245, 205, 317, 165, 148, 93, 119, 105, 69, 28, 0), # 98
(400, 369, 311, 357, 274, 139, 149, 114, 178, 85, 57, 31, 0, 373, 329, 248, 206, 320, 168, 148, 93, 121, 106, 69, 30, 0), # 99
(405, 371, 312, 359, 276, 139, 149, 117, 178, 85, 58, 32, 0, 379, 333, 249, 207, 323, 169, 149, 96, 122, 106, 69, 31, 0), # 100
(407, 376, 318, 363, 278, 139, 151, 119, 179, 85, 58, 33, 0, 383, 338, 251, 209, 324, 174, 149, 96, 125, 109, 69, 31, 0), # 101
(410, 381, 324, 370, 283, 140, 151, 119, 183, 86, 58, 34, 0, 389, 340, 255, 210, 326, 177, 151, 96, 128, 109, 70, 31, 0), # 102
(415, 383, 327, 375, 286, 141, 153, 119, 187, 86, 58, 35, 0, 392, 342, 255, 213, 327, 178, 152, 97, 128, 109, 73, 31, 0), # 103
(421, 388, 333, 379, 289, 142, 155, 120, 190, 87, 58, 35, 0, 400, 344, 258, 215, 327, 179, 156, 97, 129, 110, 73, 31, 0), # 104
(425, 392, 339, 385, 290, 142, 158, 121, 191, 87, 58, 35, 0, 404, 345, 262, 216, 331, 181, 162, 99, 129, 110, 73, 31, 0), # 105
(426, 398, 341, 390, 294, 144, 159, 121, 193, 88, 59, 35, 0, 405, 348, 266, 218, 334, 182, 162, 100, 130, 110, 73, 31, 0), # 106
(426, 403, 345, 392, 299, 145, 159, 122, 194, 88, 60, 36, 0, 409, 353, 269, 218, 336, 185, 162, 101, 130, 112, 74, 31, 0), # 107
(429, 408, 349, 394, 301, 146, 160, 123, 197, 88, 61, 36, 0, 413, 357, 271, 220, 338, 186, 164, 101, 130, 114, 76, 31, 0), # 108
(434, 410, 352, 396, 303, 147, 161, 124, 199, 89, 62, 36, 0, 415, 363, 273, 224, 343, 186, 167, 102, 132, 115, 77, 31, 0), # 109
(439, 414, 357, 397, 304, 150, 162, 125, 199, 90, 63, 36, 0, 422, 365, 274, 224, 344, 188, 167, 102, 133, 116, 77, 31, 0), # 110
(440, 418, 359, 398, 307, 150, 166, 127, 200, 90, 63, 37, 0, 424, 367, 276, 229, 346, 191, 169, 102, 133, 119, 77, 31, 0), # 111
(443, 423, 362, 404, 309, 150, 167, 128, 200, 91, 63, 37, 0, 427, 369, 278, 229, 348, 192, 170, 102, 135, 119, 78, 31, 0), # 112
(444, 425, 363, 406, 311, 152, 167, 129, 205, 92, 63, 37, 0, 429, 372, 280, 229, 351, 194, 171, 103, 136, 119, 78, 31, 0), # 113
(449, 427, 364, 412, 313, 152, 168, 129, 207, 93, 63, 37, 0, 433, 376, 281, 231, 352, 196, 173, 104, 137, 121, 78, 32, 0), # 114
(452, 435, 365, 420, 315, 152, 169, 131, 209, 94, 63, 37, 0, 439, 378, 284, 234, 355, 197, 175, 106, 139, 122, 79, 33, 0), # 115
(454, 436, 366, 424, 318, 154, 172, 132, 211, 94, 65, 37, 0, 443, 381, 285, 234, 357, 200, 176, 106, 141, 125, 80, 33, 0), # 116
(458, 441, 368, 429, 321, 156, 172, 133, 216, 94, 65, 38, 0, 449, 384, 286, 235, 362, 202, 178, 106, 143, 127, 80, 34, 0), # 117
(460, 446, 372, 437, 322, 160, 173, 133, 217, 95, 67, 38, 0, 451, 390, 288, 237, 363, 202, 181, 107, 145, 127, 81, 34, 0), # 118
(462, 448, 373, 440, 324, 160, 173, 133, 218, 95, 67, 38, 0, 455, 393, 289, 239, 364, 204, 183, 109, 147, 127, 82, 34, 0), # 119
(462, 449, 374, 444, 326, 162, 174, 133, 219, 95, 68, 38, 0, 458, 397, 290, 240, 366, 204, 183, 109, 149, 127, 82, 34, 0), # 120
(465, 449, 376, 446, 328, 164, 176, 133, 221, 95, 68, 38, 0, 461, 398, 293, 241, 369, 204, 184, 109, 152, 128, 82, 35, 0), # 121
(467, 451, 380, 447, 331, 164, 177, 133, 222, 95, 69, 38, 0, 464, 404, 297, 242, 370, 206, 185, 109, 153, 130, 82, 35, 0), # 122
(468, 454, 385, 451, 334, 164, 181, 133, 224, 95, 69, 38, 0, 471, 407, 300, 244, 371, 206, 185, 111, 153, 130, 82, 35, 0), # 123
(472, 457, 387, 457, 337, 168, 181, 135, 225, 95, 69, 38, 0, 475, 407, 301, 246, 373, 208, 188, 111, 155, 131, 83, 36, 0), # 124
(473, 457, 387, 461, 339, 170, 182, 135, 225, 95, 69, 38, 0, 478, 409, 304, 246, 375, 209, 190, 112, 156, 132, 84, 36, 0), # 125
(473, 458, 390, 464, 340, 172, 183, 136, 227, 97, 69, 38, 0, 483, 412, 307, 250, 379, 211, 190, 112, 158, 134, 85, 36, 0), # 126
(475, 461, 390, 469, 346, 173, 184, 137, 228, 99, 70, 38, 0, 483, 415, 309, 251, 383, 215, 192, 114, 159, 134, 85, 36, 0), # 127
(476, 462, 395, 474, 349, 175, 184, 137, 229, 100, 70, 39, 0, 485, 416, 314, 252, 387, 216, 194, 116, 161, 136, 86, 37, 0), # 128
(477, 464, 398, 477, 354, 176, 185, 139, 230, 100, 70, 39, 0, 491, 417, 315, 254, 389, 219, 197, 116, 163, 137, 86, 37, 0), # 129
(483, 466, 401, 479, 357, 180, 186, 140, 231, 101, 70, 39, 0, 498, 418, 318, 255, 391, 220, 200, 117, 164, 139, 86, 37, 0), # 130
(488, 471, 401, 483, 361, 181, 188, 140, 233, 103, 70, 39, 0, 502, 419, 318, 257, 392, 220, 200, 119, 167, 139, 88, 37, 0), # 131
(490, 473, 403, 487, 363, 183, 188, 141, 234, 104, 71, 39, 0, 507, 421, 322, 261, 392, 220, 205, 120, 169, 140, 91, 37, 0), # 132
(493, 474, 406, 494, 365, 185, 190, 142, 236, 104, 73, 39, 0, 511, 425, 324, 263, 395, 220, 205, 122, 169, 141, 92, 37, 0), # 133
(495, 478, 410, 494, 367, 185, 194, 142, 237, 104, 73, 39, 0, 512, 428, 325, 264, 398, 220, 206, 122, 172, 143, 92, 37, 0), # 134
(498, 479, 413, 499, 371, 186, 197, 142, 240, 105, 73, 39, 0, 516, 431, 327, 265, 400, 220, 207, 122, 172, 143, 93, 37, 0), # 135
(506, 481, 416, 501, 373, 188, 199, 142, 243, 105, 73, 39, 0, 519, 433, 329, 265, 404, 220, 208, 122, 174, 145, 93, 37, 0), # 136
(508, 482, 420, 506, 375, 191, 200, 144, 244, 105, 73, 41, 0, 526, 433, 331, 268, 408, 221, 210, 123, 175, 147, 94, 37, 0), # 137
(510, 485, 426, 508, 377, 191, 202, 144, 245, 106, 73, 41, 0, 528, 435, 337, 270, 412, 222, 211, 123, 175, 150, 96, 37, 0), # 138
(512, 489, 429, 512, 378, 191, 203, 145, 246, 106, 73, 42, 0, 533, 438, 338, 271, 416, 223, 212, 125, 175, 151, 97, 37, 0), # 139
(518, 492, 431, 515, 380, 194, 203, 147, 247, 106, 73, 42, 0, 533, 441, 342, 272, 419, 224, 213, 125, 179, 152, 98, 37, 0), # 140
(525, 498, 433, 515, 384, 194, 205, 147, 248, 108, 73, 42, 0, 538, 445, 344, 274, 423, 224, 213, 126, 181, 153, 98, 37, 0), # 141
(531, 499, 434, 520, 389, 200, 206, 147, 249, 108, 74, 43, 0, 541, 446, 346, 275, 425, 228, 215, 126, 182, 153, 98, 37, 0), # 142
(538, 502, 436, 523, 391, 203, 206, 148, 250, 108, 74, 44, 0, 543, 448, 349, 277, 428, 228, 218, 127, 188, 153, 100, 37, 0), # 143
(542, 502, 438, 526, 394, 204, 207, 148, 252, 109, 75, 44, 0, 546, 448, 350, 280, 430, 228, 218, 130, 189, 155, 100, 38, 0), # 144
(548, 504, 442, 528, 397, 205, 208, 151, 256, 109, 76, 45, 0, 547, 450, 351, 281, 434, 229, 218, 130, 190, 155, 103, 38, 0), # 145
(552, 505, 446, 532, 399, 206, 209, 151, 256, 109, 77, 45, 0, 557, 451, 353, 282, 435, 229, 220, 130, 190, 157, 103, 39, 0), # 146
(553, 508, 447, 533, 402, 208, 210, 153, 257, 110, 77, 45, 0, 557, 454, 355, 284, 435, 230, 220, 131, 191, 157, 103, 39, 0), # 147
(559, 509, 448, 538, 406, 209, 210, 154, 259, 110, 77, 45, 0, 561, 455, 356, 286, 436, 233, 221, 132, 192, 158, 104, 39, 0), # 148
(564, 513, 448, 542, 408, 209, 213, 154, 259, 110, 78, 46, 0, 566, 458, 357, 288, 440, 234, 222, 133, 192, 159, 106, 40, 0), # 149
(566, 515, 453, 547, 410, 211, 213, 155, 260, 111, 78, 46, 0, 568, 459, 359, 292, 442, 235, 224, 133, 193, 159, 107, 40, 0), # 150
(571, 516, 454, 548, 410, 212, 213, 155, 260, 111, 78, 46, 0, 576, 462, 361, 296, 445, 237, 224, 136, 194, 161, 108, 40, 0), # 151
(577, 519, 458, 550, 413, 212, 217, 155, 263, 111, 79, 46, 0, 579, 462, 361, 298, 447, 239, 225, 136, 195, 162, 109, 41, 0), # 152
(580, 519, 459, 552, 415, 213, 218, 157, 263, 111, 80, 46, 0, 580, 464, 362, 302, 451, 240, 227, 137, 198, 163, 111, 41, 0), # 153
(584, 520, 461, 556, 416, 216, 218, 159, 265, 111, 82, 47, 0, 581, 472, 363, 302, 452, 243, 231, 137, 199, 164, 112, 42, 0), # 154
(587, 523, 465, 557, 419, 218, 218, 160, 266, 111, 82, 47, 0, 587, 476, 365, 303, 455, 244, 231, 137, 200, 165, 112, 44, 0), # 155
(589, 525, 467, 565, 421, 219, 220, 161, 267, 114, 83, 47, 0, 590, 477, 368, 304, 457, 245, 231, 137, 202, 165, 112, 44, 0), # 156
(596, 525, 472, 570, 424, 221, 221, 162, 268, 115, 83, 47, 0, 594, 479, 372, 307, 461, 247, 231, 137, 202, 166, 113, 44, 0), # 157
(600, 528, 474, 573, 426, 221, 222, 162, 270, 115, 84, 47, 0, 598, 483, 373, 307, 465, 249, 232, 137, 202, 166, 113, 44, 0), # 158
(604, 528, 477, 576, 428, 223, 224, 163, 271, 116, 85, 47, 0, 601, 483, 374, 308, 467, 249, 232, 137, 204, 166, 116, 44, 0), # 159
(605, 528, 477, 578, 431, 227, 224, 164, 273, 117, 85, 48, 0, 608, 486, 376, 308, 470, 252, 234, 137, 204, 166, 116, 44, 0), # 160
(610, 528, 480, 580, 433, 230, 227, 165, 274, 119, 85, 48, 0, 612, 489, 377, 308, 475, 252, 235, 137, 205, 166, 117, 44, 0), # 161
(612, 528, 482, 583, 435, 230, 227, 166, 274, 119, 85, 48, 0, 614, 490, 379, 310, 477, 252, 236, 137, 206, 167, 117, 44, 0), # 162
(615, 531, 483, 589, 440, 231, 228, 167, 274, 120, 86, 49, 0, 619, 494, 380, 310, 480, 252, 236, 137, 208, 168, 117, 44, 0), # 163
(619, 534, 487, 592, 442, 232, 229, 168, 277, 121, 87, 49, 0, 622, 496, 383, 312, 485, 252, 236, 138, 211, 168, 117, 44, 0), # 164
(623, 534, 488, 597, 444, 232, 229, 168, 280, 121, 87, 49, 0, 626, 499, 386, 313, 488, 253, 236, 142, 212, 170, 118, 44, 0), # 165
(625, 536, 489, 599, 446, 235, 230, 168, 281, 121, 87, 49, 0, 631, 501, 387, 314, 491, 253, 238, 143, 214, 171, 121, 44, 0), # 166
(628, 537, 492, 601, 450, 238, 231, 168, 281, 121, 87, 49, 0, 640, 503, 389, 315, 493, 253, 238, 143, 214, 172, 121, 44, 0), # 167
(629, 538, 498, 602, 452, 239, 231, 169, 282, 121, 87, 50, 0, 647, 506, 391, 315, 495, 255, 238, 143, 214, 172, 121, 44, 0), # 168
(629, 538, 503, 607, 454, 239, 233, 170, 282, 122, 88, 50, 0, 651, 506, 392, 316, 496, 256, 239, 144, 214, 172, 121, 44, 0), # 169
(630, 541, 504, 608, 457, 239, 233, 171, 282, 122, 88, 51, 0, 653, 507, 397, 316, 497, 256, 239, 146, 215, 173, 122, 44, 0), # 170
(635, 542, 505, 609, 458, 240, 234, 172, 282, 122, 88, 51, 0, 654, 509, 397, 318, 502, 257, 241, 146, 215, 173, 122, 44, 0), # 171
(638, 542, 507, 610, 458, 240, 234, 172, 283, 122, 89, 51, 0, 656, 511, 398, 319, 504, 258, 242, 147, 217, 175, 122, 44, 0), # 172
(640, 543, 508, 613, 458, 241, 234, 173, 285, 122, 89, 51, 0, 658, 513, 399, 321, 505, 260, 244, 147, 221, 177, 123, 45, 0), # 173
(640, 544, 511, 617, 461, 241, 235, 175, 287, 122, 89, 51, 0, 659, 516, 400, 322, 507, 260, 245, 147, 221, 179, 123, 45, 0), # 174
(642, 546, 513, 617, 461, 242, 236, 175, 287, 122, 89, 51, 0, 661, 517, 401, 322, 508, 261, 245, 147, 221, 179, 123, 45, 0), # 175
(644, 548, 514, 617, 463, 243, 237, 176, 288, 122, 89, 51, 0, 664, 518, 401, 322, 509, 261, 247, 148, 222, 179, 123, 45, 0), # 176
(645, 548, 517, 618, 464, 243, 238, 176, 288, 122, 89, 52, 0, 665, 521, 403, 322, 511, 262, 247, 148, 223, 181, 123, 45, 0), # 177
(647, 548, 518, 618, 464, 243, 238, 178, 288, 123, 89, 53, 0, 669, 523, 404, 322, 512, 262, 247, 148, 224, 181, 123, 45, 0), # 178
(647, 548, 518, 618, 464, 243, 238, 178, 288, 123, 89, 53, 0, 669, 523, 404, 322, 512, 262, 247, 148, 224, 181, 123, 45, 0), # 179
)
passenger_arriving_rate = (
(2.0083462313487073, 2.025939138554161, 1.7370944098708356, 1.86440033215903, 1.481249495362563, 0.7323528174753792, 0.8292071230747831, 0.7755293621632372, 0.8120132082890676, 0.3958015015522371, 0.2803510109257069, 0.16326383594353913, 0.0, 2.0335520850313453, 1.7959021953789303, 1.4017550546285344, 1.187404504656711, 1.6240264165781353, 1.085741107028532, 0.8292071230747831, 0.5231091553395566, 0.7406247476812815, 0.6214667773863434, 0.34741888197416715, 0.18417628532310557, 0.0), # 0
(2.1417308608079897, 2.159688921186411, 1.851782197110051, 1.987543275982985, 1.5793307566597963, 0.780729502943263, 0.8838937882527388, 0.8265856204842847, 0.8656327101777213, 0.4218980692277151, 0.29887307573040883, 0.17404055536047852, 0.0, 2.1679166589759418, 1.9144461089652633, 1.4943653786520439, 1.265694207683145, 1.7312654203554425, 1.1572198686779986, 0.8838937882527388, 0.5576639306737593, 0.7896653783298981, 0.6625144253276618, 0.3703564394220102, 0.19633535647149197, 0.0), # 1
(2.2746892035918926, 2.292907895993359, 1.9660140951824712, 2.1101963113994384, 1.6770567929999318, 0.8289131933862371, 0.9383637015921409, 0.8774375413174034, 0.9190382409170065, 0.4478913775020547, 0.31732154325175427, 0.18477442173510186, 0.0, 2.301745931283876, 2.03251863908612, 1.586607716258771, 1.3436741325061639, 1.838076481834013, 1.2284125578443648, 0.9383637015921409, 0.5920808524187409, 0.8385283964999659, 0.7033987704664796, 0.3932028190364943, 0.20844617236303267, 0.0), # 2
(2.406703117258625, 2.4250675173766973, 2.0793369564399518, 2.231872922259622, 1.774043113600507, 0.8767128119365264, 0.9924007283295911, 0.9278835262490847, 0.9720180214561457, 0.4736782698426182, 0.3356232274551589, 0.1954228561643487, 0.0, 2.4345091225016904, 2.1496514178078354, 1.6781161372757945, 1.4210348095278542, 1.9440360429122914, 1.2990369367487185, 0.9924007283295911, 0.6262234370975188, 0.8870215568002535, 0.7439576407532075, 0.41586739128799033, 0.2204606833978816, 0.0), # 3
(2.537254459366393, 2.555639239738117, 2.1912976332343455, 2.352086592414771, 1.8699052276790646, 0.9239372817263559, 1.0457887337016918, 0.9777219768658193, 1.024360272744361, 0.499155589716768, 0.3537049423060384, 0.20594327974515883, 0.0, 2.565675453175927, 2.2653760771967466, 1.7685247115301916, 1.4974667691503036, 2.048720545488722, 1.368810767612147, 1.0457887337016918, 0.6599552012331114, 0.9349526138395323, 0.7840288641382572, 0.4382595266468692, 0.23233083997619253, 0.0), # 4
(2.6658250874734044, 2.6840945174793154, 2.3014429779175063, 2.470350805716118, 1.9642586444531411, 0.9703955258879502, 1.0983115829450447, 1.0267512947540989, 1.0758532157308744, 0.5242201805918665, 0.37149350176980883, 0.21629311357447162, 0.0, 2.694714143853131, 2.3792242493191873, 1.8574675088490442, 1.572660541775599, 2.151706431461749, 1.4374518126557383, 1.0983115829450447, 0.6931396613485358, 0.9821293222265706, 0.8234502685720396, 0.46028859558350127, 0.24400859249811963, 0.0), # 5
(2.7918968591378666, 2.8099048050019837, 2.4093198428412888, 2.586179046014896, 2.0567188731402783, 1.015896467553535, 1.1497531412962525, 1.0747698815004147, 1.1262850713649086, 0.548768885935276, 0.3889157198118855, 0.22642977874922698, 0.0, 2.821094415079843, 2.4907275662414965, 1.9445785990594275, 1.6463066578058276, 2.2525701427298173, 1.5046778341005806, 1.1497531412962525, 0.7256403339668107, 1.0283594365701392, 0.8620596820049655, 0.4818639685682578, 0.25544589136381673, 0.0), # 6
(2.9149516319179876, 2.932541556707815, 2.514475080357545, 2.699084797162339, 2.146901422958014, 1.0602490298553349, 1.199897273991917, 1.1215761386912588, 1.175444060595686, 0.5726985492143588, 0.40589841039768465, 0.23631069636636431, 0.0, 2.944285487402608, 2.599417660030007, 2.029492051988423, 1.718095647643076, 2.350888121191372, 1.5702065941677623, 1.199897273991917, 0.7573207356109535, 1.073450711479007, 0.8996949323874465, 0.5028950160715091, 0.26659468697343774, 0.0), # 7
(3.034471263371974, 3.051476226998503, 2.616455542818132, 2.8085815430096783, 2.2344218031238894, 1.1032621359255743, 1.2485278462686396, 1.166968467913121, 1.2231184043724275, 0.5959060138964776, 0.42236838749262146, 0.24589328752282347, 0.0, 3.063756581367967, 2.7048261627510577, 2.111841937463107, 1.7877180416894323, 2.446236808744855, 1.6337558550783693, 1.2485278462686396, 0.7880443828039817, 1.1172109015619447, 0.936193847669893, 0.5232911085636265, 0.2774069297271367, 0.0), # 8
(3.149937611058034, 3.1661802702757416, 2.7148080825749017, 2.9141827674081506, 2.3188955228554424, 1.1447447088964797, 1.295428723363024, 1.210745270752494, 1.2690963236443564, 0.6182881234489943, 0.4382524650621119, 0.25513497331554386, 0.0, 3.178976917522465, 2.8064847064709815, 2.1912623253105594, 1.8548643703469825, 2.538192647288713, 1.6950433790534916, 1.295428723363024, 0.817674792068914, 1.1594477614277212, 0.9713942558027171, 0.5429616165149803, 0.28783457002506746, 0.0), # 9
(3.2608325325343728, 3.276125140941222, 2.8090795519797083, 3.0154019542089863, 2.3999380913702133, 1.1845056719002751, 1.340383770511671, 1.2527049487958686, 1.3131660393606952, 0.6397417213392715, 0.45347745707157167, 0.2639931748414651, 0.0, 3.2894157164126443, 2.903924923256116, 2.267387285357858, 1.9192251640178144, 2.6263320787213904, 1.7537869283142162, 1.340383770511671, 0.8460754799287679, 1.1999690456851067, 1.005133984736329, 0.5618159103959417, 0.2978295582673839, 0.0), # 10
(3.3666378853592023, 3.3807822933966425, 2.8988168033844053, 3.1117525872634193, 2.477165017885742, 1.222353948069186, 1.3831768529511832, 1.292645903629736, 1.3551157724706657, 0.660163651034672, 0.46797017748641667, 0.27242531319752705, 0.0, 3.394542198585045, 2.996678445172797, 2.339850887432083, 1.9804909531040158, 2.7102315449413314, 1.8097042650816304, 1.3831768529511832, 0.8731099629065614, 1.238582508942871, 1.03725086242114, 0.5797633606768812, 0.30734384485424027, 0.0), # 11
(3.466835527090725, 3.479623182043689, 2.9835666891408468, 3.202748150422684, 2.550191811619567, 1.2580984605354364, 1.4235918359181623, 1.3303665368405868, 1.3947337439234906, 0.6794507560025573, 0.48165744027206236, 0.28038880948066897, 0.0, 3.493825584586214, 3.0842769042873583, 2.4082872013603116, 2.0383522680076718, 2.789467487846981, 1.8625131515768216, 1.4235918359181623, 0.8986417575253116, 1.2750959058097835, 1.0675827168075616, 0.5967133378281694, 0.31632938018579, 0.0), # 12
(3.5609073152871504, 3.572119261284061, 3.062876061600887, 3.2879021275380134, 2.618633981789227, 1.2915481324312523, 1.4614125846492112, 1.3656652500149136, 1.431808174668391, 0.6974998797102906, 0.49446605939392463, 0.2878410847878307, 0.0, 3.586735094962694, 3.1662519326661376, 2.472330296969623, 2.0924996391308714, 2.863616349336782, 1.9119313500208792, 1.4614125846492112, 0.9225343803080374, 1.3093169908946134, 1.0959673758460047, 0.6125752123201775, 0.3247381146621874, 0.0), # 13
(3.6483351075066865, 3.6577419855194493, 3.1362917731163824, 3.366728002460638, 2.6821070376122638, 1.3225118868888581, 1.4964229643809324, 1.3983404447392078, 1.4661272856545895, 0.7142078656252335, 0.5063228488174191, 0.29473956021595205, 0.0, 3.6727399502610254, 3.242135162375472, 2.531614244087095, 2.1426235968757004, 2.932254571309179, 1.9576766226348912, 1.4964229643809324, 0.9446513477777557, 1.3410535188061319, 1.1222426674868795, 0.6272583546232765, 0.33252199868358634, 0.0), # 14
(3.728600761307542, 3.7359628091515464, 3.203360676039181, 3.438739259041796, 2.7402264883062153, 1.3507986470404796, 1.5284068403499251, 1.4281905225999594, 1.4974792978313092, 0.7294715572147492, 0.5171546225079614, 0.30104165686197243, 0.0, 3.7513093710277525, 3.311458225481696, 2.5857731125398065, 2.188414671644247, 2.9949585956626184, 1.9994667316399433, 1.5284068403499251, 0.9648561764574853, 1.3701132441531076, 1.1462464196805988, 0.6406721352078363, 0.33963298265014064, 0.0), # 15
(3.8011861342479203, 3.806253186582049, 3.263629622721142, 3.5034493811327145, 2.792607843088622, 1.3762173360183407, 1.5571480777927953, 1.4550138851836603, 1.5256524321477714, 0.7431877979461997, 0.5268881944309676, 0.3067047958228314, 0.0, 3.8219125778094183, 3.3737527540511447, 2.6344409721548376, 2.229563393838599, 3.0513048642955427, 2.0370194392571244, 1.5571480777927953, 0.9830123828702433, 1.396303921544311, 1.1678164603775718, 0.6527259245442284, 0.3460230169620045, 0.0), # 16
(3.86557308388603, 3.868084572212647, 3.3166454655141178, 3.560371852584634, 2.8388666111770235, 1.3985768769546667, 1.5824305419461422, 1.4786089340768032, 1.5504349095531977, 0.755253431286947, 0.5354503785518533, 0.31168639819546856, 0.0, 3.8840187911525663, 3.4285503801501536, 2.6772518927592666, 2.2657602938608403, 3.1008698191063955, 2.0700525077075245, 1.5824305419461422, 0.9989834835390476, 1.4194333055885118, 1.1867906175282115, 0.6633290931028236, 0.35164405201933163, 0.0), # 17
(3.921243467780082, 3.920928420445034, 3.3619550567699603, 3.609020157248784, 2.878618301788957, 1.4176861929816842, 1.6040380980465703, 1.4987740708658768, 1.5716149509968127, 0.7655653007043539, 0.542767988836034, 0.31594388507682386, 0.0, 3.9370972316037385, 3.475382735845062, 2.7138399441801697, 2.2966959021130613, 3.1432299019936254, 2.0982836992122276, 1.6040380980465703, 1.0126329949869173, 1.4393091508944784, 1.203006719082928, 0.672391011353992, 0.35644803822227583, 0.0), # 18
(3.9676791434882794, 3.964256185680906, 3.399105248840526, 3.648907778976395, 2.911478424141964, 1.4333542072316154, 1.6217546113306789, 1.5153076971373745, 1.5889807774278373, 0.7740202496657831, 0.5487678392489254, 0.3194346775638366, 0.0, 3.9806171197094784, 3.513781453202202, 2.7438391962446262, 2.3220607489973486, 3.1779615548556746, 2.1214307759923243, 1.6217546113306789, 1.0238244337368683, 1.455739212070982, 1.2163025929921318, 0.6798210497681053, 0.3603869259709915, 0.0), # 19
(4.0043619685688325, 3.997539322321953, 3.427642894077668, 3.679548201618706, 2.9370624874535847, 1.4453898428366878, 1.6353639470350725, 1.5280082144777862, 1.6023206097954932, 0.7805151216385962, 0.5533767437559435, 0.32211619675344644, 0.0, 4.01404767601633, 3.54327816428791, 2.766883718779717, 2.341545364915788, 3.2046412195909864, 2.139211500268901, 1.6353639470350725, 1.0324213163119198, 1.4685312437267923, 1.2265160672062356, 0.6855285788155336, 0.36341266566563213, 0.0), # 20
(4.030773800579946, 4.020249284769871, 3.44711484483324, 3.700454909026946, 2.954986000941357, 1.453602022929125, 1.644649970396352, 1.5366740244736041, 1.611422669049003, 0.7849467600901557, 0.556521516322504, 0.32394586374259315, 0.0, 4.036858121070831, 3.5634045011685243, 2.78260758161252, 2.3548402802704667, 3.222845338098006, 2.151343634263046, 1.644649970396352, 1.0382871592350893, 1.4774930004706786, 1.233484969675649, 0.689422968966648, 0.365477207706352, 0.0), # 21
(4.046396497079832, 4.031857527426353, 3.457067953459095, 3.7111413850523514, 2.96486447382282, 1.4577996706411525, 1.64939654665112, 1.5411035287113193, 1.6160751761375887, 0.7872120084878245, 0.5581289709140228, 0.3248810996282164, 0.0, 4.048517675419531, 3.5736920959103795, 2.7906448545701137, 2.361636025463473, 3.2321503522751773, 2.157544940195847, 1.64939654665112, 1.0412854790293946, 1.48243223691141, 1.237047128350784, 0.6914135906918191, 0.3665325024933049, 0.0), # 22
(4.052157345337056, 4.0332319844535895, 3.4583077274805674, 3.712479243827161, 2.9673952149420257, 1.4583333333333335, 1.6499608004518678, 1.5415823045267492, 1.6166568312757204, 0.7874792272519435, 0.5583305358107827, 0.3249965858862978, 0.0, 4.05, 3.574962444749276, 2.7916526790539136, 2.36243768175583, 3.2333136625514407, 2.158215226337449, 1.6499608004518678, 1.0416666666666667, 1.4836976074710129, 1.2374930812757206, 0.6916615454961136, 0.36665745313214454, 0.0), # 23
(4.056404965213662, 4.03243024691358, 3.4581049382716054, 3.7123145833333338, 2.9688286969639606, 1.4583333333333335, 1.6496507625272334, 1.5409166666666667, 1.6165788888888888, 0.7873150617283953, 0.5583083052749721, 0.3249695473251029, 0.0, 4.05, 3.5746650205761314, 2.7915415263748606, 2.361945185185185, 3.2331577777777776, 2.1572833333333334, 1.6496507625272334, 1.0416666666666667, 1.4844143484819803, 1.2374381944444448, 0.6916209876543211, 0.3665845679012346, 0.0), # 24
(4.060562892084632, 4.030849908550525, 3.457704618198446, 3.7119888117283955, 2.970230652158534, 1.4583333333333335, 1.649039780521262, 1.5396090534979427, 1.6164248971193418, 0.7869918838591681, 0.5582642266284242, 0.3249161713153483, 0.0, 4.05, 3.5740778844688306, 2.7913211331421213, 2.3609756515775038, 3.2328497942386836, 2.15545267489712, 1.649039780521262, 1.0416666666666667, 1.485115326079267, 1.2373296039094654, 0.6915409236396892, 0.36644090077732056, 0.0), # 25
(4.0646308076192135, 4.028515112025606, 3.457112254229539, 3.711505632716049, 2.9716010315789614, 1.4583333333333335, 1.6481373436617444, 1.5376841563786012, 1.61619683127572, 0.7865150708733427, 0.5581986989233904, 0.3248371894528274, 0.0, 4.05, 3.573209083981101, 2.7909934946169517, 2.3595452126200276, 3.23239366255144, 2.152757818930042, 1.6481373436617444, 1.0416666666666667, 1.4858005157894807, 1.2371685442386833, 0.6914224508459078, 0.3662286465477825, 0.0), # 26
(4.068608393486655, 4.02545, 3.4563333333333333, 3.71086875, 2.972939786278457, 1.4583333333333335, 1.6469529411764707, 1.5351666666666668, 1.6158966666666665, 0.7858900000000002, 0.5581121212121213, 0.32473333333333343, 0.0, 4.05, 3.572066666666667, 2.7905606060606063, 2.3576699999999997, 3.231793333333333, 2.1492333333333336, 1.6469529411764707, 1.0416666666666667, 1.4864698931392284, 1.2369562500000002, 0.6912666666666667, 0.36595000000000005, 0.0), # 27
(4.0724953313562, 4.021678715134888, 3.4553733424782807, 3.710081867283951, 2.9742468673102405, 1.4583333333333335, 1.6454960622932302, 1.532081275720165, 1.615526378600823, 0.7851220484682215, 0.558004892546868, 0.3246053345526597, 0.0, 4.05, 3.5706586800792564, 2.7900244627343396, 2.355366145404664, 3.231052757201646, 2.144913786008231, 1.6454960622932302, 1.0416666666666667, 1.4871234336551202, 1.2366939557613172, 0.6910746684956562, 0.3656071559213535, 0.0), # 28
(4.0762913028971, 4.01722540009145, 3.4542377686328307, 3.709148688271605, 2.9755222257275253, 1.4583333333333335, 1.6437761962398132, 1.5284526748971192, 1.6150879423868312, 0.7842165935070876, 0.5578774119798812, 0.3244539247065996, 0.0, 4.05, 3.568993171772595, 2.789387059899406, 2.3526497805212623, 3.2301758847736624, 2.139833744855967, 1.6437761962398132, 1.0416666666666667, 1.4877611128637627, 1.2363828960905352, 0.6908475537265663, 0.36520230909922274, 0.0), # 29
(4.079995989778599, 4.012114197530865, 3.452932098765432, 3.7080729166666666, 2.9767658125835297, 1.4583333333333335, 1.6418028322440088, 1.5243055555555556, 1.6145833333333333, 0.7831790123456793, 0.557730078563412, 0.3242798353909465, 0.0, 4.05, 3.5670781893004113, 2.78865039281706, 2.349537037037037, 3.2291666666666665, 2.134027777777778, 1.6418028322440088, 1.0416666666666667, 1.4883829062917648, 1.2360243055555558, 0.6905864197530864, 0.36473765432098776, 0.0), # 30
(4.083609073669943, 4.006369250114313, 3.4514618198445364, 3.70685825617284, 2.977977578931469, 1.4583333333333335, 1.639585459533608, 1.519664609053498, 1.6140145267489712, 0.7820146822130776, 0.5575632913497112, 0.32408379820149374, 0.0, 4.05, 3.564921780216431, 2.7878164567485557, 2.346044046639232, 3.2280290534979423, 2.1275304526748973, 1.639585459533608, 1.0416666666666667, 1.4889887894657345, 1.2356194187242802, 0.6902923639689073, 0.36421538637402845, 0.0), # 31
(4.087130236240382, 4.000014700502972, 3.4498324188385916, 3.7055084104938274, 2.979157475824559, 1.4583333333333335, 1.6371335673363998, 1.5145545267489715, 1.613383497942387, 0.7807289803383634, 0.5573774493910297, 0.32386654473403453, 0.0, 4.05, 3.5625319920743794, 2.7868872469551484, 2.3421869410150893, 3.226766995884774, 2.12037633744856, 1.6371335673363998, 1.0416666666666667, 1.4895787379122796, 1.2351694701646094, 0.6899664837677183, 0.3636377000457248, 0.0), # 32
(4.090559159159159, 3.993074691358024, 3.4480493827160497, 3.704027083333333, 2.9803054543160163, 1.4583333333333335, 1.6344566448801743, 1.5090000000000001, 1.6126922222222222, 0.7793272839506176, 0.5571729517396184, 0.32362880658436216, 0.0, 4.05, 3.559916872427983, 2.785864758698092, 2.3379818518518523, 3.2253844444444444, 2.1126000000000005, 1.6344566448801743, 1.0416666666666667, 1.4901527271580082, 1.2346756944444446, 0.68960987654321, 0.36300679012345677, 0.0), # 33
(4.093895524095524, 3.985573365340649, 3.446118198445359, 3.702417978395062, 2.9814214654590576, 1.4583333333333335, 1.631564181392722, 1.503025720164609, 1.6119426748971197, 0.7778149702789212, 0.5569501974477283, 0.3233713153482701, 0.0, 4.05, 3.557084468830971, 2.784750987238642, 2.333444910836763, 3.2238853497942395, 2.1042360082304525, 1.631564181392722, 1.0416666666666667, 1.4907107327295288, 1.2341393261316875, 0.6892236396890719, 0.3623248513946045, 0.0), # 34
(4.097139012718723, 3.977534865112025, 3.4440443529949705, 3.700684799382716, 2.9825054603068986, 1.4583333333333335, 1.6284656661018317, 1.4966563786008233, 1.6111368312757204, 0.7761974165523551, 0.5567095855676103, 0.32309480262155166, 0.0, 4.05, 3.554042828837068, 2.7835479278380513, 2.3285922496570644, 3.2222736625514408, 2.0953189300411528, 1.6284656661018317, 1.0416666666666667, 1.4912527301534493, 1.2335615997942388, 0.6888088705989942, 0.3615940786465478, 0.0), # 35
(4.100289306698002, 3.9689833333333326, 3.4418333333333337, 3.69883125, 2.983557389912756, 1.4583333333333335, 1.625170588235294, 1.489916666666667, 1.6102766666666666, 0.7744800000000003, 0.5564515151515153, 0.3228000000000001, 0.0, 4.05, 3.5508000000000006, 2.782257575757576, 2.32344, 3.220553333333333, 2.0858833333333338, 1.625170588235294, 1.0416666666666667, 1.491778694956378, 1.2329437500000002, 0.6883666666666668, 0.3608166666666667, 0.0), # 36
(4.10334608770261, 3.9599429126657517, 3.4394906264288982, 3.6968610339506176, 2.984577205329846, 1.4583333333333335, 1.6216884370208988, 1.4828312757201647, 1.609364156378601, 0.7726680978509377, 0.5561763852516941, 0.3224876390794087, 0.0, 4.05, 3.547364029873495, 2.7808819262584703, 2.3180042935528125, 3.218728312757202, 2.0759637860082307, 1.6216884370208988, 1.0416666666666667, 1.492288602664923, 1.2322870113168727, 0.6878981252857798, 0.3599948102423411, 0.0), # 37
(4.1063090374017905, 3.9504377457704623, 3.4370217192501147, 3.6947778549382724, 2.985564857611384, 1.4583333333333335, 1.6180287016864359, 1.4754248971193418, 1.6084012757201647, 0.7707670873342481, 0.5558845949203975, 0.32215845145557087, 0.0, 4.05, 3.543742966011279, 2.7794229746019874, 2.3123012620027437, 3.2168025514403293, 2.0655948559670785, 1.6180287016864359, 1.0416666666666667, 1.492782428805692, 1.2315926183127577, 0.6874043438500229, 0.35913070416095116, 0.0), # 38
(4.109177837464794, 3.940491975308642, 3.434432098765433, 3.6925854166666667, 2.9865202978105874, 1.4583333333333335, 1.6142008714596952, 1.4677222222222224, 1.60739, 0.7687823456790126, 0.5555765432098766, 0.32181316872427984, 0.0, 4.05, 3.539944855967078, 2.777882716049383, 2.306347037037037, 3.21478, 2.0548111111111114, 1.6142008714596952, 1.0416666666666667, 1.4932601489052937, 1.2308618055555558, 0.6868864197530866, 0.3582265432098766, 0.0), # 39
(4.111952169560865, 3.930129743941472, 3.4317272519433013, 3.690287422839506, 2.9874434769806717, 1.4583333333333335, 1.6102144355684662, 1.4597479423868318, 1.606332304526749, 0.7667192501143122, 0.5552526291723824, 0.32145252248132916, 0.0, 4.05, 3.5359777472946203, 2.7762631458619116, 2.300157750342936, 3.212664609053498, 2.0436471193415646, 1.6102144355684662, 1.0416666666666667, 1.4937217384903358, 1.230095807613169, 0.6863454503886602, 0.3572845221764975, 0.0), # 40
(4.114631715359251, 3.919375194330132, 3.4289126657521725, 3.6878875771604944, 2.988334346174854, 1.4583333333333335, 1.606078883240539, 1.4515267489711936, 1.6052301646090534, 0.7645831778692275, 0.5549132518601656, 0.3210772443225119, 0.0, 4.05, 3.53184968754763, 2.7745662593008276, 2.2937495336076816, 3.210460329218107, 2.0321374485596713, 1.606078883240539, 1.0416666666666667, 1.494167173087427, 1.2292958590534984, 0.6857825331504345, 0.3563068358481939, 0.0), # 41
(4.1172161565292, 3.908252469135803, 3.425993827160495, 3.685389583333334, 2.9891928564463486, 1.4583333333333335, 1.6018037037037036, 1.4430833333333335, 1.6040855555555558, 0.7623795061728398, 0.5545588103254772, 0.3206880658436215, 0.0, 4.05, 3.5275687242798353, 2.7727940516273852, 2.2871385185185185, 3.2081711111111115, 2.020316666666667, 1.6018037037037036, 1.0416666666666667, 1.4945964282231743, 1.2284631944444449, 0.685198765432099, 0.35529567901234577, 0.0), # 42
(4.119705174739957, 3.8967857110196618, 3.4229762231367173, 3.6827971450617287, 2.990018958848374, 1.4583333333333335, 1.5973983861857501, 1.434442386831276, 1.6029004526748971, 0.7601136122542298, 0.5541897036205679, 0.32028571864045124, 0.0, 4.05, 3.523142905044963, 2.770948518102839, 2.2803408367626887, 3.2058009053497942, 2.0082193415637866, 1.5973983861857501, 1.0416666666666667, 1.495009479424187, 1.2275990483539099, 0.6845952446273434, 0.35425324645633294, 0.0), # 43
(4.122098451660771, 3.8849990626428896, 3.4198653406492916, 3.680113966049383, 2.9908126044341454, 1.4583333333333335, 1.592872419914468, 1.4256286008230457, 1.6016768312757201, 0.7577908733424785, 0.5538063307976889, 0.3198709343087945, 0.0, 4.05, 3.5185802773967385, 2.7690316539884443, 2.273372620027435, 3.2033536625514403, 1.9958800411522641, 1.592872419914468, 1.0416666666666667, 1.4954063022170727, 1.2267046553497947, 0.6839730681298584, 0.35318173296753547, 0.0), # 44
(4.1243956689608865, 3.872916666666667, 3.4166666666666674, 3.6773437500000004, 2.991573744256879, 1.4583333333333335, 1.5882352941176472, 1.416666666666667, 1.6004166666666664, 0.755416666666667, 0.553409090909091, 0.3194444444444445, 0.0, 4.05, 3.5138888888888884, 2.7670454545454546, 2.2662500000000003, 3.2008333333333328, 1.9833333333333336, 1.5882352941176472, 1.0416666666666667, 1.4957868721284395, 1.2257812500000003, 0.6833333333333335, 0.3520833333333334, 0.0), # 45
(4.126596508309553, 3.8605626657521714, 3.4133856881572933, 3.674490200617284, 2.992302329369791, 1.4583333333333335, 1.5834964980230777, 1.407581275720165, 1.5991219341563785, 0.7529963694558759, 0.552998383007025, 0.3190069806431947, 0.0, 4.05, 3.509076787075141, 2.7649919150351248, 2.258989108367627, 3.198243868312757, 1.970613786008231, 1.5834964980230777, 1.0416666666666667, 1.4961511646848955, 1.2248300668724283, 0.6826771376314588, 0.35096024234110657, 0.0), # 46
(4.128700651376014, 3.8479612025605854, 3.4100278920896208, 3.6715570216049382, 2.992998310826098, 1.4583333333333335, 1.5786655208585494, 1.3983971193415639, 1.597794609053498, 0.7505353589391863, 0.552574606143742, 0.3185592745008384, 0.0, 4.05, 3.5041520195092213, 2.7628730307187097, 2.2516060768175583, 3.195589218106996, 1.9577559670781894, 1.5786655208585494, 1.0416666666666667, 1.496499155413049, 1.2238523405349797, 0.6820055784179242, 0.3498146547782351, 0.0), # 47
(4.130707779829518, 3.835136419753087, 3.4065987654320993, 3.6685479166666672, 2.993661639679016, 1.4583333333333335, 1.5737518518518518, 1.3891388888888891, 1.5964366666666667, 0.7480390123456792, 0.5521381593714928, 0.31810205761316873, 0.0, 4.05, 3.4991226337448555, 2.7606907968574634, 2.244117037037037, 3.1928733333333335, 1.944794444444445, 1.5737518518518518, 1.0416666666666667, 1.496830819839508, 1.222849305555556, 0.6813197530864199, 0.34864876543209883, 0.0), # 48
(4.132617575339315, 3.8221124599908545, 3.403103795153178, 3.665466589506173, 2.9942922669817618, 1.4583333333333335, 1.5687649802307755, 1.3798312757201647, 1.5950500823045266, 0.7455127069044355, 0.5516894417425283, 0.31763606157597934, 0.0, 4.05, 3.4939966773357725, 2.7584472087126413, 2.2365381207133064, 3.190100164609053, 1.9317637860082308, 1.5687649802307755, 1.0416666666666667, 1.4971461334908809, 1.221822196502058, 0.6806207590306357, 0.34746476909007773, 0.0), # 49
(4.134429719574647, 3.8089134659350714, 3.399548468221308, 3.6623167438271604, 2.9948901437875506, 1.4583333333333335, 1.56371439522311, 1.3704989711934157, 1.5936368312757199, 0.742961819844536, 0.5512288523090992, 0.3171620179850633, 0.0, 4.05, 3.4887821978356963, 2.7561442615454963, 2.2288854595336076, 3.1872736625514397, 1.9186985596707822, 1.56371439522311, 1.0416666666666667, 1.4974450718937753, 1.220772247942387, 0.6799096936442617, 0.346264860539552, 0.0), # 50
(4.136143894204764, 3.7955635802469136, 3.3959382716049387, 3.659102083333334, 2.9954552211495997, 1.4583333333333335, 1.558609586056645, 1.3611666666666666, 1.592198888888889, 0.7403917283950618, 0.5507567901234569, 0.31668065843621407, 0.0, 4.05, 3.483487242798354, 2.7537839506172843, 2.221175185185185, 3.184397777777778, 1.9056333333333335, 1.558609586056645, 1.0416666666666667, 1.4977276105747999, 1.2197006944444448, 0.6791876543209877, 0.34505123456790127, 0.0), # 51
(4.137759780898912, 3.782086945587563, 3.39227869227252, 3.6558263117283953, 2.995987450121124, 1.4583333333333335, 1.5534600419591706, 1.3518590534979422, 1.590738230452675, 0.7378078097850939, 0.5502736542378519, 0.3161927145252249, 0.0, 4.05, 3.4781198597774736, 2.7513682711892593, 2.2134234293552812, 3.18147646090535, 1.8926026748971192, 1.5534600419591706, 1.0416666666666667, 1.497993725060562, 1.218608770576132, 0.678455738454504, 0.3438260859625058, 0.0), # 52
(4.139277061326338, 3.768507704618199, 3.388575217192502, 3.6524931327160495, 2.996486781755341, 1.4583333333333335, 1.5482752521584766, 1.3426008230452677, 1.5892568312757203, 0.735215441243713, 0.5497798437045351, 0.3156989178478891, 0.0, 4.05, 3.4726880963267797, 2.7488992185226753, 2.2056463237311386, 3.1785136625514405, 1.8796411522633747, 1.5482752521584766, 1.0416666666666667, 1.4982433908776704, 1.21749771090535, 0.6777150434385005, 0.3425916095107454, 0.0), # 53
(4.140695417156286, 3.7548500000000002, 3.3848333333333334, 3.64910625, 2.996953167105467, 1.4583333333333335, 1.543064705882353, 1.3334166666666667, 1.5877566666666667, 0.7326200000000002, 0.5492757575757575, 0.31520000000000004, 0.0, 4.05, 3.4672, 2.7463787878787875, 2.1978600000000004, 3.1755133333333334, 1.8667833333333332, 1.543064705882353, 1.0416666666666667, 1.4984765835527336, 1.2163687500000002, 0.6769666666666667, 0.3413500000000001, 0.0), # 54
(4.142014530058009, 3.741137974394147, 3.381058527663466, 3.6456693672839506, 2.997386557224717, 1.4583333333333335, 1.5378378923585896, 1.3243312757201646, 1.5862397119341562, 0.7300268632830363, 0.5487617949037703, 0.31469669257735106, 0.0, 4.05, 3.4616636183508613, 2.743808974518851, 2.1900805898491087, 3.1724794238683125, 1.8540637860082305, 1.5378378923585896, 1.0416666666666667, 1.4986932786123586, 1.2152231224279837, 0.6762117055326933, 0.34010345221764976, 0.0), # 55
(4.143234081700749, 3.7273957704618197, 3.377256287151349, 3.642186188271605, 2.9977869031663094, 1.4583333333333335, 1.5326043008149763, 1.3153693415637862, 1.584707942386831, 0.7274414083219024, 0.5482383547408239, 0.31418972717573546, 0.0, 4.05, 3.4560869989330896, 2.7411917737041196, 2.182324224965707, 3.169415884773662, 1.8415170781893007, 1.5326043008149763, 1.0416666666666667, 1.4988934515831547, 1.2140620627572019, 0.6754512574302699, 0.33885416095107457, 0.0), # 56
(4.144353753753753, 3.7136475308641974, 3.373432098765433, 3.638660416666667, 2.9981541559834577, 1.4583333333333335, 1.5273734204793028, 1.306555555555556, 1.5831633333333335, 0.7248690123456792, 0.5477058361391696, 0.3136798353909465, 0.0, 4.05, 3.4504781893004113, 2.7385291806958474, 2.1746070370370374, 3.166326666666667, 1.8291777777777782, 1.5273734204793028, 1.0416666666666667, 1.4990770779917288, 1.212886805555556, 0.6746864197530866, 0.33760432098765436, 0.0), # 57
(4.145373227886272, 3.69991739826246, 3.369591449474166, 3.6350957561728396, 2.99848826672938, 1.4583333333333335, 1.5221547405793594, 1.297914609053498, 1.5816078600823045, 0.7223150525834479, 0.5471646381510581, 0.3131677488187777, 0.0, 4.05, 3.444845237006554, 2.7358231907552906, 2.166945157750343, 3.163215720164609, 1.8170804526748974, 1.5221547405793594, 1.0416666666666667, 1.49924413336469, 1.2116985853909468, 0.6739182898948333, 0.33635612711476914, 0.0), # 58
(4.146292185767549, 3.6862295153177866, 3.365739826245999, 3.631495910493827, 2.9987891864572918, 1.4583333333333335, 1.5169577503429357, 1.289471193415638, 1.580043497942387, 0.7197849062642893, 0.5466151598287401, 0.3126541990550222, 0.0, 4.05, 3.439196189605243, 2.7330757991437, 2.1593547187928674, 3.160086995884774, 1.8052596707818933, 1.5169577503429357, 1.0416666666666667, 1.4993945932286459, 1.210498636831276, 0.6731479652492, 0.3351117741197988, 0.0), # 59
(4.147110309066831, 3.6726080246913586, 3.3618827160493825, 3.6278645833333334, 2.9990568662204096, 1.4583333333333335, 1.5117919389978214, 1.2812500000000002, 1.5784722222222225, 0.7172839506172841, 0.546057800224467, 0.3121399176954733, 0.0, 4.05, 3.4335390946502056, 2.7302890011223346, 2.151851851851852, 3.156944444444445, 1.7937500000000002, 1.5117919389978214, 1.0416666666666667, 1.4995284331102048, 1.2092881944444447, 0.6723765432098766, 0.33387345679012354, 0.0), # 60
(4.147827279453366, 3.6590770690443533, 3.3580256058527667, 3.624205478395062, 2.9992912570719494, 1.4583333333333335, 1.5066667957718067, 1.2732757201646092, 1.5768960082304526, 0.7148175628715137, 0.5454929583904894, 0.3116256363359245, 0.0, 4.05, 3.4278819996951686, 2.7274647919524466, 2.1444526886145407, 3.1537920164609052, 1.7825860082304528, 1.5066667957718067, 1.0416666666666667, 1.4996456285359747, 1.2080684927983543, 0.6716051211705534, 0.3326433699131231, 0.0), # 61
(4.148442778596402, 3.6456607910379515, 3.3541739826246006, 3.6205222993827166, 2.999492310065129, 1.4583333333333335, 1.5015918098926813, 1.2655730452674898, 1.5753168312757202, 0.7123911202560588, 0.5449210333790582, 0.31111208657216893, 0.0, 4.05, 3.4222329522938577, 2.7246051668952904, 2.137173360768176, 3.1506336625514404, 1.7718022633744859, 1.5015918098926813, 1.0416666666666667, 1.4997461550325646, 1.2068407664609058, 0.6708347965249202, 0.33142370827617745, 0.0), # 62
(4.148956488165184, 3.6323833333333333, 3.350333333333334, 3.6168187500000006, 2.9996599762531617, 1.4583333333333335, 1.4965764705882352, 1.2581666666666669, 1.5737366666666666, 0.7100100000000001, 0.5443424242424244, 0.31060000000000004, 0.0, 4.05, 3.4166, 2.721712121212122, 2.13003, 3.147473333333333, 1.7614333333333339, 1.4965764705882352, 1.0416666666666667, 1.4998299881265809, 1.2056062500000004, 0.6700666666666668, 0.3302166666666667, 0.0), # 63
(4.149368089828959, 3.6192688385916783, 3.346509144947417, 3.613098533950618, 2.999794206689266, 1.4583333333333335, 1.4916302670862585, 1.2510812757201648, 1.5721574897119341, 0.707679579332419, 0.5437575300328387, 0.31009010821521116, 0.0, 4.05, 3.4109911903673225, 2.7187876501641934, 2.1230387379972564, 3.1443149794238683, 1.7515137860082308, 1.4916302670862585, 1.0416666666666667, 1.499897103344633, 1.2043661779835395, 0.6693018289894834, 0.3290244398719708, 0.0), # 64
(4.149677265256975, 3.6063414494741655, 3.3427069044352997, 3.609365354938272, 2.999894952426658, 1.4583333333333335, 1.4867626886145406, 1.2443415637860082, 1.5705812757201647, 0.7054052354823961, 0.5431667498025524, 0.3095831428135955, 0.0, 4.05, 3.40541457094955, 2.715833749012762, 2.116215706447188, 3.1411625514403294, 1.7420781893004116, 1.4867626886145406, 1.0416666666666667, 1.499947476213329, 1.2031217849794242, 0.66854138088706, 0.32784922267946964, 0.0), # 65
(4.149883696118478, 3.593625308641976, 3.3389320987654325, 3.605622916666667, 2.9999621645185526, 1.4583333333333335, 1.4819832244008715, 1.2379722222222225, 1.56901, 0.7031923456790125, 0.542570482603816, 0.3090798353909466, 0.0, 4.05, 3.399878189300412, 2.7128524130190796, 2.1095770370370373, 3.13802, 1.7331611111111116, 1.4819832244008715, 1.0416666666666667, 1.4999810822592763, 1.2018743055555559, 0.6677864197530866, 0.3266932098765433, 0.0), # 66
(4.149987064082717, 3.581144558756287, 3.3351902149062647, 3.601874922839506, 2.999995794018168, 1.4583333333333335, 1.4773013636730412, 1.2319979423868317, 1.5674456378600823, 0.7010462871513491, 0.5419691274888808, 0.3085809175430575, 0.0, 4.05, 3.394390092973632, 2.7098456374444035, 2.103138861454047, 3.1348912757201646, 1.7247971193415643, 1.4773013636730412, 1.0416666666666667, 1.499997897009084, 1.2006249742798356, 0.6670380429812529, 0.3255585962505716, 0.0), # 67
(4.14991664579233, 3.5688578344174515, 3.331468649977138, 3.5980925221417075, 2.9999674547459585, 1.4583062693695066, 1.4727030389659292, 1.226390641670477, 1.5658783798201494, 0.6989620441647167, 0.5413523992360252, 0.3080843340633248, 0.0, 4.0499500600137175, 3.388927674696572, 2.7067619961801257, 2.09688613249415, 3.131756759640299, 1.716946898338668, 1.4727030389659292, 1.0416473352639333, 1.4999837273729792, 1.199364174047236, 0.6662937299954276, 0.3244416213106775, 0.0), # 68
(4.149256682769726, 3.5563900238948625, 3.3276628086419753, 3.594085054347826, 2.999709513435003, 1.4580923182441705, 1.4680536362693228, 1.2208497942386831, 1.5642397119341562, 0.6968806390704431, 0.5406575225943647, 0.3075739657786442, 0.0, 4.049554398148149, 3.3833136235650856, 2.7032876129718235, 2.090641917211329, 3.1284794238683125, 1.7091897119341564, 1.4680536362693228, 1.0414945130315503, 1.4998547567175016, 1.1980283514492756, 0.665532561728395, 0.3233081839904421, 0.0), # 69
(4.147954315023558, 3.5436839019425634, 3.3237561442615453, 3.589826137278583, 2.999199817101051, 1.4576709597114261, 1.463332026912274, 1.2153254077122393, 1.5625203856119496, 0.6947919524462736, 0.539876592435072, 0.307047425376427, 0.0, 4.048772933813444, 3.3775216791406963, 2.6993829621753602, 2.0843758573388205, 3.1250407712238992, 1.701455570797135, 1.463332026912274, 1.0411935426510186, 1.4995999085505256, 1.1966087124261946, 0.6647512288523091, 0.32215308199477855, 0.0), # 70
(4.146027864257172, 3.5307470618168946, 3.319750028577961, 3.585322051127214, 2.9984448210011028, 1.4570490219986791, 1.4585403319077976, 1.2098193110806281, 1.5607229614388052, 0.6926960359342641, 0.5390124913855908, 0.3065050979070905, 0.0, 4.047615955075446, 3.3715560769779955, 2.695062456927954, 2.0780881078027917, 3.1214459228776104, 1.6937470355128794, 1.4585403319077976, 1.040749301427628, 1.4992224105005514, 1.1951073503757383, 0.6639500057155922, 0.3209770056197177, 0.0), # 71
(4.143495652173914, 3.5175870967741933, 3.3156458333333334, 3.5805790760869565, 2.9974509803921565, 1.4562333333333337, 1.4536806722689075, 1.2043333333333335, 1.55885, 0.6905929411764707, 0.5380681020733654, 0.3059473684210527, 0.0, 4.04609375, 3.365421052631579, 2.6903405103668265, 2.071778823529412, 3.1177, 1.6860666666666668, 1.4536806722689075, 1.040166666666667, 1.4987254901960783, 1.1935263586956524, 0.6631291666666667, 0.31978064516129034, 0.0), # 72
(4.140376000477128, 3.5042116000707995, 3.3114449302697757, 3.575603492351047, 2.996224750531214, 1.4552307219427933, 1.4487551690086184, 1.1988693034598386, 1.556904061880811, 0.6884827198149495, 0.5370463071258393, 0.30537462196873066, 0.0, 4.04421660665295, 3.3591208416560367, 2.6852315356291965, 2.065448159444848, 3.113808123761622, 1.678417024843774, 1.4487551690086184, 1.0394505156734237, 1.498112375265607, 1.1918678307836825, 0.6622889860539553, 0.31856469091552725, 0.0), # 73
(4.136687230870161, 3.4906281649630513, 3.307148691129401, 3.570401580112721, 2.9947725866752735, 1.4540480160544635, 1.4437659431399446, 1.1934290504496268, 1.5548877076665142, 0.6863654234917563, 0.5359499891704572, 0.30478724360054227, 0.0, 4.041994813100138, 3.3526596796059644, 2.6797499458522855, 2.0590962704752687, 3.1097754153330284, 1.6708006706294773, 1.4437659431399446, 1.0386057257531882, 1.4973862933376367, 1.190133860037574, 0.6614297382258802, 0.31732983317845925, 0.0), # 74
(4.13244766505636, 3.4768443847072876, 3.302758487654321, 3.564979619565217, 2.9931009440813363, 1.452692043895748, 1.4387151156759002, 1.188014403292181, 1.5528034979423868, 0.6842411038489471, 0.5347820308346625, 0.30418561836690494, 0.0, 4.039438657407408, 3.3460418020359537, 2.673910154173312, 2.052723311546841, 3.1056069958847736, 1.6632201646090536, 1.4387151156759002, 1.0376371742112487, 1.4965504720406682, 1.1883265398550726, 0.6605516975308642, 0.3160767622461171, 0.0), # 75
(4.127675624739071, 3.462867852559848, 3.2982756915866487, 3.559343890901771, 2.9912162780064016, 1.4511696336940512, 1.4336048076294992, 1.1826271909769854, 1.5506539932937051, 0.682109812528578, 0.5335453147458995, 0.3035701313182361, 0.0, 4.036558427640603, 3.339271444500597, 2.6677265737294973, 2.046329437585734, 3.1013079865874102, 1.6556780673677796, 1.4336048076294992, 1.0365497383528937, 1.4956081390032008, 1.186447963633924, 0.6596551383173298, 0.31480616841453174, 0.0), # 76
(4.122389431621637, 3.4487061617770705, 3.2937016746684953, 3.55350067431562, 2.9891250437074692, 1.4494876136767771, 1.4284371400137559, 1.1772692424935225, 1.5484417543057463, 0.6799716011727052, 0.5322427235316126, 0.3029411675049536, 0.0, 4.03336441186557, 3.332352842554489, 2.6612136176580625, 2.039914803518115, 3.0968835086114925, 1.6481769394909316, 1.4284371400137559, 1.0353482954834123, 1.4945625218537346, 1.1845002247718734, 0.6587403349336991, 0.31351874197973373, 0.0), # 77
(4.1166074074074075, 3.4343669056152932, 3.2890378086419756, 3.54745625, 2.98683369644154, 1.4476528120713306, 1.423214233841685, 1.171942386831276, 1.5461693415637856, 0.6778265214233843, 0.5308771398192452, 0.30229911197747467, 0.0, 4.029866898148149, 3.3252902317522204, 2.654385699096226, 2.0334795642701526, 3.092338683127571, 1.6407193415637862, 1.423214233841685, 1.0340377229080933, 1.49341684822077, 1.182485416666667, 0.6578075617283952, 0.312215173237754, 0.0), # 78
(4.110347873799726, 3.4198576773308558, 3.2842854652492, 3.541216898148148, 2.9843486914656125, 1.445672057105116, 1.4179382101263003, 1.166648452979729, 1.5438393156531016, 0.6756746249226715, 0.5294514462362415, 0.30164434978621685, 0.0, 4.026076174554183, 3.318087847648385, 2.6472572311812077, 2.0270238747680143, 3.0876786313062032, 1.6333078341716205, 1.4179382101263003, 1.0326228979322258, 1.4921743457328063, 1.1804056327160497, 0.6568570930498401, 0.31089615248462327, 0.0), # 79
(4.103629152501939, 3.4051860701800964, 3.2794460162322814, 3.534788898953301, 2.9816764840366874, 1.4435521770055377, 1.4126111898806162, 1.1613892699283648, 1.5414542371589697, 0.6735159633126228, 0.527968525410046, 0.30097726598159785, 0.0, 4.02200252914952, 3.310749925797576, 2.6398426270502298, 2.020547889937868, 3.0829084743179394, 1.6259449778997108, 1.4126111898806162, 1.0311086978610984, 1.4908382420183437, 1.1782629663177673, 0.6558892032464564, 0.3095623700163725, 0.0), # 80
(4.096469565217392, 3.390359677419355, 3.2745208333333338, 3.5281785326086963, 2.9788235294117644, 1.4413000000000002, 1.4072352941176471, 1.1561666666666668, 1.5390166666666665, 0.6713505882352943, 0.5264312599681021, 0.3002982456140351, 0.0, 4.01765625, 3.303280701754386, 2.632156299840511, 2.0140517647058824, 3.078033333333333, 1.6186333333333336, 1.4072352941176471, 1.0295, 1.4894117647058822, 1.1760595108695657, 0.6549041666666667, 0.30821451612903233, 0.0), # 81
(4.088887433649431, 3.3753860923049697, 3.269511288294468, 3.5213920793075686, 2.975796282847844, 1.4389223543159075, 1.4018126438504073, 1.1509824721841184, 1.5365291647614692, 0.6691785513327417, 0.5248425325378543, 0.29960767373394626, 0.0, 4.013047625171469, 3.2956844110734083, 2.624212662689271, 2.0075356539982248, 3.0730583295229383, 1.6113754610577657, 1.4018126438504073, 1.0278016816542197, 1.487898141423922, 1.1737973597691898, 0.6539022576588936, 0.30685328111863364, 0.0), # 82
(4.080901079501402, 3.3602729080932785, 3.264418752857796, 3.514435819243156, 2.9726011996019257, 1.4364260681806638, 1.3963453600919107, 1.1458385154702029, 1.533994292028654, 0.6669999042470213, 0.5232052257467463, 0.29890593539174876, 0.0, 4.008186942729767, 3.287965289309236, 2.6160261287337314, 2.0009997127410637, 3.067988584057308, 1.604173921658284, 1.3963453600919107, 1.0260186201290455, 1.4863005998009629, 1.1714786064143856, 0.6528837505715593, 0.3054793552812072, 0.0), # 83
(4.072528824476651, 3.345027718040621, 3.259244598765432, 3.507316032608696, 2.969244734931009, 1.4338179698216735, 1.3908355638551717, 1.1407366255144034, 1.5314146090534977, 0.664814698620189, 0.5215222222222223, 0.2981934156378601, 0.0, 4.003084490740741, 3.280127572016461, 2.6076111111111113, 1.9944440958605667, 3.0628292181069954, 1.5970312757201646, 1.3908355638551717, 1.0241556927297668, 1.4846223674655046, 1.169105344202899, 0.6518489197530865, 0.3040934289127838, 0.0), # 84
(4.063788990278524, 3.3296581154033364, 3.253990197759488, 3.5000389995974235, 2.9657333440920954, 1.431104887466342, 1.385285376153205, 1.1356786313062037, 1.528792676421277, 0.6626229860943007, 0.5197964045917264, 0.29747049952269794, 0.0, 3.9977505572702334, 3.272175494749677, 2.5989820229586313, 1.9878689582829017, 3.057585352842554, 1.589950083828685, 1.385285376153205, 1.0222177767616727, 1.4828666720460477, 1.1666796665324748, 0.6507980395518976, 0.30269619230939426, 0.0), # 85
(4.054699898610365, 3.3141716934377627, 3.2486569215820764, 3.492611000402577, 2.9620734823421824, 1.4282936493420721, 1.3796969179990242, 1.1306663618350863, 1.5261310547172688, 0.6604248183114125, 0.5180306554827024, 0.29673757209667984, 0.0, 3.992195430384088, 3.2641132930634775, 2.5901532774135116, 1.9812744549342374, 3.0522621094345377, 1.5829329065691207, 1.3796969179990242, 1.0202097495300515, 1.4810367411710912, 1.1642036668008593, 0.6497313843164153, 0.3012883357670694, 0.0), # 86
(4.045279871175523, 3.298576045400239, 3.2432461419753085, 3.485038315217391, 2.9582716049382722, 1.4253910836762689, 1.3740723104056438, 1.1257016460905351, 1.5234323045267493, 0.6582202469135804, 0.5162278575225944, 0.29599501841022313, 0.0, 3.9864293981481485, 3.255945202512454, 2.581139287612972, 1.9746607407407408, 3.0468646090534985, 1.5759823045267491, 1.3740723104056438, 1.018136488340192, 1.4791358024691361, 1.1616794384057973, 0.6486492283950618, 0.29987054958183995, 0.0), # 87
(4.035547229677343, 3.2828787645471036, 3.2377592306812986, 3.477327224235105, 2.954334167137363, 1.4224040186963371, 1.3684136743860782, 1.1207863130620332, 1.5206989864349947, 0.6560093235428602, 0.5143908933388467, 0.29524322351374555, 0.0, 3.9804627486282587, 3.2476754586512007, 2.571954466694233, 1.9680279706285804, 3.0413979728699894, 1.5691008382868465, 1.3684136743860782, 1.0160028704973836, 1.4771670835686814, 1.1591090747450352, 0.6475518461362598, 0.29844352404973673, 0.0), # 88
(4.025520295819169, 3.267087444134696, 3.2321975594421586, 3.4694840076489535, 2.950267624196455, 1.4193392826296807, 1.3627231309533416, 1.1159221917390643, 1.5179336610272824, 0.6537920998413084, 0.512522645558903, 0.29448257245766457, 0.0, 3.9743057698902606, 3.2393082970343094, 2.5626132277945146, 1.9613762995239248, 3.035867322054565, 1.56229106843469, 1.3627231309533416, 1.0138137733069148, 1.4751338120982276, 1.156494669216318, 0.6464395118884317, 0.2970079494667906, 0.0), # 89
(4.015217391304348, 3.2512096774193546, 3.2265625000000004, 3.4615149456521745, 2.946078431372549, 1.4162037037037039, 1.3570028011204482, 1.1111111111111112, 1.515138888888889, 0.6515686274509805, 0.5106259968102075, 0.2937134502923977, 0.0, 3.9679687500000003, 3.230847953216374, 2.553129984051037, 1.9547058823529413, 3.030277777777778, 1.5555555555555556, 1.3570028011204482, 1.0115740740740742, 1.4730392156862746, 1.1538383152173917, 0.6453125000000001, 0.2955645161290323, 0.0), # 90
(4.004656837836225, 3.235253057657418, 3.2208554240969365, 3.4534263184380034, 2.9417730439226437, 1.413004110145811, 1.3512548059004124, 1.1063549001676574, 1.512317230605091, 0.6493389580139327, 0.5087038297202041, 0.2929362420683625, 0.0, 3.961461977023319, 3.222298662751987, 2.5435191486010202, 1.9480168740417978, 3.024634461210182, 1.5488968602347204, 1.3512548059004124, 1.0092886501041507, 1.4708865219613219, 1.1511421061460014, 0.6441710848193873, 0.2941139143324926, 0.0), # 91
(3.9938569571181493, 3.2192251781052263, 3.21507770347508, 3.445224406199678, 2.937357917103741, 1.4097473301834071, 1.3454812663062485, 1.1016553878981865, 1.5094712467611644, 0.6471031431722211, 0.506759026916337, 0.29215133283597666, 0.0, 3.954795739026063, 3.2136646611957427, 2.5337951345816845, 1.9413094295166629, 3.018942493522329, 1.5423175430574612, 1.3454812663062485, 1.0069623787024338, 1.4686789585518705, 1.148408135399893, 0.6430155406950161, 0.29265683437320245, 0.0), # 92
(3.982836070853462, 3.2031336320191164, 3.2092307098765436, 3.4369154891304357, 2.932839506172839, 1.4064401920438958, 1.3396843033509702, 1.0970144032921811, 1.506603497942387, 0.6448612345679013, 0.50479447102605, 0.29135910764565737, 0.0, 3.9479803240740736, 3.2049501841022305, 2.52397235513025, 1.9345837037037037, 3.013206995884774, 1.5358201646090537, 1.3396843033509702, 1.0046001371742113, 1.4664197530864196, 1.145638496376812, 0.6418461419753088, 0.29119396654719243, 0.0), # 93
(3.971612500745512, 3.1869860126554275, 3.203315815043439, 3.428505847423511, 2.9282242663869384, 1.403089523954682, 1.3338660380475922, 1.0924337753391253, 1.5037165447340346, 0.6426132838430298, 0.5028130446767874, 0.2905599515478225, 0.0, 3.9410260202331964, 3.196159467026047, 2.5140652233839367, 1.927839851529089, 3.007433089468069, 1.5294072854747756, 1.3338660380475922, 1.0022068028247728, 1.4641121331934692, 1.1428352824745038, 0.6406631630086879, 0.28972600115049346, 0.0), # 94
(3.960204568497644, 3.170789913270499, 3.1973343907178786, 3.420001761272142, 2.9235186530030397, 1.3997021541431696, 1.3280285914091288, 1.0879153330285019, 1.500812947721384, 0.6403593426396622, 0.5008176304959931, 0.28975424959288937, 0.0, 3.933943115569273, 3.187296745521783, 2.504088152479966, 1.9210780279189863, 3.001625895442768, 1.5230814662399026, 1.3280285914091288, 0.9997872529594067, 1.4617593265015199, 1.1400005870907142, 0.6394668781435758, 0.2882536284791363, 0.0), # 95
(3.948630595813205, 3.15455292712067, 3.1912878086419756, 3.4114095108695652, 2.9187291212781408, 1.3962849108367628, 1.3221740844485943, 1.0834609053497943, 1.497895267489712, 0.638099462599855, 0.4988111111111112, 0.2889423868312758, 0.0, 3.9267418981481486, 3.1783662551440335, 2.494055555555556, 1.9142983877995645, 2.995790534979424, 1.5168452674897122, 1.3221740844485943, 0.9973463648834019, 1.4593645606390704, 1.1371365036231886, 0.6382575617283952, 0.28677753882915186, 0.0), # 96
(3.936908904395539, 3.138282647462278, 3.185177440557842, 3.4027353764090176, 2.913862126469244, 1.3928446222628663, 1.3163046381790027, 1.0790723212924862, 1.4949660646242953, 0.6358336953656636, 0.4967963691495856, 0.288124748313399, 0.0, 3.919432656035666, 3.169372231447389, 2.4839818457479277, 1.9075010860969903, 2.9899321292485905, 1.5107012498094807, 1.3163046381790027, 0.9948890159020474, 1.456931063234622, 1.1342451254696728, 0.6370354881115684, 0.2852984224965707, 0.0), # 97
(3.925057815947994, 3.1219866675516617, 3.17900465820759, 3.3939856380837363, 2.908924123833347, 1.3893881166488853, 1.3104223736133687, 1.0747514098460602, 1.4920278997104097, 0.6335620925791443, 0.49477628723886047, 0.28730171908967667, 0.0, 3.9120256772976685, 3.1603189099864424, 2.4738814361943025, 1.9006862777374325, 2.9840557994208194, 1.5046519737844843, 1.3104223736133687, 0.9924200833206323, 1.4544620619166735, 1.1313285460279123, 0.6358009316415181, 0.2838169697774238, 0.0), # 98
(3.9130956521739133, 3.1056725806451615, 3.1727708333333338, 3.3851665760869567, 2.9039215686274513, 1.3859222222222223, 1.3045294117647062, 1.0705000000000002, 1.4890833333333333, 0.6312847058823531, 0.4927537480063797, 0.2864736842105264, 0.0, 3.9045312500000002, 3.1512105263157895, 2.4637687400318984, 1.893854117647059, 2.9781666666666666, 1.4987000000000004, 1.3045294117647062, 0.9899444444444444, 1.4519607843137257, 1.1283888586956525, 0.6345541666666669, 0.282333870967742, 0.0), # 99
(3.901040734776645, 3.0893479799991144, 3.1664773376771835, 3.3762844706119166, 2.8988609161085557, 1.382453767210283, 1.298627873646029, 1.0663199207437892, 1.4861349260783419, 0.629001586917346, 0.49073163407958736, 0.2856410287263656, 0.0, 3.896959662208505, 3.142051315990021, 2.4536581703979365, 1.8870047607520375, 2.9722698521566837, 1.492847889041305, 1.298627873646029, 0.9874669765787736, 1.4494304580542778, 1.125428156870639, 0.6332954675354368, 0.28084981636355594, 0.0), # 100
(3.888911385459534, 3.0730204588698617, 3.160125542981253, 3.367345601851852, 2.8937486215336614, 1.3789895798404714, 1.2927198802703526, 1.0622130010669104, 1.4831852385307118, 0.626712787326179, 0.48871282808592753, 0.2848041376876118, 0.0, 3.8893212019890258, 3.1328455145637295, 2.4435641404296375, 1.8801383619785366, 2.9663704770614236, 1.4870982014936747, 1.2927198802703526, 0.9849925570289081, 1.4468743107668307, 1.1224485339506176, 0.6320251085962507, 0.2793654962608966, 0.0), # 101
(3.8767259259259266, 3.05669761051374, 3.1537168209876545, 3.3583562500000004, 2.8885911401597673, 1.3755364883401924, 1.2868075526506901, 1.0581810699588479, 1.4802368312757201, 0.624418358750908, 0.48670021265284436, 0.28396339614468274, 0.0, 3.881626157407408, 3.12359735759151, 2.4335010632642216, 1.8732550762527236, 2.9604736625514403, 1.481453497942387, 1.2868075526506901, 0.9825260631001375, 1.4442955700798836, 1.1194520833333337, 0.630743364197531, 0.27788160095579456, 0.0), # 102
(3.864502677879168, 3.040387028187088, 3.1472525434385004, 3.349322695249598, 2.883394927243874, 1.3721013209368493, 1.280893011800056, 1.0542259564090841, 1.4772922648986433, 0.6221183528335891, 0.48469667040778164, 0.2831191891479958, 0.0, 3.873884816529492, 3.114311080627953, 2.4234833520389083, 1.8663550585007669, 2.9545845297972866, 1.475916338972718, 1.280893011800056, 0.9800723720977494, 1.441697463621937, 1.1164408984165328, 0.6294505086877001, 0.2763988207442808, 0.0), # 103
(3.852259963022604, 3.0240963051462453, 3.140734082075903, 3.340251217793881, 2.878166438042981, 1.3686909058578471, 1.2749783787314652, 1.0503494894071028, 1.4743540999847584, 0.6198128212162782, 0.48270508397818346, 0.2822719017479685, 0.0, 3.8661074674211253, 3.104990919227653, 2.413525419890917, 1.8594384636488344, 2.948708199969517, 1.4704892851699438, 1.2749783787314652, 0.9776363613270336, 1.4390832190214904, 1.1134170725979606, 0.6281468164151807, 0.274917845922386, 0.0), # 104
(3.840016103059581, 3.0078330346475504, 3.1341628086419755, 3.3311480978260866, 2.8729121278140886, 1.3653120713305902, 1.2690657744579317, 1.0465534979423872, 1.4714248971193415, 0.6175018155410315, 0.480728335991494, 0.2814219189950185, 0.0, 3.858304398148148, 3.0956411089452027, 2.40364167995747, 1.852505446623094, 2.942849794238683, 1.465174897119342, 1.2690657744579317, 0.9752229080932786, 1.4364560639070443, 1.1103826992753625, 0.6268325617283951, 0.273439366786141, 0.0), # 105
(3.8277894196934454, 2.9916048099473427, 3.1275400948788294, 3.3220196155394524, 2.867638451814196, 1.3619716455824824, 1.263157319992469, 1.0428398110044201, 1.4685072168876694, 0.6151853874499046, 0.4787693090751571, 0.2805696259395632, 0.0, 3.850485896776406, 3.0862658853351945, 2.3938465453757853, 1.8455561623497134, 2.9370144337753388, 1.4599757354061882, 1.263157319992469, 0.9728368897017731, 1.433819225907098, 1.1073398718464844, 0.6255080189757659, 0.27196407363157665, 0.0), # 106
(3.8155982346275423, 2.9754192243019606, 3.1208673125285786, 3.312872051127214, 2.8623518653003037, 1.3586764568409289, 1.2572551363480924, 1.0392102575826858, 1.465603619875019, 0.612863588584954, 0.47683088585661687, 0.2797154076320202, 0.0, 3.842662251371742, 3.0768694839522217, 2.3841544292830843, 1.8385907657548617, 2.931207239750038, 1.4548943606157603, 1.2572551363480924, 0.9704831834578064, 1.4311759326501519, 1.1042906837090716, 0.6241734625057157, 0.2704926567547237, 0.0), # 107
(3.8034608695652175, 2.9592838709677425, 3.114145833333334, 3.303711684782609, 2.857058823529411, 1.3554333333333337, 1.2513613445378151, 1.0356666666666667, 1.4627166666666667, 0.6105364705882355, 0.47491594896331746, 0.2788596491228071, 0.0, 3.8348437500000006, 3.0674561403508775, 2.374579744816587, 1.8316094117647062, 2.9254333333333333, 1.4499333333333335, 1.2513613445378151, 0.9681666666666668, 1.4285294117647056, 1.10123722826087, 0.6228291666666669, 0.269025806451613, 0.0), # 108
(3.7913956462098173, 2.9432063432010267, 3.1073770290352085, 3.2945447966988723, 2.85176578175852, 1.3522491032871007, 1.2454780655746525, 1.032210867245847, 1.4598489178478888, 0.6082040851018049, 0.4730273810227027, 0.2780027354623413, 0.0, 3.8270406807270234, 3.0580300900857535, 2.3651369051135136, 1.8246122553054143, 2.9196978356957777, 1.4450952141441857, 1.2454780655746525, 0.9658922166336433, 1.42588289087926, 1.0981815988996244, 0.6214754058070417, 0.2675642130182752, 0.0), # 109
(3.7794208862646865, 2.9271942342581534, 3.1005622713763157, 3.285377667069243, 2.846479195244628, 1.3491305949296348, 1.2396074204716179, 1.0288446883097089, 1.4570029340039627, 0.6058664837677185, 0.4711680646622168, 0.2771450517010405, 0.0, 3.819263331618656, 3.0485955687114448, 2.355840323311084, 1.817599451303155, 2.9140058680079255, 1.4403825636335925, 1.2396074204716179, 0.9636647106640249, 1.423239597622314, 1.0951258890230813, 0.6201124542752632, 0.2661085667507413, 0.0), # 110
(3.7675549114331726, 2.91125513739546, 3.093702932098766, 3.2762165760869566, 2.841205519244735, 1.3460846364883403, 1.2337515302417263, 1.0255699588477367, 1.4541812757201646, 0.6035237182280321, 0.4693408825093036, 0.27628698288932213, 0.0, 3.811521990740741, 3.039156811782543, 2.346704412546518, 1.810571154684096, 2.9083625514403293, 1.4357979423868314, 1.2337515302417263, 0.9614890260631003, 1.4206027596223676, 1.0920721920289858, 0.6187405864197533, 0.26465955794504187, 0.0), # 111
(3.75581604341862, 2.895396645869286, 3.086800382944674, 3.26706780394525, 2.8359512090158425, 1.3431180561906215, 1.2279125158979918, 1.0223885078494133, 1.4513865035817708, 0.6011758401248017, 0.46754871719140734, 0.2754289140776037, 0.0, 3.803826946159122, 3.0297180548536407, 2.337743585957037, 1.8035275203744048, 2.9027730071635416, 1.4313439109891786, 1.2279125158979918, 0.9593700401361582, 1.4179756045079213, 1.0890226013150834, 0.6173600765889348, 0.2632178768972078, 0.0), # 112
(3.744201689481218, 2.8796528268881825, 3.0798726094173565, 3.257950164747612, 2.830713514712988, 1.3402362794833866, 1.222105192731354, 1.0193087614634344, 1.4486283748344828, 0.5988304736612731, 0.4657949270768578, 0.274573097883481, 0.0, 3.7961775603372887, 3.0203040767182903, 2.328974635384289, 1.796491420983819, 2.8972567496689656, 1.4270322660488082, 1.222105192731354, 0.957311628202419, 1.415356757356494, 1.0859833882492043, 0.6159745218834713, 0.26178662062619845, 0.0), # 113
(3.732592359160026, 2.8641789672926965, 3.0730152250072065, 3.2489368263832006, 2.8254382278843537, 1.3374327419903105, 1.216403641682116, 1.0163685432508534, 1.4459492047617415, 0.5965315167912784, 0.46408295580754655, 0.2737304057370992, 0.0, 3.788510165664014, 3.0110344631080905, 2.3204147790377325, 1.7895945503738346, 2.891898409523483, 1.4229159605511947, 1.216403641682116, 0.9553091014216503, 1.4127191139421769, 1.0829789421277338, 0.6146030450014414, 0.2603799061175179, 0.0), # 114
(3.720953961201598, 2.848980639517117, 3.066232310902439, 3.240025351554534, 2.820108714103627, 1.3347001529163784, 1.2108119300383124, 1.0135671090464515, 1.4433499971558386, 0.5942825327988078, 0.46241030076180634, 0.27290125275196175, 0.0, 3.7808026526641507, 3.001913780271579, 2.3120515038090312, 1.7828475983964231, 2.886699994311677, 1.4189939526650321, 1.2108119300383124, 0.9533572520831274, 1.4100543570518136, 1.0800084505181782, 0.613246462180488, 0.2589982399561016, 0.0), # 115
(3.709271949295054, 2.8340357031402905, 3.0595107299946247, 3.231199845079921, 2.8147169403690073, 1.3320320713669895, 1.2053209635055788, 1.010896718816499, 1.4408241785637108, 0.5920793358449549, 0.4607737287514322, 0.27208410658291154, 0.0, 3.7730429039023563, 2.9929251724120265, 2.3038686437571605, 1.7762380075348643, 2.8816483571274216, 1.4152554063430987, 1.2053209635055788, 0.9514514795478496, 1.4073584701845037, 1.0770666150266406, 0.611902145998925, 0.25763960937639013, 0.0), # 116
(3.697531777129509, 2.8193220177410643, 3.052837345175329, 3.2224444117776727, 2.8092548736786958, 1.3294220564475412, 1.1999216477895505, 1.0083496325272643, 1.4383651755322937, 0.589917740090813, 0.45917000658821894, 0.2712774348847917, 0.0, 3.76521880194329, 2.9840517837327085, 2.2958500329410945, 1.7697532202724386, 2.8767303510645874, 1.4116894855381699, 1.1999216477895505, 0.9495871831768151, 1.4046274368393479, 1.0741481372592245, 0.6105674690350659, 0.25630200161282407, 0.0), # 117
(3.6857188983940845, 2.804817442898285, 3.0461990193361226, 3.2137431564660996, 2.8037144810308914, 1.3268636672634326, 1.1946048885958631, 1.0059181101450163, 1.4359664146085245, 0.587793559697476, 0.4575959010839617, 0.27047970531244503, 0.0, 3.75731822935161, 2.9752767584368947, 2.287979505419808, 1.7633806790924278, 2.871932829217049, 1.4082853542030227, 1.1946048885958631, 0.9477597623310232, 1.4018572405154457, 1.0712477188220335, 0.6092398038672245, 0.25498340389984414, 0.0), # 118
(3.673818766777897, 2.790499838190801, 3.0395826153685745, 3.2050801839635117, 2.7980877294237922, 1.324350462920061, 1.1893615916301512, 1.0035944116360243, 1.433621322339339, 0.5857026088260373, 0.45604817905045525, 0.26968938552071453, 0.0, 3.749329068691973, 2.9665832407278594, 2.2802408952522764, 1.7571078264781117, 2.867242644678678, 1.405032176290434, 1.1893615916301512, 0.9459646163714721, 1.3990438647118961, 1.0683600613211708, 0.607916523073715, 0.253681803471891, 0.0), # 119
(3.6618168359700647, 2.776347063197458, 3.0329749961642545, 3.196439599088218, 2.792366585855599, 1.3218760025228253, 1.1841826625980507, 1.0013707969665573, 1.4313233252716744, 0.5836407016375906, 0.4545236072994945, 0.2689049431644433, 0.0, 3.741239202529039, 2.9579543748088755, 2.272618036497472, 1.7509221049127714, 2.8626466505433488, 1.40191911575318, 1.1841826625980507, 0.9441971446591609, 1.3961832929277995, 1.0654798663627396, 0.6065949992328509, 0.25239518756340534, 0.0), # 120
(3.6496985596597074, 2.762336977497104, 3.0263630246147293, 3.1878055066585302, 2.7865430173245116, 1.319433845177124, 1.179059007205196, 0.9992395261028846, 1.4290658499524664, 0.5816036522932297, 0.4530189526428745, 0.26812484589847413, 0.0, 3.7330365134274643, 2.9493733048832147, 2.265094763214372, 1.744810956879689, 2.858131699904933, 1.3989353365440385, 1.179059007205196, 0.9424527465550885, 1.3932715086622558, 1.0626018355528437, 0.6052726049229459, 0.2511215434088277, 0.0), # 121
(3.6374493915359416, 2.7484474406685857, 3.0197335636115703, 3.179162011492757, 2.780608990828729, 1.3170175499883545, 1.1739815311572235, 0.9971928590112749, 1.4268423229286518, 0.5795872749540478, 0.45153098189239016, 0.2673475613776501, 0.0, 3.7247088839519082, 2.9408231751541503, 2.2576549094619507, 1.7387618248621433, 2.8536846458573035, 1.3960700026157848, 1.1739815311572235, 0.9407268214202532, 1.3903044954143644, 1.059720670497586, 0.6039467127223141, 0.24985885824259874, 0.0), # 122
(3.6250547852878876, 2.7346563122907503, 3.013073476046346, 3.1704932184092085, 2.774556473366451, 1.314620676061916, 1.1689411401597678, 0.9952230556579972, 1.4246461707471672, 0.5775873837811388, 0.4500564618598364, 0.2665715572568141, 0.0, 3.716244196667029, 2.9322871298249544, 2.2502823092991817, 1.7327621513434162, 2.8492923414943343, 1.3933122779211962, 1.1689411401597678, 0.9390147686156541, 1.3872782366832255, 1.0568310728030696, 0.6026146952092691, 0.24860511929915918, 0.0), # 123
(3.612500194604662, 2.7209414519424455, 3.0063696248106235, 3.1617832322261963, 2.7683774319358765, 1.312236782503206, 1.163928739918464, 0.9933223760093212, 1.4224708199549485, 0.5755997929355963, 0.448592159357008, 0.26579530119080924, 0.0, 3.7076303341374848, 2.923748313098901, 2.2429607967850402, 1.7267993788067884, 2.844941639909897, 1.3906513264130496, 1.163928739918464, 0.93731198750229, 1.3841887159679382, 1.053927744075399, 0.6012739249621247, 0.24735831381294962, 0.0), # 124
(3.5997710731753836, 2.7072807192025174, 2.999608872795975, 3.1530161577620284, 2.7620638335352057, 1.309859428417623, 1.1589352361389478, 0.9914830800315152, 1.4203096970989324, 0.5736203165785135, 0.4471348411957002, 0.26501726083447835, 0.0, 3.6988551789279316, 2.9151898691792613, 2.235674205978501, 1.7208609497355403, 2.840619394197865, 1.3880763120441213, 1.1589352361389478, 0.9356138774411593, 1.3810319167676028, 1.0510053859206763, 0.599921774559195, 0.24611642901841072, 0.0), # 125
(3.5868528746891712, 2.6936519736498146, 2.9927780828939663, 3.1441760998350166, 2.755607645162638, 1.307482172910566, 1.153951534526854, 0.9896974276908488, 1.4181562287260556, 0.5716447688709844, 0.44568127418770764, 0.26423590384266454, 0.0, 3.6899066136030316, 2.9065949422693094, 2.2284063709385378, 1.7149343066129528, 2.8363124574521112, 1.3855763987671883, 1.153951534526854, 0.9339158377932613, 1.377803822581319, 1.0480586999450057, 0.5985556165787933, 0.2448774521499832, 0.0), # 126
(3.5737310528351447, 2.680033074863182, 2.9858641179961682, 3.13524716326347, 2.749000833816373, 1.305098575087432, 1.1489685407878187, 0.987957678953591, 1.416003841383254, 0.5696689639741025, 0.44422822514482535, 0.2634496978702106, 0.0, 3.6807725207274395, 2.897946676572316, 2.2211411257241265, 1.7090068919223071, 2.832007682766508, 1.3831407505350275, 1.1489685407878187, 0.9322132679195942, 1.3745004169081865, 1.0450823877544901, 0.5971728235992337, 0.2436393704421075, 0.0), # 127
(3.5603910613024183, 2.6664018824214697, 2.9788538409941503, 3.1262134528656995, 2.7422353664946106, 1.3027021940536203, 1.1439771606274765, 0.9862560937860104, 1.4138459616174646, 0.5676887160489614, 0.44277246087884836, 0.2626571105719597, 0.0, 3.671440782865815, 2.8892282162915555, 2.2138623043942416, 1.7030661481468838, 2.827691923234929, 1.3807585313004147, 1.1439771606274765, 0.9305015671811573, 1.3711176832473053, 1.0420711509552334, 0.5957707681988301, 0.24240017112922455, 0.0), # 128
(3.546818353780113, 2.652736255903522, 2.9717341147794802, 3.1170590734600148, 2.73530321019555, 1.300286588914529, 1.1389682997514627, 0.9845849321543767, 1.4116760159756234, 0.5656998392566547, 0.4413107482015715, 0.2618566096027546, 0.0, 3.6618992825828154, 2.8804227056303, 2.2065537410078573, 1.6970995177699637, 2.823352031951247, 1.3784189050161275, 1.1389682997514627, 0.9287761349389492, 1.367651605097775, 1.0390196911533385, 0.594346822955896, 0.24115784144577473, 0.0), # 129
(3.532998383957347, 2.6390140548881877, 2.9644918022437268, 3.107768129864726, 2.72819633191739, 1.2978453187755554, 1.1339328638654125, 0.9829364540249584, 1.4094874310046666, 0.5636981477582759, 0.4398398539247897, 0.2610466626174385, 0.0, 3.6521359024430993, 2.8715132887918227, 2.199199269623948, 1.6910944432748272, 2.818974862009333, 1.3761110356349417, 1.1339328638654125, 0.9270323705539681, 1.364098165958695, 1.0359227099549089, 0.5928983604487453, 0.2399103686261989, 0.0), # 130
(3.5189166055232377, 2.625213138954313, 2.9571137662784603, 3.098324726898143, 2.7209066986583315, 1.295371942742099, 1.1288617586749619, 0.9813029193640249, 1.4072736332515314, 0.5616794557149186, 0.43835654486029796, 0.2602257372708542, 0.0, 3.6421385250113247, 2.8624831099793955, 2.1917827243014893, 1.6850383671447555, 2.814547266503063, 1.373824087109635, 1.1288617586749619, 0.9252656733872135, 1.3604533493291657, 1.0327749089660478, 0.5914227532556922, 0.2386557399049376, 0.0), # 131
(3.504558472166904, 2.611311367680746, 2.9495868697752488, 3.0887129693785758, 2.7134262774165743, 1.2928600199195572, 1.123745889885745, 0.9796765881378455, 1.4050280492631537, 0.5596395772876765, 0.43685758781989104, 0.2593923012178448, 0.0, 3.6318950328521504, 2.853315313396292, 2.184287939099455, 1.6789187318630292, 2.8100560985263074, 1.3715472233929837, 1.123745889885745, 0.9234714427996837, 1.3567131387082871, 1.0295709897928589, 0.5899173739550498, 0.2373919425164315, 0.0), # 132
(3.4899094375774653, 2.5972866006463327, 2.9418979756256616, 3.0789169621243357, 2.705747035190316, 1.2903031094133288, 1.118576163203398, 0.9780497203126887, 1.40274410558647, 0.5575743266376434, 0.43533974961536415, 0.25854482211325314, 0.0, 3.6213933085302346, 2.843993043245784, 2.1766987480768205, 1.6727229799129297, 2.80548821117294, 1.3692696084377642, 1.118576163203398, 0.9216450781523777, 1.352873517595158, 1.0263056540414455, 0.5883795951251324, 0.2361169636951212, 0.0), # 133
(3.474954955444038, 2.583116697429922, 2.934033946721268, 3.068920809953731, 2.697860938977758, 1.287694770328812, 1.1133434843335557, 0.9764145758548239, 1.4004152287684173, 0.5554795179259124, 0.43379979705851196, 0.25768176761192224, 0.0, 3.6106212346102335, 2.8344994437311444, 2.1689989852925597, 1.6664385537777369, 2.8008304575368346, 1.3669804061967537, 1.1133434843335557, 0.9197819788062943, 1.348930469488879, 1.0229736033179107, 0.5868067893442537, 0.23482879067544749, 0.0), # 134
(3.4596804794557414, 2.5687795176103587, 2.9259816459536365, 3.058708617685074, 2.689759955777099, 1.285028561771405, 1.1080387589818537, 0.9747634147305201, 1.3980348453559306, 0.5533509653135777, 0.4322344969611296, 0.2568016053686951, 0.0, 3.599566693656808, 2.824817659055646, 2.1611724848056477, 1.660052895940733, 2.796069690711861, 1.3646687806227282, 1.1080387589818537, 0.917877544122432, 1.3448799778885494, 1.0195695392283581, 0.5851963291907273, 0.23352541069185084, 0.0), # 135
(3.444071463301694, 2.554252920766492, 2.9177279362143365, 3.0482644901366713, 2.681436052586538, 1.282298042846506, 1.102652892853927, 0.9730884969060463, 1.3955963818959474, 0.5511844829617324, 0.43064061613501187, 0.2559028030384148, 0.0, 3.5882175682346147, 2.814930833422562, 2.153203080675059, 1.6535534488851968, 2.7911927637918947, 1.362323895668465, 1.102652892853927, 0.9159271734617901, 1.340718026293269, 1.0160881633788907, 0.5835455872428673, 0.23220481097877202, 0.0), # 136
(3.4281133606710137, 2.5395147664771676, 2.9092596803949373, 3.0375725321268376, 2.6728811964042754, 1.279496772659513, 1.0971767916554112, 0.9713820823476715, 1.3930932649354042, 0.5489758850314703, 0.42901492139195374, 0.25498382827592403, 0.0, 3.5765617409083106, 2.804822111035164, 2.145074606959769, 1.6469276550944105, 2.7861865298708084, 1.3599349152867402, 1.0971767916554112, 0.9139262661853664, 1.3364405982021377, 1.0125241773756128, 0.5818519360789874, 0.23086497877065162, 0.0), # 137
(3.4117916252528193, 2.5245429143212332, 2.900563741387006, 3.0266168484738794, 2.6640873542285117, 1.2766183103158248, 1.0916013610919408, 0.9696364310216651, 1.3905189210212374, 0.5467209856838848, 0.4273541795437502, 0.254043148736066, 0.0, 3.5645870942425564, 2.794474636096725, 2.136770897718751, 1.640162957051654, 2.781037842042475, 1.3574910034303311, 1.0916013610919408, 0.9118702216541607, 1.3320436771142559, 1.0088722828246266, 0.5801127482774012, 0.22950390130193032, 0.0), # 138
(3.3950917107362275, 2.509315223877536, 2.8916269820821134, 3.015381543996108, 2.6550464930574442, 1.2736562149208395, 1.085917506869152, 0.9678438028942958, 1.387866776700383, 0.5444155990800699, 0.4256551574021961, 0.2530792320736836, 0.0, 3.5522815108020076, 2.7838715528105187, 2.1282757870109803, 1.6332467972402092, 2.775733553400766, 1.354981324052014, 1.085917506869152, 0.9097544392291711, 1.3275232465287221, 1.0051271813320362, 0.5783253964164228, 0.22811956580704876, 0.0), # 139
(3.3779990708103593, 2.4938095547249226, 2.882436265371829, 3.0038507235118335, 2.6457505798892744, 1.2706040455799552, 1.0801161346926793, 0.9659964579318328, 1.3851302585197776, 0.5420555393811187, 0.42391462177908634, 0.25209054594361974, 0.0, 3.539632873151326, 2.7729960053798166, 2.1195731088954313, 1.6261666181433558, 2.770260517039555, 1.352395041104566, 1.0801161346926793, 0.9075743182713966, 1.3228752899446372, 1.0012835745039448, 0.5764872530743659, 0.22670995952044753, 0.0), # 140
(3.3604991591643323, 2.478003766442241, 2.8729784541477206, 2.992008491839366, 2.636191581722201, 1.2674553613985702, 1.074188150268159, 0.9640866561005451, 1.3823027930263572, 0.5396366207481252, 0.422129339486216, 0.2510755580007175, 0.0, 3.5266290638551654, 2.761831138007892, 2.1106466974310796, 1.6189098622443754, 2.7646055860527143, 1.3497213185407633, 1.074188150268159, 0.9053252581418358, 1.3180957908611004, 0.9973361639464555, 0.5745956908295441, 0.2252730696765674, 0.0), # 141
(3.3425774294872626, 2.4618757186083373, 2.863240411301357, 2.9798389537970165, 2.626361465554423, 1.2642037214820832, 1.0681244593012253, 0.962106657366702, 1.3793778067670588, 0.5371546573421829, 0.4202960773353799, 0.25003273589981984, 0.0, 3.5132579654781866, 2.750360094898018, 2.101480386676899, 1.6114639720265485, 2.7587556135341176, 1.3469493203133829, 1.0681244593012253, 0.903002658201488, 1.3131807327772116, 0.9932796512656723, 0.5726480822602714, 0.2238068835098489, 0.0), # 142
(3.32421933546827, 2.4454032708020597, 2.8532089997243086, 2.9673262142030925, 2.616252198384141, 1.2608426849358916, 1.0619159674975138, 0.960048721696572, 1.3763487262888197, 0.5346054633243854, 0.4184116021383729, 0.2489605472957697, 0.0, 3.499507460585047, 2.738566020253466, 2.0920580106918645, 1.603816389973156, 2.7526974525776393, 1.3440682103752009, 1.0619159674975138, 0.9006019178113511, 1.3081260991920705, 0.9891087380676977, 0.5706417999448617, 0.22230938825473273, 0.0), # 143
(3.305410330796474, 2.4285642826022547, 2.8428710823081427, 2.954454377875907, 2.6058557472095543, 1.2573658108653942, 1.0555535805626597, 0.9579051090564249, 1.3732089781385746, 0.5319848528558261, 0.4164726807069901, 0.24785745984341, 0.0, 3.485365431740406, 2.7264320582775095, 2.0823634035349503, 1.595954558567478, 2.746417956277149, 1.3410671526789948, 1.0555535805626597, 0.8981184363324245, 1.3029278736047771, 0.9848181259586359, 0.5685742164616286, 0.22077857114565957, 0.0), # 144
(3.286135869160991, 2.41133661358777, 2.8322135219444298, 2.9412075496337686, 2.595164079028862, 1.2537666583759894, 1.0490282042022987, 0.9556680794125294, 1.3699519888632605, 0.5292886400975989, 0.41447607985302637, 0.24672194119758384, 0.0, 3.47081976150892, 2.7139413531734218, 2.072380399265132, 1.5878659202927965, 2.739903977726521, 1.3379353111775412, 1.0490282042022987, 0.8955476131257067, 1.297582039514431, 0.9804025165445898, 0.566442704388886, 0.21921241941707004, 0.0), # 145
(3.2663814042509403, 2.393698123337452, 2.821223181524739, 2.927569834294988, 2.584169160840265, 1.2500387865730758, 1.042330744122066, 0.9533298927311545, 1.3665711850098141, 0.5265126392107972, 0.4124185663882766, 0.24555245901313405, 0.0, 3.4558583324552474, 2.701077049144474, 2.062092831941383, 1.5795379176323912, 2.7331423700196282, 1.3346618498236165, 1.042330744122066, 0.8928848475521969, 1.2920845804201324, 0.9758566114316628, 0.5642446363049479, 0.21760892030340476, 0.0), # 146
(3.24613238975544, 2.375626671430148, 2.8098869239406365, 2.913525336677874, 2.5728629596419603, 1.2461757545620502, 1.0354521060275963, 0.9508828089785692, 1.3630599931251721, 0.5236526643565147, 0.4102969071245358, 0.24434748094490372, 0.0, 3.4404690271440472, 2.6878222903939406, 2.051484535622679, 1.5709579930695439, 2.7261199862503442, 1.331235932569997, 1.0354521060275963, 0.8901255389728929, 1.2864314798209802, 0.9711751122259582, 0.5619773847881274, 0.21596606103910437, 0.0), # 147
(3.2253742793636087, 2.3571001174447055, 2.7981916120836945, 2.899058161600739, 2.56123744243215, 1.2421711214483127, 1.0283831956245253, 0.9483190881210429, 1.3594118397562704, 0.5207045296958448, 0.4081078688735989, 0.24310547464773571, 0.0, 3.4246397281399767, 2.6741602211250926, 2.0405393443679944, 1.562113589087534, 2.718823679512541, 1.3276467233694602, 1.0283831956245253, 0.8872650867487947, 1.280618721216075, 0.9663527205335799, 0.5596383224167389, 0.21428182885860964, 0.0), # 148
(3.204092526764565, 2.338096320959971, 2.7861241088454816, 2.884152413881891, 2.549284576209032, 1.2380184463372599, 1.0211149186184882, 0.9456309901248444, 1.355620151450045, 0.5176640493898814, 0.40584821844726066, 0.24182490777647309, 0.0, 3.408358318007695, 2.6600739855412034, 2.0292410922363033, 1.5529921481696438, 2.71124030290009, 1.3238833861747823, 1.0211149186184882, 0.8842988902408999, 1.274642288104516, 0.9613841379606305, 0.5572248217690964, 0.21255421099636107, 0.0), # 149
(3.182272585647426, 2.3185931415547922, 2.773671277117565, 2.8687921983396416, 2.5369963279708068, 1.2337112883342916, 1.0136381807151202, 0.9428107749562428, 1.3516783547534337, 0.5145270375997177, 0.40351472265731625, 0.24050424798595882, 0.0, 3.3916126793118586, 2.6455467278455465, 2.017573613286581, 1.5435811127991528, 2.7033567095068674, 1.31993508493874, 1.0136381807151202, 0.8812223488102082, 1.2684981639854034, 0.956264066113214, 0.5547342554235131, 0.21078119468679934, 0.0), # 150
(3.15989990970131, 2.2985684388080165, 2.7608199797915143, 2.852961619792299, 2.524364664715674, 1.2292432065448047, 1.0059438876200566, 0.9398507025815073, 1.347579876213372, 0.5112893084864479, 0.40110414831556035, 0.23914196293103576, 0.0, 3.3743906946171274, 2.630561592241393, 2.0055207415778016, 1.5338679254593435, 2.695159752426744, 1.3157909836141102, 1.0059438876200566, 0.8780308618177176, 1.262182332357837, 0.9509872065974332, 0.5521639959583029, 0.20896076716436518, 0.0), # 151
(3.1369599526153373, 2.27800007229849, 2.747557079758901, 2.836644783058176, 2.5113815534418316, 1.2246077600741982, 0.998022945038933, 0.9367430329669069, 1.343318142376796, 0.5079466762111651, 0.3986132622337882, 0.237736520266547, 0.0, 3.356680246488159, 2.6151017229320166, 1.9930663111689406, 1.523840028633495, 2.686636284753592, 1.3114402461536696, 0.998022945038933, 0.8747198286244273, 1.2556907767209158, 0.9455482610193922, 0.5495114159517802, 0.2070909156634991, 0.0), # 152
(3.1134381680786243, 2.2568659016050607, 2.7338694399112895, 2.81982579295558, 2.4980389611474814, 1.2197985080278704, 0.9898662586773839, 0.9334800260787104, 1.338886579790643, 0.504494954934963, 0.39603883122379446, 0.2362863876473355, 0.0, 3.338469217489611, 2.59915026412069, 1.9801941561189722, 1.5134848648048886, 2.677773159581286, 1.3068720365101947, 0.9898662586773839, 0.871284648591336, 1.2490194805737407, 0.9399419309851935, 0.546773887982258, 0.20516962741864192, 0.0), # 153
(3.0893200097802915, 2.2351437863065757, 2.719743923140253, 2.802488754302823, 2.4843288548308213, 1.2148090095112194, 0.9814647342410456, 0.9300539418831871, 1.3342786150018489, 0.5009299588189354, 0.3933776220973742, 0.2347900327282442, 0.0, 3.319745490186143, 2.5826903600106856, 1.9668881104868707, 1.502789876456806, 2.6685572300036977, 1.302075518636462, 0.9814647342410456, 0.8677207210794424, 1.2421644274154107, 0.9341629181009412, 0.5439487846280506, 0.20319488966423419, 0.0), # 154
(3.0645909314094544, 2.212811585981881, 2.705167392337359, 2.7846177719182137, 2.470243201490052, 1.2096328236296434, 0.9728092774355522, 0.926457040346606, 1.3294876745573503, 0.49724750202417556, 0.39062640166632223, 0.2332459231641161, 0.0, 3.3004969471424106, 2.565705154805277, 1.953132008331611, 1.4917425060725265, 2.6589753491147006, 1.2970398564852486, 0.9728092774355522, 0.8640234454497453, 1.235121600745026, 0.928205923972738, 0.5410334784674719, 0.2011646896347165, 0.0), # 155
(3.0392363866552325, 2.1898471602098257, 2.6901267103941757, 2.7661969506200625, 2.455773968123373, 1.204263509488541, 0.96389079396654, 0.9226815814352365, 1.3245071850040835, 0.4934433987117774, 0.38778193674243366, 0.23165252660979413, 0.0, 3.280711470923074, 2.548177792707735, 1.9389096837121682, 1.480330196135332, 2.649014370008167, 1.2917542140093312, 0.96389079396654, 0.8601882210632436, 1.2278869840616864, 0.9220656502066877, 0.5380253420788351, 0.19907701456452961, 0.0), # 156
(3.013241829206745, 2.1662283685692554, 2.674608740202273, 2.7472103952266815, 2.4409131217289826, 1.19869462619331, 0.9547001895396439, 0.9187198251153471, 1.319330572888985, 0.4895134630428343, 0.38484099413750333, 0.2300083107201213, 0.0, 3.2603769440927906, 2.5300914179213336, 1.9242049706875164, 1.4685403891285025, 2.63866114577797, 1.2862077551614859, 0.9547001895396439, 0.8562104472809356, 1.2204565608644913, 0.915736798408894, 0.5349217480404546, 0.19692985168811414, 0.0), # 157
(2.985872378562096, 2.141499477616495, 2.6578639846341185, 2.7269308744953733, 2.424981628232266, 1.1925723778073256, 0.9450213441855715, 0.9142994920582287, 1.3135549455465463, 0.48533659162911447, 0.38170638350259617, 0.22825331880647803, 0.0, 3.238594343766138, 2.510786506871258, 1.908531917512981, 1.456009774887343, 2.6271098910930926, 1.2800192888815203, 0.9450213441855715, 0.8518374127195183, 1.212490814116133, 0.9089769581651246, 0.5315727969268238, 0.19468177069240863, 0.0), # 158
(2.9529147067913613, 2.1131239505198085, 2.635579272800996, 2.7011931476365363, 2.4040510159417674, 1.1838609178683244, 0.9336425526771432, 0.9078689221273971, 1.3048569681629525, 0.48022809940987465, 0.37782779570793296, 0.22604541745610365, 0.0, 3.210171058768078, 2.48649959201714, 1.8891389785396648, 1.4406842982296237, 2.609713936325905, 1.271016490978356, 0.9336425526771432, 0.8456149413345173, 1.2020255079708837, 0.9003977158788457, 0.5271158545601993, 0.1921021773199826, 0.0), # 159
(2.913948837961724, 2.0808688004649283, 2.6073069859852964, 2.669573253122658, 2.3777120350258123, 1.1723463024111265, 0.9204487496767568, 0.8992665315878912, 1.2929900302971533, 0.4741205651862895, 0.3731506339073027, 0.22335006496292825, 0.0, 3.1745682435574323, 2.4568507145922105, 1.8657531695365135, 1.422361695558868, 2.5859800605943066, 1.2589731442230476, 0.9204487496767568, 0.8373902160079474, 1.1888560175129061, 0.8898577510408863, 0.5214613971970593, 0.18916989095135714, 0.0), # 160
(2.869288821834384, 2.0449443182961717, 2.5733489906367697, 2.6323717511270184, 2.34623816647523, 1.1581680230330733, 0.9055362892013753, 0.8886000888516301, 1.278110635599869, 0.4670658193170939, 0.3677161103066472, 0.22019224896358572, 0.0, 3.132149617927639, 2.4221147385994426, 1.8385805515332359, 1.4011974579512814, 2.556221271199738, 1.2440401243922823, 0.9055362892013753, 0.8272628735950524, 1.173119083237615, 0.877457250375673, 0.514669798127354, 0.18590402893601563, 0.0), # 161
(2.8192487081705426, 2.005560794857854, 2.5340071532051653, 2.5898892018228983, 2.3099028912808546, 1.1414655713315065, 0.8890015252679618, 0.8759773623305338, 1.2603752877218182, 0.45911569216102327, 0.3615654371119081, 0.21659695709470983, 0.0, 3.0832789016721334, 2.382566528041808, 1.8078271855595405, 1.3773470764830695, 2.5207505754436363, 1.2263683072627474, 0.8890015252679618, 0.815332550951076, 1.1549514456404273, 0.8632964006076329, 0.5068014306410331, 0.18232370862344133, 0.0), # 162
(2.7641425467313994, 1.9629285209942922, 2.4895833401402343, 2.5424261653835805, 2.268979690433517, 1.122378438903767, 0.8709408118934802, 0.8615061204365209, 1.2399404903137208, 0.4503220140768126, 0.35473982652902725, 0.21258917699293448, 0.0, 3.0283198145843517, 2.338480946922279, 1.7736991326451361, 1.3509660422304375, 2.4798809806274416, 1.2061085686111293, 0.8709408118934802, 0.8016988849312622, 1.1344898452167584, 0.8474753884611936, 0.4979166680280469, 0.1784480473631175, 0.0), # 163
(2.704284387278154, 1.917257787549801, 2.4403794178917257, 2.4902832019823453, 2.2237420449240504, 1.1010461173471968, 0.8514505030948932, 0.8452941315815116, 1.2169627470262965, 0.440736615423197, 0.34728049076394646, 0.20819389629489346, 0.0, 2.9676360764577314, 2.290132859243828, 1.736402453819732, 1.3222098462695906, 2.433925494052593, 1.1834117842141163, 0.8514505030948932, 0.7864615123908549, 1.1118710224620252, 0.830094400660782, 0.4880758835783452, 0.17429616250452737, 0.0), # 164
(2.639988279572007, 1.8687588853686983, 2.3866972529093897, 2.433760871792476, 2.174463435743286, 1.077608098259137, 0.8306269528891644, 0.8274491641774244, 1.191598561510264, 0.43041132655891146, 0.3392286420226075, 0.2034361026372207, 0.0, 2.901591407085708, 2.237797129009427, 1.6961432101130374, 1.291233979676734, 2.383197123020528, 1.1584288298483942, 0.8306269528891644, 0.7697200701850978, 1.087231717871643, 0.8112536239308255, 0.477339450581878, 0.16988717139715442, 0.0), # 165
(2.571568273374159, 1.8176421052952998, 2.3288387116429763, 2.3731597349872504, 2.121417343882057, 1.0522038732369288, 0.8085665152932573, 0.8080789866361796, 1.164004437416343, 0.41939797784269134, 0.330625492510952, 0.19834078365655008, 0.0, 2.830549526261718, 2.1817486202220504, 1.6531274625547598, 1.2581939335280736, 2.328008874832686, 1.1313105812906514, 0.8085665152932573, 0.7515741951692348, 1.0607086719410286, 0.7910532449957504, 0.4657677423285953, 0.16524019139048182, 0.0), # 166
(2.4993384184458094, 1.764117738173922, 2.267105660542235, 2.308780351739953, 2.0648772503311945, 1.0249729338779137, 0.785365544324135, 0.7872913673696962, 1.1343368783952532, 0.40774839963327153, 0.3215122544349219, 0.1929329269895153, 0.0, 2.7548741537791983, 2.122262196884668, 1.607561272174609, 1.2232451988998143, 2.2686737567905064, 1.1022079143175747, 0.785365544324135, 0.7321235241985098, 1.0324386251655973, 0.7695934505799846, 0.45342113210844703, 0.16037433983399293, 0.0), # 167
(2.4236127645481584, 1.7083960748488805, 2.201799966056916, 2.240923282223864, 2.005116636081531, 0.9960547717794331, 0.7611203939987609, 0.7651940747898933, 1.102752388097714, 0.3955144222893873, 0.31193014000045877, 0.1872375202727504, 0.0, 2.674929009431585, 2.0596127230002543, 1.5596507000022939, 1.1865432668681617, 2.205504776195428, 1.0712717047058506, 0.7611203939987609, 0.7114676941281666, 1.0025583180407656, 0.7469744274079547, 0.4403599932113833, 0.15530873407717097, 0.0), # 168
(2.344705361442406, 1.6506874061644923, 2.13322349463677, 2.169889086612265, 1.9424089821238986, 0.9655888785388289, 0.7359274183340984, 0.7418948773086909, 1.0694074701744452, 0.3827478761697738, 0.3019203614135046, 0.1812795511428891, 0.0, 2.591077813012314, 1.9940750625717798, 1.509601807067523, 1.148243628509321, 2.1388149403488903, 1.0386528282321672, 0.7359274183340984, 0.6897063418134491, 0.9712044910619493, 0.7232963622040884, 0.426644698927354, 0.15006249146949932, 0.0), # 169
(2.2629302588897535, 1.5912020229650736, 2.061678112731545, 2.095978325078436, 1.8770277694491289, 0.9337147457534416, 0.7098829713471106, 0.717501543338008, 1.0344586282761652, 0.36950059163316584, 0.2915241308800011, 0.1750840072365653, 0.0, 2.503684284314822, 1.9259240796022181, 1.4576206544000057, 1.1085017748994974, 2.0689172565523304, 1.0045021606732112, 0.7098829713471106, 0.6669391041096011, 0.9385138847245644, 0.6986594416928121, 0.412335622546309, 0.14465472936046128, 0.0), # 170
(2.1786015066514, 1.53015021609494, 1.9874656867909928, 2.0194915577956607, 1.809246479048055, 0.900571865020613, 0.6830834070547611, 0.6921218412897638, 0.9980623660535942, 0.35582439903829893, 0.2807826606058899, 0.16867587619041288, 0.0, 2.413112143132546, 1.8554346380945415, 1.4039133030294495, 1.0674731971148965, 1.9961247321071884, 0.9689705778056694, 0.6830834070547611, 0.6432656178718664, 0.9046232395240275, 0.6731638525985537, 0.3974931373581986, 0.13910456509954003, 0.0), # 171
(2.092033154488546, 1.4677422763984087, 1.9108880832648623, 1.940729344937219, 1.7393385919115076, 0.8662997279376846, 0.6556250794740132, 0.6658635395758785, 0.9603751871574514, 0.3417711287439081, 0.26973716279711296, 0.16208014564106574, 0.0, 2.3197251092589215, 1.7828816020517226, 1.3486858139855649, 1.025313386231724, 1.9207503743149028, 0.9322089554062299, 0.6556250794740132, 0.618785519955489, 0.8696692959557538, 0.6469097816457398, 0.3821776166529725, 0.13343111603621902, 0.0), # 172
(2.003539252162392, 1.4041884947197956, 1.832247168602904, 1.8599922466763927, 1.6675775890303204, 0.8310378261019976, 0.62760434262183, 0.6388344066082706, 0.9215535952384564, 0.32739261110872825, 0.25842884965961194, 0.1553218032251575, 0.0, 2.223886902487385, 1.7085398354767325, 1.2921442482980594, 0.9821778333261846, 1.8431071904769127, 0.8943681692515789, 0.62760434262183, 0.5935984472157125, 0.8337887945151602, 0.6199974155587977, 0.36644943372058086, 0.12765349951998142, 0.0), # 173
(1.9134338494341376, 1.3396991619034166, 1.7518448092548675, 1.7775808231864623, 1.5942369513953243, 0.7949256511108933, 0.5991175505151751, 0.6111422107988601, 0.8817540939473285, 0.31274067649149473, 0.24689893339932856, 0.1484258365793223, 0.0, 2.1259612426113734, 1.632684202372545, 1.2344946669966426, 0.9382220294744841, 1.763508187894657, 0.8555990951184042, 0.5991175505151751, 0.5678040365077809, 0.7971184756976621, 0.5925269410621542, 0.3503689618509735, 0.12179083290031062, 0.0), # 174
(1.8220309960649823, 1.274484568793588, 1.6699828716705027, 1.6937956346407104, 1.5195901599973516, 0.7581026945617134, 0.5702610571710116, 0.582894720559566, 0.8411331869347874, 0.2978671552509425, 0.23518862622220466, 0.14141723334019382, 0.0, 2.026311849424323, 1.5555895667421318, 1.1759431311110233, 0.8936014657528273, 1.682266373869575, 0.8160526087833925, 0.5702610571710116, 0.5415019246869381, 0.7597950799986758, 0.5645985448802369, 0.33399657433410057, 0.11586223352668984, 0.0), # 175
(1.7296447418161276, 1.2087550062346268, 1.5869632222995596, 1.6089372412124177, 1.4439106958272347, 0.720708448051799, 0.541131216606303, 0.5541997043023082, 0.7998473778515522, 0.28282387774580675, 0.22333914033418203, 0.134320981144406, 0.0, 1.9253024427196697, 1.4775307925884658, 1.11669570167091, 0.84847163323742, 1.5996947557031045, 0.7758795860232315, 0.541131216606303, 0.5147917486084279, 0.7219553479136174, 0.5363124137374726, 0.31739264445991194, 0.10988681874860246, 0.0), # 176
(1.636589136448773, 1.1427207650708489, 1.503087727591788, 1.5233062030748648, 1.3674720398758062, 0.6828824031784915, 0.5118243828380126, 0.5251649304390055, 0.7580531703483426, 0.2676626743348225, 0.21139168794120244, 0.12716206762859264, 0.0, 1.82329674229085, 1.3987827439145188, 1.056958439706012, 0.8029880230044673, 1.5161063406966853, 0.7352309026146077, 0.5118243828380126, 0.48777314512749387, 0.6837360199379031, 0.5077687343582884, 0.3006175455183576, 0.10388370591553173, 0.0), # 177
(1.5431782297241188, 1.0765921361465705, 1.4186582539969381, 1.437203080401335, 1.290547673133897, 0.6447640515391326, 0.4824369098831035, 0.4958981673815776, 0.715907068075878, 0.25243537537672506, 0.19938748124920752, 0.1199654804293876, 0.0, 1.7206584679313008, 1.3196202847232632, 0.9969374062460375, 0.757306126130175, 1.431814136151756, 0.6942574343342086, 0.4824369098831035, 0.46054575109938045, 0.6452738365669485, 0.47906769346711175, 0.2837316507993876, 0.09787201237696096, 0.0), # 178
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 179
)
passenger_allighting_rate = (
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 0
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 1
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 2
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 3
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 4
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 5
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 6
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 7
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 8
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 9
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 10
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 11
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 12
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 13
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 14
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 15
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 16
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 17
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 18
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 19
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 20
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 21
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 22
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 23
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 24
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 25
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 26
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 27
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 28
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 29
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 30
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 31
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 32
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 33
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 34
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 35
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 36
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 37
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 38
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 39
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 40
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 41
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 42
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 43
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 44
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 45
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 46
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 47
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 48
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 49
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 50
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 51
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 52
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 53
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 54
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 55
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 56
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 57
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 58
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 59
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 60
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 61
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 62
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 63
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 64
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 65
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 66
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 67
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 68
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 69
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 70
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 71
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 72
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 73
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 74
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 75
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 76
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 77
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 78
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 79
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 80
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 81
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 82
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 83
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 84
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 85
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 86
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 87
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 88
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 89
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 90
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 91
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 92
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 93
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 94
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 95
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 96
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 97
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 98
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 99
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 100
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 101
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 102
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 103
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 104
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 105
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 106
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 107
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 108
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 109
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 110
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 111
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 112
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 113
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 114
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 115
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 116
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 117
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 118
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 119
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 120
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 121
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 122
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 123
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 124
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 125
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 126
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 127
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 128
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 129
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 130
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 131
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 132
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 133
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 134
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 135
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 136
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 137
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 138
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 139
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 140
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 141
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 142
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 143
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 144
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 145
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 146
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 147
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 148
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 149
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 150
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 151
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 152
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 153
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 154
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 155
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 156
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 157
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 158
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 159
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 160
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 161
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 162
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 163
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 164
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 165
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 166
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 167
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 168
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 169
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 170
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 171
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 172
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 173
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 174
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 175
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 176
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 177
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 178
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1), # 179
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 8991598675325360468762009371570610170
#index for seed sequence child
child_seed_index = (
1, # 0
59, # 1
)
| 276.502674
| 500
| 0.76976
|
numPassengers = 7667
passenger_arriving = (
(2, 0, 1, 3, 1, 1, 2, 1, 0, 1, 0, 0, 0, 3, 1, 3, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0),
(2, 2, 4, 2, 0, 1, 0, 1, 2, 0, 0, 1, 0, 4, 6, 1, 2, 3, 0, 1, 1, 1, 0, 0, 0, 0),
(2, 2, 3, 3, 0, 2, 0, 1, 1, 0, 1, 0, 0, 2, 1, 4, 2, 2, 0, 3, 1, 1, 0, 0, 1, 0),
(6, 1, 2, 1, 3, 1, 0, 1, 2, 1, 0, 0, 0, 2, 1, 2, 3, 1, 0, 0, 1, 0, 1, 0, 1, 0),
(2, 5, 3, 5, 0, 0, 0, 0, 1, 0, 0, 1, 0, 1, 5, 1, 1, 2, 1, 1, 1, 0, 1, 2, 0, 0),
(2, 2, 3, 1, 1, 1, 0, 1, 1, 0, 2, 0, 0, 1, 1, 1, 1, 1, 3, 3, 2, 0, 0, 0, 1, 0),
(4, 5, 1, 4, 0, 2, 0, 1, 1, 2, 2, 1, 0, 4, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 0, 0),
(1, 2, 3, 6, 0, 1, 2, 1, 0, 0, 2, 1, 0, 1, 2, 2, 1, 5, 1, 0, 4, 2, 0, 3, 0, 0),
(1, 4, 1, 3, 1, 2, 1, 0, 0, 1, 0, 0, 0, 4, 3, 4, 4, 1, 0, 0, 0, 2, 0, 2, 1, 0),
(4, 0, 1, 2, 1, 2, 2, 1, 1, 1, 0, 0, 0, 3, 5, 2, 3, 2, 3, 1, 3, 0, 0, 1, 0, 0),
(1, 0, 0, 4, 2, 2, 2, 1, 0, 0, 1, 0, 0, 7, 3, 4, 0, 0, 5, 1, 2, 0, 2, 0, 0, 0),
(3, 3, 3, 4, 3, 1, 0, 0, 2, 1, 0, 0, 0, 5, 3, 4, 1, 1, 1, 1, 2, 1, 3, 1, 0, 0),
(3, 3, 4, 2, 3, 0, 0, 1, 2, 2, 1, 0, 0, 2, 3, 3, 4, 3, 3, 0, 1, 0, 0, 1, 0, 0),
(3, 3, 1, 1, 3, 1, 1, 0, 2, 2, 1, 1, 0, 4, 4, 1, 2, 1, 1, 0, 2, 3, 3, 1, 0, 0),
(3, 2, 3, 3, 1, 1, 1, 1, 1, 1, 0, 0, 0, 3, 2, 2, 6, 7, 2, 3, 1, 1, 0, 1, 1, 0),
(6, 1, 1, 2, 2, 1, 0, 1, 2, 0, 0, 0, 0, 3, 4, 4, 0, 4, 1, 3, 0, 2, 1, 0, 0, 0),
(4, 3, 0, 3, 0, 1, 3, 1, 1, 2, 1, 1, 0, 2, 6, 2, 3, 2, 2, 2, 0, 1, 2, 0, 0, 0),
(5, 11, 1, 7, 4, 2, 0, 1, 3, 0, 1, 0, 0, 3, 1, 5, 2, 6, 0, 1, 2, 1, 0, 0, 0, 0),
(6, 4, 2, 4, 1, 1, 2, 0, 0, 0, 0, 0, 0, 5, 2, 0, 1, 5, 0, 1, 0, 0, 0, 2, 2, 0),
(6, 6, 3, 3, 4, 0, 2, 2, 2, 1, 0, 1, 0, 3, 3, 5, 2, 4, 3, 0, 1, 1, 0, 0, 1, 0),
(8, 6, 3, 4, 2, 2, 4, 3, 3, 1, 0, 1, 0, 3, 0, 1, 4, 3, 1, 3, 1, 2, 3, 2, 0, 0),
(5, 4, 2, 6, 2, 2, 1, 1, 4, 2, 3, 0, 0, 4, 4, 2, 2, 8, 4, 1, 2, 0, 0, 2, 0, 0),
(3, 4, 4, 3, 4, 1, 1, 0, 1, 2, 1, 0, 0, 3, 2, 0, 1, 2, 2, 2, 1, 1, 2, 2, 0, 0),
(1, 2, 5, 4, 3, 0, 2, 4, 3, 2, 0, 0, 0, 7, 5, 2, 3, 6, 3, 2, 3, 3, 1, 0, 0, 0),
(2, 8, 1, 3, 1, 3, 1, 3, 2, 1, 1, 1, 0, 6, 5, 0, 3, 2, 3, 1, 0, 1, 4, 1, 0, 0),
(7, 3, 3, 3, 3, 0, 1, 0, 2, 1, 1, 0, 0, 4, 0, 2, 4, 4, 4, 0, 0, 0, 1, 0, 1, 0),
(4, 0, 2, 3, 2, 4, 1, 1, 1, 2, 1, 0, 0, 5, 1, 3, 2, 1, 1, 1, 0, 0, 1, 0, 0, 0),
(5, 4, 6, 4, 1, 1, 1, 2, 3, 2, 4, 0, 0, 3, 4, 0, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0),
(3, 5, 4, 2, 3, 2, 1, 1, 2, 0, 2, 1, 0, 3, 4, 6, 2, 6, 1, 1, 0, 1, 0, 1, 0, 0),
(3, 4, 2, 9, 0, 2, 2, 2, 4, 1, 0, 0, 0, 5, 3, 3, 1, 5, 2, 0, 2, 1, 2, 0, 0, 0),
(6, 4, 1, 2, 4, 1, 1, 3, 1, 0, 1, 1, 0, 5, 4, 3, 2, 2, 1, 3, 0, 3, 1, 0, 3, 0),
(1, 4, 4, 5, 1, 2, 2, 2, 3, 1, 1, 0, 0, 9, 4, 1, 4, 4, 1, 1, 1, 5, 2, 0, 0, 0),
(8, 4, 5, 0, 3, 1, 1, 1, 1, 1, 1, 1, 0, 3, 1, 4, 1, 5, 2, 1, 3, 0, 0, 1, 0, 0),
(3, 6, 2, 2, 2, 2, 1, 1, 1, 0, 0, 0, 0, 4, 8, 2, 4, 7, 2, 5, 1, 1, 3, 1, 0, 0),
(5, 4, 3, 2, 4, 1, 4, 2, 0, 0, 1, 0, 0, 2, 5, 9, 4, 2, 1, 4, 0, 2, 1, 0, 0, 0),
(3, 3, 3, 2, 4, 3, 2, 3, 2, 0, 0, 0, 0, 5, 3, 1, 3, 0, 1, 1, 1, 1, 1, 0, 0, 0),
(4, 3, 2, 8, 3, 2, 2, 1, 2, 0, 0, 0, 0, 3, 2, 2, 5, 3, 1, 1, 0, 2, 0, 0, 0, 0),
(5, 2, 2, 2, 7, 1, 0, 3, 2, 1, 0, 0, 0, 7, 2, 4, 1, 4, 4, 3, 0, 3, 0, 2, 0, 0),
(2, 6, 4, 10, 3, 1, 3, 0, 4, 0, 0, 1, 0, 3, 2, 4, 0, 3, 1, 0, 2, 2, 0, 0, 0, 0),
(3, 2, 5, 1, 5, 3, 4, 1, 0, 0, 2, 0, 0, 4, 4, 3, 3, 5, 4, 1, 0, 0, 1, 0, 1, 0),
(3, 5, 1, 5, 1, 2, 4, 3, 2, 2, 0, 0, 0, 1, 5, 1, 1, 3, 2, 0, 0, 1, 1, 0, 1, 0),
(3, 1, 2, 7, 5, 1, 2, 1, 1, 1, 0, 0, 0, 0, 3, 5, 3, 6, 4, 1, 2, 1, 1, 0, 0, 0),
(5, 3, 4, 4, 4, 3, 1, 0, 1, 1, 1, 0, 0, 4, 4, 1, 4, 2, 1, 3, 0, 2, 1, 1, 0, 0),
(3, 9, 6, 6, 3, 2, 5, 4, 1, 4, 0, 0, 0, 1, 1, 4, 2, 2, 0, 2, 2, 0, 1, 2, 1, 0),
(2, 2, 1, 3, 1, 2, 4, 0, 2, 0, 2, 0, 0, 3, 4, 2, 1, 2, 1, 3, 2, 1, 2, 0, 0, 0),
(8, 6, 1, 3, 3, 2, 3, 0, 1, 0, 0, 1, 0, 4, 8, 2, 3, 4, 2, 3, 0, 1, 1, 1, 0, 0),
(5, 6, 2, 0, 2, 1, 1, 2, 0, 0, 0, 1, 0, 6, 3, 3, 3, 4, 2, 1, 1, 1, 2, 1, 0, 0),
(6, 5, 3, 5, 4, 2, 0, 2, 1, 2, 2, 0, 0, 0, 3, 3, 2, 6, 2, 2, 2, 0, 2, 0, 0, 0),
(3, 6, 0, 3, 5, 2, 1, 2, 3, 1, 0, 0, 0, 4, 4, 4, 0, 3, 2, 1, 2, 2, 1, 0, 0, 0),
(4, 3, 5, 7, 3, 2, 1, 1, 2, 1, 0, 0, 0, 2, 4, 3, 1, 4, 2, 1, 1, 2, 2, 0, 0, 0),
(5, 7, 1, 3, 6, 2, 0, 1, 2, 1, 1, 1, 0, 7, 4, 3, 2, 3, 5, 4, 0, 0, 1, 0, 1, 0),
(5, 3, 3, 7, 2, 1, 3, 0, 0, 0, 0, 0, 0, 1, 4, 1, 4, 3, 1, 0, 2, 2, 3, 1, 1, 0),
(1, 4, 4, 9, 3, 4, 1, 1, 2, 0, 2, 0, 0, 3, 5, 3, 1, 6, 1, 0, 0, 0, 1, 0, 0, 0),
(4, 3, 4, 3, 5, 2, 2, 2, 4, 1, 1, 2, 0, 2, 7, 2, 3, 2, 2, 1, 0, 1, 1, 1, 0, 0),
(7, 6, 7, 4, 5, 2, 2, 2, 0, 0, 0, 1, 0, 5, 1, 2, 1, 3, 4, 2, 2, 1, 0, 0, 0, 0),
(5, 4, 2, 5, 4, 0, 2, 1, 1, 0, 0, 0, 0, 3, 2, 3, 3, 5, 1, 3, 0, 1, 0, 0, 0, 0),
(3, 3, 4, 4, 4, 2, 0, 1, 1, 0, 1, 0, 0, 5, 3, 2, 1, 3, 5, 0, 2, 0, 2, 1, 0, 0),
(3, 4, 0, 5, 2, 3, 1, 1, 3, 1, 0, 1, 0, 4, 3, 7, 1, 2, 2, 1, 1, 2, 0, 0, 0, 0),
(7, 3, 6, 3, 2, 0, 4, 0, 1, 0, 0, 0, 0, 6, 3, 2, 0, 2, 0, 3, 3, 2, 0, 0, 0, 0),
(5, 6, 5, 3, 4, 1, 3, 2, 1, 0, 0, 0, 0, 4, 1, 0, 1, 3, 1, 0, 0, 2, 0, 1, 1, 0),
(7, 4, 4, 4, 2, 0, 0, 0, 2, 1, 3, 0, 0, 0, 6, 0, 1, 4, 0, 1, 1, 2, 2, 1, 0, 0),
(5, 1, 0, 3, 0, 0, 1, 0, 4, 1, 1, 0, 0, 1, 5, 3, 1, 3, 1, 2, 3, 3, 1, 1, 1, 0),
(5, 3, 2, 4, 2, 3, 1, 1, 3, 0, 0, 0, 0, 6, 4, 5, 1, 2, 2, 2, 1, 1, 3, 1, 0, 0),
(7, 3, 8, 5, 3, 0, 1, 1, 1, 1, 0, 1, 0, 3, 1, 0, 0, 2, 1, 0, 0, 0, 2, 1, 0, 0),
(5, 4, 1, 4, 3, 1, 5, 1, 2, 2, 0, 0, 0, 6, 1, 2, 5, 3, 1, 1, 0, 1, 2, 1, 0, 0),
(2, 3, 4, 3, 2, 3, 3, 2, 2, 1, 0, 0, 0, 5, 3, 1, 3, 3, 1, 0, 1, 0, 1, 2, 1, 0),
(3, 6, 6, 6, 3, 0, 5, 1, 1, 1, 0, 0, 0, 6, 2, 3, 0, 4, 4, 5, 0, 1, 1, 0, 0, 0),
(1, 3, 3, 8, 2, 0, 2, 2, 3, 2, 1, 0, 0, 7, 2, 2, 1, 1, 1, 0, 0, 0, 2, 1, 0, 0),
(6, 5, 1, 2, 4, 2, 0, 1, 2, 1, 0, 0, 0, 4, 3, 5, 3, 3, 0, 1, 1, 3, 1, 0, 0, 0),
(4, 1, 2, 3, 7, 0, 3, 4, 1, 4, 0, 0, 0, 2, 3, 2, 2, 7, 1, 4, 0, 1, 0, 0, 0, 0),
(6, 5, 6, 1, 5, 1, 0, 0, 2, 1, 1, 0, 0, 3, 4, 1, 2, 3, 1, 1, 0, 0, 1, 0, 0, 0),
(4, 6, 3, 4, 4, 0, 0, 0, 1, 1, 0, 1, 0, 3, 3, 2, 1, 3, 2, 0, 0, 1, 0, 0, 3, 0),
(3, 3, 2, 7, 2, 0, 0, 3, 0, 0, 0, 0, 0, 3, 3, 3, 1, 1, 1, 4, 1, 0, 0, 0, 0, 0),
(4, 4, 4, 2, 3, 1, 2, 0, 1, 2, 0, 1, 0, 5, 3, 1, 1, 5, 1, 2, 1, 1, 0, 0, 1, 0),
(2, 1, 6, 2, 4, 3, 1, 1, 1, 1, 0, 0, 0, 2, 3, 1, 3, 3, 1, 2, 0, 4, 0, 1, 1, 0),
(4, 2, 3, 2, 4, 1, 0, 0, 3, 1, 0, 0, 0, 3, 8, 5, 0, 5, 1, 1, 1, 0, 1, 4, 0, 0),
(4, 3, 6, 6, 2, 1, 1, 2, 2, 1, 1, 0, 0, 11, 3, 2, 4, 3, 2, 0, 2, 2, 1, 0, 0, 0),
(3, 8, 4, 2, 4, 2, 0, 1, 1, 0, 1, 0, 0, 4, 3, 3, 4, 2, 0, 1, 2, 1, 0, 0, 0, 0),
(2, 5, 5, 1, 0, 2, 3, 1, 3, 2, 1, 0, 0, 4, 5, 3, 2, 2, 1, 4, 1, 2, 0, 0, 1, 0),
(3, 3, 3, 1, 0, 1, 1, 1, 2, 0, 0, 2, 0, 3, 2, 4, 0, 8, 1, 1, 1, 1, 2, 1, 0, 0),
(3, 3, 2, 3, 2, 2, 1, 2, 1, 3, 0, 0, 0, 4, 4, 3, 1, 4, 0, 2, 1, 0, 3, 4, 0, 0),
(2, 2, 3, 2, 2, 1, 0, 0, 3, 1, 0, 1, 0, 2, 4, 3, 5, 6, 1, 4, 1, 0, 0, 1, 1, 0),
(6, 4, 4, 2, 3, 0, 2, 0, 4, 0, 0, 0, 0, 3, 1, 3, 3, 4, 6, 1, 0, 3, 3, 1, 0, 0),
(2, 6, 4, 2, 3, 1, 3, 1, 3, 1, 0, 0, 0, 6, 0, 2, 0, 3, 2, 0, 0, 2, 2, 0, 0, 0),
(4, 5, 7, 1, 3, 1, 1, 0, 2, 1, 1, 0, 0, 4, 3, 3, 3, 6, 3, 1, 0, 2, 1, 1, 0, 0),
(2, 3, 6, 4, 2, 1, 1, 1, 2, 0, 0, 1, 0, 9, 1, 0, 3, 4, 1, 3, 1, 2, 1, 1, 0, 0),
(3, 8, 4, 3, 2, 1, 2, 0, 3, 0, 1, 0, 0, 2, 2, 1, 2, 4, 2, 2, 3, 2, 2, 1, 0, 0),
(4, 3, 2, 4, 1, 1, 2, 0, 2, 0, 0, 0, 0, 2, 8, 4, 4, 2, 3, 1, 1, 0, 0, 2, 0, 0),
(9, 0, 2, 4, 2, 0, 1, 0, 2, 1, 0, 0, 0, 0, 4, 4, 4, 1, 1, 1, 0, 2, 1, 2, 0, 0),
(6, 3, 2, 4, 7, 4, 1, 0, 3, 2, 0, 2, 0, 4, 5, 2, 4, 4, 2, 1, 1, 1, 1, 1, 0, 0),
(5, 3, 3, 5, 4, 2, 1, 1, 4, 0, 0, 0, 0, 5, 5, 1, 2, 4, 4, 0, 0, 2, 3, 0, 0, 0),
(5, 4, 0, 2, 4, 1, 1, 0, 2, 2, 0, 0, 0, 4, 6, 2, 3, 6, 0, 4, 1, 2, 1, 0, 1, 0),
(5, 5, 4, 2, 3, 1, 2, 2, 1, 0, 0, 0, 0, 6, 3, 2, 2, 2, 1, 1, 1, 0, 2, 0, 0, 0),
(3, 1, 4, 4, 1, 1, 3, 2, 2, 0, 2, 0, 0, 4, 5, 1, 3, 1, 0, 2, 0, 0, 1, 1, 0, 0),
(5, 4, 11, 4, 4, 1, 0, 1, 3, 1, 0, 0, 0, 5, 6, 2, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0),
(5, 4, 2, 1, 4, 3, 1, 0, 0, 1, 0, 0, 0, 0, 2, 1, 0, 2, 1, 1, 0, 2, 0, 0, 0, 0),
(5, 4, 4, 3, 3, 1, 2, 1, 2, 0, 1, 1, 0, 6, 2, 2, 0, 3, 3, 0, 2, 1, 1, 2, 0, 0),
(1, 4, 1, 3, 5, 1, 1, 1, 3, 1, 0, 0, 0, 3, 5, 2, 1, 1, 2, 3, 0, 2, 1, 1, 0, 0),
(5, 0, 7, 5, 3, 0, 1, 0, 3, 0, 2, 1, 0, 4, 1, 3, 3, 1, 2, 2, 0, 4, 2, 1, 0, 0),
(6, 4, 2, 2, 5, 2, 1, 4, 2, 1, 0, 0, 0, 4, 3, 3, 1, 3, 3, 0, 0, 2, 1, 0, 2, 0),
(5, 2, 1, 2, 2, 0, 0, 3, 0, 0, 1, 1, 0, 6, 4, 1, 1, 3, 1, 1, 3, 1, 0, 0, 1, 0),
(2, 5, 6, 4, 2, 0, 2, 2, 1, 0, 0, 1, 0, 4, 5, 2, 2, 1, 5, 0, 0, 3, 3, 0, 0, 0),
(3, 5, 6, 7, 5, 1, 0, 0, 4, 1, 0, 1, 0, 6, 2, 4, 1, 2, 3, 2, 0, 3, 0, 1, 0, 0),
(5, 2, 3, 5, 3, 1, 2, 0, 4, 0, 0, 1, 0, 3, 2, 0, 3, 1, 1, 1, 1, 0, 0, 3, 0, 0),
(6, 5, 6, 4, 3, 1, 2, 1, 3, 1, 0, 0, 0, 8, 2, 3, 2, 0, 1, 4, 0, 1, 1, 0, 0, 0),
(4, 4, 6, 6, 1, 0, 3, 1, 1, 0, 0, 0, 0, 4, 1, 4, 1, 4, 2, 6, 2, 0, 0, 0, 0, 0),
(1, 6, 2, 5, 4, 2, 1, 0, 2, 1, 1, 0, 0, 1, 3, 4, 2, 3, 1, 0, 1, 1, 0, 0, 0, 0),
(0, 5, 4, 2, 5, 1, 0, 1, 1, 0, 1, 1, 0, 4, 5, 3, 0, 2, 3, 0, 1, 0, 2, 1, 0, 0),
(3, 5, 4, 2, 2, 1, 1, 1, 3, 0, 1, 0, 0, 4, 4, 2, 2, 2, 1, 2, 0, 0, 2, 2, 0, 0),
(5, 2, 3, 2, 2, 1, 1, 1, 2, 1, 1, 0, 0, 2, 6, 2, 4, 5, 0, 3, 1, 2, 1, 1, 0, 0),
(5, 4, 5, 1, 1, 3, 1, 1, 0, 1, 1, 0, 0, 7, 2, 1, 0, 1, 2, 0, 0, 1, 1, 0, 0, 0),
(1, 4, 2, 1, 3, 0, 4, 2, 1, 0, 0, 1, 0, 2, 2, 2, 5, 2, 3, 2, 0, 0, 3, 0, 0, 0),
(3, 5, 3, 6, 2, 0, 1, 1, 0, 1, 0, 0, 0, 3, 2, 2, 0, 2, 1, 1, 0, 2, 0, 1, 0, 0),
(1, 2, 1, 2, 2, 2, 0, 1, 5, 1, 0, 0, 0, 2, 3, 2, 0, 3, 2, 1, 1, 1, 0, 0, 0, 0),
(5, 2, 1, 6, 2, 0, 1, 0, 2, 1, 0, 0, 0, 4, 4, 1, 2, 1, 2, 2, 1, 1, 2, 0, 1, 0),
(3, 8, 1, 8, 2, 0, 1, 2, 2, 1, 0, 0, 0, 6, 2, 3, 3, 3, 1, 2, 2, 2, 1, 1, 1, 0),
(2, 1, 1, 4, 3, 2, 3, 1, 2, 0, 2, 0, 0, 4, 3, 1, 0, 2, 3, 1, 0, 2, 3, 1, 0, 0),
(4, 5, 2, 5, 3, 2, 0, 1, 5, 0, 0, 1, 0, 6, 3, 1, 1, 5, 2, 2, 0, 2, 2, 0, 1, 0),
(2, 5, 4, 8, 1, 4, 1, 0, 1, 1, 2, 0, 0, 2, 6, 2, 2, 1, 0, 3, 1, 2, 0, 1, 0, 0),
(2, 2, 1, 3, 2, 0, 0, 0, 1, 0, 0, 0, 0, 4, 3, 1, 2, 1, 2, 2, 2, 2, 0, 1, 0, 0),
(0, 1, 1, 4, 2, 2, 1, 0, 1, 0, 1, 0, 0, 3, 4, 1, 1, 2, 0, 0, 0, 2, 0, 0, 0, 0),
(3, 0, 2, 2, 2, 2, 2, 0, 2, 0, 0, 0, 0, 3, 1, 3, 1, 3, 0, 1, 0, 3, 1, 0, 1, 0),
(2, 2, 4, 1, 3, 0, 1, 0, 1, 0, 1, 0, 0, 3, 6, 4, 1, 1, 2, 1, 0, 1, 2, 0, 0, 0),
(1, 3, 5, 4, 3, 0, 4, 0, 2, 0, 0, 0, 0, 7, 3, 3, 2, 1, 0, 0, 2, 0, 0, 0, 0, 0),
(4, 3, 2, 6, 3, 4, 0, 2, 1, 0, 0, 0, 0, 4, 0, 1, 2, 2, 2, 3, 0, 2, 1, 1, 1, 0),
(1, 0, 0, 4, 2, 2, 1, 0, 0, 0, 0, 0, 0, 3, 2, 3, 0, 2, 1, 2, 1, 1, 1, 1, 0, 0),
(0, 1, 3, 3, 1, 2, 1, 1, 2, 2, 0, 0, 0, 5, 3, 3, 4, 4, 2, 0, 0, 2, 2, 1, 0, 0),
(2, 3, 0, 5, 6, 1, 1, 1, 1, 2, 1, 0, 0, 0, 3, 2, 1, 4, 4, 2, 2, 1, 0, 0, 0, 0),
(1, 1, 5, 5, 3, 2, 0, 0, 1, 1, 0, 1, 0, 2, 1, 5, 1, 4, 1, 2, 2, 2, 2, 1, 1, 0),
(1, 2, 3, 3, 5, 1, 1, 2, 1, 0, 0, 0, 0, 6, 1, 1, 2, 2, 3, 3, 0, 2, 1, 0, 0, 0),
(6, 2, 3, 2, 3, 4, 1, 1, 1, 1, 0, 0, 0, 7, 1, 3, 1, 2, 1, 3, 1, 1, 2, 0, 0, 0),
(5, 5, 0, 4, 4, 1, 2, 0, 2, 2, 0, 0, 0, 4, 1, 0, 2, 1, 0, 0, 2, 3, 0, 2, 0, 0),
(2, 2, 2, 4, 2, 2, 0, 1, 1, 1, 1, 0, 0, 5, 2, 4, 4, 0, 0, 5, 1, 2, 1, 3, 0, 0),
(3, 1, 3, 7, 2, 2, 2, 1, 2, 0, 2, 0, 0, 4, 4, 2, 2, 3, 0, 0, 2, 0, 1, 1, 0, 0),
(2, 4, 4, 0, 2, 0, 4, 0, 1, 0, 0, 0, 0, 1, 3, 1, 1, 3, 0, 1, 0, 3, 2, 0, 0, 0),
(3, 1, 3, 5, 4, 1, 3, 0, 3, 1, 0, 0, 0, 4, 3, 2, 1, 2, 0, 1, 0, 0, 0, 1, 0, 0),
(8, 2, 3, 2, 2, 2, 2, 0, 3, 0, 0, 0, 0, 3, 2, 2, 0, 4, 0, 1, 0, 2, 2, 0, 0, 0),
(2, 1, 4, 5, 2, 3, 1, 2, 1, 0, 0, 2, 0, 7, 0, 2, 3, 4, 1, 2, 1, 1, 2, 1, 0, 0),
(2, 3, 6, 2, 2, 0, 2, 0, 1, 1, 0, 0, 0, 2, 2, 6, 2, 4, 1, 1, 0, 0, 3, 2, 0, 0),
(2, 4, 3, 4, 1, 0, 1, 1, 1, 0, 0, 1, 0, 5, 3, 1, 1, 4, 1, 1, 2, 0, 1, 1, 0, 0),
(6, 3, 2, 3, 2, 3, 0, 2, 1, 0, 0, 0, 0, 0, 3, 4, 1, 3, 1, 1, 0, 4, 1, 1, 0, 0),
(7, 6, 2, 0, 4, 0, 2, 0, 1, 2, 0, 0, 0, 5, 4, 2, 2, 4, 0, 0, 1, 2, 1, 0, 0, 0),
(6, 1, 1, 5, 5, 6, 1, 0, 1, 0, 1, 1, 0, 3, 1, 2, 1, 2, 4, 2, 0, 1, 0, 0, 0, 0),
(7, 3, 2, 3, 2, 3, 0, 1, 1, 0, 0, 1, 0, 2, 2, 3, 2, 3, 0, 3, 1, 6, 0, 2, 0, 0),
(4, 0, 2, 3, 3, 1, 1, 0, 2, 1, 1, 0, 0, 3, 0, 1, 3, 2, 0, 0, 3, 1, 2, 0, 1, 0),
(6, 2, 4, 2, 3, 1, 1, 3, 4, 0, 1, 1, 0, 1, 2, 1, 1, 4, 1, 0, 0, 1, 0, 3, 0, 0),
(4, 1, 4, 4, 2, 1, 1, 0, 0, 0, 1, 0, 0, 10, 1, 2, 1, 1, 0, 2, 0, 0, 2, 0, 1, 0),
(1, 3, 1, 1, 3, 2, 1, 2, 1, 1, 0, 0, 0, 0, 3, 2, 2, 0, 1, 0, 1, 1, 0, 0, 0, 0),
(6, 1, 1, 5, 4, 1, 0, 1, 2, 0, 0, 0, 0, 4, 1, 1, 2, 1, 3, 1, 1, 1, 1, 1, 0, 0),
(5, 4, 0, 4, 2, 0, 3, 0, 0, 0, 1, 1, 0, 5, 3, 1, 2, 4, 1, 1, 1, 0, 1, 2, 1, 0),
(2, 2, 5, 5, 2, 2, 0, 1, 1, 1, 0, 0, 0, 2, 1, 2, 4, 2, 1, 2, 0, 1, 0, 1, 0, 0),
(5, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 8, 3, 2, 4, 3, 2, 0, 3, 1, 2, 1, 0, 0),
(6, 3, 4, 2, 3, 0, 4, 0, 3, 0, 1, 0, 0, 3, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 0),
(3, 0, 1, 2, 2, 1, 1, 2, 0, 0, 1, 0, 0, 1, 2, 1, 4, 4, 1, 2, 1, 3, 1, 2, 0, 0),
(4, 1, 2, 4, 1, 3, 0, 2, 2, 0, 2, 1, 0, 1, 8, 1, 0, 1, 3, 4, 0, 1, 1, 1, 1, 0),
(3, 3, 4, 1, 3, 2, 0, 1, 1, 0, 0, 0, 0, 6, 4, 2, 1, 3, 1, 0, 0, 1, 1, 0, 2, 0),
(2, 2, 2, 8, 2, 1, 2, 1, 1, 3, 1, 0, 0, 3, 1, 3, 1, 2, 1, 0, 0, 2, 0, 0, 0, 0),
(7, 0, 5, 5, 3, 2, 1, 1, 1, 1, 0, 0, 0, 4, 2, 4, 3, 4, 2, 0, 0, 0, 1, 1, 0, 0),
(4, 3, 2, 3, 2, 0, 1, 0, 2, 0, 1, 0, 0, 4, 4, 1, 0, 4, 2, 1, 0, 0, 0, 0, 0, 0),
(4, 0, 3, 3, 2, 2, 2, 1, 1, 1, 1, 0, 0, 3, 0, 1, 1, 2, 0, 0, 0, 2, 0, 3, 0, 0),
(1, 0, 0, 2, 3, 4, 0, 1, 2, 1, 0, 1, 0, 7, 3, 2, 0, 3, 3, 2, 0, 0, 0, 0, 0, 0),
(5, 0, 3, 2, 2, 3, 3, 1, 1, 2, 0, 0, 0, 4, 3, 1, 0, 5, 0, 1, 0, 1, 0, 1, 0, 0),
(2, 0, 2, 3, 2, 0, 0, 1, 0, 0, 0, 0, 0, 2, 1, 2, 2, 2, 0, 1, 0, 1, 1, 0, 0, 0),
(3, 3, 1, 6, 5, 1, 1, 1, 0, 1, 1, 1, 0, 5, 4, 1, 0, 3, 0, 0, 0, 2, 1, 0, 0, 0),
(4, 3, 4, 3, 2, 1, 1, 1, 3, 1, 1, 0, 0, 3, 2, 3, 2, 5, 0, 0, 1, 3, 0, 0, 0, 0),
(4, 0, 1, 5, 2, 0, 0, 0, 3, 0, 0, 0, 0, 4, 3, 3, 1, 3, 1, 0, 4, 1, 2, 1, 0, 0),
(2, 2, 1, 2, 2, 3, 1, 0, 1, 0, 0, 0, 0, 5, 2, 1, 1, 3, 0, 2, 1, 2, 1, 3, 0, 0),
(3, 1, 3, 2, 4, 3, 1, 0, 0, 0, 0, 0, 0, 9, 2, 2, 1, 2, 0, 0, 0, 0, 1, 0, 0, 0),
(1, 1, 6, 1, 2, 1, 0, 1, 1, 0, 0, 1, 0, 7, 3, 2, 0, 2, 2, 0, 0, 0, 0, 0, 0, 0),
(0, 0, 5, 5, 2, 0, 2, 1, 0, 1, 1, 0, 0, 4, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0),
(1, 3, 1, 1, 3, 0, 0, 1, 0, 0, 0, 1, 0, 2, 1, 5, 0, 1, 0, 0, 2, 1, 1, 1, 0, 0),
(5, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 1, 2, 0, 2, 5, 1, 2, 0, 0, 0, 0, 0, 0),
(3, 0, 2, 1, 0, 0, 0, 0, 1, 0, 1, 0, 0, 2, 2, 1, 1, 2, 1, 1, 1, 2, 2, 0, 0, 0),
(2, 1, 1, 3, 0, 1, 0, 1, 2, 0, 0, 0, 0, 2, 2, 1, 2, 1, 2, 2, 0, 4, 2, 1, 1, 0),
(0, 1, 3, 4, 3, 0, 1, 2, 2, 0, 0, 0, 0, 1, 3, 1, 1, 2, 0, 1, 0, 0, 2, 0, 0, 0),
(2, 2, 2, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 2, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0),
(2, 2, 1, 0, 2, 1, 1, 1, 1, 0, 0, 0, 0, 3, 1, 0, 0, 1, 0, 2, 1, 1, 0, 0, 0, 0),
(1, 0, 3, 1, 1, 0, 1, 0, 0, 0, 0, 1, 0, 1, 3, 2, 0, 2, 1, 0, 0, 1, 2, 0, 0, 0),
(2, 0, 1, 0, 0, 0, 0, 2, 0, 1, 0, 1, 0, 4, 2, 1, 0, 1, 0, 0, 0, 1, 0, 0, 0, 0),
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
)
station_arriving_intensity = (
(2.0083462313487073, 2.2101154238772667, 2.0845132918450027, 2.485867109545373, 2.2218742430438447, 1.2554619728149357, 1.6584142461495661, 1.8612704691917692, 2.436039624867203, 1.583206006208948, 1.6821060655542412, 1.9591660313224695, 2.0335520850313453),
(2.1417308608079897, 2.3560242776579035, 2.222138636532061, 2.6500577013106468, 2.3689961349896946, 1.3383934336170222, 1.7677875765054776, 1.9838054891622834, 2.5968981305331638, 1.68759227691086, 1.7932384543824527, 2.088486664325742, 2.1679166589759418),
(2.2746892035918926, 2.5013540683563917, 2.3592169142189654, 2.813595081865918, 2.5155851894998977, 1.420994045804978, 1.8767274031842818, 2.105850099161768, 2.7571147227510195, 1.7915655100082184, 1.9039292595105253, 2.217293060821222, 2.301745931283876),
(2.406703117258625, 2.645528200774579, 2.4952043477279418, 2.9758305630128294, 2.661064670400761, 1.5029362490340452, 1.9848014566591823, 2.226920462997803, 2.916054064368437, 1.8947130793704723, 2.013739364730953, 2.3450742739721844, 2.4345091225016904),
(2.537254459366393, 2.78797007971431, 2.6295571598812146, 3.136115456553028, 2.804857841518597, 1.5838924829594672, 2.0915774674033836, 2.3465327444779662, 3.073080818233083, 1.9966223588670715, 2.12222965383623, 2.4713193569419056, 2.565675453175927),
(2.6658250874734044, 2.9281031099774353, 2.7617315735010073, 3.2938010742881576, 2.946387966679712, 1.6635351872364859, 2.1966231658900894, 2.464203107409837, 3.227559647192624, 2.0968807223674655, 2.228961010618853, 2.595517362893659, 2.694714143853131),
(2.7918968591378666, 3.0653506963658006, 2.8911838114095465, 3.448238728019861, 3.0850783097104175, 1.7415368015203456, 2.299506282592505, 2.5794477156009954, 3.378855214094726, 2.1950755437411034, 2.333494318871313, 2.7171573449907234, 2.821094415079843),
(2.9149516319179876, 3.1991362436812527, 3.017370096429054, 3.598779729549785, 3.2203521344370216, 1.8175697654662883, 2.399794547983834, 2.691782732859021, 3.526332181787058, 2.290794196857435, 2.4353904623861076, 2.8357283563963716, 2.944285487402608),
(3.034471263371974, 3.32888315672564, 3.1397466513817585, 3.744775390679571, 3.3516327046858345, 1.891306518729556, 2.497055692537279, 2.80072432299149, 3.6693552131172824, 2.38362405558591, 2.5342103249557284, 2.950719450273881, 3.063756581367967),
(3.149937611058034, 3.4540148403008093, 3.2577696990898817, 3.8855770232108675, 3.478343284283164, 1.9624195009653935, 2.590857446726048, 2.9057886498059853, 3.8072889709330697, 2.473152493795977, 2.629514790372671, 3.0616196797865256, 3.178976917522465),
(3.2608325325343728, 3.573954699208606, 3.3708954623756497, 4.020535938945315, 3.5999071370553204, 2.030581151829043, 2.680767541023342, 3.0064918771100846, 3.939498118082086, 2.5589668853570857, 2.7208647424294297, 3.167918098097581, 3.2894157164126443),
(3.3666378853592023, 3.6881261382508828, 3.4785801640612863, 4.149003449684559, 3.7157475268286135, 2.0954639109757474, 2.7663537059023664, 3.102350168711366, 4.065347317411997, 2.6406546041386876, 2.8078210649184996, 3.269103758370324, 3.394542198585045),
(3.466835527090725, 3.795952562229479, 3.580280026969016, 4.270330867230245, 3.825287717429351, 2.156740218060748, 2.8471836718363246, 3.1928796884174084, 4.184201231770472, 2.717803024010229, 2.8899446416323737, 3.3646657137680274, 3.493825584586214),
(3.5609073152871504, 3.896857375946248, 3.6754512739210647, 4.383869503384018, 3.9279509726838406, 2.2140825127392896, 2.9228251692984224, 3.2775966000357926, 4.295424524005173, 2.789999518841162, 2.9667963563635475, 3.4540930174539684, 3.586735094962694),
(3.6483351075066865, 3.9902639842030356, 3.763550127739659, 4.488970669947517, 4.023160556418396, 2.2671632346666137, 2.9928459287618647, 3.3560170673740988, 4.398381856963769, 2.8568314625009337, 3.0379370929045137, 3.536874722591424, 3.6727399502610254),
(3.728600761307542, 4.075595791801687, 3.844032811247017, 4.584985678722394, 4.110339732459323, 2.315654823497965, 3.0568136806998503, 3.4276572542399024, 4.4924378934939275, 2.9178862288589964, 3.1029277350477678, 3.6124998823436685, 3.7513093710277525),
(3.8011861342479203, 4.152276203544053, 3.91635554726537, 4.671265841510286, 4.188911764632933, 2.359229718888584, 3.1142961555855906, 3.4920333244407846, 4.5769572964433145, 2.9727511917847984, 3.161329166585805, 3.680457549873976, 3.8219125778094183),
(3.86557308388603, 4.219728624231979, 3.979974558616941, 4.747162470112845, 4.2582999167655355, 2.3975603604937143, 3.1648610838922844, 3.5486614417843274, 4.651304728659594, 3.021013725147787, 3.2127022713111195, 3.740236778345622, 3.8840187911525663),
(3.921243467780082, 4.27737645866731, 4.034346068123952, 4.8120268763317116, 4.317927452683436, 2.4303191879686015, 3.2080761960931405, 3.5970577700781043, 4.7148448529904385, 3.0622612028174148, 3.2566079330162037, 3.791326620921886, 3.9370972316037385),
(3.9676791434882794, 4.3246431116518975, 4.078926298608631, 4.8652103719685265, 4.3672176362129465, 2.4571786409684835, 3.2435092226613578, 3.6367384731296983, 4.766942332283512, 3.0960809986631315, 3.2926070354935515, 3.8332161307660386, 3.9806171197094784),
(4.0043619685688325, 4.360951987987585, 4.113171472893201, 4.906064268824942, 4.405593731180377, 2.4778111591486076, 3.270727894070145, 3.667219714746687, 4.80696182938648, 3.1220604865543837, 3.32026046253566, 3.8653943610413566, 4.01404767601633),
(4.030773800579946, 4.385726492476223, 4.136537813799888, 4.933939878702595, 4.432479001412036, 2.4918891821642144, 3.289299940792704, 3.6880176587366496, 4.834268007147009, 3.139787040360622, 3.339129097935024, 3.8873503649111174, 4.036858121070831),
(4.046396497079832, 4.398390029919658, 4.148481544150914, 4.948188513403135, 4.44729671073423, 2.499085149670547, 3.29879309330224, 3.698648468907166, 4.848225528412766, 3.148848033951297, 3.348773825484136, 3.898573195538596, 4.048517675419531),
(4.052157345337056, 4.399889437585734, 4.149969272976681, 4.949972325102881, 4.451092822413039, 2.5, 3.2999216009037355, 3.6997975308641977, 4.849970493827161, 3.149916909007773, 3.349983214864696, 3.8999590306355736, 4.05),
(4.056404965213662, 4.399014814814815, 4.149725925925926, 4.949752777777778, 4.453243045445941, 2.5, 3.299301525054467, 3.6982, 4.849736666666667, 3.14926024691358, 3.3498498316498324, 3.8996345679012343, 4.05),
(4.060562892084632, 4.397290809327846, 4.149245541838135, 4.949318415637861, 4.455345978237801, 2.5, 3.298079561042524, 3.6950617283950624, 4.849274691358025, 3.1479675354366714, 3.349585359770545, 3.898994055784179, 4.05),
(4.0646308076192135, 4.394743758573389, 4.148534705075447, 4.948674176954732, 4.457401547368442, 2.5, 3.2962746873234887, 3.6904419753086426, 4.84859049382716, 3.14606028349337, 3.349192193540342, 3.8980462734339287, 4.05),
(4.068608393486655, 4.3914, 4.1476, 4.947825, 4.459409679417686, 2.5, 3.2939058823529415, 3.6844, 4.84769, 3.14356, 3.3486727272727275, 3.8968000000000007, 4.05),
(4.0724953313562, 4.387285871056242, 4.146448010973937, 4.946775823045268, 4.461370300965361, 2.5, 3.2909921245864604, 3.6769950617283955, 4.846579135802469, 3.1404881938728852, 3.3480293552812075, 3.895264014631916, 4.05),
(4.0762913028971, 4.382427709190672, 4.145085322359397, 4.94553158436214, 4.463283338591288, 2.5, 3.2875523924796264, 3.6682864197530862, 4.845263827160494, 3.1368663740283496, 3.3472644718792868, 3.893447096479195, 4.05),
(4.079995989778599, 4.376851851851852, 4.143518518518518, 4.944097222222222, 4.4651487188752945, 2.5, 3.2836056644880176, 3.658333333333333, 4.84375, 3.1327160493827164, 3.3463804713804715, 3.8913580246913577, 4.05),
(4.083609073669943, 4.370584636488341, 4.141754183813443, 4.94247767489712, 4.466966368397204, 2.5, 3.279170919067216, 3.6471950617283952, 4.842043580246914, 3.1280587288523094, 3.3453797480982668, 3.8890055784179247, 4.05),
(4.087130236240382, 4.363652400548697, 4.13979890260631, 4.940677880658437, 4.468736213736839, 2.5, 3.2742671346727996, 3.6349308641975315, 4.840150493827161, 3.1229159213534525, 3.344264696346178, 3.886398536808414, 4.05),
(4.090559159159159, 4.356081481481481, 4.13765925925926, 4.938702777777777, 4.470458181474025, 2.5, 3.2689132897603486, 3.6216000000000004, 4.838076666666667, 3.1173091358024694, 3.3430377104377103, 3.8835456790123453, 4.05),
(4.093895524095524, 4.347898216735254, 4.135341838134431, 4.936557304526749, 4.472132198188587, 2.5, 3.263128362785444, 3.6072617283950614, 4.835828024691359, 3.111259881115684, 3.34170118468637, 3.880455784179241, 4.05),
(4.097139012718723, 4.339128943758573, 4.132853223593965, 4.9342463991769545, 4.473758190460348, 2.5, 3.2569313322036635, 3.5919753086419757, 4.833410493827161, 3.1047896662094194, 3.3402575134056613, 3.8771376314586194, 4.05),
(4.100289306698002, 4.3298, 4.1302, 4.931775, 4.475336084869134, 2.5, 3.250341176470588, 3.5758000000000005, 4.83083, 3.0979200000000002, 3.338709090909091, 3.8736000000000006, 4.05),
(4.10334608770261, 4.319937722908093, 4.127388751714678, 4.92914804526749, 4.476865807994769, 2.5, 3.2433768740417976, 3.558795061728395, 4.828092469135803, 3.09067239140375, 3.337058311510164, 3.869851668952904, 4.05),
(4.1063090374017905, 4.3095684499314135, 4.124426063100137, 4.92637047325103, 4.478347286417076, 2.5, 3.2360574033728717, 3.5410197530864203, 4.825203827160494, 3.0830683493369917, 3.3353075695223846, 3.86590141746685, 4.05),
(4.109177837464794, 4.298718518518519, 4.121318518518519, 4.923447222222222, 4.479780446715881, 2.5, 3.2284017429193903, 3.5225333333333335, 4.822170000000001, 3.0751293827160495, 3.3334592592592593, 3.861758024691358, 4.05),
(4.111952169560865, 4.2874142661179695, 4.118072702331961, 4.920383230452675, 4.481165215471008, 2.5, 3.2204288711369324, 3.503395061728396, 4.818996913580247, 3.066877000457248, 3.3315157750342936, 3.8574302697759495, 4.05),
(4.114631715359251, 4.275682030178326, 4.114695198902607, 4.917183436213993, 4.482501519262281, 2.5, 3.212157766481078, 3.4836641975308646, 4.8156904938271605, 3.058332711476909, 3.329479511160993, 3.852926931870142, 4.05),
(4.1172161565292, 4.263548148148149, 4.111192592592594, 4.9138527777777785, 4.483789284669523, 2.5, 3.2036074074074072, 3.4634, 4.812256666666667, 3.0495180246913582, 3.3273528619528623, 3.848256790123457, 4.05),
(4.119705174739957, 4.251038957475995, 4.1075714677640605, 4.910396193415639, 4.485028438272561, 2.5, 3.1947967723715003, 3.4426617283950622, 4.808701358024692, 3.0404544490169183, 3.3251382217234067, 3.8434286236854143, 4.05),
(4.122098451660771, 4.238180795610425, 4.10383840877915, 4.906818621399178, 4.486218906651218, 2.5, 3.185744839828936, 3.4215086419753096, 4.805030493827161, 3.031163493369913, 3.322837984786133, 3.838451211705533, 4.05),
(4.1243956689608865, 4.2250000000000005, 4.1000000000000005, 4.903125, 4.487360616385319, 2.5, 3.1764705882352944, 3.4000000000000004, 4.80125, 3.021666666666667, 3.3204545454545453, 3.833333333333333, 4.05),
(4.126596508309553, 4.211522908093278, 4.096062825788752, 4.8993202674897125, 4.488453494054687, 2.5, 3.1669929960461554, 3.3781950617283956, 4.797365802469136, 3.0119854778235027, 3.3179902980421496, 3.828083767718336, 4.05),
(4.128700651376014, 4.19777585733882, 4.092033470507545, 4.895409362139918, 4.489497466239147, 2.5, 3.1573310417170988, 3.356153086419753, 4.793383827160494, 3.0021414357567444, 3.3154476368624515, 3.82271129401006, 4.05),
(4.130707779829518, 4.183785185185186, 4.087918518518519, 4.891397222222223, 4.490492459518524, 2.5, 3.1475037037037037, 3.333933333333334, 4.78931, 2.992156049382716, 3.312828956228956, 3.8172246913580246, 4.05),
(4.132617575339315, 4.169577229080932, 4.083724554183814, 4.887288786008231, 4.491438400472643, 2.5, 3.137529960461551, 3.3115950617283954, 4.78515024691358, 2.9820508276177415, 3.3101366504551692, 3.8116327389117517, 4.05),
(4.134429719574647, 4.155178326474624, 4.07945816186557, 4.883088991769547, 4.492335215681326, 2.5, 3.12742879044622, 3.2891975308641976, 4.78091049382716, 2.9718472793781436, 3.307373113854595, 3.8059442158207597, 4.05),
(4.136143894204764, 4.140614814814815, 4.075125925925926, 4.8788027777777785, 4.4931828317244, 2.5, 3.11721917211329, 3.2668, 4.776596666666667, 2.961566913580247, 3.304540740740741, 3.8001679012345684, 4.05),
(4.137759780898912, 4.125913031550069, 4.070734430727024, 4.874435082304527, 4.493981175181686, 2.5, 3.1069200839183413, 3.2444617283950614, 4.772214691358025, 2.951231239140375, 3.301641925427111, 3.7943125743026984, 4.05),
(4.139277061326338, 4.1110993141289445, 4.0662902606310025, 4.869990843621399, 4.4947301726330116, 2.5, 3.0965505043169532, 3.222241975308642, 4.767770493827161, 2.9408617649748514, 3.2986790622272104, 3.7883870141746687, 4.05),
(4.140695417156286, 4.0962000000000005, 4.0618, 4.865475, 4.495429750658201, 2.5, 3.086129411764706, 3.2001999999999997, 4.76327, 2.93048, 3.295654545454545, 3.7824, 4.05),
(4.142014530058009, 4.081241426611797, 4.057270233196159, 4.860892489711934, 4.496079835837076, 2.5, 3.075675784717179, 3.178395061728395, 4.758719135802469, 2.920107453132145, 3.292570769422621, 3.7763603109282124, 4.05),
(4.143234081700749, 4.066249931412894, 4.052707544581619, 4.8562482510288065, 4.496680354749464, 2.5, 3.0652086016299527, 3.1568864197530866, 4.754123827160494, 2.909765633287609, 3.2894301284449434, 3.770276726108825, 4.05),
(4.144353753753753, 4.051251851851852, 4.048118518518519, 4.851547222222223, 4.497231233975187, 2.5, 3.0547468409586056, 3.135733333333334, 4.749490000000001, 2.8994760493827165, 3.286235016835017, 3.764158024691358, 4.05),
(4.145373227886272, 4.036273525377229, 4.043509739368999, 4.846794341563786, 4.49773240009407, 2.5, 3.044309481158719, 3.1149950617283952, 4.744823580246914, 2.889260210333791, 3.2829878289063483, 3.7580129858253315, 4.05),
(4.146292185767549, 4.0213412894375855, 4.038887791495199, 4.841994547325103, 4.498183779685938, 2.5, 3.0339155006858713, 3.094730864197531, 4.740130493827161, 2.8791396250571566, 3.27969095897244, 3.7518503886602654, 4.05),
(4.147110309066831, 4.006481481481482, 4.034259259259259, 4.837152777777778, 4.498585299330615, 2.5, 3.0235838779956428, 3.075, 4.7354166666666675, 2.869135802469136, 3.2763468013468016, 3.745679012345679, 4.05),
(4.147827279453366, 3.9917204389574765, 4.02963072702332, 4.832273971193416, 4.498936885607924, 2.5, 3.0133335915436135, 3.0558617283950618, 4.730688024691358, 2.859270251486054, 3.2729577503429357, 3.7395076360310933, 4.05),
(4.148442778596402, 3.977084499314129, 4.025008779149521, 4.827363065843622, 4.499238465097694, 2.5, 3.0031836197853625, 3.0373753086419755, 4.725950493827161, 2.8495644810242347, 3.2695262002743486, 3.7333450388660268, 4.05),
(4.148956488165184, 3.9626, 4.0204, 4.822425000000001, 4.499489964379743, 2.5, 2.9931529411764703, 3.0196000000000005, 4.72121, 2.84004, 3.266054545454546, 3.7272, 4.05),
(4.149368089828959, 3.948293278463649, 4.0158109739369, 4.817464711934157, 4.499691310033899, 2.5, 2.983260534172517, 3.0025950617283956, 4.716472469135803, 2.8307183173296755, 3.2625451801970318, 3.7210812985825337, 4.05),
(4.149677265256975, 3.934190672153635, 4.01124828532236, 4.812487139917696, 4.499842428639987, 2.5, 2.9735253772290813, 2.9864197530864196, 4.711743827160494, 2.821620941929584, 3.2590004988153143, 3.7149977137631454, 4.05),
(4.149883696118478, 3.920318518518519, 4.006718518518519, 4.8074972222222225, 4.499943246777829, 2.5, 2.963966448801743, 2.971133333333334, 4.7070300000000005, 2.8127693827160494, 3.2554228956228957, 3.7089580246913587, 4.05),
(4.149987064082717, 3.9067031550068587, 4.002228257887517, 4.8024998971193416, 4.499993691027252, 2.5, 2.9546027273460824, 2.956795061728396, 4.702336913580247, 2.804185148605396, 3.2518147649332843, 3.7029710105166895, 4.05),
(4.14991664579233, 3.8932994557281293, 3.9977623799725652, 4.797456696188943, 4.499951182118938, 2.49995360463344, 2.9454060779318585, 2.943337540009145, 4.6976351394604485, 2.7958481766588665, 3.2481143954161507, 3.697012008759897, 4.0499500600137175),
(4.149256682769726, 3.879698207885305, 3.99319537037037, 4.792113405797101, 4.499564270152505, 2.4995868312757206, 2.9361072725386457, 2.9300395061728395, 4.692719135802469, 2.787522556281772, 3.243945135566188, 3.69088758934373, 4.049554398148149),
(4.147954315023558, 3.865836983937342, 3.9885073731138543, 4.7864348497047775, 4.498799725651577, 2.4988645023624447, 2.926664053824548, 2.916780978509374, 4.687561156835849, 2.779167809785094, 3.239259554610432, 3.6845691045171236, 4.048772933813444),
(4.146027864257172, 3.851724067436612, 3.9837000342935527, 4.7804294015029525, 4.497667231501654, 2.497798323426307, 2.9170806638155953, 2.9035663465935073, 4.6821688843164155, 2.770784143737056, 3.2340749483135447, 3.678061174885086, 4.047615955075446),
(4.143495652173914, 3.8373677419354837, 3.9787749999999997, 4.774105434782609, 4.496176470588235, 2.4964000000000004, 2.907361344537815, 2.8904, 4.676550000000001, 2.7623717647058825, 3.228408612440192, 3.671368421052632, 4.04609375),
(4.140376000477128, 3.8227762909863268, 3.973733916323731, 4.767471323134729, 4.494337125796821, 2.494681237616217, 2.897510338017237, 2.8772863283036125, 4.670712185642433, 2.7539308792597974, 3.2222778427550356, 3.6644954636247675, 4.04421660665295),
(4.136687230870161, 3.807957998141511, 3.968578429355281, 4.760535440150295, 4.49215888001291, 2.4926537418076515, 2.887531886279889, 2.864229721079104, 4.664663122999543, 2.745461693967025, 3.2156999350227427, 3.657446923206507, 4.041994813100138),
(4.13244766505636, 3.7929211469534048, 3.963310185185185, 4.75330615942029, 4.489651416122005, 2.4903292181069965, 2.8774302313518003, 2.8512345679012348, 4.65841049382716, 2.736964415395788, 3.2086921850079744, 3.650227420402859, 4.039438657407408),
(4.127675624739071, 3.77767402097438, 3.957930829903978, 4.745791854535695, 4.486824417009602, 2.4877193720469446, 2.8672096152589983, 2.8383052583447648, 4.651961979881116, 2.7284392501143118, 3.2012718884753966, 3.6428415758188333, 4.036558427640603),
(4.122389431621637, 3.7622249037568043, 3.952442009602194, 4.738000899087493, 4.483687565561204, 2.4848359091601893, 2.8568742800275118, 2.825446181984454, 4.645325262917239, 2.71988640469082, 3.193456341189675, 3.6352940100594426, 4.03336441186557),
(4.1166074074074075, 3.7465820788530473, 3.9468453703703705, 4.729941666666667, 4.48025054466231, 2.481690534979424, 2.84642846768337, 2.812661728395062, 4.638508024691357, 2.7113060856935367, 3.1852628389154707, 3.6275893437296953, 4.029866898148149),
(4.110347873799726, 3.730753829815479, 3.94114255829904, 4.721622530864198, 4.476523037198419, 2.4782949550373417, 2.8358764202526006, 2.7999562871513493, 4.631517946959305, 2.7026984996906855, 3.176708677417449, 3.619732197434602, 4.026076174554183),
(4.103629152501939, 3.714748440196469, 3.9353352194787377, 4.713051865271068, 4.4725147260550315, 2.474660874866636, 2.8252223797612324, 2.7873342478280754, 4.624362711476909, 2.6940638532504906, 3.1678111524602754, 3.611727191779174, 4.02200252914952),
(4.096469565217392, 3.6985741935483873, 3.929425, 4.704238043478262, 4.468235294117647, 2.4708, 2.8144705882352943, 2.7748000000000004, 4.61705, 2.6854023529411766, 3.1585875598086126, 3.603578947368421, 4.01765625),
(4.088887433649431, 3.682239373423603, 3.9234135459533612, 4.695189439076758, 4.463694424271766, 2.466724035970127, 2.8036252877008145, 2.762357933241884, 4.6095874942844075, 2.6767142053309665, 3.1490551952271253, 3.5952920848073546, 4.013047625171469),
(4.080901079501402, 3.6657522633744857, 3.9173025034293554, 4.685914425657542, 4.458901799402889, 2.4624446883097093, 2.7926907201838214, 2.7500124371284866, 4.6019828760859625, 2.6679996169880846, 3.1392313544804775, 3.586871224700985, 4.008186942729767),
(4.072528824476651, 3.649121146953405, 3.9110935185185185, 4.676421376811595, 4.453867102396514, 2.4579736625514403, 2.7816711277103434, 2.7377679012345677, 4.5942438271604935, 2.6592587944807557, 3.1291333333333333, 3.578320987654321, 4.003084490740741),
(4.063788990278524, 3.6323543077127307, 3.904788237311385, 4.666718666129898, 4.448600016138143, 2.4533226642280144, 2.77057075230641, 2.7256287151348886, 4.586378029263831, 2.6504919443772024, 3.1187784275503576, 3.569645994272375, 3.9977505572702334),
(4.054699898610365, 3.6154600292048324, 3.8983883058984916, 4.656814667203436, 4.443110223513274, 2.4485033988721234, 2.7593938359980483, 2.7135992684042067, 4.578393164151807, 2.6416992732456497, 3.108183932896214, 3.5608508651601576, 3.992195430384088),
(4.045279871175523, 3.5984465949820788, 3.8918953703703703, 4.6467177536231885, 4.437407407407409, 2.443527572016461, 2.7481446208112876, 2.701683950617284, 4.570296913580248, 2.632880987654321, 3.097367145135566, 3.551940220922677, 3.9864293981481485),
(4.035547229677343, 3.5813222885968403, 3.8853110768175583, 4.63643629898014, 4.431501250706044, 2.4384068891937205, 2.7368273487721564, 2.68988715134888, 4.562096959304984, 2.6240372941714405, 3.0863453600330795, 3.542918682164946, 3.9804627486282587),
(4.025520295819169, 3.564095393601487, 3.87863707133059, 4.625978676865271, 4.425401436294683, 2.4331530559365953, 2.7254462619066833, 2.678213260173754, 4.553800983081848, 2.615168399365233, 3.0751358733534175, 3.533790869491974, 3.9743057698902606),
(4.015217391304348, 3.546774193548387, 3.871875, 4.615353260869566, 4.419117647058824, 2.427777777777778, 2.7140056022408965, 2.6666666666666665, 4.545416666666667, 2.6062745098039217, 3.0637559808612442, 3.524561403508772, 3.9679687500000003),
(4.004656837836225, 3.529366971989911, 3.8650265089163236, 4.604568424584005, 4.412659565883966, 2.4222927602499618, 2.7025096118008247, 2.6552517604023778, 4.536951691815273, 2.5973558320557304, 3.052222978321224, 3.5152349048203497, 3.961461977023319),
(3.9938569571181493, 3.511882012478429, 3.858093244170096, 4.593632541599571, 4.406036875655611, 2.4167097088858407, 2.690962532612497, 2.6439729309556474, 4.528413740283494, 2.588412572688884, 3.0405541614980214, 3.5058159940317193, 3.954795739026063),
(3.982836070853462, 3.4943275985663087, 3.851076851851852, 4.582553985507247, 4.399259259259259, 2.411040329218107, 2.6793686067019404, 2.632834567901235, 4.519810493827161, 2.579444938271605, 3.0287668261563, 3.496309291747888, 3.9479803240740736),
(3.971612500745512, 3.476712013805921, 3.8439789780521267, 4.571341129898014, 4.392336399580408, 2.4052963267794545, 2.6677320760951844, 2.621841060813901, 4.511149634202104, 2.570453135372119, 3.016878268060724, 3.4867194185738697, 3.9410260202331964),
(3.960204568497644, 3.4590435417496352, 3.8368012688614543, 4.560002348362856, 4.3852779795045596, 2.399489407102576, 2.6560571828182575, 2.6109967992684044, 4.502438843164152, 2.5614373705586484, 3.0049057829759587, 3.477050995114672, 3.933943115569273),
(3.948630595813205, 3.4413304659498216, 3.829545370370371, 4.548546014492754, 4.378093681917211, 2.3936312757201645, 2.6443481688971886, 2.6003061728395065, 4.493685802469136, 2.5523978503994194, 2.992866666666667, 3.4673086419753094, 3.9267418981481486),
(3.936908904395539, 3.4235810699588485, 3.82221292866941, 4.53698050187869, 4.370793189703866, 2.3877336381649137, 2.6326092763580053, 2.5897735711019667, 4.484898193872886, 2.543334781462654, 2.980778214897513, 3.457496979760788, 3.919432656035666),
(3.925057815947994, 3.4058036373290856, 3.814805589849108, 4.525314184111648, 4.363386185750021, 2.3818081999695173, 2.6208447472267373, 2.5794033836305443, 4.476083699131229, 2.534248370316577, 2.9686577234331626, 3.4476206290761193, 3.9120256772976685),
(3.9130956521739133, 3.3880064516129034, 3.8073250000000005, 4.513555434782609, 4.355882352941177, 2.3758666666666666, 2.6090588235294123, 2.5692000000000004, 4.46725, 2.525138823529412, 2.956522488038278, 3.437684210526316, 3.9045312500000002),
(3.901040734776645, 3.3701977963626706, 3.79977280521262, 4.501712627482555, 4.348291374162834, 2.3699207437890566, 2.597255747292058, 2.559167809785094, 4.458404778235026, 2.5160063476693835, 2.944389804477524, 3.427692344716387, 3.896959662208505),
(3.888911385459534, 3.3523859551307584, 3.792150651577504, 4.4897941358024696, 4.340622932300493, 2.3639821368693794, 2.585439760540705, 2.549311202560585, 4.449555715592136, 2.5068511493047154, 2.932276968515565, 3.4176496522513413, 3.8893212019890258),
(3.8767259259259266, 3.3345792114695345, 3.784460185185185, 4.477808333333334, 4.332886710239651, 2.3580625514403297, 2.5736151053013803, 2.539634567901235, 4.440710493827161, 2.4976734350036316, 2.9202012759170657, 3.4075607537361927, 3.881626157407408),
(3.864502677879168, 3.316785848931369, 3.7767030521262, 4.46576359366613, 4.325092390865811, 2.3521736930345987, 2.561786023600112, 2.530142295381802, 4.43187679469593, 2.488473411334356, 2.9081800224466896, 3.397430269775949, 3.873884816529492),
(3.852259963022604, 3.2990141510686315, 3.7688808984910835, 4.453668290391842, 4.317249657064472, 2.3463272671848805, 2.5499567574629305, 2.5208387745770464, 4.4230622999542755, 2.4792512848651125, 2.8962305038691003, 3.3872628209756215, 3.8661074674211253),
(3.840016103059581, 3.2812724014336916, 3.7609953703703702, 4.441530797101449, 4.309368191721133, 2.3405349794238686, 2.5381315489158633, 2.511728395061729, 4.414274691358025, 2.4700072621641254, 2.8843700159489636, 3.3770630279402214, 3.858304398148148),
(3.8277894196934454, 3.2635688835789196, 3.7530481138545952, 4.429359487385937, 4.301457677721294, 2.3348085352842554, 2.526314639984938, 2.5028155464106083, 4.405521650663008, 2.460741549799618, 2.872615854450942, 3.3668355112747577, 3.850485896776406),
(3.8155982346275423, 3.2459118810566845, 3.745040775034294, 4.417162734836285, 4.293527797950456, 2.329159640298735, 2.5145102726961848, 2.494104618198446, 4.396810859625058, 2.4514543543398157, 2.860985315139701, 3.356584891584242, 3.842662251371742),
(3.8034608695652175, 3.2283096774193556, 3.7369750000000006, 4.404948913043479, 4.285588235294117, 2.3236000000000003, 2.5027226890756302, 2.4856000000000003, 4.38815, 2.4421458823529414, 2.8494956937799043, 3.346315789473685, 3.8348437500000006),
(3.7913956462098173, 3.210770556219302, 3.72885243484225, 4.392726395598497, 4.27764867263778, 2.318141319920744, 2.490956131149305, 2.4773060813900325, 4.379546753543667, 2.432816340407219, 2.838164286136216, 3.336032825548095, 3.8270406807270234),
(3.7794208862646865, 3.193302801008895, 3.7206747256515786, 4.380503556092324, 4.269718792866942, 2.3127953055936596, 2.4792148409432357, 2.4692272519433014, 4.371008802011889, 2.4234659350708734, 2.8270083879733003, 3.3257406204124855, 3.819263331618656),
(3.7675549114331726, 3.175914695340502, 3.712443518518519, 4.368288768115942, 4.261808278867103, 2.3075736625514405, 2.4675030604834527, 2.461367901234568, 4.362543827160494, 2.414094872912128, 2.8160452950558215, 3.3154437946718653, 3.811521990740741),
(3.75581604341862, 3.1586145227664937, 3.7041604595336084, 4.356090405260333, 4.253926813523764, 2.3024880963267798, 2.4558250317959835, 2.453732418838592, 4.354159510745313, 2.4047033604992065, 2.805292303148444, 3.3051469689312443, 3.803826946159122),
(3.744201689481218, 3.141439447514381, 3.6958471313008276, 4.343933552996816, 4.246070272069482, 2.2975479076858054, 2.444210385462708, 2.4463410275122426, 4.345885124503448, 2.395321894645092, 2.7947695624611466, 3.2948771746017713, 3.7961775603372887),
(3.732592359160026, 3.1245588734102143, 3.6876182700086475, 4.331915768510934, 4.238157341826531, 2.2927418434119606, 2.432807283364232, 2.439284503802048, 4.3378476142852245, 2.386126067165113, 2.784497734845279, 3.28476486884519, 3.788510165664014),
(3.720953961201598, 3.107978879473219, 3.679478773082927, 4.320033802072712, 4.230163071155441, 2.2880574049995057, 2.421623860076625, 2.4325610617114837, 4.330049991467516, 2.377130131195231, 2.7744618045708376, 3.2748150330235406, 3.7808026526641507),
(3.709271949295054, 3.091675312516681, 3.6714128759935494, 4.3082664601065614, 4.222075410553511, 2.283483550914839, 2.4106419270111576, 2.4261521251595974, 4.322472535691133, 2.368317343379819, 2.7646423725085927, 3.2650092789949383, 3.7730429039023563),
(3.697531777129509, 3.0756240193538886, 3.6634048142103945, 4.296592549036897, 4.213882310518044, 2.279009239624356, 2.399843295579101, 2.420039118065434, 4.315095526596881, 2.3596709603632515, 2.755020039529313, 3.2553292186175002, 3.76521880194329),
(3.6857188983940845, 3.0598008467981295, 3.655438823203347, 4.284990875288133, 4.205571721546337, 2.2746234295944556, 2.3892097771917262, 2.414203464348039, 4.307899243825574, 2.3511742387899037, 2.74557540650377, 3.24575646374934, 3.75731822935161),
(3.673818766777897, 3.044181641662692, 3.6474991384422895, 4.273440245284682, 4.197131594135689, 2.270315079291533, 2.3787231832603024, 2.408626587926458, 4.300863967018017, 2.342810435304149, 2.7362890743027313, 3.236272626248574, 3.749329068691973),
(3.6618168359700647, 3.0287422507608635, 3.639569995397105, 4.261919465450958, 4.188549878783399, 2.266073147181986, 2.3683653251961014, 2.403289912719737, 4.293969975815023, 2.334562806550362, 2.7271416437969664, 3.226859317973319, 3.741239202529039),
(3.6496985596597074, 3.0134585209059317, 3.631635629537675, 4.250407342211374, 4.179814525986767, 2.261886591732212, 2.358118014410392, 2.398174862646923, 4.2871975498573995, 2.3264146091729185, 2.7181137158572466, 3.217498150781689, 3.7330365134274643),
(3.6374493915359416, 2.9983062989111846, 3.6236802763338845, 4.238882681990343, 4.170913486243093, 2.2577443714086076, 2.347963062314447, 2.3932628616270595, 4.2805269687859555, 2.318349099816191, 2.7091858913543407, 3.2081707365318004, 3.7247088839519082),
(3.6250547852878876, 2.9832614315899098, 3.6156881712556146, 4.227324291212278, 4.161834710049677, 2.25363544467757, 2.3378822803195356, 2.3885353335791932, 4.273938512241502, 2.310349535124555, 2.700338771159018, 3.198858687081769, 3.716244196667029),
(3.612500194604662, 2.968299765755395, 3.607643549772748, 4.215710976301595, 4.152566147903815, 2.2495487700054957, 2.327857479836928, 2.3839737024223706, 4.267412459864846, 2.3023991717423846, 2.691552956142048, 3.1895436142897102, 3.7076303341374848),
(3.5997710731753836, 2.9533971482209282, 3.5995306473551696, 4.204021543682704, 4.143095750302809, 2.2454733058587824, 2.3178704722778956, 2.3795593920756364, 4.260929091296798, 2.2944812663140537, 2.6828090471742008, 3.1802071300137396, 3.6988551789279316),
(3.5868528746891712, 2.938529425799798, 3.5913336994727594, 4.192234799780022, 4.133411467743957, 2.241398010703827, 2.307903069053708, 2.375273826458037, 4.254468686178167, 2.286579075483937, 2.6740876451262454, 3.170830846111974, 3.6899066136030316),
(3.5737310528351447, 2.92367244530529, 3.583036941595402, 4.18032955101796, 4.123501250724559, 2.237311843007026, 2.2979370815756375, 2.3710984294886184, 4.248011524149763, 2.2786758558964095, 2.6653693508689518, 3.1613963744425266, 3.6807725207274395),
(3.5603910613024183, 2.908802053550694, 3.57462460919298, 4.168284603820933, 4.113353049741916, 2.2332037612347775, 2.287954321254953, 2.367014625086425, 4.241537884852394, 2.2707548641958453, 2.6566347652730897, 3.1518853268635154, 3.671440782865815),
(3.546818353780113, 2.8938940973492966, 3.566080937735376, 4.156078764613353, 4.102954815293325, 2.229062723853478, 2.2779365995029255, 2.363003837170504, 4.23502804792687, 2.2627993570266183, 2.6478644892094287, 3.1422793152330546, 3.6618992825828154),
(3.532998383957347, 2.8789244235143867, 3.5573901626924718, 4.143690839819635, 4.092294497876085, 2.2248776893295235, 2.267865727730825, 2.3590474896599, 4.228462293014, 2.254792591033103, 2.639039123548738, 3.1325599514092612, 3.6521359024430993),
(3.5189166055232377, 2.863868878859251, 3.5485365195341525, 4.1310996358641905, 4.081360047987498, 2.2206376161293124, 2.2577235173499237, 2.35512700647366, 4.2218208997545945, 2.246717822859674, 2.6301392691617873, 3.1227088472502498, 3.6421385250113247),
(3.504558472166904, 2.8487033101971777, 3.5395042437302986, 4.118283959171435, 4.070139416124862, 2.216331462719241, 2.24749177977149, 2.3512238115308293, 4.215084147789462, 2.2385583091507057, 2.6211455269193458, 3.112707614614137, 3.6318950328521504),
(3.4899094375774653, 2.833403564341454, 3.5302775707507936, 4.105222616165781, 4.058620552785475, 2.2119481875657065, 2.237152326406796, 2.347319328750453, 4.2082323167594105, 2.230297306550573, 2.6120384976921844, 3.102537865359037, 3.6213933085302346),
(3.474954955444038, 2.8179454881053694, 3.5208407360655216, 4.091894413271642, 4.046791408466637, 2.207476749135106, 2.2266869686671114, 2.3433949820515774, 4.201245686305252, 2.2219180717036493, 2.6027987823510714, 3.0921812113430667, 3.6106212346102335),
(3.4596804794557414, 2.8023049283022097, 3.5111779751443635, 4.078278156913432, 4.034639933665648, 2.202906105893837, 2.2160775179637073, 2.339432195353248, 4.194104536067792, 2.2134038612543105, 2.593406981766777, 3.081619264424341, 3.599566693656808),
(3.444071463301694, 2.786457731745264, 3.5012735234572037, 4.064352653515562, 4.022154078879807, 2.198225216308296, 2.205305785707854, 2.335412392574511, 4.186789145687842, 2.204737931846929, 2.583843696810071, 3.0708336364609767, 3.5882175682346147),
(3.4281133606710137, 2.770379745247819, 3.4911116164739244, 4.0500967095024505, 4.0093217946064135, 2.1934230388448794, 2.1943535833108223, 2.3313169976344117, 4.179279794806213, 2.195903540125881, 2.5740895283517222, 3.059805939311088, 3.5765617409083106),
(3.4117916252528193, 2.7540468156231634, 3.480676489664407, 4.0354891312985055, 3.9961310313427676, 2.1884885319699854, 2.1832027221838817, 2.327127434451996, 4.1715567630637125, 2.186883942735539, 2.564125077262501, 3.048517784832791, 3.5645870942425564),
(3.3950917107362275, 2.7374347896845848, 3.469952378498536, 4.020508725328144, 3.9825697395861663, 2.1834106541500105, 2.171835013738304, 2.32282512694631, 4.163600330101149, 2.177662396320279, 2.5539309444131764, 3.0369507848842026, 3.5522815108020076),
(3.3779990708103593, 2.72051951424537, 3.458923518446195, 4.005134298015778, 3.968625869833912, 2.1781783638513517, 2.1602322693853586, 2.3183914990363985, 4.155390775559333, 2.1682221575244744, 2.5434877306745176, 3.0250865513234366, 3.539632873151326),
(3.3604991591643323, 2.7032768361188086, 3.4475741449772643, 3.989344655785821, 3.9542873725833014, 2.172780619540406, 2.148376300536318, 2.3138079746413083, 4.146908379079072, 2.1585464829925005, 2.5327760369172956, 3.01290669600861, 3.5266290638551654),
(3.3425774294872626, 2.6856826021181863, 3.4358884935616283, 3.9731186050626883, 3.939542198331635, 2.167206379683571, 2.1362489186024507, 2.3090559776800847, 4.138133420301177, 2.1486186293687313, 2.521776464012279, 3.000392830797838, 3.5132579654781866),
(3.32421933546827, 2.6677126590567926, 3.4238507996691703, 3.95643495227079, 3.9243782975762116, 2.1614446027472427, 2.1238319349950276, 2.3041169320717727, 4.129046178866459, 2.138421853297541, 2.5104696128302373, 2.987526567549236, 3.499507460585047),
(3.305410330796474, 2.6493428537479145, 3.411445298769771, 3.939272503834543, 3.9087836208143316, 2.1554842471978186, 2.1111071611253194, 2.2989722617354196, 4.119626934415724, 2.127939411423304, 2.4988360842419404, 2.9742895181209197, 3.485365431740406),
(3.286135869160991, 2.63054903300484, 3.3986562263333155, 3.921610066178358, 3.892746118543293, 2.149314271501696, 2.0980564084045974, 2.2936033905900706, 4.109855966589782, 2.117154560390395, 2.486856479118158, 2.9606632943710056, 3.47081976150892),
(3.2663814042509403, 2.6113070436408568, 3.385467817829687, 3.9034264457266503, 3.8762537412603972, 2.1429236341252724, 2.084661488244132, 2.287991742554771, 4.099713555029442, 2.106050556843188, 2.4745113983296596, 2.946629508157608, 3.4558583324552474),
(3.24613238975544, 2.5915927324692523, 3.371864308728764, 3.884700448903832, 3.859294439462941, 2.136301293534943, 2.0709042120551926, 2.282118741548566, 4.089179979375516, 2.0946106574260583, 2.4617814427472147, 2.9321697713388444, 3.4404690271440472),
(3.2253742793636087, 2.5713819463033154, 3.357829934500433, 3.8654108821343187, 3.8418561636482247, 2.129436208197107, 2.0567663912490506, 2.275965811490503, 4.078235519268811, 2.0828181187833787, 2.448647213241593, 2.9172656957728282, 3.4246397281399767),
(3.204092526764565, 2.5506505319563324, 3.3433489306145776, 3.845536551842521, 3.8239268643135484, 2.12231733657816, 2.0422298372369765, 2.2695143762996266, 4.066860454350135, 2.0706561975595252, 2.435089310683564, 2.901898893317677, 3.408358318007695),
(3.182272585647426, 2.5293743362415917, 3.328405532541078, 3.825056264452855, 3.8054944919562104, 2.1149336371444996, 2.0272763614302405, 2.2627458598949826, 4.055035064260301, 2.0581081503988705, 2.4210883359438973, 2.8860509758315054, 3.3916126793118586),
(3.15989990970131, 2.5075292059723817, 3.312983975749817, 3.803948826389732, 3.786546997073511, 2.107274068362522, 2.011887775240113, 2.2556416861956174, 4.042739628640116, 2.0451572339457913, 2.406624889893362, 2.869703555172429, 3.3743906946171274),
(3.1369599526153373, 2.485090987961989, 3.297068495710681, 3.7821930440775677, 3.7670723301627476, 2.0993275886986256, 1.996045890077866, 2.2481832791205765, 4.029954427130388, 2.03178670484466, 2.3916795734027287, 2.8528382431985637, 3.356680246488159),
(3.1134381680786243, 2.462035529023703, 3.2806433278935474, 3.759767723940773, 3.7470584417212223, 2.0910831566192063, 1.9797325173547677, 2.240352062588905, 4.01665973937193, 2.0179798197398515, 2.3762329873427666, 2.835436651768026, 3.338469217489611),
(3.0893200097802915, 2.43833867597081, 3.2636927077683033, 3.736651672403764, 3.726493282246232, 2.082529730590662, 1.9629294684820913, 2.232129460519649, 4.002835845005547, 2.0037198352757413, 2.360265732584245, 2.81748039273893, 3.319745490186143),
(3.0645909314094544, 2.413976275616598, 3.2462008708048304, 3.7128236958909513, 3.7053648022350787, 2.0736562690793887, 1.9456185548711045, 2.2234968968318545, 3.9884630236720513, 1.9889900080967018, 2.343758409997933, 2.798951077969393, 3.3004969471424106),
(3.0392363866552325, 2.3889241747743553, 3.2281520524730105, 3.68826260082675, 3.6836609521850594, 2.0644517305517844, 1.92778158793308, 2.2144357954445675, 3.9735215550122507, 1.9737735948471091, 2.3266916204546018, 2.7798303193175293, 3.280711470923074),
(3.013241829206745, 2.3631582202573695, 3.209530488242727, 3.662947193635575, 3.661369682593474, 2.0549050734742456, 1.9094003790792877, 2.204927580276833, 3.9579917186669555, 1.9580538521713367, 2.3090459648250197, 2.760099728641455, 3.2603769440927906),
(2.985872378562096, 2.3361812483089035, 3.1894367815609423, 3.6359078326604974, 3.637472442348399, 2.044409790526844, 1.890042688371143, 2.194318780939749, 3.9406648366396393, 1.9413463665164574, 2.290238301015577, 2.739039825677736, 3.238594343766138),
(2.9529147067913613, 2.305226127839791, 3.162695127361195, 3.6015908635153817, 3.6060765239126513, 2.0294758592028415, 1.8672851053542865, 2.178885413105753, 3.914570904488858, 1.9209123976394982, 2.2669667742475976, 2.7125450094732435, 3.210171058768078),
(2.913948837961724, 2.2700386914162856, 3.1287683831823556, 3.559431004163544, 3.5665680525387184, 2.0097365184190736, 1.8408974993535137, 2.158239675810939, 3.8789700908914604, 1.8964822607451575, 2.238903803443816, 2.680200779555139, 3.1745682435574323),
(2.869288821834384, 2.2308483472321874, 3.0880187887641237, 3.509829001502691, 3.5193572497128454, 1.9854308966281256, 1.8110725784027506, 2.132640213243912, 3.834331906799607, 1.8682632772683752, 2.206296661839883, 2.6423069875630283, 3.132149617927639),
(2.8192487081705426, 2.1878845034812957, 3.0408085838461982, 3.4531856024305307, 3.464854336921282, 1.9567981222825823, 1.7780030505359237, 2.102345669593281, 3.781125863165455, 1.8364627686440926, 2.1693926226714484, 2.5991634851365175, 3.0832789016721334),
(2.7641425467313994, 2.1413765683574097, 2.987500008168281, 3.3899015538447737, 3.4034695356502755, 1.924077323835029, 1.7418816237869603, 2.06761468904765, 3.7198214709411626, 1.80128805630725, 2.1284389591741633, 2.5510701239152134, 3.0283198145843517),
(2.704284387278154, 2.0915539500543283, 2.9284553014700707, 3.320377602643127, 3.3356130673860758, 1.8875076297380518, 1.7029010061897865, 2.0287059157956278, 3.6508882410788894, 1.7629464616927875, 2.0836829445836784, 2.4983267555387214, 2.9676360764577314),
(2.639988279572007, 2.038646056765853, 2.8640367034912675, 3.245014495723301, 3.2616951536149297, 1.8473281684442346, 1.6612539057783289, 1.9858779940258184, 3.574795684530792, 1.7216453062356454, 2.0353718521356448, 2.441233231646648, 2.901591407085708),
(2.571568273374159, 1.9828822966857818, 2.7946064539715714, 3.1642129799830006, 3.1821260158230857, 1.8037780684061635, 1.6171330305865146, 1.939389567926831, 3.4920133122490293, 1.677591911370765, 1.9837529550657118, 2.3800894038786007, 2.830549526261718),
(2.4993384184458094, 1.9244920780079149, 2.720526792650682, 3.0783738023199376, 3.097315875496792, 1.7570964580764235, 1.57073108864827, 1.8894992816872707, 3.40301063518576, 1.6309935985330857, 1.929073526609531, 2.3151951238741835, 2.7548741537791983),
(2.4236127645481584, 1.8637048089260515, 2.6421599592682994, 2.9878977096318184, 3.007674954122297, 1.7075224659075996, 1.5222407879975217, 1.836465779495744, 3.308257164293142, 1.5820576891575489, 1.8715808400027525, 2.2468502432730046, 2.674929009431585),
(2.344705361442406, 1.8007498976339917, 2.5598681935641237, 2.8931854488163533, 2.913613473185848, 1.655295220352278, 1.4718548366681967, 1.780547705540858, 3.2082224105233355, 1.5309915046790947, 1.8115221684810274, 2.175354613714669, 2.591077813012314),
(2.2629302588897535, 1.735856752325535, 2.474013735277854, 2.794637766771248, 2.8155416541736935, 1.6006538498630427, 1.4197659426942213, 1.722003704011219, 3.1033758848284956, 1.4780023665326631, 1.7491447852800066, 2.1010080868387835, 2.503684284314822),
(2.1786015066514, 1.6692547811944802, 2.3849588241491912, 2.6926554103942144, 2.7138697185720826, 1.5438374828924795, 1.3661668141095222, 1.6610924190954333, 2.9941870981607828, 1.4232975961531955, 1.6846959636353394, 2.0241105142849545, 2.413112143132546),
(2.092033154488546, 1.6011733924346279, 2.2930656999178347, 2.5876391265829586, 2.6090078878672616, 1.4850852478931735, 1.3112501589480263, 1.5980724949821083, 2.8811255614723543, 1.367084514975632, 1.6184229767826777, 1.9449617476927885, 2.3197251092589215),
(2.003539252162392, 1.531841994239777, 2.198696602323485, 2.4799896622351905, 2.5013663835454807, 1.42463627331771, 1.25520868524366, 1.5332025758598495, 2.7646607857153693, 1.3095704444349128, 1.5505730979576713, 1.86386163870189, 2.223886902487385),
(1.9134338494341376, 1.4614899948037272, 2.102213771105841, 2.3701077642486164, 2.3913554270929867, 1.362729687618674, 1.1982351010303502, 1.4667413059172643, 2.6452622818419855, 1.2509627059659787, 1.4813936003959711, 1.7811100389518673, 2.1259612426113734),
(1.8220309960649823, 1.3903468023202779, 2.003979446004603, 2.258394179520947, 2.2793852399960275, 1.2996046192486514, 1.1405221143420232, 1.3989473293429584, 2.5233995608043625, 1.1914686210037697, 1.4111317573332278, 1.6970068000823257, 2.026311849424323),
(1.7296447418161276, 1.3186418249832292, 1.9043558667594713, 2.14524965494989, 2.165866043740852, 1.2355001966602268, 1.082262433212606, 1.3300792903255396, 2.399542133554657, 1.1312955109832268, 1.340034842005092, 1.6118517737328717, 1.9253024427196697),
(1.636589136448773, 1.2466044709863806, 1.8037052731101455, 2.031074937433153, 2.0512080598137095, 1.1706555483059853, 1.0236487656760251, 1.2603958330536131, 2.274159511045028, 1.0706506973392897, 1.2683501276472144, 1.5259448115431116, 1.82329674229085),
(1.5431782297241188, 1.1744641485235314, 1.7023899047963256, 1.9162707738684466, 1.9358215097008455, 1.105309802638513, 0.964873819766207, 1.1901556017157862, 2.147721204227634, 1.0097415015069, 1.196324887495245, 1.439585765152651, 1.7206584679313008),
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
)
passenger_arriving_acc = (
(2, 0, 1, 3, 1, 1, 2, 1, 0, 1, 0, 0, 0, 3, 1, 3, 1, 0, 1, 0, 0, 1, 0, 0, 0, 0),
(4, 2, 5, 5, 1, 2, 2, 2, 2, 1, 0, 1, 0, 7, 7, 4, 3, 3, 1, 1, 1, 2, 0, 0, 0, 0),
(6, 4, 8, 8, 1, 4, 2, 3, 3, 1, 1, 1, 0, 9, 8, 8, 5, 5, 1, 4, 2, 3, 0, 0, 1, 0),
(12, 5, 10, 9, 4, 5, 2, 4, 5, 2, 1, 1, 0, 11, 9, 10, 8, 6, 1, 4, 3, 3, 1, 0, 2, 0),
(14, 10, 13, 14, 4, 5, 2, 4, 6, 2, 1, 2, 0, 12, 14, 11, 9, 8, 2, 5, 4, 3, 2, 2, 2, 0),
(16, 12, 16, 15, 5, 6, 2, 5, 7, 2, 3, 2, 0, 13, 15, 12, 10, 9, 5, 8, 6, 3, 2, 2, 3, 0),
(20, 17, 17, 19, 5, 8, 2, 6, 8, 4, 5, 3, 0, 17, 16, 13, 10, 10, 6, 9, 7, 3, 3, 3, 3, 0),
(21, 19, 20, 25, 5, 9, 4, 7, 8, 4, 7, 4, 0, 18, 18, 15, 11, 15, 7, 9, 11, 5, 3, 6, 3, 0),
(22, 23, 21, 28, 6, 11, 5, 7, 8, 5, 7, 4, 0, 22, 21, 19, 15, 16, 7, 9, 11, 7, 3, 8, 4, 0),
(26, 23, 22, 30, 7, 13, 7, 8, 9, 6, 7, 4, 0, 25, 26, 21, 18, 18, 10, 10, 14, 7, 3, 9, 4, 0),
(27, 23, 22, 34, 9, 15, 9, 9, 9, 6, 8, 4, 0, 32, 29, 25, 18, 18, 15, 11, 16, 7, 5, 9, 4, 0),
(30, 26, 25, 38, 12, 16, 9, 9, 11, 7, 8, 4, 0, 37, 32, 29, 19, 19, 16, 12, 18, 8, 8, 10, 4, 0),
(33, 29, 29, 40, 15, 16, 9, 10, 13, 9, 9, 4, 0, 39, 35, 32, 23, 22, 19, 12, 19, 8, 8, 11, 4, 0),
(36, 32, 30, 41, 18, 17, 10, 10, 15, 11, 10, 5, 0, 43, 39, 33, 25, 23, 20, 12, 21, 11, 11, 12, 4, 0),
(39, 34, 33, 44, 19, 18, 11, 11, 16, 12, 10, 5, 0, 46, 41, 35, 31, 30, 22, 15, 22, 12, 11, 13, 5, 0),
(45, 35, 34, 46, 21, 19, 11, 12, 18, 12, 10, 5, 0, 49, 45, 39, 31, 34, 23, 18, 22, 14, 12, 13, 5, 0),
(49, 38, 34, 49, 21, 20, 14, 13, 19, 14, 11, 6, 0, 51, 51, 41, 34, 36, 25, 20, 22, 15, 14, 13, 5, 0),
(54, 49, 35, 56, 25, 22, 14, 14, 22, 14, 12, 6, 0, 54, 52, 46, 36, 42, 25, 21, 24, 16, 14, 13, 5, 0),
(60, 53, 37, 60, 26, 23, 16, 14, 22, 14, 12, 6, 0, 59, 54, 46, 37, 47, 25, 22, 24, 16, 14, 15, 7, 0),
(66, 59, 40, 63, 30, 23, 18, 16, 24, 15, 12, 7, 0, 62, 57, 51, 39, 51, 28, 22, 25, 17, 14, 15, 8, 0),
(74, 65, 43, 67, 32, 25, 22, 19, 27, 16, 12, 8, 0, 65, 57, 52, 43, 54, 29, 25, 26, 19, 17, 17, 8, 0),
(79, 69, 45, 73, 34, 27, 23, 20, 31, 18, 15, 8, 0, 69, 61, 54, 45, 62, 33, 26, 28, 19, 17, 19, 8, 0),
(82, 73, 49, 76, 38, 28, 24, 20, 32, 20, 16, 8, 0, 72, 63, 54, 46, 64, 35, 28, 29, 20, 19, 21, 8, 0),
(83, 75, 54, 80, 41, 28, 26, 24, 35, 22, 16, 8, 0, 79, 68, 56, 49, 70, 38, 30, 32, 23, 20, 21, 8, 0),
(85, 83, 55, 83, 42, 31, 27, 27, 37, 23, 17, 9, 0, 85, 73, 56, 52, 72, 41, 31, 32, 24, 24, 22, 8, 0),
(92, 86, 58, 86, 45, 31, 28, 27, 39, 24, 18, 9, 0, 89, 73, 58, 56, 76, 45, 31, 32, 24, 25, 22, 9, 0),
(96, 86, 60, 89, 47, 35, 29, 28, 40, 26, 19, 9, 0, 94, 74, 61, 58, 77, 46, 32, 32, 24, 26, 22, 9, 0),
(101, 90, 66, 93, 48, 36, 30, 30, 43, 28, 23, 9, 0, 97, 78, 61, 59, 78, 46, 34, 32, 24, 26, 22, 9, 0),
(104, 95, 70, 95, 51, 38, 31, 31, 45, 28, 25, 10, 0, 100, 82, 67, 61, 84, 47, 35, 32, 25, 26, 23, 9, 0),
(107, 99, 72, 104, 51, 40, 33, 33, 49, 29, 25, 10, 0, 105, 85, 70, 62, 89, 49, 35, 34, 26, 28, 23, 9, 0),
(113, 103, 73, 106, 55, 41, 34, 36, 50, 29, 26, 11, 0, 110, 89, 73, 64, 91, 50, 38, 34, 29, 29, 23, 12, 0),
(114, 107, 77, 111, 56, 43, 36, 38, 53, 30, 27, 11, 0, 119, 93, 74, 68, 95, 51, 39, 35, 34, 31, 23, 12, 0),
(122, 111, 82, 111, 59, 44, 37, 39, 54, 31, 28, 12, 0, 122, 94, 78, 69, 100, 53, 40, 38, 34, 31, 24, 12, 0),
(125, 117, 84, 113, 61, 46, 38, 40, 55, 31, 28, 12, 0, 126, 102, 80, 73, 107, 55, 45, 39, 35, 34, 25, 12, 0),
(130, 121, 87, 115, 65, 47, 42, 42, 55, 31, 29, 12, 0, 128, 107, 89, 77, 109, 56, 49, 39, 37, 35, 25, 12, 0),
(133, 124, 90, 117, 69, 50, 44, 45, 57, 31, 29, 12, 0, 133, 110, 90, 80, 109, 57, 50, 40, 38, 36, 25, 12, 0),
(137, 127, 92, 125, 72, 52, 46, 46, 59, 31, 29, 12, 0, 136, 112, 92, 85, 112, 58, 51, 40, 40, 36, 25, 12, 0),
(142, 129, 94, 127, 79, 53, 46, 49, 61, 32, 29, 12, 0, 143, 114, 96, 86, 116, 62, 54, 40, 43, 36, 27, 12, 0),
(144, 135, 98, 137, 82, 54, 49, 49, 65, 32, 29, 13, 0, 146, 116, 100, 86, 119, 63, 54, 42, 45, 36, 27, 12, 0),
(147, 137, 103, 138, 87, 57, 53, 50, 65, 32, 31, 13, 0, 150, 120, 103, 89, 124, 67, 55, 42, 45, 37, 27, 13, 0),
(150, 142, 104, 143, 88, 59, 57, 53, 67, 34, 31, 13, 0, 151, 125, 104, 90, 127, 69, 55, 42, 46, 38, 27, 14, 0),
(153, 143, 106, 150, 93, 60, 59, 54, 68, 35, 31, 13, 0, 151, 128, 109, 93, 133, 73, 56, 44, 47, 39, 27, 14, 0),
(158, 146, 110, 154, 97, 63, 60, 54, 69, 36, 32, 13, 0, 155, 132, 110, 97, 135, 74, 59, 44, 49, 40, 28, 14, 0),
(161, 155, 116, 160, 100, 65, 65, 58, 70, 40, 32, 13, 0, 156, 133, 114, 99, 137, 74, 61, 46, 49, 41, 30, 15, 0),
(163, 157, 117, 163, 101, 67, 69, 58, 72, 40, 34, 13, 0, 159, 137, 116, 100, 139, 75, 64, 48, 50, 43, 30, 15, 0),
(171, 163, 118, 166, 104, 69, 72, 58, 73, 40, 34, 14, 0, 163, 145, 118, 103, 143, 77, 67, 48, 51, 44, 31, 15, 0),
(176, 169, 120, 166, 106, 70, 73, 60, 73, 40, 34, 15, 0, 169, 148, 121, 106, 147, 79, 68, 49, 52, 46, 32, 15, 0),
(182, 174, 123, 171, 110, 72, 73, 62, 74, 42, 36, 15, 0, 169, 151, 124, 108, 153, 81, 70, 51, 52, 48, 32, 15, 0),
(185, 180, 123, 174, 115, 74, 74, 64, 77, 43, 36, 15, 0, 173, 155, 128, 108, 156, 83, 71, 53, 54, 49, 32, 15, 0),
(189, 183, 128, 181, 118, 76, 75, 65, 79, 44, 36, 15, 0, 175, 159, 131, 109, 160, 85, 72, 54, 56, 51, 32, 15, 0),
(194, 190, 129, 184, 124, 78, 75, 66, 81, 45, 37, 16, 0, 182, 163, 134, 111, 163, 90, 76, 54, 56, 52, 32, 16, 0),
(199, 193, 132, 191, 126, 79, 78, 66, 81, 45, 37, 16, 0, 183, 167, 135, 115, 166, 91, 76, 56, 58, 55, 33, 17, 0),
(200, 197, 136, 200, 129, 83, 79, 67, 83, 45, 39, 16, 0, 186, 172, 138, 116, 172, 92, 76, 56, 58, 56, 33, 17, 0),
(204, 200, 140, 203, 134, 85, 81, 69, 87, 46, 40, 18, 0, 188, 179, 140, 119, 174, 94, 77, 56, 59, 57, 34, 17, 0),
(211, 206, 147, 207, 139, 87, 83, 71, 87, 46, 40, 19, 0, 193, 180, 142, 120, 177, 98, 79, 58, 60, 57, 34, 17, 0),
(216, 210, 149, 212, 143, 87, 85, 72, 88, 46, 40, 19, 0, 196, 182, 145, 123, 182, 99, 82, 58, 61, 57, 34, 17, 0),
(219, 213, 153, 216, 147, 89, 85, 73, 89, 46, 41, 19, 0, 201, 185, 147, 124, 185, 104, 82, 60, 61, 59, 35, 17, 0),
(222, 217, 153, 221, 149, 92, 86, 74, 92, 47, 41, 20, 0, 205, 188, 154, 125, 187, 106, 83, 61, 63, 59, 35, 17, 0),
(229, 220, 159, 224, 151, 92, 90, 74, 93, 47, 41, 20, 0, 211, 191, 156, 125, 189, 106, 86, 64, 65, 59, 35, 17, 0),
(234, 226, 164, 227, 155, 93, 93, 76, 94, 47, 41, 20, 0, 215, 192, 156, 126, 192, 107, 86, 64, 67, 59, 36, 18, 0),
(241, 230, 168, 231, 157, 93, 93, 76, 96, 48, 44, 20, 0, 215, 198, 156, 127, 196, 107, 87, 65, 69, 61, 37, 18, 0),
(246, 231, 168, 234, 157, 93, 94, 76, 100, 49, 45, 20, 0, 216, 203, 159, 128, 199, 108, 89, 68, 72, 62, 38, 19, 0),
(251, 234, 170, 238, 159, 96, 95, 77, 103, 49, 45, 20, 0, 222, 207, 164, 129, 201, 110, 91, 69, 73, 65, 39, 19, 0),
(258, 237, 178, 243, 162, 96, 96, 78, 104, 50, 45, 21, 0, 225, 208, 164, 129, 203, 111, 91, 69, 73, 67, 40, 19, 0),
(263, 241, 179, 247, 165, 97, 101, 79, 106, 52, 45, 21, 0, 231, 209, 166, 134, 206, 112, 92, 69, 74, 69, 41, 19, 0),
(265, 244, 183, 250, 167, 100, 104, 81, 108, 53, 45, 21, 0, 236, 212, 167, 137, 209, 113, 92, 70, 74, 70, 43, 20, 0),
(268, 250, 189, 256, 170, 100, 109, 82, 109, 54, 45, 21, 0, 242, 214, 170, 137, 213, 117, 97, 70, 75, 71, 43, 20, 0),
(269, 253, 192, 264, 172, 100, 111, 84, 112, 56, 46, 21, 0, 249, 216, 172, 138, 214, 118, 97, 70, 75, 73, 44, 20, 0),
(275, 258, 193, 266, 176, 102, 111, 85, 114, 57, 46, 21, 0, 253, 219, 177, 141, 217, 118, 98, 71, 78, 74, 44, 20, 0),
(279, 259, 195, 269, 183, 102, 114, 89, 115, 61, 46, 21, 0, 255, 222, 179, 143, 224, 119, 102, 71, 79, 74, 44, 20, 0),
(285, 264, 201, 270, 188, 103, 114, 89, 117, 62, 47, 21, 0, 258, 226, 180, 145, 227, 120, 103, 71, 79, 75, 44, 20, 0),
(289, 270, 204, 274, 192, 103, 114, 89, 118, 63, 47, 22, 0, 261, 229, 182, 146, 230, 122, 103, 71, 80, 75, 44, 23, 0),
(292, 273, 206, 281, 194, 103, 114, 92, 118, 63, 47, 22, 0, 264, 232, 185, 147, 231, 123, 107, 72, 80, 75, 44, 23, 0),
(296, 277, 210, 283, 197, 104, 116, 92, 119, 65, 47, 23, 0, 269, 235, 186, 148, 236, 124, 109, 73, 81, 75, 44, 24, 0),
(298, 278, 216, 285, 201, 107, 117, 93, 120, 66, 47, 23, 0, 271, 238, 187, 151, 239, 125, 111, 73, 85, 75, 45, 25, 0),
(302, 280, 219, 287, 205, 108, 117, 93, 123, 67, 47, 23, 0, 274, 246, 192, 151, 244, 126, 112, 74, 85, 76, 49, 25, 0),
(306, 283, 225, 293, 207, 109, 118, 95, 125, 68, 48, 23, 0, 285, 249, 194, 155, 247, 128, 112, 76, 87, 77, 49, 25, 0),
(309, 291, 229, 295, 211, 111, 118, 96, 126, 68, 49, 23, 0, 289, 252, 197, 159, 249, 128, 113, 78, 88, 77, 49, 25, 0),
(311, 296, 234, 296, 211, 113, 121, 97, 129, 70, 50, 23, 0, 293, 257, 200, 161, 251, 129, 117, 79, 90, 77, 49, 26, 0),
(314, 299, 237, 297, 211, 114, 122, 98, 131, 70, 50, 25, 0, 296, 259, 204, 161, 259, 130, 118, 80, 91, 79, 50, 26, 0),
(317, 302, 239, 300, 213, 116, 123, 100, 132, 73, 50, 25, 0, 300, 263, 207, 162, 263, 130, 120, 81, 91, 82, 54, 26, 0),
(319, 304, 242, 302, 215, 117, 123, 100, 135, 74, 50, 26, 0, 302, 267, 210, 167, 269, 131, 124, 82, 91, 82, 55, 27, 0),
(325, 308, 246, 304, 218, 117, 125, 100, 139, 74, 50, 26, 0, 305, 268, 213, 170, 273, 137, 125, 82, 94, 85, 56, 27, 0),
(327, 314, 250, 306, 221, 118, 128, 101, 142, 75, 50, 26, 0, 311, 268, 215, 170, 276, 139, 125, 82, 96, 87, 56, 27, 0),
(331, 319, 257, 307, 224, 119, 129, 101, 144, 76, 51, 26, 0, 315, 271, 218, 173, 282, 142, 126, 82, 98, 88, 57, 27, 0),
(333, 322, 263, 311, 226, 120, 130, 102, 146, 76, 51, 27, 0, 324, 272, 218, 176, 286, 143, 129, 83, 100, 89, 58, 27, 0),
(336, 330, 267, 314, 228, 121, 132, 102, 149, 76, 52, 27, 0, 326, 274, 219, 178, 290, 145, 131, 86, 102, 91, 59, 27, 0),
(340, 333, 269, 318, 229, 122, 134, 102, 151, 76, 52, 27, 0, 328, 282, 223, 182, 292, 148, 132, 87, 102, 91, 61, 27, 0),
(349, 333, 271, 322, 231, 122, 135, 102, 153, 77, 52, 27, 0, 328, 286, 227, 186, 293, 149, 133, 87, 104, 92, 63, 27, 0),
(355, 336, 273, 326, 238, 126, 136, 102, 156, 79, 52, 29, 0, 332, 291, 229, 190, 297, 151, 134, 88, 105, 93, 64, 27, 0),
(360, 339, 276, 331, 242, 128, 137, 103, 160, 79, 52, 29, 0, 337, 296, 230, 192, 301, 155, 134, 88, 107, 96, 64, 27, 0),
(365, 343, 276, 333, 246, 129, 138, 103, 162, 81, 52, 29, 0, 341, 302, 232, 195, 307, 155, 138, 89, 109, 97, 64, 28, 0),
(370, 348, 280, 335, 249, 130, 140, 105, 163, 81, 52, 29, 0, 347, 305, 234, 197, 309, 156, 139, 90, 109, 99, 64, 28, 0),
(373, 349, 284, 339, 250, 131, 143, 107, 165, 81, 54, 29, 0, 351, 310, 235, 200, 310, 156, 141, 90, 109, 100, 65, 28, 0),
(378, 353, 295, 343, 254, 132, 143, 108, 168, 82, 54, 29, 0, 356, 316, 237, 201, 310, 157, 142, 91, 110, 101, 65, 28, 0),
(383, 357, 297, 344, 258, 135, 144, 108, 168, 83, 54, 29, 0, 356, 318, 238, 201, 312, 158, 143, 91, 112, 101, 65, 28, 0),
(388, 361, 301, 347, 261, 136, 146, 109, 170, 83, 55, 30, 0, 362, 320, 240, 201, 315, 161, 143, 93, 113, 102, 67, 28, 0),
(389, 365, 302, 350, 266, 137, 147, 110, 173, 84, 55, 30, 0, 365, 325, 242, 202, 316, 163, 146, 93, 115, 103, 68, 28, 0),
(394, 365, 309, 355, 269, 137, 148, 110, 176, 84, 57, 31, 0, 369, 326, 245, 205, 317, 165, 148, 93, 119, 105, 69, 28, 0),
(400, 369, 311, 357, 274, 139, 149, 114, 178, 85, 57, 31, 0, 373, 329, 248, 206, 320, 168, 148, 93, 121, 106, 69, 30, 0),
(405, 371, 312, 359, 276, 139, 149, 117, 178, 85, 58, 32, 0, 379, 333, 249, 207, 323, 169, 149, 96, 122, 106, 69, 31, 0),
(407, 376, 318, 363, 278, 139, 151, 119, 179, 85, 58, 33, 0, 383, 338, 251, 209, 324, 174, 149, 96, 125, 109, 69, 31, 0),
(410, 381, 324, 370, 283, 140, 151, 119, 183, 86, 58, 34, 0, 389, 340, 255, 210, 326, 177, 151, 96, 128, 109, 70, 31, 0),
(415, 383, 327, 375, 286, 141, 153, 119, 187, 86, 58, 35, 0, 392, 342, 255, 213, 327, 178, 152, 97, 128, 109, 73, 31, 0),
(421, 388, 333, 379, 289, 142, 155, 120, 190, 87, 58, 35, 0, 400, 344, 258, 215, 327, 179, 156, 97, 129, 110, 73, 31, 0),
(425, 392, 339, 385, 290, 142, 158, 121, 191, 87, 58, 35, 0, 404, 345, 262, 216, 331, 181, 162, 99, 129, 110, 73, 31, 0),
(426, 398, 341, 390, 294, 144, 159, 121, 193, 88, 59, 35, 0, 405, 348, 266, 218, 334, 182, 162, 100, 130, 110, 73, 31, 0),
(426, 403, 345, 392, 299, 145, 159, 122, 194, 88, 60, 36, 0, 409, 353, 269, 218, 336, 185, 162, 101, 130, 112, 74, 31, 0),
(429, 408, 349, 394, 301, 146, 160, 123, 197, 88, 61, 36, 0, 413, 357, 271, 220, 338, 186, 164, 101, 130, 114, 76, 31, 0),
(434, 410, 352, 396, 303, 147, 161, 124, 199, 89, 62, 36, 0, 415, 363, 273, 224, 343, 186, 167, 102, 132, 115, 77, 31, 0),
(439, 414, 357, 397, 304, 150, 162, 125, 199, 90, 63, 36, 0, 422, 365, 274, 224, 344, 188, 167, 102, 133, 116, 77, 31, 0),
(440, 418, 359, 398, 307, 150, 166, 127, 200, 90, 63, 37, 0, 424, 367, 276, 229, 346, 191, 169, 102, 133, 119, 77, 31, 0),
(443, 423, 362, 404, 309, 150, 167, 128, 200, 91, 63, 37, 0, 427, 369, 278, 229, 348, 192, 170, 102, 135, 119, 78, 31, 0),
(444, 425, 363, 406, 311, 152, 167, 129, 205, 92, 63, 37, 0, 429, 372, 280, 229, 351, 194, 171, 103, 136, 119, 78, 31, 0),
(449, 427, 364, 412, 313, 152, 168, 129, 207, 93, 63, 37, 0, 433, 376, 281, 231, 352, 196, 173, 104, 137, 121, 78, 32, 0),
(452, 435, 365, 420, 315, 152, 169, 131, 209, 94, 63, 37, 0, 439, 378, 284, 234, 355, 197, 175, 106, 139, 122, 79, 33, 0),
(454, 436, 366, 424, 318, 154, 172, 132, 211, 94, 65, 37, 0, 443, 381, 285, 234, 357, 200, 176, 106, 141, 125, 80, 33, 0),
(458, 441, 368, 429, 321, 156, 172, 133, 216, 94, 65, 38, 0, 449, 384, 286, 235, 362, 202, 178, 106, 143, 127, 80, 34, 0),
(460, 446, 372, 437, 322, 160, 173, 133, 217, 95, 67, 38, 0, 451, 390, 288, 237, 363, 202, 181, 107, 145, 127, 81, 34, 0),
(462, 448, 373, 440, 324, 160, 173, 133, 218, 95, 67, 38, 0, 455, 393, 289, 239, 364, 204, 183, 109, 147, 127, 82, 34, 0),
(462, 449, 374, 444, 326, 162, 174, 133, 219, 95, 68, 38, 0, 458, 397, 290, 240, 366, 204, 183, 109, 149, 127, 82, 34, 0),
(465, 449, 376, 446, 328, 164, 176, 133, 221, 95, 68, 38, 0, 461, 398, 293, 241, 369, 204, 184, 109, 152, 128, 82, 35, 0),
(467, 451, 380, 447, 331, 164, 177, 133, 222, 95, 69, 38, 0, 464, 404, 297, 242, 370, 206, 185, 109, 153, 130, 82, 35, 0),
(468, 454, 385, 451, 334, 164, 181, 133, 224, 95, 69, 38, 0, 471, 407, 300, 244, 371, 206, 185, 111, 153, 130, 82, 35, 0),
(472, 457, 387, 457, 337, 168, 181, 135, 225, 95, 69, 38, 0, 475, 407, 301, 246, 373, 208, 188, 111, 155, 131, 83, 36, 0),
(473, 457, 387, 461, 339, 170, 182, 135, 225, 95, 69, 38, 0, 478, 409, 304, 246, 375, 209, 190, 112, 156, 132, 84, 36, 0),
(473, 458, 390, 464, 340, 172, 183, 136, 227, 97, 69, 38, 0, 483, 412, 307, 250, 379, 211, 190, 112, 158, 134, 85, 36, 0),
(475, 461, 390, 469, 346, 173, 184, 137, 228, 99, 70, 38, 0, 483, 415, 309, 251, 383, 215, 192, 114, 159, 134, 85, 36, 0),
(476, 462, 395, 474, 349, 175, 184, 137, 229, 100, 70, 39, 0, 485, 416, 314, 252, 387, 216, 194, 116, 161, 136, 86, 37, 0),
(477, 464, 398, 477, 354, 176, 185, 139, 230, 100, 70, 39, 0, 491, 417, 315, 254, 389, 219, 197, 116, 163, 137, 86, 37, 0),
(483, 466, 401, 479, 357, 180, 186, 140, 231, 101, 70, 39, 0, 498, 418, 318, 255, 391, 220, 200, 117, 164, 139, 86, 37, 0),
(488, 471, 401, 483, 361, 181, 188, 140, 233, 103, 70, 39, 0, 502, 419, 318, 257, 392, 220, 200, 119, 167, 139, 88, 37, 0),
(490, 473, 403, 487, 363, 183, 188, 141, 234, 104, 71, 39, 0, 507, 421, 322, 261, 392, 220, 205, 120, 169, 140, 91, 37, 0),
(493, 474, 406, 494, 365, 185, 190, 142, 236, 104, 73, 39, 0, 511, 425, 324, 263, 395, 220, 205, 122, 169, 141, 92, 37, 0),
(495, 478, 410, 494, 367, 185, 194, 142, 237, 104, 73, 39, 0, 512, 428, 325, 264, 398, 220, 206, 122, 172, 143, 92, 37, 0),
(498, 479, 413, 499, 371, 186, 197, 142, 240, 105, 73, 39, 0, 516, 431, 327, 265, 400, 220, 207, 122, 172, 143, 93, 37, 0),
(506, 481, 416, 501, 373, 188, 199, 142, 243, 105, 73, 39, 0, 519, 433, 329, 265, 404, 220, 208, 122, 174, 145, 93, 37, 0),
(508, 482, 420, 506, 375, 191, 200, 144, 244, 105, 73, 41, 0, 526, 433, 331, 268, 408, 221, 210, 123, 175, 147, 94, 37, 0),
(510, 485, 426, 508, 377, 191, 202, 144, 245, 106, 73, 41, 0, 528, 435, 337, 270, 412, 222, 211, 123, 175, 150, 96, 37, 0),
(512, 489, 429, 512, 378, 191, 203, 145, 246, 106, 73, 42, 0, 533, 438, 338, 271, 416, 223, 212, 125, 175, 151, 97, 37, 0),
(518, 492, 431, 515, 380, 194, 203, 147, 247, 106, 73, 42, 0, 533, 441, 342, 272, 419, 224, 213, 125, 179, 152, 98, 37, 0),
(525, 498, 433, 515, 384, 194, 205, 147, 248, 108, 73, 42, 0, 538, 445, 344, 274, 423, 224, 213, 126, 181, 153, 98, 37, 0),
(531, 499, 434, 520, 389, 200, 206, 147, 249, 108, 74, 43, 0, 541, 446, 346, 275, 425, 228, 215, 126, 182, 153, 98, 37, 0),
(538, 502, 436, 523, 391, 203, 206, 148, 250, 108, 74, 44, 0, 543, 448, 349, 277, 428, 228, 218, 127, 188, 153, 100, 37, 0),
(542, 502, 438, 526, 394, 204, 207, 148, 252, 109, 75, 44, 0, 546, 448, 350, 280, 430, 228, 218, 130, 189, 155, 100, 38, 0),
(548, 504, 442, 528, 397, 205, 208, 151, 256, 109, 76, 45, 0, 547, 450, 351, 281, 434, 229, 218, 130, 190, 155, 103, 38, 0),
(552, 505, 446, 532, 399, 206, 209, 151, 256, 109, 77, 45, 0, 557, 451, 353, 282, 435, 229, 220, 130, 190, 157, 103, 39, 0),
(553, 508, 447, 533, 402, 208, 210, 153, 257, 110, 77, 45, 0, 557, 454, 355, 284, 435, 230, 220, 131, 191, 157, 103, 39, 0),
(559, 509, 448, 538, 406, 209, 210, 154, 259, 110, 77, 45, 0, 561, 455, 356, 286, 436, 233, 221, 132, 192, 158, 104, 39, 0),
(564, 513, 448, 542, 408, 209, 213, 154, 259, 110, 78, 46, 0, 566, 458, 357, 288, 440, 234, 222, 133, 192, 159, 106, 40, 0),
(566, 515, 453, 547, 410, 211, 213, 155, 260, 111, 78, 46, 0, 568, 459, 359, 292, 442, 235, 224, 133, 193, 159, 107, 40, 0),
(571, 516, 454, 548, 410, 212, 213, 155, 260, 111, 78, 46, 0, 576, 462, 361, 296, 445, 237, 224, 136, 194, 161, 108, 40, 0),
(577, 519, 458, 550, 413, 212, 217, 155, 263, 111, 79, 46, 0, 579, 462, 361, 298, 447, 239, 225, 136, 195, 162, 109, 41, 0),
(580, 519, 459, 552, 415, 213, 218, 157, 263, 111, 80, 46, 0, 580, 464, 362, 302, 451, 240, 227, 137, 198, 163, 111, 41, 0),
(584, 520, 461, 556, 416, 216, 218, 159, 265, 111, 82, 47, 0, 581, 472, 363, 302, 452, 243, 231, 137, 199, 164, 112, 42, 0),
(587, 523, 465, 557, 419, 218, 218, 160, 266, 111, 82, 47, 0, 587, 476, 365, 303, 455, 244, 231, 137, 200, 165, 112, 44, 0),
(589, 525, 467, 565, 421, 219, 220, 161, 267, 114, 83, 47, 0, 590, 477, 368, 304, 457, 245, 231, 137, 202, 165, 112, 44, 0),
(596, 525, 472, 570, 424, 221, 221, 162, 268, 115, 83, 47, 0, 594, 479, 372, 307, 461, 247, 231, 137, 202, 166, 113, 44, 0),
(600, 528, 474, 573, 426, 221, 222, 162, 270, 115, 84, 47, 0, 598, 483, 373, 307, 465, 249, 232, 137, 202, 166, 113, 44, 0),
(604, 528, 477, 576, 428, 223, 224, 163, 271, 116, 85, 47, 0, 601, 483, 374, 308, 467, 249, 232, 137, 204, 166, 116, 44, 0),
(605, 528, 477, 578, 431, 227, 224, 164, 273, 117, 85, 48, 0, 608, 486, 376, 308, 470, 252, 234, 137, 204, 166, 116, 44, 0),
(610, 528, 480, 580, 433, 230, 227, 165, 274, 119, 85, 48, 0, 612, 489, 377, 308, 475, 252, 235, 137, 205, 166, 117, 44, 0),
(612, 528, 482, 583, 435, 230, 227, 166, 274, 119, 85, 48, 0, 614, 490, 379, 310, 477, 252, 236, 137, 206, 167, 117, 44, 0),
(615, 531, 483, 589, 440, 231, 228, 167, 274, 120, 86, 49, 0, 619, 494, 380, 310, 480, 252, 236, 137, 208, 168, 117, 44, 0),
(619, 534, 487, 592, 442, 232, 229, 168, 277, 121, 87, 49, 0, 622, 496, 383, 312, 485, 252, 236, 138, 211, 168, 117, 44, 0),
(623, 534, 488, 597, 444, 232, 229, 168, 280, 121, 87, 49, 0, 626, 499, 386, 313, 488, 253, 236, 142, 212, 170, 118, 44, 0),
(625, 536, 489, 599, 446, 235, 230, 168, 281, 121, 87, 49, 0, 631, 501, 387, 314, 491, 253, 238, 143, 214, 171, 121, 44, 0),
(628, 537, 492, 601, 450, 238, 231, 168, 281, 121, 87, 49, 0, 640, 503, 389, 315, 493, 253, 238, 143, 214, 172, 121, 44, 0),
(629, 538, 498, 602, 452, 239, 231, 169, 282, 121, 87, 50, 0, 647, 506, 391, 315, 495, 255, 238, 143, 214, 172, 121, 44, 0),
(629, 538, 503, 607, 454, 239, 233, 170, 282, 122, 88, 50, 0, 651, 506, 392, 316, 496, 256, 239, 144, 214, 172, 121, 44, 0),
(630, 541, 504, 608, 457, 239, 233, 171, 282, 122, 88, 51, 0, 653, 507, 397, 316, 497, 256, 239, 146, 215, 173, 122, 44, 0),
(635, 542, 505, 609, 458, 240, 234, 172, 282, 122, 88, 51, 0, 654, 509, 397, 318, 502, 257, 241, 146, 215, 173, 122, 44, 0),
(638, 542, 507, 610, 458, 240, 234, 172, 283, 122, 89, 51, 0, 656, 511, 398, 319, 504, 258, 242, 147, 217, 175, 122, 44, 0),
(640, 543, 508, 613, 458, 241, 234, 173, 285, 122, 89, 51, 0, 658, 513, 399, 321, 505, 260, 244, 147, 221, 177, 123, 45, 0),
(640, 544, 511, 617, 461, 241, 235, 175, 287, 122, 89, 51, 0, 659, 516, 400, 322, 507, 260, 245, 147, 221, 179, 123, 45, 0),
(642, 546, 513, 617, 461, 242, 236, 175, 287, 122, 89, 51, 0, 661, 517, 401, 322, 508, 261, 245, 147, 221, 179, 123, 45, 0),
(644, 548, 514, 617, 463, 243, 237, 176, 288, 122, 89, 51, 0, 664, 518, 401, 322, 509, 261, 247, 148, 222, 179, 123, 45, 0),
(645, 548, 517, 618, 464, 243, 238, 176, 288, 122, 89, 52, 0, 665, 521, 403, 322, 511, 262, 247, 148, 223, 181, 123, 45, 0),
(647, 548, 518, 618, 464, 243, 238, 178, 288, 123, 89, 53, 0, 669, 523, 404, 322, 512, 262, 247, 148, 224, 181, 123, 45, 0),
(647, 548, 518, 618, 464, 243, 238, 178, 288, 123, 89, 53, 0, 669, 523, 404, 322, 512, 262, 247, 148, 224, 181, 123, 45, 0),
)
passenger_arriving_rate = (
(2.0083462313487073, 2.025939138554161, 1.7370944098708356, 1.86440033215903, 1.481249495362563, 0.7323528174753792, 0.8292071230747831, 0.7755293621632372, 0.8120132082890676, 0.3958015015522371, 0.2803510109257069, 0.16326383594353913, 0.0, 2.0335520850313453, 1.7959021953789303, 1.4017550546285344, 1.187404504656711, 1.6240264165781353, 1.085741107028532, 0.8292071230747831, 0.5231091553395566, 0.7406247476812815, 0.6214667773863434, 0.34741888197416715, 0.18417628532310557, 0.0),
(2.1417308608079897, 2.159688921186411, 1.851782197110051, 1.987543275982985, 1.5793307566597963, 0.780729502943263, 0.8838937882527388, 0.8265856204842847, 0.8656327101777213, 0.4218980692277151, 0.29887307573040883, 0.17404055536047852, 0.0, 2.1679166589759418, 1.9144461089652633, 1.4943653786520439, 1.265694207683145, 1.7312654203554425, 1.1572198686779986, 0.8838937882527388, 0.5576639306737593, 0.7896653783298981, 0.6625144253276618, 0.3703564394220102, 0.19633535647149197, 0.0),
(2.2746892035918926, 2.292907895993359, 1.9660140951824712, 2.1101963113994384, 1.6770567929999318, 0.8289131933862371, 0.9383637015921409, 0.8774375413174034, 0.9190382409170065, 0.4478913775020547, 0.31732154325175427, 0.18477442173510186, 0.0, 2.301745931283876, 2.03251863908612, 1.586607716258771, 1.3436741325061639, 1.838076481834013, 1.2284125578443648, 0.9383637015921409, 0.5920808524187409, 0.8385283964999659, 0.7033987704664796, 0.3932028190364943, 0.20844617236303267, 0.0),
(2.406703117258625, 2.4250675173766973, 2.0793369564399518, 2.231872922259622, 1.774043113600507, 0.8767128119365264, 0.9924007283295911, 0.9278835262490847, 0.9720180214561457, 0.4736782698426182, 0.3356232274551589, 0.1954228561643487, 0.0, 2.4345091225016904, 2.1496514178078354, 1.6781161372757945, 1.4210348095278542, 1.9440360429122914, 1.2990369367487185, 0.9924007283295911, 0.6262234370975188, 0.8870215568002535, 0.7439576407532075, 0.41586739128799033, 0.2204606833978816, 0.0),
(2.537254459366393, 2.555639239738117, 2.1912976332343455, 2.352086592414771, 1.8699052276790646, 0.9239372817263559, 1.0457887337016918, 0.9777219768658193, 1.024360272744361, 0.499155589716768, 0.3537049423060384, 0.20594327974515883, 0.0, 2.565675453175927, 2.2653760771967466, 1.7685247115301916, 1.4974667691503036, 2.048720545488722, 1.368810767612147, 1.0457887337016918, 0.6599552012331114, 0.9349526138395323, 0.7840288641382572, 0.4382595266468692, 0.23233083997619253, 0.0),
(2.6658250874734044, 2.6840945174793154, 2.3014429779175063, 2.470350805716118, 1.9642586444531411, 0.9703955258879502, 1.0983115829450447, 1.0267512947540989, 1.0758532157308744, 0.5242201805918665, 0.37149350176980883, 0.21629311357447162, 0.0, 2.694714143853131, 2.3792242493191873, 1.8574675088490442, 1.572660541775599, 2.151706431461749, 1.4374518126557383, 1.0983115829450447, 0.6931396613485358, 0.9821293222265706, 0.8234502685720396, 0.46028859558350127, 0.24400859249811963, 0.0),
(2.7918968591378666, 2.8099048050019837, 2.4093198428412888, 2.586179046014896, 2.0567188731402783, 1.015896467553535, 1.1497531412962525, 1.0747698815004147, 1.1262850713649086, 0.548768885935276, 0.3889157198118855, 0.22642977874922698, 0.0, 2.821094415079843, 2.4907275662414965, 1.9445785990594275, 1.6463066578058276, 2.2525701427298173, 1.5046778341005806, 1.1497531412962525, 0.7256403339668107, 1.0283594365701392, 0.8620596820049655, 0.4818639685682578, 0.25544589136381673, 0.0),
(2.9149516319179876, 2.932541556707815, 2.514475080357545, 2.699084797162339, 2.146901422958014, 1.0602490298553349, 1.199897273991917, 1.1215761386912588, 1.175444060595686, 0.5726985492143588, 0.40589841039768465, 0.23631069636636431, 0.0, 2.944285487402608, 2.599417660030007, 2.029492051988423, 1.718095647643076, 2.350888121191372, 1.5702065941677623, 1.199897273991917, 0.7573207356109535, 1.073450711479007, 0.8996949323874465, 0.5028950160715091, 0.26659468697343774, 0.0),
(3.034471263371974, 3.051476226998503, 2.616455542818132, 2.8085815430096783, 2.2344218031238894, 1.1032621359255743, 1.2485278462686396, 1.166968467913121, 1.2231184043724275, 0.5959060138964776, 0.42236838749262146, 0.24589328752282347, 0.0, 3.063756581367967, 2.7048261627510577, 2.111841937463107, 1.7877180416894323, 2.446236808744855, 1.6337558550783693, 1.2485278462686396, 0.7880443828039817, 1.1172109015619447, 0.936193847669893, 0.5232911085636265, 0.2774069297271367, 0.0),
(3.149937611058034, 3.1661802702757416, 2.7148080825749017, 2.9141827674081506, 2.3188955228554424, 1.1447447088964797, 1.295428723363024, 1.210745270752494, 1.2690963236443564, 0.6182881234489943, 0.4382524650621119, 0.25513497331554386, 0.0, 3.178976917522465, 2.8064847064709815, 2.1912623253105594, 1.8548643703469825, 2.538192647288713, 1.6950433790534916, 1.295428723363024, 0.817674792068914, 1.1594477614277212, 0.9713942558027171, 0.5429616165149803, 0.28783457002506746, 0.0),
(3.2608325325343728, 3.276125140941222, 2.8090795519797083, 3.0154019542089863, 2.3999380913702133, 1.1845056719002751, 1.340383770511671, 1.2527049487958686, 1.3131660393606952, 0.6397417213392715, 0.45347745707157167, 0.2639931748414651, 0.0, 3.2894157164126443, 2.903924923256116, 2.267387285357858, 1.9192251640178144, 2.6263320787213904, 1.7537869283142162, 1.340383770511671, 0.8460754799287679, 1.1999690456851067, 1.005133984736329, 0.5618159103959417, 0.2978295582673839, 0.0),
(3.3666378853592023, 3.3807822933966425, 2.8988168033844053, 3.1117525872634193, 2.477165017885742, 1.222353948069186, 1.3831768529511832, 1.292645903629736, 1.3551157724706657, 0.660163651034672, 0.46797017748641667, 0.27242531319752705, 0.0, 3.394542198585045, 2.996678445172797, 2.339850887432083, 1.9804909531040158, 2.7102315449413314, 1.8097042650816304, 1.3831768529511832, 0.8731099629065614, 1.238582508942871, 1.03725086242114, 0.5797633606768812, 0.30734384485424027, 0.0),
(3.466835527090725, 3.479623182043689, 2.9835666891408468, 3.202748150422684, 2.550191811619567, 1.2580984605354364, 1.4235918359181623, 1.3303665368405868, 1.3947337439234906, 0.6794507560025573, 0.48165744027206236, 0.28038880948066897, 0.0, 3.493825584586214, 3.0842769042873583, 2.4082872013603116, 2.0383522680076718, 2.789467487846981, 1.8625131515768216, 1.4235918359181623, 0.8986417575253116, 1.2750959058097835, 1.0675827168075616, 0.5967133378281694, 0.31632938018579, 0.0),
(3.5609073152871504, 3.572119261284061, 3.062876061600887, 3.2879021275380134, 2.618633981789227, 1.2915481324312523, 1.4614125846492112, 1.3656652500149136, 1.431808174668391, 0.6974998797102906, 0.49446605939392463, 0.2878410847878307, 0.0, 3.586735094962694, 3.1662519326661376, 2.472330296969623, 2.0924996391308714, 2.863616349336782, 1.9119313500208792, 1.4614125846492112, 0.9225343803080374, 1.3093169908946134, 1.0959673758460047, 0.6125752123201775, 0.3247381146621874, 0.0),
(3.6483351075066865, 3.6577419855194493, 3.1362917731163824, 3.366728002460638, 2.6821070376122638, 1.3225118868888581, 1.4964229643809324, 1.3983404447392078, 1.4661272856545895, 0.7142078656252335, 0.5063228488174191, 0.29473956021595205, 0.0, 3.6727399502610254, 3.242135162375472, 2.531614244087095, 2.1426235968757004, 2.932254571309179, 1.9576766226348912, 1.4964229643809324, 0.9446513477777557, 1.3410535188061319, 1.1222426674868795, 0.6272583546232765, 0.33252199868358634, 0.0),
(3.728600761307542, 3.7359628091515464, 3.203360676039181, 3.438739259041796, 2.7402264883062153, 1.3507986470404796, 1.5284068403499251, 1.4281905225999594, 1.4974792978313092, 0.7294715572147492, 0.5171546225079614, 0.30104165686197243, 0.0, 3.7513093710277525, 3.311458225481696, 2.5857731125398065, 2.188414671644247, 2.9949585956626184, 1.9994667316399433, 1.5284068403499251, 0.9648561764574853, 1.3701132441531076, 1.1462464196805988, 0.6406721352078363, 0.33963298265014064, 0.0),
(3.8011861342479203, 3.806253186582049, 3.263629622721142, 3.5034493811327145, 2.792607843088622, 1.3762173360183407, 1.5571480777927953, 1.4550138851836603, 1.5256524321477714, 0.7431877979461997, 0.5268881944309676, 0.3067047958228314, 0.0, 3.8219125778094183, 3.3737527540511447, 2.6344409721548376, 2.229563393838599, 3.0513048642955427, 2.0370194392571244, 1.5571480777927953, 0.9830123828702433, 1.396303921544311, 1.1678164603775718, 0.6527259245442284, 0.3460230169620045, 0.0),
(3.86557308388603, 3.868084572212647, 3.3166454655141178, 3.560371852584634, 2.8388666111770235, 1.3985768769546667, 1.5824305419461422, 1.4786089340768032, 1.5504349095531977, 0.755253431286947, 0.5354503785518533, 0.31168639819546856, 0.0, 3.8840187911525663, 3.4285503801501536, 2.6772518927592666, 2.2657602938608403, 3.1008698191063955, 2.0700525077075245, 1.5824305419461422, 0.9989834835390476, 1.4194333055885118, 1.1867906175282115, 0.6633290931028236, 0.35164405201933163, 0.0),
(3.921243467780082, 3.920928420445034, 3.3619550567699603, 3.609020157248784, 2.878618301788957, 1.4176861929816842, 1.6040380980465703, 1.4987740708658768, 1.5716149509968127, 0.7655653007043539, 0.542767988836034, 0.31594388507682386, 0.0, 3.9370972316037385, 3.475382735845062, 2.7138399441801697, 2.2966959021130613, 3.1432299019936254, 2.0982836992122276, 1.6040380980465703, 1.0126329949869173, 1.4393091508944784, 1.203006719082928, 0.672391011353992, 0.35644803822227583, 0.0),
(3.9676791434882794, 3.964256185680906, 3.399105248840526, 3.648907778976395, 2.911478424141964, 1.4333542072316154, 1.6217546113306789, 1.5153076971373745, 1.5889807774278373, 0.7740202496657831, 0.5487678392489254, 0.3194346775638366, 0.0, 3.9806171197094784, 3.513781453202202, 2.7438391962446262, 2.3220607489973486, 3.1779615548556746, 2.1214307759923243, 1.6217546113306789, 1.0238244337368683, 1.455739212070982, 1.2163025929921318, 0.6798210497681053, 0.3603869259709915, 0.0),
(4.0043619685688325, 3.997539322321953, 3.427642894077668, 3.679548201618706, 2.9370624874535847, 1.4453898428366878, 1.6353639470350725, 1.5280082144777862, 1.6023206097954932, 0.7805151216385962, 0.5533767437559435, 0.32211619675344644, 0.0, 4.01404767601633, 3.54327816428791, 2.766883718779717, 2.341545364915788, 3.2046412195909864, 2.139211500268901, 1.6353639470350725, 1.0324213163119198, 1.4685312437267923, 1.2265160672062356, 0.6855285788155336, 0.36341266566563213, 0.0),
(4.030773800579946, 4.020249284769871, 3.44711484483324, 3.700454909026946, 2.954986000941357, 1.453602022929125, 1.644649970396352, 1.5366740244736041, 1.611422669049003, 0.7849467600901557, 0.556521516322504, 0.32394586374259315, 0.0, 4.036858121070831, 3.5634045011685243, 2.78260758161252, 2.3548402802704667, 3.222845338098006, 2.151343634263046, 1.644649970396352, 1.0382871592350893, 1.4774930004706786, 1.233484969675649, 0.689422968966648, 0.365477207706352, 0.0),
(4.046396497079832, 4.031857527426353, 3.457067953459095, 3.7111413850523514, 2.96486447382282, 1.4577996706411525, 1.64939654665112, 1.5411035287113193, 1.6160751761375887, 0.7872120084878245, 0.5581289709140228, 0.3248810996282164, 0.0, 4.048517675419531, 3.5736920959103795, 2.7906448545701137, 2.361636025463473, 3.2321503522751773, 2.157544940195847, 1.64939654665112, 1.0412854790293946, 1.48243223691141, 1.237047128350784, 0.6914135906918191, 0.3665325024933049, 0.0),
(4.052157345337056, 4.0332319844535895, 3.4583077274805674, 3.712479243827161, 2.9673952149420257, 1.4583333333333335, 1.6499608004518678, 1.5415823045267492, 1.6166568312757204, 0.7874792272519435, 0.5583305358107827, 0.3249965858862978, 0.0, 4.05, 3.574962444749276, 2.7916526790539136, 2.36243768175583, 3.2333136625514407, 2.158215226337449, 1.6499608004518678, 1.0416666666666667, 1.4836976074710129, 1.2374930812757206, 0.6916615454961136, 0.36665745313214454, 0.0),
(4.056404965213662, 4.03243024691358, 3.4581049382716054, 3.7123145833333338, 2.9688286969639606, 1.4583333333333335, 1.6496507625272334, 1.5409166666666667, 1.6165788888888888, 0.7873150617283953, 0.5583083052749721, 0.3249695473251029, 0.0, 4.05, 3.5746650205761314, 2.7915415263748606, 2.361945185185185, 3.2331577777777776, 2.1572833333333334, 1.6496507625272334, 1.0416666666666667, 1.4844143484819803, 1.2374381944444448, 0.6916209876543211, 0.3665845679012346, 0.0),
(4.060562892084632, 4.030849908550525, 3.457704618198446, 3.7119888117283955, 2.970230652158534, 1.4583333333333335, 1.649039780521262, 1.5396090534979427, 1.6164248971193418, 0.7869918838591681, 0.5582642266284242, 0.3249161713153483, 0.0, 4.05, 3.5740778844688306, 2.7913211331421213, 2.3609756515775038, 3.2328497942386836, 2.15545267489712, 1.649039780521262, 1.0416666666666667, 1.485115326079267, 1.2373296039094654, 0.6915409236396892, 0.36644090077732056, 0.0),
(4.0646308076192135, 4.028515112025606, 3.457112254229539, 3.711505632716049, 2.9716010315789614, 1.4583333333333335, 1.6481373436617444, 1.5376841563786012, 1.61619683127572, 0.7865150708733427, 0.5581986989233904, 0.3248371894528274, 0.0, 4.05, 3.573209083981101, 2.7909934946169517, 2.3595452126200276, 3.23239366255144, 2.152757818930042, 1.6481373436617444, 1.0416666666666667, 1.4858005157894807, 1.2371685442386833, 0.6914224508459078, 0.3662286465477825, 0.0),
(4.068608393486655, 4.02545, 3.4563333333333333, 3.71086875, 2.972939786278457, 1.4583333333333335, 1.6469529411764707, 1.5351666666666668, 1.6158966666666665, 0.7858900000000002, 0.5581121212121213, 0.32473333333333343, 0.0, 4.05, 3.572066666666667, 2.7905606060606063, 2.3576699999999997, 3.231793333333333, 2.1492333333333336, 1.6469529411764707, 1.0416666666666667, 1.4864698931392284, 1.2369562500000002, 0.6912666666666667, 0.36595000000000005, 0.0),
(4.0724953313562, 4.021678715134888, 3.4553733424782807, 3.710081867283951, 2.9742468673102405, 1.4583333333333335, 1.6454960622932302, 1.532081275720165, 1.615526378600823, 0.7851220484682215, 0.558004892546868, 0.3246053345526597, 0.0, 4.05, 3.5706586800792564, 2.7900244627343396, 2.355366145404664, 3.231052757201646, 2.144913786008231, 1.6454960622932302, 1.0416666666666667, 1.4871234336551202, 1.2366939557613172, 0.6910746684956562, 0.3656071559213535, 0.0),
(4.0762913028971, 4.01722540009145, 3.4542377686328307, 3.709148688271605, 2.9755222257275253, 1.4583333333333335, 1.6437761962398132, 1.5284526748971192, 1.6150879423868312, 0.7842165935070876, 0.5578774119798812, 0.3244539247065996, 0.0, 4.05, 3.568993171772595, 2.789387059899406, 2.3526497805212623, 3.2301758847736624, 2.139833744855967, 1.6437761962398132, 1.0416666666666667, 1.4877611128637627, 1.2363828960905352, 0.6908475537265663, 0.36520230909922274, 0.0),
(4.079995989778599, 4.012114197530865, 3.452932098765432, 3.7080729166666666, 2.9767658125835297, 1.4583333333333335, 1.6418028322440088, 1.5243055555555556, 1.6145833333333333, 0.7831790123456793, 0.557730078563412, 0.3242798353909465, 0.0, 4.05, 3.5670781893004113, 2.78865039281706, 2.349537037037037, 3.2291666666666665, 2.134027777777778, 1.6418028322440088, 1.0416666666666667, 1.4883829062917648, 1.2360243055555558, 0.6905864197530864, 0.36473765432098776, 0.0),
(4.083609073669943, 4.006369250114313, 3.4514618198445364, 3.70685825617284, 2.977977578931469, 1.4583333333333335, 1.639585459533608, 1.519664609053498, 1.6140145267489712, 0.7820146822130776, 0.5575632913497112, 0.32408379820149374, 0.0, 4.05, 3.564921780216431, 2.7878164567485557, 2.346044046639232, 3.2280290534979423, 2.1275304526748973, 1.639585459533608, 1.0416666666666667, 1.4889887894657345, 1.2356194187242802, 0.6902923639689073, 0.36421538637402845, 0.0),
(4.087130236240382, 4.000014700502972, 3.4498324188385916, 3.7055084104938274, 2.979157475824559, 1.4583333333333335, 1.6371335673363998, 1.5145545267489715, 1.613383497942387, 0.7807289803383634, 0.5573774493910297, 0.32386654473403453, 0.0, 4.05, 3.5625319920743794, 2.7868872469551484, 2.3421869410150893, 3.226766995884774, 2.12037633744856, 1.6371335673363998, 1.0416666666666667, 1.4895787379122796, 1.2351694701646094, 0.6899664837677183, 0.3636377000457248, 0.0),
(4.090559159159159, 3.993074691358024, 3.4480493827160497, 3.704027083333333, 2.9803054543160163, 1.4583333333333335, 1.6344566448801743, 1.5090000000000001, 1.6126922222222222, 0.7793272839506176, 0.5571729517396184, 0.32362880658436216, 0.0, 4.05, 3.559916872427983, 2.785864758698092, 2.3379818518518523, 3.2253844444444444, 2.1126000000000005, 1.6344566448801743, 1.0416666666666667, 1.4901527271580082, 1.2346756944444446, 0.68960987654321, 0.36300679012345677, 0.0),
(4.093895524095524, 3.985573365340649, 3.446118198445359, 3.702417978395062, 2.9814214654590576, 1.4583333333333335, 1.631564181392722, 1.503025720164609, 1.6119426748971197, 0.7778149702789212, 0.5569501974477283, 0.3233713153482701, 0.0, 4.05, 3.557084468830971, 2.784750987238642, 2.333444910836763, 3.2238853497942395, 2.1042360082304525, 1.631564181392722, 1.0416666666666667, 1.4907107327295288, 1.2341393261316875, 0.6892236396890719, 0.3623248513946045, 0.0),
(4.097139012718723, 3.977534865112025, 3.4440443529949705, 3.700684799382716, 2.9825054603068986, 1.4583333333333335, 1.6284656661018317, 1.4966563786008233, 1.6111368312757204, 0.7761974165523551, 0.5567095855676103, 0.32309480262155166, 0.0, 4.05, 3.554042828837068, 2.7835479278380513, 2.3285922496570644, 3.2222736625514408, 2.0953189300411528, 1.6284656661018317, 1.0416666666666667, 1.4912527301534493, 1.2335615997942388, 0.6888088705989942, 0.3615940786465478, 0.0),
(4.100289306698002, 3.9689833333333326, 3.4418333333333337, 3.69883125, 2.983557389912756, 1.4583333333333335, 1.625170588235294, 1.489916666666667, 1.6102766666666666, 0.7744800000000003, 0.5564515151515153, 0.3228000000000001, 0.0, 4.05, 3.5508000000000006, 2.782257575757576, 2.32344, 3.220553333333333, 2.0858833333333338, 1.625170588235294, 1.0416666666666667, 1.491778694956378, 1.2329437500000002, 0.6883666666666668, 0.3608166666666667, 0.0),
(4.10334608770261, 3.9599429126657517, 3.4394906264288982, 3.6968610339506176, 2.984577205329846, 1.4583333333333335, 1.6216884370208988, 1.4828312757201647, 1.609364156378601, 0.7726680978509377, 0.5561763852516941, 0.3224876390794087, 0.0, 4.05, 3.547364029873495, 2.7808819262584703, 2.3180042935528125, 3.218728312757202, 2.0759637860082307, 1.6216884370208988, 1.0416666666666667, 1.492288602664923, 1.2322870113168727, 0.6878981252857798, 0.3599948102423411, 0.0),
(4.1063090374017905, 3.9504377457704623, 3.4370217192501147, 3.6947778549382724, 2.985564857611384, 1.4583333333333335, 1.6180287016864359, 1.4754248971193418, 1.6084012757201647, 0.7707670873342481, 0.5558845949203975, 0.32215845145557087, 0.0, 4.05, 3.543742966011279, 2.7794229746019874, 2.3123012620027437, 3.2168025514403293, 2.0655948559670785, 1.6180287016864359, 1.0416666666666667, 1.492782428805692, 1.2315926183127577, 0.6874043438500229, 0.35913070416095116, 0.0),
(4.109177837464794, 3.940491975308642, 3.434432098765433, 3.6925854166666667, 2.9865202978105874, 1.4583333333333335, 1.6142008714596952, 1.4677222222222224, 1.60739, 0.7687823456790126, 0.5555765432098766, 0.32181316872427984, 0.0, 4.05, 3.539944855967078, 2.777882716049383, 2.306347037037037, 3.21478, 2.0548111111111114, 1.6142008714596952, 1.0416666666666667, 1.4932601489052937, 1.2308618055555558, 0.6868864197530866, 0.3582265432098766, 0.0),
(4.111952169560865, 3.930129743941472, 3.4317272519433013, 3.690287422839506, 2.9874434769806717, 1.4583333333333335, 1.6102144355684662, 1.4597479423868318, 1.606332304526749, 0.7667192501143122, 0.5552526291723824, 0.32145252248132916, 0.0, 4.05, 3.5359777472946203, 2.7762631458619116, 2.300157750342936, 3.212664609053498, 2.0436471193415646, 1.6102144355684662, 1.0416666666666667, 1.4937217384903358, 1.230095807613169, 0.6863454503886602, 0.3572845221764975, 0.0),
(4.114631715359251, 3.919375194330132, 3.4289126657521725, 3.6878875771604944, 2.988334346174854, 1.4583333333333335, 1.606078883240539, 1.4515267489711936, 1.6052301646090534, 0.7645831778692275, 0.5549132518601656, 0.3210772443225119, 0.0, 4.05, 3.53184968754763, 2.7745662593008276, 2.2937495336076816, 3.210460329218107, 2.0321374485596713, 1.606078883240539, 1.0416666666666667, 1.494167173087427, 1.2292958590534984, 0.6857825331504345, 0.3563068358481939, 0.0),
(4.1172161565292, 3.908252469135803, 3.425993827160495, 3.685389583333334, 2.9891928564463486, 1.4583333333333335, 1.6018037037037036, 1.4430833333333335, 1.6040855555555558, 0.7623795061728398, 0.5545588103254772, 0.3206880658436215, 0.0, 4.05, 3.5275687242798353, 2.7727940516273852, 2.2871385185185185, 3.2081711111111115, 2.020316666666667, 1.6018037037037036, 1.0416666666666667, 1.4945964282231743, 1.2284631944444449, 0.685198765432099, 0.35529567901234577, 0.0),
(4.119705174739957, 3.8967857110196618, 3.4229762231367173, 3.6827971450617287, 2.990018958848374, 1.4583333333333335, 1.5973983861857501, 1.434442386831276, 1.6029004526748971, 0.7601136122542298, 0.5541897036205679, 0.32028571864045124, 0.0, 4.05, 3.523142905044963, 2.770948518102839, 2.2803408367626887, 3.2058009053497942, 2.0082193415637866, 1.5973983861857501, 1.0416666666666667, 1.495009479424187, 1.2275990483539099, 0.6845952446273434, 0.35425324645633294, 0.0),
(4.122098451660771, 3.8849990626428896, 3.4198653406492916, 3.680113966049383, 2.9908126044341454, 1.4583333333333335, 1.592872419914468, 1.4256286008230457, 1.6016768312757201, 0.7577908733424785, 0.5538063307976889, 0.3198709343087945, 0.0, 4.05, 3.5185802773967385, 2.7690316539884443, 2.273372620027435, 3.2033536625514403, 1.9958800411522641, 1.592872419914468, 1.0416666666666667, 1.4954063022170727, 1.2267046553497947, 0.6839730681298584, 0.35318173296753547, 0.0),
(4.1243956689608865, 3.872916666666667, 3.4166666666666674, 3.6773437500000004, 2.991573744256879, 1.4583333333333335, 1.5882352941176472, 1.416666666666667, 1.6004166666666664, 0.755416666666667, 0.553409090909091, 0.3194444444444445, 0.0, 4.05, 3.5138888888888884, 2.7670454545454546, 2.2662500000000003, 3.2008333333333328, 1.9833333333333336, 1.5882352941176472, 1.0416666666666667, 1.4957868721284395, 1.2257812500000003, 0.6833333333333335, 0.3520833333333334, 0.0),
(4.126596508309553, 3.8605626657521714, 3.4133856881572933, 3.674490200617284, 2.992302329369791, 1.4583333333333335, 1.5834964980230777, 1.407581275720165, 1.5991219341563785, 0.7529963694558759, 0.552998383007025, 0.3190069806431947, 0.0, 4.05, 3.509076787075141, 2.7649919150351248, 2.258989108367627, 3.198243868312757, 1.970613786008231, 1.5834964980230777, 1.0416666666666667, 1.4961511646848955, 1.2248300668724283, 0.6826771376314588, 0.35096024234110657, 0.0),
(4.128700651376014, 3.8479612025605854, 3.4100278920896208, 3.6715570216049382, 2.992998310826098, 1.4583333333333335, 1.5786655208585494, 1.3983971193415639, 1.597794609053498, 0.7505353589391863, 0.552574606143742, 0.3185592745008384, 0.0, 4.05, 3.5041520195092213, 2.7628730307187097, 2.2516060768175583, 3.195589218106996, 1.9577559670781894, 1.5786655208585494, 1.0416666666666667, 1.496499155413049, 1.2238523405349797, 0.6820055784179242, 0.3498146547782351, 0.0),
(4.130707779829518, 3.835136419753087, 3.4065987654320993, 3.6685479166666672, 2.993661639679016, 1.4583333333333335, 1.5737518518518518, 1.3891388888888891, 1.5964366666666667, 0.7480390123456792, 0.5521381593714928, 0.31810205761316873, 0.0, 4.05, 3.4991226337448555, 2.7606907968574634, 2.244117037037037, 3.1928733333333335, 1.944794444444445, 1.5737518518518518, 1.0416666666666667, 1.496830819839508, 1.222849305555556, 0.6813197530864199, 0.34864876543209883, 0.0),
(4.132617575339315, 3.8221124599908545, 3.403103795153178, 3.665466589506173, 2.9942922669817618, 1.4583333333333335, 1.5687649802307755, 1.3798312757201647, 1.5950500823045266, 0.7455127069044355, 0.5516894417425283, 0.31763606157597934, 0.0, 4.05, 3.4939966773357725, 2.7584472087126413, 2.2365381207133064, 3.190100164609053, 1.9317637860082308, 1.5687649802307755, 1.0416666666666667, 1.4971461334908809, 1.221822196502058, 0.6806207590306357, 0.34746476909007773, 0.0),
(4.134429719574647, 3.8089134659350714, 3.399548468221308, 3.6623167438271604, 2.9948901437875506, 1.4583333333333335, 1.56371439522311, 1.3704989711934157, 1.5936368312757199, 0.742961819844536, 0.5512288523090992, 0.3171620179850633, 0.0, 4.05, 3.4887821978356963, 2.7561442615454963, 2.2288854595336076, 3.1872736625514397, 1.9186985596707822, 1.56371439522311, 1.0416666666666667, 1.4974450718937753, 1.220772247942387, 0.6799096936442617, 0.346264860539552, 0.0),
(4.136143894204764, 3.7955635802469136, 3.3959382716049387, 3.659102083333334, 2.9954552211495997, 1.4583333333333335, 1.558609586056645, 1.3611666666666666, 1.592198888888889, 0.7403917283950618, 0.5507567901234569, 0.31668065843621407, 0.0, 4.05, 3.483487242798354, 2.7537839506172843, 2.221175185185185, 3.184397777777778, 1.9056333333333335, 1.558609586056645, 1.0416666666666667, 1.4977276105747999, 1.2197006944444448, 0.6791876543209877, 0.34505123456790127, 0.0),
(4.137759780898912, 3.782086945587563, 3.39227869227252, 3.6558263117283953, 2.995987450121124, 1.4583333333333335, 1.5534600419591706, 1.3518590534979422, 1.590738230452675, 0.7378078097850939, 0.5502736542378519, 0.3161927145252249, 0.0, 4.05, 3.4781198597774736, 2.7513682711892593, 2.2134234293552812, 3.18147646090535, 1.8926026748971192, 1.5534600419591706, 1.0416666666666667, 1.497993725060562, 1.218608770576132, 0.678455738454504, 0.3438260859625058, 0.0),
(4.139277061326338, 3.768507704618199, 3.388575217192502, 3.6524931327160495, 2.996486781755341, 1.4583333333333335, 1.5482752521584766, 1.3426008230452677, 1.5892568312757203, 0.735215441243713, 0.5497798437045351, 0.3156989178478891, 0.0, 4.05, 3.4726880963267797, 2.7488992185226753, 2.2056463237311386, 3.1785136625514405, 1.8796411522633747, 1.5482752521584766, 1.0416666666666667, 1.4982433908776704, 1.21749771090535, 0.6777150434385005, 0.3425916095107454, 0.0),
(4.140695417156286, 3.7548500000000002, 3.3848333333333334, 3.64910625, 2.996953167105467, 1.4583333333333335, 1.543064705882353, 1.3334166666666667, 1.5877566666666667, 0.7326200000000002, 0.5492757575757575, 0.31520000000000004, 0.0, 4.05, 3.4672, 2.7463787878787875, 2.1978600000000004, 3.1755133333333334, 1.8667833333333332, 1.543064705882353, 1.0416666666666667, 1.4984765835527336, 1.2163687500000002, 0.6769666666666667, 0.3413500000000001, 0.0),
(4.142014530058009, 3.741137974394147, 3.381058527663466, 3.6456693672839506, 2.997386557224717, 1.4583333333333335, 1.5378378923585896, 1.3243312757201646, 1.5862397119341562, 0.7300268632830363, 0.5487617949037703, 0.31469669257735106, 0.0, 4.05, 3.4616636183508613, 2.743808974518851, 2.1900805898491087, 3.1724794238683125, 1.8540637860082305, 1.5378378923585896, 1.0416666666666667, 1.4986932786123586, 1.2152231224279837, 0.6762117055326933, 0.34010345221764976, 0.0),
(4.143234081700749, 3.7273957704618197, 3.377256287151349, 3.642186188271605, 2.9977869031663094, 1.4583333333333335, 1.5326043008149763, 1.3153693415637862, 1.584707942386831, 0.7274414083219024, 0.5482383547408239, 0.31418972717573546, 0.0, 4.05, 3.4560869989330896, 2.7411917737041196, 2.182324224965707, 3.169415884773662, 1.8415170781893007, 1.5326043008149763, 1.0416666666666667, 1.4988934515831547, 1.2140620627572019, 0.6754512574302699, 0.33885416095107457, 0.0),
(4.144353753753753, 3.7136475308641974, 3.373432098765433, 3.638660416666667, 2.9981541559834577, 1.4583333333333335, 1.5273734204793028, 1.306555555555556, 1.5831633333333335, 0.7248690123456792, 0.5477058361391696, 0.3136798353909465, 0.0, 4.05, 3.4504781893004113, 2.7385291806958474, 2.1746070370370374, 3.166326666666667, 1.8291777777777782, 1.5273734204793028, 1.0416666666666667, 1.4990770779917288, 1.212886805555556, 0.6746864197530866, 0.33760432098765436, 0.0),
(4.145373227886272, 3.69991739826246, 3.369591449474166, 3.6350957561728396, 2.99848826672938, 1.4583333333333335, 1.5221547405793594, 1.297914609053498, 1.5816078600823045, 0.7223150525834479, 0.5471646381510581, 0.3131677488187777, 0.0, 4.05, 3.444845237006554, 2.7358231907552906, 2.166945157750343, 3.163215720164609, 1.8170804526748974, 1.5221547405793594, 1.0416666666666667, 1.49924413336469, 1.2116985853909468, 0.6739182898948333, 0.33635612711476914, 0.0),
(4.146292185767549, 3.6862295153177866, 3.365739826245999, 3.631495910493827, 2.9987891864572918, 1.4583333333333335, 1.5169577503429357, 1.289471193415638, 1.580043497942387, 0.7197849062642893, 0.5466151598287401, 0.3126541990550222, 0.0, 4.05, 3.439196189605243, 2.7330757991437, 2.1593547187928674, 3.160086995884774, 1.8052596707818933, 1.5169577503429357, 1.0416666666666667, 1.4993945932286459, 1.210498636831276, 0.6731479652492, 0.3351117741197988, 0.0),
(4.147110309066831, 3.6726080246913586, 3.3618827160493825, 3.6278645833333334, 2.9990568662204096, 1.4583333333333335, 1.5117919389978214, 1.2812500000000002, 1.5784722222222225, 0.7172839506172841, 0.546057800224467, 0.3121399176954733, 0.0, 4.05, 3.4335390946502056, 2.7302890011223346, 2.151851851851852, 3.156944444444445, 1.7937500000000002, 1.5117919389978214, 1.0416666666666667, 1.4995284331102048, 1.2092881944444447, 0.6723765432098766, 0.33387345679012354, 0.0),
(4.147827279453366, 3.6590770690443533, 3.3580256058527667, 3.624205478395062, 2.9992912570719494, 1.4583333333333335, 1.5066667957718067, 1.2732757201646092, 1.5768960082304526, 0.7148175628715137, 0.5454929583904894, 0.3116256363359245, 0.0, 4.05, 3.4278819996951686, 2.7274647919524466, 2.1444526886145407, 3.1537920164609052, 1.7825860082304528, 1.5066667957718067, 1.0416666666666667, 1.4996456285359747, 1.2080684927983543, 0.6716051211705534, 0.3326433699131231, 0.0),
(4.148442778596402, 3.6456607910379515, 3.3541739826246006, 3.6205222993827166, 2.999492310065129, 1.4583333333333335, 1.5015918098926813, 1.2655730452674898, 1.5753168312757202, 0.7123911202560588, 0.5449210333790582, 0.31111208657216893, 0.0, 4.05, 3.4222329522938577, 2.7246051668952904, 2.137173360768176, 3.1506336625514404, 1.7718022633744859, 1.5015918098926813, 1.0416666666666667, 1.4997461550325646, 1.2068407664609058, 0.6708347965249202, 0.33142370827617745, 0.0),
(4.148956488165184, 3.6323833333333333, 3.350333333333334, 3.6168187500000006, 2.9996599762531617, 1.4583333333333335, 1.4965764705882352, 1.2581666666666669, 1.5737366666666666, 0.7100100000000001, 0.5443424242424244, 0.31060000000000004, 0.0, 4.05, 3.4166, 2.721712121212122, 2.13003, 3.147473333333333, 1.7614333333333339, 1.4965764705882352, 1.0416666666666667, 1.4998299881265809, 1.2056062500000004, 0.6700666666666668, 0.3302166666666667, 0.0),
(4.149368089828959, 3.6192688385916783, 3.346509144947417, 3.613098533950618, 2.999794206689266, 1.4583333333333335, 1.4916302670862585, 1.2510812757201648, 1.5721574897119341, 0.707679579332419, 0.5437575300328387, 0.31009010821521116, 0.0, 4.05, 3.4109911903673225, 2.7187876501641934, 2.1230387379972564, 3.1443149794238683, 1.7515137860082308, 1.4916302670862585, 1.0416666666666667, 1.499897103344633, 1.2043661779835395, 0.6693018289894834, 0.3290244398719708, 0.0),
(4.149677265256975, 3.6063414494741655, 3.3427069044352997, 3.609365354938272, 2.999894952426658, 1.4583333333333335, 1.4867626886145406, 1.2443415637860082, 1.5705812757201647, 0.7054052354823961, 0.5431667498025524, 0.3095831428135955, 0.0, 4.05, 3.40541457094955, 2.715833749012762, 2.116215706447188, 3.1411625514403294, 1.7420781893004116, 1.4867626886145406, 1.0416666666666667, 1.499947476213329, 1.2031217849794242, 0.66854138088706, 0.32784922267946964, 0.0),
(4.149883696118478, 3.593625308641976, 3.3389320987654325, 3.605622916666667, 2.9999621645185526, 1.4583333333333335, 1.4819832244008715, 1.2379722222222225, 1.56901, 0.7031923456790125, 0.542570482603816, 0.3090798353909466, 0.0, 4.05, 3.399878189300412, 2.7128524130190796, 2.1095770370370373, 3.13802, 1.7331611111111116, 1.4819832244008715, 1.0416666666666667, 1.4999810822592763, 1.2018743055555559, 0.6677864197530866, 0.3266932098765433, 0.0),
(4.149987064082717, 3.581144558756287, 3.3351902149062647, 3.601874922839506, 2.999995794018168, 1.4583333333333335, 1.4773013636730412, 1.2319979423868317, 1.5674456378600823, 0.7010462871513491, 0.5419691274888808, 0.3085809175430575, 0.0, 4.05, 3.394390092973632, 2.7098456374444035, 2.103138861454047, 3.1348912757201646, 1.7247971193415643, 1.4773013636730412, 1.0416666666666667, 1.499997897009084, 1.2006249742798356, 0.6670380429812529, 0.3255585962505716, 0.0),
(4.14991664579233, 3.5688578344174515, 3.331468649977138, 3.5980925221417075, 2.9999674547459585, 1.4583062693695066, 1.4727030389659292, 1.226390641670477, 1.5658783798201494, 0.6989620441647167, 0.5413523992360252, 0.3080843340633248, 0.0, 4.0499500600137175, 3.388927674696572, 2.7067619961801257, 2.09688613249415, 3.131756759640299, 1.716946898338668, 1.4727030389659292, 1.0416473352639333, 1.4999837273729792, 1.199364174047236, 0.6662937299954276, 0.3244416213106775, 0.0),
(4.149256682769726, 3.5563900238948625, 3.3276628086419753, 3.594085054347826, 2.999709513435003, 1.4580923182441705, 1.4680536362693228, 1.2208497942386831, 1.5642397119341562, 0.6968806390704431, 0.5406575225943647, 0.3075739657786442, 0.0, 4.049554398148149, 3.3833136235650856, 2.7032876129718235, 2.090641917211329, 3.1284794238683125, 1.7091897119341564, 1.4680536362693228, 1.0414945130315503, 1.4998547567175016, 1.1980283514492756, 0.665532561728395, 0.3233081839904421, 0.0),
(4.147954315023558, 3.5436839019425634, 3.3237561442615453, 3.589826137278583, 2.999199817101051, 1.4576709597114261, 1.463332026912274, 1.2153254077122393, 1.5625203856119496, 0.6947919524462736, 0.539876592435072, 0.307047425376427, 0.0, 4.048772933813444, 3.3775216791406963, 2.6993829621753602, 2.0843758573388205, 3.1250407712238992, 1.701455570797135, 1.463332026912274, 1.0411935426510186, 1.4995999085505256, 1.1966087124261946, 0.6647512288523091, 0.32215308199477855, 0.0),
(4.146027864257172, 3.5307470618168946, 3.319750028577961, 3.585322051127214, 2.9984448210011028, 1.4570490219986791, 1.4585403319077976, 1.2098193110806281, 1.5607229614388052, 0.6926960359342641, 0.5390124913855908, 0.3065050979070905, 0.0, 4.047615955075446, 3.3715560769779955, 2.695062456927954, 2.0780881078027917, 3.1214459228776104, 1.6937470355128794, 1.4585403319077976, 1.040749301427628, 1.4992224105005514, 1.1951073503757383, 0.6639500057155922, 0.3209770056197177, 0.0),
(4.143495652173914, 3.5175870967741933, 3.3156458333333334, 3.5805790760869565, 2.9974509803921565, 1.4562333333333337, 1.4536806722689075, 1.2043333333333335, 1.55885, 0.6905929411764707, 0.5380681020733654, 0.3059473684210527, 0.0, 4.04609375, 3.365421052631579, 2.6903405103668265, 2.071778823529412, 3.1177, 1.6860666666666668, 1.4536806722689075, 1.040166666666667, 1.4987254901960783, 1.1935263586956524, 0.6631291666666667, 0.31978064516129034, 0.0),
(4.140376000477128, 3.5042116000707995, 3.3114449302697757, 3.575603492351047, 2.996224750531214, 1.4552307219427933, 1.4487551690086184, 1.1988693034598386, 1.556904061880811, 0.6884827198149495, 0.5370463071258393, 0.30537462196873066, 0.0, 4.04421660665295, 3.3591208416560367, 2.6852315356291965, 2.065448159444848, 3.113808123761622, 1.678417024843774, 1.4487551690086184, 1.0394505156734237, 1.498112375265607, 1.1918678307836825, 0.6622889860539553, 0.31856469091552725, 0.0),
(4.136687230870161, 3.4906281649630513, 3.307148691129401, 3.570401580112721, 2.9947725866752735, 1.4540480160544635, 1.4437659431399446, 1.1934290504496268, 1.5548877076665142, 0.6863654234917563, 0.5359499891704572, 0.30478724360054227, 0.0, 4.041994813100138, 3.3526596796059644, 2.6797499458522855, 2.0590962704752687, 3.1097754153330284, 1.6708006706294773, 1.4437659431399446, 1.0386057257531882, 1.4973862933376367, 1.190133860037574, 0.6614297382258802, 0.31732983317845925, 0.0),
(4.13244766505636, 3.4768443847072876, 3.302758487654321, 3.564979619565217, 2.9931009440813363, 1.452692043895748, 1.4387151156759002, 1.188014403292181, 1.5528034979423868, 0.6842411038489471, 0.5347820308346625, 0.30418561836690494, 0.0, 4.039438657407408, 3.3460418020359537, 2.673910154173312, 2.052723311546841, 3.1056069958847736, 1.6632201646090536, 1.4387151156759002, 1.0376371742112487, 1.4965504720406682, 1.1883265398550726, 0.6605516975308642, 0.3160767622461171, 0.0),
(4.127675624739071, 3.462867852559848, 3.2982756915866487, 3.559343890901771, 2.9912162780064016, 1.4511696336940512, 1.4336048076294992, 1.1826271909769854, 1.5506539932937051, 0.682109812528578, 0.5335453147458995, 0.3035701313182361, 0.0, 4.036558427640603, 3.339271444500597, 2.6677265737294973, 2.046329437585734, 3.1013079865874102, 1.6556780673677796, 1.4336048076294992, 1.0365497383528937, 1.4956081390032008, 1.186447963633924, 0.6596551383173298, 0.31480616841453174, 0.0),
(4.122389431621637, 3.4487061617770705, 3.2937016746684953, 3.55350067431562, 2.9891250437074692, 1.4494876136767771, 1.4284371400137559, 1.1772692424935225, 1.5484417543057463, 0.6799716011727052, 0.5322427235316126, 0.3029411675049536, 0.0, 4.03336441186557, 3.332352842554489, 2.6612136176580625, 2.039914803518115, 3.0968835086114925, 1.6481769394909316, 1.4284371400137559, 1.0353482954834123, 1.4945625218537346, 1.1845002247718734, 0.6587403349336991, 0.31351874197973373, 0.0),
(4.1166074074074075, 3.4343669056152932, 3.2890378086419756, 3.54745625, 2.98683369644154, 1.4476528120713306, 1.423214233841685, 1.171942386831276, 1.5461693415637856, 0.6778265214233843, 0.5308771398192452, 0.30229911197747467, 0.0, 4.029866898148149, 3.3252902317522204, 2.654385699096226, 2.0334795642701526, 3.092338683127571, 1.6407193415637862, 1.423214233841685, 1.0340377229080933, 1.49341684822077, 1.182485416666667, 0.6578075617283952, 0.312215173237754, 0.0),
(4.110347873799726, 3.4198576773308558, 3.2842854652492, 3.541216898148148, 2.9843486914656125, 1.445672057105116, 1.4179382101263003, 1.166648452979729, 1.5438393156531016, 0.6756746249226715, 0.5294514462362415, 0.30164434978621685, 0.0, 4.026076174554183, 3.318087847648385, 2.6472572311812077, 2.0270238747680143, 3.0876786313062032, 1.6333078341716205, 1.4179382101263003, 1.0326228979322258, 1.4921743457328063, 1.1804056327160497, 0.6568570930498401, 0.31089615248462327, 0.0),
(4.103629152501939, 3.4051860701800964, 3.2794460162322814, 3.534788898953301, 2.9816764840366874, 1.4435521770055377, 1.4126111898806162, 1.1613892699283648, 1.5414542371589697, 0.6735159633126228, 0.527968525410046, 0.30097726598159785, 0.0, 4.02200252914952, 3.310749925797576, 2.6398426270502298, 2.020547889937868, 3.0829084743179394, 1.6259449778997108, 1.4126111898806162, 1.0311086978610984, 1.4908382420183437, 1.1782629663177673, 0.6558892032464564, 0.3095623700163725, 0.0),
(4.096469565217392, 3.390359677419355, 3.2745208333333338, 3.5281785326086963, 2.9788235294117644, 1.4413000000000002, 1.4072352941176471, 1.1561666666666668, 1.5390166666666665, 0.6713505882352943, 0.5264312599681021, 0.3002982456140351, 0.0, 4.01765625, 3.303280701754386, 2.632156299840511, 2.0140517647058824, 3.078033333333333, 1.6186333333333336, 1.4072352941176471, 1.0295, 1.4894117647058822, 1.1760595108695657, 0.6549041666666667, 0.30821451612903233, 0.0),
(4.088887433649431, 3.3753860923049697, 3.269511288294468, 3.5213920793075686, 2.975796282847844, 1.4389223543159075, 1.4018126438504073, 1.1509824721841184, 1.5365291647614692, 0.6691785513327417, 0.5248425325378543, 0.29960767373394626, 0.0, 4.013047625171469, 3.2956844110734083, 2.624212662689271, 2.0075356539982248, 3.0730583295229383, 1.6113754610577657, 1.4018126438504073, 1.0278016816542197, 1.487898141423922, 1.1737973597691898, 0.6539022576588936, 0.30685328111863364, 0.0),
(4.080901079501402, 3.3602729080932785, 3.264418752857796, 3.514435819243156, 2.9726011996019257, 1.4364260681806638, 1.3963453600919107, 1.1458385154702029, 1.533994292028654, 0.6669999042470213, 0.5232052257467463, 0.29890593539174876, 0.0, 4.008186942729767, 3.287965289309236, 2.6160261287337314, 2.0009997127410637, 3.067988584057308, 1.604173921658284, 1.3963453600919107, 1.0260186201290455, 1.4863005998009629, 1.1714786064143856, 0.6528837505715593, 0.3054793552812072, 0.0),
(4.072528824476651, 3.345027718040621, 3.259244598765432, 3.507316032608696, 2.969244734931009, 1.4338179698216735, 1.3908355638551717, 1.1407366255144034, 1.5314146090534977, 0.664814698620189, 0.5215222222222223, 0.2981934156378601, 0.0, 4.003084490740741, 3.280127572016461, 2.6076111111111113, 1.9944440958605667, 3.0628292181069954, 1.5970312757201646, 1.3908355638551717, 1.0241556927297668, 1.4846223674655046, 1.169105344202899, 0.6518489197530865, 0.3040934289127838, 0.0),
(4.063788990278524, 3.3296581154033364, 3.253990197759488, 3.5000389995974235, 2.9657333440920954, 1.431104887466342, 1.385285376153205, 1.1356786313062037, 1.528792676421277, 0.6626229860943007, 0.5197964045917264, 0.29747049952269794, 0.0, 3.9977505572702334, 3.272175494749677, 2.5989820229586313, 1.9878689582829017, 3.057585352842554, 1.589950083828685, 1.385285376153205, 1.0222177767616727, 1.4828666720460477, 1.1666796665324748, 0.6507980395518976, 0.30269619230939426, 0.0),
(4.054699898610365, 3.3141716934377627, 3.2486569215820764, 3.492611000402577, 2.9620734823421824, 1.4282936493420721, 1.3796969179990242, 1.1306663618350863, 1.5261310547172688, 0.6604248183114125, 0.5180306554827024, 0.29673757209667984, 0.0, 3.992195430384088, 3.2641132930634775, 2.5901532774135116, 1.9812744549342374, 3.0522621094345377, 1.5829329065691207, 1.3796969179990242, 1.0202097495300515, 1.4810367411710912, 1.1642036668008593, 0.6497313843164153, 0.3012883357670694, 0.0),
(4.045279871175523, 3.298576045400239, 3.2432461419753085, 3.485038315217391, 2.9582716049382722, 1.4253910836762689, 1.3740723104056438, 1.1257016460905351, 1.5234323045267493, 0.6582202469135804, 0.5162278575225944, 0.29599501841022313, 0.0, 3.9864293981481485, 3.255945202512454, 2.581139287612972, 1.9746607407407408, 3.0468646090534985, 1.5759823045267491, 1.3740723104056438, 1.018136488340192, 1.4791358024691361, 1.1616794384057973, 0.6486492283950618, 0.29987054958183995, 0.0),
(4.035547229677343, 3.2828787645471036, 3.2377592306812986, 3.477327224235105, 2.954334167137363, 1.4224040186963371, 1.3684136743860782, 1.1207863130620332, 1.5206989864349947, 0.6560093235428602, 0.5143908933388467, 0.29524322351374555, 0.0, 3.9804627486282587, 3.2476754586512007, 2.571954466694233, 1.9680279706285804, 3.0413979728699894, 1.5691008382868465, 1.3684136743860782, 1.0160028704973836, 1.4771670835686814, 1.1591090747450352, 0.6475518461362598, 0.29844352404973673, 0.0),
(4.025520295819169, 3.267087444134696, 3.2321975594421586, 3.4694840076489535, 2.950267624196455, 1.4193392826296807, 1.3627231309533416, 1.1159221917390643, 1.5179336610272824, 0.6537920998413084, 0.512522645558903, 0.29448257245766457, 0.0, 3.9743057698902606, 3.2393082970343094, 2.5626132277945146, 1.9613762995239248, 3.035867322054565, 1.56229106843469, 1.3627231309533416, 1.0138137733069148, 1.4751338120982276, 1.156494669216318, 0.6464395118884317, 0.2970079494667906, 0.0),
(4.015217391304348, 3.2512096774193546, 3.2265625000000004, 3.4615149456521745, 2.946078431372549, 1.4162037037037039, 1.3570028011204482, 1.1111111111111112, 1.515138888888889, 0.6515686274509805, 0.5106259968102075, 0.2937134502923977, 0.0, 3.9679687500000003, 3.230847953216374, 2.553129984051037, 1.9547058823529413, 3.030277777777778, 1.5555555555555556, 1.3570028011204482, 1.0115740740740742, 1.4730392156862746, 1.1538383152173917, 0.6453125000000001, 0.2955645161290323, 0.0),
(4.004656837836225, 3.235253057657418, 3.2208554240969365, 3.4534263184380034, 2.9417730439226437, 1.413004110145811, 1.3512548059004124, 1.1063549001676574, 1.512317230605091, 0.6493389580139327, 0.5087038297202041, 0.2929362420683625, 0.0, 3.961461977023319, 3.222298662751987, 2.5435191486010202, 1.9480168740417978, 3.024634461210182, 1.5488968602347204, 1.3512548059004124, 1.0092886501041507, 1.4708865219613219, 1.1511421061460014, 0.6441710848193873, 0.2941139143324926, 0.0),
(3.9938569571181493, 3.2192251781052263, 3.21507770347508, 3.445224406199678, 2.937357917103741, 1.4097473301834071, 1.3454812663062485, 1.1016553878981865, 1.5094712467611644, 0.6471031431722211, 0.506759026916337, 0.29215133283597666, 0.0, 3.954795739026063, 3.2136646611957427, 2.5337951345816845, 1.9413094295166629, 3.018942493522329, 1.5423175430574612, 1.3454812663062485, 1.0069623787024338, 1.4686789585518705, 1.148408135399893, 0.6430155406950161, 0.29265683437320245, 0.0),
(3.982836070853462, 3.2031336320191164, 3.2092307098765436, 3.4369154891304357, 2.932839506172839, 1.4064401920438958, 1.3396843033509702, 1.0970144032921811, 1.506603497942387, 0.6448612345679013, 0.50479447102605, 0.29135910764565737, 0.0, 3.9479803240740736, 3.2049501841022305, 2.52397235513025, 1.9345837037037037, 3.013206995884774, 1.5358201646090537, 1.3396843033509702, 1.0046001371742113, 1.4664197530864196, 1.145638496376812, 0.6418461419753088, 0.29119396654719243, 0.0),
(3.971612500745512, 3.1869860126554275, 3.203315815043439, 3.428505847423511, 2.9282242663869384, 1.403089523954682, 1.3338660380475922, 1.0924337753391253, 1.5037165447340346, 0.6426132838430298, 0.5028130446767874, 0.2905599515478225, 0.0, 3.9410260202331964, 3.196159467026047, 2.5140652233839367, 1.927839851529089, 3.007433089468069, 1.5294072854747756, 1.3338660380475922, 1.0022068028247728, 1.4641121331934692, 1.1428352824745038, 0.6406631630086879, 0.28972600115049346, 0.0),
(3.960204568497644, 3.170789913270499, 3.1973343907178786, 3.420001761272142, 2.9235186530030397, 1.3997021541431696, 1.3280285914091288, 1.0879153330285019, 1.500812947721384, 0.6403593426396622, 0.5008176304959931, 0.28975424959288937, 0.0, 3.933943115569273, 3.187296745521783, 2.504088152479966, 1.9210780279189863, 3.001625895442768, 1.5230814662399026, 1.3280285914091288, 0.9997872529594067, 1.4617593265015199, 1.1400005870907142, 0.6394668781435758, 0.2882536284791363, 0.0),
(3.948630595813205, 3.15455292712067, 3.1912878086419756, 3.4114095108695652, 2.9187291212781408, 1.3962849108367628, 1.3221740844485943, 1.0834609053497943, 1.497895267489712, 0.638099462599855, 0.4988111111111112, 0.2889423868312758, 0.0, 3.9267418981481486, 3.1783662551440335, 2.494055555555556, 1.9142983877995645, 2.995790534979424, 1.5168452674897122, 1.3221740844485943, 0.9973463648834019, 1.4593645606390704, 1.1371365036231886, 0.6382575617283952, 0.28677753882915186, 0.0),
(3.936908904395539, 3.138282647462278, 3.185177440557842, 3.4027353764090176, 2.913862126469244, 1.3928446222628663, 1.3163046381790027, 1.0790723212924862, 1.4949660646242953, 0.6358336953656636, 0.4967963691495856, 0.288124748313399, 0.0, 3.919432656035666, 3.169372231447389, 2.4839818457479277, 1.9075010860969903, 2.9899321292485905, 1.5107012498094807, 1.3163046381790027, 0.9948890159020474, 1.456931063234622, 1.1342451254696728, 0.6370354881115684, 0.2852984224965707, 0.0),
(3.925057815947994, 3.1219866675516617, 3.17900465820759, 3.3939856380837363, 2.908924123833347, 1.3893881166488853, 1.3104223736133687, 1.0747514098460602, 1.4920278997104097, 0.6335620925791443, 0.49477628723886047, 0.28730171908967667, 0.0, 3.9120256772976685, 3.1603189099864424, 2.4738814361943025, 1.9006862777374325, 2.9840557994208194, 1.5046519737844843, 1.3104223736133687, 0.9924200833206323, 1.4544620619166735, 1.1313285460279123, 0.6358009316415181, 0.2838169697774238, 0.0),
(3.9130956521739133, 3.1056725806451615, 3.1727708333333338, 3.3851665760869567, 2.9039215686274513, 1.3859222222222223, 1.3045294117647062, 1.0705000000000002, 1.4890833333333333, 0.6312847058823531, 0.4927537480063797, 0.2864736842105264, 0.0, 3.9045312500000002, 3.1512105263157895, 2.4637687400318984, 1.893854117647059, 2.9781666666666666, 1.4987000000000004, 1.3045294117647062, 0.9899444444444444, 1.4519607843137257, 1.1283888586956525, 0.6345541666666669, 0.282333870967742, 0.0),
(3.901040734776645, 3.0893479799991144, 3.1664773376771835, 3.3762844706119166, 2.8988609161085557, 1.382453767210283, 1.298627873646029, 1.0663199207437892, 1.4861349260783419, 0.629001586917346, 0.49073163407958736, 0.2856410287263656, 0.0, 3.896959662208505, 3.142051315990021, 2.4536581703979365, 1.8870047607520375, 2.9722698521566837, 1.492847889041305, 1.298627873646029, 0.9874669765787736, 1.4494304580542778, 1.125428156870639, 0.6332954675354368, 0.28084981636355594, 0.0),
(3.888911385459534, 3.0730204588698617, 3.160125542981253, 3.367345601851852, 2.8937486215336614, 1.3789895798404714, 1.2927198802703526, 1.0622130010669104, 1.4831852385307118, 0.626712787326179, 0.48871282808592753, 0.2848041376876118, 0.0, 3.8893212019890258, 3.1328455145637295, 2.4435641404296375, 1.8801383619785366, 2.9663704770614236, 1.4870982014936747, 1.2927198802703526, 0.9849925570289081, 1.4468743107668307, 1.1224485339506176, 0.6320251085962507, 0.2793654962608966, 0.0),
(3.8767259259259266, 3.05669761051374, 3.1537168209876545, 3.3583562500000004, 2.8885911401597673, 1.3755364883401924, 1.2868075526506901, 1.0581810699588479, 1.4802368312757201, 0.624418358750908, 0.48670021265284436, 0.28396339614468274, 0.0, 3.881626157407408, 3.12359735759151, 2.4335010632642216, 1.8732550762527236, 2.9604736625514403, 1.481453497942387, 1.2868075526506901, 0.9825260631001375, 1.4442955700798836, 1.1194520833333337, 0.630743364197531, 0.27788160095579456, 0.0),
(3.864502677879168, 3.040387028187088, 3.1472525434385004, 3.349322695249598, 2.883394927243874, 1.3721013209368493, 1.280893011800056, 1.0542259564090841, 1.4772922648986433, 0.6221183528335891, 0.48469667040778164, 0.2831191891479958, 0.0, 3.873884816529492, 3.114311080627953, 2.4234833520389083, 1.8663550585007669, 2.9545845297972866, 1.475916338972718, 1.280893011800056, 0.9800723720977494, 1.441697463621937, 1.1164408984165328, 0.6294505086877001, 0.2763988207442808, 0.0),
(3.852259963022604, 3.0240963051462453, 3.140734082075903, 3.340251217793881, 2.878166438042981, 1.3686909058578471, 1.2749783787314652, 1.0503494894071028, 1.4743540999847584, 0.6198128212162782, 0.48270508397818346, 0.2822719017479685, 0.0, 3.8661074674211253, 3.104990919227653, 2.413525419890917, 1.8594384636488344, 2.948708199969517, 1.4704892851699438, 1.2749783787314652, 0.9776363613270336, 1.4390832190214904, 1.1134170725979606, 0.6281468164151807, 0.274917845922386, 0.0),
(3.840016103059581, 3.0078330346475504, 3.1341628086419755, 3.3311480978260866, 2.8729121278140886, 1.3653120713305902, 1.2690657744579317, 1.0465534979423872, 1.4714248971193415, 0.6175018155410315, 0.480728335991494, 0.2814219189950185, 0.0, 3.858304398148148, 3.0956411089452027, 2.40364167995747, 1.852505446623094, 2.942849794238683, 1.465174897119342, 1.2690657744579317, 0.9752229080932786, 1.4364560639070443, 1.1103826992753625, 0.6268325617283951, 0.273439366786141, 0.0),
(3.8277894196934454, 2.9916048099473427, 3.1275400948788294, 3.3220196155394524, 2.867638451814196, 1.3619716455824824, 1.263157319992469, 1.0428398110044201, 1.4685072168876694, 0.6151853874499046, 0.4787693090751571, 0.2805696259395632, 0.0, 3.850485896776406, 3.0862658853351945, 2.3938465453757853, 1.8455561623497134, 2.9370144337753388, 1.4599757354061882, 1.263157319992469, 0.9728368897017731, 1.433819225907098, 1.1073398718464844, 0.6255080189757659, 0.27196407363157665, 0.0),
(3.8155982346275423, 2.9754192243019606, 3.1208673125285786, 3.312872051127214, 2.8623518653003037, 1.3586764568409289, 1.2572551363480924, 1.0392102575826858, 1.465603619875019, 0.612863588584954, 0.47683088585661687, 0.2797154076320202, 0.0, 3.842662251371742, 3.0768694839522217, 2.3841544292830843, 1.8385907657548617, 2.931207239750038, 1.4548943606157603, 1.2572551363480924, 0.9704831834578064, 1.4311759326501519, 1.1042906837090716, 0.6241734625057157, 0.2704926567547237, 0.0),
(3.8034608695652175, 2.9592838709677425, 3.114145833333334, 3.303711684782609, 2.857058823529411, 1.3554333333333337, 1.2513613445378151, 1.0356666666666667, 1.4627166666666667, 0.6105364705882355, 0.47491594896331746, 0.2788596491228071, 0.0, 3.8348437500000006, 3.0674561403508775, 2.374579744816587, 1.8316094117647062, 2.9254333333333333, 1.4499333333333335, 1.2513613445378151, 0.9681666666666668, 1.4285294117647056, 1.10123722826087, 0.6228291666666669, 0.269025806451613, 0.0),
(3.7913956462098173, 2.9432063432010267, 3.1073770290352085, 3.2945447966988723, 2.85176578175852, 1.3522491032871007, 1.2454780655746525, 1.032210867245847, 1.4598489178478888, 0.6082040851018049, 0.4730273810227027, 0.2780027354623413, 0.0, 3.8270406807270234, 3.0580300900857535, 2.3651369051135136, 1.8246122553054143, 2.9196978356957777, 1.4450952141441857, 1.2454780655746525, 0.9658922166336433, 1.42588289087926, 1.0981815988996244, 0.6214754058070417, 0.2675642130182752, 0.0),
(3.7794208862646865, 2.9271942342581534, 3.1005622713763157, 3.285377667069243, 2.846479195244628, 1.3491305949296348, 1.2396074204716179, 1.0288446883097089, 1.4570029340039627, 0.6058664837677185, 0.4711680646622168, 0.2771450517010405, 0.0, 3.819263331618656, 3.0485955687114448, 2.355840323311084, 1.817599451303155, 2.9140058680079255, 1.4403825636335925, 1.2396074204716179, 0.9636647106640249, 1.423239597622314, 1.0951258890230813, 0.6201124542752632, 0.2661085667507413, 0.0),
(3.7675549114331726, 2.91125513739546, 3.093702932098766, 3.2762165760869566, 2.841205519244735, 1.3460846364883403, 1.2337515302417263, 1.0255699588477367, 1.4541812757201646, 0.6035237182280321, 0.4693408825093036, 0.27628698288932213, 0.0, 3.811521990740741, 3.039156811782543, 2.346704412546518, 1.810571154684096, 2.9083625514403293, 1.4357979423868314, 1.2337515302417263, 0.9614890260631003, 1.4206027596223676, 1.0920721920289858, 0.6187405864197533, 0.26465955794504187, 0.0),
(3.75581604341862, 2.895396645869286, 3.086800382944674, 3.26706780394525, 2.8359512090158425, 1.3431180561906215, 1.2279125158979918, 1.0223885078494133, 1.4513865035817708, 0.6011758401248017, 0.46754871719140734, 0.2754289140776037, 0.0, 3.803826946159122, 3.0297180548536407, 2.337743585957037, 1.8035275203744048, 2.9027730071635416, 1.4313439109891786, 1.2279125158979918, 0.9593700401361582, 1.4179756045079213, 1.0890226013150834, 0.6173600765889348, 0.2632178768972078, 0.0),
(3.744201689481218, 2.8796528268881825, 3.0798726094173565, 3.257950164747612, 2.830713514712988, 1.3402362794833866, 1.222105192731354, 1.0193087614634344, 1.4486283748344828, 0.5988304736612731, 0.4657949270768578, 0.274573097883481, 0.0, 3.7961775603372887, 3.0203040767182903, 2.328974635384289, 1.796491420983819, 2.8972567496689656, 1.4270322660488082, 1.222105192731354, 0.957311628202419, 1.415356757356494, 1.0859833882492043, 0.6159745218834713, 0.26178662062619845, 0.0),
(3.732592359160026, 2.8641789672926965, 3.0730152250072065, 3.2489368263832006, 2.8254382278843537, 1.3374327419903105, 1.216403641682116, 1.0163685432508534, 1.4459492047617415, 0.5965315167912784, 0.46408295580754655, 0.2737304057370992, 0.0, 3.788510165664014, 3.0110344631080905, 2.3204147790377325, 1.7895945503738346, 2.891898409523483, 1.4229159605511947, 1.216403641682116, 0.9553091014216503, 1.4127191139421769, 1.0829789421277338, 0.6146030450014414, 0.2603799061175179, 0.0),
(3.720953961201598, 2.848980639517117, 3.066232310902439, 3.240025351554534, 2.820108714103627, 1.3347001529163784, 1.2108119300383124, 1.0135671090464515, 1.4433499971558386, 0.5942825327988078, 0.46241030076180634, 0.27290125275196175, 0.0, 3.7808026526641507, 3.001913780271579, 2.3120515038090312, 1.7828475983964231, 2.886699994311677, 1.4189939526650321, 1.2108119300383124, 0.9533572520831274, 1.4100543570518136, 1.0800084505181782, 0.613246462180488, 0.2589982399561016, 0.0),
(3.709271949295054, 2.8340357031402905, 3.0595107299946247, 3.231199845079921, 2.8147169403690073, 1.3320320713669895, 1.2053209635055788, 1.010896718816499, 1.4408241785637108, 0.5920793358449549, 0.4607737287514322, 0.27208410658291154, 0.0, 3.7730429039023563, 2.9929251724120265, 2.3038686437571605, 1.7762380075348643, 2.8816483571274216, 1.4152554063430987, 1.2053209635055788, 0.9514514795478496, 1.4073584701845037, 1.0770666150266406, 0.611902145998925, 0.25763960937639013, 0.0),
(3.697531777129509, 2.8193220177410643, 3.052837345175329, 3.2224444117776727, 2.8092548736786958, 1.3294220564475412, 1.1999216477895505, 1.0083496325272643, 1.4383651755322937, 0.589917740090813, 0.45917000658821894, 0.2712774348847917, 0.0, 3.76521880194329, 2.9840517837327085, 2.2958500329410945, 1.7697532202724386, 2.8767303510645874, 1.4116894855381699, 1.1999216477895505, 0.9495871831768151, 1.4046274368393479, 1.0741481372592245, 0.6105674690350659, 0.25630200161282407, 0.0),
(3.6857188983940845, 2.804817442898285, 3.0461990193361226, 3.2137431564660996, 2.8037144810308914, 1.3268636672634326, 1.1946048885958631, 1.0059181101450163, 1.4359664146085245, 0.587793559697476, 0.4575959010839617, 0.27047970531244503, 0.0, 3.75731822935161, 2.9752767584368947, 2.287979505419808, 1.7633806790924278, 2.871932829217049, 1.4082853542030227, 1.1946048885958631, 0.9477597623310232, 1.4018572405154457, 1.0712477188220335, 0.6092398038672245, 0.25498340389984414, 0.0),
(3.673818766777897, 2.790499838190801, 3.0395826153685745, 3.2050801839635117, 2.7980877294237922, 1.324350462920061, 1.1893615916301512, 1.0035944116360243, 1.433621322339339, 0.5857026088260373, 0.45604817905045525, 0.26968938552071453, 0.0, 3.749329068691973, 2.9665832407278594, 2.2802408952522764, 1.7571078264781117, 2.867242644678678, 1.405032176290434, 1.1893615916301512, 0.9459646163714721, 1.3990438647118961, 1.0683600613211708, 0.607916523073715, 0.253681803471891, 0.0),
(3.6618168359700647, 2.776347063197458, 3.0329749961642545, 3.196439599088218, 2.792366585855599, 1.3218760025228253, 1.1841826625980507, 1.0013707969665573, 1.4313233252716744, 0.5836407016375906, 0.4545236072994945, 0.2689049431644433, 0.0, 3.741239202529039, 2.9579543748088755, 2.272618036497472, 1.7509221049127714, 2.8626466505433488, 1.40191911575318, 1.1841826625980507, 0.9441971446591609, 1.3961832929277995, 1.0654798663627396, 0.6065949992328509, 0.25239518756340534, 0.0),
(3.6496985596597074, 2.762336977497104, 3.0263630246147293, 3.1878055066585302, 2.7865430173245116, 1.319433845177124, 1.179059007205196, 0.9992395261028846, 1.4290658499524664, 0.5816036522932297, 0.4530189526428745, 0.26812484589847413, 0.0, 3.7330365134274643, 2.9493733048832147, 2.265094763214372, 1.744810956879689, 2.858131699904933, 1.3989353365440385, 1.179059007205196, 0.9424527465550885, 1.3932715086622558, 1.0626018355528437, 0.6052726049229459, 0.2511215434088277, 0.0),
(3.6374493915359416, 2.7484474406685857, 3.0197335636115703, 3.179162011492757, 2.780608990828729, 1.3170175499883545, 1.1739815311572235, 0.9971928590112749, 1.4268423229286518, 0.5795872749540478, 0.45153098189239016, 0.2673475613776501, 0.0, 3.7247088839519082, 2.9408231751541503, 2.2576549094619507, 1.7387618248621433, 2.8536846458573035, 1.3960700026157848, 1.1739815311572235, 0.9407268214202532, 1.3903044954143644, 1.059720670497586, 0.6039467127223141, 0.24985885824259874, 0.0),
(3.6250547852878876, 2.7346563122907503, 3.013073476046346, 3.1704932184092085, 2.774556473366451, 1.314620676061916, 1.1689411401597678, 0.9952230556579972, 1.4246461707471672, 0.5775873837811388, 0.4500564618598364, 0.2665715572568141, 0.0, 3.716244196667029, 2.9322871298249544, 2.2502823092991817, 1.7327621513434162, 2.8492923414943343, 1.3933122779211962, 1.1689411401597678, 0.9390147686156541, 1.3872782366832255, 1.0568310728030696, 0.6026146952092691, 0.24860511929915918, 0.0),
(3.612500194604662, 2.7209414519424455, 3.0063696248106235, 3.1617832322261963, 2.7683774319358765, 1.312236782503206, 1.163928739918464, 0.9933223760093212, 1.4224708199549485, 0.5755997929355963, 0.448592159357008, 0.26579530119080924, 0.0, 3.7076303341374848, 2.923748313098901, 2.2429607967850402, 1.7267993788067884, 2.844941639909897, 1.3906513264130496, 1.163928739918464, 0.93731198750229, 1.3841887159679382, 1.053927744075399, 0.6012739249621247, 0.24735831381294962, 0.0),
(3.5997710731753836, 2.7072807192025174, 2.999608872795975, 3.1530161577620284, 2.7620638335352057, 1.309859428417623, 1.1589352361389478, 0.9914830800315152, 1.4203096970989324, 0.5736203165785135, 0.4471348411957002, 0.26501726083447835, 0.0, 3.6988551789279316, 2.9151898691792613, 2.235674205978501, 1.7208609497355403, 2.840619394197865, 1.3880763120441213, 1.1589352361389478, 0.9356138774411593, 1.3810319167676028, 1.0510053859206763, 0.599921774559195, 0.24611642901841072, 0.0),
(3.5868528746891712, 2.6936519736498146, 2.9927780828939663, 3.1441760998350166, 2.755607645162638, 1.307482172910566, 1.153951534526854, 0.9896974276908488, 1.4181562287260556, 0.5716447688709844, 0.44568127418770764, 0.26423590384266454, 0.0, 3.6899066136030316, 2.9065949422693094, 2.2284063709385378, 1.7149343066129528, 2.8363124574521112, 1.3855763987671883, 1.153951534526854, 0.9339158377932613, 1.377803822581319, 1.0480586999450057, 0.5985556165787933, 0.2448774521499832, 0.0),
(3.5737310528351447, 2.680033074863182, 2.9858641179961682, 3.13524716326347, 2.749000833816373, 1.305098575087432, 1.1489685407878187, 0.987957678953591, 1.416003841383254, 0.5696689639741025, 0.44422822514482535, 0.2634496978702106, 0.0, 3.6807725207274395, 2.897946676572316, 2.2211411257241265, 1.7090068919223071, 2.832007682766508, 1.3831407505350275, 1.1489685407878187, 0.9322132679195942, 1.3745004169081865, 1.0450823877544901, 0.5971728235992337, 0.2436393704421075, 0.0),
(3.5603910613024183, 2.6664018824214697, 2.9788538409941503, 3.1262134528656995, 2.7422353664946106, 1.3027021940536203, 1.1439771606274765, 0.9862560937860104, 1.4138459616174646, 0.5676887160489614, 0.44277246087884836, 0.2626571105719597, 0.0, 3.671440782865815, 2.8892282162915555, 2.2138623043942416, 1.7030661481468838, 2.827691923234929, 1.3807585313004147, 1.1439771606274765, 0.9305015671811573, 1.3711176832473053, 1.0420711509552334, 0.5957707681988301, 0.24240017112922455, 0.0),
(3.546818353780113, 2.652736255903522, 2.9717341147794802, 3.1170590734600148, 2.73530321019555, 1.300286588914529, 1.1389682997514627, 0.9845849321543767, 1.4116760159756234, 0.5656998392566547, 0.4413107482015715, 0.2618566096027546, 0.0, 3.6618992825828154, 2.8804227056303, 2.2065537410078573, 1.6970995177699637, 2.823352031951247, 1.3784189050161275, 1.1389682997514627, 0.9287761349389492, 1.367651605097775, 1.0390196911533385, 0.594346822955896, 0.24115784144577473, 0.0),
(3.532998383957347, 2.6390140548881877, 2.9644918022437268, 3.107768129864726, 2.72819633191739, 1.2978453187755554, 1.1339328638654125, 0.9829364540249584, 1.4094874310046666, 0.5636981477582759, 0.4398398539247897, 0.2610466626174385, 0.0, 3.6521359024430993, 2.8715132887918227, 2.199199269623948, 1.6910944432748272, 2.818974862009333, 1.3761110356349417, 1.1339328638654125, 0.9270323705539681, 1.364098165958695, 1.0359227099549089, 0.5928983604487453, 0.2399103686261989, 0.0),
(3.5189166055232377, 2.625213138954313, 2.9571137662784603, 3.098324726898143, 2.7209066986583315, 1.295371942742099, 1.1288617586749619, 0.9813029193640249, 1.4072736332515314, 0.5616794557149186, 0.43835654486029796, 0.2602257372708542, 0.0, 3.6421385250113247, 2.8624831099793955, 2.1917827243014893, 1.6850383671447555, 2.814547266503063, 1.373824087109635, 1.1288617586749619, 0.9252656733872135, 1.3604533493291657, 1.0327749089660478, 0.5914227532556922, 0.2386557399049376, 0.0),
(3.504558472166904, 2.611311367680746, 2.9495868697752488, 3.0887129693785758, 2.7134262774165743, 1.2928600199195572, 1.123745889885745, 0.9796765881378455, 1.4050280492631537, 0.5596395772876765, 0.43685758781989104, 0.2593923012178448, 0.0, 3.6318950328521504, 2.853315313396292, 2.184287939099455, 1.6789187318630292, 2.8100560985263074, 1.3715472233929837, 1.123745889885745, 0.9234714427996837, 1.3567131387082871, 1.0295709897928589, 0.5899173739550498, 0.2373919425164315, 0.0),
(3.4899094375774653, 2.5972866006463327, 2.9418979756256616, 3.0789169621243357, 2.705747035190316, 1.2903031094133288, 1.118576163203398, 0.9780497203126887, 1.40274410558647, 0.5575743266376434, 0.43533974961536415, 0.25854482211325314, 0.0, 3.6213933085302346, 2.843993043245784, 2.1766987480768205, 1.6727229799129297, 2.80548821117294, 1.3692696084377642, 1.118576163203398, 0.9216450781523777, 1.352873517595158, 1.0263056540414455, 0.5883795951251324, 0.2361169636951212, 0.0),
(3.474954955444038, 2.583116697429922, 2.934033946721268, 3.068920809953731, 2.697860938977758, 1.287694770328812, 1.1133434843335557, 0.9764145758548239, 1.4004152287684173, 0.5554795179259124, 0.43379979705851196, 0.25768176761192224, 0.0, 3.6106212346102335, 2.8344994437311444, 2.1689989852925597, 1.6664385537777369, 2.8008304575368346, 1.3669804061967537, 1.1133434843335557, 0.9197819788062943, 1.348930469488879, 1.0229736033179107, 0.5868067893442537, 0.23482879067544749, 0.0),
(3.4596804794557414, 2.5687795176103587, 2.9259816459536365, 3.058708617685074, 2.689759955777099, 1.285028561771405, 1.1080387589818537, 0.9747634147305201, 1.3980348453559306, 0.5533509653135777, 0.4322344969611296, 0.2568016053686951, 0.0, 3.599566693656808, 2.824817659055646, 2.1611724848056477, 1.660052895940733, 2.796069690711861, 1.3646687806227282, 1.1080387589818537, 0.917877544122432, 1.3448799778885494, 1.0195695392283581, 0.5851963291907273, 0.23352541069185084, 0.0),
(3.444071463301694, 2.554252920766492, 2.9177279362143365, 3.0482644901366713, 2.681436052586538, 1.282298042846506, 1.102652892853927, 0.9730884969060463, 1.3955963818959474, 0.5511844829617324, 0.43064061613501187, 0.2559028030384148, 0.0, 3.5882175682346147, 2.814930833422562, 2.153203080675059, 1.6535534488851968, 2.7911927637918947, 1.362323895668465, 1.102652892853927, 0.9159271734617901, 1.340718026293269, 1.0160881633788907, 0.5835455872428673, 0.23220481097877202, 0.0),
(3.4281133606710137, 2.5395147664771676, 2.9092596803949373, 3.0375725321268376, 2.6728811964042754, 1.279496772659513, 1.0971767916554112, 0.9713820823476715, 1.3930932649354042, 0.5489758850314703, 0.42901492139195374, 0.25498382827592403, 0.0, 3.5765617409083106, 2.804822111035164, 2.145074606959769, 1.6469276550944105, 2.7861865298708084, 1.3599349152867402, 1.0971767916554112, 0.9139262661853664, 1.3364405982021377, 1.0125241773756128, 0.5818519360789874, 0.23086497877065162, 0.0),
(3.4117916252528193, 2.5245429143212332, 2.900563741387006, 3.0266168484738794, 2.6640873542285117, 1.2766183103158248, 1.0916013610919408, 0.9696364310216651, 1.3905189210212374, 0.5467209856838848, 0.4273541795437502, 0.254043148736066, 0.0, 3.5645870942425564, 2.794474636096725, 2.136770897718751, 1.640162957051654, 2.781037842042475, 1.3574910034303311, 1.0916013610919408, 0.9118702216541607, 1.3320436771142559, 1.0088722828246266, 0.5801127482774012, 0.22950390130193032, 0.0),
(3.3950917107362275, 2.509315223877536, 2.8916269820821134, 3.015381543996108, 2.6550464930574442, 1.2736562149208395, 1.085917506869152, 0.9678438028942958, 1.387866776700383, 0.5444155990800699, 0.4256551574021961, 0.2530792320736836, 0.0, 3.5522815108020076, 2.7838715528105187, 2.1282757870109803, 1.6332467972402092, 2.775733553400766, 1.354981324052014, 1.085917506869152, 0.9097544392291711, 1.3275232465287221, 1.0051271813320362, 0.5783253964164228, 0.22811956580704876, 0.0),
(3.3779990708103593, 2.4938095547249226, 2.882436265371829, 3.0038507235118335, 2.6457505798892744, 1.2706040455799552, 1.0801161346926793, 0.9659964579318328, 1.3851302585197776, 0.5420555393811187, 0.42391462177908634, 0.25209054594361974, 0.0, 3.539632873151326, 2.7729960053798166, 2.1195731088954313, 1.6261666181433558, 2.770260517039555, 1.352395041104566, 1.0801161346926793, 0.9075743182713966, 1.3228752899446372, 1.0012835745039448, 0.5764872530743659, 0.22670995952044753, 0.0),
(3.3604991591643323, 2.478003766442241, 2.8729784541477206, 2.992008491839366, 2.636191581722201, 1.2674553613985702, 1.074188150268159, 0.9640866561005451, 1.3823027930263572, 0.5396366207481252, 0.422129339486216, 0.2510755580007175, 0.0, 3.5266290638551654, 2.761831138007892, 2.1106466974310796, 1.6189098622443754, 2.7646055860527143, 1.3497213185407633, 1.074188150268159, 0.9053252581418358, 1.3180957908611004, 0.9973361639464555, 0.5745956908295441, 0.2252730696765674, 0.0),
(3.3425774294872626, 2.4618757186083373, 2.863240411301357, 2.9798389537970165, 2.626361465554423, 1.2642037214820832, 1.0681244593012253, 0.962106657366702, 1.3793778067670588, 0.5371546573421829, 0.4202960773353799, 0.25003273589981984, 0.0, 3.5132579654781866, 2.750360094898018, 2.101480386676899, 1.6114639720265485, 2.7587556135341176, 1.3469493203133829, 1.0681244593012253, 0.903002658201488, 1.3131807327772116, 0.9932796512656723, 0.5726480822602714, 0.2238068835098489, 0.0),
(3.32421933546827, 2.4454032708020597, 2.8532089997243086, 2.9673262142030925, 2.616252198384141, 1.2608426849358916, 1.0619159674975138, 0.960048721696572, 1.3763487262888197, 0.5346054633243854, 0.4184116021383729, 0.2489605472957697, 0.0, 3.499507460585047, 2.738566020253466, 2.0920580106918645, 1.603816389973156, 2.7526974525776393, 1.3440682103752009, 1.0619159674975138, 0.9006019178113511, 1.3081260991920705, 0.9891087380676977, 0.5706417999448617, 0.22230938825473273, 0.0),
(3.305410330796474, 2.4285642826022547, 2.8428710823081427, 2.954454377875907, 2.6058557472095543, 1.2573658108653942, 1.0555535805626597, 0.9579051090564249, 1.3732089781385746, 0.5319848528558261, 0.4164726807069901, 0.24785745984341, 0.0, 3.485365431740406, 2.7264320582775095, 2.0823634035349503, 1.595954558567478, 2.746417956277149, 1.3410671526789948, 1.0555535805626597, 0.8981184363324245, 1.3029278736047771, 0.9848181259586359, 0.5685742164616286, 0.22077857114565957, 0.0),
(3.286135869160991, 2.41133661358777, 2.8322135219444298, 2.9412075496337686, 2.595164079028862, 1.2537666583759894, 1.0490282042022987, 0.9556680794125294, 1.3699519888632605, 0.5292886400975989, 0.41447607985302637, 0.24672194119758384, 0.0, 3.47081976150892, 2.7139413531734218, 2.072380399265132, 1.5878659202927965, 2.739903977726521, 1.3379353111775412, 1.0490282042022987, 0.8955476131257067, 1.297582039514431, 0.9804025165445898, 0.566442704388886, 0.21921241941707004, 0.0),
(3.2663814042509403, 2.393698123337452, 2.821223181524739, 2.927569834294988, 2.584169160840265, 1.2500387865730758, 1.042330744122066, 0.9533298927311545, 1.3665711850098141, 0.5265126392107972, 0.4124185663882766, 0.24555245901313405, 0.0, 3.4558583324552474, 2.701077049144474, 2.062092831941383, 1.5795379176323912, 2.7331423700196282, 1.3346618498236165, 1.042330744122066, 0.8928848475521969, 1.2920845804201324, 0.9758566114316628, 0.5642446363049479, 0.21760892030340476, 0.0),
(3.24613238975544, 2.375626671430148, 2.8098869239406365, 2.913525336677874, 2.5728629596419603, 1.2461757545620502, 1.0354521060275963, 0.9508828089785692, 1.3630599931251721, 0.5236526643565147, 0.4102969071245358, 0.24434748094490372, 0.0, 3.4404690271440472, 2.6878222903939406, 2.051484535622679, 1.5709579930695439, 2.7261199862503442, 1.331235932569997, 1.0354521060275963, 0.8901255389728929, 1.2864314798209802, 0.9711751122259582, 0.5619773847881274, 0.21596606103910437, 0.0),
(3.2253742793636087, 2.3571001174447055, 2.7981916120836945, 2.899058161600739, 2.56123744243215, 1.2421711214483127, 1.0283831956245253, 0.9483190881210429, 1.3594118397562704, 0.5207045296958448, 0.4081078688735989, 0.24310547464773571, 0.0, 3.4246397281399767, 2.6741602211250926, 2.0405393443679944, 1.562113589087534, 2.718823679512541, 1.3276467233694602, 1.0283831956245253, 0.8872650867487947, 1.280618721216075, 0.9663527205335799, 0.5596383224167389, 0.21428182885860964, 0.0),
(3.204092526764565, 2.338096320959971, 2.7861241088454816, 2.884152413881891, 2.549284576209032, 1.2380184463372599, 1.0211149186184882, 0.9456309901248444, 1.355620151450045, 0.5176640493898814, 0.40584821844726066, 0.24182490777647309, 0.0, 3.408358318007695, 2.6600739855412034, 2.0292410922363033, 1.5529921481696438, 2.71124030290009, 1.3238833861747823, 1.0211149186184882, 0.8842988902408999, 1.274642288104516, 0.9613841379606305, 0.5572248217690964, 0.21255421099636107, 0.0),
(3.182272585647426, 2.3185931415547922, 2.773671277117565, 2.8687921983396416, 2.5369963279708068, 1.2337112883342916, 1.0136381807151202, 0.9428107749562428, 1.3516783547534337, 0.5145270375997177, 0.40351472265731625, 0.24050424798595882, 0.0, 3.3916126793118586, 2.6455467278455465, 2.017573613286581, 1.5435811127991528, 2.7033567095068674, 1.31993508493874, 1.0136381807151202, 0.8812223488102082, 1.2684981639854034, 0.956264066113214, 0.5547342554235131, 0.21078119468679934, 0.0),
(3.15989990970131, 2.2985684388080165, 2.7608199797915143, 2.852961619792299, 2.524364664715674, 1.2292432065448047, 1.0059438876200566, 0.9398507025815073, 1.347579876213372, 0.5112893084864479, 0.40110414831556035, 0.23914196293103576, 0.0, 3.3743906946171274, 2.630561592241393, 2.0055207415778016, 1.5338679254593435, 2.695159752426744, 1.3157909836141102, 1.0059438876200566, 0.8780308618177176, 1.262182332357837, 0.9509872065974332, 0.5521639959583029, 0.20896076716436518, 0.0),
(3.1369599526153373, 2.27800007229849, 2.747557079758901, 2.836644783058176, 2.5113815534418316, 1.2246077600741982, 0.998022945038933, 0.9367430329669069, 1.343318142376796, 0.5079466762111651, 0.3986132622337882, 0.237736520266547, 0.0, 3.356680246488159, 2.6151017229320166, 1.9930663111689406, 1.523840028633495, 2.686636284753592, 1.3114402461536696, 0.998022945038933, 0.8747198286244273, 1.2556907767209158, 0.9455482610193922, 0.5495114159517802, 0.2070909156634991, 0.0),
(3.1134381680786243, 2.2568659016050607, 2.7338694399112895, 2.81982579295558, 2.4980389611474814, 1.2197985080278704, 0.9898662586773839, 0.9334800260787104, 1.338886579790643, 0.504494954934963, 0.39603883122379446, 0.2362863876473355, 0.0, 3.338469217489611, 2.59915026412069, 1.9801941561189722, 1.5134848648048886, 2.677773159581286, 1.3068720365101947, 0.9898662586773839, 0.871284648591336, 1.2490194805737407, 0.9399419309851935, 0.546773887982258, 0.20516962741864192, 0.0),
(3.0893200097802915, 2.2351437863065757, 2.719743923140253, 2.802488754302823, 2.4843288548308213, 1.2148090095112194, 0.9814647342410456, 0.9300539418831871, 1.3342786150018489, 0.5009299588189354, 0.3933776220973742, 0.2347900327282442, 0.0, 3.319745490186143, 2.5826903600106856, 1.9668881104868707, 1.502789876456806, 2.6685572300036977, 1.302075518636462, 0.9814647342410456, 0.8677207210794424, 1.2421644274154107, 0.9341629181009412, 0.5439487846280506, 0.20319488966423419, 0.0),
(3.0645909314094544, 2.212811585981881, 2.705167392337359, 2.7846177719182137, 2.470243201490052, 1.2096328236296434, 0.9728092774355522, 0.926457040346606, 1.3294876745573503, 0.49724750202417556, 0.39062640166632223, 0.2332459231641161, 0.0, 3.3004969471424106, 2.565705154805277, 1.953132008331611, 1.4917425060725265, 2.6589753491147006, 1.2970398564852486, 0.9728092774355522, 0.8640234454497453, 1.235121600745026, 0.928205923972738, 0.5410334784674719, 0.2011646896347165, 0.0),
(3.0392363866552325, 2.1898471602098257, 2.6901267103941757, 2.7661969506200625, 2.455773968123373, 1.204263509488541, 0.96389079396654, 0.9226815814352365, 1.3245071850040835, 0.4934433987117774, 0.38778193674243366, 0.23165252660979413, 0.0, 3.280711470923074, 2.548177792707735, 1.9389096837121682, 1.480330196135332, 2.649014370008167, 1.2917542140093312, 0.96389079396654, 0.8601882210632436, 1.2278869840616864, 0.9220656502066877, 0.5380253420788351, 0.19907701456452961, 0.0),
(3.013241829206745, 2.1662283685692554, 2.674608740202273, 2.7472103952266815, 2.4409131217289826, 1.19869462619331, 0.9547001895396439, 0.9187198251153471, 1.319330572888985, 0.4895134630428343, 0.38484099413750333, 0.2300083107201213, 0.0, 3.2603769440927906, 2.5300914179213336, 1.9242049706875164, 1.4685403891285025, 2.63866114577797, 1.2862077551614859, 0.9547001895396439, 0.8562104472809356, 1.2204565608644913, 0.915736798408894, 0.5349217480404546, 0.19692985168811414, 0.0),
(2.985872378562096, 2.141499477616495, 2.6578639846341185, 2.7269308744953733, 2.424981628232266, 1.1925723778073256, 0.9450213441855715, 0.9142994920582287, 1.3135549455465463, 0.48533659162911447, 0.38170638350259617, 0.22825331880647803, 0.0, 3.238594343766138, 2.510786506871258, 1.908531917512981, 1.456009774887343, 2.6271098910930926, 1.2800192888815203, 0.9450213441855715, 0.8518374127195183, 1.212490814116133, 0.9089769581651246, 0.5315727969268238, 0.19468177069240863, 0.0),
(2.9529147067913613, 2.1131239505198085, 2.635579272800996, 2.7011931476365363, 2.4040510159417674, 1.1838609178683244, 0.9336425526771432, 0.9078689221273971, 1.3048569681629525, 0.48022809940987465, 0.37782779570793296, 0.22604541745610365, 0.0, 3.210171058768078, 2.48649959201714, 1.8891389785396648, 1.4406842982296237, 2.609713936325905, 1.271016490978356, 0.9336425526771432, 0.8456149413345173, 1.2020255079708837, 0.9003977158788457, 0.5271158545601993, 0.1921021773199826, 0.0),
(2.913948837961724, 2.0808688004649283, 2.6073069859852964, 2.669573253122658, 2.3777120350258123, 1.1723463024111265, 0.9204487496767568, 0.8992665315878912, 1.2929900302971533, 0.4741205651862895, 0.3731506339073027, 0.22335006496292825, 0.0, 3.1745682435574323, 2.4568507145922105, 1.8657531695365135, 1.422361695558868, 2.5859800605943066, 1.2589731442230476, 0.9204487496767568, 0.8373902160079474, 1.1888560175129061, 0.8898577510408863, 0.5214613971970593, 0.18916989095135714, 0.0),
(2.869288821834384, 2.0449443182961717, 2.5733489906367697, 2.6323717511270184, 2.34623816647523, 1.1581680230330733, 0.9055362892013753, 0.8886000888516301, 1.278110635599869, 0.4670658193170939, 0.3677161103066472, 0.22019224896358572, 0.0, 3.132149617927639, 2.4221147385994426, 1.8385805515332359, 1.4011974579512814, 2.556221271199738, 1.2440401243922823, 0.9055362892013753, 0.8272628735950524, 1.173119083237615, 0.877457250375673, 0.514669798127354, 0.18590402893601563, 0.0),
(2.8192487081705426, 2.005560794857854, 2.5340071532051653, 2.5898892018228983, 2.3099028912808546, 1.1414655713315065, 0.8890015252679618, 0.8759773623305338, 1.2603752877218182, 0.45911569216102327, 0.3615654371119081, 0.21659695709470983, 0.0, 3.0832789016721334, 2.382566528041808, 1.8078271855595405, 1.3773470764830695, 2.5207505754436363, 1.2263683072627474, 0.8890015252679618, 0.815332550951076, 1.1549514456404273, 0.8632964006076329, 0.5068014306410331, 0.18232370862344133, 0.0),
(2.7641425467313994, 1.9629285209942922, 2.4895833401402343, 2.5424261653835805, 2.268979690433517, 1.122378438903767, 0.8709408118934802, 0.8615061204365209, 1.2399404903137208, 0.4503220140768126, 0.35473982652902725, 0.21258917699293448, 0.0, 3.0283198145843517, 2.338480946922279, 1.7736991326451361, 1.3509660422304375, 2.4798809806274416, 1.2061085686111293, 0.8709408118934802, 0.8016988849312622, 1.1344898452167584, 0.8474753884611936, 0.4979166680280469, 0.1784480473631175, 0.0),
(2.704284387278154, 1.917257787549801, 2.4403794178917257, 2.4902832019823453, 2.2237420449240504, 1.1010461173471968, 0.8514505030948932, 0.8452941315815116, 1.2169627470262965, 0.440736615423197, 0.34728049076394646, 0.20819389629489346, 0.0, 2.9676360764577314, 2.290132859243828, 1.736402453819732, 1.3222098462695906, 2.433925494052593, 1.1834117842141163, 0.8514505030948932, 0.7864615123908549, 1.1118710224620252, 0.830094400660782, 0.4880758835783452, 0.17429616250452737, 0.0),
(2.639988279572007, 1.8687588853686983, 2.3866972529093897, 2.433760871792476, 2.174463435743286, 1.077608098259137, 0.8306269528891644, 0.8274491641774244, 1.191598561510264, 0.43041132655891146, 0.3392286420226075, 0.2034361026372207, 0.0, 2.901591407085708, 2.237797129009427, 1.6961432101130374, 1.291233979676734, 2.383197123020528, 1.1584288298483942, 0.8306269528891644, 0.7697200701850978, 1.087231717871643, 0.8112536239308255, 0.477339450581878, 0.16988717139715442, 0.0),
(2.571568273374159, 1.8176421052952998, 2.3288387116429763, 2.3731597349872504, 2.121417343882057, 1.0522038732369288, 0.8085665152932573, 0.8080789866361796, 1.164004437416343, 0.41939797784269134, 0.330625492510952, 0.19834078365655008, 0.0, 2.830549526261718, 2.1817486202220504, 1.6531274625547598, 1.2581939335280736, 2.328008874832686, 1.1313105812906514, 0.8085665152932573, 0.7515741951692348, 1.0607086719410286, 0.7910532449957504, 0.4657677423285953, 0.16524019139048182, 0.0),
(2.4993384184458094, 1.764117738173922, 2.267105660542235, 2.308780351739953, 2.0648772503311945, 1.0249729338779137, 0.785365544324135, 0.7872913673696962, 1.1343368783952532, 0.40774839963327153, 0.3215122544349219, 0.1929329269895153, 0.0, 2.7548741537791983, 2.122262196884668, 1.607561272174609, 1.2232451988998143, 2.2686737567905064, 1.1022079143175747, 0.785365544324135, 0.7321235241985098, 1.0324386251655973, 0.7695934505799846, 0.45342113210844703, 0.16037433983399293, 0.0),
(2.4236127645481584, 1.7083960748488805, 2.201799966056916, 2.240923282223864, 2.005116636081531, 0.9960547717794331, 0.7611203939987609, 0.7651940747898933, 1.102752388097714, 0.3955144222893873, 0.31193014000045877, 0.1872375202727504, 0.0, 2.674929009431585, 2.0596127230002543, 1.5596507000022939, 1.1865432668681617, 2.205504776195428, 1.0712717047058506, 0.7611203939987609, 0.7114676941281666, 1.0025583180407656, 0.7469744274079547, 0.4403599932113833, 0.15530873407717097, 0.0),
(2.344705361442406, 1.6506874061644923, 2.13322349463677, 2.169889086612265, 1.9424089821238986, 0.9655888785388289, 0.7359274183340984, 0.7418948773086909, 1.0694074701744452, 0.3827478761697738, 0.3019203614135046, 0.1812795511428891, 0.0, 2.591077813012314, 1.9940750625717798, 1.509601807067523, 1.148243628509321, 2.1388149403488903, 1.0386528282321672, 0.7359274183340984, 0.6897063418134491, 0.9712044910619493, 0.7232963622040884, 0.426644698927354, 0.15006249146949932, 0.0),
(2.2629302588897535, 1.5912020229650736, 2.061678112731545, 2.095978325078436, 1.8770277694491289, 0.9337147457534416, 0.7098829713471106, 0.717501543338008, 1.0344586282761652, 0.36950059163316584, 0.2915241308800011, 0.1750840072365653, 0.0, 2.503684284314822, 1.9259240796022181, 1.4576206544000057, 1.1085017748994974, 2.0689172565523304, 1.0045021606732112, 0.7098829713471106, 0.6669391041096011, 0.9385138847245644, 0.6986594416928121, 0.412335622546309, 0.14465472936046128, 0.0),
(2.1786015066514, 1.53015021609494, 1.9874656867909928, 2.0194915577956607, 1.809246479048055, 0.900571865020613, 0.6830834070547611, 0.6921218412897638, 0.9980623660535942, 0.35582439903829893, 0.2807826606058899, 0.16867587619041288, 0.0, 2.413112143132546, 1.8554346380945415, 1.4039133030294495, 1.0674731971148965, 1.9961247321071884, 0.9689705778056694, 0.6830834070547611, 0.6432656178718664, 0.9046232395240275, 0.6731638525985537, 0.3974931373581986, 0.13910456509954003, 0.0),
(2.092033154488546, 1.4677422763984087, 1.9108880832648623, 1.940729344937219, 1.7393385919115076, 0.8662997279376846, 0.6556250794740132, 0.6658635395758785, 0.9603751871574514, 0.3417711287439081, 0.26973716279711296, 0.16208014564106574, 0.0, 2.3197251092589215, 1.7828816020517226, 1.3486858139855649, 1.025313386231724, 1.9207503743149028, 0.9322089554062299, 0.6556250794740132, 0.618785519955489, 0.8696692959557538, 0.6469097816457398, 0.3821776166529725, 0.13343111603621902, 0.0),
(2.003539252162392, 1.4041884947197956, 1.832247168602904, 1.8599922466763927, 1.6675775890303204, 0.8310378261019976, 0.62760434262183, 0.6388344066082706, 0.9215535952384564, 0.32739261110872825, 0.25842884965961194, 0.1553218032251575, 0.0, 2.223886902487385, 1.7085398354767325, 1.2921442482980594, 0.9821778333261846, 1.8431071904769127, 0.8943681692515789, 0.62760434262183, 0.5935984472157125, 0.8337887945151602, 0.6199974155587977, 0.36644943372058086, 0.12765349951998142, 0.0),
(1.9134338494341376, 1.3396991619034166, 1.7518448092548675, 1.7775808231864623, 1.5942369513953243, 0.7949256511108933, 0.5991175505151751, 0.6111422107988601, 0.8817540939473285, 0.31274067649149473, 0.24689893339932856, 0.1484258365793223, 0.0, 2.1259612426113734, 1.632684202372545, 1.2344946669966426, 0.9382220294744841, 1.763508187894657, 0.8555990951184042, 0.5991175505151751, 0.5678040365077809, 0.7971184756976621, 0.5925269410621542, 0.3503689618509735, 0.12179083290031062, 0.0),
(1.8220309960649823, 1.274484568793588, 1.6699828716705027, 1.6937956346407104, 1.5195901599973516, 0.7581026945617134, 0.5702610571710116, 0.582894720559566, 0.8411331869347874, 0.2978671552509425, 0.23518862622220466, 0.14141723334019382, 0.0, 2.026311849424323, 1.5555895667421318, 1.1759431311110233, 0.8936014657528273, 1.682266373869575, 0.8160526087833925, 0.5702610571710116, 0.5415019246869381, 0.7597950799986758, 0.5645985448802369, 0.33399657433410057, 0.11586223352668984, 0.0),
(1.7296447418161276, 1.2087550062346268, 1.5869632222995596, 1.6089372412124177, 1.4439106958272347, 0.720708448051799, 0.541131216606303, 0.5541997043023082, 0.7998473778515522, 0.28282387774580675, 0.22333914033418203, 0.134320981144406, 0.0, 1.9253024427196697, 1.4775307925884658, 1.11669570167091, 0.84847163323742, 1.5996947557031045, 0.7758795860232315, 0.541131216606303, 0.5147917486084279, 0.7219553479136174, 0.5363124137374726, 0.31739264445991194, 0.10988681874860246, 0.0),
(1.636589136448773, 1.1427207650708489, 1.503087727591788, 1.5233062030748648, 1.3674720398758062, 0.6828824031784915, 0.5118243828380126, 0.5251649304390055, 0.7580531703483426, 0.2676626743348225, 0.21139168794120244, 0.12716206762859264, 0.0, 1.82329674229085, 1.3987827439145188, 1.056958439706012, 0.8029880230044673, 1.5161063406966853, 0.7352309026146077, 0.5118243828380126, 0.48777314512749387, 0.6837360199379031, 0.5077687343582884, 0.3006175455183576, 0.10388370591553173, 0.0),
(1.5431782297241188, 1.0765921361465705, 1.4186582539969381, 1.437203080401335, 1.290547673133897, 0.6447640515391326, 0.4824369098831035, 0.4958981673815776, 0.715907068075878, 0.25243537537672506, 0.19938748124920752, 0.1199654804293876, 0.0, 1.7206584679313008, 1.3196202847232632, 0.9969374062460375, 0.757306126130175, 1.431814136151756, 0.6942574343342086, 0.4824369098831035, 0.46054575109938045, 0.6452738365669485, 0.47906769346711175, 0.2837316507993876, 0.09787201237696096, 0.0),
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0),
)
passenger_allighting_rate = (
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
(0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1, 0, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 0.07692307692307693, 1),
)
entropy = 8991598675325360468762009371570610170
child_seed_index = (
1,
59,
)
| true
| true
|
f70a4ac2929e2a599d2d671f614c03a61a104b68
| 1,788
|
py
|
Python
|
tests/parsers/plist_plugins/spotlight_volume.py
|
nflexfo/plaso
|
5da7aa51c39b593773687fdf20a93ba35fc492b4
|
[
"Apache-2.0"
] | 1
|
2020-12-04T10:26:34.000Z
|
2020-12-04T10:26:34.000Z
|
tests/parsers/plist_plugins/spotlight_volume.py
|
nflexfo/plaso
|
5da7aa51c39b593773687fdf20a93ba35fc492b4
|
[
"Apache-2.0"
] | null | null | null |
tests/parsers/plist_plugins/spotlight_volume.py
|
nflexfo/plaso
|
5da7aa51c39b593773687fdf20a93ba35fc492b4
|
[
"Apache-2.0"
] | null | null | null |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Tests for the Spotlight Volume configuration plist plugin."""
from __future__ import unicode_literals
import unittest
from plaso.parsers.plist_plugins import spotlight_volume
from tests.parsers.plist_plugins import test_lib
class SpotlightVolumePluginTest(test_lib.PlistPluginTestCase):
"""Tests for the Spotlight Volume configuration plist plugin."""
def testProcess(self):
"""Tests the Process function."""
plist_name = 'VolumeConfiguration.plist'
plugin = spotlight_volume.SpotlightVolumePlugin()
storage_writer = self._ParsePlistFileWithPlugin(
plugin, [plist_name], plist_name)
self.assertEqual(storage_writer.number_of_warnings, 0)
self.assertEqual(storage_writer.number_of_events, 2)
# The order in which PlistParser generates events is nondeterministic
# hence we sort the events.
events = list(storage_writer.GetSortedEvents())
expected_timestamps = [1369657656000000, 1372139683000000]
timestamps = sorted([event.timestamp for event in events])
self.assertEqual(timestamps, expected_timestamps)
event = events[1]
event_data = self._GetEventDataOfEvent(storage_writer, event)
self.assertEqual(event_data.key, '')
self.assertEqual(event_data.root, '/Stores')
expected_description = (
'Spotlight Volume 4D4BFEB5-7FE6-4033-AAAA-AAAABBBBCCCCDDDD '
'(/.MobileBackups) activated.')
self.assertEqual(event_data.desc, expected_description)
expected_message = '/Stores/ {0:s}'.format(expected_description)
expected_short_message = '{0:s}...'.format(expected_message[:77])
self._TestGetMessageStrings(
event_data, expected_message, expected_short_message)
if __name__ == '__main__':
unittest.main()
| 31.928571
| 73
| 0.748881
|
from __future__ import unicode_literals
import unittest
from plaso.parsers.plist_plugins import spotlight_volume
from tests.parsers.plist_plugins import test_lib
class SpotlightVolumePluginTest(test_lib.PlistPluginTestCase):
def testProcess(self):
plist_name = 'VolumeConfiguration.plist'
plugin = spotlight_volume.SpotlightVolumePlugin()
storage_writer = self._ParsePlistFileWithPlugin(
plugin, [plist_name], plist_name)
self.assertEqual(storage_writer.number_of_warnings, 0)
self.assertEqual(storage_writer.number_of_events, 2)
events = list(storage_writer.GetSortedEvents())
expected_timestamps = [1369657656000000, 1372139683000000]
timestamps = sorted([event.timestamp for event in events])
self.assertEqual(timestamps, expected_timestamps)
event = events[1]
event_data = self._GetEventDataOfEvent(storage_writer, event)
self.assertEqual(event_data.key, '')
self.assertEqual(event_data.root, '/Stores')
expected_description = (
'Spotlight Volume 4D4BFEB5-7FE6-4033-AAAA-AAAABBBBCCCCDDDD '
'(/.MobileBackups) activated.')
self.assertEqual(event_data.desc, expected_description)
expected_message = '/Stores/ {0:s}'.format(expected_description)
expected_short_message = '{0:s}...'.format(expected_message[:77])
self._TestGetMessageStrings(
event_data, expected_message, expected_short_message)
if __name__ == '__main__':
unittest.main()
| true
| true
|
f70a4acf2ec4271147663a6bc4e1d881de4e042a
| 508
|
py
|
Python
|
mapbox_tilesets/errors.py
|
bozdoz/tilesets-cli
|
05a00bf7ec9e88bc123ffc3833ff4fd47e6bb1f9
|
[
"BSD-2-Clause"
] | null | null | null |
mapbox_tilesets/errors.py
|
bozdoz/tilesets-cli
|
05a00bf7ec9e88bc123ffc3833ff4fd47e6bb1f9
|
[
"BSD-2-Clause"
] | null | null | null |
mapbox_tilesets/errors.py
|
bozdoz/tilesets-cli
|
05a00bf7ec9e88bc123ffc3833ff4fd47e6bb1f9
|
[
"BSD-2-Clause"
] | null | null | null |
"""Error handling for the tilesets CLI"""
class TilesetsError(Exception):
"""Base Tilesets error
Deriving errors from this base isolates module development
problems from Python usage problems.
"""
exit_code = 1
def __init__(self, message):
"""Error constructor
Parameters
----------
message: str
Error description
"""
self.message = message
class TilesetNameError(TilesetsError):
"""Not a valid tileset id
"""
| 20.32
| 62
| 0.610236
|
class TilesetsError(Exception):
exit_code = 1
def __init__(self, message):
self.message = message
class TilesetNameError(TilesetsError):
| true
| true
|
f70a4b45aadb056434a71d7ec721b0fdf2efa485
| 6,084
|
py
|
Python
|
webdriver/tests/find_elements_from_shadow_root/find.py
|
jimmywarting/wpt
|
75d80fa43c763935dff59b3c6b21f4dffa9b03b7
|
[
"BSD-3-Clause"
] | 3
|
2015-11-18T06:24:23.000Z
|
2017-05-21T13:55:56.000Z
|
webdriver/tests/find_elements_from_shadow_root/find.py
|
jimmywarting/wpt
|
75d80fa43c763935dff59b3c6b21f4dffa9b03b7
|
[
"BSD-3-Clause"
] | 153
|
2021-01-28T16:58:19.000Z
|
2022-03-30T22:15:57.000Z
|
webdriver/tests/find_elements_from_shadow_root/find.py
|
almajlis/wpt
|
a1d4dd189a5bdca857845b374946b8002c41d199
|
[
"BSD-3-Clause"
] | 4
|
2018-11-09T00:04:40.000Z
|
2022-01-21T00:22:19.000Z
|
import pytest
from webdriver.transport import Response
from tests.support.asserts import assert_error, assert_same_element, assert_success
def find_elements(session, shadow_id, using, value):
return session.transport.send(
"POST", "session/{session_id}/shadow/{shadow_id}/elements".format(
session_id=session.session_id,
shadow_id=shadow_id),
{"using": using, "value": value})
def test_null_parameter_value(session, http, inline):
session.url = inline("<div><a href=# id=linkText>full link text</a></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
path = "/session/{session_id}/shadow/{shadow_id}/elements".format(
session_id=session.session_id, shadow_id=shadow_root.id)
with http.post(path, None) as response:
assert_error(Response.from_http(response), "invalid argument")
def test_no_top_browsing_context(session, closed_window):
response = find_elements(session, "notReal", "css selector", "foo")
assert_error(response, "no such window")
def test_no_browsing_context(session, closed_frame):
response = find_elements(session, "notReal", "css selector", "foo")
assert_error(response, "no such window")
@pytest.mark.parametrize("using", [("a"), (True), (None), (1), ([]), ({})])
def test_invalid_using_argument(session, using):
# Step 1 - 2
response = find_elements(session, "notReal", using, "value")
assert_error(response, "invalid argument")
@pytest.mark.parametrize("value", [None, [], {}])
def test_invalid_selector_argument(session, value):
# Step 3 - 4
response = find_elements(session, "notReal", "css selector", value)
assert_error(response, "invalid argument")
def test_detached_shadow_root(session, get_shadow_page):
session.url = get_shadow_page("<div><input type='checkbox'/></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
session.refresh()
response = find_elements(session, shadow_root.id, "css", "input")
assert_error(response, "detached shadow root")
def test_find_elements_equivalence(session, get_shadow_page):
session.url = get_shadow_page("<div><input id='check' type='checkbox'/><input id='text'/></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
response = find_elements(session, shadow_root.id, "css", "input")
assert_success(response)
@pytest.mark.parametrize("using,value",
[("css selector", "#linkText"),
("link text", "full link text"),
("partial link text", "link text"),
("tag name", "a"),
("xpath", "//a")])
def test_find_elements(session, get_shadow_page, using, value):
# Step 8 - 9
session.url = get_shadow_page("<div><a href=# id=linkText>full link text</a></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
response = find_elements(session, shadow_root.id, using, value)
assert_success(response)
@pytest.mark.parametrize("document,value", [
("<a href=#>link text</a>", "link text"),
("<a href=#> link text </a>", "link text"),
("<a href=#>link<br>text</a>", "link\ntext"),
("<a href=#>link&text</a>", "link&text"),
("<a href=#>LINK TEXT</a>", "LINK TEXT"),
("<a href=# style='text-transform: uppercase'>link text</a>", "LINK TEXT"),
])
def test_find_elements_link_text(session, get_shadow_page, document, value):
# Step 8 - 9
session.url = get_shadow_page("<div><a href=#>not wanted</a><br/>{0}</div>".format(document))
element = session.find.css("div", all=False)
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
expected = session.execute_script("return arguments[0].shadowRoot.querySelectorAll('a')[1]",
args=(custom_element,))
response = find_elements(session, shadow_root.id, "link text", value)
value = assert_success(response)
assert isinstance(value, list)
assert len(value) == 1
found_element = value[0]
assert_same_element(session, found_element, expected)
@pytest.mark.parametrize("document,value", [
("<a href=#>partial link text</a>", "link"),
("<a href=#> partial link text </a>", "link"),
("<a href=#>partial link text</a>", "k t"),
("<a href=#>partial link<br>text</a>", "k\nt"),
("<a href=#>partial link&text</a>", "k&t"),
("<a href=#>PARTIAL LINK TEXT</a>", "LINK"),
("<a href=# style='text-transform: uppercase'>partial link text</a>", "LINK"),
])
def test_find_elements_partial_link_text(session, get_shadow_page, document, value):
# Step 8 - 9
session.url = get_shadow_page("<div><a href=#>not wanted</a><br/>{0}</div>".format(document))
element = session.find.css("div", all=False)
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
expected = session.execute_script("return arguments[0].shadowRoot.querySelectorAll('a')[1]",
args=(custom_element,))
response = find_elements(session, shadow_root.id, "partial link text", value)
value = assert_success(response)
assert isinstance(value, list)
assert len(value) == 1
found_element = value[0]
assert_same_element(session, found_element, expected)
@pytest.mark.parametrize("using,value", [("css selector", "#wontExist")])
def test_no_element(session, get_shadow_page, using, value):
# Step 8 - 9
session.url = get_shadow_page("<div></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
response = find_elements(session, shadow_root.id, using, value)
assert response.body["value"] == []
| 41.958621
| 101
| 0.668146
|
import pytest
from webdriver.transport import Response
from tests.support.asserts import assert_error, assert_same_element, assert_success
def find_elements(session, shadow_id, using, value):
return session.transport.send(
"POST", "session/{session_id}/shadow/{shadow_id}/elements".format(
session_id=session.session_id,
shadow_id=shadow_id),
{"using": using, "value": value})
def test_null_parameter_value(session, http, inline):
session.url = inline("<div><a href=# id=linkText>full link text</a></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
path = "/session/{session_id}/shadow/{shadow_id}/elements".format(
session_id=session.session_id, shadow_id=shadow_root.id)
with http.post(path, None) as response:
assert_error(Response.from_http(response), "invalid argument")
def test_no_top_browsing_context(session, closed_window):
response = find_elements(session, "notReal", "css selector", "foo")
assert_error(response, "no such window")
def test_no_browsing_context(session, closed_frame):
response = find_elements(session, "notReal", "css selector", "foo")
assert_error(response, "no such window")
@pytest.mark.parametrize("using", [("a"), (True), (None), (1), ([]), ({})])
def test_invalid_using_argument(session, using):
response = find_elements(session, "notReal", using, "value")
assert_error(response, "invalid argument")
@pytest.mark.parametrize("value", [None, [], {}])
def test_invalid_selector_argument(session, value):
response = find_elements(session, "notReal", "css selector", value)
assert_error(response, "invalid argument")
def test_detached_shadow_root(session, get_shadow_page):
session.url = get_shadow_page("<div><input type='checkbox'/></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
session.refresh()
response = find_elements(session, shadow_root.id, "css", "input")
assert_error(response, "detached shadow root")
def test_find_elements_equivalence(session, get_shadow_page):
session.url = get_shadow_page("<div><input id='check' type='checkbox'/><input id='text'/></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
response = find_elements(session, shadow_root.id, "css", "input")
assert_success(response)
@pytest.mark.parametrize("using,value",
[("css selector", "#linkText"),
("link text", "full link text"),
("partial link text", "link text"),
("tag name", "a"),
("xpath", "//a")])
def test_find_elements(session, get_shadow_page, using, value):
session.url = get_shadow_page("<div><a href=# id=linkText>full link text</a></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
response = find_elements(session, shadow_root.id, using, value)
assert_success(response)
@pytest.mark.parametrize("document,value", [
("<a href=#>link text</a>", "link text"),
("<a href=#> link text </a>", "link text"),
("<a href=#>link<br>text</a>", "link\ntext"),
("<a href=#>link&text</a>", "link&text"),
("<a href=#>LINK TEXT</a>", "LINK TEXT"),
("<a href=# style='text-transform: uppercase'>link text</a>", "LINK TEXT"),
])
def test_find_elements_link_text(session, get_shadow_page, document, value):
session.url = get_shadow_page("<div><a href=#>not wanted</a><br/>{0}</div>".format(document))
element = session.find.css("div", all=False)
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
expected = session.execute_script("return arguments[0].shadowRoot.querySelectorAll('a')[1]",
args=(custom_element,))
response = find_elements(session, shadow_root.id, "link text", value)
value = assert_success(response)
assert isinstance(value, list)
assert len(value) == 1
found_element = value[0]
assert_same_element(session, found_element, expected)
@pytest.mark.parametrize("document,value", [
("<a href=#>partial link text</a>", "link"),
("<a href=#> partial link text </a>", "link"),
("<a href=#>partial link text</a>", "k t"),
("<a href=#>partial link<br>text</a>", "k\nt"),
("<a href=#>partial link&text</a>", "k&t"),
("<a href=#>PARTIAL LINK TEXT</a>", "LINK"),
("<a href=# style='text-transform: uppercase'>partial link text</a>", "LINK"),
])
def test_find_elements_partial_link_text(session, get_shadow_page, document, value):
session.url = get_shadow_page("<div><a href=#>not wanted</a><br/>{0}</div>".format(document))
element = session.find.css("div", all=False)
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
expected = session.execute_script("return arguments[0].shadowRoot.querySelectorAll('a')[1]",
args=(custom_element,))
response = find_elements(session, shadow_root.id, "partial link text", value)
value = assert_success(response)
assert isinstance(value, list)
assert len(value) == 1
found_element = value[0]
assert_same_element(session, found_element, expected)
@pytest.mark.parametrize("using,value", [("css selector", "#wontExist")])
def test_no_element(session, get_shadow_page, using, value):
session.url = get_shadow_page("<div></div>")
custom_element = session.find.css("custom-shadow-element", all=False)
shadow_root = custom_element.shadow_root
response = find_elements(session, shadow_root.id, using, value)
assert response.body["value"] == []
| true
| true
|
f70a4bdbeaf0914b6cd41aaeb149332620257846
| 1,129
|
py
|
Python
|
localnet/delegate.py
|
moneyhoardermike/MHG.Network
|
7c1ef4b4d17223d91b613b4f96b100248bd45a74
|
[
"Apache-2.0"
] | 1
|
2022-03-27T20:20:54.000Z
|
2022-03-27T20:20:54.000Z
|
localnet/delegate.py
|
moneyhoardermike/MHG.Network
|
7c1ef4b4d17223d91b613b4f96b100248bd45a74
|
[
"Apache-2.0"
] | null | null | null |
localnet/delegate.py
|
moneyhoardermike/MHG.Network
|
7c1ef4b4d17223d91b613b4f96b100248bd45a74
|
[
"Apache-2.0"
] | null | null | null |
import sys
import subprocess
import yaml
if len(sys.argv) != 4:
print('usage: delegate.py [val1_stake] [val2_stake] [val3_stake]')
exit(0)
# Load config
confFile = open('./conf.yml')
conf = yaml.safe_load(confFile)
def delegate_cmd(valNumber, amount):
cmd = ["spnd", "tx", "staking", "delegate"]
cmd.append(conf['validator_addresses'][valNumber])
stake = amount + conf['staking_denom']
cmd.append(stake)
cmd.append('--from')
cmd.append(conf['validator_names'][valNumber])
cmd.append('--chain-id')
cmd.append(conf['chain_id'])
cmd.append('-y')
return cmd
# Perform delegation
for s in sys.argv[1:]:
if not s.isnumeric():
print(s + ' must be a number')
exit(1)
i = 0
for s in sys.argv[1:]:
if int(s) > 0:
print(i)
cmd = delegate_cmd(i, s)
print('running: ' + " ".join(cmd))
subprocess.run(cmd, check=True)
i += 1
print()
print()
print('delegation performed, to show validator set:')
print('spnd q tendermint-validator-set')
print()
print('to show consensus state')
print('spnd q ibc client self-consensus-state')
| 22.137255
| 70
| 0.631532
|
import sys
import subprocess
import yaml
if len(sys.argv) != 4:
print('usage: delegate.py [val1_stake] [val2_stake] [val3_stake]')
exit(0)
confFile = open('./conf.yml')
conf = yaml.safe_load(confFile)
def delegate_cmd(valNumber, amount):
cmd = ["spnd", "tx", "staking", "delegate"]
cmd.append(conf['validator_addresses'][valNumber])
stake = amount + conf['staking_denom']
cmd.append(stake)
cmd.append('--from')
cmd.append(conf['validator_names'][valNumber])
cmd.append('--chain-id')
cmd.append(conf['chain_id'])
cmd.append('-y')
return cmd
for s in sys.argv[1:]:
if not s.isnumeric():
print(s + ' must be a number')
exit(1)
i = 0
for s in sys.argv[1:]:
if int(s) > 0:
print(i)
cmd = delegate_cmd(i, s)
print('running: ' + " ".join(cmd))
subprocess.run(cmd, check=True)
i += 1
print()
print()
print('delegation performed, to show validator set:')
print('spnd q tendermint-validator-set')
print()
print('to show consensus state')
print('spnd q ibc client self-consensus-state')
| true
| true
|
f70a4cfab56b4aac1796dc8a0daf25899daa7761
| 589
|
py
|
Python
|
TianJiPlanBackend/core/utils.py
|
weridolin/tianji-plan
|
b98a49d92ee2a365095f9e15f4231f5178aca1c0
|
[
"Apache-2.0"
] | null | null | null |
TianJiPlanBackend/core/utils.py
|
weridolin/tianji-plan
|
b98a49d92ee2a365095f9e15f4231f5178aca1c0
|
[
"Apache-2.0"
] | null | null | null |
TianJiPlanBackend/core/utils.py
|
weridolin/tianji-plan
|
b98a49d92ee2a365095f9e15f4231f5178aca1c0
|
[
"Apache-2.0"
] | 1
|
2021-12-07T11:45:13.000Z
|
2021-12-07T11:45:13.000Z
|
'''
Description:
email: 359066432@qq.com
Author: lhj
software: vscode
Date: 2021-09-19 17:28:48
platform: windows 10
LastEditors: lhj
LastEditTime: 2021-09-20 20:01:05
'''
from dataclasses import dataclass
@dataclass
class UserBriefInfo(object):
user_id:str
user_name:str
@classmethod
def from_user(cls,user):
return cls(user_id=user.id,user_name=user.username)
@property
def cache_permission_key(self):
return f"user:{self.user_name}:permissions"
@property
def cache_roles_key(self):
return f"user:{self.user_name}:roles"
| 19.633333
| 59
| 0.704584
|
from dataclasses import dataclass
@dataclass
class UserBriefInfo(object):
user_id:str
user_name:str
@classmethod
def from_user(cls,user):
return cls(user_id=user.id,user_name=user.username)
@property
def cache_permission_key(self):
return f"user:{self.user_name}:permissions"
@property
def cache_roles_key(self):
return f"user:{self.user_name}:roles"
| true
| true
|
f70a4d8c027af9c7d598f7510fa3b661626b62ff
| 4,113
|
py
|
Python
|
inkscape_control.py
|
pkumath/datastructure
|
0b440b59af73ed73c575df5cd1c67946aa510dba
|
[
"MIT"
] | 4
|
2020-05-19T05:38:37.000Z
|
2020-05-27T04:14:17.000Z
|
inkscape_control.py
|
pkumath/datastructure
|
0b440b59af73ed73c575df5cd1c67946aa510dba
|
[
"MIT"
] | null | null | null |
inkscape_control.py
|
pkumath/datastructure
|
0b440b59af73ed73c575df5cd1c67946aa510dba
|
[
"MIT"
] | 1
|
2020-05-19T05:41:53.000Z
|
2020-05-19T05:41:53.000Z
|
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import paste
import subprocess
from multiprocessing import Process
from pathlib import Path
import tkinter.messagebox as messagebox
from shutil import copy
from appdirs import user_config_dir
import logging as log
from globe import Globe as globe
from util import StrUtil as strutil
import workspace
SYSTEM = globe.SYSTEM
if SYSTEM == "Darwin":
from pynput import keyboard
elif SYSTEM == "Windows":
import keyboard
import mouse as w_mouse
user_dir = Path(user_config_dir("project", "ww"))
if not user_dir.is_dir():
user_dir.mkdir(parents=True)
roots_file = user_dir / 'roots'
template = user_dir / 'template.svg'
config = user_dir / 'config.py'
if not template.is_file():
source = str(Path(__file__).parent / 'template.svg')
destination = str(template)
copy(source, destination)
def inkscape(path):
log.info("Inkscape function started")
#
# def for_canonical(f):
# log.info("for_canonical")
# return lambda k: f(l.canonical(k))
# hotkey = keyboard.HotKey(
# keyboard.HotKey.parse('<cmd>+u'),
# on_activate)
if SYSTEM == "Darwin":
processOpen = subprocess.Popen(['/Applications/Inkscape.app/Contents/MacOS/inkscape', str(path)])
log.info("Opening file")
elif SYSTEM == "Windows":
processOpen = subprocess.Popen(['inkscape', str(path)])
log.info("Opening file")
# with keyboard.GlobalHotKeys({'<cmd>+i': paste.open_vim}) as hotkey:
# hotkey.join()
# l = keyboard.Listener(
# on_press=for_canonical(hotkey.press),
# on_release=for_canonical(hotkey.release),
# # suppress=True
# )
# l.start()
processOpen.wait()
log.info("Inkscape terminated")
if SYSTEM == "Darwin":
version = os.popen('/Applications/Inkscape.app/Contents/MacOS/inkscape --version').readlines()
if '4035a4f' not in str(version):
messagebox.showinfo('警告!', 'inkscape版本可能不兼容!导致并没有生成latex能识别的文件,请检查是否为1.0 (4035a4f, 2020-05-01)')
inkscape_name = '/Applications/Inkscape.app/Contents/MacOS/inkscape'
subprocess.Popen([inkscape_name, str(path), '-o', str(path.with_suffix(".pdf")), '--export-latex'])
#else:
#os.system('/Applications/Inkscape.app/Contents/MacOS/inkscape '+ str(path)+ ' --export-file='+str(path.with_suffix(".pdf"))+' --export-latex')
elif SYSTEM == "Windows":
subprocess.Popen(['inkscape', str(path), '-o', str(path.with_suffix(".pdf")), '--export-latex'])
log.info("Export to pdf_tex process and InkscapeProcess terminated")
def create(factor):
# """
# Creates a figure.
# First argument is the title of the figure
# Second argument is the figure directory.
# """
# title = title.strip()
# file_name = title.replace(' ', '-').lower() + '.svg'
# figures = root + os.path.sep + 'figures'+os.path.sep
# figure_path = figures + file_name
# # If a file with this name already exists, append a '2'.
# if Path(figure_path).exists():
# title = title + '-2'
# create(title,root)
# else:
# figure_path = Path(figure_path).absolute()
# inkscape(figure_path)
"""
Creates a figure.
First argument is the title of the figure
Second argument is the figure directory.
"""
workspace.sub('figures')
log.debug("File name without extension " + factor['fileName'])
file_fullname = factor['fileName'] + '.svg'
log.debug("File name " + file_fullname)
figures_dir = Path(globe.workspace['sub']['figures'])
figure_path = figures_dir / file_fullname
# If a file with this name already exists, quit
#TODO: 查重工作应该放在paste中完成,也许可以将功能封装,放在util里
if figure_path.exists():
log.warning("{} already exists. Edit but not create.".format(str(figure_path)))
else:
copy(str(template), str(figure_path))
log.info("Template copied")
log.info("Starting Inkscape")
process_inkscape = Process(target=inkscape, args=(figure_path,))
process_inkscape.start()
return
| 32.132813
| 155
| 0.653538
|
import os
import paste
import subprocess
from multiprocessing import Process
from pathlib import Path
import tkinter.messagebox as messagebox
from shutil import copy
from appdirs import user_config_dir
import logging as log
from globe import Globe as globe
from util import StrUtil as strutil
import workspace
SYSTEM = globe.SYSTEM
if SYSTEM == "Darwin":
from pynput import keyboard
elif SYSTEM == "Windows":
import keyboard
import mouse as w_mouse
user_dir = Path(user_config_dir("project", "ww"))
if not user_dir.is_dir():
user_dir.mkdir(parents=True)
roots_file = user_dir / 'roots'
template = user_dir / 'template.svg'
config = user_dir / 'config.py'
if not template.is_file():
source = str(Path(__file__).parent / 'template.svg')
destination = str(template)
copy(source, destination)
def inkscape(path):
log.info("Inkscape function started")
if SYSTEM == "Darwin":
processOpen = subprocess.Popen(['/Applications/Inkscape.app/Contents/MacOS/inkscape', str(path)])
log.info("Opening file")
elif SYSTEM == "Windows":
processOpen = subprocess.Popen(['inkscape', str(path)])
log.info("Opening file")
processOpen.wait()
log.info("Inkscape terminated")
if SYSTEM == "Darwin":
version = os.popen('/Applications/Inkscape.app/Contents/MacOS/inkscape --version').readlines()
if '4035a4f' not in str(version):
messagebox.showinfo('警告!', 'inkscape版本可能不兼容!导致并没有生成latex能识别的文件,请检查是否为1.0 (4035a4f, 2020-05-01)')
inkscape_name = '/Applications/Inkscape.app/Contents/MacOS/inkscape'
subprocess.Popen([inkscape_name, str(path), '-o', str(path.with_suffix(".pdf")), '--export-latex'])
elif SYSTEM == "Windows":
subprocess.Popen(['inkscape', str(path), '-o', str(path.with_suffix(".pdf")), '--export-latex'])
log.info("Export to pdf_tex process and InkscapeProcess terminated")
def create(factor):
# Creates a figure.
# First argument is the title of the figure
# Second argument is the figure directory.
# """
pace.sub('figures')
log.debug("File name without extension " + factor['fileName'])
file_fullname = factor['fileName'] + '.svg'
log.debug("File name " + file_fullname)
figures_dir = Path(globe.workspace['sub']['figures'])
figure_path = figures_dir / file_fullname
if figure_path.exists():
log.warning("{} already exists. Edit but not create.".format(str(figure_path)))
else:
copy(str(template), str(figure_path))
log.info("Template copied")
log.info("Starting Inkscape")
process_inkscape = Process(target=inkscape, args=(figure_path,))
process_inkscape.start()
return
| true
| true
|
f70a4e0537f64d4f57d9c31c05f6e8dab7dea946
| 26,170
|
py
|
Python
|
tensorflow/python/data/experimental/ops/batching.py
|
nicolasoyharcabal/tensorflow
|
0d3b58cfe91c6b865a14701345d7a84ce949c0e3
|
[
"Apache-2.0"
] | null | null | null |
tensorflow/python/data/experimental/ops/batching.py
|
nicolasoyharcabal/tensorflow
|
0d3b58cfe91c6b865a14701345d7a84ce949c0e3
|
[
"Apache-2.0"
] | null | null | null |
tensorflow/python/data/experimental/ops/batching.py
|
nicolasoyharcabal/tensorflow
|
0d3b58cfe91c6b865a14701345d7a84ce949c0e3
|
[
"Apache-2.0"
] | null | null | null |
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
"""Batching dataset transformations."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.data.experimental.ops import get_single_element
from tensorflow.python.data.experimental.ops import grouping
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.data.util import convert
from tensorflow.python.data.util import nest
from tensorflow.python.data.util import sparse
from tensorflow.python.data.util import structure
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import tensor_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import check_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import gen_array_ops
from tensorflow.python.ops import gen_experimental_dataset_ops as ged_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import sparse_ops
from tensorflow.python.util.tf_export import tf_export
def batch_window(dataset):
"""Batches a window of tensors.
Args:
dataset: the input dataset.
Returns:
A `Tensor` representing the batch of the entire input dataset.
"""
if isinstance(dataset.output_classes, tuple):
raise TypeError("Input dataset expected to have a single component")
if dataset.output_classes is ops.Tensor:
return _batch_dense_window(dataset)
elif dataset.output_classes is sparse_tensor.SparseTensor:
return _batch_sparse_window(dataset)
else:
raise TypeError("Unsupported dataset type: %s" % dataset.output_classes)
def _batch_dense_window(dataset):
"""Batches a window of dense tensors."""
def key_fn(_):
return np.int64(0)
def shape_init_fn(_):
return array_ops.shape(first_element)
def shape_reduce_fn(state, value):
check_ops.assert_equal(state, array_ops.shape(value))
return state
def finalize_fn(state):
return state
if dataset.output_shapes.is_fully_defined():
shape = dataset.output_shapes
else:
first_element = get_single_element.get_single_element(dataset.take(1))
shape_reducer = grouping.Reducer(shape_init_fn, shape_reduce_fn,
finalize_fn)
shape = get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, shape_reducer)))
def batch_init_fn(_):
batch_shape = array_ops.concat([[0], shape], 0)
return gen_array_ops.empty(batch_shape, dtype=dataset.output_types)
def batch_reduce_fn(state, value):
return array_ops.concat([state, [value]], 0)
batch_reducer = grouping.Reducer(batch_init_fn, batch_reduce_fn, finalize_fn)
return get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, batch_reducer)))
def _batch_sparse_window(dataset):
"""Batches a window of sparse tensors."""
def key_fn(_):
return np.int64(0)
def shape_init_fn(_):
return first_element.dense_shape
def shape_reduce_fn(state, value):
check_ops.assert_equal(state, value.dense_shape)
return state
def finalize_fn(state):
return state
if dataset.output_shapes.is_fully_defined():
shape = dataset.output_shapes
else:
first_element = get_single_element.get_single_element(dataset.take(1))
shape_reducer = grouping.Reducer(shape_init_fn, shape_reduce_fn,
finalize_fn)
shape = get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, shape_reducer)))
def batch_init_fn(_):
indices_shape = array_ops.concat([[0], [array_ops.size(shape) + 1]], 0)
return sparse_tensor.SparseTensor(
indices=gen_array_ops.empty(indices_shape, dtype=dtypes.int64),
values=constant_op.constant([], shape=[0], dtype=dataset.output_types),
dense_shape=array_ops.concat(
[np.array([0], dtype=np.int64),
math_ops.cast(shape, dtypes.int64)], 0))
def batch_reduce_fn(state, value):
return sparse_ops.sparse_concat(0, [state, value])
def reshape_fn(value):
return sparse_ops.sparse_reshape(
value,
array_ops.concat([np.array([1], dtype=np.int64), value.dense_shape], 0))
batch_reducer = grouping.Reducer(batch_init_fn, batch_reduce_fn, finalize_fn)
return get_single_element.get_single_element(
dataset.map(reshape_fn).apply(
grouping.group_by_reducer(key_fn, batch_reducer)))
@tf_export("data.experimental.dense_to_sparse_batch")
def dense_to_sparse_batch(batch_size, row_shape):
"""A transformation that batches ragged elements into `tf.SparseTensor`s.
Like `Dataset.padded_batch()`, this transformation combines multiple
consecutive elements of the dataset, which might have different
shapes, into a single element. The resulting element has three
components (`indices`, `values`, and `dense_shape`), which
comprise a `tf.SparseTensor` that represents the same data. The
`row_shape` represents the dense shape of each row in the
resulting `tf.SparseTensor`, to which the effective batch size is
prepended. For example:
```python
# NOTE: The following examples use `{ ... }` to represent the
# contents of a dataset.
a = { ['a', 'b', 'c'], ['a', 'b'], ['a', 'b', 'c', 'd'] }
a.apply(tf.data.experimental.dense_to_sparse_batch(
batch_size=2, row_shape=[6])) ==
{
([[0, 0], [0, 1], [0, 2], [1, 0], [1, 1]], # indices
['a', 'b', 'c', 'a', 'b'], # values
[2, 6]), # dense_shape
([[0, 0], [0, 1], [0, 2], [0, 3]],
['a', 'b', 'c', 'd'],
[1, 6])
}
```
Args:
batch_size: A `tf.int64` scalar `tf.Tensor`, representing the
number of consecutive elements of this dataset to combine in a
single batch.
row_shape: A `tf.TensorShape` or `tf.int64` vector tensor-like
object representing the equivalent dense shape of a row in the
resulting `tf.SparseTensor`. Each element of this dataset must
have the same rank as `row_shape`, and must have size less
than or equal to `row_shape` in each dimension.
Returns:
A `Dataset` transformation function, which can be passed to
`tf.data.Dataset.apply`.
"""
def _apply_fn(dataset):
return _DenseToSparseBatchDataset(dataset, batch_size, row_shape)
return _apply_fn
def padded_batch_window(dataset, padded_shape, padding_value=None):
"""Batches a window of tensors with padding.
Args:
dataset: the input dataset.
padded_shape: (Optional.) `tf.TensorShape` or `tf.int64` vector tensor-like
object representing the shape to which the input elements should be padded
prior to batching. Any unknown dimensions (e.g. `tf.Dimension(None)` in a
`tf.TensorShape` or `-1` in a tensor-like object) will be padded to the
maximum size of that dimension in each batch.
padding_value: (Optional.) A scalar-shaped `tf.Tensor`, representing the
padding value to use. Defaults are `0` for numeric types and the empty
string for string types. If `dataset` contains `tf.SparseTensor`, this
value is ignored.
Returns:
A `Tensor` representing the batch of the entire input dataset.
Raises:
ValueError: if invalid arguments are provided.
"""
if not issubclass(dataset.output_classes,
(ops.Tensor, sparse_tensor.SparseTensor)):
raise TypeError("Input dataset expected to have a single tensor component")
if issubclass(dataset.output_classes, (ops.Tensor)):
return _padded_batch_dense_window(dataset, padded_shape, padding_value)
elif issubclass(dataset.output_classes, (sparse_tensor.SparseTensor)):
if padding_value is not None:
raise ValueError("Padding value not allowed for sparse tensors")
return _padded_batch_sparse_window(dataset, padded_shape)
else:
raise TypeError("Unsupported dataset type: %s" % dataset.output_classes)
def _padded_batch_dense_window(dataset, padded_shape, padding_value=None):
"""Batches a window of dense tensors with padding."""
padded_shape = math_ops.cast(
convert.partial_shape_to_tensor(padded_shape), dtypes.int32)
def key_fn(_):
return np.int64(0)
def max_init_fn(_):
return padded_shape
def max_reduce_fn(state, value):
"""Computes the maximum shape to pad to."""
condition = math_ops.reduce_all(
math_ops.logical_or(
math_ops.less_equal(array_ops.shape(value), padded_shape),
math_ops.equal(padded_shape, -1)))
assert_op = control_flow_ops.Assert(condition, [
"Actual shape greater than padded shape: ",
array_ops.shape(value), padded_shape
])
with ops.control_dependencies([assert_op]):
return math_ops.maximum(state, array_ops.shape(value))
def finalize_fn(state):
return state
# Compute the padded shape.
max_reducer = grouping.Reducer(max_init_fn, max_reduce_fn, finalize_fn)
padded_shape = get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, max_reducer)))
if padding_value is None:
if dataset.output_types == dtypes.string:
padding_value = ""
elif dataset.output_types == dtypes.bool:
padding_value = False
elif dataset.output_types == dtypes.variant:
raise TypeError("Unable to create padding for field of type 'variant'")
else:
padding_value = 0
def batch_init_fn(_):
batch_shape = array_ops.concat(
[np.array([0], dtype=np.int32), padded_shape], 0)
return gen_array_ops.empty(batch_shape, dtype=dataset.output_types)
def batch_reduce_fn(state, value):
return array_ops.concat([state, [value]], 0)
def pad_fn(value):
shape = array_ops.shape(value)
left = array_ops.zeros_like(shape)
right = padded_shape - shape
return array_ops.pad(
value, array_ops.stack([left, right], 1), constant_values=padding_value)
batch_reducer = grouping.Reducer(batch_init_fn, batch_reduce_fn, finalize_fn)
return get_single_element.get_single_element(
dataset.map(pad_fn).apply(
grouping.group_by_reducer(key_fn, batch_reducer)))
def _padded_batch_sparse_window(dataset, padded_shape):
"""Batches a window of sparse tensors with padding."""
def key_fn(_):
return np.int64(0)
def max_init_fn(_):
return convert.partial_shape_to_tensor(padded_shape)
def max_reduce_fn(state, value):
"""Computes the maximum shape to pad to."""
condition = math_ops.reduce_all(
math_ops.logical_or(
math_ops.less_equal(value.dense_shape, padded_shape),
math_ops.equal(padded_shape, -1)))
assert_op = control_flow_ops.Assert(condition, [
"Actual shape greater than padded shape: ", value.dense_shape,
padded_shape
])
with ops.control_dependencies([assert_op]):
return math_ops.maximum(state, value.dense_shape)
def finalize_fn(state):
return state
# Compute the padded shape.
max_reducer = grouping.Reducer(max_init_fn, max_reduce_fn, finalize_fn)
padded_shape = get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, max_reducer)))
def batch_init_fn(_):
indices_shape = array_ops.concat([[0], [array_ops.size(padded_shape) + 1]],
0)
return sparse_tensor.SparseTensor(
indices=gen_array_ops.empty(indices_shape, dtype=dtypes.int64),
values=constant_op.constant([], shape=[0], dtype=dataset.output_types),
dense_shape=array_ops.concat(
[np.array([0], dtype=np.int64), padded_shape], 0))
def batch_reduce_fn(state, value):
padded_value = sparse_tensor.SparseTensor(
indices=value.indices, values=value.values, dense_shape=padded_shape)
reshaped_value = sparse_ops.sparse_reshape(
padded_value,
array_ops.concat(
[np.array([1], dtype=np.int64), padded_value.dense_shape], 0))
return sparse_ops.sparse_concat(0, [state, reshaped_value])
reducer = grouping.Reducer(batch_init_fn, batch_reduce_fn, finalize_fn)
return get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, reducer)))
class _UnbatchDataset(dataset_ops.UnaryDataset):
"""A dataset that splits the elements of its input into multiple elements."""
def __init__(self, input_dataset):
"""See `unbatch()` for more details."""
super(_UnbatchDataset, self).__init__(input_dataset)
flat_shapes = nest.flatten(input_dataset.output_shapes)
if any(s.ndims == 0 for s in flat_shapes):
raise ValueError("Cannot unbatch an input with scalar components.")
known_batch_dim = tensor_shape.Dimension(None)
for s in flat_shapes:
try:
known_batch_dim = known_batch_dim.merge_with(s[0])
except ValueError:
raise ValueError("Cannot unbatch an input whose components have "
"different batch sizes.")
self._input_dataset = input_dataset
self._structure = structure.convert_legacy_structure(
input_dataset.output_types,
nest.map_structure(lambda s: s[1:], input_dataset.output_shapes),
input_dataset.output_classes)
def _as_variant_tensor(self):
return ged_ops.experimental_unbatch_dataset(
self._input_dataset._as_variant_tensor(), # pylint: disable=protected-access
**dataset_ops.flat_structure(self))
@property
def _element_structure(self):
return self._structure
@tf_export("data.experimental.unbatch")
def unbatch():
"""Splits elements of a dataset into multiple elements on the batch dimension.
For example, if elements of the dataset are shaped `[B, a0, a1, ...]`,
where `B` may vary for each input element, then for each element in the
dataset, the unbatched dataset will contain `B` consecutive elements
of shape `[a0, a1, ...]`.
```python
# NOTE: The following example uses `{ ... }` to represent the contents
# of a dataset.
a = { ['a', 'b', 'c'], ['a', 'b'], ['a', 'b', 'c', 'd'] }
a.apply(tf.data.experimental.unbatch()) == {
'a', 'b', 'c', 'a', 'b', 'a', 'b', 'c', 'd'}
```
Returns:
A `Dataset` transformation function, which can be passed to
`tf.data.Dataset.apply`.
"""
def _apply_fn(dataset):
"""Function from `Dataset` to `Dataset` that applies the transformation."""
if not sparse.any_sparse(dataset.output_classes):
return _UnbatchDataset(dataset)
# NOTE(mrry): We must ensure that any SparseTensors in `dataset`
# are normalized to the rank-1 dense representation, so that the
# sparse-oblivious unbatching logic will slice them
# appropriately. This leads to a somewhat inefficient re-encoding step
# for all SparseTensor components.
# TODO(mrry): Consider optimizing this in future
# if it turns out to be a bottleneck.
def normalize(arg, *rest):
if rest:
return sparse.serialize_many_sparse_tensors((arg,) + rest)
else:
return sparse.serialize_many_sparse_tensors(arg)
normalized_dataset = dataset.map(normalize)
# NOTE(mrry): Our `map()` has lost information about the sparseness
# of any SparseTensor components, so re-apply the structure of the
# original dataset.
restructured_dataset = _RestructuredDataset(
normalized_dataset,
dataset.output_types,
dataset.output_shapes,
dataset.output_classes,
allow_unsafe_cast=True)
return _UnbatchDataset(restructured_dataset)
return _apply_fn
class _DenseToSparseBatchDataset(dataset_ops.UnaryDataset):
"""A `Dataset` that batches ragged dense elements into `tf.SparseTensor`s."""
def __init__(self, input_dataset, batch_size, row_shape):
"""See `Dataset.dense_to_sparse_batch()` for more details."""
super(_DenseToSparseBatchDataset, self).__init__(input_dataset)
if not isinstance(input_dataset.output_types, dtypes.DType):
raise TypeError("DenseToSparseDataset requires an input whose elements "
"have a single component, whereas the input has %r." %
input_dataset.output_types)
self._input_dataset = input_dataset
self._batch_size = batch_size
self._row_shape = row_shape
self._structure = structure.SparseTensorStructure(
input_dataset.output_types,
tensor_shape.vector(None).concatenate(self._row_shape))
def _as_variant_tensor(self):
return ged_ops.experimental_dense_to_sparse_batch_dataset(
self._input_dataset._as_variant_tensor(), # pylint: disable=protected-access
self._batch_size,
row_shape=convert.partial_shape_to_tensor(self._row_shape),
**dataset_ops.flat_structure(self))
@property
def _element_structure(self):
return self._structure
class _RestructuredDataset(dataset_ops.UnaryDataset):
"""An internal helper for changing the structure and shape of a dataset."""
def __init__(self,
dataset,
output_types,
output_shapes=None,
output_classes=None,
allow_unsafe_cast=False):
"""Creates a new dataset with the given output types and shapes.
The given `dataset` must have a structure that is convertible:
* `dataset.output_types` must be the same as `output_types` module nesting.
* Each shape in `dataset.output_shapes` must be compatible with each shape
in `output_shapes` (if given).
Note: This helper permits "unsafe casts" for shapes, equivalent to using
`tf.Tensor.set_shape()` where domain-specific knowledge is available.
Args:
dataset: A `Dataset` object.
output_types: A nested structure of `tf.DType` objects.
output_shapes: (Optional.) A nested structure of `tf.TensorShape` objects.
If omitted, the shapes will be inherited from `dataset`.
output_classes: (Optional.) A nested structure of class types.
If omitted, the class types will be inherited from `dataset`.
allow_unsafe_cast: (Optional.) If `True`, the caller may switch the
reported output types and shapes of the restructured dataset, e.g. to
switch a sparse tensor represented as `tf.variant` to its user-visible
type and shape.
Raises:
ValueError: If either `output_types` or `output_shapes` is not compatible
with the structure of `dataset`.
"""
super(_RestructuredDataset, self).__init__(dataset)
self._input_dataset = dataset
if not allow_unsafe_cast:
# Validate that the types are compatible.
output_types = nest.map_structure(dtypes.as_dtype, output_types)
flat_original_types = nest.flatten(dataset.output_types)
flat_new_types = nest.flatten(output_types)
if flat_original_types != flat_new_types:
raise ValueError(
"Dataset with output types %r cannot be restructured to have "
"output types %r" % (dataset.output_types, output_types))
if output_shapes is None:
# Inherit shapes from the original `dataset`.
output_shapes = nest.pack_sequence_as(
output_types, nest.flatten(dataset.output_shapes))
else:
if not allow_unsafe_cast:
# Validate that the shapes are compatible.
nest.assert_same_structure(output_types, output_shapes)
flat_original_shapes = nest.flatten(dataset.output_shapes)
flat_new_shapes = nest.flatten_up_to(output_types, output_shapes)
for original_shape, new_shape in zip(flat_original_shapes,
flat_new_shapes):
if not original_shape.is_compatible_with(new_shape):
raise ValueError(
"Dataset with output shapes %r cannot be restructured to have "
"incompatible output shapes %r" % (dataset.output_shapes,
output_shapes))
output_shapes = nest.map_structure_up_to(
output_types, tensor_shape.as_shape, output_shapes)
if output_classes is None:
# Inherit class types from the original `dataset`.
output_classes = nest.pack_sequence_as(
output_types, nest.flatten(dataset.output_classes))
self._structure = structure.convert_legacy_structure(
output_types, output_shapes, output_classes)
def _as_variant_tensor(self):
return self._input_dataset._as_variant_tensor() # pylint: disable=protected-access
@property
def _element_structure(self):
return self._structure
class _MapAndBatchDataset(dataset_ops.UnaryDataset):
"""A `Dataset` that maps a function over a batch of elements."""
def __init__(self, input_dataset, map_func, batch_size, num_parallel_calls,
drop_remainder):
"""See `Dataset.map()` for details."""
super(_MapAndBatchDataset, self).__init__(input_dataset)
self._input_dataset = input_dataset
self._map_func = dataset_ops.StructuredFunctionWrapper(
map_func, "tf.data.experimental.map_and_batch()", dataset=input_dataset)
self._batch_size_t = ops.convert_to_tensor(
batch_size, dtype=dtypes.int64, name="batch_size")
self._num_parallel_calls_t = ops.convert_to_tensor(
num_parallel_calls, dtype=dtypes.int64, name="num_parallel_calls")
self._drop_remainder_t = ops.convert_to_tensor(
drop_remainder, dtype=dtypes.bool, name="drop_remainder")
constant_drop_remainder = tensor_util.constant_value(self._drop_remainder_t)
if constant_drop_remainder:
# NOTE(mrry): `constant_drop_remainder` may be `None` (unknown statically)
# or `False` (explicitly retaining the remainder).
self._structure = self._map_func.output_structure._batch( # pylint: disable=protected-access
tensor_util.constant_value(self._batch_size_t))
else:
self._structure = self._map_func.output_structure._batch(None) # pylint: disable=protected-access
def _functions(self):
return [self._map_func]
def _as_variant_tensor(self):
# pylint: disable=protected-access
return ged_ops.experimental_map_and_batch_dataset(
self._input_dataset._as_variant_tensor(),
self._map_func.function.captured_inputs,
f=self._map_func.function,
batch_size=self._batch_size_t,
num_parallel_calls=self._num_parallel_calls_t,
drop_remainder=self._drop_remainder_t,
preserve_cardinality=True,
**dataset_ops.flat_structure(self))
@property
def _element_structure(self):
return self._structure
@tf_export("data.experimental.map_and_batch")
def map_and_batch(map_func,
batch_size,
num_parallel_batches=None,
drop_remainder=False,
num_parallel_calls=None):
"""Fused implementation of `map` and `batch`.
Maps `map_func` across `batch_size` consecutive elements of this dataset
and then combines them into a batch. Functionally, it is equivalent to `map`
followed by `batch`. However, by fusing the two transformations together, the
implementation can be more efficient. Surfacing this transformation in the API
is temporary. Once automatic input pipeline optimization is implemented,
the fusing of `map` and `batch` will happen automatically and this API will be
deprecated.
Args:
map_func: A function mapping a nested structure of tensors to another
nested structure of tensors.
batch_size: A `tf.int64` scalar `tf.Tensor`, representing the number of
consecutive elements of this dataset to combine in a single batch.
num_parallel_batches: (Optional.) A `tf.int64` scalar `tf.Tensor`,
representing the number of batches to create in parallel. On one hand,
higher values can help mitigate the effect of stragglers. On the other
hand, higher values can increase contention if CPU is scarce.
drop_remainder: (Optional.) A `tf.bool` scalar `tf.Tensor`, representing
whether the last batch should be dropped in case its size is smaller than
desired; the default behavior is not to drop the smaller batch.
num_parallel_calls: (Optional.) A `tf.int32` scalar `tf.Tensor`,
representing the number of elements to process in parallel. If not
specified, `batch_size * num_parallel_batches` elements will be processed
in parallel. If the value `tf.data.experimental.AUTOTUNE` is used, then
the number of parallel calls is set dynamically based on available CPU.
Returns:
A `Dataset` transformation function, which can be passed to
`tf.data.Dataset.apply`.
Raises:
ValueError: If both `num_parallel_batches` and `num_parallel_calls` are
specified.
"""
if num_parallel_batches is None and num_parallel_calls is None:
num_parallel_calls = batch_size
elif num_parallel_batches is not None and num_parallel_calls is None:
num_parallel_calls = batch_size * num_parallel_batches
elif num_parallel_batches is not None and num_parallel_calls is not None:
raise ValueError("The `num_parallel_batches` and `num_parallel_calls` "
"arguments are mutually exclusive.")
def _apply_fn(dataset):
return _MapAndBatchDataset(dataset, map_func, batch_size,
num_parallel_calls, drop_remainder)
return _apply_fn
| 39.893293
| 104
| 0.713068
|
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import numpy as np
from tensorflow.python.data.experimental.ops import get_single_element
from tensorflow.python.data.experimental.ops import grouping
from tensorflow.python.data.ops import dataset_ops
from tensorflow.python.data.util import convert
from tensorflow.python.data.util import nest
from tensorflow.python.data.util import sparse
from tensorflow.python.data.util import structure
from tensorflow.python.framework import constant_op
from tensorflow.python.framework import dtypes
from tensorflow.python.framework import ops
from tensorflow.python.framework import sparse_tensor
from tensorflow.python.framework import tensor_shape
from tensorflow.python.framework import tensor_util
from tensorflow.python.ops import array_ops
from tensorflow.python.ops import check_ops
from tensorflow.python.ops import control_flow_ops
from tensorflow.python.ops import gen_array_ops
from tensorflow.python.ops import gen_experimental_dataset_ops as ged_ops
from tensorflow.python.ops import math_ops
from tensorflow.python.ops import sparse_ops
from tensorflow.python.util.tf_export import tf_export
def batch_window(dataset):
if isinstance(dataset.output_classes, tuple):
raise TypeError("Input dataset expected to have a single component")
if dataset.output_classes is ops.Tensor:
return _batch_dense_window(dataset)
elif dataset.output_classes is sparse_tensor.SparseTensor:
return _batch_sparse_window(dataset)
else:
raise TypeError("Unsupported dataset type: %s" % dataset.output_classes)
def _batch_dense_window(dataset):
def key_fn(_):
return np.int64(0)
def shape_init_fn(_):
return array_ops.shape(first_element)
def shape_reduce_fn(state, value):
check_ops.assert_equal(state, array_ops.shape(value))
return state
def finalize_fn(state):
return state
if dataset.output_shapes.is_fully_defined():
shape = dataset.output_shapes
else:
first_element = get_single_element.get_single_element(dataset.take(1))
shape_reducer = grouping.Reducer(shape_init_fn, shape_reduce_fn,
finalize_fn)
shape = get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, shape_reducer)))
def batch_init_fn(_):
batch_shape = array_ops.concat([[0], shape], 0)
return gen_array_ops.empty(batch_shape, dtype=dataset.output_types)
def batch_reduce_fn(state, value):
return array_ops.concat([state, [value]], 0)
batch_reducer = grouping.Reducer(batch_init_fn, batch_reduce_fn, finalize_fn)
return get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, batch_reducer)))
def _batch_sparse_window(dataset):
def key_fn(_):
return np.int64(0)
def shape_init_fn(_):
return first_element.dense_shape
def shape_reduce_fn(state, value):
check_ops.assert_equal(state, value.dense_shape)
return state
def finalize_fn(state):
return state
if dataset.output_shapes.is_fully_defined():
shape = dataset.output_shapes
else:
first_element = get_single_element.get_single_element(dataset.take(1))
shape_reducer = grouping.Reducer(shape_init_fn, shape_reduce_fn,
finalize_fn)
shape = get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, shape_reducer)))
def batch_init_fn(_):
indices_shape = array_ops.concat([[0], [array_ops.size(shape) + 1]], 0)
return sparse_tensor.SparseTensor(
indices=gen_array_ops.empty(indices_shape, dtype=dtypes.int64),
values=constant_op.constant([], shape=[0], dtype=dataset.output_types),
dense_shape=array_ops.concat(
[np.array([0], dtype=np.int64),
math_ops.cast(shape, dtypes.int64)], 0))
def batch_reduce_fn(state, value):
return sparse_ops.sparse_concat(0, [state, value])
def reshape_fn(value):
return sparse_ops.sparse_reshape(
value,
array_ops.concat([np.array([1], dtype=np.int64), value.dense_shape], 0))
batch_reducer = grouping.Reducer(batch_init_fn, batch_reduce_fn, finalize_fn)
return get_single_element.get_single_element(
dataset.map(reshape_fn).apply(
grouping.group_by_reducer(key_fn, batch_reducer)))
@tf_export("data.experimental.dense_to_sparse_batch")
def dense_to_sparse_batch(batch_size, row_shape):
def _apply_fn(dataset):
return _DenseToSparseBatchDataset(dataset, batch_size, row_shape)
return _apply_fn
def padded_batch_window(dataset, padded_shape, padding_value=None):
if not issubclass(dataset.output_classes,
(ops.Tensor, sparse_tensor.SparseTensor)):
raise TypeError("Input dataset expected to have a single tensor component")
if issubclass(dataset.output_classes, (ops.Tensor)):
return _padded_batch_dense_window(dataset, padded_shape, padding_value)
elif issubclass(dataset.output_classes, (sparse_tensor.SparseTensor)):
if padding_value is not None:
raise ValueError("Padding value not allowed for sparse tensors")
return _padded_batch_sparse_window(dataset, padded_shape)
else:
raise TypeError("Unsupported dataset type: %s" % dataset.output_classes)
def _padded_batch_dense_window(dataset, padded_shape, padding_value=None):
padded_shape = math_ops.cast(
convert.partial_shape_to_tensor(padded_shape), dtypes.int32)
def key_fn(_):
return np.int64(0)
def max_init_fn(_):
return padded_shape
def max_reduce_fn(state, value):
condition = math_ops.reduce_all(
math_ops.logical_or(
math_ops.less_equal(array_ops.shape(value), padded_shape),
math_ops.equal(padded_shape, -1)))
assert_op = control_flow_ops.Assert(condition, [
"Actual shape greater than padded shape: ",
array_ops.shape(value), padded_shape
])
with ops.control_dependencies([assert_op]):
return math_ops.maximum(state, array_ops.shape(value))
def finalize_fn(state):
return state
max_reducer = grouping.Reducer(max_init_fn, max_reduce_fn, finalize_fn)
padded_shape = get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, max_reducer)))
if padding_value is None:
if dataset.output_types == dtypes.string:
padding_value = ""
elif dataset.output_types == dtypes.bool:
padding_value = False
elif dataset.output_types == dtypes.variant:
raise TypeError("Unable to create padding for field of type 'variant'")
else:
padding_value = 0
def batch_init_fn(_):
batch_shape = array_ops.concat(
[np.array([0], dtype=np.int32), padded_shape], 0)
return gen_array_ops.empty(batch_shape, dtype=dataset.output_types)
def batch_reduce_fn(state, value):
return array_ops.concat([state, [value]], 0)
def pad_fn(value):
shape = array_ops.shape(value)
left = array_ops.zeros_like(shape)
right = padded_shape - shape
return array_ops.pad(
value, array_ops.stack([left, right], 1), constant_values=padding_value)
batch_reducer = grouping.Reducer(batch_init_fn, batch_reduce_fn, finalize_fn)
return get_single_element.get_single_element(
dataset.map(pad_fn).apply(
grouping.group_by_reducer(key_fn, batch_reducer)))
def _padded_batch_sparse_window(dataset, padded_shape):
def key_fn(_):
return np.int64(0)
def max_init_fn(_):
return convert.partial_shape_to_tensor(padded_shape)
def max_reduce_fn(state, value):
condition = math_ops.reduce_all(
math_ops.logical_or(
math_ops.less_equal(value.dense_shape, padded_shape),
math_ops.equal(padded_shape, -1)))
assert_op = control_flow_ops.Assert(condition, [
"Actual shape greater than padded shape: ", value.dense_shape,
padded_shape
])
with ops.control_dependencies([assert_op]):
return math_ops.maximum(state, value.dense_shape)
def finalize_fn(state):
return state
max_reducer = grouping.Reducer(max_init_fn, max_reduce_fn, finalize_fn)
padded_shape = get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, max_reducer)))
def batch_init_fn(_):
indices_shape = array_ops.concat([[0], [array_ops.size(padded_shape) + 1]],
0)
return sparse_tensor.SparseTensor(
indices=gen_array_ops.empty(indices_shape, dtype=dtypes.int64),
values=constant_op.constant([], shape=[0], dtype=dataset.output_types),
dense_shape=array_ops.concat(
[np.array([0], dtype=np.int64), padded_shape], 0))
def batch_reduce_fn(state, value):
padded_value = sparse_tensor.SparseTensor(
indices=value.indices, values=value.values, dense_shape=padded_shape)
reshaped_value = sparse_ops.sparse_reshape(
padded_value,
array_ops.concat(
[np.array([1], dtype=np.int64), padded_value.dense_shape], 0))
return sparse_ops.sparse_concat(0, [state, reshaped_value])
reducer = grouping.Reducer(batch_init_fn, batch_reduce_fn, finalize_fn)
return get_single_element.get_single_element(
dataset.apply(grouping.group_by_reducer(key_fn, reducer)))
class _UnbatchDataset(dataset_ops.UnaryDataset):
def __init__(self, input_dataset):
super(_UnbatchDataset, self).__init__(input_dataset)
flat_shapes = nest.flatten(input_dataset.output_shapes)
if any(s.ndims == 0 for s in flat_shapes):
raise ValueError("Cannot unbatch an input with scalar components.")
known_batch_dim = tensor_shape.Dimension(None)
for s in flat_shapes:
try:
known_batch_dim = known_batch_dim.merge_with(s[0])
except ValueError:
raise ValueError("Cannot unbatch an input whose components have "
"different batch sizes.")
self._input_dataset = input_dataset
self._structure = structure.convert_legacy_structure(
input_dataset.output_types,
nest.map_structure(lambda s: s[1:], input_dataset.output_shapes),
input_dataset.output_classes)
def _as_variant_tensor(self):
return ged_ops.experimental_unbatch_dataset(
self._input_dataset._as_variant_tensor(),
**dataset_ops.flat_structure(self))
@property
def _element_structure(self):
return self._structure
@tf_export("data.experimental.unbatch")
def unbatch():
def _apply_fn(dataset):
if not sparse.any_sparse(dataset.output_classes):
return _UnbatchDataset(dataset)
def normalize(arg, *rest):
if rest:
return sparse.serialize_many_sparse_tensors((arg,) + rest)
else:
return sparse.serialize_many_sparse_tensors(arg)
normalized_dataset = dataset.map(normalize)
restructured_dataset = _RestructuredDataset(
normalized_dataset,
dataset.output_types,
dataset.output_shapes,
dataset.output_classes,
allow_unsafe_cast=True)
return _UnbatchDataset(restructured_dataset)
return _apply_fn
class _DenseToSparseBatchDataset(dataset_ops.UnaryDataset):
def __init__(self, input_dataset, batch_size, row_shape):
super(_DenseToSparseBatchDataset, self).__init__(input_dataset)
if not isinstance(input_dataset.output_types, dtypes.DType):
raise TypeError("DenseToSparseDataset requires an input whose elements "
"have a single component, whereas the input has %r." %
input_dataset.output_types)
self._input_dataset = input_dataset
self._batch_size = batch_size
self._row_shape = row_shape
self._structure = structure.SparseTensorStructure(
input_dataset.output_types,
tensor_shape.vector(None).concatenate(self._row_shape))
def _as_variant_tensor(self):
return ged_ops.experimental_dense_to_sparse_batch_dataset(
self._input_dataset._as_variant_tensor(),
self._batch_size,
row_shape=convert.partial_shape_to_tensor(self._row_shape),
**dataset_ops.flat_structure(self))
@property
def _element_structure(self):
return self._structure
class _RestructuredDataset(dataset_ops.UnaryDataset):
def __init__(self,
dataset,
output_types,
output_shapes=None,
output_classes=None,
allow_unsafe_cast=False):
super(_RestructuredDataset, self).__init__(dataset)
self._input_dataset = dataset
if not allow_unsafe_cast:
output_types = nest.map_structure(dtypes.as_dtype, output_types)
flat_original_types = nest.flatten(dataset.output_types)
flat_new_types = nest.flatten(output_types)
if flat_original_types != flat_new_types:
raise ValueError(
"Dataset with output types %r cannot be restructured to have "
"output types %r" % (dataset.output_types, output_types))
if output_shapes is None:
output_shapes = nest.pack_sequence_as(
output_types, nest.flatten(dataset.output_shapes))
else:
if not allow_unsafe_cast:
nest.assert_same_structure(output_types, output_shapes)
flat_original_shapes = nest.flatten(dataset.output_shapes)
flat_new_shapes = nest.flatten_up_to(output_types, output_shapes)
for original_shape, new_shape in zip(flat_original_shapes,
flat_new_shapes):
if not original_shape.is_compatible_with(new_shape):
raise ValueError(
"Dataset with output shapes %r cannot be restructured to have "
"incompatible output shapes %r" % (dataset.output_shapes,
output_shapes))
output_shapes = nest.map_structure_up_to(
output_types, tensor_shape.as_shape, output_shapes)
if output_classes is None:
output_classes = nest.pack_sequence_as(
output_types, nest.flatten(dataset.output_classes))
self._structure = structure.convert_legacy_structure(
output_types, output_shapes, output_classes)
def _as_variant_tensor(self):
return self._input_dataset._as_variant_tensor()
@property
def _element_structure(self):
return self._structure
class _MapAndBatchDataset(dataset_ops.UnaryDataset):
def __init__(self, input_dataset, map_func, batch_size, num_parallel_calls,
drop_remainder):
super(_MapAndBatchDataset, self).__init__(input_dataset)
self._input_dataset = input_dataset
self._map_func = dataset_ops.StructuredFunctionWrapper(
map_func, "tf.data.experimental.map_and_batch()", dataset=input_dataset)
self._batch_size_t = ops.convert_to_tensor(
batch_size, dtype=dtypes.int64, name="batch_size")
self._num_parallel_calls_t = ops.convert_to_tensor(
num_parallel_calls, dtype=dtypes.int64, name="num_parallel_calls")
self._drop_remainder_t = ops.convert_to_tensor(
drop_remainder, dtype=dtypes.bool, name="drop_remainder")
constant_drop_remainder = tensor_util.constant_value(self._drop_remainder_t)
if constant_drop_remainder:
self._structure = self._map_func.output_structure._batch(
tensor_util.constant_value(self._batch_size_t))
else:
self._structure = self._map_func.output_structure._batch(None)
def _functions(self):
return [self._map_func]
def _as_variant_tensor(self):
return ged_ops.experimental_map_and_batch_dataset(
self._input_dataset._as_variant_tensor(),
self._map_func.function.captured_inputs,
f=self._map_func.function,
batch_size=self._batch_size_t,
num_parallel_calls=self._num_parallel_calls_t,
drop_remainder=self._drop_remainder_t,
preserve_cardinality=True,
**dataset_ops.flat_structure(self))
@property
def _element_structure(self):
return self._structure
@tf_export("data.experimental.map_and_batch")
def map_and_batch(map_func,
batch_size,
num_parallel_batches=None,
drop_remainder=False,
num_parallel_calls=None):
if num_parallel_batches is None and num_parallel_calls is None:
num_parallel_calls = batch_size
elif num_parallel_batches is not None and num_parallel_calls is None:
num_parallel_calls = batch_size * num_parallel_batches
elif num_parallel_batches is not None and num_parallel_calls is not None:
raise ValueError("The `num_parallel_batches` and `num_parallel_calls` "
"arguments are mutually exclusive.")
def _apply_fn(dataset):
return _MapAndBatchDataset(dataset, map_func, batch_size,
num_parallel_calls, drop_remainder)
return _apply_fn
| true
| true
|
f70a4e811c901d0c029f84d9ed26ad4bb9ede94d
| 2,022
|
py
|
Python
|
src/compas_rv2/ui/Rhino/RV2/dev/RV2force_modify_vertices_cmd.py
|
selinabitting/compas-RV2
|
0884cc00d09c8f4a75eb2b97614105e4c8bfd818
|
[
"MIT"
] | 34
|
2020-04-27T13:54:38.000Z
|
2022-01-17T19:16:27.000Z
|
src/compas_rv2/ui/Rhino/RV2/dev/RV2force_modify_vertices_cmd.py
|
selinabitting/compas-RV2
|
0884cc00d09c8f4a75eb2b97614105e4c8bfd818
|
[
"MIT"
] | 306
|
2020-04-27T12:00:54.000Z
|
2022-03-23T22:28:54.000Z
|
src/compas_rv2/ui/Rhino/RV2/dev/RV2force_modify_vertices_cmd.py
|
selinabitting/compas-RV2
|
0884cc00d09c8f4a75eb2b97614105e4c8bfd818
|
[
"MIT"
] | 11
|
2020-06-30T08:23:40.000Z
|
2022-02-01T20:47:39.000Z
|
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.utilities import flatten
import compas_rhino
from compas_rv2.rhino import get_scene
from compas_rv2.rhino import rv2_undo
from compas_rv2.rhino import rv2_error
# from compas_rv2.rhino import ModifyAttributesForm
__commandname__ = "RV2force_modify_vertices"
@rv2_error()
@rv2_undo
def RunCommand(is_interactive):
scene = get_scene()
if not scene:
return
force = scene.get("force")[0]
if not force:
print("There is no ForceDiagram in the scene.")
return
thrust = scene.get("thrust")[0]
options = ["All", "ByContinuousEdges", "Manual"]
option = compas_rhino.rs.GetString("Selection Type.", strings=options)
if not option:
return
if option == "All":
keys = list(force.datastructure.vertices())
elif option == "ByContinuousEdges":
temp = force.select_edges()
keys = list(set(flatten([force.datastructure.vertices_on_edge_loop(key) for key in temp])))
elif option == "Manual":
keys = force.select_vertices()
if keys:
# current = scene.settings['RV2']['show.angles']
# scene.settings['RV2']['show.angles'] = False
# scene.update()
# ModifyAttributesForm.from_sceneNode(force, 'vertices', keys)
# scene.settings['RV2']['show.angles'] = current
# if thrust:
# thrust.settings['_is.valid'] = False
# scene.update()
public = [name for name in force.datastructure.default_vertex_attributes.keys() if not name.startswith('_')]
if force.update_vertices_attributes(keys, names=public):
if thrust:
thrust.settings['_is.valid'] = False
scene.update()
# ==============================================================================
# Main
# ==============================================================================
if __name__ == "__main__":
RunCommand(True)
| 27.69863
| 116
| 0.611276
|
from __future__ import print_function
from __future__ import absolute_import
from __future__ import division
from compas.utilities import flatten
import compas_rhino
from compas_rv2.rhino import get_scene
from compas_rv2.rhino import rv2_undo
from compas_rv2.rhino import rv2_error
__commandname__ = "RV2force_modify_vertices"
@rv2_error()
@rv2_undo
def RunCommand(is_interactive):
scene = get_scene()
if not scene:
return
force = scene.get("force")[0]
if not force:
print("There is no ForceDiagram in the scene.")
return
thrust = scene.get("thrust")[0]
options = ["All", "ByContinuousEdges", "Manual"]
option = compas_rhino.rs.GetString("Selection Type.", strings=options)
if not option:
return
if option == "All":
keys = list(force.datastructure.vertices())
elif option == "ByContinuousEdges":
temp = force.select_edges()
keys = list(set(flatten([force.datastructure.vertices_on_edge_loop(key) for key in temp])))
elif option == "Manual":
keys = force.select_vertices()
if keys:
public = [name for name in force.datastructure.default_vertex_attributes.keys() if not name.startswith('_')]
if force.update_vertices_attributes(keys, names=public):
if thrust:
thrust.settings['_is.valid'] = False
scene.update()
if __name__ == "__main__":
RunCommand(True)
| true
| true
|
f70a4f99ed17d4e51bbbcf86b20403048c13eea3
| 491
|
py
|
Python
|
tests/system/test_base.py
|
live-wire/terminalbeat
|
c85b86d6b118beb52b1e4d037c1984f36a1e5935
|
[
"Apache-2.0"
] | 8
|
2019-01-14T14:49:09.000Z
|
2020-07-24T18:32:06.000Z
|
tests/system/test_base.py
|
live-wire/terminalbeat
|
c85b86d6b118beb52b1e4d037c1984f36a1e5935
|
[
"Apache-2.0"
] | 1
|
2019-11-26T22:32:53.000Z
|
2019-11-28T03:11:30.000Z
|
tests/system/test_base.py
|
live-wire/terminalbeat
|
c85b86d6b118beb52b1e4d037c1984f36a1e5935
|
[
"Apache-2.0"
] | 1
|
2019-09-01T05:47:58.000Z
|
2019-09-01T05:47:58.000Z
|
from terminalbeat import BaseTest
import os
class Test(BaseTest):
def test_base(self):
"""
Basic test with exiting Terminalbeat normally
"""
self.render_config_template(
path=os.path.abspath(self.working_dir) + "/log/*"
)
terminalbeat_proc = self.start_beat()
self.wait_until(lambda: self.log_contains("terminalbeat is running"))
exit_code = terminalbeat_proc.kill_and_wait()
assert exit_code == 0
| 24.55
| 77
| 0.641548
|
from terminalbeat import BaseTest
import os
class Test(BaseTest):
def test_base(self):
self.render_config_template(
path=os.path.abspath(self.working_dir) + "/log/*"
)
terminalbeat_proc = self.start_beat()
self.wait_until(lambda: self.log_contains("terminalbeat is running"))
exit_code = terminalbeat_proc.kill_and_wait()
assert exit_code == 0
| true
| true
|
f70a517cef671f469725873b87a9a185709dbe5b
| 9,021
|
py
|
Python
|
saleor/credit/models.py
|
glosoftgroup/KahawaHardware
|
893e94246583addf41c3bb0d58d2ce6bcd233c4f
|
[
"BSD-3-Clause"
] | null | null | null |
saleor/credit/models.py
|
glosoftgroup/KahawaHardware
|
893e94246583addf41c3bb0d58d2ce6bcd233c4f
|
[
"BSD-3-Clause"
] | null | null | null |
saleor/credit/models.py
|
glosoftgroup/KahawaHardware
|
893e94246583addf41c3bb0d58d2ce6bcd233c4f
|
[
"BSD-3-Clause"
] | null | null | null |
from __future__ import unicode_literals
from decimal import Decimal
from django.conf import settings
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.db.models import Sum
from django.utils.encoding import python_2_unicode_compatible
from django.utils.timezone import now
from django.utils.translation import pgettext_lazy
from django_prices.models import PriceField
from django.utils import timezone
from datetime import datetime, timedelta
from ..userprofile.models import Address
from ..customer.models import Customer
from ..site.models import SiteSettings
from ..sale.models import Terminal, PaymentOption
from . import OrderStatus
class CreditManager(models.Manager):
def due_credits(self):
return self.get_queryset().filter(due_date__lte=timezone.now())
def customer_credits(self, customer):
return self.get_queryset().filter(customer=customer).aggregate(Sum('debt'))['debt__sum']
def expired_credit(self):
max_credit_date = SiteSettings.objects.get(pk=1).max_credit_date
days = timezone.now()-timedelta(days=max_credit_date)
return self.get_queryset().filter(created__lte=timezone.now()-timedelta(days=max_credit_date))
class Credit(models.Model):
status = models.CharField(
pgettext_lazy('Credit field', 'Credit status'),
max_length=32, choices=OrderStatus.CHOICES, default=OrderStatus.NEW)
created = models.DateTimeField(
pgettext_lazy('Credit field', 'created'),
default=now, editable=False)
last_status_change = models.DateTimeField(
pgettext_lazy('Credit field', 'last status change'),
default=now, editable=False)
customer = models.ForeignKey(
Customer, blank=True, null=True, related_name='credit_customers',
verbose_name=pgettext_lazy('Credit field', 'customer'))
mobile = models.CharField(max_length=20, blank=True, null=True)
customer_name = models.CharField(max_length=100, null=True, blank=True)
user = models.ForeignKey(
settings.AUTH_USER_MODEL, blank=True, null=True, related_name='creditor',
verbose_name=pgettext_lazy('Credit field', 'user'))
language_code = models.CharField(max_length=35, default=settings.LANGUAGE_CODE)
billing_address = models.ForeignKey(
Address, related_name='+', editable=False,blank=True, null=True,
verbose_name=pgettext_lazy('Credit field', 'billing address'))
user_email = models.EmailField(
pgettext_lazy('Credit field', 'user email'),
blank=True, default='', editable=False)
terminal = models.ForeignKey(
Terminal, related_name='terminal_credit',blank=True, default='',
verbose_name=pgettext_lazy('Credit field', 'order'))
invoice_number = models.CharField(
pgettext_lazy('Credit field', 'invoice_number'), unique=True, null=True, max_length=36,)
total_net = models.DecimalField(
pgettext_lazy('Credit field', 'total net'), default=Decimal(0), max_digits=100, decimal_places=2)
sub_total = models.DecimalField(
pgettext_lazy('Credit field', 'sub total'), default=Decimal(0), max_digits=100, decimal_places=2)
total_tax = models.DecimalField(
pgettext_lazy('Credit field', 'total tax'), default=Decimal(0), max_digits=100, decimal_places=2)
amount_paid = models.DecimalField(
pgettext_lazy('Credit field', 'amount paid'), default=Decimal(0), max_digits=100, decimal_places=2)
balance = models.DecimalField(
pgettext_lazy('Credit field', 'balance'), default=Decimal(0), max_digits=100, decimal_places=2)
debt = models.DecimalField(
pgettext_lazy('Credit field', 'debt'), default=Decimal(0), max_digits=100, decimal_places=2)
discount_amount = PriceField(
verbose_name=pgettext_lazy('Credit field', 'discount amount'),
currency=settings.DEFAULT_CURRENCY, max_digits=12, decimal_places=2,
blank=True, null=True)
discount_name = models.CharField(
verbose_name=pgettext_lazy('Credit field', 'discount name'),
max_length=255, default='', blank=True)
payment_options = models.ManyToManyField(
PaymentOption, related_name='credit_payment_option', blank=True,
verbose_name=pgettext_lazy('Sales field',
'sales options'))
notified = models.BooleanField(default=False, blank=False)
due_date = models.DateTimeField(
pgettext_lazy('Credit field', 'due date'),
null=False, default=now)
car_registration = models.CharField(max_length=100, null=True, blank=True)
objects = CreditManager()
class Meta:
ordering = ('-last_status_change',)
verbose_name = pgettext_lazy('Credit model', 'Credit')
verbose_name_plural = pgettext_lazy('Credit model', 'Credits')
def __str__(self):
return self.invoice_number
def __unicode__(self):
return unicode(self.invoice_number)
def total_items(self):
return len(self.credititems.all())
def items(self):
return self.credititems.all()
def is_fully_paid(self):
if self.status == 'fully-paid':
return True
else:
return False
def is_due(self):
if self.due_date <= timezone.now():
return True
return False
def is_expired(self):
difference = datetime.now() - self.created.replace(tzinfo=None)
max_credit_date = SiteSettings.objects.get(pk=1).max_credit_date
if difference.days > max_credit_date:
return True
return False
def total_amount(self):
return len(self.credit_history.all())
def total_balance(self):
return self.credit_history.aggregate(Sum('balance'))['balance__sum']
class CreditedItem(models.Model):
credit = models.ForeignKey(Credit,related_name='credititems',on_delete=models.CASCADE)
order = models.IntegerField(default=Decimal(1))
sku = models.CharField(
pgettext_lazy('CreditedItem field', 'SKU'), max_length=32)
quantity = models.IntegerField(
pgettext_lazy('CreditedItem field', 'quantity'),
validators=[MinValueValidator(0)], default=Decimal(1))
product_name = models.CharField(
pgettext_lazy('CreditedItem field', 'product name'), max_length=128)
total_cost = models.DecimalField(
pgettext_lazy('CreditedItem field', 'total cost'), default=Decimal(0), max_digits=100, decimal_places=2)
unit_cost = models.DecimalField(
pgettext_lazy('CreditedItem field', 'unit cost'), default=Decimal(0), max_digits=100, decimal_places=2)
product_category = models.CharField(
pgettext_lazy('CreditedItem field', 'product_category'), max_length=128, null=True)
discount = models.DecimalField(
pgettext_lazy('SoldItem field', 'discount'), default=Decimal(0), max_digits=100, decimal_places=2)
tax = models.IntegerField(default=Decimal(0))
class Meta:
#unique_together = ('sales')
ordering = ['order']
def __unicode__(self):
return '%d: %s' % (self.order,self.product_name)
def __str__(self):
return self.product_name
@python_2_unicode_compatible
class CreditHistoryEntry(models.Model):
date = models.DateTimeField(
pgettext_lazy('Credit history entry field', 'last history change'),
default=now, editable=False)
created = models.DateTimeField(
pgettext_lazy('Credit history entry field', 'created'),
default=now, editable=False)
credit = models.ForeignKey(
Credit, related_name='credit_history',
verbose_name=pgettext_lazy('Credit history entry field', 'order'))
amount = models.DecimalField(
pgettext_lazy('Credit history entry field', 'amount cost'), default=Decimal(0), max_digits=100, decimal_places=2)
balance = models.DecimalField(
pgettext_lazy('Credit history entry field', 'balance'), default=Decimal(0), max_digits=100,
decimal_places=2)
comment = models.CharField(
pgettext_lazy('Credit history entry field', 'comment'),
max_length=100, default='', blank=True)
crud = models.CharField(
pgettext_lazy('Credit history entry field', 'crud'),
max_length=30, default='', blank=True)
user = models.ForeignKey(
settings.AUTH_USER_MODEL, blank=True, null=True,
verbose_name=pgettext_lazy('Credit history entry field', 'user'))
class Meta:
ordering = ('date',)
verbose_name = pgettext_lazy(
'Credit history entry model', 'Credit history entry')
verbose_name_plural = pgettext_lazy(
'Credit history entry model', 'Credit history entries')
def __str__(self):
return pgettext_lazy(
'Credit history entry str',
'CreditHistoryEntry for terminal #%s') % self.credit.invoice_number
| 41.004545
| 121
| 0.687729
|
from __future__ import unicode_literals
from decimal import Decimal
from django.conf import settings
from django.core.validators import MaxValueValidator, MinValueValidator
from django.db import models
from django.db.models import Sum
from django.utils.encoding import python_2_unicode_compatible
from django.utils.timezone import now
from django.utils.translation import pgettext_lazy
from django_prices.models import PriceField
from django.utils import timezone
from datetime import datetime, timedelta
from ..userprofile.models import Address
from ..customer.models import Customer
from ..site.models import SiteSettings
from ..sale.models import Terminal, PaymentOption
from . import OrderStatus
class CreditManager(models.Manager):
def due_credits(self):
return self.get_queryset().filter(due_date__lte=timezone.now())
def customer_credits(self, customer):
return self.get_queryset().filter(customer=customer).aggregate(Sum('debt'))['debt__sum']
def expired_credit(self):
max_credit_date = SiteSettings.objects.get(pk=1).max_credit_date
days = timezone.now()-timedelta(days=max_credit_date)
return self.get_queryset().filter(created__lte=timezone.now()-timedelta(days=max_credit_date))
class Credit(models.Model):
status = models.CharField(
pgettext_lazy('Credit field', 'Credit status'),
max_length=32, choices=OrderStatus.CHOICES, default=OrderStatus.NEW)
created = models.DateTimeField(
pgettext_lazy('Credit field', 'created'),
default=now, editable=False)
last_status_change = models.DateTimeField(
pgettext_lazy('Credit field', 'last status change'),
default=now, editable=False)
customer = models.ForeignKey(
Customer, blank=True, null=True, related_name='credit_customers',
verbose_name=pgettext_lazy('Credit field', 'customer'))
mobile = models.CharField(max_length=20, blank=True, null=True)
customer_name = models.CharField(max_length=100, null=True, blank=True)
user = models.ForeignKey(
settings.AUTH_USER_MODEL, blank=True, null=True, related_name='creditor',
verbose_name=pgettext_lazy('Credit field', 'user'))
language_code = models.CharField(max_length=35, default=settings.LANGUAGE_CODE)
billing_address = models.ForeignKey(
Address, related_name='+', editable=False,blank=True, null=True,
verbose_name=pgettext_lazy('Credit field', 'billing address'))
user_email = models.EmailField(
pgettext_lazy('Credit field', 'user email'),
blank=True, default='', editable=False)
terminal = models.ForeignKey(
Terminal, related_name='terminal_credit',blank=True, default='',
verbose_name=pgettext_lazy('Credit field', 'order'))
invoice_number = models.CharField(
pgettext_lazy('Credit field', 'invoice_number'), unique=True, null=True, max_length=36,)
total_net = models.DecimalField(
pgettext_lazy('Credit field', 'total net'), default=Decimal(0), max_digits=100, decimal_places=2)
sub_total = models.DecimalField(
pgettext_lazy('Credit field', 'sub total'), default=Decimal(0), max_digits=100, decimal_places=2)
total_tax = models.DecimalField(
pgettext_lazy('Credit field', 'total tax'), default=Decimal(0), max_digits=100, decimal_places=2)
amount_paid = models.DecimalField(
pgettext_lazy('Credit field', 'amount paid'), default=Decimal(0), max_digits=100, decimal_places=2)
balance = models.DecimalField(
pgettext_lazy('Credit field', 'balance'), default=Decimal(0), max_digits=100, decimal_places=2)
debt = models.DecimalField(
pgettext_lazy('Credit field', 'debt'), default=Decimal(0), max_digits=100, decimal_places=2)
discount_amount = PriceField(
verbose_name=pgettext_lazy('Credit field', 'discount amount'),
currency=settings.DEFAULT_CURRENCY, max_digits=12, decimal_places=2,
blank=True, null=True)
discount_name = models.CharField(
verbose_name=pgettext_lazy('Credit field', 'discount name'),
max_length=255, default='', blank=True)
payment_options = models.ManyToManyField(
PaymentOption, related_name='credit_payment_option', blank=True,
verbose_name=pgettext_lazy('Sales field',
'sales options'))
notified = models.BooleanField(default=False, blank=False)
due_date = models.DateTimeField(
pgettext_lazy('Credit field', 'due date'),
null=False, default=now)
car_registration = models.CharField(max_length=100, null=True, blank=True)
objects = CreditManager()
class Meta:
ordering = ('-last_status_change',)
verbose_name = pgettext_lazy('Credit model', 'Credit')
verbose_name_plural = pgettext_lazy('Credit model', 'Credits')
def __str__(self):
return self.invoice_number
def __unicode__(self):
return unicode(self.invoice_number)
def total_items(self):
return len(self.credititems.all())
def items(self):
return self.credititems.all()
def is_fully_paid(self):
if self.status == 'fully-paid':
return True
else:
return False
def is_due(self):
if self.due_date <= timezone.now():
return True
return False
def is_expired(self):
difference = datetime.now() - self.created.replace(tzinfo=None)
max_credit_date = SiteSettings.objects.get(pk=1).max_credit_date
if difference.days > max_credit_date:
return True
return False
def total_amount(self):
return len(self.credit_history.all())
def total_balance(self):
return self.credit_history.aggregate(Sum('balance'))['balance__sum']
class CreditedItem(models.Model):
credit = models.ForeignKey(Credit,related_name='credititems',on_delete=models.CASCADE)
order = models.IntegerField(default=Decimal(1))
sku = models.CharField(
pgettext_lazy('CreditedItem field', 'SKU'), max_length=32)
quantity = models.IntegerField(
pgettext_lazy('CreditedItem field', 'quantity'),
validators=[MinValueValidator(0)], default=Decimal(1))
product_name = models.CharField(
pgettext_lazy('CreditedItem field', 'product name'), max_length=128)
total_cost = models.DecimalField(
pgettext_lazy('CreditedItem field', 'total cost'), default=Decimal(0), max_digits=100, decimal_places=2)
unit_cost = models.DecimalField(
pgettext_lazy('CreditedItem field', 'unit cost'), default=Decimal(0), max_digits=100, decimal_places=2)
product_category = models.CharField(
pgettext_lazy('CreditedItem field', 'product_category'), max_length=128, null=True)
discount = models.DecimalField(
pgettext_lazy('SoldItem field', 'discount'), default=Decimal(0), max_digits=100, decimal_places=2)
tax = models.IntegerField(default=Decimal(0))
class Meta:
ordering = ['order']
def __unicode__(self):
return '%d: %s' % (self.order,self.product_name)
def __str__(self):
return self.product_name
@python_2_unicode_compatible
class CreditHistoryEntry(models.Model):
date = models.DateTimeField(
pgettext_lazy('Credit history entry field', 'last history change'),
default=now, editable=False)
created = models.DateTimeField(
pgettext_lazy('Credit history entry field', 'created'),
default=now, editable=False)
credit = models.ForeignKey(
Credit, related_name='credit_history',
verbose_name=pgettext_lazy('Credit history entry field', 'order'))
amount = models.DecimalField(
pgettext_lazy('Credit history entry field', 'amount cost'), default=Decimal(0), max_digits=100, decimal_places=2)
balance = models.DecimalField(
pgettext_lazy('Credit history entry field', 'balance'), default=Decimal(0), max_digits=100,
decimal_places=2)
comment = models.CharField(
pgettext_lazy('Credit history entry field', 'comment'),
max_length=100, default='', blank=True)
crud = models.CharField(
pgettext_lazy('Credit history entry field', 'crud'),
max_length=30, default='', blank=True)
user = models.ForeignKey(
settings.AUTH_USER_MODEL, blank=True, null=True,
verbose_name=pgettext_lazy('Credit history entry field', 'user'))
class Meta:
ordering = ('date',)
verbose_name = pgettext_lazy(
'Credit history entry model', 'Credit history entry')
verbose_name_plural = pgettext_lazy(
'Credit history entry model', 'Credit history entries')
def __str__(self):
return pgettext_lazy(
'Credit history entry str',
'CreditHistoryEntry for terminal #%s') % self.credit.invoice_number
| true
| true
|
f70a5222663a3702e2a5dc5e9d2718c5d92ef525
| 629
|
py
|
Python
|
solve.py
|
LeoQuote/power-flow-python
|
7382c116d3b2583fa3d8406d58290aa3ba91db7c
|
[
"MIT"
] | 3
|
2015-11-05T08:11:02.000Z
|
2021-05-07T13:44:53.000Z
|
solve.py
|
LeoQuote/power-flow-python
|
7382c116d3b2583fa3d8406d58290aa3ba91db7c
|
[
"MIT"
] | null | null | null |
solve.py
|
LeoQuote/power-flow-python
|
7382c116d3b2583fa3d8406d58290aa3ba91db7c
|
[
"MIT"
] | null | null | null |
for j in range(y_bus_size - 1, -1, -1):
f=[]
f += [0] * j
h=f.copy()
f += [1]
for i in range(j + 1, y_bus_size):
f += [0]
for k in range(j, i):
# print(j,i,k)
# 临时变量temp,存储l f 的乘积
f[i] -= facter_table[k, i] * f[k]
# print(f)
for i in range(j, y_bus_size):
h += [f[i] * facter_table[i, i]]
# print(h)
# print(f,j)
for i in range(y_bus_size - 1, -1, -1):
z_bus[i, j]=h[i]
# print(i,j)
for k in range(i + 1, y_bus_size):
# print('in!')
z_bus[i, j] -= facter_table[i, k] * z_bus[k, j]
| 27.347826
| 59
| 0.430843
|
for j in range(y_bus_size - 1, -1, -1):
f=[]
f += [0] * j
h=f.copy()
f += [1]
for i in range(j + 1, y_bus_size):
f += [0]
for k in range(j, i):
f[i] -= facter_table[k, i] * f[k]
for i in range(j, y_bus_size):
h += [f[i] * facter_table[i, i]]
for i in range(y_bus_size - 1, -1, -1):
z_bus[i, j]=h[i]
for k in range(i + 1, y_bus_size):
z_bus[i, j] -= facter_table[i, k] * z_bus[k, j]
| true
| true
|
f70a52490eb88a7e170aead0a106cbf79e90a6dd
| 461
|
py
|
Python
|
env/Lib/site-packages/plotly/validators/scattergl/marker/colorbar/_tickprefix.py
|
andresgreen-byte/Laboratorio-1--Inversion-de-Capital
|
8a4707301d19c3826c31026c4077930bcd6a8182
|
[
"MIT"
] | 11,750
|
2015-10-12T07:03:39.000Z
|
2022-03-31T20:43:15.000Z
|
env/Lib/site-packages/plotly/validators/scattergl/marker/colorbar/_tickprefix.py
|
andresgreen-byte/Laboratorio-1--Inversion-de-Capital
|
8a4707301d19c3826c31026c4077930bcd6a8182
|
[
"MIT"
] | 2,951
|
2015-10-12T00:41:25.000Z
|
2022-03-31T22:19:26.000Z
|
env/Lib/site-packages/plotly/validators/scattergl/marker/colorbar/_tickprefix.py
|
andresgreen-byte/Laboratorio-1--Inversion-de-Capital
|
8a4707301d19c3826c31026c4077930bcd6a8182
|
[
"MIT"
] | 2,623
|
2015-10-15T14:40:27.000Z
|
2022-03-28T16:05:50.000Z
|
import _plotly_utils.basevalidators
class TickprefixValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="tickprefix",
parent_name="scattergl.marker.colorbar",
**kwargs
):
super(TickprefixValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "calc"),
**kwargs
)
| 27.117647
| 72
| 0.633406
|
import _plotly_utils.basevalidators
class TickprefixValidator(_plotly_utils.basevalidators.StringValidator):
def __init__(
self,
plotly_name="tickprefix",
parent_name="scattergl.marker.colorbar",
**kwargs
):
super(TickprefixValidator, self).__init__(
plotly_name=plotly_name,
parent_name=parent_name,
edit_type=kwargs.pop("edit_type", "calc"),
**kwargs
)
| true
| true
|
f70a529f71d485b581dd3d7d9dad29024325cffa
| 1,391
|
py
|
Python
|
tests/features/steps/call_steps.py
|
candango/taskio
|
cd9687dc7facfea45f45631f44f21075c14e4a7b
|
[
"Apache-2.0"
] | null | null | null |
tests/features/steps/call_steps.py
|
candango/taskio
|
cd9687dc7facfea45f45631f44f21075c14e4a7b
|
[
"Apache-2.0"
] | 9
|
2020-02-13T03:16:18.000Z
|
2022-03-24T05:14:43.000Z
|
tests/features/steps/call_steps.py
|
candango/taskio
|
cd9687dc7facfea45f45631f44f21075c14e4a7b
|
[
"Apache-2.0"
] | 1
|
2019-10-09T14:52:56.000Z
|
2019-10-09T14:52:56.000Z
|
# -*- coding: UTF-8 -*-
#
# Copyright 2019-2022 Flávio Gonçalves Garcia
#
# 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.
from behave import given, when, then
from taskio.process import TaskioLoader
from behave.api.async_step import async_run_until_complete
from tests import PROJECT_ROOT
import sys
@when("{command} is called from {program} program")
def step_is_called_from_program(context, command, program):
program_attribute = "%s_program" % program
current_program: TaskioLoader = getattr(context, program_attribute)
current_program.program.args = [command]
current_category = current_program.program.what_category()
context.what_to_run = current_program.program.what_to_run(
current_category)
@then("program will resolve command")
def set_program_will_resolve_command(context):
context.tester.assertTrue(isinstance(context.what_to_run, TaskioCommand))
| 37.594595
| 77
| 0.777858
|
from behave import given, when, then
from taskio.process import TaskioLoader
from behave.api.async_step import async_run_until_complete
from tests import PROJECT_ROOT
import sys
@when("{command} is called from {program} program")
def step_is_called_from_program(context, command, program):
program_attribute = "%s_program" % program
current_program: TaskioLoader = getattr(context, program_attribute)
current_program.program.args = [command]
current_category = current_program.program.what_category()
context.what_to_run = current_program.program.what_to_run(
current_category)
@then("program will resolve command")
def set_program_will_resolve_command(context):
context.tester.assertTrue(isinstance(context.what_to_run, TaskioCommand))
| true
| true
|
f70a52a9a23a725b7c77f7cc457a46c90b493435
| 196
|
py
|
Python
|
sphinx/source/docs/user_guide/source_examples/charts_histogram_values_field_arg.py
|
quasiben/bokeh
|
738343bd18c851dfd1fdc82cf35fe3eb4cdfd475
|
[
"BSD-3-Clause"
] | 1
|
2017-08-02T23:12:03.000Z
|
2017-08-02T23:12:03.000Z
|
sphinx/source/docs/user_guide/source_examples/charts_histogram_values_field_arg.py
|
evidation-health/bokeh
|
2c580d93419033b962d36e3c46d7606cc2f24606
|
[
"BSD-3-Clause"
] | null | null | null |
sphinx/source/docs/user_guide/source_examples/charts_histogram_values_field_arg.py
|
evidation-health/bokeh
|
2c580d93419033b962d36e3c46d7606cc2f24606
|
[
"BSD-3-Clause"
] | null | null | null |
from bokeh.charts import Histogram, output_file, show
from bokeh.sampledata.autompg import autompg as df
p = Histogram(df, 'hp', title="HP Distribution")
output_file("histogram.html",)
show(p)
| 21.777778
| 53
| 0.765306
|
from bokeh.charts import Histogram, output_file, show
from bokeh.sampledata.autompg import autompg as df
p = Histogram(df, 'hp', title="HP Distribution")
output_file("histogram.html",)
show(p)
| true
| true
|
f70a52f93364ea4968332dac6b553bf9463c313f
| 778
|
py
|
Python
|
src/token.py
|
AsmusAB/wrap-tz-contracts
|
8b93a63507e5f8e5ce816ceb7fe0cbaf5e83f6e7
|
[
"MIT"
] | 1
|
2021-12-11T17:14:31.000Z
|
2021-12-11T17:14:31.000Z
|
src/token.py
|
AsmusAB/wrap-tz-contracts
|
8b93a63507e5f8e5ce816ceb7fe0cbaf5e83f6e7
|
[
"MIT"
] | 4
|
2021-02-26T08:02:11.000Z
|
2021-06-23T20:27:39.000Z
|
src/token.py
|
AsmusAB/wrap-tz-contracts
|
8b93a63507e5f8e5ce816ceb7fe0cbaf5e83f6e7
|
[
"MIT"
] | 6
|
2021-04-13T07:34:52.000Z
|
2022-03-09T04:29:47.000Z
|
from pytezos import PyTezosClient
class Token(object):
def __init__(self, client: PyTezosClient):
self.client = client
def set_admin(self, contract_id, new_admin):
print(f"Setting fa2 admin on {contract_id} to {new_admin}")
call = self.set_admin_call(contract_id, new_admin)
res = call.autofill().sign().inject(_async=False)
print(f"Done {res[0]['hash']}")
def set_admin_call(self, contract_id, new_admin):
contract = self.client.contract(contract_id)
op = contract \
.set_admin(new_admin)
return op
def set_minter_call(self, contract_id, new_admin):
contract = self.client.contract(contract_id)
op = contract \
.set_minter(new_admin)
return op
| 31.12
| 67
| 0.64653
|
from pytezos import PyTezosClient
class Token(object):
def __init__(self, client: PyTezosClient):
self.client = client
def set_admin(self, contract_id, new_admin):
print(f"Setting fa2 admin on {contract_id} to {new_admin}")
call = self.set_admin_call(contract_id, new_admin)
res = call.autofill().sign().inject(_async=False)
print(f"Done {res[0]['hash']}")
def set_admin_call(self, contract_id, new_admin):
contract = self.client.contract(contract_id)
op = contract \
.set_admin(new_admin)
return op
def set_minter_call(self, contract_id, new_admin):
contract = self.client.contract(contract_id)
op = contract \
.set_minter(new_admin)
return op
| true
| true
|
f70a53626db7b46409330eca5f315ce54d9032aa
| 8,161
|
py
|
Python
|
Scripts/DvdListFiles.py
|
ogamespec/dolwin-python
|
c5dade6a9fc1dd716d85a839a4ce967a65011292
|
[
"CC0-1.0"
] | 2
|
2020-10-16T09:49:22.000Z
|
2020-11-18T01:11:58.000Z
|
Scripts/DvdListFiles.py
|
ogamespec/dolwin-python
|
c5dade6a9fc1dd716d85a839a4ce967a65011292
|
[
"CC0-1.0"
] | null | null | null |
Scripts/DvdListFiles.py
|
ogamespec/dolwin-python
|
c5dade6a9fc1dd716d85a839a4ce967a65011292
|
[
"CC0-1.0"
] | null | null | null |
'''
Parse the FST of the current disk and list the files
Example:
MountIso c:/isos/ac.gcm (mount existing GCM)
% DvdListFiles
'''
def do_command(dolwin, args):
# Check if any DVD is mounted (real GCM image or DolphinSDK virtual disk)
mounted = False
res = dolwin.ExecuteWithResult ("DvdInfo 1") # Silent mode
#print (res)
for i in res["result"]:
if type(i) == str:
mounted = i != ""
if not mounted:
print ("DVD is not mounted")
return
# Get FST offset on disk and its size
DVD_BB2_OFFSET = 0x0420
DVD_APPLDR_OFFSET = 0x2440
BB2_FSTPosition = 4
BB2_FSTLength = 8
fstEntrySize = 12;
fstOffset = __DvdReadUInt32 (dolwin, DVD_BB2_OFFSET + BB2_FSTPosition)
fstLength = __DvdReadUInt32 (dolwin, DVD_BB2_OFFSET + BB2_FSTLength) # Including name table
print ( "FST offset: 0x%0.8X, length: 0x%0.8X" % (fstOffset, fstLength))
if fstOffset <= DVD_APPLDR_OFFSET:
print ("Suspicious FST offset")
return
if fstLength > 16*1024*1024 or fstLength < fstEntrySize:
print ("Invalid FST size")
return
# Get the number of entries in FST
if __DvdReadUInt8(dolwin, fstOffset) != 1:
print ("Invalid FST format. The first entry must be of type isDir = 1")
return
numEntries = __DvdReadUInt32(dolwin, fstOffset + 8)
if numEntries * fstEntrySize > fstLength:
print ("The number of records exceeds the specified FST size (including nametable)")
return
nameTableLength = fstLength - numEntries * fstEntrySize
if nameTableLength <= 0:
print ("Suspicious nametable size")
return
print ("FST entries count: " + str(numEntries))
print ("Nametable size: " + str(nameTableLength) + " bytes")
# Load nametable
nametable = __DvdReadLargeChunk(dolwin, fstOffset + numEntries * fstEntrySize, nameTableLength)
#print ("nametable: " + str(nametable))
# Collect all FST entries into a common collection for easy display
entryOffset = fstOffset # Offset of the current entry
entries = [] # Save all entries to this collection
while numEntries != 0:
entry = FSTEntry()
entry.id = len(entries)
entry.isDir = __DvdReadUInt8(dolwin, entryOffset) != 0
entry.nameOffset = (__DvdReadUInt8(dolwin, entryOffset + 1) << 16) | __DvdReadUInt16(dolwin, entryOffset + 2)
if entry.isDir:
entry.parentOffset = __DvdReadUInt32(dolwin, entryOffset + 4)
entry.nextOffset = __DvdReadUInt32(dolwin, entryOffset + 8)
else:
entry.fileOffset = __DvdReadUInt32(dolwin, entryOffset + 4)
entry.fileLength = __DvdReadUInt32(dolwin, entryOffset + 8)
entries.append(entry)
numEntries -= 1
entryOffset += fstEntrySize
# Consecutively display the contents of FST entries (each entry is either a directory or a file)
print ("category [entry_id]: path (nameOffset), ... directory/file specific info")
for e in entries:
__DumpFstEntry (e, entries, nametable)
'''
Display FST entry contents
'''
def __DumpFstEntry (entry, entries, nametable):
if entry.isDir:
if entry.id == 0:
print ("dir [0]: (root)")
else:
print ("dir [%d]: %s (%d), parent: %d, next: %d" % (entry.id, __DvdGetName(nametable, entry.nameOffset), entry.nameOffset, entry.parentOffset, entry.nextOffset))
else:
fullPath = __DvdGetName(nametable, entry.nameOffset)
# To understand how the FST hierarchical structure works, see the bottom of this file.
# Get parent directory by iterating over FST entries backward until isDir = 1 is encountered.
# The `next` value for the directory must be greater file ID
parentDirId = 0
currentId = entry.id
while currentId != 0:
if entries[currentId].isDir and entries[currentId].nextOffset > entry.id:
parentDirId = currentId
break
currentId -= 1
# Recursively climb up directories until a directory with parent = 0 is encountered
while parentDirId != 0:
fullPath = __DvdGetName(nametable, entries[parentDirId].nameOffset) + "/" + fullPath
parentDirId = entries[parentDirId].parentOffset
fullPath = "/" + fullPath
print ("file [%d]: %s (%d), offset: 0x%0.8X, len: 0x%0.8X" % (entry.id, fullPath, entry.nameOffset, entry.fileOffset, entry.fileLength))
'''
Read uint8_t from disk
'''
def __DvdReadUInt8(dolwin, offset):
dolwin.Execute ("DvdSeek " + str(offset))
res = dolwin.ExecuteWithResult ( "DvdRead 1 1")
return res["result"][0]
'''
Read uint16_t from disk (already swapped to little-endian)
'''
def __DvdReadUInt16(dolwin, offset):
dolwin.Execute ("DvdSeek " + str(offset))
res = dolwin.ExecuteWithResult ( "DvdRead 2 1")
return (res["result"][0] << 8) | (res["result"][1])
'''
Read uint32_t from disk (already swapped to little-endian)
'''
def __DvdReadUInt32(dolwin, offset):
dolwin.Execute ("DvdSeek " + str(offset))
res = dolwin.ExecuteWithResult ( "DvdRead 4 1")
return (res["result"][0] << 24) | (res["result"][1] << 16) | (res["result"][2] << 8) | (res["result"][3])
'''
Load large block of data. Loading is performed in chunks no larger than a sector.
'''
def __DvdReadLargeChunk(dolwin, offset, size):
result = []
DVD_SECTOR_SIZE = 2048
while size != 0:
actualSize = min (size, DVD_SECTOR_SIZE)
dolwin.Execute ("DvdSeek " + str(offset))
res = dolwin.ExecuteWithResult ( "DvdRead " + str(actualSize) + " 1")
result += res["result"]
offset += actualSize
size -= actualSize
return result
'''
Get zero-terminated ANSI byte string from nametable
'''
def __DvdGetName(nametable, offset):
len = 0
while nametable[offset + len] != 0:
len += 1
return bytearray(nametable[offset:offset+len]).decode()
'''
struct DVDFileEntry
{
uint8_t isDir; // 1, if directory
uint8_t nameOffsetHi; // Relative to Name Table start
uint16_t nameOffsetLo;
union
{
struct // file
{
uint32_t fileOffset; // Relative to disk start (0)
uint32_t fileLength; // In bytes
};
struct // directory
{
uint32_t parentOffset; // parent directory FST index
uint32_t nextOffset; // next directory FST index
};
};
};
'''
class FSTEntry (object):
pass
'''
An example of a directory structure in FST:
/
AudioRes
Banks
LuiSe2_0.aw
LuiSec0_0.aw
LuiSec1_0.aw
LuiSec2_0.aw
JaiInit.aaf -- file
Seqs
JaiArcS.arc
Stream
TMansion.afc
TMOpen.afc
CVS
...
dir [84]: AudioRes (981), parent: 0, next: 96
dir [85]: Banks (990), parent: 84, next: 90
file [86]: /AudioRes/Banks/LuiSe2_0.aw (996), offset: 0x4D5785F0, len: 0x0003EA60
file [87]: /AudioRes/Banks/LuiSec0_0.aw (1008), offset: 0x4D5B7050, len: 0x002325C0
file [88]: /AudioRes/Banks/LuiSec1_0.aw (1021), offset: 0x4D7E9610, len: 0x00637200
file [89]: /AudioRes/Banks/LuiSec2_0.aw (1034), offset: 0x4DE20810, len: 0x005E1CE0
file [90]: /AudioRes/JaiInit.aaf (1047), offset: 0x56D96820, len: 0x0003B900
dir [91]: Seqs (1059), parent: 84, next: 93
file [92]: /AudioRes/Seqs/JaiArcS.arc (1064), offset: 0x4E4024F0, len: 0x0008DEA0
dir [93]: Stream (1076), parent: 84, next: 96
file [94]: /AudioRes/Stream/TMansion.afc (1083), offset: 0x4E490390, len: 0x000DE040
file [95]: /AudioRes/Stream/TMOpen.afc (1096), offset: 0x4E56E3D0, len: 0x0024FC00
dir [96]: CVS (1107), parent: 0, next: 100
As you can see, the `next` field in the `Banks` directory points to the `JaiInit.aaf` file, where the current level of the `Banks` folder hierarchy ends.
'''
| 31.754864
| 173
| 0.620635
|
def do_command(dolwin, args):
mounted = False
res = dolwin.ExecuteWithResult ("DvdInfo 1")
for i in res["result"]:
if type(i) == str:
mounted = i != ""
if not mounted:
print ("DVD is not mounted")
return
DVD_BB2_OFFSET = 0x0420
DVD_APPLDR_OFFSET = 0x2440
BB2_FSTPosition = 4
BB2_FSTLength = 8
fstEntrySize = 12;
fstOffset = __DvdReadUInt32 (dolwin, DVD_BB2_OFFSET + BB2_FSTPosition)
fstLength = __DvdReadUInt32 (dolwin, DVD_BB2_OFFSET + BB2_FSTLength)
print ( "FST offset: 0x%0.8X, length: 0x%0.8X" % (fstOffset, fstLength))
if fstOffset <= DVD_APPLDR_OFFSET:
print ("Suspicious FST offset")
return
if fstLength > 16*1024*1024 or fstLength < fstEntrySize:
print ("Invalid FST size")
return
if __DvdReadUInt8(dolwin, fstOffset) != 1:
print ("Invalid FST format. The first entry must be of type isDir = 1")
return
numEntries = __DvdReadUInt32(dolwin, fstOffset + 8)
if numEntries * fstEntrySize > fstLength:
print ("The number of records exceeds the specified FST size (including nametable)")
return
nameTableLength = fstLength - numEntries * fstEntrySize
if nameTableLength <= 0:
print ("Suspicious nametable size")
return
print ("FST entries count: " + str(numEntries))
print ("Nametable size: " + str(nameTableLength) + " bytes")
nametable = __DvdReadLargeChunk(dolwin, fstOffset + numEntries * fstEntrySize, nameTableLength)
entryOffset = fstOffset
entries = []
while numEntries != 0:
entry = FSTEntry()
entry.id = len(entries)
entry.isDir = __DvdReadUInt8(dolwin, entryOffset) != 0
entry.nameOffset = (__DvdReadUInt8(dolwin, entryOffset + 1) << 16) | __DvdReadUInt16(dolwin, entryOffset + 2)
if entry.isDir:
entry.parentOffset = __DvdReadUInt32(dolwin, entryOffset + 4)
entry.nextOffset = __DvdReadUInt32(dolwin, entryOffset + 8)
else:
entry.fileOffset = __DvdReadUInt32(dolwin, entryOffset + 4)
entry.fileLength = __DvdReadUInt32(dolwin, entryOffset + 8)
entries.append(entry)
numEntries -= 1
entryOffset += fstEntrySize
print ("category [entry_id]: path (nameOffset), ... directory/file specific info")
for e in entries:
__DumpFstEntry (e, entries, nametable)
def __DumpFstEntry (entry, entries, nametable):
if entry.isDir:
if entry.id == 0:
print ("dir [0]: (root)")
else:
print ("dir [%d]: %s (%d), parent: %d, next: %d" % (entry.id, __DvdGetName(nametable, entry.nameOffset), entry.nameOffset, entry.parentOffset, entry.nextOffset))
else:
fullPath = __DvdGetName(nametable, entry.nameOffset)
parentDirId = 0
currentId = entry.id
while currentId != 0:
if entries[currentId].isDir and entries[currentId].nextOffset > entry.id:
parentDirId = currentId
break
currentId -= 1
while parentDirId != 0:
fullPath = __DvdGetName(nametable, entries[parentDirId].nameOffset) + "/" + fullPath
parentDirId = entries[parentDirId].parentOffset
fullPath = "/" + fullPath
print ("file [%d]: %s (%d), offset: 0x%0.8X, len: 0x%0.8X" % (entry.id, fullPath, entry.nameOffset, entry.fileOffset, entry.fileLength))
def __DvdReadUInt8(dolwin, offset):
dolwin.Execute ("DvdSeek " + str(offset))
res = dolwin.ExecuteWithResult ( "DvdRead 1 1")
return res["result"][0]
def __DvdReadUInt16(dolwin, offset):
dolwin.Execute ("DvdSeek " + str(offset))
res = dolwin.ExecuteWithResult ( "DvdRead 2 1")
return (res["result"][0] << 8) | (res["result"][1])
def __DvdReadUInt32(dolwin, offset):
dolwin.Execute ("DvdSeek " + str(offset))
res = dolwin.ExecuteWithResult ( "DvdRead 4 1")
return (res["result"][0] << 24) | (res["result"][1] << 16) | (res["result"][2] << 8) | (res["result"][3])
def __DvdReadLargeChunk(dolwin, offset, size):
result = []
DVD_SECTOR_SIZE = 2048
while size != 0:
actualSize = min (size, DVD_SECTOR_SIZE)
dolwin.Execute ("DvdSeek " + str(offset))
res = dolwin.ExecuteWithResult ( "DvdRead " + str(actualSize) + " 1")
result += res["result"]
offset += actualSize
size -= actualSize
return result
def __DvdGetName(nametable, offset):
len = 0
while nametable[offset + len] != 0:
len += 1
return bytearray(nametable[offset:offset+len]).decode()
class FSTEntry (object):
pass
| true
| true
|
f70a53838caca2eaa018cef84eeb42f6e4dd002b
| 223
|
py
|
Python
|
exer2/multiply.py
|
JekyllAndHyde8999/Git-Tutorials-AIDC
|
5747e05980c82fd3a22dc3102bcede79079842f9
|
[
"MIT"
] | null | null | null |
exer2/multiply.py
|
JekyllAndHyde8999/Git-Tutorials-AIDC
|
5747e05980c82fd3a22dc3102bcede79079842f9
|
[
"MIT"
] | null | null | null |
exer2/multiply.py
|
JekyllAndHyde8999/Git-Tutorials-AIDC
|
5747e05980c82fd3a22dc3102bcede79079842f9
|
[
"MIT"
] | null | null | null |
# The objective of this program is to multiply two input numbers
def multiply(*args):
a = args
res = 1
for ele in a:
res *= ele
return res
a1=int(input())
a2=int(input())
print(multiply(a1,a2))
| 13.9375
| 64
| 0.61435
|
def multiply(*args):
a = args
res = 1
for ele in a:
res *= ele
return res
a1=int(input())
a2=int(input())
print(multiply(a1,a2))
| true
| true
|
f70a5395c3923da0f06930099407d0b2dd77e18e
| 1,322
|
py
|
Python
|
h/layouts.py
|
gnott/h
|
77a0452b8196f7efb97d4a400ce7583062d620e6
|
[
"MIT"
] | null | null | null |
h/layouts.py
|
gnott/h
|
77a0452b8196f7efb97d4a400ce7583062d620e6
|
[
"MIT"
] | null | null | null |
h/layouts.py
|
gnott/h
|
77a0452b8196f7efb97d4a400ce7583062d620e6
|
[
"MIT"
] | null | null | null |
from pyramid_layout.layout import layout_config
@layout_config(template='h:templates/base.pt')
class BaseLayout(object):
csp = None
inline_webfont = True
requirements = (('app', None),)
def __init__(self, context, request):
self.context = context
self.request = request
self.forms = {}
def add_form(self, form):
if form.formid in self.forms:
raise ValueError('duplicate form id "%s"' % form.formid)
self.forms[form.formid] = form
def get_widget_requirements(self):
requirements = []
requirements.extend(self.requirements)
for form in self.forms.values():
requirements.extend(form.get_widget_requirements())
return requirements
def get_widget_resources(self):
requirements = self.get_widget_requirements()
return self.request.registry.resources(requirements)
@property
def css_links(self):
return self.get_widget_resources()['css']
@property
def js_links(self):
return self.get_widget_resources()['js']
@layout_config(name='sidebar', template='h:templates/base.pt')
class SidebarLayout(BaseLayout):
requirements = (('app', None), ('sidebar', None))
def includeme(config):
config.include('pyramid_layout')
config.scan(__name__)
| 27.541667
| 68
| 0.666415
|
from pyramid_layout.layout import layout_config
@layout_config(template='h:templates/base.pt')
class BaseLayout(object):
csp = None
inline_webfont = True
requirements = (('app', None),)
def __init__(self, context, request):
self.context = context
self.request = request
self.forms = {}
def add_form(self, form):
if form.formid in self.forms:
raise ValueError('duplicate form id "%s"' % form.formid)
self.forms[form.formid] = form
def get_widget_requirements(self):
requirements = []
requirements.extend(self.requirements)
for form in self.forms.values():
requirements.extend(form.get_widget_requirements())
return requirements
def get_widget_resources(self):
requirements = self.get_widget_requirements()
return self.request.registry.resources(requirements)
@property
def css_links(self):
return self.get_widget_resources()['css']
@property
def js_links(self):
return self.get_widget_resources()['js']
@layout_config(name='sidebar', template='h:templates/base.pt')
class SidebarLayout(BaseLayout):
requirements = (('app', None), ('sidebar', None))
def includeme(config):
config.include('pyramid_layout')
config.scan(__name__)
| true
| true
|
f70a53bcae60ac2df6c5fb334f3698dce45cc9af
| 819
|
py
|
Python
|
test/prophet_model.py
|
jsonbruce/MTSAnomalyDetection
|
94e1b3177f8260804a4f9079ce7358f984521471
|
[
"Apache-2.0"
] | 28
|
2017-09-10T01:45:40.000Z
|
2021-12-02T11:57:48.000Z
|
test/prophet_model.py
|
maxsxu/MTSAnomalyDetection
|
94e1b3177f8260804a4f9079ce7358f984521471
|
[
"Apache-2.0"
] | 3
|
2019-05-28T08:29:20.000Z
|
2019-08-29T20:58:56.000Z
|
test/prophet_model.py
|
maxsxu/MTSAnomalyDetection
|
94e1b3177f8260804a4f9079ce7358f984521471
|
[
"Apache-2.0"
] | 14
|
2017-11-28T10:32:59.000Z
|
2021-07-01T12:49:45.000Z
|
#!/usr/bin/env python
# coding=utf-8
# Created by max on 17-5-4.
import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from fbprophet import Prophet
from pandas import Series, DataFrame
DATA_FILE = "dataset/data0.csv"
def main(args):
data = pd.read_csv(DATA_FILE, parse_dates=True, index_col='timestamp')
# Re-group data to fit for Prophet data format
data['ds'] = data.index
data = data.reindex(columns=['ds', 'v0', 'v1', 'result'])
data = data.rename(columns={"v0": 'y'})
model = Prophet()
model.fit(data.ix[data.index[0:500]])
future = model.make_future_dataframe(120, 'H')
forecast = model.predict(future)
model.plot(forecast)
model.plot_components(forecast)
plt.show()
if __name__ == "__main__":
main(sys.argv)
| 20.475
| 74
| 0.680098
|
import os
import sys
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
from fbprophet import Prophet
from pandas import Series, DataFrame
DATA_FILE = "dataset/data0.csv"
def main(args):
data = pd.read_csv(DATA_FILE, parse_dates=True, index_col='timestamp')
data['ds'] = data.index
data = data.reindex(columns=['ds', 'v0', 'v1', 'result'])
data = data.rename(columns={"v0": 'y'})
model = Prophet()
model.fit(data.ix[data.index[0:500]])
future = model.make_future_dataframe(120, 'H')
forecast = model.predict(future)
model.plot(forecast)
model.plot_components(forecast)
plt.show()
if __name__ == "__main__":
main(sys.argv)
| true
| true
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.