hexsha stringlengths 40 40 | size int64 1 1.03M | ext stringclasses 10
values | lang stringclasses 1
value | max_stars_repo_path stringlengths 3 239 | max_stars_repo_name stringlengths 5 130 | max_stars_repo_head_hexsha stringlengths 40 78 | 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 3 239 | max_issues_repo_name stringlengths 5 130 | max_issues_repo_head_hexsha stringlengths 40 78 | 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 3 239 | max_forks_repo_name stringlengths 5 130 | max_forks_repo_head_hexsha stringlengths 40 78 | 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 1 1.03M | avg_line_length float64 1 958k | max_line_length int64 1 1.03M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
795385e5db21ea4ade80c9c24ddd01a15262f45b | 3,647 | py | Python | tests/integration/test_notebooks.py | Hedingber/mlrun | e2269718fcc7caa7e1aa379ac28495830b45f9da | [
"Apache-2.0"
] | 1 | 2021-02-17T08:12:33.000Z | 2021-02-17T08:12:33.000Z | tests/integration/test_notebooks.py | Hedingber/mlrun | e2269718fcc7caa7e1aa379ac28495830b45f9da | [
"Apache-2.0"
] | 1 | 2020-12-31T14:36:29.000Z | 2020-12-31T14:36:29.000Z | tests/integration/test_notebooks.py | Hedingber/mlrun | e2269718fcc7caa7e1aa379ac28495830b45f9da | [
"Apache-2.0"
] | 1 | 2021-08-30T21:43:38.000Z | 2021-08-30T21:43:38.000Z | # Copyright 2018 Iguazio
#
# 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 re
from collections import ChainMap
from os import environ
from pathlib import Path
from subprocess import run
import pytest
import yaml
here = Path(__file__).absolute().parent
tests_dir = here.parent
root = tests_dir.parent
# Need to be in root for docker context
tmp_dockerfile = Path(root / "Dockerfile.mlrun-test-nb")
with (here / "Dockerfile.test-nb").open() as fp:
dockerfile_template = fp.read()
docker_tag = "mlrun/test-notebook"
def mlrun_api_configured():
config_file_path = here / "test-notebooks.yml"
with config_file_path.open() as fp:
config = yaml.safe_load(fp)
return config["env"].get("MLRUN_DBPATH") is not None
def iterate_notebooks():
if not mlrun_api_configured():
return []
config_file_path = here / "test-notebooks.yml"
with config_file_path.open() as fp:
config = yaml.safe_load(fp)
general_env = config["env"]
for notebook_test_config in config["notebook_tests"]:
# fill env keys that reference the general env
test_env = {}
for key, value in notebook_test_config.get("env", {}).items():
match = re.match(r"^\$\{(?P<env_var>.*)\}$", value)
if match is not None:
env_var = match.group("env_var")
env_var_value = general_env.get(env_var)
if env_var_value is None:
raise ValueError(
f"Env var {env_var} references general env, but it does not exist there"
)
test_env[key] = env_var_value
else:
test_env[key] = value
notebook_test_config["env"] = test_env
yield pytest.param(
notebook_test_config, id=notebook_test_config["notebook_name"]
)
def args_from_env(env):
external_env = {}
for env_var_key in environ:
if env_var_key.startswith("MLRUN_"):
external_env[env_var_key] = environ[env_var_key]
env = ChainMap(env, external_env)
args, cmd = [], []
for name in env:
value = env[name]
args.append(f"ARG {name}")
cmd.extend(["--build-arg", f"{name}={value}"])
args = "\n".join(args)
return args, cmd
@pytest.mark.skipif(
not mlrun_api_configured(),
reason="This is an integration test, add the needed environment variables in test-notebooks.yml "
"to run it",
)
@pytest.mark.parametrize("notebook", iterate_notebooks())
def test_notebook(notebook):
path = f'./examples/{notebook["notebook_name"]}'
args, args_cmd = args_from_env(notebook["env"])
deps = []
for dep in notebook.get("pip", []):
deps.append(f"RUN python -m pip install --upgrade {dep}")
pip = "\n".join(deps)
code = dockerfile_template.format(notebook=path, args=args, pip=pip)
with tmp_dockerfile.open("w") as out:
out.write(code)
cmd = (
["docker", "build", "--file", str(tmp_dockerfile), "--tag", docker_tag]
+ args_cmd
+ ["."]
)
out = run(cmd, cwd=root)
assert out.returncode == 0, "cannot build"
| 31.713043 | 101 | 0.644914 |
795385e9dbfc4ccdbe6edceb97e419418e9a9c8a | 1,886 | py | Python | src/worker.py | shiburizu/Eddienput | b2ce192090ba658641383af84c7f3e09920a7d83 | [
"MIT"
] | 91 | 2021-04-05T21:48:35.000Z | 2022-03-09T20:45:12.000Z | src/worker.py | shiburizu/Eddienput | b2ce192090ba658641383af84c7f3e09920a7d83 | [
"MIT"
] | 7 | 2021-04-08T04:47:29.000Z | 2021-12-09T18:30:38.000Z | src/worker.py | shiburizu/Eddienput | b2ce192090ba658641383af84c7f3e09920a7d83 | [
"MIT"
] | 10 | 2021-04-06T10:35:24.000Z | 2022-02-07T14:23:14.000Z | import sys
import traceback
from PyQt5.QtCore import QObject, pyqtSignal, QRunnable, pyqtSlot
class WorkerSignals(QObject):
'''
Defines the signals available from a running worker thread.
Supported signals are:
finished
No data
error
tuple (exctype, value, traceback.format_exc() )
result
object data returned from processing, anything
progress
int indicating % progress
'''
finished = pyqtSignal()
error = pyqtSignal(tuple)
result = pyqtSignal(object)
progress = pyqtSignal(int)
class Worker(QRunnable):
'''
Worker thread
Inherits from QRunnable to handler worker thread setup, signals and wrap-up.
:param callback: The function callback to run on this worker thread. Supplied args and
kwargs will be passed through to the runner.
:type callback: function
:param args: Arguments to pass to the callback function
:param kwargs: Keywords to pass to the callback function
'''
def __init__(self, fn, *args, **kwargs):
super(Worker, self).__init__()
# Store constructor arguments (re-used for processing)
self.fn = fn
self.args = args
self.kwargs = kwargs
self.signals = WorkerSignals()
@pyqtSlot()
def run(self):
'''
Initialise the runner function with passed args, kwargs.
'''
# Retrieve args/kwargs here; and fire processing using them
try:
result = self.fn(*self.args, **self.kwargs)
except:
traceback.print_exc()
exctype, value = sys.exc_info()[:2]
self.signals.error.emit((exctype, value, traceback.format_exc()))
else:
self.signals.result.emit(result) # Return the result of the processing
finally:
self.signals.finished.emit() # Done | 26.56338 | 90 | 0.630965 |
795387844ed09435eac7066733ef2c8c726fc78a | 2,044 | py | Python | test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration.py | qwordy/autorest.python | 6b12df51c2a39a1285546b5a771b69f5896e794f | [
"MIT"
] | 35 | 2018-04-03T12:15:53.000Z | 2022-03-11T14:03:34.000Z | test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration.py | qwordy/autorest.python | 6b12df51c2a39a1285546b5a771b69f5896e794f | [
"MIT"
] | 652 | 2017-08-28T22:44:41.000Z | 2022-03-31T21:20:31.000Z | test/vanilla/Expected/AcceptanceTests/MultipleInheritance/multipleinheritance/aio/_configuration.py | qwordy/autorest.python | 6b12df51c2a39a1285546b5a771b69f5896e794f | [
"MIT"
] | 29 | 2017-08-28T20:57:01.000Z | 2022-03-11T14:03:38.000Z | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
# --------------------------------------------------------------------------
from typing import Any
from azure.core.configuration import Configuration
from azure.core.pipeline import policies
from .._version import VERSION
class MultipleInheritanceServiceClientConfiguration(Configuration):
"""Configuration for MultipleInheritanceServiceClient.
Note that all parameters used to create this instance are saved as instance
attributes.
"""
def __init__(self, **kwargs: Any) -> None:
super(MultipleInheritanceServiceClientConfiguration, self).__init__(**kwargs)
kwargs.setdefault("sdk_moniker", "multipleinheritanceserviceclient/{}".format(VERSION))
self._configure(**kwargs)
def _configure(self, **kwargs: Any) -> None:
self.user_agent_policy = kwargs.get("user_agent_policy") or policies.UserAgentPolicy(**kwargs)
self.headers_policy = kwargs.get("headers_policy") or policies.HeadersPolicy(**kwargs)
self.proxy_policy = kwargs.get("proxy_policy") or policies.ProxyPolicy(**kwargs)
self.logging_policy = kwargs.get("logging_policy") or policies.NetworkTraceLoggingPolicy(**kwargs)
self.http_logging_policy = kwargs.get("http_logging_policy") or policies.HttpLoggingPolicy(**kwargs)
self.retry_policy = kwargs.get("retry_policy") or policies.AsyncRetryPolicy(**kwargs)
self.custom_hook_policy = kwargs.get("custom_hook_policy") or policies.CustomHookPolicy(**kwargs)
self.redirect_policy = kwargs.get("redirect_policy") or policies.AsyncRedirectPolicy(**kwargs)
self.authentication_policy = kwargs.get("authentication_policy")
| 51.1 | 108 | 0.701076 |
7953881011de50a4a663c8d49ab43c3505fd97c1 | 4,558 | py | Python | demo/demo.py | ignazioa/mobile-gaitlab | 34681ce956ad885c388f8b811bf1eb236b1f20b7 | [
"Apache-2.0"
] | null | null | null | demo/demo.py | ignazioa/mobile-gaitlab | 34681ce956ad885c388f8b811bf1eb236b1f20b7 | [
"Apache-2.0"
] | null | null | null | demo/demo.py | ignazioa/mobile-gaitlab | 34681ce956ad885c388f8b811bf1eb236b1f20b7 | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# coding: utf-8
# # Demonstration of Video Gait Analysis
#
# In this notebook we present how to run OpenPose processing on a video and how apply neural networks from the paper to data processed by OpenPose. As a result, for a given mp4 file we will get predictions from all models.
#
# To run this script you will need packages from the file `requirements.txt`. To install requirements run:
# ```bash
# pip install -r requirements.txt
# ```
# we recommend using conda or a virtual environment.
#
# We start with some definitions and global constants.
# In[1]:
import pandas as pd
import numpy as np
import os
import json
from video_process_utils import *
from keras.models import load_model
import keras.losses
import keras.metrics
keras.losses.loss = keras.losses.mse
keras.metrics.loss = keras.metrics.mse
from statsmodels.regression.linear_model import OLSResults
from keras.backend.tensorflow_backend import clear_session
import gc
import tensorflow
# Reset Keras Session
def reset_keras():
clear_session()
try:
del classifier # this is from global space - change this as you need
except:
pass
print(gc.collect()) # if it's done something you should see a number being outputted
def convert_json2csv(json_dir):
resL = np.zeros((300,75))
resL[:] = np.nan
for frame in range(1,300):
test_image_json = '%sinput_%s_keypoints.json' % (json_dir, str(frame).zfill(12))
if not os.path.isfile(test_image_json):
break
with open(test_image_json) as data_file:
data = json.load(data_file)
for person in data['people']:
keypoints = person['pose_keypoints_2d']
xcoords = [keypoints[i] for i in range(len(keypoints)) if i % 3 == 0]
counter = 0
resL[frame-1,:] = keypoints
break
#we can save space by dropping rows after the last row that isn't all nan
check = np.apply_along_axis(lambda x: np.any(~np.isnan(x)),1,resL)
for i in range(len(check)-1,-1,-1):
if check[i]:
break
return resL[:i+1]
def get_prediction(centered_filtered, col, side = None):
model = load_model("models/{}_best.pb".format(col))
correction_model = OLSResults.load("models/{}_correction.pb".format(col))
maps = {
"KneeFlex_maxExtension": (-29.4408212510502, 114.8431545843835),
"GDI": (36.314492983907, 77.03271217530302), # singlesided
"gmfcs": (1, 3),
"speed": (0.0718863507111867, 1.5259117583433834),
"cadence": (0.222, 1.71556665023985),
"SEMLS_dev_residual": (-0.8205001909638112, 3.309054961371647)
}
def undo_scaling(y,target_min,target_range):
return y*target_range+target_min
preds = []
video_len = centered_filtered.shape[0]
cols = x_columns
if side == "L":
cols = x_columns_left
if side == "R":
cols = x_columns_right
samples = []
for nstart in range(0,video_len-124,31):
samples.append(centered_filtered[nstart:(nstart+124),cols])
X = np.stack(samples)
p = model.predict(X)[:,0]
p = undo_scaling(p, maps[col][0], maps[col][1])
p = np.transpose(np.vstack([p,np.ones(p.shape[0])]))
p = correction_model.predict(pd.DataFrame(p))
# reset_keras()# Shouldn't be needed anymore
return np.mean(p)
# Next, we define a function which will run all models from the paper one by one:
# In[9]:
def get_all_preds(centered_filtered, centered_filtered_noswap):
cols = ["GDI","gmfcs","speed","cadence","SEMLS_dev_residual"]
return dict([(col, get_prediction(centered_filtered, col)) for col in cols] + [
("KneeFlex_maxExtension_L", get_prediction(centered_filtered_noswap, "KneeFlex_maxExtension", "L")),
("KneeFlex_maxExtension_R", get_prediction(centered_filtered_noswap, "KneeFlex_maxExtension", "R")),
])
# def predict(path):
# values = {"test": 1}
# return values, open(path, "rb")
def predict(path):
os.system('cd /openpose ; /openpose/build/examples/openpose/openpose.bin --video {} --display 0 --write_json /gaitlab/output/keypoints -write_video /gaitlab/output/video.mp4 ; cd /gaitlab'.format(path))
frames = convert_json2csv("output/keypoints/")
centered_filtered = process_video_and_add_cols(frames)
centered_filtered_noswap = process_video_and_add_cols(frames, swap_orientation=False)
return get_all_preds(centered_filtered, centered_filtered_noswap), open("/gaitlab/output/video.mp4", "rb")
| 32.791367 | 222 | 0.680123 |
795388346a96203adca6c3bb8e1daa74b07b4c8c | 6,267 | py | Python | core/models/mixins/domain_ruler_mixin.py | hugoseabra/redmine-task-generator | b5ce1764f1c7588a7c82b25f7dd4bf07d1c105cf | [
"MIT"
] | null | null | null | core/models/mixins/domain_ruler_mixin.py | hugoseabra/redmine-task-generator | b5ce1764f1c7588a7c82b25f7dd4bf07d1c105cf | [
"MIT"
] | 4 | 2021-03-30T14:04:56.000Z | 2021-06-10T19:40:52.000Z | core/models/mixins/domain_ruler_mixin.py | hugoseabra/redmine-task-generator | b5ce1764f1c7588a7c82b25f7dd4bf07d1c105cf | [
"MIT"
] | null | null | null | from abc import ABC, abstractmethod
from django.forms import ValidationError
from django.utils.translation import gettext as _
__all__ = [
'DomainRuleMixin',
'DeletionRuleChecker',
'IntegrityRuleChecker',
'RuleIntegrityError',
'RuleInstanceTypeError',
]
class RuleValidationError(Exception):
"""
Exceção erro em runtime para forçar validação de model no save.
"""
pass
class RuleIntegrityError(Exception):
"""
Exceção erro durante verificação de integridade de entidade de domínio.
"""
def __init__(self, message, field_name: str = None, *args, **kwargs):
self.message = message
self.field_name = field_name
super().__init__(*args, **kwargs)
def __str__(self):
return str(self.message)
class RuleDeletionError(Exception):
"""
Exceção erro durante deleção de entidade de domínio.
"""
def __init__(self, message, field_name: str = None, *args, **kwargs):
self.message = message
self.field_name = field_name
super().__init__(*args, **kwargs)
def __str__(self):
return str(self.message)
class RuleInstanceTypeError(TypeError):
"""
Exceção quando uma instância de regra de negócio de entidade informada
mas não é instância de RuleChecker.
"""
def __init__(self, message):
self.message = _('The configured rule is not an instance of'
' RuleChecker: {}'.format(message))
class IntegrityRuleChecker(ABC):
"""
Classe concreta de implementação de verficação de integridade de domínio
de uma entidade.
:raise RuleIntegrityError
"""
@abstractmethod
def check(self, instance): # pragma: no cover
pass
class DeletionRuleChecker(ABC):
"""
Classe concreta de implementação de deleção de entidade.
:raise RuleIntegrityError
"""
@abstractmethod
def check(self, instance): # pragma: no cover
pass
class DomainRuleMixin:
"""
Adds support to check domain rules
"""
# Rule instances
integrity_rules = list()
deletion_rules = list()
def __init__(self, *args, **kwargs):
self.ignore_validation = False
self.validation_processed = False
self.valid = False
integrity_rules = []
for rule in self.integrity_rules:
if self.is_valid_integrity_rule(rule):
integrity_rules.append(rule)
continue
raise RuleInstanceTypeError(rule.__name__)
deletion_rules = []
for rule in self.deletion_rules:
if self.is_valid_deletion_rule(rule):
deletion_rules.append(rule)
continue
raise RuleInstanceTypeError(rule.__class__.__name__)
if integrity_rules:
self.integrity_rules = integrity_rules
if deletion_rules:
self.deletion_rules = deletion_rules
super().__init__(*args, **kwargs)
def full_clean(self, exclude=None, validate_unique=True):
super().full_clean(exclude, validate_unique)
self.validate(full_clean=False)
def validate(self, full_clean=True):
if self.ignore_validation is False:
self.validation_processed = True
self._required_fields_filled()
self._check_integrity_rules()
if full_clean is True:
self.full_clean()
self.valid = True
def delete(self, ignore_validation=False, *args, **kwargs):
if self.ignore_validation is False and ignore_validation is False:
self._check_deletion_rules()
super().delete(*args, **kwargs)
def save(self, ignore_validation=False, *args, **kwargs):
if self.ignore_validation is False and ignore_validation is False:
if self.validation_processed is False:
raise RuleValidationError(
'Entity model must be validated before saving.'
' Call .validate() before saving.'
)
if self.valid is False:
raise RuleValidationError(
'Entity instance is not valid and cannot be saved.'
)
super().save(*args, **kwargs)
@staticmethod
def is_valid_integrity_rule(rule):
is_subclass = issubclass(rule, IntegrityRuleChecker)
is_instance = isinstance(rule, IntegrityRuleChecker)
return is_subclass is True or is_instance is True
@staticmethod
def is_valid_deletion_rule(rule):
is_subclass = issubclass(rule, DeletionRuleChecker)
is_instance = isinstance(rule, DeletionRuleChecker)
return is_subclass is True or is_instance is True
def _required_fields_filled(self):
"""
Check if all required fields are filled.
"""
required_empty_fields = list()
for f in self._meta.get_fields():
if getattr(f, 'null', False) is True:
continue
if getattr(f, 'editable', True) is False:
continue
v = getattr(self, f.name, None)
if v is None:
required_empty_fields.append(f.name)
if required_empty_fields:
raise ValidationError(
_('Required fields must be provided:'
' {}'.format(', '.join(required_empty_fields)))
)
def _check_integrity_rules(self):
""" Verifica as regras de integridade de domínio. """
for rule in self.integrity_rules:
if not isinstance(rule, IntegrityRuleChecker):
rule = rule()
try:
rule.check(self)
except RuleIntegrityError as e:
msg = e.message
if e.field_name is not None:
error_dict = dict()
error_dict[e.field_name] = msg
raise ValidationError(error_dict)
raise ValidationError(msg)
def _check_deletion_rules(self):
""" Verifica as regras de remoção de entidade de domínio. """
for rule in self.integrity_rules:
if not isinstance(rule, DeletionRuleChecker):
rule = rule()
rule.check(self)
| 29.013889 | 76 | 0.613212 |
795388b2a21b8e055b53e62b36eeaf02cb136185 | 4,185 | py | Python | benchmark/startQiskit_QC1938.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit_QC1938.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | benchmark/startQiskit_QC1938.py | UCLA-SEAL/QDiff | d968cbc47fe926b7f88b4adf10490f1edd6f8819 | [
"BSD-3-Clause"
] | null | null | null | # qubit number=4
# total number=33
import cirq
import qiskit
from qiskit import IBMQ
from qiskit.providers.ibmq import least_busy
from qiskit import QuantumCircuit, QuantumRegister, ClassicalRegister
from qiskit import BasicAer, execute, transpile
from pprint import pprint
from qiskit.test.mock import FakeVigo
from math import log2
import numpy as np
import networkx as nx
def bitwise_xor(s: str, t: str) -> str:
length = len(s)
res = []
for i in range(length):
res.append(str(int(s[i]) ^ int(t[i])))
return ''.join(res[::-1])
def bitwise_dot(s: str, t: str) -> str:
length = len(s)
res = 0
for i in range(length):
res += int(s[i]) * int(t[i])
return str(res % 2)
def build_oracle(n: int, f) -> QuantumCircuit:
# implement the oracle O_f
# NOTE: use multi_control_toffoli_gate ('noancilla' mode)
# https://qiskit.org/documentation/_modules/qiskit/aqua/circuits/gates/multi_control_toffoli_gate.html
# https://quantumcomputing.stackexchange.com/questions/3943/how-do-you-implement-the-toffoli-gate-using-only-single-qubit-and-cnot-gates
# https://quantumcomputing.stackexchange.com/questions/2177/how-can-i-implement-an-n-bit-toffoli-gate
controls = QuantumRegister(n, "ofc")
target = QuantumRegister(1, "oft")
oracle = QuantumCircuit(controls, target, name="Of")
for i in range(2 ** n):
rep = np.binary_repr(i, n)
if f(rep) == "1":
for j in range(n):
if rep[j] == "0":
oracle.x(controls[j])
oracle.mct(controls, target[0], None, mode='noancilla')
for j in range(n):
if rep[j] == "0":
oracle.x(controls[j])
# oracle.barrier()
return oracle
def make_circuit(n:int,f) -> QuantumCircuit:
# circuit begin
input_qubit = QuantumRegister(n,"qc")
classical = ClassicalRegister(n, "qm")
prog = QuantumCircuit(input_qubit, classical)
prog.h(input_qubit[3]) # number=30
prog.cz(input_qubit[0],input_qubit[3]) # number=31
prog.h(input_qubit[3]) # number=32
prog.x(input_qubit[3]) # number=11
prog.h(input_qubit[3]) # number=13
prog.cz(input_qubit[0],input_qubit[3]) # number=14
prog.h(input_qubit[1]) # number=18
prog.cz(input_qubit[3],input_qubit[1]) # number=19
prog.z(input_qubit[3]) # number=25
prog.h(input_qubit[1]) # number=20
prog.rx(-3.141592653589793,input_qubit[3]) # number=26
prog.h(input_qubit[3]) # number=15
prog.h(input_qubit[1]) # number=2
prog.h(input_qubit[2]) # number=3
prog.h(input_qubit[2]) # number=17
prog.h(input_qubit[3]) # number=4
prog.h(input_qubit[0]) # number=5
oracle = build_oracle(n-1, f)
prog.append(oracle.to_gate(),[input_qubit[i] for i in range(n-1)]+[input_qubit[n-1]])
prog.h(input_qubit[1]) # number=6
prog.h(input_qubit[2]) # number=7
prog.h(input_qubit[3]) # number=8
prog.h(input_qubit[0]) # number=9
prog.h(input_qubit[0]) # number=27
prog.cz(input_qubit[1],input_qubit[0]) # number=28
prog.h(input_qubit[0]) # number=29
prog.cx(input_qubit[1],input_qubit[0]) # number=22
prog.x(input_qubit[1]) # number=23
prog.x(input_qubit[1]) # number=24
# circuit end
for i in range(n):
prog.measure(input_qubit[i], classical[i])
return prog
if __name__ == '__main__':
a = "111"
b = "0"
f = lambda rep: bitwise_xor(bitwise_dot(a, rep), b)
prog = make_circuit(4,f)
IBMQ.load_account()
provider = IBMQ.get_provider(hub='ibm-q')
provider.backends()
backend = least_busy(provider.backends(filters=lambda x: x.configuration().n_qubits >= 2 and not x.configuration().simulator and x.status().operational == True))
sample_shot =8000
info = execute(prog, backend=backend, shots=sample_shot).result().get_counts()
backend = FakeVigo()
circuit1 = transpile(prog,backend,optimization_level=2)
writefile = open("../data/startQiskit_QC1938.csv","w")
print(info,file=writefile)
print("results end", file=writefile)
print(circuit1.__len__(),file=writefile)
print(circuit1,file=writefile)
writefile.close()
| 34.875 | 165 | 0.654958 |
795388bcbdf9e12af556954f71bd3aa0505aa755 | 6,024 | py | Python | toontown/catalog/CatalogFlooringItem.py | CrankySupertoon01/Toontown-2 | 60893d104528a8e7eb4aced5d0015f22e203466d | [
"MIT"
] | 1 | 2021-02-13T22:40:50.000Z | 2021-02-13T22:40:50.000Z | toontown/catalog/CatalogFlooringItem.py | CrankySupertoonArchive/Toontown-2 | 60893d104528a8e7eb4aced5d0015f22e203466d | [
"MIT"
] | 1 | 2018-07-28T20:07:04.000Z | 2018-07-30T18:28:34.000Z | toontown/catalog/CatalogFlooringItem.py | CrankySupertoonArchive/Toontown-2 | 60893d104528a8e7eb4aced5d0015f22e203466d | [
"MIT"
] | 2 | 2019-12-02T01:39:10.000Z | 2021-02-13T22:41:00.000Z | from CatalogSurfaceItem import *
FTTextureName = 0
FTColor = 1
FTBasePrice = 2
FlooringTypes = {1000: ('phase_5.5/maps/floor_wood_neutral.jpg', CTBasicWoodColorOnWhite, 150),
1010: ('phase_5.5/maps/flooring_carpetA_neutral.jpg', CTFlatColorDark, 150),
1020: ('phase_4/maps/flooring_tile_neutral.jpg', CTFlatColorDark, 150),
1030: ('phase_5.5/maps/flooring_tileB2.jpg', None, 150),
1040: ('phase_4/maps/grass.jpg', None, 150),
1050: ('phase_4/maps/floor_tile_brick_diagonal2.jpg', None, 150),
1060: ('phase_4/maps/floor_tile_brick_diagonal.jpg', None, 150),
1070: ('phase_4/maps/plazz_tile.jpg', None, 150),
1080: ('phase_4/maps/sidewalk.jpg', CTFlatColorDark, 150),
1090: ('phase_3.5/maps/boardwalk_floor.jpg', None, 150),
1100: ('phase_3.5/maps/dustroad.jpg', None, 150),
1110: ('phase_5.5/maps/floor_woodtile_neutral.jpg', CTBasicWoodColorOnWhite, 150),
1120: ('phase_5.5/maps/floor_tile_neutral.jpg', CTBasicWoodColorOnWhite + CTFlatColorDark, 150),
1130: ('phase_5.5/maps/floor_tile_honeycomb_neutral.jpg', CTBasicWoodColorOnWhite, 150),
1140: ('phase_5.5/maps/UWwaterFloor1.jpg', None, 150),
1150: ('phase_5.5/maps/UWtileFloor4.jpg', None, 150),
1160: ('phase_5.5/maps/UWtileFloor3.jpg', None, 150),
1170: ('phase_5.5/maps/UWtileFloor2.jpg', None, 150),
1180: ('phase_5.5/maps/UWtileFloor1.jpg', None, 150),
1190: ('phase_5.5/maps/UWsandyFloor1.jpg', None, 150),
10000: ('phase_5.5/maps/floor_icecube.jpg', CTWhite, 225),
10010: ('phase_5.5/maps/floor_snow.jpg', CTWhite, 225),
11000: ('phase_5.5/maps/StPatsFloor1.jpg', CTWhite, 225),
11010: ('phase_5.5/maps/StPatsFloor2.jpg', CTWhite, 225)}
class CatalogFlooringItem(CatalogSurfaceItem):
def makeNewItem(self, patternIndex, colorIndex = None):
self.patternIndex = patternIndex
self.colorIndex = colorIndex
CatalogSurfaceItem.makeNewItem(self)
def needsCustomize(self):
return self.colorIndex == None
def getTypeName(self):
return TTLocalizer.SurfaceNames[STFlooring]
def getName(self):
name = TTLocalizer.FlooringNames.get(self.patternIndex)
if name:
return name
return self.getTypeName()
def getSurfaceType(self):
return STFlooring
def getPicture(self, avatar):
frame = self.makeFrame()
sample = loader.loadModel('phase_5.5/models/estate/wallpaper_sample')
a = sample.find('**/a')
b = sample.find('**/b')
c = sample.find('**/c')
a.setTexture(self.loadTexture(), 1)
a.setColorScale(*self.getColor())
b.setTexture(self.loadTexture(), 1)
b.setColorScale(*self.getColor())
c.setTexture(self.loadTexture(), 1)
c.setColorScale(*self.getColor())
sample.reparentTo(frame)
self.hasPicture = True
return (frame, None)
def output(self, store = -1):
return 'CatalogFlooringItem(%s, %s%s)' % (self.patternIndex, self.colorIndex, self.formatOptionalData(store))
def getFilename(self):
return FlooringTypes[self.patternIndex][FTTextureName]
def compareTo(self, other):
if self.patternIndex != other.patternIndex:
return self.patternIndex - other.patternIndex
return 0
def getHashContents(self):
return self.patternIndex
def getBasePrice(self):
return FlooringTypes[self.patternIndex][FTBasePrice]
def loadTexture(self):
from pandac.PandaModules import Texture
filename = FlooringTypes[self.patternIndex][FTTextureName]
texture = loader.loadTexture(filename)
texture.setMinfilter(Texture.FTLinearMipmapLinear)
texture.setMagfilter(Texture.FTLinear)
return texture
def getColor(self):
if self.colorIndex == None:
colorIndex = 0
else:
colorIndex = self.colorIndex
colors = FlooringTypes[self.patternIndex][FTColor]
if colors:
if colorIndex < len(colors):
return colors[colorIndex]
else:
print 'Warning: colorIndex not in colors. Returning white.'
return CT_WHITE
else:
return CT_WHITE
return
def decodeDatagram(self, di, versionNumber, store):
CatalogAtticItem.CatalogAtticItem.decodeDatagram(self, di, versionNumber, store)
self.patternIndex = di.getUint16()
if store & CatalogItem.Customization:
self.colorIndex = di.getUint8()
else:
self.colorIndex = 0
wtype = FlooringTypes[self.patternIndex]
return
def encodeDatagram(self, dg, store):
CatalogAtticItem.CatalogAtticItem.encodeDatagram(self, dg, store)
dg.addUint16(self.patternIndex)
if store & CatalogItem.Customization:
dg.addUint8(self.colorIndex)
def getFloorings(*indexList):
list = []
for index in indexList:
list.append(CatalogFlooringItem(index))
return list
def getAllFloorings(*indexList):
list = []
for index in indexList:
colors = FlooringTypes[index][FTColor]
if colors:
for n in xrange(len(colors)):
list.append(CatalogFlooringItem(index, n))
else:
list.append(CatalogFlooringItem(index, 0))
return list
def getFlooringRange(fromIndex, toIndex, *otherRanges):
list = []
froms = [fromIndex]
tos = [toIndex]
i = 0
while i < len(otherRanges):
froms.append(otherRanges[i])
tos.append(otherRanges[i + 1])
i += 2
for patternIndex in FlooringTypes.keys():
for fromIndex, toIndex in zip(froms, tos):
if patternIndex >= fromIndex and patternIndex <= toIndex:
colors = FlooringTypes[patternIndex][FTColor]
if colors:
for n in xrange(len(colors)):
list.append(CatalogFlooringItem(patternIndex, n))
else:
list.append(CatalogFlooringItem(patternIndex, 0))
return list
| 35.435294 | 117 | 0.65405 |
7953894d7bc2f0cf05ba26388582a009425b7fdd | 43,458 | py | Python | config.py | swinslow/scaffold | 4cf48b9f1545ad789095cf93a68a78a5df63f8b5 | [
"Apache-2.0"
] | null | null | null | config.py | swinslow/scaffold | 4cf48b9f1545ad789095cf93a68a78a5df63f8b5 | [
"Apache-2.0"
] | 18 | 2020-01-09T21:50:34.000Z | 2021-01-04T19:02:37.000Z | config.py | swinslow/scaffold | 4cf48b9f1545ad789095cf93a68a78a5df63f8b5 | [
"Apache-2.0"
] | null | null | null | # Copyright The Linux Foundation
# SPDX-License-Identifier: Apache-2.0
import json
import os
from pathlib import Path
from shutil import copyfile
import yaml
from datatypes import Config, Finding, JiraSecret, MatchText, Priority, Project, ProjectRepoType, Secrets, SLMCategoryConfig, SLMLicenseConfig, SLMPolicy, Status, Subproject, TicketType, WSSecret
def getConfigFilename(scaffoldHome, month):
return os.path.join(scaffoldHome, month, "config.json")
def getMatchesProjectFilename(scaffoldHome, month, prj_name):
return os.path.join(scaffoldHome, month, f"matches-{prj_name}.json")
def getFindingsProjectFilename(scaffoldHome, month, prj_name):
return os.path.join(scaffoldHome, month, f"findings-{prj_name}.yaml")
def loadMatches(matchesFilename):
matches = []
try:
with open(matchesFilename, 'r') as f:
js = json.load(f)
# expecting array of match objects
for j in js:
m = MatchText()
m._text = j.get('text', "")
if m._text == "":
print(f'No text value found in match section')
return []
# comments can be empty string or absent
m._comment = j.get('comment', "")
actions = j.get('actions', [])
if actions == []:
if m._comment == "":
print(f'No actions found in match section')
else:
print(f'No actions found in match section with comment {m._comment}')
return []
# parse and add actions
m._actions = []
for a in actions:
ac = a.get('action', "")
if ac != "add" and ac != "remove":
print(f'Invalid action type {ac} in match')
return []
lic = a.get('license', "")
if lic == "":
print(f'Invalid empty string for license in match')
return []
actionTup = (ac, lic)
m._actions.append(actionTup)
# and now add it in
matches.append(m)
return matches
except json.decoder.JSONDecodeError as e:
print(f'Error loading or parsing {matchesFilename}: {str(e)}')
return []
# parses findings template file and returns arrays, first with findings and
# second with flagged categories
def loadFindings(findingsFilename):
try:
with open(findingsFilename, "r") as f:
yd = yaml.safe_load(f)
# expecting object with findings array
findings_arr = yd.get("findings", [])
if findings_arr == []:
print(f'No findings specified in {findingsFilename}')
return []
findings = []
count = 0
for fd in findings_arr:
count += 1
finding = Finding()
finding._id = fd.get('id', [])
finding._text = fd.get('text', "")
finding._title = fd.get('title', "")
finding._matches_path = fd.get('matches-path', [])
finding._matches_license = fd.get('matches-license', [])
finding._matches_subproject = fd.get('matches-subproject', [])
if finding._matches_path == [] and finding._matches_license == [] and finding._matches_subproject == []:
print(f'Finding {count} in {findingsFilename} has no entries for either matches-path, matches-license or matches-subproject')
return []
prstr = fd.get("priority", "")
try:
finding._priority = Priority[prstr.upper()]
except KeyError:
print(f'Invalid priority value for finding {count} in {findingsFilename} with paths {finding._matches_path}, licenses {finding._matches_license}, subprojects {finding._matches_subproject}, ')
return []
findings.append(finding)
return findings
except yaml.YAMLError as e:
print(f'Error loading or parsing {findingsFilename}: {str(e)}')
return []
# parses secrets file; always looks in ~/.scaffold-secrets.json
def loadSecrets():
secretsFile = os.path.join(Path.home(), ".scaffold-secrets.json")
try:
with open(secretsFile, 'r') as f:
js = json.load(f)
secrets = Secrets()
default_oauth = js.get("default_github_oauth", "")
secrets._default_oauth = default_oauth
# expecting mapping of prj name to JiraSecret data
project_data = js.get("projects", {})
for prj, prj_dict in project_data.items():
jira_dict = prj_dict.get("jira", {})
if jira_dict != {}:
jira_secret = JiraSecret()
jira_secret._project_name = prj
jira_secret._jira_project = jira_dict.get("board", "")
jira_secret._server = jira_dict.get("server", "")
jira_secret._username = jira_dict.get("username", "")
jira_secret._password = jira_dict.get("password", "")
secrets._jira[prj] = jira_secret
ws_dict = prj_dict.get("whitesource", {})
if ws_dict != {}:
ws_secret = WSSecret()
ws_secret._project_name = prj
ws_secret._ws_api_key = ws_dict.get("apikey", "")
ws_secret._ws_user_key = ws_dict.get("userkey", "")
secrets._ws[prj] = ws_secret
secrets._gitoauth[prj] = prj_dict.get("github_oauth", default_oauth)
return secrets
except json.decoder.JSONDecodeError as e:
print(f'Error loading or parsing {secretsFile}: {str(e)}')
return None
def loadConfig(configFilename, scaffoldHome):
cfg = Config()
try:
with open(configFilename, 'r') as f:
js = json.load(f)
# load global config
config_dict = js.get('config', {})
if config_dict == {}:
print(f'No config section found in config file')
raise RuntimeError(f'No config section found in config file')
cfg._month = config_dict.get('month', "")
if cfg._month == "":
print(f'No valid month found in config section')
raise RuntimeError(f'No valid month found in config section')
cfg._version = config_dict.get('version', -1)
if cfg._version == -1:
print(f'No valid version found in config section')
raise RuntimeError(f'No valid version found in config section')
cfg._storepath = config_dict.get('storepath', "")
if cfg._storepath == "":
print(f'No valid storepath found in config section')
raise RuntimeError(f'No valid storepath found in config section')
cfg._spdx_github_org = config_dict.get('spdxGithubOrg', "")
if cfg._spdx_github_org == "":
print(f'No valid spdxGithubOrg found in config section')
raise RuntimeError(f'No valid spdxGithubOrg found in config section')
cfg._spdx_github_signoff = config_dict.get('spdxGithubSignoff', "")
if cfg._spdx_github_signoff == "":
print(f'No valid spdxGithubSignoff found in config section')
raise RuntimeError(f'No valid spdxGithubSignoff found in config section')
# load web server data
cfg._web_server_use_scp = config_dict.get('webServerUseScp', False)
cfg._web_server = config_dict.get('webServer', "")
if cfg._web_server == "":
print(f"No valid webServer found in config section")
raise RuntimeError(f"No valid webServer found in config section")
cfg._web_server_username = config_dict.get('webServerUsername', "")
if cfg._web_server_username == "" and cfg._web_server_use_scp:
print(f"No valid webServerUsername found in config section")
raise RuntimeError(f"No valid webServerUsername found in config section")
cfg._web_reports_path = config_dict.get('webReportsPath', "")
if cfg._web_reports_path == "":
print(f"No valid webReportsPath found in config section")
raise RuntimeError(f"No valid webReportsPath found in config section")
cfg._web_reports_url = config_dict.get('webReportsUrl', "")
if cfg._web_reports_url == "":
print(f"No valid webReportsUrl found in config section")
raise RuntimeError(f"No valid webReportsUrl found in config section")
# load config-wide WhiteSource data
cfg._ws_server_url = config_dict.get('wsServerUrl', "")
if cfg._ws_server_url == "":
print(f"No valid wsServerUrl found in config section")
raise RuntimeError(f"No valid wsServerUrl found in config section")
cfg._ws_unified_agent_jar_path = config_dict.get('wsUnifiedAgentJarPath', "")
if cfg._ws_unified_agent_jar_path == "":
print(f"No valid wsUnifiedAgentJarPath found in config section")
raise RuntimeError(f"No valid wsUnifiedAgentJarPath found in config section")
# default_env does not need to exist
cfg._ws_default_env = config_dict.get('wsDefaultEnv', {})
# load secrets
cfg._secrets = loadSecrets()
# if we get here, main config is at least valid
cfg._ok = True
# load projects
projects_dict = js.get('projects', {})
if projects_dict == {}:
print(f'No projects found in config file')
raise RuntimeError(f'No projects found in config file')
for prj_name, prj_dict in projects_dict.items():
#TODO: Refactor this function - cognative and cyclomatic complexity is high
prj = Project()
prj._name = prj_name
prj._ok = True
if not prj_name in cfg._secrets._gitoauth:
# Update the secrets for any missing project data
cfg._secrets._gitoauth[prj_name] = cfg._secrets._default_oauth
prj._cycle = prj_dict.get('cycle', 99)
# get project status
status_str = prj_dict.get('status', '')
if status_str == '':
prj._status = Status.UNKNOWN
else:
prj._status = Status[status_str]
# get project ticket type
ticket_type = prj_dict.get('ticket-type', '')
if ticket_type == "jira":
prj._ticket_type = TicketType.JIRA
else:
prj._ticket_type = TicketType.NONE
pt = prj_dict.get('type', '')
if pt == "gerrit":
prj._repotype = ProjectRepoType.GERRIT
gerrit_dict = prj_dict.get('gerrit', {})
if gerrit_dict == {}:
print(f'Project {prj_name} has no gerrit data')
prj._ok = False
else:
prj._gerrit_apiurl = gerrit_dict.get('apiurl', '')
if prj._gerrit_apiurl == '':
print(f'Project {prj_name} has no apiurl data')
prj._ok = False
# if subproject-config is absent, treat it as manual
prj._gerrit_subproject_config = gerrit_dict.get('subproject-config', "manual")
# if repos-ignore is absent, that's fine
prj._gerrit_repos_ignore = gerrit_dict.get('repos-ignore', [])
# if repos-pending is absent, that's fine
prj._gerrit_repos_pending = gerrit_dict.get('repos-pending', [])
# now load SLM project data
parseProjectSLMConfig(prj_dict, prj)
# now load WS project data
parseProjectWSConfig(prj_dict, prj)
# now load project web data, where applicable
parseProjectWebConfig(prj_dict, prj)
# now load subprojects, if any are listed; it's okay if none are
sps = prj_dict.get('subprojects', {})
if sps != {}:
for sp_name, sp_dict in sps.items():
sp = Subproject()
sp._name = sp_name
sp._repotype = ProjectRepoType.GERRIT
sp._ok = True
sp._cycle = sp_dict.get('cycle', 99)
if prj._cycle != 99 and sp._cycle != 99:
print(f"Project {prj_name} and subproject {sp_name} both have cycles specified; invalid")
prj._ok = False
sp._ok = False
# get subproject status
status_str = sp_dict.get('status', '')
if status_str == '':
sp._status = Status.UNKNOWN
else:
sp._status = Status[status_str]
# get code section
code_dict = sp_dict.get('code', {})
if code_dict == {}:
sp._code_pulled = ""
sp._code_path = ""
sp._code_anyfiles = False
sp._code_repos = {}
else:
sp._code_pulled = code_dict.get('pulled', "")
sp._code_path = code_dict.get('path', "")
sp._code_anyfiles = code_dict.get('anyfiles', "")
sp._code_repos = code_dict.get('repos', {})
# get web data
web_dict = sp_dict.get('web', {})
if web_dict == {}:
sp._web_uuid = ""
sp._web_html_url = ""
sp._web_xlsx_url = ""
else:
sp._web_uuid = web_dict.get('uuid', "")
sp._web_html_url = web_dict.get('htmlurl', "")
sp._web_xlsx_url = web_dict.get('xlsxurl', "")
# now load SLM subproject data
parseSubprojectSLMConfig(sp_dict, prj, sp)
# now load WS subproject data
parseSubprojectWSConfig(sp_dict, prj, sp)
sp_gerrit_dict = sp_dict.get('gerrit', {})
if sp_gerrit_dict == {}:
sp._repos = []
else:
# if repos is absent, that's fine
sp._repos = sp_gerrit_dict.get('repos', [])
sp._repo_dirs_delete = sp_gerrit_dict.get('repo-dirs-delete', {})
# and add subprojects to the project's dictionary
prj._subprojects[sp_name] = sp
elif pt == "github-shared":
prj._repotype = ProjectRepoType.GITHUB_SHARED
github_shared_dict = prj_dict.get('github-shared', {})
if github_shared_dict == {}:
print(f'Project {prj_name} has no github-shared data')
prj._ok = False
else:
prj._github_shared_org = github_shared_dict.get('org', '')
if prj._github_shared_org == '':
print(f'Project {prj_name} has no org data')
prj._ok = False
# if repos-ignore is absent, that's fine
prj._github_shared_repos_ignore = github_shared_dict.get('repos-ignore', [])
# if repos-pending is absent, that's fine
prj._github_shared_repos_pending = github_shared_dict.get('repos-pending', [])
# now load SLM project data
parseProjectSLMConfig(prj_dict, prj)
# now load WS project data
parseProjectWSConfig(prj_dict, prj)
# now load project web data, where applicable
parseProjectWebConfig(prj_dict, prj)
# now load subprojects, if any are listed; it's okay if none are
sps = prj_dict.get('subprojects', {})
if sps != {}:
for sp_name, sp_dict in sps.items():
sp = Subproject()
sp._name = sp_name
sp._repotype = ProjectRepoType.GITHUB_SHARED
sp._ok = True
sp._cycle = sp_dict.get('cycle', 99)
if prj._cycle != 99 and sp._cycle != 99:
print(f"Project {prj_name} and subproject {sp_name} both have cycles specified; invalid")
prj._ok = False
sp._ok = False
# get subproject status
status_str = sp_dict.get('status', '')
if status_str == '':
sp._status = Status.UNKNOWN
else:
sp._status = Status[status_str]
# get code section
code_dict = sp_dict.get('code', {})
if code_dict == {}:
sp._code_pulled = ""
sp._code_path = ""
sp._code_anyfiles = False
sp._code_repos = {}
else:
sp._code_pulled = code_dict.get('pulled', "")
sp._code_path = code_dict.get('path', "")
sp._code_anyfiles = code_dict.get('anyfiles', "")
sp._code_repos = code_dict.get('repos', {})
# get web data
web_dict = sp_dict.get('web', {})
if web_dict == {}:
sp._web_uuid = ""
sp._web_html_url = ""
sp._web_xlsx_url = ""
else:
sp._web_uuid = web_dict.get('uuid', "")
sp._web_html_url = web_dict.get('htmlurl', "")
sp._web_xlsx_url = web_dict.get('xlsxurl', "")
# now load SLM subproject data
parseSubprojectSLMConfig(sp_dict, prj, sp)
# now load WS subproject data
parseSubprojectWSConfig(sp_dict, prj, sp)
# get subproject github-shared details, including repos
gs_sp_shared_dict = sp_dict.get('github-shared', {})
if gs_sp_shared_dict == {}:
print(f'Subproject {sp_name} in project {prj_name} has no github-shared data')
prj._ok = False
else:
# if no repos specified, that's fine, we'll find them later
sp._repos = gs_sp_shared_dict.get('repos', [])
sp._repo_dirs_delete = gs_sp_shared_dict.get('repo-dirs-delete', {})
# and add subprojects to the project's dictionary
prj._subprojects[sp_name] = sp
elif pt == "github":
prj._repotype = ProjectRepoType.GITHUB
# now load SLM project data
parseProjectSLMConfig(prj_dict, prj)
# now load WS project data
parseProjectWSConfig(prj_dict, prj)
# now load project web data, where applicable
parseProjectWebConfig(prj_dict, prj)
sps = prj_dict.get('subprojects', {})
if sps == {}:
print(f'Project {prj_name} has no subprojects specified')
prj._ok = False
else:
for sp_name, sp_dict in sps.items():
sp = Subproject()
sp._name = sp_name
sp._repotype = ProjectRepoType.GITHUB
sp._ok = True
sp._cycle = sp_dict.get('cycle', 99)
if prj._cycle != 99 and sp._cycle != 99:
print(f"Project {prj_name} and subproject {sp_name} both have cycles specified; invalid")
prj._ok = False
sp._ok = False
# get subproject status
status_str = sp_dict.get('status', '')
if status_str == '':
sp._status = Status.UNKNOWN
else:
sp._status = Status[status_str]
# get code section
code_dict = sp_dict.get('code', {})
if code_dict == {}:
sp._code_pulled = ""
sp._code_path = ""
sp._code_anyfiles = False
sp._code_repos = {}
else:
sp._code_pulled = code_dict.get('pulled', "")
sp._code_path = code_dict.get('path', "")
sp._code_anyfiles = code_dict.get('anyfiles', "")
sp._code_repos = code_dict.get('repos', {})
# get web data
web_dict = sp_dict.get('web', {})
if web_dict == {}:
sp._web_uuid = ""
sp._web_html_url = ""
sp._web_xlsx_url = ""
else:
sp._web_uuid = web_dict.get('uuid', "")
sp._web_html_url = web_dict.get('htmlurl', "")
sp._web_xlsx_url = web_dict.get('xlsxurl', "")
# now load SLM subproject data
parseSubprojectSLMConfig(sp_dict, prj, sp)
# now load WS subproject data
parseSubprojectWSConfig(sp_dict, prj, sp)
# get subproject github details
github_dict = sp_dict.get('github', {})
if github_dict == {}:
print(f'Project {prj_name} has no github data')
prj._ok = False
else:
sp._github_org = github_dict.get('org', '')
if sp._github_org == '':
print(f'Subproject {sp_name} in project {prj_name} has no org specified')
sp._ok = False
# if no ziporg specified, that's fine, use the org name
sp._github_ziporg = github_dict.get('ziporg', sp._github_org)
# if no branch specified, that's fine
sp._github_branch = github_dict.get('branch', "")
# if no repos specified, that's fine, we'll find them later
sp._repos = github_dict.get('repos', [])
sp._repo_dirs_delete = github_dict.get('repo-dirs-delete', {})
# and if no repos-ignore specified, that's fine too
sp._github_repos_ignore = github_dict.get('repos-ignore', [])
# and if no repos-pending specified, that's fine too
sp._github_repos_pending = github_dict.get('repos-pending', [])
# and add subprojects to the project's dictionary
prj._subprojects[sp_name] = sp
else:
print(f'Project {prj_name} has invalid or no repo type')
prj._repotype = ProjectRepoType.UNKNOWN
prj._ok = False
# also add in matches if a matches-{prj_name}.json file exists
matchesFilename = getMatchesProjectFilename(scaffoldHome, cfg._month, prj._name)
if os.path.isfile(matchesFilename):
prj._matches = loadMatches(matchesFilename)
else:
prj._matches = []
# also add in findings templates if a findings-{prj_name}.json file exists
findingsFilename = getFindingsProjectFilename(scaffoldHome, cfg._month, prj._name)
if os.path.isfile(findingsFilename):
prj._findings = loadFindings(findingsFilename)
else:
prj._findings = []
# and add project to the dictionary
cfg._projects[prj_name] = prj
return cfg
except json.decoder.JSONDecodeError as e:
print(f'Error loading or parsing {configFilename}: {str(e)}')
return {}
def parseProjectSLMConfig(prj_dict, prj):
prj_slm_dict = prj_dict.get('slm', {})
if prj_slm_dict == {}:
print(f'Project {prj._name} has no slm data')
prj._ok = False
else:
prj._slm_combined_report = prj_slm_dict.get('combinedReport', False)
prj._slm_extensions_skip = prj_slm_dict.get('extensions-skip', [])
prj._slm_thirdparty_dirs = prj_slm_dict.get('thirdparty-dirs', [])
# build policies
prj._slm_policies = {}
policies = prj_slm_dict.get('policies', {})
for policy_name, policy_dict in policies.items():
policy = SLMPolicy()
policy._name = policy_name
# for each policy, build category configs
policy._category_configs = []
categories = policy_dict.get('categories', [])
for category_dict in categories:
cat = SLMCategoryConfig()
cat._name = category_dict.get('name', "")
if cat._name == "":
print(f'SLM category in project {prj._name}, policy {policy_name} has no name')
prj._ok = False
cat._license_configs = []
licenses = category_dict.get('licenses', [])
for license_dict in licenses:
lic = SLMLicenseConfig()
lic._name = license_dict.get('name', "")
if lic._name == "":
print(f'SLM license in project {prj._name}, policy {policy_name}, category {cat._name} has no name')
prj._ok = False
lic._aliases = license_dict.get('aliases', [])
cat._license_configs.append(lic)
policy._category_configs.append(cat)
# also get list of categories that are flagged
policy._flag_categories = policy_dict.get('flagged', [])
prj._slm_policies[policy_name] = policy
# check that there's at least one policy
if len(prj._slm_policies) < 1:
print(f'Project {prj._name} has no slm policies')
prj._ok = False
# check that there's no more than one policy if this project needs
# a combined report
if len(prj._slm_policies) > 1 and prj._slm_combined_report == True:
print(f'Project {prj._name} has more than one slm policy, but wants a combined report; invalid')
prj._ok = False
def parseProjectWSConfig(prj_dict, prj):
prj_ws_dict = prj_dict.get('ws', {})
if prj_ws_dict == {}:
return
# load data -- fine if missing or empty, since we might not
# have WhiteSource configured for this project
prj._ws_enabled = prj_ws_dict.get("enabled", False)
prj._ws_env = prj_ws_dict.get("env", {})
def parseProjectWebConfig(prj_dict, prj):
prj_web_dict = prj_dict.get('web', {})
# it's okay if there's no web report data; possible we just haven't created it yet
# but if there is data for a project without a combined report, that's wrong
if prj._slm_combined_report == False and prj_web_dict != {}:
print(f'Project {prj._name} has web report data but has slm:combinedReport == False')
prj._ok = False
return
# load data -- fine if it's missing or empty, since we might not
# be at the report creation stage yet
prj._web_combined_uuid = prj_web_dict.get('uuid', "")
prj._web_combined_html_url = prj_web_dict.get('htmlurl', "")
prj._web_combined_xlsx_url = prj_web_dict.get('xlsxurl', "")
def parseSubprojectSLMConfig(sp_dict, prj, sp):
sp_slm_dict = sp_dict.get('slm', {})
if sp_slm_dict == {}:
sp._slm_policy_name = ""
sp._slm_report_xlsx = ""
sp._slm_report_json = ""
sp._slm_pending_lics = []
else:
# we did get an slm section, so we'll parse it
sp._slm_policy_name = sp_slm_dict.get('policy', "")
sp._slm_report_xlsx = sp_slm_dict.get('report-xlsx', "")
sp._slm_report_json = sp_slm_dict.get('report-json', "")
sp._slm_pending_lics = sp_slm_dict.get('licenses-pending', [])
# check whether there's only one slm policy, if no name is given
# or check whether slm policy name is known, if one is given
if sp._slm_policy_name == "":
if len(prj._slm_policies) > 1:
print(f'Project {prj._name} has multiple slm policies but no policy is specified for subproject {sp._name}')
sp._ok = False
prj._ok = False
else:
if sp._slm_policy_name not in prj._slm_policies:
print(f'Project {prj._name} does not have slm policy named "{sp._slm_policy_name}", specified for subproject {sp._name}')
sp._ok = False
prj._ok = False
def parseSubprojectWSConfig(sp_dict, prj, sp):
sp_ws_dict = sp_dict.get('ws', {})
if sp_ws_dict == {}:
return
# load data -- fine if missing or empty, since we might not
# have WhiteSource configured for this project
sp._ws_override_disable_anyway = sp_ws_dict.get("override-disable-anyway", False)
sp._ws_override_product = sp_ws_dict.get("override-product", "")
sp._ws_override_project = sp_ws_dict.get("override-project", "")
sp._ws_env = sp_ws_dict.get("env", {})
class ConfigJSONEncoder(json.JSONEncoder):
def default(self, o): # pylint: disable=method-hidden
if isinstance(o, Config):
return {
"config": {
"storepath": o._storepath,
"month": o._month,
"version": o._version,
"spdxGithubOrg": o._spdx_github_org,
"spdxGithubSignoff": o._spdx_github_signoff,
"webServer": o._web_server,
"webServerUsername": o._web_server_username,
"webReportsPath": o._web_reports_path,
"webReportsUrl": o._web_reports_url,
"wsServerUrl": o._ws_server_url,
"wsUnifiedAgentJarPath": o._ws_unified_agent_jar_path,
"wsDefaultEnv": o._ws_default_env,
},
"projects": o._projects,
}
elif isinstance(o, Project):
retval = {}
if o._cycle != 99:
retval["cycle"] = o._cycle
# build ticket data, if any
if o._ticket_type == TicketType.JIRA:
retval["ticket-type"] = "jira"
# build SLM data
slm_section = {
"policies": o._slm_policies,
"combinedReport": o._slm_combined_report,
"extensions-skip": o._slm_extensions_skip,
"thirdparty-dirs": o._slm_thirdparty_dirs,
}
retval["slm"] = slm_section
if o._slm_combined_report == True:
if o._web_combined_uuid != "" or o._web_combined_html_url != "" or o._web_combined_xlsx_url!= "":
web_section = {
"uuid": o._web_combined_uuid,
"htmlurl": o._web_combined_html_url,
"xlsxurl": o._web_combined_xlsx_url,
}
retval["web"] = web_section
# build WS data
ws_section = {"enabled": o._ws_enabled}
if o._ws_env != {}:
ws_section["env"] = o._ws_env
if ws_section != {"enabled": False}:
retval["ws"] = ws_section
if o._repotype == ProjectRepoType.GITHUB:
retval["type"] = "github"
retval["subprojects"] = o._subprojects
return retval
elif o._repotype == ProjectRepoType.GERRIT:
retval["type"] = "gerrit"
retval["status"] = o._status.name
retval["gerrit"] = {
"apiurl": o._gerrit_apiurl,
"subproject-config": o._gerrit_subproject_config,
"repos-ignore": o._gerrit_repos_ignore,
"repos-pending": o._gerrit_repos_pending,
}
retval["subprojects"] = o._subprojects
return retval
elif o._repotype == ProjectRepoType.GITHUB_SHARED:
retval["type"] = "github-shared"
retval["status"] = o._status.name
retval["github-shared"] = {
"org": o._github_shared_org,
"repos-ignore": o._github_shared_repos_ignore,
"repos-pending": o._github_shared_repos_pending,
}
retval["subprojects"] = o._subprojects
return retval
else:
return {
"type": "unknown"
}
elif isinstance(o, Subproject):
# build SLM data
slm_section = {}
if o._slm_policy_name != "":
slm_section["policy"] = o._slm_policy_name
if o._slm_report_json != "":
slm_section["report-json"] = o._slm_report_json
if o._slm_report_xlsx != "":
slm_section["report-xlsx"] = o._slm_report_xlsx
if o._slm_pending_lics != []:
slm_section["licenses-pending"] = o._slm_pending_lics
# build WS data
ws_section = {}
if o._ws_override_disable_anyway != False:
ws_section["override-disable-anyway"] = o._ws_override_disable_anyway
if o._ws_override_product != "":
ws_section["override-product"] = o._ws_override_product
if o._ws_override_project != "":
ws_section["override-project"] = o._ws_override_project
if o._ws_env != {}:
ws_section["env"] = o._ws_env
if o._repotype == ProjectRepoType.GITHUB:
js = {
"status": o._status.name,
"slm": slm_section,
"code": {
"anyfiles": o._code_anyfiles,
},
"web": {},
"github": {
"org": o._github_org,
"ziporg": o._github_ziporg,
"repo-dirs-delete": o._repo_dirs_delete,
"repos": sorted(o._repos),
"repos-ignore": sorted(o._github_repos_ignore),
}
}
if o._github_branch != "":
js["github"]["branch"] = o._github_branch
if ws_section != {}:
js["ws"] = ws_section
if o._cycle != 99:
js["cycle"] = o._cycle
if o._code_pulled != "":
js["code"]["pulled"] = o._code_pulled
if o._code_path != "":
js["code"]["path"] = o._code_path
if o._code_repos != {}:
js["code"]["repos"] = o._code_repos
if o._web_html_url != "":
js["web"]["htmlurl"] = o._web_html_url
if o._web_xlsx_url != "":
js["web"]["xlsxurl"] = o._web_xlsx_url
if o._web_uuid != "":
js["web"]["uuid"] = o._web_uuid
if len(o._github_repos_pending) > 0:
js["github"]["repos-pending"] = sorted(o._github_repos_pending)
return js
elif o._repotype == ProjectRepoType.GITHUB_SHARED:
js = {
"status": o._status.name,
"slm": slm_section,
"web": {},
"code": {
"anyfiles": o._code_anyfiles,
},
"github-shared": {
"repo-dirs-delete": o._repo_dirs_delete,
"repos": sorted(o._repos),
}
}
if ws_section != {}:
js["ws"] = ws_section
if o._cycle != 99:
js["cycle"] = o._cycle
if o._code_pulled != "":
js["code"]["pulled"] = o._code_pulled
if o._code_path != "":
js["code"]["path"] = o._code_path
if o._code_repos != {}:
js["code"]["repos"] = o._code_repos
if o._web_html_url != "":
js["web"]["htmlurl"] = o._web_html_url
if o._web_xlsx_url != "":
js["web"]["xlsxurl"] = o._web_xlsx_url
if o._web_uuid != "":
js["web"]["uuid"] = o._web_uuid
return js
elif o._repotype == ProjectRepoType.GERRIT:
js = {
"status": o._status.name,
"slm": slm_section,
"web": {},
"code": {
"anyfiles": o._code_anyfiles,
},
"gerrit": {
"repo-dirs-delete": o._repo_dirs_delete,
"repos": sorted(o._repos),
}
}
if ws_section != {}:
js["ws"] = ws_section
if o._cycle != 99:
js["cycle"] = o._cycle
if o._code_pulled != "":
js["code"]["pulled"] = o._code_pulled
if o._code_path != "":
js["code"]["path"] = o._code_path
if o._code_repos != {}:
js["code"]["repos"] = o._code_repos
if o._web_html_url != "":
js["web"]["htmlurl"] = o._web_html_url
if o._web_xlsx_url != "":
js["web"]["xlsxurl"] = o._web_xlsx_url
if o._web_uuid != "":
js["web"]["uuid"] = o._web_uuid
return js
else:
return {
"type": "unknown"
}
elif isinstance(o, SLMPolicy):
return {
"categories": o._category_configs,
"flagged": o._flag_categories,
}
elif isinstance(o, SLMCategoryConfig):
return {
"name": o._name,
"licenses": o._license_configs,
}
elif isinstance(o, SLMLicenseConfig):
return {
"name": o._name,
"aliases": o._aliases,
}
else:
return {'__{}__'.format(o.__class__.__name__): o.__dict__}
def saveBackupConfig(scaffoldHome, cfg):
configFilename = getConfigFilename(scaffoldHome, cfg._month)
# if existing file is present, copy to backup
if os.path.isfile(configFilename):
backupDir = os.path.join(scaffoldHome, cfg._month, "backup")
backupFilename = os.path.join(backupDir, f"config-{cfg._version}.json")
if not os.path.exists(backupDir):
os.makedirs(backupDir)
copyfile(configFilename, backupFilename)
# now, increment the config version
cfg._version += 1
# don't save it back to disk yet -- we'll do that later (repeatedly)
def saveConfig(scaffoldHome, cfg):
configFilename = getConfigFilename(scaffoldHome, cfg._month)
# don't increment the config version -- we should have done that
# by saving a backup
# save the config file out as json
with open(configFilename, "w") as f:
json.dump(cfg, f, indent=4, cls=ConfigJSONEncoder)
def updateProjectStatusToSubprojectMin(cfg, prj):
minStatus = Status.MAX
for sp in prj._subprojects.values():
if sp._status.value < minStatus.value:
minStatus = sp._status
if minStatus == Status.MAX:
minStatus = Status.START
prj._status = minStatus
def isInThisCycle(cfg, prj, sp):
cycle = 99
# shouldn't have both prj._cycle and sp._cycle set at the same time;
# JSON loader validates this so we'll ignore it here (not sure how
# to best handle here)
if prj._cycle != 99:
cycle = prj._cycle
if sp is not None and sp._cycle != 99:
cycle = sp._cycle
if cycle == 0 or cycle == 99:
return True
mth = cfg._month[5:7]
if cycle == 1 and mth in ['01', '04', '07', '10']:
return True
if cycle == 2 and mth in ['02', '05', '08', '11']:
return True
if cycle == 3 and mth in ['03', '06', '09', '10']:
return True
return False
| 45.793467 | 211 | 0.489668 |
79538987768c3623242cd947dfce222a2c98eb87 | 321,160 | py | Python | graphs/n.py | jaatadia/tic-toc-sic | ee93e23bbe40c9ad5d981604d01076386a6b9b59 | [
"MIT"
] | null | null | null | graphs/n.py | jaatadia/tic-toc-sic | ee93e23bbe40c9ad5d981604d01076386a6b9b59 | [
"MIT"
] | null | null | null | graphs/n.py | jaatadia/tic-toc-sic | ee93e23bbe40c9ad5d981604d01076386a6b9b59 | [
"MIT"
] | null | null | null | import csv
import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import mode
# -----------------------------------
# DATA
# -----------------------------------
n = [1.151309, 1.706339, 0.392103, 0.279633, 0.428113, 0.124932, 1.550828, 4.597046, 2.037313, 1.119261, 0.797872, 0.511729, 0.654323, 1.704014, 0.065346, 0.156505, 0.226282, 1.084548, 0.275709, 0.932560, 5.331478, 0.953265, 0.554031, 0.441384, 0.807405, 1.240811, 0.669079, 1.719974, 1.837847, 1.733162, 1.038786, 0.562821, 0.476210, 0.729052, 0.978729, 0.777690, 4.856842, 0.819836, 8.161437, 0.663701, 0.264922, 0.939587, 0.303826, 0.695842, 0.497662, 0.329956, 0.856116, 1.256548, 0.519432, 0.471004, 0.805724, 0.915799, 1.257428, 0.296912, 0.394417, 2.410020, 0.654130, 0.347405, 2.515387, 4.755097, 1.285513, 1.272630, 4.956128, 0.786137, 0.188317, 0.381931, 3.755806, 0.680596, 0.178262, 0.298626, 0.590465, 0.825768, 0.230589, 0.831322, 1.461187, 0.787332, 0.799508, 13.854856, 0.264826, 0.847056, 2.086471, 0.379879, 0.686789, 0.062268, 0.586088, 0.493991, 0.414028, 0.658521, 1.178355, 2.121965, 7.186402, 1.927683, 0.502700, 1.144547, 1.180825, 1.447557, 0.790563, 0.553123, 1.265255, 1.299065, 8.979447, 3.378094, 0.913933, 1.706243, 1.769254, 0.900575, 7.994836, 4.050396, 1.292753, 1.302932, 1.445723, 0.650797, 5.814555, 15.284314, 0.863901, 0.899177, 2.836684, 1.733190, 4.124066, 0.703821, 0.411566, 3.078184, 1.281316, 0.760583, 1.230095, 0.804260, 1.589512, 1.600098, 0.827381, 0.733568, 0.462539, 10.373527, 1.198807, 0.514393, 2.192374, 0.765273, 2.338752, 0.634528, 5.161905, 0.208098, 0.825954, 4.824401, 0.834573, 0.824068, 1.243849, 11.937725, 1.024215, 1.747118, 0.046457, 1.126422, 2.231233, 0.709848, 6.304531, 0.611315, 3.623716, 2.225231, 0.575712, 1.000596, 7.718296, 9.414616, 1.212926, 4.845786, 4.527448, 1.862124, 2.708556, 3.190702, 3.604921, 1.030592, 1.223098, 1.177279, 1.905313, 0.597754, 1.368524, 1.858445, 0.662750, 1.683487, 2.589332, 1.078482, 0.856534, 3.251073, 0.812908, 1.202527, 11.297828, 0.746635, 0.953283, 0.676598, 3.502802, 0.828578, 1.217613, 1.827227, 0.749307, 1.232759, 0.832960, 0.723684, 0.587250, 0.546016, 2.111993, 3.303781, 0.790783, 1.337120, 0.908730, 0.714703, 1.823543, 1.838793, 1.267023, 0.507487, 0.856309, 1.350013, 3.244222, 0.176369, 1.126834, 0.673357, 1.542315, 0.770411, 0.917510, 0.769912, 1.281401, 0.860207, 8.860148, 12.592125, 0.763850, 1.324453, 0.315468, 2.629218, 1.858013, 2.020370, 2.281254, 2.419521, 2.320197, 0.356944, 0.733198, 8.476224, 4.121862, 1.780300, 0.554603, 1.266102, 1.358430, 7.178387, 6.050108, 3.143687, 1.316936, 3.186815, 1.791551, 1.228746, 1.344890, 0.575400, 3.593214, 2.663420, 1.101866, 0.464002, 0.321111, 1.257571, 0.780117, 1.550484, 1.296232, 0.340041, 1.547374, 11.627332, 0.865222, 1.344779, 0.592637, 2.048930, 0.768945, 0.774613, 0.827915, 7.974710, 1.057675, 0.715735, 1.711105, 0.795446, 1.959408, 1.651344, 1.875612, 0.459959, 0.791802, 1.786217, 0.741735, 0.825586, 1.892231, 1.168827, 0.677069, 1.817405, 0.658015, 1.024986, 0.308619, 0.824100, 1.219193, 0.185966, 0.122821, 0.539913, 0.760279, 0.523855, 1.227594, 0.519508, 1.503222, 0.473661, 0.925239, 0.306562, 0.700718, 3.936151, 0.821438, 5.102954, 0.729989, 1.942092, 1.292566, 3.214337, 0.276788, 1.646888, 2.101725, 0.399275, 0.657961, 0.589072, 1.047804, 0.927023, 1.321518, 1.645148, 2.151652, 0.646136, 2.140538, 1.362804, 1.508201, 1.899161, 0.375190, 0.342867, 0.457775, 0.814368, 1.553483, 1.710910, 0.444507, 2.984071, 0.511667, 0.796434, 1.268922, 0.715343, 0.852908, 3.072035, 1.346055, 0.562906, 1.294972, 0.555498, 0.771924, 9.377162, 0.754132, 0.748580, 1.993296, 11.255013, 2.324675, 2.047545, 2.101003, 0.805934, 2.137544, 0.731228, 0.487667, 0.291176, 0.298213, 1.209474, 1.337133, 0.628495, 0.391236, 0.727149, 0.110543, 0.526838, 0.788208, 0.726211, 0.996542, 0.340937, 2.277837, 0.463109, 5.140041, 1.241416, 0.520189, 0.479878, 21.219235, 1.251649, 1.321127, 0.406815, 0.062598, 0.486536, 0.783509, 0.826198, 5.075910, 1.241263, 0.877053, 0.370611, 0.826531, 1.434221, 0.091721, 0.507911, 0.492453, 3.770892, 3.101943, 1.153622, 1.644720, 0.789029, 0.700932, 1.066555, 0.347035, 0.863592, 1.136398, 0.502070, 0.644807, 2.277542, 2.198109, 1.037150, 2.028625, 2.167577, 1.155286, 0.341544, 0.217229, 1.705465, 1.126306, 0.637571, 1.085033, 0.231941, 3.024562, 3.276656, 3.894047, 1.735689, 0.464575, 1.359635, 0.311121, 1.561316, 3.272299, 8.967766, 0.289076, 1.277055, 0.448540, 0.342617, 0.274937, 0.183643, 0.549647, 0.302567, 2.843741, 1.851957, 5.190351, 2.370601, 1.438702, 1.898763, 0.332380, 0.084184, 1.124961, 3.232622, 1.191935, 0.767745, 1.170982, 0.224510, 3.417430, 4.749685, 3.093881, 0.762010, 4.266399, 1.642053, 0.321127, 2.543820, 2.658982, 0.850657, 0.191156, 0.817909, 0.942312, 2.053347, 2.685076, 2.153747, 0.722437, 0.310392, 0.311083, 1.444254, 0.813266, 0.707358, 2.022430, 0.786667, 1.334034, 0.797700, 3.947807, 2.435510, 0.144764, 0.106716, 0.894122, 0.527873, 2.926609, 0.794326, 0.364338, 0.506758, 0.409585, 1.139561, 0.803036, 0.515648, 4.892808, 0.665242, 0.957200, 1.295399, 11.011154, 1.316031, 0.350423, 1.267328, 1.657522, 4.864679, 1.070414, 2.612145, 2.171689, 5.810292, 0.395758, 0.921342, 1.164557, 1.315020, 0.181672, 0.529209, 0.496637, 0.736494, 1.421656, 0.649993, 0.771377, 0.792043, 7.105971, 0.876201, 0.525471, 2.121652, 0.414844, 0.174669, 0.737561, 0.449701, 1.251363, 0.828405, 9.058380, 1.220388, 1.986245, 0.604372, 1.048813, 5.099255, 1.148841, 6.728184, 0.556228, 0.587291, 0.420035, 1.864288, 3.390845, 3.737275, 1.089713, 0.989711, 30.050824, 0.747372, 0.757884, 0.408535, 3.254083, 0.173594, 0.940977, 1.883979, 0.521101, 1.349321, 0.451722, 0.464343, 0.581101, 0.619842, 0.239198, 1.046861, 1.213532, 0.456891, 0.593137, 0.190447, 1.031676, 0.648486, 0.854656, 0.521133, 0.455852, 1.004514, 0.609208, 0.684316, 1.154618, 0.271966, 0.070280, 0.709467, 0.605986, 1.392137, 0.727855, 0.482093, 0.439359, 1.349755, 2.014518, 0.143181, 0.230896, 2.460406, 0.352252, 0.989903, 1.369503, 1.596509, 0.260919, 0.677033, 0.861549, 1.234013, 0.920936, 1.642564, 2.407655, 1.053326, 0.816884, 0.592900, 1.634740, 3.091977, 0.660095, 1.260826, 0.262762, 12.525424, 1.714539, 0.240994, 0.823309, 1.394890, 0.858196, 1.550336, 0.166977, 1.014535, 2.178901, 0.889743, 1.122940, 2.779173, 1.612933, 0.824991, 1.990017, 1.937296, 2.397542, 2.411402, 0.195720, 0.614838, 4.776151, 0.241130, 1.224605, 3.124366, 0.717817, 0.281500, 0.219462, 0.234772, 0.958338, 0.942700, 1.169196, 1.245683, 0.433990, 0.285090, 1.398648, 1.266917, 1.051523, 0.292836, 1.055758, 1.060874, 2.342477, 3.757778, 0.134386, 7.365269, 0.576823, 1.988972, 0.458798, 0.307770, 0.222662, 0.686209, 1.528905, 0.438824, 0.100478, 2.863334, 2.683312, 2.684887, 1.110482, 2.295776, 0.564756, 1.980510, 1.707726, 0.944223, 0.331467, 0.359505, 3.839377, 0.184477, 0.966090, 1.368427, 1.914840, 1.360649, 1.037444, 0.898806, 0.966526, 0.522391, 0.832507, 2.518918, 0.517650, 0.847087, 0.532118, 0.733458, 0.582676, 0.712281, 0.744092, 0.626453, 0.209832, 0.528628, 2.506405, 16.753831, 0.158931, 7.987352, 0.342643, 13.333168, 0.523673, 0.296304, 0.487699, 0.501770, 0.829849, 2.516160, 0.299576, 0.503019, 1.448718, 1.302552, 0.804994, 0.490438, 0.509478, 1.388539, 1.675334, 0.409176, 1.186943, 2.181135, 0.815226, 0.367588, 1.042533, 1.374205, 1.122501, 4.481728, 0.344297, 0.583387, 0.330723, 0.795675, 4.072474, 1.396141, 1.262369, 1.245850, 1.945493, 0.975668, 1.672581, 2.185571, 2.076307, 0.586894, 0.787585, 1.172188, 1.323199, 2.246978, 1.215124, 0.783149, 3.012407, 1.135002, 0.584597, 0.853892, 1.633472, 0.233188, 1.163495, 1.256616, 0.593591, 0.382369, 0.744756, 1.903076, 0.235311, 2.374264, 1.907758, 0.277353, 1.638692, 1.190193, 2.314708, 1.342778, 1.007197, 1.523857, 0.638370, 1.846267, 0.068299, 0.981557, 1.721468, 2.965803, 0.221210, 2.290222, 1.487348, 2.034309, 6.352766, 3.932593, 0.481330, 0.370133, 1.358034, 8.573798, 0.190393, 1.048336, 0.520405, 3.303983, 0.263346, 5.626591, 0.728531, 1.090349, 0.903166, 0.424080, 2.346113, 0.477460, 18.811731, 0.777626, 0.618943, 1.084079, 0.951975, 0.522566, 1.971799, 3.395930, 2.245582, 0.677649, 6.386377, 0.694892, 3.630104, 2.045380, 2.992960, 2.286195, 3.310784, 4.609843, 1.412619, 0.070796, 0.334971, 1.173421, 0.713819, 2.102299, 0.110185, 6.990576, 0.739450, 0.746781, 1.189179, 0.544369, 0.351854, 0.697160, 2.202884, 0.568374, 0.517505, 1.033380, 2.578487, 0.294786, 0.604720, 0.455873, 0.817148, 0.272351, 7.452389, 2.658414, 0.372639, 1.706984, 4.556100, 0.333305, 1.560636, 1.021591, 3.267289, 2.427187, 1.178207, 1.183206, 0.708446, 0.845149, 1.310789, 1.049025, 1.814940, 0.859931, 0.774797, 1.024156, 0.961028, 1.151046, 5.364742, 1.613738, 0.548470, 0.113214, 1.340379, 9.751709, 0.795011, 1.302612, 0.755489, 2.395166, 0.581512, 0.764622, 0.790439, 0.613861, 5.917620, 2.576909, 5.287671, 1.426747, 0.087415, 0.945235, 0.745152, 1.010468, 0.782857, 9.758238, 1.399255, 4.408668, 0.799639, 1.817647, 1.607922, 0.790114, 1.368861, 1.256246, 0.802415, 0.583291, 1.215349, 1.222458, 1.326221, 0.813231, 5.322535, 1.162690, 2.818519, 3.759291, 1.398695, 1.364213, 0.801804, 5.729106, 2.513281, 1.164380, 1.361702, 0.673414, 1.982559, 3.295991, 0.233786, 6.734812, 0.674009, 1.201140, 1.753545, 1.274317, 1.064859, 4.333898, 1.891798, 11.474456, 2.896345, 6.032811, 1.530567, 3.434170, 1.305110, 1.297759, 3.338483, 0.628913, 0.407786, 1.473156, 0.591133, 1.202665, 5.412293, 1.230931, 11.157969, 5.986833, 1.217573, 1.293906, 4.435717, 1.826348, 2.939128, 5.230118, 0.463900, 1.206208, 1.630750, 0.709199, 0.213250, 1.256625, 6.050143, 2.484492, 1.647064, 0.274041, 0.493291, 0.365570, 1.548584, 4.374914, 0.955751, 9.915242, 0.974073, 1.209881, 1.146698, 2.040257, 15.076464, 1.024713, 3.542997, 1.379407, 2.802261, 0.406986, 2.704789, 0.559232, 1.239322, 1.828361, 0.263488, 4.954175, 1.249200, 1.412818, 7.855452, 1.420547, 3.096267, 1.485219, 0.864796, 3.286167, 1.251075, 0.945588, 1.006882, 2.207450, 0.454364, 10.161853, 4.758161, 1.617506, 2.967127, 0.572087, 0.818013, 1.981740, 15.618930, 0.837923, 0.769774, 0.863721, 0.750794, 0.712131, 2.115508, 2.441507, 0.288228, 0.185294, 2.311215, 11.647652, 0.409317, 3.778170, 1.834559, 1.181767, 0.694880, 2.416622, 2.329412, 0.413999, 0.721438, 1.182009, 1.286346, 7.764846, 1.766384, 1.581978, 0.830215, 1.556369, 0.235236, 1.002844, 0.429904, 1.198917, 1.175657, 1.169662, 0.356114, 3.075297, 3.790889, 3.178404, 20.036000, 5.477823, 2.696659, 0.304751, 0.298387, 0.779610, 0.983773, 0.444158, 0.355838, 0.880666, 1.172620, 0.283120, 0.726480, 2.221121, 6.622342, 1.775243, 2.571103, 5.876681, 1.765302, 1.351953, 0.557316, 2.078921, 1.546475, 1.275762, 0.904995, 7.046644, 11.889126, 0.845305, 0.785422, 0.782529, 7.127191, 6.725926, 1.723251, 0.282328, 0.701239, 8.627586, 0.757102, 0.284758, 1.675627, 6.663025, 1.799418, 1.407719, 0.249800, 1.511992, 6.227925, 6.866204, 1.003737, 2.147374, 2.344154, 0.217366, 0.338077, 1.996158, 0.717779, 0.733195, 1.449908, 2.190889, 0.225381, 6.976817, 9.019651, 1.375275, 1.385795, 0.546687, 4.286843, 0.426841, 2.446788, 0.537510, 0.517815, 0.887279, 1.406258, 1.300222, 1.239313, 0.782999, 0.353948, 0.409450, 1.737053, 1.019227, 1.217957, 0.635253, 1.289697, 0.294288, 1.291559, 0.808147, 1.070752, 0.780856, 0.892953, 2.005198, 5.881614, 2.698554, 0.671108, 3.822102, 2.993872, 0.520207, 0.738218, 0.914193, 0.218680, 0.519194, 0.222524, 0.642721, 1.995749, 0.790141, 1.869081, 0.626445, 0.796430, 1.208373, 0.647102, 0.760000, 0.975158, 0.132602, 6.119403, 0.582263, 0.249460, 1.964584, 0.596189, 3.555993, 0.555719, 0.853508, 10.832551, 3.255408, 2.564304, 0.792644, 1.565031, 1.740537, 1.338738, 0.071956, 1.043448, 1.188049, 0.788682, 0.842652, 0.184264, 1.389921, 0.360183, 1.447471, 1.743730, 1.402948, 1.878788, 2.245878, 3.506877, 1.016861, 0.693548, 2.874485, 0.349330, 0.090988, 0.244096, 0.287821, 1.313927, 0.945527, 0.941263, 1.234743, 1.273876, 1.173051, 0.787734, 0.391551, 0.097091, 0.867384, 0.266932, 1.787911, 0.890265, 1.568032, 0.748571, 1.116502, 1.406190, 1.795810, 1.834768, 0.627495, 0.879326, 0.957489, 0.631029, 1.071787, 0.791563, 3.792776, 1.186053, 1.622231, 0.610866, 0.703916, 1.808439, 0.669224, 0.285073, 13.773446, 6.939283, 2.552836, 0.307899, 0.548235, 2.068512, 0.366258, 1.930446, 4.061735, 2.238006, 1.621128, 4.556655, 1.389700, 10.718945, 7.019523, 0.279101, 0.399315, 3.123801, 4.466423, 5.952674, 0.632677, 0.177835, 0.643458, 0.232210, 1.471812, 0.811342, 0.480842, 2.026042, 2.609343, 0.593846, 4.589588, 3.067098, 3.348903, 1.257215, 0.678773, 1.259408, 5.565034, 3.416935, 1.103651, 2.533884, 0.885414, 1.006050, 0.175854, 0.152954, 2.192039, 0.381527, 0.349721, 0.256633, 0.319341, 1.701215, 0.742367, 2.251771, 0.756906, 1.264244, 0.972987, 2.476627, 15.650847, 0.533333, 4.819655, 0.678353, 1.312477, 0.713697, 0.371603, 0.346171, 0.745448, 0.560544, 5.546040, 0.200143, 0.825408, 0.492209, 0.805036, 2.630871, 0.384802, 0.652236, 0.885038, 0.519367, 0.962446, 5.513109, 1.528740, 0.785521, 0.835177, 0.856812, 0.476195, 1.585597, 0.834862, 5.837969, 1.503356, 1.560950, 0.772090, 0.393813, 0.270284, 0.321096, 0.049968, 1.724116, 0.697911, 0.824489, 2.391896, 1.019166, 0.863060, 3.221793, 0.194255, 0.195485, 0.833802, 1.017549, 0.715166, 0.333098, 1.232543, 0.671292, 0.336322, 3.407078, 0.853543, 0.852506, 1.843390, 2.662690, 0.277245, 1.154713, 3.171785, 0.736346, 5.326867, 0.861943, 0.735519, 2.486008, 0.841779, 0.298397, 0.564096, 0.536056, 3.185401, 0.914429, 1.663922, 1.526564, 1.275516, 4.173047, 0.831973, 0.492757, 0.759878, 1.023078, 0.319586, 0.709575, 0.815038, 1.470373, 2.566244, 1.165303, 0.816327, 0.743116, 0.494677, 1.338802, 1.194339, 1.244261, 0.406185, 1.504073, 1.374132, 4.101920, 3.595585, 0.623053, 0.279840, 1.109212, 2.463187, 3.741801, 2.030294, 2.525578, 1.561289, 3.653510, 3.191610, 0.351664, 0.941562, 2.020238, 0.982359, 1.022448, 1.877437, 0.888871, 8.910051, 2.950481, 1.088110, 0.803378, 0.914816, 1.764645, 1.123051, 1.770270, 1.181598, 0.318074, 0.530994, 1.710152, 0.886828, 0.569886, 5.661190, 1.226738, 1.321599, 0.734991, 0.411399, 2.054601, 0.635818, 1.821042, 2.349384, 0.348780, 1.143481, 1.269836, 1.171862, 1.548800, 2.772665, 3.575646, 1.198661, 3.971927, 1.282946, 1.716981, 2.130113, 0.355131, 9.467101, 0.367125, 1.654640, 0.733216, 0.805085, 0.722553, 1.542120, 0.624427, 2.959011, 1.557001, 1.999188, 0.826839, 0.667018, 0.877971, 0.270899, 0.399928, 1.091896, 0.235486, 2.267811, 1.508762, 3.401391, 0.719035, 2.160624, 0.753118, 1.238492, 0.784941, 0.741185, 3.841104, 1.304403, 1.326964, 4.974109, 1.055395, 1.655496, 0.364588, 0.630884, 1.194490, 3.437514, 2.104298, 1.451976, 0.975104, 4.945145, 1.724183, 0.303787, 0.362975, 0.830944, 2.711019, 0.575912, 0.196889, 5.904779, 1.363034, 0.142085, 1.254561, 0.231568, 0.669080, 1.357112, 1.286814, 0.339748, 1.603158, 1.302855, 1.295535, 1.148246, 1.141188, 1.621242, 8.278436, 1.253752, 0.757716, 1.570711, 0.655191, 0.823157, 1.250692, 0.737199, 1.266691, 3.448673, 1.552078, 1.278149, 4.123258, 1.293628, 0.212554, 1.315789, 1.270406, 1.391648, 0.322584, 1.683295, 1.111790, 0.160938, 3.109863, 1.601447, 2.024539, 0.644123, 0.340290, 1.172561, 2.962238, 1.865775, 2.379667, 3.107468, 2.854277, 1.115437, 8.115634, 2.297571, 21.382643, 0.416556, 1.811076, 2.903826, 1.474316, 2.672790, 1.275672, 2.904259, 12.773592, 3.454585, 1.044269, 1.876627, 3.535048, 4.230842, 0.368511, 1.198186, 1.391997, 0.639219, 1.703717, 0.422461, 1.258463, 0.768668, 1.501391, 0.788372, 5.742600, 0.455395, 0.916189, 1.854627, 1.275591, 3.494725, 1.339511, 2.504742, 4.333660, 8.742209, 2.336475, 1.321775, 1.326946, 1.304283, 1.217829, 2.156144, 1.397114, 0.652430, 1.584014, 2.687893, 3.301557, 4.560189, 1.284229, 0.517431, 2.558050, 1.332106, 1.866543, 1.286478, 1.519526, 0.783372, 0.342406, 1.624157, 6.655622, 8.514938, 4.646688, 0.061930, 0.468889, 1.502310, 4.030090, 0.639810, 4.943935, 4.803838, 53.500000, 0.749878, 2.654923, 0.461332, 0.905508, 1.366357, 1.903851, 1.151741, 1.976357, 3.452937, 1.224632, 2.627046, 1.334633, 1.296751, 1.388415, 1.259847, 1.112347, 1.766658, 0.476388, 3.187727, 2.173317, 0.842118, 2.272629, 2.094030, 1.243442, 0.560549, 2.817651, 1.305202, 1.201045, 0.305244, 0.803690, 1.198329, 2.185364, 0.623662, 1.139457, 1.486212, 0.758134, 1.222811, 0.616101, 3.879913, 0.510980, 9.724012, 1.558876, 5.680858, 0.453643, 0.776641, 0.486387, 1.255714, 0.857902, 0.689005, 0.586140, 2.194969, 8.720624, 0.807728, 1.266833, 3.200070, 3.096768, 1.648662, 1.226056, 1.261665, 0.743554, 1.331508, 1.315559, 1.594448, 0.697896, 2.956927, 0.354346, 2.831179, 2.710714, 1.275416, 1.306108, 1.311254, 1.280843, 0.748703, 2.275469, 1.625966, 1.622436, 0.488976, 0.847249, 1.503103, 1.196596, 1.253442, 1.258964, 1.952974, 1.195232, 1.459450, 0.567241, 1.695523, 0.851329, 1.284948, 1.360250, 1.214036, 1.795652, 2.085783, 1.794343, 1.618424, 16.995627, 1.385023, 2.111036, 1.273418, 0.700000, 1.424153, 3.789383, 0.416104, 3.735802, 4.636227, 1.983803, 2.199643, 0.692529, 1.352016, 1.258087, 0.645447, 1.249566, 1.182067, 0.387713, 1.203959, 2.263844, 0.876781, 0.499605, 0.508998, 1.391758, 1.021953, 4.406093, 5.637973, 1.292875, 5.321114, 3.103907, 1.855111, 0.261433, 0.270610, 8.789020, 1.240942, 0.389084, 2.982338, 1.363636, 0.418226, 1.133131, 1.006907, 0.274201, 1.360739, 1.972652, 2.674600, 1.250804, 0.737325, 1.206186, 13.050992, 2.710521, 5.438982, 4.218795, 0.481798, 0.824320, 0.544913, 12.768262, 2.883217, 1.236682, 8.971646, 0.805130, 0.679041, 0.460944, 1.207185, 0.849770, 0.613480, 3.273262, 1.256392, 0.819602, 1.744082, 1.275285, 5.235862, 0.724861, 3.435982, 0.636033, 1.897636, 1.934295, 1.312062, 3.757523, 2.663481, 0.616812, 1.391010, 0.225305, 1.105779, 1.528065, 0.842090, 1.545180, 2.197855, 0.404309, 1.706794, 0.320407, 0.494985, 10.412074, 1.305140, 5.587676, 1.973245, 1.300000, 1.220770, 2.715700, 0.235878, 1.427876, 2.962113, 4.021420, 1.108404, 1.188153, 2.154211, 2.559110, 3.505239, 1.956630, 2.353321, 1.574262, 1.212016, 1.228834, 4.836045, 0.626903, 1.417584, 1.412749, 2.336017, 25.471893, 6.633157, 1.219512, 1.431103, 1.463642, 0.334526, 8.469129, 0.659310, 2.142711, 1.323677, 1.192626, 1.229525, 0.671849, 1.222665, 3.535477, 1.420798, 2.573471, 3.377035, 3.669346, 1.237255, 0.361214, 2.507785, 1.374584, 0.520281, 15.754639, 0.755546, 1.178303, 19.722504, 1.981192, 3.028433, 1.665253, 1.280924, 2.235797, 1.694160, 5.623254, 2.339957, 6.546263, 1.275711, 12.395737, 1.257143, 0.653223, 1.041021, 1.214286, 1.244223, 0.292201, 0.213653, 0.315112, 2.007028, 1.631237, 2.808292, 1.265737, 2.509006, 1.328821, 1.325608, 2.795891, 2.499725, 2.042048, 3.302401, 1.353627, 1.416667, 1.273739, 1.521525, 2.330524, 2.472696, 2.251059, 0.411549, 0.614343, 0.968940, 1.335599, 0.525977, 1.224000, 0.563578, 0.940587, 2.458813, 2.295809, 3.581654, 0.365231, 3.915208, 2.459276, 0.369105, 0.335279, 2.303456, 2.966960, 0.801462, 3.961630, 4.361619, 1.186584, 2.281777, 1.215598, 0.676263, 2.412514, 1.256367, 0.988742, 1.503024, 2.803452, 7.796235, 2.557570, 3.915964, 0.388472, 0.856117, 1.351714, 1.261220, 3.182490, 1.285914, 1.998172, 2.821416, 0.831691, 0.316372, 0.526268, 1.806543, 0.871970, 0.719381, 1.231374, 1.059683, 0.654043, 1.462941, 0.727576, 3.016360, 4.577539, 0.788466, 0.539553, 0.513228, 0.809958, 12.400730, 2.056937, 38.223656, 1.770676, 1.436988, 0.784861, 0.818378, 2.360866, 0.289825, 0.487359, 7.955508, 8.607061, 0.392239, 0.699811, 0.528674, 0.787879, 1.250870, 8.824031, 1.754024, 1.736497, 0.383760, 0.406089, 0.123392, 0.601372, 20.556693, 0.244167, 0.737733, 0.774363, 0.282228, 5.222222, 0.408310, 8.374973, 1.039868, 0.974763, 1.426165, 2.462571, 1.274286, 1.354205, 1.227936, 2.601626, 3.373450, 5.771429, 8.436092, 0.277963, 0.763499, 4.986000, 4.647646, 3.087594, 4.234321, 0.479288, 2.679088, 0.218562, 1.073831, 1.611332, 8.237332, 0.223105, 1.428905, 0.558887, 0.598276, 0.808194, 19.954483, 1.450966, 0.292405, 1.392850, 1.289610, 0.966581, 0.408285, 1.674814, 0.826559, 1.032208, 0.983212, 2.125775, 2.856666, 3.633242, 2.714695, 1.183515, 0.229208, 3.179757, 0.563334, 0.460747, 0.503031, 1.560433, 0.432662, 1.364204, 0.479210, 0.490951, 0.508587, 0.476706, 0.392040, 6.281967, 1.144596, 3.467835, 0.802068, 1.363124, 0.223641, 0.646127, 1.748195, 1.190030, 1.265179, 1.846099, 1.602266, 4.122198, 1.715743, 0.719586, 1.835467, 0.525631, 1.283065, 1.281050, 2.895170, 1.098352, 0.743595, 0.743766, 1.608736, 0.460664, 1.826565, 4.615240, 0.312815, 1.114647, 0.764086, 1.303882, 1.988235, 1.694506, 1.535437, 1.303129, 2.368785, 1.507459, 1.519236, 1.267209, 3.909483, 3.560360, 6.707861, 1.318101, 0.567258, 3.476748, 1.303064, 0.818887, 0.738535, 8.515039, 2.720056, 0.429254, 1.530914, 1.485121, 0.247698, 0.375373, 2.753730, 1.334431, 0.862606, 1.188194, 1.106887, 1.285200, 2.820542, 0.208472, 1.748349, 0.810024, 1.783435, 0.206676, 0.212582, 0.802966, 1.330856, 1.923461, 1.918106, 0.329447, 1.607515, 3.697051, 2.618195, 0.332775, 2.087785, 0.485587, 3.928624, 1.508623, 1.660675, 0.815920, 1.951384, 3.675521, 1.364455, 2.399683, 0.649233, 0.245306, 0.336624, 0.909168, 0.394077, 1.077650, 0.312940, 2.648784, 1.503380, 4.846327, 0.435437, 4.280176, 0.509140, 0.926890, 1.676185, 0.754561, 1.250178, 0.771416, 0.262562, 2.015964, 0.739988, 0.922198, 1.616051, 0.785002, 1.657340, 2.590230, 3.144754, 0.959126, 1.923772, 0.351373, 1.268931, 0.817149, 0.819452, 2.561016, 0.641459, 10.707530, 0.652019, 1.525387, 0.805247, 1.287115, 3.983785, 1.361451, 1.495545, 0.805812, 0.334325, 0.801804, 0.608543, 1.489718, 1.555619, 0.805566, 0.356052, 1.433946, 0.376070, 2.020374, 1.060573, 3.452018, 3.740632, 3.092932, 5.003260, 5.046478, 0.859384, 1.857398, 0.797049, 0.650167, 3.443118, 1.442142, 1.989624, 0.362710, 1.306305, 1.562689, 1.931121, 0.676620, 0.770399, 0.508725, 0.876988, 1.173997, 0.268542, 0.813279, 1.105744, 3.796670, 0.171291, 1.302301, 0.749303, 0.353374, 2.527893, 2.704619, 2.378550, 1.764093, 3.370820, 0.887366, 1.401698, 1.293908, 1.255645, 0.536052, 1.268388, 0.726720, 3.298550, 0.912335, 1.801627, 2.897698, 0.385670, 0.178170, 4.008798, 0.186812, 0.247781, 0.630157, 0.223209, 0.855502, 1.919355, 0.734564, 0.755400, 0.083013, 0.533220, 3.366483, 1.173730, 1.731553, 0.300025, 1.138498, 0.747720, 0.559011, 4.058423, 3.422785, 0.481731, 0.406483, 3.113559, 1.050545, 1.445119, 4.888914, 0.842581, 0.544952, 0.616256, 0.696374, 0.092067, 0.775873, 1.613825, 1.706452, 4.173343, 6.993407, 0.098528, 9.071468, 1.386636, 20.403147, 2.397435, 0.827799, 38.123543, 1.506337, 0.399740, 1.327972, 2.037147, 0.984035, 0.418124, 0.321929, 1.165379, 1.513450, 0.709150, 0.230879, 1.970793, 0.771967, 2.659084, 0.298300, 3.961500, 0.418186, 0.302477, 0.784275, 4.500855, 0.792198, 0.791974, 1.145144, 2.292030, 1.331143, 0.759671, 0.773571, 0.795765, 1.909031, 0.038681, 0.672904, 0.142059, 1.516084, 1.733639, 0.770227, 0.915708, 0.274207, 0.220947, 0.777281, 0.841045, 0.400389, 0.503673, 1.805403, 2.799747, 4.494198, 0.325205, 3.808787, 1.151350, 0.887975, 2.020324, 1.186942, 1.062605, 0.960920, 8.562557, 3.117847, 1.434269, 0.041056, 2.151689, 1.632421, 1.456906, 0.983440, 3.031925, 2.228422, 1.471647, 1.876981, 0.131439, 0.514178, 1.797086, 1.378863, 1.473223, 0.621324, 2.968118, 6.237050, 0.635219, 1.207047, 1.388359, 0.240962, 0.719089, 1.126650, 1.464195, 0.159585, 1.085512, 0.393427, 0.601213, 2.105863, 2.554703, 0.236056, 0.179832, 2.553311, 6.781758, 2.788373, 2.047897, 4.600810, 0.732289, 0.754335, 2.309958, 1.796689, 4.027743, 1.049611, 0.929477, 2.146814, 0.505762, 2.113147, 1.256259, 0.867208, 0.723649, 1.478940, 3.030309, 2.248044, 1.345156, 9.572247, 0.448672, 0.358307, 4.419568, 1.528408, 6.161335, 5.174098, 1.056745, 0.171910, 0.457068, 1.462169, 2.712847, 2.976402, 0.125251, 2.281968, 3.238934, 1.180060, 0.890126, 5.066825, 1.309588, 1.924815, 0.967436, 1.440765, 0.471586, 2.154481, 1.108534, 4.551880, 1.064231, 4.705489, 0.665470, 1.732011, 0.794654, 0.363073, 1.816280, 21.109383, 0.288303, 0.955030, 1.028380, 1.150232, 1.939445, 1.253534, 4.719784, 0.424932, 1.675639, 2.154873, 0.444876, 0.648398, 0.357270, 4.511607, 0.812665, 0.149757, 0.988515, 1.687906, 0.935859, 0.644970, 1.155990, 0.082871, 0.755771, 1.281295, 0.832183, 2.837951, 3.552532, 1.524592, 0.292180, 0.228853, 2.237947, 3.547997, 19.698816, 1.628388, 0.588346, 4.550206, 0.552781, 1.465910, 0.630304, 2.816488, 1.336009, 0.749317, 1.904792, 1.264083, 0.922711, 1.773356, 3.267752, 3.791686, 0.857102, 0.856278, 4.676272, 1.736109, 3.457803, 0.764633, 1.929787, 1.265220, 1.248880, 3.500405, 1.002889, 1.640586, 0.406437, 1.198426, 1.342711, 0.826352, 7.764557, 2.956772, 0.285995, 1.269076, 1.762223, 0.758342, 1.320517, 0.514854, 0.327028, 1.116984, 1.596813, 0.607222, 0.585771, 1.601278, 1.303284, 1.612528, 0.324901, 2.468811, 5.684001, 1.821384, 3.614076, 8.334078, 1.239871, 0.730990, 1.229725, 4.657697, 1.946950, 1.193219, 1.123719, 3.595155, 5.553282, 1.401911, 3.146035, 0.643791, 1.844833, 1.559504, 0.905397, 0.337349, 4.442863, 2.077453, 1.229330, 4.009241, 1.745905, 1.599279, 2.154818, 1.956089, 0.823132, 2.671319, 0.687143, 1.749276, 1.130689, 1.232378, 0.714077, 0.463344, 2.902499, 1.628516, 0.937898, 0.985301, 0.315115, 3.008754, 1.896112, 1.444828, 1.252180, 0.407794, 1.389096, 1.251581, 2.372962, 0.131948, 4.265020, 0.594973, 11.676604, 1.398889, 2.377026, 3.224670, 0.689385, 1.292490, 1.230583, 2.513760, 0.877849, 1.047835, 1.243849, 0.779973, 1.149564, 0.766509, 0.934426, 2.322797, 1.025399, 0.890457, 3.942580, 0.356616, 0.099939, 0.926168, 1.450465, 1.261774, 0.699319, 0.733325, 0.795707, 1.246413, 3.366020, 3.436110, 6.729488, 6.965868, 4.132025, 0.454622, 2.570497, 0.774001, 1.286585, 0.531415, 0.937529, 1.321928, 1.608499, 0.533581, 2.203573, 7.056016, 2.204332, 0.861641, 0.583902, 0.728773, 1.230450, 2.775056, 0.627211, 1.285968, 0.749669, 1.208324, 2.179763, 3.068620, 0.863318, 0.822268, 0.637922, 0.540531, 1.168253, 1.266082, 1.797969, 1.168754, 1.324383, 2.797473, 1.830080, 0.567883, 13.146384, 1.198410, 1.211491, 23.922090, 1.224046, 11.832368, 2.756045, 1.462053, 2.934268, 1.734272, 5.122912, 0.848835, 0.487642, 6.245111, 0.652789, 0.621537, 1.388325, 0.405475, 14.147981, 4.994702, 0.890191, 14.520572, 5.012411, 1.515023, 5.901115, 2.903882, 0.603025, 12.595591, 1.275994, 1.215775, 1.222960, 3.888665, 0.820348, 1.545254, 0.139220, 1.251568, 1.778813, 1.316171, 1.380098, 3.998911, 1.160847, 0.819244, 6.040057, 1.983187, 1.261982, 1.319242, 1.824953, 2.868653, 3.247644, 1.106850, 1.083425, 1.229655, 0.739988, 8.227496, 1.197062, 7.961083, 1.707885, 1.283566, 1.272444, 0.578854, 1.294974, 2.105758, 1.230231, 1.748283, 2.122366, 8.300760, 1.243919, 0.876153, 1.295841, 14.095288, 1.299014, 1.318508, 4.723266, 1.282687, 1.309001, 2.894680, 1.170895, 10.645024, 3.360619, 0.952070, 3.041943, 0.918480, 6.410758, 1.213566, 1.923997, 0.835246, 2.251857, 1.063696, 1.535088, 0.793926, 1.270655, 0.746903, 1.165592, 1.294863, 1.876516, 1.623432, 1.883520, 1.273449, 1.261232, 2.568910, 0.652190, 0.498171, 1.540746, 1.022300, 0.461652, 0.306351, 1.308481, 1.374674, 1.170488, 1.403337, 0.857464, 0.512576, 2.558099, 1.322774, 1.286270, 1.125265, 0.712990, 1.287884, 1.270521, 2.124510, 0.627852, 1.331807, 3.806772, 11.515080, 3.309965, 2.103119, 1.310649, 4.308541, 0.774549, 1.320957, 0.823349, 0.721764, 0.968539, 1.168621, 1.504422, 0.487384, 1.844385, 0.780900, 1.806760, 0.805287, 0.599187, 0.524781, 0.789814, 1.519448, 0.639963, 0.598684, 0.821170, 8.395170, 0.791519, 2.307148, 1.233780, 1.302673, 0.803353, 1.797736, 1.270650, 1.246688, 6.238886, 1.212899, 0.739543, 0.795117, 4.392359, 1.209717, 4.556855, 1.660423, 0.379617, 2.042887, 0.511705, 8.568182, 1.243400, 1.247471, 2.216082, 1.213343, 5.245276, 0.847941, 4.853226, 1.310432, 1.852149, 0.883326, 0.463080, 1.222800, 1.269423, 5.182008, 0.092243, 4.766911, 1.120466, 1.216768, 1.217014, 1.223284, 1.300071, 0.223207, 0.386800, 1.228213, 5.484702, 1.287352, 4.316775, 0.333023, 0.936958, 1.186217, 0.328840, 0.375258, 0.704114, 5.216216, 0.795344, 6.613050, 0.746259, 1.178678, 0.843979, 0.511177, 0.784504, 1.641731, 2.059472, 0.693109, 0.817570, 0.728005, 0.819164, 1.177285, 0.531335, 0.696474, 0.502755, 1.327654, 0.778334, 0.749048, 0.840749, 1.795933, 0.498965, 0.539679, 0.589633, 2.514408, 16.522250, 2.633387, 1.295713, 5.435529, 1.351322, 1.259047, 0.568361, 1.263443, 1.490566, 0.756526, 3.183733, 1.808824, 1.207713, 1.241018, 0.593217, 1.285967, 1.295205, 1.257864, 0.838843, 0.618163, 1.255326, 5.225750, 1.836484, 1.173806, 0.811579, 1.265349, 0.764158, 4.199909, 0.708140, 0.822415, 1.278187, 0.334069, 1.174939, 3.667866, 2.256522, 0.646154, 1.187759, 1.354718, 3.727668, 0.827804, 0.672254, 36.821442, 14.745781, 0.845216, 2.246575, 1.966620, 1.311032, 12.104559, 1.765488, 3.066019, 3.380836, 1.893631, 1.113805, 6.041368, 0.839846, 1.218415, 1.342111, 1.733768, 2.403139, 1.572608, 2.194195, 2.103962, 2.328947, 1.255806, 0.873779, 5.878525, 1.361590, 1.305133, 5.488360, 1.131491, 1.361740, 0.874877, 2.773577, 0.526977, 11.612296, 0.814465, 2.094183, 1.272279, 1.229853, 3.084116, 1.212483, 1.300324, 1.866223, 1.541577, 1.166166, 0.803359, 7.374866, 1.398179, 1.252027, 10.954898, 1.315431, 1.187780, 1.232949, 0.810411, 0.492701, 0.671673, 1.315908, 2.085495, 1.933470, 1.198329, 0.812837, 1.357552, 0.264337, 1.242001, 1.212742, 1.333933, 1.512297, 1.631230, 2.849139, 0.660232, 0.859621, 1.678667, 1.097959, 1.281227, 1.737751, 1.275976, 0.613169, 1.233062, 1.305256, 3.444914, 0.314061, 1.561927, 2.264597, 0.661476, 2.648295, 2.898283, 1.512950, 1.253704, 3.364606, 0.738020, 0.791072, 1.456681, 2.588110, 0.831848, 1.205985, 0.782485, 1.473574, 0.828276, 1.269008, 0.540427, 2.656328, 0.753247, 1.227241, 1.290172, 0.776552, 1.864456, 0.513952, 0.831519, 0.628756, 0.845357, 2.776846, 0.376937, 0.612038, 0.530060, 0.244975, 0.389040, 0.768045, 1.243072, 1.405190, 0.761587, 1.241935, 0.625890, 1.963013, 0.805301, 0.830222, 0.721096, 0.760280, 0.751221, 1.361255, 1.742120, 0.764225, 1.178833, 0.806974, 0.571570, 0.780638, 0.815225, 0.600767, 0.338710, 0.511292, 0.774604, 0.802190, 0.476184, 0.269364, 0.808268, 1.739917, 0.283799, 0.801044, 0.840173, 1.722646, 1.817863, 0.763573, 1.466258, 7.837145, 0.663071, 0.752811, 0.262065, 0.468364, 0.764394, 0.820791, 0.445378, 8.178367, 0.487126, 0.794274, 0.765574, 1.715141, 0.647379, 0.545343, 2.054562, 0.820108, 1.732991, 1.266855, 7.614328, 1.285663, 1.821377, 1.378510, 0.298455, 1.072786, 2.453168, 1.818340, 0.782732, 3.593282, 0.886081, 1.278508, 1.346499, 0.285941, 0.473337, 1.262426, 0.754608, 3.080885, 0.792694, 1.264205, 1.382694, 0.993178, 0.332389, 1.687042, 1.235899, 1.747312, 0.618918, 1.170740, 1.295316, 2.493852, 2.248292, 0.802783, 0.722222, 2.343399, 0.807456, 6.184036, 0.483757, 1.534636, 1.317811, 1.339311, 0.844236, 1.342784, 3.982193, 0.594659, 1.189661, 1.749049, 2.223657, 0.808631, 1.173489, 3.178807, 0.879680, 0.956161, 3.186134, 0.514178, 1.263268, 2.200623, 1.275862, 0.886801, 1.191070, 1.286540, 0.810095, 0.850184, 2.021088, 4.914316, 0.337362, 1.827869, 1.316750, 1.268512, 2.470588, 0.802334, 1.855898, 0.914704, 0.416135, 0.581301, 1.167586, 0.899473, 0.833863, 0.778846, 1.293548, 4.808154, 0.388767, 0.334317, 1.224022, 1.327226, 1.793044, 0.771961, 2.180186, 3.310481, 0.405472, 0.457554, 1.329514, 1.258907, 1.247920, 0.298569, 1.408477, 1.758960, 0.822723, 3.742279, 10.310164, 6.856278, 0.479812, 1.213549, 0.753770, 1.266807, 10.923587, 1.821827, 1.845926, 0.148258, 1.233874, 1.297911, 1.533543, 1.366679, 2.819229, 4.864556, 3.398230, 1.235153, 1.841040, 0.481943, 0.193449, 1.351168, 0.055744, 0.057695, 1.261605, 1.147317, 1.213398, 3.503892, 8.115715, 1.152316, 1.737297, 3.199374, 4.245890, 0.655294, 0.753742, 0.987855, 1.238429, 4.731573, 2.896065, 45.601514, 1.738293, 0.814210, 1.320420, 1.191888, 1.256040, 1.274568, 14.109418, 1.249377, 2.978621, 0.885511, 1.227861, 0.812174, 21.654287, 0.673135, 0.595905, 2.087870, 0.220837, 1.224674, 1.969377, 0.575490, 0.909226, 0.431047, 0.834249, 2.220620, 1.308135, 1.325994, 1.787021, 1.259993, 4.935009, 1.823018, 0.341605, 2.712469, 1.821060, 5.236215, 0.670747, 13.048706, 3.954529, 0.451839, 4.391429, 1.076497, 4.461835, 1.139154, 17.095680, 4.091390, 0.991394, 3.685704, 0.417135, 1.246288, 1.681479, 2.958606, 1.296110, 0.919499, 2.148174, 1.266980, 1.349673, 1.264306, 14.246107, 2.350853, 4.232404, 1.292159, 1.386799, 1.738608, 4.256309, 0.606109, 1.143025, 0.570521, 1.080620, 1.167602, 2.778869, 0.139535, 0.330172, 0.559306, 65.714387, 1.283263, 1.309964, 0.927946, 3.394569, 1.142198, 1.782342, 1.308052, 1.359853, 1.813011, 1.891147, 3.212751, 1.333698, 1.209694, 1.528538, 1.234431, 1.189679, 2.524815, 1.314848, 1.222103, 1.221086, 7.458957, 0.614093, 29.828428, 1.208511, 2.994889, 0.816690, 1.344616, 1.275562, 23.060681, 1.338636, 0.692318, 1.233240, 0.807039, 1.109516, 3.385616, 0.855831, 1.251343, 0.787721, 3.507591, 3.488506, 1.166642, 1.219117, 11.515701, 0.765016, 1.461136, 4.126860, 0.228123, 0.706546, 5.411933, 3.770234, 4.497099, 4.565985, 0.359041, 2.808084, 0.921210, 1.661792, 1.256890, 1.274176, 12.026796, 1.336713, 0.722750, 16.394003, 1.709104, 0.755965, 3.527118, 1.262897, 2.116821, 0.839263, 0.516686, 1.812368, 2.380742, 1.143671, 0.752451, 0.866027, 1.223642, 2.202812, 5.908525, 0.635957, 4.226709, 0.493942, 0.821256, 0.396700, 1.300170, 2.993463, 1.278365, 2.231821, 1.309815, 1.339171, 1.851018, 2.411465, 1.802068, 1.226035, 1.433145, 1.224377, 15.041622, 1.828259, 1.601509, 0.499346, 1.253353, 5.151229, 0.631683, 2.671617, 2.242068, 1.358193, 0.314534, 9.933498, 2.773626, 1.269679, 0.795365, 0.829797, 1.750375, 1.249334, 0.820554, 1.253076, 1.334186, 2.771106, 3.226296, 0.600584, 1.188485, 0.785517, 1.658037, 0.708559, 1.183631, 0.913754, 1.770872, 1.564562, 0.778818, 1.278092, 1.922969, 2.574404, 1.776603, 1.250174, 0.789291, 11.834174, 1.201449, 7.027452, 0.899798, 1.067915, 2.617678, 3.026251, 0.398912, 1.178754, 1.756653, 1.252349, 1.832642, 1.324324, 0.957163, 1.481049, 3.586748, 0.737636, 1.223149, 2.054693, 1.289818, 1.169143, 1.260672, 2.787736, 1.211394, 1.269950, 1.341809, 0.786638, 1.211600, 1.245856, 1.180609, 1.917892, 0.782158, 1.211363, 0.860660, 1.760494, 1.296976, 1.365568, 1.235856, 1.181514, 0.804834, 1.345656, 0.933279, 0.955893, 8.842087, 0.468157, 1.166381, 1.969652, 0.187943, 1.138975, 1.888889, 0.885942, 0.415619, 1.317402, 9.344753, 1.446029, 1.442955, 1.205524, 1.253358, 1.238837, 1.360482, 0.736293, 0.404851, 1.254888, 1.434528, 2.164226, 11.553206, 7.179641, 1.829416, 0.792846, 1.219605, 3.440893, 1.259116, 1.188581, 0.797053, 1.802917, 1.112421, 10.459244, 1.274366, 13.618234, 0.540417, 1.299339, 0.395118, 0.100043, 0.828539, 4.538245, 1.234537, 1.246484, 1.280758, 2.528914, 1.779764, 12.359870, 0.365322, 1.233574, 1.234918, 1.242316, 1.277817, 0.979447, 1.300757, 1.701348, 0.749760, 1.694395, 1.352725, 0.959583, 0.765089, 2.348442, 1.787001, 1.580316, 1.135959, 0.941412, 1.249723, 0.417084, 2.576700, 1.173319, 2.998930, 0.382209, 2.301751, 2.708016, 3.065287, 1.306429, 1.281272, 0.700776, 0.773637, 0.159571, 1.140725, 0.774182, 1.325782, 0.800215, 2.136770, 0.548108, 0.533070, 0.182391, 0.794808, 0.055235, 0.247851, 0.292983, 2.929140, 1.262023, 0.807799, 0.394478, 1.664302, 0.774473, 2.543601, 0.858931, 1.870357, 0.597751, 0.422508, 8.052608, 0.815485, 5.104749, 1.289088, 4.841229, 1.063788, 0.820513, 1.627430, 1.918703, 0.196886, 1.891825, 1.216151, 0.095662, 1.055133, 1.144134, 5.680416, 1.255197, 0.516008, 1.763982, 0.394034, 1.734247, 1.239000, 0.771310, 0.367627, 1.200219, 1.301692, 1.869445, 1.833817, 11.443791, 0.765890, 0.588368, 2.954820, 1.992078, 0.084652, 3.230609, 0.079625, 1.234440, 2.522939, 11.445135, 24.042229, 0.485308, 1.260462, 1.235678, 4.666789, 0.237527, 2.689392, 0.809858, 0.137433, 1.286257, 0.786268, 1.234631, 0.345822, 1.092615, 0.464591, 0.476257, 3.767433, 1.251452, 1.297527, 1.323359, 0.868197, 1.393461, 1.138276, 1.732475, 0.314173, 0.798525, 7.797059, 0.438529, 0.799573, 0.787857, 1.271889, 0.749142, 2.346601, 1.332626, 0.958534, 1.656061, 1.298318, 1.268588, 0.401219, 0.355716, 1.241846, 6.638939, 1.305163, 0.823592, 0.318000, 1.298778, 1.159582, 1.270337, 3.103803, 1.990854, 0.884622, 1.161017, 2.029627, 0.744785, 1.139945, 1.306842, 2.358484, 2.551797, 0.636728, 1.624656, 0.714471, 0.801112, 0.091015, 1.274503, 2.554217, 0.800215, 0.870803, 1.234611, 12.606527, 1.407261, 0.839102, 0.751554, 11.118833, 3.086798, 0.802091, 0.312500, 1.279366, 6.616771, 1.241534, 1.367120, 1.285763, 0.843237, 1.296892, 0.403832, 0.572504, 0.265180, 0.617820, 0.405386, 2.703989, 0.492577, 0.372167, 0.556885, 5.251649, 2.573075, 1.974460, 0.881489, 0.889993, 0.767758, 3.948542, 0.296586, 0.523623, 0.572365, 1.248674, 0.606253, 0.769019, 0.482158, 0.779295, 0.232646, 1.224065, 1.144080, 1.662418, 2.685965, 1.333831, 2.895877, 5.627762, 1.880388, 0.817522, 1.161471, 1.261092, 4.646046, 1.219643, 1.851729, 2.428728, 2.428125, 0.504377, 0.328879, 5.355305, 4.662585, 0.178235, 0.338710, 0.432687, 1.834200, 1.216060, 1.198270, 0.524869, 8.264556, 0.664998, 18.589261, 1.054380, 6.731132, 0.830831, 0.706055, 0.790948, 1.235263, 0.834318, 5.788323, 0.222033, 0.501577, 0.696668, 0.403581, 1.302524, 5.604709, 2.115852, 11.199863, 1.706811, 1.263357, 1.620515, 8.348697, 0.172698, 0.626576, 0.591471, 0.488605, 1.912416, 0.101621, 0.830944, 7.199358, 1.109189, 1.388724, 1.281115, 0.849095, 7.721129, 3.598062, 0.822950, 0.960902, 0.806476, 16.465201, 4.051496, 0.751900, 1.955231, 4.084680, 3.707274, 8.876229, 0.749822, 0.486197, 2.081502, 1.555803, 3.505831, 0.183779, 1.470070, 2.915055, 1.129996, 1.270185, 0.673255, 0.809787, 0.549705, 0.835005, 0.499305, 0.569061, 0.555695, 0.518758, 1.198598, 0.272022, 2.305508, 0.055405, 0.759704, 0.799087, 0.815233, 11.130894, 0.551291, 1.117021, 0.743368, 1.160577, 0.765685, 2.862182, 2.492631, 0.359677, 16.291858, 4.584046, 0.506911, 1.324890, 1.374306, 0.239384, 1.134498, 0.516782, 2.226473, 0.390098, 0.381833, 4.646048, 1.931394, 0.387241, 0.560010, 0.525088, 0.496719, 1.429976, 0.407926, 2.816284, 0.546528, 0.139018, 0.525387, 0.530990, 0.536351, 0.870348, 0.341554, 0.366587, 0.403398, 0.177190, 0.574374, 0.833273, 1.293539, 1.107794, 0.553255, 3.427361, 0.781644, 0.741160, 3.101075, 0.758168, 0.781507, 0.421260, 2.183713, 0.786667, 2.935948, 0.691018, 10.661848, 0.807439, 2.354526, 0.825691, 0.033620, 11.818213, 7.824904, 0.492818, 0.508596, 0.736405, 1.708669, 0.065292, 0.926889, 0.267866, 0.390787, 0.348310, 0.528376, 0.667979, 0.493833, 0.141056, 0.102250, 0.924832, 0.500685, 0.811610, 1.350037, 16.558497, 0.790413, 0.282231, 0.760854, 0.791915, 0.486023, 1.395782, 1.058908, 0.496686, 0.754202, 12.087757, 0.400396, 6.982753, 0.819609, 0.755624, 0.473871, 0.554718, 0.850624, 1.320197, 10.955287, 0.460676, 2.110803, 0.523942, 5.342766, 0.449978, 0.502107, 0.803963, 0.860708, 0.524520, 0.408461, 0.514649, 0.206547, 0.756314, 0.898923, 0.775123, 0.501161, 0.865540, 1.308612, 3.626681, 11.273247, 0.235589, 0.818084, 0.395716, 2.159555, 2.571953, 0.744120, 0.540936, 0.778053, 0.321063, 0.814053, 0.573034, 2.963293, 22.692028, 0.703055, 0.771942, 0.382601, 0.647800, 0.147781, 0.785256, 0.395051, 1.269761, 1.304878, 1.116584, 0.831530, 0.926464, 0.497776, 0.681854, 1.254806, 0.761560, 0.148520, 1.314123, 0.760042, 1.214217, 1.261905, 0.530646, 0.345920, 32.348613, 1.315900, 0.805776, 0.270524, 1.431248, 0.755826, 3.627868, 0.749303, 0.766187, 0.800279, 2.347826, 0.798692, 1.098659, 0.765603, 0.826071, 0.823654, 0.793623, 0.732735, 0.484074, 1.076993, 0.749150, 4.567479, 2.226872, 0.113954, 0.777700, 0.780802, 0.389768, 1.756330, 0.824802, 0.762628, 2.319986, 0.513597, 0.739849, 0.778127, 1.454050, 0.767483, 6.531545, 0.771613, 1.298803, 0.416234, 0.654171, 0.561601, 0.725911, 0.837259, 1.261071, 0.736377, 0.808937, 0.794177, 0.762509, 1.030910, 1.780177, 0.775694, 7.023552, 2.397331, 1.329558, 2.512821, 0.245067, 0.380717, 0.719022, 0.808205, 0.406927, 14.658554, 0.321036, 7.920667, 0.794836, 0.648855, 3.598392, 0.175597, 8.255599, 3.168841, 0.819359, 0.761771, 0.644475, 0.408220, 0.529010, 0.770327, 0.622405, 0.727486, 2.139523, 0.885076, 1.798161, 0.497881, 0.377415, 0.788133, 0.554246, 12.276830, 4.225349, 0.765576, 0.884967, 0.528324, 1.530716, 0.545301, 0.117826, 0.804124, 0.334429, 0.077506, 0.355281, 1.254358, 2.630755, 0.210315, 0.581201, 0.511793, 1.044266, 3.986012, 0.256238, 0.278391, 1.049323, 0.231965, 5.902892, 0.242368, 0.709967, 7.968919, 0.723139, 0.556338, 1.720775, 1.730809, 0.511547, 0.493565, 0.351826, 0.566723, 0.760563, 0.899513, 1.508384, 11.315143, 0.387108, 2.097452, 1.299020, 5.930751, 6.531870, 0.532110, 0.899593, 0.566341, 0.627745, 0.428018, 0.545714, 0.554543, 0.378206, 0.501843, 0.813159, 1.898511, 4.148767, 0.179728, 0.518936, 0.812785, 0.832850, 9.145405, 0.744348, 0.218793, 2.186721, 1.696291, 0.374382, 0.866096, 0.234082, 0.461670, 0.537156, 0.907151, 0.508028, 0.544048, 0.504541, 8.239832, 0.918226, 1.308377, 0.273734, 0.543430, 0.017307, 0.725994, 0.797460, 1.454735, 0.315633, 0.566158, 0.404551, 0.747911, 18.216229, 0.797403, 0.767166, 18.051327, 0.828212, 4.660470, 8.538188, 0.638141, 0.385357, 0.501326, 0.406848, 0.523002, 8.809744, 0.420769, 9.101337, 0.314387, 1.309566, 0.546466, 0.733371, 0.845471, 25.151932, 0.795518, 1.846154, 0.525910, 0.784784, 0.510345, 3.305248, 0.736323, 1.741554, 0.566749, 0.785324, 0.551090, 0.292192, 0.577103, 1.371105, 0.552509, 0.861995, 1.165991, 0.937968, 1.266734, 4.347642, 1.224958, 6.141809, 2.662861, 0.522440, 0.775436, 11.271329, 1.886996, 1.281261, 0.514333, 0.557418, 0.710041, 0.750954, 0.518996, 0.532477, 1.331484, 0.657814, 0.830395, 1.659805, 0.768451, 0.618235, 0.788566, 0.212930, 0.504897, 0.545913, 0.370687, 0.817513, 0.379774, 1.342032, 2.828872, 0.782793, 0.692385, 0.202665, 0.387660, 0.752817, 0.541778, 5.699031, 0.699334, 1.776671, 0.717499, 0.037516, 0.768696, 2.667190, 0.051050, 1.358029, 0.817820, 0.172976, 0.535056, 2.152751, 9.641563, 0.718994, 1.241873, 0.517879, 1.493821, 0.570114, 1.816210, 1.612677, 0.912010, 1.042885, 0.134896, 0.528595, 0.789763, 0.777108, 0.499111, 0.810585, 1.313521, 0.791157, 0.096684, 2.659897, 0.749126, 0.541381, 0.540908, 0.677247, 0.314127, 0.388326, 0.732613, 0.319887, 0.557377, 0.827437, 0.393200, 0.761027, 0.196582, 1.194532, 0.700340, 1.963017, 0.552155, 0.521240, 1.173162, 1.732359, 1.370659, 0.783766, 0.887280, 0.417375, 0.416682, 0.507145, 1.514154, 0.549759, 0.788027, 0.769178, 0.167433, 9.126545, 2.211289, 6.282280, 0.530519, 1.234250, 1.274558, 1.143908, 0.903771, 0.836959, 0.474956, 0.185600, 0.500676, 2.186881, 2.451386, 1.872109, 0.516709, 0.894756, 0.151067, 0.535538, 5.234931, 0.800000, 0.722315, 0.480081, 0.895599, 1.816033, 15.314346, 0.795324, 8.116616, 0.516277, 0.740728, 3.737255, 0.654565, 1.153917, 5.544854, 0.543554, 1.558359, 0.754599, 0.898790, 0.836505, 0.740881, 1.738910, 1.935136, 0.847136, 0.562119, 1.339349, 8.306607, 2.261905, 0.770755, 0.903355, 0.715757, 0.279119, 0.559773, 0.762183, 0.978739, 0.487668, 6.395145, 5.139599, 0.125728, 0.710694, 2.506565, 1.286966, 1.470213, 0.877431, 1.164127, 0.807609, 0.396189, 1.217347, 0.579738, 1.254829, 0.717602, 1.263069, 8.579892, 1.418813, 2.627542, 0.720686, 1.337793, 0.778037, 0.187316, 0.482877, 11.874740, 0.469413, 1.200491, 1.347257, 0.819023, 1.258115, 0.760281, 0.511340, 0.859501, 1.733140, 1.203965, 1.277362, 0.448817, 0.813607, 1.334045, 2.873555, 3.569989, 0.749210, 0.771637, 1.411012, 0.227383, 0.581838, 0.702041, 27.891729, 0.788251, 0.798065, 0.392703, 1.292780, 0.777317, 0.212954, 0.541262, 1.376333, 1.176491, 0.870582, 0.790622, 1.304073, 0.792045, 0.416101, 0.783841, 0.523192, 2.312167, 0.494131, 0.929773, 1.210100, 1.403722, 0.512365, 0.763725, 0.864953, 1.729853, 0.832298, 0.501793, 0.745789, 3.412420, 0.624547, 0.871661, 2.377773, 5.732273, 1.741379, 0.787963, 0.808588, 0.478204, 0.365993, 0.779720, 1.246295, 0.833935, 0.185877, 0.783197, 0.786561, 5.377516, 0.771080, 1.557096, 1.785586, 0.992881, 0.852620, 3.108907, 0.859557, 0.371414, 0.861347, 0.298144, 0.495229, 0.371201, 0.643910, 3.907923, 0.814585, 0.785431, 1.570326, 2.235770, 1.309792, 0.718761, 0.583882, 0.302514, 0.310519, 0.530186, 0.679675, 0.386859, 0.887488, 0.360344, 0.196927, 0.907588, 0.881551, 0.892166, 0.628270, 0.515755, 0.538462, 5.017590, 2.835934, 3.319894, 15.980579, 0.677770, 4.553389, 0.811960, 2.370866, 2.877908, 0.563596, 0.679252, 0.524722, 0.785536, 0.336727, 0.640782, 0.206738, 2.368368, 1.039357, 0.389650, 0.411111, 0.612701, 3.467733, 1.073466, 0.262957, 0.304505, 3.604074, 0.326036, 0.539690, 1.038023, 0.248624, 0.529657, 0.746464, 0.863303, 0.103742, 0.804364, 0.797713, 1.165895, 0.814516, 0.847834, 0.520036, 0.802134, 2.233085, 0.712976, 0.499407, 0.786541, 0.733006, 4.692396, 0.059933, 0.735354, 0.790747, 0.745467, 6.308620, 4.138163, 1.189244, 0.541737, 0.845077, 1.073646, 1.274836, 0.352582, 1.340809, 0.762943, 0.827647, 0.801198, 0.699434, 0.805784, 2.943921, 0.388859, 19.437784, 1.738386, 1.693315, 0.289005, 1.414215, 1.244046, 9.562049, 9.863573, 1.242148, 1.946281, 0.226394, 0.794624, 4.140758, 0.829096, 0.861457, 0.491814, 1.848080, 4.048577, 2.723236, 4.544391, 11.436125, 0.803526, 0.264877, 0.770782, 10.980371, 1.138498, 0.733241, 0.515960, 0.736139, 2.062522, 0.799929, 1.148606, 0.853895, 0.416981, 1.237916, 0.719918, 0.750529, 0.486528, 0.509768, 1.127973, 0.852548, 0.183928, 0.792904, 0.773047, 0.765642, 0.986687, 0.720628, 5.960943, 0.505648, 0.850779, 0.860286, 8.111826, 0.801828, 0.763149, 1.282899, 1.383674, 1.455083, 0.406189, 1.806954, 0.970091, 0.776994, 0.788329, 1.584370, 0.989913, 1.338023, 0.161881, 0.792356, 9.541738, 0.733081, 0.511853, 1.203690, 8.770563, 0.450573, 0.748721, 0.807343, 1.351894, 9.748865, 2.364591, 0.787330, 0.848679, 0.801372, 1.365845, 4.879327, 0.180149, 0.517257, 11.770521, 0.420375, 2.145594, 0.431234, 0.421725, 0.873891, 0.746241, 0.821703, 0.748488, 0.176144, 3.348700, 3.742937, 0.433256, 2.242759, 0.798217, 0.484361, 4.084244, 0.833029, 2.684415, 0.402923, 0.489669, 0.798894, 3.056065, 0.923227, 0.791477, 0.821869, 2.819552, 0.395149, 0.401531, 0.761610, 0.378227, 3.830694, 0.900986, 0.755175, 6.571300, 0.449545, 0.802068, 0.780056, 0.385991, 1.256089, 2.534244, 1.830155, 0.697897, 1.322288, 1.329791, 0.496826, 0.740960, 1.080143, 1.182542, 0.763248, 2.347436, 0.382445, 0.778912, 1.698378, 0.799788, 0.442159, 0.243744, 0.150793, 4.510355, 5.979816, 1.137673, 0.708971, 0.513101, 23.567263, 0.060210, 0.769442, 0.566396, 5.062307, 3.097348, 0.205773, 0.832457, 0.590347, 0.468145, 0.279236, 0.799422, 0.801513, 0.581325, 1.532445, 4.555921, 10.164815, 3.639069, 1.031002, 0.315826, 0.807773, 0.235836, 1.883350, 0.580504, 0.774737, 11.144908, 0.796027, 2.300243, 0.797849, 0.241628, 0.788297, 5.205854, 1.618521, 0.813023, 0.751922, 0.394967, 5.907244, 1.398443, 0.744749, 2.419531, 0.728023, 0.474694, 0.495100, 0.785690, 0.753905, 9.189878, 1.346652, 13.532511, 14.327305, 1.487747, 0.855248, 0.758304, 0.825911, 0.398880, 0.894933, 0.762338, 0.753729, 3.077822, 0.237772, 0.792115, 0.754429, 0.738172, 30.554187, 19.231920, 0.751141, 0.337496, 0.815575, 0.722669, 3.225980, 3.320471, 2.163335, 0.851059, 1.025744, 16.052923, 0.580428, 0.805082, 0.118686, 0.773380, 0.774228, 0.302931, 0.544197, 0.462227, 18.551635, 11.057214, 0.365440, 23.229108, 7.826424, 0.443272, 0.808000, 0.744300, 0.830149, 0.765668, 0.092634, 13.433057, 0.902083, 0.757345, 0.495229, 17.232284, 15.232863, 14.208264, 13.106772, 1.945588, 37.846402, 0.788061, 0.818830, 0.648819, 1.850908, 0.479103, 4.264823, 0.773968, 0.836124, 0.548010, 15.350039, 1.041632, 0.754776, 1.174207, 9.780819, 18.751610, 14.808419, 0.787113, 9.724852, 9.523746, 0.431311, 0.228303, 0.780621, 3.157763, 1.327186, 0.549422, 6.717696, 0.750533, 0.800559, 0.369820, 0.506893, 0.511761, 0.382563, 0.876014, 0.864365, 0.546565, 1.537190, 0.811191, 0.783638, 2.343771, 0.423563, 0.782629, 1.215275, 0.475185, 1.310443, 0.768572, 0.759116, 3.175676, 8.715295, 1.137215, 0.778211, 0.776978, 0.781273, 0.409730, 0.765785, 1.213373, 1.276807, 1.386371, 1.401706, 2.651536, 2.509342, 0.832976, 0.513225, 2.380476, 0.819017, 0.862321, 0.259948, 0.393586, 1.863185, 0.675232, 0.485620, 1.159091, 3.756106, 0.768056, 0.782564, 0.135288, 0.810104, 0.551515, 0.456415, 2.741138, 0.863371, 0.618136, 0.338393, 0.781328, 0.817151, 4.161074, 1.058231, 7.543821, 0.414770, 0.638914, 0.350622, 0.363621, 1.497431, 0.743405, 0.796568, 0.251432, 1.455128, 1.057005, 1.358688, 0.382684, 0.955324, 0.783212, 0.748097, 2.862195, 1.376044, 0.737970, 1.385011, 0.483800, 4.685603, 0.807264, 1.031022, 2.830742, 1.049321, 0.863459, 0.526290, 6.751046, 3.559290, 0.761019, 0.493735, 2.300283, 0.761626, 0.732149, 0.500674, 0.479175, 3.684565, 6.231794, 1.645298, 0.778697, 0.386926, 0.803534, 0.456182, 7.674823, 0.851201, 0.958925, 1.437183, 1.822004, 0.831155, 0.378582, 0.526056, 0.925532, 1.838509, 1.152051, 0.154253, 0.303080, 0.803193, 0.680340, 0.548434, 1.845015, 0.525608, 0.686611, 1.672577, 5.131400, 1.404838, 0.329796, 0.454286, 0.555240, 0.562257, 0.527378, 0.534785, 1.314619, 1.204513, 0.371432, 1.816279, 0.692251, 0.763264, 0.524113, 0.806157, 0.312901, 0.446328, 0.232758, 0.525388, 0.399105, 2.545257, 0.658389, 3.274267, 0.354248, 0.542360, 0.337592, 0.813620, 0.521888, 0.387021, 0.473743, 0.522346, 0.735074, 0.800951, 0.621475, 2.536037, 0.763559, 1.549679, 10.668536, 4.267192, 2.147899, 0.168908, 1.901813, 0.536847, 5.051773, 1.589150, 0.382861, 1.264002, 1.226209, 1.225591, 0.760420, 0.822515, 1.775089, 6.772408, 0.533666, 0.495470, 0.453121, 1.259391, 0.781717, 0.475735, 2.520728, 0.507907, 0.866828, 3.712772, 0.491366, 0.479754, 0.347365, 1.312906, 0.774059, 0.243365, 8.002274, 2.950953, 0.834208, 0.747418, 1.300355, 0.799718, 0.500462, 0.814038, 1.572301, 0.418126, 0.355436, 0.805132, 0.804323, 9.762158, 1.634865, 0.393258, 0.496142, 1.908128, 0.761587, 0.756700, 0.909355, 0.539810, 0.526516, 0.813784, 1.652345, 0.327064, 0.273633, 1.111797, 0.777003, 0.772854, 1.015979, 11.852593, 0.514696, 0.511927, 0.749558, 1.759804, 1.500857, 0.288212, 0.795479, 1.277382, 0.814735, 0.846958, 0.794296, 1.610665, 0.810976, 0.579256, 0.789586, 3.453572, 1.848819, 0.192478, 0.257968, 0.907214, 0.549837, 0.236947, 3.096011, 1.381831, 0.731020, 0.814114, 0.710437, 0.717878, 0.929473, 2.705241, 2.075180, 3.070711, 0.312829, 5.503817, 0.502025, 3.633003, 0.045927, 0.300590, 0.486241, 0.776701, 1.204262, 0.888681, 0.319532, 0.957959, 0.419671, 0.377284, 2.777552, 0.286012, 0.846897, 5.665557, 1.211567, 2.004356, 0.273478, 0.375627, 0.674695, 2.689458, 1.812284, 6.877007, 14.949198, 0.799350, 1.440702, 2.120731, 1.556668, 0.685643, 0.189372, 0.785287, 0.711652, 0.822917, 0.224324, 0.536636, 1.878661, 1.040058, 0.658622, 0.421283, 1.213069, 1.322788, 2.410649, 6.387570, 0.408763, 0.784732, 0.756269, 1.394756, 0.847981, 0.716250, 0.388528, 1.062066, 0.663020, 0.200366, 0.310201, 0.700512, 0.785637, 4.058810, 0.795567, 0.742176, 0.565477, 1.076271, 0.477394, 0.808160, 1.374734, 0.843333, 0.803986, 3.763927, 0.746135, 2.035727, 0.730776, 0.466358, 0.376916, 0.736353, 4.434909, 0.755892, 2.843547, 0.711266, 0.824245, 14.851967, 2.868394, 0.832436, 0.747942, 0.381989, 0.428551, 0.400680, 0.849594, 1.134259, 0.187573, 0.900542, 0.666488, 0.770870, 0.765570, 0.825190, 0.531354, 3.942847, 0.785907, 0.066991, 2.030369, 0.099113, 0.289364, 0.668827, 1.114286, 0.807805, 3.510966, 0.826033, 0.773606, 0.388542, 0.519358, 4.096074, 0.759559, 0.802521, 2.307948, 0.496382, 0.385694, 0.782171, 1.102033, 0.674814, 1.438644, 1.281867, 4.999762, 0.843983, 1.799448, 2.096903, 0.709748, 1.264867, 0.379739, 0.828602, 0.514427, 2.157370, 0.598827, 0.645964, 0.614989, 0.107684, 3.913174, 0.192647, 1.142112, 4.838195, 0.774948, 0.731415, 1.734024, 2.429162, 1.103315, 0.318321, 0.383040, 0.808882, 0.816721, 0.403205, 1.659715, 1.226670, 0.497950, 1.206840, 0.796688, 0.829818, 3.704882, 0.711289, 9.763899, 3.335445, 0.903565, 1.246170, 0.861660, 7.525207, 1.975904, 0.533381, 0.517837, 2.454736, 0.778556, 0.850309, 0.739609, 1.155159, 0.459494, 0.908586, 0.537903, 0.308348, 1.540259, 0.905665, 6.007176, 0.384308, 5.847865, 0.723960, 0.834005, 2.105728, 0.793228, 0.211610, 0.515025, 1.298429, 1.308108, 3.355049, 1.689507, 0.312908, 0.935014, 0.668719, 0.517745, 0.801408, 9.715849, 0.532833, 0.828342, 0.837899, 4.296770, 0.765071, 0.760197, 0.559066, 8.570537, 7.113304, 0.830951, 4.829323, 1.766830, 0.954381, 0.724281, 0.511236, 0.591090, 0.522699, 0.861622, 0.392157, 2.398611, 2.890138, 0.308536, 0.123078, 2.345137, 1.496835, 0.683777, 0.760151, 0.845858, 4.934234, 0.382684, 0.861060, 0.811221, 1.911793, 0.386671, 2.031176, 0.441896, 0.527831, 0.776619, 0.778147, 0.976048, 0.935590, 0.372546, 0.844533, 0.079312, 0.810638, 0.237322, 0.820717, 0.402878, 9.321051, 1.352036, 0.889292, 5.695355, 0.529660, 0.822207, 0.536142, 0.372694, 0.419266, 1.265650, 0.776025, 0.514807, 0.477455, 0.763918, 0.522741, 0.767491, 1.457690, 0.343127, 0.852823, 4.004240, 0.517542, 1.854597, 0.338798, 12.417350, 4.088706, 0.537766, 0.768366, 0.808088, 0.779874, 2.669211, 0.270656, 0.660110, 0.292218, 0.492283, 0.616048, 0.374314, 0.812762, 1.670222, 1.742350, 3.934222, 2.342533, 0.317622, 1.398275, 0.528257, 0.401986, 0.275601, 0.535557, 6.910611, 0.559764, 0.572872, 1.401283, 0.552685, 0.547053, 4.940933, 0.128494, 0.495298, 1.385234, 1.246021, 1.378715, 0.042166, 0.382210, 0.794923, 0.794128, 1.290074, 0.132977, 0.270058, 0.221126, 0.902938, 0.060364, 1.682590, 0.798076, 0.542914, 0.512430, 0.525568, 0.223924, 0.696376, 0.871280, 0.611729, 3.000000, 0.303054, 0.522304, 1.832047, 0.504841, 0.630520, 0.382389, 0.497900, 1.244407, 2.514995, 0.539202, 2.737622, 0.372365, 0.403135, 0.481613, 0.492067, 0.464096, 0.374389, 0.538698, 1.808037, 0.624369, 0.971353, 0.573163, 4.138788, 0.542019, 0.317984, 0.376675, 1.093595, 0.497716, 0.891855, 5.275786, 1.345719, 0.385830, 0.848655, 0.956836, 0.415851, 2.827697, 0.520849, 0.511085, 0.375523, 1.957866, 0.386863, 0.761281, 0.335002, 1.619563, 0.508874, 0.387552, 0.763649, 0.515865, 0.373307, 0.607670, 0.231907, 0.770609, 0.817822, 1.812985, 3.409746, 0.591350, 1.416254, 5.131279, 0.897361, 0.056585, 0.792793, 0.802301, 0.066628, 0.357428, 0.748615, 0.318877, 0.742672, 0.834966, 0.361336, 0.536592, 0.107268, 0.543056, 1.888565, 9.450623, 1.188662, 5.203519, 0.511938, 0.568824, 0.943439, 0.408389, 0.515295, 0.324835, 0.953889, 0.346166, 0.118455, 0.433911, 0.733820, 0.314409, 0.233337, 0.791652, 32.521581, 0.407916, 0.515472, 0.778993, 0.372802, 1.841863, 0.665104, 1.884110, 0.558700, 0.265539, 3.143162, 0.807069, 0.442917, 8.485430, 1.205601, 1.715630, 3.418721, 0.332656, 0.508668, 0.765112, 0.228415, 0.493571, 0.463901, 1.479581, 0.448413, 7.961345, 0.371694, 0.923558, 0.292003, 1.736919, 4.445969, 0.924896, 0.437487, 0.920473, 0.472487, 1.799296, 0.525623, 0.844637, 0.433621, 1.151146, 0.385933, 0.385460, 0.887839, 0.889248, 0.557511, 0.600068, 0.359859, 0.493849, 1.091455, 0.505474, 0.385473, 3.227284, 0.511461, 0.374738, 0.394308, 0.632204, 0.984552, 0.694139, 0.818838, 0.611031, 0.539166, 0.746609, 0.512462, 0.815808, 0.721861, 0.214343, 0.493629, 1.765855, 3.713036, 0.906560, 0.571112, 0.746840, 0.338584, 1.520097, 3.800840, 0.900745, 0.284697, 2.693571, 0.524759, 1.313502, 0.825962, 0.492557, 0.940975, 1.531286, 0.521221, 0.463303, 0.810153, 4.512274, 0.707857, 0.805853, 0.543842, 1.212919, 2.080376, 0.783465, 0.768913, 0.485002, 0.267640, 0.341704, 0.809385, 0.693474, 0.793028, 0.790049, 0.648278, 0.490859, 0.476024, 1.271000, 1.331695, 0.240015, 0.776404, 0.546787, 0.904992, 0.706455, 5.466273, 3.851622, 2.110419, 0.827390, 12.079833, 0.768830, 1.133652, 0.273929, 3.471674, 4.494923, 1.331499, 0.489773, 0.766129, 0.852024, 0.802681, 0.482198, 1.473169, 0.846476, 0.541540, 3.301541, 0.464892, 0.816733, 0.775632, 0.405212, 0.516510, 0.229811, 1.265243, 2.385940, 0.854385, 0.307864, 3.637610, 0.425014, 1.243754, 0.847210, 0.887187, 1.289212, 0.835044, 3.056943, 1.849643, 0.757942, 0.780282, 0.385859, 0.907634, 0.320995, 0.524065, 0.777195, 2.750351, 0.490147, 0.816294, 0.778579, 0.764727, 0.808668, 9.842356, 0.826007, 1.273237, 0.761955, 0.698328, 0.552163, 0.812319, 0.747866, 1.726257, 1.242662, 0.342689, 0.413305, 0.081212, 1.878398, 1.374908, 1.293568, 0.767153, 0.464721, 0.304750, 0.572292, 1.049104, 0.863702, 0.794034, 1.315357, 1.017532, 1.162610, 0.418539, 1.085091, 0.858060, 1.388241, 0.221705, 0.575121, 0.528315, 1.146728, 1.294590, 0.799028, 1.311577, 1.971027, 3.898536, 0.373275, 0.543614, 0.825099, 0.960601, 1.242170, 1.235791, 0.322292, 0.460236, 2.059397, 0.768902, 0.526266, 0.556163, 0.495539, 0.966102, 0.542831, 0.256334, 14.505850, 0.743776, 0.770440, 0.311766, 0.369640, 0.424227, 0.247953, 0.559014, 0.815145, 0.890580, 0.832092, 0.677120, 0.482428, 2.283814, 0.220289, 0.736041, 1.809886, 0.810703, 0.770642, 0.408210, 1.320481, 0.389826, 2.697848, 0.219795, 0.526937, 0.872404, 1.368232, 1.307473, 0.509130, 0.773650, 0.738464, 1.705856, 0.477567, 0.733333, 0.761538, 0.479592, 0.514239, 0.369509, 1.316143, 0.856099, 0.773285, 0.808070, 0.838616, 1.819145, 13.431349, 0.432138, 0.400723, 1.269007, 0.690195, 1.716538, 1.538370, 0.173840, 0.745505, 0.746527, 1.566374, 2.273538, 0.407193, 0.947075, 0.526855, 1.284586, 0.406064, 0.527442, 0.511431, 0.551452, 0.499887, 0.431033, 1.485661, 0.332806, 0.525689, 0.535098, 0.516535, 0.526139, 0.546161, 0.502875, 1.216216, 1.295563, 0.284526, 0.324757, 0.389524, 0.669188, 0.636409, 0.253279, 0.217234, 1.491859, 1.389665, 0.874108, 0.935916, 0.697976, 1.597311, 2.455215, 0.095063, 1.713121, 0.243061, 0.460114, 0.884799, 1.585866, 1.205890, 0.799645, 0.224535, 0.773590, 0.860005, 0.590041, 0.514645, 1.199488, 0.898864, 1.127262, 0.196373, 0.517421, 0.392275, 0.401886, 0.502899, 1.323613, 0.493615, 0.198771, 0.194886, 1.271777, 0.351500, 0.654112, 0.518413, 0.773530, 0.111316, 0.762784, 0.805386, 0.489343, 1.383002, 1.409500, 0.784642, 0.288929, 0.553101, 0.542976, 0.518432, 0.688052, 0.312013, 0.335515, 0.940500, 0.356089, 0.540797, 0.558145, 0.669930, 0.724857, 0.784681, 0.292648, 1.329554, 0.329114, 0.566315, 0.407941, 0.901317, 5.018827, 1.250694, 0.782310, 1.144348, 0.887276, 0.289779, 0.790419, 0.885993, 0.728471, 0.805808, 0.461566, 0.535275, 0.059483, 0.209341, 1.989842, 1.148778, 0.416245, 0.934198, 0.414828, 1.625123, 4.037539, 0.381114, 1.809558, 0.750896, 0.870636, 0.499398, 0.426153, 0.866422, 7.255835, 0.424918, 0.836697, 0.240841, 0.310348, 0.587068, 1.414418, 1.206760, 0.585240, 0.570828, 0.630919, 0.897820, 1.412394, 7.874599, 0.202873, 1.859180, 0.791050, 1.908364, 1.903453, 0.489552, 0.546062, 1.833623, 0.721129, 0.517340, 0.391688, 0.492875, 0.758136, 0.508177, 0.470431, 1.287340, 1.377970, 0.907507, 0.351377, 0.526654, 0.749650, 0.794817, 0.751511, 0.403813, 0.355795, 1.776344, 3.883859, 0.799088, 0.738729, 0.791252, 1.350486, 0.664068, 0.185376, 0.868193, 0.803597, 0.767211, 0.795317, 0.165191, 1.847911, 2.138607, 0.867854, 2.215323, 3.698299, 0.574534, 0.520483, 12.621019, 1.283989, 0.510935, 0.518061, 0.710180, 0.722483, 1.286923, 1.251018, 1.164889, 0.836403, 0.979631, 10.215166, 0.845980, 0.793223, 0.798838, 0.293882, 0.235640, 0.054729, 0.502692, 0.907042, 0.844660, 1.566970, 0.758774, 0.504633, 0.726949, 0.780056, 0.726948, 1.342693, 1.211232, 0.249836, 0.534810, 0.805760, 1.065408, 1.313061, 1.595673, 0.223801, 2.129021, 1.166438, 0.807746, 0.799566, 0.804142, 6.611624, 0.808580, 1.349498, 0.793322, 0.364380, 0.816685, 0.509425, 0.431114, 0.511162, 2.899568, 2.769177, 1.298952, 0.307273, 2.260120, 1.322753, 1.291377, 1.058242, 1.462605, 7.429985, 0.827523, 0.050956, 1.355532, 2.547801, 0.197062, 1.273862, 0.814382, 0.738196, 1.389327, 0.849175, 1.324230, 2.841009, 0.503941, 0.540956, 0.785613, 0.513845, 0.469268, 0.509502, 0.517610, 1.320381, 0.836042, 0.801140, 0.770870, 1.324020, 0.376344, 0.787633, 0.224547, 0.892762, 5.039643, 0.807665, 0.788172, 0.802949, 1.588461, 0.796123, 1.252893, 0.772507, 0.390687, 0.779810, 0.551682, 0.519244, 0.775009, 0.919629, 0.165063, 0.292038, 0.677764, 0.552228, 0.500464, 0.581743, 0.362974, 0.517792, 0.531268, 0.541447, 0.301824, 0.160540, 0.327601, 0.300743, 0.318262, 0.511905, 0.276357, 0.171394, 7.423793, 0.486113, 0.355431, 0.816043, 0.880240, 0.549579, 0.515750, 0.368518, 0.955532, 0.830832, 1.309995, 1.189623, 0.760446, 0.506024, 0.750950, 0.684359, 9.693449, 1.779021, 0.550310, 0.507071, 1.886390, 1.558063, 1.244001, 0.370873, 0.411765, 0.736194, 0.805938, 0.884119, 0.850151, 1.218130, 0.639229, 0.535359, 0.411892, 0.982016, 1.914488, 0.858228, 0.380456, 0.581566, 0.525348, 0.284323, 0.569932, 0.830885, 0.611260, 1.236144, 0.516121, 0.792979, 1.191009, 0.541676, 0.848061, 0.226805, 0.309286, 1.177503, 0.508157, 0.867285, 6.739756, 0.532728, 22.908426, 0.939162, 1.131999, 0.190972, 0.525050, 6.235937, 1.289585, 0.528337, 0.165920, 0.517615, 0.268519, 0.901445, 0.468716, 0.527501, 1.318646, 0.640753, 1.131015, 1.434339, 0.740146, 5.245607, 11.117950, 0.345713, 0.312635, 0.188979, 4.207921, 2.479804, 0.742045, 0.489564, 1.426382, 3.611395, 0.498103, 1.852466, 0.136355, 0.830885, 0.543924, 0.556010, 1.262107, 0.223764, 0.535742, 0.184264, 0.263867, 0.877465, 2.242693, 0.884319, 12.950235, 0.343918, 6.686969, 0.407310, 0.884320, 1.491504, 0.985272, 0.556375, 0.812500, 0.578285, 0.257739, 0.753521, 0.567187, 0.254672, 1.271960, 0.307896, 0.281469, 1.705600, 0.839971, 0.520038, 0.640460, 1.184107, 0.299323, 1.300655, 4.744910, 0.758483, 0.302872, 0.642562, 0.511498, 0.389391, 0.512382, 0.728795, 0.546114, 0.513330, 0.346753, 0.554439, 0.567964, 1.330108, 0.715530, 1.122357, 0.226376, 1.567084, 0.539190, 0.374339, 0.533222, 0.356754, 0.322576, 0.798372, 1.867658, 1.694058, 0.528699, 0.778259, 1.298214, 0.635889, 0.507373, 0.848405, 0.850881, 0.733554, 0.567286, 0.497953, 0.748714, 1.213968, 1.330314, 2.795127, 0.495183, 0.386999, 0.418070, 0.546276, 0.818742, 1.578960, 5.513003, 0.397907, 1.055903, 1.159894, 0.390494, 5.816342, 0.727199, 2.866900, 0.534082, 0.506551, 0.705261, 0.206380, 0.476245, 0.496065, 0.449674, 0.941234, 4.755154, 18.827623, 0.541646, 1.119473, 0.189303, 2.046718, 1.190120, 0.676008, 0.801398, 0.781274, 1.006694, 0.294053, 0.236151, 12.617635, 0.698509, 0.509664, 0.034743, 1.165459, 1.319646, 0.496628, 0.582115, 0.815962, 1.614198, 0.425644, 1.638456, 0.705942, 0.512968, 0.527698, 0.579753, 0.842178, 10.459570, 1.573477, 1.144192, 0.808046, 2.413947, 1.196484, 0.218027, 0.736239, 0.377035, 11.327473, 0.911532, 1.048357, 0.811673, 0.563408, 0.386005, 0.341682, 0.160672, 0.619647, 0.674668, 0.762849, 0.317820, 0.824444, 3.501285, 0.858950, 1.284949, 13.724351, 0.528257, 4.281526, 1.400195, 1.178149, 0.238609, 1.814418, 0.289172, 2.681361, 5.939863, 0.502375, 0.531061, 0.336211, 1.147485, 1.010537, 2.266844, 0.145461, 0.725881, 1.357087, 0.748387, 0.839564, 1.400479, 4.337934, 0.469641, 0.804012, 0.385621, 0.538126, 0.544811, 0.506437, 0.391153, 0.598998, 1.758429, 1.784099, 1.075712, 0.415521, 0.271810, 0.509074, 0.755182, 17.799791, 0.774359, 0.376965, 0.789078, 2.622689, 4.515650, 0.465441, 0.639648, 0.348678, 0.835520, 0.097500, 0.639222, 6.569234, 0.787654, 0.832331, 0.183950, 0.256166, 1.353854, 2.500975, 1.294394, 1.027553, 6.005368, 0.812859, 0.584740, 0.456630, 1.071951, 11.887109, 0.783444, 0.522983, 8.552475, 0.360595, 0.486226, 1.333333, 1.210904, 0.909854, 1.545388, 0.179245, 0.718631, 0.851716, 0.713965, 0.509643, 1.972016, 0.333542, 0.692151, 3.361818, 1.698304, 0.851766, 0.808119, 1.690848, 0.848358, 0.512443, 0.500115, 0.258482, 0.930387, 0.274236, 1.662648, 0.736341, 0.762408, 0.549084, 0.898132, 0.849356, 2.298679, 1.246464, 0.406339, 0.537729, 0.528188, 0.702762, 0.352641, 0.409057, 0.786936, 1.157611, 0.244270, 0.440416, 1.317958, 10.535085, 0.686236, 0.461182, 0.239142, 0.501803, 1.113418, 0.237690, 0.420809, 0.777511, 0.262287, 0.547872, 0.779642, 0.088616, 0.393604, 1.223886, 10.059176, 1.250173, 1.438273, 0.649646, 2.127378, 0.171717, 0.784489, 0.702396, 0.658053, 0.862684, 0.385971, 0.518713, 9.489763, 1.358177, 0.234700, 0.399513, 0.653785, 1.282669, 0.222839, 0.529092, 0.538256, 1.809807, 3.541645, 0.359136, 0.896831, 0.246872, 0.153473, 0.871031, 2.200989, 0.550284, 0.512201, 0.535874, 4.188588, 0.268127, 0.059451, 10.317091, 0.537647, 1.102343, 0.579130, 1.053695, 0.285679, 11.628709, 1.599852, 0.573933, 0.250055, 0.792666, 0.559784, 1.143310, 0.485727, 0.393292, 1.161173, 0.209657, 0.189469, 3.266259, 0.557905, 2.576571, 0.368827, 0.666835, 3.940824, 0.913497, 0.848442, 0.355069, 0.715893, 14.736756, 0.877402, 0.521304, 0.246228, 0.476051, 1.050689, 2.928231, 1.387573, 0.573235, 0.257383, 0.378406, 0.565637, 0.391266, 0.532269, 1.554043, 1.693595, 9.184781, 0.814706, 0.679596, 1.240149, 0.158243, 0.407248, 0.378225, 0.799220, 0.305936, 0.423247, 1.189673, 0.288411, 0.182426, 0.815605, 0.586358, 0.890948, 0.726518, 6.841745, 2.802807, 1.877446, 2.617783, 0.855368, 26.222938, 0.529523, 0.421517, 0.822868, 1.450999, 0.680238, 1.389106, 4.333103, 4.684046, 2.709710, 0.237455, 6.138293, 0.534416, 0.547289, 1.506268, 0.553607, 5.713920, 0.506880, 0.474708, 0.851693, 0.919465, 2.252726, 0.741800, 0.265339, 1.249416, 5.737093, 0.509287, 5.360445, 0.628866, 3.047668, 0.155336, 0.382817, 0.288226, 0.537237, 0.395047, 0.382649, 0.776980, 1.683268, 1.714050, 2.402035, 1.018444, 0.071544, 4.760209, 0.644340, 0.536063, 0.531163, 1.825786, 16.735039, 0.806740, 0.748182, 0.837987, 0.780479, 0.303043, 0.389420, 1.767391, 0.696405, 6.455466, 1.924797, 1.115696, 0.498121, 0.517754, 0.815030, 1.258485, 0.369042, 0.317084, 0.375084, 0.593918, 0.884359, 0.291586, 1.272932, 2.227576, 0.532550, 0.761436, 0.067875, 0.247420, 16.762910, 0.716015, 0.522197, 0.623612, 0.335675, 0.667860, 0.509984, 30.371415, 5.288210, 0.746563, 1.461329, 0.857045, 1.132550, 0.886067, 0.387730, 0.522276, 1.788175, 0.880266, 1.156587, 0.788496, 0.904494, 0.687388, 1.290171, 0.777700, 2.112227, 0.788742, 4.146674, 0.756976, 2.445172, 0.374066, 0.864723, 0.803123, 0.772260, 0.542607, 0.687292, 1.083480, 0.497154, 0.883135, 1.221239, 0.510877, 0.762523, 0.218512, 0.315527, 0.495955, 1.403502, 0.765928, 0.254654, 0.279121, 0.635247, 0.849875, 0.814414, 0.841873, 0.484999, 0.544836, 0.524265, 0.565207, 2.674686, 2.172043, 0.200688, 0.540665, 0.807388, 0.913806, 0.822293, 0.784962, 0.618028, 1.837990, 0.555973, 0.788747, 0.516465, 0.731150, 0.769361, 0.311543, 0.394991, 0.753104, 0.508421, 0.488420, 0.945283, 1.245771, 2.179058, 0.516975, 0.800139, 0.150330, 0.231854, 0.592515, 0.887805, 0.511355, 0.755381, 0.266699, 0.531425, 1.407727, 0.521770, 0.244262, 0.386657, 0.537331, 1.197394, 0.706336, 0.541060, 0.784722, 0.226137, 0.397742, 0.355254, 0.539408, 0.540711, 0.524000, 0.378670, 2.224513, 1.702027, 0.223364, 0.521749, 0.731056, 1.591038, 0.279426, 0.527824, 0.864084, 3.087372, 0.875235, 1.449038, 0.825139, 1.537844, 0.529883, 0.319264, 1.187600, 0.419063, 0.256045, 0.790543, 6.173817, 0.778375, 0.816882, 0.292758, 0.536275, 0.519960, 0.730247, 1.986497, 1.583483, 3.387334, 0.402359, 0.194249, 0.932940, 0.475713, 0.259725, 0.752219, 0.914250, 0.818442, 0.306111, 0.436332, 0.542397, 2.720471, 0.559837, 0.367541, 0.749328, 0.805927, 0.792288, 0.167931, 0.578408, 0.860092, 0.242143, 0.727706, 0.518933, 1.346313, 4.015519, 0.549536, 0.748883, 0.485630, 0.534453, 0.564999, 2.783246, 1.315664, 0.765441, 0.744658, 2.773097, 0.849707, 10.834066, 0.249804, 0.392940, 0.189979, 0.855873, 0.486122, 0.489919, 0.515708, 1.385946, 0.704009, 0.271350, 0.470883, 2.521988, 5.292927, 1.537260, 0.904193, 0.246568, 0.655398, 0.920653, 0.598288, 0.563547, 0.385999, 0.364816, 0.608110, 0.776909, 0.806089, 0.513829, 0.906900, 0.821843, 0.242493, 0.833215, 0.510455, 1.313366, 0.484162, 0.829241, 0.378743, 1.053329, 0.407134, 0.980661, 0.519235, 0.575135, 0.387146, 0.912962, 0.622110, 2.426911, 0.783784, 0.302571, 0.531817, 0.522331, 1.354745, 0.275650, 0.315418, 0.803508, 2.297335, 0.405317, 0.227877, 0.490196, 1.214445, 1.715686, 0.423312, 0.399051, 0.828822, 0.900954, 0.792286, 0.938705, 0.251072, 0.023251, 2.461485, 0.740232, 0.395572, 0.521324, 0.586004, 0.799788, 0.559405, 1.350226, 0.368624, 0.321117, 0.783282, 2.806757, 1.800585, 0.860386, 0.397186, 0.952036, 0.371542, 0.437862, 0.796336, 0.913701, 0.437327, 0.289969, 0.503989, 0.572395, 1.513482, 0.877014, 0.536491, 1.300489, 1.010648, 0.742435, 0.244020, 0.507961, 1.306969, 1.335484, 0.278247, 0.377080, 0.555179, 1.541496, 1.282539, 0.772156, 1.333452, 1.045434, 0.778958, 0.499675, 1.760696, 0.834341, 1.712046, 1.312082, 0.496958, 0.501028, 0.489151, 0.805677, 0.186386, 0.564806, 0.783859, 0.756500, 0.261680, 1.236812, 0.811798, 0.312483, 1.317602, 0.827292, 0.811179, 2.148545, 0.773494, 0.503165, 0.729153, 0.308494, 1.225034, 1.732229, 0.528120, 1.405104, 0.813319, 0.692786, 0.453248, 0.663729, 0.519539, 0.991014, 1.901634, 1.786988, 0.965677, 0.830786, 1.251977, 0.789418, 0.496854, 0.815742, 0.809882, 0.763158, 0.425321, 1.264706, 0.453910, 0.482751, 1.284932, 0.525621, 0.143171, 0.772760, 4.249426, 0.485979, 0.770607, 0.807310, 1.696586, 0.544170, 0.637733, 0.382826, 1.655943, 0.832155, 0.490745, 0.802372, 0.855187, 0.778458, 0.370359, 3.370772, 3.060794, 0.894472, 0.504204, 0.523774, 0.981217, 0.302292, 0.763989, 0.699154, 2.167473, 0.860120, 0.973945, 0.525415, 0.302464, 0.777934, 0.267956, 3.394962, 1.303243, 0.568786, 0.227777, 0.865959, 0.873053, 0.689833, 0.288007, 0.900478, 4.458961, 0.520665, 0.498985, 0.644122, 0.501399, 1.098454, 0.388929, 3.785100, 0.781457, 0.505951, 0.368430, 0.859168, 0.380458, 0.352438, 0.813156, 0.661575, 0.410359, 0.654481, 0.513183, 0.521468, 1.295575, 0.290105, 0.535208, 0.579271, 0.691847, 0.478573, 0.620309, 0.588710, 1.276836, 1.324237, 0.880659, 0.388351, 3.785555, 2.103887, 0.538389, 0.383082, 0.418550, 0.471262, 0.744162, 0.363855, 1.362960, 0.880777, 0.465300, 0.902643, 0.529909, 0.918362, 0.352657, 0.555975, 0.520009, 0.881725, 0.354902, 0.537807, 0.793283, 0.795303, 0.416761, 0.542260, 1.729389, 0.372477, 0.533909, 0.530944, 0.511268, 0.440119, 0.889650, 0.258711, 0.711392, 1.175135, 0.322113, 0.514579, 0.813266, 0.520490, 0.419208, 0.523910, 0.601112, 0.820801, 2.250768, 0.812319, 0.532905, 0.745492, 2.570290, 0.512379, 0.357405, 1.136944, 0.535410, 0.537028, 0.543826, 0.546942, 0.534426, 0.680408, 0.545108, 0.530205, 0.466714, 0.617324, 0.757060, 0.260526, 1.357218, 1.093445, 0.762919, 0.818382, 0.457746, 0.733728, 0.748492, 1.128476, 1.213391, 2.588355, 0.518875, 0.526948, 0.400634, 1.376425, 0.486049, 0.942778, 0.381029, 0.810880, 0.822025, 5.336674, 0.599213, 0.818376, 0.444423, 0.770944, 0.231170, 0.416715, 0.678142, 0.512307, 0.234908, 0.723909, 0.502658, 2.011379, 0.749910, 0.730120, 0.392585, 0.952684, 30.438310, 0.808339, 0.825573, 0.480490, 1.724101, 5.232978, 0.944099, 0.753018, 0.232686, 0.381442, 1.378933, 0.710868, 0.745873, 0.792815, 0.782710, 9.305073, 0.477602, 0.539433, 0.346262, 0.560364, 0.748947, 1.655064, 0.560094, 0.376983, 0.238973, 0.593838, 0.737159, 0.938661, 0.792606, 0.740215, 0.703792, 1.095955, 0.522843, 0.382581, 2.328407, 0.763713, 0.820731, 0.514045, 0.546783, 7.099782, 0.721374, 0.926391, 0.416003, 0.505143, 0.749258, 1.020965, 0.463213, 0.590810, 0.744583, 0.771577, 0.425756, 0.917741, 0.270947, 0.491935, 0.769257, 0.749827, 0.484620, 1.135709, 0.730206, 1.918909, 0.522110, 0.508030, 0.771793, 1.315325, 0.781887, 0.194317, 0.781963, 2.062176, 0.774775, 0.511589, 0.474094, 0.717845, 0.789818, 0.534113, 0.516011, 0.800913, 0.400636, 0.496909, 5.434379, 1.807387, 0.487744, 0.504604, 0.840308, 0.763752, 0.504334, 0.506496, 0.479819, 0.461656, 0.380637, 0.280382, 1.984534, 0.793610, 0.284819, 0.804947, 0.826860, 0.812936, 2.326346, 0.804618, 0.741901, 0.401374, 0.326779, 0.838500, 0.532616, 0.224380, 0.581160, 0.316687, 0.319560, 0.096333, 0.799639, 0.521886, 0.743521, 0.326152, 0.553501, 0.787977, 0.641140, 0.774846, 2.275944, 0.519796, 0.908016, 0.533563, 0.496169, 0.272543, 1.180957, 0.799783, 2.679004, 0.703507, 0.506120, 1.010807, 1.660330, 0.499412, 0.132105, 0.507323, 1.321722, 0.778045, 0.773904, 0.858119, 0.975920, 0.519486, 0.364802, 1.332969, 1.333098, 0.528517, 0.782217, 0.817143, 0.752371, 0.573308, 0.883802, 0.697690, 1.820623, 1.264259, 0.482805, 0.319416, 2.082902, 0.701336, 0.272930, 0.874113, 0.477253, 0.776837, 9.632902, 0.779708, 7.197086, 0.795510, 0.789744, 0.454527, 0.539840, 0.441893, 1.795732, 1.464396, 1.280180, 2.823167, 1.434875, 0.546303, 1.461909, 0.856743, 2.867310, 0.680502, 0.785739, 6.801855, 1.498014, 0.785198, 0.791082, 0.531619, 0.590090, 0.506283, 0.731977, 1.364753, 0.493497, 1.969865, 6.176889, 0.533688, 0.777741, 12.125117, 0.525424, 0.312473, 2.200489, 1.633030, 1.511813, 0.503475, 0.401024, 0.345034, 1.334501, 13.243757, 0.824791, 0.531899, 0.532271, 0.487497, 0.815690, 0.744681, 0.840500, 0.536624, 0.825636, 0.551472, 0.782845, 0.774433, 0.778458, 0.511207, 1.366309, 0.758242, 0.503366, 0.393449, 0.631225, 0.529166, 1.299965, 0.463853, 1.723176, 1.225390, 0.526575, 0.298375, 0.761087, 0.801294, 0.511921, 0.420626, 0.819605, 2.098278, 1.046854, 0.372970, 2.152374, 0.460140, 0.800000, 0.803571, 0.693433, 0.933250, 0.423102, 0.768004, 0.523106, 0.303973, 0.444010, 0.801047, 0.814332, 0.380625, 1.301235, 1.277117, 0.886748, 0.664028, 0.815294, 3.169118, 2.016260, 0.781939, 0.266349, 0.781172, 1.090025, 0.851094, 1.603267, 0.775123, 1.846734, 2.260963, 0.455590, 13.868587, 0.761808, 0.437704, 0.822152, 1.003247, 0.793482, 1.105671, 0.459278, 0.378507, 1.742236, 0.791622, 0.732371, 0.789111, 0.175777, 1.730353, 7.082265, 0.742116, 0.755349, 0.410627, 1.032163, 0.774106, 0.717703, 0.808330, 0.521403, 0.758693, 5.575236, 0.480064, 0.794936, 0.462071, 0.751404, 0.772449, 0.371519, 1.341710, 0.786096, 0.563391, 0.322988, 0.925799, 2.777658, 0.776352, 1.342365, 0.794627, 1.087332, 0.591224, 2.357746, 0.086064, 4.559695, 0.708390, 0.408256, 0.662591, 0.772414, 0.780600, 0.705586, 0.381419, 8.296688, 0.549345, 0.755138, 0.747150, 0.361722, 1.758707, 1.853743, 0.962514, 2.961556, 0.793656, 0.909488, 0.836018, 3.276885, 6.315078, 0.805818, 0.529898, 2.208717, 0.797610, 1.305176, 0.866841, 2.377768, 1.780789, 0.803068, 0.770833, 0.354261, 1.511273, 0.442938, 0.523424, 0.710595, 0.517899, 1.055757, 2.625896, 1.256215, 2.252817, 0.650978, 0.452155, 1.293315, 0.798623, 0.889787, 3.021662, 0.831264, 0.566556, 0.857043, 0.889087, 0.771228, 0.428702, 0.781250, 0.566933, 1.003961, 3.293164, 0.482796, 1.544970, 0.558794, 0.809425, 1.286469, 0.757745, 0.777505, 1.721700, 0.798221, 0.523937, 9.678571, 0.501655, 0.570857, 0.829206, 0.773333, 1.456894, 0.321814, 1.811933, 1.373103, 0.852123, 0.811630, 3.591224, 0.790648, 1.359687, 0.352747, 1.103589, 0.796858, 0.776737, 0.809324, 1.137225, 0.777422, 10.052161, 1.153585, 1.204400, 2.307504, 0.103895, 1.498839, 0.869820, 0.556798, 0.766920, 0.838099, 0.777431, 1.603008, 0.947745, 0.781955, 1.191356, 1.353482, 1.343246, 0.556786, 1.277977, 0.641532, 11.090209, 0.457857, 0.785869, 9.443243, 2.032337, 1.161705, 0.703936, 0.843478, 0.787204, 0.786914, 0.871577, 0.510324, 9.044414, 1.215090, 0.467988, 1.281145, 0.811278, 0.781786, 2.256884, 1.314029, 0.782609, 2.991885, 0.466159, 0.727997, 0.743165, 0.751746, 0.827184, 0.782765, 1.373731, 0.964182, 1.906857, 0.786620, 0.822364, 0.819642, 4.729148, 0.739939, 1.313205, 3.285714, 0.456244, 0.715951, 0.803190, 0.569773, 1.709954, 1.244592, 1.324485, 1.708858, 1.987771, 0.572296, 0.777817, 1.337589, 0.790439, 0.798682, 2.341253, 1.925781, 1.326403, 0.689020, 1.567625, 0.807094, 0.619987, 1.094766, 0.797610, 0.554610, 0.523968, 0.765224, 0.381590, 1.293300, 1.397285, 0.582968, 0.446446, 0.538150, 0.684101, 0.725337, 0.739532, 7.803057, 2.187284, 2.583187, 0.849671, 0.799927, 0.799643, 0.780267, 0.566902, 1.480373, 0.891082, 0.353267, 0.322024, 0.509322, 0.730982, 1.361262, 12.777973, 1.112551, 0.514306, 0.522409, 0.491622, 1.290755, 0.517488, 0.813238, 1.345313, 0.345681, 0.480822, 0.830658, 0.351241, 0.762504, 0.800139, 0.576767, 5.232777, 0.522876, 0.510024, 0.836815, 0.810630, 0.813695, 0.406877, 0.489390, 0.518176, 0.796551, 1.899293, 0.242851, 0.440864, 0.288494, 0.840131, 0.494918, 1.200176, 0.505365, 0.322017, 1.211103, 2.365178, 1.408686, 0.804270, 0.852594, 10.538102, 0.523899, 0.480873, 0.206279, 0.305183, 0.346516, 0.759800, 1.319666, 0.841190, 0.297049, 0.283787, 1.292864, 0.796267, 0.527553, 0.693356, 0.766071, 0.713739, 1.275991, 0.816726, 0.758276, 0.493591, 0.796488, 0.810707, 0.785409, 0.834881, 0.489191, 0.261908, 0.289164, 1.348108, 0.409318, 0.523906, 0.621980, 1.875831, 0.816807, 0.279684, 0.784321, 1.226555, 0.804704, 0.490489, 0.300082, 1.787723, 2.099360, 1.860343, 0.386204, 0.465495, 0.530455, 0.734783, 1.402214, 0.517649, 0.551499, 0.362219, 0.814872, 0.712183, 0.528774, 0.484793, 0.330767, 0.930788, 0.565435, 0.760108, 0.533566, 0.813897, 0.562625, 0.714334, 0.373802, 5.392139, 0.765306, 14.133907, 0.481432, 1.497454, 0.513957, 0.806664, 0.782655, 0.489837, 0.465811, 0.782407, 1.205691, 1.436109, 0.285471, 0.294614, 5.111746, 3.444687, 0.882105, 0.455607, 0.804420, 0.779263, 0.794798, 0.811143, 1.786577, 0.492645, 0.527376, 0.507602, 0.848693, 0.734094, 0.763844, 0.738341, 8.963941, 0.857076, 0.875000, 0.833980, 0.772505, 0.876126, 0.839921, 0.458829, 0.759555, 1.320988, 0.222020, 0.196661, 0.783274, 0.479552, 0.882742, 0.681439, 0.512649, 0.234887, 0.701137, 9.673689, 0.461576, 0.299196, 0.435468, 1.430985, 5.277383, 0.536004, 0.807376, 0.786857, 0.482711, 0.777358, 0.533483, 1.268683, 0.649810, 0.909179, 0.510471, 0.756959, 2.243083, 1.032353, 2.116746, 0.329534, 0.377660, 0.537669, 0.777970, 0.867598, 0.519694, 0.530115, 0.540763, 0.396904, 0.524467, 1.041146, 0.696905, 0.359013, 0.392266, 0.854969, 0.766963, 0.549491, 0.381848, 1.482450, 1.256593, 1.215901, 0.411715, 0.491904, 0.698175, 0.430930, 0.538055, 1.292591, 0.377161, 0.505608, 0.328604, 0.519961, 1.314174, 0.547965, 0.539707, 0.223684, 1.113106, 1.076334, 1.241963, 0.770053, 7.837887, 0.732046, 1.538443, 0.488719, 1.796466, 1.341516, 0.249800, 0.723335, 0.058095, 2.495298, 0.996738, 0.769150, 0.836907, 0.811003, 0.516555, 1.132866, 0.695353, 0.912714, 2.527143, 22.992006, 0.751458, 0.744161, 0.495506, 1.617082, 1.132812, 0.813473, 0.807297, 0.739451, 2.652386, 0.893528, 0.493185, 0.804716, 0.823032, 0.833460, 0.465559, 1.259523, 0.842682, 0.403650, 1.411268, 1.943253, 1.336643, 0.497423, 0.523980, 0.783124, 0.762940, 0.241079, 1.279742, 0.916006, 1.258431, 0.813603, 0.489861, 0.532207, 1.258922, 0.827240, 0.845428, 0.517026, 0.496568, 1.280911, 0.569579, 0.736150, 0.507874, 1.756425, 0.310020, 1.807571, 0.819062, 0.542063, 0.767014, 0.803802, 1.068476, 1.627965, 1.646957, 0.843265, 0.844362, 0.838092, 1.545814, 0.786630, 0.522446, 0.758322, 0.742517, 0.487934, 5.585641, 1.832541, 2.339957, 0.816433, 1.746250, 0.812857, 1.341326, 0.810108, 0.772838, 0.805495, 1.451195, 0.410597, 0.290659, 1.218577, 0.734068, 0.807994, 0.368404, 0.305708, 1.893878, 0.507281, 11.651868, 0.416213, 0.402700, 0.235657, 0.401323, 0.534471, 1.017161, 0.776031, 4.486240, 0.519128, 0.545522, 1.639928, 0.776238, 0.856305, 1.042896, 1.782821, 0.836690, 0.779566, 0.525455, 0.079987, 0.754278, 1.351680, 0.659696, 0.380985, 0.208394, 0.461337, 0.995127, 1.458803, 0.787890, 0.222912, 0.390688, 1.589241, 2.249824, 1.340325, 1.182369, 0.492213, 0.307362, 0.522072, 8.967798, 1.988799, 3.012992, 1.133800, 0.391844, 1.823923, 0.311362, 0.797081, 0.515760, 2.067281, 1.259405, 0.738135, 0.833478, 1.265732, 0.773512, 0.761331, 0.844133, 1.494683, 0.520369, 0.494075, 0.484074, 1.009326, 0.932017, 0.256883, 0.497438, 1.281350, 1.287832, 0.731785, 0.849475, 0.615847, 2.078652, 0.517224, 0.557939, 0.527700, 0.404874, 0.407140, 0.517791, 8.996876, 0.476169, 0.420283, 0.510143, 0.744620, 1.248067, 0.539804, 0.531684, 0.499424, 2.226899, 1.315587, 0.247685, 0.741781, 0.795904, 0.773784, 0.424870, 0.819892, 0.881253, 1.417900, 7.385214, 0.774991, 0.512735, 0.475347, 0.292090, 0.767950, 1.353152, 2.179649, 0.699254, 1.052525, 1.217849, 0.648839, 0.515882, 0.796990, 0.781261, 0.908313, 0.849363, 0.408004, 0.809696, 0.816009, 2.756410, 0.788316, 0.058855, 0.492823, 0.753536, 0.864466, 0.519177, 1.035753, 1.788707, 0.757285, 1.211195, 0.523601, 0.388182, 0.800336, 0.781872, 0.736413, 1.475983, 0.768846, 0.800849, 1.144352, 0.262299, 0.934637, 0.944472, 0.767571, 0.523698, 0.340919, 0.853394, 0.048755, 1.338808, 0.228415, 1.170827, 0.244130, 5.539152, 1.409996, 0.794462, 0.789919, 0.906643, 2.391165, 0.420136, 2.401376, 0.917798, 0.443421, 0.763277, 0.522854, 0.369082, 0.843638, 2.077457, 1.427171, 0.826758, 0.500796, 0.481861, 0.529636, 0.726604, 1.711089, 0.488187, 0.590244, 0.828213, 0.813771, 1.333333, 0.481930, 0.521625, 0.309294, 1.954655, 0.769388, 0.748037, 8.446400, 9.863192, 1.398693, 1.367361, 0.799857, 0.814627, 0.539464, 1.419088, 0.827413, 0.782137, 0.497274, 0.498984, 0.516678, 0.795538, 0.759239, 4.135781, 0.499183, 0.518526, 0.816693, 2.308192, 0.820233, 0.849152, 0.530656, 0.473497, 0.361602, 0.766349, 1.888889, 1.766962, 1.174297, 0.786270, 6.160961, 0.527797, 0.805714, 1.318966, 0.909435, 0.470411, 1.311111, 0.717860, 0.475067, 0.487528, 0.240166, 0.803249, 0.683031, 0.795911, 0.804493, 0.506977, 0.775988, 1.393124, 0.760620, 0.252447, 1.240435, 0.810222, 0.825535, 0.779139, 0.873592, 1.752614, 1.185453, 0.279738, 0.810526, 0.380469, 0.782853, 0.463201, 0.765722, 1.319706, 1.295074, 0.264702, 0.901454, 0.535167, 0.610002, 0.581003, 0.055231, 0.812318, 1.972264, 1.281853, 0.744202, 0.530747, 0.769576, 0.350815, 0.264887, 1.525253, 1.302659, 0.549462, 0.408400, 0.845203, 0.861018, 0.774394, 1.388404, 0.816546, 1.874602, 2.522679, 1.389907, 0.811478, 0.543340, 0.417602, 2.180624, 1.183867, 1.276360, 0.379248, 0.876212, 0.509264, 0.510218, 1.396095, 0.130713, 0.090981, 0.754764, 3.429334, 0.282012, 0.419319, 0.754337, 0.504200, 0.740546, 0.797561, 1.372549, 2.703046, 1.826696, 0.766847, 0.498024, 0.554640, 1.877142, 0.546640, 0.391505, 0.495978, 0.180506, 0.488168, 0.321592, 0.565635, 0.615896, 1.285910, 0.667838, 1.540622, 0.227508, 0.550680, 0.483318, 0.567067, 0.743978, 1.228872, 1.124334, 0.501268, 0.253995, 0.560161, 0.819122, 0.525605, 0.351538, 0.510894, 0.798559, 0.811204, 0.368101, 0.760558, 0.525912, 1.404959, 0.575698, 0.489768, 0.483627, 1.019547, 1.265398, 0.493015, 0.494452, 0.734759, 1.702460, 0.375751, 0.264909, 0.658534, 1.933551, 0.840215, 0.768861, 5.006942, 0.293939, 0.514948, 0.540497, 1.267377, 2.115825, 1.211575, 0.788683, 0.766641, 0.509689, 7.715023, 0.385917, 2.516990, 0.691914, 0.489725, 3.829216, 0.812522, 0.390252, 0.517974, 1.079132, 0.741869, 0.228074, 0.882224, 0.864001, 1.434324, 0.534322, 0.744790, 0.818519, 2.138501, 0.477456, 0.228797, 0.534839, 0.492617, 0.563935, 0.523084, 0.839503, 1.318999, 2.080249, 0.283308, 0.395353, 0.369588, 1.563948, 0.771139, 0.516663, 0.949676, 0.943149, 0.533669, 0.829537, 0.552921, 0.372597, 0.531685, 0.545107, 5.024076, 0.413059, 0.564530, 1.316783, 1.554451, 0.553761, 0.817812, 0.907202, 0.382835, 1.247259, 0.755908, 0.827169, 0.528013, 1.181818, 0.810251, 1.305248, 0.359960, 0.409873, 0.189481, 4.612647, 0.755123, 0.903930, 0.657937, 2.431873, 1.570261, 1.229868, 0.530482, 0.404176, 2.641621, 0.303677, 0.772711, 0.573202, 0.570937, 0.484980, 0.750169, 4.711532, 1.710602, 1.187695, 1.353448, 0.348819, 1.395221, 0.776618, 1.062162, 0.342992, 0.053238, 0.777202, 1.330454, 0.658281, 0.229959, 0.345140, 0.962250, 0.039608, 0.273997, 0.501629, 1.198146, 0.559297, 0.337508, 0.731218, 0.499768, 1.864529, 0.594859, 0.816366, 0.567127, 0.919807, 0.306765, 0.465874, 0.404107, 0.921327, 0.210526, 1.276664, 0.650747, 1.252384, 0.806039, 0.236224, 0.778395, 0.495948, 0.769822, 1.310362, 0.525951, 0.862633, 0.537764, 0.413716, 0.036162, 0.825087, 0.793256, 1.348140, 0.797096, 1.226005, 0.764747, 0.381598, 0.527957, 0.566398, 0.531227, 0.511765, 0.826934, 0.738252, 1.086555, 0.733560, 0.094178, 0.573945, 0.487288, 0.852736, 1.387668, 1.149185, 0.839634, 1.026681, 0.492726, 0.710882, 0.718009, 0.407278, 1.122375, 0.551699, 0.784824, 0.310506, 0.856871, 0.619854, 1.892935, 0.644189, 1.829836, 0.866027, 0.567427, 0.539885, 0.337582, 0.495128, 0.797039, 0.535808, 0.803143, 2.535919, 0.540224, 0.551757, 0.783883, 0.345179, 0.793656, 0.222299, 0.820194, 4.989744, 0.813128, 5.437529, 0.502404, 1.253458, 1.356021, 0.345849, 5.612659, 0.628144, 0.778843, 2.648639, 0.539633, 0.872130, 0.363728, 0.054947, 0.390046, 0.406357, 0.480992, 0.539637, 9.507555, 1.265355, 2.044454, 0.826077, 1.829941, 1.510227, 0.652161, 0.737474, 0.514187, 0.406934, 1.266437, 0.312024, 1.721562, 1.194814, 0.742243, 0.772853, 0.834862, 0.807181, 1.711096, 0.945985, 1.120823, 0.749075, 0.614442, 2.445072, 0.722912, 0.794806, 1.718861, 0.964104, 0.841743, 0.516809, 0.503801, 0.760690, 0.292693, 1.366351, 2.614326, 0.776256, 0.828571, 0.847173, 0.825332, 1.484769, 0.521277, 2.283162, 1.203230, 0.743391, 0.655105, 0.538210, 0.526790, 0.531316, 1.776720, 9.547535, 1.888849, 0.700717, 0.763252, 0.843097, 0.832272, 0.835958, 0.819316, 0.726257, 0.984237, 1.969531, 0.814256, 0.756320, 0.786723, 0.759944, 0.506440, 1.805400, 1.531892, 0.674049, 1.328305, 0.795480, 1.521927, 0.817888, 0.319923, 0.447112, 2.905934, 0.374881, 1.342650, 0.739417, 0.742148, 0.463031, 0.257585, 0.198003, 126.402803, 74.995701, 0.963264, 1.323540, 1.316276, 0.329791, 8.537961, 0.847949, 4.915213, 0.768020, 0.871360, 0.528048, 1.460773, 0.862748, 0.349463, 6.181653, 0.777858, 0.486964, 1.298986, 1.287956, 2.221955, 0.508904, 0.306082, 0.792635, 7.423349, 1.285563, 0.808913, 0.648727, 0.371017, 0.753879, 3.187587, 1.341156, 0.787391, 0.695326, 1.210167, 0.944848, 1.074762, 0.810064, 0.753138, 1.981716, 9.981699, 0.540032, 1.080580, 0.819027, 1.836661, 0.851112, 0.510493, 0.478086, 0.217150, 1.216207, 0.463705, 1.161666, 5.286669, 3.906449, 0.474728, 0.759228, 0.749731, 1.267165, 0.405768, 3.412327, 0.814570, 1.447119, 0.468225, 1.498724, 0.501486, 0.884549, 0.817029, 0.387430, 0.487678, 0.513751, 0.794067, 0.769774, 0.404875, 0.330033, 1.010989, 0.568013, 8.412526, 17.926863, 1.705715, 2.461591, 0.887888, 0.533268, 0.779601, 0.823424, 0.416347, 1.088057, 0.465575, 0.388253, 1.274288, 1.399221, 0.824472, 0.399720, 0.502839, 0.814557, 0.506553, 0.505016, 0.460848, 1.625526, 0.787379, 0.839246, 1.889828, 1.382565, 1.419115, 1.158345, 0.951203, 5.833881, 0.730796, 0.484499, 0.754058, 2.320342, 0.818349, 0.493304, 0.415955, 0.638650, 0.222021, 0.543468, 15.138383, 1.376017, 0.507064, 0.802618, 0.578883, 0.770412, 0.752904, 1.293292, 0.818115, 0.846445, 0.798097, 3.471715, 0.389189, 0.836691, 0.706227, 0.792000, 1.366340, 0.800650, 0.775591, 0.766678, 0.372643, 2.225139, 3.249089, 0.945927, 3.277817, 0.373500, 0.523055, 0.767677, 0.770189, 0.474504, 0.509066, 1.378433, 0.408804, 0.841752, 0.763655, 4.856722, 1.275910, 0.765547, 0.986443, 0.735394, 0.891259, 0.785338, 0.807202, 0.529206, 0.533092, 0.777933, 0.477408, 6.341304, 1.663172, 1.814061, 1.266332, 0.763868, 0.505351, 0.907462, 0.804272, 0.797096, 11.365202, 1.317617, 0.989459, 0.521892, 0.299228, 0.724886, 5.047636, 1.889303, 0.878720, 0.269404, 0.851958, 0.396529, 1.367283, 1.260028, 0.850431, 0.734349, 0.237541, 0.534101, 6.221721, 1.269678, 1.280273, 1.332282, 0.520057, 0.383695, 0.856759, 0.775826, 0.747142, 0.206213, 0.889048, 0.500000, 1.261445, 0.478026, 0.603525, 0.399513, 0.755315, 0.434307, 0.547310, 0.540251, 0.813284, 0.720083, 0.809240, 0.855248, 1.788196, 0.363242, 0.743184, 0.737121, 0.609699, 5.936700, 0.532795, 0.508015, 1.748993, 0.740000, 0.509689, 0.807117, 0.761583, 0.770790, 1.336012, 1.611609, 1.717779, 0.921197, 0.379928, 0.445523, 0.289941, 0.790363, 4.072480, 0.521456, 2.396802, 2.803534, 0.801380, 0.501936, 0.630327, 1.308202, 7.800347, 0.251221, 0.791235, 2.084321, 5.252621, 11.176285, 0.817920, 0.779774, 1.352833, 0.795430, 0.369448, 0.492196, 0.820745, 1.284122, 2.629303, 0.775676, 1.291157, 1.221603, 0.505794, 0.715114, 0.088913, 0.777245, 0.751295, 1.253024, 1.529640, 0.823919, 0.697569, 12.086406, 0.807278, 0.722242, 1.498394, 0.733045, 0.759693, 4.188153, 3.175562, 1.801634, 1.767529, 0.781565, 0.486274, 0.764260, 0.912631, 0.524488, 0.480748, 0.823102, 0.761461, 0.507490, 0.757102, 2.734182, 0.665186, 6.593326, 0.776833, 0.540190, 0.759768, 2.797529, 1.254565, 0.558318, 0.801924, 2.612508, 1.827807, 1.401264, 0.818069, 0.752821, 2.269218, 1.397455, 0.247084, 0.826467, 0.783735, 1.026728, 5.097977, 1.289437, 1.010510, 0.768075, 0.245395, 0.806830, 0.811953, 1.588010, 0.790765, 0.634841, 0.778773, 2.332009, 0.808239, 0.504227, 0.810113, 1.793363, 0.524644, 1.418129, 0.740690, 2.589204, 0.783321, 0.582502, 0.751049, 2.143916, 5.832343, 1.628210, 0.829651, 0.607896, 0.788718, 0.794926, 0.780446, 1.603669, 5.929918, 2.696422, 0.730889, 7.044263, 0.788732, 0.340382, 0.824441, 0.777378, 1.284581, 1.141704, 0.773891, 0.450648, 0.756263, 0.369328, 0.860355, 1.329957, 4.398670, 1.084942, 1.356651, 0.557420, 0.749650, 0.332487, 0.748865, 2.102224, 1.513130, 1.397826, 1.126071, 0.794118, 0.539097, 0.556130, 1.184078, 1.276344, 2.177608, 1.367254, 0.585353, 0.586904, 1.702306, 0.230998, 0.757058, 0.462038, 0.846182, 1.814525, 0.567839, 0.262121, 0.817529, 0.780542, 2.043398, 0.805776, 0.658624, 0.515078, 2.579421, 0.782815, 0.779697, 0.848597, 0.828654, 0.792189, 1.351137, 2.858127, 1.271288, 0.557283, 0.724761, 0.759898, 1.773904, 0.909666, 1.855487, 0.781193, 0.718140, 1.250435, 0.411536, 0.620102, 0.714478, 0.757928, 0.290148, 0.880934, 1.598350, 0.292097, 1.804690, 0.793537, 0.287755, 0.660538, 0.743963, 0.827445, 0.826715, 2.608272, 0.846551, 0.884765, 3.915945, 2.980478, 0.811631, 0.537042, 2.884815, 0.734594, 1.730542, 0.826780, 0.896425, 0.807564, 1.391756, 0.839479, 0.770725, 0.413736, 1.184840, 0.794383, 0.378047, 0.868185, 1.312477, 0.405045, 0.943721, 2.250000, 1.378194, 4.413324, 0.365178, 0.822311, 0.817489, 0.634638, 0.824799, 1.340224, 1.356868, 3.200574, 0.767148, 1.266959, 1.605786, 0.796575, 0.765935, 2.313882, 0.847917, 0.801178, 1.342929, 2.536551, 0.815771, 0.425287, 0.829945, 0.754211, 0.822124, 0.673309, 1.733877, 0.464256, 0.795236, 1.207553, 0.742867, 1.700323, 0.381558, 0.837550, 0.348786, 0.744163, 0.800211, 0.653757, 1.272415, 4.101056, 0.496554, 0.750859, 2.428336, 6.120851, 0.758499, 0.831564, 0.786700, 1.925791, 1.695144, 0.768913, 0.559990, 0.797658, 0.334944, 0.811388, 0.791209, 8.197065, 1.323668, 2.850408, 1.378963, 1.309449, 0.810686, 0.775177, 2.185160, 0.788597, 1.484018, 0.782513, 0.584183, 0.769203, 0.805627, 0.743941, 5.598151, 1.038376, 1.746326, 1.800073, 4.033071, 3.983199, 0.823571, 0.580390, 1.154846, 27.790671, 0.755690, 0.736768, 1.265577, 6.781700, 1.362392, 0.699330, 1.179125, 15.751079, 1.391823, 0.757751, 0.346820, 0.756691, 0.971316, 1.343874, 0.773512, 4.180874, 0.960714, 3.924911, 4.155197, 0.545062, 1.811665, 0.794316, 0.395463, 0.831494, 0.701770, 6.965962, 1.300069, 0.797518, 2.231041, 0.799488, 0.454639, 0.776553, 0.764090, 0.640643, 0.791050, 0.657323, 1.824568, 0.758324, 1.173807, 0.783756, 0.613388, 0.780930, 0.219970, 0.512151, 0.793667, 0.271192, 0.747435, 0.824319, 0.552261, 0.798540, 1.235253, 0.575828, 2.304570, 0.836270, 0.518248, 0.834998, 0.550074, 0.780618, 4.889043, 0.801521, 1.657427, 1.204178, 0.566989, 0.809885, 0.062736, 0.950441, 1.243868, 1.247218, 1.585989, 0.750978, 0.527114, 0.812273, 0.802202, 0.812215, 1.727758, 3.258811, 1.361732, 3.627569, 0.749827, 0.778064, 1.528422, 0.820541, 0.781767, 0.207732, 0.769661, 2.872869, 0.782367, 0.735589, 21.310015, 1.337408, 1.325516, 0.795503, 0.664877, 1.296925, 1.973702, 0.796141, 0.316821, 3.525984, 0.773189, 0.785323, 0.786741, 1.262007, 0.613057, 1.351892, 0.806713, 0.508479, 0.688977, 0.795543, 7.508030, 0.430483, 2.124955, 0.707563, 1.975085, 1.343213, 0.748754, 0.803759, 0.551480, 0.736861, 0.831227, 1.226671, 0.711761, 0.525243, 0.827999, 0.591164, 1.444568, 15.284545, 0.577778, 12.803131, 1.484559, 0.778097, 1.651510, 0.804861, 4.073620, 2.539866, 1.858590, 0.840226, 0.753126, 2.605222, 0.740375, 1.130035, 0.465735, 0.185544, 1.772459, 4.015479, 0.721607, 0.771634, 0.490374, 0.193079, 1.774014, 0.515610, 1.442001, 1.749738, 0.812804, 0.767861, 7.315580, 0.408954, 11.549839, 0.478231, 1.761738, 3.944625, 0.764415, 0.546406, 1.312788, 0.994328, 4.887391, 0.518879, 1.139535, 2.119945, 0.904477, 8.839913, 0.481894, 0.815890, 2.035191, 0.807933, 1.345921, 0.522238, 0.489962, 0.387982, 8.787385, 0.819979, 0.372209, 0.196458, 0.536381, 1.346966, 0.276335, 0.702092, 0.783082, 0.724434, 0.744492, 0.200914, 1.676602, 1.752941, 1.844635, 0.788065, 0.517903, 1.765133, 3.393606, 3.060950, 1.818311, 0.760506, 0.737118, 0.781798, 0.486542, 0.796283, 6.133087, 0.809012, 0.725332, 0.786371, 0.504628, 0.415126, 0.833456, 0.807524, 1.335486, 2.597451, 1.264408, 0.777660, 0.821258, 0.470158, 1.641878, 2.967230, 1.383957, 0.181055, 1.277680, 1.320100, 0.830690, 0.464479, 0.752699, 0.708670, 3.417240, 3.737727, 0.256553, 0.501006, 1.348319, 0.484520, 0.449061, 0.715768, 24.909091, 1.552968, 0.704335, 1.392833, 0.180893, 0.797265, 1.690672, 0.747611, 0.775071, 0.765957, 0.758560, 1.862494, 0.169876, 0.460074, 0.281619, 0.803634, 0.846125, 0.845097, 0.881773, 0.723190, 1.735139, 0.171119, 1.195185, 0.752912, 0.833157, 0.503146, 0.505774, 0.392305, 0.800291, 1.337852, 1.407992, 0.516272, 0.388821, 0.492828, 0.832784, 0.765054, 4.340331, 0.504471, 0.602546, 0.305293, 1.206083, 0.818671, 0.767426, 0.753329, 0.842553, 1.465407, 5.375693, 0.306390, 0.513280, 0.488279, 0.825106, 0.786017, 0.790219, 0.647806, 2.397544, 0.810676, 0.790935, 0.831325, 0.793103, 0.398733, 0.761527, 0.707967, 0.775986, 0.790805, 0.400000, 0.468119, 0.367496, 1.253004, 3.087769, 0.315789, 0.796181, 0.777778, 0.716480, 0.792705, 0.818443, 1.651719, 0.814487, 2.203924, 0.388188, 0.662766, 0.756157, 0.772038, 0.736692, 0.940388, 1.118628, 0.503040, 0.766724, 0.802222, 0.416280, 0.515832, 0.383137, 0.190941, 1.726453, 0.834619, 0.845647, 11.496498, 1.834007, 2.247616, 0.810724, 0.771831, 0.511894, 6.167702, 0.738476, 2.131801, 0.792235, 0.516024, 0.504285, 0.512447, 0.833569, 0.794835, 0.217620, 0.498423, 0.466076, 0.790385, 1.360482, 0.638705, 0.813571, 0.318960, 0.750794, 0.764470, 0.186649, 0.373114, 0.542651, 0.857537, 0.746763, 1.311317, 0.796422, 1.892115, 0.358049, 0.372475, 0.828731, 1.258506, 0.809277, 0.799779, 1.340359, 1.063297, 0.814619, 0.808081, 0.782042, 1.352729, 0.496202, 0.837332, 0.463428, 0.504804, 0.305480, 1.764316, 8.215789, 0.792277, 0.867685, 0.784314, 0.489648, 1.100268, 2.073845, 0.761258, 0.819320, 0.470268, 1.177740, 0.807624, 1.842761, 0.949664, 0.221829, 0.527861, 0.846295, 0.497162, 0.796303, 0.826303, 1.267976, 1.676237, 2.713436, 1.171527, 0.829823, 0.497505, 0.833942, 0.802952, 0.603452, 0.521379, 0.791535, 0.708674, 0.744981, 0.486679, 0.832320, 0.479235, 0.818631, 0.778290, 1.422490, 2.283924, 1.832450, 1.808777, 0.483390, 1.316046, 0.292147, 0.500789, 0.548800, 0.508120, 1.422325, 7.965230, 0.543818, 0.691396, 0.783510, 0.509665, 0.464787, 0.675329, 0.823316, 1.384392, 0.816334, 0.765359, 1.356782, 1.060654, 0.384297, 0.311284, 0.515158, 1.230259, 0.777739, 0.840750, 0.493793, 1.052644, 1.191533, 1.298221, 0.533256, 1.162172, 1.789455, 1.003018, 0.803190, 0.896842, 0.761175, 0.818638, 0.533333, 0.740531, 0.790755, 0.769367, 0.365191, 0.168604, 9.701211, 0.247459, 0.833393, 0.766873, 0.457675, 0.749643, 8.986287, 0.743501, 2.636688, 0.483463, 1.012384, 1.462997, 0.811361, 0.799704, 0.755380, 0.481084, 0.463025, 1.344433, 0.754216, 0.783153, 0.519492, 0.473743, 0.497721, 6.620460, 1.250343, 0.771867, 2.172625, 0.904896, 0.779230, 1.348430, 0.514215, 0.764808, 13.262491, 0.515692, 0.747882, 0.821379, 0.893071, 0.488923, 0.448638, 0.452763, 0.795382, 1.718470, 1.841441, 2.550144, 0.356873, 0.489319, 1.107250, 9.523132, 0.798112, 0.878132, 0.827524, 0.867524, 0.229719, 0.543646, 0.821687, 0.503067, 1.243077, 0.803025, 0.770457, 0.833873, 0.807912, 1.376973, 0.874047, 8.683553, 0.225041, 0.756382, 0.748328, 1.212824, 0.822609, 0.828914, 0.506924, 3.659128, 1.850287, 0.784792, 0.807005, 0.793471, 0.796829, 0.409280, 0.489610, 0.889303, 1.784828, 0.814680, 0.802460, 0.773626, 1.274339, 0.758322, 1.228414, 0.387679, 0.761194, 1.318032, 0.798720, 0.782717, 1.315083, 0.763598, 1.665414, 0.237639, 0.857653, 1.258904, 0.736192, 0.823296, 0.488605, 0.808469, 1.206004, 0.743321, 2.847698, 0.384766, 0.749198, 0.775531, 0.824512, 0.787944, 0.807859, 0.943964, 0.657648, 0.784237, 0.799217, 0.743830, 0.735444, 0.717098, 9.040967, 1.474423, 1.195782, 3.497966, 0.499160, 1.261645, 1.354565, 0.724818, 0.468973, 11.376743, 0.828654, 0.782083, 1.347411, 1.395205, 0.757215, 0.505502, 0.531586, 2.896053, 0.731216, 3.294199, 5.683965, 4.930901, 0.491676, 7.292943, 0.151536, 0.090440, 6.371145, 1.146067, 1.318539, 7.270759, 0.321488, 0.761220, 1.613830, 0.763460, 0.748363, 0.806902, 1.276757, 0.641422, 0.480892, 0.755414, 0.770924, 0.522545, 0.753144, 0.794223, 0.786207, 0.789436, 0.814270, 0.779484, 0.480191, 0.377063, 0.782125, 2.339048, 0.317346, 0.735663, 0.908453, 0.755640, 0.784452, 0.512578, 0.794169, 0.412344, 0.323589, 0.824286, 0.701665, 0.713173, 0.786855, 0.807788, 1.785490, 0.821168, 0.511826, 0.730823, 0.804020, 0.540476, 0.722184, 0.501174, 0.290615, 0.744436, 0.521916, 0.227393, 0.772510, 0.811532, 8.261352, 0.503596, 1.063927, 1.671931, 0.834553, 0.800875, 0.472703, 5.511865, 0.509017, 0.806185, 0.873323, 0.307514, 0.174029, 0.230365, 0.392785, 0.834624, 0.810256, 0.727241, 0.499317, 0.347568, 1.422548, 0.793826, 1.402055, 0.501052, 0.494564, 0.500117, 1.059503, 1.150376, 0.293790, 0.525534, 0.831186, 0.792500, 0.739846, 0.489381, 0.475710, 0.441973, 0.715640, 0.726478, 0.494349, 0.788678, 0.761352, 0.784442, 0.152711, 0.333179, 0.390152, 0.322410, 0.457787, 0.345643, 0.755870, 0.812500, 0.175835, 0.520441, 0.489223, 0.722513, 0.525743, 0.386999, 0.754571, 0.511178, 0.233230, 0.872404, 0.782105, 0.821493, 0.519356, 0.698093, 0.833031, 0.376539, 2.631561, 0.743653, 1.404175, 0.826993, 0.752348, 0.494848, 1.227129, 1.392086, 0.768987, 0.829197, 0.746009, 0.772421, 0.770979, 0.531447, 0.459466, 3.964286, 0.722837, 0.538624, 0.470111, 0.502614, 0.810549, 0.800712, 0.184462, 0.402828, 0.519758, 0.788777, 0.838626, 0.747412, 0.759463, 0.450566, 0.280878, 0.993631, 0.409970, 0.804284, 0.828025, 0.556380, 0.056204, 0.494178, 0.783091, 0.743369, 0.372136, 0.250604, 0.520983, 0.815476, 0.783916, 0.577752, 1.182456, 0.991417, 0.218603, 0.803303, 0.972442, 0.758377, 0.769365, 0.766463, 0.824081, 1.099627, 0.867975, 0.494774, 0.787930, 0.486530, 0.513571, 0.462128, 0.839870, 0.408088, 0.492304, 0.394275, 0.491697, 1.580082, 0.520785, 2.451795, 1.505882, 0.774895, 1.340993, 0.409574, 0.739354, 0.939800, 0.858514, 0.319875, 2.359783, 0.795067, 0.602498, 0.490341, 0.503506, 0.821211, 0.796703, 1.703406, 0.894815, 0.429323, 0.790543, 0.435708, 0.735562, 0.694279, 0.779625, 3.617582, 1.103155, 1.383387, 1.182666, 1.975374, 0.400775, 0.736291, 0.989350, 0.687692, 1.382205, 0.327478, 0.512300, 0.489576, 0.520455, 1.308860, 1.638970, 0.403730, 1.291117, 0.793073, 0.800495, 0.805842, 0.791193, 0.191842, 4.628131, 0.725943, 1.736748, 0.750714, 0.729620, 0.723270, 0.835476, 0.817257, 14.760059, 7.914577, 0.413907, 0.513952, 1.243206, 1.318277, 0.316839, 0.405596, 0.439525, 0.358389, 6.033182, 1.753867, 1.088480, 12.666094, 7.950683, 1.410354, 1.407179, 0.217082, 0.435709, 0.536444, 0.535329, 1.286569, 0.824668, 0.732155, 0.492088, 12.439828, 0.869195, 0.857311, 0.443202, 1.537365, 0.824048, 0.703357, 0.509934, 0.808063, 0.961900, 9.470448, 0.994015, 1.672831, 0.220593, 3.293260, 0.478057, 0.754041, 1.318898, 5.130847, 3.342721, 3.764147, 0.565228, 1.650641, 0.640896, 0.515744, 0.845446, 0.765454, 1.926997, 0.495154, 0.510281, 5.021602, 3.802737, 0.769474, 0.805808, 0.398405, 0.518799, 0.740345, 2.580985, 0.387445, 0.508247, 7.417951, 1.296595, 0.851431, 2.965149, 0.826474, 3.501025, 1.750737, 0.249282, 0.799378, 0.746897, 0.635089, 1.840845, 3.652596, 2.840468, 1.265841, 0.824304, 1.333936, 0.837818, 0.831481, 0.791561, 1.731018, 3.046585, 0.394613, 0.787067, 1.397290, 0.809135, 0.780666, 8.852330, 5.915368, 0.726829, 1.280431, 2.723834, 1.077547, 1.099616, 0.799653, 0.861121, 0.787572, 1.005768, 1.343262, 3.772758, 0.710769, 0.860917, 1.401957, 0.832765, 0.754769, 0.417988, 1.881471, 0.798577, 1.028302, 0.718107, 0.776767, 0.806611, 1.402409, 0.442610, 0.813604, 0.792023, 0.831862, 0.835157, 0.514601, 1.270790, 0.644427, 0.828048, 1.037160, 0.845791, 0.782009, 0.800874, 0.805694, 0.247168, 4.942254, 0.785242, 0.785817, 0.829929, 3.169131, 0.801398, 0.540140, 0.786268, 0.716528, 0.296499, 1.401728, 0.777660, 1.911859, 1.409124, 0.793690, 1.482815, 1.279817, 2.111954, 9.138879, 0.767377, 0.744056, 0.634261, 6.802473, 5.496547, 5.703412, 0.619877, 13.787445, 7.009132, 0.928681, 3.320734, 1.505022, 0.059457, 1.653517, 0.859160, 1.841252, 0.776702, 2.828723, 3.654053, 1.111607, 0.813945, 1.605350, 3.483357, 0.866150, 0.814923, 1.746448, 1.133293, 1.319149, 0.623693, 0.794643, 3.008000, 6.799098, 0.722356, 1.622763, 1.178068, 0.798188, 0.567690, 0.816401, 2.763305, 1.816269, 0.642544, 1.242009, 1.295292, 3.287482, 0.795396, 0.777700, 0.782529, 10.855530, 1.099341, 0.808876, 0.798447, 0.748092, 0.757316, 0.815520, 0.837345, 1.828835, 0.843241, 0.727926, 0.772711, 1.240515, 0.752127, 7.053749, 0.751039, 0.802546, 0.795302, 1.365767, 0.866642, 0.792718, 0.552722, 0.775569, 1.474114, 1.224621, 0.811067, 0.847584, 4.566478, 1.342705, 1.347777, 6.728009, 0.794716, 0.782837, 0.754069, 1.295221, 1.837282, 0.812779, 0.700363, 0.782780, 10.546249, 0.731338, 0.824121, 1.249334, 11.183929, 2.192904, 1.303290, 0.796858, 1.270921, 0.871170, 0.744153, 0.770199, 9.804479, 8.625087, 6.568743, 0.777778, 0.579970, 0.843997, 0.504198, 3.323208, 1.391009, 1.780915, 0.523029, 8.643300, 5.581526, 7.116872, 0.829635, 0.841637, 0.808572, 0.409741, 0.903738, 0.217917, 0.503729, 0.728587, 0.785089, 1.284225, 0.569694, 0.809696, 0.891018, 0.391283, 1.298999, 0.498185, 0.762250, 0.786862, 0.511356, 3.306115, 0.844214, 0.821132, 0.381977, 0.270891, 0.368251, 0.881788, 0.723498, 0.275566, 0.487934, 0.526091, 0.435808, 0.763752, 2.946361, 0.899531, 1.565357, 0.871545, 1.273394, 0.358013, 0.505394, 0.707212, 0.836832, 0.860803, 1.592732, 0.395732, 0.772243, 1.502525, 2.851217, 0.210215, 0.380878, 0.741818, 1.457418, 0.775440, 1.254813, 0.870241, 1.085625, 0.499549, 7.985807, 0.251223, 0.447412, 0.581088, 0.851472, 1.679828, 0.655250, 0.796742, 3.127892, 0.774633, 0.756383, 0.698165, 0.734880, 0.550996, 1.915334, 0.343000, 0.531191, 0.786375, 1.732091, 2.513025, 1.164492, 0.748547, 0.761204, 0.229062, 0.526634, 0.775611, 0.549947, 0.747467, 0.377474, 0.671119, 1.058941, 0.891089, 0.529462, 0.443457, 0.568991, 1.322535, 1.305297, 1.361952, 0.788952, 0.570928, 0.982244, 0.078296, 0.414469, 0.266154, 0.366283, 1.184573, 0.613640, 0.227559, 0.715398, 0.862020, 1.725537, 0.994826, 0.533153, 1.277467, 2.540579, 0.755610, 0.471135, 0.555196, 0.447459, 0.949793, 1.196537, 1.699831, 2.094251, 5.597106, 1.823006, 0.853496, 0.803201, 0.556676, 0.789339, 8.025471, 4.328222, 0.503052, 1.353276, 0.499888, 0.778017, 1.864760, 0.821686, 0.791427, 0.526973, 0.805357, 0.575732, 0.864411, 0.542982, 0.573578, 0.530278, 0.831925, 2.722926, 0.341194, 0.496743, 0.823022, 0.285771, 0.749829, 0.321529, 0.505086, 1.667492, 0.754697, 1.167623, 2.772041, 0.561575, 0.387097, 0.773065, 0.722819, 0.909091, 0.907824, 0.500357, 0.786460, 0.789269, 0.817139, 1.462736, 0.401408, 0.513112, 0.737294, 1.367560, 0.823868, 0.535756, 1.347601, 2.062170, 0.295124, 0.472604, 0.510867, 0.778093, 0.363928, 0.488908, 1.309373, 2.998584, 0.315588, 1.194163, 1.078551, 0.211926, 0.778007, 0.491981, 1.221933, 1.671048, 0.757102, 0.540273, 0.446676, 2.425857, 0.956222, 0.383037, 1.269852, 1.363636, 0.250516, 0.815541, 0.513396, 0.526631, 0.769175, 0.762647, 0.799638, 1.630104, 0.221521, 1.251187, 0.275556, 0.549024, 0.492495, 0.567453, 0.503268, 0.514052, 1.441573, 2.144065, 0.373433, 0.628092, 2.193921, 2.571918, 0.800742, 0.397952, 0.527115, 0.909957, 0.525972, 1.181951, 0.809794, 0.720814, 0.521442, 0.829295, 0.817032, 0.795270, 0.895052, 0.505361, 0.465433, 0.450586, 1.275089, 0.471353, 0.739758, 0.746223, 1.487751, 1.263774, 1.838183, 1.293370, 0.501830, 0.684711, 0.226532, 0.820719, 0.759062, 0.384087, 0.364475, 2.174305, 0.792519, 0.786513, 0.287103, 0.819334, 0.775261, 2.694405, 0.246217, 0.490248, 0.552319, 2.339515, 0.793609, 0.766643, 0.953811, 2.849436, 0.767781, 1.237335, 0.774839, 0.802161, 0.777010, 0.844867, 0.527921, 0.479112, 0.539455, 0.866129, 0.259264, 0.707009, 0.805130, 2.446721, 0.270953, 0.794433, 5.983063, 0.403521, 0.481612, 0.556575, 1.520833, 1.331332, 1.386864, 1.842196, 0.479507, 0.513388, 0.511358, 0.756098, 0.818675, 0.731504, 1.421072, 0.487291, 0.537823, 0.764665, 0.296306, 0.765794, 0.751068, 2.265341, 0.210805, 0.774182, 0.912289, 3.033096, 1.431359, 0.805422, 0.881452, 2.902878, 0.782516, 5.414785, 0.816137, 1.227797, 2.045393, 0.493381, 0.539143, 0.424575, 3.770990, 0.784058, 0.778273, 1.677718, 6.684637, 0.782609, 0.381218, 0.531442, 0.481059, 0.785244, 0.817849, 0.558426, 2.969327, 0.533178, 0.863059, 0.836389, 0.221776, 0.527189, 0.870686, 1.655902, 0.919767, 1.539498, 0.803604, 0.596122, 1.701181, 0.281348, 0.819668, 1.757732, 1.417953, 0.554088, 0.516932, 0.481858, 2.158687, 0.733973, 1.248008, 0.480363, 0.484059, 0.561296, 0.531087, 0.767434, 1.332170, 1.567016, 1.317747, 0.744390, 0.769259, 0.526145, 0.775582, 0.549166, 0.877453, 0.692012, 1.193610, 0.188442, 0.494636, 2.832516, 1.154180, 0.731248, 0.743902, 0.832909, 3.380885, 0.796022, 0.386462, 0.800419, 0.480589, 0.588543, 0.527324, 1.098751, 0.756274, 0.557118, 0.463458, 0.777778, 0.526712, 0.864330, 0.290653, 0.215846, 9.115234, 0.452482, 1.261151, 0.562040, 1.354102, 0.836295, 0.498665, 1.274110, 0.171665, 1.341800, 0.212082, 0.499757, 0.918965, 2.233751, 0.456740, 0.236462, 0.780933, 0.810390, 0.808131, 0.750926, 1.291875, 1.306303, 0.229047, 0.486327, 0.747657, 0.538387, 0.597978, 1.758396, 0.386044, 1.588222, 0.762060, 0.813781, 0.445715, 0.343114, 0.402831, 0.744322, 2.139584, 0.872621, 0.127108, 0.261096, 0.743483, 1.082656, 0.404803, 1.343631, 6.741440, 0.801756, 1.612755, 1.394551, 7.080913, 0.773147, 1.953385, 1.436156, 0.506195, 1.791038, 3.278957, 0.560636, 0.450439, 10.679325, 0.833982, 0.741724, 0.233857, 0.727644, 1.312744, 3.153460, 1.575977, 0.925573, 1.387166, 2.066040, 0.394085, 0.493751, 1.409384, 0.526178, 0.801068, 0.813603, 0.811186, 0.552147, 1.235460, 0.683412, 0.535208, 0.743966, 0.730809, 2.026422, 0.202207, 0.816230, 1.178510, 0.532162, 0.322929, 0.522803, 0.552811, 0.779522, 0.830798, 0.707376, 1.328596, 0.831282, 0.220633, 0.508463, 0.395964, 0.284344, 0.475435, 1.758253, 1.284139, 2.765488, 1.770237, 0.988363, 1.118072, 0.277261, 0.806067, 0.780764, 0.593665, 0.521978, 0.793991, 1.294671, 1.207297, 0.813285, 0.405944, 0.506881, 0.786109, 0.815847, 1.307478, 0.692943, 1.344385, 0.531067, 0.773413, 3.101132, 1.615687, 0.831264, 0.394934, 2.717366, 1.307297, 1.250085, 0.734489, 11.430375, 0.526124, 1.450013, 0.939240, 0.877250, 0.709535, 0.930261, 0.761552, 0.520903, 0.725829, 1.661433, 0.895964, 9.541835, 0.881986, 0.361078, 0.766325, 0.822330, 0.721416, 1.266847, 0.533878, 0.399349, 0.574696, 0.914129, 0.484182, 0.235665, 0.800564, 1.292120, 1.931909, 1.751325, 0.466195, 0.423525, 3.256372, 0.825117, 0.912159, 0.436558, 2.127545, 0.795326, 0.416821, 1.140332, 0.227001, 0.823445, 0.809920, 1.402813, 0.385285, 0.483014, 0.659021, 2.619305, 0.820154, 0.506167, 0.378966, 0.525635, 0.871795, 0.787393, 0.739845, 0.784610, 0.497574, 0.543906, 0.556261, 0.277156, 0.369723, 0.686477, 7.072668, 1.303893, 1.203853, 0.558018, 0.790323, 0.380544, 0.252269, 2.078853, 0.838686, 0.960000, 0.547866, 0.210611, 0.767015, 0.492634, 0.281241, 0.629566, 1.103274, 0.604783, 0.487529, 0.900948, 1.735527, 0.532145, 0.392971, 1.380097, 0.506836, 0.481792, 0.735383, 0.527350, 1.248938, 1.361763, 0.843853, 0.286896, 0.427446, 0.784866, 0.774551, 1.285617, 0.837877, 1.436079, 0.534404, 0.227468, 0.784915, 0.540429, 0.308089, 11.650988, 1.437322, 3.111672, 0.274041, 0.381514, 0.576134, 0.761989, 0.484773, 0.309632, 0.793103, 0.239260, 0.727399, 7.874686, 0.770701, 1.191120, 0.910223, 0.470721, 0.953248, 1.294199, 0.532549, 0.237445, 0.742116, 0.790854, 0.769231, 2.462777, 0.942596, 2.344029, 0.545345, 0.370842, 0.758842, 0.770050, 0.790739, 0.383380, 0.488939, 0.720318, 0.546159, 0.849603, 0.786837, 0.798122, 0.781082, 1.738539, 0.802120, 0.539608, 0.331684, 0.809723, 0.567809, 0.551205, 0.803765, 1.434842, 0.508636, 0.486493, 0.536334, 0.488090, 0.491435, 0.805669, 0.666953, 0.559622, 0.569144, 0.523662, 0.555583, 0.543983, 0.526367, 1.355263, 0.525221, 0.178706, 0.340552, 0.735350, 0.764931, 0.305905, 0.573935, 0.766374, 0.795172, 1.950402, 1.013435, 0.188022, 0.924865, 1.333216, 0.526438, 0.635620, 0.547201, 0.304996, 0.591659, 14.359028, 0.579862, 0.401190, 0.263030, 0.547098, 0.596428, 3.652599, 0.636157, 0.877296, 0.518744, 0.202664, 0.524693, 0.390779, 0.534151, 0.515855, 0.581801, 0.717425, 13.578752, 0.626485, 2.398011, 0.770790, 0.478007, 5.303892, 0.531536, 0.838442, 0.544228, 0.763971, 0.805612, 0.540942, 0.765850, 0.528055, 1.656421, 0.535835, 2.148109, 0.581544, 0.593715, 0.155218, 0.497102, 1.554070, 0.653178, 0.656617, 0.754579, 1.441694, 0.751694, 0.335577, 0.752278, 0.538665, 0.666549, 0.489551, 0.306719, 0.766508, 2.485877, 1.346788, 0.552020, 0.790574, 1.261236, 0.552886, 0.377483, 0.860809, 0.703851, 0.125620, 0.468716, 0.518591, 0.775548, 0.690615, 0.783345, 0.524610, 0.515129, 2.183171, 0.703628, 0.775567, 0.783110, 0.559615, 0.380494, 0.904250, 0.509268, 0.374528, 0.784694, 0.531777, 0.407606, 0.509868, 0.868692, 8.126845, 0.571958, 0.386272, 2.079589, 1.567401, 1.083599, 1.614544, 1.279281, 0.499172, 0.530399, 0.414804, 0.310069, 0.390882, 0.367990, 0.519068, 0.875623, 0.503950, 12.918892, 0.491224, 0.524994, 0.774228, 0.167004, 0.137210, 0.181384, 0.369880, 1.196252, 0.520671, 0.853007, 1.709811, 0.991281, 0.229315, 0.551732, 0.533890, 0.743932, 0.546833, 0.941345, 0.527027, 0.535418, 2.604115, 0.328134, 0.161339, 0.420164, 0.319343, 0.529157, 0.796276, 0.391883, 0.754960, 0.831342, 2.050605, 0.239970, 0.263749, 0.388326, 0.776284, 0.514890, 0.490805, 0.768601, 0.411342, 0.482905, 0.328204, 0.847002, 0.387299, 0.514842, 0.570476, 1.067498, 0.191775, 0.740666, 0.347354, 0.831391, 0.551174, 0.809423, 0.533382, 0.536197, 0.846108, 0.270475, 0.333237, 0.546480, 0.538673, 0.893079, 0.800357, 0.383824, 1.596906, 0.363062, 1.154649, 0.788723, 0.037378, 6.134081, 0.740860, 0.540197, 0.529116, 0.305838, 0.195916, 0.562512, 0.541734, 0.880140, 0.770224, 0.656605, 0.385965, 0.534861, 0.380506, 0.546314, 0.678302, 0.822504, 0.297646, 0.462389, 0.768737, 0.747142, 0.739580, 1.407636, 0.848801, 1.096190, 0.824436, 1.159773, 1.987456, 0.363322, 0.354592, 0.524233, 2.095479, 0.376204, 0.410394, 0.558962, 0.520918, 0.796018, 1.283669, 0.654079, 0.056678, 0.311772, 0.668137, 0.590610, 1.024117, 0.525668, 0.518379, 0.388676, 1.772131, 0.403095, 0.321536, 0.403049, 1.503367, 0.525987, 0.806348, 0.845668, 0.935955, 0.907271, 0.257593, 0.129228, 0.319961, 0.505973, 0.754902, 0.451118, 0.546724, 0.383366, 1.903467, 0.345000, 0.374467, 0.259268, 0.525947, 0.641791, 0.547258, 0.564900, 1.954979, 0.532471, 1.832482, 0.562470, 0.508042, 0.510327, 0.542015, 0.768756, 1.709414, 1.323179, 0.373110, 0.516691, 0.878889, 0.512970, 7.145989, 0.523292, 0.476901, 0.485752, 4.618629, 0.290608, 0.616479, 0.812755, 1.523286, 0.495504, 0.823508, 1.246284, 0.366554, 0.146406, 0.209902, 0.276625, 0.920627, 0.446000, 0.744371, 0.545794, 0.909181, 0.286890, 0.528500, 0.723775, 1.165910, 0.757587, 0.389857, 0.507522, 3.250113, 2.172208, 0.902670, 3.151667, 0.233435, 0.283301, 0.327927, 5.105820, 0.394102, 1.450660, 1.097736, 0.556708, 0.789307, 1.469454, 0.772712, 1.256384, 1.140676, 0.844858, 0.538838, 0.835918, 1.457951, 0.329171, 0.497798, 0.694695, 0.570058, 0.528302, 0.525610, 0.810408, 1.280304, 0.407219, 0.550012, 0.559856, 0.361706, 0.560724, 0.382056, 6.459227, 10.434652, 0.534421, 0.875030, 0.407725, 0.880366, 0.353063, 0.545841, 0.514767, 0.664057, 0.786732, 0.789092, 0.812478, 0.384490, 0.956949, 5.020247, 3.337696, 0.320971, 0.772743, 0.286093, 5.227450, 0.563906, 0.705964, 0.547625, 1.247160, 0.475561, 0.496417, 0.527046, 0.465116, 1.143858, 0.485396, 0.841879, 0.540014, 1.867213, 0.662050, 0.231932, 0.387179, 0.456384, 0.498699, 5.521390, 0.308703, 1.308145, 0.833794, 5.357773, 0.523978, 1.040273, 0.401797, 0.474309, 0.681484, 6.422228, 0.741113, 4.054020, 0.938233, 0.554217, 0.555635, 0.318704, 0.140293, 0.258052, 0.506527, 0.304628, 0.354983, 1.726945, 0.527430, 0.899314, 0.525399, 2.411215, 0.320623, 0.851617, 0.508654, 0.884922, 0.379471, 0.526561, 0.547040, 1.484289, 1.881643, 0.323873, 0.441261, 1.191114, 0.530153, 0.871901, 0.538316, 0.752330, 0.482238, 5.723228, 1.502652, 0.137571, 0.560821, 0.761715, 0.532509, 0.499044, 0.507042, 0.542304, 10.360143, 0.837312, 0.381825, 0.498097, 0.518527, 0.586155, 0.533684, 0.240278, 3.294068, 0.119347, 0.535798, 1.155045, 5.205110, 0.545363, 0.316752, 0.651466, 0.834683, 0.872981, 0.384475, 0.120654, 0.297017, 0.792609, 0.354458, 0.557385, 0.362385, 0.900214, 1.895844, 1.449647, 0.315846, 0.951189, 1.413208, 0.272832, 0.525173, 0.353918, 0.067553, 0.572237, 0.831754, 2.295204, 2.032371, 0.547406, 0.854804, 0.386655, 0.816211, 12.951109, 0.369399, 0.519753, 0.307426, 0.368233, 0.376954, 0.208978, 0.555188, 0.825728, 1.942597, 0.528184, 0.272133, 0.541533, 0.497154, 0.507612, 0.762174, 1.888837, 0.495473, 1.008684, 0.254468, 0.541985, 0.413599, 0.392197, 0.760181, 0.128080, 1.213808, 0.632532, 0.518990, 1.292035, 0.535387, 0.531706, 0.504861, 0.506105, 0.259455, 0.378151, 0.854076, 0.526676, 0.600404, 0.495962, 0.798188, 0.081553, 0.509466, 2.819298, 0.920996, 0.286775, 0.334502, 0.553657, 0.519554, 0.382261, 1.421712, 0.529526, 1.628368, 0.506182, 0.820019, 0.535414, 0.534013, 1.916578, 0.889472, 17.922412, 0.334896, 0.382036, 6.442787, 0.526063, 1.317676, 0.483041, 0.390874, 0.480483, 0.219796, 0.806582, 1.477147, 0.720930, 0.405684, 0.364073, 0.760819, 0.609268, 0.281152, 2.203285, 1.727319, 0.506179, 0.728395, 0.761843, 1.307856, 1.291973, 1.127878, 0.535416, 1.051307, 0.725100, 0.455934, 0.493682, 0.886135, 0.253572, 1.494511, 1.498587, 3.049507, 0.312254, 0.426197, 13.046373, 0.535153, 0.972690, 1.345185, 0.896967, 0.759986, 0.813277, 0.533820, 0.185753, 0.297752, 0.554530, 0.342392, 0.407866, 0.378457, 0.757597, 0.531235, 0.912959, 6.172760, 0.233726, 0.508674, 0.469345, 1.221588, 0.414748, 0.813602, 0.561287, 6.061715, 0.181454, 0.227719, 0.388022, 1.115660, 0.526453, 0.429568, 0.536859, 0.400109, 4.186563, 0.533715, 0.375832, 0.253858, 0.408395, 0.950499, 0.377227, 0.456928, 0.759541, 0.556113, 2.916697, 3.852029, 0.355042, 1.174934, 0.311249, 1.304120, 0.835699, 5.097342, 0.416049, 0.328612, 0.521420, 3.939702, 0.776681, 0.543909, 0.681130, 2.021402, 0.623732, 0.380219, 0.728778, 0.773885, 0.669149, 0.497489, 1.227483, 4.234979, 0.343974, 1.330852, 0.805482, 0.510780, 0.436268, 1.079726, 3.358508, 0.292081, 0.242874, 0.788194, 0.314579, 1.026372, 0.786566, 0.553920, 5.046933, 1.378398, 0.642997, 0.790480, 0.506062, 1.247376, 8.113362, 0.840849, 0.394737, 0.519506, 0.536768, 0.917290, 1.571956, 0.682200, 0.573698, 0.808787, 0.840538, 0.855902, 0.385915, 1.073224, 0.454222, 0.405482, 0.503353, 8.610445, 0.796194, 0.824945, 1.200370, 0.927366, 0.871030, 1.788826, 0.358802, 0.520564, 0.398825, 0.481668, 0.653980, 0.797653, 2.266277, 0.497532, 0.151056, 0.364227, 1.698760, 0.571610, 1.265110, 0.480282, 0.607808, 0.269824, 0.279941, 3.275697, 0.808526, 0.274335, 5.048193, 0.508030, 1.297223, 0.878253, 0.555769, 0.281946, 0.198662, 0.087836, 0.849466, 1.270458, 0.430999, 0.536326, 0.528375, 0.851548, 2.085714, 0.562943, 0.507306, 0.842663, 0.297945, 0.757627, 0.405532, 0.416191, 0.521840, 0.752556, 0.629804, 3.981779, 9.675882, 0.951096, 1.262871, 1.443322, 0.048073, 0.538602, 0.369576, 0.205142, 0.845107, 3.480982, 0.793679, 0.531054, 0.388498, 0.385929, 0.519571, 1.521934, 0.391320, 1.485287, 0.828604, 1.291646, 0.575743, 0.269710, 0.520449, 1.052250, 0.483442, 1.195225, 0.550831, 0.655346, 0.431708, 0.553379, 2.542885, 0.952006, 0.371393, 0.667072, 0.504865, 0.461475, 0.532116, 0.839127, 0.559717, 0.797793, 0.550061, 0.335412, 0.324616, 0.657803, 0.380212, 0.897410, 2.144195, 0.379783, 6.461432, 0.820364, 0.262915, 0.533542, 0.635172, 0.522492, 0.778936, 1.293478, 0.327655, 0.670798, 1.021545, 0.563366, 0.533025, 0.364922, 0.797091, 4.115111, 2.335113, 0.207426, 0.231437, 0.239638, 0.347799, 0.535215, 0.538141, 0.506234, 1.213694, 2.350828, 0.173499, 0.672889, 0.990731, 0.587616, 7.535971, 0.412537, 0.522441, 0.495052, 0.506817, 2.026664, 0.436211, 0.907670, 0.551758, 0.292161, 6.482636, 1.721451, 0.503294, 0.800570, 0.766404, 0.513476, 0.772958, 0.783209, 0.639199, 0.540068, 0.814083, 0.380765, 0.024378, 3.328174, 0.678695, 0.622592, 0.869932, 0.539490, 1.898313, 0.378154, 0.938659, 0.533787, 0.536431, 0.500366, 0.960595, 0.522337, 0.051090, 0.516399, 0.754186, 0.523367, 0.543128, 0.347549, 0.517194, 0.689680, 0.957198, 2.284250, 0.366897, 0.529064, 0.539055, 4.412591, 0.784135, 0.770752, 1.361021, 11.205993, 0.560282, 0.983014, 0.309268, 1.197144, 0.413896, 0.386519, 0.577886, 0.495338, 0.558600, 0.928249, 0.215426, 0.516595, 0.538981, 1.180324, 0.828472, 1.691181, 0.404568, 0.397749, 0.808457, 1.271632, 9.305470, 1.219559, 1.247077, 1.526451, 0.241937, 0.783617, 0.523640, 3.335174, 0.644695, 0.381674, 0.383345, 0.783825, 0.369929, 1.615885, 0.872783, 0.537482, 0.630240, 0.520789, 0.573807, 0.544662, 0.207573, 0.919448, 0.497985, 0.390827, 0.537488, 0.546274, 1.285066, 2.342905, 0.649619, 0.356696, 0.907229, 0.321757, 0.545209, 9.237689, 0.562959, 1.658934, 0.397385, 0.786160, 0.506197, 0.763989, 1.288740, 0.500593, 5.522061, 0.631897, 0.579058, 0.049093, 0.473310, 0.981631, 1.305326, 1.335379, 0.931835, 0.544319, 0.743741, 0.703091, 2.651180, 2.199588, 0.548768, 0.493169, 0.934690, 0.370140, 0.221969, 0.512978, 0.889631, 1.877682, 0.270328, 0.536603, 0.192322, 1.127538, 0.611723, 0.544417, 0.751251, 0.402435, 0.360012, 4.741858, 1.011651, 3.078835, 0.585529, 0.481849, 0.387884, 0.707416, 0.512171, 1.417645, 0.872523, 1.425408, 0.571714, 0.511086, 0.410737, 0.524505, 0.525532, 2.661541, 1.779474, 0.752272, 0.550365, 0.840833, 0.335496, 0.662162, 0.415770, 0.865266, 1.672326, 0.313382, 0.390345, 0.890139, 0.538928, 0.407014, 0.516732, 0.525608, 0.898005, 0.171554, 1.706828, 0.394452, 1.185526, 0.551774, 0.396913, 0.804565, 5.117132, 0.537132, 1.918978, 0.249196, 0.486416, 0.523903, 0.563651, 0.361846, 0.557805, 0.309002, 1.457799, 0.535389, 0.861605, 0.518710, 0.650963, 0.573260, 0.486301, 0.400888, 0.508722, 12.927259, 0.553611, 3.192970, 0.558584, 0.284070, 4.817488, 0.893654, 0.515763, 0.483806, 0.373594, 0.820616, 0.214300, 0.553705, 0.743267, 0.510698, 1.314700, 0.509461, 0.567279, 2.412556, 0.886242, 1.136585, 0.849837, 1.313314, 0.795463, 0.776092, 0.804363, 0.539956, 0.801017, 0.930559, 0.323978, 1.272401, 2.961733, 0.918100, 8.634066, 0.521850, 0.837719, 0.612562, 1.295545, 7.508065, 0.545477, 0.334436, 0.550750, 0.845063, 0.366050, 1.272570, 0.832914, 0.767330, 0.389226, 0.304389, 0.682027, 0.713436, 0.180039, 0.915057, 0.923606, 11.180289, 0.520309, 0.777532, 0.497412, 0.340895, 0.401261, 0.315367, 0.398678, 0.228282, 5.871024, 1.083772, 2.229066, 6.591591, 1.112981, 2.234401, 0.655064, 0.593909, 0.820494, 0.527130, 0.854199, 0.545934, 1.208437, 2.113497, 0.389684, 0.539077, 0.393003, 0.542653, 0.852126, 2.173945, 0.693853, 0.308877, 0.860101, 1.084964, 0.170605, 0.172806, 0.544238, 0.880238, 1.235899, 2.654420, 0.769727, 0.545318, 0.541687, 0.665551, 2.310589, 0.478962, 0.539741, 0.674048, 0.554750, 0.523033, 0.353295, 0.801280, 0.313424, 0.200997, 1.265602, 0.537374, 0.507552, 0.818985, 0.791629, 0.854052, 1.490371, 0.175426, 0.255049, 0.383461, 0.501082, 0.556099, 2.006378, 1.217903, 0.427018, 0.581240, 0.341346, 0.768621, 0.503475, 0.925463, 1.879715, 0.559025, 0.839798, 0.326633, 0.178356, 0.758291, 0.942453, 0.481094, 0.689189, 0.738560, 0.811091, 0.770632, 0.183568, 0.398758, 0.453476, 0.531525, 0.625000, 0.290916, 5.990764, 0.251327, 0.947547, 2.198800, 0.214468, 0.508290, 0.773498, 0.881607, 0.938875, 0.436233, 0.549745, 6.146319, 0.391350, 0.152338, 1.284985, 0.450182, 0.816452, 0.372439, 0.535756, 1.211116, 0.340649, 0.657370, 0.271777, 0.362894, 0.683412, 0.398960, 0.310991, 0.873692, 0.310830, 0.531235, 0.306002, 0.340404, 0.856988, 0.880509, 0.812000, 0.854521, 0.638529, 1.237868, 1.395251, 0.391245, 1.412839, 0.385307, 0.419907, 0.939231, 0.407970, 0.656453, 0.830171, 0.683246, 0.278087, 0.310833, 0.164870, 2.389267, 0.562221, 0.517601, 0.762872, 0.225511, 0.376641, 0.790838, 0.784765, 0.333816, 0.579373, 0.589493, 0.866276, 0.638855, 1.425189, 0.360645, 0.400833, 2.155236, 0.762176, 0.744194, 0.553802, 0.179994, 0.398457, 0.658628, 0.888400, 0.571787, 0.520110, 0.533952, 0.647588, 0.586554, 0.543807, 0.919384, 0.312033, 0.499770, 0.832196, 0.558634, 0.514231, 0.236724, 0.384044, 0.288405, 0.351893, 0.539552, 0.386626, 0.749036, 0.623143, 0.274145, 0.760534, 2.390811, 0.732473, 0.494599, 0.378873, 0.903012, 1.348362, 1.650632, 0.286191, 0.307724, 0.562970, 2.426950, 4.015184, 0.563626, 0.346065, 5.143571, 0.228143, 0.742690, 0.483578, 1.303764, 0.615914, 0.741517, 0.226773, 1.760373, 0.712482, 1.393863, 12.204218, 0.510381, 1.223135, 1.293219, 0.942444, 0.972304, 1.150490, 0.276799, 0.187690, 1.345594, 1.360734, 0.556620, 0.804363, 0.241395, 0.265699, 0.225620, 0.275941, 0.795406, 0.538181, 0.783852, 2.178664, 0.354356, 0.584676, 0.827165, 0.270967, 0.560336, 0.492680, 0.624971, 0.887159, 0.315068, 2.914265, 0.402846, 0.833527, 0.414647, 0.506073, 0.396834, 0.525708, 0.334854, 0.961240, 0.466667, 2.963429, 0.529088, 0.528708, 0.550518, 0.911645, 0.419580, 2.609688, 0.746787, 1.308191, 0.607180, 0.683922, 0.467839, 0.099948, 1.370737, 0.812687, 1.311752, 0.514731, 0.581221, 0.312367, 0.189156, 0.489611, 0.872451, 0.593264, 1.723806, 0.316657, 1.060996, 0.767509, 0.188424, 0.490027, 0.578802, 0.531969, 1.988835, 0.529057, 1.311447, 2.201141, 4.014995, 0.086558, 0.255763, 1.439438, 0.539371, 0.572555, 0.578043, 0.926070, 0.540014, 0.176346, 0.246028, 0.514643, 0.687585, 0.177586, 0.393970, 0.551365, 0.888011, 0.543544, 0.578208, 0.523259, 0.314097, 0.196162, 0.543689, 1.361459, 0.785193, 0.435833, 0.275643, 0.646422, 1.586606, 0.467320, 0.497648, 0.530425, 0.389599, 0.199182, 19.449168, 1.294607, 8.059391, 1.379055, 0.677941, 1.355032, 1.173492, 0.346052, 0.174619, 0.401395, 0.559902, 0.502499, 2.689679, 0.902856, 0.446647, 0.885006, 0.796322, 2.862190, 0.780913, 0.503851, 0.385532, 0.760333, 0.835842, 0.761247, 0.761738, 0.788650, 0.466405, 7.712770, 1.824518, 0.740631, 0.817483, 1.916143, 1.329901, 1.591503, 0.483849, 0.482901, 0.721938, 0.448448, 0.808098, 0.760014, 0.807720, 0.491409, 0.836895, 1.251900, 0.739536, 1.349965, 0.273473, 0.511237, 0.343901, 0.819620, 0.498659, 0.807473, 0.747088, 2.008282, 0.102726, 1.673703, 3.950123, 1.046402, 1.790825, 0.834331, 12.841438, 18.526845, 1.420329, 0.493711, 0.525917, 0.796869, 1.242517, 0.218977, 0.576381, 0.373963, 1.987466, 1.322226, 0.802156, 0.808534, 2.765882, 0.271753, 0.380568, 0.396726, 1.898112, 1.319449, 0.778547, 0.743243, 1.775340, 0.688166, 0.737395, 1.074252, 1.894900, 0.776000, 4.398352, 0.498286, 0.409530, 0.519991, 0.793764, 2.508901, 0.776206, 0.727015, 0.383513, 0.312484, 0.910826, 0.820942, 0.765136, 0.497236, 0.730696, 1.290223, 0.342866, 1.248599, 1.801053, 0.751381, 0.512704, 1.620813, 0.343174, 0.803267, 0.049379, 0.508540, 1.445946, 0.198677, 2.135087, 8.086014, 0.819171, 0.276476, 21.157687, 0.499887, 0.500820, 1.285225, 1.019111, 0.499432, 0.500591, 2.018175, 0.558870, 0.765029, 0.280674, 1.272662, 0.505824, 0.773854, 1.900181, 0.832935, 11.588133, 0.900967, 1.055131, 0.502088, 3.539795, 1.145847, 0.740371, 0.776845, 0.805291, 0.738601, 0.796329, 3.947126, 0.510658, 0.373256, 0.522500, 1.828591, 3.868097, 0.503795, 1.169202, 0.207611, 1.766040, 0.810388, 0.499886, 0.668621, 0.412066, 1.132749, 3.282238, 0.776343, 0.778947, 1.294903, 0.558858, 0.507346, 0.504360, 4.292768, 3.174581, 0.822738, 0.496369, 0.510414, 1.034715, 1.833212, 0.828276, 1.877899, 0.764354, 1.305703, 0.775856, 0.560981, 0.756940, 0.778650, 2.197227, 0.734035, 0.457491, 0.824629, 0.106599, 0.779661, 0.802569, 1.794051, 1.309726, 0.709405, 2.991676, 1.940638, 2.764954, 0.758234, 0.434333, 0.837111, 0.916979, 0.728905, 2.198115, 0.386217, 0.489453, 2.291172, 1.862141, 1.277604, 0.515021, 1.146907, 0.540912, 0.510105, 0.751209, 1.250647, 0.775096, 0.067341, 5.278900, 0.490290, 0.762053, 1.196185, 0.328092, 0.478798, 0.777427, 0.770328, 0.530374, 0.453870, 0.461864, 0.405223, 0.819164, 1.172367, 7.254496, 0.494256, 1.373790, 7.833707, 0.811018, 2.777111, 1.777939, 1.319059, 0.992277, 1.828239, 0.384615, 0.521802, 0.863060, 0.375127, 0.719340, 0.908036, 0.179537, 0.535413, 0.471367, 0.818502, 1.420463, 0.383424, 0.843959, 0.441842, 0.141713, 1.364187, 1.308276, 0.779090, 0.775681, 0.524582, 0.808390, 0.731952, 1.263416, 1.308496, 1.094385, 0.514988, 0.505207, 0.678536, 0.733622, 0.713307, 0.249163, 1.343371, 1.161361, 0.802491, 0.719372, 0.840964, 0.494294, 4.631506, 0.155717, 1.274376, 1.279823, 0.823453, 1.242445, 0.417676, 0.509124, 0.971363, 0.232215, 0.731425, 2.006233, 0.713568, 0.456277, 4.683815, 0.690772, 1.292847, 2.115307, 0.879677, 0.631329, 0.781851, 10.599621, 1.462380, 0.784314, 1.260598, 0.190141, 1.140387, 1.344320, 3.057706, 1.408690, 0.506147, 0.516316, 1.675270, 0.757302, 0.655445, 0.893939, 2.943617, 1.373898, 0.877185, 0.794516, 0.813937, 0.170884, 1.323675, 1.327788, 0.750693, 0.777010, 0.403898, 1.308458, 1.192348, 0.229071, 0.522541, 0.404858, 0.756902, 0.731046, 1.881565, 2.562902, 4.083959, 0.481757, 0.906277, 0.523264, 0.552495, 0.759608, 2.226793, 1.353754, 0.140764, 2.004688, 0.360019, 0.874774, 0.764706, 0.522413, 0.439815, 0.907204, 0.503189, 0.164600, 0.710688, 1.701035, 2.800681, 0.792181, 6.398540, 2.072053, 0.483974, 0.507556, 5.707586, 4.365136, 0.149388, 0.748621, 1.257273, 0.792519, 0.808456, 0.378165, 0.794396, 1.330717, 0.234207, 0.595552, 1.082892, 1.282350, 1.405631, 1.242076, 0.492085, 0.899125, 0.189864, 1.000685, 0.833271, 3.836192, 1.334051, 0.771084, 0.498685, 2.566598, 0.254051, 0.815194, 0.804076, 8.892622, 0.817666, 4.972502, 0.533505, 0.960124, 0.480973, 1.291382, 4.426743, 0.796898, 1.224109, 0.767293, 0.812500, 1.890587, 0.502973, 0.760000, 0.170184, 0.039872, 0.821416, 0.756813, 1.066445, 0.842884, 0.658758, 0.735414, 1.263563, 0.717033, 0.749648, 2.189625, 0.756682, 0.749657, 0.518398, 0.499099, 0.456805, 0.453873, 0.772687, 2.961161, 0.259671, 1.874549, 0.516313, 0.797051, 0.751963, 1.249037, 0.792113, 0.469746, 0.406020, 1.696918, 4.576431, 0.825820, 0.710650, 0.814787, 0.832536, 0.782790, 0.593975, 0.506170, 0.849654, 0.755233, 0.849709, 0.851048, 0.750261, 0.488196, 0.170515, 0.885068, 1.804203, 4.247986, 0.644199, 0.465722, 0.499545, 0.794212, 2.748698, 0.850295, 1.070534, 3.312602, 1.259840, 1.287564, 0.506353, 0.461400, 0.471541, 0.760098, 1.342466, 0.521286, 0.528868, 0.223696, 0.755668, 0.746116, 8.000885, 0.453806, 0.954980, 0.778955, 1.342543, 0.788904, 12.418823, 0.792432, 0.509235, 0.844799, 0.910587, 0.875567, 1.786849, 0.415735, 0.377657, 0.505880, 0.838745, 0.104300, 0.876813, 0.831166, 0.363264, 0.505539, 2.417843, 1.217529, 0.207928, 0.871580, 0.550976, 1.126235, 0.741824, 0.803462, 0.806152, 0.728561, 0.208604, 0.799422, 1.167552, 0.483156, 1.967786, 0.399927, 0.733558, 0.397941, 0.753065, 1.368881, 1.342389, 0.525561, 0.801051, 0.764256, 4.309189, 4.293913, 0.725464, 0.812701, 11.156284, 2.319902, 1.299818, 1.701524, 1.118251, 0.487516, 3.802320, 0.192924, 0.380142, 0.747122, 0.540547, 0.403645, 0.717119, 1.637925, 5.051111, 1.186151, 1.908598, 6.081808, 2.095715, 1.375395, 0.579708, 3.776025, 0.495610, 1.150965, 0.520488, 2.196584, 1.325936, 0.493081, 0.515242, 0.785714, 0.763422, 1.939459, 0.530902, 0.750356, 0.821338, 0.795208, 0.762509, 7.499827, 0.748408, 0.750177, 0.711919, 0.548383, 0.805536, 0.839151, 0.771911, 0.470109, 0.788727, 1.528626, 3.600789, 3.813489, 0.600381, 1.379144, 0.802928, 0.830576, 0.829155, 0.795646, 3.308154, 3.675184, 0.675824, 0.508687, 0.724789, 1.406550, 0.828674, 3.839785, 0.806196, 0.883321, 0.508315, 0.383699, 0.494397, 1.131176, 4.606952, 0.644008, 0.390994, 1.421799, 0.783830, 1.805722, 0.473411, 0.787751, 0.330313, 0.443514, 1.854251, 0.898540, 0.361359, 1.286795, 0.508613, 0.735395, 1.293854, 0.861746, 0.715808, 1.124955, 0.808425, 1.362558, 0.810811, 0.511289, 0.352229, 0.497171, 1.377714, 0.678407, 0.760524, 1.271329, 0.822371, 0.499438, 1.963252, 2.808455, 0.779449, 0.444683, 0.505371, 0.478858, 0.795975, 1.206371, 1.056556, 0.449909, 0.778456, 4.226529, 2.251991, 1.336496, 1.894049, 0.771572, 0.822260, 0.746321, 0.838197, 0.880524, 0.788243, 1.196751, 0.726752, 0.796774, 0.227557, 0.754076, 1.678314, 1.191104, 0.795613, 0.837700, 9.932604, 0.853603, 0.743689, 0.504317, 0.375463, 0.773835, 0.737406, 0.805115, 0.800230, 1.319625, 2.608744, 1.688604, 1.751888, 0.268805, 0.758076, 0.751346, 0.692874, 0.238608, 0.789545, 1.310734, 2.414779, 1.847355, 1.803431, 0.762272, 0.313855, 0.754697, 0.765845, 0.782562, 0.843908, 0.843246, 0.870163, 0.332081, 0.408628, 1.207143, 1.366322, 0.440120, 0.820503, 0.754584, 1.509464, 2.102926, 0.695763, 1.245361, 0.561198, 0.504762, 0.513495, 2.971861, 1.245513, 0.860457, 0.819137, 0.535490, 0.745429, 0.657550, 2.421941, 0.845764, 2.029616, 0.777508, 0.788055, 1.005337, 1.281725, 1.280727, 32.289026, 0.362084, 1.329420, 0.752221, 1.554149, 0.886621, 0.986586, 8.460193, 0.809302, 1.324214, 0.808945, 0.790494, 0.795109, 0.696466, 0.756140, 0.444935, 0.360345, 1.436280, 0.394784, 0.753197, 9.047522, 1.697682, 0.490143, 0.258137, 0.773210, 1.948962, 1.264716, 0.683216, 1.000186, 0.803301, 0.780057, 0.260999, 1.167918, 0.997307, 4.754121, 0.757938, 0.759005, 0.821183, 0.596610, 0.786988, 0.381666, 0.274223, 1.270438, 0.734364, 0.789435, 0.993987, 11.337410, 1.816623, 0.839574, 0.797331, 0.388840, 0.749388, 0.433687, 1.602206, 0.844708, 0.519554, 0.771866, 0.836682, 0.817587, 1.366557, 0.698040, 0.864611, 1.481678, 0.485543, 0.844606, 0.294669, 0.733684, 0.833395, 18.334308, 4.357291, 2.284259, 2.135465, 0.795423, 0.613163, 0.474293, 0.387491, 0.314883, 1.408090, 1.541813, 1.977096, 1.190883, 0.773850, 0.749654, 1.913423, 0.460264, 0.813459, 0.506400, 0.778979, 1.675018, 1.189411, 1.381440, 0.594183, 0.700065, 0.503547, 0.709011, 1.089322, 1.582730, 0.401835, 1.294562, 0.798892, 10.922680, 0.771468, 0.792700, 0.427928, 0.756071, 0.842584, 0.800213, 1.270636, 0.781405, 0.804223, 3.310617, 1.323439, 0.821889, 0.321577, 0.885110, 0.721996, 10.835804, 0.519802, 0.747394, 0.450828, 0.501137, 0.764014, 0.773977, 0.650394, 0.646049, 0.359538, 1.834442, 0.777778, 1.396887, 0.308749, 0.797076, 0.735908, 1.290763, 1.348389, 0.806107, 0.739400, 0.391583, 0.503431, 0.430537, 0.399262, 1.290390, 0.777229, 1.078919, 1.421713, 1.240329, 0.764349, 0.289819, 1.281451, 5.587368, 0.839703, 0.801635, 0.769774, 7.635424, 0.465163, 1.180785, 1.449403, 0.801034, 0.827116, 0.493515, 0.750693, 0.733684, 0.747230, 0.742312, 0.802472, 4.462310, 0.647565, 0.551825, 0.535094, 0.802435, 0.495404, 1.199661, 0.815287, 1.852696, 1.293870, 1.048554, 2.878276, 0.826715, 0.772858, 0.256844, 1.405842, 0.737061, 0.503787, 0.631184, 0.720547, 1.233803, 1.718822, 0.773094, 0.769873, 0.470038, 0.809311, 0.834538, 0.752904, 39.455997, 0.322747, 0.801066, 0.801920, 0.805596, 0.832340, 0.808735, 1.320144, 1.135287, 1.192716, 0.270274, 0.700327, 0.757153, 3.595117, 0.498262, 0.788802, 0.789934, 1.446397, 0.799169, 1.836186, 2.133055, 0.505222, 0.366563, 4.780395, 0.991312, 0.805036, 0.422190, 1.522981, 0.809025, 0.206887, 0.478789, 0.415635, 3.410704, 4.977551, 0.292425, 14.021482, 0.164539, 0.243467, 1.236072, 0.491734, 0.744768, 2.752789, 1.248502, 0.820475, 3.405435, 41.979941, 1.079664, 0.724603, 0.756397, 0.797250, 0.729001, 1.281636, 1.319193, 0.845117, 0.514325, 0.798117, 0.773497, 0.314286, 1.337727, 1.317727, 0.801103, 0.918549, 2.412844, 0.764460, 0.814696, 0.307022, 0.503333, 0.792123, 5.989310, 0.560788, 1.492530, 1.286527, 0.830521, 0.869507, 9.201342, 2.954848, 0.827279, 0.752212, 2.050539, 1.390524, 0.874168, 0.466767, 1.364543, 0.494822, 0.379580, 0.774160, 0.764767, 0.260495, 0.486156, 0.830728, 0.783719, 2.253160, 0.865583, 0.514633, 1.421458, 1.373443, 0.502224, 0.256949, 0.747485, 0.793030, 0.676682, 0.778795, 0.825499, 0.803302, 0.734130, 0.523502, 0.701487, 0.563265, 0.745050, 0.742391, 0.509637, 0.769069, 0.809982, 1.209339, 14.314952, 9.122287, 0.786657, 0.753556, 0.763410, 0.784720, 0.750000, 1.501035, 0.610379, 0.791029, 0.441705, 0.543394, 1.296907, 1.082508, 0.736525, 0.794746, 0.809336, 1.000363, 0.459016, 1.702904, 0.816355, 0.434198, 0.635282, 0.384548, 0.262698, 6.638223, 0.687754, 1.071403, 0.468426, 1.294661, 0.765965, 0.805797, 1.264413, 7.180732, 0.773347, 0.751146, 0.750712, 0.829803, 0.844933, 1.108162, 1.401028, 0.780865, 0.506003, 0.818162, 0.652981, 0.203769, 0.408485, 0.838473, 1.286257, 0.877721, 0.806452, 10.717560, 0.461380, 0.822150, 0.681137, 3.610039, 1.235356, 0.795479, 10.323934, 1.305256, 0.735472, 1.294391, 0.517886, 0.821903, 0.800993, 0.464358, 1.249744, 0.804878, 0.831140, 1.152791, 0.740184, 2.438904, 0.768069, 0.750961, 1.490967, 0.754429, 0.762020, 0.299433, 0.811370, 1.741947, 0.809084, 0.791385, 1.781089, 0.842117, 1.200363, 0.951004, 0.939394, 0.838924, 0.767426, 0.820268, 0.791105, 1.346591, 1.886550, 0.475105, 0.267572, 8.605511, 0.779365, 0.381903, 0.700222, 0.667816, 1.734467, 1.582987, 1.267794, 0.763016, 0.793166, 1.180082, 0.777229, 0.850107, 0.509768, 0.749912, 0.783095, 0.810118, 0.785865, 1.258232, 0.502517, 0.496886, 7.174284, 0.820697, 0.708379, 2.279796, 0.825275, 1.301808, 1.653576, 0.761084, 0.807191, 1.305108, 0.810714, 0.507104, 0.794402, 0.828385, 0.797468, 0.598866, 0.733223, 1.280851, 0.470640, 0.729215, 1.393291, 3.399434, 0.493536, 0.288471, 0.796377, 12.552126, 0.762024, 0.468582, 2.362593, 2.246780, 0.837662, 0.792217, 0.821976, 0.778599, 0.801621, 1.262116, 0.790101, 0.687274, 0.378671, 0.638830, 0.821583, 0.808534, 0.546461, 9.498340, 1.119192, 3.684785, 2.456195, 1.454225, 0.780514, 0.367312, 0.823330, 4.497173, 17.593895, 0.482712, 1.426901, 0.788786, 0.819489, 0.338643, 0.719558, 0.751524, 0.903045, 0.780274, 1.298678, 0.785387, 1.674891, 0.338963, 0.628325, 0.894003, 1.321881, 0.301125, 1.037907, 0.507816, 0.812988, 1.942119, 0.797781, 0.770160, 1.956189, 0.796110, 1.266340, 1.825653, 0.838763, 1.048115, 1.385759, 0.534582, 1.960159, 0.712287, 0.825645, 1.676201, 0.573162, 0.383544, 0.480399, 0.796598, 0.752692, 0.769175, 0.495937, 0.491829, 0.270896, 0.769479, 0.864142, 0.787772, 0.825000, 0.526800, 0.407689, 2.047550, 0.802920, 1.020189, 2.224945, 3.712373, 1.228235, 0.866533, 0.260860, 2.175518, 0.804651, 0.476148, 0.990428, 0.512556, 1.732482, 0.356162, 1.441876, 0.851048, 0.827586, 1.008872, 1.271315, 0.303297, 1.552518, 1.772017, 0.252792, 1.869319, 1.253204, 0.823399, 1.892146, 0.512347, 1.295151, 1.461579, 6.173883, 2.261011, 1.807161, 0.515207, 0.733220, 0.523610, 0.547071, 0.760713, 0.834246, 0.777507, 0.271536, 0.772632, 0.769231, 0.746071, 1.072500, 1.799508, 0.268139, 1.034981, 0.828694, 12.790510, 0.789250, 1.253566, 0.796317, 0.734594, 0.794598, 1.386845, 1.321786, 0.770294, 0.463704, 0.744747, 0.813008, 0.808792, 0.622831, 0.411686, 4.371717, 0.784599, 0.740085, 4.372640, 0.486605, 1.345455, 0.803319, 1.662088, 3.038274, 1.517123, 0.552406, 0.823293, 1.376990, 0.513394, 0.796200, 1.786552, 0.059759, 0.271357, 0.479440, 0.427364, 0.453500, 0.838583, 0.700436, 1.313607, 0.768203, 0.272306, 1.657028, 0.785867, 0.770527, 1.857539, 0.842826, 1.413067, 1.439421, 1.281427, 2.228138, 0.794329, 3.622150, 0.978819, 0.788909, 1.262859, 1.548705, 0.530898, 0.762807, 0.787234, 0.774485, 0.822079, 0.494663, 1.270819, 0.745893, 0.741641, 15.815489, 0.829609, 0.398302, 0.514098, 0.311989, 0.523182, 0.482944, 0.403943, 0.086191, 2.296774, 4.588261, 0.809117, 0.801998, 3.563636, 0.877106, 3.018365, 3.773029, 6.400358, 3.085102, 2.098400, 0.882643, 0.234712, 7.784244, 0.030336, 0.109209, 0.657923, 2.492456, 0.761921, 17.335501, 0.227666, 2.857751, 0.817880, 0.789548, 0.764644, 0.857294, 0.826972, 0.801903, 0.750683, 0.723517, 0.609663, 0.387719, 0.747301, 0.900045, 0.890819, 0.744696, 0.747122, 0.774135, 0.579940, 0.441350, 0.890462, 0.764418, 0.778481, 4.636396, 0.750085, 0.363772, 0.754795, 0.770503, 0.755338, 0.514922, 0.522170, 0.786228, 0.796616, 0.788929, 0.830314, 1.345377, 0.866080, 0.775418, 1.305477, 1.267648, 7.514317, 0.505510, 0.467888, 1.210435, 0.780497, 0.320339, 0.496239, 0.612126, 3.060050, 0.790294, 0.799355, 0.745763, 1.197920, 0.767498, 0.767666, 0.651989, 1.377851, 0.189329, 0.747803, 7.882536, 0.502374, 0.758868, 0.505454, 0.776659, 0.822794, 0.795147, 0.482316, 0.384717, 1.199004, 0.505107, 0.810978, 0.727525, 1.395357, 0.899557, 2.449653, 0.231339, 0.435108, 0.357833, 0.501051, 13.169066, 0.786605, 1.492259, 0.829588, 1.330401, 1.202384, 0.416393, 0.505951, 0.285479, 0.512453, 0.560301, 0.474952, 0.769438, 1.824409, 0.612561, 1.890457, 0.098274, 0.501118, 0.796485, 0.921547, 0.816377, 1.327756, 1.803913, 2.524269, 0.794212, 0.533252, 1.331884, 1.228787, 0.692135, 0.879757, 0.824176, 0.572159, 6.540994, 0.414925, 0.550649, 0.872764, 0.787017, 0.666205, 2.333223, 1.032033, 0.807650, 0.848064, 0.593275, 0.791307, 1.334156, 1.282466, 0.776795, 0.790379, 0.794621, 0.341280, 0.397016, 1.076410, 0.868510, 0.860881, 0.768344, 1.296659, 0.489687, 0.780412, 0.700817, 0.749658, 0.533891, 0.759355, 0.756311, 0.376103, 0.811736, 1.789456, 1.379459, 4.640235, 0.826577, 1.246771, 1.356293, 1.211234, 0.820312, 0.771769, 0.478746, 1.721289, 2.172041, 3.056890, 0.756013, 0.771709, 2.494155, 0.499664, 0.366922, 2.241179, 0.460547, 0.882132, 0.516844, 0.794817, 0.540944, 0.800770, 0.494416, 1.329601, 0.809473, 0.259188, 0.446258, 1.301821, 0.819394, 1.166064, 0.726032, 15.350917, 0.819303, 1.211401, 1.354507, 0.682018, 0.830557, 0.800074, 0.792058, 0.834955, 0.491385, 1.417122, 0.338303, 1.906283, 0.499778, 0.723962, 0.505085, 0.821416, 1.747644, 0.797552, 0.212692, 0.798080, 1.296436, 0.333934, 0.558145, 0.515363, 1.251651, 3.292371, 1.958918, 3.398828, 0.487278, 0.517011, 1.316429, 0.822357, 0.787280, 0.376997, 0.217019, 0.727854, 1.291379, 1.219251, 1.149553, 0.778198, 0.844527, 0.315252, 2.975000, 0.486102, 0.775027, 0.404901, 0.711441, 0.746690, 0.059018, 0.848179, 1.281987, 1.146372, 0.497165, 2.247020, 0.498962, 0.700339, 0.433705, 1.185422, 0.702135, 0.747260, 2.652778, 0.776770, 1.282089, 0.501694, 0.465142, 0.517379, 1.479159, 0.763064, 0.401553, 1.842749, 0.591508, 0.863409, 1.352748, 0.767346, 3.244118, 0.531737, 1.001322, 0.685514, 0.515403, 0.812569, 1.765043, 0.775788, 0.829635, 0.387979, 0.179218, 0.487714, 0.745899, 4.433760, 0.841616, 0.517697, 0.322987, 0.526774, 0.693730, 0.217288, 0.480067, 0.763624, 0.766532, 0.503050, 0.508643, 0.830277, 0.806022, 2.574750, 0.747090, 1.416048, 0.539928, 1.321879, 0.749655, 0.271370, 0.815233, 0.878213, 0.335236, 0.754448, 0.774579, 0.779868, 0.908702, 0.771202, 0.359003, 1.274254, 0.548267, 0.775632, 0.198696, 1.237462, 2.948015, 0.315414, 0.243476, 0.285613, 0.756588, 0.741509, 0.852790, 0.536336, 0.811139, 0.851622, 0.483371, 1.248046, 0.767870, 0.772318, 0.055735, 1.206025, 0.536743, 0.765303, 0.657411, 1.876840, 0.759253, 1.352208, 0.830209, 1.294303, 0.714731, 0.932463, 0.559393, 0.828981, 2.385746, 0.765432, 0.495084, 1.719945, 0.790631, 0.761127, 0.424359, 0.378285, 0.839214, 0.358786, 0.526967, 0.857047, 0.702720, 0.818034, 0.715264, 1.687072, 0.819213, 0.787151, 0.790132, 0.317541, 0.805599, 1.278237, 0.714689, 7.726969, 0.735345, 0.687286, 0.724764, 0.751683, 0.825914, 2.105649, 0.522166, 1.392471, 0.773118, 0.844329, 0.717700, 0.143250, 1.180532, 0.550636, 0.413984, 1.752482, 0.553120, 0.317250, 0.809025, 0.727520, 0.785380, 1.152872, 0.404771, 1.590699, 0.816989, 0.810388, 0.810859, 7.501604, 1.758253, 1.286058, 0.298032, 0.842376, 0.797112, 0.384036, 0.746010, 1.229102, 1.378683, 1.101444, 0.790936, 0.555918, 1.315667, 1.288704, 0.800995, 0.808288, 0.788223, 0.802039, 3.146004, 0.786460, 0.269681, 0.767603, 1.221311, 0.768490, 0.265077, 1.334028, 0.543081, 0.670282, 7.940243, 0.826428, 5.284135, 1.135973, 0.779590, 0.493943, 0.784391, 0.175365, 1.563953, 0.749787, 0.892624, 0.774194, 0.764188, 0.892914, 0.754240, 0.765603, 1.405589, 0.830996, 0.199778, 0.808398, 0.806186, 0.771574, 0.058531, 0.779033, 0.791094, 1.255757, 1.225595, 1.268293, 0.817863, 0.785004, 0.390159, 1.303083, 0.802080, 1.341367, 0.805922, 0.638991, 0.819365, 0.806303, 0.745328, 1.365515, 0.837389, 1.314105, 0.785235, 1.630766, 0.782339, 0.987197, 0.536692, 0.826647, 0.781756, 0.425786, 5.386023, 0.856942, 1.854020, 0.760977, 0.397840, 0.755363, 0.972338, 0.525964, 0.700159, 0.846438, 1.554470, 0.770143, 0.738340, 0.774913, 1.184255, 0.754508, 0.302090, 0.895804, 2.636139, 1.023599, 0.797684, 0.551429, 0.532464, 2.012491, 0.818310, 0.209222, 2.310940, 0.524851, 0.869180, 1.390184, 0.873169, 1.771222, 1.468283, 0.897182, 0.454887, 0.761608, 0.539282, 1.412172, 0.760262, 0.551870, 0.357892, 0.742754, 0.279084, 0.768454, 12.607953, 0.893997, 1.365114, 4.082785, 0.840158, 0.368251, 0.499567, 0.823107, 1.731962, 0.851311, 0.699115, 0.492204, 0.863753, 1.137915, 2.555634, 0.825914, 0.754493, 0.315663, 0.520293, 8.108854, 0.821598, 0.502630, 0.390926, 0.863524, 0.546074, 1.972616, 1.274718, 0.761388, 0.766667, 0.787463, 0.754211, 0.258714, 1.903308, 0.832103, 0.844165, 0.510619, 4.630884, 1.716509, 0.520375, 0.278435, 0.927067, 0.838442, 0.816577, 0.560767, 0.826972, 0.520657, 0.566185, 0.778325, 1.818214, 0.468185, 1.213137, 0.530793, 0.826965, 0.818383, 0.784139, 0.303583, 0.088862, 0.742477, 0.270293, 0.867072, 0.219628, 0.776671, 0.514565, 0.871199, 0.741379, 1.950000, 0.568537, 1.162690, 0.778126, 2.859199, 0.378355, 0.747579, 0.788578, 3.015739, 0.880220, 1.608836, 1.449304, 1.324895, 1.811383, 1.365280, 0.485895, 1.184502, 0.498649, 1.712366, 0.790836, 0.756719, 0.773725, 0.725424, 0.363840, 0.366547, 0.302781, 0.787659, 0.783626, 0.836941, 9.119879, 0.828903, 6.716845, 2.055437, 0.772550, 0.144464, 0.710544, 0.801827, 1.281625, 0.798364, 1.705291, 1.100979, 1.339298, 0.257034, 0.515409, 1.402055, 0.860304, 0.798966, 0.852302, 0.392907, 0.803656, 1.104331, 0.469837, 0.512873, 0.300638, 0.767630, 0.498948, 0.764607, 0.548585, 0.302966, 0.369048, 1.210418, 1.773272, 8.508348, 1.226616, 10.686395, 1.333452, 1.197077, 0.496634, 0.186095, 1.319053, 0.393722, 1.316420, 0.492136, 11.459608, 0.808125, 0.897004, 0.481416, 1.835795, 0.837619, 0.817792, 0.490005, 4.159812, 0.874064, 10.369119, 8.774272, 0.413422, 3.992808, 1.809775, 1.025034, 0.760300, 1.086778, 1.276119, 4.319380, 4.237894, 0.371849, 1.964324, 0.817263, 3.089181, 1.272854, 0.803337, 0.419617, 0.810129, 10.945077, 0.697190, 8.846491, 1.962489, 0.935296, 0.720391, 1.825079, 0.775357, 0.793008, 0.453399, 2.649638, 1.323156, 0.696781, 2.590958, 0.906192, 0.312517, 0.319695, 0.755065, 1.231695, 1.307638, 0.814114, 0.489019, 3.003975, 1.824511, 0.498436, 1.372846, 0.390933, 0.741355, 0.864793, 2.245771, 0.477645, 1.196187, 0.498628, 0.512575, 0.795527, 2.206983, 0.401457, 0.552386, 0.822301, 0.189557, 0.683024, 0.837767, 1.293581, 0.279504, 1.944269, 0.479492, 0.273241, 0.724196, 0.492726, 0.749117, 1.383420, 0.519703, 4.258756, 0.467624, 9.319766, 0.283717, 0.215669, 0.515614, 0.403385, 0.519812, 0.720527, 1.821965, 0.581233, 0.210055, 0.304214, 0.510186, 0.766726, 1.478447, 0.536529, 3.187542, 2.556694, 0.510078, 0.976147, 0.523733, 1.269448, 0.573067, 0.775180, 5.314155, 0.636343, 1.240066, 1.475575, 0.783029, 0.237341, 2.781063, 0.353030, 0.470074, 0.312808, 0.699702, 0.670310, 3.410389, 1.818375, 0.718276, 0.831159, 7.593505, 11.681616, 0.417485, 11.687601, 0.383442, 4.396155, 0.093770, 0.507671, 0.715764, 0.800882, 0.533988, 0.825118, 0.801859, 0.805148, 0.767492, 0.832782, 2.647300, 0.413615, 0.743750, 0.837987, 0.839143, 0.541055, 0.480610, 1.290628, 0.369512, 1.313114, 0.471836, 0.408303, 8.187095, 0.798307, 1.838680, 0.854128, 0.409427, 0.808808, 0.787911, 10.365488, 0.771833, 0.488233, 0.496486, 1.375685, 0.756621, 0.782851, 0.834483, 0.510021, 0.617776, 1.830078, 0.833393, 0.269895, 1.791106, 0.808724, 1.253536, 0.480097, 0.801524, 0.795276, 2.782103, 1.071334, 1.016577, 5.827765, 1.055959, 14.122874, 0.550562, 0.544909, 0.529533, 1.509911, 1.693537, 0.622036, 1.061454, 1.475967, 0.856681, 1.290265, 0.802709, 0.531532, 2.104414, 0.460133, 0.791060, 0.818182, 0.573742, 0.785490, 0.775350, 0.498776, 0.509655, 0.823778, 0.763326, 0.484145, 0.504921, 0.513520, 0.514566, 0.246750, 0.802870, 1.348138, 0.496555, 0.487314, 0.501203, 0.778179, 0.394866, 0.514934, 0.475531, 0.771529, 0.788840, 0.757682, 0.617131, 1.912761, 1.246753, 0.794677, 1.164406, 0.773171, 0.742461, 0.774262, 1.352257, 1.330663, 0.886270, 0.391468, 0.757534, 0.786537, 1.754644, 1.287408, 0.263433, 0.228946, 0.802206, 0.778853, 1.073503, 0.793495, 0.549933, 1.539779, 0.840072, 0.753618, 0.786045, 0.750429, 0.537901, 0.527998, 0.834352, 0.553831, 3.619314, 0.389565, 0.828815, 0.505402, 0.754514, 0.795518, 0.865372, 0.945458, 0.549836, 0.253403, 0.810469, 0.622107, 0.487150, 2.496310, 0.499460, 1.383339, 0.754967, 0.823636, 0.781272, 0.909091, 0.780488, 1.206974, 8.040908, 0.513146, 0.481506, 0.658085, 2.139092, 0.758128, 0.780409, 2.719161, 0.755952, 0.857404, 0.415365, 0.813444, 0.312490, 0.803098, 0.836449, 0.363761, 0.820092, 1.396848, 1.881678, 0.780546, 0.174456, 1.193515, 0.726097, 2.347685, 1.283316, 0.781193, 1.820136, 0.244891, 0.467009, 0.391413, 2.534223, 0.724350, 8.540198, 0.859585, 0.782548, 0.786455, 0.962666, 0.776330, 1.280677, 0.384522, 0.179462, 0.486400, 0.784417, 1.812942, 0.876458, 0.772962, 1.346112, 1.153159, 0.437708, 0.478988, 5.865364, 0.794928, 0.635703, 0.524739, 0.097135, 0.796113, 1.381541, 1.312388, 2.413220, 0.059996, 2.324074, 0.769203, 0.782272, 0.744361, 0.787848, 10.026478, 0.318377, 0.549038, 0.901014, 2.241708, 1.194895, 0.292703, 0.553717, 0.511308, 0.843478, 1.285662, 0.925114, 0.282670, 0.851877, 0.981635, 0.504417, 0.709259, 0.820430, 0.824098, 2.268430, 0.732993, 0.528319, 0.504390, 1.225372, 0.540942, 0.758752, 0.748877, 0.544974, 0.722683, 0.821006, 1.348582, 0.819505, 0.261356, 1.346860, 1.303956, 0.545390, 1.183645, 0.415994, 0.566112, 2.565591, 1.260930, 1.314591, 0.747257, 1.366156, 0.478568, 4.400524, 0.398299, 0.839424, 0.283323, 0.799495, 0.816304, 0.467393, 0.790415, 0.763655, 1.766631, 2.255936, 1.801712, 0.823223, 3.195045, 2.396393, 0.816926, 0.750350, 2.299180, 0.812041, 0.747603, 0.820875, 0.276538, 0.845961, 0.405934, 1.298120, 0.526886, 1.179402, 0.823093, 0.564520, 0.747463, 0.776726, 0.766008, 0.746809, 0.426104, 1.286171, 0.366972, 0.432841, 0.338124, 0.736140, 2.172241, 1.305449, 0.248490, 0.573051, 2.236519, 0.553160, 0.774470, 0.420699, 9.658351, 1.357614, 1.278897, 0.775826, 0.372211, 1.343706, 0.801850, 0.806856, 0.769558, 0.786325, 0.325234, 1.315372, 0.718112, 3.860393, 0.814286, 0.491763, 2.197738, 8.890896, 1.270355, 0.515732, 1.154507, 1.203315, 2.531315, 0.805732, 0.821608, 0.780885, 0.794526, 0.504977, 0.370072, 0.495498, 0.462543, 0.890943, 0.794336, 0.788671, 2.737456, 0.775952, 0.518652, 0.430047, 0.746315, 0.521414, 1.010747, 1.211477, 0.744586, 0.696913, 0.963528, 0.527113, 0.809403, 0.734424, 0.849872, 0.672429, 0.835309, 0.775986, 0.365969, 0.796592, 1.310695, 1.301819, 0.564219, 1.288732, 0.725597, 0.119184, 0.853568, 0.453768, 0.748899, 0.891892, 1.350765, 8.061300, 0.421803, 0.387706, 2.069839, 0.795073, 1.811142, 2.843324, 0.745035, 0.496585, 0.525716, 1.227305, 1.332200, 0.833819, 0.877216, 0.297001, 0.529960, 2.543105, 0.765669, 0.508411, 0.316845, 1.961093, 0.830919, 0.819503, 0.428263, 0.782252, 0.448211, 1.287640, 2.188502, 1.151403, 0.870357, 0.578586, 0.443533, 4.912706, 0.684195, 0.752475, 1.766595, 0.672999, 0.604731, 1.415205, 0.806327, 0.212835, 0.746627, 0.820652, 1.273352, 0.789771, 0.773109, 0.815751, 0.537213, 4.584631, 0.760615, 0.842331, 0.840406, 0.770532, 0.262724, 1.703164, 0.549842, 0.451879, 0.748709, 1.023873, 0.394866, 1.838402, 0.285019, 0.766164, 0.957725, 0.834828, 0.693935, 0.776040, 1.315549, 2.275934, 0.620436, 0.661358, 1.759700, 0.784654, 0.424338, 1.354944, 0.606748, 1.591563, 0.700279, 1.788855, 0.855198, 0.977731, 0.735719, 1.061627, 0.815041, 0.565185, 1.828591, 0.267683, 0.548912, 0.759407, 10.054377, 4.897153, 0.791805, 0.808699, 0.800502, 0.771470, 0.554081, 1.955379, 0.562218, 0.830810, 0.805645, 0.630346, 0.824768, 1.288759, 0.276341, 1.572211, 0.830786, 0.562582, 0.701588, 1.767691, 1.854376, 2.287372, 1.917119, 1.816600, 1.286708, 0.552692, 0.762037, 0.777778, 1.230711, 0.782848, 3.431728, 1.786070, 1.049547, 0.820692, 0.549161, 1.532528, 0.729833, 1.358123, 0.751319, 1.385258, 0.832400, 0.827723, 0.838113, 1.266940, 1.285468, 0.857040, 0.754196, 0.754944, 0.861649, 1.388286, 0.354732, 1.782083, 0.611126, 1.850133, 0.791232, 0.509554, 0.412419, 1.875691, 0.866268, 0.791882, 0.787509, 1.074117, 1.010893, 8.561103, 0.569434, 0.842784, 0.823342, 0.829748, 3.793807, 0.992428, 0.354519, 1.884383, 0.752904, 0.809456, 0.268553, 1.760609, 1.088474, 1.433368, 0.785225, 0.850271, 2.209081, 1.807318, 12.205256, 0.783872, 0.816195, 0.238233, 0.743455, 1.223697, 0.845540, 1.506572, 2.361411, 0.790960, 2.480701, 0.546049, 0.398048, 0.847597, 0.779979, 0.634424, 2.330165, 0.805054, 14.285042, 0.812750, 0.798564, 0.701643, 0.586322, 0.772246, 1.208101, 0.338765, 13.997476, 1.859198, 0.741764, 13.138686, 0.468699, 0.898067, 0.771693, 0.769522, 0.590935, 0.532779, 1.344286, 0.957933, 0.782060, 0.790455, 0.253484, 1.292045, 1.262930, 0.772959, 1.075116, 0.752794, 0.404012, 1.428471, 0.619582, 0.481910, 0.813701, 0.593930, 0.415570, 2.248059, 0.551967, 0.862803, 0.849447, 0.585458, 0.924172, 1.534856, 0.753965, 6.286558, 0.738605, 0.781928, 0.545432, 0.801837, 14.270685, 0.674497, 0.814698, 1.294513, 1.319465, 0.763290, 2.629951, 1.459257, 4.034495, 0.779396, 0.783736, 0.821742, 3.066920, 1.328286, 1.125291, 2.523289, 6.136349, 0.765943, 0.744635, 0.778947, 1.937135, 3.002880, 0.394258, 2.275874, 0.763977, 0.089288, 0.737945, 0.777896, 0.870585, 0.404819, 34.542549, 6.021398, 1.394220, 0.784717, 0.837486, 0.577215, 0.743743, 0.758387, 0.729358, 0.862267, 0.992867, 0.550653, 0.768905, 0.838919, 0.791803, 0.854440, 0.587891, 0.705981, 0.547442, 1.692615, 0.826740, 1.819391, 0.535732, 1.812387, 0.771123, 0.806193, 0.731830, 0.587137, 0.016208, 0.683303, 0.904768, 0.255691, 0.119617, 1.331400, 1.732724, 0.702888, 0.779211, 0.718726, 7.493721, 2.123326, 0.812617, 1.357691, 2.090384, 0.746903, 0.737955, 0.449752, 2.145887, 0.268152, 0.788301, 0.679988, 2.168138, 0.723458, 1.253925, 0.311423, 1.728562, 0.306556, 0.793656, 1.119419, 0.547418, 5.060370, 1.320630, 0.567428, 1.282341, 0.288706, 0.466108, 3.832037, 0.108858, 0.781181, 1.828947, 0.330494, 1.338693, 1.386872, 0.581523, 0.769175, 0.791471, 1.339091, 0.251634, 0.092122, 0.875282, 0.592074, 0.305174, 0.828446, 0.430976, 0.234752, 2.549890, 0.223592, 0.228183, 0.197367, 0.097058, 0.289720, 0.102231, 1.849750, 1.462664, 1.261514, 0.874152, 2.117926, 7.712003, 3.760970, 0.469296, 0.987863, 0.568286, 2.446772, 0.747546, 0.551450, 0.767309, 2.189123, 0.502216, 0.240856, 0.785408, 0.578894, 0.978055, 0.817560, 5.626633, 1.761059, 1.433094, 0.924512, 0.780749, 0.823717, 0.961000, 0.807721, 0.670458, 0.662971, 0.468833, 0.554161, 2.310592, 0.434518, 7.159973, 0.851893, 1.304031, 0.720816, 0.361705, 1.716169, 3.689861, 0.799710, 0.084463, 0.111801, 1.290543, 0.931149, 0.837896, 0.771843, 0.521493, 0.809316, 0.739258, 8.122484, 0.590480, 0.317118, 0.753726, 0.127351, 0.865941, 0.832963, 0.805476, 3.649574, 0.820522, 3.811664, 0.825172, 1.732069, 0.404177, 0.837857, 1.007130, 0.755617, 0.795172, 0.644383, 0.106150, 2.092297, 0.300439, 1.345781, 0.797185, 0.549038, 0.819103, 1.254426, 0.746597, 0.255392, 1.285567, 0.757639, 0.761263, 0.735495, 0.772937, 11.627882, 1.318424, 0.742380, 1.402846, 0.790240, 0.765739, 0.088772, 0.815460, 1.270214, 0.076270, 0.083535, 0.103800, 1.245942, 0.739860, 4.022956, 0.913706, 0.240324, 0.786106, 0.922283, 0.567541, 0.830898, 4.530604, 1.306101, 0.798956, 0.260829, 0.774227, 1.950109, 0.444599, 0.832366, 9.511527, 1.337873, 1.812389, 0.857509, 0.600416, 1.094716, 0.803355, 0.690191, 10.224715, 0.800434, 0.836520, 0.781395, 1.292247, 0.858832, 0.241147, 0.786765, 1.946064, 0.408489, 0.769518, 0.593825, 0.554237, 2.168348, 0.399053, 0.780254, 1.397743, 0.382272, 0.784550, 0.798172, 0.785539, 2.162190, 0.816702, 0.785891, 1.131090, 0.779110, 1.323645, 0.434309, 0.782916, 0.280719, 1.316818, 1.185844, 1.412957, 0.810830, 1.400140, 0.757565, 0.590746, 0.787751, 6.401151, 10.915220, 2.143242, 0.116581, 0.837260, 14.232509, 0.823206, 3.740232, 0.429882, 0.755686, 0.567348, 0.803331, 0.306056, 4.332274, 0.808466, 0.820721, 0.781926, 0.728802, 8.962884, 0.845465, 0.475922, 0.529381, 1.182587, 1.636123, 0.801240, 1.451712, 0.780523, 0.769037, 3.494802, 1.284045, 0.809007, 1.244565, 0.506459, 0.851568, 1.268970, 0.802274, 10.493653, 0.726316, 0.794690, 0.787671, 0.249643, 0.802580, 2.351679, 2.339286, 1.262306, 0.772624, 0.776376, 1.100589, 0.310255, 0.725572, 1.205988, 0.797679, 0.866109, 0.402074, 2.518519, 1.340278, 0.838977, 0.785211, 12.419972, 0.790093, 0.774527, 0.793727, 1.286096, 0.790630, 0.450891, 0.827762, 1.791533, 3.022161, 0.776801, 0.763704, 0.802015, 1.693654, 0.323036, 1.369137, 1.447166, 0.690759, 0.641405, 0.383429, 0.753548, 1.508622, 0.718630, 4.269108, 0.612074, 0.552217, 0.758316, 0.853846, 0.809222, 9.816937, 0.763816, 0.780522, 1.192965, 0.751898, 0.750000, 1.325557, 0.551025, 0.762904, 0.463610, 0.055735, 1.856648, 0.674804, 1.779673, 0.324416, 0.838527, 31.111111, 0.778050, 0.792388, 3.335353, 0.758377, 0.617847, 2.042943, 0.765788, 1.324413, 0.826151, 1.369724, 0.376860, 0.841993, 0.814646, 0.611271, 0.799496, 0.499083, 1.269271, 0.848815, 1.317426, 0.562378, 0.813468, 0.789230, 0.839530, 0.749658, 2.818698, 0.726186, 1.789366, 0.434766, 0.789341, 1.821752, 1.400071, 9.017310, 0.770429, 0.438649, 0.798310, 0.501356, 0.680146, 0.750693, 3.331587, 1.848900, 0.761708, 0.777441, 0.789913, 0.568371, 0.754626, 0.790521, 0.768825, 0.777664, 2.795398, 1.341961, 1.404840, 0.419368, 1.367288, 0.783871, 0.817875, 0.778297, 2.760993, 0.733018, 1.119299, 2.061874, 0.771662, 1.255830, 0.650920, 1.339670, 0.288011, 0.789054, 0.796335, 1.145134, 0.762626, 0.568895, 0.842393, 1.104695, 1.222883, 0.575198, 0.828084, 0.794604, 0.745448, 0.737549, 3.072510, 0.768226, 1.279070, 0.369587, 0.775517, 0.833576, 0.842373, 2.175920, 0.279339, 0.824168, 29.963899, 0.988674, 1.213891, 2.456352, 0.752316, 1.235210, 0.335347, 0.763303, 0.615635, 1.061132, 1.852190, 0.339560, 0.819598, 0.911472, 1.517409, 0.775923, 0.311677, 1.251574, 1.033537, 1.441407, 0.633579, 0.825152, 1.381544, 1.291712, 1.204702, 0.702758, 0.870562, 1.469938, 0.766338, 0.831412, 1.949222, 5.907539, 0.835534, 1.316376, 1.879187, 0.811091, 4.179815, 5.251047, 0.784452, 0.928436, 1.256106, 0.642224, 0.784238, 0.404486, 2.761323, 3.794220, 0.525116, 0.582490, 0.807720, 0.858133, 1.371585, 0.821159, 0.558059, 0.846374, 1.287666, 0.822086, 0.691476, 0.519760, 2.093067, 0.793184, 0.559444, 0.873991, 1.645310, 2.203136, 1.393485, 0.805113, 0.779293, 3.850602, 0.779391, 0.935569, 0.795231, 0.562484, 0.894724, 0.297768, 0.405939, 0.521579, 1.392550, 0.804506, 0.739944, 0.471246, 1.044766, 0.866133, 0.830593, 0.834238, 2.109594, 0.545073, 0.850088, 0.983891, 0.756651, 3.081042, 2.735067, 0.718970, 0.628707, 0.856981, 0.766762, 0.569142, 0.749108, 0.800883, 0.863554, 0.839461, 1.736020, 1.854182, 1.693190, 0.766593, 0.601667, 2.285181, 0.767863, 0.051635, 0.831131, 0.577156, 20.954987, 0.522327, 0.574637, 1.318789, 0.633002, 0.779422, 0.666867, 1.894492, 0.284629, 1.474570, 0.540130, 1.366930, 0.548719, 1.292260, 0.586033, 0.741675, 0.719011, 2.891272, 0.605362, 0.764017, 0.829480, 0.857405, 0.766631, 0.794918, 0.780705, 2.065596, 0.976762, 1.599932, 0.542709, 0.795610, 2.889176, 0.815018, 0.828724, 0.590969, 0.503974, 0.763800, 0.720407, 0.800501, 11.342495, 0.697923, 0.807469, 0.340837, 0.565063, 1.233865, 1.830467, 0.527375, 1.776275, 0.784687, 3.716188, 1.354174, 0.577494, 0.567988, 0.777539, 1.346542, 0.793535, 8.681759, 0.549847, 1.001722, 0.806683, 0.887505, 0.447332, 1.006742, 1.282313, 0.809747, 0.719034, 0.715709, 0.766621, 0.894918, 7.422222, 1.878459, 1.353568, 1.339936, 0.805052, 0.630082, 0.751395, 1.174894, 1.205016, 1.386531, 1.921234, 2.018752, 1.341809, 4.407557, 0.646213, 1.542928, 0.908699, 0.728714, 1.357544, 0.823169, 0.878261, 0.786474, 0.791186, 0.571955, 0.790517, 0.773834, 0.785991, 0.953657, 0.762879, 0.865512, 2.574029, 0.927832, 2.226025, 0.799128, 0.758175, 0.537467, 0.758596, 1.730910, 0.739735, 0.814961, 1.878788, 0.831027, 0.826761, 0.800140, 0.607172, 0.544578, 0.803458, 1.274128, 0.756365, 1.360990, 0.794804, 0.790837, 0.285116, 0.814556, 0.609289, 0.572959, 0.783601, 0.303496, 0.659495, 1.133290, 0.902309, 1.810087, 5.521691, 0.657652, 0.763782, 1.196334, 1.297297, 1.076096, 0.310013, 1.879900, 0.525146, 0.617994, 1.321491, 0.351372, 0.729404, 5.975533, 0.292585, 0.978473, 1.303114, 0.816527, 0.790305, 0.619253, 0.842354, 1.222433, 1.307939, 0.729337, 0.331998, 0.797577, 0.754398, 16.512598, 1.293789, 1.199287, 2.826733, 1.222144, 0.766773, 0.779920, 0.729919, 0.538732, 1.259986, 0.736974, 0.293360, 0.792561, 1.354776, 0.560705, 1.166789, 0.760544, 0.817688, 1.003812, 1.344577, 1.895015, 0.822399, 0.818509, 1.771277, 0.800850, 1.696260, 0.876015, 0.798444, 0.667733, 1.314136, 0.511194, 0.835994, 0.809626, 15.129149, 0.768080, 1.337911, 0.693514, 1.226441, 2.063125, 0.597860, 1.385084, 1.368517, 0.751911, 0.724215, 0.648451, 1.568627, 1.301926, 0.798840, 0.438656, 10.750529, 0.609897, 3.602740, 0.551688, 1.799860, 9.287285, 3.141807, 0.744688, 0.751856, 1.182007, 0.780351, 0.506579, 0.747005, 0.781409, 0.825346, 0.807624, 0.550721, 1.077085, 0.751951, 0.456590, 0.862607, 3.236047, 0.580429, 0.726804, 0.755697, 0.831037, 2.803527, 0.727496, 3.372934, 0.770383, 0.581477, 0.604854, 0.755411, 2.453624, 0.778771, 0.811475, 0.757350, 0.776650, 0.712066, 0.757374, 2.337372, 0.829864, 0.842339, 0.054252, 0.837768, 1.487242, 0.246838, 0.743961, 1.308260, 0.618448, 0.834110, 0.355110, 10.104509, 0.520176, 2.781889, 0.807889, 0.844371, 1.328281, 1.594776, 0.880555, 0.786984, 0.744406, 0.303034, 0.767410, 0.608287, 0.642720, 0.775740, 5.027905, 1.280154, 1.356559, 1.240250, 0.800141, 0.622546, 1.270356, 0.837008, 0.926187, 0.798080, 0.750087, 2.250908, 0.944255, 0.587818, 1.298770, 0.769366, 0.351436, 0.799511, 0.508293, 1.605407, 0.748135, 0.821749, 0.850000, 0.857832, 1.287007, 0.827462, 0.658628, 0.292745, 15.403409, 1.409974, 0.553594, 0.767673, 0.950064, 1.336458, 1.440347, 0.305117, 4.108388, 1.350424, 0.272919, 0.784605, 8.143007, 0.767260, 0.466404, 0.557455, 2.980531, 0.811748, 0.554575, 0.646015, 0.567505, 1.403250, 6.330393, 0.744492, 2.308682, 0.826652, 0.858903, 0.829795, 1.325465, 1.344238, 0.752552, 0.767350, 0.782006, 0.723306, 0.336160, 0.782387, 1.787643, 1.915493, 1.357371, 0.229586, 0.800072, 1.298891, 1.319142, 1.298791, 0.413453, 0.830377, 9.585825, 0.519953, 0.806212, 1.290222, 2.077670, 0.959064, 0.740000, 0.795646, 1.192598, 0.354721, 0.783281, 0.958964, 1.416875, 0.763112, 2.287846, 0.773115, 2.283878, 9.302845, 0.846972, 12.819103, 0.801962, 0.762500, 1.917508, 1.144204, 1.321391, 0.794406, 1.362622, 0.842640, 0.758042, 0.456241, 0.774775, 0.787279, 0.497336, 0.587090, 0.560376, 0.837024, 0.757174, 0.829382, 0.802355, 0.803051, 11.293949, 1.612519, 0.981197, 1.304102, 3.424309, 0.803963, 0.732270, 1.617087, 2.087054, 1.382179, 0.238649, 1.336975, 0.541780, 0.789787, 0.773500, 0.764256, 0.665034, 1.902716, 0.786809, 0.813270, 0.798772, 0.756318, 0.852248, 0.809339, 0.333830, 0.766585, 0.272579, 1.398072, 0.326795, 5.038918, 1.636786, 1.515267, 0.764503, 0.735664, 1.804378, 0.783133, 1.177405, 0.841914, 0.799176, 0.555225, 0.824750, 0.770613, 1.811589, 1.191138, 0.573214, 1.089410, 0.334661, 1.986127, 0.829128, 0.759093, 1.427381, 0.571891, 0.769580, 1.188016, 1.288269, 0.762376, 1.339332, 0.809127, 1.282617, 11.441176, 0.324415, 10.299744, 0.748832, 0.805578, 0.795814, 0.697391, 1.364760, 0.838067, 0.795746, 0.805323, 0.713359, 0.503457, 0.979695, 0.639275, 0.624856, 1.259514, 0.106479, 0.764306, 1.071170, 0.584683, 0.551716, 0.828298, 1.089224, 1.261414, 0.788798, 1.218350, 2.291712, 1.344023, 0.813191, 0.381379, 0.850325, 0.824310, 0.774957, 6.847834, 1.763326, 0.561654, 1.300469, 0.469295, 0.855766, 1.509963, 1.159520, 1.413028, 0.731817, 0.804738, 1.349910, 0.756028, 0.490663, 0.793899, 0.786460, 0.753531, 0.845951, 0.758669, 0.787416, 1.338905, 1.296699, 1.284553, 0.280884, 0.872059, 2.310039, 0.243902, 0.532549, 0.844993, 1.406761, 0.561727, 0.756806, 0.732248, 1.205846, 0.815506, 0.820485, 0.377285, 0.816580, 0.933886, 1.240555, 0.178867, 0.768837, 1.895176, 1.412080, 0.834358, 0.826461, 0.813382, 1.228232, 0.788897, 0.073998, 0.787752, 1.728930, 0.803074, 1.448103, 1.672682, 0.793668, 0.604517, 0.135692, 0.789771, 1.357509, 0.779883, 0.777933, 1.367721, 0.855339, 0.602632, 0.839839, 0.822968, 0.796489, 0.799354, 0.761921, 1.278717, 1.315734, 1.323571, 0.074992, 0.827170, 0.905095, 0.786927, 0.740687, 1.387909, 1.206591, 1.746831, 0.113790, 0.085583, 0.172313, 0.825277, 0.145878, 0.039717, 0.801377, 0.744170, 0.839599, 1.838332, 0.429319, 2.090464, 0.762928, 1.517943, 0.801576, 0.798472, 0.774171, 1.616438, 1.566560, 0.905627, 0.560697, 7.282585, 0.829197, 0.770322, 10.451916, 7.475662, 0.801724, 0.912899, 0.939649, 2.082503, 0.782684, 0.782609, 0.657949, 0.824268, 0.869876, 0.800424, 1.787561, 1.728352, 1.198622, 0.771246, 0.781293, 2.366845, 0.818892, 0.803331, 0.667694, 0.631865, 0.711020, 0.746032, 0.646821, 0.889610, 0.801047, 2.916986, 1.315493, 0.811466, 0.447660, 0.704120, 1.093200, 0.764281, 1.771383, 1.863278, 1.807561, 1.729749, 1.151359, 0.784008, 1.713446, 0.756794, 2.362122, 0.694387, 0.719231, 0.746625, 0.116074, 0.772760, 0.829209, 1.861448, 0.761755, 2.346181, 0.697516, 1.337337, 0.528571, 0.796676, 0.680760, 0.807031, 0.750427, 0.790756, 1.361372, 0.644741, 0.581856, 2.193686, 1.263248, 0.796748, 0.283104, 1.765559, 1.351179, 1.392446, 1.317660, 0.723361, 0.781831, 2.212675, 0.736173, 0.793429, 10.838197, 0.812567, 0.855908, 0.812022, 0.853974, 0.865243, 0.454128, 0.697758, 0.814854, 0.774540, 0.815434, 1.329655, 0.794433, 2.003170, 0.788441, 0.779058, 0.479606, 0.738625, 2.783708, 0.813394, 0.538644, 0.824786, 1.339091, 4.656491, 2.444247, 1.324891, 0.856671, 0.750526, 0.780101, 1.268534, 1.386734, 1.846672, 0.758238, 1.770335, 0.456242, 11.952883, 1.262644, 0.673900, 0.749568, 1.076634, 0.554941, 1.365970, 3.224052, 0.837719, 0.809269, 0.427600, 0.773367, 2.899582, 1.233846, 8.174240, 0.830930, 1.302712, 0.772035, 0.817363, 0.779235, 0.787846, 0.792705, 0.760991, 1.654188, 0.401042, 1.353278, 1.268610, 1.663884, 0.810538, 0.812942, 0.623612, 2.298878, 0.767568, 0.785637, 2.186705, 0.801795, 1.338962, 0.764985, 0.766306, 0.809061, 0.728861, 0.819876, 0.780505, 1.742622, 1.423945, 1.338710, 0.345631, 0.841135, 0.773112, 0.767594, 0.823784, 1.282275, 1.789199, 2.685603, 0.874969, 0.821517, 0.563599, 0.810542, 2.969169, 0.949096, 0.920727, 2.151387, 0.752781, 0.739241, 0.690268, 0.863074, 0.574745, 0.798252, 1.274733, 1.324549, 0.824530, 1.112780, 0.818975, 4.862522, 1.481471, 0.514541, 0.773427, 0.769990, 0.842596, 0.810631, 1.697473, 1.307584, 0.650553, 0.722071, 0.613611, 0.646041, 1.295161, 0.972895, 1.385318, 1.199677, 1.262451, 2.496897, 1.323378, 0.783957, 0.515899, 0.800648, 1.061274, 0.808997, 1.285457, 0.795955, 0.780479, 0.775437, 0.782154, 1.353065, 0.847787, 0.814399, 0.301967, 0.996033, 0.795676, 0.759091, 0.766930, 0.445917, 1.241813, 2.314109, 0.550998, 0.511096, 0.480124, 0.772437, 0.514027, 5.059433, 0.744894, 0.796048, 0.387353, 1.736640, 1.279422, 4.691145, 0.510771, 1.541209, 0.741992, 0.822206, 0.270297, 0.472204, 0.772520, 0.867933, 0.509131, 4.885222, 0.800974, 0.590659, 0.371220, 0.569824, 0.738435, 1.308421, 0.508529, 15.828925, 0.513329, 0.841016, 2.035899, 0.107134, 1.377291, 0.741813, 0.481323, 0.256754, 0.507958, 0.801431, 0.808273, 0.514599, 0.317956, 0.777816, 0.186227, 0.760428, 1.892433, 1.671531, 0.869757, 0.761711, 0.735072, 0.498371, 0.452125, 0.828228, 1.395474, 0.841281, 0.476785, 1.096881, 0.864797, 2.228283, 0.813978, 0.497013, 0.807074, 0.373720, 0.488989, 1.197655, 0.489185, 1.765656, 0.764865, 0.071974, 0.813077, 2.222679, 0.274838, 0.392723, 0.522148, 0.771326, 0.760059, 0.252706, 1.195652, 2.320727, 0.732610, 0.930125, 0.382892, 0.797961, 0.365324, 0.753338, 0.906786, 1.269980, 0.754643, 1.831065, 0.794382, 0.949421, 0.427837, 0.481933, 0.197982, 0.512912, 0.555693, 0.103627, 0.800866, 0.838780, 0.769645, 0.274956, 0.689593, 3.537574, 0.829742, 0.522898, 0.347535, 0.736771, 2.950855, 0.808055, 0.553791, 0.784341, 1.283188, 1.970921, 0.395399, 0.308387, 7.017415, 0.810530, 0.749574, 1.482081, 0.757044, 0.787160, 0.402205, 3.624438, 2.020853, 0.839226, 0.723390, 1.576803, 0.875416, 0.811194, 2.747592, 0.766306, 0.766275, 0.689557, 0.759498, 1.287482, 0.745828, 0.782609, 2.582524, 0.488614, 0.862727, 0.519143, 0.808997, 0.412409, 0.305177, 0.876303, 0.757085, 0.755159, 0.561725, 0.349953, 0.303400, 1.784973, 1.253165, 0.513308, 0.447309, 0.202935, 1.122399, 2.263683, 1.080815, 0.789940, 0.473810, 0.764244, 1.689904, 0.765734, 0.751941, 0.745063, 0.737994, 0.507803, 0.876500, 0.380301, 0.728169, 0.746435, 0.529221, 0.465852, 0.757946, 0.800655, 0.811493, 0.758836, 0.843906, 2.092153, 0.808889, 0.816421, 0.374716, 0.780311, 2.181513, 3.351114, 1.174722, 2.206763, 0.844305, 6.809934, 0.536229, 0.494274, 2.697323, 0.633706, 1.363062, 2.163840, 0.775510, 0.760966, 0.418883, 1.305824, 1.722147, 0.747506, 0.809711, 0.790452, 0.284971, 0.636933, 0.641890, 20.483883, 0.410652, 0.290445, 0.502315, 1.126360, 0.836197, 1.264093, 0.795202, 0.478752, 0.681144, 0.496815, 7.703030, 0.595618, 0.785162, 0.833035, 0.462857, 0.851782, 1.787205, 0.476956, 1.192359, 0.820000, 1.370877, 0.551591, 0.388870, 0.541460, 0.552268, 0.830386, 0.207511, 1.361517, 2.481780, 0.947243, 0.869152, 0.813269, 0.875806, 0.746236, 0.250308, 0.477044, 0.266795, 0.811726, 0.548725, 0.580297, 0.824414, 0.402162, 7.425296, 0.834677, 1.181582, 0.526991, 2.096670, 0.792079, 1.211633, 0.423936, 2.998313, 2.145188, 0.868476, 0.786556, 0.610949, 0.388136, 0.384100, 0.484179, 0.507062, 1.964804, 0.369029, 0.545929, 0.530143, 3.474250, 1.310728, 1.141898, 0.386343, 0.915454, 0.898888, 0.549509, 0.375153, 0.387408, 0.403694, 0.810936, 0.548744, 0.504703, 0.361197, 0.244913, 1.169234, 1.297568, 0.814567, 0.544928, 0.642372, 0.964656, 1.595575, 1.120244, 0.514702, 0.397212, 8.476693, 0.396567, 0.064615, 1.154155, 0.459658, 0.482452, 0.273458, 0.372677, 1.728685, 2.177659, 5.668028, 0.521130, 0.414621, 0.234027, 1.683113, 0.823856, 0.729535, 0.551386, 0.478290, 0.267637, 0.814882, 0.962711, 0.699429, 1.989116, 0.842067, 0.819571, 1.954300, 1.367297, 1.341176, 0.745467, 0.565756, 0.622341, 0.816176, 2.222950, 0.805313, 0.530941, 0.618430, 0.768342, 1.449708, 0.514429, 0.868037, 0.500337, 0.771327, 0.515880, 0.532819, 0.364028, 0.814573, 0.754098, 0.542468, 0.856095, 1.763319, 1.787129, 0.526659, 0.526141, 0.366684, 1.848680, 0.870594, 0.549004, 0.497789, 0.723478, 0.322473, 0.360438, 0.867243, 0.895292, 0.788278, 0.755712, 0.542642, 0.504691, 0.865385, 0.346780, 3.752577, 0.836974, 1.764841, 0.790136, 0.256808, 0.325488, 0.536213, 0.327063, 0.497179, 1.391045, 0.941162, 6.287637, 1.392490, 0.829996, 0.815344, 0.418005, 5.100352, 0.496641, 2.333740, 0.515535, 0.918837, 0.800561, 0.504011, 0.567994, 0.531578, 1.240929, 0.528451, 0.354143, 0.520191, 0.526060, 1.182593, 1.288401, 0.767377, 0.513102, 0.467553, 0.535932, 0.923040, 1.239867, 0.376229, 0.405978, 0.599827, 0.787424, 0.259057, 0.784615, 0.838036, 0.515854, 0.785506, 1.088046, 0.662217, 0.508311, 0.778169, 0.497483, 1.471139, 0.655664, 0.639119, 0.519934, 0.528103, 0.208883, 0.517781, 0.414824, 1.923842, 9.288660, 0.525701, 0.494852, 0.479961, 0.535741, 2.050000, 1.691236, 1.280287, 0.809329, 0.417493, 1.368252, 4.268361, 0.550634, 0.729074, 0.295868, 0.918861, 0.363459, 0.381658, 0.542965, 1.295824, 0.824974, 1.068504, 0.769646, 0.680155, 0.379434, 8.617355, 1.078178, 0.277819, 0.511275, 1.234492, 0.603862, 1.103046, 0.767172, 0.770671, 0.312746, 0.732970, 1.285763, 4.728200, 0.536393, 0.499131, 0.746165, 0.748571, 1.553813, 0.362237, 1.300760, 1.309996, 0.269443, 0.493619, 0.313786, 1.012806, 0.778013, 0.794290, 1.370410, 0.505097, 0.241658, 0.706466, 0.526603, 0.524192, 0.671041, 0.308952, 0.435718, 0.790723, 0.502862, 1.238523, 0.544055, 0.536080, 0.381888, 0.299500, 0.662478, 1.953614, 0.579664, 0.790632, 0.393449, 0.748421, 1.337119, 0.542907, 2.991972, 0.656723, 0.813698, 0.961500, 0.386173, 0.524687, 0.873266, 0.471469, 1.957576, 0.803751, 0.779731, 0.942703, 0.535964, 0.392108, 3.522574, 1.789881, 0.815396, 0.574226, 0.503094, 0.363334, 0.373092, 1.417717, 1.325891, 0.924877, 0.796048, 0.754470, 0.788369, 0.857537, 0.715535, 0.780471, 0.812721, 0.848660, 0.577483, 1.238015, 0.842946, 0.744060, 0.810763, 1.904222, 1.715623, 1.005944, 0.767769, 0.480878, 0.524842, 0.539477, 0.617837, 1.536790, 0.990682, 0.800619, 0.498609, 1.269659, 0.506837, 0.750870, 3.180152, 5.394631, 3.429517, 0.780513, 0.780248, 0.518638, 0.651436, 0.811875, 9.798040, 0.554532, 0.374385, 2.340401, 0.512668, 0.289437, 1.169701, 0.286339, 0.573835, 0.744226, 0.487474, 0.800648, 0.821974, 0.389615, 0.574228, 0.565780, 0.774965, 0.293296, 0.457428, 0.954282, 1.222485, 0.842758, 0.982726, 0.511026, 0.836441, 0.402108, 0.569674, 1.714215, 4.560219, 2.382949, 0.577012, 0.876676, 0.516058, 0.528465, 0.907555, 1.787953, 0.535783, 1.228305, 0.749826, 0.399853, 8.806638, 0.855577, 0.832658, 1.098025, 0.401910, 0.393955, 0.503800, 7.668638, 0.234051, 0.622830, 0.247278, 8.114001, 0.421532, 0.506021, 0.644444, 0.414176, 1.793613, 3.505429, 0.491075, 0.553810, 0.342504, 0.549182, 0.804348, 0.547125, 0.371851, 1.126842, 0.521902, 0.465956, 0.822613, 0.594850, 0.500113, 1.605239, 0.830182, 0.179519, 0.387254, 2.509282, 0.512580, 0.785247, 0.777619, 0.823352, 1.820585, 1.819871, 12.806428, 1.277738, 0.553672, 0.754941, 0.517089, 0.335921, 0.784410, 0.819424, 1.307288, 0.922570, 1.438093, 0.366661, 1.020761, 0.822127, 0.534042, 0.384419, 0.290581, 0.480451, 1.807772, 0.923977, 0.700636, 0.878982, 0.517732, 0.258931, 0.479768, 0.649947, 0.295208, 0.741379, 0.522546, 0.747890, 0.629319, 0.358555, 0.391184, 0.694261, 5.403986, 1.153004, 0.743793, 0.145976, 0.767320, 1.356656, 1.347253, 1.345865, 0.780007, 0.540295, 0.832064, 0.444671, 0.760993, 0.883981, 0.553953, 0.538715, 0.896960, 0.383059, 0.991672, 11.109247, 0.856798, 0.315782, 0.385127, 0.800637, 0.839744, 0.389085, 0.863945, 0.777191, 0.713805, 0.793203, 9.164602, 0.550515, 0.730541, 0.398023, 3.175114, 0.544161, 0.525528, 0.935350, 0.798026, 0.736405, 0.356393, 0.405589, 4.896673, 0.552707, 0.972496, 0.286657, 0.655129, 0.832900, 0.315662, 0.946287, 0.379913, 0.388322, 1.776408, 0.827330, 0.494589, 0.268296, 0.545943, 11.767733, 0.364260, 0.363962, 0.747314, 1.314266, 0.544574, 0.549819, 0.770730, 0.867225, 0.786765, 0.448140, 0.866301, 0.534080, 0.549334, 0.537497, 0.639038, 0.405898, 0.822342, 0.813409, 0.815058, 0.506109, 0.503194, 0.776471, 0.316937, 0.776187, 0.794076, 0.782517, 1.326412, 0.622997, 0.381626, 0.295718, 0.761141, 0.611366, 0.881940, 1.257363, 0.541877, 0.956684, 2.240401, 0.511945, 1.049172, 0.534911, 0.532624, 0.329900, 0.756291, 0.822134, 0.673145, 0.851258, 0.562020, 0.310412, 0.725470, 0.352386, 1.133438, 1.302986, 0.842722, 0.473816, 0.788762, 0.931065, 1.219968, 0.633128, 0.770886, 0.656900, 1.317268, 0.814286, 1.164551, 1.277492, 0.854827, 0.406037, 1.433740, 1.084208, 2.352983, 0.682418, 0.520028, 0.297360, 0.376248, 1.003358, 0.079374, 0.498902, 0.195050, 0.617811, 1.245748, 0.872967, 0.489305, 0.386384, 1.048846, 0.454108, 1.377849, 0.259656, 0.804676, 1.331714, 0.730504, 0.874849, 1.570463, 11.941565, 0.658347, 0.261520, 0.394064, 0.791533, 0.507521, 1.819986, 0.753857, 0.796628, 0.840580, 1.278245, 0.780987, 0.636253, 0.512313, 0.397054, 0.548710, 1.550735, 0.270422, 0.528420, 0.774025, 0.811672, 0.779643, 0.831635, 0.510364, 0.765805, 1.360651, 1.589286, 4.723400, 0.410874, 0.532787, 0.838680, 0.839440, 0.376604, 0.520981, 0.743536, 0.865176, 0.861852, 0.631963, 0.494442, 0.288406, 0.515287, 1.709958, 0.516390, 0.452289, 1.345355, 0.343705, 0.517511, 0.519748, 0.799228, 0.526215, 1.132215, 0.827717, 1.042045, 0.556766, 0.516129, 0.387212, 1.331809, 1.191331, 0.312438, 0.549605, 0.513177, 0.796369, 0.633698, 0.524460, 0.496408, 3.406056, 0.549308, 0.608555, 0.511179, 5.758144, 2.128981, 0.713632, 0.525054, 0.529125, 0.797473, 0.562106, 0.810052, 1.297012, 0.681753, 0.382005, 0.369898, 1.152356, 0.827961, 0.260932, 0.808526, 0.744658, 8.175926, 0.790036, 0.555746, 0.382601, 1.407801, 0.503980, 1.006303, 0.774913, 0.382343, 1.434710, 0.737569, 0.755852, 0.282150, 0.331170, 0.369342, 1.347079, 0.419338, 0.558350, 0.546171, 0.917351, 0.521529, 0.288951, 0.533010, 0.370810, 0.506868, 0.458043, 0.911405, 0.514816, 0.884363, 0.378200, 0.362196, 0.372592, 1.283402, 0.797528, 1.320428, 1.413692, 0.822133, 0.802416, 0.874051, 0.480062, 0.514053, 0.424780, 0.508418, 0.297861, 0.754909, 0.816971, 0.918913, 0.843727, 0.844790, 0.385305, 1.131871, 0.290021, 0.769395, 0.762966, 0.793067, 1.212885, 1.187661, 0.528151, 1.711686, 0.543687, 0.504145, 0.680897, 0.804757, 0.864865, 26.585284, 1.444604, 0.558888, 0.659649, 0.074626, 0.521425, 0.765410, 0.278896, 0.545540, 0.528588, 1.139832, 0.567541, 1.342837, 0.787076, 1.113790, 1.284091, 0.159886, 0.391342, 0.761773, 1.330025, 0.471343, 0.396069, 0.850687, 0.784225, 0.402157, 0.551327, 0.477707, 0.514146, 0.499320, 0.755495, 1.314459, 1.921918, 0.502189, 0.394256, 0.401983, 0.775755, 0.527354, 0.321946, 0.734417, 1.311237, 1.201574, 1.382173, 0.837536, 0.519817, 1.160160, 0.809781, 0.273870, 0.762189, 0.858729, 0.939566, 0.733217, 6.312979, 0.422383, 0.807294, 0.892326, 0.662035, 0.393509, 0.468329, 1.880019, 0.744606, 0.291603, 0.846309, 6.286557, 0.504086, 0.883755, 0.403483, 0.512013, 0.464168, 0.498829, 0.541048, 1.246195, 0.768676, 0.314740, 0.398284, 0.393813, 0.513815, 0.762818, 0.366569, 0.781937, 1.061998, 0.630369, 0.410155, 0.509582, 0.894914, 0.924392, 0.832624, 0.811656, 0.234459, 0.621508, 5.682187, 0.982902, 0.508571, 0.875706, 0.831967, 0.062776, 0.499182, 0.553473, 0.389468, 0.622993, 0.639888, 1.323949, 0.506802, 0.807108, 2.210433, 1.340320, 0.217714, 0.873669, 1.171448, 1.293953, 0.717705, 5.548714, 0.520456, 1.596334, 0.774264, 0.769343, 0.530512, 0.842838, 0.504687, 0.742077, 1.067353, 0.804997, 0.348375, 0.845350, 1.352962, 0.806624, 0.706068, 0.784797, 0.382687, 1.452287, 1.215814, 0.535706, 0.317152, 0.518036, 0.535918, 3.261431, 1.381884, 0.842470, 1.330381, 0.805980, 0.504505, 0.766306, 0.413943, 0.858018, 0.773055, 0.785917, 0.821505, 0.758470, 0.469319, 0.858365, 0.730964, 1.136217, 0.492357, 0.796388, 0.239788, 1.254564, 1.338163, 0.397438, 0.756966, 0.670118, 0.476501, 1.824928, 0.800358, 0.798162, 0.373492, 1.352941, 0.735800, 0.780921, 0.740176, 0.807386, 0.766905, 1.348953, 0.380663, 0.443621, 0.817889, 12.758668, 0.770067, 0.821634, 0.313952, 0.747929, 0.819290, 0.932819, 0.510910, 0.775947, 1.760528, 1.580118, 0.799133, 0.786730, 2.674567, 1.004842, 0.848555, 0.777857, 0.815946, 3.157779, 3.331314, 0.520896, 0.798396, 0.705111, 0.242887, 1.246840, 0.889382, 0.769203, 0.449918, 0.510793, 0.550866, 0.579300, 2.287790, 0.775766, 1.817239, 0.424267, 0.816076, 0.776060, 2.236703, 0.802030, 0.801196, 0.829856, 0.486387, 0.503017, 1.257913, 1.219388, 0.793043, 1.191865, 3.711254, 0.820065, 0.798853, 0.625448, 0.381913, 0.480000, 0.535758, 0.538739, 0.575160, 0.901683, 1.371277, 1.103114, 1.121248, 0.769507, 1.192102, 0.344352, 0.268040, 0.764366, 0.805271, 0.878205, 1.164806, 0.516690, 0.255535, 2.297693, 0.529812, 1.237351, 0.459352, 0.730890, 0.801491, 0.921071, 0.779139, 0.510047, 1.813746, 1.651064, 1.409446, 0.810393, 1.805323, 0.481300, 0.310331, 0.368439, 0.526413, 0.836364, 0.817718, 0.527639, 0.571529, 1.562505, 20.932277, 0.804966, 0.846069, 0.879386, 0.518711, 0.255094, 0.747735, 0.553063, 0.509618, 0.833220, 0.670821, 0.407634, 0.489612, 0.551206, 0.676569, 1.275044, 0.528588, 0.492261, 0.369540, 0.800446, 0.341610, 0.770696, 0.799862, 1.649847, 0.385908, 0.844734, 0.792485, 1.451777, 0.769098, 0.525253, 1.510284, 0.863480, 0.703755, 0.784207, 0.810082, 0.505944, 0.391430, 0.862911, 1.257613, 1.247405, 0.761720, 0.811703, 0.813025, 1.197256, 0.764457, 0.294379, 0.815798, 0.805027, 1.794695, 0.448007, 1.585307, 0.808185, 0.379521, 1.380084, 1.291910, 0.806732, 0.767994, 0.791514, 0.793939, 0.788767, 0.506905, 0.308745, 0.748314, 0.785101, 0.400480, 0.843508, 0.493631, 8.065619, 1.325573, 0.530803, 0.268623, 0.395758, 0.760456, 0.766536, 0.751983, 0.778309, 0.280805, 0.307492, 1.327100, 0.854442, 1.219529, 0.785967, 0.789700, 1.320898, 1.286122, 0.323512, 0.516057, 0.370081, 1.300762, 16.961255, 0.845688, 0.760885, 0.651139, 0.924658, 0.247862, 1.975069, 0.813715, 0.473930, 0.427443, 0.760149, 0.861767, 0.504406, 0.804782, 0.811024, 1.285166, 0.832419, 0.551724, 0.472285, 2.587125, 1.294921, 0.539434, 0.508920, 0.525580, 0.798450, 1.219471, 5.841733, 4.867929, 0.526291, 1.291269, 5.903103, 0.929746, 0.539354, 0.471820, 1.296401, 1.303030, 0.479947, 0.561261, 0.270616, 1.981235, 1.264184, 0.841019, 1.264125, 0.725784, 0.842451, 0.622632, 13.864736, 0.763361, 0.554424, 0.676990, 0.234341, 0.748628, 0.456504, 1.290368, 0.865367, 1.245074, 0.781934, 0.243310, 8.998963, 0.446412, 0.355357, 0.869386, 0.158741, 0.238782, 0.505397, 2.426165, 1.300289, 0.515933, 0.502538, 0.880570, 0.765599, 4.332783, 0.780065, 0.451048, 1.311720, 0.396789, 0.511633, 0.744512, 1.321005, 0.981020, 0.412279, 0.536375, 1.687102, 1.327615, 0.518665, 0.839965, 1.082277, 0.124183, 1.211557, 5.498182, 3.219839, 0.200370, 0.657825, 0.442372, 0.780044, 0.777231, 0.485682, 0.527799, 0.761905, 1.676154, 0.818327, 0.779756, 0.779823, 0.539320, 0.840917, 0.529144, 0.500115, 0.191844, 2.500500, 0.749827, 0.396012, 0.402795, 0.396081, 0.575012, 1.301213, 0.795172, 0.480962, 0.798188, 1.363732, 1.324845, 1.526036, 0.786879, 0.808956, 1.211335, 1.242616, 0.381872, 0.777135, 0.761578, 1.760372, 0.646898, 0.608235, 1.802543, 0.728320, 0.781850, 7.199711, 0.818017, 0.393248, 0.809555, 1.218707, 1.279499, 1.905778, 0.089295, 1.597406, 0.069627, 1.263506, 0.750516, 0.829214, 0.502967, 0.827364, 0.501073, 0.841951, 0.825993, 0.432748, 2.798730, 0.782213, 0.759003, 0.775826, 0.752958, 1.215632, 1.469325, 0.080338, 0.894954, 0.814187, 0.813281, 0.530282, 0.664976, 0.547283, 0.777072, 1.920144, 0.287895, 0.225087, 0.816739, 0.883430, 1.649841, 0.800368, 0.763799, 1.270883, 0.384290, 0.147501, 0.985544, 0.808219, 1.346086, 1.404600, 0.855984, 0.076732, 1.375044, 0.367075, 0.264295, 0.427641, 0.850289, 0.863029, 0.765520, 0.745425, 0.119122, 1.441414, 0.477155, 2.200795, 0.789140, 0.477174, 0.524925, 0.913146, 1.287105, 0.521936, 0.787169, 0.502715, 0.579673, 0.792757, 0.765458, 0.477157, 0.825022, 0.465656, 0.521461, 2.429656, 1.889198, 0.506352, 0.235565, 1.176988, 0.792519, 7.490602, 0.826341, 0.819890, 0.471552, 0.802498, 0.199458, 0.511217, 6.416812, 0.757234, 0.832957, 0.819034, 0.406400, 1.253265, 0.827762, 1.305249, 0.484983, 0.522176, 0.492961, 1.299040, 23.639616, 0.828903, 0.523798, 0.494451, 0.779528, 2.961189, 0.518526, 0.383811, 0.844640, 0.498635, 0.788341, 0.916930, 5.554724, 2.371792, 1.337707, 0.436102, 0.514266, 0.506159, 0.775231, 1.283798, 0.799857, 2.749735, 0.897832, 0.520984, 0.851088, 0.623996, 0.843472, 0.778660, 1.339209, 0.835573, 0.567674, 0.818530, 0.882091, 0.464778, 0.854649, 0.505134, 0.584081, 0.397473, 0.520829, 2.052377, 1.660455, 0.556929, 0.725174, 0.692444, 1.172866, 0.747321, 1.813404, 0.881653, 0.767055, 0.515291, 1.340964, 0.829917, 1.585140, 0.880277, 1.314356, 0.757138, 0.793006, 0.767702, 1.737547, 0.789677, 0.393578, 0.482874, 0.516078, 0.785465, 0.782153, 0.451285, 0.511050, 0.615623, 1.298139, 0.766678, 0.506734, 0.872731, 0.555943, 0.785900, 1.609751, 0.798628, 1.217261, 0.398362, 0.777306, 0.744997, 2.171025, 0.836372, 1.181267, 0.830840, 1.288188, 0.773319, 0.481052, 0.857875, 1.289663, 0.282119, 0.455768, 2.251686, 1.288755, 1.324448, 0.781863, 0.223876, 1.214286, 1.291480, 1.366287, 0.329366, 0.829959, 0.375154, 1.217974, 0.776098, 3.558677, 0.503822, 0.507618, 0.065847, 1.389522, 0.341059, 0.461488, 0.552210, 1.827562, 1.370144, 0.618792, 0.513732, 0.516107, 0.508494, 0.753724, 0.820522, 2.299210, 0.878864, 0.840962, 0.410141, 1.129215, 0.723006, 0.743608, 0.501046, 0.266316, 0.263906, 0.822953, 0.492322, 1.266921, 0.788959, 0.764914, 1.533462, 1.357805, 0.796562, 0.533617, 0.517978, 0.528676, 0.850525, 1.778507, 0.803588, 0.833446, 0.562808, 0.927529, 0.370879, 0.497549, 0.375904, 0.791024, 0.705741, 0.389377, 0.495405, 0.758751, 0.761854, 0.519815, 0.733844, 1.621513, 1.271134, 1.289945, 0.335719, 0.512104, 0.488032, 2.325606, 1.759709, 0.880611, 0.520436, 0.838176, 0.739467, 0.790283, 0.748184, 0.773539, 0.261044, 1.277285, 0.789250, 1.409675, 0.758242, 0.740625, 0.784286, 0.276450, 0.385253, 0.867701, 0.767328, 0.913694, 0.780783, 0.747330, 0.794326, 5.070369, 1.316242, 1.340114, 0.523299, 0.900044, 0.500229, 0.713355, 0.826504, 0.255566, 0.296512, 0.529355, 0.682327, 1.804954, 0.494766, 0.535459, 0.740850, 2.358824, 1.254603, 1.848110, 0.749911, 0.749158, 0.499778, 1.437013, 0.790366, 0.743280, 0.470575, 0.828559, 0.462857, 0.775632, 0.766607, 7.028398, 0.875288, 1.349313, 0.359250, 0.524707, 0.856266, 0.824828, 0.742867, 0.769390, 1.308950, 2.047964, 0.529600, 0.871867, 0.800283, 0.805052, 5.547903, 0.477237, 0.500000, 0.723001, 1.281095, 0.533511, 0.836937, 0.512658, 0.752868, 1.400488, 0.486824, 0.237192, 0.288065, 1.334758, 0.743038, 0.456769, 0.798695, 1.164088, 1.488818, 2.324277, 1.414688, 1.121913, 0.369847, 0.793001, 0.852060, 0.554717, 0.507537, 0.720511, 0.826329, 0.803014, 0.380420, 0.740152, 0.747841, 1.312542, 0.813005, 0.775613, 0.745611, 1.068914, 0.808181, 0.892415, 0.497531, 0.819666, 0.275179, 0.512733, 0.504673, 0.507730, 0.811273, 0.820440, 2.341742, 2.738104, 0.869625, 1.101180, 0.754776, 1.298802, 0.252547, 0.720460, 0.459246, 0.788248, 0.785714, 0.367808, 0.389737, 0.729152, 0.788780, 1.295447, 0.481795, 0.738524, 0.777233, 1.769424, 0.501800, 1.312721, 0.692308, 1.268144, 0.667194, 0.514299, 0.366786, 0.383540, 0.767618, 0.819491, 0.653927, 1.749301, 0.943024, 1.752736, 0.765957, 0.846834, 0.400842, 1.408883, 1.319684, 0.756563, 0.779082, 1.759306, 3.711545, 0.030214, 0.841339, 0.479910, 1.633378, 1.326598, 0.511567, 0.775237, 0.231883, 1.240239, 0.772384, 1.304602, 0.522346, 0.504744, 0.510728, 2.383249, 0.460868, 0.878606, 0.500343, 0.802518, 0.874040, 0.785434, 1.117727, 1.223973, 1.222183, 0.780248, 0.498635, 0.767649, 0.823962, 1.268951, 0.476740, 0.519295, 0.483995, 0.738418, 1.943925, 0.520046, 0.521215, 0.517398, 0.730214, 1.330053, 0.796658, 0.793363, 0.796963, 0.813251, 0.809950, 3.018783, 2.510852, 0.640627, 0.519123, 0.820522, 0.824723, 0.524283, 0.532182, 1.432658, 1.770458, 1.293559, 1.670845, 0.824810, 1.266283, 0.767616, 0.380442, 1.519014, 0.291997, 0.749489, 0.504946, 0.796526, 0.776963, 0.807746, 1.121177, 1.183725, 1.298016, 0.820504, 0.384189, 0.505553, 0.365484, 0.769665, 1.764368, 1.932776, 1.751962, 0.807074, 0.509235, 0.874659, 1.274718, 0.506320, 0.384145, 0.353555, 0.534491, 0.845860, 0.739941, 0.792971, 1.263956, 1.544148, 0.433248, 0.763497, 0.797053, 0.798561, 0.826425, 0.803765, 1.108339, 0.120965, 0.228356, 0.761270, 1.255275, 0.540216, 1.325480, 0.775983, 0.505700, 1.533854, 0.321680, 0.757114, 0.218092, 0.374119, 0.466933, 0.486265, 0.838816, 1.255068, 0.455681, 0.786436, 0.729767, 0.788420, 0.776534, 0.790106, 1.265205, 1.029493, 0.827540, 0.737762, 0.574378, 0.479935, 0.525219, 0.765889, 0.341828, 1.767514, 0.894600, 0.799647, 0.929930, 1.281139, 0.774309, 0.912828, 0.298319, 0.333550, 0.498274, 0.792786, 1.290311, 0.735599, 1.423697, 0.746071, 0.525701, 0.877415, 0.384200, 0.778994, 0.768447, 0.788032, 0.800788, 0.768966, 0.495095, 0.846531, 0.845999, 0.527896, 0.708573, 3.204654, 0.338970, 0.747237, 0.797955, 0.766608, 0.806821, 6.662134, 0.519235, 11.810048, 0.820778, 0.791753, 0.304639, 0.182167, 0.738498, 0.797611, 0.845796, 0.543303, 0.768121, 1.141214, 0.309750, 0.515846, 1.301298, 0.781780, 0.497248, 0.492253, 0.922897, 0.813319, 0.803428, 1.206458, 0.377873, 0.487386, 0.846323, 0.842086, 2.351209, 9.073969, 0.519525, 0.755334, 0.836925, 0.526857, 0.920926, 0.833184, 1.282015, 0.778014, 0.249886, 0.238519, 0.516678, 0.821305, 1.323763, 1.747888, 0.776996, 1.665789, 1.729181, 0.270509, 0.405568, 0.753477, 0.754776, 0.813648, 0.753415, 0.735063, 1.638800, 1.256454, 1.332181, 0.787946, 0.466392, 0.542326, 0.748684, 1.358187, 0.790123, 6.302123, 0.772026, 0.735640, 0.776531, 0.567441, 0.694089, 0.272324, 0.510232, 0.243164, 1.498032, 1.275434, 1.304638, 0.810441, 0.305848, 0.750173, 1.133898, 0.849482, 22.620738, 2.110825, 0.790065, 1.348924, 0.779576, 0.254426, 0.469994, 1.242373, 1.285714, 0.396230, 0.499551, 5.197256, 0.821821, 0.744583, 1.267215, 0.442164, 0.790524, 1.032335, 0.763817, 0.528520, 0.791894, 0.844821, 0.508294, 0.506187, 1.224396, 2.184472, 0.815665, 0.519874, 0.786713, 0.808977, 0.535534, 0.508845, 13.055746, 1.205075, 2.061988, 0.505768, 0.599868, 1.009669, 0.796673, 0.808845, 0.714102, 0.576265, 0.049740, 0.896375, 2.060825, 0.582071, 1.291928, 8.736577, 1.325191, 0.279217, 0.503985, 1.429401, 0.531848, 1.292974, 0.737128, 0.759114, 1.061471, 0.766126, 1.326715, 0.813441, 0.829754, 0.771683, 0.820188, 1.440765, 0.795976, 0.793752, 0.772459, 1.781848, 3.926364, 0.520445, 0.781282, 0.816855, 0.894797, 2.371096, 0.466030, 0.779508, 0.518267, 1.333275, 1.311782, 0.549242, 0.827674, 0.686615, 0.775301, 0.777895, 1.216273, 0.797948, 0.523560, 1.287047, 1.760215, 21.002943, 1.347903, 0.755940, 0.734195, 0.475176, 0.845131, 1.117241, 1.252820, 0.767691, 0.905085, 0.521331, 0.375654, 0.849589, 0.776770, 0.861482, 0.708603, 14.079628, 0.753521, 1.287868, 1.289363, 0.803509, 0.885382, 0.490462, 0.815244, 1.489414, 0.780514, 0.351557, 0.791785, 0.523324, 0.778088, 3.020563, 0.486648, 1.503725, 1.305785, 1.241511, 0.812834, 0.745409, 0.481588, 1.120069, 0.830460, 0.899549, 0.842894, 0.779155, 0.777979, 0.512304, 1.130744, 0.993274, 0.733432, 0.763299, 1.282684, 0.561947, 0.821980, 0.502116, 1.066876, 5.922423, 1.326770, 0.755911, 0.527681, 0.566845, 0.359819, 0.520588, 1.494041, 1.185811, 1.062531, 0.787561, 0.771144, 1.088826, 1.263705, 1.848877, 0.791418, 2.300212, 0.257055, 0.727749, 1.260083, 0.772470, 0.790714, 0.504111, 0.649419, 0.900836, 0.507029, 12.353846, 0.496845, 0.397844, 0.497346, 9.467224, 1.311933, 0.831036, 0.473299, 1.853057, 2.141388, 0.501286, 0.516636, 0.507289, 0.740576, 0.807802, 0.729922, 0.476974, 0.522150, 1.165263, 0.561335, 0.526130, 0.517785, 0.483049, 0.871200, 1.419297, 0.888177, 1.686129, 0.805606, 0.760622, 0.760929, 1.262733, 0.425621, 8.816758, 0.771008, 4.891711, 0.502464, 0.330303, 0.510176, 1.316961, 1.203321, 0.861656, 0.609263, 0.298329, 1.800499, 0.884216, 0.521206, 0.730484, 0.745774, 1.809814, 0.577853, 0.463055, 0.413889, 0.853458, 0.853300, 0.488884, 0.738445, 1.211552, 0.604262, 0.276808, 0.531640, 0.806054, 13.263945, 0.500574, 0.520458, 0.455099, 1.236746, 1.241239, 0.281038, 7.402346, 0.815280, 1.284828, 4.564148, 0.881251, 0.599014, 0.875909, 0.785790, 0.484869, 0.517503, 0.477609, 0.839153, 0.501946, 0.547962, 0.758019, 0.411338, 1.297902, 0.807905, 12.490463, 0.491105, 0.387863, 4.869475, 9.750629, 0.495592, 0.347304, 5.404438, 4.087170, 1.025040, 1.691027, 0.766736, 0.532814, 0.412289, 0.740626, 0.770300, 0.838523, 0.514751, 0.724434, 1.311769, 0.080343, 0.879096, 0.795683, 1.286399, 1.348894, 1.443251, 1.232972, 2.548195, 0.754487, 0.763611, 0.467028, 0.541822, 1.474741, 0.786351, 2.447782, 0.655223, 0.370062, 0.499883, 0.776699, 1.135628, 1.246121, 0.818464, 0.819606, 1.991606, 4.237676, 0.767266, 0.341762, 0.380476, 0.517233, 0.782424, 1.327931, 2.388863, 1.331337, 0.800579, 0.766544, 2.212426, 1.280236, 0.882950, 0.818364, 2.602307, 0.737036, 1.279225, 0.780007, 0.710712, 0.355490, 0.910345, 0.820567, 1.313096, 12.158078, 0.441655, 0.326042, 0.239701, 0.804541, 0.822392, 0.471205, 1.804982, 1.330087, 0.773565, 0.859375, 4.570695, 0.057245, 0.274219, 8.669311, 0.447161, 1.364656, 0.790592, 0.774643, 0.775904, 0.476357, 5.486114, 0.524017, 0.424385, 0.921731, 0.875346, 0.798978, 1.187346, 0.449131, 1.299858, 0.381017, 0.471961, 0.473708, 0.551122, 0.788788, 0.460524, 1.633809, 1.089080, 1.434343, 0.794275, 0.403018, 0.520432, 1.397788, 0.978615, 1.278193, 0.811807, 1.314756, 0.801053, 0.801460, 0.804340, 0.766140, 0.369558, 0.527987, 1.312067, 0.751659, 2.253111, 3.234392, 0.721883, 0.473914, 1.512512, 1.556114, 0.793807, 0.778194, 0.837401, 0.807198, 0.457915, 3.503883, 0.916402, 1.725838, 1.290666, 5.423598, 0.501110, 0.404373, 0.771249, 1.403226, 0.768261, 5.889437, 13.243776, 0.770376, 1.783021, 0.489285, 0.758632, 0.559164, 0.901190, 0.810428, 2.957584, 6.583949, 0.781577, 1.690407, 0.481605, 0.469334, 0.791197, 0.825755, 1.324623, 0.792093, 2.676694, 0.491446, 0.474558, 0.494669, 6.841900, 0.826797, 0.514953, 0.471728, 1.903738, 0.714958, 0.758763, 1.843597, 0.788586, 0.729539, 0.550072, 0.824494, 0.170092, 0.743709, 0.836659, 0.883333, 0.817481, 0.508736, 0.465487, 0.467954, 0.753266, 1.340115, 3.723122, 1.370506, 0.831022, 0.726477, 1.278146, 0.884298, 0.692732, 0.649404, 0.385324, 1.253032, 0.748553, 0.507846, 2.341290, 0.804790, 0.511121, 0.488744, 0.529125, 0.490371, 0.453483, 1.347527, 0.463932, 0.763364, 1.814044, 0.538536, 0.782464, 0.570240, 0.511330, 0.444537, 0.389994, 0.752672, 0.808006, 0.884694, 1.247430, 0.811490, 0.807112, 0.847481, 2.259034, 0.611225, 1.488239, 1.313668, 0.829662, 0.162664, 0.794649, 0.387229, 0.061011, 0.321528, 1.609199, 2.223416, 0.639313, 1.984822, 0.759565, 1.839695, 1.257807, 1.220818, 0.807828, 0.481563, 1.323250, 3.256555, 0.435794, 1.295065, 1.103074, 0.389420, 0.492213, 0.696864, 0.792632, 1.110100, 0.155130, 0.496421, 0.745769, 1.561929, 0.839528, 0.795695, 0.111217, 0.511953, 0.382291, 1.228197, 0.778885, 1.103910, 0.471322, 0.545190, 0.662368, 0.535882, 0.811252, 1.493381, 1.881303, 0.794633, 0.797117, 0.945383, 1.727941, 0.061477, 0.508623, 0.790493, 0.745378, 0.506057, 2.731367, 0.366270, 1.715514, 2.015364, 0.500118, 0.517326, 0.897570, 1.361710, 0.650460, 0.779152, 0.789658, 0.834098, 0.670024, 1.247492, 1.291917, 1.961103, 0.561862, 0.469232, 0.518649, 0.786174, 0.735714, 0.812210, 1.297074, 0.834749, 0.812017, 0.772743, 0.835481, 0.398675, 0.480679, 0.801491, 1.769500, 5.644570, 0.463574, 0.778556, 1.351991, 0.536408, 0.540572, 1.317029, 0.754806, 3.853032, 0.355887, 0.540898, 0.778089, 0.699335, 0.576621, 0.801577, 1.255490, 2.410220, 1.272598, 0.555087, 0.641815, 0.501918, 0.734906, 0.742515, 1.055542, 0.171281, 0.518144, 0.389576, 0.849606, 1.375504, 0.772632, 0.781338, 1.310781, 0.435556, 0.836377, 0.498785, 0.511964, 0.497228, 0.455296, 0.766796, 2.261910, 0.191579, 0.694495, 6.925984, 0.800504, 0.802757, 3.638339, 0.760611, 0.733514, 0.789228, 0.522462, 0.755936, 0.762509, 2.715386, 0.538615, 1.498373, 0.569978, 0.753734, 0.477457, 0.470136, 0.520394, 1.268722, 0.460567, 0.521387, 0.536742, 0.517361, 1.228269, 1.808095, 0.869625, 2.025719, 2.556988, 3.998178, 0.489919, 0.481550, 0.640622, 1.826087, 1.224127, 0.741173, 0.151937, 0.750175, 3.846975, 0.810900, 0.969543, 0.710864, 1.484994, 0.358695, 10.724568, 0.833693, 0.952453, 1.833986, 1.221677, 0.513578, 0.384588, 0.503863, 0.146675, 0.925765, 1.313161, 1.342754, 0.781818, 0.537957, 0.802676, 0.911169, 0.428144, 12.644723, 2.258675, 0.273719, 0.057348, 0.446356, 0.781019, 0.489700, 0.399783, 0.870661, 1.297778, 0.872962, 1.633143, 0.782345, 0.507351, 0.666022, 0.786207, 0.895628, 1.333681, 1.174162, 3.496709, 1.270486, 0.187196, 0.740766, 0.769446, 1.795326, 0.695888, 0.794220, 0.794191, 0.834814, 0.302508, 0.546917, 0.739972, 0.576589, 0.787088, 0.533840, 0.692595, 2.217062, 0.037032, 1.302367, 0.791681, 0.817531, 0.848797, 0.536286, 1.402863, 1.687884, 0.768237, 0.789436, 0.805485, 0.725271, 0.783831, 0.972475, 0.798798, 0.168433, 0.187062, 1.156427, 0.775582, 0.495626, 1.243756, 0.761770, 1.181877, 1.741565, 1.341105, 1.288984, 0.780000, 0.521599, 0.505032, 0.504684, 1.351975, 0.452542, 0.521946, 0.535115, 2.767898, 0.525275, 0.759194, 0.538821, 0.520139, 1.118051, 0.331219, 0.764298, 0.943667, 0.811818, 0.481256, 0.521554, 0.743724, 4.412483, 0.264747, 0.843587, 0.453519, 1.612224, 0.530821, 0.777309, 0.814975, 1.910464, 0.854273, 1.297190, 0.512826, 0.763167, 1.181880, 0.758682, 2.059165, 3.876766, 0.858238, 6.586724, 0.758467, 0.789511, 0.503627, 0.523577, 1.295194, 0.709587, 0.822150, 0.781805, 1.024787, 0.895501, 0.844815, 0.762287, 1.545594, 1.258443, 1.755736, 0.449893, 0.803144, 0.794572, 1.427110, 1.869212, 0.779707, 0.792265, 0.379887, 9.390144, 0.860246, 0.619874, 0.802469, 0.765753, 0.746822, 3.363512, 0.791105, 0.517866, 0.072715, 0.737294, 0.741869, 0.489886, 0.521168, 0.878128, 5.368744, 1.326458, 0.191140, 0.631861, 6.691315, 0.196919, 0.707401, 0.691296, 0.850169, 10.225725, 0.511443, 0.509320, 0.530039, 3.244711, 0.458343, 0.789965, 0.598374, 0.801431, 0.980538, 0.837700, 1.080000, 0.180846, 0.265157, 1.343662, 0.537830, 0.484023, 0.730247, 1.434230, 0.809130, 0.867265, 0.490999, 0.777897, 0.748887, 0.778922, 0.481473, 0.910620, 0.455260, 0.820901, 0.842632, 9.357382, 1.267181, 0.506193, 0.359862, 0.349400, 0.726508, 0.798162, 0.721177, 1.421166, 1.230946, 0.388664, 0.488313, 0.768988, 0.437297, 0.490705, 1.310506, 1.782164, 1.342374, 2.938871, 0.859833, 0.532586, 0.321166, 0.483801, 1.217254, 0.810638, 1.455164, 0.775222, 0.408983, 1.005716, 0.815307, 1.308336, 1.295151, 0.776542, 0.224734, 1.091371, 4.058635, 1.302772, 0.530508, 0.564269, 0.488424, 1.263405, 3.055293, 0.730823, 0.501711, 0.475142, 0.472088, 0.790232, 0.815723, 0.634907, 0.865778, 0.203701, 0.771497, 1.269518, 0.051081, 0.502481, 0.709942, 0.848012, 0.606094, 0.766467, 0.846909, 1.322647, 0.795876, 1.321990, 1.229916, 0.816553, 0.508941, 0.491769, 0.828419, 8.374957, 2.041435, 2.592127, 0.423085, 0.765428, 8.611966, 0.509112, 0.471020, 0.512574, 0.747525, 1.279973, 0.518733, 1.894432, 0.510614, 0.775678, 0.778094, 0.488090, 0.496210, 0.488398, 1.149417, 0.897597, 1.142291, 0.812355, 0.835341, 0.332689, 0.765255, 31.642569, 0.493894, 1.060746, 2.235475, 1.312855, 0.772183, 1.355251, 0.843973, 0.500684, 0.741980, 0.764301, 0.396415, 0.514943, 0.656295, 0.793880, 0.763687, 0.831518, 5.278296, 0.347270, 0.749397, 0.768429, 1.296909, 1.768717, 0.479622, 0.484434, 3.648516, 0.496903, 1.372809, 1.268301, 0.729853, 9.440387, 0.744770, 0.196551, 0.514035, 1.276873, 0.752154, 0.729259, 1.349771, 0.738959, 1.665284, 0.505343, 0.491781, 1.502855, 0.796264, 0.510648, 0.535009, 0.876485, 2.591141, 0.813401, 0.376501, 0.392250, 0.793803, 0.795117, 1.331098, 1.252225, 0.819727, 0.527863, 1.149750, 0.807530, 0.785813, 0.410605, 0.484909, 0.226727, 0.563025, 1.876274, 0.847080, 0.796732, 0.813620, 0.516280, 3.224345, 1.322171, 0.523232, 0.262876, 0.892458, 0.786970, 1.378858, 1.098331, 0.509026, 0.485194, 0.492120, 0.480909, 1.219277, 0.822399, 0.790507, 0.355111, 1.271541, 1.372982, 0.506118, 0.490669, 0.494179, 1.320870, 2.729659, 2.953740, 7.855615, 0.182098, 0.054720, 0.508333, 0.354870, 1.272253, 0.791652, 0.730164, 1.315102, 0.844693, 0.795683, 0.825837, 0.216674, 1.377684, 1.359011, 1.330212, 0.413177, 0.858821, 0.475652, 3.400140, 0.811052, 0.537137, 0.324645, 0.518338, 0.755524, 0.980623, 1.443133, 0.728556, 0.733241, 0.492660, 0.772205, 0.781552, 0.826056, 0.546793, 0.322348, 0.877691, 0.815960, 1.959680, 0.476295, 0.529783, 0.551090, 0.808150, 0.800281, 0.518039, 1.461945, 0.633694, 0.797555, 1.783634, 0.859269, 1.624630, 0.171330, 0.798258, 1.325480, 2.219718, 1.354625, 0.515671, 0.434388, 1.512876, 0.443320, 1.305854, 0.773353, 0.833813, 7.598623, 1.465168, 0.701125, 0.293278, 0.798780, 0.751553, 0.823676, 0.803503, 0.316985, 0.408900, 0.760885, 1.231004, 1.268601, 0.308715, 0.437887, 1.300620, 0.723697, 0.496890, 0.475337, 0.629133, 1.476314, 0.773544, 1.254874, 9.195385, 0.510633, 0.374556, 0.492449, 0.607003, 1.205550, 4.233826, 1.264808, 0.752696, 2.701999, 0.775205, 0.719292, 0.646085, 0.826406, 0.926533, 0.515225, 1.308518, 0.804138, 0.542169, 1.613540, 0.530331, 0.459701, 0.821698, 0.761284, 0.232029, 0.777141, 1.289384, 0.779566, 0.794991, 1.294097, 0.834938, 3.905217, 0.504178, 0.489688, 0.524302, 0.768326, 1.372161, 1.285714, 1.147329, 5.143998, 0.175145, 0.759528, 0.760240, 1.208019, 0.877420, 0.792304, 0.812785, 0.776034, 2.220022, 1.305361, 0.792978, 0.181667, 0.745194, 1.267675, 1.630872, 0.753061, 2.683181, 0.759720, 1.305680, 1.433286, 1.121489, 0.493259, 0.862972, 0.505920, 0.786978, 0.811493, 0.514737, 0.215884, 0.863029, 0.834912, 0.793580, 0.733424, 1.419083, 0.499883, 1.934978, 0.553879, 1.675752, 0.489280, 2.427742, 0.759383, 0.789585, 2.166726, 0.791725, 0.756106, 0.507615, 0.380386, 0.489740, 1.345075, 1.278554, 0.021831, 0.405001, 1.230922, 0.824425, 1.341892, 1.222144, 1.227378, 0.208679, 0.787119, 0.809506, 0.648902, 0.095092, 0.379966, 0.404121, 0.889120, 1.838847, 0.377800, 2.584339, 0.166552, 0.800978, 0.507198, 0.839423, 0.766365, 0.802827, 0.822206, 13.384187, 1.170648, 1.216052, 0.165414, 1.310159, 0.823888, 1.759615, 0.775088, 0.576049, 1.115819, 1.237703, 2.897048, 0.774638, 0.770617, 1.084861, 0.518459, 0.476106, 0.778836, 1.588319, 0.404964, 0.980245, 0.512844, 0.765625, 0.777937, 0.530281, 0.501900, 2.446912, 1.258780, 1.440104, 0.330116, 0.545667, 0.776021, 0.112013, 9.560867, 0.510218, 0.529109, 0.343583, 1.416127, 1.348278, 0.894836, 0.488647, 0.746025, 0.789362, 0.913514, 2.875219, 0.632102, 0.784767, 1.147152, 0.740356, 0.551920, 0.799867, 0.549396, 1.228928, 0.784271, 0.505400, 0.890142, 0.460265, 0.834418, 0.799854, 0.077352, 0.855340, 1.959046, 0.849219, 1.346648, 2.173942, 0.804993, 0.314264, 0.092677, 0.098837, 0.739772, 0.379671, 0.283929, 0.773768, 1.147161, 0.890343, 0.790793, 0.767914, 0.786549, 0.813195, 5.373524, 0.955162, 4.070738, 2.450199, 2.424907, 0.065927, 1.278294, 0.214525, 0.854446, 0.863402, 0.765313, 0.741620, 0.790572, 0.766492, 1.699681, 1.110381, 0.819557, 0.741044, 1.017007, 0.789622, 0.767220, 0.725271, 8.158349, 1.307884, 1.332624, 0.486570, 0.509259, 0.482720, 0.741935, 2.488364, 0.532377, 0.518510, 0.491954, 0.528772, 0.749407, 0.472216, 0.456373, 0.521991, 4.255276, 1.630457, 0.763359, 0.823550, 1.520644, 0.739502, 0.826806, 0.461402, 0.519801, 3.789749, 0.792887, 0.357009, 0.373356, 0.465080, 0.817980, 0.751687, 1.241132, 0.809095, 0.823895, 0.497043, 0.773315, 1.374235, 0.777659, 0.917758, 0.190701, 0.390944, 0.796848, 0.651167, 1.143749, 0.810870, 0.554912, 0.372828, 0.801546, 0.913336, 1.584812, 0.507828, 3.021755, 1.350673, 0.819982, 0.700176, 0.518046, 1.221671, 0.707730, 0.525253, 3.644997, 0.512743, 1.811720, 1.740313, 1.267348, 0.547859, 0.510363, 0.402926, 1.698563, 1.314879, 2.876747, 0.694359, 0.836318, 0.242668, 0.526597, 0.834468, 0.191863, 0.506682, 1.805450, 0.493437, 0.735143, 1.261966, 0.485642, 0.858002, 0.501576, 0.856017, 0.764111, 0.392227, 1.495785, 0.498289, 0.757173, 0.809490, 0.510633, 0.203061, 0.760522, 0.927163, 1.309064, 1.292480, 0.785614, 1.345622, 1.582840, 0.843210, 1.235856, 0.749650, 0.499432, 1.401095, 0.835817, 0.912658, 0.792072, 1.267694, 0.429755, 0.540211, 0.863486, 1.314704, 0.744335, 0.168486, 0.168984, 0.792423, 1.347312, 0.489485, 0.812885, 1.232599, 1.285461, 0.851180, 0.867793, 0.827033, 1.621062, 1.123275, 0.655781, 1.291509, 1.307665, 1.463279, 0.317471, 0.751875, 0.822551, 0.790413, 0.273205, 1.304835, 0.798376, 9.413913, 0.821506, 3.417483, 1.272352, 0.512861, 0.382906, 0.496644, 0.784388, 0.841270, 1.236748, 0.932701, 0.511196, 0.800141, 0.775373, 0.505364, 0.430573, 2.066482, 0.354700, 0.793409, 0.687643, 0.447125, 3.807835, 1.224374, 1.242435, 1.236491, 1.116220, 1.313962, 0.765798, 1.046348, 0.503175, 0.472353, 0.745599, 0.138583, 0.531538, 0.789159, 0.846291, 0.794406, 1.247148, 1.212443, 0.866298, 0.485537, 0.817120, 1.334778, 2.008250, 0.309730, 0.766457, 0.891212, 1.311526, 0.781250, 0.764665, 0.740179, 0.489549, 0.488067, 1.766804, 2.242465, 0.889532, 1.607634, 0.510944, 0.762276, 3.471333, 0.812899, 0.451228, 0.462179, 1.187709, 0.722800, 0.608513, 0.892224, 6.090843, 7.935606, 1.253105, 0.200553, 0.541961, 2.119501, 0.649878, 0.542141, 0.532937, 0.779357, 3.096259, 0.523369, 1.282609, 0.492961, 0.729545, 2.862807, 0.487488, 8.101076, 0.766088, 1.213821, 0.685632, 1.478124, 1.070610, 0.782137, 15.473565, 2.450526, 0.525754, 0.536387, 7.854487, 0.777973, 0.802477, 1.766801, 2.801326, 0.167698, 0.761043, 0.797824, 3.729159, 0.615685, 0.517007, 0.795683, 0.788401, 0.527594, 0.784132, 2.807624, 1.295141, 1.172391, 0.481189, 0.756374, 3.796870, 0.791785, 0.817647, 0.494186, 0.505076, 1.239446, 3.552141, 0.475972, 0.437444, 0.163927, 0.798596, 0.771214, 0.528654, 0.733980, 0.746060, 2.175787, 0.795398, 0.875591, 0.762783, 2.011091, 0.843693, 0.764205, 3.439739, 0.522008, 3.003076, 3.282821, 0.491839, 0.784783, 0.786710, 0.524982, 1.176701, 4.875315, 0.777184, 1.473848, 0.790047, 0.808140, 0.335205, 0.854167, 3.667228, 0.813375, 0.789455, 0.169069, 1.235172, 1.186731, 1.641503, 0.784631, 1.796830, 0.226109, 3.256965, 0.568419, 2.043337, 1.064479, 0.384439, 1.152815, 0.747495, 0.496496, 2.872427, 0.792069, 0.752262, 0.805976, 0.711272, 0.732687, 0.536334, 1.619157, 1.071709, 7.385614, 0.726738, 0.738904, 0.849886, 0.529196, 0.771960, 1.375798, 0.507055, 0.508852, 0.507168, 2.980399, 2.148713, 0.809167, 0.912080, 0.059967, 0.425684, 0.236388, 2.882458, 3.655906, 1.276440, 0.744269, 1.330094, 0.763533, 1.471353, 0.255054, 0.528727, 1.026590, 0.759738, 1.112944, 1.244926, 0.768193, 2.245235, 0.878652, 0.812784, 0.464195, 0.753744, 0.804292, 0.736728, 1.401982, 2.473758, 0.799691, 0.745119, 2.449550, 0.499551, 0.400840, 0.798863, 0.563723, 1.317255, 0.159924, 0.172369, 0.772104, 0.777464, 0.498421, 0.850343, 0.758742, 1.278671, 2.414617, 0.272560, 0.784859, 0.600393, 0.787354, 0.795868, 1.243677, 1.222879, 4.182750, 0.319994, 0.508008, 1.788718, 2.420384, 0.861473, 0.516999, 0.768489, 4.182679, 5.148659, 0.343330, 0.780263, 0.497309, 0.814251, 10.812043, 10.499646, 0.743692, 1.627239, 0.804042, 0.792083, 1.039248, 3.006804, 1.243686, 8.348829, 0.462380, 0.833691, 0.374241, 0.483534, 0.548813, 0.527184, 1.635279, 0.768081, 1.830195, 4.263176, 0.882250, 0.521470, 0.371758, 0.476094, 1.680131, 0.817283, 0.807938, 0.370260, 0.550145, 0.512698, 0.782289, 0.712367, 3.177688, 0.483592, 0.530040, 0.733507, 0.774262, 0.519031, 0.495774, 0.804270, 4.070772, 0.416104, 0.742734, 0.377321, 0.866343, 1.395546, 1.907871, 0.543415, 0.806314, 0.154379, 0.764502, 0.777229, 0.489172, 0.742476, 0.827662, 0.803483, 0.901840, 0.310910, 1.311986, 0.792865, 1.272334, 0.729436, 0.772582, 0.460677, 0.834869, 0.826772, 1.367362, 0.505293, 0.778012, 1.571379, 1.290113, 0.507638, 2.447873, 0.304033, 0.435299, 0.493399, 1.220747, 0.556925, 1.266071, 0.786670, 1.063497, 0.171286, 0.473241, 2.383557, 6.831089, 1.067436, 0.378904, 0.555880, 0.633668, 0.504153, 0.487735, 0.682230, 2.401981, 0.814378, 0.510380, 0.851582, 0.869423, 0.762431, 0.766143, 2.159582, 0.605444, 0.500115, 1.192294, 0.527579, 1.262823, 0.746789, 0.536591, 3.369570, 1.596495, 0.779198, 0.480839, 0.727542, 0.480392, 0.769231, 0.859222, 0.660516, 0.299509, 0.493231, 0.828173, 1.204005, 1.341437, 1.285047, 0.526366, 0.626613, 0.556223, 0.663457, 0.751325, 0.773118, 0.776030, 0.758633, 1.243367, 0.778297, 1.348933, 0.766216, 0.531808, 0.781263, 0.514521, 0.946786, 0.535939, 1.321691, 0.771329, 0.772487, 2.232233, 1.780142, 1.345515, 0.715427, 0.237971, 0.840080, 0.770238, 0.795584, 0.506915, 1.102700, 0.504471, 0.851351, 0.278347, 0.764177, 4.254720, 1.351323, 0.778298, 0.716183, 0.748148, 0.844682, 0.501835, 0.478289, 0.861051, 0.808298, 0.494091, 0.774457, 1.662432, 0.426640, 0.854820, 0.508440, 0.483995, 0.810830, 1.263997, 1.132198, 1.291242, 0.795623, 0.663345, 0.474613, 0.482014, 0.817986, 0.541809, 1.043373, 0.545005, 0.675889, 0.790996, 1.323623, 0.768237, 1.859882, 4.308063, 0.261499, 0.854356, 0.396415, 0.834270, 7.657052, 0.570724, 1.396279, 1.962410, 0.759565, 0.752235, 0.803186, 0.843831, 0.798927, 0.847359, 0.511254, 0.529315, 1.073950, 0.295203, 1.399132, 0.802930, 0.497410, 0.512756, 0.834614, 0.805072, 1.532997, 0.229432, 0.780895, 0.959061, 1.112002, 0.740453, 0.473128, 0.789436, 1.425628, 0.526100, 0.538800, 0.497935, 0.819944, 0.734622, 0.813959, 0.699567, 0.886358, 0.825045, 0.794379, 0.837560, 0.514619, 1.013420, 1.827169, 0.824180, 0.155753, 0.797457, 0.631075, 1.396640, 0.803907, 0.812033, 1.686796, 0.716268, 1.313945, 0.812039, 1.375718, 1.531306, 0.472165, 0.508768, 6.175870, 3.549005, 0.752492, 1.307197, 0.400072, 0.467886, 0.763488, 0.814801, 0.992817, 0.256361, 0.518039, 1.267012, 1.857394, 0.796316, 0.483871, 0.752154, 1.049332, 0.751572, 0.575282, 0.498207, 0.501365, 0.826337, 0.533143, 0.522659, 3.724199, 0.044130, 1.295810, 1.289392, 0.529224, 0.571083, 0.759332, 1.771949, 6.257490, 0.321703, 0.461408, 1.277893, 0.486064, 0.510609, 0.512364, 0.866809, 0.854881, 0.753932, 0.802443, 0.773315, 0.539223, 0.527639, 0.782672, 0.676251, 0.511369, 1.130081, 0.851838, 0.769339, 1.170794, 1.146253, 0.327069, 1.387482, 1.257153, 1.156122, 0.515459, 0.472057, 0.497322, 0.211978, 0.315915, 0.383408, 0.792330, 1.825983, 0.750439, 0.401189, 0.875630, 0.769518, 0.448885, 0.846182, 0.498399, 0.839020, 0.490857, 0.802977, 0.755691, 0.469684, 0.271168, 0.774768, 1.260638, 1.709746, 1.164657, 0.490412, 0.508981, 0.737179, 3.132190, 0.707416, 0.334962, 0.496746, 0.834345, 1.331159, 0.775717, 1.389183, 0.531547, 0.845066, 0.699593, 0.780367, 0.782164, 0.497530, 1.414841, 1.216264, 1.345865, 0.875261, 0.499887, 0.491670, 0.724434, 1.174021, 6.686768, 0.196918, 0.495021, 1.745918, 0.740821, 0.807498, 0.780311, 0.461928, 0.300113, 0.511821, 0.817273, 1.274775, 1.821725, 0.515588, 0.863551, 0.398715, 1.496111, 0.757197, 0.766775, 0.829420, 0.516051, 1.387262, 0.643955, 0.457894, 0.796205, 1.750000, 0.521870, 0.505126, 0.522257, 0.789294, 0.763917, 3.449086, 2.971236, 0.899270, 0.459298, 7.867971, 2.621278, 0.695055, 0.752388, 0.837518, 0.816684, 0.582781, 0.784486, 0.501591, 0.517210, 0.763884, 1.286413, 1.147321, 1.701351, 0.252291, 0.536366, 1.320082, 1.836899, 0.831967, 0.486167, 0.770095, 1.414391, 0.500208, 0.513676, 0.764384, 0.577086, 0.514827, 0.538353, 0.645795, 1.294677, 1.650421, 0.809993, 0.762193, 2.245074, 5.974677, 1.438609, 1.336006, 0.841196, 0.515934, 0.661146, 0.768313, 0.780724, 0.511085, 0.511350, 0.859099, 0.815992, 0.512070, 1.259986, 0.763048, 0.811443, 0.798883, 1.366924, 0.862988, 1.213227, 0.227754, 0.587376, 1.303614, 0.527879, 2.345953, 1.210580, 1.191354, 1.016715, 0.793363, 0.751435, 0.330170, 0.556704, 0.846136, 1.224044, 0.787083, 0.228610, 0.837856, 0.904855, 2.308221, 0.839515, 0.738659, 0.518383, 0.486541, 0.799930, 0.798944, 0.884668, 0.782065, 0.769783, 0.795051, 0.759790, 0.514436, 0.511397, 0.194211, 1.362680, 1.272116, 1.052434, 0.930637, 0.764927, 0.755762, 0.512529, 1.427563, 2.382773, 0.777351, 0.843044, 0.526179, 0.515152, 0.498421, 0.807036, 2.519748, 0.296649, 0.520456, 0.818729, 0.805126, 0.753809, 0.519781, 0.324295, 5.554570, 0.632394, 0.768101, 0.525428, 0.517655, 0.496707, 0.800365, 0.755596, 0.831393, 0.473678, 0.761809, 0.776830, 0.388346, 0.796678, 0.796222, 0.945381, 0.805114, 0.756217, 0.754533, 0.761458, 0.464070, 0.564299, 0.740087, 13.184487, 1.322471, 0.766026, 1.108468, 0.583213, 0.479190, 0.850182, 1.245095, 1.231323, 0.771624, 0.070933, 0.781981, 0.772337, 1.355666, 0.503741, 0.855548, 5.759476, 0.704043, 0.504820, 0.809559, 0.831494, 0.621007, 0.752975, 1.318540, 1.010730, 0.511361, 0.189115, 0.780021, 3.252052, 0.262413, 0.523277, 0.527134, 1.248672, 1.325368, 1.409973, 0.808121, 1.171484, 0.843013, 0.822662, 0.752696, 0.523546, 0.549732, 0.515711, 1.294023, 1.461987, 1.295726, 0.474505, 0.743441, 1.222997, 1.332475, 1.651773, 0.805994, 0.516813, 1.130435, 0.817010, 0.759533, 0.803735, 0.515013, 0.429155, 0.300115, 0.770924, 1.284501, 1.338622, 0.522307, 0.483907, 0.229184, 2.197336, 1.483935, 1.713730, 0.792980, 0.908272, 0.825487, 0.854121, 0.851234, 0.812102, 1.309967, 1.746420, 1.340280, 0.492052, 0.476909, 0.900884, 0.732855, 1.366118, 1.911584, 0.492760, 0.523026, 1.209222, 0.790253, 7.900909, 0.841826, 1.302551, 0.771751, 1.145866, 0.370274, 0.480727, 0.744567, 0.813676, 0.797935, 0.735325, 0.578238, 1.337958, 0.855399, 1.322453, 0.304471, 0.485654, 0.509863, 0.798917, 0.739915, 0.273112, 0.507789, 4.276677, 0.776003, 0.805829, 0.500000, 0.499298, 0.484088, 1.002460, 1.524728, 1.292120, 1.172808, 0.803732, 0.766655, 1.288593, 0.772853, 0.620461, 1.729674, 1.608929, 0.831354, 0.781219, 0.772206, 0.562136, 0.528031, 0.364712, 0.801808, 1.521678, 0.751914, 0.772842, 1.829939, 0.904987, 1.496934, 0.745247, 0.856245, 1.299533, 0.501117, 0.371782, 0.839785, 1.233175, 0.796859, 0.803369, 0.886444, 1.178736, 0.400516, 0.815938, 0.694120, 0.830609, 0.738617, 0.840783, 0.510648, 0.541171, 0.803929, 1.909191, 1.920553, 0.497380, 0.829228, 1.372757, 0.728933, 0.494785, 0.498984, 1.105209, 1.565461, 0.797016, 0.558738, 0.780185, 0.758740, 0.514800, 0.511863, 1.295799, 0.758573, 0.535565, 4.707944, 0.517992, 0.821326, 0.760553, 0.523573, 0.783207, 0.831826, 1.262894, 0.499546, 0.919026, 0.393657, 0.521337, 0.474695, 0.791292, 0.373106, 0.768876, 0.511290, 0.811597, 0.859426, 7.277690, 0.804020, 0.510386, 0.821020, 0.581802, 0.849507, 1.350385, 0.732708, 0.781774, 0.477741, 0.510844, 0.490925, 0.798152, 0.812726, 0.950714, 0.518134, 0.517963, 0.778010, 0.391928, 0.288851, 0.349764, 1.806119, 1.492608, 1.337799, 0.712770, 0.876460, 0.588732, 1.255790, 0.788248, 0.773714, 0.774624, 0.524095, 0.511299, 3.540694, 1.793768, 0.864632, 1.206507, 2.129054, 0.783859, 0.793772, 0.806867, 0.283975, 0.540258, 0.811524, 1.367070, 0.811791, 0.604075, 0.720598, 1.368224, 1.859199, 0.872485, 1.411703, 0.849283, 0.815102, 0.802426, 0.920345, 0.844268, 0.497495, 6.723024, 0.771114, 1.434114, 0.471362, 0.515858, 0.505393, 0.756185, 0.403027, 2.022135, 0.854092, 1.676997, 0.808708, 0.845635, 0.870862, 1.160764, 0.696732, 0.784353, 0.323842, 0.773306, 0.812367, 0.706186, 1.389795, 5.805706, 2.561901, 3.603964, 0.815385, 0.804594, 0.769020, 7.612121, 4.643090, 0.756914, 0.414957, 0.520667, 1.223203, 0.410159, 0.497547, 0.767401, 7.743940, 1.248977, 0.519291, 0.723615, 0.231023, 1.287997, 0.908968, 1.093970, 0.784922, 0.813101, 0.524249, 0.381656, 0.369025, 0.716230, 1.723054, 0.800882, 1.189486, 0.500000, 1.290048, 0.796296, 11.343919, 1.426339, 0.867876, 0.800348, 0.800855, 0.481249, 0.305260, 1.006854, 0.755976, 0.779119, 0.769529, 1.329849, 1.121876, 0.764963, 1.174943, 0.415690, 1.297084, 0.755810, 0.792832, 0.257788, 0.941759, 1.281101, 1.284746, 0.727972, 0.524676, 0.916168, 0.463382, 0.760186, 11.198231, 1.059685, 1.737550, 1.710119, 0.739938, 0.790503, 0.523310, 0.522661, 1.314533, 0.958496, 0.892711, 0.708029, 0.908149, 0.498635, 0.732267, 0.840321, 0.863150, 0.515726, 0.485671, 1.562757, 0.753171, 0.393506, 0.741193, 0.823385, 0.371691, 0.402496, 0.782396, 0.810172, 1.287227, 1.261561, 1.811353, 1.297770, 5.517849, 1.134839, 0.271901, 1.405602, 0.854372, 0.757922, 1.440331, 0.769231, 1.743355, 0.833593, 0.738748, 0.796995, 0.740415, 0.796537, 0.513025, 1.124956, 1.454900, 1.125759, 0.759450, 0.750436, 0.522923, 0.487952, 1.258043, 1.275153, 0.513440, 0.796432, 2.280545, 1.324577, 0.816415, 28.049551, 0.773040, 0.307248, 0.514545, 0.499778, 0.866544, 0.830699, 0.837745, 0.317186, 1.119907, 0.487848, 0.736769, 1.740063, 1.318489, 0.371728, 1.271093, 1.371334, 0.794718, 0.793931, 1.403166, 1.620868, 1.460957, 3.727841, 0.484972, 0.748678, 1.873754, 1.113582, 0.392615, 0.796251, 0.773454, 0.450519, 1.435047, 0.462159, 0.518872, 0.754472, 0.742489, 0.530747, 0.766667, 0.652705, 0.771546, 0.797203, 0.732602, 0.808009, 0.489195, 0.544208, 0.874344, 0.758238, 0.592572, 0.535469, 0.488835, 0.529051, 0.776639, 0.792622, 0.293505, 0.821652, 0.483100, 1.328792, 0.737198, 0.845048, 1.039991, 0.827933, 0.242125, 0.746964, 0.814147, 0.797675, 12.114996, 0.671307, 0.757332, 0.461128, 0.485297, 1.155740, 0.780705, 0.753312, 0.532827, 0.856323, 0.489773, 0.798039, 0.483209, 0.191383, 0.898170, 0.771538, 1.227106, 0.456098, 0.396751, 0.778836, 0.766162, 1.327375, 1.726734, 1.109070, 0.864794, 0.577117, 0.741283, 0.429096, 0.571239, 0.737526, 0.891112, 0.767596, 0.771716, 0.833941, 0.705143, 0.836135, 0.731256, 0.756259, 0.390938, 0.513167, 0.485435, 0.776940, 0.775407, 0.643882, 1.364563, 0.375567, 0.713139, 0.815713, 0.793310, 0.354935, 11.076352, 0.843234, 0.640370, 0.786063, 1.334299, 0.879220, 0.508129, 0.534676, 0.835260, 0.787211, 0.268221, 1.570053, 0.472258, 0.798664, 0.730533, 8.688735, 0.733557, 0.535368, 0.493900, 0.959651, 2.238877, 0.762284, 0.517289, 0.510971, 0.370409, 0.719986, 0.770119, 1.378886, 1.265466, 0.507645, 1.195727, 0.757332, 1.811826, 1.316995, 0.436515, 2.038312, 0.830918, 1.315296, 0.516618, 1.129821, 2.194823, 1.849709, 2.267705, 0.808673, 0.495427, 5.918123, 0.752134, 0.795706, 0.799715, 1.842458, 1.833508, 1.900904, 0.522795, 0.493319, 0.726018, 0.779522, 0.739220, 1.319048, 0.785233, 0.401712, 0.479055, 0.835252, 1.275078, 0.748332, 0.296537, 0.498119, 0.673315, 0.873894, 1.392550, 0.811878, 0.783804, 2.072924, 1.206760, 0.183127, 0.310853, 0.794263, 0.510867, 1.191726, 1.761265, 0.789886, 0.743853, 1.622767, 0.852603, 1.288881, 1.678739, 0.825976, 0.795091, 1.220705, 0.889775, 1.281560, 1.287253, 0.542702, 0.833012, 0.851622, 0.692356, 0.847579, 1.378219, 0.330334, 9.375089, 1.338048, 0.862888, 0.899385, 1.268234, 1.663969, 1.797937, 0.477283, 0.801429, 5.296897, 0.554419, 0.815761, 1.333930, 1.651439, 0.864581, 0.744392, 0.789685, 0.787987, 0.404866, 0.401652, 0.524477, 0.854820, 0.402888, 2.322650, 1.195329, 1.858161, 13.893602, 0.788162, 0.796595, 1.277483, 0.819294, 1.964221, 0.322998, 0.959125, 1.306225, 1.271896, 0.810029, 0.479583, 0.439821, 0.512814, 0.757913, 1.300388, 1.233286, 0.780677, 0.718334, 0.740460, 0.492810, 0.751134, 0.814375, 0.755060, 1.532990, 4.508084, 1.347858, 1.815117, 0.415812, 0.390016, 0.483107, 1.310763, 1.301873, 0.449453, 0.399307, 0.590257, 1.690698, 0.382202, 0.323379, 0.510064, 0.780720, 0.797201, 0.555318, 0.857404, 0.466523, 1.098275, 0.887859, 0.476899, 0.791407, 0.769097, 0.340713, 0.523221, 0.814227, 1.386103, 0.809261, 0.796528, 0.794863, 1.370567, 1.061332, 0.407400, 2.449006, 0.524601, 0.874943, 0.757629, 0.841206, 2.028333, 0.411374, 0.541811, 0.502888, 1.247769, 0.754196, 0.792101, 0.812894, 1.137330, 1.084558, 0.550602, 1.161034, 2.604863, 1.295655, 1.095980, 0.493492, 0.643653, 1.817208, 0.761225, 0.531616, 0.417139, 0.489042, 0.539902, 0.279683, 0.452293, 0.337247, 0.487837, 2.214085, 1.319635, 0.806395, 0.476580, 4.995863, 0.904773, 2.275899, 1.330070, 1.290024, 0.805214, 0.725135, 0.867931, 0.269133, 1.725177, 1.293141, 2.178695, 0.404671, 0.723235, 0.505258, 1.341214, 1.215948, 0.468488, 0.933752, 0.903147, 0.299561, 1.131453, 0.788727, 0.601298, 0.411425, 1.825442, 3.683486, 0.586573, 9.435905, 0.595829, 0.784797, 0.530836, 0.837903, 0.726614, 1.214870, 15.018427, 0.787933, 10.427660, 0.793668, 1.435401, 0.801185, 0.803133, 1.667870, 0.518628, 1.272201, 0.827246, 0.706707, 0.545810, 0.774136, 1.558457, 1.470980, 0.794659, 0.784139, 0.805000, 0.883065, 2.292915, 1.837218, 1.347533, 1.837808, 1.394412, 0.806440, 0.820603, 1.346490, 0.789013, 0.840473, 0.446028, 2.802426, 0.814789, 1.384951, 7.837148, 0.882958, 0.667492, 0.751819, 1.259643, 0.812343, 0.740152, 0.790205, 11.397153, 0.839588, 0.752432, 4.710293, 1.160906, 0.335035, 1.753541, 0.675361, 0.793458, 0.820465, 1.172457, 0.797198, 0.863135, 1.323625, 0.760377, 0.823551, 0.729379, 0.802651, 0.794633, 0.865082, 0.768222, 1.829478, 1.751678, 1.317780, 0.762846, 0.760995, 0.755780, 0.495329, 0.996335, 1.332855, 0.848440, 0.814762, 0.797028, 8.317399, 1.009214, 0.893955, 0.730063, 1.337962, 0.756724, 0.838304, 0.786710, 0.779365, 0.754689, 0.433115, 0.562169, 0.700068, 0.790757, 0.845478, 0.808318, 1.745370, 3.128587, 2.424117, 1.305836, 0.623482, 0.570029, 1.328214, 0.895885, 0.816222, 0.780240, 1.660674, 1.214478, 1.300991, 0.797459, 0.772522, 0.768340, 0.408702, 21.064876, 0.793748, 1.318712, 1.048879, 1.222987, 0.794834, 0.831347, 0.906098, 0.543775, 0.811856, 0.930738, 0.824973, 3.199246, 0.579918, 0.595057, 0.738211, 0.751134, 0.770940, 0.756738, 1.314241, 0.832351, 0.807198, 0.747586, 0.827375, 0.817842, 1.719942, 1.281621, 1.392582, 1.729749, 0.814657, 0.610000, 0.613546, 0.530190, 0.734564, 1.852825, 0.519419, 3.250503, 5.992497, 2.863668, 1.940707, 0.830730, 2.213446, 1.847415, 1.285352, 0.816113, 6.092672, 3.515350, 0.666872, 5.178329, 1.518692, 0.773138, 9.180340, 1.173022, 1.340114, 0.779745, 0.754121, 0.720730, 1.174522, 8.243459, 5.369226, 5.833994, 1.282825, 2.078825, 1.304167, 1.407725, 1.860036, 1.635380, 0.766392, 0.796592, 0.763799, 0.530623, 0.420914, 1.933908, 0.795503, 0.839594, 0.507363, 1.059489, 0.813195, 1.086354, 1.293777, 0.673071, 0.590484, 0.794334, 0.815603, 0.761822, 0.576503, 0.778792, 2.491472, 0.479452, 1.353066, 5.417209, 0.768380, 0.783617, 0.903468, 0.846718, 1.258877, 1.976147, 0.531136, 0.777266, 1.359749, 0.749204, 0.388739, 1.432830, 0.747047, 0.812254, 0.768842, 0.777579, 0.793796, 1.546172, 8.197846, 0.807988, 1.154406, 1.511236, 1.303865, 0.777389, 6.064107, 0.649298, 0.691407, 0.780638, 1.522472, 1.528760, 0.796501, 0.528571, 0.803824, 0.788055, 0.734645, 0.774688, 1.971347, 1.566529, 1.293642, 1.394492, 1.058037, 0.127151, 0.828777, 0.632137, 0.500451, 1.098361, 0.802915, 0.761955, 0.829678, 0.780595, 0.436090, 0.949416, 0.576500, 1.364516, 0.795216, 0.564638, 0.778569, 0.809524, 1.402891, 0.662297, 0.764178, 0.568907, 9.000358, 0.800000, 0.779275, 1.280085, 2.555166, 1.183751, 1.809524, 1.393068, 0.809647, 0.822269, 4.466986, 1.328456, 1.936306, 0.751039, 0.772842, 0.763014, 0.838482, 0.863921, 0.825000, 0.830965, 1.282730, 3.254603, 10.390215, 1.368421, 0.806986, 0.773171, 0.852985, 0.836071, 1.954917, 1.277214, 1.293124, 0.762410, 0.764686, 0.799787, 0.800213, 0.860951, 2.803826, 1.902359, 0.738095, 0.845142, 0.863254, 0.798975, 0.756235, 0.841584, 0.545934, 1.255629, 0.428055, 2.211614, 1.223903, 8.654270, 6.257085, 1.240977, 1.265373, 0.712430, 0.775452, 1.093716, 1.290580, 0.798806, 0.849836, 0.793925, 0.805000, 0.366110, 3.520846, 1.866762, 1.716975, 0.822458, 0.776093, 0.803886, 1.408379, 0.369178, 1.282042, 0.649432, 0.770979, 0.731845, 1.364763, 0.762585, 1.298631, 1.325220, 0.329326, 0.791420, 0.776070, 0.784300, 0.775064, 0.796470, 0.754568, 2.707997, 2.326056, 1.311633, 0.825094, 0.745028, 1.386872, 0.753603, 1.339311, 1.021455, 0.840055, 0.816003, 1.714439, 0.860802, 1.721093, 0.836035, 0.625991, 0.800839, 0.754052, 0.751771, 0.789845, 3.258769, 0.880183, 2.866852, 0.793994, 6.194164, 0.753985, 0.741005, 0.837738, 12.924103, 1.109973, 0.569223, 0.770376, 0.529180, 0.472282, 0.841437, 0.817831, 1.280462, 0.812859, 0.398178, 1.295203, 10.308409, 0.831826, 0.801641, 0.808708, 0.054980, 0.831193, 0.896156, 1.234105, 0.793840, 4.127039, 1.715505, 0.782704, 0.428196, 1.207801, 0.375202, 3.981377, 0.447768, 0.757186, 0.771398, 2.296427, 0.518266, 1.005340, 0.807775, 0.481042, 1.060797, 2.076169, 0.512912, 1.810446, 0.781295, 0.547122, 0.556713, 0.490989, 1.250859, 0.204465, 0.839120, 0.482199, 0.803116, 0.775063, 0.498440, 9.687181, 0.523240, 1.795804, 0.765445, 2.216264, 0.360191, 0.839678, 0.804878, 0.710329, 0.441356, 0.415338, 1.279499, 1.298343, 0.742083, 0.794263, 0.768174, 0.784383, 1.058907, 0.543579, 0.754127, 0.694474, 0.687412, 1.796886, 0.495998, 0.620213, 0.769496, 2.405473, 0.300097, 0.495454, 0.848618, 0.814853, 5.007285, 0.791489, 0.771892, 0.438768, 8.560774, 0.747350, 2.474345, 0.756565, 1.617081, 0.800214, 3.690746, 0.506052, 0.481716, 9.370114, 1.615774, 1.656016, 1.314325, 0.314013, 0.481802, 2.319027, 1.358537, 1.890357, 2.465569, 0.869698, 2.540835, 1.147812, 1.203774, 0.769697, 0.792752, 0.911592, 0.375061, 1.346611, 0.771054, 0.524943, 1.306429, 0.517273, 0.375324, 0.895907, 0.824708, 3.068687, 0.478062, 1.112601, 0.629617, 0.785063, 0.749103, 0.773174, 1.554220, 0.301248, 0.494209, 0.544637, 0.768111, 0.653226, 0.851825, 1.300455, 0.361335, 0.742059, 0.776885, 0.758715, 1.327782, 2.449734, 1.878872, 0.262199, 0.514709, 0.488519, 0.799431, 0.797569, 5.148311, 1.243961, 0.634864, 0.648901, 1.746384, 0.830411, 1.077002, 0.724593, 0.552638, 1.642982, 1.307832, 0.399865, 0.813614, 0.819449, 1.342888, 0.764517, 0.842990, 0.783685, 1.273263, 0.536975, 1.275727, 0.763662, 0.818351, 0.778012, 1.583803, 0.735174, 2.195359, 1.192797, 1.181726, 0.792338, 10.722762, 0.750924, 0.543672, 1.959610, 0.751475, 1.149808, 0.816013, 1.184829, 1.278343, 1.283327, 0.349191, 0.570180, 1.716124, 0.807310, 0.770072, 0.546838, 0.514059, 0.786623, 0.795278, 1.370747, 1.763623, 0.824810, 0.517820, 0.629933, 0.484607, 1.752966, 1.385364, 0.205350, 2.004836, 0.522802, 0.787514, 0.756700, 0.534689, 0.812567, 0.354197, 1.340188, 0.444040, 0.829566, 0.539493, 0.741871, 0.706081, 6.895854, 1.320416, 0.775937, 1.212482, 0.384426, 0.488994, 0.840876, 0.808442, 0.830986, 0.723350, 0.407221, 0.626484, 1.304663, 0.504566, 1.279857, 0.531057, 0.996885, 3.073493, 0.145430, 0.767133, 1.073944, 0.745870, 0.396309, 0.496223, 0.802546, 0.724161, 4.263032, 0.383095, 1.343873, 0.484097, 0.807036, 0.777302, 0.811007, 0.989220, 0.482566, 1.305433, 0.378336, 0.758656, 0.797402, 2.166145, 0.828757, 0.462528, 1.316293, 0.434001, 1.000000, 0.798046, 1.679642, 0.670146, 0.909550, 0.123451, 0.520458, 0.819480, 0.856255, 0.805986, 10.456858, 0.789492, 1.238028, 0.374300, 0.501638, 0.421292, 1.234903, 0.842792, 0.796309, 0.789962, 0.377902, 0.399348, 0.784605, 5.675123, 1.252729, 3.246952, 0.806834, 0.927289, 0.485075, 0.802330, 2.927788, 0.679304, 1.629416, 0.274789, 1.744280, 0.785382, 0.719046, 4.806357, 0.499524, 0.879684, 2.188942, 0.601009, 0.608075, 0.764833, 14.631181, 0.350574, 0.333785, 0.797757, 0.768193, 0.733065, 0.473419, 0.494519, 5.621174, 0.713627, 1.176014, 0.778794, 0.846014, 0.786594, 0.811300, 1.372673, 0.762039, 0.484187, 6.242127, 0.471441, 0.796050, 0.784903, 0.832498, 0.818822, 0.527458, 8.626959, 7.164209, 0.343979, 0.349984, 0.760885, 0.699092, 1.305861, 1.216216, 1.359521, 1.154247, 0.838598, 12.692767, 0.882233, 5.800910, 0.464826, 0.266635, 0.845853, 0.810538, 3.320687, 1.724938, 2.293789, 0.499097, 3.371173, 0.378323, 0.783970, 0.784066, 0.775874, 0.749824, 0.503328, 0.805725, 2.846736, 1.359816, 1.186449, 0.531870, 0.812457, 3.717429, 1.303030, 1.311430, 0.425137, 1.345791, 0.514845, 0.806519, 0.820741, 0.435173, 1.177184, 0.563447, 0.640726, 1.361541, 13.252959, 2.049400, 0.748669, 0.761189, 0.493550, 0.372539, 1.817857, 1.263068, 0.822863, 0.857509, 0.846042, 0.527281, 0.482814, 1.613905, 0.727480, 0.757143, 0.718750, 13.548525, 0.860380, 1.312284, 0.512166, 1.119556, 0.828923, 2.912199, 0.522887, 1.328717, 0.380462, 0.530387, 0.847186, 0.806034, 1.164915, 0.305679, 0.811135, 1.210150, 1.587090, 0.867265, 2.054577, 0.883896, 1.521649, 0.324038, 5.470851, 0.900789, 0.509198, 0.810954, 0.522071, 0.477391, 11.257952, 0.380157, 2.681279, 0.964960, 4.383798, 0.907678, 0.408844, 0.636239, 0.381763, 11.951537, 0.818640, 0.559105, 0.794595, 2.080561, 0.418733, 0.456739, 0.834332, 31.075465, 0.101607, 0.597535, 0.792635, 1.859100, 0.405598, 0.766031, 3.801708, 0.854945, 7.591005, 0.420290, 0.731202, 0.665645, 0.839709, 1.339609, 0.394912, 0.565819, 0.783784, 1.777894, 0.769043, 0.287408, 1.288070, 0.517840, 0.748730, 0.857143, 1.357340, 0.777625, 1.037391, 0.516114, 2.451846, 1.372500, 1.189796, 0.532526, 0.569070, 0.468304, 0.801927, 1.378698, 0.656813, 0.800712, 0.759445, 1.214061, 1.209497, 0.442671, 0.837844, 0.561416, 0.458468, 0.821948, 0.788748, 5.766655, 0.817304, 0.737288, 0.469849, 1.077230, 0.482766, 0.774848, 0.830116, 0.526970, 0.799220, 0.642574, 3.225385, 9.294854, 0.519098, 3.064680, 1.314559, 0.747871, 0.522604, 0.801287, 1.623787, 1.344520, 2.256871, 0.758175, 0.491966, 0.506044, 0.783717, 0.857378, 0.412531, 0.828700, 0.485941, 0.776292, 5.717584, 0.821988, 0.472731, 0.797665, 0.079546, 0.805422, 1.291945, 0.528846, 1.846379, 0.471499, 6.422212, 0.729181, 0.824524, 1.293932, 0.684100, 1.391295, 0.525241, 0.945246, 0.710847, 0.765740, 0.808683, 0.492356, 0.509800, 1.080652, 1.199633, 0.726557, 0.809558, 0.782255, 0.832665, 0.764768, 0.550000, 0.740220, 0.448097, 0.453478, 0.815122, 0.834123, 0.804178, 1.315354, 0.486606, 2.228754, 1.291477, 1.191954, 0.837144, 1.227740, 0.493287, 0.849320, 1.417472, 0.795315, 1.690980, 0.865066, 0.484594, 2.625261, 1.303647, 0.841463, 0.658663, 0.409603, 0.793684, 0.775629, 0.801737, 1.298264, 1.274361, 0.743192, 0.528680, 0.526681, 0.788669, 0.806210, 0.768988, 0.309948, 0.850214, 2.511686, 1.220091, 1.092519, 0.788288, 0.521277, 0.507682, 0.824767, 1.742141, 12.359758, 1.858909, 0.388849, 1.236223, 0.787846, 0.752163, 0.783803, 0.282437, 0.838150, 0.527198, 0.723896, 0.494118, 0.841818, 0.760655, 2.033843, 0.766247, 2.031008, 0.903496, 0.800569, 0.808356, 0.500227, 0.843618, 0.799568, 0.810576, 0.308129, 0.779502, 0.866500, 0.377055, 1.733651, 1.391399, 0.757745, 0.637422, 1.486381, 2.652590, 1.128549, 0.809748, 0.466859, 2.269162, 1.226667, 2.111086, 0.719959, 0.895602, 0.739608, 0.802702, 0.437101, 1.214711, 2.330018, 0.774672, 1.252979, 0.789013, 0.779797, 0.810505, 1.269204, 1.277367, 0.487526, 0.742717, 0.713894, 0.804869, 0.815883, 0.227350, 0.516233, 1.107095, 0.759191, 0.823631, 0.782783, 0.486347, 1.401873, 0.841043, 0.780204, 0.434373, 0.531925, 0.374157, 0.506645, 0.771592, 0.257050, 0.744353, 1.778779, 0.764278, 1.760598, 0.810752, 1.332367, 0.617441, 0.782974, 0.485287, 0.805218, 0.862251, 0.821848, 0.495470, 0.551541, 0.531590, 0.770237, 2.125914, 1.833105, 0.786348, 0.743518, 1.483800, 0.747525, 1.777222, 0.849250, 0.255994, 0.844558, 0.833877, 0.913847, 9.919075, 0.772028, 1.411229, 2.682435, 1.330912, 0.834447, 1.845060, 0.817982, 0.629829, 1.198251, 1.190507, 0.771254, 0.711996, 0.476023, 0.668678, 6.996083, 0.744962, 0.686047, 0.517857, 6.444719, 1.393007, 0.390252, 0.510785, 0.841416, 0.822329, 0.511031, 0.497763, 0.497998, 2.056914, 0.758811, 1.330848, 0.748967, 1.942900, 0.254682, 0.521348, 1.063521, 0.750263, 0.770406, 0.776466, 0.508664, 0.583032, 0.811867, 0.825851, 0.794444, 0.801513, 0.807789, 0.800641, 1.365773, 0.734602, 0.790714, 2.252703, 0.811291, 0.812759, 1.210526, 0.816282, 0.369025, 0.759914, 1.559926, 0.389712, 1.236607, 0.766385, 0.768612, 0.253981, 0.512875, 1.722559, 0.843462, 0.869533, 3.637513, 0.796829, 1.084837, 0.719604, 0.779725, 0.497264, 0.506822, 0.757548, 0.199073, 0.548116, 1.078694, 1.970207, 1.305895, 0.846118, 1.339704, 0.774653, 0.828187, 0.789568, 0.780409, 0.523613, 0.827760, 0.390126, 1.296913, 0.732720, 1.368214, 0.510879, 0.512116, 0.490628, 1.764613, 0.821913, 0.625438, 0.816071, 0.541013, 0.423374, 1.926760, 2.365699, 0.792860, 1.332284, 0.849895, 2.026549, 0.676357, 1.389568, 0.784747, 0.503864, 0.509009, 0.752351, 1.391817, 1.770352, 0.453159, 0.718546, 1.324123, 0.196213, 0.711900, 0.740324, 9.757717, 0.835689, 0.868932, 0.282813, 0.164065, 0.741015, 0.141679, 0.342443, 0.724572, 0.250583, 0.455448, 0.822402, 1.310185, 0.086401, 0.768140, 0.850932, 0.469540, 1.275378, 0.219355, 0.485540, 0.845024, 0.783736, 0.522309, 0.519519, 0.778554, 1.700657, 0.694248, 0.751195, 0.769814, 1.172987, 0.200798, 0.775850, 1.323267, 0.767593, 1.688742, 10.619215, 0.838805, 1.174338, 1.097081, 0.791097, 0.819404, 0.804762, 0.792023, 0.776596, 1.110296, 0.757022, 0.397903, 0.431646, 0.389745, 0.370006, 0.824378, 0.819264, 0.263990, 1.238842, 0.803852, 0.808942, 0.860906, 3.481960, 0.754435, 0.278529, 0.281940, 0.795301, 1.739130, 1.270642, 0.461470, 1.127490, 0.492177, 0.478006, 2.521862, 1.794855, 0.759670, 0.286955, 0.504435, 1.976883, 1.216655, 5.443496, 0.132648, 0.762176, 0.342070, 0.831726, 0.649548, 2.376934, 0.434534, 1.298507, 0.511958, 1.202997, 0.070151, 0.351718, 1.750084, 0.870164, 1.778133, 0.527765, 1.202684, 0.821705, 0.767845, 1.276140, 0.750449, 1.606081, 0.691023, 0.407171, 0.495516, 1.788752, 2.123711, 0.448092, 0.771744, 1.558511, 0.247602, 0.784845, 0.536495, 1.309671, 0.816429, 0.810497, 0.488573, 0.797602, 1.320217, 0.527666, 0.263376, 0.539981, 0.810840, 0.816442, 0.061266, 0.502706, 0.354730, 1.306999, 0.708651, 0.496742, 1.590950, 7.220230, 0.646710, 0.499433, 0.873923, 0.770645, 0.797357, 0.247546, 0.237018, 0.758799, 0.765965, 0.379198, 1.438269, 0.807168, 0.745268, 0.805044, 0.851049, 0.766695, 0.485983, 0.788688, 0.793875, 0.081850, 0.814442, 0.486664, 0.454328, 0.799045, 0.897921, 0.528612, 1.212039, 0.746769, 0.530810, 0.715726, 0.789934, 1.398188, 0.521187, 0.478709, 0.435940, 0.754160, 0.722704, 0.752131, 0.765054, 0.301375, 0.536535, 0.627475, 7.417752, 0.791132, 0.828154, 0.888809, 0.511345, 0.533734, 0.521649, 0.743428, 0.887486, 1.436508, 1.251915, 0.621137, 2.315957, 0.607567, 0.462111, 0.739425, 0.178971, 0.830853, 0.116034, 1.434377, 1.830648, 0.271691, 1.374782, 2.358055, 0.361271, 0.044351, 0.255215, 0.765972, 1.352899, 0.804113, 0.752797, 0.320298, 1.275327, 2.194973, 0.786564, 1.253037, 0.732566, 0.288892, 0.088831, 0.497239, 0.421118, 0.513736, 1.735771, 1.923658, 1.353846, 1.849732, 0.731781, 5.160790, 5.860832, 0.476359, 0.852612, 0.495192, 1.254254, 0.727303, 1.191081, 0.491944, 0.498393, 2.145738, 0.761517, 1.375398, 0.489613, 0.523013, 0.505530, 0.802175, 1.795301, 1.428506, 0.558916, 0.527432, 0.785638, 3.052525, 0.484138, 0.830464, 0.853767, 29.309691, 5.583456, 2.359759, 0.580112, 1.279468, 1.179841, 0.809535, 1.338073, 0.774113, 0.779216, 0.781004, 0.763757, 0.801887, 0.380779, 0.530271, 1.290410, 1.296245, 3.526243, 0.837246, 6.489924, 0.497098, 0.792424, 1.254159, 0.781250, 0.404522, 1.937903, 0.501936, 1.813673, 0.780686, 0.551093, 0.310916, 0.496374, 1.281705, 0.775221, 0.482387, 0.790385, 0.513286, 0.712243, 0.801287, 0.774828, 0.278769, 0.490654, 0.554327, 1.222334, 0.841321, 0.795284, 0.494687, 2.050546, 0.490135, 0.849556, 1.386762, 1.298679, 0.732225, 4.178919, 0.534783, 0.856341, 0.224015, 1.445808, 0.536945, 1.746369, 1.826652, 0.812041, 0.368167, 1.306022, 0.482782, 0.515600, 0.827899, 1.322894, 0.375022, 0.741708, 1.702991, 0.823342, 0.788767, 0.783065, 0.525623, 0.804154, 0.778179, 1.740949, 0.381663, 6.359635, 0.797143, 1.647451, 1.259478, 0.856019, 1.703466, 0.508708, 1.216502, 5.483531, 0.520730, 0.526559, 0.361745, 0.745480, 0.425813, 0.825530, 1.215079, 0.552656, 0.505521, 0.531286, 0.753477, 1.000353, 0.752149, 1.370464, 0.766878, 0.373198, 0.675271, 0.626578, 0.492353, 0.511811, 0.767161, 3.054957, 1.793322, 0.827160, 0.495050, 0.537363, 0.841737, 1.231933, 0.498858, 3.311547, 0.739325, 0.675540, 0.504857, 0.528802, 0.283229, 0.764623, 1.276392, 0.787649, 0.784495, 0.470823, 0.825260, 1.308468, 1.837251, 0.770011, 0.708493, 0.506035, 0.824927, 0.823234, 0.774101, 1.308072, 0.746140, 2.604223, 0.483893, 0.383043, 6.840864, 0.818276, 0.788897, 0.788468, 0.315842, 0.504779, 1.326214, 0.803721, 1.286264, 0.506007, 0.491721, 1.649843, 0.814465, 0.518414, 0.477450, 1.197089, 1.094902, 1.210990, 1.303658, 0.784225, 0.816423, 1.612091, 0.554177, 1.226768, 1.247508, 0.523963, 0.269571, 0.421887, 1.291300, 1.787071, 0.828709, 0.488780, 0.822413, 0.800290, 0.278811, 0.540579, 1.690736, 0.781272, 0.753260, 0.512549, 0.374911, 0.776168, 0.741324, 0.537898, 0.454310, 1.318685, 0.508085, 0.743051, 0.811838, 0.817545, 0.881932, 1.434723, 0.814591, 0.526485, 0.747271, 0.738183, 0.303051, 1.238861, 0.040121, 0.760644, 0.780973, 0.403149, 0.728483, 0.746971, 0.765041, 0.227186, 0.496881, 0.666608, 1.305190, 0.746070, 0.851209, 1.251029, 2.774001, 0.759266, 0.741745, 3.376263, 0.144412, 0.762660, 0.870555, 1.126958, 0.782563, 6.170446, 1.333217, 0.797940, 1.268528, 0.855313, 0.749473, 0.722032, 0.800350, 0.548415, 0.771310, 0.512011, 0.510615, 3.812477, 0.266855, 0.878223, 0.749136, 1.424227, 0.739318, 1.747656, 1.361415, 0.293674, 0.896057, 1.772225, 1.884149, 0.190238, 0.916667, 2.305304, 0.104668, 1.243407, 1.860554, 0.779861, 6.043438, 0.519816, 0.738881, 0.490137, 0.766632, 2.230363, 0.735669, 0.517073, 0.805181, 0.833098, 2.419554, 0.768927, 1.313385, 0.494420, 11.531315, 0.130414, 0.503428, 0.796151, 0.846570, 0.841798, 2.295535, 0.753329, 0.794286, 1.337619, 0.783992, 0.522938, 1.231218, 0.514768, 0.386461, 0.142392, 1.246856, 1.779330, 0.751710, 1.355015, 0.645566, 0.312694, 0.733275, 0.245556, 0.548150, 0.847623, 0.484241, 1.415227, 1.244296, 3.885338, 0.470718, 0.522173, 0.700740, 1.348988, 1.481024, 0.505386, 0.755556, 0.747485, 0.510658, 0.243642, 0.378378, 1.251644, 0.503069, 0.839551, 0.491522, 0.548658, 1.194524, 0.692970, 0.896940, 0.241056, 0.471483, 0.738380, 0.686255, 0.855879, 0.889076, 0.395733, 2.890292, 1.710461, 7.278876, 1.292595, 2.202165, 0.773151, 0.134779, 1.239092, 0.857559, 1.120348, 0.487973, 5.935952, 1.336458, 0.744170, 0.479167, 0.315517, 0.803058, 0.775131, 0.792108, 0.753771, 0.541109, 1.090323, 0.873974, 0.730094, 0.986187, 0.255520, 0.793091, 0.783289, 1.943301, 0.819510, 0.764937, 0.795592, 0.387027, 0.743992, 0.805932, 0.739915, 0.810969, 0.322256, 2.434211, 0.534678, 0.510395, 1.891508, 0.787319, 0.877719, 0.487626, 0.781812, 0.544020, 0.519825, 2.351044, 0.770363, 0.800992, 0.753960, 0.493920, 0.291855, 0.757606, 1.375090, 0.453831, 0.815696, 0.509196, 1.638851, 0.463705, 0.789639, 3.999276, 0.796806, 0.819560, 0.490671, 1.267944, 0.803635, 0.785663, 0.766047, 2.236805, 0.740830, 0.509236, 0.503820, 0.768726, 0.358170, 0.814748, 1.283600, 0.554274, 0.503541, 0.790473, 0.741561, 1.332885, 0.485210, 0.890405, 1.176765, 1.400000, 1.348124, 1.282586, 1.350625, 2.287014, 1.093708, 0.801460, 0.778178, 1.338905, 0.668460, 0.829108, 0.821708, 0.413100, 0.747911, 1.469100, 0.477940, 0.804625, 0.761589, 0.531343, 0.278118, 0.819484, 1.307111, 0.836483, 0.498543, 0.486842, 0.497223, 1.615839, 0.523875, 0.843190, 0.205303, 0.741813, 1.324890, 1.103487, 0.802370, 0.778024, 0.776699, 1.699858, 0.728055, 0.787857, 0.778483, 0.546625, 0.460313, 0.804851, 1.291861, 0.759140, 0.754620, 0.511228, 0.508593, 3.158850, 0.819058, 0.536867, 0.799425, 0.517808, 0.515516, 0.803752, 0.572818, 0.399541, 0.721210, 2.257498, 0.419928, 0.780359, 0.494319, 1.670134, 0.431984, 0.807746, 0.742796, 1.023198, 0.743886, 0.754038, 1.318646, 0.795592, 0.785439, 1.371499, 1.199952, 0.770463, 0.880958, 1.255334, 1.191358, 2.952598, 0.801242, 1.780162, 0.584624, 0.504800, 0.617522, 1.166363, 0.832042, 0.781009, 0.741225, 1.674955, 0.769361, 0.820263, 0.787595, 0.459412, 0.403437, 0.380138, 2.343420, 0.727520, 0.823785, 0.468634, 0.541998, 3.127531, 0.879162, 1.291162, 1.251412, 0.718319, 0.488725, 0.517153, 0.764518, 0.462219, 0.796622, 0.328263, 0.785487, 1.356636, 0.782932, 0.797714, 0.462287, 0.531480, 2.732509, 1.260118, 1.368623, 0.775088, 0.784832, 0.292182, 0.533860, 0.844558, 0.754442, 0.812609, 0.504902, 0.819881, 1.623728, 0.556937, 0.765658, 1.299471, 0.784404, 0.980098, 0.493374, 0.844191, 0.690400, 0.779993, 1.241256, 4.427813, 1.827487, 1.814698, 0.850250, 0.810675, 0.899770, 0.814461, 0.787097, 0.233803, 0.415006, 0.636238, 0.393923, 0.771720, 0.527513, 0.747686, 1.608455, 0.754493, 1.216477, 0.525276, 0.412352, 0.286699, 1.771561, 1.318547, 0.479991, 0.313412, 0.533090, 1.334130, 1.802632, 0.826830, 0.872866, 1.604822, 0.750087, 0.828928, 5.826227, 0.728433, 0.773109, 0.776238, 0.989655, 1.792531, 1.318424, 1.486885, 0.322550, 0.514716, 0.786644, 0.730487, 0.863783, 1.231325, 0.862842, 1.277305, 0.517514, 0.754670, 0.775574, 0.867812, 0.731401, 0.749820, 0.752786, 2.113068, 1.266190, 1.890602, 1.080279, 0.513774, 0.569189, 2.246088, 2.761215, 0.823929, 0.856328, 1.429805, 1.889085, 2.550369, 0.547855, 0.330961, 0.234388, 0.751395, 0.755977, 0.476507, 1.158502, 0.491888, 0.485733, 2.611128, 1.318516, 1.388396, 0.794107, 0.845534, 1.678765, 1.138713, 0.752078, 0.489782, 1.350914, 1.499068, 0.378256, 0.251671, 0.748097, 1.244021, 0.753086, 0.796902, 0.725202, 0.535362, 0.933375, 0.512462, 0.828541, 1.169479, 0.766225, 1.363669, 16.066880, 1.274015, 1.236151, 0.719250, 0.370687, 1.631110, 1.211274, 1.376280, 0.552021, 0.779257, 0.834614, 1.783930, 1.420922, 1.240876, 0.573467, 0.929318, 0.527829, 0.380657, 0.791610, 0.795018, 0.522496, 1.294630, 0.175439, 0.778293, 0.844256, 0.847931, 0.780982, 0.836152, 0.813272, 1.187214, 0.764747, 0.747647, 1.350494, 1.363245, 0.520984, 0.528032, 0.502001, 2.316527, 0.746305, 0.802249, 2.139450, 0.511697, 0.809942, 1.164463, 0.841428, 0.652717, 1.311669, 1.196994, 1.330547, 0.758764, 1.406889, 1.202324, 0.458516, 1.284639, 1.266552, 0.786932, 0.763045, 0.476274, 0.825929, 0.745983, 0.795091, 0.660542, 1.826733, 0.687288, 0.521916, 0.536556, 0.947344, 2.893190, 0.776177, 0.474019, 0.263385, 0.478538, 1.224517, 0.725118, 0.431675, 0.516862, 0.387360, 0.868321, 0.775496, 0.505027, 0.782865, 11.788796, 0.287951, 0.749395, 0.793585, 0.791814, 1.419498, 0.762952, 0.761255, 0.774788, 0.504460, 0.960713, 0.863616, 0.745429, 0.750186, 0.785346, 0.806452, 0.839039, 1.357872, 1.558863, 0.774896, 0.513719, 1.249915, 0.533596, 3.295281, 7.715418, 0.405386, 0.698024, 0.382712, 0.733898, 1.336224, 1.036873, 1.323044, 0.818792, 10.003289, 0.814984, 7.195461, 0.479113, 0.786749, 32.989341, 0.813429, 0.459602, 0.644356, 1.222261, 1.230307, 1.333572, 1.200313, 0.613667, 2.145273, 0.733218, 0.812071, 0.828000, 3.753165, 0.390748, 0.496135, 1.161527, 1.317532, 0.752916, 0.502478, 0.365777, 0.441459, 0.763167, 1.411831, 0.197396, 0.525819, 0.833407, 0.732609, 0.494268, 0.783642, 0.796880, 1.307561, 0.782460, 0.727951, 0.839254, 0.491099, 1.174726, 0.512742, 0.784505, 2.446612, 0.608332, 0.361720, 0.784661, 0.850178, 0.795381, 0.408606, 1.465313, 0.863805, 1.783321, 0.388250, 0.472569, 1.361180, 0.757006, 1.650196, 0.820298, 0.482653, 0.774318, 0.779458, 0.450355, 9.897216, 0.995963, 18.280605, 0.791193, 0.757895, 0.280637, 0.504811, 1.170902, 0.909335, 1.798628, 0.483105, 0.701391, 1.515967, 12.571429, 1.128790, 1.448185, 1.263561, 0.954147, 0.577610, 1.269258, 1.294839, 1.308342, 1.083767, 1.369620, 8.167931, 0.520920, 0.502435, 0.514672, 1.236998, 0.790187, 0.854240, 3.952446, 0.464780, 1.468244, 0.526689, 1.144286, 0.873905, 0.820972, 0.768391, 0.491645, 0.517271, 0.779033, 2.301543, 1.296927, 1.315255, 0.802038, 0.805369, 1.695428, 1.125546, 0.536242, 5.623169, 0.778046, 0.513078, 0.405077, 0.495273, 0.452116, 0.848578, 1.141131, 1.346257, 0.770614, 0.784026, 0.753439, 0.742918, 11.556343, 6.991896, 1.736691, 0.496203, 0.524173, 1.270508, 0.360631, 0.801060, 0.766431, 0.764325, 0.781851, 0.397892, 0.524658, 0.818987, 0.217927, 11.988482, 0.852670, 4.420191, 1.266065, 1.153259, 1.238289, 2.980956, 0.856883, 0.273433, 0.823084, 0.382237, 0.798334, 1.291822, 3.706786, 0.728159, 1.421884, 0.825820, 1.304424, 0.635397, 0.763937, 0.765094, 0.764808, 0.520213, 0.266141, 0.380562, 1.326118, 1.376914, 1.282564, 0.798319, 0.819011, 0.965887, 1.835826, 1.366772, 2.441788, 0.744137, 0.547838, 0.764288, 12.821005, 0.822660, 0.831011, 0.528066, 0.756406, 0.370459, 0.762778, 0.666106, 0.797035, 1.289835, 0.742947, 0.775701, 1.385465, 0.264640, 0.542477, 0.539489, 0.736484, 0.616734, 0.516943, 0.416306, 0.938199, 0.809540, 0.485453, 7.645490, 5.400438, 1.218239, 0.777975, 0.814591, 0.493290, 0.479516, 0.486486, 2.315198, 1.137535, 11.027977, 1.789401, 1.761520, 0.906397, 0.754888, 0.628068, 2.366584, 1.359531, 0.754586, 0.819873, 1.099404, 0.770815, 0.769681, 0.766935, 0.776988, 1.394241, 0.784995, 0.803164, 8.552649, 1.138075, 0.820022, 0.751246, 2.157698, 1.319917, 0.652599, 0.779626, 0.799133, 1.302586, 7.217676, 1.830514, 1.335430, 0.326471, 1.242084, 0.763140, 1.343947, 0.864312, 0.801436, 0.863851, 0.831504, 0.375660, 0.486424, 0.785073, 2.079482, 1.361875, 3.820841, 0.821772, 1.265669, 3.298724, 0.779901, 0.524155, 0.357360, 1.300879, 1.307859, 0.796120, 1.825794, 0.758195, 0.863620, 0.775026, 0.510939, 0.475413, 0.795695, 1.264485, 3.118726, 0.799929, 0.803443, 2.809524, 0.928208, 0.637129, 0.775703, 1.181191, 0.781076, 1.111924, 1.201667, 1.814689, 1.435394, 0.526053, 0.763293, 0.724367, 0.762513, 1.820680, 0.794087, 0.798433, 0.478805, 3.384668, 0.512211, 0.528358, 0.504020, 1.782821, 0.608528, 1.250597, 1.335889, 0.789700, 1.266619, 0.719369, 0.536940, 1.789602, 0.842656, 0.794711, 0.827748, 0.760431, 0.439276, 0.489205, 0.403618, 1.219039, 0.777048, 0.830916, 0.470870, 1.222399, 0.643930, 0.509026, 1.310515, 0.822528, 0.819160, 0.775000, 0.806053, 0.364922, 0.509452, 0.489593, 1.287230, 0.739702, 0.771398, 0.766123, 0.492623, 7.775158, 0.554523, 0.770035, 1.111959, 0.800846, 0.770191, 0.797510, 1.369242, 0.478438, 0.741612, 0.370043, 0.231077, 0.794334, 0.790190, 1.218317, 2.604278, 9.292475, 0.387185, 0.495935, 0.844188, 1.300950, 2.893362, 1.308651, 1.840500, 0.502907, 0.481180, 1.061378, 0.251586, 0.465293, 0.694195, 0.794329, 0.747539, 0.592918, 0.532855, 0.637314, 0.268706, 0.768916, 0.807569, 0.769993, 2.010537, 0.805241, 0.552857, 0.455086, 0.856720, 0.504982, 0.791209, 0.527930, 3.757654, 0.732448, 1.264446, 0.865522, 0.741105, 0.506739, 0.586398, 1.257837, 0.777549, 0.798265, 1.448994, 1.195586, 1.236307, 0.852013, 1.325980, 0.962319, 0.493747, 0.465742, 1.063969, 0.764438, 1.268535, 0.478669, 0.419916, 0.794818, 0.848677, 1.764726, 0.331007, 0.783078, 0.803775, 0.746805, 0.461790, 0.742160, 1.348117, 1.471409, 0.481334, 0.401982, 0.827100, 0.475534, 1.341379, 0.797437, 1.428665, 0.777117, 1.654632, 0.809929, 1.190883, 0.766238, 4.420851, 0.516278, 1.109260, 0.827455, 1.308075, 0.500223, 1.260900, 1.368134, 1.343606, 1.265823, 1.537945, 1.199796, 0.793656, 1.599454, 0.848301, 0.753771, 0.769799, 0.406411, 3.261896, 0.820857, 0.738669, 0.750806, 0.412581, 1.282361, 0.057334, 0.502048, 0.488377, 2.348689, 0.770504, 0.488950, 2.906101, 0.505046, 2.118886, 1.401051, 0.767823, 0.845702, 1.769599, 0.763490, 0.778246, 0.517574, 0.779499, 0.295140, 0.492131, 2.109267, 1.251719, 1.283561, 0.814615, 5.518365, 0.860371, 0.436837, 0.748905, 1.298132, 1.766659, 0.732111, 0.781536, 0.723946, 0.814220, 0.778723, 0.497553, 2.593666, 2.336433, 2.253220, 0.819538, 0.754885, 1.735336, 0.540735, 0.588579, 1.109694, 1.372597, 1.297896, 0.487839, 1.120429, 0.504467, 0.785364, 3.322129, 0.210012, 0.528404, 0.559270, 0.781710, 0.678339, 7.124885, 1.199589, 0.869397, 1.256304, 1.697150, 0.362965, 1.053887, 1.373580, 0.779494, 0.118457, 0.596039, 0.501812, 1.719918, 1.241725, 0.733954, 1.298715, 0.796257, 2.405800, 0.284438, 0.510512, 1.724077, 0.643172, 0.534780, 0.644806, 1.656552, 1.044847, 0.858575, 1.256149, 2.093106, 0.743985, 0.533132, 16.225137, 1.282920, 2.204618, 0.579821, 0.531680, 0.847507, 0.861232, 2.044593, 0.820102, 0.753623, 4.439346, 2.734015, 0.714044, 0.727273, 0.840135, 1.215405, 1.313643, 0.772324, 2.108948, 1.293310, 0.516034, 1.257893, 1.258065, 5.588926, 1.718870, 0.806320, 1.856454, 0.507260, 0.361286, 0.488926, 1.242823, 1.299861, 0.816105, 0.528951, 0.227389, 0.779667, 0.741991, 0.363968, 1.293188, 1.256025, 0.277742, 1.432080, 0.450133, 1.646768, 1.304491, 1.826288, 3.662206, 2.670501, 0.516996, 0.512523, 0.872096, 2.435452, 0.216368, 0.749075, 0.781440, 0.805384, 0.395556, 0.509095, 1.074535, 0.742211, 1.694603, 0.854258, 0.678373, 1.268662, 0.846354, 0.487110, 1.301491, 1.273729, 1.816602, 0.773037, 0.444571, 0.806979, 0.479254, 0.789085, 0.250113, 0.809424, 1.358711, 0.781780, 0.854790, 0.775788, 1.837283, 1.525882, 0.220119, 0.490135, 1.506133, 0.791827, 0.246410, 0.502446, 0.924718, 2.644228, 0.769311, 0.839856, 0.779561, 1.009373, 0.823997, 0.859381, 0.784861, 0.798706, 1.079387, 0.708347, 0.793211, 0.510452, 1.278717, 0.782748, 0.937857, 1.690619, 1.687280, 1.848955, 4.081176, 0.536597, 1.774923, 2.848716, 0.812545, 0.844646, 0.803622, 1.288848, 0.757409, 0.776172, 1.829302, 0.558868, 0.781767, 0.482812, 0.476510, 0.833333, 1.338517, 0.379716, 0.826831, 0.527273, 0.727492, 0.568248, 0.858158, 0.857109, 0.054034, 0.804768, 0.644159, 6.811537, 0.774493, 0.395432, 0.795289, 0.494887, 1.349930, 0.744674, 1.789438, 0.855535, 0.272010, 1.252009, 2.257014, 0.780065, 0.257318, 0.849982, 1.278892, 2.166781, 1.197320, 0.422357, 0.520411, 1.394743, 1.298984, 0.851059, 0.951896, 0.735961, 1.239605, 0.744755, 0.747539, 0.799429, 0.574663, 0.307825, 0.223082, 1.833163, 1.663077, 0.735668, 0.272948, 0.727242, 1.854839, 2.777537, 1.364672, 13.113056, 0.587040, 0.491738, 0.483113, 1.507714, 3.011806, 0.455168, 1.213301, 0.809407, 1.369581, 2.351448, 0.510722, 1.081565, 0.813811, 0.476303, 1.296976, 0.509957, 0.777121, 1.752063, 1.350838, 1.848364, 1.342867, 0.742105, 0.402250, 0.323255, 0.371312, 0.489310, 0.831732, 0.944845, 1.376508, 14.922634, 0.776245, 8.888420, 0.527485, 0.779511, 0.369634, 2.477774, 0.788264, 1.291697, 0.400290, 0.078804, 1.315663, 2.543210, 5.234419, 0.386823, 1.736703, 0.784673, 0.313536, 0.829710, 2.398451, 0.780204, 0.753783, 0.829989, 1.365915, 1.857143, 0.886660, 0.748986, 0.812457, 2.722879, 1.228387, 0.872879, 0.758728, 16.531542, 1.226903, 1.613767, 1.862759, 0.367901, 0.522701, 0.835106, 1.372788, 0.608637, 0.815117, 1.768301, 0.733333, 0.887131, 0.720914, 1.097871, 0.848343, 0.506509, 0.552189, 0.232102, 1.789761, 0.739660, 3.083421, 0.820199, 2.706878, 0.741230, 1.254539, 0.789718, 0.451691, 0.507425, 0.392013, 0.703249, 0.778135, 0.318306, 2.767244, 1.223513, 0.817472, 0.850481, 0.263158, 1.297404, 1.352982, 1.763167, 1.283249, 0.834088, 0.742574, 1.361420, 1.246627, 0.502389, 0.571929, 1.362361, 3.395654, 0.479910, 0.773537, 1.276860, 0.798599, 0.648180, 3.176125, 0.825463, 1.319080, 0.787784, 0.418844, 0.763348, 1.345540, 1.249385, 1.152078, 0.861906, 0.115817, 0.269254, 0.488999, 0.828849, 0.802131, 1.479709, 0.490205, 0.896480, 0.488238, 0.325856, 0.515588, 1.309507, 0.759585, 1.302967, 1.323040, 0.369239, 0.300737, 1.211867, 0.760847, 0.821173, 3.011709, 0.802827, 0.733547, 1.272345, 12.740931, 0.358916, 4.291500, 7.529372, 0.790847, 0.529252, 0.515152, 0.518662, 1.437720, 0.604112, 0.867283, 0.811948, 0.739639, 1.280014, 1.734919, 3.789113, 1.792895, 1.401232, 0.518553, 0.780879, 0.219695, 1.176450, 1.770536, 2.103237, 1.102067, 0.828750, 0.374033, 3.077687, 1.852482, 4.417043, 1.445049, 2.441495, 0.771967, 0.447140, 0.512974, 1.151446, 1.731004, 0.830861, 0.492551, 0.494521, 0.489161, 0.740028, 0.502691, 1.721859, 0.731348, 1.238251, 1.026776, 0.057698, 0.786667, 2.356888, 1.725524, 0.502801, 0.808686, 0.343298, 0.823234, 0.465448, 0.814570, 2.691001, 2.251195, 0.277383, 0.981073, 0.673811, 0.770963, 0.521374, 1.116942, 17.347600, 1.326588, 0.822843, 0.541743, 0.087108, 1.267438, 0.250774, 0.741679, 0.792705, 0.702995, 1.939373, 0.768174, 0.828068, 0.811853, 0.759857, 3.506227, 0.386155, 0.407241, 0.915556, 1.109187, 3.487242, 0.678716, 1.372587, 0.570340, 2.824344, 11.897624, 1.245685, 0.703993, 0.648907, 2.392857, 0.778016, 0.800293, 1.369580, 0.560623, 0.744847, 0.782068, 0.307374, 0.638944, 0.756157, 0.812681, 0.743181, 0.774149, 0.850495, 0.853845, 1.192019, 0.544541, 0.781338, 0.803779, 2.607009, 0.244035, 0.510009, 1.365979, 1.348169, 5.696242, 0.379056, 0.731456, 0.506076, 1.025650, 0.921859, 0.822040, 0.547025, 0.519641, 7.158217, 1.215261, 0.829233, 0.748850, 0.777738, 0.308665, 0.562544, 1.045047, 0.483756, 0.841321, 0.513845, 0.871159, 0.538316, 0.924523, 0.650009, 1.589008, 3.238432, 1.818990, 1.341684, 0.863956, 0.327532, 0.397683, 0.820932, 0.754415, 3.806904, 0.731328, 6.541933, 0.511468, 0.823672, 0.790640, 1.385495, 0.770775, 0.261229, 2.895792, 1.274982, 0.733968, 0.796212, 1.845152, 2.215520, 1.750903, 0.848485, 7.581049, 0.764298, 0.848761, 0.491444, 1.107478, 1.547991, 2.253366, 12.492313, 1.131917, 0.882558, 1.693695, 0.771449, 0.488409, 1.677285, 0.922867, 0.543058, 1.781353, 1.689478, 0.536603, 0.522459, 8.878630, 0.773675, 0.741343, 0.477151, 0.479052, 0.400809, 0.792221, 1.757009, 1.853531, 0.712250, 9.811960, 1.737744, 1.094301, 0.491345, 0.503230, 1.285663, 2.909313, 1.322920, 0.505648, 0.486806, 2.137122, 0.769986, 1.297521, 0.672081, 0.408643, 0.676018, 0.584359, 1.301102, 0.681177, 9.681818, 11.972879, 0.511710, 4.382349, 1.283374, 0.803928, 0.791364, 0.851257, 1.435989, 0.799928, 0.750266, 0.397347, 0.497905, 1.739272, 1.307018, 0.796635, 0.820841, 0.883504, 1.331900, 0.829257, 1.285839, 0.620850, 0.783505, 0.824017, 1.705984, 0.574234, 0.534247, 0.493981, 0.366186, 9.388967, 0.485946, 1.340235, 0.828765, 3.061232, 1.817623, 1.335845, 0.525401, 0.512286, 0.496258, 0.424366, 1.392471, 1.366775, 0.795918, 0.776471, 0.730197, 0.597604, 0.897807, 0.803908, 1.257587, 3.717602, 0.492494, 1.826285, 0.848474, 0.609678, 0.760684, 0.272241, 0.782545, 1.246148, 0.819571, 0.790071, 0.812790, 0.761669, 1.184997, 0.809545, 0.468791, 0.818016, 0.553413, 0.871521, 2.153445, 0.826643, 0.808945, 3.102020, 0.725490, 1.771798, 0.490942, 1.192012, 0.487072, 0.251025, 0.814629, 0.769069, 0.748850, 1.696228, 1.250784, 1.168975, 1.324720, 1.339595, 1.806762, 1.294526, 0.458576, 0.807036, 1.575349, 0.506792, 0.756831, 0.801877, 9.277739, 0.332066, 0.730895, 0.490683, 0.485160, 0.781900, 0.405222, 1.293236, 1.280384, 0.768451, 0.848221, 1.393283, 1.211516, 0.937946, 0.807011, 0.761436, 0.804252, 1.986167, 1.250613, 1.108132, 0.507088, 0.254983, 0.812968, 0.764524, 0.822883, 1.488490, 1.221488, 1.335319, 1.678981, 0.325985, 0.522520, 0.791071, 1.304222, 1.396849, 0.764726, 0.738243, 0.285122, 0.777895, 1.718246, 1.537196, 0.273663, 0.794755, 0.538873, 2.055743, 1.260640, 0.752563, 0.802702, 1.547891, 2.080544, 0.768207, 1.119458, 0.263102, 0.871511, 2.181028, 1.197232, 1.857757, 1.255258, 1.271044, 2.766633, 0.672210, 0.479982, 0.546890, 0.746119, 0.815544, 0.362676, 1.087442, 1.289926, 2.539939, 1.293809, 0.517383, 0.781968, 1.290598, 0.828739, 0.834189, 0.804719, 0.715172, 1.166433, 0.752160, 8.505872, 0.780660, 1.389939, 0.680148, 0.562358, 0.818940, 0.798584, 0.794530, 0.399213, 0.742533, 0.353826, 1.692073, 14.160677, 2.386492, 0.764601, 1.328966, 0.514208, 1.674973, 0.727115, 0.739327, 1.282534, 0.248483, 0.816766, 1.989943, 0.736275, 0.752206, 0.788618, 1.217161, 1.496171, 0.471739, 0.516121, 0.753014, 0.925241, 1.643092, 3.256754, 0.278568, 1.774561, 0.464200, 0.513627, 0.815697, 0.294030, 0.782782, 1.161447, 0.838778, 0.554274, 0.506710, 0.799151, 1.145383, 0.789307, 1.070773, 0.472970, 0.687953, 0.530200, 0.797127, 0.846154, 0.759957, 0.968795, 0.732073, 1.410737, 0.332241, 0.402198, 1.179339, 0.476359, 2.696082, 1.239625, 1.727952, 1.404087, 12.073003, 0.745243, 1.432420, 0.471293, 0.511807, 3.116804, 0.815527, 0.941389, 0.793651, 0.772404, 1.929577, 0.799711, 1.296025, 0.490449, 0.539806, 0.828959, 2.504406, 0.828431, 0.508674, 0.734392, 1.597451, 0.800212, 0.508471, 3.462397, 0.604187, 1.886430, 1.918474, 0.516107, 0.725347, 1.150590, 0.773454, 2.057038, 0.500221, 0.744806, 0.784342, 0.287755, 8.547438, 0.732051, 0.770891, 0.786629, 0.298486, 0.526485, 1.749743, 0.761755, 0.833099, 0.842282, 0.864452, 1.918133, 0.791858, 0.787965, 1.270516, 2.909668, 1.273847, 0.502517, 0.503949, 1.094077, 0.884803, 1.344645, 0.464692, 0.798307, 1.384506, 0.780903, 1.284970, 1.810993, 0.527759, 0.521979, 1.164341, 1.264364, 0.880793, 0.701122, 0.865360, 0.418053, 2.463215, 0.870872, 1.262482, 0.812811, 1.867204, 1.723108, 1.780935, 1.796932, 0.512997, 2.339269, 0.221564, 1.308882, 0.819919, 1.132264, 0.807706, 1.316184, 1.166667, 2.185865, 0.771300, 0.774482, 0.778569, 0.794452, 1.196857, 0.727857, 1.450336, 0.741802, 0.782394, 1.224676, 0.487463, 0.751650, 0.471104, 1.815314, 0.557982, 1.190688, 0.504918, 2.742624, 3.785304, 0.810850, 0.738255, 0.471849, 0.744659, 5.129552, 4.408149, 0.905499, 1.699760, 0.848174, 0.764548, 8.014892, 0.736456, 2.385873, 0.792216, 1.362377, 0.790137, 1.512839, 0.876042, 1.395298, 0.498426, 1.712797, 1.668069, 0.820241, 0.486270, 1.125945, 0.507898, 0.767114, 0.788778, 0.478909, 0.828132, 0.478310, 1.210958, 0.897254, 0.781579, 0.821076, 0.837477, 1.216523, 2.316531, 0.801662, 0.309383, 0.762923, 1.193285, 0.783935, 0.315376, 0.788162, 0.088289, 1.318133, 1.833985, 1.303319, 1.716962, 0.627053, 1.085968, 1.194504, 0.852470, 0.801953, 0.996570, 1.768962, 1.804501, 0.739312, 0.260042, 0.758813, 9.685213, 2.044460, 0.800583, 0.823238, 1.285664, 0.338620, 0.484638, 0.363701, 0.473324, 0.500804, 0.348158, 1.776027, 1.319440, 0.393346, 0.485228, 0.848586, 5.157614, 1.300282, 11.930444, 0.756701, 6.690131, 0.476379, 0.381324, 0.516075, 9.492937, 1.321040, 0.512509, 0.297358, 0.523592, 1.298064, 2.631289, 0.825144, 0.560456, 0.525420, 1.773631, 0.756290, 0.494299, 0.501330, 0.842166, 0.779148, 0.793807, 1.242168, 0.517915, 0.654382, 1.366836, 0.621058, 0.823716, 1.288235, 0.796614, 0.591566, 1.276325, 1.329982, 1.682692, 0.863470, 0.518169, 0.394887, 1.403899, 0.841818, 0.784461, 0.520294, 0.376398, 0.367814, 0.823041, 1.410330, 0.844912, 0.663141, 0.435167, 0.786757, 1.254753, 0.376887, 0.513451, 0.225330, 1.340950, 11.529137, 5.862959, 1.243677, 1.264494, 0.503185, 0.374678, 0.547958, 2.498485, 1.427997, 0.275355, 0.495437, 0.821557, 0.376577, 0.818534, 0.818203, 0.857601, 2.160878, 0.725857, 0.536651, 0.760168, 0.522562, 1.167964, 0.822088, 2.269446, 0.775789, 0.724877, 0.490859, 0.518069, 1.930159, 0.819546, 0.801568, 0.518935, 0.520785, 0.862474, 0.767540, 0.921100, 1.455269, 0.811412, 0.553127, 2.374065, 1.416337, 1.076834, 0.522869, 0.512403, 0.763879, 1.867601, 0.792126, 0.500682, 0.512156, 0.531235, 0.820513, 0.830080, 0.834508, 1.298660, 0.874453, 0.487517, 0.283157, 1.755571, 1.478045, 0.503687, 0.806511, 0.795164, 0.791190, 1.710810, 0.998825, 0.885057, 1.787988, 0.501003, 0.279132, 1.124916, 1.314566, 2.461813, 0.501241, 1.417253, 0.503631, 2.504968, 1.310284, 0.501263, 0.498320, 0.502834, 1.290706, 0.817034, 0.747335, 0.754616, 1.372303, 0.570737, 0.761429, 2.365419, 0.431163, 0.726928, 0.323318, 0.761921, 1.811327, 0.302830, 0.719256, 1.735967, 0.747922, 2.110996, 0.518898, 5.116268, 0.512135, 0.470697, 0.604615, 1.416461, 0.510493, 0.725275, 0.249382, 1.285566, 1.315348, 2.042714, 0.862467, 0.811421, 0.807424, 1.255588, 0.804296, 0.772302, 1.247992, 0.536102, 1.279152, 1.249464, 2.374030, 2.306180, 1.265254, 1.210687, 0.669340, 0.755670, 0.740341, 0.824599, 1.350107, 0.824290, 0.770260, 0.515924, 0.499276, 0.509519, 0.400425, 1.278579, 0.264028, 0.528143, 1.324910, 0.442678, 0.771242, 0.795407, 0.729748, 1.674263, 0.832739, 0.706603, 0.856296, 0.397289, 0.543207, 1.362044, 1.337048, 0.504730, 0.539161, 0.516920, 0.771349, 1.853261, 0.515951, 0.507682, 0.226748, 0.828561, 1.731775, 0.420195, 2.702270, 1.526408, 0.494538, 1.548816, 0.879954, 0.778706, 1.236778, 3.983926, 0.517080, 0.975524, 0.819929, 2.265910, 0.964989, 0.375869, 0.387795, 0.461074, 0.856261, 1.662240, 5.228632, 0.809796, 0.793187, 0.784183, 0.808117, 1.333098, 0.480769, 0.832715, 1.140273, 0.767353, 0.257401, 1.183736, 0.747542, 0.431642, 0.769769, 1.261301, 0.777511, 1.426734, 0.520749, 0.858191, 1.276567, 0.790208, 1.228707, 0.902077, 1.676657, 0.763066, 0.783986, 0.882775, 1.759751, 0.751084, 0.443142, 0.800655, 0.141871, 0.758824, 1.712403, 1.392866, 0.969048, 0.870008, 0.924775, 1.086199, 0.352653, 0.788588, 0.736770, 0.800948, 1.654979, 2.116587, 0.381163, 0.405797, 0.280511, 2.558744, 1.519366, 2.459441, 1.285231, 1.295911, 0.510699, 0.647825, 0.529723, 0.759462, 1.059197, 0.528239, 0.742201, 0.965842, 0.775772, 1.951545, 0.489927, 0.496864, 0.748854, 0.534515, 0.774602, 0.812993, 0.753238, 12.918139, 1.784946, 0.141452, 0.726862, 1.334506, 0.780427, 0.387491, 0.754803, 0.512150, 0.784996, 0.792942, 1.115325, 0.437846, 0.801776, 2.159348, 0.772213, 0.944531, 1.174239, 0.854895, 4.103913, 0.136092, 1.342798, 0.757812, 0.069831, 1.312563, 2.017699, 0.859616, 1.743498, 0.807073, 1.101997, 0.787234, 0.496268, 0.534714, 1.367454, 0.707009, 0.861795, 0.854090, 0.823208, 3.032652, 0.067848, 0.870031, 5.269231, 1.308136, 0.275007, 1.097164, 0.501384, 0.887181, 4.595960, 0.730900, 0.526111, 0.508452, 3.471802, 0.561776, 0.850088, 0.783019, 0.789925, 0.326270, 4.990675, 1.121001, 0.905038, 0.741152, 6.567754, 0.517396, 0.641781, 0.771804, 0.053457, 0.750000, 0.812346, 0.815875, 1.225936, 0.755315, 0.726899, 0.813722, 2.737430, 0.544381, 1.748906, 1.165599, 0.723851, 0.455474, 0.518510, 0.508730, 0.531840, 1.624657, 0.741242, 0.512201, 0.810413, 0.950798, 0.198724, 1.944329, 1.390309, 0.831530, 0.323800, 1.219645, 2.914674, 1.501812, 1.264125, 0.788177, 0.763728, 0.787557, 0.818679, 0.490963, 0.914318, 0.994256, 0.791427, 0.827415, 0.396940, 1.249826, 1.346503, 0.753721, 8.144968, 0.523909, 0.199111, 2.192619, 1.257113, 0.554814, 2.124014, 1.276965, 0.829562, 1.303915, 0.769879, 9.207140, 0.418006, 0.353667, 0.687301, 0.766047, 8.272236, 0.509125, 0.853548, 0.501993, 0.788950, 0.944018, 0.373716, 0.689489, 0.418917, 0.804469, 0.455291, 0.493734, 0.396413, 0.513592, 1.728842, 0.649500, 0.752140, 0.300182, 0.801647, 1.308018, 0.768786, 0.821913, 1.853508, 0.876529, 1.022613, 0.394633, 1.239278, 2.139321, 0.506893, 0.745933, 0.793174, 0.771541, 0.562195, 1.754763, 0.406806, 2.495068, 7.116020, 13.504375, 0.815687, 0.437969, 1.732858, 1.598247, 0.958356, 8.375789, 0.332338, 0.766034, 0.308288, 2.314128, 0.842994, 0.792737, 1.139177, 0.790074, 0.378480, 1.329064, 3.335902, 1.400847, 0.744571, 0.383040, 0.736183, 0.825099, 0.491420, 1.649111, 0.765832, 0.834471, 1.987552, 0.790032, 0.808142, 1.288960, 0.799372, 0.805662, 0.704716, 0.717906, 0.384274, 1.287842, 0.719335, 0.235101, 0.254518, 1.797652, 0.792722, 0.365120, 0.817376, 0.749912, 0.824427, 1.772018, 0.853228, 0.501285, 1.546050, 0.476234, 0.392557, 0.790512, 0.783859, 1.379720, 1.287726, 1.100633, 15.977680, 0.799789, 1.402055, 1.348877, 0.793735, 0.513766, 0.567244, 0.194618, 0.520794, 0.507570, 0.800855, 1.864311, 11.677596, 1.331518, 1.316899, 0.633631, 0.490152, 1.592784, 0.507289, 1.300524, 0.766503, 0.498530, 0.514831, 0.655646, 2.002140, 0.757490, 0.816160, 2.525193, 0.486809, 0.409551, 0.751869, 0.787835, 1.315516, 0.819172, 0.806669, 0.623428, 1.319451, 0.588803, 0.733583, 0.265706, 0.806475, 1.673868, 0.692332, 0.812569, 0.548402, 1.636807, 1.298390, 1.270690, 1.329054, 0.429282, 0.514618, 3.177476, 2.729238, 0.772240, 0.804142, 0.771843, 0.705529, 1.394115, 1.114475, 0.526723, 0.407400, 0.789398, 2.331934, 4.658666, 0.812188, 0.841300, 0.474820, 4.756884, 1.906582, 0.774101, 1.841346, 1.260242, 1.216847, 0.761468, 0.818586, 0.742154, 0.782811, 0.757905, 1.404572, 0.788462, 0.738227, 6.156149, 0.757717, 0.774355, 0.542925, 1.192925, 1.231288, 1.332109, 0.781908, 0.786962, 0.379796, 0.428600, 0.814029, 14.073955, 1.268557, 2.709378, 0.496837, 0.544190, 0.290061, 0.778205, 1.314325, 0.499425, 0.914646, 0.514012, 4.837310, 0.834911, 0.258786, 0.380264, 0.886684, 1.763339, 0.668615, 2.317039, 0.799647, 0.574060, 0.301821, 0.501693, 0.522481, 0.765126, 1.388022, 0.517353, 0.470357, 0.090019, 1.772875, 3.215797, 1.359900, 0.857654, 0.817521, 1.278838, 1.548919, 1.114691, 0.295771, 0.447088, 0.838398, 1.221448, 1.324524, 1.333819, 0.824084, 0.970410, 0.460063, 0.523375, 0.775018, 0.725396, 0.811354, 0.788415, 0.947203, 0.825916, 0.461722, 0.526558, 1.781929, 1.308627, 1.048501, 0.772366, 0.489602, 0.255560, 0.790536, 0.187750, 0.441346, 0.686028, 0.873574, 0.477913, 0.740806, 0.779339, 0.719793, 0.796372, 0.873882, 1.679823, 1.400000, 1.118442, 0.509782, 0.588068, 1.258296, 1.285916, 0.826715, 0.783345, 1.651332, 1.565024, 1.084104, 0.522293, 0.364998, 0.757641, 0.799732, 0.546209, 0.530636, 0.752884, 0.789338, 0.943754, 0.488393, 0.401378, 2.162117, 1.309271, 1.194883, 0.428243, 6.189324, 5.181694, 4.116495, 0.162800, 0.245539, 4.872592, 0.337872, 0.736222, 1.192603, 0.801081, 0.779465, 1.069099, 0.761210, 1.429809, 0.776923, 1.297538, 0.968950, 12.501056, 0.765763, 1.703390, 3.320850, 0.953798, 1.838459, 0.822483, 1.342115, 0.584497, 0.760530, 1.677793, 1.243311, 0.804317, 0.422263, 0.847802, 1.194975, 0.740378, 0.836993, 1.178559, 1.318823, 1.697032, 1.263300, 1.339691, 0.810004, 0.759663, 0.761771, 1.307531, 2.238916, 1.228229, 1.230660, 0.642296, 1.187543, 2.405792, 1.360814, 0.784517, 0.371345, 0.704057, 1.846939, 0.823997, 0.788804, 1.025863, 39.303546, 1.606012, 14.328520, 0.910687, 6.905040, 25.768589, 0.814704, 0.433839, 0.800365, 0.989435, 0.818643, 6.998928, 1.062434, 0.771006, 0.813911, 0.446950, 0.800573, 0.701776, 0.752188, 0.733022, 0.784440, 0.714532, 0.578487, 0.821839, 0.794965, 0.847890, 0.814709, 4.879870, 1.235143, 0.577968, 0.549394, 0.615946, 0.751147, 0.859243, 0.811279, 0.422222, 0.646940, 0.769850, 0.762950, 0.758082, 0.402441, 0.720508, 1.149609, 0.808368, 0.849945, 0.432504, 0.691862, 0.144999, 0.270147, 6.426481, 6.170697, 0.223248, 0.123989, 0.866226, 1.840868, 0.747722, 10.298791, 0.781774, 0.451308, 2.571077, 1.238737, 1.110090, 1.321416, 1.287772, 0.820734, 0.829595, 0.800567, 1.234219, 0.772205, 0.636070, 0.805710, 0.727208, 0.449968, 8.978415, 0.828413, 0.800000, 0.812790, 0.968134, 1.989451, 0.757411, 0.832789, 1.276573, 0.687380, 1.405108, 0.093333, 0.566684, 0.748623, 6.588613, 1.240907, 0.738816, 0.321500, 0.603955, 0.756940, 0.763148, 0.785109, 0.814774, 1.212970, 1.541836, 0.752482, 0.753524, 0.625899, 0.755448, 1.337500, 1.824754, 0.769761, 0.786919, 1.716961, 1.155047, 0.775370, 0.792574, 1.221448, 1.040866, 0.807976, 0.846268, 0.801429, 1.491803, 0.820621, 2.492470, 1.427660, 0.769850, 0.791961, 0.805256, 0.802043, 1.025801, 0.731214, 0.795301, 0.804834, 0.909700, 10.049708, 2.646576, 1.205803, 1.219255, 2.591363, 0.668693, 1.206110, 0.947406, 0.741610, 0.771205, 0.753943, 0.825495, 0.812137, 0.685783, 0.796580, 7.701937, 0.869614, 0.831021, 2.194894, 0.747979, 0.774973, 0.699584, 0.729819, 0.458637, 0.811280, 0.786624, 0.791357, 0.754294, 0.465590, 0.803309, 0.887974, 0.565514, 0.751606, 0.814586, 0.788773, 0.704451, 0.742787, 0.805545, 0.813978, 0.747417, 0.437686, 0.631195, 0.789474, 0.752941, 0.811896, 0.584090, 1.245387, 1.181481, 0.753680, 0.743398, 4.615192, 0.768868, 0.778246, 0.396916, 3.799353, 1.135077, 0.801540, 0.784605, 0.812389, 1.884249, 1.987239, 0.817270, 0.666171, 0.869197, 0.760796, 0.600104, 0.810296, 1.538371, 1.368087, 1.317663, 0.847283, 0.750784, 2.323357, 1.858164, 0.140595, 2.050089, 0.762926, 2.084482, 11.413136, 1.781643, 4.533702, 1.229787, 1.876194, 7.406934, 2.737868, 1.297421, 0.787647, 0.792313, 1.022806, 0.773399, 1.250594, 0.742419, 0.745556, 6.334851, 1.344925, 0.760945, 0.411899, 0.769637, 6.468804, 14.099685, 1.266858, 1.605974, 1.302098, 0.782778, 0.648289, 0.648848, 0.592134, 0.836364, 0.739281, 1.228581, 1.758633, 3.019092, 1.125938, 0.711768, 2.142173, 0.793737, 0.773677, 0.817762, 0.773504, 2.634451, 0.790928, 0.789209, 0.786352, 0.812455, 0.343160, 0.908257, 1.526335, 1.143942, 1.539774, 0.793417, 0.747291, 6.140233, 0.482917, 0.558756, 4.390514, 2.400428, 1.283375, 0.802395, 0.834637, 0.838722, 0.323090, 0.405149, 0.817108, 0.835763, 0.811103, 0.821982, 0.780427, 1.678832, 0.721700, 0.756037, 0.045970, 2.086529, 1.260761, 1.477122, 1.282964, 1.783897, 1.317678, 0.812485, 3.217561, 2.040479, 0.794506, 4.635945, 0.756486, 0.675022, 1.263031, 1.763830, 3.410098, 1.321429, 0.799509, 0.799791, 0.334727, 1.271821, 0.780627, 2.877437, 0.858233, 1.251811, 1.857374, 1.994413, 0.411232, 1.247374, 0.703738, 2.720652, 0.862637, 0.791367, 10.162192, 1.275838, 2.436645, 0.774359, 0.856182, 0.396226, 1.853172, 0.800916, 1.335507, 1.374155, 3.218728, 0.859026, 1.312297, 0.735409, 1.543989, 0.751899, 1.414260, 2.151159, 1.430454, 4.596994, 1.116237, 0.769367, 0.793190, 4.055515, 3.346101, 1.693222, 0.791953, 0.789511, 0.811842, 0.787070, 2.276446, 1.353734, 0.855748, 0.807746, 0.807734, 0.604888, 0.816104, 1.214433, 6.128997, 1.387281, 1.577929, 0.821429, 0.691221, 0.385980, 0.532282, 1.334029, 1.281175, 5.034954, 7.544835, 6.162201, 0.470176, 0.858470, 8.080000, 0.900467, 0.861323, 0.537967, 2.739191, 0.789210, 0.801518, 1.386637, 0.800000, 7.232633, 1.426825, 0.677352, 0.343286, 1.291976, 1.293212, 1.314465, 0.828415, 0.261098, 1.286835, 2.653127, 2.032793, 0.784996, 0.737513, 10.425336, 11.300554, 4.589968, 0.810870, 0.828290, 0.597649, 1.777818, 0.792194, 0.795687, 0.778940, 0.729665, 2.051489, 1.326408, 0.840223, 2.178630, 0.565305, 0.801613, 0.768626, 0.752182, 1.796113, 1.330840, 0.239122, 1.412528, 1.165074, 8.362794, 0.785403, 0.747693, 2.282345, 1.324401, 0.559548, 0.602527, 0.662246, 0.382478, 2.199147, 1.305447, 1.697392, 0.851439, 1.864288, 1.272540, 1.605141, 2.537923, 1.273234, 0.661207, 1.854937, 1.373077, 0.828159, 0.547680, 0.778450, 2.593596, 0.783345, 0.764645, 0.763682, 1.506137, 0.452204, 0.793212, 6.420042, 1.841009, 1.139339, 0.762397, 3.992479, 1.301399, 1.543809, 0.794536, 1.916120, 0.923676, 0.781073, 0.803610, 1.286975, 0.376895, 0.327565, 0.727653, 0.475051, 0.788441, 0.710458, 0.278755, 2.178482, 1.624467, 1.326427, 0.802787, 0.785610, 14.576950, 0.981418, 1.860507, 0.837455, 0.811021, 11.502787, 7.369776, 0.205315, 1.783310, 4.730046, 2.519122, 0.825714, 1.296735, 0.486114, 0.813198, 0.791740, 0.999006, 0.205626, 0.431404, 0.230398, 0.683721, 0.845380, 0.801751, 5.407756, 0.605109, 0.787166, 1.662482, 2.432686, 5.743133, 0.610476, 0.535379, 0.826149, 2.927220, 1.137255, 0.816797, 0.533791, 1.228133, 2.433547, 2.376318, 2.282617, 4.774858, 6.254959, 1.336923, 1.097982, 7.457893, 0.800213, 0.797386, 5.831909, 0.805014, 0.752962, 0.234924, 4.197571, 0.872481, 0.455668, 1.298134, 1.691222, 1.370450, 0.759704, 0.313267, 1.799031, 0.954193, 1.890275, 5.471673, 1.253491, 0.765410, 1.353690, 0.508748, 0.637092, 1.454266, 0.756522, 0.791050, 0.781903, 0.827969, 1.278566, 1.143033, 1.226232, 1.231507, 0.762482, 0.737509, 0.796110, 0.794462, 1.352612, 1.333567, 0.393059, 1.315441, 1.758389, 1.368365, 0.965240, 0.276354, 1.851892, 1.898757, 0.814243, 0.824530, 0.834823, 1.288295, 14.900176, 1.718513, 0.609294, 2.160745, 1.346671, 0.815252, 0.813826, 1.580751, 5.862133, 0.854302, 0.817443, 2.095423, 1.785966, 1.352579, 0.756045, 1.339852, 0.122468, 2.807887, 1.187651, 1.310957, 1.184511, 2.887477, 1.875000, 1.499663, 0.746254, 0.790105, 0.790732, 1.352311, 0.815059, 1.344051, 1.335351, 0.290109, 0.318498, 2.256720, 1.295353, 1.023262, 0.290524, 0.548850, 0.490794, 0.814607, 0.751084, 0.759848, 0.476308, 1.976507, 0.280630, 0.533333, 1.631021, 2.269069, 0.830758, 0.482249, 0.602442, 0.866507, 0.061768, 0.770165, 0.457054, 0.529883, 0.614331, 1.262574, 0.684440, 0.803167, 0.813813, 0.785342, 1.056079, 2.518724, 0.666032, 1.386653, 0.488594, 0.773491, 2.644003, 0.758846, 1.061391, 0.761511, 0.718662, 0.490888, 0.531702, 0.835281, 1.311065, 0.766793, 0.502222, 0.530607, 1.865867, 0.758431, 0.786541, 0.574432, 1.197091, 2.930599, 0.705510, 1.270998, 1.193243, 11.937824, 0.434870, 0.746223, 0.792705, 0.264549, 0.778886, 3.008532, 7.696136, 0.767481, 0.771999, 1.335821, 1.272146, 0.802009, 0.496188, 0.539709, 0.645873, 0.871219, 1.188103, 0.537439, 0.813104, 4.804741, 1.052170, 0.522099, 1.250869, 0.797858, 0.836331, 0.543787, 0.529650, 0.775691, 0.773199, 0.383879, 0.503506, 0.764045, 0.515414, 0.796725, 0.806741, 3.740962, 2.654052, 1.129277, 0.534443, 0.672870, 0.754872, 0.784160, 1.538169, 1.256359, 0.814907, 0.530782, 0.516283, 0.528037, 1.328000, 1.323813, 0.921627, 0.478469, 0.266896, 0.751612, 0.506797, 8.525519, 0.751122, 1.300484, 1.448313, 0.729088, 0.804544, 0.508106, 0.829189, 0.357829, 0.806645, 1.293706, 0.810859, 0.532910, 0.728408, 0.804415, 0.781337, 0.757702, 0.760877, 1.284970, 0.506079, 0.474672, 0.702787, 1.253222, 1.889803, 0.909955, 0.739960, 0.285112, 0.976287, 2.929754, 0.806279, 6.100946, 0.521621, 0.777027, 19.541933, 1.032293, 0.717921, 0.770626, 0.515679, 0.792367, 2.648531, 0.766980, 1.493076, 0.742403, 0.761019, 2.234918, 1.737649, 7.869758, 0.489764, 0.516769, 0.812408, 0.491297, 0.490731, 0.809243, 1.722982, 1.299747, 1.237676, 0.720827, 0.472854, 0.404209, 0.489607, 1.285134, 9.885184, 0.786868, 0.775357, 10.782799, 2.426224, 1.268409, 0.790780, 0.539326, 1.862727, 0.435840, 0.793363, 1.399653, 2.916347, 1.249235, 1.459040, 0.503810, 0.589619, 0.452159, 2.145805, 1.332856, 0.511649, 0.526817, 0.621205, 0.745896, 1.201094, 0.375706, 6.940765, 0.864132, 1.893262, 0.318873, 2.334137, 3.374233, 1.862946, 1.134824, 0.766692, 1.752307, 1.540879, 0.484290, 0.499112, 0.753669, 0.425885, 0.508426, 0.818824, 0.789148, 0.362249, 3.879376, 1.835583, 2.834430, 4.952949, 0.758227, 0.824606, 0.810474, 8.073892, 0.559761, 1.686689, 2.438322, 0.259655, 0.338694, 0.427194, 0.780921, 1.602201, 12.245526, 1.411277, 0.730591, 0.793548, 0.750433, 0.860788, 4.312661, 0.829028, 0.874409, 0.490222, 0.797366, 0.313574, 0.473118, 2.003905, 1.349687, 1.347353, 1.292010, 1.351228, 1.203476, 0.515144, 0.531490, 0.774368, 1.716592, 0.508744, 0.532855, 0.526006, 8.092791, 2.718717, 0.540907, 1.516849, 0.474736, 0.781445, 0.714830, 0.504213, 0.698611, 0.780556, 0.501342, 1.442955, 2.810394, 1.117404, 3.134399, 0.827548, 0.496680, 0.886253, 0.841996, 1.265093, 1.273827, 0.801949, 0.642983, 0.811531, 0.709255, 1.844576, 0.803355, 0.778249, 1.233924, 0.512329, 0.508643, 0.477136, 0.767773, 0.768855, 0.203788, 0.905775, 0.525416, 0.843028, 1.317747, 0.812656, 0.758669, 1.294159, 0.869464, 0.381402, 0.834375, 0.489215, 0.755699, 0.762706, 0.776801, 0.821744, 0.336464, 0.623810, 0.641910, 0.810353, 0.769989, 3.391180, 0.773156, 0.781653, 0.279737, 0.780409, 0.522309, 0.783219, 0.804826, 24.956130, 1.792103, 2.242715, 0.500440, 0.467774, 0.539267, 0.501008, 1.305990, 0.397359, 0.807138, 0.790436, 3.654269, 11.604676, 2.281651, 0.531098, 1.729443, 1.347145, 1.353245, 0.598973, 0.521889, 0.495944, 0.785441, 1.312298, 0.525727, 0.813701, 0.550348, 0.605988, 0.756106, 0.391404, 0.881751, 2.321135, 1.792561, 1.710796, 1.239887, 1.191731, 1.780149, 0.518908, 0.813362, 0.826957, 0.761288, 0.827624, 0.821214, 0.505430, 2.247273, 1.752721, 1.336240, 1.415396, 1.846828, 0.825182, 0.571881, 0.494115, 1.075022, 1.298549, 1.240850, 0.511822, 0.224031, 0.535104, 0.811216, 1.311011, 0.875452, 0.500457, 0.485149, 1.313919, 0.491194, 2.408254, 0.803888, 1.356491, 0.783671, 0.816769, 1.523909, 0.646905, 0.599867, 1.471241, 0.765313, 0.799631, 0.766406, 2.407161, 1.372421, 0.845458, 0.780428, 0.562256, 0.681371, 0.732193, 0.761835, 0.229011, 0.380774, 0.491878, 1.779244, 1.150123, 1.834373, 1.821213, 1.579808, 1.269565, 1.306328, 0.875479, 0.502455, 0.385656, 0.510723, 1.307233, 1.296336, 0.882642, 0.367400, 0.781573, 2.262939, 1.440506, 1.247080, 2.258030, 0.795031, 1.302883, 0.815935, 1.257711, 1.250510, 0.783146, 1.471046, 0.242009, 1.349842, 0.824020, 0.476441, 1.279562, 1.341673, 0.801632, 0.718728, 0.295490, 0.825100, 0.832745, 0.812213, 1.130445, 0.796639, 0.778951, 2.327857, 6.426540, 1.234461, 0.776888, 0.747022, 0.781786, 0.773097, 4.448923, 0.848201, 0.786018, 1.640364, 0.811414, 0.786295, 0.692284, 0.752661, 0.781646, 0.830161, 2.360873, 0.522675, 0.406171, 0.778947, 0.777274, 0.528280, 0.185401, 0.793255, 3.217685, 0.520224, 0.422591, 1.250799, 0.917342, 0.803391, 0.806735, 1.218250, 1.542963, 0.484399, 0.475456, 0.835918, 1.737896, 0.851852, 0.796167, 1.420771, 0.819814, 0.684318, 0.381368, 0.777627, 1.353426, 1.254773, 1.813613, 0.520066, 1.745400, 1.979695, 0.754213, 1.253731, 1.259246, 0.738104, 0.505046, 0.422031, 0.868309, 0.799093, 0.779193, 5.155446, 2.836168, 1.373080, 0.810227, 0.225827, 0.535406, 0.498834, 0.752650, 0.828571, 0.807421, 1.721545, 2.040422, 0.859079, 1.911447, 0.751817, 0.890519, 0.794565, 0.825942, 1.210420, 1.300754, 1.203267, 0.521546, 0.545007, 0.352624, 0.814828, 2.964143, 1.324768, 1.226644, 0.538141, 1.795604, 1.094913, 1.232362, 0.793501, 0.252136, 0.223508, 1.609886, 0.495533, 0.446813, 1.849455, 0.805593, 0.740453, 0.809641, 0.819887, 0.514722, 0.956298, 0.781129, 0.744103, 1.298601, 0.516152, 0.373359, 0.211905, 0.748084, 0.449263, 0.718642, 0.803462, 0.813697, 0.799426, 2.764915, 0.467157, 0.741453, 1.136828, 2.601710, 1.502061, 1.672751, 1.587604, 0.791055, 1.324886, 0.764037, 0.833211, 0.757240, 0.796218, 0.486978, 0.342581, 0.853446, 1.201624, 0.416842, 2.360776, 0.816205, 0.799929, 0.757112, 3.979930, 0.965382, 0.451706, 0.490951, 0.645844, 0.781880, 0.512974, 2.714234, 0.503922, 0.759785, 0.731801, 1.880900, 0.786931, 0.468919, 0.515243, 0.662947, 2.112458, 0.497325, 0.779025, 0.794267, 0.771544, 0.779225, 0.935531, 0.551524, 1.341588, 0.817812, 0.798591, 0.790340, 21.171386, 0.874639, 0.500466, 0.521780, 0.787579, 12.897303, 0.529055, 0.362840, 0.505683, 0.509030, 0.791085, 0.785484, 0.785510, 1.331232, 2.372178, 0.236168, 0.525468, 0.479204, 0.814322, 0.797163, 0.760627, 7.436487, 1.189725, 0.795215, 2.199929, 0.494906, 0.392330, 0.846397, 0.832125, 0.745973, 0.783574, 1.340000, 0.779262, 1.918722, 0.769545, 1.862773, 1.246353, 0.501825, 0.746756, 1.435087, 2.403464, 0.382957, 0.360847, 0.222966, 1.442216, 5.752611, 2.084504, 6.906892, 0.882277, 0.810351, 0.526552, 0.897491, 0.683480, 0.731110, 0.719560, 0.747576, 3.021447, 0.748380, 0.464356, 0.501049, 11.137710, 0.756297, 5.346181, 0.362113, 1.782907, 0.393245, 23.415638, 4.796186, 5.846678, 0.789655, 1.147905, 1.092442, 0.801081, 0.803456, 0.252710, 1.322397, 8.032936, 0.523119, 0.473443, 0.486333, 4.518042, 1.352829, 0.351184, 0.029525, 1.281306, 0.419456, 0.357038, 0.074535, 7.939020, 88.698263, 2.193583, 3.824934, 0.748372, 1.404420, 0.236657, 0.786997, 1.828645, 0.898087, 0.550895, 0.171925, 2.596639, 0.543728, 0.418591, 0.682663, 2.188937, 3.308227, 1.842664, 3.876007, 1.705215, 8.408365, 1.303641, 1.840155, 0.754460, 0.111681, 0.847257, 0.155343, 0.232807, 1.289013, 0.095490, 0.306348, 4.201687, 0.192165, 0.829749, 0.083324, 2.529307, 0.130927, 0.941862, 5.939505, 0.169119, 0.431353, 0.269030, 0.160320, 13.104976, 4.632644, 0.788919, 1.824948, 0.483612, 3.712234, 1.659249, 1.325289, 1.296936, 2.737688, 0.758265, 0.068815, 0.234388, 1.070254, 9.299512, 0.399965, 3.528579, 6.586288, 0.555559, 0.388753, 2.342886, 1.787391, 0.265141, 2.555023, 3.357291, 0.342348, 1.282885, 0.434416, 0.048185, 0.724444, 7.444591, 0.740918, 0.371893, 0.361566, 8.680444, 20.953286, 5.684668, 0.099124, 0.254710, 2.105805, 9.041435, 0.272236, 3.873188, 0.618435, 2.507067, 1.428011, 0.741171, 0.485816, 1.889610, 0.850523, 0.276867, 0.830645, 0.137701, 0.312274, 5.348859, 0.034389, 0.470837, 0.739917, 2.207238, 0.166949, 3.451451, 0.204806, 0.378454, 0.781670, 0.778777, 0.759266, 0.779885, 0.246161, 2.075244, 2.459096, 0.787348, 0.501260, 0.940962, 0.907912, 0.848751, 0.776942, 0.760962, 0.817957, 0.708962, 2.720092, 5.542363, 1.735873, 0.316573, 0.790889, 0.463695, 4.493923, 5.573785, 1.326772, 1.630113, 0.937492, 0.519283, 0.358963, 17.325843, 0.493483, 1.052737, 0.083152, 0.127433, 1.877820, 0.236627, 0.262224, 0.065011, 26.654654, 2.309013, 0.842578, 0.335845, 0.050144, 0.778929, 0.709416, 0.320760, 0.654405, 0.851286, 0.281249, 0.201345, 0.755059, 3.139762, 0.813732, 0.546323, 1.482915, 1.872363, 0.363424, 8.957942, 0.518734, 0.787572, 2.558345, 0.619338, 0.409948, 0.278374, 0.448646, 0.433637, 0.512802, 3.543314, 0.675072, 1.251559, 3.654577, 0.116055, 4.203580, 0.373214, 0.070428, 0.419556, 0.771500, 0.179937, 0.305556, 10.116331, 4.386333, 1.301587, 1.593849, 6.881860, 1.216682, 1.135763, 1.768563, 0.632233, 0.262694, 2.882434, 0.476032, 6.521147, 0.064208, 4.126474, 0.431227, 1.180135, 0.394657, 0.496903, 1.555244, 0.781678, 0.031743, 0.542176, 1.876263, 0.234107, 1.302586, 1.328210, 2.024944, 0.109190, 9.748436, 0.218158, 1.302249, 0.120100, 0.752853, 5.400480, 0.140703, 0.849571, 0.303971, 0.508486, 0.103033, 0.799145, 0.757608, 0.102748, 0.527269, 1.791943, 0.538962, 1.187171, 13.500177, 0.463125, 6.779958, 0.796087, 3.055269, 0.334117, 0.492106, 0.486883, 0.310300, 1.239308, 1.307033, 0.846048, 0.467572, 0.519305, 1.340837, 13.565520, 0.130461, 0.526926, 0.495922, 16.427680, 1.318275, 0.857920, 0.517969, 0.801973, 0.366393, 0.800289, 0.580227, 0.549809, 0.306055, 0.773539, 1.259993, 0.819509, 0.421413, 1.012089, 0.347104, 0.711346, 0.802945, 7.459191, 3.142912, 1.061770, 0.807280, 1.675170, 0.052300, 0.491498, 0.181277, 0.489707, 0.774772, 0.795626, 1.805132, 4.021175, 2.753710, 4.690667, 1.069953, 4.448932, 1.163641, 0.069375, 0.346225, 2.653887, 1.482723, 0.838399, 0.466754, 4.958727, 0.638783, 0.112173, 0.169615, 4.449067, 4.994187, 0.790890, 0.532403, 0.507170, 0.274716, 14.642356, 19.809134, 0.798043, 1.558090, 1.274988, 9.169456, 0.203854, 1.263212, 10.929342, 1.805529, 19.002193, 3.116507, 1.475361, 1.990002, 0.401441, 0.772242, 1.412960, 6.648487, 7.375274, 0.689816, 0.461950, 0.356313, 4.631370, 0.179024, 0.533854, 0.282463, 0.733024, 0.776833, 1.125983, 0.740818, 1.266415, 6.606039, 1.278934, 1.712762, 0.462015, 17.219197, 0.787500, 0.782367, 9.716547, 1.202955, 0.730635, 0.390900, 0.512520, 0.059898, 0.501391, 0.815737, 0.473988, 0.751645, 0.785112, 0.058722, 1.148360, 0.791194, 0.666605, 11.861239, 14.056750, 0.751303, 2.305471, 0.586219, 0.868610, 0.093084, 0.449032, 0.116677, 0.373102, 1.193353, 0.205397, 0.361583, 0.151480, 0.873119, 0.109210, 0.539026, 0.584870, 0.513408, 0.783287, 0.863491, 1.368091, 0.098295, 2.083655, 0.522246, 0.720968, 0.683179, 10.113347, 3.647468, 0.784602, 0.866697, 1.276330, 0.141589, 1.324253, 7.412427, 16.476912, 1.285279, 0.141829, 1.104666, 1.183559, 0.762984, 6.878767, 0.385780, 0.858900, 16.400896, 7.952365, 6.757005, 0.707395, 1.363700, 2.342047, 2.329823, 0.528707, 0.036585, 1.349291, 0.758348, 0.754336, 0.725929, 1.290165, 0.500793, 0.532829, 0.709382, 1.306243, 1.701608, 0.307947, 0.377544, 0.313630, 1.475652, 4.087209, 0.467551, 1.021906, 3.905086, 8.528719, 1.256778, 0.810500, 4.819922, 0.782424, 4.893993, 4.449064, 0.078277, 0.391258, 0.296486, 0.493409, 4.996899, 6.828039, 8.646006, 5.682150, 0.729444, 0.711498, 6.823721, 0.292748, 2.394298, 3.824163, 0.165867, 0.523030, 0.119795, 2.703400, 0.418444, 9.042193, 0.817147, 1.133517, 0.818018, 0.144370, 0.991575, 2.443526, 1.308045, 1.683270, 0.686661, 4.149628, 1.591610, 0.598963, 1.724138, 6.374773, 15.226156, 3.855266, 3.973152, 0.830258, 0.775476, 0.402623, 0.343824, 7.378362, 1.830741, 4.076140, 3.856225, 0.752410, 0.772232, 0.703093, 3.894456, 7.534958, 0.195358, 2.802899, 1.552254, 3.152213, 0.853644, 1.729692, 14.262174, 1.028516, 1.241638, 13.008514, 16.187943, 1.397148, 0.976967, 1.291341, 0.690475, 1.270585, 0.491630, 0.217140, 11.507681, 0.379593, 0.023310, 0.810689, 1.272171, 3.511127, 4.656364, 0.956781, 11.177996, 0.811543, 1.736951, 8.777310, 0.501766, 0.267531, 0.851997, 2.801046, 0.125147, 0.802660, 20.149946, 0.759559, 0.912039, 3.141341, 1.236134, 0.815942, 0.466511, 0.862898, 0.779781, 4.484727, 9.394191, 1.634993, 3.603111, 0.148642, 5.185675, 1.871855, 3.389496, 0.165610, 1.208333, 1.200069, 1.285863, 7.889124, 0.291330, 0.065496, 2.190169, 0.764787, 6.786570, 0.740076, 0.114686, 1.302006, 0.763110, 1.284912, 1.441746, 3.078763, 0.138878, 0.122732, 1.455106, 0.687807, 1.324838, 0.746975, 0.527670, 0.846388, 0.739803, 9.684120, 0.790294, 0.514325, 0.713178, 2.709240, 5.070402, 0.721488, 0.511550, 1.847649, 3.992928, 2.197768, 11.034247, 4.900890, 4.196158, 0.420225, 8.200978, 1.768382, 0.950090, 0.811307, 5.460061, 0.574595, 0.492780, 0.798404, 7.706972, 0.769684, 0.526366, 2.929825, 0.471221, 1.535461, 0.475233, 0.736726, 0.806774, 0.802617, 0.764560, 2.976641, 2.117943, 0.475814, 0.904661, 1.662712, 0.844930, 1.219027, 1.321745, 0.313901, 0.450352, 2.869481, 0.498993, 3.468911, 6.392004, 0.531107, 0.935558, 0.153388, 5.431551, 2.854129, 3.483985, 1.980769, 0.267214, 1.855182, 3.664872, 0.357286, 2.266120, 3.732840, 0.288403, 0.778317, 0.817366, 2.970011, 5.337094, 7.879471, 2.319292, 13.636557, 5.627458, 3.035814, 0.516432, 1.171928, 5.067204, 0.385293, 0.774388, 10.270642, 12.340961, 0.807307, 2.417243, 0.048466, 0.792687, 0.134969, 0.035323, 0.203069, 0.477983, 15.877704, 0.801383, 12.026657, 2.324569, 3.166834, 43.323734, 4.905785, 0.772602, 1.432919, 4.731635, 0.445889, 10.569124, 11.603398, 2.086088, 9.657837, 0.328599, 0.840352, 3.691282, 20.826231, 5.966273, 6.904480, 1.805693, 1.826742, 0.684688, 1.955287, 1.184798, 10.559678, 29.804878, 1.458484, 3.987528, 0.764205, 2.266207, 6.768177, 0.798208, 0.510256, 12.986552, 0.452000, 0.900627, 5.159314, 2.416015, 1.305550, 0.784321, 0.616680, 0.818643, 0.529950, 0.772059, 0.367071, 1.592460, 1.168592, 1.259170, 0.508701, 0.828723, 0.788929, 1.527501, 1.010160, 0.745273, 0.794593, 1.378456, 1.284672, 0.586826, 0.879391, 0.544844, 0.395229, 0.788968, 0.654047, 0.775018, 0.771911, 0.787334, 0.811845, 7.666548, 0.181365, 0.520608, 0.820230, 1.121497, 0.466829, 0.777890, 2.840190, 1.752848, 0.430347, 0.730180, 9.334425, 0.397595, 0.799632, 1.223294, 0.574084, 0.772744, 0.786605, 1.276434, 0.719224, 0.390244, 0.499213, 1.371032, 0.823508, 0.393276, 0.291645, 0.922200, 1.277415, 1.314944, 0.518119, 0.792408, 1.355563, 2.399439, 0.778433, 0.822893, 1.231149, 1.191948, 1.230432, 1.253278, 0.727081, 1.308244, 0.848396, 0.502813, 0.360019, 0.506261, 0.725706, 0.780056, 0.542080, 1.303326, 0.487043, 0.396220, 0.785588, 0.812673, 0.792446, 1.674904, 0.659514, 0.533361, 0.494261, 0.631527, 0.765306, 0.874813, 0.805505, 1.911872, 0.544232, 0.306189, 0.508432, 0.801309, 0.531116, 0.781613, 0.760854, 1.835044, 0.790614, 2.313698, 0.800074, 0.871124, 0.060319, 0.500113, 0.782367, 0.491408, 0.499545, 0.525392, 0.691983, 1.688490, 0.677543, 1.441542, 0.626018, 0.783859, 0.742199, 0.679492, 0.524322, 0.502309, 0.834113, 0.780591, 0.532866, 0.790115, 0.510443, 1.846262, 3.366038, 1.778132, 1.068465, 0.823312, 1.248636, 1.259417, 0.505417, 1.453875, 0.538315, 0.785923, 1.370068, 0.715101, 0.481424, 0.536675, 0.512357, 1.049219, 0.742325, 0.496341, 0.751650, 0.772015, 0.710608, 0.733310, 0.931298, 0.797704, 1.495016, 0.637686, 0.501651, 0.768962, 0.778629, 1.287362, 0.505447, 0.843137, 1.814297, 0.812901, 0.505102, 5.358876, 1.321240, 1.266368, 0.600908, 0.497412, 0.475547, 0.503564, 3.335392, 0.514457, 0.761856, 0.803201, 1.701754, 1.060250, 0.491691, 1.251741, 1.673128, 0.745263, 1.353152, 1.332248, 1.687565, 2.191225, 0.890058, 4.194439, 1.297652, 0.820000, 0.782501, 0.178948, 0.784248, 0.285550, 0.304069, 0.557796, 0.892439, 0.497002, 0.815723, 0.725228, 1.733560, 0.415328, 0.402013, 0.826763, 1.809946, 0.819690, 0.771972, 0.769317, 1.192174, 0.797871, 1.256419, 0.571665, 0.534120, 4.156959, 1.302482, 0.784452, 0.911019, 0.629072, 0.475000, 0.712416, 0.748927, 0.781055, 0.511942, 0.330057, 2.566350, 1.275493, 0.492786, 0.474783, 0.820985, 0.746554, 1.505210, 0.608228, 1.626722, 0.518410, 2.097864, 0.825569, 0.820550, 0.804004, 0.865501, 0.421905, 0.406228, 0.756276, 0.879934, 1.286331, 1.254237, 0.512525, 0.565995, 1.744614, 1.280664, 0.562432, 0.479090, 0.818311, 0.505511, 0.703355, 0.375853, 0.797208, 1.774716, 0.712011, 0.822961, 0.778700, 1.514761, 1.580808, 0.510576, 0.748451, 1.441903, 0.815771, 0.770732, 0.502660, 1.750440, 54.453058, 0.784314, 0.789435, 0.285822, 0.487010, 1.951286, 0.771284, 1.512455, 0.752394, 1.009533, 1.192571, 0.460606, 0.780166, 0.047420, 0.755218, 1.336949, 1.275767, 0.779625, 1.241292, 1.343944, 0.513297, 2.114805, 0.508749, 1.267692, 1.802043, 0.809816, 0.524228, 0.527759, 0.501036, 1.282211, 0.808229, 0.512026, 0.812882, 0.508144, 0.553142, 0.792281, 1.344778, 0.517939, 0.387790, 0.699534, 1.281884, 0.740367, 0.374393, 0.250552, 0.375744, 2.133885, 7.107652, 0.808405, 0.719202, 0.768075, 0.741202, 1.285817, 0.623079, 1.172001, 3.315390, 0.506007, 4.412567, 1.500883, 0.760296, 0.452304, 0.635799, 1.151662, 0.382444, 0.776860, 0.779599, 0.819362, 0.517092, 0.960455, 1.246372, 0.820080, 1.269896, 0.842697, 0.517434, 0.542864, 0.512324, 1.400502, 1.140519, 0.456371, 0.390680, 0.836531, 0.785118, 1.088802, 0.540638, 1.259469, 0.885174, 0.432591, 0.533161, 0.765313, 0.525544, 0.498375, 1.289186, 1.301795, 0.335416, 0.308303, 0.540402, 0.496266, 1.285347, 1.270401, 6.735480, 0.780747, 0.785681, 1.835303, 1.868270, 1.468559, 0.385881, 0.769178, 1.714040, 0.381042, 0.387477, 0.357688, 0.507515, 0.589789, 0.791045, 1.339215, 0.303168, 0.505725, 0.394723, 0.880308, 0.820494, 0.789212, 2.256526, 0.811717, 0.429798, 0.523132, 0.321926, 0.317699, 0.809387, 0.544020, 2.256574, 1.576135, 0.783507, 1.449438, 0.834114, 1.287352, 2.659764, 0.805477, 0.501496, 0.741409, 0.499218, 0.728843, 0.754075, 1.873922, 1.877369, 0.937940, 1.754051, 0.391281, 0.291445, 0.384710, 0.507649, 0.482789, 1.290860, 0.833511, 0.276865, 1.317990, 0.436815, 0.838629, 4.739208, 0.792852, 0.783413, 0.715921, 0.718940, 0.823241, 0.351396, 0.783735, 0.793490, 0.509661, 0.318130, 0.955257, 1.753012, 1.739693, 2.165042, 9.850111, 1.396380, 0.769550, 1.350397, 0.511052, 0.628650, 0.799230, 0.795984, 0.732181, 0.850353, 0.417979, 0.826984, 0.789455, 1.361915, 0.557605, 0.494225, 0.815011, 0.746234, 0.776496, 0.917284, 0.545637, 0.718264, 1.857703, 0.548723, 0.461894, 0.499537, 6.364651, 0.777547, 1.339286, 1.396036, 0.522764, 0.514044, 0.773673, 1.261191, 0.526709, 0.503448, 0.815761, 1.287268, 0.754428, 1.122862, 0.510280, 0.502386, 0.783505, 0.835994, 0.575853, 0.226007, 0.855463, 0.757642, 0.720426, 0.557670, 0.489825, 0.869922, 10.810870, 0.523261, 0.468784, 0.495440, 0.810172, 1.163480, 1.342004, 0.844615, 0.308270, 0.263466, 1.473439, 0.725869, 1.764416, 1.280596, 1.270436, 2.184126, 0.555004, 5.107391, 0.725186, 1.701236, 1.238816, 1.127665, 1.275615, 1.883117, 0.495234, 0.287072, 0.693228, 0.825586, 0.493965, 0.839176, 0.498501, 0.770509, 0.729797, 1.258076, 0.454131, 0.490302, 0.458217, 1.338710, 0.802139, 0.494346, 1.648630, 0.453474, 0.887719, 1.272954, 1.305771, 0.802655, 0.824410, 0.100437, 5.788219, 1.358247, 6.912681, 0.956401, 0.511507, 0.524676, 1.273847, 1.713052, 0.761456, 0.534306, 1.309222, 0.780204, 1.102581, 0.932958, 1.273977, 1.280612, 1.216720, 0.722752, 9.903553, 0.810211, 0.771796, 0.768469, 0.863842, 1.835896, 0.786252, 0.800783, 0.436621, 0.522859, 0.516772, 0.778435, 0.773639, 0.507638, 0.520331, 2.806235, 0.767773, 1.346306, 0.494303, 0.494006, 0.579674, 0.832160, 1.357500, 1.831191, 0.520028, 0.690365, 1.341844, 1.201015, 1.230329, 0.802064, 0.922157, 1.244763, 0.826927, 1.297652, 0.512554, 0.786775, 1.250182, 1.377868, 1.264665, 0.505838, 0.536232, 0.748102, 0.823463, 0.512838, 0.061734, 1.248575, 0.936391, 2.461520, 5.269449, 1.157950, 3.183134, 0.284295, 1.717354, 0.416435, 0.550962, 0.900372, 0.755350, 1.066403, 1.279963, 0.494721, 1.670908, 0.794844, 6.375000, 0.795844, 6.129055, 1.186039, 1.362544, 1.424860, 1.112166, 0.843966, 0.530773, 0.811677, 0.780757, 0.806288, 0.765463, 1.303390, 0.773712, 1.782759, 0.493703, 0.821016, 0.535030, 0.100681, 0.807011, 1.337384, 2.299467, 0.315415, 0.477212, 1.229793, 1.307167, 0.749911, 0.498557, 0.808433, 0.540609, 1.399972, 0.856891, 2.315960, 0.750876, 0.497985, 0.457342, 0.807838, 1.157991, 14.282549, 1.326748, 2.732132, 0.743092, 1.713475, 1.796810, 0.818947, 0.453581, 1.167230, 0.772775, 2.896071, 0.487402, 0.479366, 0.750615, 0.785689, 0.833258, 0.838996, 0.455426, 1.312034, 0.782531, 0.735577, 0.815412, 0.804208, 0.791201, 0.361228, 1.285963, 0.763566, 1.436174, 0.537215, 0.828456, 0.508586, 0.519281, 0.352803, 0.672347, 1.285682, 2.024133, 1.165651, 0.495716, 0.802072, 0.508446, 2.157731, 0.490737, 7.282934, 0.329006, 0.747161, 0.794375, 0.512718, 0.494857, 0.980379, 0.272661, 0.749727, 0.404886, 0.740210, 0.802886, 0.784286, 1.264364, 1.597513, 0.426893, 0.525246, 1.171591, 1.174046, 0.547057, 0.794900, 0.529070, 1.579855, 0.794396, 0.738827, 0.849872, 0.539095, 0.535773, 5.712408, 0.836364, 1.291104, 0.292489, 0.746269, 1.741168, 1.133987, 0.819577, 0.778743, 2.203987, 1.016140, 0.951426, 0.822238, 0.775540, 0.795040, 0.378715, 0.901137, 0.838775, 1.630728, 0.720778, 1.308440, 0.828991, 0.369926, 0.382789, 1.371772, 0.733219, 0.953521, 3.038993, 0.819719, 0.388029, 0.508260, 0.945869, 0.777699, 1.759122, 1.751532, 0.784396, 0.779673, 0.768689, 11.768633, 0.493166, 0.878131, 0.786992, 0.822402, 0.426641, 0.383172, 0.509955, 1.140583, 0.958870, 0.830935, 0.824081, 0.548969, 3.087655, 1.301807, 0.956329, 0.779091, 0.865310, 0.731359, 1.276190, 1.423381, 0.385278, 0.837243, 7.972648, 0.487253, 1.070059, 1.272121, 0.811453, 0.503865, 2.338387, 0.409075, 0.603395, 0.799645, 0.778561, 0.887522, 0.758999, 1.205152, 0.495756, 1.330547, 1.325080, 1.820766, 0.809138, 0.503932, 0.374936, 1.336804, 2.251993, 0.424506, 0.489778, 1.109314, 1.281996, 1.326937, 2.573699, 1.136396, 0.762359, 0.760824, 0.803630, 0.772873, 0.483913, 0.608578, 2.259128, 1.785869, 1.249831, 0.780277, 0.540732, 1.330021, 1.357352, 0.659331, 1.284214, 1.333910, 0.523623, 0.380528, 0.554606, 0.756567, 7.792774, 1.331302, 2.593437, 3.719064, 0.365808, 0.391983, 1.178913, 0.790960, 0.523033, 0.808609, 2.774609, 1.314218, 0.820376, 0.951912, 0.707162, 0.830950, 0.339883, 1.359438, 0.468146, 0.542096, 0.801327, 0.765957, 1.440642, 1.179104, 0.315656, 0.932276, 0.781239, 0.415778, 0.862995, 0.495002, 0.754520, 0.739530, 3.039823, 0.800819, 0.473454, 1.320883, 0.574442, 1.240599, 0.790079, 0.771108, 0.806126, 1.343247, 0.795977, 0.744318, 0.794993, 0.515744, 0.334262, 1.120256, 1.737861, 1.277329, 0.778843, 2.220253, 0.795936, 0.784646, 1.169427, 1.801049, 0.754441, 0.822101, 0.775664, 0.789014, 0.724443, 0.493627, 0.549688, 0.709413, 1.257163, 1.135314, 0.510793, 0.835920, 0.856730, 1.233814, 0.315995, 0.063890, 0.726492, 0.560794, 0.804957, 0.590195, 1.923968, 0.497010, 0.809081, 0.800495, 2.163854, 9.322346, 0.507279, 0.513313, 0.838384, 0.556638, 0.500335, 0.791061, 0.611570, 0.233161, 1.331560, 1.842485, 0.626235, 1.313583, 0.872240, 0.489096, 2.128684, 0.557568, 1.796793, 0.766737, 0.779184, 0.496234, 0.395907, 0.515589, 0.539211, 0.803950, 0.876712, 0.482003, 0.517661, 1.346182, 1.855625, 1.253569, 0.503915, 1.277249, 1.024713, 1.345136, 0.509666, 0.770480, 1.069185, 0.494985, 1.696545, 0.375424, 2.200325, 1.056719, 2.168276, 1.357795, 5.083637, 0.366805, 0.774940, 0.769285, 0.783128, 1.140535, 5.983304, 0.785214, 1.355157, 0.789161, 1.574823, 0.780228, 0.376598, 0.560178, 0.459200, 0.780618, 0.483514, 0.770139, 0.834994, 0.805926, 1.318919, 1.387943, 1.826894, 0.758081, 0.493416, 0.390146, 0.438391, 12.666782, 0.766070, 0.799279, 0.780520, 1.124250, 0.625043, 0.790829, 0.488741, 1.051336, 0.215345, 0.819359, 0.507042, 1.751221, 0.538006, 0.390003, 0.498657, 2.762956, 0.753031, 1.338830, 0.552221, 0.777699, 0.859934, 1.355216, 0.544471, 0.529261, 0.781438, 1.342990, 0.780343, 0.781038, 0.492315, 1.512304, 1.329133, 0.801653, 0.356932, 0.493125, 0.797459, 0.780962, 0.862804, 1.531128, 8.190409, 1.350106, 0.560885, 0.863574, 0.806459, 1.841394, 1.289621, 0.146432, 1.186809, 0.455666, 0.506475, 1.244014, 0.803590, 0.825876, 0.523409, 5.878015, 0.793178, 1.266327, 0.805709, 3.301404, 0.521534, 0.496647, 9.376041, 0.813589, 0.494795, 0.502314, 0.851629, 0.798829, 2.768722, 0.490335, 1.278999, 0.509091, 0.733977, 0.797700, 1.366333, 4.463449, 6.396820, 0.251812, 0.497270, 1.182089, 1.407485, 0.496670, 0.505289, 0.806678, 1.452837, 1.051012, 0.520102, 0.519022, 0.856610, 1.155161, 0.801880, 0.818411, 5.819238, 0.736381, 0.384657, 0.360297, 0.401923, 0.479809, 0.767857, 1.214636, 2.190153, 0.907385, 1.310086, 1.330478, 0.509216, 0.782069, 0.783422, 0.912607, 0.815759, 2.194986, 1.343145, 1.246232, 1.688363, 1.820827, 1.348279, 0.912498, 1.386243, 0.459621, 0.867290, 0.781661, 0.808890, 0.519435, 1.324903, 0.296843, 0.775105, 0.430671, 1.311127, 0.754229, 1.305144, 0.505987, 1.862500, 0.799343, 0.854137, 0.840609, 0.748772, 7.524730, 0.813937, 1.259056, 0.977354, 13.557025, 0.561311, 2.614196, 0.548540, 1.114993, 0.810251, 0.781530, 0.763167, 0.793266, 0.539066, 0.859496, 1.354653, 0.828613, 0.814815, 0.496011, 0.532892, 0.369529, 1.275517, 1.337945, 0.614661, 0.859927, 0.612343, 0.835626, 0.785153, 0.518649, 1.510070, 0.654399, 0.789568, 0.789174, 0.518610, 0.487888, 1.378711, 0.784578, 1.224249, 1.326056, 0.885275, 3.198852, 0.861372, 0.465371, 1.060491, 0.506565, 1.777423, 0.857344, 0.632026, 0.507427, 0.657974, 1.698497, 0.287626, 6.395132, 0.313404, 0.494162, 1.146324, 1.200213, 1.269647, 0.831031, 1.137116, 2.120257, 14.005005, 2.194998, 1.048286, 0.527229, 0.540235, 0.856255, 1.800000, 0.509673, 0.780720, 0.884887, 0.773917, 0.471104, 0.353959, 0.633155, 0.363804, 0.815583, 0.498518, 0.639746, 1.927713, 0.795389, 1.249819, 0.803203, 0.385863, 0.806767, 2.467248, 6.577491, 0.742680, 0.849654, 13.856268, 0.420535, 0.377213, 1.165375, 0.374606, 0.550135, 1.372232, 1.762059, 1.384233, 0.741628, 2.347718, 1.478699, 0.465063, 0.754331, 0.525366, 1.307229, 0.534912, 0.489005, 0.501709, 3.044018, 0.775043, 0.505587, 0.487939, 0.785021, 0.801093, 0.738423, 0.733428, 1.100419, 1.186632, 0.764786, 1.187736, 0.786509, 0.832658, 1.848485, 0.859617, 0.765657, 0.800999, 0.797262, 0.803243, 1.330943, 0.829563, 1.662983, 0.540262, 1.176017, 0.638450, 0.830815, 1.711206, 0.610172, 0.747103, 5.026923, 0.375211, 0.843110, 1.247477, 0.797698, 0.771860, 1.207728, 0.689853, 1.423129, 0.500448, 0.756149, 1.361023, 1.695118, 1.767972, 1.295029, 0.491135, 1.227671, 0.796349, 1.239199, 0.822142, 0.873990, 0.767089, 4.785739, 0.480586, 1.438317, 0.560112, 0.515532, 0.794530, 0.788618, 0.902161, 0.804643, 0.743624, 1.632379, 0.545433, 0.745858, 0.893865, 2.462673, 0.549086, 0.495526, 0.808662, 2.536031, 0.498874, 1.576184, 0.851064, 0.756860, 0.827687, 0.529301, 0.665434, 0.548054, 0.935835, 3.258579, 0.541676, 0.781855, 0.799716, 6.105068, 1.170732, 1.333145, 0.794265, 1.873454, 0.776194, 1.215374, 1.868506, 0.783850, 0.840876, 0.811308, 0.495449, 1.309728, 0.729599, 0.810136, 0.491126, 0.894216, 9.250356, 1.396907, 0.501026, 0.497733, 0.818011, 1.360404, 0.822836, 0.765625, 3.285361, 0.758846, 7.794639, 1.256002, 1.181934, 0.390973, 0.924613, 7.325777, 14.482060, 1.587510, 0.261660, 13.394900, 0.473733, 0.471949, 0.778373, 0.453986, 1.863147, 0.779643, 1.338858, 0.480160, 0.550332, 0.498734, 0.546034, 0.780171, 0.753002, 0.810078, 0.784871, 0.853045, 0.487938, 1.739382, 1.601584, 0.888265, 0.822140, 0.732917, 0.491935, 0.665787, 5.880695, 0.570360, 0.504579, 0.511589, 1.279289, 0.798651, 0.529426, 0.772505, 1.271607, 0.698077, 0.809334, 0.795845, 0.518130, 0.505290, 0.816423, 1.322207, 2.980114, 0.803428, 0.458006, 0.521364, 0.761084, 0.814749, 0.504467, 0.821658, 0.505804, 0.764849, 0.776845, 0.468311, 1.527914, 0.770687, 0.565068, 0.528624, 1.287496, 0.756708, 1.299278, 0.745578, 0.795699, 0.759069, 1.004649, 0.510343, 0.499210, 0.805103, 0.801703, 0.544008, 1.284844, 1.138298, 1.954135, 1.687415, 3.206261, 0.474170, 0.300699, 0.780263, 0.563488, 0.434515, 0.405607, 0.356193, 0.485057, 0.730756, 1.681818, 1.329488, 1.274194, 0.522873, 0.935719, 0.156366, 0.794267, 0.779417, 1.284830, 0.785414, 0.475463, 0.528543, 1.295814, 0.656880, 0.798936, 0.727116, 0.764213, 0.726721, 0.820988, 0.501595, 2.510686, 4.626826, 1.822361, 0.875258, 0.898630, 0.855656, 0.843901, 0.607484, 0.647072, 0.207416, 0.860891, 0.846863, 1.891028, 0.840172, 0.840212, 0.489416, 2.938435, 0.757955, 0.488644, 0.768909, 0.534123, 0.101803, 0.819917, 0.865777, 0.830044, 0.292474, 0.659953, 1.321592, 0.788099, 0.769905, 0.773885, 0.816481, 0.787447, 0.258362, 0.403736, 0.387777, 0.367446, 0.864091, 0.422038, 0.461469, 0.766691, 1.296257, 6.944015, 11.214440, 0.620987, 1.760073, 1.298641, 1.260157, 1.286071, 0.774137, 1.268538, 2.543218, 0.548799, 0.306889, 0.659202, 0.380944, 0.487666, 0.497356, 0.706801, 0.646108, 0.437227, 6.842707, 1.739070, 0.763564, 0.842105, 0.505860, 1.131068, 1.217507, 0.497199, 0.518698, 1.038969, 0.521642, 1.079804, 0.777195, 0.742323, 0.769971, 0.462907, 2.225814, 1.009501, 0.782139, 0.386340, 7.472778, 0.883015, 0.814641, 0.787901, 1.261913, 0.264915, 2.151290, 0.511943, 0.476065, 0.394273, 1.175331, 0.820285, 0.716096, 0.808787, 1.031016, 3.104488, 0.887560, 1.615675, 8.641227, 3.996157, 0.876462, 0.515859, 0.116395, 0.897427, 0.478339, 0.517306, 0.476602, 0.367073, 0.797447, 0.876346, 0.835988, 1.757662, 0.506749, 0.862705, 1.826868, 0.599829, 1.657832, 1.275910, 1.290466, 0.773254, 0.525273, 0.531991, 0.792687, 1.763913, 0.709821, 0.514590, 0.483326, 0.778975, 1.284024, 0.820724, 0.382513, 0.501695, 0.488655, 0.539436, 0.790981, 0.512006, 0.391845, 9.545665, 1.337451, 0.923870, 2.663776, 0.200923, 4.351773, 0.772105, 1.235460, 0.695297, 0.522294, 0.847138, 0.755556, 1.298258, 2.255763, 0.500450, 0.509045, 1.741132, 0.752397, 0.475516, 0.727024, 7.462034, 0.734576, 0.786131, 0.861456, 0.396571, 0.726836, 0.779760, 0.999601, 0.730256, 0.490092, 2.715256, 0.424635, 0.846924, 1.052337, 0.517265, 0.770549, 1.893162, 2.194182, 1.312034, 0.521432, 0.816908, 1.241307, 0.817263, 0.513747, 0.515051, 0.553919, 0.787781, 0.798923, 0.831473, 0.788261, 0.826729, 0.624565, 1.677524, 0.615223, 0.899068, 2.193715, 2.453065, 1.226786, 1.273699, 0.810370, 4.283720, 1.554599, 0.481734, 1.726931, 1.782516, 1.298822, 1.100454, 0.547562, 0.562888, 1.796257, 0.896680, 0.535475, 0.509120, 0.814500, 0.800000, 1.345907, 4.817131, 0.608612, 0.518015, 0.493170, 0.550063, 0.540807, 0.646874, 0.515466, 0.739009, 0.788849, 0.470652, 0.838596, 0.693657, 12.810820, 0.504626, 0.515250, 0.493898, 10.601692, 0.819160, 0.357298, 0.330753, 0.783831, 0.748271, 0.778795, 0.840753, 0.101243, 0.510348, 0.829268, 2.276027, 0.875000, 1.170151, 0.466914, 0.748652, 1.253225, 0.825728, 0.728438, 0.654787, 4.437922, 0.759636, 0.766234, 1.355674, 0.749297, 0.466532, 0.959554, 1.147294, 0.807140, 0.801465, 0.549789, 0.492202, 0.498948, 1.219829, 0.767099, 0.462506, 0.426818, 0.837589, 13.516992, 1.239417, 1.180230, 1.508148, 1.130191, 0.793705, 0.454806, 0.505495, 0.962234, 0.559161, 0.843321, 0.785814, 0.999772, 1.701854, 0.933133, 0.775949, 6.414071, 0.745620, 0.795714, 1.371408, 0.471252, 2.193901, 0.544647, 1.259060, 0.826937, 0.714385, 0.740881, 1.389880, 1.533727, 1.238983, 0.770285, 0.374955, 0.533089, 7.642857, 0.517471, 0.783128, 0.791637, 0.760542, 0.514382, 1.319495, 0.761682, 0.833757, 0.499646, 0.493087, 0.775668, 0.800355, 3.483871, 0.921792, 1.482058, 1.388622, 0.797581, 1.301955, 0.804717, 1.023457, 0.518058, 1.274645, 0.785486, 0.807197, 0.512262, 0.509204, 0.802334, 0.564529, 0.354720, 0.382856, 7.844259, 0.679029, 0.560081, 0.807122, 0.807483, 0.815784, 1.300256, 1.276325, 1.693961, 0.388351, 0.491807, 1.300069, 0.770973, 1.242301, 1.816743, 1.460434, 8.435351, 0.448051, 0.745366, 1.099978, 0.501027, 0.708594, 0.740604, 0.474048, 1.236301, 0.393772, 1.281437, 1.339479, 0.777739, 0.781417, 0.833037, 0.530263, 0.448475, 1.168547, 2.605011, 4.019223, 11.394248, 0.484743, 0.787075, 0.797251, 0.783601, 0.786415, 0.791205, 1.343818, 0.308226, 0.318379, 0.398351, 0.394967, 0.558512, 1.781812, 0.905733, 1.314680, 0.488136, 1.129594, 0.524081, 4.310212, 0.823721, 0.771917, 0.791028, 0.771062, 1.275172, 0.904902, 0.841837, 4.624862, 1.366879, 0.402140, 0.811739, 1.305710, 0.760854, 1.312500, 3.266763, 0.875671, 1.649677, 1.337000, 0.830914, 0.741980, 0.830048, 1.175215, 0.662305, 0.494597, 0.467058, 0.761719, 0.783446, 0.209875, 0.653833, 0.513489, 0.801994, 9.952011, 0.764932, 0.805832, 0.501012, 2.235866, 0.471154, 1.205793, 0.792757, 0.771039, 0.802948, 0.697405, 0.850145, 2.054737, 0.417652, 0.790115, 0.796847, 0.917078, 1.213197, 0.485166, 0.764458, 0.277778, 0.667295, 0.908289, 0.459066, 0.743642, 0.861335, 0.527916, 1.195424, 0.314583, 1.365148, 1.310601, 1.486664, 0.796154, 0.818281, 0.526884, 0.961447, 0.319954, 0.931686, 0.547259, 0.514716, 0.543869, 1.205783, 0.510604, 0.486266, 0.355707, 0.853448, 0.820761, 0.829054, 0.768743, 0.791606, 1.671557, 1.390912, 0.721646, 1.087541, 1.743590, 1.835452, 1.866806, 4.966682, 0.780548, 7.837887, 0.741650, 0.781050, 0.856512, 0.762783, 0.740574, 0.801009, 1.335587, 0.776254, 0.533639, 0.042106, 0.760053, 1.235939, 0.403051, 0.506335, 0.486990, 0.546177, 1.127440, 0.763364, 0.790796, 0.803401, 0.782033, 0.792466, 0.068743, 6.437558, 1.125603, 1.418715, 2.314603, 0.886275, 1.299756, 0.761210, 1.374726, 0.748749, 0.760475, 0.771144, 0.299573, 0.393748, 0.502525, 0.814553, 1.159327, 1.389173, 1.215805, 0.840870, 0.824604, 0.771290, 0.810108, 0.534773, 7.100249, 0.802726, 0.783333, 2.416187, 0.797127, 0.541220, 0.499524, 0.743267, 0.550239, 0.885957, 1.357143, 0.201843, 0.819687, 0.473718, 0.797958, 0.487466, 0.777662, 0.792420, 1.303863, 1.023367, 1.264945, 0.830740, 1.684118, 0.791725, 0.766335, 0.746992, 5.426512, 2.889578, 0.715353, 0.789474, 1.354702, 0.507722, 0.781129, 0.771155, 0.790379, 0.732996, 0.199282, 0.733106, 0.805960, 1.832390, 1.286976, 0.810692, 4.418639, 0.502347, 0.598501, 0.679208, 1.214781, 0.818932, 0.803672, 0.810369, 0.813060, 0.854153, 6.454711, 0.487087, 7.854128, 1.256048, 0.778411, 0.377049, 0.823324, 0.784761, 0.439737, 0.781714, 0.763719, 0.783042, 4.744710, 0.618107, 0.503509, 0.701134, 0.829915, 0.742182, 0.813447, 0.745118, 3.480198, 1.811205, 9.225271, 0.392048, 1.355987, 0.832244, 0.797906, 0.813987, 1.294944, 0.286254, 2.079492, 0.525710, 1.301828, 0.533767, 0.530112, 0.788609, 0.408747, 0.608337, 1.291903, 1.503680, 1.227117, 0.669437, 0.813886, 0.818967, 0.768551, 0.510786, 0.406266, 0.389907, 5.700749, 0.755785, 1.233240, 0.791871, 0.482718, 0.378038, 0.785426, 1.695697, 0.417343, 0.776080, 0.759023, 0.514737, 0.876159, 0.472615, 0.531631, 0.742177, 1.267826, 1.394946, 0.845014, 0.523932, 0.506862, 2.246175, 0.506091, 0.736601, 0.803349, 1.358352, 0.708659, 0.482398, 0.524181, 2.476067, 0.465138, 1.352302, 0.816750, 2.885959, 0.764340, 0.525012, 4.526833, 0.397326, 1.199716, 1.337602, 0.813822, 9.107539, 0.760747, 0.479748, 0.500696, 0.539321, 1.300633, 2.511611, 0.558451, 0.835697, 0.519256, 0.753197, 0.854312, 0.852270, 1.004121, 0.503055, 0.787900, 1.354565, 1.308077, 0.790123, 0.533221, 0.508260, 6.551511, 1.095238, 0.487185, 0.488745, 0.678062, 0.821958, 0.799220, 0.844428, 0.346139, 0.217234, 0.663365, 1.196182, 0.819078, 0.595050, 1.275163, 0.826356, 0.493025, 1.203514, 0.770855, 0.780367, 10.393613, 0.741373, 0.826512, 0.501839, 0.490587, 0.161726, 0.774090, 1.247677, 0.595538, 0.839964, 0.750934, 0.788290, 0.777852, 1.156854, 1.152775, 0.392309, 0.778752, 0.803425, 1.311957, 0.822088, 0.489834, 0.798302, 2.205461, 0.637667, 1.450269, 0.536857, 0.800315, 0.404314, 0.753215, 0.789533, 0.571019, 1.205748, 4.526491, 0.770590, 0.762482, 3.167571, 0.490621, 0.410205, 0.797765, 0.771153, 0.391511, 2.141861, 1.733615, 0.917478, 0.937305, 0.497432, 0.530126, 0.774401, 0.452131, 0.815108, 0.847098, 0.527011, 1.670839, 1.305412, 0.516724, 0.521087, 6.106698, 4.341719, 0.305338, 0.765281, 0.792277, 1.275838, 0.780327, 0.451535, 0.782083, 3.383571, 2.636870, 1.855296, 2.368802, 1.765302, 0.418360, 0.374466, 1.178761, 1.282468, 1.415157, 0.407441, 0.822710, 0.447718, 7.270182, 0.785714, 1.096450, 0.903545, 0.468265, 0.745780, 0.871313, 0.501547, 0.490132, 1.975552, 0.308831, 0.752078, 0.769231, 0.777309, 0.752718, 0.524722, 0.202333, 0.866231, 1.641796, 1.358214, 0.526864, 0.373673, 0.515817, 0.753002, 0.806300, 0.532777, 1.263866, 3.008699, 2.298943, 0.839229, 5.797408, 1.339674, 0.506808, 1.202243, 0.755709, 0.871486, 15.895803, 0.750696, 0.769680, 0.297782, 0.532262, 0.533147, 0.773638, 1.310406, 0.844884, 0.509320, 0.883444, 12.211679, 0.461235, 1.189183, 0.521591, 0.523810, 0.498073, 1.181544, 0.816942, 1.235251, 11.614048, 8.353751, 3.544537, 0.482929, 0.797717, 1.319820, 2.193260, 0.857761, 0.742828, 4.357143, 0.827429, 0.954465, 0.605910, 1.903836, 1.745198, 0.113576, 0.761241, 0.591065, 0.791301, 5.440938, 0.814321, 0.766808, 0.933382, 0.655402, 0.422701, 0.782342, 1.315455, 2.404087, 1.262662, 0.458494, 0.907520, 0.403561, 0.511445, 0.788252, 0.486945, 0.765630, 0.763494, 0.404545, 1.713434, 1.812629, 0.847121, 0.485773, 0.742644, 0.714625, 0.931195, 0.505479, 0.464048, 0.737699, 0.808937, 0.530594, 0.531396, 1.162464, 1.436708, 1.390977, 0.495788, 0.494232, 0.894233, 1.354300, 1.260839, 2.762373, 2.185045, 1.487395, 0.832324, 0.832401, 5.303100, 1.269562, 0.884763, 0.784810, 0.805223, 1.931728, 1.759383, 1.327749, 1.229575, 0.865641, 0.495986, 0.536811, 0.713479, 0.522291, 0.815335, 0.809627, 0.799718, 0.841337, 1.198506, 0.787751, 0.726254, 0.294601, 0.574123, 1.252189, 0.796622, 0.558893, 0.790857, 1.267625, 0.764104, 0.768461, 0.809304, 0.832487, 0.784981, 0.596197, 1.113329, 0.518485, 1.217600, 0.493458, 0.486326, 0.729693, 1.270677, 0.703140, 0.801362, 1.280441, 0.505380, 0.384902, 0.517719, 0.819357, 1.808268, 0.742306, 0.784995, 1.308398, 0.608929, 0.803063, 0.849400, 0.769367, 0.505540, 0.434526, 0.505829, 1.257584, 1.150011, 1.258787, 1.222147, 0.748323, 1.388144, 4.026215, 0.760809, 0.554676, 0.498589, 0.333787, 1.246102, 0.361666, 0.695753, 0.848462, 4.768073, 0.838949, 0.874401, 0.779087, 1.291795, 6.137038, 0.489879, 0.784714, 2.072038, 0.844888, 1.292783, 0.658109, 0.830206, 0.854669, 1.372596, 0.513977, 0.379598, 0.432796, 0.035330, 0.524718, 11.463466, 0.520731, 0.838504, 0.502809, 12.120642, 0.757398, 0.448959, 0.380491, 4.255965, 1.389963, 1.380864, 0.850801, 1.411911, 0.740566, 1.189259, 2.179352, 0.869161, 0.537209, 0.828728, 0.637135, 0.784328, 2.095291, 1.440892, 3.824598, 3.537110, 0.774677, 0.756115, 0.801843, 1.377699, 1.923333, 0.546073, 0.789390, 0.503265, 2.063650, 0.794138, 0.768188, 0.794150, 0.305642, 0.732283, 0.767838, 1.274165, 0.796881, 0.844388, 0.804109, 0.867482, 3.535990, 0.433172, 0.881183, 0.761199, 0.965529, 3.839083, 0.501457, 0.384906, 0.790932, 0.350557, 1.696906, 0.503033, 0.759663, 1.216578, 1.327887, 3.362939, 2.308612, 0.833221, 1.300765, 10.984906, 0.762575, 0.756873, 0.785989, 1.995342, 0.505376, 0.660163, 0.601548, 0.509747, 0.814112, 1.196281, 8.808149, 0.562008, 0.508717, 0.548150, 0.551625, 0.162829, 1.107610, 1.569440, 1.322718, 0.761707, 0.785688, 1.306524, 0.483060, 0.327904, 0.554298, 0.776909, 0.519417, 1.312239, 1.436911, 1.305874, 4.931919, 0.398217, 0.756577, 0.822662, 1.302655, 0.806855, 0.806096, 3.612032, 0.440221, 0.382524, 0.351846, 0.759409, 1.759040, 0.803966, 0.789549, 0.463039, 0.630821, 4.024960, 0.378732, 0.760998, 0.740590, 1.432345, 0.635736, 0.764516, 0.701934, 1.885287, 0.782670, 0.805061, 0.786728, 0.770463, 0.800223, 2.270095, 1.089374, 1.864180, 0.486836, 1.277837, 0.541741, 1.261050, 0.855135, 0.304211, 0.484385, 1.133032, 1.329371, 0.817686, 0.741462, 0.768090, 1.323638, 0.514610, 0.764602, 1.303020, 1.728591, 0.390931, 0.384231, 0.282645, 0.606638, 1.756975, 0.786152, 1.211936, 0.823720, 0.504682, 0.254433, 0.318182, 0.825411, 1.557868, 0.831022, 0.792603, 1.322757, 0.770201, 0.554628, 0.496861, 1.170280, 1.255903, 0.496817, 0.544237, 0.499004, 0.812910, 1.867238, 0.401174, 0.511421, 0.489007, 1.007265, 0.747896, 0.508059, 0.973491, 0.676179, 0.328356, 0.501403, 0.781558, 1.314125, 1.649408, 0.787911, 1.213120, 1.245026, 0.380247, 0.308048, 0.517407, 0.769613, 0.782154, 0.341129, 1.680121, 0.393955, 1.656346, 0.863536, 1.359655, 1.301075, 1.394007, 0.646870, 0.254498, 0.516780, 0.795382, 1.154955, 0.815132, 0.772892, 1.335832, 1.210289, 0.360139, 0.568168, 1.247659, 0.758128, 1.277302, 0.785612, 0.368674, 0.810623, 0.504125, 0.380435, 0.515145, 1.329433, 0.300921, 0.978264, 0.380161, 0.769562, 0.795181, 0.790417, 1.273047, 1.336577, 0.847321, 0.990590, 0.391205, 1.272697, 0.518458, 0.729124, 1.299341, 0.819911, 1.204333, 1.212840, 2.206427, 0.491181, 0.538297, 0.468225, 0.494889, 0.771893, 1.288740, 1.087733, 0.519850, 0.806358, 1.389596, 0.796718, 0.697795, 0.737206, 0.710490, 0.883196, 11.566618, 0.524467, 0.754380, 0.767260, 0.498098, 0.395418, 0.805142, 0.768242, 0.488049, 0.758380, 1.630769, 1.307248, 1.707095, 1.248690, 1.319730, 0.860136, 0.797846, 0.750427, 2.505187, 0.389072, 0.483086, 0.776135, 0.496197, 0.815771, 12.417973, 0.151125, 0.782760, 0.781909, 1.182450, 0.839709, 0.483144, 0.412461, 0.795309, 0.746474, 0.824140, 0.303845, 0.956836, 0.879018, 0.522806, 0.391603, 1.314737, 0.821013, 0.525439, 0.314632, 0.668944, 0.799789, 0.745518, 0.770580, 0.737906, 1.248898, 0.545859, 0.286848, 0.397054, 1.298838, 0.765988, 0.500808, 1.296864, 1.365039, 1.441236, 0.803279, 0.833821, 0.743856, 0.478330, 9.559328, 0.724162, 1.196789, 0.882272, 0.396281, 0.748799, 0.513594, 0.509276, 0.381986, 1.324991, 0.750790, 1.241033, 1.210088, 0.874859, 0.798413, 2.869039, 1.267299, 1.296914, 0.502516, 0.677827, 0.391071, 1.383688, 0.496230, 0.513768, 0.471100, 1.273575, 0.470984, 0.805526, 0.757112, 1.331644, 0.799563, 0.755822, 0.771728, 0.968292, 0.300904, 10.317398, 2.655784, 0.533039, 1.359271, 0.411053, 0.759114, 6.919777, 0.376904, 0.916072, 0.865476, 0.532054, 1.396116, 0.493986, 1.143966, 1.277217, 0.783617, 0.489683, 2.358363, 0.285661, 1.397310, 1.298601, 0.823838, 0.785369, 0.869284, 0.790449, 2.710779, 0.710440, 0.756860, 0.758186, 0.771008, 0.536166, 0.680269, 0.279906, 1.399570, 0.836188, 0.493923, 0.522454, 0.469456, 0.735796, 2.020687, 0.252232, 0.833768, 0.518544, 0.774274, 0.789126, 0.498236, 0.897926, 2.464562, 0.389269, 1.194979, 1.234409, 1.321078, 0.791071, 0.795867, 1.318197, 2.706425, 0.507198, 0.504429, 0.815691, 0.803887, 0.740741, 0.839956, 0.770308, 1.796426, 0.519292, 0.839065, 0.537268, 0.773374, 0.226121, 0.851224, 5.500347, 0.904706, 0.783927, 0.819993, 0.321937, 0.413671, 0.596815, 0.834562, 0.816163, 0.422886, 0.388575, 0.583894, 1.775510, 0.375347, 2.418207, 0.814775, 0.777163, 0.735612, 1.319111, 1.804748, 0.268827, 0.318678, 0.522813, 0.796316, 0.827447, 0.501015, 0.528535, 0.531657, 2.172018, 0.504386, 0.815548, 0.781182, 1.296139, 1.294649, 0.897503, 0.747071, 0.146438, 0.732493, 1.289908, 1.158183, 1.399782, 0.526536, 0.552185, 1.126786, 1.916463, 0.295976, 0.866622, 0.805484, 0.765117, 0.635101, 0.814444, 0.696718, 0.976175, 0.247730, 1.320307, 0.743724, 1.304949, 1.199659, 1.332026, 1.378250, 0.942338, 0.397140, 1.803324, 1.367487, 0.518773, 1.721340, 0.805341, 1.290079, 1.778761, 0.761857, 0.841914, 0.788347, 0.529278, 0.837410, 33.775179, 0.771148, 0.306301, 0.603389, 0.300684, 5.508428, 0.906572, 1.016348, 1.454089, 0.477936, 0.789840, 0.795315, 0.769039, 0.788877, 0.769559, 0.483355, 0.374124, 1.963250, 0.767284, 0.811091, 0.823427, 1.294715, 1.365261, 0.530767, 0.402208, 0.383994, 0.824374, 0.785066, 1.304818, 1.297797, 1.311623, 0.859775, 0.852941, 0.517305, 0.758547, 0.560391, 0.806593, 0.534534, 7.979491, 0.762147, 1.417388, 0.501853, 0.889205, 0.763361, 0.483871, 0.852419, 1.276178, 2.155572, 1.335773, 0.354153, 0.494483, 1.259676, 1.333800, 0.736003, 0.673017, 0.950407, 0.909785, 1.112728, 1.229620, 0.752912, 0.819243, 0.781787, 0.811786, 0.882140, 1.106289, 0.526694, 0.791166, 0.778384, 0.525173, 0.516003, 1.833733, 0.740201, 0.730402, 0.477044, 0.836394, 0.896098, 0.835434, 1.625647, 0.861692, 0.742840, 0.654997, 0.495247, 1.287671, 0.600033, 0.414586, 0.507765, 0.429987, 0.821442, 1.379024, 0.931638, 0.800729, 2.058660, 0.488038, 0.375602, 0.764558, 0.795139, 0.770538, 0.792857, 1.393003, 1.188743, 0.486696, 0.744770, 0.797606, 0.524348, 0.482256, 3.018182, 0.796338, 0.469558, 0.540297, 0.499665, 0.737229, 0.737241, 1.355429, 0.318260, 0.365939, 1.768698, 1.818483, 1.292042, 1.332144, 0.762898, 8.228087, 0.491146, 0.513520, 1.664914, 1.754545, 0.880546, 0.490372, 0.849252, 1.273292, 0.400315, 2.557081, 0.854524, 0.507869, 0.777202, 0.791429, 0.539995, 6.907885, 0.898601, 0.761502, 0.900465, 1.187863, 0.511364, 0.518693, 0.734068, 0.826479, 0.836289, 0.498292, 0.869495, 0.759622, 0.795955, 0.381247, 0.637003, 0.492737, 2.408129, 1.339266, 0.618598, 0.314402, 0.866346, 0.864480, 0.752541, 0.683203, 0.266610, 0.239280, 0.474558, 0.797726, 1.691852, 0.836415, 0.755897, 0.964794, 1.125456, 1.109201, 0.778813, 0.871133, 0.466898, 0.782188, 0.769039, 0.634820, 0.493633, 0.907699, 0.801673, 0.794319, 0.498154, 0.492494, 0.820410, 0.765994, 1.290768, 0.396317, 0.743816, 0.511508, 0.805928, 1.358354, 0.488587, 0.269155, 0.480135, 0.833215, 0.892004, 0.779555, 0.797230, 1.193504, 1.210783, 1.106047, 0.735558, 0.737921, 0.733547, 0.826245, 0.835397, 0.372325, 1.333104, 2.238046, 1.837514, 0.767450, 0.776238, 0.722416, 0.531822, 0.285225, 0.803850, 0.761011, 0.804586, 0.488566, 0.551235, 0.512031, 0.359540, 0.770285, 1.125301, 0.852627, 0.513785, 4.883737, 1.202992, 0.810918, 0.382387, 0.777500, 0.467123, 0.710544, 1.255567, 0.782713, 1.171216, 1.904414, 2.981812, 0.826029, 1.286966, 1.279460, 0.511589, 0.874727, 0.539508, 0.743708, 0.774497, 0.479940, 0.487985, 0.793743, 0.731553, 0.463447, 0.108495, 0.490025, 0.286785, 0.484442, 0.515123, 1.255639, 1.721700, 1.745702, 0.774878, 1.141168, 0.558232, 0.496870, 0.829181, 2.410181, 2.259936, 3.051408, 1.298502, 0.530556, 0.843736, 0.639222, 0.712548, 0.780264, 0.816870, 0.796880, 0.733569, 0.532548, 0.500115, 0.493203, 0.724185, 1.236130, 0.470356, 0.723577, 0.764920, 0.501949, 0.752101, 1.286265, 1.803804, 0.767636, 0.504836, 0.984317, 0.518328, 0.494770, 0.767147, 0.879382, 1.836957, 0.826310, 1.119440, 0.820580, 9.575569, 1.822038, 1.356041, 1.187500, 1.261527, 1.311160, 1.865672, 0.231538, 0.264209, 0.275597, 0.305465, 0.521729, 1.823381, 1.831753, 1.248872, 1.148108, 0.547559, 0.673571, 0.521182, 0.766009, 0.752131, 0.792674, 0.428013, 0.481080, 0.835470, 1.313775, 2.666905, 0.515886, 0.843260, 0.701460, 0.736917, 0.498185, 0.473497, 0.474580, 0.817995, 0.793544, 0.826156, 0.828692, 0.265970, 0.503436, 0.505445, 0.747682, 0.756528, 1.651462, 1.296920, 1.997518, 0.890524, 1.148350, 0.791244, 0.362324, 0.501374, 1.286448, 0.753108, 0.816917, 1.323435, 0.936899, 0.504872, 0.507213, 0.809201, 0.788632, 0.457146, 0.306020, 0.776423, 0.780754, 0.494628, 1.220829, 1.887713, 3.155875, 2.181723, 0.914454, 0.780341, 0.793116, 0.774552, 0.813351, 0.763258, 0.821647, 0.528914, 0.742513, 0.887669, 0.880788, 0.527533, 0.382328, 0.687856, 0.845350, 1.466069, 0.780329, 0.746933, 22.951154, 0.816667, 0.755151, 1.393961, 0.775510, 0.794442, 0.490135, 0.523754, 0.817104, 0.822907, 0.804227, 0.780204, 0.759833, 0.385984, 0.488255, 0.509917, 1.322028, 0.795120, 0.827143, 1.411276, 1.710257, 0.863810, 0.798210, 0.504829, 1.636489, 0.805150, 0.539796, 0.544971, 0.504279, 1.188510, 1.325349, 0.523430, 0.492767, 0.387623, 0.763103, 1.125338, 0.751338, 0.800000, 0.803495, 0.509711, 1.836413, 0.861317, 1.380262, 9.247191, 0.482495, 0.318404, 1.527718, 2.253097, 0.526022, 0.546785, 0.249889, 0.089803, 0.783155, 1.083830, 0.527553, 0.788896, 1.830830, 1.264537, 0.474983, 0.527771, 0.469731, 0.808693, 0.801897, 0.273244, 0.373395, 0.874640, 1.993054, 0.513569, 0.757072, 2.470790, 1.360683, 0.917436, 0.390872, 0.391582, 0.520445, 0.812342, 1.483907, 0.826868, 1.308629, 0.527721, 0.521861, 1.382374, 0.795535, 0.786473, 0.513657, 0.257215, 0.517969, 0.832804, 1.102818, 5.367578, 0.743873, 0.764579, 0.795948, 1.258869, 1.264706, 0.556563, 0.497813, 0.530429, 0.552018, 0.793357, 0.765068, 0.836795, 4.184392, 1.194894, 0.759463, 0.855766, 0.789661, 1.794689, 0.511479, 0.495296, 0.774493, 0.486377, 0.476698, 0.490143, 1.745497, 1.768433, 0.720973, 0.260761, 0.408750, 0.780076, 0.796172, 0.785845, 0.709097, 2.693310, 0.960542, 1.404885, 0.526304, 0.532522, 1.266919, 10.713121, 0.818050, 0.407691, 0.818161, 0.789629, 0.521003, 1.336280, 0.489709, 1.273010, 0.815863, 1.804178, 1.754447, 1.275491, 1.211317, 0.454580, 0.388065, 0.105528, 1.275703, 1.184220, 0.379049, 6.858206, 0.851680, 1.306300, 0.780936, 0.889731, 0.518756, 0.284878, 0.529096, 0.803267, 1.374753, 0.806199, 1.262580, 0.361098, 2.783352, 0.791724, 0.749674, 0.824152, 1.278011, 1.386484, 2.034892, 0.867586, 1.418707, 0.812726, 0.757639, 0.849195, 0.789913, 0.539623, 0.466156, 1.261565, 8.759666, 0.400036, 0.490343, 0.501233, 0.731748, 0.976704, 0.834185, 0.844351, 0.886020, 0.815971, 6.728814, 0.499083, 0.512086, 0.494562, 1.696136, 0.403512, 1.198635, 0.373583, 0.504555, 0.833887, 1.363760, 0.884015, 5.189309, 0.499426, 0.885714, 0.793367, 0.872515, 2.251910, 0.353681, 0.739778, 0.783520, 3.239745, 0.301685, 0.142813, 0.775675, 1.079643, 0.807854, 1.340558, 1.864643, 0.494331, 0.490330, 0.857143, 0.798890, 1.412010, 1.224643, 0.894324, 0.901177, 0.423600, 0.396187, 1.214583, 0.720916, 2.568684, 0.343791, 1.054341, 0.472644, 0.729131, 0.793091, 0.951531, 0.840286, 1.696121, 0.799057, 1.267485, 0.795455, 0.740596, 0.379848, 0.424369, 0.328039, 0.788118, 0.770885, 0.753928, 0.484763, 0.777544, 0.801582, 0.753499, 0.059229, 0.853560, 0.868402, 1.256868, 6.101300, 0.769686, 1.272064, 1.206710, 1.730938, 0.560477, 1.781789, 0.659198, 0.809777, 0.428055, 0.603708, 1.800988, 2.438603, 1.364647, 0.323871, 0.802886, 0.058228, 0.316058, 0.533981, 0.783244, 0.175575, 0.520736, 0.857511, 0.719595, 2.002751, 0.469552, 0.745839, 1.326502, 0.785004, 0.810831, 1.600932, 0.970228, 0.918814, 0.531818, 0.475865, 0.774023, 0.730441, 0.898871, 0.495515, 0.271271, 0.774712, 1.338977, 0.787676, 1.407099, 1.371663, 0.435665, 1.447495, 0.370090, 0.805218, 0.613774, 1.260551, 1.272317, 2.128501, 0.523612, 1.388535, 0.301435, 0.467136, 0.532477, 0.770357, 0.754255, 3.013615, 1.816754, 1.222769, 0.515899, 0.862836, 1.564269, 0.069992, 0.496824, 0.500918, 0.490755, 1.429893, 1.408046, 0.530604, 0.386288, 0.505135, 0.801688, 0.759929, 0.366295, 2.276512, 0.411208, 0.782315, 0.789079, 1.378929, 0.782023, 1.532182, 0.749311, 0.925892, 0.822610, 1.131030, 1.316068, 0.543591, 0.289820, 0.398658, 0.426394, 0.743197, 1.676851, 1.288944, 0.867309, 1.266574, 0.294618, 0.969072, 0.370458, 0.768964, 0.456868, 0.715344, 1.245712, 2.432306, 1.320680, 1.807024, 1.411422, 1.086358, 0.520101, 6.790476, 0.806854, 1.261179, 0.203782, 1.166180, 0.501798, 0.884238, 0.800770, 1.364281, 0.536401, 0.516833, 0.506210, 0.775559, 2.711789, 0.615877, 0.501214, 0.388012, 0.489835, 0.886642, 0.427100, 0.950513, 0.599688, 1.167774, 1.258313, 0.831188, 1.517655, 2.216988, 0.863770, 0.769012, 0.867255, 1.269191, 1.313350, 0.516885, 0.501606, 0.505234, 0.588217, 0.773082, 0.559709, 0.752876, 0.476829, 0.697822, 1.290132, 1.709189, 0.810801, 0.836772, 0.798849, 7.736335, 0.535639, 0.417223, 0.479725, 0.789455, 0.857567, 1.205972, 0.830645, 1.348624, 1.349246, 0.835760, 0.772401, 7.375364, 0.304600, 0.838834, 1.684085, 0.499200, 0.800628, 0.867756, 1.238475, 0.748048, 0.457876, 0.783315, 1.195114, 0.515705, 0.861019, 1.171058, 16.299819, 0.514510, 1.397211, 1.234765, 1.705651, 1.996815, 1.363103, 1.310915, 0.813455, 0.830313, 0.850736, 0.850896, 0.876938, 0.234959, 0.453156, 0.650027, 9.020401, 1.253635, 1.281987, 14.830169, 1.657055, 0.517671, 0.898085, 0.847756, 1.303279, 1.342012, 0.805241, 0.758479, 1.347796, 0.535069, 0.555502, 0.783137, 0.939920, 1.232937, 2.121390, 0.831835, 0.799200, 0.754939, 1.296796, 0.851508, 0.268310, 0.503325, 1.821918, 0.810357, 0.794817, 0.504291, 0.514581, 1.218687, 0.091355, 0.738277, 0.814156, 0.842852, 0.786379, 1.307583, 0.496183, 0.776720, 0.798778, 0.523329, 1.282616, 0.770520, 0.927314, 0.385799, 0.814429, 0.691135, 0.528164, 0.842814, 2.596768, 1.367303, 1.437751, 0.508455, 0.500446, 0.792051, 16.697849, 1.265043, 0.491217, 0.722027, 1.535091, 0.738851, 0.321016, 0.838904, 0.651664, 1.230953, 0.774161, 0.140688, 1.182768, 1.211823, 0.856545, 0.860311, 0.386326, 0.794314, 0.824427, 0.791637, 0.823555, 0.379823, 1.856777, 1.862649, 0.779235, 1.283968, 0.780827, 0.514115, 1.481340, 0.832495, 0.769314, 0.813658, 0.785740, 0.699402, 0.515088, 0.099889, 0.733027, 0.374228, 1.436154, 1.278508, 0.862666, 0.757848, 1.330991, 9.775143, 0.473339, 0.512597, 1.277817, 1.835777, 0.808601, 1.301037, 0.537549, 0.496093, 0.508219, 0.356825, 0.809934, 0.489942, 0.757534, 0.788274, 0.977806, 0.384697, 0.498995, 0.717498, 1.297137, 0.481768, 0.343614, 1.133394, 2.284047, 0.854136, 1.321000, 0.772504, 0.737926, 1.079443, 0.818494, 1.309869, 0.782436, 0.762341, 0.746561, 0.550718, 1.335059, 1.209262, 2.590766, 0.606567, 1.268802, 0.777978, 0.865438, 0.613921, 0.292773, 0.590573, 0.596769, 4.958204, 0.495974, 0.543027, 0.835137, 0.431234, 0.478767, 0.480233, 0.811528, 0.803100, 1.349737, 1.313517, 0.793412, 0.763471, 0.383295, 0.730115, 2.626358, 0.488928, 0.815884, 0.550888, 1.244137, 1.658219, 0.817244, 0.879982, 0.834564, 0.492135, 0.754821, 0.765988, 0.813214, 1.403717, 0.779859, 0.140845, 0.917054, 0.545341, 6.105263, 0.316068, 0.773539, 0.150190, 0.846239, 0.763559, 2.570582, 0.761134, 1.458768, 0.372434, 0.711631, 0.745605, 0.384331, 0.748756, 1.316979, 0.766559, 0.770503]
# -----------------------------------
plt.figure("N")
plt.hist(n, bins=range(0,30,1))
plt.xlabel('n = t(c->s)/t(s->c)')
plt.ylabel('# of samples')
plt.savefig('N Histogram.png')
plt.close()
print("mode: "+str(mode(n).mode[0]), "mean: "+str(np.mean(n)), "std: "+str(np.std(n)))
| 13,381.666667 | 320,696 | 0.700109 |
79538992332f18ef9a73f228c4a3552c62cd6e0a | 371 | py | Python | experiments/heat-3d/tmp_files/1766.py | LoopTilingBenchmark/benchmark | 52a3d2e70216552a498fd91de02a2fa9cb62122c | [
"BSD-2-Clause"
] | null | null | null | experiments/heat-3d/tmp_files/1766.py | LoopTilingBenchmark/benchmark | 52a3d2e70216552a498fd91de02a2fa9cb62122c | [
"BSD-2-Clause"
] | null | null | null | experiments/heat-3d/tmp_files/1766.py | LoopTilingBenchmark/benchmark | 52a3d2e70216552a498fd91de02a2fa9cb62122c | [
"BSD-2-Clause"
] | null | null | null | from chill import *
source('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/polybench/polybench-code/stencils/heat-3d/kernel.c')
destination('/uufs/chpc.utah.edu/common/home/u1142914/lib/ytopt_vinu/experiments/heat-3d/tmp_files/1766.c')
procedure('kernel_heat_3d')
loop(0)
tile(0,2,8,2)
tile(0,4,8,4)
tile(0,6,16,6)
tile(1,2,8,2)
tile(1,4,8,4)
tile(1,6,16,6)
| 23.1875 | 116 | 0.743935 |
79538b20d56d6e53874725977744fac27a6e3fdf | 1,085 | py | Python | geodashserver/data.py | geodashio/geodash-server | 196a2a437e75dc6b2687cd778e87e37d11f7a1a2 | [
"BSD-3-Clause"
] | 1 | 2017-04-03T02:22:18.000Z | 2017-04-03T02:22:18.000Z | geodashserver/data.py | geodashio/geodash-server | 196a2a437e75dc6b2687cd778e87e37d11f7a1a2 | [
"BSD-3-Clause"
] | 1 | 2016-08-22T16:05:22.000Z | 2016-08-22T16:05:22.000Z | geodashserver/data.py | geodashio/geodash-server | 196a2a437e75dc6b2687cd778e87e37d11f7a1a2 | [
"BSD-3-Clause"
] | null | null | null | import errno
import psycopg2
from socket import error as socket_error
#from jenks import jenks
from django.conf import settings
from django.template.loader import get_template
from geodash.enumerations import MONTHS_SHORT3
from geodash.cache import provision_memcached_client
from geodash.data import data_local_country
class data_local_country_admin(data_local_country):
key = None
def _build_key(self, *args, **kwargs):
return "data/local/country/{iso_alpha3}/admin/{level}/geojson".format(**kwargs)
def _build_data(self, *args, **kwargs):
cursor = kwargs.get('cursor', None)
iso_alpha3 = kwargs.get('iso_alpha3', None)
level = kwargs.get('level', None)
results = None
if level == 2:
q = get_template("geodashserver/sql/_admin2_polygons.sql").render({
'tolerance': '.01',
'iso_alpha3': iso_alpha3})
cursor.execute(q)
res = cursor.fetchone()
results = json.loads(res[0]) if (type(res[0]) is not dict) else res[0]
return results
| 31 | 87 | 0.668203 |
79538c22d0f50b2f4d4d52c05c9b60fa2527d213 | 14,167 | py | Python | speedydeploy/webserver.py | suvit/speedydeploy | 124d7723f9e5935935f97bd3b1e433cfd251084d | [
"MIT"
] | null | null | null | speedydeploy/webserver.py | suvit/speedydeploy | 124d7723f9e5935935f97bd3b1e433cfd251084d | [
"MIT"
] | null | null | null | speedydeploy/webserver.py | suvit/speedydeploy | 124d7723f9e5935935f97bd3b1e433cfd251084d | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import with_statement
import os
import time
from fabric import api as fab
from fab_deploy.utils import run_as
from base import _, Daemon, Ubuntu
from deployment import command
from utils import upload_template, upload_first
class FrontEnd(Daemon):
config_dir = None
namespace = 'server'
backend = None
def __init__(self, name, domain):
super(FrontEnd, self).__init__(name)
self.env = fab.env
self.env['domain'] = domain
self.env['server_dir'] = self.config_dir
def enable_site(self, name):
server_dir = self.config_dir
fab.sudo("ln -s %(server_dir)ssites-available/%(name)s"
" %(server_dir)ssites-enabled/%(name)s" % locals() )
@command
def enable(self):
fab.sudo(_("ln -s %(server_dir)ssites-available/%(domain)s.conf"
" %(server_dir)ssites-enabled/%(domain)s.conf"))
def disable_site(self, name):
server_dir = self.config_dir
fab.sudo("rm -f %(server_dir)ssites-enabled/%(name)s" % locals() )
@command
def disable(self):
fab.sudo(_("rm -f %(server_dir)ssites-enabled/%(domain)s.conf"))
def remove_site(self, name):
self.disable_site(name)
server_dir = self.config_dir
fab.sudo("rm -f %(server_dir)ssites-available/%(name)s" % locals() )
@command
def remove(self):
self.disable()
fab.sudo(_("rm -f %(server_dir)ssites-available/%(domain)s.conf"))
def install_development_libraries(self):
if self.backend:
self.backend.install_development_libraries()
def install_requirements(self):
if self.backend:
self.backend.install_requirements()
def dirs(self):
dirs = []
if self.backend:
dirs.extend(self.backend.dirs())
return dirs
@command
def start(self, pty=True):
super(FrontEnd, self).start(pty=pty)
@command
def stop(self, pty=True):
super(FrontEnd, self).stop(pty=pty)
@command
def restart(self, pty=True):
super(FrontEnd, self).restart(pty=pty)
@command
def reload(self, pty=True):
super(FrontEnd, self).reload(pty=pty)
@command
def configure(self):
if self.backend:
self.backend.configure()
WebServer = FrontEnd
Server = WebServer # TODO remove this
class Backend(object): #TODO inherit Server
name = NotImplemented
namespace = 'backend'
def __init__(self, domain=None):
if domain is not None:
fab.env['domain'] = domain
if 'project' in fab.env and fab.env.project.use_django:
project_path = _('%(django_python_path)s')
else:
project_path = _('%(remote_dir)s/%(project_name)s')
fab.env['project_path'] = project_path
def start(self):
pass
def stop(self):
pass
class FcgiBackend(Backend):
name = 'fcgi'
def install_requirements(self):
with fab.cd(_('%(remote_dir)s/')):
fab.run(_('%(virtualenv)s/bin/pip install "flup==1.0.2"'))
def stop(self):
with fab.settings(warn_only=True):
fab.run(_("kill -TERM `cat %(remote_dir)s/run/fcgi.pid`"))
def start(self):
with fab.cd(_('%(remote_dir)s/%(project_name)s')):
# TODO use' socket=%(remote_dir)s/run/fcgi.sock'
fab.run(_('../%(virtualenv)s/bin/python manage.py runfcgi'
' host=127.0.0.1 port=8080',
' daemonize=true'
' minspare=1'
' maxspare=%(worker_count)s'
' maxchildren=%(worker_count)s'
' maxrequests=10000'
' method=prefork'
' pidfile=%(remote_dir)s/run/fcgi.pid'
' logfile=%(remote_dir)s/log/fcgi.log'))
def reload(self):
fab.run(_('touch %(remote_dir)s/http/wrapper.fcgi'))
class FcgiWrapper(FcgiBackend):
fcgi_path = '%(remote_dir)s/http/'
use_project_media = False
def dirs(self):
return ['http']
def configure(self):
upload_first([_('nginx/%(domain)s-sh.fcgi'),
'fcgi/wrapper-sh.fcgi'],
_(self.fcgi_path) + 'wrapper.fcgi',
fab.env,
mode=0755,
use_jinja=True)
upload_first([_('nginx/%(domain)s.fcgi'),
'fcgi/wrapper.fcgi'],
_('%(remote_dir)s/http/wrapper.fcgi'),
fab.env,
mode=0755,
use_jinja=True)
upload_first([_('nginx/%(domain)s.htaccess'),
'fcgi/.htaccess'],
_('%(remote_dir)s/http/.htaccess'),
fab.env,
use_jinja=True)
if self.use_project_media:
with fab.cd(_('%(remote_dir)s/http')):
with fab.settings(warn_only=True):
fab.run('ln -s ../media/static')
fab.run('ln -s ../media/media')
def stop(self):
with fab.settings(warn_only=True):
fab.run(_("kill -HUP `cat %(remote_dir)s/run/fcgi.pid`"))
def reload(self):
self.stop()
class Gunicorn(Backend):
name = 'gunicorn'
namespace = 'backend'
supervisor = False
def dirs(self):
return ['etc/gunicorn']
def install_requirements(self):
with fab.cd(_('%(remote_dir)s/')):
fab.run(_('%(virtualenv)s/bin/pip install -U gunicorn'))
fab.run(_('%(virtualenv)s/bin/pip install -U setproctitle'))
def stop(self):
with fab.settings(warn_only=True):
fab.run(_("kill -TERM `cat %(remote_dir)s/run/gunicorn.pid`"))
def start_command(self):
if fab.env.project.use_django:
if fab.env.project.django.HAS_WSGI:
fab.env['gunicorn_starter'] = _('gunicorn '
'%(django_project_name)s.wsgi:application')
else:
fab.env['gunicorn_starter'] = 'gunicorn_django'
else:
fab.env['gunicorn_starter'] = _('gunicorn '
'%(project_name)s:application')
def start(self):
if self.supervisor:
return
self.start_command()
with fab.cd(_('%(project_path)s')):
fab.run(_('%(remote_dir)s/%(virtualenv)s/bin/%(gunicorn_starter)s'
' -c %(remote_dir)s/etc/gunicorn/conf.py'))
@command
def reload(self):
with fab.settings(warn_only=True):
fab.run(_("kill -HUP `cat %(remote_dir)s/run/gunicorn.pid`"))
#self.stop()
#self.start()
@command
def configure(self):
self.start_command()
upload_first([_('gunicorn/%(domain)s.conf'),
_('nginx/%(domain)s.gunicorn.conf'),
'gunicorn/default.conf'],
_('%(remote_dir)s/etc/gunicorn/conf.py'),
fab.env,
use_jinja=True)
def supervisor_configure(self):
upload_first([_('gunicorn/%(domain)s.supervisor.conf'),
'gunicorn/supervisor.conf',
],
_('%(remote_dir)s/etc/supervisor/gunicorn.conf'),
fab.env,
use_jinja=True)
def supervisor_start(self):
pass
class WsgiBackend(Backend):
name = 'wsgi'
def configure(self):
fab.put(self.local_dir + _("/%(instance_name)s"), "/tmp/")
fab.sudo(_("cp /tmp/%(instance_name)s /etc/apache2/sites-available/%(instance_name)s"))
self.enable_site(_("%(instance_name)s"))
fab.put(self.local_dir + "/django.wsgi", "/tmp/")
fab.run("chmod 755 /tmp/django.wsgi")
fab.run(_("mkdir -p %(remote_dir)s/%(project_name)s/etc/apache"))
fab.run(_("cp /tmp/django.wsgi %(remote_dir)s/%(project_name)s/etc/apache/django.wsgi"))
fab.sudo(_("chown %(user)s:www-data -R %(remote_dir)s/%(project_name)s"))
fab.sudo(_("chmod u=rwx,g=rx,o= -R %(remote_dir)s/%(project_name)s"))
class UwsgiBackend(Backend):
name = 'uwsgi'
namespace = 'backend'
supervisor = False
def __init__(self, domain=None):
super(UwsgiBackend, self).__init__(domain=domain)
fab.env.setdefault('uwsgi_conf', 'uwsgi/default.ini')
def dirs(self):
return ['etc/uwsgi']
def install_requirements(self):
with fab.cd(_('%(remote_dir)s/')):
fab.run(_('%(virtualenv)s/bin/pip install -U uwsgi'))
fab.run(_('%(virtualenv)s/bin/pip install -U uwsgitop'))
@command
def stop(self):
fab.run(_("kill -INT `cat %(remote_dir)s/run/uwsgi.pid`"))
@command
def start(self):
if self.supervisor:
return
fab.run(_('%(remote_dir)s/%(virtualenv)s/bin/uwsgi'
' --ini %(remote_dir)s/etc/uwsgi/conf.ini'))
def reload(self):
with fab.settings(warn_only=True):
fab.run(_("kill -HUP `cat %(remote_dir)s/run/uwsgi.pid`"))
@command
def configure(self):
if fab.env.project.use_django:
# XXX
if fab.env.project.django.HAS_WSGI:
default_template = 'uwsgi/django.ini'
else:
default_template = 'uwsgi/django_old.ini'
else:
default_template = fab.env.uwsgi_conf
upload_first([_('uwsgi/%(domain)s.conf'),
_('nginx/%(domain)s.uwsgi.conf'),
default_template],
_('%(remote_dir)s/etc/uwsgi/conf.ini'),
fab.env,
use_jinja=True)
def supervisor_configure(self):
upload_first([_('uwsgi/%(domain)s.supervisor.conf'),
'uwsgi/supervisor.conf',
],
_('%(remote_dir)s/etc/supervisor/uwsgi.conf'),
fab.env,
use_jinja=True)
def supervisor_start(self):
pass
class ApacheServer(FrontEnd):
local_dir = 'apache'
def __init__(self, **kwargs):
kwargs.setdefault('name', 'apache')
super(ApacheServer, self).__init__(**kwargs)
class Apache2Server(ApacheServer):
name = 'apache'
config_dir = '/etc/apache2/'
sites_dir = config_dir + 'sites-available/'
log_dir = '/var/log/apache2/'
log_user = 'www-data'
def __init__(self, **kwargs):
kwargs.setdefault('name', 'apache2')
super(ApacheServer, self).__init__(**kwargs)
def configure(self):
upload_template(_('apache/%(domain)s.conf'),
fab.env.os.path.join(self.sites_dir,
_('%(domain)s.conf') ),
fab.env,
use_sudo=True,
use_jinja=True)
def restart(self):
fab.sudo("apache2ctl -k graceful")
def status(self):
fab.sudo("apache2ctl status")
def enable_site(self, name):
fab.sudo("a2ensite %s" % name)
def disable_site(self, name):
fab.sudo("a2dissite %s" % name)
def install_development_libraries(self):
os = fab.env.os
os.install_package('apache2')
class Nginx(FrontEnd):
name = 'nginx'
config_dir = '/etc/nginx/'
sites_dir = config_dir + 'sites-available/'
log_dir = '/var/log/nginx/'
log_user = 'www-data'
def __init__(self, **kwargs):
kwargs.setdefault('name', 'nginx')
super(NginxServer, self).__init__(**kwargs)
def stop(self, pty=True):
super(NginxServer, self).stop(pty=pty)
self.backend_stop()
def start(self, pty=True):
super(NginxServer, self).start(pty=pty)
self.backend_start()
def backend_stop(self):
if self.backend:
self.backend.stop()
def backend_start(self):
if self.backend:
self.backend.start()
def backend_reload(self):
if self.backend:
self.backend.reload()
def reload(self):
self.backend_reload()
def install_development_libraries(self):
os = fab.env.os
if isinstance(os, Ubuntu):
os.install_package('python-software-properties')
fab.sudo('add-apt-repository ppa:nginx/stable')
fab.sudo('apt-get update')
os.install_package('nginx')
def update_static_files(self):
remote_dir = fab.env['remote_dir']
files = fab.env['server_static_files'] = list()
test_dirs = ['nginx/files',
_('nginx/%(domain)s')]
for dir in test_dirs:
if not os.path.exists(dir):
continue
for filename in os.listdir(dir):
if filename.startswith('.'):
continue
# TODO use jinia template engine to render txt files(robots.txt)
fab.put("%s/%s" % (dir, filename),
"%s/media/%s" % (remote_dir, filename))
files.append(filename)
def configure(self, template=None):
if template is None:
template = [_('nginx/%(domain)s.conf'),
'nginx/default.conf']
super(Nginx, self).configure()
self.update_static_files() #added static_files var for fab.env
upload_first(template,
fab.env.os.path.join(self.sites_dir, _('%(domain)s.conf') ),
fab.env,
use_sudo=True,
use_jinja=True)
os = fab.env.os
log_dir = os.path.join(self.log_dir, _('%(user)s'))
os.mkdir(log_dir, sudo=True)
os.change_owner(log_dir, self.log_user, 'adm', sudo=True)
self.disable_site('%(domain)s.conf' % self.env)
self.enable_site('%(domain)s.conf' % self.env)
if hasattr(fab.env, 'logrotate'):
fab.env.logrotate.add_script('nginx/logrotate', 'nginx')
NginxServer = Nginx
| 29.270661 | 96 | 0.549446 |
79538c3db177192d101c5635ba954704a0a10aa8 | 28,948 | py | Python | notebooks/120.4-BDP-silly-models.py | zeou1/maggot_models | 4e1b518c2981ab1ca9607099c3813e8429d94ca4 | [
"BSD-3-Clause"
] | null | null | null | notebooks/120.4-BDP-silly-models.py | zeou1/maggot_models | 4e1b518c2981ab1ca9607099c3813e8429d94ca4 | [
"BSD-3-Clause"
] | null | null | null | notebooks/120.4-BDP-silly-models.py | zeou1/maggot_models | 4e1b518c2981ab1ca9607099c3813e8429d94ca4 | [
"BSD-3-Clause"
] | null | null | null | # %% [markdown]
# # THE MIND OF A MAGGOT
# %% [markdown]
# ## Imports
import os
import time
import colorcet as cc
import matplotlib as mpl
import matplotlib.pyplot as plt
import matplotlib.transforms as transforms
import numpy as np
import pandas as pd
import seaborn as sns
from scipy.linalg import orthogonal_procrustes
from scipy.optimize import linear_sum_assignment
from sklearn.metrics import adjusted_rand_score
from tqdm import tqdm
from graspy.cluster import GaussianCluster
from graspy.embed import AdjacencySpectralEmbed
from graspy.models import DCSBMEstimator, RDPGEstimator, SBMEstimator
from graspy.plot import heatmap, pairplot
from graspy.simulations import rdpg
from graspy.utils import binarize, pass_to_ranks
from src.data import load_metagraph
from src.graph import preprocess
from src.hierarchy import signal_flow
from src.io import savefig
from src.visualization import (
CLASS_COLOR_DICT,
barplot_text,
gridmap,
matrixplot,
stacked_barplot,
adjplot,
)
from sklearn.utils.testing import ignore_warnings
from sklearn.exceptions import ConvergenceWarning
import warnings
warnings.filterwarnings(action="ignore", category=ConvergenceWarning)
CLUSTER_SPLIT = "best"
FNAME = os.path.basename(__file__)[:-3]
print(FNAME)
rc_dict = {
"axes.spines.right": False,
"axes.spines.top": False,
"axes.formatter.limits": (-3, 3),
"figure.figsize": (6, 3),
"figure.dpi": 100,
}
for key, val in rc_dict.items():
mpl.rcParams[key] = val
context = sns.plotting_context(context="talk", font_scale=1, rc=rc_dict)
sns.set_context(context)
np.random.seed(8888)
def stashfig(name, **kws):
savefig(name, foldername=FNAME, save_on=True, **kws)
def get_paired_inds(meta):
pair_meta = meta[meta["Pair"].isin(meta.index)]
pair_group_size = pair_meta.groupby("Pair ID").size()
remove_pairs = pair_group_size[pair_group_size == 1].index
pair_meta = pair_meta[~pair_meta["Pair ID"].isin(remove_pairs)]
assert pair_meta.groupby("Pair ID").size().min() == 2
pair_meta.sort_values(["Pair ID", "hemisphere"], inplace=True)
lp_inds = pair_meta[pair_meta["hemisphere"] == "L"]["inds"]
rp_inds = pair_meta[pair_meta["hemisphere"] == "R"]["inds"]
assert (
meta.iloc[lp_inds]["Pair ID"].values == meta.iloc[rp_inds]["Pair ID"].values
).all()
return lp_inds, rp_inds
# TODO broken in some cases, switched to `compute_pairedness_bipartite`
def compute_pairedness(partition, left_pair_inds, right_pair_inds, plot=False):
uni_labels, inv = np.unique(partition, return_inverse=True)
train_int_mat = np.zeros((len(uni_labels), len(uni_labels)))
for i, ul in enumerate(uni_labels):
c1_mask = inv == i
for j, ul in enumerate(uni_labels):
c2_mask = inv == j
# number of times a thing in cluster 1 has a pair also in cluster 2
pairs_in_other = np.logical_and(
c1_mask[left_pair_inds], c2_mask[right_pair_inds]
).sum()
train_int_mat[i, j] = pairs_in_other
row_ind, col_ind = linear_sum_assignment(train_int_mat, maximize=True)
train_pairedness = np.trace(train_int_mat[np.ix_(row_ind, col_ind)]) / np.sum(
train_int_mat
) # TODO double check that this is right
if plot:
fig, axs = plt.subplots(1, 2, figsize=(20, 10))
sns.heatmap(
train_int_mat, square=True, ax=axs[0], cbar=False, cmap="RdBu_r", center=0
)
int_df = pd.DataFrame(data=train_int_mat, index=uni_labels, columns=uni_labels)
int_df = int_df.reindex(index=uni_labels[row_ind])
int_df = int_df.reindex(columns=uni_labels[col_ind])
sns.heatmap(int_df, square=True, ax=axs[1], cbar=False, cmap="RdBu_r", center=0)
return train_pairedness, row_ind, col_ind
def compute_pairedness_bipartite(left_labels, right_labels):
left_uni_labels, left_inv = np.unique(left_labels, return_inverse=True)
right_uni_labels, right_inv = np.unique(right_labels, return_inverse=True)
train_int_mat = np.zeros((len(left_uni_labels), len(right_uni_labels)))
for i, ul in enumerate(left_uni_labels):
c1_mask = left_inv == i
for j, ul in enumerate(right_uni_labels):
c2_mask = right_inv == j
# number of times a thing in cluster 1 has a pair also in cluster 2
pairs_in_other = np.logical_and(c1_mask, c2_mask).sum()
train_int_mat[i, j] = pairs_in_other
row_ind, col_ind = linear_sum_assignment(train_int_mat, maximize=True)
train_pairedness = np.trace(train_int_mat[np.ix_(row_ind, col_ind)]) / np.sum(
train_int_mat
) # TODO double check that this is right
return train_pairedness, row_ind, col_ind
def fit_and_score(X_train, X_test, k, **kws):
gc = GaussianCluster(min_components=k, max_components=k, **kws)
gc.fit(X_train)
model = gc.model_
train_bic = model.bic(X_train)
train_lik = model.score(X_train)
test_bic = model.bic(X_test)
test_lik = model.score(X_test)
bic = model.bic(np.concatenate((X_train, X_test), axis=0))
res = {
"train_bic": -train_bic,
"train_lik": train_lik,
"test_bic": -test_bic,
"test_lik": test_lik,
"bic": -bic,
"lik": train_lik + test_lik,
"k": k,
"model": gc.model_,
}
return res, model
def crossval_cluster(
embed,
left_inds,
right_inds,
min_clusters=2,
max_clusters=15,
n_init=25,
left_pair_inds=None,
right_pair_inds=None,
):
left_embed = embed[left_inds]
right_embed = embed[right_inds]
print("Running left/right clustering with cross-validation\n")
currtime = time.time()
rows = []
for k in tqdm(range(min_clusters, max_clusters)):
# TODO add option for AutoGMM as well, might as well check
for i in range(n_init):
left_row, left_gc = fit_and_score(left_embed, right_embed, k)
left_row["train"] = "left"
right_row, right_gc = fit_and_score(right_embed, left_embed, k)
right_row["train"] = "right"
# pairedness computation, if available
if left_pair_inds is not None and right_pair_inds is not None:
# TODO double check this is right
pred_left = left_gc.predict(embed[left_pair_inds])
pred_right = right_gc.predict(embed[right_pair_inds])
pness, _, _ = compute_pairedness_bipartite(pred_left, pred_right)
left_row["pairedness"] = pness
right_row["pairedness"] = pness
ari = adjusted_rand_score(pred_left, pred_right)
left_row["ARI"] = ari
right_row["ARI"] = ari
rows.append(left_row)
rows.append(right_row)
results = pd.DataFrame(rows)
print(f"{time.time() - currtime} elapsed")
return results
def plot_crossval_cluster(results):
fig, axs = plt.subplots(3, 1, figsize=(10, 10), sharex=True)
ax = axs[0]
sns.lineplot(data=results, x="k", y="test_lik", hue="train", ax=ax, legend=False)
ax.lines[0].set_linestyle("--")
ax.lines[1].set_linestyle("--")
sns.lineplot(data=results, x="k", y="train_lik", hue="train", ax=ax, legend=False)
ax.set_ylabel("Log likelihood")
ax.yaxis.set_major_locator(mpl.ticker.MaxNLocator(nbins=3, min_n_ticks=3))
ax = axs[1]
sns.lineplot(data=results, x="k", y="test_bic", hue="train", ax=ax, legend="full")
ax.lines[0].set_linestyle("--")
ax.lines[1].set_linestyle("--")
sns.lineplot(data=results, x="k", y="train_bic", hue="train", ax=ax, legend="full")
ax.set_ylabel("-BIC")
ax.yaxis.set_major_locator(mpl.ticker.MaxNLocator(nbins=3, min_n_ticks=3))
leg = ax.legend()
leg.set_title("Train side")
leg.texts[0].set_text("Test contra")
leg.set_bbox_to_anchor((1, 1.8))
lines = leg.get_lines()
lines[0].set_linestyle("--")
lines[1].set_linestyle("--")
lines[2].set_linestyle("--")
leg.texts[3].set_text("Test ipsi")
ax = axs[2]
sns.lineplot(
data=results,
x="k",
y="pairedness",
ax=ax,
legend="full",
color="purple",
label="Pairedness",
)
sns.lineplot(
data=results, x="k", y="ARI", ax=ax, legend="full", color="green", label="ARI"
)
ax.set_ylabel("Pair score")
leg = ax.legend().remove()
ax.legend(bbox_to_anchor=(1, 1), loc="upper left")
# leg.loc = 2
# leg.set_bbox_to_anchor((1, 1))
# ax.yaxis.set_major_locator(mpl.ticker.MaxNLocator(nbins=3, min_n_ticks=3))
# trans = transforms.blended_transform_factory(ax.transAxes, ax.transAxes)
# ax.text(0.8, 0.8, "Pairedness", color="purple", transform=trans)
# ax.text(0.8, 0.6, "ARI", color="green", transform=trans)
return fig, axs
def make_ellipses(gmm, ax, i, j, colors, alpha=0.5, equal=False, **kws):
inds = [j, i]
for n, color in enumerate(colors):
if gmm.covariance_type == "full":
covariances = gmm.covariances_[n][np.ix_(inds, inds)]
elif gmm.covariance_type == "tied":
covariances = gmm.covariances_[np.ix_(inds, inds)]
elif gmm.covariance_type == "diag":
covariances = np.diag(gmm.covariances_[n][inds])
elif gmm.covariance_type == "spherical":
covariances = np.eye(gmm.means_.shape[1]) * gmm.covariances_[n]
v, w = np.linalg.eigh(covariances)
u = w[0] / np.linalg.norm(w[0])
angle = np.arctan2(u[1], u[0])
angle = 180 * angle / np.pi # convert to degrees
v = 2.0 * np.sqrt(2.0) * np.sqrt(v)
ell = mpl.patches.Ellipse(
gmm.means_[n, inds], v[0], v[1], 180 + angle, color=color, **kws
)
ell.set_clip_box(ax.bbox)
ell.set_alpha(alpha)
ax.add_artist(ell)
if equal:
ax.set_aspect("equal", "datalim")
def plot_cluster_pairs(
X, left_inds, right_inds, left_model, right_model, labels, colors=None, equal=True
):
k = left_model.n_components
n_dims = X.shape[1]
if colors is None:
colors = sns.color_palette("tab10", n_colors=k, desat=0.7)
fig, axs = plt.subplots(
n_dims, n_dims, sharex=False, sharey=False, figsize=(20, 20)
)
data = pd.DataFrame(data=X)
data["label"] = labels #
pred = composite_predict(
X, left_inds, right_inds, left_model, right_model, relabel=False
)
data["pred"] = pred
for i in range(n_dims):
for j in range(n_dims):
ax = axs[i, j]
ax.axis("off")
if i < j:
sns.scatterplot(
data=data,
x=j,
y=i,
ax=ax,
alpha=0.5,
linewidth=0,
s=5,
legend=False,
hue="label",
palette=CLASS_COLOR_DICT,
)
make_ellipses(left_model, ax, i, j, colors, fill=False, equal=equal)
if i > j:
sns.scatterplot(
data=data,
x=j,
y=i,
ax=ax,
alpha=0.7,
linewidth=0,
s=5,
legend=False,
hue="pred",
palette=colors,
)
make_ellipses(left_model, ax, i, j, colors, fill=True, equal=equal)
plt.tight_layout()
return fig, axs
def composite_predict(X, left_inds, right_inds, left_model, right_model, relabel=False):
# TODO add option to boost the right numbers
X_left = X[left_inds]
X_right = X[right_inds]
pred_left = left_model.predict(X_left)
pred_right = right_model.predict(X_right)
if relabel:
leftify = np.vectorize(lambda x: str(x) + "L")
rightify = np.vectorize(lambda x: str(x) + "R")
pred_left = leftify(pred_left)
pred_right = rightify(pred_right)
dtype = pred_left.dtype
pred = np.empty(len(X), dtype=dtype)
pred[left_inds] = pred_left
pred[right_inds] = pred_right
return pred
def reindex_model(gmm, perm_inds):
gmm.weights_ = gmm.weights_[perm_inds]
gmm.means_ = gmm.means_[perm_inds]
if gmm.covariance_type != "tied":
gmm.covariances_ = gmm.covariances_[perm_inds]
gmm.precisions_ = gmm.precisions_[perm_inds]
gmm.precisions_cholesky_ = gmm.precisions_cholesky_[perm_inds]
return gmm
def plot_metrics(results, plot_all=True):
plot_results = results.copy()
plot_results["k"] += np.random.normal(size=len(plot_results), scale=0.1)
fig, axs = plt.subplots(3, 3, figsize=(20, 10), sharex=True)
def miniplotter(var, ax):
if plot_all:
sns.scatterplot(
data=plot_results,
x="k",
y=var,
hue="train",
ax=ax,
s=8,
linewidth=0,
alpha=0.5,
)
best_inds = results.groupby(["k"])[var].idxmax()
best_results = results.loc[best_inds].copy()
sns.lineplot(
data=best_results, x="k", y=var, ax=ax, color="purple", label="max"
)
mean_results = results.groupby(["k"]).mean()
mean_results.reset_index(inplace=True)
sns.lineplot(
data=mean_results, x="k", y=var, ax=ax, color="green", label="mean"
)
ax.get_legend().remove()
plot_vars = [
"train_lik",
"test_lik",
"lik",
"train_bic",
"test_bic",
"bic",
"ARI",
"pairedness",
]
axs = axs.T.ravel()
for pv, ax in zip(plot_vars, axs):
miniplotter(pv, ax)
axs[2].xaxis.set_major_locator(mpl.ticker.MultipleLocator(2))
axs[-2].tick_params(labelbottom=True)
axs[-2].set_xlabel("k")
handles, labels = axs[-2].get_legend_handles_labels()
axs[-1].legend(handles, labels, loc="upper left")
axs[-1].axis("off")
return fig, axs
# %% [markdown]
# ## Load data
# In this case we are working with `G`, the directed graph formed by summing the edge
# weights of the 4 different graph types. Preprocessing here includes removing
# partially differentiated cells, and cutting out the lowest 5th percentile of nodes in
# terms of their number of incident synapses. 5th percentile ~= 12 synapses. After this,
# the largest connected component is used.
mg = load_metagraph("G", version="2020-04-01")
mg = preprocess(
mg,
threshold=0,
sym_threshold=False,
remove_pdiff=True,
binarize=False,
weight="weight",
)
meta = mg.meta
# plot where we are cutting out nodes based on degree
degrees = mg.calculate_degrees()
fig, ax = plt.subplots(1, 1, figsize=(5, 2.5))
sns.distplot(np.log10(degrees["Total edgesum"]), ax=ax)
q = np.quantile(degrees["Total edgesum"], 0.05)
ax.axvline(np.log10(q), linestyle="--", color="r")
ax.set_xlabel("log10(total synapses)")
# remove low degree neurons
idx = meta[degrees["Total edgesum"] > q].index
mg = mg.reindex(idx, use_ids=True)
# remove center neurons # FIXME
idx = mg.meta[mg.meta["hemisphere"].isin(["L", "R"])].index
mg = mg.reindex(idx, use_ids=True)
mg = mg.make_lcc()
mg.calculate_degrees(inplace=True)
meta = mg.meta
adj = mg.adj
adj = pass_to_ranks(adj)
meta["inds"] = range(len(meta))
left_inds = meta[meta["left"]]["inds"]
right_inds = meta[meta["right"]]["inds"]
lp_inds, rp_inds = get_paired_inds(meta)
# %% [markdown]
# ## Embed
# Here the embedding is ASE, with PTR and DiagAug, the number of embedding dimensions
# is for now set to ZG2 (4 + 4). Using the known pairs as "seeds", the left embedding
# is matched to the right using procrustes.
ase = AdjacencySpectralEmbed(n_components=None, n_elbows=2)
embed = ase.fit_transform(adj)
n_components = embed[0].shape[1] # use all of ZG2
X = np.concatenate((embed[0][:, :n_components], embed[1][:, :n_components]), axis=-1)
R, _ = orthogonal_procrustes(X[lp_inds], X[rp_inds])
if CLUSTER_SPLIT == "best":
X[left_inds] = X[left_inds] @ R
# %% [markdown]
# ## Clustering
# Clustering is performed using Gaussian mixture modeling. At each candidate value of k,
# 50 models are trained on the left embedding, 50 models are trained on the right
# embedding (choosing the best covariance structure based on BIC on the train set).
results = crossval_cluster(
X,
left_inds,
right_inds,
left_pair_inds=lp_inds,
right_pair_inds=rp_inds,
max_clusters=15,
n_init=50,
)
# best_inds = results.groupby(["k", "train"])["test_bic"].idxmax()
# best_results = results.loc[best_inds].copy()
# plot_crossval_cluster(best_results)
# stashfig(f"cross-val-n_components={n_components}")
# %% [markdown]
# ## Evaluating Clustering
# Of the 100 models we fit as described above, we now evaluate them on a variety of
# metrics:
# - likelihood of the data the model was trained on ("train_lik")
# - likelihood of the held out (other hemisphere) data ("test_lik")
# - likelihood of all of the data ("lik", = "train_lik" + "test_lik")
# - BIC using the data the model was trained on ("train_bic")
# - BIC using the held out (other hemisphere) data ("test_bic")
# - BIC using all of the data ("bic")
# - ARI for pairs. Given the prediction of the model on the left data and the right
# data, using known pairs to define a correspondence between (some) nodes, what is
# the ARI(left_prediction, right_prediciton) for the given model
# - Pairedness, like the above but simply the raw fraction of pairs that end up in
# corresponding L/R clusters. Very related to ARI but not normalized.
plot_metrics(results)
stashfig(f"cluster-metrics-n_components={n_components}")
# %% [markdown]
# ## Choose a model
# A few things are clear from the above. One is that the likelihood on the train set
# continues to go up as `k` increases, but plateaus and then drops on the test set around
# k = 6 - 8. This is even slightly more clear when looking at the BIC plots, where the
# only difference is the added penalty for complexity. Based on this, I would say that
# the best k at this scale is around 6-8; however, we still need to pick a single metric
# to give us the *best* model to proceed. I'm not sure whether it makes more sense to use
# likelihood or bic here, or, to use performance on the test set or performance on all
# of the data. Here we will proceed with k=7, and choose the model with the best BIC on
# all of the data.
k = 6
metric = "bic"
basename = f"-metric={metric}-k={k}-n_components={n_components}"
basetitle = f"Metric={metric}, k={k}, n_components={n_components}"
ind = results[results["k"] == k][metric].idxmax()
print(f"Choosing model at k={k} based on best {metric}.\n")
print(f"ARI: {results.loc[ind, 'ARI']}")
print(f"Pairedness: {results.loc[ind, 'pairedness']}\n")
model = results.loc[ind, "model"]
left_model = model
right_model = model
pred = composite_predict(
X, left_inds, right_inds, left_model, right_model, relabel=False
)
pred_side = composite_predict(
X, left_inds, right_inds, left_model, right_model, relabel=True
)
ax = stacked_barplot(
pred_side, meta["merge_class"].values, color_dict=CLASS_COLOR_DICT, legend_ncol=6
)
ax.set_title(basetitle)
stashfig(f"barplot" + basename)
fig, ax = plot_cluster_pairs(
X, left_inds, right_inds, left_model, right_model, meta["merge_class"].values
)
fig.suptitle(basetitle, y=1)
stashfig(f"pairs" + basename)
sf = signal_flow(adj)
meta["signal_flow"] = -sf
meta["pred"] = pred
meta["pred_side"] = pred_side
meta["group_signal_flow"] = meta["pred"].map(meta.groupby("pred")["signal_flow"].mean())
fig, ax = plt.subplots(1, 1, figsize=(20, 20))
adjplot(
adj,
ax=ax,
meta=meta,
sort_class="pred_side",
class_order="group_signal_flow",
colors="merge_class",
palette=CLASS_COLOR_DICT,
item_order=["merge_class", "signal_flow"],
plot_type="scattermap",
sizes=(0.5, 1),
)
fig.suptitle(basetitle, y=0.94)
stashfig(f"adj-sf" + basename)
meta["te"] = -meta["Total edgesum"]
fig, ax = plt.subplots(1, 1, figsize=(20, 20))
adjplot(
adj,
ax=ax,
meta=meta,
sort_class="pred_side",
class_order="group_signal_flow",
colors="merge_class",
palette=CLASS_COLOR_DICT,
item_order=["merge_class", "te"],
plot_type="scattermap",
sizes=(0.5, 1),
)
fig.suptitle(basetitle, y=0.94)
stashfig(f"adj-te" + basename)
meta["rand"] = np.random.uniform(size=len(meta))
fig, ax = plt.subplots(1, 1, figsize=(20, 20))
adjplot(
adj,
ax=ax,
meta=meta,
sort_class="pred_side",
class_order="group_signal_flow",
colors="merge_class",
palette=CLASS_COLOR_DICT,
item_order="rand",
plot_type="scattermap",
sizes=(0.5, 1),
)
fig.suptitle(basetitle, y=0.94)
stashfig(f"adj-rand" + basename)
# %% [markdown]
# ## SUBCLUSTER
np.random.seed(8888)
uni_labels, inv = np.unique(pred, return_inverse=True)
all_sub_results = []
sub_data = []
reembed = False
for label in uni_labels:
print(label)
print()
label_mask = pred == label
sub_meta = meta[label_mask].copy()
sub_meta["inds"] = range(len(sub_meta))
sub_left_inds = sub_meta[sub_meta["left"]]["inds"].values
sub_right_inds = sub_meta[sub_meta["right"]]["inds"].values
sub_lp_inds, sub_rp_inds = get_paired_inds(sub_meta)
sub_adj = adj[np.ix_(label_mask, label_mask)]
if reembed:
ase = AdjacencySpectralEmbed()
# TODO look into PTR at this level as well
sub_embed = ase.fit_transform(sub_adj)
sub_X = np.concatenate(sub_embed, axis=1)
sub_R, _ = orthogonal_procrustes(sub_X[sub_lp_inds], sub_X[sub_rp_inds])
sub_X[sub_left_inds] = sub_X[sub_left_inds] @ sub_R
else:
sub_X = X[label_mask].copy()
sub_R = R
var_dict = {
"meta": sub_meta,
"left_inds": sub_left_inds,
"right_inds": sub_right_inds,
"left_pair_inds": sub_lp_inds,
"right_pair_inds": sub_rp_inds,
"X": sub_X,
"adj": sub_adj,
}
sub_data.append(var_dict)
sub_results = crossval_cluster(
sub_X,
sub_left_inds,
sub_right_inds,
left_pair_inds=sub_lp_inds,
right_pair_inds=sub_rp_inds,
max_clusters=10,
min_clusters=1,
n_init=50,
)
fig, axs = plot_metrics(sub_results, plot_all=False)
fig.suptitle(f"Subclustering for cluster {label}, reembed={reembed}")
stashfig(f"sub-cluster-profile-label={label}-reembed={reembed}")
plt.close()
all_sub_results.append(sub_results)
# %% [markdown]
# ##
# sub_ks = [(2, 4), (0,), (3, 4), (3,), (2, 3), (0,), (4,)]
# sub_kws = [(4,), (0,), (4,), (3, 4), (2, 3), (3,), (3, 4, 5)]
if not reembed:
sub_ks = [(4,), (4,), (3,), (2, 3, 4), (0,), (3,)]
else:
pass
for i, label in enumerate(uni_labels):
ks = sub_ks[i]
sub_results = all_sub_results[i]
sub_X = sub_data[i]["X"]
sub_left_inds = sub_data[i]["left_inds"]
sub_right_inds = sub_data[i]["right_inds"]
sub_lp_inds = sub_data[i]["left_pair_inds"]
sub_rp_inds = sub_data[i]["right_pair_inds"]
sub_meta = sub_data[i]["meta"]
fig, axs = plot_metrics(sub_results)
fig.suptitle(f"Subclustering for cluster {label}, reembed={reembed}")
for ax in axs[:-1]:
for k in ks:
ax.axvline(k, linestyle="--", color="red", linewidth=2)
stashfig(f"sub-cluster-metrics-label={label}-reembed={reembed}" + basename)
plt.close()
for k in ks:
if k != 0:
sub_basename = f"-label={label}-subk={k}-reembed={reembed}" + basename
sub_basetitle = f"Subcluster for {label}, subk={k}, reembed={reembed},"
sub_basetitle += f" metric={metric}, k={k}, n_components={n_components}"
ind = sub_results[sub_results["k"] == k][metric].idxmax()
sub_model = sub_results.loc[ind, "model"]
sub_left_model = sub_model
sub_right_model = sub_model
sub_pred_side = composite_predict(
sub_X,
sub_left_inds,
sub_right_inds,
sub_left_model,
sub_right_model,
relabel=True,
)
ax = stacked_barplot(
sub_pred_side,
sub_meta["merge_class"].values,
color_dict=CLASS_COLOR_DICT,
legend_ncol=6,
)
ax.set_title(sub_basetitle)
stashfig(f"barplot" + sub_basename)
plt.close()
fig, ax = plot_cluster_pairs(
sub_X,
sub_left_inds,
sub_right_inds,
sub_left_model,
sub_right_model,
sub_meta["merge_class"].values,
)
fig.suptitle(sub_basetitle, y=1)
stashfig(f"pairs" + sub_basename)
plt.close()
sub_adj = sub_data[i]["adj"]
sub_meta["sub_pred_side"] = sub_pred_side
sub_pred_var = f"c{label}_sub_pred_side"
meta[sub_pred_var] = ""
meta.loc[
pred == label, sub_pred_var
] = sub_pred_side # TODO indexing is dangerous here
meta[f"c{label}_sub_pred"] = ""
meta.loc[pred == label, f"c{label}_sub_pred"] = composite_predict(
sub_X,
sub_left_inds,
sub_right_inds,
sub_left_model,
sub_right_model,
relabel=False,
)
meta[f"is_c{label}"] = pred == label
fig, ax = plt.subplots(1, 1, figsize=(20, 20))
adjplot(
adj,
ax=ax,
meta=meta,
sort_class=["pred_side", sub_pred_var],
class_order="group_signal_flow",
colors="merge_class",
palette=CLASS_COLOR_DICT,
item_order=["merge_class", "signal_flow"],
highlight=f"is_c{label}",
highlight_kws=dict(color="red", linestyle="-", linewidth=1),
plot_type="scattermap",
sizes=(0.5, 1),
)
fig.suptitle(sub_basetitle, y=0.94)
stashfig("full-adj" + sub_basename)
plt.close()
# %% [markdown]
# ##
cols = meta.columns
sub_pred_side_cols = []
sub_pred_cols = []
for c in cols:
if "_sub_pred" in c:
if "_side" in c:
sub_pred_side_cols.append(c)
else:
sub_pred_cols.append(c)
meta["total_pred"] = ""
meta["total_pred"] = meta["pred"].astype(str) + "-"
meta["total_pred_side"] = ""
meta["total_pred_side"] = meta["pred_side"].astype(str) + "-"
meta["sub_pred"] = ""
meta["sub_pred_side"] = ""
for c in sub_pred_cols:
meta["total_pred"] += meta[c].astype(str)
meta["sub_pred"] += meta[c].astype(str)
for c in sub_pred_side_cols:
meta["sub_pred_side"] += meta[c].astype(str)
meta["total_pred_side"] += meta[c].astype(str)
# %% [markdown]
# ##
meta["lvl2_signal_flow"] = meta["total_pred"].map(
meta.groupby("total_pred")["signal_flow"].mean()
)
fig, ax = plt.subplots(1, 1, figsize=(20, 20))
adjplot(
adj,
ax=ax,
meta=meta,
sort_class=["hemisphere", "pred", "sub_pred"],
class_order="lvl2_signal_flow",
colors="merge_class",
palette=CLASS_COLOR_DICT,
item_order=["merge_class", "signal_flow"],
plot_type="scattermap",
sizes=(0.5, 1),
)
fig.suptitle(f"2-level hierarchy clustering, reembed={reembed}" + basetitle, y=0.94)
stashfig("lvl2-full-adj" + sub_basename)
fig, ax = plt.subplots(1, 1, figsize=(20, 20))
adjplot(
adj,
ax=ax,
meta=meta,
sort_class=["hemisphere", "pred", "sub_pred"],
class_order="lvl2_signal_flow",
colors="merge_class",
palette=CLASS_COLOR_DICT,
item_order=["rand"],
plot_type="scattermap",
sizes=(0.5, 1),
)
fig.suptitle(f"2-level hierarchy clustering, reembed={reembed}" + basetitle, y=0.94)
stashfig("lvl2-full-adj-rand" + sub_basename)
# %% [markdown]
# ##
fig, ax = plt.subplots(1, 1, figsize=(15, 20))
ax = stacked_barplot(
meta["total_pred_side"].values,
meta["merge_class"].values,
color_dict=CLASS_COLOR_DICT,
legend_ncol=6,
ax=ax,
norm_bar_width=False,
)
stashfig("lvl2-barplot" + sub_basename)
# %% [markdown]
# ##
import pymaid
from src.pymaid import start_instance
start_instance()
for tp in meta["total_pred"].unique()[:10]:
ids = list(meta[meta["total_pred"] == tp].index.values)
ids = [int(i) for i in ids]
fig, ax = plt.subplots(1, 1, figsize=(10, 10))
skeleton_color_dict = dict(
zip(meta.index, np.vectorize(CLASS_COLOR_DICT.get)(meta["merge_class"]))
)
pymaid.plot2d(ids, color=skeleton_color_dict, ax=ax)
ax.axis("equal")
stashfig(f"test-plot2d-{tp}")
# %% [markdown]
# ##
# %%
| 32.200222 | 89 | 0.627781 |
79538d4d2e5744f63d8d01e4385a1792c6f8580a | 192 | py | Python | Desafios/Desafio2.py | Felix-xilef/Curso-de-Python | cdff7c7f3850e6326e274c8c1987b9e1a18ce910 | [
"MIT"
] | null | null | null | Desafios/Desafio2.py | Felix-xilef/Curso-de-Python | cdff7c7f3850e6326e274c8c1987b9e1a18ce910 | [
"MIT"
] | null | null | null | Desafios/Desafio2.py | Felix-xilef/Curso-de-Python | cdff7c7f3850e6326e274c8c1987b9e1a18ce910 | [
"MIT"
] | null | null | null | import os
print("Digite:\n")
dia = input('\tDia = ')
mes = input('\tMês = ')
ano = input('\tAno = ')
print('\nVocê nasceu no dia', dia, 'de', mes, 'de', ano, '\nCorreto?')
os.system("pause") | 21.333333 | 70 | 0.578125 |
79538d70783cc891418df3649a8591b93e1e5933 | 5,084 | py | Python | test/kb_variation_importer_server_test.py | pjtinker/kb_validation_demo | 550ddb6c7cd5cf7ff32790659a885675bf53d113 | [
"MIT"
] | 1 | 2019-01-24T20:38:11.000Z | 2019-01-24T20:38:11.000Z | test/kb_variation_importer_server_test.py | pjtinker/kb_validation_demo | 550ddb6c7cd5cf7ff32790659a885675bf53d113 | [
"MIT"
] | null | null | null | test/kb_variation_importer_server_test.py | pjtinker/kb_validation_demo | 550ddb6c7cd5cf7ff32790659a885675bf53d113 | [
"MIT"
] | 1 | 2019-01-08T16:55:32.000Z | 2019-01-08T16:55:32.000Z | # -*- coding: utf-8 -*-
import unittest
import os # noqa: F401
import json # noqa: F401
import time
import requests
import shutil
import uuid
from os import environ
try:
from ConfigParser import ConfigParser # py2
except:
from configparser import ConfigParser # py3
from pprint import pprint # noqa: F401
from DataFileUtil.DataFileUtilClient import DataFileUtil
from mock import patch
from biokbase.workspace.client import Workspace as workspaceService
from kb_variation_importer.kb_variation_importerImpl import kb_variation_importer
from kb_variation_importer.kb_variation_importerServer import MethodContext
from kb_variation_importer.authclient import KBaseAuth as _KBaseAuth
mock_assembly = {
"assembly_id": "Carsonella_ruddii_HT.fna.gz_assembly",
"base_counts": {
"A": 67508,
"C": 11789,
"G": 11134,
"T": 67112
},
"contigs": {
"CP003544.1": {
"contig_id": "CP003544.1",
"description": "Candidatus Carsonella ruddii HT isolate Thao2000, complete genome",
"gc_content": 0.1455,
"length": 157543,
"md5": "2648e704354959e79f5de6fff3b5b9db",
"name": "CP003544.1"
}
},
"dna_size": 157543,
"gc_content": 0.1455,
"num_contigs": 1,
"type": "Unknown"
}
class kb_variation_importerTest(unittest.TestCase):
@classmethod
def setUpClass(cls):
token = environ.get('KB_AUTH_TOKEN', None)
config_file = environ.get('KB_DEPLOYMENT_CONFIG', None)
cls.cfg = {}
config = ConfigParser()
config.read(config_file)
for nameval in config.items('kb_variation_importer'):
cls.cfg[nameval[0]] = nameval[1]
# Getting username from Auth profile for token
authServiceUrl = cls.cfg['auth-service-url']
auth_client = _KBaseAuth(authServiceUrl)
user_id = auth_client.get_user(token)
# WARNING: don't call any logging methods on the context object,
# it'll result in a NoneType error
cls.ctx = MethodContext(None)
cls.ctx.update({'token': token,
'user_id': user_id,
'provenance': [
{'service': 'kb_variation_importer',
'method': 'please_never_use_it_in_production',
'method_params': []
}],
'authenticated': 1})
cls.wsURL = cls.cfg['workspace-url']
cls.wsClient = workspaceService(cls.wsURL)
cls.serviceImpl = kb_variation_importer(cls.cfg)
cls.scratch = cls.cfg['scratch']
cls.callback_url = os.environ['SDK_CALLBACK_URL']
@classmethod
def tearDownClass(cls):
if hasattr(cls, 'wsName'):
cls.wsClient.delete_workspace({'workspace': cls.wsName})
print('Test workspace was deleted')
def getWsClient(self):
return self.__class__.wsClient
def getWsName(self):
if hasattr(self.__class__, 'wsName'):
return self.__class__.wsName
suffix = int(time.time() * 1000)
wsName = "test_kb_variation_importer_" + str(suffix)
ret = self.getWsClient().create_workspace({'workspace': wsName}) # noqa
self.__class__.wsName = wsName
return wsName
def getImpl(self):
return self.__class__.serviceImpl
def getContext(self):
return self.__class__.ctx
@staticmethod
def fake_staging_download(params):
scratch = '/kb/module/work/tmp/'
inpath = params['staging_file_subdir_path']
shutil.copy('/kb/module/data/'+ inpath, scratch + inpath)
return {'copy_file_path': scratch + inpath}
# NOTE: According to Python unittest naming rules test method names should start from 'test'. # noqa
@patch.object(DataFileUtil, "download_staging_file",
new=fake_staging_download)
def test_your_method(self):
# Prepare test objects in workspace if needed using
# self.getWsClient().save_objects({'workspace': self.getWsName(),
# 'objects': []})
#
# Run your method by
# ret = self.getImpl().your_method(self.getContext(), parameters...)
#
# Check returned data with
# self.assertEqual(ret[...], ...) or other unittest methods
params = {
'workspace_name' : self.getWsName(),
'variation_object_name' : 'Test_variation_object_name',
'genome_ref' : '18590/2/8',
'variation_file_subdir_path' : 'test_with_chr.vcf',
'variation_attributes_subdir_path' : 'population_locality.txt',
}
ret = self.getImpl().import_variation(self.getContext(), params)[0]
self.assertIsNotNone(ret['report_ref'], ret['report_name'])
pass
| 37.109489 | 104 | 0.596577 |
79538e437ed7a900d6d38303d112882f1d74dcea | 1,167 | py | Python | src/stage_00_template.py | nitinkakad/MLflow_CNN_App-FSDS | 7e416a0d56278e3352619dbf69dc701ace93093b | [
"MIT"
] | null | null | null | src/stage_00_template.py | nitinkakad/MLflow_CNN_App-FSDS | 7e416a0d56278e3352619dbf69dc701ace93093b | [
"MIT"
] | null | null | null | src/stage_00_template.py | nitinkakad/MLflow_CNN_App-FSDS | 7e416a0d56278e3352619dbf69dc701ace93093b | [
"MIT"
] | null | null | null | import argparse
import os
import shutil
from tqdm import tqdm
import logging
from src.utils.common import read_yaml, create_directories
import random
import urllib.request as req
STAGE = "TEMPLATE" ## <<< change stage name
logging.basicConfig(
filename=os.path.join("logs", 'running_logs.log'),
level=logging.INFO,
format="[%(asctime)s: %(levelname)s: %(module)s]: %(message)s",
filemode="a"
)
def main(config_path, params_path):
## read config files
config = read_yaml(config_path)
params = read_yaml(params_path)
pass
if __name__ == '__main__':
args = argparse.ArgumentParser()
args.add_argument("--config", "-c", default="configs/config.yaml")
args.add_argument("--params", "-p", default="params.yaml")
parsed_args = args.parse_args()
try:
logging.info("\n********************")
logging.info(f">>>>> stage {STAGE} started <<<<<")
main(config_path=parsed_args.config, params_path=parsed_args.params)
logging.info(f">>>>> stage {STAGE} completed!<<<<<\n")
except Exception as e:
logging.exception(e)
raise e | 28.463415 | 77 | 0.627249 |
79538e595767a5665244f718b0ce5886a47cffaa | 955 | py | Python | travel/urls.py | team-yuml-kkks/TravelAPI | 62ccbdd071206f2e76d44b8661518d5bc9a7e7fd | [
"MIT"
] | null | null | null | travel/urls.py | team-yuml-kkks/TravelAPI | 62ccbdd071206f2e76d44b8661518d5bc9a7e7fd | [
"MIT"
] | 7 | 2019-12-04T23:05:25.000Z | 2022-02-10T09:23:59.000Z | travel/urls.py | team-yuml-kkks/TravelAPI | 62ccbdd071206f2e76d44b8661518d5bc9a7e7fd | [
"MIT"
] | null | null | null | """travel URL Configuration
The `urlpatterns` list routes URLs to views. For more information please see:
https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
1. Add an import: from my_app import views
2. Add a URL to urlpatterns: path('', views.home, name='home')
Class-based views
1. Add an import: from other_app.views import Home
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
Including another URLconf
1. Import the include() function: from django.urls import include, path
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path('admin/', admin.site.urls),
path('routes/', include('travel.apps.routes.urls'))
] + static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
| 38.2 | 77 | 0.726702 |
79538f34c0325804a8bf33a22f346cebdcee4043 | 4,617 | py | Python | build_files.py | david-hay-eips/recess-countdown | 06861d7961f6bc64061385f6a45a5bd1f8df97b2 | [
"CC0-1.0"
] | 1 | 2021-03-30T15:54:01.000Z | 2021-03-30T15:54:01.000Z | build_files.py | david-hay-eips/recess-countdown | 06861d7961f6bc64061385f6a45a5bd1f8df97b2 | [
"CC0-1.0"
] | null | null | null | build_files.py | david-hay-eips/recess-countdown | 06861d7961f6bc64061385f6a45a5bd1f8df97b2 | [
"CC0-1.0"
] | null | null | null | import csv
with open('bell-times.csv') as csv_file:
csv_reader = csv.reader(csv_file, delimiter=',')
line_count = 0
for row in csv_reader:
if line_count > 0:
group = row[0]
if group[1] == 'R':
lunchOrRecess = "'lunch'"
else:
lunchOrRecess = "'recess'"
firstRecessTime = row[1].replace(':',', ')
lunchRecessTime = row[2].replace(':',', ')
afterLunchTime = row[3].replace(':',', ')
lastRecessTime = row[4].replace(':',', ')
endOfDay = row[5].replace(':',', ')
firstRecessTimeED = row[6].replace(':',', ')
lunchRecessTimeED = row[7].replace(':',', ')
afterLunchTimeED = row[8].replace(':',', ')
endOfDayED = row[9].replace(':',', ')
contents = '''
<!DOCTYPE html>
<html>
<head>
<base target='_top'>
</head>
<body>
<div id='countDownParagraph' style="text-align: center; font-size: 700%;"></div>
<script>
var x = setInterval(function() {
var dateNow = new Date();
var year = dateNow.getFullYear();
var month = dateNow.getMonth();
var day = dateNow.getDate();
if (day < 8 && dateNow.getDay() == 3) { // first Wednesday of the month
var firstRecessTime = new Date(year, month, day,
'''+ firstRecessTimeED +'''
, 0);
var lunchRecessTime = new Date(year, month, day,
'''+ lunchRecessTimeED +'''
, 0);
var afterLunchTime = new Date(year, month, day,
'''+ afterLunchTimeED +'''
, 0);
var lastRecessTime = new Date(year, month, day,
'''+ afterLunchTimeED +'''
, 1);
var endOfDay = new Date(year, month, day,
'''+ endOfDayED +'''
, 0);
} else {
var firstRecessTime = new Date(year, month, day,
'''+ firstRecessTime +'''
, 0);
var lunchRecessTime = new Date(year, month, day,
'''+ lunchRecessTime +'''
, 0);
var afterLunchTime = new Date(year, month, day,
'''+ afterLunchTime +'''
, 0);
var lastRecessTime = new Date(year, month, day,
'''+ lastRecessTime +'''
, 0);
var endOfDay = new Date(year, month, day,
'''+ endOfDay +'''
, 0);
}
var untilString = 'recess';
var difference = firstRecessTime - dateNow;
if (difference < 0) {difference = lunchRecessTime - dateNow; untilString =
'''+lunchOrRecess+'''
}
if (difference < 0) {difference = afterLunchTime - dateNow; untilString = 'class starts';}
if (difference < 0) {difference = lastRecessTime - dateNow; untilString = 'recess'}
if (difference < 0) {difference = endOfDay - dateNow; untilString = 'the end of the day'}
var hours = Math.floor((difference % (1000 * 60 * 60 * 24)) / (1000 * 60 * 60));
var minutes = Math.floor((difference % (1000 * 60 * 60)) / (1000 * 60));
var seconds = Math.floor((difference % (1000 * 60)) / 1000);
var displayDateTime = dateNow.toString().split(" GMT")[0];
// check each morning for an update
if (hours == 5 && minutes == 30 && seconds == 30) {location.reload(true);}
// set text color to red if < 3 minutes
if (hours == 0 && minutes < 3) {document.getElementById('countDownParagraph').style.color='red';}
if (hours < 0) {document.getElementById('countDownParagraph').style.color='grey';document.body.style.backgroundColor='black';}
else {document.getElementById('countDownParagraph').style.color='black';}
if (hours > 0) {var countDownString = hours + " h and " + minutes + " m ";}
else {var countDownString = minutes + " m and " + seconds + " s ";}
document.getElementById('countDownParagraph').innerHTML = displayDateTime + "<br><br>" + countDownString + 'until ' + untilString + '.';
}, 1000); // updating setInterval every second
</script>
</body>
</html>
'''
f = open(group+'.html', 'w')
f.write(contents)
f.close()
line_count += 1
print('complete') | 45.712871 | 149 | 0.491878 |
79538f9daf2a410ce09288ab34ba4c44c5218eee | 95 | py | Python | dycco/tests/input/bad_shebang_and_coding.py | mccutchen/dycco | da8236e6faf922827ed68fd04a41c199b566d674 | [
"MIT"
] | 2 | 2016-05-01T15:18:43.000Z | 2016-12-26T15:30:50.000Z | dycco/tests/input/bad_shebang_and_coding.py | mccutchen/dycco | da8236e6faf922827ed68fd04a41c199b566d674 | [
"MIT"
] | 4 | 2022-03-15T07:59:13.000Z | 2022-03-24T14:49:39.000Z | dycco/tests/input/bad_shebang_and_coding.py | mccutchen/dycco | da8236e6faf922827ed68fd04a41c199b566d674 | [
"MIT"
] | 1 | 2016-05-01T15:18:50.000Z | 2016-05-01T15:18:50.000Z | # Shebang must come first
#!/usr/bin/env/python2.6
# -*- coding: utf8 -*-
print 'Hello, World!' | 23.75 | 25 | 0.652632 |
795390516bd4b5993c1324b8d43b3884defab4df | 28,527 | py | Python | custom_components/hasl/sensor.py | DSorlov/ha-sensor-sl | 6d6b27baff5322bf9e1abc819ef23dca5af826d3 | [
"Apache-2.0"
] | 7 | 2018-12-02T19:14:16.000Z | 2019-05-07T07:52:25.000Z | custom_components/hasl/sensor.py | DSorlov/ha-sensor-sl | 6d6b27baff5322bf9e1abc819ef23dca5af826d3 | [
"Apache-2.0"
] | 23 | 2019-02-11T13:20:31.000Z | 2019-05-10T11:03:12.000Z | custom_components/hasl/sensor.py | DSorlov/ha-sensor-sl | 6d6b27baff5322bf9e1abc819ef23dca5af826d3 | [
"Apache-2.0"
] | 4 | 2019-03-13T12:22:58.000Z | 2019-04-30T20:51:25.000Z | #!/usr/bin/python
# -*- coding: utf-8 -*-
"""Simple service for SL (Storstockholms Lokaltrafik)."""
import datetime
import json
import logging
from datetime import timedelta
import math
import homeassistant.helpers.config_validation as cv
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (ATTR_FRIENDLY_NAME, CONF_SCAN_INTERVAL,
CONF_SENSOR_TYPE, CONF_SENSORS, STATE_OFF,
STATE_ON)
from homeassistant.helpers.entity import Entity
from homeassistant.helpers.event import (async_track_point_in_utc_time,
async_track_utc_time_change,
track_time_interval)
from homeassistant.util import Throttle
from homeassistant.util.dt import now
from hasl import (haslapi, fpapi, tl2api, ri4api, si2api,
HASL_Error, HASL_API_Error, HASL_HTTP_Error)
__version__ = '2.2.6'
_LOGGER = logging.getLogger(__name__)
DOMAIN = 'hasl'
# Keys used in the configuration.
CONF_RI4_KEY = 'ri4key'
CONF_SI2_KEY = 'si2key'
CONF_TL2_KEY = 'tl2key'
CONF_SITEID = 'siteid'
CONF_LINES = 'lines'
CONF_DIRECTION = 'direction'
CONF_ENABLED_SENSOR = 'sensor'
CONF_TIMEWINDOW = 'timewindow'
CONF_SENSORPROPERTY = 'property'
CONF_TRAIN_TYPE = 'train_type'
CONF_TRAFFIC_CLASS = 'traffic_class'
CONF_VERSION = 'version_sensor'
CONF_USE_MINIMIZATION = 'api_minimization'
LIST_SENSOR_TYPES = ['departures', 'status', 'trainlocation', 'comb', 'tl2']
LIST_SENSOR_PROPERTIES = ['min', 'time', 'deviations', 'refresh', 'updated']
LIST_TRAIN_TYPES = ['PT', 'RB', 'TVB', 'SB', 'LB', 'SpvC', 'TB1', 'TB2', 'TB3']
# Default values for configuration.
DEFAULT_INTERVAL = timedelta(minutes=10)
DEFAULT_TIMEWINDOW = 30
DEFAULT_DIRECTION = 0
DEFAULT_SENSORPROPERTY = 'min'
DEFAULT_TRAIN_TYPE = 'PT'
DEFAULT_TRAFFIC_CLASS = ['metro', 'train', 'local', 'tram', 'bus', 'fer']
DEFAULT_SENSORTYPE = 'departures'
DEFAULT_CACHE_FILE = '.storage/haslcache.json'
# Defining the configuration schema.
PLATFORM_SCHEMA = PLATFORM_SCHEMA.extend({
# API Keys
vol.Optional(CONF_RI4_KEY): cv.string,
vol.Optional(CONF_SI2_KEY): cv.string,
vol.Optional(CONF_TL2_KEY): cv.string,
vol.Optional(CONF_VERSION, default=False): cv.boolean,
vol.Optional(CONF_USE_MINIMIZATION, default=True): cv.boolean,
vol.Required(CONF_SENSORS, default=[]):
vol.All(cv.ensure_list, [vol.All({
vol.Required(ATTR_FRIENDLY_NAME): cv.string,
vol.Required(CONF_SENSOR_TYPE, default=DEFAULT_SENSORTYPE):
vol.In(LIST_SENSOR_TYPES),
vol.Optional(CONF_ENABLED_SENSOR): cv.string,
vol.Optional(CONF_SCAN_INTERVAL, default=DEFAULT_INTERVAL):
vol.Any(cv.time_period, cv.positive_timedelta),
vol.Optional(CONF_SITEID): cv.string,
vol.Optional(CONF_LINES, default=[]):
vol.All(cv.ensure_list, [cv.string]),
vol.Optional(CONF_DIRECTION, default=DEFAULT_DIRECTION):
vol.All(vol.Coerce(int), vol.Range(min=0, max=2)),
vol.Optional(CONF_TIMEWINDOW, default=DEFAULT_TIMEWINDOW):
vol.All(vol.Coerce(int), vol.Range(min=0, max=60)),
vol.Optional(CONF_SENSORPROPERTY, default=DEFAULT_SENSORPROPERTY):
vol.In(LIST_SENSOR_PROPERTIES),
vol.Optional(CONF_TRAFFIC_CLASS, default=DEFAULT_TRAFFIC_CLASS):
vol.All(cv.ensure_list, [vol.In(DEFAULT_TRAFFIC_CLASS)]),
vol.Optional(CONF_TRAIN_TYPE, default=DEFAULT_TRAIN_TYPE):
vol.In(LIST_TRAIN_TYPES)
})]),
}, extra=vol.ALLOW_EXTRA)
def setup_platform(hass, config, add_devices, discovery_info=None):
"""Setup the sensors."""
if not hass.data.get(DOMAIN):
hass.data[DOMAIN] = {}
sensors = []
if config[CONF_VERSION]:
sensors.append(SLVersionSensor(hass))
_LOGGER.info("Created version sensor for HASL")
for sensorconf in config[CONF_SENSORS]:
if sensorconf[CONF_SENSOR_TYPE] == 'departures' or \
sensorconf[CONF_SENSOR_TYPE] == 'comb':
sitekey = sensorconf.get(CONF_SITEID)
si2key = config.get(CONF_SI2_KEY)
ri4key = config.get(CONF_RI4_KEY)
if sitekey and ri4key:
sensorname = sensorconf[ATTR_FRIENDLY_NAME]
sensors.append(SLDeparturesSensor(
hass,
si2key,
ri4key,
sitekey,
sensorconf.get(CONF_LINES),
sensorname,
sensorconf.get(CONF_ENABLED_SENSOR),
sensorconf.get(CONF_SCAN_INTERVAL),
sensorconf.get(CONF_DIRECTION),
sensorconf.get(CONF_TIMEWINDOW),
sensorconf.get(CONF_SENSORPROPERTY),
config.get(CONF_USE_MINIMIZATION)
))
_LOGGER.info("Created departures sensor %s...", sensorname)
else:
_LOGGER.error("Sensor %s is missing site, si2key or ri4key",
sensorconf[ATTR_FRIENDLY_NAME])
if sensorconf[CONF_SENSOR_TYPE] == 'status' or \
sensorconf[CONF_SENSOR_TYPE] == 'tl2':
tl2key = config.get(CONF_TL2_KEY)
if tl2key:
sensorname = sensorconf[ATTR_FRIENDLY_NAME]
sensors.append(SLStatusSensor(
hass,
tl2key,
sensorname,
sensorconf.get(CONF_ENABLED_SENSOR),
sensorconf.get(CONF_SCAN_INTERVAL),
sensorconf.get(CONF_TRAFFIC_CLASS),
config.get(CONF_USE_MINIMIZATION)
))
_LOGGER.info("Created status sensor %s...", sensorname)
else:
_LOGGER.error("Sensor %s is missing tl2key attribute",
sensorconf[ATTR_FRIENDLY_NAME])
if sensorconf[CONF_SENSOR_TYPE] == 'trainlocation':
train_type = sensorconf.get(CONF_TRAIN_TYPE)
if train_type:
sensorname = sensorconf[ATTR_FRIENDLY_NAME]
sensors.append(SLTrainLocationSensor(
hass,
sensorname,
train_type,
sensorconf.get(CONF_SCAN_INTERVAL),
sensorconf.get(CONF_ENABLED_SENSOR),
))
_LOGGER.info("Created train sensor %s...", sensorname)
else:
_LOGGER.error("Sensor %s is missing train_type attribute",
sensorconf[ATTR_FRIENDLY_NAME])
add_devices(sensors)
class SLTrainLocationSensor(Entity):
"""Trafic Situation Sensor."""
def __init__(self, hass, friendly_name, train_type,
interval, enabled_sensor):
self._hass = hass
self._fpapi = fpapi()
self._name = friendly_name
self._interval = interval
self._enabled_sensor = enabled_sensor
self._train_type = train_type
self._data = {}
self.update = Throttle(interval)(self._update)
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def icon(self):
""" Return the icon for the frontend."""
return None
@property
def extra_state_attributes(self):
""" Return the sensor attributes."""
return {'type': self._train_type, 'data': json.dumps(self._data)}
@property
def state(self):
""" Return the state of the sensor."""
return self._train_type
def _update(self):
if self._enabled_sensor is not None:
sensor_state = self._hass.states.get(self._enabled_sensor)
if self._enabled_sensor is None or sensor_state.state is STATE_ON:
try:
apidata = self._fpapi.request(self._train_type)
except HASL_Error as e:
_LOGGER.error("A communication error occured while "
"updating train location sensor: %s", e.details)
return
except Exception as e:
_LOGGER.error("A error occured while"
"updating train location sensor: %s", e)
return
self._data = apidata
_LOGGER.info("Update completed %s...", self._name)
class SLVersionSensor(Entity):
"""HASL Version Sensor."""
def __init__(self, hass):
self._hass = hass
self._haslapi = haslapi()
self._name = 'HASL Version'
self._version = __version__
self._py_version = self._haslapi.version()
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def icon(self):
""" Return the icon for the frontend."""
return None
@property
def extra_state_attributes(self):
""" Return the sensor attributes."""
return {'hasl': self._version, 'pyHasl': self._py_version}
@property
def state(self):
""" Return the state of the sensor."""
return self._version + "/" + self._py_version
class SLStatusSensor(Entity):
"""Trafic Situation Sensor."""
def __init__(self, hass, tl2key, friendly_name,
enabled_sensor, interval, type,
minimization):
self._tl2api = tl2api(tl2key)
self._datakey = 'tl2_' + tl2key
self._interval = interval
self._hass = hass
self._name = friendly_name
self._enabled_sensor = enabled_sensor
self._type = type
self._sensordata = []
self._lastupdate = '-'
self._cachefile = hass.config.path(DEFAULT_CACHE_FILE)
self._minimization = minimization
if not hass.data[DOMAIN].get(self._datakey):
hass.data[DOMAIN][self._datakey] = ''
self.update = Throttle(interval)(self._update)
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def icon(self):
""" Return the icon for the frontend."""
return 'mdi:train-car'
@property
def extra_state_attributes(self):
""" Return the sensor attributes."""
return self._sensordata
@property
def state(self):
""" Return the state of the sensor."""
return self._lastupdate
def getCache(self, key):
try:
jsonFile = open(self._cachefile, 'r')
data = json.load(jsonFile)
jsonFile.close()
return data.get(key)
except:
return {}
def putCache(self, key, value):
try:
jsonFile = open(self._cachefile, 'r')
data = json.load(jsonFile)
jsonFile.close()
data[key] = value
except:
data = {'' + key + '': value}
jsonFile = open(self._cachefile, 'w')
jsonFile.write(json.dumps(data))
jsonFile.close()
def _update(self):
if self._enabled_sensor is not None:
sensor_state = self._hass.states.get(self._enabled_sensor)
if self._enabled_sensor is None or sensor_state.state is STATE_ON:
_LOGGER.info("Starting to update TL2 for %s...",
self._name)
# Object used to create our object.
newdata = {}
# Use some nice translations for the statuses etc.
statuses = {
'EventGood': 'Good',
'EventMinor': 'Minor',
'EventMajor': 'Closed',
'EventPlanned': 'Planned',
}
# Icon table used for HomeAssistant.
statusIcons = {
'EventGood': 'mdi:check',
'EventMinor': 'mdi:clock-alert-outline',
'EventMajor': 'mdi:close',
'EventPlanned': 'mdi:triangle-outline'
}
trafficTypeIcons = {
'ferry': 'mdi:ferry',
'bus': 'mdi:bus',
'tram': 'mdi:tram',
'train': 'mdi:train',
'local': 'mdi:train-variant',
'metro': 'mdi:subway-variant'
}
# If the same API have already made the request in within
# the specified interval then use that data instead of
# requesting it again and spare some innocent credits from dying.
cacheage = self._hass.data[DOMAIN][self._datakey]
if not cacheage or now() \
- self._interval > cacheage or not self._minimization:
try:
apidata = self._tl2api.request()
apidata = apidata['ResponseData']['TrafficTypes']
self.putCache(self._datakey, apidata)
self._hass.data[DOMAIN][self._datakey] = \
now()
_LOGGER.info("Updated cache for %s...", self._name)
except HASL_Error as e:
_LOGGER.error("A communication error occured while "
"updating TL2 sensor: %s", e.details)
return
except Exception as e:
_LOGGER.error("A error occured while "
"updating TL4 API: %s", e)
return
else:
apidata = self.getCache(self._datakey)
_LOGGER.info("Reusing data from cache for %s...",
self._name)
# Return only the relevant portion of the results.
for response in apidata:
type = response['Type']
if self._type is None or type in self._type:
statustype = ('ferry' if type == 'fer' else type)
newdata[statustype + '_status'] = \
statuses.get(response['StatusIcon'])
newdata[statustype + '_status_icon'] = \
statusIcons.get(response['StatusIcon'])
newdata[statustype + '_icon'] = \
trafficTypeIcons.get(statustype)
for event in response['Events']:
event['Status'] = statuses.get(event['StatusIcon'])
event['StatusIcon'] = \
statusIcons.get(event['StatusIcon'])
newdata[statustype + '_events'] = response['Events']
# Attribution and update sensor data.
newdata['attribution'] = "Stockholms Lokaltrafik"
newdata['last_updated'] = \
self._hass.data[DOMAIN][self._datakey].strftime('%Y-%m-%d' +
'%H:%M:%S')
self._sensordata = newdata
self._lastupdate = newdata['last_updated']
_LOGGER.info("TL2 update completed for %s...", self._name)
class SLDeparturesSensor(Entity):
"""Departure board for one SL site."""
def __init__(self, hass, si2key, ri4key, siteid,
lines, friendly_name, enabled_sensor,
interval, direction, timewindow, sensorproperty,
minimization):
"""Initialize"""
# The table of resulttypes and the corresponding units of measure.
unit_table = {
'min': 'min',
'time': '',
'deviations': '',
'refresh': '',
'update': '',
}
if si2key:
self._si2key = si2key
self._si2api = si2api(si2key, siteid, '')
self._si2datakey = 'si2_' + si2key + '_' + siteid
self._ri4key = ri4key
self._ri4api = ri4api(ri4key, siteid, 60)
self._ri4datakey = 'ri2_' + ri4key + '_' + siteid
self._hass = hass
self._name = friendly_name
self._lines = lines
self._siteid = siteid
self._enabled_sensor = enabled_sensor
self._sensorproperty = sensorproperty
self._departure_table = []
self._deviations_table = []
self._direction = direction
self._timewindow = timewindow
self._nextdeparture_minutes = '0'
self._nextdeparture_expected = '-'
self._lastupdate = '-'
self._interval = interval
self._unit_of_measure = unit_table.get(self._sensorproperty, 'min')
self._cachefile = hass.config.path(DEFAULT_CACHE_FILE)
self._minimization = minimization
if not hass.data[DOMAIN].get(self._ri4datakey):
hass.data[DOMAIN][self._ri4datakey] = ''
if self._si2key:
if not hass.data[DOMAIN].get(self._si2datakey):
hass.data[DOMAIN][self._si2datakey] = ''
# Setup updating of the sensor.
self.update = Throttle(interval)(self._update)
@property
def name(self):
"""Return the name of the sensor."""
return self._name
@property
def icon(self):
""" Return the icon for the frontend."""
if self._deviations_table:
return 'mdi:bus-alert'
return 'mdi:bus'
@property
def state(self):
""" Return number of minutes to the next departure """
# If the sensor should return minutes to next departure.
if self._sensorproperty is 'min':
next_departure = self.nextDeparture()
if not next_departure:
return '-'
delta = next_departure['expected'] - datetime.datetime.now()
expected_minutes = math.floor(delta.total_seconds() / 60)
return expected_minutes
# If the sensor should return the time at which next departure occurs.
if self._sensorproperty is 'time':
next_departure = self.nextDeparture()
if not next_departure:
return '-'
expected = next_departure['expected'].strftime('%H:%M:%S')
return expected
# If the sensor should return the number of deviations.
if self._sensorproperty is 'deviations':
return len(self._deviations_table)
# If the sensor should return if it is updating or not.
if self._sensorproperty is 'refresh':
if self._enabled_sensor is None or sensor_state.state is STATE_ON:
return STATE_ON
return STATE_OFF
if self._sensorproperty is 'updated':
if self._lastupdate is '-':
return '-'
return refresh.strftime('%Y-%m-%d %H:%M:%S')
# Failsafe
return '-'
@property
def extra_state_attributes(self):
""" Return the sensor attributes ."""
# Initialize the state attributes.
val = {}
# Format the next exptected time.
next_departure = self.nextDeparture()
if next_departure:
expected_time = next_departure['expected']
delta = expected_time - datetime.datetime.now()
expected_minutes = math.floor(delta.total_seconds() / 60)
expected_time = expected_time.strftime('%H:%M:%S')
else:
expected_time = '-'
expected_minutes = '-'
# Format the last refresh time.
refresh = self._lastupdate
if self._lastupdate is not '-':
refresh = refresh.strftime('%Y-%m-%d %H:%M:%S')
# Setup the unit of measure.
if self._unit_of_measure is not '':
val['unit_of_measurement'] = self._unit_of_measure
# Check if sensor is currently updating or not.
if self._enabled_sensor is not None:
sensor_state = self._hass.states.get(self._enabled_sensor)
if self._enabled_sensor is None or sensor_state.state is STATE_ON:
val['refresh_enabled'] = STATE_ON
else:
val['refresh_enabled'] = STATE_OFF
# Set values of the sensor.
val['attribution'] = 'Stockholms Lokaltrafik'
val['departures'] = self._departure_table
val['deviations'] = self._deviations_table
val['last_refresh'] = refresh
val['next_departure_minutes'] = expected_minutes
val['next_departure_time'] = expected_time
val['deviation_count'] = len(self._deviations_table)
return val
def parseDepartureTime(self, t):
""" weird time formats from the API,
do some quick and dirty conversions. """
try:
if t == 'Nu':
return 0
s = t.split()
if len(s) > 1 and s[1] == 'min':
return int(s[0])
s = t.split(':')
if len(s) > 1:
rightnow = now()
min = int(s[0]) * 60 + int(s[1]) - (rightnow.hour * 60 +
rightnow.minute)
if min < 0:
min = min + 1440
return min
except Exception:
_LOGGER.warning("Failed to parse departure time (%s) ", t)
return 0
def nextDeparture(self):
if not self._departure_table:
return None
now = datetime.datetime.now()
for departure in self._departure_table:
if departure['expected'] > now:
return departure
return None
def getCache(self, key):
try:
jsonFile = open(self._cachefile, 'r')
data = json.load(jsonFile)
jsonFile.close()
return data.get(key)
except:
return {}
def putCache(self, key, value):
try:
jsonFile = open(self._cachefile, 'r')
data = json.load(jsonFile)
jsonFile.close()
data[key] = value
except:
data = {'' + key + '': value}
jsonFile = open(self._cachefile, 'w')
jsonFile.write(json.dumps(data))
jsonFile.close()
def _update(self):
"""Get the departure board."""
# If using external sensor, get its value.
if self._enabled_sensor is not None:
sensor_state = self._hass.states.get(self._enabled_sensor)
# If we dont have external sensor or it is ON then proceed.
if self._enabled_sensor is None or sensor_state.state \
is STATE_ON:
self._update_ri4()
if self._si2key:
self._update_si2()
self._lastupdate = now()
def _update_ri4(self):
errorOccured = False
_LOGGER.info("Starting to update RI4 for %s...", self._name)
cacheage = self._hass.data[DOMAIN][self._ri4datakey]
if not cacheage or now() \
- self._interval > cacheage or not self._minimization:
try:
departuredata = self._ri4api.request()
departuredata = departuredata['ResponseData']
self.putCache(self._ri4datakey, departuredata)
self._hass.data[DOMAIN][self._ri4datakey] = \
now()
_LOGGER.info("Updated cache for %s...", self._name)
except HASL_Error as e:
_LOGGER.error("A communication error occured while "
"updating SI2 sensor: %s", e.details)
errorOccured = True
except Exception as e:
_LOGGER.error("A communication error occured while "
"updating RI4 API: %s", e)
errorOccured = True
else:
try:
departuredata = self.getCache(self._ri4datakey)
_LOGGER.info("Reusing data from cache for %s...",
self._name)
except Exception as e:
_LOGGER.error("A error occured while retreiving "
"cached RI4 sensor data: %s", e)
errorOccured = True
if not errorOccured:
departures = []
iconswitcher = {
'Buses': 'mdi:bus',
'Trams': 'mdi:tram',
'Ships': 'mdi:ferry',
'Metros': 'mdi:subway-variant',
'Trains': 'mdi:train',
}
for (i, traffictype) in enumerate(['Metros', 'Buses', 'Trains',
'Trams', 'Ships']):
for (idx, value) in enumerate(departuredata[traffictype]):
direction = value['JourneyDirection'] or 0
displaytime = value['DisplayTime'] or ''
destination = value['Destination'] or ''
linenumber = value['LineNumber'] or ''
expected = value['ExpectedDateTime'] or ''
groupofline = value['GroupOfLine'] or ''
icon = iconswitcher.get(traffictype, 'mdi:train-car')
if int(self._direction) == 0 or int(direction) \
== int(self._direction):
if self._lines == [] or linenumber \
in self._lines:
diff = self.parseDepartureTime(displaytime)
if diff < self._timewindow:
departures.append({
'line': linenumber,
'direction': direction,
'departure': displaytime,
'destination': destination,
'time': diff,
'expected': datetime.datetime.strptime(
expected, '%Y-%m-%dT%H:%M:%S'
),
'type': traffictype,
'groupofline': groupofline,
'icon': icon,
})
self._departure_table = sorted(departures,
key=lambda k: k['time'])
_LOGGER.info("RI4 update completed for %s...", self._name)
def _update_si2(self):
errorOccured = False
_LOGGER.info("Starting to update SI2 for %s...", self._name)
cacheage = self._hass.data[DOMAIN][self._si2datakey]
if not cacheage or now() \
- self._interval > cacheage or not self._minimization:
try:
deviationdata = self._si2api.request()
deviationdata = deviationdata['ResponseData']
self.putCache(self._si2datakey, deviationdata)
self._hass.data[DOMAIN][self._si2datakey] = \
now()
_LOGGER.info('Updated cache for %s...', self._name)
except HASL_Error as e:
_LOGGER.error("A communication error occured while "
"updating SI2 sensor: %s", e.details)
errorOccured = True
except Exception as e:
_LOGGER.error("A error occured while "
"updating SI2 sensor: %s", e)
errorOccured = True
else:
try:
deviationdata = self.getCache(self._si2datakey)
_LOGGER.info("Reusing data from cache for %s...",
self._name)
except Exception as e:
_LOGGER.error("A error occured while retreiving "
"cached SI2 sensor: %s", e.details)
errorOccured = True
if not errorOccured:
deviations = []
for (idx, value) in enumerate(deviationdata):
deviations.append({
'updated': value['Updated'],
'title': value['Header'],
'fromDate': value['FromDateTime'],
'toDate': value['UpToDateTime'],
'details': value['Details'],
'sortOrder': value['SortOrder'],
})
self._deviations_table = \
sorted(deviations, key=lambda k: k['sortOrder'])
_LOGGER.info("SI2 update completed for %s...", self._name)
| 34.874083 | 79 | 0.541943 |
7953913a4d4d6e73a182c23626673ec8acf908b6 | 639 | py | Python | backend/home/migrations/0003_room.py | open-home-iot/hint | b674f83ee61d7cc653acec15b92b98618f8e23b5 | [
"MIT"
] | null | null | null | backend/home/migrations/0003_room.py | open-home-iot/hint | b674f83ee61d7cc653acec15b92b98618f8e23b5 | [
"MIT"
] | 3 | 2020-12-28T23:31:47.000Z | 2021-04-18T09:30:43.000Z | backend/home/migrations/0003_room.py | megacorpincorporated/hint | 136700c743a647cc9bf35548a7baeaac238e3b1f | [
"MIT"
] | null | null | null | # Generated by Django 3.1.3 on 2021-02-12 18:00
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('home', '0002_home_users'),
]
operations = [
migrations.CreateModel(
name='Room',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=50)),
('home', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='home.home')),
],
),
]
| 27.782609 | 114 | 0.594679 |
79539144fef5607f1a74bc5b04749fd6229c7c3b | 584 | py | Python | chapter7/behavior_path.py | dannystaple/Learn-Robotics-Programming-Second-Edition | 081ed9bbab59aab57334fe8f2f06a157a8639eb4 | [
"MIT"
] | 19 | 2020-05-13T12:53:59.000Z | 2022-03-07T19:50:30.000Z | chapter7/behavior_path.py | dannystaple/Learn-Robotics-Programming-Second-Edition | 081ed9bbab59aab57334fe8f2f06a157a8639eb4 | [
"MIT"
] | 1 | 2020-11-20T16:56:24.000Z | 2020-12-01T06:24:45.000Z | chapter7/behavior_path.py | dannystaple/Learn-Robotics-Programming-Second-Edition | 081ed9bbab59aab57334fe8f2f06a157a8639eb4 | [
"MIT"
] | 12 | 2019-12-24T18:13:14.000Z | 2022-03-20T23:44:12.000Z | import robot
from time import sleep
def straight(bot, seconds):
bot.set_left(100)
bot.set_right(100)
sleep(seconds)
def turn_left(bot, seconds):
bot.set_left(20)
bot.set_right(80)
sleep(seconds)
def turn_right(bot, seconds):
bot.set_left(80)
bot.set_right(20)
sleep(seconds)
def spin_left(bot, seconds):
bot.set_left(-100)
bot.set_right(100)
sleep(seconds)
bot = robot.Robot()
straight(bot, 1)
turn_right(bot, 0.6)
straight(bot, 0.6)
turn_left(bot, 0.6)
straight(bot, 0.6)
turn_left(bot, 0.6)
straight(bot, 0.3)
spin_left(bot, 1)
| 17.176471 | 29 | 0.681507 |
795391b1ebb945645521681cf0a83cf8f1ae7e42 | 5,346 | py | Python | rubiks-cube-solver.py | dwalton76/rubiks-cube-NxNxN-solver | db42aeacca81366dba87ef475274ffb99645193d | [
"MIT"
] | 59 | 2017-04-29T15:19:29.000Z | 2022-03-18T22:17:20.000Z | rubiks-cube-solver.py | dwalton76/rubiks-cube-NxNxN-solver | db42aeacca81366dba87ef475274ffb99645193d | [
"MIT"
] | 44 | 2017-05-25T00:05:31.000Z | 2022-03-23T22:39:34.000Z | rubiks-cube-solver.py | dwalton76/rubiks-cube-NxNxN-solver | db42aeacca81366dba87ef475274ffb99645193d | [
"MIT"
] | 19 | 2017-06-17T00:32:47.000Z | 2021-12-18T00:03:56.000Z | #!/usr/bin/env python3
"""
Solve any size rubiks cube:
- For 2x2x2 and 3x3x3 just solve it
- For 4x4x4 and larger, reduce to 3x3x3 and then solve
"""
# standard libraries
import argparse
import datetime as dt
import logging
import resource
import sys
from math import sqrt
# rubiks cube libraries
from rubikscubennnsolver import SolveError, configure_logging, reverse_steps
if sys.version_info < (3, 6):
raise SystemError("Must be using Python 3.6 or higher")
configure_logging()
logger = logging.getLogger(__name__)
logger.info("rubiks-cube-solver.py begin")
start_time = dt.datetime.now()
parser = argparse.ArgumentParser()
parser.add_argument("--print-steps", default=False, action="store_true", help="Display animated step-by-step solution")
parser.add_argument("--debug", default=False, action="store_true", help="set loglevel to DEBUG")
parser.add_argument("--no-comments", default=False, action="store_true", help="No comments in alg.cubing.net url")
# CPU mode
parser.add_argument(
"--min-memory",
default=False,
action="store_true",
help="Load smaller tables to use less memory...takes longer to run",
)
action = parser.add_mutually_exclusive_group(required=False)
parser.add_argument("--openwith", default=None, type=str, help="Colors for sides U, L, etc")
parser.add_argument("--colormap", default=None, type=str, help="Colors for sides U, L, etc")
parser.add_argument("--order", type=str, default="URFDLB", help="order of sides in --state, default kociemba URFDLB")
parser.add_argument("--solution333", type=str, default=None, help="cube explorer optimal steps for solving 3x3x3")
parser.add_argument(
"--state",
type=str,
help="Cube state",
default="LBBUUURBDDBBDFLFLUDFBFDDFLLLLRLRFRDUDBULBLFLDLFBLBUDFURURDUUBFFBBRBRLBRFLLDRRDDFRRUURRFDUFBFURUD",
)
args = parser.parse_args()
if "G" in args.state:
args.state = args.state.replace("G", "F")
args.state = args.state.replace("Y", "D")
args.state = args.state.replace("O", "L")
args.state = args.state.replace("W", "U")
if args.debug:
logger.setLevel(logging.DEBUG)
size = int(sqrt((len(args.state) / 6)))
if size == 2:
# rubiks cube libraries
from rubikscubennnsolver.RubiksCube222 import RubiksCube222
cube = RubiksCube222(args.state, args.order, args.colormap)
elif size == 3:
# rubiks cube libraries
from rubikscubennnsolver.RubiksCube333 import RubiksCube333
cube = RubiksCube333(args.state, args.order, args.colormap)
elif size == 4:
# rubiks cube libraries
from rubikscubennnsolver.RubiksCube444 import RubiksCube444
cube = RubiksCube444(args.state, args.order, args.colormap)
elif size == 5:
# rubiks cube libraries
from rubikscubennnsolver.RubiksCube555 import RubiksCube555
cube = RubiksCube555(args.state, args.order, args.colormap)
elif size == 6:
# rubiks cube libraries
from rubikscubennnsolver.RubiksCube666 import RubiksCube666
cube = RubiksCube666(args.state, args.order, args.colormap)
elif size == 7:
# rubiks cube libraries
from rubikscubennnsolver.RubiksCube777 import RubiksCube777
cube = RubiksCube777(args.state, args.order, args.colormap)
elif size % 2 == 0:
# rubiks cube libraries
from rubikscubennnsolver.RubiksCubeNNNEven import RubiksCubeNNNEven
cube = RubiksCubeNNNEven(args.state, args.order, args.colormap)
else:
# rubiks cube libraries
from rubikscubennnsolver.RubiksCubeNNNOdd import RubiksCubeNNNOdd
cube = RubiksCubeNNNOdd(args.state, args.order, args.colormap)
cube.sanity_check()
cube.print_cube("Initial Cube")
cube.www_header()
cube.www_write_cube("Initial Cube")
if args.openwith:
for step in args.openwith.split():
cube.rotate(step)
cube.print_cube("post --openwith")
if args.solution333:
solution333 = reverse_steps(args.solution333.split())
else:
solution333 = []
cube.solve(solution333)
end_time = dt.datetime.now()
cube.print_cube("Final Cube")
cube.print_solution(not args.no_comments)
logger.info("*********************************************************************************")
logger.info("See /tmp/rubiks-cube-NxNxN-solver/index.html for more detailed solve instructions")
logger.info("*********************************************************************************\n")
# Now put the cube back in its initial state and verify the solution solves it
solution = cube.solution
cube.re_init()
len_steps = len(solution)
for (i, step) in enumerate(solution):
if args.print_steps:
print(("Move %d/%d: %s" % (i + 1, len_steps, step)))
cube.rotate(step)
www_desc = "Cube After Move %d/%d: %s<br>\n" % (i + 1, len_steps, step)
cube.www_write_cube(www_desc)
if args.print_steps:
cube.print_cube(f"--print-steps {step}")
print("\n\n\n\n")
cube.www_footer()
if args.print_steps:
cube.print_cube("--print-steps DONE")
if args.min_memory:
print("\n\n****************************************")
print("--min-memory has been replaced by --fast")
print("****************************************\n\n")
logger.info("rubiks-cube-solver.py end")
logger.info(f"Memory : {resource.getrusage(resource.RUSAGE_SELF).ru_maxrss:,} bytes")
logger.info(f"Time : {end_time - start_time}")
logger.info("")
if not cube.solved():
raise SolveError("cube should be solved but is not")
| 31.633136 | 119 | 0.693416 |
7953943c1319cd9dea749571147c339625db2d5d | 2,170 | py | Python | frameworks/scrapy/crawler.py | Crossroadsman/python-notes | b12658e172c23e29e7c61e6aee73743dcb256aa5 | [
"Apache-2.0"
] | null | null | null | frameworks/scrapy/crawler.py | Crossroadsman/python-notes | b12658e172c23e29e7c61e6aee73743dcb256aa5 | [
"Apache-2.0"
] | null | null | null | frameworks/scrapy/crawler.py | Crossroadsman/python-notes | b12658e172c23e29e7c61e6aee73743dcb256aa5 | [
"Apache-2.0"
] | null | null | null | """crawler.py
This is a spider and in a scrapy project it would be saved in the
`<ProjectName>/spiders` subdirectory of the project.
Execute the crawl by running scrapy with the crawl option and passing the
spider's name:
```
(venv) $ pwd
/Users/MyUser/MyProject
(venv) $ scrapy crawl whirlaway
```
"""
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
class HorseSpider(CrawlSpider):
"""CrawlSpider is a generic Spider subclass used for common crawling
tasks.
https://doc.scrapy.org/en/latest/topics/spiders.html#crawlspider
"""
name = 'whirlaway'
allowed_domains = ['treehouse-projects.github.io']
start_urls = ['https://treehouse-projects.github.io/horse-land']
# A LinkExtractor defines how links should be extracted from web pages
# (strictly, `scrapy.http.response` objects), using a regex pattern.
# It returns a list of links (strictly, `scrapy.link.link` objects)
link_pattern = r'.*'
link_extractor = LinkExtractor(allow=link_pattern)
# A Rule takes a LinkExtractor and a callback parsing function. The callback
# will be called for every link exctracted by the LinkExtractor
horse_rule = Rule(link_extractor, callback='parse_horses', follow=True)
rules = [horse_rule]
def parse_horses(self, response):
"""Parsers will be used as callbacks. They take a response object and
return a list containing Item and/or Request objects.
"""
url = response.url
# The `css` method lets us use CSS selectors to select page elements
# It returns a list of SelectorObjects (these make it easier to
# progressively refine selectors). You can call extract() on a
# Selector or extract_first on a list of Selectors
# Use pseudo selectors to get the text or attributes of an HTML
# element instead of the HTML itself.
# See:
# https://doc.scrapy.org/en/latest/topics/selectors.html#id1
title = response.css('title::text').extract_first()
print("==== CRAWLING URL ====")
print(f'{title} ({url})')
print("==== END URL ====")
| 37.413793 | 80 | 0.687097 |
7953949d298bf6b2f2f3bb5441231cd1d4ba6186 | 964 | py | Python | catalog/tests/test_urls.py | ens-lgil/PGS_Catalog | 24cfaf8e0dd3d6b4b024b5cefca226e6fc8eb659 | [
"Apache-2.0"
] | 1 | 2020-01-29T11:01:53.000Z | 2020-01-29T11:01:53.000Z | catalog/tests/test_urls.py | ens-lgil/PGS_Catalog | 24cfaf8e0dd3d6b4b024b5cefca226e6fc8eb659 | [
"Apache-2.0"
] | null | null | null | catalog/tests/test_urls.py | ens-lgil/PGS_Catalog | 24cfaf8e0dd3d6b4b024b5cefca226e6fc8eb659 | [
"Apache-2.0"
] | null | null | null | from django.test import TestCase, Client
databases_list = ['default', 'benchmark']
class BrowseUrlTest(TestCase):
""" Test the main URLs of the website """
databases = databases_list
def test_urls(self):
client = Client()
urls = [
'/',
'/about/',
'/benchmark/',
'/browse/all/',
'/browse/traits/',
'/browse/studies/',
'/browse/sample_set/',
'/docs/',
'/downloads/',
'/rest/',
'/robots.txt'
]
for url in urls:
resp = client.get(url)
self.assertEqual(resp.status_code, 200)
def test_urls_redirection(self):
client = Client()
urls = [
'/docs/curation',
'/submit/',
'/template/current'
]
for url in urls:
resp = client.get(url)
self.assertEqual(resp.status_code, 302)
| 24.717949 | 51 | 0.478216 |
795395c84203cc827efadcce1c31146cf7034efa | 30 | py | Python | python/testData/quickFixes/PyRenameElementQuickFixTest/renameInInjectedFragment_after.py | jnthn/intellij-community | 8fa7c8a3ace62400c838e0d5926a7be106aa8557 | [
"Apache-2.0"
] | 2 | 2019-04-28T07:48:50.000Z | 2020-12-11T14:18:08.000Z | python/testData/quickFixes/PyRenameElementQuickFixTest/renameInInjectedFragment_after.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 173 | 2018-07-05T13:59:39.000Z | 2018-08-09T01:12:03.000Z | python/testData/quickFixes/PyRenameElementQuickFixTest/renameInInjectedFragment_after.py | Cyril-lamirand/intellij-community | 60ab6c61b82fc761dd68363eca7d9d69663cfa39 | [
"Apache-2.0"
] | 2 | 2020-03-15T08:57:37.000Z | 2020-04-07T04:48:14.000Z | a = """
def f():
a = 1
""" | 7.5 | 9 | 0.233333 |
79539722f7b24bd61da5836b034d40c6bbdb15ba | 871 | py | Python | rename.py | michaelczhou/travel_mod | 198ac84f012ba7acca1c58b895a5edffaf8360e3 | [
"MIT"
] | null | null | null | rename.py | michaelczhou/travel_mod | 198ac84f012ba7acca1c58b895a5edffaf8360e3 | [
"MIT"
] | null | null | null | rename.py | michaelczhou/travel_mod | 198ac84f012ba7acca1c58b895a5edffaf8360e3 | [
"MIT"
] | null | null | null | import os
import sys
def rename():
count = 1
#path = sys.path[0] #得到文件路径
#path = "/home/zc/Downloads/datesets/data2018/g"
path = "/home/zc/project/travel_mod-build/g/"
#path = "/home/zc/project/travel_mod-build/label/commit/"
filelist = os.listdir(path) #得到文件名字
print(filelist)
for files in filelist:
oldpath = os.path.join(path, files) # 原来的文件路径
#print(oldpath)
if os.path.isdir(oldpath): #如果是文件夹则跳过
continue
#filename = os.path.splitext(files)[0] # 文件名
filetype = os.path.splitext(files)[1] # 文件扩展名
#print(filename,"in ",filetype)
newpath = os.path.join(path,"{:0>4d}".format(count)+filetype)
# if not os.path.isfile(newpath)
os.rename(oldpath, newpath) #重命名
print(newpath, 'ok')
count += 1
rename() | 34.84 | 69 | 0.58209 |
7953983cf2b03811a6284bae939a2c560007ca14 | 2,714 | py | Python | tempest/api_schema/response/compute/v2_1/quotas.py | KiranPawar72/tempest | 1fef3dd92b083055793065dd0693454735ec2c01 | [
"Apache-2.0"
] | 3 | 2016-07-15T12:27:23.000Z | 2021-04-23T04:41:10.000Z | tempest/lib/api_schema/response/compute/v2_1/quotas.py | LIS/lis-tempest | 8e6403b2d6de81c5d18ed867b4977385c8278b75 | [
"Apache-2.0"
] | null | null | null | tempest/lib/api_schema/response/compute/v2_1/quotas.py | LIS/lis-tempest | 8e6403b2d6de81c5d18ed867b4977385c8278b75 | [
"Apache-2.0"
] | 12 | 2016-07-14T18:13:05.000Z | 2017-07-08T18:45:42.000Z | # Copyright 2014 NEC Corporation. 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.
import copy
update_quota_set = {
'status_code': [200],
'response_body': {
'type': 'object',
'properties': {
'quota_set': {
'type': 'object',
'properties': {
'instances': {'type': 'integer'},
'cores': {'type': 'integer'},
'ram': {'type': 'integer'},
'floating_ips': {'type': 'integer'},
'fixed_ips': {'type': 'integer'},
'metadata_items': {'type': 'integer'},
'key_pairs': {'type': 'integer'},
'security_groups': {'type': 'integer'},
'security_group_rules': {'type': 'integer'},
'server_group_members': {'type': 'integer'},
'server_groups': {'type': 'integer'},
'injected_files': {'type': 'integer'},
'injected_file_content_bytes': {'type': 'integer'},
'injected_file_path_bytes': {'type': 'integer'}
},
'additionalProperties': False,
# NOTE: server_group_members and server_groups are represented
# when enabling quota_server_group extension. So they should
# not be required.
'required': ['instances', 'cores', 'ram',
'floating_ips', 'fixed_ips',
'metadata_items', 'key_pairs',
'security_groups', 'security_group_rules',
'injected_files', 'injected_file_content_bytes',
'injected_file_path_bytes']
}
},
'additionalProperties': False,
'required': ['quota_set']
}
}
get_quota_set = copy.deepcopy(update_quota_set)
get_quota_set['response_body']['properties']['quota_set']['properties'][
'id'] = {'type': 'string'}
get_quota_set['response_body']['properties']['quota_set']['required'].extend([
'id'])
delete_quota = {
'status_code': [202]
}
| 41.121212 | 78 | 0.537583 |
79539a3091e38a4253e4e77152e8de1b4bdc75af | 2,775 | py | Python | Lib/fontTools/pens/boundsPen.py | RimeOCRLIB/fonttools | af18936984da9ecdc984e4d521cf52934d47007d | [
"Adobe-Glyph"
] | null | null | null | Lib/fontTools/pens/boundsPen.py | RimeOCRLIB/fonttools | af18936984da9ecdc984e4d521cf52934d47007d | [
"Adobe-Glyph"
] | null | null | null | Lib/fontTools/pens/boundsPen.py | RimeOCRLIB/fonttools | af18936984da9ecdc984e4d521cf52934d47007d | [
"Adobe-Glyph"
] | 1 | 2019-08-14T15:57:38.000Z | 2019-08-14T15:57:38.000Z | from __future__ import print_function, division, absolute_import
from fontTools.misc.py23 import *
from fontTools.misc.arrayTools import updateBounds, pointInRect, unionRect
from fontTools.misc.bezierTools import calcCubicBounds, calcQuadraticBounds
from fontTools.pens.basePen import BasePen
__all__ = ["BoundsPen", "ControlBoundsPen"]
class ControlBoundsPen(BasePen):
"""Pen to calculate the "control bounds" of a shape. This is the
bounding box of all control points, so may be larger than the
actual bounding box if there are curves that don't have points
on their extremes.
When the shape has been drawn, the bounds are available as the
'bounds' attribute of the pen object. It's a 4-tuple:
(xMin, yMin, xMax, yMax).
If 'ignoreSinglePoints' is True, single points are ignored.
"""
def __init__(self, glyphSet, ignoreSinglePoints=False):
BasePen.__init__(self, glyphSet)
self.ignoreSinglePoints = ignoreSinglePoints
self.bounds = None
self._start = None
def _moveTo(self, pt):
self._start = pt
if not self.ignoreSinglePoints:
self._addMoveTo()
def _addMoveTo(self):
if self._start is None:
return
bounds = self.bounds
if bounds:
self.bounds = updateBounds(bounds, self._start)
else:
x, y = self._start
self.bounds = (x, y, x, y)
self._start = None
def _lineTo(self, pt):
self._addMoveTo()
self.bounds = updateBounds(self.bounds, pt)
def _curveToOne(self, bcp1, bcp2, pt):
self._addMoveTo()
bounds = self.bounds
bounds = updateBounds(bounds, bcp1)
bounds = updateBounds(bounds, bcp2)
bounds = updateBounds(bounds, pt)
self.bounds = bounds
def _qCurveToOne(self, bcp, pt):
self._addMoveTo()
bounds = self.bounds
bounds = updateBounds(bounds, bcp)
bounds = updateBounds(bounds, pt)
self.bounds = bounds
class BoundsPen(ControlBoundsPen):
"""Pen to calculate the bounds of a shape. It calculates the
correct bounds even when the shape contains curves that don't
have points on their extremes. This is somewhat slower to compute
than the "control bounds".
When the shape has been drawn, the bounds are available as the
'bounds' attribute of the pen object. It's a 4-tuple:
(xMin, yMin, xMax, yMax)
"""
def _curveToOne(self, bcp1, bcp2, pt):
self._addMoveTo()
bounds = self.bounds
bounds = updateBounds(bounds, pt)
if not pointInRect(bcp1, bounds) or not pointInRect(bcp2, bounds):
bounds = unionRect(bounds, calcCubicBounds(
self._getCurrentPoint(), bcp1, bcp2, pt))
self.bounds = bounds
def _qCurveToOne(self, bcp, pt):
self._addMoveTo()
bounds = self.bounds
bounds = updateBounds(bounds, pt)
if not pointInRect(bcp, bounds):
bounds = unionRect(bounds, calcQuadraticBounds(
self._getCurrentPoint(), bcp, pt))
self.bounds = bounds
| 28.90625 | 75 | 0.734775 |
79539b34451626856df2559112fcd02fb12d62fe | 2,012 | py | Python | airflow/api/common/experimental/get_dag_runs.py | InigoSJ/airflow | 8b97a387dc30d8c88390d500ec99333798c20f1c | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 3 | 2019-10-03T21:38:59.000Z | 2019-10-04T00:39:03.000Z | airflow/api/common/experimental/get_dag_runs.py | InigoSJ/airflow | 8b97a387dc30d8c88390d500ec99333798c20f1c | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 7 | 2019-03-27T07:58:14.000Z | 2020-02-12T17:42:33.000Z | airflow/api/common/experimental/get_dag_runs.py | upjohnc/airflow-upjohn-k8s | caadbc1618d73e054de99138b0892cea3a9327c4 | [
"Apache-2.0",
"BSD-2-Clause",
"MIT",
"ECL-2.0",
"BSD-3-Clause"
] | 5 | 2017-06-19T19:55:47.000Z | 2020-10-10T00:49:20.000Z | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you 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.
"""DAG runs APIs."""
from typing import Optional, List, Dict, Any
from flask import url_for
from airflow.api.common.experimental import check_and_get_dag
from airflow.models import DagRun
def get_dag_runs(dag_id: str, state: Optional[str] = None) -> List[Dict[str, Any]]:
"""
Returns a list of Dag Runs for a specific DAG ID.
:param dag_id: String identifier of a DAG
:param state: queued|running|success...
:return: List of DAG runs of a DAG with requested state,
or all runs if the state is not specified
"""
check_and_get_dag(dag_id=dag_id)
dag_runs = list()
state = state.lower() if state else None
for run in DagRun.find(dag_id=dag_id, state=state):
dag_runs.append({
'id': run.id,
'run_id': run.run_id,
'state': run.state,
'dag_id': run.dag_id,
'execution_date': run.execution_date.isoformat(),
'start_date': ((run.start_date or '') and
run.start_date.isoformat()),
'dag_run_url': url_for('Airflow.graph', dag_id=run.dag_id,
execution_date=run.execution_date)
})
return dag_runs
| 37.259259 | 83 | 0.675447 |
79539b4fdd83ec200a19d95b7f4f9e9c20582825 | 130 | py | Python | codigo/Live01/basic_botle.py | cassiasamp/live-de-python | 00b5e51793097544ba9b75c97a0d30e63970bf45 | [
"MIT"
] | 572 | 2018-04-03T03:17:08.000Z | 2022-03-31T19:05:32.000Z | codigo/Live01/basic_botle.py | cassiasamp/live-de-python | 00b5e51793097544ba9b75c97a0d30e63970bf45 | [
"MIT"
] | 176 | 2018-05-18T15:56:16.000Z | 2022-03-28T20:39:07.000Z | codigo/Live01/basic_botle.py | cassiasamp/live-de-python | 00b5e51793097544ba9b75c97a0d30e63970bf45 | [
"MIT"
] | 140 | 2018-04-18T13:59:11.000Z | 2022-03-29T00:43:49.000Z | from bottle import route, run
@route('/')
def index():
return "<h1>olá pessoas</h1>"
if __name__ == '__main__':
run()
| 11.818182 | 33 | 0.6 |
79539bcb8efaa5cf164d1ddcde690d0e2ed47eef | 2,591 | py | Python | test/utils/test_cnn.py | q759729997/qytPytorch | b9b4b6aeff67596c493871c0842dc72c5b66c548 | [
"Apache-2.0"
] | null | null | null | test/utils/test_cnn.py | q759729997/qytPytorch | b9b4b6aeff67596c493871c0842dc72c5b66c548 | [
"Apache-2.0"
] | null | null | null | test/utils/test_cnn.py | q759729997/qytPytorch | b9b4b6aeff67596c493871c0842dc72c5b66c548 | [
"Apache-2.0"
] | null | null | null | """
main_module - CNN工具类,测试时将对应方法的@unittest.skip注释掉.
Main members:
# __main__ - 程序入口.
"""
import sys
import unittest
import torch
from torch import nn
sys.path.insert(0, './') # 定义搜索路径的优先顺序,序号从0开始,表示最大优先级
import qytPytorch # noqa
print('qytPytorch module path :{}'.format(qytPytorch.__file__)) # 输出测试模块文件位置
from qytPytorch.utils.cnn_utils import get_Conv2d_out_shape # noqa
from qytPytorch.utils.cnn_utils import get_MaxPool2d_out_shape # noqa
class TestCNN(unittest.TestCase):
"""CNN工具类.
Main methods:
test_get_Conv2d_out_shape - 计算2维卷积输出形状.
test_get_MaxPool2d_out_shape - 计算2维池化层输出形状.
"""
@unittest.skip('debug')
def test_get_Conv2d_out_shape(self):
"""计算2维卷积输出形状.
"""
print('{} test_get_Conv2d_out_shape {}'.format('-'*15, '-'*15))
net = nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=2, kernel_size=3)
)
x = torch.ones(8, 1, 28, 28) # 批量大小, 通道, 高, 宽
y = net(x)
print(y.shape) # torch.Size([8, 2, 26, 26])
print(get_Conv2d_out_shape(input_shape=x.shape, out_channels=2, kernel_size=3)) # torch.Size([8, 2, 26, 26])
net = nn.Sequential(
nn.Conv2d(in_channels=1, out_channels=2, kernel_size=3, stride=3, padding=1)
)
x = torch.ones(8, 1, 28, 28) # 批量大小, 通道, 高, 宽
y = net(x)
print(y.shape) # torch.Size([8, 2, 10, 10])
print(get_Conv2d_out_shape(input_shape=x.shape, out_channels=2, kernel_size=3, stride=3, padding=1)) # (8, 2, 10, 10)
# @unittest.skip('debug')
def test_get_MaxPool2d_out_shape(self):
"""计算2维池化层输出形状.
"""
print('{} test_get_MaxPool2d_out_shape {}'.format('-'*15, '-'*15))
net = nn.Sequential(
nn.MaxPool2d(kernel_size=3, stride=1) # the stride of the window. Default value is kernel_size
)
x = torch.ones(8, 1, 28, 28) # 批量大小, 通道, 高, 宽
y = net(x)
print(y.shape) # torch.Size([8, 1, 26, 26])
print(get_MaxPool2d_out_shape(input_shape=x.shape, kernel_size=3)) # (8, 1, 26, 26)
net = nn.Sequential(
nn.MaxPool2d(kernel_size=3, stride=3, padding=1)
)
x = torch.ones(8, 1, 28, 28) # 批量大小, 通道, 高, 宽
y = net(x)
print(y.shape) # torch.Size([8, 1, 10, 10])
print(get_MaxPool2d_out_shape(input_shape=x.shape, kernel_size=3, stride=3, padding=1)) # (8, 1, 10, 10)
if __name__ == "__main__":
unittest.main() # 运行当前源文件中的所有测试用例
| 35.986111 | 127 | 0.59012 |
79539c5abdb6274dcf63a4557cb0afc4f6f30a0b | 3,328 | py | Python | test/test_engine.py | kvonkoni/osler | 6aec649548e1cd609decaaa0f6a91a8d6884bf60 | [
"MIT"
] | null | null | null | test/test_engine.py | kvonkoni/osler | 6aec649548e1cd609decaaa0f6a91a8d6884bf60 | [
"MIT"
] | null | null | null | test/test_engine.py | kvonkoni/osler | 6aec649548e1cd609decaaa0f6a91a8d6884bf60 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import os, sys, unittest
lib_path = os.path.abspath(os.path.join('..'))
sys.path.append(lib_path)
from osler.assertion import Assertion
from osler.criterion import Criterion
from osler.diagnosis import Diagnosis
from osler.issue import Issue
from osler.graph import Node
from osler.engine import Matrix
class TestEngine(unittest.TestCase):
def test_init(self):
#Defining assertions
assertionA = Assertion("assertion A")
assertionB = Assertion("assertion B")
assertionC = Assertion("assertion C")
assertionD = Assertion("assertion D")
assertionE = Assertion("assertion E")
assertionX = Assertion("assertion X")
assertionY = Assertion("assertion Y")
#Defining criteria
criterionA = Criterion(assertionA, True)
criterionC = Criterion(assertionC, True)
criterionD = Criterion(assertionD, True)
criterionE = Criterion(assertionE, True)
criterionNA = Criterion(assertionA, False)
criterionNB = Criterion(assertionB, False)
criterionNC = Criterion(assertionC, False)
criterionND = Criterion(assertionD, False)
criterionNE = Criterion(assertionE, False)
criterionX = Criterion(assertionX, True)
criterionY = Criterion(assertionY, False)
#Defining diagnoses
diagnosis1 = Diagnosis('Diagnosis 1', {criterionA, criterionNB, criterionC, criterionX}, 0.2)
diagnosis2 = Diagnosis('Diagnosis 2', {criterionNA, criterionNC, criterionD, criterionY, criterionX}, 0.2)
diagnosis3 = Diagnosis('Diagnosis 3', {criterionNA, criterionC, criterionX}, 0.2)
diagnosis4 = Diagnosis('Diagnosis 4', {criterionNA, criterionNC, criterionND, criterionE, criterionX}, 0.2)
diagnosis5 = Diagnosis('Diagnosis 5', {criterionNA, criterionNC, criterionND, criterionNE, criterionX}, 0.2)
#Defining an issue
issue = Issue('Issue I', {diagnosis1, diagnosis2, diagnosis3, diagnosis4, diagnosis5})
#Building a test tree using the engine
matrix = Matrix(issue)
matrix.construct_tree()
#Building a test tree manually
#For diagnosis 1
#I->C->A->1
inode = Node(issue)
aCnode = assertionC.parent(inode)
cCnode = criterionC.parent(aCnode)
aAnode = assertionA.parent(cCnode)
cAnode = criterionA.parent(aAnode)
diagnosis1.parent(cAnode)
#For diagnosis 2
#I->C->D->2
cNCnode = criterionNC.parent(aCnode)
aDnode = assertionD.parent(cNCnode)
cDnode = criterionD.parent(aDnode)
diagnosis2.parent(cDnode)
#For diagnosis 3
#I->C->A->3
cNAnode = criterionNA.parent(aAnode)
diagnosis3.parent(cNAnode)
#For diagnosis 4
#I->C->D->->E->4
cNDnode = criterionND.parent(aDnode)
aEnode = assertionE.parent(cNDnode)
cEnode = criterionE.parent(aEnode)
diagnosis4.parent(cEnode)
#For diagnosis 4
#I->C->D->->E->4
cNEnode = criterionNE.parent(aEnode)
diagnosis5.parent(cNEnode)
# Assert that the manually-generated tree is equal to the engine-generated tree
self.assertEqual(matrix.node, inode)
if __name__ == '__main__':
unittest.main()
| 30.254545 | 116 | 0.654748 |
79539e73b19a3ab7611ed7c046028c12453ee7a4 | 430 | py | Python | venv/Scripts/easy_install-3.7-script.py | Rr-shan/100days | d8b25686350dd89f2253d5e077aebe5099090a70 | [
"MIT"
] | 1 | 2020-05-13T13:50:55.000Z | 2020-05-13T13:50:55.000Z | venv/Scripts/easy_install-3.7-script.py | Rr-shan/100days | d8b25686350dd89f2253d5e077aebe5099090a70 | [
"MIT"
] | null | null | null | venv/Scripts/easy_install-3.7-script.py | Rr-shan/100days | d8b25686350dd89f2253d5e077aebe5099090a70 | [
"MIT"
] | null | null | null | #!E:\100days\venv\Scripts\python.exe
# EASY-INSTALL-ENTRY-SCRIPT: 'setuptools==40.8.0','console_scripts','easy_install-3.7'
__requires__ = 'setuptools==40.8.0'
import re
import sys
from pkg_resources import load_entry_point
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0])
sys.exit(
load_entry_point('setuptools==40.8.0', 'console_scripts', 'easy_install-3.7')()
)
| 33.076923 | 87 | 0.681395 |
79539f171b11d067d372dd7f773b3f28ca1c0d21 | 5,696 | py | Python | caller.py | xopherw/algotrader | 6daafe165d7eb4d5d34b2a7051e102f15bcb71dd | [
"MIT"
] | null | null | null | caller.py | xopherw/algotrader | 6daafe165d7eb4d5d34b2a7051e102f15bcb71dd | [
"MIT"
] | null | null | null | caller.py | xopherw/algotrader | 6daafe165d7eb4d5d34b2a7051e102f15bcb71dd | [
"MIT"
] | 1 | 2022-01-19T14:49:42.000Z | 2022-01-19T14:49:42.000Z | import requests, datetime as dt, numpy as np, pandas as pd, pytz
from dateutil.relativedelta import relativedelta
# Call for raw data (NASDAQ)
def nsdq_data(ticker):
try:
today = dt.datetime.now(pytz.timezone('US/Eastern')).date()
past = today - relativedelta(years= 5)
price = current_price(ticker.upper())
new_data = {"date" : today.strftime("%m/%d/%Y"), "close" : price}
headers = {'user-agent' : "-"}
url = "https://api.nasdaq.com/api"
post = f"/quote/{ticker.upper()}/historical"
params = {
"assetclass" : "stocks",
"fromdate" : past,
"limit" : '100000',
}
r = requests.get(url + post, headers=headers, params=params).json()
# data cleaning and formatting
# Remove unnecessary data and reverse order
data = pd.DataFrame(r["data"]["tradesTable"]["rows"][::-1])
data[['close']] = data[['close']].replace('\$|,', '', regex=True).astype(float) # Convert 'close' to float type
data = data.append(new_data, ignore_index=True) # Append latest data (aproaching closing time)
# Calculate and add ema3, ema10, and slope to data
ema3 = data['close'].ewm(span=3, adjust=False).mean()
ema10 = data['close'].ewm(span=10, adjust=False).mean()
slope= np.gradient(data['close'])
data['ema3'] = ema3
data['ema10'] = ema10
data['slope'] = slope
return data
except Exception as e:
print("NSDQ Data Error: ", e)
pass
# Call for current price
def current_price(ticker):
try:
url = f"https://api.nasdaq.com/api/quote/{ticker}/info?assetclass=stocks"
headers = {'user-agent' : "-"}
r = requests.get(url, headers=headers).json()['data']
return round(float(r['primaryData']['lastSalePrice'].strip('$')), 2)
except Exception as e:
print("Current Price Error:", e)
pass
# Call for order
def order(ticker, qty, order, api):
try:
side = "buy" if order else "sell"
url = "https://paper-api.alpaca.markets"
post = "/v2/orders"
headers = {
"APCA-API-KEY-ID" : api.alpaca_api,
"APCA-API-SECRET-KEY" : api.alpaca_secret,
}
params = {
"symbol" : ticker.upper(),
"qty" : str(qty),
"side" : side,
"type" : "market",
"time_in_force" : "day"
}
r = requests.post(url + post, headers=headers, json=params)
print("Status Code:", r.status_code)
except Exception as e:
print("Order Error:", e)
pass
# Call to list bought stocks
def stock_list(api):
try:
url = "https://paper-api.alpaca.markets"
post = "/v2/positions"
headers = {
"APCA-API-KEY-ID" : api.alpaca_api,
"APCA-API-SECRET-KEY" : api.alpaca_secret,
}
r = requests.get(url + post, headers=headers).json()
return r
except Exception as e:
print("Stock List Error:", e)
pass
# Call for stock quantity bought
def qty(ticker, api):
try:
url = "https://paper-api.alpaca.markets"
post = "/v2/positions/" + ticker.upper()
headers = {
"APCA-API-KEY-ID" : api.alpaca_api,
"APCA-API-SECRET-KEY" : api.alpaca_secret,
}
r = requests.get(url + post, headers=headers)
return r.json()["qty"] if(r.status_code == 200) else None
except Exception as e:
print("Quantity Error:", e)
pass
# Call for buying power
def money(api):
try:
url = "https://paper-api.alpaca.markets"
post = "/v2/account"
headers = {
"APCA-API-KEY-ID" : api.alpaca_api,
"APCA-API-SECRET-KEY" : api.alpaca_secret,
}
r = requests.get(url + post, headers=headers).json()["buying_power"]
money = round(float(r), 2)
return money
except Exception as e:
print("Buying Power Error:", e)
pass
# Call for calendar (check if holiday)
def calendar(date, api):
try:
url = "https://paper-api.alpaca.markets"
post = f"/v2/calendar"
headers = {
"APCA-API-KEY-ID" : api.alpaca_api,
"APCA-API-SECRET-KEY" : api.alpaca_secret,
}
params = {
"start" : date,
"end" : date,
}
r = requests.get(url + post, headers=headers, params=params).json()
d = r[0]["date"]
return d
except Exception as e:
print("Calendar Error:", e)
pass
# Call for open/close time (params: "Open" or "Clos" only, case senstive and no 'e' for "Clos")
def market_hour(market_time):
try:
url = "https://api.nasdaq.com/api/market-info"
headers = {'user-agent' : "-"}
r = requests.get(url, headers=headers).json()['data']
hour = dt.datetime.strptime(r[f'market{market_time}ingTime'].strip(' ET'),"%b %d, %Y %I:%M %p")
return hour
except Exception as e:
print("Market time Error:", e)
pass
# Call for next open time
def next_open_time(api):
try:
url = "https://paper-api.alpaca.markets"
post = f"/v2/clock"
headers = {
"APCA-API-KEY-ID" : api.alpaca_api,
"APCA-API-SECRET-KEY" : api.alpaca_secret,
}
r = requests.get(url + post, headers=headers).json()
next_open = dt.datetime.strptime(r['next_open'][:-6],"%Y-%m-%dT%H:%M:%S")
return next_open
except Exception as e:
print("Next open time Error:", e)
pass | 34.107784 | 119 | 0.548631 |
79539f6ea84b2c8c29327390a590b0bc95e6f68c | 1,897 | py | Python | test_merge.py | LeoWood/bert | bb916e2038e9c8360463e60678d999606f58ad0d | [
"Apache-2.0"
] | 1 | 2019-12-30T12:14:44.000Z | 2019-12-30T12:14:44.000Z | test_merge.py | LeoWood/bert | bb916e2038e9c8360463e60678d999606f58ad0d | [
"Apache-2.0"
] | null | null | null | test_merge.py | LeoWood/bert | bb916e2038e9c8360463e60678d999606f58ad0d | [
"Apache-2.0"
] | 1 | 2020-06-19T10:48:38.000Z | 2020-06-19T10:48:38.000Z | #!/usr/bin/env python
#-*- coding:utf-8 -*-
# Author: LiuHuan
# Datetime: 2019/6/21 10:45
from sklearn import metrics
import os
import pandas as pd
import tensorflow as tf
flags = tf.flags
FLAGS = flags.FLAGS
## Required parameters
flags.DEFINE_string(
"output_dir", None,
"output results dir")
flags.DEFINE_string(
"data_dir", None,
"The input data dir. Should contain the .tsv files (or other data files) "
"for the task.")
if __name__ == '__main__':
true_labels = []
with open(os.path.join(FLAGS.data_dir,'test.tsv'), 'r', encoding='utf-8') as f:
for line in f.readlines():
line = line.strip()
true_labels.append(int(line.split('\t')[0]))
results1 = pd.read_csv(os.path.join(FLAGS.output_dir,'mask_test_results.tsv'), sep='\t', names=['0', '1', '2', '3', '4'])
results2 = pd.read_csv(os.path.join(FLAGS.output_dir,'sen_test_results.tsv'), sep='\t', names=['0', '1', '2', '3', '4'])
df = results1 + results2
df.to_csv(os.path.join(FLAGS.output_dir,'test_results.csv'),index=False)
predictions = []
for i in range(len(df)):
a = df.iloc[i].tolist()
predictions.append(a.index(max(a)))
report = metrics.classification_report(y_true=true_labels,
y_pred=predictions,
labels=[4, 0, 1, 2, 3],
target_names=['Background', 'Objective', 'Methods', 'Results',
'Conclusions'], digits=4)
confution_matrix = metrics.confusion_matrix(y_true=true_labels,
y_pred=predictions, labels=[4, 3, 1, 0, 2])
print(report)
print(confution_matrix)
with open(os.path.join(FLAGS.output_dir, "eval_report.txt"), 'w', encoding='utf-8') as f:
f.write(report) | 37.94 | 125 | 0.574064 |
79539f8a521d976bffbaff98920b2a8d3a226599 | 1,699 | py | Python | picture/src/7MX.py | zjh567/py-scripts | d54c220de000d3a52615d7ed5652ad61741a41c5 | [
"Apache-2.0"
] | 2 | 2020-01-13T16:15:32.000Z | 2020-01-27T11:45:59.000Z | picture/src/7MX.py | zjh567/py-scripts | d54c220de000d3a52615d7ed5652ad61741a41c5 | [
"Apache-2.0"
] | null | null | null | picture/src/7MX.py | zjh567/py-scripts | d54c220de000d3a52615d7ed5652ad61741a41c5 | [
"Apache-2.0"
] | null | null | null | #coding=utf-8
import requests
import json
import os
import sys
import re
headers = {
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'Accept-Encoding': 'gzip, deflate',
'Accept-Language': 'en-US,en;q=0.5',
'Connection': 'keep-alive',
'Host': 'api.7mx.com',
'Upgrade-Insecure-Requests': 1,
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0',
}
def download(count, path):
path.replace(r"\\", "/")
filepath = path + '/' + str(count + 1)
os.makedirs(filepath, exist_ok=True)
url = 'http://api.7mx.com/media/category_recommend_list?line=' + str(count) + ',0,0&limit=40'
r = requests.get(url)
r.headers = headers
r.coding = 'utf-8'
html = r.text
j = json.loads(html)
data = j['data']
control = j['msg']
if control == '':
print('第 ' + str(count + 1) + '页下载开始')
j = 1
for ID in data:
img_url = ID['image']
# title = ID['title']
image_height = ID['image_height']
image_width = ID['image_width']
# img_name = str(j) + '_' + title + '_ 长:' + image_width + ' - 宽:' + image_height + '.jpg'
img_name = str(j) + '-' + image_width + '-' + image_height + '.jpg'
# r_name = re.compile('\/',re.M)
# img_name = r_name.sub('-',img_name)
res = requests.get(img_url)
res.headers = headers
f = open(filepath + '/%s' % img_name, 'wb')
for chunk in res.iter_content(chunk_size=20):
f.write(chunk)
print('正在下载为: ', img_name, ' 的第 ', j, ' 张图片')
j = j+1
print('图片链接为: ' + img_url)
print('第 ' + str(count + 1) + ' 页下载完成!')
else:
print('全部下载完成!')
sys.exit()
return download(count+1, path)
if __name__ == '__main__':
i = 0
filepath = input("./output/7MX.com/")
download(i, filepath)
| 27.403226 | 94 | 0.613891 |
79539fa18707fb2c5dddf7a543272153174ac5d6 | 2,357 | py | Python | tests/test_patterns.py | cofin/aiosql | d29a75e07ab1b13c369f15fe7813a1763fdd7f28 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | tests/test_patterns.py | cofin/aiosql | d29a75e07ab1b13c369f15fe7813a1763fdd7f28 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | tests/test_patterns.py | cofin/aiosql | d29a75e07ab1b13c369f15fe7813a1763fdd7f28 | [
"BSD-2-Clause-FreeBSD"
] | null | null | null | from aiosql.patterns import var_pattern
def test_var_pattern_is_quote_aware():
sql = """
select foo_id,
bar_id,
to_char(created_at, 'YYYY-MM-DD"T"HH24:MI:SSOF')
from foos
join bars using(bar_id)
join bazs using(baz_id)
where created_at < :created_at_mark
and foo_mark > :foo_mark
order by created_at desc, source_name asc;
"""
groupdicts = [m.groupdict() for m in var_pattern.finditer(sql)]
assert len(groupdicts) == 3
expected = [
{
"dblquote": None,
"lead": None,
"quote": "'YYYY-MM-DD\"T\"HH24:MI:SSOF'",
"trail": None,
"var_name": None,
},
{
"dblquote": None,
"lead": " ",
"quote": None,
"trail": "\n",
"var_name": "created_at_mark",
},
{"dblquote": None, "lead": " ", "quote": None, "trail": "\n", "var_name": "foo_mark"},
]
assert groupdicts == expected
def test_var_pattern_does_not_require_semicolon_trail():
"""Make sure keywords ending queries are recognized even without
semi-colons.
"""
sql = """
select a,
b,
c
FROM foo
WHERE a = :a"""
groupdicts = [m.groupdict() for m in var_pattern.finditer(sql)]
assert len(groupdicts) == 1
expected = {"dblquote": None, "lead": " ", "quote": None, "trail": "", "var_name": "a"}
assert groupdicts[0] == expected
def test_var_pattern_handles_empty_sql_string_literals():
"""Make sure SQL '' are treated correctly and don't cause a substitution to be skipped."""
sql = """
select blah
from foo
where lower(regexp_replace(blah,'\W','','g')) = lower(regexp_replace(:blah,'\W','','g'));"""
groupdicts = [m.groupdict() for m in var_pattern.finditer(sql)]
expected_single_quote_match = {
"dblquote": None,
"lead": None,
"quote": "''",
"trail": None,
"var_name": None,
}
assert groupdicts[1] == expected_single_quote_match
expected_var_match = {
"dblquote": None,
"lead": "(",
"quote": None,
"trail": ",",
"var_name": "blah",
}
assert groupdicts[3] == expected_var_match
| 28.39759 | 101 | 0.533305 |
7953a027c0df955a9c042654a605e034b2b77bf7 | 23,115 | py | Python | mmdet3d/models/dense_heads/anchor_free_mono3d_head.py | maskjp/mmdetection3d | 98f332372b1a4c82bc2d57588a5d764f4176c869 | [
"Apache-2.0"
] | 1 | 2022-03-04T19:29:42.000Z | 2022-03-04T19:29:42.000Z | mmdet3d/models/dense_heads/anchor_free_mono3d_head.py | maskjp/mmdetection3d | 98f332372b1a4c82bc2d57588a5d764f4176c869 | [
"Apache-2.0"
] | null | null | null | mmdet3d/models/dense_heads/anchor_free_mono3d_head.py | maskjp/mmdetection3d | 98f332372b1a4c82bc2d57588a5d764f4176c869 | [
"Apache-2.0"
] | null | null | null | # Copyright (c) OpenMMLab. All rights reserved.
from abc import abstractmethod
import torch
from mmcv.cnn import ConvModule, bias_init_with_prob, normal_init
from mmcv.runner import force_fp32
from torch import nn as nn
from mmdet.core import multi_apply
from mmdet.models.builder import HEADS, build_loss
from .base_mono3d_dense_head import BaseMono3DDenseHead
@HEADS.register_module()
class AnchorFreeMono3DHead(BaseMono3DDenseHead):
"""Anchor-free head for monocular 3D object detection.
Args:
num_classes (int): Number of categories excluding the background
category.
in_channels (int): Number of channels in the input feature map.
feat_channels (int, optional): Number of hidden channels.
Used in child classes. Defaults to 256.
stacked_convs (int, optional): Number of stacking convs of the head.
strides (tuple, optional): Downsample factor of each feature map.
dcn_on_last_conv (bool, optional): If true, use dcn in the last
layer of towers. Default: False.
conv_bias (bool | str, optional): If specified as `auto`, it will be
decided by the norm_cfg. Bias of conv will be set as True
if `norm_cfg` is None, otherwise False. Default: 'auto'.
background_label (int, optional): Label ID of background,
set as 0 for RPN and num_classes for other heads.
It will automatically set as `num_classes` if None is given.
use_direction_classifier (bool, optional):
Whether to add a direction classifier.
diff_rad_by_sin (bool, optional): Whether to change the difference
into sin difference for box regression loss. Defaults to True.
dir_offset (float, optional): Parameter used in direction
classification. Defaults to 0.
dir_limit_offset (float, optional): Parameter used in direction
classification. Defaults to 0.
loss_cls (dict, optional): Config of classification loss.
loss_bbox (dict, optional): Config of localization loss.
loss_dir (dict, optional): Config of direction classifier loss.
loss_attr (dict, optional): Config of attribute classifier loss,
which is only active when `pred_attrs=True`.
bbox_code_size (int, optional): Dimensions of predicted bounding boxes.
pred_attrs (bool, optional): Whether to predict attributes.
Defaults to False.
num_attrs (int, optional): The number of attributes to be predicted.
Default: 9.
pred_velo (bool, optional): Whether to predict velocity.
Defaults to False.
pred_bbox2d (bool, optional): Whether to predict 2D boxes.
Defaults to False.
group_reg_dims (tuple[int], optional): The dimension of each regression
target group. Default: (2, 1, 3, 1, 2).
cls_branch (tuple[int], optional): Channels for classification branch.
Default: (128, 64).
reg_branch (tuple[tuple], optional): Channels for regression branch.
Default: (
(128, 64), # offset
(128, 64), # depth
(64, ), # size
(64, ), # rot
() # velo
),
dir_branch (tuple[int], optional): Channels for direction
classification branch. Default: (64, ).
attr_branch (tuple[int], optional): Channels for classification branch.
Default: (64, ).
conv_cfg (dict, optional): Config dict for convolution layer.
Default: None.
norm_cfg (dict, optional): Config dict for normalization layer.
Default: None.
train_cfg (dict, optional): Training config of anchor head.
test_cfg (dict, optional): Testing config of anchor head.
""" # noqa: W605
_version = 1
def __init__(
self,
num_classes,
in_channels,
feat_channels=256,
stacked_convs=4,
strides=(4, 8, 16, 32, 64),
dcn_on_last_conv=False,
conv_bias='auto',
background_label=None,
use_direction_classifier=True,
diff_rad_by_sin=True,
dir_offset=0,
dir_limit_offset=0,
loss_cls=dict(
type='FocalLoss',
use_sigmoid=True,
gamma=2.0,
alpha=0.25,
loss_weight=1.0),
loss_bbox=dict(
type='SmoothL1Loss', beta=1.0 / 9.0, loss_weight=1.0),
loss_dir=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
loss_attr=dict(
type='CrossEntropyLoss', use_sigmoid=False, loss_weight=1.0),
bbox_code_size=9, # For nuscenes
pred_attrs=False,
num_attrs=9, # For nuscenes
pred_velo=False,
pred_bbox2d=False,
group_reg_dims=(2, 1, 3, 1, 2), # offset, depth, size, rot, velo,
cls_branch=(128, 64),
reg_branch=(
(128, 64), # offset
(128, 64), # depth
(64, ), # size
(64, ), # rot
() # velo
),
dir_branch=(64, ),
attr_branch=(64, ),
conv_cfg=None,
norm_cfg=None,
train_cfg=None,
test_cfg=None,
init_cfg=None):
super(AnchorFreeMono3DHead, self).__init__(init_cfg=init_cfg)
self.num_classes = num_classes
self.cls_out_channels = num_classes
self.in_channels = in_channels
self.feat_channels = feat_channels
self.stacked_convs = stacked_convs
self.strides = strides
self.dcn_on_last_conv = dcn_on_last_conv
assert conv_bias == 'auto' or isinstance(conv_bias, bool)
self.conv_bias = conv_bias
self.use_direction_classifier = use_direction_classifier
self.diff_rad_by_sin = diff_rad_by_sin
self.dir_offset = dir_offset
self.dir_limit_offset = dir_limit_offset
self.loss_cls = build_loss(loss_cls)
self.loss_bbox = build_loss(loss_bbox)
self.loss_dir = build_loss(loss_dir)
self.bbox_code_size = bbox_code_size
self.group_reg_dims = list(group_reg_dims)
self.cls_branch = cls_branch
self.reg_branch = reg_branch
assert len(reg_branch) == len(group_reg_dims), 'The number of '\
'element in reg_branch and group_reg_dims should be the same.'
self.pred_velo = pred_velo
self.pred_bbox2d = pred_bbox2d
self.out_channels = []
for reg_branch_channels in reg_branch:
if len(reg_branch_channels) > 0:
self.out_channels.append(reg_branch_channels[-1])
else:
self.out_channels.append(-1)
self.dir_branch = dir_branch
self.train_cfg = train_cfg
self.test_cfg = test_cfg
self.conv_cfg = conv_cfg
self.norm_cfg = norm_cfg
self.fp16_enabled = False
self.background_label = (
num_classes if background_label is None else background_label)
# background_label should be either 0 or num_classes
assert (self.background_label == 0
or self.background_label == num_classes)
self.pred_attrs = pred_attrs
self.attr_background_label = -1
self.num_attrs = num_attrs
if self.pred_attrs:
self.attr_background_label = num_attrs
self.loss_attr = build_loss(loss_attr)
self.attr_branch = attr_branch
self._init_layers()
def _init_layers(self):
"""Initialize layers of the head."""
self._init_cls_convs()
self._init_reg_convs()
self._init_predictor()
def _init_cls_convs(self):
"""Initialize classification conv layers of the head."""
self.cls_convs = nn.ModuleList()
for i in range(self.stacked_convs):
chn = self.in_channels if i == 0 else self.feat_channels
if self.dcn_on_last_conv and i == self.stacked_convs - 1:
conv_cfg = dict(type='DCNv2')
else:
conv_cfg = self.conv_cfg
self.cls_convs.append(
ConvModule(
chn,
self.feat_channels,
3,
stride=1,
padding=1,
conv_cfg=conv_cfg,
norm_cfg=self.norm_cfg,
bias=self.conv_bias))
def _init_reg_convs(self):
"""Initialize bbox regression conv layers of the head."""
self.reg_convs = nn.ModuleList()
for i in range(self.stacked_convs):
chn = self.in_channels if i == 0 else self.feat_channels
if self.dcn_on_last_conv and i == self.stacked_convs - 1:
conv_cfg = dict(type='DCNv2')
else:
conv_cfg = self.conv_cfg
self.reg_convs.append(
ConvModule(
chn,
self.feat_channels,
3,
stride=1,
padding=1,
conv_cfg=conv_cfg,
norm_cfg=self.norm_cfg,
bias=self.conv_bias))
def _init_branch(self, conv_channels=(64), conv_strides=(1)):
"""Initialize conv layers as a prediction branch."""
conv_before_pred = nn.ModuleList()
if isinstance(conv_channels, int):
conv_channels = [self.feat_channels] + [conv_channels]
conv_strides = [conv_strides]
else:
conv_channels = [self.feat_channels] + list(conv_channels)
conv_strides = list(conv_strides)
for i in range(len(conv_strides)):
conv_before_pred.append(
ConvModule(
conv_channels[i],
conv_channels[i + 1],
3,
stride=conv_strides[i],
padding=1,
conv_cfg=self.conv_cfg,
norm_cfg=self.norm_cfg,
bias=self.conv_bias))
return conv_before_pred
def _init_predictor(self):
"""Initialize predictor layers of the head."""
self.conv_cls_prev = self._init_branch(
conv_channels=self.cls_branch,
conv_strides=(1, ) * len(self.cls_branch))
self.conv_cls = nn.Conv2d(self.cls_branch[-1], self.cls_out_channels,
1)
self.conv_reg_prevs = nn.ModuleList()
self.conv_regs = nn.ModuleList()
for i in range(len(self.group_reg_dims)):
reg_dim = self.group_reg_dims[i]
reg_branch_channels = self.reg_branch[i]
out_channel = self.out_channels[i]
if len(reg_branch_channels) > 0:
self.conv_reg_prevs.append(
self._init_branch(
conv_channels=reg_branch_channels,
conv_strides=(1, ) * len(reg_branch_channels)))
self.conv_regs.append(nn.Conv2d(out_channel, reg_dim, 1))
else:
self.conv_reg_prevs.append(None)
self.conv_regs.append(
nn.Conv2d(self.feat_channels, reg_dim, 1))
if self.use_direction_classifier:
self.conv_dir_cls_prev = self._init_branch(
conv_channels=self.dir_branch,
conv_strides=(1, ) * len(self.dir_branch))
self.conv_dir_cls = nn.Conv2d(self.dir_branch[-1], 2, 1)
if self.pred_attrs:
self.conv_attr_prev = self._init_branch(
conv_channels=self.attr_branch,
conv_strides=(1, ) * len(self.attr_branch))
self.conv_attr = nn.Conv2d(self.attr_branch[-1], self.num_attrs, 1)
def init_weights(self):
"""Initialize weights of the head.
We currently still use the customized defined init_weights because the
default init of DCN triggered by the init_cfg will init
conv_offset.weight, which mistakenly affects the training stability.
"""
for modules in [self.cls_convs, self.reg_convs, self.conv_cls_prev]:
for m in modules:
if isinstance(m.conv, nn.Conv2d):
normal_init(m.conv, std=0.01)
for conv_reg_prev in self.conv_reg_prevs:
if conv_reg_prev is None:
continue
for m in conv_reg_prev:
if isinstance(m.conv, nn.Conv2d):
normal_init(m.conv, std=0.01)
if self.use_direction_classifier:
for m in self.conv_dir_cls_prev:
if isinstance(m.conv, nn.Conv2d):
normal_init(m.conv, std=0.01)
if self.pred_attrs:
for m in self.conv_attr_prev:
if isinstance(m.conv, nn.Conv2d):
normal_init(m.conv, std=0.01)
bias_cls = bias_init_with_prob(0.01)
normal_init(self.conv_cls, std=0.01, bias=bias_cls)
for conv_reg in self.conv_regs:
normal_init(conv_reg, std=0.01)
if self.use_direction_classifier:
normal_init(self.conv_dir_cls, std=0.01, bias=bias_cls)
if self.pred_attrs:
normal_init(self.conv_attr, std=0.01, bias=bias_cls)
def forward(self, feats):
"""Forward features from the upstream network.
Args:
feats (tuple[Tensor]): Features from the upstream network, each is
a 4D-tensor.
Returns:
tuple: Usually contain classification scores, bbox predictions,
and direction class predictions.
cls_scores (list[Tensor]): Box scores for each scale level,
each is a 4D-tensor, the channel number is
num_points * num_classes.
bbox_preds (list[Tensor]): Box energies / deltas for each scale
level, each is a 4D-tensor, the channel number is
num_points * bbox_code_size.
dir_cls_preds (list[Tensor]): Box scores for direction class
predictions on each scale level, each is a 4D-tensor,
the channel number is num_points * 2. (bin = 2)
attr_preds (list[Tensor]): Attribute scores for each scale
level, each is a 4D-tensor, the channel number is
num_points * num_attrs.
"""
return multi_apply(self.forward_single, feats)[:5]
def forward_single(self, x):
"""Forward features of a single scale level.
Args:
x (Tensor): FPN feature maps of the specified stride.
Returns:
tuple: Scores for each class, bbox predictions, direction class,
and attributes, features after classification and regression
conv layers, some models needs these features like FCOS.
"""
cls_feat = x
reg_feat = x
for cls_layer in self.cls_convs:
cls_feat = cls_layer(cls_feat)
# clone the cls_feat for reusing the feature map afterwards
clone_cls_feat = cls_feat.clone()
for conv_cls_prev_layer in self.conv_cls_prev:
clone_cls_feat = conv_cls_prev_layer(clone_cls_feat)
cls_score = self.conv_cls(clone_cls_feat)
for reg_layer in self.reg_convs:
reg_feat = reg_layer(reg_feat)
bbox_pred = []
for i in range(len(self.group_reg_dims)):
# clone the reg_feat for reusing the feature map afterwards
clone_reg_feat = reg_feat.clone()
if len(self.reg_branch[i]) > 0:
for conv_reg_prev_layer in self.conv_reg_prevs[i]:
clone_reg_feat = conv_reg_prev_layer(clone_reg_feat)
bbox_pred.append(self.conv_regs[i](clone_reg_feat))
bbox_pred = torch.cat(bbox_pred, dim=1)
dir_cls_pred = None
if self.use_direction_classifier:
clone_reg_feat = reg_feat.clone()
for conv_dir_cls_prev_layer in self.conv_dir_cls_prev:
clone_reg_feat = conv_dir_cls_prev_layer(clone_reg_feat)
dir_cls_pred = self.conv_dir_cls(clone_reg_feat)
attr_pred = None
if self.pred_attrs:
# clone the cls_feat for reusing the feature map afterwards
clone_cls_feat = cls_feat.clone()
for conv_attr_prev_layer in self.conv_attr_prev:
clone_cls_feat = conv_attr_prev_layer(clone_cls_feat)
attr_pred = self.conv_attr(clone_cls_feat)
return cls_score, bbox_pred, dir_cls_pred, attr_pred, cls_feat, \
reg_feat
@abstractmethod
@force_fp32(apply_to=('cls_scores', 'bbox_preds', 'dir_cls_preds'))
def loss(self,
cls_scores,
bbox_preds,
dir_cls_preds,
attr_preds,
gt_bboxes,
gt_labels,
gt_bboxes_3d,
gt_labels_3d,
centers2d,
depths,
attr_labels,
img_metas,
gt_bboxes_ignore=None):
"""Compute loss of the head.
Args:
cls_scores (list[Tensor]): Box scores for each scale level,
each is a 4D-tensor, the channel number is
num_points * num_classes.
bbox_preds (list[Tensor]): Box energies / deltas for each scale
level, each is a 4D-tensor, the channel number is
num_points * bbox_code_size.
dir_cls_preds (list[Tensor]): Box scores for direction class
predictions on each scale level, each is a 4D-tensor,
the channel number is num_points * 2. (bin = 2)
attr_preds (list[Tensor]): Box scores for each scale level,
each is a 4D-tensor, the channel number is
num_points * num_attrs.
gt_bboxes (list[Tensor]): Ground truth bboxes for each image with
shape (num_gts, 4) in [tl_x, tl_y, br_x, br_y] format.
gt_labels (list[Tensor]): class indices corresponding to each box
gt_bboxes_3d (list[Tensor]): 3D Ground truth bboxes for each
image with shape (num_gts, bbox_code_size).
gt_labels_3d (list[Tensor]): 3D class indices of each box.
centers2d (list[Tensor]): Projected 3D centers onto 2D images.
depths (list[Tensor]): Depth of projected centers on 2D images.
attr_labels (list[Tensor], optional): Attribute indices
corresponding to each box
img_metas (list[dict]): Meta information of each image, e.g.,
image size, scaling factor, etc.
gt_bboxes_ignore (list[Tensor]): specify which bounding
boxes can be ignored when computing the loss.
"""
raise NotImplementedError
@abstractmethod
@force_fp32(apply_to=('cls_scores', 'bbox_preds', 'dir_cls_preds'))
def get_bboxes(self,
cls_scores,
bbox_preds,
dir_cls_preds,
attr_preds,
img_metas,
cfg=None,
rescale=None):
"""Transform network output for a batch into bbox predictions.
Args:
cls_scores (list[Tensor]): Box scores for each scale level
Has shape (N, num_points * num_classes, H, W)
bbox_preds (list[Tensor]): Box energies / deltas for each scale
level with shape (N, num_points * bbox_code_size, H, W)
dir_cls_preds (list[Tensor]): Box scores for direction class
predictions on each scale level, each is a 4D-tensor,
the channel number is num_points * 2. (bin = 2)
attr_preds (list[Tensor]): Attribute scores for each scale level
Has shape (N, num_points * num_attrs, H, W)
img_metas (list[dict]): Meta information of each image, e.g.,
image size, scaling factor, etc.
cfg (mmcv.Config): Test / postprocessing configuration,
if None, test_cfg would be used
rescale (bool): If True, return boxes in original image space
"""
raise NotImplementedError
@abstractmethod
def get_targets(self, points, gt_bboxes_list, gt_labels_list,
gt_bboxes_3d_list, gt_labels_3d_list, centers2d_list,
depths_list, attr_labels_list):
"""Compute regression, classification and centerss targets for points
in multiple images.
Args:
points (list[Tensor]): Points of each fpn level, each has shape
(num_points, 2).
gt_bboxes_list (list[Tensor]): Ground truth bboxes of each image,
each has shape (num_gt, 4).
gt_labels_list (list[Tensor]): Ground truth labels of each box,
each has shape (num_gt,).
gt_bboxes_3d_list (list[Tensor]): 3D Ground truth bboxes of each
image, each has shape (num_gt, bbox_code_size).
gt_labels_3d_list (list[Tensor]): 3D Ground truth labels of each
box, each has shape (num_gt,).
centers2d_list (list[Tensor]): Projected 3D centers onto 2D image,
each has shape (num_gt, 2).
depths_list (list[Tensor]): Depth of projected 3D centers onto 2D
image, each has shape (num_gt, 1).
attr_labels_list (list[Tensor]): Attribute labels of each box,
each has shape (num_gt,).
"""
raise NotImplementedError
def _get_points_single(self,
featmap_size,
stride,
dtype,
device,
flatten=False):
"""Get points of a single scale level."""
h, w = featmap_size
x_range = torch.arange(w, dtype=dtype, device=device)
y_range = torch.arange(h, dtype=dtype, device=device)
y, x = torch.meshgrid(y_range, x_range)
if flatten:
y = y.flatten()
x = x.flatten()
return y, x
def get_points(self, featmap_sizes, dtype, device, flatten=False):
"""Get points according to feature map sizes.
Args:
featmap_sizes (list[tuple]): Multi-level feature map sizes.
dtype (torch.dtype): Type of points.
device (torch.device): Device of points.
Returns:
tuple: points of each image.
"""
mlvl_points = []
for i in range(len(featmap_sizes)):
mlvl_points.append(
self._get_points_single(featmap_sizes[i], self.strides[i],
dtype, device, flatten))
return mlvl_points
| 43.205607 | 79 | 0.584253 |
7953a098b63a73948d05222c479c2ab04e32dcf4 | 711 | py | Python | test.py | nx-python/nx | eef890370950b2dec8be797d1e26113cfe457c2f | [
"ISC"
] | 16 | 2018-03-25T17:22:38.000Z | 2022-01-15T14:39:05.000Z | test.py | nx-python/nx | eef890370950b2dec8be797d1e26113cfe457c2f | [
"ISC"
] | 6 | 2018-05-14T18:50:56.000Z | 2020-04-29T03:45:10.000Z | test.py | nx-python/nx | eef890370950b2dec8be797d1e26113cfe457c2f | [
"ISC"
] | 8 | 2018-03-23T15:54:39.000Z | 2018-08-26T20:32:38.000Z | import nx
import shutil
BOTW_TITLE_ID = 0x01007ef00011e000
SAVEGAME_PATH = '0/game_data.sav'
OUTPUT_PATH = 'botw_0_game_data.sav'
def main():
botw = nx.titles[BOTW_TITLE_ID] # get botw Title object
try:
with botw.savedata as savedata: # mount BotW savedata partition
with savedata.open(SAVEGAME_PATH, 'rb') as savegame_file: # open save game file
with open(OUTPUT_PATH, 'wb') as destination_file: # open destination file on SD card
shutil.copyfileobj(savegame_file, destination_file) # copy file from savedata to SD card
except FileNotFoundError:
print("No such file:", SAVEGAME_PATH)
if __name__ == '__main__':
main()
| 29.625 | 109 | 0.684951 |
7953a21bcbd77cafccb7ff6974abb05e8cf3f365 | 2,353 | py | Python | main.py | panyam/blogcentral | 747a4e8dc0555c9e03069a2683f10c7d358acf75 | [
"Apache-2.0"
] | null | null | null | main.py | panyam/blogcentral | 747a4e8dc0555c9e03069a2683f10c7d358acf75 | [
"Apache-2.0"
] | 4 | 2020-12-04T20:32:40.000Z | 2022-02-13T13:00:15.000Z | main.py | panyam/blogcentral | 747a4e8dc0555c9e03069a2683f10c7d358acf75 | [
"Apache-2.0"
] | null | null | null |
# import googleclouddebugger
# googleclouddebugger.enable()
from flask import request, Flask, Blueprint, render_template, redirect, jsonify, session, send_from_directory
import blogcentral_config as bcconfigs
import utils
# If `entrypoint` is not defined in app.yaml, App Engine will look for an app
# called `app` in `main.py`.
app = Flask(__name__)
app.secret_key = bcconfigs.SESSION_SECRET_KEY
app.debug = True
app.json_encoder = utils.JsonEncoder
def common_properties(**extra_kwargs):
gsuite_marketplace_id = "712411571237"
out = dict(
company_name = "Blog Central",
gsuite_marketplace_id = f"{gsuite_marketplace_id}",
gsuite_marketplace_url = f"https://gsuite.google.com/marketplace/app/blogcentral/{gsuite_marketplace_id}",
last_updated_date = "March-16-2020",
servers_locations_label = "US",
retention_period_string = "30 days",
contact_email = "sri.panyam@gmail.com"
)
out["auth_results"] = session.get("auth_results", "[]")
return out
@app.route('/terms-of-service/')
def tos():
return render_template("tos.html", **common_properties())
@app.route('/privacypolicy/')
def privacypolicy():
return render_template("privacy.html", **common_properties())
@app.route('/client/')
def client():
return render_template("client/index.flask.html", **common_properties())
@app.route('/')
def homepage():
return render_template("homepage.html", **common_properties())
@app.route('/favicon.ico')
def favicon():
return send_from_directory(os.path.join(app.root_path, 'static'),
'icons/icon_16.ico', mimetype='image/vnd.microsoft.icon')
@app.route("/clear")
def clear():
session.clear()
return redirect("/");
app.route("/urlfetch/", methods = ["GET", "PUT", "POST", "DELETE", "OPTIONS"])(utils.urlfetch)
for route,config in bcconfigs.oauth2.items():
print("Setting up route: ", route)
app.route(route)(utils.OAuth2Handler(app, **config))
if __name__ == '__main__':
import os, sys
os.environ['OAUTHLIB_INSECURE_TRANSPORT'] = "1"
# This is used when running locally only. When deploying to Google App
# Engine, a webserver process such as Gunicorn will serve the app. This
# can be configured by adding an `entrypoint` to app.yaml.
app.run(host='127.0.0.1', port=8080, debug=True)
| 34.101449 | 114 | 0.697833 |
7953a25d23a3b7d64da053b5ad1e265dc8b42fcc | 114 | py | Python | pt01_object,design/cpt01/__init__.py | s3ich4n/object_study | 302108212d1d1f18ae57135145416513de3cb7c2 | [
"MIT"
] | null | null | null | pt01_object,design/cpt01/__init__.py | s3ich4n/object_study | 302108212d1d1f18ae57135145416513de3cb7c2 | [
"MIT"
] | 2 | 2021-06-03T18:45:13.000Z | 2021-06-04T13:09:29.000Z | pt01_object,design/cpt01/__init__.py | s3ich4n/object_study | 302108212d1d1f18ae57135145416513de3cb7c2 | [
"MIT"
] | null | null | null | #
# 주요 객체들을 init하는 코드
#
# @author Seongeun Yu (s3ich4n@gmail.com)
# @date 2021/06/03 23:52 created.
#
| 16.285714 | 46 | 0.596491 |
7953a2e39a3cc1ffd8515a09dbf907510aeaf666 | 16,620 | py | Python | flexget/plugins/api_tmdb.py | cvium/Flexget | 4279058887a77a78052a2a666bf9b8d9b98f5268 | [
"MIT"
] | 1 | 2017-08-25T07:17:04.000Z | 2017-08-25T07:17:04.000Z | flexget/plugins/api_tmdb.py | cvium/Flexget | 4279058887a77a78052a2a666bf9b8d9b98f5268 | [
"MIT"
] | 1 | 2015-11-10T01:07:54.000Z | 2015-11-10T01:07:54.000Z | flexget/plugins/api_tmdb.py | cvium/Flexget | 4279058887a77a78052a2a666bf9b8d9b98f5268 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals, division, absolute_import
from datetime import datetime, timedelta
import logging
import os
import posixpath
import socket
import sys
from urllib2 import URLError
from sqlalchemy import Table, Column, Integer, Float, String, Unicode, Boolean, DateTime, func
from sqlalchemy.schema import ForeignKey
from sqlalchemy.orm import relation
from flexget import db_schema, plugin
from flexget.event import event
from flexget.manager import Session
from flexget.plugin import get_plugin_by_name
from flexget.utils import requests
from flexget.utils.database import text_date_synonym, year_property, with_session
from flexget.utils.sqlalchemy_utils import table_add_column, table_schema
try:
import tmdb3
except ImportError:
raise plugin.DependencyError(issued_by='api_tmdb', missing='tmdb3',
message='TMDB requires https://github.com/wagnerrp/pytmdb3')
log = logging.getLogger('api_tmdb')
Base = db_schema.versioned_base('api_tmdb', 0)
# This is a FlexGet API key
tmdb3.tmdb_api.set_key('bdfc018dbdb7c243dc7cb1454ff74b95')
tmdb3.locales.set_locale("en", "us", True)
# There is a bug in tmdb3 library, where it uses the system encoding for query parameters, tmdb expects utf-8 #2392
tmdb3.locales.syslocale.encoding = 'utf-8'
tmdb3.set_cache('null')
@db_schema.upgrade('api_tmdb')
def upgrade(ver, session):
if ver is None:
log.info('Adding columns to tmdb cache table, marking current cache as expired.')
table_add_column('tmdb_movies', 'runtime', Integer, session)
table_add_column('tmdb_movies', 'tagline', Unicode, session)
table_add_column('tmdb_movies', 'budget', Integer, session)
table_add_column('tmdb_movies', 'revenue', Integer, session)
table_add_column('tmdb_movies', 'homepage', String, session)
table_add_column('tmdb_movies', 'trailer', String, session)
# Mark all cached movies as expired, so new fields get populated next lookup
movie_table = table_schema('tmdb_movies', session)
session.execute(movie_table.update(values={'updated': datetime(1970, 1, 1)}))
ver = 0
return ver
# association tables
genres_table = Table('tmdb_movie_genres', Base.metadata,
Column('movie_id', Integer, ForeignKey('tmdb_movies.id')),
Column('genre_id', Integer, ForeignKey('tmdb_genres.id')))
Base.register_table(genres_table)
class TMDBContainer(object):
"""Base class for TMDb objects"""
def __init__(self, init_object=None):
if isinstance(init_object, dict):
self.update_from_dict(init_object)
elif init_object:
self.update_from_object(init_object)
def update_from_dict(self, update_dict):
"""Populates any simple (string or number) attributes from a dict"""
for col in self.__table__.columns:
if isinstance(update_dict.get(col.name), (basestring, int, float)):
setattr(self, col.name, update_dict[col.name])
def update_from_object(self, update_object):
"""Populates any simple (string or number) attributes from object attributes"""
for col in self.__table__.columns:
if (hasattr(update_object, col.name) and
isinstance(getattr(update_object, col.name), (basestring, int, float))):
setattr(self, col.name, getattr(update_object, col.name))
class TMDBMovie(TMDBContainer, Base):
__tablename__ = 'tmdb_movies'
id = Column(Integer, primary_key=True, autoincrement=False, nullable=False)
updated = Column(DateTime, default=datetime.now, nullable=False)
popularity = Column(Integer)
translated = Column(Boolean)
adult = Column(Boolean)
language = Column(String)
original_name = Column(Unicode)
name = Column(Unicode)
alternative_name = Column(Unicode)
movie_type = Column(String)
imdb_id = Column(String)
url = Column(String)
votes = Column(Integer)
rating = Column(Float)
certification = Column(String)
overview = Column(Unicode)
runtime = Column(Integer)
tagline = Column(Unicode)
budget = Column(Integer)
revenue = Column(Integer)
homepage = Column(String)
trailer = Column(String)
_released = Column('released', DateTime)
released = text_date_synonym('_released')
year = year_property('released')
posters = relation('TMDBPoster', backref='movie', cascade='all, delete, delete-orphan')
genres = relation('TMDBGenre', secondary=genres_table, backref='movies')
def update_from_object(self, update_object):
try:
TMDBContainer.update_from_object(self, update_object)
self.translated = len(update_object.translations) > 0
if len(update_object.languages) > 0:
self.language = update_object.languages[0].code # .code or .name ?
self.original_name = update_object.originaltitle
self.name = update_object.title
try:
if len(update_object.alternate_titles) > 0:
# maybe we could choose alternate title from movie country only
self.alternative_name = update_object.alternate_titles[0].title
except UnicodeEncodeError:
# Bug in tmdb3 library, see #2437. Just don't set alternate_name when it fails
pass
self.imdb_id = update_object.imdb
self.url = update_object.homepage
self.rating = update_object.userrating
if len(update_object.youtube_trailers) > 0:
self.trailer = update_object.youtube_trailers[0].source # unicode: ooNSm6Uug3g
elif len(update_object.apple_trailers) > 0:
self.trailer = update_object.apple_trailers[0].source
self.released = update_object.releasedate
except tmdb3.TMDBError as e:
raise LookupError('Error updating data from tmdb: %s' % e)
class TMDBGenre(TMDBContainer, Base):
__tablename__ = 'tmdb_genres'
id = Column(Integer, primary_key=True, autoincrement=False)
name = Column(String, nullable=False)
class TMDBPoster(TMDBContainer, Base):
__tablename__ = 'tmdb_posters'
db_id = Column(Integer, primary_key=True)
movie_id = Column(Integer, ForeignKey('tmdb_movies.id'))
size = Column(String)
url = Column(String)
file = Column(Unicode)
def get_file(self, only_cached=False):
"""Makes sure the poster is downloaded to the local cache (in userstatic folder) and
returns the path split into a list of directory and file components"""
from flexget.manager import manager
base_dir = os.path.join(manager.config_base, 'userstatic')
if self.file and os.path.isfile(os.path.join(base_dir, self.file)):
return self.file.split(os.sep)
elif only_cached:
return
# If we don't already have a local copy, download one.
log.debug('Downloading poster %s' % self.url)
dirname = os.path.join('tmdb', 'posters', str(self.movie_id))
# Create folders if they don't exist
fullpath = os.path.join(base_dir, dirname)
if not os.path.isdir(fullpath):
os.makedirs(fullpath)
filename = os.path.join(dirname, posixpath.basename(self.url))
thefile = file(os.path.join(base_dir, filename), 'wb')
thefile.write(requests.get(self.url).content)
self.file = filename
# If we are detached from a session, update the db
if not Session.object_session(self):
session = Session()
try:
poster = session.query(TMDBPoster).filter(TMDBPoster.db_id == self.db_id).first()
if poster:
poster.file = filename
finally:
session.close()
return filename.split(os.sep)
class TMDBSearchResult(Base):
__tablename__ = 'tmdb_search_results'
id = Column(Integer, primary_key=True)
search = Column(Unicode, nullable=False)
movie_id = Column(Integer, ForeignKey('tmdb_movies.id'), nullable=True)
movie = relation(TMDBMovie, backref='search_strings')
class ApiTmdb(object):
"""Does lookups to TMDb and provides movie information. Caches lookups."""
@staticmethod
@with_session(expire_on_commit=False)
def lookup(title=None, year=None, tmdb_id=None, imdb_id=None, smart_match=None, only_cached=False, session=None):
"""
Do a lookup from TMDb for the movie matching the passed arguments.
Any combination of criteria can be passed, the most specific criteria specified will be used.
:param int tmdb_id: tmdb_id of desired movie
:param unicode imdb_id: imdb_id of desired movie
:param unicode title: title of desired movie
:param int year: release year of desired movie
:param unicode smart_match: attempt to clean and parse title and year from a string
:param bool only_cached: if this is specified, an online lookup will not occur if the movie is not in the cache
session: optionally specify a session to use, if specified, returned Movie will be live in that session
:param session: sqlalchemy Session in which to do cache lookups/storage. commit may be called on a passed in
session. If not supplied, a session will be created automatically.
:return: The :class:`TMDBMovie` object populated with data from tmdb
:raises: :class:`LookupError` if a match cannot be found or there are other problems with the lookup
"""
if not (tmdb_id or imdb_id or title) and smart_match:
# If smart_match was specified, and we don't have more specific criteria, parse it into a title and year
title_parser = get_plugin_by_name('parsing').instance.parse_movie(smart_match)
title = title_parser.name
year = title_parser.year
if title:
search_string = title.lower()
if year:
search_string = '%s (%s)' % (search_string, year)
elif not (tmdb_id or imdb_id):
raise LookupError('No criteria specified for TMDb lookup')
log.debug('Looking up TMDb information for %r' % {'title': title, 'tmdb_id': tmdb_id, 'imdb_id': imdb_id})
movie = None
def id_str():
return '<title=%s,tmdb_id=%s,imdb_id=%s>' % (title, tmdb_id, imdb_id)
if tmdb_id:
movie = session.query(TMDBMovie).filter(TMDBMovie.id == tmdb_id).first()
if not movie and imdb_id:
movie = session.query(TMDBMovie).filter(TMDBMovie.imdb_id == imdb_id).first()
if not movie and title:
movie_filter = session.query(TMDBMovie).filter(func.lower(TMDBMovie.name) == title.lower())
if year:
movie_filter = movie_filter.filter(TMDBMovie.year == year)
movie = movie_filter.first()
if not movie:
found = session.query(TMDBSearchResult). \
filter(func.lower(TMDBSearchResult.search) == search_string).first()
if found and found.movie:
movie = found.movie
if movie:
# Movie found in cache, check if cache has expired.
refresh_time = timedelta(days=2)
if movie.released:
if movie.released > datetime.now() - timedelta(days=7):
# Movie is less than a week old, expire after 1 day
refresh_time = timedelta(days=1)
else:
age_in_years = (datetime.now() - movie.released).days / 365
refresh_time += timedelta(days=age_in_years * 5)
if movie.updated < datetime.now() - refresh_time and not only_cached:
log.debug('Cache has expired for %s, attempting to refresh from TMDb.' % id_str())
try:
ApiTmdb.get_movie_details(movie, session)
except URLError:
log.error('Error refreshing movie details from TMDb, cached info being used.')
else:
log.debug('Movie %s information restored from cache.' % id_str())
else:
if only_cached:
raise LookupError('Movie %s not found from cache' % id_str())
# There was no movie found in the cache, do a lookup from tmdb
log.verbose('Searching from TMDb %s' % id_str())
try:
if imdb_id and not tmdb_id:
result = tmdb3.Movie.fromIMDB(imdb_id)
if result:
movie = session.query(TMDBMovie).filter(TMDBMovie.id == result.id).first()
if movie:
# Movie was in database, but did not have the imdb_id stored, force an update
ApiTmdb.get_movie_details(movie, session, result)
else:
tmdb_id = result.id
if tmdb_id:
movie = TMDBMovie()
movie.id = tmdb_id
ApiTmdb.get_movie_details(movie, session)
if movie.name:
session.merge(movie)
else:
movie = None
elif title:
try:
result = _first_result(tmdb3.tmdb_api.searchMovie(title.lower(), adult=True, year=year))
except (socket.timeout, URLError):
raise LookupError('Error contacting TMDb')
if not result and year:
result = _first_result(tmdb3.tmdb_api.searchMovie(title.lower(), adult=True))
if result:
movie = session.query(TMDBMovie).filter(TMDBMovie.id == result.id).first()
if not movie:
movie = TMDBMovie(result)
ApiTmdb.get_movie_details(movie, session, result)
session.merge(movie)
if title.lower() != movie.name.lower():
session.merge(TMDBSearchResult(search=search_string, movie=movie))
except tmdb3.TMDBError as e:
raise LookupError('Error looking up movie from TMDb (%s)' % e)
if movie:
log.verbose("Movie found from TMDb: %s (%s)" % (movie.name, movie.year))
if not movie:
raise LookupError('No results found from tmdb for %s' % id_str())
else:
session.commit()
return movie
@staticmethod
def get_movie_details(movie, session, result=None):
"""Populate details for this :movie: from TMDb"""
if not result and not movie.id:
raise LookupError('Cannot get tmdb details without tmdb id')
if not result:
try:
result = tmdb3.Movie(movie.id)
except tmdb3.TMDBError:
raise LookupError('No results for tmdb_id: %s (%s)' % (movie.id, sys.exc_info()[1]))
try:
movie.update_from_object(result)
except tmdb3.TMDBRequestInvalid as e:
log.debug('Error updating tmdb info: %s' % e)
raise LookupError('Error getting tmdb info')
posters = result.posters
if posters:
# Add any posters we don't already have
# TODO: There are quite a few posters per movie, do we need to cache them all?
poster_urls = [p.url for p in movie.posters]
for item in posters:
for size in item.sizes():
url = item.geturl(size)
if url not in poster_urls:
poster_data = {"movie_id": movie.id, "size": size, "url": url, "file": item.filename}
movie.posters.append(TMDBPoster(poster_data))
genres = result.genres
if genres:
for genre in genres:
if not genre.id:
continue
db_genre = session.query(TMDBGenre).filter(TMDBGenre.id == genre.id).first()
if not db_genre:
db_genre = TMDBGenre(genre)
if db_genre not in movie.genres:
movie.genres.append(db_genre)
movie.updated = datetime.now()
def _first_result(results):
if results and len(results) >= 1:
return results[0]
@event('plugin.register')
def register_plugin():
plugin.register(ApiTmdb, 'api_tmdb', api_ver=2)
| 44.084881 | 119 | 0.622082 |
7953a31de0de94a228a87b0755c51f225fdcdbd9 | 10,690 | py | Python | accelbyte_py_sdk/api/dsmc/operations/deployment_config/update_override_region__fb90bf.py | AccelByte/accelbyte-python-sdk | dcd311fad111c59da828278975340fb92e0f26f7 | [
"MIT"
] | null | null | null | accelbyte_py_sdk/api/dsmc/operations/deployment_config/update_override_region__fb90bf.py | AccelByte/accelbyte-python-sdk | dcd311fad111c59da828278975340fb92e0f26f7 | [
"MIT"
] | 1 | 2021-10-13T03:46:58.000Z | 2021-10-13T03:46:58.000Z | accelbyte_py_sdk/api/dsmc/operations/deployment_config/update_override_region__fb90bf.py | AccelByte/accelbyte-python-sdk | dcd311fad111c59da828278975340fb92e0f26f7 | [
"MIT"
] | null | null | null | # Copyright (c) 2021 AccelByte Inc. All Rights Reserved.
# This is licensed software from AccelByte Inc, for limitations
# and restrictions contact your company contract manager.
#
# Code generated. DO NOT EDIT!
# template file: justice_py_sdk_codegen/__main__.py
# pylint: disable=duplicate-code
# pylint: disable=line-too-long
# pylint: disable=missing-function-docstring
# pylint: disable=missing-module-docstring
# pylint: disable=too-many-arguments
# pylint: disable=too-many-branches
# pylint: disable=too-many-instance-attributes
# pylint: disable=too-many-lines
# pylint: disable=too-many-locals
# pylint: disable=too-many-public-methods
# pylint: disable=too-many-return-statements
# pylint: disable=too-many-statements
# pylint: disable=unused-import
# justice-dsm-controller-service (3.2.1)
from __future__ import annotations
from typing import Any, Dict, List, Optional, Tuple, Union
from .....core import Operation
from .....core import HeaderStr
from .....core import HttpResponse
from ...models import ModelsDeploymentWithOverride
from ...models import ModelsUpdateRegionOverrideRequest
from ...models import ResponseError
class UpdateOverrideRegionOverride(Operation):
"""Update region override for deployment override (UpdateOverrideRegionOverride)
Required permission: ADMIN:NAMESPACE:{namespace}:DSM:CONFIG [UPDATE]
Required scope: social
This endpoint update a dedicated servers deployment override in a namespace in a region for deployment overrides.
Required Permission(s):
- ADMIN:NAMESPACE:{namespace}:DSM:CONFIG [UPDATE]
Required Scope(s):
- social
Properties:
url: /dsmcontroller/admin/namespaces/{namespace}/configs/deployments/{deployment}/overrides/versions/{version}/regions/{region}
method: PATCH
tags: ["Deployment Config"]
consumes: ["application/json"]
produces: ["application/json"]
securities: [BEARER_AUTH]
body: (body) REQUIRED ModelsUpdateRegionOverrideRequest in body
deployment: (deployment) REQUIRED str in path
namespace: (namespace) REQUIRED str in path
region: (region) REQUIRED str in path
version: (version) REQUIRED str in path
Responses:
200: OK - ModelsDeploymentWithOverride (deployment region override updated)
400: Bad Request - ResponseError (malformed request)
401: Unauthorized - ResponseError (Unauthorized)
404: Not Found - ResponseError (deployment not found)
500: Internal Server Error - ResponseError (Internal Server Error)
"""
# region fields
_url: str = "/dsmcontroller/admin/namespaces/{namespace}/configs/deployments/{deployment}/overrides/versions/{version}/regions/{region}"
_method: str = "PATCH"
_consumes: List[str] = ["application/json"]
_produces: List[str] = ["application/json"]
_securities: List[List[str]] = [["BEARER_AUTH"]]
_location_query: str = None
body: ModelsUpdateRegionOverrideRequest # REQUIRED in [body]
deployment: str # REQUIRED in [path]
namespace: str # REQUIRED in [path]
region: str # REQUIRED in [path]
version: str # REQUIRED in [path]
# endregion fields
# region properties
@property
def url(self) -> str:
return self._url
@property
def method(self) -> str:
return self._method
@property
def consumes(self) -> List[str]:
return self._consumes
@property
def produces(self) -> List[str]:
return self._produces
@property
def securities(self) -> List[List[str]]:
return self._securities
@property
def location_query(self) -> str:
return self._location_query
# endregion properties
# region get methods
# endregion get methods
# region get_x_params methods
def get_all_params(self) -> dict:
return {
"body": self.get_body_params(),
"path": self.get_path_params(),
}
def get_body_params(self) -> Any:
if not hasattr(self, "body") or self.body is None:
return None
return self.body.to_dict()
def get_path_params(self) -> dict:
result = {}
if hasattr(self, "deployment"):
result["deployment"] = self.deployment
if hasattr(self, "namespace"):
result["namespace"] = self.namespace
if hasattr(self, "region"):
result["region"] = self.region
if hasattr(self, "version"):
result["version"] = self.version
return result
# endregion get_x_params methods
# region is/has methods
# endregion is/has methods
# region with_x methods
def with_body(self, value: ModelsUpdateRegionOverrideRequest) -> UpdateOverrideRegionOverride:
self.body = value
return self
def with_deployment(self, value: str) -> UpdateOverrideRegionOverride:
self.deployment = value
return self
def with_namespace(self, value: str) -> UpdateOverrideRegionOverride:
self.namespace = value
return self
def with_region(self, value: str) -> UpdateOverrideRegionOverride:
self.region = value
return self
def with_version(self, value: str) -> UpdateOverrideRegionOverride:
self.version = value
return self
# endregion with_x methods
# region to methods
def to_dict(self, include_empty: bool = False) -> dict:
result: dict = {}
if hasattr(self, "body") and self.body:
result["body"] = self.body.to_dict(include_empty=include_empty)
elif include_empty:
result["body"] = ModelsUpdateRegionOverrideRequest()
if hasattr(self, "deployment") and self.deployment:
result["deployment"] = str(self.deployment)
elif include_empty:
result["deployment"] = ""
if hasattr(self, "namespace") and self.namespace:
result["namespace"] = str(self.namespace)
elif include_empty:
result["namespace"] = ""
if hasattr(self, "region") and self.region:
result["region"] = str(self.region)
elif include_empty:
result["region"] = ""
if hasattr(self, "version") and self.version:
result["version"] = str(self.version)
elif include_empty:
result["version"] = ""
return result
# endregion to methods
# region response methods
# noinspection PyMethodMayBeStatic
def parse_response(self, code: int, content_type: str, content: Any) -> Tuple[Union[None, ModelsDeploymentWithOverride], Union[None, HttpResponse, ResponseError]]:
"""Parse the given response.
200: OK - ModelsDeploymentWithOverride (deployment region override updated)
400: Bad Request - ResponseError (malformed request)
401: Unauthorized - ResponseError (Unauthorized)
404: Not Found - ResponseError (deployment not found)
500: Internal Server Error - ResponseError (Internal Server Error)
---: HttpResponse (Undocumented Response)
---: HttpResponse (Unexpected Content-Type Error)
---: HttpResponse (Unhandled Error)
"""
pre_processed_response, error = self.pre_process_response(code=code, content_type=content_type, content=content)
if error is not None:
return None, None if error.is_no_content() else error
code, content_type, content = pre_processed_response
if code == 200:
return ModelsDeploymentWithOverride.create_from_dict(content), None
if code == 400:
return None, ResponseError.create_from_dict(content)
if code == 401:
return None, ResponseError.create_from_dict(content)
if code == 404:
return None, ResponseError.create_from_dict(content)
if code == 500:
return None, ResponseError.create_from_dict(content)
return None, self.handle_undocumented_response(code=code, content_type=content_type, content=content)
# endregion response methods
# region static methods
@classmethod
def create(
cls,
body: ModelsUpdateRegionOverrideRequest,
deployment: str,
namespace: str,
region: str,
version: str,
) -> UpdateOverrideRegionOverride:
instance = cls()
instance.body = body
instance.deployment = deployment
instance.namespace = namespace
instance.region = region
instance.version = version
return instance
@classmethod
def create_from_dict(cls, dict_: dict, include_empty: bool = False) -> UpdateOverrideRegionOverride:
instance = cls()
if "body" in dict_ and dict_["body"] is not None:
instance.body = ModelsUpdateRegionOverrideRequest.create_from_dict(dict_["body"], include_empty=include_empty)
elif include_empty:
instance.body = ModelsUpdateRegionOverrideRequest()
if "deployment" in dict_ and dict_["deployment"] is not None:
instance.deployment = str(dict_["deployment"])
elif include_empty:
instance.deployment = ""
if "namespace" in dict_ and dict_["namespace"] is not None:
instance.namespace = str(dict_["namespace"])
elif include_empty:
instance.namespace = ""
if "region" in dict_ and dict_["region"] is not None:
instance.region = str(dict_["region"])
elif include_empty:
instance.region = ""
if "version" in dict_ and dict_["version"] is not None:
instance.version = str(dict_["version"])
elif include_empty:
instance.version = ""
return instance
@staticmethod
def get_field_info() -> Dict[str, str]:
return {
"body": "body",
"deployment": "deployment",
"namespace": "namespace",
"region": "region",
"version": "version",
}
@staticmethod
def get_required_map() -> Dict[str, bool]:
return {
"body": True,
"deployment": True,
"namespace": True,
"region": True,
"version": True,
}
# endregion static methods
| 32.791411 | 167 | 0.625631 |
7953a55a6f8eae953b80d6aa18ffc31c72dfcddf | 15 | py | Python | python100days/Day15/pdf1.py | lanSeFangZhou/pythonbase | f4daa373573b2fc0a59a5eb919d02eddf5914e18 | [
"Apache-2.0"
] | null | null | null | python100days/Day15/pdf1.py | lanSeFangZhou/pythonbase | f4daa373573b2fc0a59a5eb919d02eddf5914e18 | [
"Apache-2.0"
] | 1 | 2021-06-02T00:58:26.000Z | 2021-06-02T00:58:26.000Z | python100days/Day15/pdf2.py | lanSeFangZhou/pythonbase | f4daa373573b2fc0a59a5eb919d02eddf5914e18 | [
"Apache-2.0"
] | null | null | null | '''
创建pdf文件
''' | 5 | 7 | 0.466667 |
7953a5650bf6325534279c5b266f47607b03df10 | 83,494 | py | Python | statsmodels/tsa/statespace/sarimax.py | dieterv77/statsmodels | ec3b6d02c96cd9c8f4b993434f0bbae4b3e91a21 | [
"BSD-3-Clause"
] | 34 | 2018-07-13T11:30:46.000Z | 2022-01-05T13:48:10.000Z | venv/lib/python3.6/site-packages/statsmodels/tsa/statespace/sarimax.py | HeyWeiPan/vnpy_crypto | 844381797a475a01c05a4e162592a5a6e3a48032 | [
"MIT"
] | 6 | 2015-08-28T16:59:03.000Z | 2019-04-12T22:29:01.000Z | venv/lib/python3.6/site-packages/statsmodels/tsa/statespace/sarimax.py | HeyWeiPan/vnpy_crypto | 844381797a475a01c05a4e162592a5a6e3a48032 | [
"MIT"
] | 28 | 2015-04-01T20:02:25.000Z | 2021-07-03T00:09:28.000Z | """
SARIMAX Model
Author: Chad Fulton
License: Simplified-BSD
"""
from __future__ import division, absolute_import, print_function
from statsmodels.compat.python import long
from warnings import warn
import numpy as np
from .kalman_filter import KalmanFilter
from .mlemodel import MLEModel, MLEResults, MLEResultsWrapper
from .tools import (
companion_matrix, diff, is_invertible, constrain_stationary_univariate,
unconstrain_stationary_univariate, solve_discrete_lyapunov,
prepare_exog
)
from statsmodels.tools.tools import Bunch
from statsmodels.tools.data import _is_using_pandas
from statsmodels.tsa.tsatools import lagmat
from statsmodels.tools.decorators import cache_readonly
from statsmodels.tools.sm_exceptions import ValueWarning
import statsmodels.base.wrapper as wrap
class SARIMAX(MLEModel):
r"""
Seasonal AutoRegressive Integrated Moving Average with eXogenous regressors
model
Parameters
----------
endog : array_like
The observed time-series process :math:`y`
exog : array_like, optional
Array of exogenous regressors, shaped nobs x k.
order : iterable or iterable of iterables, optional
The (p,d,q) order of the model for the number of AR parameters,
differences, and MA parameters. `d` must be an integer
indicating the integration order of the process, while
`p` and `q` may either be an integers indicating the AR and MA
orders (so that all lags up to those orders are included) or else
iterables giving specific AR and / or MA lags to include. Default is
an AR(1) model: (1,0,0).
seasonal_order : iterable, optional
The (P,D,Q,s) order of the seasonal component of the model for the
AR parameters, differences, MA parameters, and periodicity.
`d` must be an integer indicating the integration order of the process,
while `p` and `q` may either be an integers indicating the AR and MA
orders (so that all lags up to those orders are included) or else
iterables giving specific AR and / or MA lags to include. `s` is an
integer giving the periodicity (number of periods in season), often it
is 4 for quarterly data or 12 for monthly data. Default is no seasonal
effect.
trend : str{'n','c','t','ct'} or iterable, optional
Parameter controlling the deterministic trend polynomial :math:`A(t)`.
Can be specified as a string where 'c' indicates a constant (i.e. a
degree zero component of the trend polynomial), 't' indicates a
linear trend with time, and 'ct' is both. Can also be specified as an
iterable defining the polynomial as in `numpy.poly1d`, where
`[1,1,0,1]` would denote :math:`a + bt + ct^3`. Default is to not
include a trend component.
measurement_error : boolean, optional
Whether or not to assume the endogenous observations `endog` were
measured with error. Default is False.
time_varying_regression : boolean, optional
Used when an explanatory variables, `exog`, are provided provided
to select whether or not coefficients on the exogenous regressors are
allowed to vary over time. Default is False.
mle_regression : boolean, optional
Whether or not to use estimate the regression coefficients for the
exogenous variables as part of maximum likelihood estimation or through
the Kalman filter (i.e. recursive least squares). If
`time_varying_regression` is True, this must be set to False. Default
is True.
simple_differencing : boolean, optional
Whether or not to use partially conditional maximum likelihood
estimation. If True, differencing is performed prior to estimation,
which discards the first :math:`s D + d` initial rows but results in a
smaller state-space formulation. If False, the full SARIMAX model is
put in state-space form so that all datapoints can be used in
estimation. Default is False.
enforce_stationarity : boolean, optional
Whether or not to transform the AR parameters to enforce stationarity
in the autoregressive component of the model. Default is True.
enforce_invertibility : boolean, optional
Whether or not to transform the MA parameters to enforce invertibility
in the moving average component of the model. Default is True.
hamilton_representation : boolean, optional
Whether or not to use the Hamilton representation of an ARMA process
(if True) or the Harvey representation (if False). Default is False.
**kwargs
Keyword arguments may be used to provide default values for state space
matrices or for Kalman filtering options. See `Representation`, and
`KalmanFilter` for more details.
Attributes
----------
measurement_error : boolean
Whether or not to assume the endogenous
observations `endog` were measured with error.
state_error : boolean
Whether or not the transition equation has an error component.
mle_regression : boolean
Whether or not the regression coefficients for
the exogenous variables were estimated via maximum
likelihood estimation.
state_regression : boolean
Whether or not the regression coefficients for
the exogenous variables are included as elements
of the state space and estimated via the Kalman
filter.
time_varying_regression : boolean
Whether or not coefficients on the exogenous
regressors are allowed to vary over time.
simple_differencing : boolean
Whether or not to use partially conditional maximum likelihood
estimation.
enforce_stationarity : boolean
Whether or not to transform the AR parameters
to enforce stationarity in the autoregressive
component of the model.
enforce_invertibility : boolean
Whether or not to transform the MA parameters
to enforce invertibility in the moving average
component of the model.
hamilton_representation : boolean
Whether or not to use the Hamilton representation of an ARMA process.
trend : str{'n','c','t','ct'} or iterable
Parameter controlling the deterministic
trend polynomial :math:`A(t)`. See the class
parameter documentation for more information.
polynomial_ar : array
Array containing autoregressive lag polynomial
coefficients, ordered from lowest degree to highest.
Initialized with ones, unless a coefficient is
constrained to be zero (in which case it is zero).
polynomial_ma : array
Array containing moving average lag polynomial
coefficients, ordered from lowest degree to highest.
Initialized with ones, unless a coefficient is
constrained to be zero (in which case it is zero).
polynomial_seasonal_ar : array
Array containing seasonal moving average lag
polynomial coefficients, ordered from lowest degree
to highest. Initialized with ones, unless a
coefficient is constrained to be zero (in which
case it is zero).
polynomial_seasonal_ma : array
Array containing seasonal moving average lag
polynomial coefficients, ordered from lowest degree
to highest. Initialized with ones, unless a
coefficient is constrained to be zero (in which
case it is zero).
polynomial_trend : array
Array containing trend polynomial coefficients,
ordered from lowest degree to highest. Initialized
with ones, unless a coefficient is constrained to be
zero (in which case it is zero).
k_ar : int
Highest autoregressive order in the model, zero-indexed.
k_ar_params : int
Number of autoregressive parameters to be estimated.
k_diff : int
Order of intergration.
k_ma : int
Highest moving average order in the model, zero-indexed.
k_ma_params : int
Number of moving average parameters to be estimated.
seasonal_periods : int
Number of periods in a season.
k_seasonal_ar : int
Highest seasonal autoregressive order in the model, zero-indexed.
k_seasonal_ar_params : int
Number of seasonal autoregressive parameters to be estimated.
k_seasonal_diff : int
Order of seasonal intergration.
k_seasonal_ma : int
Highest seasonal moving average order in the model, zero-indexed.
k_seasonal_ma_params : int
Number of seasonal moving average parameters to be estimated.
k_trend : int
Order of the trend polynomial plus one (i.e. the constant polynomial
would have `k_trend=1`).
k_exog : int
Number of exogenous regressors.
Notes
-----
The SARIMA model is specified :math:`(p, d, q) \times (P, D, Q)_s`.
.. math::
\phi_p (L) \tilde \phi_P (L^s) \Delta^d \Delta_s^D y_t = A(t) +
\theta_q (L) \tilde \theta_Q (L^s) \zeta_t
In terms of a univariate structural model, this can be represented as
.. math::
y_t & = u_t + \eta_t \\
\phi_p (L) \tilde \phi_P (L^s) \Delta^d \Delta_s^D u_t & = A(t) +
\theta_q (L) \tilde \theta_Q (L^s) \zeta_t
where :math:`\eta_t` is only applicable in the case of measurement error
(although it is also used in the case of a pure regression model, i.e. if
p=q=0).
In terms of this model, regression with SARIMA errors can be represented
easily as
.. math::
y_t & = \beta_t x_t + u_t \\
\phi_p (L) \tilde \phi_P (L^s) \Delta^d \Delta_s^D u_t & = A(t) +
\theta_q (L) \tilde \theta_Q (L^s) \zeta_t
this model is the one used when exogenous regressors are provided.
Note that the reduced form lag polynomials will be written as:
.. math::
\Phi (L) \equiv \phi_p (L) \tilde \phi_P (L^s) \\
\Theta (L) \equiv \theta_q (L) \tilde \theta_Q (L^s)
If `mle_regression` is True, regression coefficients are treated as
additional parameters to be estimated via maximum likelihood. Otherwise
they are included as part of the state with a diffuse initialization.
In this case, however, with approximate diffuse initialization, results
can be sensitive to the initial variance.
This class allows two different underlying representations of ARMA models
as state space models: that of Hamilton and that of Harvey. Both are
equivalent in the sense that they are analytical representations of the
ARMA model, but the state vectors of each have different meanings. For
this reason, maximum likelihood does not result in identical parameter
estimates and even the same set of parameters will result in different
loglikelihoods.
The Harvey representation is convenient because it allows integrating
differencing into the state vector to allow using all observations for
estimation.
In this implementation of differenced models, the Hamilton representation
is not able to accomodate differencing in the state vector, so
`simple_differencing` (which performs differencing prior to estimation so
that the first d + sD observations are lost) must be used.
Many other packages use the Hamilton representation, so that tests against
Stata and R require using it along with simple differencing (as Stata
does).
Detailed information about state space models can be found in [1]_. Some
specific references are:
- Chapter 3.4 describes ARMA and ARIMA models in state space form (using
the Harvey representation), and gives references for basic seasonal
models and models with a multiplicative form (for example the airline
model). It also shows a state space model for a full ARIMA process (this
is what is done here if `simple_differencing=False`).
- Chapter 3.6 describes estimating regression effects via the Kalman filter
(this is performed if `mle_regression` is False), regression with
time-varying coefficients, and regression with ARMA errors (recall from
above that if regression effects are present, the model estimated by this
class is regression with SARIMA errors).
- Chapter 8.4 describes the application of an ARMA model to an example
dataset. A replication of this section is available in an example
IPython notebook in the documentation.
References
----------
.. [1] Durbin, James, and Siem Jan Koopman. 2012.
Time Series Analysis by State Space Methods: Second Edition.
Oxford University Press.
"""
def __init__(self, endog, exog=None, order=(1, 0, 0),
seasonal_order=(0, 0, 0, 0), trend=None,
measurement_error=False, time_varying_regression=False,
mle_regression=True, simple_differencing=False,
enforce_stationarity=True, enforce_invertibility=True,
hamilton_representation=False, **kwargs):
# Model parameters
self.seasonal_periods = seasonal_order[3]
self.measurement_error = measurement_error
self.time_varying_regression = time_varying_regression
self.mle_regression = mle_regression
self.simple_differencing = simple_differencing
self.enforce_stationarity = enforce_stationarity
self.enforce_invertibility = enforce_invertibility
self.hamilton_representation = hamilton_representation
# Save given orders
self.order = order
self.seasonal_order = seasonal_order
# Enforce non-MLE coefficients if time varying coefficients is
# specified
if self.time_varying_regression and self.mle_regression:
raise ValueError('Models with time-varying regression coefficients'
' must integrate the coefficients as part of the'
' state vector, so that `mle_regression` must'
' be set to False.')
# Lag polynomials
# Assume that they are given from lowest degree to highest, that all
# degrees except for the constant are included, and that they are
# boolean vectors (0 for not included, 1 for included).
if isinstance(order[0], (int, long, np.integer)):
self.polynomial_ar = np.r_[1., np.ones(order[0])]
else:
self.polynomial_ar = np.r_[1., order[0]]
if isinstance(order[2], (int, long, np.integer)):
self.polynomial_ma = np.r_[1., np.ones(order[2])]
else:
self.polynomial_ma = np.r_[1., order[2]]
# Assume that they are given from lowest degree to highest, that the
# degrees correspond to (1*s, 2*s, ..., P*s), and that they are
# boolean vectors (0 for not included, 1 for included).
if isinstance(seasonal_order[0], (int, long, np.integer)):
self.polynomial_seasonal_ar = np.r_[
1., # constant
([0] * (self.seasonal_periods - 1) + [1]) * seasonal_order[0]
]
else:
self.polynomial_seasonal_ar = np.r_[
1., [0] * self.seasonal_periods * len(seasonal_order[0])
]
for i in range(len(seasonal_order[0])):
tmp = (i + 1) * self.seasonal_periods
self.polynomial_seasonal_ar[tmp] = seasonal_order[0][i]
if isinstance(seasonal_order[2], (int, long, np.integer)):
self.polynomial_seasonal_ma = np.r_[
1., # constant
([0] * (self.seasonal_periods - 1) + [1]) * seasonal_order[2]
]
else:
self.polynomial_seasonal_ma = np.r_[
1., [0] * self.seasonal_periods * len(seasonal_order[2])
]
for i in range(len(seasonal_order[2])):
tmp = (i + 1) * self.seasonal_periods
self.polynomial_seasonal_ma[tmp] = seasonal_order[2][i]
# Deterministic trend polynomial
self.trend = trend
if trend is None or trend == 'n':
self.polynomial_trend = np.ones((0))
elif trend == 'c':
self.polynomial_trend = np.r_[1]
elif trend == 't':
self.polynomial_trend = np.r_[0, 1]
elif trend == 'ct':
self.polynomial_trend = np.r_[1, 1]
else:
self.polynomial_trend = (np.array(trend) > 0).astype(int)
# Model orders
# Note: k_ar, k_ma, k_seasonal_ar, k_seasonal_ma do not include the
# constant term, so they may be zero.
# Note: for a typical ARMA(p,q) model, p = k_ar_params = k_ar - 1 and
# q = k_ma_params = k_ma - 1, although this may not be true for models
# with arbitrary log polynomials.
self.k_ar = int(self.polynomial_ar.shape[0] - 1)
self.k_ar_params = int(np.sum(self.polynomial_ar) - 1)
self.k_diff = int(order[1])
self.k_ma = int(self.polynomial_ma.shape[0] - 1)
self.k_ma_params = int(np.sum(self.polynomial_ma) - 1)
self.k_seasonal_ar = int(self.polynomial_seasonal_ar.shape[0] - 1)
self.k_seasonal_ar_params = (
int(np.sum(self.polynomial_seasonal_ar) - 1)
)
self.k_seasonal_diff = int(seasonal_order[1])
self.k_seasonal_ma = int(self.polynomial_seasonal_ma.shape[0] - 1)
self.k_seasonal_ma_params = (
int(np.sum(self.polynomial_seasonal_ma) - 1)
)
# Make internal copies of the differencing orders because if we use
# simple differencing, then we will need to internally use zeros after
# the simple differencing has been performed
self._k_diff = self.k_diff
self._k_seasonal_diff = self.k_seasonal_diff
# We can only use the Hamilton representation if differencing is not
# performed as a part of the state space
if (self.hamilton_representation and not (self.simple_differencing or
self._k_diff == self._k_seasonal_diff == 0)):
raise ValueError('The Hamilton representation is only available'
' for models in which there is no differencing'
' integrated into the state vector. Set'
' `simple_differencing` to True or set'
' `hamilton_representation` to False')
# Note: k_trend is not the degree of the trend polynomial, because e.g.
# k_trend = 1 corresponds to the degree zero polynomial (with only a
# constant term).
self.k_trend = int(np.sum(self.polynomial_trend))
# Model order
# (this is used internally in a number of locations)
self._k_order = max(self.k_ar + self.k_seasonal_ar,
self.k_ma + self.k_seasonal_ma + 1)
if self._k_order == 1 and self.k_ar + self.k_seasonal_ar == 0:
# Handle time-varying regression
if self.time_varying_regression:
self._k_order = 0
# Exogenous data
(self.k_exog, exog) = prepare_exog(exog)
# Redefine mle_regression to be true only if it was previously set to
# true and there are exogenous regressors
self.mle_regression = (
self.mle_regression and exog is not None and self.k_exog > 0
)
# State regression is regression with coefficients estiamted within
# the state vector
self.state_regression = (
not self.mle_regression and exog is not None and self.k_exog > 0
)
# If all we have is a regression (so k_ar = k_ma = 0), then put the
# error term as measurement error
if self.state_regression and self._k_order == 0:
self.measurement_error = True
# Number of states
k_states = self._k_order
if not self.simple_differencing:
k_states += (self.seasonal_periods * self._k_seasonal_diff +
self._k_diff)
if self.state_regression:
k_states += self.k_exog
# Number of diffuse states
k_diffuse_states = k_states
if self.enforce_stationarity:
k_diffuse_states -= self._k_order
# Number of positive definite elements of the state covariance matrix
k_posdef = int(self._k_order > 0)
# Only have an error component to the states if k_posdef > 0
self.state_error = k_posdef > 0
if self.state_regression and self.time_varying_regression:
k_posdef += self.k_exog
# Diffuse initialization can be more sensistive to the variance value
# in the case of state regression, so set a higher than usual default
# variance
if self.state_regression:
kwargs.setdefault('initial_variance', 1e10)
# Number of parameters
self.k_params = (
self.k_ar_params + self.k_ma_params +
self.k_seasonal_ar_params + self.k_seasonal_ar_params +
self.k_trend +
self.measurement_error + 1
)
if self.mle_regression:
self.k_params += self.k_exog
# We need to have an array or pandas at this point
self.orig_endog = endog
self.orig_exog = exog
if not _is_using_pandas(endog, None):
endog = np.asanyarray(endog)
# Update the differencing dimensions if simple differencing is applied
self.orig_k_diff = self._k_diff
self.orig_k_seasonal_diff = self._k_seasonal_diff
if (self.simple_differencing and
(self._k_diff > 0 or self._k_seasonal_diff > 0)):
self._k_diff = 0
self._k_seasonal_diff = 0
# Internally used in several locations
self._k_states_diff = (
self._k_diff + self.seasonal_periods * self._k_seasonal_diff
)
# Set some model variables now so they will be available for the
# initialize() method, below
self.nobs = len(endog)
self.k_states = k_states
self.k_posdef = k_posdef
# By default, do not calculate likelihood while it is controlled by
# diffuse initial conditions.
kwargs.setdefault('loglikelihood_burn', k_diffuse_states)
# Initialize the statespace
super(SARIMAX, self).__init__(
endog, exog=exog, k_states=k_states, k_posdef=k_posdef, **kwargs
)
# Set as time-varying model if we have time-trend or exog
if self.k_exog > 0 or len(self.polynomial_trend) > 1:
self.ssm._time_invariant = False
# Handle kwargs specified initialization
if self.ssm.initialization is not None:
self._manual_initialization = True
# Initialize the fixed components of the statespace model
self.ssm['design'] = self.initial_design
self.ssm['state_intercept'] = self.initial_state_intercept
self.ssm['transition'] = self.initial_transition
self.ssm['selection'] = self.initial_selection
# If we are estimating a simple ARMA model, then we can use a faster
# initialization method (unless initialization was already specified).
if k_diffuse_states == 0 and not self._manual_initialization:
self.initialize_stationary()
# update _init_keys attached by super
self._init_keys += ['order', 'seasonal_order', 'trend',
'measurement_error', 'time_varying_regression',
'mle_regression', 'simple_differencing',
'enforce_stationarity', 'enforce_invertibility',
'hamilton_representation'] + list(kwargs.keys())
# TODO: I think the kwargs or not attached, need to recover from ???
def _get_init_kwds(self):
kwds = super(SARIMAX, self)._get_init_kwds()
for key, value in kwds.items():
if value is None and hasattr(self.ssm, key):
kwds[key] = getattr(self.ssm, key)
return kwds
def prepare_data(self):
endog, exog = super(SARIMAX, self).prepare_data()
# Perform simple differencing if requested
if (self.simple_differencing and
(self.orig_k_diff > 0 or self.orig_k_seasonal_diff > 0)):
# Save the original length
orig_length = endog.shape[0]
# Perform simple differencing
endog = diff(endog.copy(), self.orig_k_diff,
self.orig_k_seasonal_diff, self.seasonal_periods)
if exog is not None:
exog = diff(exog.copy(), self.orig_k_diff,
self.orig_k_seasonal_diff, self.seasonal_periods)
# Reset the ModelData datasets and cache
self.data.endog, self.data.exog = (
self.data._convert_endog_exog(endog, exog))
# Reset indexes, if provided
new_length = self.data.endog.shape[0]
if self.data.row_labels is not None:
self.data._cache['row_labels'] = (
self.data.row_labels[orig_length - new_length:])
if self._index is not None:
if self._index_generated:
self._index = self._index[:-(orig_length - new_length)]
else:
self._index = self._index[orig_length - new_length:]
# Reset the nobs
self.nobs = endog.shape[0]
# Cache the arrays for calculating the intercept from the trend
# components
time_trend = np.arange(1, self.nobs + 1)
self._trend_data = np.zeros((self.nobs, self.k_trend))
i = 0
for k in self.polynomial_trend.nonzero()[0]:
if k == 0:
self._trend_data[:, i] = np.ones(self.nobs,)
else:
self._trend_data[:, i] = time_trend**k
i += 1
return endog, exog
def initialize(self):
"""
Initialize the SARIMAX model.
Notes
-----
These initialization steps must occur following the parent class
__init__ function calls.
"""
super(SARIMAX, self).initialize()
# Internal flag for whether the default mixed approximate diffuse /
# stationary initialization has been overridden with a user-supplied
# initialization
self._manual_initialization = False
# Cache the indexes of included polynomial orders (for update below)
# (but we do not want the index of the constant term, so exclude the
# first index)
self._polynomial_ar_idx = np.nonzero(self.polynomial_ar)[0][1:]
self._polynomial_ma_idx = np.nonzero(self.polynomial_ma)[0][1:]
self._polynomial_seasonal_ar_idx = np.nonzero(
self.polynomial_seasonal_ar
)[0][1:]
self._polynomial_seasonal_ma_idx = np.nonzero(
self.polynomial_seasonal_ma
)[0][1:]
# Save the indices corresponding to the reduced form lag polynomial
# parameters in the transition and selection matrices so that they
# don't have to be recalculated for each update()
start_row = self._k_states_diff
end_row = start_row + self.k_ar + self.k_seasonal_ar
col = self._k_states_diff
if not self.hamilton_representation:
self.transition_ar_params_idx = (
np.s_['transition', start_row:end_row, col]
)
else:
self.transition_ar_params_idx = (
np.s_['transition', col, start_row:end_row]
)
start_row += 1
end_row = start_row + self.k_ma + self.k_seasonal_ma
col = 0
if not self.hamilton_representation:
self.selection_ma_params_idx = (
np.s_['selection', start_row:end_row, col]
)
else:
self.design_ma_params_idx = (
np.s_['design', col, start_row:end_row]
)
# Cache indices for exog variances in the state covariance matrix
if self.state_regression and self.time_varying_regression:
idx = np.diag_indices(self.k_posdef)
self._exog_variance_idx = ('state_cov', idx[0][-self.k_exog:],
idx[1][-self.k_exog:])
def initialize_known(self, initial_state, initial_state_cov):
self._manual_initialization = True
self.ssm.initialize_known(initial_state, initial_state_cov)
initialize_known.__doc__ = KalmanFilter.initialize_known.__doc__
def initialize_approximate_diffuse(self, variance=None):
self._manual_initialization = True
self.ssm.initialize_approximate_diffuse(variance)
initialize_approximate_diffuse.__doc__ = (
KalmanFilter.initialize_approximate_diffuse.__doc__
)
def initialize_stationary(self):
self._manual_initialization = True
self.ssm.initialize_stationary()
initialize_stationary.__doc__ = (
KalmanFilter.initialize_stationary.__doc__
)
def initialize_state(self, variance=None, complex_step=False):
"""
Initialize state and state covariance arrays in preparation for the
Kalman filter.
Parameters
----------
variance : float, optional
The variance for approximating diffuse initial conditions. Default
can be found in the Representation class documentation.
Notes
-----
Initializes the ARMA component of the state space to the typical
stationary values and the other components as approximate diffuse.
Can be overridden be calling one of the other initialization methods
before fitting the model.
"""
# Check if a manual initialization has already been specified
if self._manual_initialization:
return
# If we're not enforcing stationarity, then we can't initialize a
# stationary component
if not self.enforce_stationarity:
self.initialize_approximate_diffuse(variance)
return
# Otherwise, create the initial state and state covariance matrix
# as from a combination of diffuse and stationary components
# Create initialized non-stationary components
if variance is None:
variance = self.ssm.initial_variance
dtype = self.ssm.transition.dtype
initial_state = np.zeros(self.k_states, dtype=dtype)
initial_state_cov = np.eye(self.k_states, dtype=dtype) * variance
# Get the offsets (from the bottom or bottom right of the vector /
# matrix) for the stationary component.
if self.state_regression:
start = -(self.k_exog + self._k_order)
end = -self.k_exog if self.k_exog > 0 else None
else:
start = -self._k_order
end = None
# Add in the initialized stationary components
if self._k_order > 0:
transition = self.ssm['transition', start:end, start:end, 0]
# Initial state
# In the Harvey representation, if we have a trend that
# is put into the state intercept and means we have a non-zero
# unconditional mean
if not self.hamilton_representation and self.k_trend > 0:
initial_intercept = (
self['state_intercept', self._k_states_diff, 0])
initial_mean = (initial_intercept /
(1 - np.sum(transition[:, 0])))
initial_state[self._k_states_diff] = initial_mean
_start = self._k_states_diff + 1
_end = _start + transition.shape[0] - 1
initial_state[_start:_end] = transition[1:, 0] * initial_mean
# Initial state covariance
selection_stationary = self.ssm['selection', start:end, :, 0]
selected_state_cov_stationary = np.dot(
np.dot(selection_stationary, self.ssm['state_cov', :, :, 0]),
selection_stationary.T)
initial_state_cov_stationary = solve_discrete_lyapunov(
transition, selected_state_cov_stationary,
complex_step=complex_step)
initial_state_cov[start:end, start:end] = (
initial_state_cov_stationary)
self.ssm.initialize_known(initial_state, initial_state_cov)
@property
def initial_design(self):
"""Initial design matrix"""
# Basic design matrix
design = np.r_[
[1] * self._k_diff,
([0] * (self.seasonal_periods - 1) + [1]) * self._k_seasonal_diff,
[1] * self.state_error, [0] * (self._k_order - 1)
]
if len(design) == 0:
design = np.r_[0]
# If we have exogenous regressors included as part of the state vector
# then the exogenous data is incorporated as a time-varying component
# of the design matrix
if self.state_regression:
if self._k_order > 0:
design = np.c_[
np.reshape(
np.repeat(design, self.nobs),
(design.shape[0], self.nobs)
).T,
self.exog
].T[None, :, :]
else:
design = self.exog.T[None, :, :]
return design
@property
def initial_state_intercept(self):
"""Initial state intercept vector"""
# TODO make this self.k_trend > 1 and adjust the update to take
# into account that if the trend is a constant, it is not time-varying
if self.k_trend > 0:
state_intercept = np.zeros((self.k_states, self.nobs))
else:
state_intercept = np.zeros((self.k_states,))
return state_intercept
@property
def initial_transition(self):
"""Initial transition matrix"""
transition = np.zeros((self.k_states, self.k_states))
# Exogenous regressors component
if self.state_regression:
start = -self.k_exog
# T_\beta
transition[start:, start:] = np.eye(self.k_exog)
# Autoregressive component
start = -(self.k_exog + self._k_order)
end = -self.k_exog if self.k_exog > 0 else None
else:
# Autoregressive component
start = -self._k_order
end = None
# T_c
if self._k_order > 0:
transition[start:end, start:end] = companion_matrix(self._k_order)
if self.hamilton_representation:
transition[start:end, start:end] = np.transpose(
companion_matrix(self._k_order)
)
# Seasonal differencing component
# T^*
if self._k_seasonal_diff > 0:
seasonal_companion = companion_matrix(self.seasonal_periods).T
seasonal_companion[0, -1] = 1
for d in range(self._k_seasonal_diff):
start = self._k_diff + d * self.seasonal_periods
end = self._k_diff + (d + 1) * self.seasonal_periods
# T_c^*
transition[start:end, start:end] = seasonal_companion
# i
for i in range(d + 1, self._k_seasonal_diff):
transition[start, end + self.seasonal_periods - 1] = 1
# \iota
transition[start, self._k_states_diff] = 1
# Differencing component
if self._k_diff > 0:
idx = np.triu_indices(self._k_diff)
# T^**
transition[idx] = 1
# [0 1]
if self.seasonal_periods > 0:
start = self._k_diff
end = self._k_states_diff
transition[:self._k_diff, start:end] = (
([0] * (self.seasonal_periods - 1) + [1]) *
self._k_seasonal_diff)
# [1 0]
column = self._k_states_diff
transition[:self._k_diff, column] = 1
return transition
@property
def initial_selection(self):
"""Initial selection matrix"""
if not (self.state_regression and self.time_varying_regression):
if self.k_posdef > 0:
selection = np.r_[
[0] * (self._k_states_diff),
[1] * (self._k_order > 0), [0] * (self._k_order - 1),
[0] * ((1 - self.mle_regression) * self.k_exog)
][:, None]
if len(selection) == 0:
selection = np.zeros((self.k_states, self.k_posdef))
else:
selection = np.zeros((self.k_states, 0))
else:
selection = np.zeros((self.k_states, self.k_posdef))
# Typical state variance
if self._k_order > 0:
selection[0, 0] = 1
# Time-varying regression coefficient variances
for i in range(self.k_exog, 0, -1):
selection[-i, -i] = 1
return selection
@property
def _res_classes(self):
return {'fit': (SARIMAXResults, SARIMAXResultsWrapper)}
@staticmethod
def _conditional_sum_squares(endog, k_ar, polynomial_ar, k_ma,
polynomial_ma, k_trend=0, trend_data=None):
k = 2 * k_ma
r = max(k + k_ma, k_ar)
k_params_ar = 0 if k_ar == 0 else len(polynomial_ar.nonzero()[0]) - 1
k_params_ma = 0 if k_ma == 0 else len(polynomial_ma.nonzero()[0]) - 1
residuals = None
if k_ar + k_ma + k_trend > 0:
# If we have MA terms, get residuals from an AR(k) model to use
# as data for conditional sum of squares estimates of the MA
# parameters
if k_ma > 0:
Y = endog[k:]
X = lagmat(endog, k, trim='both')
params_ar = np.linalg.pinv(X).dot(Y)
residuals = Y - np.dot(X, params_ar)
# Run an ARMA(p,q) model using the just computed residuals as data
Y = endog[r:]
X = np.empty((Y.shape[0], 0))
if k_trend > 0:
if trend_data is None:
raise ValueError('Trend data must be provided if'
' `k_trend` > 0.')
X = np.c_[X, trend_data[:(-r if r > 0 else None), :]]
if k_ar > 0:
cols = polynomial_ar.nonzero()[0][1:] - 1
X = np.c_[X, lagmat(endog, k_ar)[r:, cols]]
if k_ma > 0:
cols = polynomial_ma.nonzero()[0][1:] - 1
X = np.c_[X, lagmat(residuals, k_ma)[r-k:, cols]]
# Get the array of [ar_params, ma_params]
params = np.linalg.pinv(X).dot(Y)
residuals = Y - np.dot(X, params)
# Default output
params_trend = []
params_ar = []
params_ma = []
params_variance = []
# Get the params
offset = 0
if k_trend > 0:
params_trend = params[offset:k_trend + offset]
offset += k_trend
if k_ar > 0:
params_ar = params[offset:k_params_ar + offset]
offset += k_params_ar
if k_ma > 0:
params_ma = params[offset:k_params_ma + offset]
offset += k_params_ma
if residuals is not None:
params_variance = (residuals[k_params_ma:]**2).mean()
return (params_trend, params_ar, params_ma,
params_variance)
@property
def start_params(self):
"""
Starting parameters for maximum likelihood estimation
"""
# Perform differencing if necessary (i.e. if simple differencing is
# false so that the state-space model will use the entire dataset)
trend_data = self._trend_data
if not self.simple_differencing and (
self._k_diff > 0 or self._k_seasonal_diff > 0):
endog = diff(self.endog, self._k_diff,
self._k_seasonal_diff, self.seasonal_periods)
if self.exog is not None:
exog = diff(self.exog, self._k_diff,
self._k_seasonal_diff, self.seasonal_periods)
else:
exog = None
trend_data = trend_data[:endog.shape[0], :]
else:
endog = self.endog.copy()
exog = self.exog.copy() if self.exog is not None else None
endog = endog.squeeze()
# Although the Kalman filter can deal with missing values in endog,
# conditional sum of squares cannot
if np.any(np.isnan(endog)):
mask = ~np.isnan(endog).squeeze()
endog = endog[mask]
if exog is not None:
exog = exog[mask]
if trend_data is not None:
trend_data = trend_data[mask]
# Regression effects via OLS
params_exog = []
if self.k_exog > 0:
params_exog = np.linalg.pinv(exog).dot(endog)
endog = endog - np.dot(exog, params_exog)
if self.state_regression:
params_exog = []
# Non-seasonal ARMA component and trend
(params_trend, params_ar, params_ma,
params_variance) = self._conditional_sum_squares(
endog, self.k_ar, self.polynomial_ar, self.k_ma,
self.polynomial_ma, self.k_trend, trend_data
)
# If we have estimated non-stationary start parameters but enforce
# stationarity is on, raise an error
invalid_ar = (
self.k_ar > 0 and
self.enforce_stationarity and
not is_invertible(np.r_[1, -params_ar])
)
if invalid_ar:
raise ValueError('Non-stationary starting autoregressive'
' parameters found with `enforce_stationarity`'
' set to True.')
# If we have estimated non-invertible start parameters but enforce
# invertibility is on, raise an error
invalid_ma = (
self.k_ma > 0 and
self.enforce_invertibility and
not is_invertible(np.r_[1, params_ma])
)
if invalid_ma:
raise ValueError('non-invertible starting MA parameters found'
' with `enforce_invertibility` set to True.')
# Seasonal Parameters
_, params_seasonal_ar, params_seasonal_ma, params_seasonal_variance = (
self._conditional_sum_squares(
endog, self.k_seasonal_ar, self.polynomial_seasonal_ar,
self.k_seasonal_ma, self.polynomial_seasonal_ma
)
)
# If we have estimated non-stationary start parameters but enforce
# stationarity is on, raise an error
invalid_seasonal_ar = (
self.k_seasonal_ar > 0 and
self.enforce_stationarity and
not is_invertible(np.r_[1, -params_seasonal_ar])
)
if invalid_seasonal_ar:
raise ValueError('Non-stationary starting autoregressive'
' parameters found with `enforce_stationarity`'
' set to True.')
# If we have estimated non-invertible start parameters but enforce
# invertibility is on, raise an error
invalid_seasonal_ma = (
self.k_seasonal_ma > 0 and
self.enforce_invertibility and
not is_invertible(np.r_[1, params_seasonal_ma])
)
if invalid_seasonal_ma:
raise ValueError('non-invertible starting seasonal moving average'
' parameters found with `enforce_invertibility`'
' set to True.')
# Variances
params_exog_variance = []
if self.state_regression and self.time_varying_regression:
# TODO how to set the initial variance parameters?
params_exog_variance = [1] * self.k_exog
if self.state_error and params_variance == []:
if not params_seasonal_variance == []:
params_variance = params_seasonal_variance
elif self.k_exog > 0:
params_variance = np.inner(endog, endog)
else:
params_variance = np.inner(endog, endog) / self.nobs
params_measurement_variance = 1 if self.measurement_error else []
# Combine all parameters
return np.r_[
params_trend,
params_exog,
params_ar,
params_ma,
params_seasonal_ar,
params_seasonal_ma,
params_exog_variance,
params_measurement_variance,
params_variance
]
@property
def endog_names(self, latex=False):
"""Names of endogenous variables"""
diff = ''
if self.k_diff > 0:
if self.k_diff == 1:
diff = '\Delta' if latex else 'D'
else:
diff = ('\Delta^%d' if latex else 'D%d') % self.k_diff
seasonal_diff = ''
if self.k_seasonal_diff > 0:
if self.k_seasonal_diff == 1:
seasonal_diff = (('\Delta_%d' if latex else 'DS%d') %
(self.seasonal_periods))
else:
seasonal_diff = (('\Delta_%d^%d' if latex else 'D%dS%d') %
(self.k_seasonal_diff, self.seasonal_periods))
endog_diff = self.simple_differencing
if endog_diff and self.k_diff > 0 and self.k_seasonal_diff > 0:
return (('%s%s %s' if latex else '%s.%s.%s') %
(diff, seasonal_diff, self.data.ynames))
elif endog_diff and self.k_diff > 0:
return (('%s %s' if latex else '%s.%s') %
(diff, self.data.ynames))
elif endog_diff and self.k_seasonal_diff > 0:
return (('%s %s' if latex else '%s.%s') %
(seasonal_diff, self.data.ynames))
else:
return self.data.ynames
params_complete = [
'trend', 'exog', 'ar', 'ma', 'seasonal_ar', 'seasonal_ma',
'exog_variance', 'measurement_variance', 'variance'
]
@property
def param_terms(self):
"""
List of parameters actually included in the model, in sorted order.
TODO Make this an OrderedDict with slice or indices as the values.
"""
model_orders = self.model_orders
# Get basic list from model orders
params = [
order for order in self.params_complete
if model_orders[order] > 0
]
# k_exog may be positive without associated parameters if it is in the
# state vector
if 'exog' in params and not self.mle_regression:
params.remove('exog')
return params
@property
def param_names(self):
"""
List of human readable parameter names (for parameters actually
included in the model).
"""
params_sort_order = self.param_terms
model_names = self.model_names
return [
name for param in params_sort_order for name in model_names[param]
]
@property
def model_orders(self):
"""
The orders of each of the polynomials in the model.
"""
return {
'trend': self.k_trend,
'exog': self.k_exog,
'ar': self.k_ar,
'ma': self.k_ma,
'seasonal_ar': self.k_seasonal_ar,
'seasonal_ma': self.k_seasonal_ma,
'reduced_ar': self.k_ar + self.k_seasonal_ar,
'reduced_ma': self.k_ma + self.k_seasonal_ma,
'exog_variance': self.k_exog if (
self.state_regression and self.time_varying_regression) else 0,
'measurement_variance': int(self.measurement_error),
'variance': int(self.state_error),
}
@property
def model_names(self):
"""
The plain text names of all possible model parameters.
"""
return self._get_model_names(latex=False)
@property
def model_latex_names(self):
"""
The latex names of all possible model parameters.
"""
return self._get_model_names(latex=True)
def _get_model_names(self, latex=False):
names = {
'trend': None,
'exog': None,
'ar': None,
'ma': None,
'seasonal_ar': None,
'seasonal_ma': None,
'reduced_ar': None,
'reduced_ma': None,
'exog_variance': None,
'measurement_variance': None,
'variance': None,
}
# Trend
if self.k_trend > 0:
trend_template = 't_%d' if latex else 'trend.%d'
names['trend'] = []
for i in self.polynomial_trend.nonzero()[0]:
if i == 0:
names['trend'].append('intercept')
elif i == 1:
names['trend'].append('drift')
else:
names['trend'].append(trend_template % i)
# Exogenous coefficients
if self.k_exog > 0:
names['exog'] = self.exog_names
# Autoregressive
if self.k_ar > 0:
ar_template = '$\\phi_%d$' if latex else 'ar.L%d'
names['ar'] = []
for i in self.polynomial_ar.nonzero()[0][1:]:
names['ar'].append(ar_template % i)
# Moving Average
if self.k_ma > 0:
ma_template = '$\\theta_%d$' if latex else 'ma.L%d'
names['ma'] = []
for i in self.polynomial_ma.nonzero()[0][1:]:
names['ma'].append(ma_template % i)
# Seasonal Autoregressive
if self.k_seasonal_ar > 0:
seasonal_ar_template = (
'$\\tilde \\phi_%d$' if latex else 'ar.S.L%d'
)
names['seasonal_ar'] = []
for i in self.polynomial_seasonal_ar.nonzero()[0][1:]:
names['seasonal_ar'].append(seasonal_ar_template % i)
# Seasonal Moving Average
if self.k_seasonal_ma > 0:
seasonal_ma_template = (
'$\\tilde \\theta_%d$' if latex else 'ma.S.L%d'
)
names['seasonal_ma'] = []
for i in self.polynomial_seasonal_ma.nonzero()[0][1:]:
names['seasonal_ma'].append(seasonal_ma_template % i)
# Reduced Form Autoregressive
if self.k_ar > 0 or self.k_seasonal_ar > 0:
reduced_polynomial_ar = reduced_polynomial_ar = -np.polymul(
self.polynomial_ar, self.polynomial_seasonal_ar
)
ar_template = '$\\Phi_%d$' if latex else 'ar.R.L%d'
names['reduced_ar'] = []
for i in reduced_polynomial_ar.nonzero()[0][1:]:
names['reduced_ar'].append(ar_template % i)
# Reduced Form Moving Average
if self.k_ma > 0 or self.k_seasonal_ma > 0:
reduced_polynomial_ma = np.polymul(
self.polynomial_ma, self.polynomial_seasonal_ma
)
ma_template = '$\\Theta_%d$' if latex else 'ma.R.L%d'
names['reduced_ma'] = []
for i in reduced_polynomial_ma.nonzero()[0][1:]:
names['reduced_ma'].append(ma_template % i)
# Exogenous variances
if self.state_regression and self.time_varying_regression:
exog_var_template = '$\\sigma_\\text{%s}^2$' if latex else 'var.%s'
names['exog_variance'] = [
exog_var_template % exog_name for exog_name in self.exog_names
]
# Measurement error variance
if self.measurement_error:
meas_var_tpl = (
'$\\sigma_\\eta^2$' if latex else 'var.measurement_error'
)
names['measurement_variance'] = [meas_var_tpl]
# State variance
if self.state_error:
var_tpl = '$\\sigma_\\zeta^2$' if latex else 'sigma2'
names['variance'] = [var_tpl]
return names
def transform_params(self, unconstrained):
"""
Transform unconstrained parameters used by the optimizer to constrained
parameters used in likelihood evaluation.
Used primarily to enforce stationarity of the autoregressive lag
polynomial, invertibility of the moving average lag polynomial, and
positive variance parameters.
Parameters
----------
unconstrained : array_like
Unconstrained parameters used by the optimizer.
Returns
-------
constrained : array_like
Constrained parameters used in likelihood evaluation.
Notes
-----
If the lag polynomial has non-consecutive powers (so that the
coefficient is zero on some element of the polynomial), then the
constraint function is not onto the entire space of invertible
polynomials, although it only excludes a very small portion very close
to the invertibility boundary.
"""
unconstrained = np.array(unconstrained, ndmin=1)
constrained = np.zeros(unconstrained.shape, unconstrained.dtype)
start = end = 0
# Retain the trend parameters
if self.k_trend > 0:
end += self.k_trend
constrained[start:end] = unconstrained[start:end]
start += self.k_trend
# Retain any MLE regression coefficients
if self.mle_regression:
end += self.k_exog
constrained[start:end] = unconstrained[start:end]
start += self.k_exog
# Transform the AR parameters (phi) to be stationary
if self.k_ar_params > 0:
end += self.k_ar_params
if self.enforce_stationarity:
constrained[start:end] = (
constrain_stationary_univariate(unconstrained[start:end])
)
else:
constrained[start:end] = unconstrained[start:end]
start += self.k_ar_params
# Transform the MA parameters (theta) to be invertible
if self.k_ma_params > 0:
end += self.k_ma_params
if self.enforce_invertibility:
constrained[start:end] = (
-constrain_stationary_univariate(unconstrained[start:end])
)
else:
constrained[start:end] = unconstrained[start:end]
start += self.k_ma_params
# Transform the seasonal AR parameters (\tilde phi) to be stationary
if self.k_seasonal_ar > 0:
end += self.k_seasonal_ar_params
if self.enforce_stationarity:
constrained[start:end] = (
constrain_stationary_univariate(unconstrained[start:end])
)
else:
constrained[start:end] = unconstrained[start:end]
start += self.k_seasonal_ar_params
# Transform the seasonal MA parameters (\tilde theta) to be invertible
if self.k_seasonal_ma_params > 0:
end += self.k_seasonal_ma_params
if self.enforce_invertibility:
constrained[start:end] = (
-constrain_stationary_univariate(unconstrained[start:end])
)
else:
constrained[start:end] = unconstrained[start:end]
start += self.k_seasonal_ma_params
# Transform the standard deviation parameters to be positive
if self.state_regression and self.time_varying_regression:
end += self.k_exog
constrained[start:end] = unconstrained[start:end]**2
start += self.k_exog
if self.measurement_error:
constrained[start] = unconstrained[start]**2
start += 1
end += 1
if self.state_error:
constrained[start] = unconstrained[start]**2
# start += 1
# end += 1
return constrained
def untransform_params(self, constrained):
"""
Transform constrained parameters used in likelihood evaluation
to unconstrained parameters used by the optimizer
Used primarily to reverse enforcement of stationarity of the
autoregressive lag polynomial and invertibility of the moving average
lag polynomial.
Parameters
----------
constrained : array_like
Constrained parameters used in likelihood evaluation.
Returns
-------
constrained : array_like
Unconstrained parameters used by the optimizer.
Notes
-----
If the lag polynomial has non-consecutive powers (so that the
coefficient is zero on some element of the polynomial), then the
constraint function is not onto the entire space of invertible
polynomials, although it only excludes a very small portion very close
to the invertibility boundary.
"""
constrained = np.array(constrained, ndmin=1)
unconstrained = np.zeros(constrained.shape, constrained.dtype)
start = end = 0
# Retain the trend parameters
if self.k_trend > 0:
end += self.k_trend
unconstrained[start:end] = constrained[start:end]
start += self.k_trend
# Retain any MLE regression coefficients
if self.mle_regression:
end += self.k_exog
unconstrained[start:end] = constrained[start:end]
start += self.k_exog
# Transform the AR parameters (phi) to be stationary
if self.k_ar_params > 0:
end += self.k_ar_params
if self.enforce_stationarity:
unconstrained[start:end] = (
unconstrain_stationary_univariate(constrained[start:end])
)
else:
unconstrained[start:end] = constrained[start:end]
start += self.k_ar_params
# Transform the MA parameters (theta) to be invertible
if self.k_ma_params > 0:
end += self.k_ma_params
if self.enforce_invertibility:
unconstrained[start:end] = (
unconstrain_stationary_univariate(-constrained[start:end])
)
else:
unconstrained[start:end] = constrained[start:end]
start += self.k_ma_params
# Transform the seasonal AR parameters (\tilde phi) to be stationary
if self.k_seasonal_ar > 0:
end += self.k_seasonal_ar_params
if self.enforce_stationarity:
unconstrained[start:end] = (
unconstrain_stationary_univariate(constrained[start:end])
)
else:
unconstrained[start:end] = constrained[start:end]
start += self.k_seasonal_ar_params
# Transform the seasonal MA parameters (\tilde theta) to be invertible
if self.k_seasonal_ma_params > 0:
end += self.k_seasonal_ma_params
if self.enforce_invertibility:
unconstrained[start:end] = (
unconstrain_stationary_univariate(-constrained[start:end])
)
else:
unconstrained[start:end] = constrained[start:end]
start += self.k_seasonal_ma_params
# Untransform the standard deviation
if self.state_regression and self.time_varying_regression:
end += self.k_exog
unconstrained[start:end] = constrained[start:end]**0.5
start += self.k_exog
if self.measurement_error:
unconstrained[start] = constrained[start]**0.5
start += 1
end += 1
if self.state_error:
unconstrained[start] = constrained[start]**0.5
# start += 1
# end += 1
return unconstrained
def update(self, params, transformed=True, complex_step=False):
"""
Update the parameters of the model
Updates the representation matrices to fill in the new parameter
values.
Parameters
----------
params : array_like
Array of new parameters.
transformed : boolean, optional
Whether or not `params` is already transformed. If set to False,
`transform_params` is called. Default is True..
Returns
-------
params : array_like
Array of parameters.
"""
params = super(SARIMAX, self).update(params, transformed=transformed,
complex_step=False)
params_trend = None
params_exog = None
params_ar = None
params_ma = None
params_seasonal_ar = None
params_seasonal_ma = None
params_exog_variance = None
params_measurement_variance = None
params_variance = None
# Extract the parameters
start = end = 0
end += self.k_trend
params_trend = params[start:end]
start += self.k_trend
if self.mle_regression:
end += self.k_exog
params_exog = params[start:end]
start += self.k_exog
end += self.k_ar_params
params_ar = params[start:end]
start += self.k_ar_params
end += self.k_ma_params
params_ma = params[start:end]
start += self.k_ma_params
end += self.k_seasonal_ar_params
params_seasonal_ar = params[start:end]
start += self.k_seasonal_ar_params
end += self.k_seasonal_ma_params
params_seasonal_ma = params[start:end]
start += self.k_seasonal_ma_params
if self.state_regression and self.time_varying_regression:
end += self.k_exog
params_exog_variance = params[start:end]
start += self.k_exog
if self.measurement_error:
params_measurement_variance = params[start]
start += 1
end += 1
if self.state_error:
params_variance = params[start]
# start += 1
# end += 1
# Update lag polynomials
if self.k_ar > 0:
if self.polynomial_ar.dtype == params.dtype:
self.polynomial_ar[self._polynomial_ar_idx] = -params_ar
else:
polynomial_ar = self.polynomial_ar.real.astype(params.dtype)
polynomial_ar[self._polynomial_ar_idx] = -params_ar
self.polynomial_ar = polynomial_ar
if self.k_ma > 0:
if self.polynomial_ma.dtype == params.dtype:
self.polynomial_ma[self._polynomial_ma_idx] = params_ma
else:
polynomial_ma = self.polynomial_ma.real.astype(params.dtype)
polynomial_ma[self._polynomial_ma_idx] = params_ma
self.polynomial_ma = polynomial_ma
if self.k_seasonal_ar > 0:
idx = self._polynomial_seasonal_ar_idx
if self.polynomial_seasonal_ar.dtype == params.dtype:
self.polynomial_seasonal_ar[idx] = -params_seasonal_ar
else:
polynomial_seasonal_ar = (
self.polynomial_seasonal_ar.real.astype(params.dtype)
)
polynomial_seasonal_ar[idx] = -params_seasonal_ar
self.polynomial_seasonal_ar = polynomial_seasonal_ar
if self.k_seasonal_ma > 0:
idx = self._polynomial_seasonal_ma_idx
if self.polynomial_seasonal_ma.dtype == params.dtype:
self.polynomial_seasonal_ma[idx] = params_seasonal_ma
else:
polynomial_seasonal_ma = (
self.polynomial_seasonal_ma.real.astype(params.dtype)
)
polynomial_seasonal_ma[idx] = params_seasonal_ma
self.polynomial_seasonal_ma = polynomial_seasonal_ma
# Get the reduced form lag polynomial terms by multiplying the regular
# and seasonal lag polynomials
# Note: that although the numpy np.polymul examples assume that they
# are ordered from highest degree to lowest, whereas our are from
# lowest to highest, it does not matter.
if self.k_seasonal_ar > 0:
reduced_polynomial_ar = -np.polymul(
self.polynomial_ar, self.polynomial_seasonal_ar
)
else:
reduced_polynomial_ar = -self.polynomial_ar
if self.k_seasonal_ma > 0:
reduced_polynomial_ma = np.polymul(
self.polynomial_ma, self.polynomial_seasonal_ma
)
else:
reduced_polynomial_ma = self.polynomial_ma
# Observation intercept
# Exogenous data with MLE estimation of parameters enters through a
# time-varying observation intercept (is equivalent to simply
# subtracting it out of the endogenous variable first)
if self.mle_regression:
self.ssm['obs_intercept'] = np.dot(self.exog, params_exog)[None, :]
# State intercept (Harvey) or additional observation intercept
# (Hamilton)
# SARIMA trend enters through the a time-varying state intercept,
# associated with the first row of the stationary component of the
# state vector (i.e. the first element of the state vector following
# any differencing elements)
if self.k_trend > 0:
data = np.dot(self._trend_data, params_trend).astype(params.dtype)
if not self.hamilton_representation:
self.ssm['state_intercept', self._k_states_diff, :] = data
else:
# The way the trend enters in the Hamilton representation means
# that the parameter is not an ``intercept'' but instead the
# mean of the process. The trend values in `data` are meant for
# an intercept, and so must be transformed to represent the
# mean instead
if self.hamilton_representation:
data /= np.sum(-reduced_polynomial_ar)
# If we already set the observation intercept for MLE
# regression, just add to it
if self.mle_regression:
self.ssm.obs_intercept += data[None, :]
# Otherwise set it directly
else:
self.ssm['obs_intercept'] = data[None, :]
# Observation covariance matrix
if self.measurement_error:
self.ssm['obs_cov', 0, 0] = params_measurement_variance
# Transition matrix
if self.k_ar > 0 or self.k_seasonal_ar > 0:
self.ssm[self.transition_ar_params_idx] = reduced_polynomial_ar[1:]
elif not self.ssm.transition.dtype == params.dtype:
# This is required if the transition matrix is not really in use
# (e.g. for an MA(q) process) so that it's dtype never changes as
# the parameters' dtype changes. This changes the dtype manually.
self.ssm['transition'] = self.ssm['transition'].real.astype(
params.dtype)
# Selection matrix (Harvey) or Design matrix (Hamilton)
if self.k_ma > 0 or self.k_seasonal_ma > 0:
if not self.hamilton_representation:
self.ssm[self.selection_ma_params_idx] = (
reduced_polynomial_ma[1:]
)
else:
self.ssm[self.design_ma_params_idx] = reduced_polynomial_ma[1:]
# State covariance matrix
if self.k_posdef > 0:
self.ssm['state_cov', 0, 0] = params_variance
if self.state_regression and self.time_varying_regression:
self.ssm[self._exog_variance_idx] = params_exog_variance
# Initialize
if not self._manual_initialization:
self.initialize_state(complex_step=complex_step)
return params
class SARIMAXResults(MLEResults):
"""
Class to hold results from fitting an SARIMAX model.
Parameters
----------
model : SARIMAX instance
The fitted model instance
Attributes
----------
specification : dictionary
Dictionary including all attributes from the SARIMAX model instance.
polynomial_ar : array
Array containing autoregressive lag polynomial coefficients,
ordered from lowest degree to highest. Initialized with ones, unless
a coefficient is constrained to be zero (in which case it is zero).
polynomial_ma : array
Array containing moving average lag polynomial coefficients,
ordered from lowest degree to highest. Initialized with ones, unless
a coefficient is constrained to be zero (in which case it is zero).
polynomial_seasonal_ar : array
Array containing seasonal autoregressive lag polynomial coefficients,
ordered from lowest degree to highest. Initialized with ones, unless
a coefficient is constrained to be zero (in which case it is zero).
polynomial_seasonal_ma : array
Array containing seasonal moving average lag polynomial coefficients,
ordered from lowest degree to highest. Initialized with ones, unless
a coefficient is constrained to be zero (in which case it is zero).
polynomial_trend : array
Array containing trend polynomial coefficients, ordered from lowest
degree to highest. Initialized with ones, unless a coefficient is
constrained to be zero (in which case it is zero).
model_orders : list of int
The orders of each of the polynomials in the model.
param_terms : list of str
List of parameters actually included in the model, in sorted order.
See Also
--------
statsmodels.tsa.statespace.kalman_filter.FilterResults
statsmodels.tsa.statespace.mlemodel.MLEResults
"""
def __init__(self, model, params, filter_results, cov_type='opg',
**kwargs):
super(SARIMAXResults, self).__init__(model, params, filter_results,
cov_type, **kwargs)
self.df_resid = np.inf # attribute required for wald tests
# Save _init_kwds
self._init_kwds = self.model._get_init_kwds()
# Save model specification
self.specification = Bunch(**{
# Set additional model parameters
'seasonal_periods': self.model.seasonal_periods,
'measurement_error': self.model.measurement_error,
'time_varying_regression': self.model.time_varying_regression,
'simple_differencing': self.model.simple_differencing,
'enforce_stationarity': self.model.enforce_stationarity,
'enforce_invertibility': self.model.enforce_invertibility,
'hamilton_representation': self.model.hamilton_representation,
'order': self.model.order,
'seasonal_order': self.model.seasonal_order,
# Model order
'k_diff': self.model.k_diff,
'k_seasonal_diff': self.model.k_seasonal_diff,
'k_ar': self.model.k_ar,
'k_ma': self.model.k_ma,
'k_seasonal_ar': self.model.k_seasonal_ar,
'k_seasonal_ma': self.model.k_seasonal_ma,
# Param Numbers
'k_ar_params': self.model.k_ar_params,
'k_ma_params': self.model.k_ma_params,
# Trend / Regression
'trend': self.model.trend,
'k_trend': self.model.k_trend,
'k_exog': self.model.k_exog,
'mle_regression': self.model.mle_regression,
'state_regression': self.model.state_regression,
})
# Polynomials
self.polynomial_trend = self.model.polynomial_trend
self.polynomial_ar = self.model.polynomial_ar
self.polynomial_ma = self.model.polynomial_ma
self.polynomial_seasonal_ar = self.model.polynomial_seasonal_ar
self.polynomial_seasonal_ma = self.model.polynomial_seasonal_ma
self.polynomial_reduced_ar = np.polymul(
self.polynomial_ar, self.polynomial_seasonal_ar
)
self.polynomial_reduced_ma = np.polymul(
self.polynomial_ma, self.polynomial_seasonal_ma
)
# Distinguish parameters
self.model_orders = self.model.model_orders
self.param_terms = self.model.param_terms
start = end = 0
for name in self.param_terms:
if name == 'ar':
k = self.model.k_ar_params
elif name == 'ma':
k = self.model.k_ma_params
elif name == 'seasonal_ar':
k = self.model.k_seasonal_ar_params
elif name == 'seasonal_ma':
k = self.model.k_seasonal_ma_params
else:
k = self.model_orders[name]
end += k
setattr(self, '_params_%s' % name, self.params[start:end])
start += k
# Handle removing data
self._data_attr_model.extend(['orig_endog', 'orig_exog'])
@cache_readonly
def arroots(self):
"""
(array) Roots of the reduced form autoregressive lag polynomial
"""
return np.roots(self.polynomial_reduced_ar)**-1
@cache_readonly
def maroots(self):
"""
(array) Roots of the reduced form moving average lag polynomial
"""
return np.roots(self.polynomial_reduced_ma)**-1
@cache_readonly
def arfreq(self):
"""
(array) Frequency of the roots of the reduced form autoregressive
lag polynomial
"""
z = self.arroots
if not z.size:
return
return np.arctan2(z.imag, z.real) / (2 * np.pi)
@cache_readonly
def mafreq(self):
"""
(array) Frequency of the roots of the reduced form moving average
lag polynomial
"""
z = self.maroots
if not z.size:
return
return np.arctan2(z.imag, z.real) / (2 * np.pi)
@cache_readonly
def arparams(self):
"""
(array) Autoregressive parameters actually estimated in the model.
Does not include seasonal autoregressive parameters (see
`seasonalarparams`) or parameters whose values are constrained to be
zero.
"""
return self._params_ar
@cache_readonly
def seasonalarparams(self):
"""
(array) Seasonal autoregressive parameters actually estimated in the
model. Does not include nonseasonal autoregressive parameters (see
`arparams`) or parameters whose values are constrained to be zero.
"""
return self._params_seasonal_ar
@cache_readonly
def maparams(self):
"""
(array) Moving average parameters actually estimated in the model.
Does not include seasonal moving average parameters (see
`seasonalmaparams`) or parameters whose values are constrained to be
zero.
"""
return self._params_ma
@cache_readonly
def seasonalmaparams(self):
"""
(array) Seasonal moving average parameters actually estimated in the
model. Does not include nonseasonal moving average parameters (see
`maparams`) or parameters whose values are constrained to be zero.
"""
return self._params_seasonal_ma
def get_prediction(self, start=None, end=None, dynamic=False, index=None,
exog=None, **kwargs):
"""
In-sample prediction and out-of-sample forecasting
Parameters
----------
start : int, str, or datetime, optional
Zero-indexed observation number at which to start forecasting, ie.,
the first forecast is start. Can also be a date string to
parse or a datetime type. Default is the the zeroth observation.
end : int, str, or datetime, optional
Zero-indexed observation number at which to end forecasting, ie.,
the first forecast is start. Can also be a date string to
parse or a datetime type. However, if the dates index does not
have a fixed frequency, end must be an integer index if you
want out of sample prediction. Default is the last observation in
the sample.
exog : array_like, optional
If the model includes exogenous regressors, you must provide
exactly enough out-of-sample values for the exogenous variables if
end is beyond the last observation in the sample.
dynamic : boolean, int, str, or datetime, optional
Integer offset relative to `start` at which to begin dynamic
prediction. Can also be an absolute date string to parse or a
datetime type (these are not interpreted as offsets).
Prior to this observation, true endogenous values will be used for
prediction; starting with this observation and continuing through
the end of prediction, forecasted endogenous values will be used
instead.
full_results : boolean, optional
If True, returns a FilterResults instance; if False returns a
tuple with forecasts, the forecast errors, and the forecast error
covariance matrices. Default is False.
**kwargs
Additional arguments may required for forecasting beyond the end
of the sample. See `FilterResults.predict` for more details.
Returns
-------
forecast : array
Array of out of sample forecasts.
"""
if start is None:
start = self.model._index[0]
# Handle start, end, dynamic
_start, _end, _out_of_sample, prediction_index = (
self.model._get_prediction_index(start, end, index, silent=True))
# Handle exogenous parameters
if _out_of_sample and (self.model.k_exog + self.model.k_trend > 0):
# Create a new faux SARIMAX model for the extended dataset
nobs = self.model.data.orig_endog.shape[0] + _out_of_sample
endog = np.zeros((nobs, self.model.k_endog))
if self.model.k_exog > 0:
if exog is None:
raise ValueError('Out-of-sample forecasting in a model'
' with a regression component requires'
' additional exogenous values via the'
' `exog` argument.')
exog = np.array(exog)
required_exog_shape = (_out_of_sample, self.model.k_exog)
if not exog.shape == required_exog_shape:
raise ValueError('Provided exogenous values are not of the'
' appropriate shape. Required %s, got %s.'
% (str(required_exog_shape),
str(exog.shape)))
exog = np.c_[self.model.data.orig_exog.T, exog.T].T
model_kwargs = self._init_kwds.copy()
model_kwargs['exog'] = exog
model = SARIMAX(endog, **model_kwargs)
model.update(self.params)
# Set the kwargs with the update time-varying state space
# representation matrices
for name in self.filter_results.shapes.keys():
if name == 'obs':
continue
mat = getattr(model.ssm, name)
if mat.shape[-1] > 1:
if len(mat.shape) == 2:
kwargs[name] = mat[:, -_out_of_sample:]
else:
kwargs[name] = mat[:, :, -_out_of_sample:]
elif self.model.k_exog == 0 and exog is not None:
warn('Exogenous array provided to predict, but additional data not'
' required. `exog` argument ignored.', ValueWarning)
return super(SARIMAXResults, self).get_prediction(
start=start, end=end, dynamic=dynamic, index=index, exog=exog,
**kwargs)
def summary(self, alpha=.05, start=None):
# Create the model name
# See if we have an ARIMA component
order = ''
if self.model.k_ar + self.model.k_diff + self.model.k_ma > 0:
if self.model.k_ar == self.model.k_ar_params:
order_ar = self.model.k_ar
else:
order_ar = tuple(self.polynomial_ar.nonzero()[0][1:])
if self.model.k_ma == self.model.k_ma_params:
order_ma = self.model.k_ma
else:
order_ma = tuple(self.polynomial_ma.nonzero()[0][1:])
# If there is simple differencing, then that is reflected in the
# dependent variable name
k_diff = 0 if self.model.simple_differencing else self.model.k_diff
order = '(%s, %d, %s)' % (order_ar, k_diff, order_ma)
# See if we have an SARIMA component
seasonal_order = ''
has_seasonal = (
self.model.k_seasonal_ar +
self.model.k_seasonal_diff +
self.model.k_seasonal_ma
) > 0
if has_seasonal:
if self.model.k_ar == self.model.k_ar_params:
order_seasonal_ar = (
int(self.model.k_seasonal_ar / self.model.seasonal_periods)
)
else:
order_seasonal_ar = (
tuple(self.polynomial_seasonal_ar.nonzero()[0][1:])
)
if self.model.k_ma == self.model.k_ma_params:
order_seasonal_ma = (
int(self.model.k_seasonal_ma / self.model.seasonal_periods)
)
else:
order_seasonal_ma = (
tuple(self.polynomial_seasonal_ma.nonzero()[0][1:])
)
# If there is simple differencing, then that is reflected in the
# dependent variable name
k_seasonal_diff = self.model.k_seasonal_diff
if self.model.simple_differencing:
k_seasonal_diff = 0
seasonal_order = ('(%s, %d, %s, %d)' %
(str(order_seasonal_ar), k_seasonal_diff,
str(order_seasonal_ma),
self.model.seasonal_periods))
if not order == '':
order += 'x'
model_name = (
'%s%s%s' % (self.model.__class__.__name__, order, seasonal_order)
)
return super(SARIMAXResults, self).summary(
alpha=alpha, start=start, model_name=model_name
)
summary.__doc__ = MLEResults.summary.__doc__
class SARIMAXResultsWrapper(MLEResultsWrapper):
_attrs = {}
_wrap_attrs = wrap.union_dicts(MLEResultsWrapper._wrap_attrs,
_attrs)
_methods = {}
_wrap_methods = wrap.union_dicts(MLEResultsWrapper._wrap_methods,
_methods)
wrap.populate_wrapper(SARIMAXResultsWrapper, SARIMAXResults)
| 40.868331 | 79 | 0.602391 |
7953a5d75093b3de8e27ed4dda72300c6445d4df | 1,224 | py | Python | src/profiles/admin.py | TechFitU/SctVehCheck | 4e034c6040dccda8477a3ded14b2fb571fde70b9 | [
"MIT"
] | null | null | null | src/profiles/admin.py | TechFitU/SctVehCheck | 4e034c6040dccda8477a3ded14b2fb571fde70b9 | [
"MIT"
] | 13 | 2020-02-11T22:48:15.000Z | 2022-03-11T23:25:40.000Z | src/profiles/admin.py | TechFitU/SctVehCheck | 4e034c6040dccda8477a3ded14b2fb571fde70b9 | [
"MIT"
] | null | null | null | from __future__ import unicode_literals
from authtools.admin import NamedUserAdmin
from django.contrib import admin
from django.contrib.auth import get_user_model
from django.urls import reverse
from django.utils.html import format_html
from django.utils.text import gettext_lazy
from .models import Profile
User = get_user_model()
# Define an inline admin descriptor for Employee model
# which acts a bit like a singleton
class UserProfileInline(admin.StackedInline):
model = Profile
can_delete = False
verbose_name_plural = gettext_lazy("profile")
class NewUserAdmin(NamedUserAdmin):
inlines = [UserProfileInline]
list_display = ('is_active', 'email', 'name', 'permalink',
'is_superuser', 'is_staff',)
# 'View on site' didn't work since the original User model needs to
# have get_absolute_url defined. So showing on the list display
# was a workaround.
def permalink(self, obj):
url = reverse("profiles:show",
kwargs={"slug": obj.profile.slug})
# Unicode hex b6 is the Pilcrow sign
return format_html('<a href="{}">{}</a>'.format(url, 'Go'))
admin.site.unregister(User)
admin.site.register(User, NewUserAdmin)
| 31.384615 | 71 | 0.714869 |
7953a790b7f28ae8dcc2e34539b7f57eb0423dc4 | 5,478 | py | Python | MicroPython_BUILD/components/micropython/esp32/modules_examples/drivers/mpu6500.py | sio-funmatsu/MicroPython_ESP32_psRAM_LoBo | 108f1ceaa79c120de652af744eda01b1a4a5dc8c | [
"Apache-2.0"
] | 1 | 2020-04-27T23:05:18.000Z | 2020-04-27T23:05:18.000Z | MicroPython_BUILD/components/micropython/esp32/modules_examples/drivers/mpu6500.py | sio-funmatsu/MicroPython_ESP32_psRAM_LoBo | 108f1ceaa79c120de652af744eda01b1a4a5dc8c | [
"Apache-2.0"
] | null | null | null | MicroPython_BUILD/components/micropython/esp32/modules_examples/drivers/mpu6500.py | sio-funmatsu/MicroPython_ESP32_psRAM_LoBo | 108f1ceaa79c120de652af744eda01b1a4a5dc8c | [
"Apache-2.0"
] | 1 | 2020-04-27T23:14:37.000Z | 2020-04-27T23:14:37.000Z | #
# This file is part of MicroPython MPU9250 driver
# Copyright (c) 2018 Mika Tuupola
#
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license.php
#
# Project home:
# https://github.com/tuupola/micropython-mpu9250
#
"""
MicroPython I2C driver for MPU6500 6-axis motion tracking device
"""
__version__ = "0.2.0-dev"
# pylint: disable=import-error
import ustruct
from machine import I2C, Pin
from micropython import const
# pylint: enable=import-error
_GYRO_CONFIG = const(0x1b)
_ACCEL_CONFIG = const(0x1c)
_ACCEL_CONFIG2 = const(0x1d)
_INT_PIN_CFG = const(0x37)
_ACCEL_XOUT_H = const(0x3b)
_ACCEL_XOUT_L = const(0x3c)
_ACCEL_YOUT_H = const(0x3d)
_ACCEL_YOUT_L = const(0x3e)
_ACCEL_ZOUT_H = const(0x3f)
_ACCEL_ZOUT_L = const(0x40)
_TEMP_OUT_H = const(0x41)
_TEMP_OUT_L = const(0x42)
_GYRO_XOUT_H = const(0x43)
_GYRO_XOUT_L = const(0x44)
_GYRO_YOUT_H = const(0x45)
_GYRO_YOUT_L = const(0x46)
_GYRO_ZOUT_H = const(0x47)
_GYRO_ZOUT_L = const(0x48)
_WHO_AM_I = const(0x75)
#_ACCEL_FS_MASK = const(0b00011000)
ACCEL_FS_SEL_2G = const(0b00000000)
ACCEL_FS_SEL_4G = const(0b00001000)
ACCEL_FS_SEL_8G = const(0b00010000)
ACCEL_FS_SEL_16G = const(0b00011000)
_ACCEL_SO_2G = 16384 # 1 / 16384 ie. 0.061 mg / digit
_ACCEL_SO_4G = 8192 # 1 / 8192 ie. 0.122 mg / digit
_ACCEL_SO_8G = 4096 # 1 / 4096 ie. 0.244 mg / digit
_ACCEL_SO_16G = 2048 # 1 / 2048 ie. 0.488 mg / digit
#_GYRO_FS_MASK = const(0b00011000)
GYRO_FS_SEL_250DPS = const(0b00000000)
GYRO_FS_SEL_500DPS = const(0b00001000)
GYRO_FS_SEL_1000DPS = const(0b00010000)
GYRO_FS_SEL_2000DPS = const(0b00011000)
_GYRO_SO_250DPS = 131
_GYRO_SO_500DPS = 65.5
_GYRO_SO_1000DPS = 32.8
_GYRO_SO_2000DPS = 16.4
# Used for enablind and disabling the i2c bypass access
_I2C_BYPASS_MASK = const(0b00000010)
_I2C_BYPASS_EN = const(0b00000010)
_I2C_BYPASS_DIS = const(0b00000000)
SF_G = 1
SF_M_S2 = 9.80665 # 1 g = 9.80665 m/s2 ie. standard gravity
SF_DEG_S = 1
SF_RAD_S = 57.295779513082 # 1 rad/s is 57.295779513082 deg/s
class MPU6500:
"""Class which provides interface to MPU6500 6-axis motion tracking device."""
def __init__(
self, i2c, address=0x68,
accel_fs=ACCEL_FS_SEL_2G, gyro_fs=GYRO_FS_SEL_250DPS,
accel_sf=SF_M_S2, gyro_sf=SF_RAD_S
):
self.i2c = i2c
self.address = address
if 0x71 != self.whoami:
raise RuntimeError("MPU6500 not found in I2C bus.")
self._accel_so = self._accel_fs(accel_fs)
self._gyro_so = self._gyro_fs(gyro_fs)
self._accel_sf = accel_sf
self._gyro_sf = gyro_sf
# Enable I2C bypass to access for MPU9250 magnetometer access.
char = self._register_char(_INT_PIN_CFG)
char &= ~_I2C_BYPASS_MASK # clear I2C bits
char |= _I2C_BYPASS_EN
self._register_char(_INT_PIN_CFG, char)
@property
def acceleration(self):
"""
Acceleration measured by the sensor. By default will return a
3-tuple of X, Y, Z axis acceleration values in m/s^2 as floats. Will
return values in g if constructor was provided `accel_sf=SF_M_S2`
parameter.
"""
so = self._accel_so
sf = self._accel_sf
xyz = self._register_three_shorts(_ACCEL_XOUT_H)
return tuple([value / so * sf for value in xyz])
@property
def gyro(self):
"""
X, Y, Z radians per second as floats.
"""
so = self._gyro_so
sf = self._gyro_sf
xyz = self._register_three_shorts(_GYRO_XOUT_H)
return tuple([value / so * sf for value in xyz])
@property
def whoami(self):
""" Value of the whoami register. """
return self._register_char(_WHO_AM_I)
def _register_short(self, register, value=None, buf=bytearray(2)):
if value is None:
self.i2c.readfrom_mem_into(self.address, register, buf)
return ustruct.unpack(">h", buf)[0]
ustruct.pack_into(">h", buf, 0, value)
return self.i2c.writeto_mem(self.address, register, buf)
def _register_three_shorts(self, register, buf=bytearray(6)):
self.i2c.readfrom_mem_into(self.address, register, buf)
return ustruct.unpack(">hhh", buf)
def _register_char(self, register, value=None, buf=bytearray(1)):
if value is None:
self.i2c.readfrom_mem_into(self.address, register, buf)
return buf[0]
ustruct.pack_into("<b", buf, 0, value)
return self.i2c.writeto_mem(self.address, register, buf)
def _accel_fs(self, value):
self._register_char(_ACCEL_CONFIG, value)
# Return the sensitivity divider
if ACCEL_FS_SEL_2G == value:
return _ACCEL_SO_2G
elif ACCEL_FS_SEL_4G == value:
return _ACCEL_SO_4G
elif ACCEL_FS_SEL_8G == value:
return _ACCEL_SO_8G
elif ACCEL_FS_SEL_16G == value:
return _ACCEL_SO_16G
def _gyro_fs(self, value):
self._register_char(_GYRO_CONFIG, value)
# Return the sensitivity divider
if GYRO_FS_SEL_250DPS == value:
return _GYRO_SO_250DPS
elif GYRO_FS_SEL_500DPS == value:
return _GYRO_SO_500DPS
elif GYRO_FS_SEL_1000DPS == value:
return _GYRO_SO_1000DPS
elif GYRO_FS_SEL_2000DPS == value:
return _GYRO_SO_2000DPS
def __enter__(self):
return self
def __exit__(self, exception_type, exception_value, traceback):
pass
| 30.265193 | 82 | 0.678897 |
7953a7bb8cfc7eb72be3ded4082c542cfae8efdf | 3,224 | py | Python | homeassistant/components/cert_expiry/config_flow.py | erogleva/core | 994ae09f69afe772150a698953c0d7386a745de2 | [
"Apache-2.0"
] | 6 | 2016-11-25T06:36:27.000Z | 2021-11-16T11:20:23.000Z | homeassistant/components/cert_expiry/config_flow.py | erogleva/core | 994ae09f69afe772150a698953c0d7386a745de2 | [
"Apache-2.0"
] | 57 | 2020-10-15T06:47:00.000Z | 2022-03-31T06:11:18.000Z | homeassistant/components/cert_expiry/config_flow.py | erogleva/core | 994ae09f69afe772150a698953c0d7386a745de2 | [
"Apache-2.0"
] | 14 | 2018-08-19T16:28:26.000Z | 2021-09-02T18:26:53.000Z | """Config flow for the Cert Expiry platform."""
import logging
import voluptuous as vol
from homeassistant import config_entries
from homeassistant.const import CONF_HOST, CONF_PORT
from .const import DEFAULT_PORT, DOMAIN # pylint: disable=unused-import
from .errors import (
ConnectionRefused,
ConnectionTimeout,
ResolveFailed,
ValidationFailure,
)
from .helper import get_cert_expiry_timestamp
_LOGGER = logging.getLogger(__name__)
class CertexpiryConfigFlow(config_entries.ConfigFlow, domain=DOMAIN):
"""Handle a config flow."""
VERSION = 1
CONNECTION_CLASS = config_entries.CONN_CLASS_LOCAL_POLL
def __init__(self) -> None:
"""Initialize the config flow."""
self._errors = {}
async def _test_connection(self, user_input=None):
"""Test connection to the server and try to get the certificate."""
try:
await get_cert_expiry_timestamp(
self.hass,
user_input[CONF_HOST],
user_input.get(CONF_PORT, DEFAULT_PORT),
)
return True
except ResolveFailed:
self._errors[CONF_HOST] = "resolve_failed"
except ConnectionTimeout:
self._errors[CONF_HOST] = "connection_timeout"
except ConnectionRefused:
self._errors[CONF_HOST] = "connection_refused"
except ValidationFailure:
return True
return False
async def async_step_user(self, user_input=None):
"""Step when user initializes a integration."""
self._errors = {}
if user_input is not None:
host = user_input[CONF_HOST]
port = user_input.get(CONF_PORT, DEFAULT_PORT)
await self.async_set_unique_id(f"{host}:{port}")
self._abort_if_unique_id_configured()
if await self._test_connection(user_input):
title_port = f":{port}" if port != DEFAULT_PORT else ""
title = f"{host}{title_port}"
return self.async_create_entry(
title=title,
data={CONF_HOST: host, CONF_PORT: port},
)
if ( # pylint: disable=no-member
self.context["source"] == config_entries.SOURCE_IMPORT
):
_LOGGER.error("Config import failed for %s", user_input[CONF_HOST])
return self.async_abort(reason="import_failed")
else:
user_input = {}
user_input[CONF_HOST] = ""
user_input[CONF_PORT] = DEFAULT_PORT
return self.async_show_form(
step_id="user",
data_schema=vol.Schema(
{
vol.Required(CONF_HOST, default=user_input[CONF_HOST]): str,
vol.Required(
CONF_PORT, default=user_input.get(CONF_PORT, DEFAULT_PORT)
): int,
}
),
errors=self._errors,
)
async def async_step_import(self, user_input=None):
"""Import a config entry.
Only host was required in the yaml file all other fields are optional
"""
return await self.async_step_user(user_input)
| 33.936842 | 83 | 0.600496 |
7953aa09634a29afe8d6584459063804241405df | 10,007 | bzl | Python | third_party_repositories.bzl | meteorcloudy/bazel-federation | b3252e9c00cd6c788139008cd0ce34a4b0481b53 | [
"Apache-2.0"
] | 49 | 2019-01-09T19:21:34.000Z | 2021-11-10T22:21:27.000Z | third_party_repositories.bzl | meteorcloudy/bazel-federation | b3252e9c00cd6c788139008cd0ce34a4b0481b53 | [
"Apache-2.0"
] | 55 | 2019-03-19T15:35:05.000Z | 2021-07-12T08:30:39.000Z | third_party_repositories.bzl | meteorcloudy/bazel-federation | b3252e9c00cd6c788139008cd0ce34a4b0481b53 | [
"Apache-2.0"
] | 17 | 2019-01-09T16:37:01.000Z | 2021-11-09T12:07:53.000Z | load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
def _import_abseil_py(name):
maybe(
http_archive,
name = name,
sha256 = "3d0f39e0920379ff1393de04b573bca3484d82a5f8b939e9e83b20b6106c9bbe",
strip_prefix = "abseil-py-pypi-v0.7.1",
urls = [
"https://mirror.bazel.build/github.com/abseil/abseil-py/archive/pypi-v0.7.1.tar.gz",
"https://github.com/abseil/abseil-py/archive/pypi-v0.7.1.tar.gz",
],
)
def abseil_py():
# TODO(fweikert): remove this hack. It's currently needed since rules_cc and rule_pkg
# use different repository names for abseil.
_import_abseil_py("abseil_py")
_import_abseil_py("io_abseil_py")
def futures_2_whl():
maybe(
http_file,
name = "futures_2_2_0_whl",
downloaded_file_path = "futures-2.2.0-py2.py3-none-any.whl",
sha256 = "9fd22b354a4c4755ad8c7d161d93f5026aca4cfe999bd2e53168f14765c02cd6",
# From https://pypi.python.org/pypi/futures/2.2.0
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/d7/1d/68874943aa37cf1c483fc61def813188473596043158faa6511c04a038b4/futures-2.2.0-py2.py3-none-any.whl",
"https://pypi.python.org/packages/d7/1d/68874943aa37cf1c483fc61def813188473596043158faa6511c04a038b4/futures-2.2.0-py2.py3-none-any.whl",
],
)
def futures_3_whl():
maybe(
http_file,
name = "futures_3_1_1_whl",
downloaded_file_path = "futures-3.1.1-py2-none-any.whl",
sha256 = "c4884a65654a7c45435063e14ae85280eb1f111d94e542396717ba9828c4337f",
# From https://pypi.python.org/pypi/futures
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/a6/1c/72a18c8c7502ee1b38a604a5c5243aa8c2a64f4bba4e6631b1b8972235dd/futures-3.1.1-py2-none-any.whl",
"https://pypi.python.org/packages/a6/1c/72a18c8c7502ee1b38a604a5c5243aa8c2a64f4bba4e6631b1b8972235dd/futures-3.1.1-py2-none-any.whl",
],
)
def google_cloud_language_whl():
maybe(
http_file,
name = "google_cloud_language_whl",
downloaded_file_path = "google_cloud_language-0.29.0-py2.py3-none-any.whl",
sha256 = "a2dd34f0a0ebf5705dcbe34bd41199b1d0a55c4597d38ed045bd183361a561e9",
# From https://pypi.python.org/pypi/google-cloud-language
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/6e/86/cae57e4802e72d9e626ee5828ed5a646cf4016b473a4a022f1038dba3460/google_cloud_language-0.29.0-py2.py3-none-any.whl",
"https://pypi.python.org/packages/6e/86/cae57e4802e72d9e626ee5828ed5a646cf4016b473a4a022f1038dba3460/google_cloud_language-0.29.0-py2.py3-none-any.whl",
],
)
def grpc_whl():
maybe(
http_file,
name = "grpc_whl",
downloaded_file_path = "grpcio-1.6.0-cp27-cp27m-manylinux1_i686.whl",
sha256 = "c232d6d168cb582e5eba8e1c0da8d64b54b041dd5ea194895a2fe76050916561",
# From https://pypi.python.org/pypi/grpcio/1.6.0
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/c6/28/67651b4eabe616b27472c5518f9b2aa3f63beab8f62100b26f05ac428639/grpcio-1.6.0-cp27-cp27m-manylinux1_i686.whl",
"https://pypi.python.org/packages/c6/28/67651b4eabe616b27472c5518f9b2aa3f63beab8f62100b26f05ac428639/grpcio-1.6.0-cp27-cp27m-manylinux1_i686.whl",
],
)
JINJA2_BUILD_FILE = """
py_library(
name = "jinja2",
srcs = glob(["jinja2/*.py"]),
srcs_version = "PY2AND3",
deps = [
"@markupsafe_archive//:markupsafe",
],
visibility = ["//visibility:public"],
)
"""
def jinja2():
maybe(
http_archive,
name = "jinja2_archive",
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/source/J/Jinja2/Jinja2-2.8.tar.gz",
"https://pypi.python.org/packages/source/J/Jinja2/Jinja2-2.8.tar.gz",
],
sha256 = "bc1ff2ff88dbfacefde4ddde471d1417d3b304e8df103a7a9437d47269201bf4",
build_file_content = JINJA2_BUILD_FILE,
strip_prefix = "Jinja2-2.8",
)
native.bind(
name = "jinja2",
actual = "@jinja2_archive//:jinja2",
)
# For manual testing against an LLVM toolchain.
# Use --crosstool_top=@llvm_toolchain//:toolchain
def llvm_toolchain():
maybe(
http_archive,
name = "com_grail_bazel_toolchain",
sha256 = "aafea89b6abe75205418c0d2127252948afe6c7f2287a79b67aab3e0c3676c4f",
strip_prefix = "bazel-toolchain-d0a5b0af3102c7c607f2cf098421fcdbaeaaaf19",
urls = [
"https://mirror.bazel.build/github.com/grailbio/bazel-toolchain/archive/d0a5b0af3102c7c607f2cf098421fcdbaeaaaf19.tar.gz",
"https://github.com/grailbio/bazel-toolchain/archive/d0a5b0af3102c7c607f2cf098421fcdbaeaaaf19.tar.gz",
],
)
MARKUPSAFE_BUILD_FILE = """
py_library(
name = "markupsafe",
srcs = glob(["markupsafe/*.py"]),
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)
"""
def markupsafe():
maybe(
http_archive,
name = "markupsafe_archive",
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz",
"https://pypi.python.org/packages/source/M/MarkupSafe/MarkupSafe-0.23.tar.gz",
],
sha256 = "a4ec1aff59b95a14b45eb2e23761a0179e98319da5a7eb76b56ea8cdc7b871c3",
build_file_content = MARKUPSAFE_BUILD_FILE,
strip_prefix = "MarkupSafe-0.23",
)
native.bind(
name = "markupsafe",
actual = "@markupsafe_archive//:markupsafe",
)
MISTUNE_BUILD_FILE = """
py_library(
name = "mistune",
srcs = ["mistune.py"],
srcs_version = "PY2AND3",
visibility = ["//visibility:public"],
)
"""
def mistune():
maybe(
http_archive,
name = "mistune_archive",
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/source/m/mistune/mistune-0.7.1.tar.gz",
"https://pypi.python.org/packages/source/m/mistune/mistune-0.7.1.tar.gz",
],
sha256 = "6076dedf768348927d991f4371e5a799c6a0158b16091df08ee85ee231d929a7",
build_file_content = MISTUNE_BUILD_FILE,
strip_prefix = "mistune-0.7.1",
)
native.bind(
name = "mistune",
actual = "@mistune_archive//:mistune",
)
def mock_whl():
maybe(
http_file,
name = "mock_whl",
downloaded_file_path = "mock-2.0.0-py2.py3-none-any.whl",
sha256 = "5ce3c71c5545b472da17b72268978914d0252980348636840bd34a00b5cc96c1",
# From https://pypi.python.org/pypi/mock
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl",
"https://pypi.python.org/packages/e6/35/f187bdf23be87092bd0f1200d43d23076cee4d0dec109f195173fd3ebc79/mock-2.0.0-py2.py3-none-any.whl",
],
)
def org_golang_x_sys():
maybe(
git_repository,
name = "org_golang_x_sys",
remote = "https://github.com/golang/sys",
commit = "e4b3c5e9061176387e7cea65e4dc5853801f3fb7", # master as of 2018-09-28
patches = ["@io_bazel_rules_go//third_party:org_golang_x_sys-gazelle.patch"],
patch_args = ["-p1"],
# gazelle args: -go_prefix golang.org/x/sys
)
def org_golang_x_tools():
maybe(
http_archive,
name = "org_golang_x_tools",
# master^1, as of 2018-11-02 (master is currently broken)
urls = ["https://codeload.github.com/golang/tools/zip/92b943e6bff73e0dfe9e975d94043d8f31067b06"],
strip_prefix = "tools-92b943e6bff73e0dfe9e975d94043d8f31067b06",
type = "zip",
patches = [
"@io_bazel_rules_go//third_party:org_golang_x_tools-gazelle.patch",
"@io_bazel_rules_go//third_party:org_golang_x_tools-extras.patch",
],
patch_args = ["-p1"],
# gazelle args: -go_prefix golang.org/x/tools
)
def py_mock():
maybe(
http_archive,
name = "py_mock",
sha256 = "b839dd2d9c117c701430c149956918a423a9863b48b09c90e30a6013e7d2f44f",
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/source/m/mock/mock-1.0.1.tar.gz",
"https://pypi.python.org/packages/source/m/mock/mock-1.0.1.tar.gz",
],
strip_prefix = "mock-1.0.1",
patch_cmds = [
"mkdir -p py/mock",
"mv mock.py py/mock/__init__.py",
"""echo 'licenses(["notice"])' > BUILD""",
"touch py/BUILD",
"""echo 'py_library(name = "mock", srcs = ["__init__.py"], visibility = ["//visibility:public"],)' > py/mock/BUILD""",
],
)
def six():
maybe(
http_archive,
name = "six_archive",
build_file = "@bazel_federation//:third_party/six.BUILD",
sha256 = "105f8d68616f8248e24bf0e9372ef04d3cc10104f1980f54d57b2ce73a5ad56a",
urls = [
"https://mirror.bazel.build/pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
"https://pypi.python.org/packages/source/s/six/six-1.10.0.tar.gz",
],
)
native.bind(name = "six", actual = "@six_archive//:six")
def subpar():
maybe(
git_repository,
name = "subpar",
remote = "https://github.com/google/subpar",
tag = "2.0.0",
)
def zlib():
maybe(
http_archive,
name = "zlib",
build_file = "@bazel_federation//:third_party/zlib.BUILD",
sha256 = "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1",
strip_prefix = "zlib-1.2.11",
urls = [
"https://mirror.bazel.build/zlib.net/zlib-1.2.11.tar.gz",
"https://zlib.net/zlib-1.2.11.tar.gz",
],
)
| 38.04943 | 183 | 0.649545 |
7953aa21dafaffbdcec07b89fa4806af9606730c | 1,765 | py | Python | utils/indigo-service/service/test/tests.py | f1nzer/Indigo | 59efbd0be0b42f449f706c3a3c8d094e483e5ef4 | [
"Apache-2.0"
] | null | null | null | utils/indigo-service/service/test/tests.py | f1nzer/Indigo | 59efbd0be0b42f449f706c3a3c8d094e483e5ef4 | [
"Apache-2.0"
] | null | null | null | utils/indigo-service/service/test/tests.py | f1nzer/Indigo | 59efbd0be0b42f449f706c3a3c8d094e483e5ef4 | [
"Apache-2.0"
] | null | null | null | import os
import time
import unittest
import requests
if __name__ == "__main__":
service_url = "http://front/v2"
if (
"INDIGO_SERVICE_URL" in os.environ
and len(os.environ["INDIGO_SERVICE_URL"]) > 0
):
service_url = os.environ["INDIGO_SERVICE_URL"]
start_time = time.time()
service_is_up = False
while time.time() - start_time < 60:
try:
if (
requests.get(
"{}/info".format(service_url), timeout=None
).status_code
== 200
):
service_is_up = True
break
print("Waiting for front container getting ready...")
except Exception:
pass
finally:
time.sleep(1)
if not service_is_up:
raise RuntimeError(
"Front container service seems to be down, stopping..."
)
print("Front container is ready, starting tests...")
def load_tests(loader, tests, pattern):
suite = unittest.TestSuite()
ignore_pattern = ""
if (
"IGNORE_PATTERN" in os.environ
and len(os.environ["IGNORE_PATTERN"]) > 0
):
ignore_pattern = os.environ["IGNORE_PATTERN"]
for all_test_suite in unittest.defaultTestLoader.discover(
os.path.join(os.path.dirname(os.path.abspath(__file__)), "api"),
pattern="*.py",
):
for test_suite in all_test_suite:
if not (
len(ignore_pattern) > 0
and ignore_pattern in str(test_suite)
):
suite.addTests(test_suite)
return suite
exit(unittest.main(verbosity=2, warnings="ignore"))
| 29.915254 | 76 | 0.54051 |
7953aad3d22d939f69e06a0c0bfe3d6c81e4570b | 2,050 | py | Python | tests/resources/quandl_samples/rebuild_samples.py | SJCosgrove/quantoipian | 70f8d14778a16f771d8c2ee196a5dba0788e920a | [
"Apache-2.0"
] | 7 | 2018-02-20T20:42:49.000Z | 2021-03-22T20:04:28.000Z | tests/resources/quandl_samples/rebuild_samples.py | SJCosgrove/quantoipian | 70f8d14778a16f771d8c2ee196a5dba0788e920a | [
"Apache-2.0"
] | null | null | null | tests/resources/quandl_samples/rebuild_samples.py | SJCosgrove/quantoipian | 70f8d14778a16f771d8c2ee196a5dba0788e920a | [
"Apache-2.0"
] | 3 | 2018-01-28T20:18:40.000Z | 2022-01-25T02:36:35.000Z | """
Script for rebuilding the samples for the Quandl tests.
"""
from __future__ import print_function
import os
import requests
from io import BytesIO
from zipfile import ZipFile
from six.moves.urllib.parse import urlencode
from zipline.testing import test_resource_path, write_compressed
from zipline.data.bundles.quandl import QUANDL_DATA_URL
def format_table_query(api_key,
start_date,
end_date,
symbols):
query_params = [
('api_key', api_key),
('date.gte', start_date),
('date.lte', end_date),
('ticker', ','.join(symbols)),
]
return (
QUANDL_DATA_URL + urlencode(query_params)
)
def zipfile_path(file_name):
return test_resource_path('quandl_samples', file_name)
def main():
api_key = os.environ.get('QUANDL_API_KEY')
start_date = '2014-1-1'
end_date = '2015-1-1'
symbols = 'AAPL', 'BRK_A', 'MSFT', 'ZEN'
url = format_table_query(
api_key=api_key,
start_date=start_date,
end_date=end_date,
symbols=symbols
)
print('Fetching equity data from %s' % url)
response = requests.get(url)
response.raise_for_status()
archive_path = zipfile_path('QUANDL_ARCHIVE.zip')
print('Writing compressed table to %s' % archive_path)
with ZipFile(archive_path, 'w') as zip_file:
zip_file.writestr(
'QUANDL_SAMPLE_TABLE.csv',
BytesIO(response.content).getvalue()
)
print('Writing mock metadata')
cols = (
'file.link',
'file.status',
'file.data_snapshot_time',
'datatable.last_refreshed_time\n',
)
row = (
'https://file_url.mock.quandl',
'fresh',
'2017-10-17 23:48:25 UTC',
'2017-10-17 23:48:15 UTC\n',
)
metadata = ','.join(cols) + ','.join(row)
path = zipfile_path('metadata.csv.gz')
print('Writing compressed metadata to %s' % path)
write_compressed(path, metadata)
if __name__ == '__main__':
main()
| 26.282051 | 64 | 0.620976 |
7953ab388875e664da8966614e77f1e630755b9a | 465 | py | Python | application_src/application.py | mbabu2/codeartifact-jenkins-python-sample | f858ff844cb0c6a64cb9fb14a29693139debe570 | [
"MIT-0"
] | 3 | 2020-09-04T09:23:43.000Z | 2022-03-24T10:15:39.000Z | application_src/application.py | mbabu2/codeartifact-jenkins-python-sample | f858ff844cb0c6a64cb9fb14a29693139debe570 | [
"MIT-0"
] | null | null | null | application_src/application.py | mbabu2/codeartifact-jenkins-python-sample | f858ff844cb0c6a64cb9fb14a29693139debe570 | [
"MIT-0"
] | 8 | 2020-10-08T19:49:47.000Z | 2022-03-24T16:11:57.000Z | # Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
# SPDX-License-Identifier: MIT-0
from flask import Flask
from fantastic_ascii import ascii
from datetime import datetime
app = Flask(__name__)
@app.route('/')
def hello_world():
now = datetime.now()
current_time = now.strftime("%H:%M:%S")
return "<pre>%s</pre>" % ascii.joe_say("Current time is %s" % current_time)
if __name__ == '__main__':
app.run(host='0.0.0.0', port=8080) | 27.352941 | 79 | 0.694624 |
7953adb83c06b41d3ca788cd89e69f4e8cee5cba | 8,085 | py | Python | wallee/models/bank_account.py | bluedynamics/wallee-python-sdk | 7f20df96d2c3dba3b1ca5236e8deca578819eea2 | [
"Apache-2.0"
] | 2 | 2020-01-16T13:24:06.000Z | 2020-11-21T17:40:17.000Z | postfinancecheckout/models/bank_account.py | pfpayments/python-sdk | b8ef159ea3c843a8d0361d1e0b122a9958adbcb4 | [
"Apache-2.0"
] | 4 | 2019-10-14T17:33:23.000Z | 2021-10-01T14:49:11.000Z | postfinancecheckout/models/bank_account.py | pfpayments/python-sdk | b8ef159ea3c843a8d0361d1e0b122a9958adbcb4 | [
"Apache-2.0"
] | 2 | 2019-10-15T14:17:10.000Z | 2021-09-17T13:07:09.000Z | # coding: utf-8
import pprint
import six
from enum import Enum
class BankAccount:
swagger_types = {
'description': 'str',
'id': 'int',
'identifier': 'str',
'linked_space_id': 'int',
'planned_purge_date': 'datetime',
'state': 'BankAccountState',
'type': 'int',
'version': 'int',
}
attribute_map = {
'description': 'description','id': 'id','identifier': 'identifier','linked_space_id': 'linkedSpaceId','planned_purge_date': 'plannedPurgeDate','state': 'state','type': 'type','version': 'version',
}
_description = None
_id = None
_identifier = None
_linked_space_id = None
_planned_purge_date = None
_state = None
_type = None
_version = None
def __init__(self, **kwargs):
self.discriminator = None
self.description = kwargs.get('description', None)
self.id = kwargs.get('id', None)
self.identifier = kwargs.get('identifier', None)
self.linked_space_id = kwargs.get('linked_space_id', None)
self.planned_purge_date = kwargs.get('planned_purge_date', None)
self.state = kwargs.get('state', None)
self.type = kwargs.get('type', None)
self.version = kwargs.get('version', None)
@property
def description(self):
"""Gets the description of this BankAccount.
The optional description is shown along the identifier. The intention of the description is to give an alternative name to the bank account.
:return: The description of this BankAccount.
:rtype: str
"""
return self._description
@description.setter
def description(self, description):
"""Sets the description of this BankAccount.
The optional description is shown along the identifier. The intention of the description is to give an alternative name to the bank account.
:param description: The description of this BankAccount.
:type: str
"""
if description is not None and len(description) > 100:
raise ValueError("Invalid value for `description`, length must be less than or equal to `100`")
self._description = description
@property
def id(self):
"""Gets the id of this BankAccount.
The ID is the primary key of the entity. The ID identifies the entity uniquely.
:return: The id of this BankAccount.
:rtype: int
"""
return self._id
@id.setter
def id(self, id):
"""Sets the id of this BankAccount.
The ID is the primary key of the entity. The ID identifies the entity uniquely.
:param id: The id of this BankAccount.
:type: int
"""
self._id = id
@property
def identifier(self):
"""Gets the identifier of this BankAccount.
The bank account identifier is responsible to uniquely identify the bank account.
:return: The identifier of this BankAccount.
:rtype: str
"""
return self._identifier
@identifier.setter
def identifier(self, identifier):
"""Sets the identifier of this BankAccount.
The bank account identifier is responsible to uniquely identify the bank account.
:param identifier: The identifier of this BankAccount.
:type: str
"""
if identifier is not None and len(identifier) > 100:
raise ValueError("Invalid value for `identifier`, length must be less than or equal to `100`")
self._identifier = identifier
@property
def linked_space_id(self):
"""Gets the linked_space_id of this BankAccount.
The linked space id holds the ID of the space to which the entity belongs to.
:return: The linked_space_id of this BankAccount.
:rtype: int
"""
return self._linked_space_id
@linked_space_id.setter
def linked_space_id(self, linked_space_id):
"""Sets the linked_space_id of this BankAccount.
The linked space id holds the ID of the space to which the entity belongs to.
:param linked_space_id: The linked_space_id of this BankAccount.
:type: int
"""
self._linked_space_id = linked_space_id
@property
def planned_purge_date(self):
"""Gets the planned_purge_date of this BankAccount.
The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.
:return: The planned_purge_date of this BankAccount.
:rtype: datetime
"""
return self._planned_purge_date
@planned_purge_date.setter
def planned_purge_date(self, planned_purge_date):
"""Sets the planned_purge_date of this BankAccount.
The planned purge date indicates when the entity is permanently removed. When the date is null the entity is not planned to be removed.
:param planned_purge_date: The planned_purge_date of this BankAccount.
:type: datetime
"""
self._planned_purge_date = planned_purge_date
@property
def state(self):
"""Gets the state of this BankAccount.
:return: The state of this BankAccount.
:rtype: BankAccountState
"""
return self._state
@state.setter
def state(self, state):
"""Sets the state of this BankAccount.
:param state: The state of this BankAccount.
:type: BankAccountState
"""
self._state = state
@property
def type(self):
"""Gets the type of this BankAccount.
:return: The type of this BankAccount.
:rtype: int
"""
return self._type
@type.setter
def type(self, type):
"""Sets the type of this BankAccount.
:param type: The type of this BankAccount.
:type: int
"""
self._type = type
@property
def version(self):
"""Gets the version of this BankAccount.
The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
:return: The version of this BankAccount.
:rtype: int
"""
return self._version
@version.setter
def version(self, version):
"""Sets the version of this BankAccount.
The version number indicates the version of the entity. The version is incremented whenever the entity is changed.
:param version: The version of this BankAccount.
:type: int
"""
self._version = version
def to_dict(self):
result = {}
for attr, _ in six.iteritems(self.swagger_types):
value = getattr(self, attr)
if isinstance(value, list):
result[attr] = list(map(
lambda x: x.to_dict() if hasattr(x, "to_dict") else x,
value
))
elif hasattr(value, "to_dict"):
result[attr] = value.to_dict()
elif isinstance(value, dict):
result[attr] = dict(map(
lambda item: (item[0], item[1].to_dict())
if hasattr(item[1], "to_dict") else item,
value.items()
))
elif isinstance(value, Enum):
result[attr] = value.value
else:
result[attr] = value
if issubclass(BankAccount, dict):
for key, value in self.items():
result[key] = value
return result
def to_str(self):
return pprint.pformat(self.to_dict())
def __repr__(self):
return self.to_str()
def __eq__(self, other):
if not isinstance(other, BankAccount):
return False
return self.__dict__ == other.__dict__
def __ne__(self, other):
return not self == other
| 28.772242 | 204 | 0.599382 |
7953adc2fa6ed20045357447a9b5c897735b6583 | 2,319 | py | Python | test/functional/tests/initialize/test_negative_load.py | Ostrokrzew/open-cas-linux | 35eb5682c9aae13ee7b44da5acc2dd0b593a0b10 | [
"BSD-3-Clause-Clear"
] | 139 | 2019-03-29T08:01:40.000Z | 2022-03-19T01:01:44.000Z | test/functional/tests/initialize/test_negative_load.py | Ostrokrzew/open-cas-linux | 35eb5682c9aae13ee7b44da5acc2dd0b593a0b10 | [
"BSD-3-Clause-Clear"
] | 604 | 2019-04-12T14:18:59.000Z | 2022-03-31T18:19:56.000Z | test/functional/tests/initialize/test_negative_load.py | Ostrokrzew/open-cas-linux | 35eb5682c9aae13ee7b44da5acc2dd0b593a0b10 | [
"BSD-3-Clause-Clear"
] | 64 | 2019-03-29T08:44:01.000Z | 2022-03-30T09:11:30.000Z | #
# Copyright(c) 2019-2021 Intel Corporation
# SPDX-License-Identifier: BSD-3-Clause-Clear
#
import pytest
from api.cas import casadm, casadm_parser
from core.test_run import TestRun
from storage_devices.disk import DiskType, DiskTypeSet, DiskTypeLowerThan
from test_utils.size import Size, Unit
@pytest.mark.require_disk("cache", DiskTypeSet([DiskType.optane, DiskType.nand]))
@pytest.mark.require_disk("core", DiskTypeLowerThan("cache"))
def test_load_occupied_id():
"""
title: Negative test for loading cache with occupied ID.
description: |
Verify that loading cache with occupied ID is not permitted.
pass_criteria:
- Loading cache with occupied ID should fail.
"""
with TestRun.step("Create partitions for test."):
cache_device = TestRun.disks['cache']
core_device = TestRun.disks['core']
cache_device.create_partitions([Size(500, Unit.MebiByte), Size(500, Unit.MebiByte)])
core_device.create_partitions([Size(1, Unit.GibiByte)])
cache_device_1 = cache_device.partitions[0]
cache_device_2 = cache_device.partitions[1]
core_device = core_device.partitions[0]
with TestRun.step("Start cache with default id and one core."):
cache1 = casadm.start_cache(cache_device_1, force=True)
cache1.add_core(core_device)
with TestRun.step("Stop cache."):
cache1.stop()
with TestRun.step("Start cache with default id on different device."):
casadm.start_cache(cache_device_2, force=True)
with TestRun.step("Attempt to load metadata from first cache device."):
try:
casadm.load_cache(cache_device_1)
TestRun.fail("Cache loaded successfully but it should not.")
except Exception:
pass
caches = casadm_parser.get_caches()
if len(caches) != 1:
TestRun.LOGGER.error("Inappropriate number of caches after load!")
if caches[0].cache_device.path != cache_device_2.path:
TestRun.LOGGER.error("Wrong cache device system path!")
if caches[0].cache_id != 1:
TestRun.LOGGER.error("Wrong cache id.")
cores = caches[0].get_core_devices()
if len(cores) != 0:
TestRun.LOGGER.error("Inappropriate number of cores after load!")
| 37.403226 | 92 | 0.678741 |
7953ade3ecbd9524402b412922a04bdd5e6070fd | 61,745 | py | Python | isolateserver.py | asdfghjjklllllaaa/client-py | 2b9640ed5ccf3921a8292408cbcd7664260eed7d | [
"Apache-2.0"
] | null | null | null | isolateserver.py | asdfghjjklllllaaa/client-py | 2b9640ed5ccf3921a8292408cbcd7664260eed7d | [
"Apache-2.0"
] | null | null | null | isolateserver.py | asdfghjjklllllaaa/client-py | 2b9640ed5ccf3921a8292408cbcd7664260eed7d | [
"Apache-2.0"
] | null | null | null | #!/usr/bin/env python
# Copyright 2013 The LUCI Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0
# that can be found in the LICENSE file.
"""Archives a set of files or directories to an Isolate Server."""
__version__ = '0.9.0'
import collections
import errno
import functools
import logging
import optparse
import os
import re
import signal
import stat
import sys
import tarfile
import threading
import time
import zlib
from utils import tools
tools.force_local_third_party()
# third_party/
import colorama
from depot_tools import fix_encoding
from depot_tools import subcommand
from six.moves import queue as Queue
# pylint: disable=ungrouped-imports
import auth
import isolated_format
import isolate_storage
import local_caching
from utils import file_path
from utils import fs
from utils import logging_utils
from utils import net
from utils import on_error
from utils import subprocess42
from utils import threading_utils
# Version of isolate protocol passed to the server in /handshake request.
ISOLATE_PROTOCOL_VERSION = '1.0'
# Maximum expected delay (in seconds) between successive file fetches or uploads
# in Storage. If it takes longer than that, a deadlock might be happening
# and all stack frames for all threads are dumped to log.
DEADLOCK_TIMEOUT = 5 * 60
# The number of files to check the isolate server per /pre-upload query.
# All files are sorted by likelihood of a change in the file content
# (currently file size is used to estimate this: larger the file -> larger the
# possibility it has changed). Then first ITEMS_PER_CONTAINS_QUERIES[0] files
# are taken and send to '/pre-upload', then next ITEMS_PER_CONTAINS_QUERIES[1],
# and so on. Numbers here is a trade-off; the more per request, the lower the
# effect of HTTP round trip latency and TCP-level chattiness. On the other hand,
# larger values cause longer lookups, increasing the initial latency to start
# uploading, which is especially an issue for large files. This value is
# optimized for the "few thousands files to look up with minimal number of large
# files missing" case.
ITEMS_PER_CONTAINS_QUERIES = (20, 20, 50, 50, 50, 100)
# A list of already compressed extension types that should not receive any
# compression before being uploaded.
ALREADY_COMPRESSED_TYPES = [
'7z', 'avi', 'cur', 'gif', 'h264', 'jar', 'jpeg', 'jpg', 'mp4', 'pdf',
'png', 'wav', 'zip',
]
# The delay (in seconds) to wait between logging statements when retrieving
# the required files. This is intended to let the user (or buildbot) know that
# the program is still running.
DELAY_BETWEEN_UPDATES_IN_SECS = 30
DEFAULT_BLACKLIST = (
# Temporary vim or python files.
r'^.+\.(?:pyc|swp)$',
# .git or .svn directory.
r'^(?:.+' + re.escape(os.path.sep) + r'|)\.(?:git|svn)$',
)
class Error(Exception):
"""Generic runtime error."""
pass
class Aborted(Error):
"""Operation aborted."""
pass
class AlreadyExists(Error):
"""File already exists."""
def file_read(path, chunk_size=isolated_format.DISK_FILE_CHUNK, offset=0):
"""Yields file content in chunks of |chunk_size| starting from |offset|."""
with fs.open(path, 'rb') as f:
if offset:
f.seek(offset)
while True:
data = f.read(chunk_size)
if not data:
break
yield data
def fileobj_path(fileobj):
"""Return file system path for file like object or None.
The returned path is guaranteed to exist and can be passed to file system
operations like copy.
"""
name = getattr(fileobj, 'name', None)
if name is None:
return None
# If the file like object was created using something like open("test.txt")
# name will end up being a str (such as a function outside our control, like
# the standard library). We want all our paths to be unicode objects, so we
# decode it.
if not isinstance(name, unicode):
# We incorrectly assume that UTF-8 is used everywhere.
name = name.decode('utf-8')
# fs.exists requires an absolute path, otherwise it will fail with an
# assertion error.
if not os.path.isabs(name):
return None
if fs.exists(name):
return name
return None
# TODO(tansell): Replace fileobj_copy with shutil.copyfileobj once proper file
# wrappers have been created.
def fileobj_copy(
dstfileobj, srcfileobj, size=-1,
chunk_size=isolated_format.DISK_FILE_CHUNK):
"""Copy data from srcfileobj to dstfileobj.
Providing size means exactly that amount of data will be copied (if there
isn't enough data, an IOError exception is thrown). Otherwise all data until
the EOF marker will be copied.
"""
if size == -1 and hasattr(srcfileobj, 'tell'):
if srcfileobj.tell() != 0:
raise IOError('partial file but not using size')
written = 0
while written != size:
readsize = chunk_size
if size > 0:
readsize = min(readsize, size-written)
data = srcfileobj.read(readsize)
if not data:
if size == -1:
break
raise IOError('partial file, got %s, wanted %s' % (written, size))
dstfileobj.write(data)
written += len(data)
def putfile(srcfileobj, dstpath, file_mode=None, size=-1, use_symlink=False):
"""Put srcfileobj at the given dstpath with given mode.
The function aims to do this as efficiently as possible while still allowing
any possible file like object be given.
Creating a tree of hardlinks has a few drawbacks:
- tmpfs cannot be used for the scratch space. The tree has to be on the same
partition as the cache.
- involves a write to the inode, which advances ctime, cause a metadata
writeback (causing disk seeking).
- cache ctime cannot be used to detect modifications / corruption.
- Some file systems (NTFS) have a 64k limit on the number of hardlink per
partition. This is why the function automatically fallbacks to copying the
file content.
- /proc/sys/fs/protected_hardlinks causes an additional check to ensure the
same owner is for all hardlinks.
- Anecdotal report that ext2 is known to be potentially faulty on high rate
of hardlink creation.
Creating a tree of symlinks has a few drawbacks:
- Tasks running the equivalent of os.path.realpath() will get the naked path
and may fail.
- Windows:
- Symlinks are reparse points:
https://msdn.microsoft.com/library/windows/desktop/aa365460.aspx
https://msdn.microsoft.com/library/windows/desktop/aa363940.aspx
- Symbolic links are Win32 paths, not NT paths.
https://googleprojectzero.blogspot.com/2016/02/the-definitive-guide-on-win32-to-nt.html
- Symbolic links are supported on Windows 7 and later only.
- SeCreateSymbolicLinkPrivilege is needed, which is not present by
default.
- SeCreateSymbolicLinkPrivilege is *stripped off* by UAC when a restricted
RID is present in the token;
https://msdn.microsoft.com/en-us/library/bb530410.aspx
"""
srcpath = fileobj_path(srcfileobj)
if srcpath and size == -1:
readonly = file_mode is None or (
file_mode & (stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH))
if readonly:
# If the file is read only we can link the file
if use_symlink:
link_mode = file_path.SYMLINK_WITH_FALLBACK
else:
link_mode = file_path.HARDLINK_WITH_FALLBACK
else:
# If not read only, we must copy the file
link_mode = file_path.COPY
file_path.link_file(dstpath, srcpath, link_mode)
else:
# Need to write out the file
with fs.open(dstpath, 'wb') as dstfileobj:
fileobj_copy(dstfileobj, srcfileobj, size)
assert fs.exists(dstpath)
# file_mode of 0 is actually valid, so need explicit check.
if file_mode is not None:
fs.chmod(dstpath, file_mode)
def zip_compress(content_generator, level=7):
"""Reads chunks from |content_generator| and yields zip compressed chunks."""
compressor = zlib.compressobj(level)
for chunk in content_generator:
compressed = compressor.compress(chunk)
if compressed:
yield compressed
tail = compressor.flush(zlib.Z_FINISH)
if tail:
yield tail
def zip_decompress(
content_generator, chunk_size=isolated_format.DISK_FILE_CHUNK):
"""Reads zipped data from |content_generator| and yields decompressed data.
Decompresses data in small chunks (no larger than |chunk_size|) so that
zip bomb file doesn't cause zlib to preallocate huge amount of memory.
Raises IOError if data is corrupted or incomplete.
"""
decompressor = zlib.decompressobj()
compressed_size = 0
try:
for chunk in content_generator:
compressed_size += len(chunk)
data = decompressor.decompress(chunk, chunk_size)
if data:
yield data
while decompressor.unconsumed_tail:
data = decompressor.decompress(decompressor.unconsumed_tail, chunk_size)
if data:
yield data
tail = decompressor.flush()
if tail:
yield tail
except zlib.error as e:
raise IOError(
'Corrupted zip stream (read %d bytes) - %s' % (compressed_size, e))
# Ensure all data was read and decompressed.
if decompressor.unused_data or decompressor.unconsumed_tail:
raise IOError('Not all data was decompressed')
def _get_zip_compression_level(filename):
"""Given a filename calculates the ideal zip compression level to use."""
file_ext = os.path.splitext(filename)[1].lower()
# TODO(csharp): Profile to find what compression level works best.
return 0 if file_ext in ALREADY_COMPRESSED_TYPES else 7
def create_directories(base_directory, files):
"""Creates the directory structure needed by the given list of files."""
logging.debug('create_directories(%s, %d)', base_directory, len(files))
# Creates the tree of directories to create.
directories = set(os.path.dirname(f) for f in files)
for item in list(directories):
while item:
directories.add(item)
item = os.path.dirname(item)
for d in sorted(directories):
if d:
abs_d = os.path.join(base_directory, d)
if not fs.isdir(abs_d):
fs.mkdir(abs_d)
def _create_symlinks(base_directory, files):
"""Creates any symlinks needed by the given set of files."""
for filepath, properties in files:
if 'l' not in properties:
continue
if sys.platform == 'win32':
# TODO(maruel): Create symlink via the win32 api.
logging.warning('Ignoring symlink %s', filepath)
continue
outfile = os.path.join(base_directory, filepath)
try:
os.symlink(properties['l'], outfile) # pylint: disable=E1101
except OSError as e:
if e.errno == errno.EEXIST:
raise AlreadyExists('File %s already exists.' % outfile)
raise
class _ThreadFile(object):
"""Multithreaded fake file. Used by TarBundle."""
def __init__(self):
self._data = threading_utils.TaskChannel()
self._offset = 0
def __iter__(self):
return self._data
def tell(self):
return self._offset
def write(self, b):
self._data.send_result(b)
self._offset += len(b)
def close(self):
self._data.send_done()
class FileItem(isolate_storage.Item):
"""A file to push to Storage.
Its digest and size may be provided in advance, if known. Otherwise they will
be derived from the file content.
"""
def __init__(self, path, algo, digest=None, size=None, high_priority=False):
super(FileItem, self).__init__(
digest,
size if size is not None else fs.stat(path).st_size,
high_priority,
compression_level=_get_zip_compression_level(path))
self._path = path
self._algo = algo
self._meta = None
@property
def path(self):
return self._path
@property
def digest(self):
if not self._digest:
self._digest = isolated_format.hash_file(self._path, self._algo)
return self._digest
@property
def meta(self):
if not self._meta:
# TODO(maruel): Inline.
self._meta = isolated_format.file_to_metadata(self.path, 0, False)
# We need to hash right away.
self._meta['h'] = self.digest
return self._meta
def content(self):
return file_read(self.path)
class TarBundle(isolate_storage.Item):
"""Tarfile to push to Storage.
Its digest is the digest of all the files it contains. It is generated on the
fly.
"""
def __init__(self, root, algo):
# 2 trailing 512 bytes headers.
super(TarBundle, self).__init__(size=1024)
self._items = []
self._meta = None
self._algo = algo
self._root_len = len(root) + 1
# Same value as for Go.
# https://chromium.googlesource.com/infra/luci/luci-go.git/+/master/client/archiver/tar_archiver.go
# https://chromium.googlesource.com/infra/luci/luci-go.git/+/master/client/archiver/upload_tracker.go
self._archive_max_size = int(10e6)
@property
def digest(self):
if not self._digest:
self._prepare()
return self._digest
@property
def size(self):
if self._size is None:
self._prepare()
return self._size
def try_add(self, item):
"""Try to add this file to the bundle.
It is extremely naive but this should be just enough for
https://crbug.com/825418.
Future improvements should be in the Go code, and the Swarming bot should be
migrated to use the Go code instead.
"""
if not item.size:
return False
# pylint: disable=unreachable
rounded = (item.size + 512) & ~511
if rounded + self._size > self._archive_max_size:
return False
# https://crbug.com/825418
return False
self._size += rounded
self._items.append(item)
return True
def yield_item_path_meta(self):
"""Returns a tuple(Item, filepath, meta_dict).
If the bundle contains less than 5 items, the items are yielded.
"""
if len(self._items) < 5:
# The tarball is too small, yield individual items, if any.
for item in self._items:
yield item, item.path[self._root_len:], item.meta
else:
# This ensures self._meta is set.
p = self.digest + '.tar'
# Yield itself as a tarball.
yield self, p, self._meta
def content(self):
"""Generates the tarfile content on the fly."""
obj = _ThreadFile()
def _tar_thread():
try:
t = tarfile.open(
fileobj=obj, mode='w', format=tarfile.PAX_FORMAT, encoding='utf-8')
for item in self._items:
logging.info(' tarring %s', item.path)
t.add(item.path)
t.close()
except Exception:
logging.exception('Internal failure')
finally:
obj.close()
t = threading.Thread(target=_tar_thread)
t.start()
try:
for data in obj:
yield data
finally:
t.join()
def _prepare(self):
h = self._algo()
total = 0
for chunk in self.content():
h.update(chunk)
total += len(chunk)
# pylint: disable=attribute-defined-outside-init
# This is not true, they are defined in Item.__init__().
self._digest = h.hexdigest()
self._size = total
self._meta = {
'h': self.digest,
's': self.size,
't': u'tar',
}
class BufferItem(isolate_storage.Item):
"""A byte buffer to push to Storage."""
def __init__(self, buf, algo, high_priority=False):
super(BufferItem, self).__init__(
digest=algo(buf).hexdigest(),
size=len(buf),
high_priority=high_priority)
self._buffer = buf
def content(self):
return [self._buffer]
class Storage(object):
"""Efficiently downloads or uploads large set of files via StorageApi.
Implements compression support, parallel 'contains' checks, parallel uploads
and more.
Works only within single namespace (and thus hashing algorithm and compression
scheme are fixed).
Spawns multiple internal threads. Thread safe, but not fork safe. Modifies
signal handlers table to handle Ctrl+C.
"""
def __init__(self, storage_api):
self._storage_api = storage_api
self._cpu_thread_pool = None
self._net_thread_pool = None
self._aborted = False
self._prev_sig_handlers = {}
@property
def server_ref(self):
"""Shortcut to get the server_ref from storage_api.
This can be used to get the underlying hash_algo.
"""
return self._storage_api.server_ref
@property
def cpu_thread_pool(self):
"""ThreadPool for CPU-bound tasks like zipping."""
if self._cpu_thread_pool is None:
threads = max(threading_utils.num_processors(), 2)
max_size = long(2)**32 if sys.version_info.major == 2 else 2**32
if sys.maxsize <= max_size:
# On 32 bits userland, do not try to use more than 16 threads.
threads = min(threads, 16)
self._cpu_thread_pool = threading_utils.ThreadPool(2, threads, 0, 'zip')
return self._cpu_thread_pool
@property
def net_thread_pool(self):
"""AutoRetryThreadPool for IO-bound tasks, retries IOError."""
if self._net_thread_pool is None:
self._net_thread_pool = threading_utils.IOAutoRetryThreadPool()
return self._net_thread_pool
def close(self):
"""Waits for all pending tasks to finish."""
logging.info('Waiting for all threads to die...')
if self._cpu_thread_pool:
self._cpu_thread_pool.join()
self._cpu_thread_pool.close()
self._cpu_thread_pool = None
if self._net_thread_pool:
self._net_thread_pool.join()
self._net_thread_pool.close()
self._net_thread_pool = None
logging.info('Done.')
def abort(self):
"""Cancels any pending or future operations."""
# This is not strictly theadsafe, but in the worst case the logging message
# will be printed twice. Not a big deal. In other places it is assumed that
# unprotected reads and writes to _aborted are serializable (it is true
# for python) and thus no locking is used.
if not self._aborted:
logging.warning('Aborting... It can take a while.')
self._aborted = True
def __enter__(self):
"""Context manager interface."""
assert not self._prev_sig_handlers, self._prev_sig_handlers
for s in (signal.SIGINT, signal.SIGTERM):
self._prev_sig_handlers[s] = signal.signal(s, lambda *_args: self.abort())
return self
def __exit__(self, _exc_type, _exc_value, _traceback):
"""Context manager interface."""
self.close()
while self._prev_sig_handlers:
s, h = self._prev_sig_handlers.popitem()
signal.signal(s, h)
return False
def upload_items(self, items):
"""Uploads a generator of Item to the isolate server.
It figures out what items are missing from the server and uploads only them.
It uses 3 threads internally:
- One to create batches based on a timeout
- One to dispatch the /contains RPC and field the missing entries
- One to field the /push RPC
The main threads enumerates 'items' and pushes to the first thread. Then it
join() all the threads, waiting for them to complete.
(enumerate items of Item, this can be slow as disk is traversed)
|
v
_create_items_batches_thread Thread #1
(generates list(Item), every 3s or 20~100 items)
|
v
_do_lookups_thread Thread #2
| |
v v
(missing) (was on server)
|
v
_handle_missing_thread Thread #3
|
v
(upload Item, append to uploaded)
Arguments:
items: list of isolate_storage.Item instances that represents data to
upload.
Returns:
List of items that were uploaded. All other items are already there.
"""
incoming = Queue.Queue()
batches_to_lookup = Queue.Queue()
missing = Queue.Queue()
uploaded = []
def _create_items_batches_thread():
"""Creates batches for /contains RPC lookup from individual items.
Input: incoming
Output: batches_to_lookup
"""
try:
batch_size_index = 0
batch_size = ITEMS_PER_CONTAINS_QUERIES[batch_size_index]
batch = []
while not self._aborted:
try:
item = incoming.get(True, timeout=3)
if item:
batch.append(item)
except Queue.Empty:
item = False
if len(batch) == batch_size or (not item and batch):
if len(batch) == batch_size:
batch_size_index += 1
batch_size = ITEMS_PER_CONTAINS_QUERIES[
min(batch_size_index, len(ITEMS_PER_CONTAINS_QUERIES)-1)]
batches_to_lookup.put(batch)
batch = []
if item is None:
break
finally:
# Unblock the next pipeline.
batches_to_lookup.put(None)
def _do_lookups_thread():
"""Enqueues all the /contains RPCs and emits the missing items.
Input: batches_to_lookup
Output: missing, to_upload
"""
try:
channel = threading_utils.TaskChannel()
def _contains(b):
if self._aborted:
raise Aborted()
return self._storage_api.contains(b)
pending_contains = 0
while not self._aborted:
batch = batches_to_lookup.get()
if batch is None:
break
self.net_thread_pool.add_task_with_channel(
channel, threading_utils.PRIORITY_HIGH, _contains, batch)
pending_contains += 1
while pending_contains and not self._aborted:
try:
v = channel.next(timeout=0)
except threading_utils.TaskChannel.Timeout:
break
pending_contains -= 1
for missing_item, push_state in v.iteritems():
missing.put((missing_item, push_state))
while pending_contains and not self._aborted:
for missing_item, push_state in channel.next().iteritems():
missing.put((missing_item, push_state))
pending_contains -= 1
finally:
# Unblock the next pipeline.
missing.put((None, None))
def _handle_missing_thread():
"""Sends the missing items to the uploader.
Input: missing
Output: uploaded
"""
with threading_utils.DeadlockDetector(DEADLOCK_TIMEOUT) as detector:
channel = threading_utils.TaskChannel()
pending_upload = 0
while not self._aborted:
try:
missing_item, push_state = missing.get(True, timeout=5)
if missing_item is None:
break
self._async_push(channel, missing_item, push_state)
pending_upload += 1
except Queue.Empty:
pass
detector.ping()
while not self._aborted and pending_upload:
try:
item = channel.next(timeout=0)
except threading_utils.TaskChannel.Timeout:
break
uploaded.append(item)
pending_upload -= 1
logging.debug(
'Uploaded %d; %d pending: %s (%d)',
len(uploaded), pending_upload, item.digest, item.size)
while not self._aborted and pending_upload:
item = channel.next()
uploaded.append(item)
pending_upload -= 1
logging.debug(
'Uploaded %d; %d pending: %s (%d)',
len(uploaded), pending_upload, item.digest, item.size)
threads = [
threading.Thread(target=_create_items_batches_thread),
threading.Thread(target=_do_lookups_thread),
threading.Thread(target=_handle_missing_thread),
]
for t in threads:
t.start()
try:
# For each digest keep only first isolate_storage.Item that matches it.
# All other items are just indistinguishable copies from the point of view
# of isolate server (it doesn't care about paths at all, only content and
# digests).
seen = {}
try:
# TODO(maruel): Reorder the items as a priority queue, with larger items
# being processed first. This is, before hashing the data.
# This must be done in the primary thread since items can be a
# generator.
for item in items:
if seen.setdefault(item.digest, item) is item:
incoming.put(item)
finally:
incoming.put(None)
finally:
for t in threads:
t.join()
logging.info('All %s files are uploaded', len(uploaded))
if seen:
_print_upload_stats(seen.values(), uploaded)
return uploaded
def _async_push(self, channel, item, push_state):
"""Starts asynchronous push to the server in a parallel thread.
Can be used only after |item| was checked for presence on a server with a
/contains RPC.
Arguments:
channel: TaskChannel that receives back |item| when upload ends.
item: item to upload as instance of isolate_storage.Item class.
push_state: push state returned by storage_api.contains(). It contains
storage specific information describing how to upload the item (for
example in case of cloud storage, it is signed upload URLs).
Returns:
None, but |channel| later receives back |item| when upload ends.
"""
# Thread pool task priority.
priority = (
threading_utils.PRIORITY_HIGH if item.high_priority
else threading_utils.PRIORITY_MED)
def _push(content):
"""Pushes an isolate_storage.Item and returns it to |channel|."""
if self._aborted:
raise Aborted()
self._storage_api.push(item, push_state, content)
return item
# If zipping is not required, just start a push task. Don't pass 'content'
# so that it can create a new generator when it retries on failures.
if not self.server_ref.is_with_compression:
self.net_thread_pool.add_task_with_channel(channel, priority, _push, None)
return
# If zipping is enabled, zip in a separate thread.
def zip_and_push():
# TODO(vadimsh): Implement streaming uploads. Before it's done, assemble
# content right here. It will block until all file is zipped.
try:
if self._aborted:
raise Aborted()
stream = zip_compress(item.content(), item.compression_level)
data = ''.join(stream)
except Exception as exc:
logging.error('Failed to zip \'%s\': %s', item, exc)
channel.send_exception()
return
# Pass '[data]' explicitly because the compressed data is not same as the
# one provided by 'item'. Since '[data]' is a list, it can safely be
# reused during retries.
self.net_thread_pool.add_task_with_channel(
channel, priority, _push, [data])
self.cpu_thread_pool.add_task(priority, zip_and_push)
def push(self, item, push_state):
"""Synchronously pushes a single item to the server.
If you need to push many items at once, consider using 'upload_items' or
'_async_push' with instance of TaskChannel.
Arguments:
item: item to upload as instance of isolate_storage.Item class.
push_state: push state returned by storage_api.contains(). It contains
storage specific information describing how to upload the item (for
example in case of cloud storage, it is signed upload URLs).
Returns:
Pushed item (same object as |item|).
"""
channel = threading_utils.TaskChannel()
with threading_utils.DeadlockDetector(DEADLOCK_TIMEOUT):
self._async_push(channel, item, push_state)
pushed = channel.next()
assert pushed is item
return item
def async_fetch(self, channel, priority, digest, size, sink):
"""Starts asynchronous fetch from the server in a parallel thread.
Arguments:
channel: TaskChannel that receives back |digest| when download ends.
priority: thread pool task priority for the fetch.
digest: hex digest of an item to download.
size: expected size of the item (after decompression).
sink: function that will be called as sink(generator).
"""
def fetch():
try:
# Prepare reading pipeline.
stream = self._storage_api.fetch(digest, size, 0)
if self.server_ref.is_with_compression:
stream = zip_decompress(stream, isolated_format.DISK_FILE_CHUNK)
# Run |stream| through verifier that will assert its size.
verifier = FetchStreamVerifier(
stream, self.server_ref.hash_algo, digest, size)
# Verified stream goes to |sink|.
sink(verifier.run())
except Exception as err:
logging.error('Failed to fetch %s: %s', digest, err)
raise
return digest
# Don't bother with zip_thread_pool for decompression. Decompression is
# really fast and most probably IO bound anyway.
self.net_thread_pool.add_task_with_channel(channel, priority, fetch)
class FetchQueue(object):
"""Fetches items from Storage and places them into ContentAddressedCache.
It manages multiple concurrent fetch operations. Acts as a bridge between
Storage and ContentAddressedCache so that Storage and ContentAddressedCache
don't depend on each other at all.
"""
def __init__(self, storage, cache):
self.storage = storage
self.cache = cache
self._channel = threading_utils.TaskChannel()
self._pending = set()
self._accessed = set()
self._fetched = set(cache)
# Pending digests that the caller waits for, see wait_on()/wait().
self._waiting_on = set()
# Already fetched digests the caller waits for which are not yet returned by
# wait().
self._waiting_on_ready = set()
def add(
self,
digest,
size=local_caching.UNKNOWN_FILE_SIZE,
priority=threading_utils.PRIORITY_MED):
"""Starts asynchronous fetch of item |digest|."""
# Fetching it now?
if digest in self._pending:
return
# Mark this file as in use, verify_all_cached will later ensure it is still
# in cache.
self._accessed.add(digest)
# Already fetched? Notify cache to update item's LRU position.
if digest in self._fetched:
# 'touch' returns True if item is in cache and not corrupted.
if self.cache.touch(digest, size):
return
logging.error('%s is corrupted', digest)
self._fetched.remove(digest)
# TODO(maruel): It should look at the free disk space, the current cache
# size and the size of the new item on every new item:
# - Trim the cache as more entries are listed when free disk space is low,
# otherwise if the amount of data downloaded during the run > free disk
# space, it'll crash.
# - Make sure there's enough free disk space to fit all dependencies of
# this run! If not, abort early.
# Start fetching.
self._pending.add(digest)
self.storage.async_fetch(
self._channel, priority, digest, size,
functools.partial(self.cache.write, digest))
def wait_on(self, digest):
"""Updates digests to be waited on by 'wait'."""
# Calculate once the already fetched items. These will be retrieved first.
if digest in self._fetched:
self._waiting_on_ready.add(digest)
else:
self._waiting_on.add(digest)
def wait(self):
"""Waits until any of waited-on items is retrieved.
Once this happens, it is remove from the waited-on set and returned.
This function is called in two waves. The first wave it is done for HIGH
priority items, the isolated files themselves. The second wave it is called
for all the files.
If the waited-on set is empty, raises RuntimeError.
"""
# Flush any already fetched items.
if self._waiting_on_ready:
return self._waiting_on_ready.pop()
assert self._waiting_on, 'Needs items to wait on'
# Wait for one waited-on item to be fetched.
while self._pending:
digest = self._channel.next()
self._pending.remove(digest)
self._fetched.add(digest)
if digest in self._waiting_on:
self._waiting_on.remove(digest)
return digest
# Should never reach this point due to assert above.
raise RuntimeError('Impossible state')
@property
def wait_queue_empty(self):
"""Returns True if there is no digest left for wait() to return."""
return not self._waiting_on and not self._waiting_on_ready
def inject_local_file(self, path, algo):
"""Adds local file to the cache as if it was fetched from storage."""
with fs.open(path, 'rb') as f:
data = f.read()
digest = algo(data).hexdigest()
self.cache.write(digest, [data])
self._fetched.add(digest)
return digest
@property
def pending_count(self):
"""Returns number of items to be fetched."""
return len(self._pending)
def verify_all_cached(self):
"""True if all accessed items are in cache."""
# Not thread safe, but called after all work is done.
return self._accessed.issubset(self.cache)
class FetchStreamVerifier(object):
"""Verifies that fetched file is valid before passing it to the
ContentAddressedCache.
"""
def __init__(self, stream, hasher, expected_digest, expected_size):
"""Initializes the verifier.
Arguments:
* stream: an iterable yielding chunks of content
* hasher: an object from hashlib that supports update() and hexdigest()
(eg, hashlib.sha1).
* expected_digest: if the entire stream is piped through hasher and then
summarized via hexdigest(), this should be the result. That is, it
should be a hex string like 'abc123'.
* expected_size: either the expected size of the stream, or
local_caching.UNKNOWN_FILE_SIZE.
"""
assert stream is not None
self.stream = stream
self.expected_digest = expected_digest
self.expected_size = expected_size
self.current_size = 0
self.rolling_hash = hasher()
def run(self):
"""Generator that yields same items as |stream|.
Verifies |stream| is complete before yielding a last chunk to consumer.
Also wraps IOError produced by consumer into MappingError exceptions since
otherwise Storage will retry fetch on unrelated local cache errors.
"""
# Read one chunk ahead, keep it in |stored|.
# That way a complete stream can be verified before pushing last chunk
# to consumer.
stored = None
for chunk in self.stream:
assert chunk is not None
if stored is not None:
self._inspect_chunk(stored, is_last=False)
try:
yield stored
except IOError as exc:
raise isolated_format.MappingError(
'Failed to store an item in cache: %s' % exc)
stored = chunk
if stored is not None:
self._inspect_chunk(stored, is_last=True)
try:
yield stored
except IOError as exc:
raise isolated_format.MappingError(
'Failed to store an item in cache: %s' % exc)
def _inspect_chunk(self, chunk, is_last):
"""Called for each fetched chunk before passing it to consumer."""
self.current_size += len(chunk)
self.rolling_hash.update(chunk)
if not is_last:
return
if ((self.expected_size != local_caching.UNKNOWN_FILE_SIZE) and
(self.expected_size != self.current_size)):
msg = 'Incorrect file size: want %d, got %d' % (
self.expected_size, self.current_size)
raise IOError(msg)
actual_digest = self.rolling_hash.hexdigest()
if self.expected_digest != actual_digest:
msg = 'Incorrect digest: want %s, got %s' % (
self.expected_digest, actual_digest)
raise IOError(msg)
class IsolatedBundle(object):
"""Fetched and parsed .isolated file with all dependencies."""
def __init__(self, filter_cb):
"""
filter_cb: callback function to filter downloaded content.
When filter_cb is not None, Isolated file is downloaded iff
filter_cb(filepath) returns True.
"""
self.command = []
self.files = {}
self.read_only = None
self.relative_cwd = None
# The main .isolated file, a IsolatedFile instance.
self.root = None
self._filter_cb = filter_cb
def fetch(self, fetch_queue, root_isolated_hash, algo):
"""Fetches the .isolated and all the included .isolated.
It enables support for "included" .isolated files. They are processed in
strict order but fetched asynchronously from the cache. This is important so
that a file in an included .isolated file that is overridden by an embedding
.isolated file is not fetched needlessly. The includes are fetched in one
pass and the files are fetched as soon as all the ones on the left-side
of the tree were fetched.
The prioritization is very important here for nested .isolated files.
'includes' have the highest priority and the algorithm is optimized for both
deep and wide trees. A deep one is a long link of .isolated files referenced
one at a time by one item in 'includes'. A wide one has a large number of
'includes' in a single .isolated file. 'left' is defined as an included
.isolated file earlier in the 'includes' list. So the order of the elements
in 'includes' is important.
As a side effect this method starts asynchronous fetch of all data files
by adding them to |fetch_queue|. It doesn't wait for data files to finish
fetching though.
"""
self.root = isolated_format.IsolatedFile(root_isolated_hash, algo)
# Isolated files being retrieved now: hash -> IsolatedFile instance.
pending = {}
# Set of hashes of already retrieved items to refuse recursive includes.
seen = set()
# Set of IsolatedFile's whose data files have already being fetched.
processed = set()
def retrieve_async(isolated_file):
"""Retrieves an isolated file included by the root bundle."""
h = isolated_file.obj_hash
if h in seen:
raise isolated_format.IsolatedError(
'IsolatedFile %s is retrieved recursively' % h)
assert h not in pending
seen.add(h)
pending[h] = isolated_file
# This isolated item is being added dynamically, notify FetchQueue.
fetch_queue.wait_on(h)
fetch_queue.add(h, priority=threading_utils.PRIORITY_HIGH)
# Start fetching root *.isolated file (single file, not the whole bundle).
retrieve_async(self.root)
while pending:
# Wait until some *.isolated file is fetched, parse it.
item_hash = fetch_queue.wait()
item = pending.pop(item_hash)
with fetch_queue.cache.getfileobj(item_hash) as f:
item.load(f.read())
# Start fetching included *.isolated files.
for new_child in item.children:
retrieve_async(new_child)
# Always fetch *.isolated files in traversal order, waiting if necessary
# until next to-be-processed node loads. "Waiting" is done by yielding
# back to the outer loop, that waits until some *.isolated is loaded.
for node in isolated_format.walk_includes(self.root):
if node not in processed:
# Not visited, and not yet loaded -> wait for it to load.
if not node.is_loaded:
break
# Not visited and loaded -> process it and continue the traversal.
self._start_fetching_files(node, fetch_queue)
processed.add(node)
# All *.isolated files should be processed by now and only them.
all_isolateds = set(isolated_format.walk_includes(self.root))
assert all_isolateds == processed, (all_isolateds, processed)
assert fetch_queue.wait_queue_empty, 'FetchQueue should have been emptied'
# Extract 'command' and other bundle properties.
for node in isolated_format.walk_includes(self.root):
self._update_self(node)
self.relative_cwd = self.relative_cwd or ''
def _start_fetching_files(self, isolated, fetch_queue):
"""Starts fetching files from |isolated| that are not yet being fetched.
Modifies self.files.
"""
files = isolated.data.get('files', {})
logging.debug('fetch_files(%s, %d)', isolated.obj_hash, len(files))
for filepath, properties in files.iteritems():
if self._filter_cb and not self._filter_cb(filepath):
continue
# Root isolated has priority on the files being mapped. In particular,
# overridden files must not be fetched.
if filepath not in self.files:
self.files[filepath] = properties
# Make sure if the isolated is read only, the mode doesn't have write
# bits.
if 'm' in properties and self.read_only:
properties['m'] &= ~(stat.S_IWUSR | stat.S_IWGRP | stat.S_IWOTH)
# Preemptively request hashed files.
if 'h' in properties:
fetch_queue.add(
properties['h'], properties['s'], threading_utils.PRIORITY_MED)
def _update_self(self, node):
"""Extracts bundle global parameters from loaded *.isolated file.
Will be called with each loaded *.isolated file in order of traversal of
isolated include graph (see isolated_format.walk_includes).
"""
# Grabs properties.
if not self.command and node.data.get('command'):
# Ensure paths are correctly separated on windows.
self.command = node.data['command']
if self.command:
self.command[0] = self.command[0].replace('/', os.path.sep)
if self.read_only is None and node.data.get('read_only') is not None:
self.read_only = node.data['read_only']
if (self.relative_cwd is None and
node.data.get('relative_cwd') is not None):
self.relative_cwd = node.data['relative_cwd']
def get_storage(server_ref):
"""Returns Storage class that can upload and download from |namespace|.
Arguments:
server_ref: isolate_storage.ServerRef instance.
Returns:
Instance of Storage.
"""
assert isinstance(server_ref, isolate_storage.ServerRef), repr(server_ref)
return Storage(isolate_storage.get_storage_api(server_ref))
def _map_file(dst, digest, props, cache, read_only, use_symlinks):
"""Put downloaded file to destination path. This function is used for multi
threaded file putting.
"""
with cache.getfileobj(digest) as srcfileobj:
filetype = props.get('t', 'basic')
if filetype == 'basic':
# Ignore all bits apart from the user.
file_mode = (props.get('m') or 0o500) & 0o700
if read_only:
# Enforce read-only if the root bundle does.
file_mode &= 0o500
putfile(srcfileobj, dst, file_mode,
use_symlink=use_symlinks)
elif filetype == 'tar':
basedir = os.path.dirname(dst)
with tarfile.TarFile(fileobj=srcfileobj, encoding='utf-8') as t:
for ti in t:
if not ti.isfile():
logging.warning(
'Path(%r) is nonfile (%s), skipped',
ti.name, ti.type)
continue
# Handle files created on Windows fetched on POSIX and the
# reverse.
other_sep = '/' if os.path.sep == '\\' else '\\'
name = ti.name.replace(other_sep, os.path.sep)
fp = os.path.normpath(os.path.join(basedir, name))
if not fp.startswith(basedir):
logging.error(
'Path(%r) is outside root directory',
fp)
ifd = t.extractfile(ti)
file_path.ensure_tree(os.path.dirname(fp))
file_mode = ti.mode & 0o700
if read_only:
# Enforce read-only if the root bundle does.
file_mode &= 0o500
putfile(ifd, fp, file_mode, ti.size)
else:
raise isolated_format.IsolatedError(
'Unknown file type %r' % filetype)
def fetch_isolated(isolated_hash, storage, cache, outdir, use_symlinks,
filter_cb=None):
"""Aggressively downloads the .isolated file(s), then download all the files.
Arguments:
isolated_hash: hash of the root *.isolated file.
storage: Storage class that communicates with isolate storage.
cache: ContentAddressedCache class that knows how to store and map files
locally.
outdir: Output directory to map file tree to.
use_symlinks: Use symlinks instead of hardlinks when True.
filter_cb: filter that works as whitelist for downloaded files.
Returns:
IsolatedBundle object that holds details about loaded *.isolated file.
"""
logging.debug(
'fetch_isolated(%s, %s, %s, %s, %s)',
isolated_hash, storage, cache, outdir, use_symlinks)
# Hash algorithm to use, defined by namespace |storage| is using.
algo = storage.server_ref.hash_algo
fetch_queue = FetchQueue(storage, cache)
bundle = IsolatedBundle(filter_cb)
with tools.Profiler('GetIsolateds'):
# Optionally support local files by manually adding them to cache.
if not isolated_format.is_valid_hash(isolated_hash, algo):
logging.debug('%s is not a valid hash, assuming a file '
'(algo was %s, hash size was %d)',
isolated_hash, algo(), algo().digest_size)
path = unicode(os.path.abspath(isolated_hash))
try:
isolated_hash = fetch_queue.inject_local_file(path, algo)
except IOError as e:
raise isolated_format.MappingError(
'%s doesn\'t seem to be a valid file. Did you intent to pass a '
'valid hash (error: %s)?' % (isolated_hash, e))
# Load all *.isolated and start loading rest of the files.
bundle.fetch(fetch_queue, isolated_hash, algo)
with tools.Profiler('GetRest'):
# Create file system hierarchy.
file_path.ensure_tree(outdir)
create_directories(outdir, bundle.files)
_create_symlinks(outdir, bundle.files.iteritems())
# Ensure working directory exists.
cwd = os.path.normpath(os.path.join(outdir, bundle.relative_cwd))
file_path.ensure_tree(cwd)
# Multimap: digest -> list of pairs (path, props).
remaining = {}
for filepath, props in bundle.files.iteritems():
if 'h' in props:
remaining.setdefault(props['h'], []).append((filepath, props))
fetch_queue.wait_on(props['h'])
# Now block on the remaining files to be downloaded and mapped.
logging.info('Retrieving remaining files (%d of them)...',
fetch_queue.pending_count)
last_update = time.time()
with threading_utils.ThreadPool(2, 32, 32) as putfile_thread_pool:
with threading_utils.DeadlockDetector(DEADLOCK_TIMEOUT) as detector:
while remaining:
detector.ping()
# Wait for any item to finish fetching to cache.
digest = fetch_queue.wait()
# Create the files in the destination using item in cache as the
# source.
for filepath, props in remaining.pop(digest):
fullpath = os.path.join(outdir, filepath)
putfile_thread_pool.add_task(threading_utils.PRIORITY_HIGH,
_map_file, fullpath, digest,
props, cache, bundle.read_only,
use_symlinks)
# Report progress.
duration = time.time() - last_update
if duration > DELAY_BETWEEN_UPDATES_IN_SECS:
msg = '%d files remaining...' % len(remaining)
sys.stdout.write(msg + '\n')
sys.stdout.flush()
logging.info(msg)
last_update = time.time()
assert fetch_queue.wait_queue_empty, 'FetchQueue should have been emptied'
putfile_thread_pool.join()
# Save the cache right away to not loose the state of the new objects.
cache.save()
# Cache could evict some items we just tried to fetch, it's a fatal error.
if not fetch_queue.verify_all_cached():
free_disk = file_path.get_free_space(cache.cache_dir)
msg = (
'Cache is too small to hold all requested files.\n'
' %s\n cache=%dbytes, %d items; %sb free_space') % (
cache.policies, cache.total_size, len(cache), free_disk)
raise isolated_format.MappingError(msg)
return bundle
def _directory_to_metadata(root, algo, blacklist):
"""Yields every file and/or symlink found.
Yields:
tuple(FileItem, relpath, metadata)
For a symlink, FileItem is None.
"""
# Current tar file bundle, if any.
root = file_path.get_native_path_case(root)
bundle = TarBundle(root, algo)
for relpath, issymlink in isolated_format.expand_directory_and_symlink(
root,
u'.' + os.path.sep,
blacklist,
follow_symlinks=(sys.platform != 'win32')):
filepath = os.path.join(root, relpath)
if issymlink:
# TODO(maruel): Do not call this.
meta = isolated_format.file_to_metadata(filepath, 0, False)
yield None, relpath, meta
continue
prio = relpath.endswith('.isolated')
if bundle.try_add(FileItem(path=filepath, algo=algo, high_priority=prio)):
# The file was added to the current pending tarball and won't be archived
# individually.
continue
# Flush and reset the bundle.
for i, p, m in bundle.yield_item_path_meta():
yield i, p, m
bundle = TarBundle(root, algo)
# Yield the file individually.
item = FileItem(path=filepath, algo=algo, size=None, high_priority=prio)
yield item, relpath, item.meta
for i, p, m in bundle.yield_item_path_meta():
yield i, p, m
def _print_upload_stats(items, missing):
"""Prints upload stats."""
total = len(items)
total_size = sum(f.size for f in items)
logging.info(
'Total: %6d, %9.1fkiB', total, total_size / 1024.)
cache_hit = set(items).difference(missing)
cache_hit_size = sum(f.size for f in cache_hit)
logging.info(
'cache hit: %6d, %9.1fkiB, %6.2f%% files, %6.2f%% size',
len(cache_hit),
cache_hit_size / 1024.,
len(cache_hit) * 100. / total,
cache_hit_size * 100. / total_size if total_size else 0)
cache_miss = missing
cache_miss_size = sum(f.size for f in cache_miss)
logging.info(
'cache miss: %6d, %9.1fkiB, %6.2f%% files, %6.2f%% size',
len(cache_miss),
cache_miss_size / 1024.,
len(cache_miss) * 100. / total,
cache_miss_size * 100. / total_size if total_size else 0)
def _enqueue_dir(dirpath, blacklist, hash_algo, hash_algo_name):
"""Called by archive_files_to_storage for a directory.
Create an .isolated file.
Yields:
FileItem for every file found, plus one for the .isolated file itself.
"""
files = {}
for item, relpath, meta in _directory_to_metadata(
dirpath, hash_algo, blacklist):
# item is None for a symlink.
files[relpath] = meta
if item:
yield item
# TODO(maruel): If there' not file, don't yield an .isolated file.
data = {
'algo': hash_algo_name,
'files': files,
'version': isolated_format.ISOLATED_FILE_VERSION,
}
# Keep the file in memory. This is fine because .isolated files are relatively
# small.
yield BufferItem(
tools.format_json(data, True), algo=hash_algo, high_priority=True)
def archive_files_to_storage(storage, files, blacklist):
"""Stores every entry into remote storage and returns stats.
Arguments:
storage: a Storage object that communicates with the remote object store.
files: iterable of files to upload. If a directory is specified (with a
trailing slash), a .isolated file is created and its hash is returned.
Duplicates are skipped.
blacklist: function that returns True if a file should be omitted.
Returns:
tuple(OrderedDict(path: hash), list(FileItem cold), list(FileItem hot)).
The first file in the first item is always the .isolated file.
"""
# Dict of path to hash.
results = collections.OrderedDict()
hash_algo = storage.server_ref.hash_algo
hash_algo_name = storage.server_ref.hash_algo_name
# Generator of FileItem to pass to upload_items() concurrent operation.
channel = threading_utils.TaskChannel()
uploaded_digests = set()
def _upload_items():
results = storage.upload_items(channel)
uploaded_digests.update(f.digest for f in results)
t = threading.Thread(target=_upload_items)
t.start()
# Keep track locally of the items to determine cold and hot items.
items_found = []
try:
for f in files:
assert isinstance(f, unicode), repr(f)
if f in results:
# Duplicate
continue
try:
filepath = os.path.abspath(f)
if fs.isdir(filepath):
# Uploading a whole directory.
item = None
for item in _enqueue_dir(
filepath, blacklist, hash_algo, hash_algo_name):
channel.send_result(item)
items_found.append(item)
# The very last item will be the .isolated file.
if not item:
# There was no file in the directory.
continue
elif fs.isfile(filepath):
item = FileItem(
path=filepath,
algo=hash_algo,
size=None,
high_priority=f.endswith('.isolated'))
channel.send_result(item)
items_found.append(item)
else:
raise Error('%s is neither a file or directory.' % f)
results[f] = item.digest
except OSError:
raise Error('Failed to process %s.' % f)
finally:
# Stops the generator, so _upload_items() can exit.
channel.send_done()
t.join()
cold = []
hot = []
for i in items_found:
# Note that multiple FileItem may have the same .digest.
if i.digest in uploaded_digests:
cold.append(i)
else:
hot.append(i)
return results, cold, hot
@subcommand.usage('<file1..fileN> or - to read from stdin')
def CMDarchive(parser, args):
"""Archives data to the server.
If a directory is specified, a .isolated file is created the whole directory
is uploaded. Then this .isolated file can be included in another one to run
commands.
The commands output each file that was processed with its content hash. For
directories, the .isolated generated for the directory is listed as the
directory entry itself.
"""
add_isolate_server_options(parser)
add_archive_options(parser)
options, files = parser.parse_args(args)
process_isolate_server_options(parser, options, True, True)
server_ref = isolate_storage.ServerRef(
options.isolate_server, options.namespace)
if files == ['-']:
files = (l.rstrip('\n\r') for l in sys.stdin)
if not files:
parser.error('Nothing to upload')
files = (f.decode('utf-8') for f in files)
blacklist = tools.gen_blacklist(options.blacklist)
try:
with get_storage(server_ref) as storage:
results, _cold, _hot = archive_files_to_storage(storage, files, blacklist)
except (Error, local_caching.NoMoreSpace) as e:
parser.error(e.args[0])
print('\n'.join('%s %s' % (h, f) for f, h in results.iteritems()))
return 0
def CMDdownload(parser, args):
"""Download data from the server.
It can either download individual files or a complete tree from a .isolated
file.
"""
add_isolate_server_options(parser)
parser.add_option(
'-s', '--isolated', metavar='HASH',
help='hash of an isolated file, .isolated file content is discarded, use '
'--file if you need it')
parser.add_option(
'-f', '--file', metavar='HASH DEST', default=[], action='append', nargs=2,
help='hash and destination of a file, can be used multiple times')
parser.add_option(
'-t', '--target', metavar='DIR', default='download',
help='destination directory')
parser.add_option(
'--use-symlinks', action='store_true',
help='Use symlinks instead of hardlinks')
add_cache_options(parser)
options, args = parser.parse_args(args)
if args:
parser.error('Unsupported arguments: %s' % args)
if not file_path.enable_symlink():
logging.warning('Symlink support is not enabled')
process_isolate_server_options(parser, options, True, True)
if bool(options.isolated) == bool(options.file):
parser.error('Use one of --isolated or --file, and only one.')
if not options.cache and options.use_symlinks:
parser.error('--use-symlinks require the use of a cache with --cache')
cache = process_cache_options(options, trim=True)
cache.cleanup()
options.target = unicode(os.path.abspath(options.target))
if options.isolated:
if (fs.isfile(options.target) or
(fs.isdir(options.target) and fs.listdir(options.target))):
parser.error(
'--target \'%s\' exists, please use another target' % options.target)
server_ref = isolate_storage.ServerRef(
options.isolate_server, options.namespace)
with get_storage(server_ref) as storage:
# Fetching individual files.
if options.file:
# TODO(maruel): Enable cache in this case too.
channel = threading_utils.TaskChannel()
pending = {}
for digest, dest in options.file:
dest = unicode(dest)
pending[digest] = dest
storage.async_fetch(
channel,
threading_utils.PRIORITY_MED,
digest,
local_caching.UNKNOWN_FILE_SIZE,
functools.partial(
local_caching.file_write, os.path.join(options.target, dest)))
while pending:
fetched = channel.next()
dest = pending.pop(fetched)
logging.info('%s: %s', fetched, dest)
# Fetching whole isolated tree.
if options.isolated:
bundle = fetch_isolated(
isolated_hash=options.isolated,
storage=storage,
cache=cache,
outdir=options.target,
use_symlinks=options.use_symlinks)
cache.trim()
if bundle.command:
rel = os.path.join(options.target, bundle.relative_cwd)
print('To run this test please run from the directory %s:' %
os.path.join(options.target, rel))
print(' ' + ' '.join(bundle.command))
return 0
def add_archive_options(parser):
parser.add_option(
'--blacklist',
action='append', default=list(DEFAULT_BLACKLIST),
help='List of regexp to use as blacklist filter when uploading '
'directories')
def add_isolate_server_options(parser):
"""Adds --isolate-server and --namespace options to parser."""
parser.add_option(
'-I', '--isolate-server',
metavar='URL', default=os.environ.get('ISOLATE_SERVER', ''),
help='URL of the Isolate Server to use. Defaults to the environment '
'variable ISOLATE_SERVER if set. No need to specify https://, this '
'is assumed.')
parser.add_option(
'--grpc-proxy', help='gRPC proxy by which to communicate to Isolate')
parser.add_option(
'--namespace', default='default-gzip',
help='The namespace to use on the Isolate Server, default: %default')
def process_isolate_server_options(
parser, options, set_exception_handler, required):
"""Processes the --isolate-server option.
Returns the identity as determined by the server.
"""
if not options.isolate_server:
if required:
parser.error('--isolate-server is required.')
return
if options.grpc_proxy:
isolate_storage.set_grpc_proxy(options.grpc_proxy)
else:
try:
options.isolate_server = net.fix_url(options.isolate_server)
except ValueError as e:
parser.error('--isolate-server %s' % e)
if set_exception_handler:
on_error.report_on_exception_exit(options.isolate_server)
try:
return auth.ensure_logged_in(options.isolate_server)
except ValueError as e:
parser.error(str(e))
return None
def add_cache_options(parser):
cache_group = optparse.OptionGroup(parser, 'Cache management')
cache_group.add_option(
'--cache', metavar='DIR', default='cache',
help='Directory to keep a local cache of the files. Accelerates download '
'by reusing already downloaded files. Default=%default')
cache_group.add_option(
'--max-cache-size',
type='int',
metavar='NNN',
default=50*1024*1024*1024,
help='Trim if the cache gets larger than this value, default=%default')
cache_group.add_option(
'--min-free-space',
type='int',
metavar='NNN',
default=2*1024*1024*1024,
help='Trim if disk free space becomes lower than this value, '
'default=%default')
cache_group.add_option(
'--max-items',
type='int',
metavar='NNN',
default=100000,
help='Trim if more than this number of items are in the cache '
'default=%default')
parser.add_option_group(cache_group)
def process_cache_options(options, trim, **kwargs):
if options.cache:
policies = local_caching.CachePolicies(
options.max_cache_size,
options.min_free_space,
options.max_items,
# 3 weeks.
max_age_secs=21*24*60*60)
# |options.cache| path may not exist until DiskContentAddressedCache()
# instance is created.
return local_caching.DiskContentAddressedCache(
unicode(os.path.abspath(options.cache)), policies, trim, **kwargs)
return local_caching.MemoryContentAddressedCache()
class OptionParserIsolateServer(logging_utils.OptionParserWithLogging):
def __init__(self, **kwargs):
logging_utils.OptionParserWithLogging.__init__(
self,
version=__version__,
prog=os.path.basename(sys.modules[__name__].__file__),
**kwargs)
auth.add_auth_options(self)
def parse_args(self, *args, **kwargs):
options, args = logging_utils.OptionParserWithLogging.parse_args(
self, *args, **kwargs)
auth.process_auth_options(self, options)
return options, args
def main(args):
dispatcher = subcommand.CommandDispatcher(__name__)
return dispatcher.execute(OptionParserIsolateServer(), args)
if __name__ == '__main__':
subprocess42.inhibit_os_error_reporting()
fix_encoding.fix_encoding()
tools.disable_buffering()
colorama.init()
sys.exit(main(sys.argv[1:]))
| 34.475154 | 105 | 0.672168 |
7953aeafe5979b7b3e2320204aab2c5c09452534 | 4,060 | py | Python | google/ads/googleads/v7/googleads-py/google/ads/googleads/v7/services/services/user_location_view_service/transports/base.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 7 | 2021-02-21T10:39:41.000Z | 2021-12-07T07:31:28.000Z | google/ads/googleads/v7/googleads-py/google/ads/googleads/v7/services/services/user_location_view_service/transports/base.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 6 | 2021-02-02T23:46:11.000Z | 2021-11-15T01:46:02.000Z | google/ads/googleads/v7/googleads-py/google/ads/googleads/v7/services/services/user_location_view_service/transports/base.py | googleapis/googleapis-gen | d84824c78563d59b0e58d5664bfaa430e9ad7e7a | [
"Apache-2.0"
] | 4 | 2021-01-28T23:25:45.000Z | 2021-08-30T01:55:16.000Z | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
import abc
import typing
import pkg_resources
import google.auth # type: ignore
from google.api_core import gapic_v1 # type: ignore
from google.api_core import retry as retries # type: ignore
from google.auth import credentials as ga_credentials # type: ignore
from google.ads.googleads.v7.resources.types import user_location_view
from google.ads.googleads.v7.services.types import user_location_view_service
try:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo(
gapic_version=pkg_resources.get_distribution(
'google-ads',
).version,
)
except pkg_resources.DistributionNotFound:
DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo()
class UserLocationViewServiceTransport(metaclass=abc.ABCMeta):
"""Abstract transport class for UserLocationViewService."""
AUTH_SCOPES = (
'https://www.googleapis.com/auth/adwords',
)
def __init__(
self, *,
host: str = 'googleads.googleapis.com',
credentials: ga_credentials.Credentials = None,
client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
) -> None:
"""Instantiate the transport.
Args:
host (Optional[str]):
The hostname to connect to.
credentials (Optional[google.auth.credentials.Credentials]): The
authorization credentials to attach to requests. These
credentials identify the application to the service; if none
are specified, the client will attempt to ascertain the
credentials from the environment.
client_info (google.api_core.gapic_v1.client_info.ClientInfo):
The client info used to send a user-agent string along with
API requests. If ``None``, then default info will be used.
Generally, you only need to set this if you're developing
your own client library.
"""
# Save the hostname. Default to port 443 (HTTPS) if none is specified.
if ':' not in host:
host += ':443'
self._host = host
# If no credentials are provided, then determine the appropriate
# defaults.
if credentials is None:
credentials, _ = google.auth.default(scopes=self.AUTH_SCOPES)
# Save the credentials.
self._credentials = credentials
# Lifted into its own function so it can be stubbed out during tests.
self._prep_wrapped_messages(client_info)
def _prep_wrapped_messages(self, client_info):
# Precomputed wrapped methods
self._wrapped_methods = {
self.get_user_location_view: gapic_v1.method.wrap_method(
self.get_user_location_view,
default_timeout=None,
client_info=client_info,
),
}
def close(self):
"""Closes resources associated with the transport.
.. warning::
Only call this method if the transport is NOT shared
with other clients - this may cause errors in other clients!
"""
raise NotImplementedError()
@property
def get_user_location_view(self) -> typing.Callable[
[user_location_view_service.GetUserLocationViewRequest],
user_location_view.UserLocationView]:
raise NotImplementedError
__all__ = (
'UserLocationViewServiceTransport',
)
| 36.25 | 79 | 0.667734 |
7953af27a1b5e4e5e1bb07e184806d41646342a7 | 85 | py | Python | coins/apps.py | ken-www-learn/stock_money_jpw | ed3e144d0c6d4b405a2fa258f6ce999ce38935cc | [
"MIT"
] | 1 | 2018-01-26T20:52:58.000Z | 2018-01-26T20:52:58.000Z | coins/apps.py | ken-www-learn/stock_money_jpw | ed3e144d0c6d4b405a2fa258f6ce999ce38935cc | [
"MIT"
] | 6 | 2020-06-05T16:52:05.000Z | 2021-09-07T23:48:07.000Z | coincheck/coins/apps.py | mmalarz/coincheck | d403585da5d8485716ec8739f1849fe47174fede | [
"MIT"
] | null | null | null | from django.apps import AppConfig
class CoinsConfig(AppConfig):
name = 'coins'
| 14.166667 | 33 | 0.741176 |
7953affa0a1b866b06f5f3ba337758f21e7231b5 | 115,368 | py | Python | eth/abc.py | dbfreem/py-evm | 02a1f6f38884b1f7a89640c2095ea5b0f20687c3 | [
"MIT"
] | 1,641 | 2017-11-24T04:24:22.000Z | 2022-03-31T14:59:30.000Z | eth/abc.py | UniqueMR/py-evm | 026ee20f8d9b70d7c1b6a4fb9484d5489d425e54 | [
"MIT"
] | 1,347 | 2017-11-23T10:37:36.000Z | 2022-03-20T16:31:44.000Z | eth/abc.py | UniqueMR/py-evm | 026ee20f8d9b70d7c1b6a4fb9484d5489d425e54 | [
"MIT"
] | 567 | 2017-11-22T18:03:27.000Z | 2022-03-28T17:49:08.000Z | from abc import (
ABC,
abstractmethod
)
from typing import (
Any,
Callable,
ClassVar,
ContextManager,
Dict,
FrozenSet,
Iterable,
Iterator,
List,
MutableMapping,
NamedTuple,
Optional,
Sequence,
Tuple,
Type,
TypeVar,
Union,
Hashable,
)
from eth_bloom import BloomFilter
from eth_typing import (
Address,
BlockNumber,
Hash32,
)
from eth_utils import ExtendedDebugLogger
from eth_keys.datatypes import PrivateKey
from eth.constants import (
BLANK_ROOT_HASH,
)
from eth.exceptions import VMError
from eth.typing import (
BytesOrView,
ChainGaps,
JournalDBCheckpoint,
AccountState,
HeaderParams,
VMConfiguration,
)
T = TypeVar('T')
# A decoded RLP object of unknown interpretation, with a maximum "depth" of 1.
DecodedZeroOrOneLayerRLP = Union[bytes, List[bytes]]
class MiningHeaderAPI(ABC):
"""
A class to define a block header without ``mix_hash`` and ``nonce`` which can act as a
temporary representation during mining before the block header is sealed.
"""
parent_hash: Hash32
uncles_hash: Hash32
coinbase: Address
state_root: Hash32
transaction_root: Hash32
receipt_root: Hash32
bloom: int
difficulty: int
block_number: BlockNumber
gas_limit: int
gas_used: int
timestamp: int
extra_data: bytes
@property
@abstractmethod
def hash(self) -> Hash32:
"""
Return the hash of the block header.
"""
...
@property
@abstractmethod
def mining_hash(self) -> Hash32:
"""
Return the mining hash of the block header.
"""
@property
def hex_hash(self) -> str:
"""
Return the hash as a hex string.
"""
...
@property
@abstractmethod
def is_genesis(self) -> bool:
"""
Return ``True`` if this header represents the genesis block of the chain,
otherwise ``False``.
"""
...
# We can remove this API and inherit from rlp.Serializable when it becomes typesafe
@abstractmethod
def build_changeset(self, *args: Any, **kwargs: Any) -> Any:
"""
Open a changeset to modify the header.
"""
...
# We can remove this API and inherit from rlp.Serializable when it becomes typesafe
@abstractmethod
def as_dict(self) -> Dict[Hashable, Any]:
"""
Return a dictionary representation of the header.
"""
...
@property
@abstractmethod
def base_fee_per_gas(self) -> Optional[int]:
"""
Return the base fee per gas of the block.
Set to None in pre-EIP-1559 (London) header.
"""
...
class BlockHeaderSedesAPI(ABC):
"""
Serialize and deserialize RLP for a header.
The header may be one of several definitions, like a London (EIP-1559) or
pre-London header.
"""
@classmethod
@abstractmethod
def deserialize(cls, encoded: List[bytes]) -> 'BlockHeaderAPI':
"""
Extract a header from an encoded RLP object.
This method is used by rlp.decode(..., sedes=TransactionBuilderAPI).
"""
...
@classmethod
@abstractmethod
def serialize(cls, obj: 'BlockHeaderAPI') -> List[bytes]:
"""
Encode a header to a series of bytes used by RLP.
This method is used by rlp.encode(obj).
"""
...
class BlockHeaderAPI(MiningHeaderAPI, BlockHeaderSedesAPI):
"""
A class derived from :class:`~eth.abc.MiningHeaderAPI` to define a block header after it is
sealed.
"""
mix_hash: Hash32
nonce: bytes
# We can remove this API and inherit from rlp.Serializable when it becomes typesafe
@abstractmethod
def copy(self, *args: Any, **kwargs: Any) -> 'BlockHeaderAPI':
"""
Return a copy of the header, optionally overwriting any of its properties.
"""
...
class LogAPI(ABC):
"""
A class to define a written log.
"""
address: Address
topics: Sequence[int]
data: bytes
@property
@abstractmethod
def bloomables(self) -> Tuple[bytes, ...]:
...
class ReceiptAPI(ABC):
"""
A class to define a receipt to capture the outcome of a transaction.
"""
@property
@abstractmethod
def state_root(self) -> bytes:
...
@property
@abstractmethod
def gas_used(self) -> int:
...
@property
@abstractmethod
def bloom(self) -> int:
...
@property
@abstractmethod
def logs(self) -> Sequence[LogAPI]:
...
@property
@abstractmethod
def bloom_filter(self) -> BloomFilter:
...
# We can remove this API and inherit from rlp.Serializable when it becomes typesafe
def copy(self, *args: Any, **kwargs: Any) -> 'ReceiptAPI':
"""
Return a copy of the receipt, optionally overwriting any of its properties.
"""
# This method isn't marked abstract because derived classes implement it by deriving from
# rlp.Serializable but mypy won't recognize it as implemented.
...
@abstractmethod
def encode(self) -> bytes:
"""
This encodes a receipt, no matter if it's: a legacy receipt, a
typed receipt, or the payload of a typed receipt. See more
context in decode.
"""
...
class ReceiptDecoderAPI(ABC):
"""
Responsible for decoding receipts from bytestrings.
"""
@classmethod
@abstractmethod
def decode(cls, encoded: bytes) -> ReceiptAPI:
"""
This decodes a receipt that is encoded to either a typed
receipt, a legacy receipt, or the body of a typed receipt. It assumes
that typed receipts are *not* rlp-encoded first.
If dealing with an object that is always rlp encoded, then use this instead:
rlp.decode(encoded, sedes=ReceiptBuilderAPI)
For example, you may receive a list of receipts via a devp2p request.
Each receipt is either a (legacy) rlp list, or a (new-style)
bytestring. Even if the receipt is a bytestring, it's wrapped in an rlp
bytestring, in that context. New-style receipts will *not* be wrapped
in an RLP bytestring in other contexts. They will just be an EIP-2718
type-byte plus payload of concatenated bytes, which cannot be decoded
as RLP. This happens for example, when calculating the receipt root
hash.
"""
...
class ReceiptBuilderAPI(ReceiptDecoderAPI):
"""
Responsible for encoding and decoding receipts.
Most simply, the builder is responsible for some pieces of the encoding for
RLP. In legacy transactions, this happens using rlp.Serializeable.
Some VMs support multiple distinct transaction types. In that case, the
builder is responsible for dispatching on the different types.
"""
@classmethod
@abstractmethod
def deserialize(cls, encoded: DecodedZeroOrOneLayerRLP) -> 'ReceiptAPI':
"""
Extract a receipt from an encoded RLP object.
This method is used by rlp.decode(..., sedes=ReceiptBuilderAPI).
"""
...
@classmethod
@abstractmethod
def serialize(cls, obj: 'ReceiptAPI') -> DecodedZeroOrOneLayerRLP:
"""
Encode a receipt to a series of bytes used by RLP.
In the case of legacy receipt, it will actually be a list of
bytes. That doesn't show up here, because pyrlp doesn't export type
annotations.
This method is used by rlp.encode(obj).
"""
...
class BaseTransactionAPI(ABC):
"""
A class to define all common methods of a transaction.
"""
@abstractmethod
def validate(self) -> None:
"""
Hook called during instantiation to ensure that all transaction
parameters pass validation rules.
"""
...
@property
@abstractmethod
def intrinsic_gas(self) -> int:
"""
Convenience property for the return value of `get_intrinsic_gas`
"""
...
@abstractmethod
def get_intrinsic_gas(self) -> int:
"""
Return the intrinsic gas for the transaction which is defined as the amount of gas that
is needed before any code runs.
"""
...
@abstractmethod
def gas_used_by(self, computation: 'ComputationAPI') -> int:
"""
Return the gas used by the given computation. In Frontier,
for example, this is sum of the intrinsic cost and the gas used
during computation.
"""
...
# We can remove this API and inherit from rlp.Serializable when it becomes typesafe
@abstractmethod
def copy(self: T, **overrides: Any) -> T:
"""
Return a copy of the transaction.
"""
...
@property
@abstractmethod
def access_list(self) -> Sequence[Tuple[Address, Sequence[int]]]:
"""
Get addresses to be accessed by a transaction, and their storage slots.
"""
...
class TransactionFieldsAPI(ABC):
"""
A class to define all common transaction fields.
"""
@property
@abstractmethod
def nonce(self) -> int:
...
@property
@abstractmethod
def gas_price(self) -> int:
"""
Will raise :class:`AttributeError` if get or set on a 1559 transaction.
"""
...
@property
@abstractmethod
def max_fee_per_gas(self) -> int:
"""
Will default to gas_price if this is a pre-1559 transaction.
"""
...
@property
@abstractmethod
def max_priority_fee_per_gas(self) -> int:
"""
Will default to gas_price if this is a pre-1559 transaction.
"""
...
@property
@abstractmethod
def gas(self) -> int:
...
@property
@abstractmethod
def to(self) -> Address:
...
@property
@abstractmethod
def value(self) -> int:
...
@property
@abstractmethod
def data(self) -> bytes:
...
@property
@abstractmethod
def r(self) -> int:
...
@property
@abstractmethod
def s(self) -> int:
...
@property
@abstractmethod
def hash(self) -> Hash32:
"""
Return the hash of the transaction.
"""
...
@property
@abstractmethod
def chain_id(self) -> Optional[int]:
...
class LegacyTransactionFieldsAPI(TransactionFieldsAPI):
@property
@abstractmethod
def v(self) -> int:
"""
In old transactions, this v field combines the y_parity bit and the
chain ID. All new usages should prefer accessing those fields directly.
But if you must access the original v, then you can cast to this API
first (after checking that type_id is None).
"""
...
class UnsignedTransactionAPI(BaseTransactionAPI):
"""
A class representing a transaction before it is signed.
"""
nonce: int
gas_price: int
gas: int
to: Address
value: int
data: bytes
#
# API that must be implemented by all Transaction subclasses.
#
@abstractmethod
def as_signed_transaction(self, private_key: PrivateKey) -> 'SignedTransactionAPI':
"""
Return a version of this transaction which has been signed using the
provided `private_key`
"""
...
class TransactionDecoderAPI(ABC):
"""
Responsible for decoding transactions from bytestrings.
Some VMs support multiple distinct transaction types. In that case, the
decoder is responsible for dispatching on the different types.
"""
@classmethod
@abstractmethod
def decode(cls, encoded: bytes) -> 'SignedTransactionAPI':
"""
This decodes a transaction that is encoded to either a typed
transaction or a legacy transaction, or even the payload of one of the
transaction types. It assumes that typed transactions are *not*
rlp-encoded first.
If dealing with an object that is rlp encoded first, then use this instead:
rlp.decode(encoded, sedes=TransactionBuilderAPI)
For example, you may receive a list of transactions via a devp2p
request. Each transaction is either a (legacy) rlp list, or a
(new-style) bytestring. Even if the transaction is a bytestring, it's
wrapped in an rlp bytestring, in that context. New-style transactions
will *not* be wrapped in an RLP bytestring in other contexts. They will
just be an EIP-2718 type-byte plus payload of concatenated bytes, which
cannot be decoded as RLP. An example context for this is calculating
the transaction root hash.
"""
...
class TransactionBuilderAPI(TransactionDecoderAPI):
"""
Responsible for creating and encoding transactions.
Most simply, the builder is responsible for some pieces of the encoding for
RLP. In legacy transactions, this happens using rlp.Serializeable. It is
also responsible for initializing the transactions. The two transaction
initializers assume legacy transactions, for now.
Some VMs support multiple distinct transaction types. In that case, the
builder is responsible for dispatching on the different types.
"""
@classmethod
@abstractmethod
def deserialize(cls, encoded: DecodedZeroOrOneLayerRLP) -> 'SignedTransactionAPI':
"""
Extract a transaction from an encoded RLP object.
This method is used by rlp.decode(..., sedes=TransactionBuilderAPI).
"""
...
@classmethod
@abstractmethod
def serialize(cls, obj: 'SignedTransactionAPI') -> DecodedZeroOrOneLayerRLP:
"""
Encode a transaction to a series of bytes used by RLP.
In the case of legacy transactions, it will actually be a list of
bytes. That doesn't show up here, because pyrlp doesn't export type
annotations.
This method is used by rlp.encode(obj).
"""
...
@classmethod
@abstractmethod
def create_unsigned_transaction(cls,
*,
nonce: int,
gas_price: int,
gas: int,
to: Address,
value: int,
data: bytes) -> UnsignedTransactionAPI:
"""
Create an unsigned transaction.
"""
...
@classmethod
@abstractmethod
def new_transaction(
cls,
nonce: int,
gas_price: int,
gas: int,
to: Address,
value: int,
data: bytes,
v: int,
r: int,
s: int) -> 'SignedTransactionAPI':
"""
Create a signed transaction.
"""
...
class SignedTransactionAPI(BaseTransactionAPI, TransactionFieldsAPI):
def __init__(self, *args: Any, **kwargs: Any) -> None:
...
"""
A class representing a transaction that was signed with a private key.
"""
@property
@abstractmethod
def sender(self) -> Address:
"""
Convenience and performance property for the return value of `get_sender`
"""
...
@property
@abstractmethod
def y_parity(self) -> int:
"""
The bit used to disambiguate elliptic curve signatures.
The only values this method will return are 0 or 1.
"""
...
type_id: Optional[int]
"""
The type of EIP-2718 transaction
Each EIP-2718 transaction includes a type id (which is the leading
byte, as encoded).
If this transaction is a legacy transaction, that it has no type. Then,
type_id will be None.
"""
# +-------------------------------------------------------------+
# | API that must be implemented by all Transaction subclasses. |
# +-------------------------------------------------------------+
#
# Validation
#
@abstractmethod
def validate(self) -> None:
"""
Hook called during instantiation to ensure that all transaction
parameters pass validation rules.
"""
...
#
# Signature and Sender
#
@property
@abstractmethod
def is_signature_valid(self) -> bool:
"""
Return ``True`` if the signature is valid, otherwise ``False``.
"""
...
@abstractmethod
def check_signature_validity(self) -> None:
"""
Check if the signature is valid. Raise a ``ValidationError`` if the signature
is invalid.
"""
...
@abstractmethod
def get_sender(self) -> Address:
"""
Get the 20-byte address which sent this transaction.
This can be a slow operation. ``transaction.sender`` is always preferred.
"""
...
#
# Conversion to and creation of unsigned transactions.
#
@abstractmethod
def get_message_for_signing(self) -> bytes:
"""
Return the bytestring that should be signed in order to create a signed transaction.
"""
...
# We can remove this API and inherit from rlp.Serializable when it becomes typesafe
def as_dict(self) -> Dict[Hashable, Any]:
"""
Return a dictionary representation of the transaction.
"""
...
@abstractmethod
def make_receipt(
self,
status: bytes,
gas_used: int,
log_entries: Tuple[Tuple[bytes, Tuple[int, ...], bytes], ...]) -> ReceiptAPI:
"""
Build a receipt for this transaction.
Transactions have this responsibility because there are different types
of transactions, which have different types of receipts. (See
access-list transactions, which change the receipt encoding)
:param status: success or failure (used to be the state root after execution)
:param gas_used: cumulative usage of this transaction and the previous
ones in the header
:param log_entries: logs generated during execution
"""
...
@abstractmethod
def encode(self) -> bytes:
"""
This encodes a transaction, no matter if it's: a legacy transaction, a
typed transaction, or the payload of a typed transaction. See more
context in decode.
"""
...
class BlockAPI(ABC):
"""
A class to define a block.
"""
header: BlockHeaderAPI
transactions: Tuple[SignedTransactionAPI, ...]
transaction_builder: Type[TransactionBuilderAPI] = None
receipt_builder: Type[ReceiptBuilderAPI] = None
uncles: Tuple[BlockHeaderAPI, ...]
@abstractmethod
def __init__(self,
header: BlockHeaderAPI,
transactions: Sequence[SignedTransactionAPI],
uncles: Sequence[BlockHeaderAPI]):
...
@classmethod
@abstractmethod
def get_transaction_builder(cls) -> Type[TransactionBuilderAPI]:
"""
Return the transaction builder for the block.
"""
...
@classmethod
@abstractmethod
def get_receipt_builder(cls) -> Type[ReceiptBuilderAPI]:
"""
Return the receipt builder for the block.
"""
...
@classmethod
@abstractmethod
def from_header(cls, header: BlockHeaderAPI, chaindb: 'ChainDatabaseAPI') -> 'BlockAPI':
"""
Instantiate a block from the given ``header`` and the ``chaindb``.
"""
...
@abstractmethod
def get_receipts(self, chaindb: 'ChainDatabaseAPI') -> Tuple[ReceiptAPI, ...]:
"""
Fetch the receipts for this block from the given ``chaindb``.
"""
...
@property
@abstractmethod
def hash(self) -> Hash32:
"""
Return the hash of the block.
"""
...
@property
@abstractmethod
def number(self) -> BlockNumber:
"""
Return the number of the block.
"""
...
@property
@abstractmethod
def is_genesis(self) -> bool:
"""
Return ``True`` if this block represents the genesis block of the chain,
otherwise ``False``.
"""
...
# We can remove this API and inherit from rlp.Serializable when it becomes typesafe
def copy(self, *args: Any, **kwargs: Any) -> 'BlockAPI':
"""
Return a copy of the block, optionally overwriting any of its properties.
"""
# This method isn't marked abstract because derived classes implement it by deriving from
# rlp.Serializable but mypy won't recognize it as implemented.
...
class MetaWitnessAPI(ABC):
@property
@abstractmethod
def hashes(self) -> FrozenSet[Hash32]:
...
@property
@abstractmethod
def accounts_queried(self) -> FrozenSet[Address]:
...
@property
@abstractmethod
def account_bytecodes_queried(self) -> FrozenSet[Address]:
...
@abstractmethod
def get_slots_queried(self, address: Address) -> FrozenSet[int]:
...
@property
@abstractmethod
def total_slots_queried(self) -> int:
"""
Summed across all accounts, how many storage slots were queried?
"""
...
class BlockAndMetaWitness(NamedTuple):
"""
After evaluating a block using the VirtualMachine, this information
becomes available.
"""
block: BlockAPI
meta_witness: MetaWitnessAPI
class BlockPersistResult(NamedTuple):
"""
After persisting a block into the active chain, this information
becomes available.
"""
imported_block: BlockAPI
new_canonical_blocks: Tuple[BlockAPI, ...]
old_canonical_blocks: Tuple[BlockAPI, ...]
class BlockImportResult(NamedTuple):
"""
After importing and persisting a block into the active chain, this information
becomes available.
"""
imported_block: BlockAPI
new_canonical_blocks: Tuple[BlockAPI, ...]
old_canonical_blocks: Tuple[BlockAPI, ...]
meta_witness: MetaWitnessAPI
class SchemaAPI(ABC):
"""
A class representing a database schema that maps values to lookup keys.
"""
@staticmethod
@abstractmethod
def make_header_chain_gaps_lookup_key() -> bytes:
"""
Return the lookup key to retrieve the header chain integrity info from the database.
"""
...
@staticmethod
@abstractmethod
def make_canonical_head_hash_lookup_key() -> bytes:
"""
Return the lookup key to retrieve the canonical head from the database.
"""
...
@staticmethod
@abstractmethod
def make_block_number_to_hash_lookup_key(block_number: BlockNumber) -> bytes:
"""
Return the lookup key to retrieve a block hash from a block number.
"""
...
@staticmethod
@abstractmethod
def make_block_hash_to_score_lookup_key(block_hash: Hash32) -> bytes:
"""
Return the lookup key to retrieve the score from a block hash.
"""
...
@staticmethod
@abstractmethod
def make_transaction_hash_to_block_lookup_key(transaction_hash: Hash32) -> bytes:
"""
Return the lookup key to retrieve a transaction key from a transaction hash.
"""
...
class DatabaseAPI(MutableMapping[bytes, bytes], ABC):
"""
A class representing a database.
"""
@abstractmethod
def set(self, key: bytes, value: bytes) -> None:
"""
Assign the ``value`` to the ``key``.
"""
...
@abstractmethod
def exists(self, key: bytes) -> bool:
"""
Return ``True`` if the ``key`` exists in the database, otherwise ``False``.
"""
...
@abstractmethod
def delete(self, key: bytes) -> None:
"""
Delete the given ``key`` from the database.
"""
...
class AtomicWriteBatchAPI(DatabaseAPI):
"""
The readable/writeable object returned by an atomic database when we start building
a batch of writes to commit.
Reads to this database will observe writes written during batching,
but the writes will not actually persist until this object is committed.
"""
pass
class AtomicDatabaseAPI(DatabaseAPI):
"""
Like ``BatchDB``, but immediately write out changes if they are
not in an ``atomic_batch()`` context.
"""
@abstractmethod
def atomic_batch(self) -> ContextManager[AtomicWriteBatchAPI]:
"""
Return a :class:`~typing.ContextManager` to write an atomic batch to the database.
"""
...
class HeaderDatabaseAPI(ABC):
"""
A class representing a database for block headers.
"""
db: AtomicDatabaseAPI
@abstractmethod
def __init__(self, db: AtomicDatabaseAPI) -> None:
"""
Instantiate the database from an :class:`~eth.abc.AtomicDatabaseAPI`.
"""
...
@abstractmethod
def get_header_chain_gaps(self) -> ChainGaps:
"""
Return information about gaps in the chain of headers. This consists of an ordered sequence
of block ranges describing the integrity of the chain. Each block range describes a missing
segment in the chain and each range is defined with inclusive boundaries, meaning the first
value describes the first missing block of that segment and the second value describes the
last missing block of the segment.
In addition to the sequences of block ranges a block number is included that indicates the
number of the first header that is known to be missing at the very tip of the chain.
"""
#
# Canonical Chain API
#
@abstractmethod
def get_canonical_block_hash(self, block_number: BlockNumber) -> Hash32:
"""
Return the block hash for the canonical block at the given number.
Raise ``BlockNotFound`` if there's no block header with the given number in the
canonical chain.
"""
...
@abstractmethod
def get_canonical_block_header_by_number(self, block_number: BlockNumber) -> BlockHeaderAPI:
"""
Return the block header with the given number in the canonical chain.
Raise ``HeaderNotFound`` if there's no block header with the given number in the
canonical chain.
"""
...
@abstractmethod
def get_canonical_head(self) -> BlockHeaderAPI:
"""
Return the current block header at the head of the chain.
"""
...
#
# Header API
#
@abstractmethod
def get_block_header_by_hash(self, block_hash: Hash32) -> BlockHeaderAPI:
"""
Return the block header for the given ``block_hash``.
Raise ``HeaderNotFound`` if no header with the given ``block_hash`` exists in the database.
"""
...
@abstractmethod
def get_score(self, block_hash: Hash32) -> int:
"""
Return the score for the given ``block_hash``.
"""
...
@abstractmethod
def header_exists(self, block_hash: Hash32) -> bool:
"""
Return ``True`` if the ``block_hash`` exists in the database, otherwise ``False``.
"""
...
@abstractmethod
def persist_checkpoint_header(self, header: BlockHeaderAPI, score: int) -> None:
"""
Persist a checkpoint header with a trusted score. Persisting the checkpoint header
automatically sets it as the new canonical head.
"""
...
@abstractmethod
def persist_header(self,
header: BlockHeaderAPI
) -> Tuple[Tuple[BlockHeaderAPI, ...], Tuple[BlockHeaderAPI, ...]]:
"""
Persist the ``header`` in the database.
Return two iterable of headers, the first containing the new canonical header,
the second containing the old canonical headers
"""
...
@abstractmethod
def persist_header_chain(self,
headers: Sequence[BlockHeaderAPI],
genesis_parent_hash: Hash32 = None,
) -> Tuple[Tuple[BlockHeaderAPI, ...], Tuple[BlockHeaderAPI, ...]]:
"""
Persist a chain of headers in the database.
Return two iterable of headers, the first containing the new canonical headers,
the second containing the old canonical headers
:param genesis_parent_hash: *optional* parent hash of the block that is treated as genesis.
Providing a ``genesis_parent_hash`` allows storage of headers that aren't (yet)
connected back to the true genesis header.
"""
...
class ChainDatabaseAPI(HeaderDatabaseAPI):
"""
A class representing a database for chain data. This class is derived from
:class:`~eth.abc.HeaderDatabaseAPI`.
"""
#
# Header API
#
@abstractmethod
def get_block_uncles(self, uncles_hash: Hash32) -> Tuple[BlockHeaderAPI, ...]:
"""
Return an iterable of uncle headers specified by the given ``uncles_hash``
"""
...
#
# Block API
#
@abstractmethod
def persist_block(self,
block: BlockAPI,
genesis_parent_hash: Hash32 = None,
) -> Tuple[Tuple[Hash32, ...], Tuple[Hash32, ...]]:
"""
Persist the given block's header and uncles.
:param block: the block that gets persisted
:param genesis_parent_hash: *optional* parent hash of the header that is treated
as genesis. Providing a ``genesis_parent_hash`` allows storage of blocks that
aren't (yet) connected back to the true genesis header.
.. warning::
This API assumes all block transactions have been persisted already. Use
:meth:`eth.abc.ChainDatabaseAPI.persist_unexecuted_block` to persist blocks that were
not executed.
"""
...
@abstractmethod
def persist_unexecuted_block(self,
block: BlockAPI,
receipts: Tuple[ReceiptAPI, ...],
genesis_parent_hash: Hash32 = None
) -> Tuple[Tuple[Hash32, ...], Tuple[Hash32, ...]]:
"""
Persist the given block's header, uncles, transactions, and receipts. Does
**not** validate if state transitions are valid.
:param block: the block that gets persisted
:param receipts: the receipts for the given block
:param genesis_parent_hash: *optional* parent hash of the header that is treated
as genesis. Providing a ``genesis_parent_hash`` allows storage of blocks that
aren't (yet) connected back to the true genesis header.
This API should be used to persist blocks that the EVM does not execute but which it
stores to make them available. It ensures to persist receipts and transactions which
:meth:`eth.abc.ChainDatabaseAPI.persist_block` in contrast assumes to be persisted
separately.
"""
@abstractmethod
def persist_uncles(self, uncles: Tuple[BlockHeaderAPI]) -> Hash32:
"""
Persist the list of uncles to the database.
Return the uncles hash.
"""
...
#
# Transaction API
#
@abstractmethod
def add_receipt(self,
block_header: BlockHeaderAPI,
index_key: int, receipt: ReceiptAPI) -> Hash32:
"""
Add the given receipt to the provided block header.
Return the updated `receipts_root` for updated block header.
"""
...
@abstractmethod
def add_transaction(self,
block_header: BlockHeaderAPI,
index_key: int, transaction: SignedTransactionAPI) -> Hash32:
"""
Add the given transaction to the provided block header.
Return the updated `transactions_root` for updated block header.
"""
...
@abstractmethod
def get_block_transactions(
self,
block_header: BlockHeaderAPI,
transaction_decoder: Type[TransactionDecoderAPI]) -> Tuple[SignedTransactionAPI, ...]:
"""
Return an iterable of transactions for the block speficied by the
given block header.
"""
...
@abstractmethod
def get_block_transaction_hashes(self, block_header: BlockHeaderAPI) -> Tuple[Hash32, ...]:
"""
Return a tuple cointaining the hashes of the transactions of the given ``block_header``.
"""
...
@abstractmethod
def get_receipt_by_index(self,
block_number: BlockNumber,
receipt_index: int,
receipt_decoder: Type[ReceiptDecoderAPI]) -> ReceiptAPI:
"""
Return the receipt of the transaction at specified index
for the block header obtained by the specified block number
"""
...
@abstractmethod
def get_receipts(self,
header: BlockHeaderAPI,
receipt_decoder: Type[ReceiptDecoderAPI]) -> Tuple[ReceiptAPI, ...]:
"""
Return a tuple of receipts for the block specified by the given
block header.
"""
...
@abstractmethod
def get_transaction_by_index(
self,
block_number: BlockNumber,
transaction_index: int,
transaction_decoder: Type[TransactionDecoderAPI]) -> SignedTransactionAPI:
"""
Return the transaction at the specified `transaction_index` from the
block specified by `block_number` from the canonical chain.
Raise ``TransactionNotFound`` if no block with that ``block_number`` exists.
"""
...
@abstractmethod
def get_transaction_index(self, transaction_hash: Hash32) -> Tuple[BlockNumber, int]:
"""
Return a 2-tuple of (block_number, transaction_index) indicating which
block the given transaction can be found in and at what index in the
block transactions.
Raise ``TransactionNotFound`` if the transaction_hash is not found in the
canonical chain.
"""
...
#
# Raw Database API
#
@abstractmethod
def exists(self, key: bytes) -> bool:
"""
Return ``True`` if the given key exists in the database.
"""
...
@abstractmethod
def get(self, key: bytes) -> bytes:
"""
Return the value for the given key or a KeyError if it doesn't exist in the database.
"""
...
@abstractmethod
def persist_trie_data_dict(self, trie_data_dict: Dict[Hash32, bytes]) -> None:
"""
Store raw trie data to db from a dict
"""
...
class GasMeterAPI(ABC):
"""
A class to define a gas meter.
"""
gas_refunded: int
gas_remaining: int
#
# Write API
#
@abstractmethod
def consume_gas(self, amount: int, reason: str) -> None:
"""
Consume ``amount`` of gas for a defined ``reason``.
"""
...
@abstractmethod
def return_gas(self, amount: int) -> None:
"""
Return ``amount`` of gas.
"""
...
@abstractmethod
def refund_gas(self, amount: int) -> None:
"""
Refund ``amount`` of gas.
"""
...
class MessageAPI(ABC):
"""
A message for VM computation.
"""
code: bytes
_code_address: Address
create_address: Address
data: BytesOrView
depth: int
gas: int
is_static: bool
sender: Address
should_transfer_value: bool
_storage_address: Address
to: Address
value: int
__slots__ = [
'code',
'_code_address',
'create_address',
'data',
'depth',
'gas',
'is_static',
'sender',
'should_transfer_value',
'_storage_address'
'to',
'value',
]
@property
@abstractmethod
def code_address(self) -> Address:
...
@property
@abstractmethod
def storage_address(self) -> Address:
...
@property
@abstractmethod
def is_create(self) -> bool:
...
@property
@abstractmethod
def data_as_bytes(self) -> bytes:
...
class OpcodeAPI(ABC):
"""
A class representing an opcode.
"""
mnemonic: str
@abstractmethod
def __call__(self, computation: 'ComputationAPI') -> None:
"""
Execute the logic of the opcode.
"""
...
@classmethod
@abstractmethod
def as_opcode(cls: Type[T],
logic_fn: Callable[['ComputationAPI'], None],
mnemonic: str,
gas_cost: int) -> T:
"""
Class factory method for turning vanilla functions into Opcodes.
"""
...
@abstractmethod
def __copy__(self) -> 'OpcodeAPI':
"""
Return a copy of the opcode.
"""
...
@abstractmethod
def __deepcopy__(self, memo: Any) -> 'OpcodeAPI':
"""
Return a deep copy of the opcode.
"""
...
class ChainContextAPI(ABC):
"""
Immutable chain context information that remains constant over the VM execution.
"""
@abstractmethod
def __init__(self, chain_id: Optional[int]) -> None:
"""
Initialize the chain context with the given ``chain_id``.
"""
...
@property
@abstractmethod
def chain_id(self) -> int:
"""
Return the chain id of the chain context.
"""
...
class TransactionContextAPI(ABC):
"""
Immutable transaction context information that remains constant over the VM execution.
"""
@abstractmethod
def __init__(self, gas_price: int, origin: Address) -> None:
"""
Initialize the transaction context from the given ``gas_price`` and ``origin`` address.
"""
...
@abstractmethod
def get_next_log_counter(self) -> int:
"""
Increment and return the log counter.
"""
...
@property
@abstractmethod
def gas_price(self) -> int:
"""
Return the gas price of the transaction context.
"""
...
@property
@abstractmethod
def origin(self) -> Address:
"""
Return the origin of the transaction context.
"""
...
class MemoryAPI(ABC):
"""
A class representing the memory of the :class:`~eth.abc.VirtualMachineAPI`.
"""
@abstractmethod
def extend(self, start_position: int, size: int) -> None:
"""
Extend the memory from the given ``start_position`` to the provided ``size``.
"""
...
@abstractmethod
def __len__(self) -> int:
"""
Return the length of the memory.
"""
...
@abstractmethod
def write(self, start_position: int, size: int, value: bytes) -> None:
"""
Write `value` into memory.
"""
...
@abstractmethod
def read(self, start_position: int, size: int) -> memoryview:
"""
Return a view into the memory
"""
...
@abstractmethod
def read_bytes(self, start_position: int, size: int) -> bytes:
"""
Read a value from memory and return a fresh bytes instance
"""
...
class StackAPI(ABC):
"""
A class representing the stack of the :class:`~eth.abc.VirtualMachineAPI`.
"""
@abstractmethod
def push_int(self, value: int) -> None:
"""
Push an integer item onto the stack.
"""
...
@abstractmethod
def push_bytes(self, value: bytes) -> None:
"""
Push a bytes item onto the stack.
"""
...
@abstractmethod
def pop1_bytes(self) -> bytes:
"""
Pop and return a bytes element from the stack.
Raise `eth.exceptions.InsufficientStack` if the stack was empty.
"""
...
@abstractmethod
def pop1_int(self) -> int:
"""
Pop and return an integer from the stack.
Raise `eth.exceptions.InsufficientStack` if the stack was empty.
"""
...
@abstractmethod
def pop1_any(self) -> Union[int, bytes]:
"""
Pop and return an element from the stack.
The type of each element will be int or bytes, depending on whether it was
pushed with push_bytes or push_int.
Raise `eth.exceptions.InsufficientStack` if the stack was empty.
"""
...
@abstractmethod
def pop_any(self, num_items: int) -> Tuple[Union[int, bytes], ...]:
"""
Pop and return a tuple of items of length ``num_items`` from the stack.
The type of each element will be int or bytes, depending on whether it was
pushed with stack_push_bytes or stack_push_int.
Raise `eth.exceptions.InsufficientStack` if there are not enough items on
the stack.
Items are ordered with the top of the stack as the first item in the tuple.
"""
...
@abstractmethod
def pop_ints(self, num_items: int) -> Tuple[int, ...]:
"""
Pop and return a tuple of integers of length ``num_items`` from the stack.
Raise `eth.exceptions.InsufficientStack` if there are not enough items on
the stack.
Items are ordered with the top of the stack as the first item in the tuple.
"""
...
@abstractmethod
def pop_bytes(self, num_items: int) -> Tuple[bytes, ...]:
"""
Pop and return a tuple of bytes of length ``num_items`` from the stack.
Raise `eth.exceptions.InsufficientStack` if there are not enough items on
the stack.
Items are ordered with the top of the stack as the first item in the tuple.
"""
...
@abstractmethod
def swap(self, position: int) -> None:
"""
Perform a SWAP operation on the stack.
"""
...
@abstractmethod
def dup(self, position: int) -> None:
"""
Perform a DUP operation on the stack.
"""
...
class CodeStreamAPI(ABC):
"""
A class representing a stream of EVM code.
"""
program_counter: int
@abstractmethod
def read(self, size: int) -> bytes:
"""
Read and return the code from the current position of the cursor up to ``size``.
"""
...
@abstractmethod
def __len__(self) -> int:
"""
Return the length of the code stream.
"""
...
@abstractmethod
def __getitem__(self, index: int) -> int:
"""
Return the ordinal value of the byte at the given ``index``.
"""
...
@abstractmethod
def __iter__(self) -> Iterator[int]:
"""
Iterate over all ordinal values of the bytes of the code stream.
"""
...
@abstractmethod
def peek(self) -> int:
"""
Return the ordinal value of the byte at the current program counter.
"""
...
@abstractmethod
def seek(self, program_counter: int) -> ContextManager['CodeStreamAPI']:
"""
Return a :class:`~typing.ContextManager` with the program counter
set to ``program_counter``.
"""
...
@abstractmethod
def is_valid_opcode(self, position: int) -> bool:
"""
Return ``True`` if a valid opcode exists at ``position``.
"""
...
class StackManipulationAPI(ABC):
@abstractmethod
def stack_pop_ints(self, num_items: int) -> Tuple[int, ...]:
"""
Pop the last ``num_items`` from the stack, returning a tuple of their ordinal values.
"""
...
@abstractmethod
def stack_pop_bytes(self, num_items: int) -> Tuple[bytes, ...]:
"""
Pop the last ``num_items`` from the stack, returning a tuple of bytes.
"""
...
@abstractmethod
def stack_pop_any(self, num_items: int) -> Tuple[Union[int, bytes], ...]:
"""
Pop the last ``num_items`` from the stack, returning a tuple with potentially mixed values
of bytes or ordinal values of bytes.
"""
...
@abstractmethod
def stack_pop1_int(self) -> int:
"""
Pop one item from the stack and return the ordinal value of the represented bytes.
"""
...
@abstractmethod
def stack_pop1_bytes(self) -> bytes:
"""
Pop one item from the stack and return the value as ``bytes``.
"""
...
@abstractmethod
def stack_pop1_any(self) -> Union[int, bytes]:
"""
Pop one item from the stack and return the value either as byte or the ordinal value of
a byte.
"""
...
@abstractmethod
def stack_push_int(self, value: int) -> None:
"""
Push ``value`` on the stack which must be a 256 bit integer.
"""
...
@abstractmethod
def stack_push_bytes(self, value: bytes) -> None:
"""
Push ``value`` on the stack which must be a 32 byte string.
"""
...
class ExecutionContextAPI(ABC):
"""
A class representing context information that remains constant over the execution of a block.
"""
@property
@abstractmethod
def coinbase(self) -> Address:
"""
Return the coinbase address of the block.
"""
...
@property
@abstractmethod
def timestamp(self) -> int:
"""
Return the timestamp of the block.
"""
...
@property
@abstractmethod
def block_number(self) -> BlockNumber:
"""
Return the number of the block.
"""
...
@property
@abstractmethod
def difficulty(self) -> int:
"""
Return the difficulty of the block.
"""
...
@property
@abstractmethod
def gas_limit(self) -> int:
"""
Return the gas limit of the block.
"""
...
@property
@abstractmethod
def prev_hashes(self) -> Iterable[Hash32]:
"""
Return an iterable of block hashes that precede the block.
"""
...
@property
@abstractmethod
def chain_id(self) -> int:
"""
Return the id of the chain.
"""
...
@property
@abstractmethod
def base_fee_per_gas(self) -> Optional[int]:
"""
Return the base fee per gas of the block
"""
...
class ComputationAPI(ContextManager['ComputationAPI'], StackManipulationAPI):
"""
The base class for all execution computations.
"""
msg: MessageAPI
logger: ExtendedDebugLogger
code: CodeStreamAPI
opcodes: Dict[int, OpcodeAPI] = None
state: 'StateAPI'
return_data: bytes
@abstractmethod
def __init__(self,
state: 'StateAPI',
message: MessageAPI,
transaction_context: TransactionContextAPI) -> None:
"""
Instantiate the computation.
"""
...
#
# Convenience
#
@property
@abstractmethod
def is_origin_computation(self) -> bool:
"""
Return ``True`` if this computation is the outermost computation at ``depth == 0``.
"""
...
#
# Error handling
#
@property
@abstractmethod
def is_success(self) -> bool:
"""
Return ``True`` if the computation did not result in an error.
"""
...
@property
@abstractmethod
def is_error(self) -> bool:
"""
Return ``True`` if the computation resulted in an error.
"""
...
@property
@abstractmethod
def error(self) -> VMError:
"""
Return the :class:`~eth.exceptions.VMError` of the computation.
Raise ``AttributeError`` if no error exists.
"""
...
@error.setter
def error(self, value: VMError) -> None:
"""
Set an :class:`~eth.exceptions.VMError` for the computation.
"""
# See: https://github.com/python/mypy/issues/4165
# Since we can't also decorate this with abstract method we want to be
# sure that the setter doesn't actually get used as a noop.
raise NotImplementedError
@abstractmethod
def raise_if_error(self) -> None:
"""
If there was an error during computation, raise it as an exception immediately.
:raise VMError:
"""
...
@property
@abstractmethod
def should_burn_gas(self) -> bool:
"""
Return ``True`` if the remaining gas should be burned.
"""
...
@property
@abstractmethod
def should_return_gas(self) -> bool:
"""
Return ``True`` if the remaining gas should be returned.
"""
...
@property
@abstractmethod
def should_erase_return_data(self) -> bool:
"""
Return ``True`` if the return data should be zerod out due to an error.
"""
...
#
# Memory Management
#
@abstractmethod
def extend_memory(self, start_position: int, size: int) -> None:
"""
Extend the size of the memory to be at minimum ``start_position + size``
bytes in length. Raise `eth.exceptions.OutOfGas` if there is not enough
gas to pay for extending the memory.
"""
...
@abstractmethod
def memory_write(self, start_position: int, size: int, value: bytes) -> None:
"""
Write ``value`` to memory at ``start_position``. Require that ``len(value) == size``.
"""
...
@abstractmethod
def memory_read(self, start_position: int, size: int) -> memoryview:
"""
Read and return a view of ``size`` bytes from memory starting at ``start_position``.
"""
...
@abstractmethod
def memory_read_bytes(self, start_position: int, size: int) -> bytes:
"""
Read and return ``size`` bytes from memory starting at ``start_position``.
"""
...
#
# Gas Consumption
#
@abstractmethod
def get_gas_meter(self) -> GasMeterAPI:
"""
Return the :class:`~eth.abc.GasMeterAPI` of the computation.
"""
...
@abstractmethod
def consume_gas(self, amount: int, reason: str) -> None:
"""
Consume ``amount`` of gas from the remaining gas.
Raise `eth.exceptions.OutOfGas` if there is not enough gas remaining.
"""
...
@abstractmethod
def return_gas(self, amount: int) -> None:
"""
Return ``amount`` of gas to the available gas pool.
"""
...
@abstractmethod
def refund_gas(self, amount: int) -> None:
"""
Add ``amount`` of gas to the pool of gas marked to be refunded.
"""
...
@abstractmethod
def get_gas_refund(self) -> int:
"""
Return the number of refunded gas.
"""
...
@abstractmethod
def get_gas_used(self) -> int:
"""
Return the number of used gas.
"""
...
@abstractmethod
def get_gas_remaining(self) -> int:
"""
Return the number of remaining gas.
"""
...
#
# Stack management
#
@abstractmethod
def stack_swap(self, position: int) -> None:
"""
Swap the item on the top of the stack with the item at ``position``.
"""
...
@abstractmethod
def stack_dup(self, position: int) -> None:
"""
Duplicate the stack item at ``position`` and pushes it onto the stack.
"""
...
#
# Computation result
#
@property
@abstractmethod
def output(self) -> bytes:
"""
Get the return value of the computation.
"""
...
@output.setter
def output(self, value: bytes) -> None:
"""
Set the return value of the computation.
"""
# See: https://github.com/python/mypy/issues/4165
# Since we can't also decorate this with abstract method we want to be
# sure that the setter doesn't actually get used as a noop.
raise NotImplementedError
#
# Runtime operations
#
@abstractmethod
def prepare_child_message(self,
gas: int,
to: Address,
value: int,
data: BytesOrView,
code: bytes,
**kwargs: Any) -> MessageAPI:
"""
Helper method for creating a child computation.
"""
...
@abstractmethod
def apply_child_computation(self, child_msg: MessageAPI) -> 'ComputationAPI':
"""
Apply the vm message ``child_msg`` as a child computation.
"""
...
@abstractmethod
def generate_child_computation(self, child_msg: MessageAPI) -> 'ComputationAPI':
"""
Generate a child computation from the given ``child_msg``.
"""
...
@abstractmethod
def add_child_computation(self, child_computation: 'ComputationAPI') -> None:
"""
Add the given ``child_computation``.
"""
...
#
# Account management
#
@abstractmethod
def register_account_for_deletion(self, beneficiary: Address) -> None:
"""
Register the address of ``beneficiary`` for deletion.
"""
...
@abstractmethod
def get_accounts_for_deletion(self) -> Tuple[Tuple[Address, Address], ...]:
"""
Return a tuple of addresses that are registered for deletion.
"""
...
#
# EVM logging
#
@abstractmethod
def add_log_entry(self, account: Address, topics: Tuple[int, ...], data: bytes) -> None:
"""
Add a log entry.
"""
...
@abstractmethod
def get_raw_log_entries(self) -> Tuple[Tuple[int, bytes, Tuple[int, ...], bytes], ...]:
"""
Return a tuple of raw log entries.
"""
...
@abstractmethod
def get_log_entries(self) -> Tuple[Tuple[bytes, Tuple[int, ...], bytes], ...]:
"""
Return the log entries for this computation and its children.
They are sorted in the same order they were emitted during the transaction processing, and
include the sequential counter as the first element of the tuple representing every entry.
"""
...
#
# State Transition
#
@classmethod
@abstractmethod
def apply_message(
cls,
state: 'StateAPI',
message: MessageAPI,
transaction_context: TransactionContextAPI) -> 'ComputationAPI':
"""
Execute a VM message. This is where the VM-specific call logic exists.
"""
...
@classmethod
@abstractmethod
def apply_create_message(
cls,
state: 'StateAPI',
message: MessageAPI,
transaction_context: TransactionContextAPI) -> 'ComputationAPI':
"""
Execute a VM message to create a new contract. This is where the VM-specific
create logic exists.
"""
...
@classmethod
@abstractmethod
def apply_computation(cls,
state: 'StateAPI',
message: MessageAPI,
transaction_context: TransactionContextAPI) -> 'ComputationAPI':
"""
Execute the logic within the message: Either run the precompile, or
step through each opcode. Generally, the only VM-specific logic is for
each opcode as it executes.
This should rarely be called directly, because it will skip over other important
VM-specific logic that happens before or after the execution.
Instead, prefer :meth:`~apply_message` or :meth:`~apply_create_message`.
"""
...
#
# Opcode API
#
@property
@abstractmethod
def precompiles(self) -> Dict[Address, Callable[['ComputationAPI'], None]]:
"""
Return a dictionary where the keys are the addresses of precompiles and the values are
the precompile functions.
"""
...
@classmethod
@abstractmethod
def get_precompiles(cls) -> Dict[Address, Callable[['ComputationAPI'], None]]:
"""
Return a dictionary where the keys are the addresses of precompiles and the values are
the precompile functions.
"""
...
@abstractmethod
def get_opcode_fn(self, opcode: int) -> OpcodeAPI:
"""
Return the function for the given ``opcode``.
"""
...
class AccountStorageDatabaseAPI(ABC):
"""
Storage cache and write batch for a single account. Changes are not
merklized until :meth:`make_storage_root` is called.
"""
@abstractmethod
def get(self, slot: int, from_journal: bool = True) -> int:
"""
Return the value at ``slot``. Lookups take the journal into consideration unless
``from_journal`` is explicitly set to ``False``.
"""
...
@abstractmethod
def set(self, slot: int, value: int) -> None:
"""
Write ``value`` into ``slot``.
"""
...
@abstractmethod
def delete(self) -> None:
"""
Delete the entire storage at the account.
"""
...
@abstractmethod
def record(self, checkpoint: JournalDBCheckpoint) -> None:
"""
Record changes into the given ``checkpoint``.
"""
...
@abstractmethod
def discard(self, checkpoint: JournalDBCheckpoint) -> None:
"""
Discard the given ``checkpoint``.
"""
...
@abstractmethod
def commit(self, checkpoint: JournalDBCheckpoint) -> None:
"""
Collapse changes into the given ``checkpoint``.
"""
...
@abstractmethod
def lock_changes(self) -> None:
"""
Locks in changes to storage, typically just as a transaction starts.
This is used, for example, to look up the storage value from the start
of the transaction, when calculating gas costs in EIP-2200: net gas metering.
"""
...
@abstractmethod
def make_storage_root(self) -> None:
"""
Force calculation of the storage root for this account
"""
...
@property
@abstractmethod
def has_changed_root(self) -> bool:
"""
Return ``True`` if the storage root has changed.
"""
...
@abstractmethod
def get_changed_root(self) -> Hash32:
"""
Return the changed root hash.
Raise ``ValidationError`` if the root has not changed.
"""
...
@abstractmethod
def persist(self, db: DatabaseAPI) -> None:
"""
Persist all changes to the database.
"""
...
@abstractmethod
def get_accessed_slots(self) -> FrozenSet[int]:
"""
List all the slots that had been accessed since object creation.
"""
...
class AccountAPI(ABC):
"""
A class representing an Ethereum account.
"""
nonce: int
balance: int
storage_root: Hash32
code_hash: Hash32
class AccountDatabaseAPI(ABC):
"""
A class representing a database for accounts.
"""
@abstractmethod
def __init__(self, db: AtomicDatabaseAPI, state_root: Hash32 = BLANK_ROOT_HASH) -> None:
"""
Initialize the account database.
"""
...
@property
@abstractmethod
def state_root(self) -> Hash32:
"""
Return the state root hash.
"""
...
@state_root.setter
def state_root(self, value: Hash32) -> None:
"""
Force-set the state root hash.
"""
# See: https://github.com/python/mypy/issues/4165
# Since we can't also decorate this with abstract method we want to be
# sure that the setter doesn't actually get used as a noop.
raise NotImplementedError
@abstractmethod
def has_root(self, state_root: bytes) -> bool:
"""
Return ``True`` if the `state_root` exists, otherwise ``False``.
"""
...
#
# Storage
#
@abstractmethod
def get_storage(self, address: Address, slot: int, from_journal: bool = True) -> int:
"""
Return the value stored at ``slot`` for the given ``address``. Take the journal
into consideration unless ``from_journal`` is set to ``False``.
"""
...
@abstractmethod
def set_storage(self, address: Address, slot: int, value: int) -> None:
"""
Write ``value`` into ``slot`` for the given ``address``.
"""
...
@abstractmethod
def delete_storage(self, address: Address) -> None:
"""
Delete the storage at ``address``.
"""
...
@abstractmethod
def is_storage_warm(self, address: Address, slot: int) -> bool:
"""
Was the storage slot accessed during this transaction?
See EIP-2929
"""
...
@abstractmethod
def mark_storage_warm(self, address: Address, slot: int) -> None:
"""
Mark the storage slot as accessed during this transaction.
See EIP-2929
"""
...
#
# Balance
#
@abstractmethod
def get_balance(self, address: Address) -> int:
"""
Return the balance at ``address``.
"""
...
@abstractmethod
def set_balance(self, address: Address, balance: int) -> None:
"""
Set ``balance`` as the new balance for ``address``.
"""
...
#
# Nonce
#
@abstractmethod
def get_nonce(self, address: Address) -> int:
"""
Return the nonce for ``address``.
"""
...
@abstractmethod
def set_nonce(self, address: Address, nonce: int) -> None:
"""
Set ``nonce`` as the new nonce for ``address``.
"""
...
@abstractmethod
def increment_nonce(self, address: Address) -> None:
"""
Increment the nonce for ``address``.
"""
...
#
# Code
#
@abstractmethod
def set_code(self, address: Address, code: bytes) -> None:
"""
Set ``code`` as the new code at ``address``.
"""
...
@abstractmethod
def get_code(self, address: Address) -> bytes:
"""
Return the code at the given ``address``.
"""
...
@abstractmethod
def get_code_hash(self, address: Address) -> Hash32:
"""
Return the hash of the code at ``address``.
"""
...
@abstractmethod
def delete_code(self, address: Address) -> None:
"""
Delete the code at ``address``.
"""
...
#
# Account Methods
#
@abstractmethod
def account_has_code_or_nonce(self, address: Address) -> bool:
"""
Return ``True`` if either code or a nonce exists at ``address``.
"""
...
@abstractmethod
def delete_account(self, address: Address) -> None:
"""
Delete the account at ``address``.
"""
...
@abstractmethod
def account_exists(self, address: Address) -> bool:
"""
Return ``True`` if an account exists at ``address``, otherwise ``False``.
"""
...
@abstractmethod
def touch_account(self, address: Address) -> None:
"""
Touch the account at ``address``.
"""
...
@abstractmethod
def account_is_empty(self, address: Address) -> bool:
"""
Return ``True`` if an account exists at ``address``.
"""
...
@abstractmethod
def is_address_warm(self, address: Address) -> bool:
"""
Was the account accessed during this transaction?
See EIP-2929
"""
...
@abstractmethod
def mark_address_warm(self, address: Address) -> None:
"""
Mark the account as accessed during this transaction.
See EIP-2929
"""
...
#
# Record and discard API
#
@abstractmethod
def record(self) -> JournalDBCheckpoint:
"""
Create and return a new checkpoint.
"""
...
@abstractmethod
def discard(self, checkpoint: JournalDBCheckpoint) -> None:
"""
Discard the given ``checkpoint``.
"""
...
@abstractmethod
def commit(self, checkpoint: JournalDBCheckpoint) -> None:
"""
Collapse changes into ``checkpoint``.
"""
...
@abstractmethod
def lock_changes(self) -> None:
"""
Locks in changes across all accounts' storage databases.
This is typically used at the end of a transaction, to make sure that
a revert doesn't roll back through the previous transaction, and to
be able to look up the "original" value of any account storage, where
"original" is the beginning of a transaction (instead of the beginning
of a block).
See :meth:`eth.abc.AccountStorageDatabaseAPI.lock_changes` for
what is called on each account's storage database.
"""
...
@abstractmethod
def make_state_root(self) -> Hash32:
"""
Generate the state root with all the current changes in AccountDB
Current changes include every pending change to storage, as well as all account changes.
After generating all the required tries, the final account state root is returned.
This is an expensive operation, so should be called as little as possible. For example,
pre-Byzantium, this is called after every transaction, because we need the state root
in each receipt. Byzantium+, we only need state roots at the end of the block,
so we *only* call it right before persistance.
:return: the new state root
"""
...
@abstractmethod
def persist(self) -> MetaWitnessAPI:
"""
Send changes to underlying database, including the trie state
so that it will forever be possible to read the trie from this checkpoint.
:meth:`make_state_root` must be explicitly called before this method.
Otherwise persist will raise a ValidationError.
"""
...
class TransactionExecutorAPI(ABC):
"""
A class providing APIs to execute transactions on VM state.
"""
@abstractmethod
def __init__(self, vm_state: 'StateAPI') -> None:
"""
Initialize the executor from the given ``vm_state``.
"""
...
@abstractmethod
def __call__(self, transaction: SignedTransactionAPI) -> 'ComputationAPI':
"""
Execute the ``transaction`` and return a :class:`eth.abc.ComputationAPI`.
"""
...
@abstractmethod
def validate_transaction(self, transaction: SignedTransactionAPI) -> None:
"""
Validate the given ``transaction``.
Raise a ``ValidationError`` if the transaction is invalid.
"""
...
@abstractmethod
def build_evm_message(self, transaction: SignedTransactionAPI) -> MessageAPI:
"""
Build and return a :class:`~eth.abc.MessageAPI` from the given ``transaction``.
"""
...
@abstractmethod
def build_computation(self,
message: MessageAPI,
transaction: SignedTransactionAPI) -> 'ComputationAPI':
"""
Apply the ``message`` to the VM and use the given ``transaction`` to
retrieve the context from.
"""
...
@abstractmethod
def finalize_computation(self,
transaction: SignedTransactionAPI,
computation: 'ComputationAPI') -> 'ComputationAPI':
"""
Finalize the ``transaction``.
"""
...
class ConfigurableAPI(ABC):
"""
A class providing inline subclassing.
"""
@classmethod
@abstractmethod
def configure(cls: Type[T],
__name__: str = None,
**overrides: Any) -> Type[T]:
...
class StateAPI(ConfigurableAPI):
"""
The base class that encapsulates all of the various moving parts related to
the state of the VM during execution.
Each :class:`~eth.abc.VirtualMachineAPI` must be configured with a subclass of the
:class:`~eth.abc.StateAPI`.
.. note::
Each :class:`~eth.abc.StateAPI` class must be configured with:
- ``computation_class``: The :class:`~eth.abc.ComputationAPI` class for
vm execution.
- ``transaction_context_class``: The :class:`~eth.abc.TransactionContextAPI`
class for vm execution.
"""
#
# Set from __init__
#
execution_context: ExecutionContextAPI
computation_class: Type[ComputationAPI]
transaction_context_class: Type[TransactionContextAPI]
account_db_class: Type[AccountDatabaseAPI]
transaction_executor_class: Type[TransactionExecutorAPI] = None
@abstractmethod
def __init__(
self,
db: AtomicDatabaseAPI,
execution_context: ExecutionContextAPI,
state_root: bytes) -> None:
"""
Initialize the state.
"""
...
@property
@abstractmethod
def logger(self) -> ExtendedDebugLogger:
"""
Return the logger.
"""
...
#
# Block Object Properties (in opcodes)
#
@property
@abstractmethod
def coinbase(self) -> Address:
"""
Return the current ``coinbase`` from the current :attr:`~execution_context`
"""
...
@property
@abstractmethod
def timestamp(self) -> int:
"""
Return the current ``timestamp`` from the current :attr:`~execution_context`
"""
...
@property
@abstractmethod
def block_number(self) -> BlockNumber:
"""
Return the current ``block_number`` from the current :attr:`~execution_context`
"""
...
@property
@abstractmethod
def difficulty(self) -> int:
"""
Return the current ``difficulty`` from the current :attr:`~execution_context`
"""
...
@property
@abstractmethod
def gas_limit(self) -> int:
"""
Return the current ``gas_limit`` from the current :attr:`~transaction_context`
"""
...
@property
@abstractmethod
def base_fee(self) -> int:
"""
Return the current ``base_fee`` from the current :attr:`~execution_context`
Raises a ``NotImplementedError`` if called in an execution context
prior to the London hard fork.
"""
...
@abstractmethod
def get_gas_price(self, transaction: SignedTransactionAPI) -> int:
"""
Return the gas price of the given transaction.
Factor in the current block's base gase price, if appropriate. (See EIP-1559)
"""
...
@abstractmethod
def get_tip(self, transaction: SignedTransactionAPI) -> int:
"""
Return the gas price that gets allocated to the miner/validator.
Pre-EIP-1559 that would be the full transaction gas price. After, it
would be the tip price (potentially reduced, if the base fee is so high
that it surpasses the transaction's maximum gas price after adding the
tip).
"""
...
#
# Access to account db
#
@classmethod
@abstractmethod
def get_account_db_class(cls) -> Type[AccountDatabaseAPI]:
"""
Return the :class:`~eth.abc.AccountDatabaseAPI` class that the
state class uses.
"""
...
@property
@abstractmethod
def state_root(self) -> Hash32:
"""
Return the current ``state_root`` from the underlying database
"""
...
@abstractmethod
def make_state_root(self) -> Hash32:
"""
Create and return the state root.
"""
...
@abstractmethod
def get_storage(self, address: Address, slot: int, from_journal: bool = True) -> int:
"""
Return the storage at ``slot`` for ``address``.
"""
...
@abstractmethod
def set_storage(self, address: Address, slot: int, value: int) -> None:
"""
Write ``value`` to the given ``slot`` at ``address``.
"""
...
@abstractmethod
def delete_storage(self, address: Address) -> None:
"""
Delete the storage at ``address``
"""
...
@abstractmethod
def delete_account(self, address: Address) -> None:
"""
Delete the account at the given ``address``.
"""
...
@abstractmethod
def get_balance(self, address: Address) -> int:
"""
Return the balance for the account at ``address``.
"""
...
@abstractmethod
def set_balance(self, address: Address, balance: int) -> None:
"""
Set ``balance`` to the balance at ``address``.
"""
...
@abstractmethod
def delta_balance(self, address: Address, delta: int) -> None:
"""
Apply ``delta`` to the balance at ``address``.
"""
...
@abstractmethod
def get_nonce(self, address: Address) -> int:
"""
Return the nonce at ``address``.
"""
...
@abstractmethod
def set_nonce(self, address: Address, nonce: int) -> None:
"""
Set ``nonce`` as the new nonce at ``address``.
"""
...
@abstractmethod
def increment_nonce(self, address: Address) -> None:
"""
Increment the nonce at ``address``.
"""
...
@abstractmethod
def get_code(self, address: Address) -> bytes:
"""
Return the code at ``address``.
"""
...
@abstractmethod
def set_code(self, address: Address, code: bytes) -> None:
"""
Set ``code`` as the new code at ``address``.
"""
...
@abstractmethod
def get_code_hash(self, address: Address) -> Hash32:
"""
Return the hash of the code at ``address``.
"""
...
@abstractmethod
def delete_code(self, address: Address) -> None:
"""
Delete the code at ``address``.
"""
...
@abstractmethod
def has_code_or_nonce(self, address: Address) -> bool:
"""
Return ``True`` if either a nonce or code exists at the given ``address``.
"""
...
@abstractmethod
def account_exists(self, address: Address) -> bool:
"""
Return ``True`` if an account exists at ``address``.
"""
...
@abstractmethod
def touch_account(self, address: Address) -> None:
"""
Touch the account at the given ``address``.
"""
...
@abstractmethod
def account_is_empty(self, address: Address) -> bool:
"""
Return ``True`` if the account at ``address`` is empty, otherwise ``False``.
"""
...
@abstractmethod
def is_storage_warm(self, address: Address, slot: int) -> bool:
"""
Was the storage slot accessed during this transaction?
See EIP-2929
"""
...
@abstractmethod
def mark_storage_warm(self, address: Address, slot: int) -> None:
"""
Mark the storage slot as accessed during this transaction.
See EIP-2929
"""
...
@abstractmethod
def is_address_warm(self, address: Address) -> bool:
"""
Was the account accessed during this transaction?
See EIP-2929
"""
...
@abstractmethod
def mark_address_warm(self, address: Address) -> None:
"""
Mark the account as accessed during this transaction.
See EIP-2929
"""
...
#
# Access self._chaindb
#
@abstractmethod
def snapshot(self) -> Tuple[Hash32, JournalDBCheckpoint]:
"""
Perform a full snapshot of the current state.
Snapshots are a combination of the :attr:`~state_root` at the time of the
snapshot and the checkpoint from the journaled DB.
"""
...
@abstractmethod
def revert(self, snapshot: Tuple[Hash32, JournalDBCheckpoint]) -> None:
"""
Revert the VM to the state at the snapshot
"""
...
@abstractmethod
def commit(self, snapshot: Tuple[Hash32, JournalDBCheckpoint]) -> None:
"""
Commit the journal to the point where the snapshot was taken. This
merges in any changes that were recorded since the snapshot.
"""
...
@abstractmethod
def lock_changes(self) -> None:
"""
Locks in all changes to state, typically just as a transaction starts.
This is used, for example, to look up the storage value from the start
of the transaction, when calculating gas costs in EIP-2200: net gas metering.
"""
...
@abstractmethod
def persist(self) -> MetaWitnessAPI:
"""
Persist the current state to the database.
"""
...
#
# Access self.prev_hashes (Read-only)
#
@abstractmethod
def get_ancestor_hash(self, block_number: BlockNumber) -> Hash32:
"""
Return the hash for the ancestor block with number ``block_number``.
Return the empty bytestring ``b''`` if the block number is outside of the
range of available block numbers (typically the last 255 blocks).
"""
...
#
# Computation
#
@abstractmethod
def get_computation(self,
message: MessageAPI,
transaction_context: TransactionContextAPI) -> ComputationAPI:
"""
Return a computation instance for the given `message` and `transaction_context`
"""
...
#
# Transaction context
#
@classmethod
@abstractmethod
def get_transaction_context_class(cls) -> Type[TransactionContextAPI]:
"""
Return the :class:`~eth.vm.transaction_context.BaseTransactionContext` class that the
state class uses.
"""
...
#
# Execution
#
@abstractmethod
def apply_transaction(self, transaction: SignedTransactionAPI) -> ComputationAPI:
"""
Apply transaction to the vm state
:param transaction: the transaction to apply
:return: the computation
"""
...
@abstractmethod
def get_transaction_executor(self) -> TransactionExecutorAPI:
"""
Return the transaction executor.
"""
...
@abstractmethod
def costless_execute_transaction(self,
transaction: SignedTransactionAPI) -> ComputationAPI:
"""
Execute the given ``transaction`` with a gas price of ``0``.
"""
...
@abstractmethod
def override_transaction_context(self, gas_price: int) -> ContextManager[None]:
"""
Return a :class:`~typing.ContextManager` that overwrites the current transaction context,
applying the given ``gas_price``.
"""
...
@abstractmethod
def validate_transaction(self, transaction: SignedTransactionAPI) -> None:
"""
Validate the given ``transaction``.
"""
...
@abstractmethod
def get_transaction_context(self,
transaction: SignedTransactionAPI) -> TransactionContextAPI:
"""
Return the :class:`~eth.abc.TransactionContextAPI` for the given ``transaction``
"""
...
class ConsensusContextAPI(ABC):
"""
A class representing a data context for the :class:`~eth.abc.ConsensusAPI` which is
instantiated once per chain instance and stays in memory across VM runs.
"""
@abstractmethod
def __init__(self, db: AtomicDatabaseAPI) -> None:
"""
Initialize the context with a database.
"""
...
class ConsensusAPI(ABC):
"""
A class encapsulating the consensus scheme to allow chains to run under different kind of
EVM-compatible consensus mechanisms such as the Clique Proof of Authority scheme.
"""
@abstractmethod
def __init__(self, context: ConsensusContextAPI) -> None:
"""
Initialize the consensus api.
"""
...
@abstractmethod
def validate_seal(self, header: BlockHeaderAPI) -> None:
"""
Validate the seal on the given header, even if its parent is missing.
"""
...
@abstractmethod
def validate_seal_extension(self,
header: BlockHeaderAPI,
parents: Iterable[BlockHeaderAPI]) -> None:
"""
Validate the seal on the given header when all parents must be present. Parent headers
that are not yet in the database must be passed as ``parents``.
"""
...
@classmethod
@abstractmethod
def get_fee_recipient(cls, header: BlockHeaderAPI) -> Address:
"""
Return the address that should receive rewards for creating the block.
"""
...
class VirtualMachineAPI(ConfigurableAPI):
"""
The :class:`~eth.abc.VirtualMachineAPI` class represents the Chain rules for a
specific protocol definition such as the Frontier or Homestead network.
.. note::
Each :class:`~eth.abc.VirtualMachineAPI` class must be configured with:
- ``block_class``: The :class:`~eth.abc.BlockAPI` class for blocks in this VM ruleset.
- ``_state_class``: The :class:`~eth.abc.StateAPI` class used by this VM for execution.
"""
fork: str # noqa: E701 # flake8 bug that's fixed in 3.6.0+
chaindb: ChainDatabaseAPI
extra_data_max_bytes: ClassVar[int]
consensus_class: Type[ConsensusAPI]
consensus_context: ConsensusContextAPI
@abstractmethod
def __init__(self,
header: BlockHeaderAPI,
chaindb: ChainDatabaseAPI,
chain_context: ChainContextAPI,
consensus_context: ConsensusContextAPI) -> None:
"""
Initialize the virtual machine.
"""
...
@property
@abstractmethod
def state(self) -> StateAPI:
"""
Return the current state.
"""
...
@classmethod
@abstractmethod
def build_state(cls,
db: AtomicDatabaseAPI,
header: BlockHeaderAPI,
chain_context: ChainContextAPI,
previous_hashes: Iterable[Hash32] = (),
) -> StateAPI:
"""
You probably want `VM().state` instead of this.
Occasionally, you want to build custom state against a particular header and DB,
even if you don't have the VM initialized. This is a convenience method to do that.
"""
...
@abstractmethod
def get_header(self) -> BlockHeaderAPI:
"""
Return the current header.
"""
...
@abstractmethod
def get_block(self) -> BlockAPI:
"""
Return the current block.
"""
...
#
# Hooks
#
def transaction_applied_hook(
self,
transaction_index: int,
transactions: Sequence[SignedTransactionAPI],
base_header: BlockHeaderAPI,
partial_header: BlockHeaderAPI,
computation: ComputationAPI,
receipt: ReceiptAPI) -> None:
"""
A hook for a subclass to use as a way to note that a transaction was applied.
This only gets triggered as part of `apply_all_transactions`, which is called
by `block_import`.
"""
pass
#
# Execution
#
@abstractmethod
def apply_transaction(self,
header: BlockHeaderAPI,
transaction: SignedTransactionAPI
) -> Tuple[ReceiptAPI, ComputationAPI]:
"""
Apply the transaction to the current block. This is a wrapper around
:func:`~eth.vm.state.State.apply_transaction` with some extra orchestration logic.
:param header: header of the block before application
:param transaction: to apply
"""
...
@staticmethod
@abstractmethod
def create_execution_context(header: BlockHeaderAPI,
prev_hashes: Iterable[Hash32],
chain_context: ChainContextAPI) -> ExecutionContextAPI:
"""
Create and return the :class:`~eth.abc.ExecutionContextAPI`` for the given ``header``,
iterable of block hashes that precede the block and the ``chain_context``.
"""
...
@abstractmethod
def execute_bytecode(self,
origin: Address,
gas_price: int,
gas: int,
to: Address,
sender: Address,
value: int,
data: bytes,
code: bytes,
code_address: Address = None) -> ComputationAPI:
"""
Execute raw bytecode in the context of the current state of
the virtual machine. Note that this skips over some of the logic
that would normally happen during a call. Watch out for:
- value (ether) is *not* transferred
- state is *not* rolled back in case of an error
- The target account is *not* necessarily created
- others...
For other potential surprises, check the implementation differences
between :meth:`ComputationAPI.apply_computation` and
:meth:`ComputationAPI.apply_message`. (depending on the VM fork)
"""
...
@abstractmethod
def apply_all_transactions(
self,
transactions: Sequence[SignedTransactionAPI],
base_header: BlockHeaderAPI
) -> Tuple[BlockHeaderAPI, Tuple[ReceiptAPI, ...], Tuple[ComputationAPI, ...]]:
"""
Determine the results of applying all transactions to the base header.
This does *not* update the current block or header of the VM.
:param transactions: an iterable of all transactions to apply
:param base_header: the starting header to apply transactions to
:return: the final header, the receipts of each transaction, and the computations
"""
...
@abstractmethod
def make_receipt(self,
base_header: BlockHeaderAPI,
transaction: SignedTransactionAPI,
computation: ComputationAPI,
state: StateAPI) -> ReceiptAPI:
"""
Generate the receipt resulting from applying the transaction.
:param base_header: the header of the block before the transaction was applied.
:param transaction: the transaction used to generate the receipt
:param computation: the result of running the transaction computation
:param state: the resulting state, after executing the computation
:return: receipt
"""
...
#
# Mining
#
@abstractmethod
def import_block(self, block: BlockAPI) -> BlockAndMetaWitness:
"""
Import the given block to the chain.
"""
...
@abstractmethod
def mine_block(self, block: BlockAPI, *args: Any, **kwargs: Any) -> BlockAndMetaWitness:
"""
Mine the given block. Proxies to self.pack_block method.
"""
...
@abstractmethod
def set_block_transactions(self,
base_block: BlockAPI,
new_header: BlockHeaderAPI,
transactions: Sequence[SignedTransactionAPI],
receipts: Sequence[ReceiptAPI]) -> BlockAPI:
"""
Create a new block with the given ``transactions``.
"""
...
#
# Finalization
#
@abstractmethod
def finalize_block(self, block: BlockAPI) -> BlockAndMetaWitness:
"""
Perform any finalization steps like awarding the block mining reward,
and persisting the final state root.
"""
...
@abstractmethod
def pack_block(self, block: BlockAPI, *args: Any, **kwargs: Any) -> BlockAPI:
"""
Pack block for mining.
:param bytes coinbase: 20-byte public address to receive block reward
:param bytes uncles_hash: 32 bytes
:param bytes state_root: 32 bytes
:param bytes transaction_root: 32 bytes
:param bytes receipt_root: 32 bytes
:param int bloom:
:param int gas_used:
:param bytes extra_data: 32 bytes
:param bytes mix_hash: 32 bytes
:param bytes nonce: 8 bytes
"""
...
#
# Headers
#
@abstractmethod
def add_receipt_to_header(self,
old_header: BlockHeaderAPI,
receipt: ReceiptAPI) -> BlockHeaderAPI:
"""
Apply the receipt to the old header, and return the resulting header. This may have
storage-related side-effects. For example, pre-Byzantium, the state root hash
is included in the receipt, and so must be stored into the database.
"""
...
@classmethod
@abstractmethod
def compute_difficulty(cls, parent_header: BlockHeaderAPI, timestamp: int) -> int:
"""
Compute the difficulty for a block header.
:param parent_header: the parent header
:param timestamp: the timestamp of the child header
"""
...
@abstractmethod
def configure_header(self, **header_params: Any) -> BlockHeaderAPI:
"""
Setup the current header with the provided parameters. This can be
used to set fields like the gas limit or timestamp to value different
than their computed defaults.
"""
...
@classmethod
@abstractmethod
def create_header_from_parent(cls,
parent_header: BlockHeaderAPI,
**header_params: Any) -> BlockHeaderAPI:
"""
Creates and initializes a new block header from the provided
`parent_header`.
"""
...
#
# Blocks
#
@classmethod
@abstractmethod
def generate_block_from_parent_header_and_coinbase(cls,
parent_header: BlockHeaderAPI,
coinbase: Address) -> BlockAPI:
"""
Generate block from parent header and coinbase.
"""
...
@classmethod
@abstractmethod
def create_genesis_header(cls, **genesis_params: Any) -> BlockHeaderAPI:
"""
Create a genesis header using this VM's rules.
This is equivalent to calling :meth:`create_header_from_parent`
with ``parent_header`` set to None.
"""
...
@classmethod
@abstractmethod
def get_block_class(cls) -> Type[BlockAPI]:
"""
Return the :class:`~eth.rlp.blocks.Block` class that this VM uses for blocks.
"""
...
@staticmethod
@abstractmethod
def get_block_reward() -> int:
"""
Return the amount in **wei** that should be given to a miner as a reward
for this block.
.. note::
This is an abstract method that must be implemented in subclasses
"""
...
@classmethod
@abstractmethod
def get_nephew_reward(cls) -> int:
"""
Return the reward which should be given to the miner of the given `nephew`.
.. note::
This is an abstract method that must be implemented in subclasses
"""
...
@classmethod
@abstractmethod
def get_prev_hashes(cls,
last_block_hash: Hash32,
chaindb: ChainDatabaseAPI) -> Optional[Iterable[Hash32]]:
"""
Return an iterable of block hashes that precede the block with the given
``last_block_hash``.
"""
...
@property
@abstractmethod
def previous_hashes(self) -> Optional[Iterable[Hash32]]:
"""
Convenience API for accessing the previous 255 block hashes.
"""
...
@staticmethod
@abstractmethod
def get_uncle_reward(block_number: BlockNumber, uncle: BlockHeaderAPI) -> int:
"""
Return the reward which should be given to the miner of the given `uncle`.
.. note::
This is an abstract method that must be implemented in subclasses
"""
...
#
# Transactions
#
@abstractmethod
def create_transaction(self, *args: Any, **kwargs: Any) -> SignedTransactionAPI:
"""
Proxy for instantiating a signed transaction for this VM.
"""
...
@classmethod
@abstractmethod
def create_unsigned_transaction(cls,
*,
nonce: int,
gas_price: int,
gas: int,
to: Address,
value: int,
data: bytes) -> UnsignedTransactionAPI:
"""
Proxy for instantiating an unsigned transaction for this VM.
"""
...
@classmethod
@abstractmethod
def get_transaction_builder(cls) -> Type[TransactionBuilderAPI]:
"""
Return the class that this VM uses to build and encode transactions.
"""
...
@classmethod
@abstractmethod
def get_receipt_builder(cls) -> Type[ReceiptBuilderAPI]:
"""
Return the class that this VM uses to encode and decode receipts.
"""
...
#
# Validate
#
@classmethod
@abstractmethod
def validate_receipt(self, receipt: ReceiptAPI) -> None:
"""
Validate the given ``receipt``.
"""
...
@abstractmethod
def validate_block(self, block: BlockAPI) -> None:
"""
Validate the the given block.
"""
...
@classmethod
@abstractmethod
def validate_header(self,
header: BlockHeaderAPI,
parent_header: BlockHeaderAPI) -> None:
"""
:raise eth.exceptions.ValidationError: if the header is not valid
"""
...
@abstractmethod
def validate_transaction_against_header(self,
base_header: BlockHeaderAPI,
transaction: SignedTransactionAPI) -> None:
"""
Validate that the given transaction is valid to apply to the given header.
:param base_header: header before applying the transaction
:param transaction: the transaction to validate
:raises: ValidationError if the transaction is not valid to apply
"""
...
@abstractmethod
def validate_seal(self, header: BlockHeaderAPI) -> None:
"""
Validate the seal on the given header.
"""
...
@abstractmethod
def validate_seal_extension(self,
header: BlockHeaderAPI,
parents: Iterable[BlockHeaderAPI]) -> None:
"""
Validate the seal on the given header when all parents must be present. Parent headers
that are not yet in the database must be passed as ``parents``.
"""
...
@classmethod
@abstractmethod
def validate_uncle(cls,
block: BlockAPI,
uncle: BlockHeaderAPI,
uncle_parent: BlockHeaderAPI
) -> None:
"""
Validate the given uncle in the context of the given block.
"""
...
#
# State
#
@classmethod
@abstractmethod
def get_state_class(cls) -> Type[StateAPI]:
"""
Return the class that this VM uses for states.
"""
...
@abstractmethod
def in_costless_state(self) -> ContextManager[StateAPI]:
"""
Return a :class:`~typing.ContextManager` with the current state wrapped in a temporary
block. In this state, the ability to pay gas costs is ignored.
"""
...
class VirtualMachineModifierAPI(ABC):
"""
Amend a set of VMs for a chain. This allows modifying a chain for different consensus schemes.
"""
@abstractmethod
def amend_vm_configuration(self, vm_config: VMConfiguration) -> VMConfiguration:
"""
Amend the ``vm_config`` by configuring the VM classes, and hence returning a modified
set of VM classes.
"""
...
class HeaderChainAPI(ABC):
"""
Like :class:`eth.abc.ChainAPI` but does only support headers, not entire blocks.
"""
header: BlockHeaderAPI
chain_id: int
vm_configuration: Tuple[Tuple[BlockNumber, Type[VirtualMachineAPI]], ...]
@abstractmethod
def __init__(self, base_db: AtomicDatabaseAPI, header: BlockHeaderAPI = None) -> None:
"""
Initialize the header chain.
"""
...
#
# Chain Initialization API
#
@classmethod
@abstractmethod
def from_genesis_header(cls,
base_db: AtomicDatabaseAPI,
genesis_header: BlockHeaderAPI) -> 'HeaderChainAPI':
"""
Initialize the chain from the genesis header.
"""
...
#
# Helpers
#
@classmethod
@abstractmethod
def get_headerdb_class(cls) -> Type[HeaderDatabaseAPI]:
"""
Return the class which should be used for the `headerdb`
"""
...
#
# Canonical Chain API
#
def get_canonical_block_hash(self, block_number: BlockNumber) -> Hash32:
"""
Direct passthrough to `headerdb`
"""
@abstractmethod
def get_canonical_block_header_by_number(self, block_number: BlockNumber) -> BlockHeaderAPI:
"""
Direct passthrough to `headerdb`
"""
...
@abstractmethod
def get_canonical_head(self) -> BlockHeaderAPI:
"""
Direct passthrough to `headerdb`
"""
...
#
# Header API
#
@abstractmethod
def get_block_header_by_hash(self, block_hash: Hash32) -> BlockHeaderAPI:
"""
Direct passthrough to `headerdb`
"""
...
@abstractmethod
def header_exists(self, block_hash: Hash32) -> bool:
"""
Direct passthrough to `headerdb`
"""
...
@abstractmethod
def import_header(self,
header: BlockHeaderAPI,
) -> Tuple[Tuple[BlockHeaderAPI, ...], Tuple[BlockHeaderAPI, ...]]:
"""
Direct passthrough to `headerdb`
Also updates the local `header` property to be the latest canonical head.
Returns an iterable of headers representing the headers that are newly
part of the canonical chain.
- If the imported header is not part of the canonical chain then an
empty tuple will be returned.
- If the imported header simply extends the canonical chain then a
length-1 tuple with the imported header will be returned.
- If the header is part of a non-canonical chain which overtakes the
current canonical chain then the returned tuple will contain the
headers which are newly part of the canonical chain.
"""
...
class ChainAPI(ConfigurableAPI):
"""
A Chain is a combination of one or more VM classes. Each VM is associated
with a range of blocks. The Chain class acts as a wrapper around these other
VM classes, delegating operations to the appropriate VM depending on the
current block number.
"""
vm_configuration: Tuple[Tuple[BlockNumber, Type[VirtualMachineAPI]], ...]
chain_id: int
chaindb: ChainDatabaseAPI
consensus_context_class: Type[ConsensusContextAPI]
#
# Helpers
#
@classmethod
@abstractmethod
def get_chaindb_class(cls) -> Type[ChainDatabaseAPI]:
"""
Return the class for the used :class:`~eth.abc.ChainDatabaseAPI`.
"""
...
#
# Chain API
#
@classmethod
@abstractmethod
def from_genesis(cls,
base_db: AtomicDatabaseAPI,
genesis_params: Dict[str, HeaderParams],
genesis_state: AccountState = None) -> 'ChainAPI':
"""
Initialize the Chain from a genesis state.
"""
...
@classmethod
@abstractmethod
def from_genesis_header(cls,
base_db: AtomicDatabaseAPI,
genesis_header: BlockHeaderAPI) -> 'ChainAPI':
"""
Initialize the chain from the genesis header.
"""
...
#
# VM API
#
@classmethod
@abstractmethod
def get_vm_class(cls, header: BlockHeaderAPI) -> Type[VirtualMachineAPI]:
"""
Return the VM class for the given ``header``
"""
...
@abstractmethod
def get_vm(self, header: BlockHeaderAPI = None) -> VirtualMachineAPI:
"""
Return the VM instance for the given ``header``.
"""
...
@classmethod
def get_vm_class_for_block_number(cls, block_number: BlockNumber) -> Type[VirtualMachineAPI]:
"""
Return the VM class for the given ``block_number``
"""
...
#
# Header API
#
@abstractmethod
def create_header_from_parent(self,
parent_header: BlockHeaderAPI,
**header_params: HeaderParams) -> BlockHeaderAPI:
"""
Passthrough helper to the VM class of the block descending from the
given header.
"""
...
@abstractmethod
def get_block_header_by_hash(self, block_hash: Hash32) -> BlockHeaderAPI:
"""
Return the requested block header as specified by ``block_hash``.
Raise ``BlockNotFound`` if no block header with the given hash exists in the db.
"""
...
@abstractmethod
def get_canonical_block_header_by_number(self, block_number: BlockNumber) -> BlockHeaderAPI:
"""
Return the block header with the given number in the canonical chain.
Raise ``HeaderNotFound`` if there's no block header with the given number in the
canonical chain.
"""
...
@abstractmethod
def get_canonical_head(self) -> BlockHeaderAPI:
"""
Return the block header at the canonical chain head.
Raise ``CanonicalHeadNotFound`` if there's no head defined for the canonical chain.
"""
...
@abstractmethod
def get_score(self, block_hash: Hash32) -> int:
"""
Return the difficulty score of the block with the given ``block_hash``.
Raise ``HeaderNotFound`` if there is no matching block hash.
"""
...
#
# Block API
#
@abstractmethod
def get_ancestors(self, limit: int, header: BlockHeaderAPI) -> Tuple[BlockAPI, ...]:
"""
Return `limit` number of ancestor blocks from the current canonical head.
"""
...
@abstractmethod
def get_block(self) -> BlockAPI:
"""
Return the current block at the tip of the chain.
"""
...
@abstractmethod
def get_block_by_hash(self, block_hash: Hash32) -> BlockAPI:
"""
Return the requested block as specified by ``block_hash``.
:raise eth.exceptions.HeaderNotFound: if the header is missing
:raise eth.exceptions.BlockNotFound: if any part of the block body is missing
"""
...
@abstractmethod
def get_block_by_header(self, block_header: BlockHeaderAPI) -> BlockAPI:
"""
Return the requested block as specified by the ``block_header``.
:raise eth.exceptions.BlockNotFound: if any part of the block body is missing
"""
...
@abstractmethod
def get_canonical_block_by_number(self, block_number: BlockNumber) -> BlockAPI:
"""
Return the block with the given ``block_number`` in the canonical chain.
Raise ``BlockNotFound`` if no block with the given ``block_number`` exists in the
canonical chain.
"""
...
@abstractmethod
def get_canonical_block_hash(self, block_number: BlockNumber) -> Hash32:
"""
Return the block hash with the given ``block_number`` in the canonical chain.
Raise ``BlockNotFound`` if there's no block with the given number in the
canonical chain.
"""
...
@abstractmethod
def build_block_with_transactions(
self,
transactions: Tuple[SignedTransactionAPI, ...],
parent_header: BlockHeaderAPI = None
) -> Tuple[BlockAPI, Tuple[ReceiptAPI, ...], Tuple[ComputationAPI, ...]]:
"""
Generate a block with the provided transactions. This does *not* import
that block into your chain. If you want this new block in your chain,
run :meth:`~import_block` with the result block from this method.
:param transactions: an iterable of transactions to insert to the block
:param parent_header: parent of the new block -- or canonical head if ``None``
:return: (new block, receipts, computations)
"""
...
#
# Transaction API
#
@abstractmethod
def create_transaction(self, *args: Any, **kwargs: Any) -> SignedTransactionAPI:
"""
Passthrough helper to the current VM class.
"""
...
@abstractmethod
def create_unsigned_transaction(cls,
*,
nonce: int,
gas_price: int,
gas: int,
to: Address,
value: int,
data: bytes) -> UnsignedTransactionAPI:
"""
Passthrough helper to the current VM class.
"""
...
@abstractmethod
def get_canonical_transaction_index(self, transaction_hash: Hash32) -> Tuple[BlockNumber, int]:
"""
Return a 2-tuple of (block_number, transaction_index) indicating which
block the given transaction can be found in and at what index in the
block transactions.
Raise ``TransactionNotFound`` if the transaction does not exist in the canoncial
chain.
"""
@abstractmethod
def get_canonical_transaction(self, transaction_hash: Hash32) -> SignedTransactionAPI:
"""
Return the requested transaction as specified by the ``transaction_hash``
from the canonical chain.
Raise ``TransactionNotFound`` if no transaction with the specified hash is
found in the canonical chain.
"""
...
@abstractmethod
def get_canonical_transaction_by_index(self,
block_number: BlockNumber,
index: int) -> SignedTransactionAPI:
"""
Return the requested transaction as specified by the ``block_number``
and ``index`` from the canonical chain.
Raise ``TransactionNotFound`` if no transaction exists at ``index`` at ``block_number`` in
the canonical chain.
"""
...
@abstractmethod
def get_transaction_receipt(self, transaction_hash: Hash32) -> ReceiptAPI:
"""
Return the requested receipt for the transaction as specified by the ``transaction_hash``.
Raise ``ReceiptNotFound`` if not receipt for the specified ``transaction_hash`` is found
in the canonical chain.
"""
...
@abstractmethod
def get_transaction_receipt_by_index(self, block_number: BlockNumber, index: int) -> ReceiptAPI:
"""
Return the requested receipt for the transaction as specified by the ``block_number``
and ``index``.
Raise ``ReceiptNotFound`` if not receipt for the specified ``block_number`` and ``index`` is
found in the canonical chain.
"""
...
#
# Execution API
#
@abstractmethod
def get_transaction_result(
self,
transaction: SignedTransactionAPI,
at_header: BlockHeaderAPI) -> bytes:
"""
Return the result of running the given transaction.
This is referred to as a `call()` in web3.
"""
...
@abstractmethod
def estimate_gas(
self,
transaction: SignedTransactionAPI,
at_header: BlockHeaderAPI = None) -> int:
"""
Return an estimation of the amount of gas the given ``transaction`` will
use if executed on top of the block specified by ``at_header``.
"""
...
@abstractmethod
def import_block(self,
block: BlockAPI,
perform_validation: bool = True,
) -> BlockImportResult:
"""
Import the given ``block`` and return a 3-tuple
- the imported block
- a tuple of blocks which are now part of the canonical chain.
- a tuple of blocks which were canonical and now are no longer canonical.
"""
...
#
# Validation API
#
@abstractmethod
def validate_receipt(self, receipt: ReceiptAPI, at_header: BlockHeaderAPI) -> None:
"""
Validate the given ``receipt`` at the given header.
"""
...
@abstractmethod
def validate_block(self, block: BlockAPI) -> None:
"""
Validate a block that is either being mined or imported.
Since block validation (specifically the uncle validation) must have
access to the ancestor blocks, this validation must occur at the Chain
level.
Cannot be used to validate genesis block.
"""
...
@abstractmethod
def validate_seal(self, header: BlockHeaderAPI) -> None:
"""
Validate the seal on the given ``header``.
"""
...
@abstractmethod
def validate_uncles(self, block: BlockAPI) -> None:
"""
Validate the uncles for the given ``block``.
"""
...
@abstractmethod
def validate_chain(
self,
root: BlockHeaderAPI,
descendants: Tuple[BlockHeaderAPI, ...],
seal_check_random_sample_rate: int = 1) -> None:
"""
Validate that all of the descendents are valid, given that the root header is valid.
By default, check the seal validity (Proof-of-Work on Ethereum 1.x mainnet) of all headers.
This can be expensive. Instead, check a random sample of seals using
seal_check_random_sample_rate.
"""
...
@abstractmethod
def validate_chain_extension(self, headers: Tuple[BlockHeaderAPI, ...]) -> None:
"""
Validate a chain of headers under the assumption that the entire chain of headers is
present. Headers that are not already in the database must exist in ``headers``. Calling
this API is not a replacement for calling :meth:`~eth.abc.ChainAPI.validate_chain`, it is
an additional API to call at a different stage of header processing to enable consensus
schemes where the consensus can not be verified out of order.
"""
...
class MiningChainAPI(ChainAPI):
"""
Like :class:`~eth.abc.ChainAPI` but with APIs to create blocks incrementally.
"""
header: BlockHeaderAPI
@abstractmethod
def __init__(self, base_db: AtomicDatabaseAPI, header: BlockHeaderAPI = None) -> None:
"""
Initialize the chain.
"""
...
@abstractmethod
def set_header_timestamp(self, timestamp: int) -> None:
"""
Set the timestamp of the pending header to mine.
This is mostly useful for testing, as the timestamp will be chosen
automatically if this method is not called.
"""
...
@abstractmethod
def mine_all(
self,
transactions: Sequence[SignedTransactionAPI],
*args: Any,
parent_header: BlockHeaderAPI = None,
**kwargs: Any,
) -> Tuple[BlockImportResult, Tuple[ReceiptAPI, ...], Tuple[ComputationAPI, ...]]:
"""
Build a block with the given transactions, and mine it.
Optionally, supply the parent block header to mine on top of.
This is much faster than individually running :meth:`apply_transaction`
and then :meth:`mine_block`.
"""
...
@abstractmethod
def apply_transaction(self,
transaction: SignedTransactionAPI
) -> Tuple[BlockAPI, ReceiptAPI, ComputationAPI]:
"""
Apply the transaction to the current tip block.
WARNING: ReceiptAPI and Transaction trie generation is computationally
heavy and incurs significant performance overhead.
"""
...
@abstractmethod
def mine_block(self, *args: Any, **kwargs: Any) -> BlockAPI:
"""
Mines the current block. Proxies to the current Virtual Machine.
See VM. :meth:`~eth.vm.base.VM.mine_block`
"""
...
@abstractmethod
def mine_block_extended(self, *args: Any, **kwargs: Any) -> BlockAndMetaWitness:
"""
Just like :meth:`~mine_block`, but includes extra returned info. Currently,
the only extra info returned is the :class:`MetaWitness`.
"""
...
| 27.900363 | 100 | 0.577691 |
7953b1f14535f64f86b0b2a80f5d3e6258138b5a | 404 | py | Python | Aula16/ex07.py | danicon/MD3-Curso_Python | 3d419d440d3b28adb5c019268f4b217e7d0ce45a | [
"MIT"
] | null | null | null | Aula16/ex07.py | danicon/MD3-Curso_Python | 3d419d440d3b28adb5c019268f4b217e7d0ce45a | [
"MIT"
] | null | null | null | Aula16/ex07.py | danicon/MD3-Curso_Python | 3d419d440d3b28adb5c019268f4b217e7d0ce45a | [
"MIT"
] | null | null | null | numeros = ('zero', 'um', 'dois', 'três', 'quatro', 'cinco', 'seis', 'sete', 'oito', 'nove', 'dez', 'onze', 'doze', 'treze', 'catorze', 'quinze', 'dezesseis', 'dezessete', 'dezoito', 'dezenove', 'vinte')
num = int(input('Digite um número entre 0 e 20: '))
while num < 0 or num > 20:
num = int(input('Tente novamente. Digite um número entre 0 e 20: '))
print(f'Você digitou o número {numeros[num]}') | 50.5 | 202 | 0.611386 |
7953b49da9fc579045a2427fcbdba9038c1a23bc | 1,647 | py | Python | result_analysis/exp5/results_to_table.py | maartenbuyl/memory-enhanced-maze-exploration | e897b14ac3678a6d9a80d1366eaec9ebaa13255e | [
"MIT"
] | null | null | null | result_analysis/exp5/results_to_table.py | maartenbuyl/memory-enhanced-maze-exploration | e897b14ac3678a6d9a80d1366eaec9ebaa13255e | [
"MIT"
] | null | null | null | result_analysis/exp5/results_to_table.py | maartenbuyl/memory-enhanced-maze-exploration | e897b14ac3678a6d9a80d1366eaec9ebaa13255e | [
"MIT"
] | null | null | null | import numpy as np
import os
results_files = [
"post_results_lin.txt",
"post_results_lstm.txt",
"post_results_gruc.txt"
]
# Output: (training set results, test set results)
def file_into_tuple(file_name):
prefix = os.path.dirname(__file__) + "/"
file = open(prefix + file_name)
lines = file.readlines()
result = [[], []]
result_index = 0
for line in lines:
if line.startswith("Maze"):
break
if line.startswith("Summary of validation set"):
result_index = 1
if line.startswith("Summary"):
continue
if line.startswith("---"):
continue
start_of_value = line.find(":") + 2
number = float(line[start_of_value:])
assert number < 1e5
string = np.format_float_positional(number, precision=5, unique=False, fractional=True)
result[result_index].append(string)
result = np.array(result)
return result
datas = [[], []]
for i in range(len(results_files)):
results_as_tuple = file_into_tuple(results_files[i])
datas[0].append(results_as_tuple[0])
datas[1].append(results_as_tuple[1])
datas = np.array(datas)
output_prefixes = ["success rate", "fail rate", "sloth rate", "recall50", "recall90", "wall collisions",
"inefficient turns", "inefficient revisits", "exploitation inefficiency"]
output = ""
for i in range(len(output_prefixes)):
output += output_prefixes[i]
for k in range(2):
for j in range(len(results_files)):
output += " & " + str(datas[k, j, i])
output += "\\\\" + "\n" + "\\hline" + "\n"
print(output)
| 25.734375 | 104 | 0.615058 |
7953b5b0e1296430a4137f3f04eaa97a07fd74c1 | 371 | py | Python | src/models/Match.py | ItsSyed/automated-Wechat-cricket-commentary | 95f031174f89ef3ce9fbfe078635ffa842c7af4a | [
"MIT"
] | 2 | 2019-01-13T03:15:17.000Z | 2020-05-05T17:43:13.000Z | src/models/Match.py | ItsSyed/automated-Wechat-cricket-commentary | 95f031174f89ef3ce9fbfe078635ffa842c7af4a | [
"MIT"
] | null | null | null | src/models/Match.py | ItsSyed/automated-Wechat-cricket-commentary | 95f031174f89ef3ce9fbfe078635ffa842c7af4a | [
"MIT"
] | 1 | 2020-02-15T07:29:08.000Z | 2020-02-15T07:29:08.000Z | class Match:
def __init__(self, first_team, second_team, first_team_score, second_team_score):
self.first_team = first_team
self.second_team = second_team
self.first_team_score = first_team_score
self.second_team_score = second_team_score
self.commentary = []
def __repr__(self):
return str(self.__dict__)
| 33.727273 | 85 | 0.681941 |
7953b6ca7cc8e6b292bb8656253986e36304e11c | 3,482 | py | Python | py/moma/sensors/site_sensor_test.py | wx-b/dm_robotics | 5d407622360ccf7f0b4b50bcee84589e2cfd0783 | [
"Apache-2.0"
] | 128 | 2021-09-08T18:39:39.000Z | 2022-03-27T11:29:05.000Z | py/moma/sensors/site_sensor_test.py | wx-b/dm_robotics | 5d407622360ccf7f0b4b50bcee84589e2cfd0783 | [
"Apache-2.0"
] | 7 | 2021-10-11T14:26:17.000Z | 2022-03-15T17:26:45.000Z | py/moma/sensors/site_sensor_test.py | LaudateCorpus1/dm_robotics | 647bc810788c74972c1684a8d2e4d2dfd2791485 | [
"Apache-2.0"
] | 8 | 2021-09-08T18:25:49.000Z | 2022-02-21T23:45:16.000Z | # Copyright 2020 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Tests for site_sensor."""
from absl.testing import absltest
from dm_control import mjcf
from dm_robotics.moma.sensors import site_sensor
from dm_robotics.transformations import transformations as tr
import numpy as np
class SiteSensorTest(absltest.TestCase):
def test_read_value_from_sensor(self):
# We create a mjcf body with a site we want to measure.
mjcf_root = mjcf.RootElement()
box_body = mjcf_root.worldbody.add(
"body", pos="0 0 0", axisangle="0 0 1 0",
name="box")
box_body.add("inertial", pos="0. 0. 0.", mass="1", diaginertia="1 1 1")
box_body.add("freejoint")
site = box_body.add("site", pos="0 0 0")
# Get expected values
expected_pos = np.array([1., 2., 3.])
expected_quat = np.array([4.0, 5.0, 6.0, 7.0])
expected_quat = expected_quat/ np.linalg.norm(expected_quat)
expected_rmat = np.reshape(tr.quat_to_mat(expected_quat)[:3, :3], (9,))
expected_vel = np.array([8., 9., 10., 11., 12., 13.])
# We then set the position and velocity of the body
physics = mjcf.Physics.from_mjcf_model(mjcf_root)
physics.data.qpos[:] = np.hstack((expected_pos, expected_quat))
physics.data.qvel[:] = expected_vel
physics.forward()
# Read the measurements of the sensors and ensure everything is correct
sensor = site_sensor.SiteSensor(site, "test_site")
pos_callable = sensor.observables[
sensor.get_obs_key(site_sensor.Observations.POS)]
np.testing.assert_allclose(expected_pos, pos_callable(physics))
quat_callable = sensor.observables[
sensor.get_obs_key(site_sensor.Observations.QUAT)]
np.testing.assert_allclose(expected_quat, quat_callable(physics))
rmat_callable = sensor.observables[
sensor.get_obs_key(site_sensor.Observations.RMAT)]
np.testing.assert_allclose(expected_rmat, rmat_callable(physics))
# The qvel that is set has the linear velocity expressed in the world
# frame orientation and the angular velocity expressed in the body frame
# orientation. We therefore test that the values appear where they should.
vel_world_callable = sensor.observables[
sensor.get_obs_key(site_sensor.Observations.VEL_WORLD)]
np.testing.assert_allclose(
expected_vel[:3], vel_world_callable(physics)[:3])
vel_relative_callable = sensor.observables[
sensor.get_obs_key(site_sensor.Observations.VEL_RELATIVE)]
np.testing.assert_allclose(
expected_vel[3:], vel_relative_callable(physics)[3:])
def test_passing_a_non_site_raise(self):
# We create a mjcf body with a site we want to measure.
mjcf_root = mjcf.RootElement()
box_body = mjcf_root.worldbody.add(
"body", pos="0 0 0", axisangle="0 0 1 0",
name="box")
with self.assertRaises(ValueError):
site_sensor.SiteSensor(box_body, "error")
if __name__ == "__main__":
absltest.main()
| 39.123596 | 78 | 0.721424 |
7953b724fae4fb0ac18cedca102727f03851f0ce | 1,140 | py | Python | Python/examples/example.py | RyanShahidi/easyml | fe0ecab6de02c0d91ef7de937cfb72ce7fcf3a51 | [
"MIT"
] | 37 | 2016-11-16T20:11:34.000Z | 2022-03-28T19:18:35.000Z | Python/examples/example.py | RyanShahidi/easyml | fe0ecab6de02c0d91ef7de937cfb72ce7fcf3a51 | [
"MIT"
] | 76 | 2016-11-06T18:04:41.000Z | 2021-04-30T20:34:51.000Z | Python/examples/example.py | CCS-Lab/easyML | 664076b4aba733751905ed351e5a320f20f1e520 | [
"MIT"
] | 18 | 2016-12-21T17:41:29.000Z | 2021-05-10T20:43:49.000Z | from easymlpy import glmnet
from glmnet import ElasticNet
import numpy as np
import pandas as pd
from sklearn.preprocessing import StandardScaler
# Load data
prostate = pd.read_table('./Python/examples/prostate.txt')
# Generate coefficients from data using easy_glmnet
output = glmnet.easy_glmnet(prostate, 'lpsa',
random_state=1, progress_bar=True, n_core=1,
n_samples=10, n_divisions=10, n_iterations=2,
model_args={'alpha': 1})
print(output.coefficients)
# Generate coefficients from data by hand
X, y = prostate.drop('lpsa', axis=1).values, prostate['lpsa'].values
sclr = StandardScaler()
X_preprocessed = sclr.fit_transform(X)
# data is the same in both - check
assert np.all(X_preprocessed == output.X_preprocessed)
coefficients = []
for i in range(10):
model = ElasticNet(alpha=1, standardize=False, cut_point=0.0, n_lambda=200)
model.fit(X_preprocessed, y)
coefficients.append(np.asarray(model.coef_))
print(coefficients)
# coefficients are the same in both - check
assert np.all(output.coefficients == np.asarray(coefficients))
| 32.571429 | 79 | 0.713158 |
7953b7a0c6b737b582b6536b7637ba4495958fc7 | 431 | py | Python | app/core/migrations/0005_recipe_image.py | geraldini/recipe-app-api | 653863e6c9d2b8132db1abdc80a3298a12e68d93 | [
"MIT"
] | null | null | null | app/core/migrations/0005_recipe_image.py | geraldini/recipe-app-api | 653863e6c9d2b8132db1abdc80a3298a12e68d93 | [
"MIT"
] | null | null | null | app/core/migrations/0005_recipe_image.py | geraldini/recipe-app-api | 653863e6c9d2b8132db1abdc80a3298a12e68d93 | [
"MIT"
] | null | null | null | # Generated by Django 2.1.15 on 2020-12-10 20:24
import core.models
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('core', '0004_recipe'),
]
operations = [
migrations.AddField(
model_name='recipe',
name='image',
field=models.ImageField(null=True, upload_to=core.models.recipe_image_file_path),
),
]
| 21.55 | 93 | 0.62181 |
7953b7f6a43e1f4f88228b40bf1cbadd39707820 | 11,959 | py | Python | goldcoin/timelord/timelord_state.py | DevMau5x/goldcoin-blockchain-2 | ed223dd16fa290ea710db7202d6c52a056242cfa | [
"Apache-2.0"
] | 17 | 2021-09-08T17:07:54.000Z | 2022-03-30T04:11:58.000Z | goldcoin/timelord/timelord_state.py | DevMau5x/goldcoin-blockchain-2 | ed223dd16fa290ea710db7202d6c52a056242cfa | [
"Apache-2.0"
] | 15 | 2021-09-28T21:09:49.000Z | 2022-03-22T21:13:23.000Z | goldcoin/timelord/timelord_state.py | Pierre21dd/gold2 | 4a35f207ed4c8a7745bfbc73fd3c190bd8b60a3f | [
"Apache-2.0"
] | 9 | 2021-09-12T10:03:23.000Z | 2022-03-15T08:35:11.000Z | import logging
from typing import List, Optional, Tuple, Union
from goldcoin.consensus.constants import ConsensusConstants
from goldcoin.protocols import timelord_protocol
from goldcoin.timelord.iters_from_block import iters_from_block
from goldcoin.timelord.types import Chain, StateType
from goldcoin.types.blockchain_format.classgroup import ClassgroupElement
from goldcoin.types.blockchain_format.sized_bytes import bytes32
from goldcoin.types.blockchain_format.slots import ChallengeBlockInfo
from goldcoin.types.blockchain_format.sub_epoch_summary import SubEpochSummary
from goldcoin.types.end_of_slot_bundle import EndOfSubSlotBundle
from goldcoin.util.ints import uint8, uint32, uint64, uint128
log = logging.getLogger(__name__)
class LastState:
"""
Represents the state that the timelord is in, and should execute VDFs on top of. A state can be one of three types:
1. A "peak" or a block
2. An end of sub-slot
3. None, if it's the first sub-slot and there are no blocks yet
Timelords execute VDFs until they reach the next block or sub-slot, at which point the state is changed again.
The state can also be changed arbitrarily to a sub-slot or peak, for example in the case the timelord receives
a new block in the future.
"""
def __init__(self, constants: ConsensusConstants):
self.state_type: StateType = StateType.FIRST_SUB_SLOT
self.peak: Optional[timelord_protocol.NewPeakTimelord] = None
self.subslot_end: Optional[EndOfSubSlotBundle] = None
self.last_ip: uint64 = uint64(0)
self.deficit: uint8 = constants.MIN_BLOCKS_PER_CHALLENGE_BLOCK
self.sub_epoch_summary: Optional[SubEpochSummary] = None
self.constants: ConsensusConstants = constants
self.last_weight: uint128 = uint128(0)
self.last_height: uint32 = uint32(0)
self.total_iters: uint128 = uint128(0)
self.last_challenge_sb_or_eos_total_iters = uint128(0)
self.last_block_total_iters: Optional[uint128] = None
self.last_peak_challenge: bytes32 = constants.GENESIS_CHALLENGE
self.difficulty: uint64 = constants.DIFFICULTY_STARTING
self.sub_slot_iters: uint64 = constants.SUB_SLOT_ITERS_STARTING
self.reward_challenge_cache: List[Tuple[bytes32, uint128]] = [(constants.GENESIS_CHALLENGE, uint128(0))]
self.new_epoch = False
self.passed_ses_height_but_not_yet_included = False
self.infused_ses = False
def set_state(self, state: Union[timelord_protocol.NewPeakTimelord, EndOfSubSlotBundle]):
if isinstance(state, timelord_protocol.NewPeakTimelord):
self.state_type = StateType.PEAK
self.peak = state
self.subslot_end = None
_, self.last_ip = iters_from_block(
self.constants,
state.reward_chain_block,
state.sub_slot_iters,
state.difficulty,
)
self.deficit = state.deficit
self.sub_epoch_summary = state.sub_epoch_summary
self.last_weight = state.reward_chain_block.weight
self.last_height = state.reward_chain_block.height
self.total_iters = state.reward_chain_block.total_iters
self.last_peak_challenge = state.reward_chain_block.get_hash()
self.difficulty = state.difficulty
self.sub_slot_iters = state.sub_slot_iters
if state.reward_chain_block.is_transaction_block:
self.last_block_total_iters = self.total_iters
self.reward_challenge_cache = state.previous_reward_challenges
self.last_challenge_sb_or_eos_total_iters = self.peak.last_challenge_sb_or_eos_total_iters
self.new_epoch = False
if (self.peak.reward_chain_block.height + 1) % self.constants.SUB_EPOCH_BLOCKS == 0:
self.passed_ses_height_but_not_yet_included = True
else:
self.passed_ses_height_but_not_yet_included = state.passes_ses_height_but_not_yet_included
elif isinstance(state, EndOfSubSlotBundle):
self.state_type = StateType.END_OF_SUB_SLOT
if self.peak is not None:
self.total_iters = uint128(self.total_iters - self.get_last_ip() + self.sub_slot_iters)
else:
self.total_iters = uint128(self.total_iters + self.sub_slot_iters)
self.peak = None
self.subslot_end = state
self.last_ip = uint64(0)
self.deficit = state.reward_chain.deficit
if state.challenge_chain.new_difficulty is not None:
assert state.challenge_chain.new_sub_slot_iters is not None
self.difficulty = state.challenge_chain.new_difficulty
self.sub_slot_iters = state.challenge_chain.new_sub_slot_iters
self.new_epoch = True
else:
self.new_epoch = False
if state.challenge_chain.subepoch_summary_hash is not None:
self.infused_ses = True
self.passed_ses_height_but_not_yet_included = False
else:
self.infused_ses = False
self.passed_ses_height_but_not_yet_included = self.passed_ses_height_but_not_yet_included
self.last_challenge_sb_or_eos_total_iters = self.total_iters
else:
self.passed_ses_height_but_not_yet_included = self.passed_ses_height_but_not_yet_included
self.new_epoch = False
self.reward_challenge_cache.append((self.get_challenge(Chain.REWARD_CHAIN), self.total_iters))
log.info(f"Updated timelord peak to {self.get_challenge(Chain.REWARD_CHAIN)}, total iters: {self.total_iters}")
while len(self.reward_challenge_cache) > 2 * self.constants.MAX_SUB_SLOT_BLOCKS:
self.reward_challenge_cache.pop(0)
def get_sub_slot_iters(self) -> uint64:
return self.sub_slot_iters
def can_infuse_block(self, overflow: bool) -> bool:
if overflow and self.new_epoch:
# No overflows in new epoch
return False
if self.state_type == StateType.FIRST_SUB_SLOT or self.state_type == StateType.END_OF_SUB_SLOT:
return True
ss_start_iters = self.get_total_iters() - self.get_last_ip()
already_infused_count: int = 0
for _, total_iters in self.reward_challenge_cache:
if total_iters > ss_start_iters:
already_infused_count += 1
if already_infused_count >= self.constants.MAX_SUB_SLOT_BLOCKS:
return False
return True
def get_weight(self) -> uint128:
return self.last_weight
def get_height(self) -> uint32:
return self.last_height
def get_total_iters(self) -> uint128:
return self.total_iters
def get_last_peak_challenge(self) -> Optional[bytes32]:
return self.last_peak_challenge
def get_difficulty(self) -> uint64:
return self.difficulty
def get_last_ip(self) -> uint64:
return self.last_ip
def get_deficit(self) -> uint8:
return self.deficit
def just_infused_sub_epoch_summary(self) -> bool:
"""
Returns true if state is an end of sub-slot, and that end of sub-slot infused a sub epoch summary
"""
return self.state_type == StateType.END_OF_SUB_SLOT and self.infused_ses
def get_next_sub_epoch_summary(self) -> Optional[SubEpochSummary]:
if self.state_type == StateType.FIRST_SUB_SLOT or self.state_type == StateType.END_OF_SUB_SLOT:
# Can only infuse SES after a peak (in an end of sub slot)
return None
assert self.peak is not None
if self.passed_ses_height_but_not_yet_included and self.get_deficit() == 0:
# This will mean we will include the ses in the next sub-slot
return self.sub_epoch_summary
return None
def get_last_block_total_iters(self) -> Optional[uint128]:
return self.last_block_total_iters
def get_passed_ses_height_but_not_yet_included(self) -> bool:
return self.passed_ses_height_but_not_yet_included
def get_challenge(self, chain: Chain) -> Optional[bytes32]:
if self.state_type == StateType.FIRST_SUB_SLOT:
assert self.peak is None and self.subslot_end is None
if chain == Chain.CHALLENGE_CHAIN:
return self.constants.GENESIS_CHALLENGE
elif chain == Chain.REWARD_CHAIN:
return self.constants.GENESIS_CHALLENGE
elif chain == Chain.INFUSED_CHALLENGE_CHAIN:
return None
elif self.state_type == StateType.PEAK:
assert self.peak is not None
reward_chain_block = self.peak.reward_chain_block
if chain == Chain.CHALLENGE_CHAIN:
return reward_chain_block.challenge_chain_ip_vdf.challenge
elif chain == Chain.REWARD_CHAIN:
return reward_chain_block.get_hash()
elif chain == Chain.INFUSED_CHALLENGE_CHAIN:
if reward_chain_block.infused_challenge_chain_ip_vdf is not None:
return reward_chain_block.infused_challenge_chain_ip_vdf.challenge
elif self.peak.deficit == self.constants.MIN_BLOCKS_PER_CHALLENGE_BLOCK - 1:
return ChallengeBlockInfo(
reward_chain_block.proof_of_space,
reward_chain_block.challenge_chain_sp_vdf,
reward_chain_block.challenge_chain_sp_signature,
reward_chain_block.challenge_chain_ip_vdf,
).get_hash()
return None
elif self.state_type == StateType.END_OF_SUB_SLOT:
assert self.subslot_end is not None
if chain == Chain.CHALLENGE_CHAIN:
return self.subslot_end.challenge_chain.get_hash()
elif chain == Chain.REWARD_CHAIN:
return self.subslot_end.reward_chain.get_hash()
elif chain == Chain.INFUSED_CHALLENGE_CHAIN:
if self.subslot_end.reward_chain.deficit < self.constants.MIN_BLOCKS_PER_CHALLENGE_BLOCK:
assert self.subslot_end.infused_challenge_chain is not None
return self.subslot_end.infused_challenge_chain.get_hash()
return None
return None
def get_initial_form(self, chain: Chain) -> Optional[ClassgroupElement]:
if self.state_type == StateType.FIRST_SUB_SLOT:
return ClassgroupElement.get_default_element()
elif self.state_type == StateType.PEAK:
assert self.peak is not None
reward_chain_block = self.peak.reward_chain_block
if chain == Chain.CHALLENGE_CHAIN:
return reward_chain_block.challenge_chain_ip_vdf.output
if chain == Chain.REWARD_CHAIN:
return ClassgroupElement.get_default_element()
if chain == Chain.INFUSED_CHALLENGE_CHAIN:
if reward_chain_block.infused_challenge_chain_ip_vdf is not None:
return reward_chain_block.infused_challenge_chain_ip_vdf.output
elif self.peak.deficit == self.constants.MIN_BLOCKS_PER_CHALLENGE_BLOCK - 1:
return ClassgroupElement.get_default_element()
else:
return None
elif self.state_type == StateType.END_OF_SUB_SLOT:
if chain == Chain.CHALLENGE_CHAIN or chain == Chain.REWARD_CHAIN:
return ClassgroupElement.get_default_element()
if chain == Chain.INFUSED_CHALLENGE_CHAIN:
assert self.subslot_end is not None
if self.subslot_end.reward_chain.deficit < self.constants.MIN_BLOCKS_PER_CHALLENGE_BLOCK:
return ClassgroupElement.get_default_element()
else:
return None
return None
| 50.037657 | 119 | 0.676478 |
7953b803624f845a278bfeaeda1a9f663e0acc6a | 271 | py | Python | textract/parsers/msg_parser.py | nesnahnoj/py3-textract | 61290fb44c964cf78ce64593fdf0076143dbcd91 | [
"MIT"
] | 1 | 2017-08-07T14:52:02.000Z | 2017-08-07T14:52:02.000Z | Lib/site-packages/textract/parsers/msg_parser.py | adzhou/Python27 | a7113b69d54a04cc780143241c2f1fe81939ad3a | [
"bzip2-1.0.6"
] | null | null | null | Lib/site-packages/textract/parsers/msg_parser.py | adzhou/Python27 | a7113b69d54a04cc780143241c2f1fe81939ad3a | [
"bzip2-1.0.6"
] | null | null | null | from ExtractMsg import Message
from .utils import BaseParser
class Parser(BaseParser):
"""Extract text from Microsoft Outlook files (.msg)
"""
def extract(self, filename, **kwargs):
m = Message(filename)
return m.subject + '\n\n' + m.body
| 20.846154 | 55 | 0.653137 |
7953b8108d79d024949d9d3557269c1d9bb95f74 | 221 | py | Python | Chapter 4/BubblesR.py | itsmealex56/myPyVenture | 7fa183905635a450095be00c2d3f3ddb94c70645 | [
"MIT"
] | null | null | null | Chapter 4/BubblesR.py | itsmealex56/myPyVenture | 7fa183905635a450095be00c2d3f3ddb94c70645 | [
"MIT"
] | null | null | null | Chapter 4/BubblesR.py | itsmealex56/myPyVenture | 7fa183905635a450095be00c2d3f3ddb94c70645 | [
"MIT"
] | null | null | null | #This is Bubbles-R-Us
smothies = ['coconut', 'strawberry', 'banana', 'pineapple', 'acai berry']
favorite = smothies[2]
smothies[3] = 'tropical'
length = len(smothies)
print(length)
for i in smothies:
print(i+ '\n') | 22.1 | 73 | 0.669683 |
7953b8556a87d1297a59820e5d5d9915c4b50acc | 6,977 | py | Python | client.py | rdaelanroosa/ME333_Final_Project | ba11f7b522b527d7a4ef340e47c81dedd1d41af6 | [
"Unlicense"
] | null | null | null | client.py | rdaelanroosa/ME333_Final_Project | ba11f7b522b527d7a4ef340e47c81dedd1d41af6 | [
"Unlicense"
] | null | null | null | client.py | rdaelanroosa/ME333_Final_Project | ba11f7b522b527d7a4ef340e47c81dedd1d41af6 | [
"Unlicense"
] | null | null | null |
import serial
import matplotlib.pyplot as plt
from genref import genRef
PORT = '/dev/ttyUSB'
MOTOR_SERVO_RATE = 200.0
PIC_MAX_STORE = 2000
menu = '''
MENU:
a: Read current (ticks)
b: Read current (mA)
c: Read encoder (ticks)
d: Read encoder (deg)
e: Reset encoder
f: Set PWM (-100 to 100)
g: Set current gains
h: Get current gains
i; Set position gains
j: Get position gains
k: Test current control
l: Go to angle (deg)
m: Load step trajectory
n: Load cubic trajectory
o: Execute Trajectory
p: Unpower motor
q: Quit client
r: Get mode
?: Help (display this menu)
'''
mode_dict = {
0:"IDLE",
1:"PWM",
2:"ITEST",
3:"HOLD",
4:"TRACK"}
# get current (ticks)
def a():
ser.write(b'a\n')
print("\nISENSE TICKS: %d\n" % int(ser.read_until(b'\n', 50)))
# get current (mA)
def b():
ser.write(b'b\n')
print("\nISENSE mA: %f\n" % float(ser.read_until(b'\n', 50)))
# get encoder (ticks)
def c():
ser.write(b'c\n')
ticks = int(ser.read_until(b'\n', 50))
print("\nENCODER TICKS: %d\n" % ticks)
if ticks == 0:
print("\n!!! ENCODER SATURATED !!!\n")
#get encoder (degrees)
def d():
ser.write(b'd\n')
deg = float(ser.read_until(b'\n', 50))
print("\nENCODER DEGREES: %f\n" % deg)
if deg == -30720.0:
print("\n!!! ENCODER SATURATED !!!\n")
#reset encoder
def e():
ser.write(b'e\n')
#set motor voltage by pwm percent
def f():
pwm = input('\n PWM: ')
ser.write(b'f\n')
ser.write(('%s\n' % pwm).encode())
raw = ser.read_until(b'\n', 50)
if float(raw) != float(pwm):
print("\nERROR: PWM MAY NOT BE SET PROPERLY")
print("")
# set current gains
def g():
ser.write(b'g\n')
kp = float(input('\nCurrent Kp: '))
ki = float(input('Current Ki: '))
print('\nSending gains... ', end='')
ser.write(("%f %f\n" % (kp, ki)).encode())
raw = ser.read_until(b'\n', 50)
data = list(map(float,raw.split()))
if data[0] == kp and data[1] == ki:
print("Done\n")
else:
print("ERROR: CURRENT KP, CURRENT KI may have been written improperly. Read back to confirm\n")
#get current gains
def h():
ser.write(b'h\n')
raw = ser.read_until(b'\n', 50)
data = raw.split()
print('\nCURRENT KP: %f' % float((data[0])))
print('CURRENT KI: %f\n' % float((data[1])))
#set position gains
def i():
ser.write(b'i\n')
kp = float(input('\nPosition Kp: '))
ki = float(input('Position Ki: '))
kd = float(input('Position Kd: '))
print('\nSending gains... ', end='')
ser.write(("%f %f %f\n" % (kp, ki, kd)).encode())
raw = ser.read_until(b'\n', 50)
data = list(map(float,raw.split()))
if data[0] == kp and data[1] == ki and data[2] == kd:
print("Done\n")
else:
print("ERROR: POSITION KP, POSITION KI, POSITION KD may have been written improperly. Read back to confirm.\n")
#get position gains
def j():
ser.write(b'j\n')
raw = ser.read_until(b'\n', 50)
data = raw.split()
print('\nPOSITION KP: %f' % float((data[0])))
print('POSITION KI: %f' % float((data[1])))
print('POSITION KD: %f\n' % float((data[2])))
#run test of current gains
def k():
h()
ser.write(b'k\n')
target = []
current = []
output = []
endflag = 0
i = 0
while not bool(endflag):
data_read = ser.read_until(b'\n',50)
data = str(data_read,'utf-8').split()
if len(data) == 5:
endflag = int(data[0])
target.append(float(data[2]))
current.append(float(data[3]))
output.append(float(data[4]))
print("\n\n<CLOSE PLOT TO CONTINUE>\r\n") # time array
plt.plot(output)
plt.plot(target)
plt.plot(current)
plt.ylabel('value')
plt.xlabel('sample')
plt.show()
#hold arm at given position
def l():
ntarg = input('Angle to HOLD (deg): ')
ser.write(b'l\n')
ser.write(('%s\n' % ntarg).encode())
# load step trajectory
def m():
trajectory = genRef('step')
if len(trajectory) > PIC_MAX_STORE:
print('Trajectory is too long. It will be truncated to %d entries.' % PIC_MAX_STORE)
trajectory = trajectory[0:PIC_MAX_STORE]
print("Done!")
print("Sending... ", end='')
ser.write(b'm\n')
ser.write(('%d\n' % len(trajectory)).encode())
for i in trajectory:
ser.write(('%f\n' % i).encode())
print(ser.read_until(b'\n',50))
print("Done\n")
#load cubic trajectory
def n():
trajectory = genRef('cubic')
if len(trajectory) > PIC_MAX_STORE:
print('Trajectory is too long. It will be truncated to %d entries.' % PIC_MAX_STORE)
trajectory = trajectory[0:PIC_MAX_STORE]
print("Done!")
print("Sending... ", end='')
ser.write(b'm\n')
ser.write(('%d\n' % len(trajectory)).encode())
for i in trajectory:
ser.write(('%f\n' % i).encode())
print(ser.read_until(b'\n',50))
#execute trajectory
def o():
target = []
position = []
output = []
endflag = 0
i = 0
ser.write(b'o\n')
while not bool(endflag):
data_read = ser.read_until(b'\n',50)
data = str(data_read,'utf-8').split()
if len(data) == 5:
endflag = int(data[0])
target.append(float(data[2]))
position.append(float(data[3]))
output.append(float(data[4]))
print("\n\n<CLOSE PLOT TO CONTINUE>\r\n")
#plt.plot(output)
plt.plot(target)
plt.plot(position)
plt.ylabel('value')
plt.xlabel('sample')
plt.show()
#unpower motor
def p():
ser.write(b'p\n')
#set PIC to IDLE and quit
def q():
print("\nSetting MODE to IDLE...", end = '')
ser.write(b'q\n')
raw = ser.read_until(b'\n', 50)
data = int(str(raw, 'utf-8'))
if data == 0:
print("Done\n")
end = 'y'
else:
print("IDLE NOT SET")
end = input("Force exit? (Y/n): ")
if (end == 'y') or (end == 'Y'):
print('Closing port...', end = '')
ser.close()
print('Done\n')
print('Exiting...\n\n')
exit()
#get mode
def r():
ser.write(b'r\n')
raw = ser.read_until(b'\n', 50)
data = int(str(raw, 'utf-8'))
print('MODE: ' + mode_dict[data])
#pritnt menu
def help():
print(menu)
def err():
print('\nInvalid choice\n')
switcher.get(input('(h for help) >>> '), err)()
#switch implementation
switcher = {
'a':a,
'b':b,
'c':c,
'd':d,
'e':e,
'f':f,
'g':g,
'h':h,
'i':i,
'j':j,
'k':k,
'l':l,
'm':m,
'n':n,
'o':o,
'p':p,
'q':q,
'r':r,
't':t,
'?':help}
#initialize serial port
portname = "%s%s" % (PORT, input('Port number: '))
ser = serial.Serial(portname,230400,rtscts=1)
print('Opening port: ' + ser.name)
print(menu)
#loop through menu prompt forever
while (True):
choice = input('>>> ')
switcher.get(choice, err)()
| 22.726384 | 119 | 0.54909 |
7953b8aa3f269c99d524e5ba921ff2d06c5fa577 | 2,556 | py | Python | soft/lib.tflite.static-old/customize.py | TITAN-PyCompat/ck-tensorflow | 6e42c2dc7a98ced05c2e74990b215407f06b542b | [
"BSD-3-Clause"
] | null | null | null | soft/lib.tflite.static-old/customize.py | TITAN-PyCompat/ck-tensorflow | 6e42c2dc7a98ced05c2e74990b215407f06b542b | [
"BSD-3-Clause"
] | null | null | null | soft/lib.tflite.static-old/customize.py | TITAN-PyCompat/ck-tensorflow | 6e42c2dc7a98ced05c2e74990b215407f06b542b | [
"BSD-3-Clause"
] | null | null | null | #
# Collective Knowledge (individual environment - setup)
#
# See CK LICENSE.txt for licensing details
# See CK COPYRIGHT.txt for copyright details
#
import os
##############################################################################
# setup environment setup
def setup(i):
"""
Input: {
cfg - meta of this soft entry
self_cfg - meta of module soft
ck_kernel - import CK kernel module (to reuse functions)
host_os_uoa - host OS UOA
host_os_uid - host OS UID
host_os_dict - host OS meta
target_os_uoa - target OS UOA
target_os_uid - target OS UID
target_os_dict - target OS meta
target_device_id - target device ID (if via ADB)
tags - list of tags used to search this entry
env - updated environment vars from meta
customize - updated customize vars from meta
deps - resolved dependencies for this soft
interactive - if 'yes', can ask questions, otherwise quiet
}
Output: {
return - return code = 0, if successful
> 0, if error
(error) - error text if return > 0
bat - prepared string for bat file
}
"""
import os
# Get variables
ck=i['ck_kernel']
s=''
iv=i.get('interactive','')
cus=i.get('customize',{})
full_path = cus.get('full_path','')
hosd=i['host_os_dict']
tosd=i['target_os_dict']
winh=hosd.get('windows_base','')
env=i['env']
ep=cus['env_prefix']
lib_dir = os.path.dirname(full_path)
install_dir = os.path.dirname(lib_dir)
src_dir = os.path.join(install_dir, 'src')
target_os_dict = i.get('target_os_dict', {})
target_os_name = target_os_dict.get('ck_name2', '')
env[ep+'_LIBS_DIRS'] = '-L' + lib_dir
if target_os_name == 'android':
env[ep+'_LIBS'] = '-ltensorflow-lite'
elif target_os_name == 'linux':
env[ep+'_LIBS'] = '-pthread -ltensorflow-lite -ldl'
else:
return {'return': -1, 'error': 'Unsupported target OS'}
env[ep] = install_dir
env[ep+'_LIB'] = lib_dir
env[ep+'_INCLUDE0'] = src_dir
env[ep+'_INCLUDE1'] = os.path.join(src_dir, 'tensorflow', 'contrib', 'lite', 'downloads', 'flatbuffers', 'include')
return {'return': 0, 'bat': s}
| 28.4 | 119 | 0.529343 |
7953b9875222fe4f0c778260be42a3df5f0109bc | 3,674 | py | Python | model.py | novakspela/vislice | 20f05d7ca5ade915943468520483566afa915e2d | [
"MIT"
] | null | null | null | model.py | novakspela/vislice | 20f05d7ca5ade915943468520483566afa915e2d | [
"MIT"
] | null | null | null | model.py | novakspela/vislice | 20f05d7ca5ade915943468520483566afa915e2d | [
"MIT"
] | null | null | null | import random
import json
STEVILO_DOVOLJENIH_NAPAK = 9
PRAVILNA_CRKA = '+'
PONOVLJENA_CRKA = 'O'
NAPACNA_CRKA = '-'
ZMAGA = 'W'
PORAZ = 'X'
ZACETEK = 'S'
class Igra:
def __init__(self, geslo, crke = None):
self.geslo = geslo
if crke is None:
self.crke = []
else:
self.crke = crke
def napacne_crke(self):
return [c for c in self.crke if c not in self.geslo]
def pravilne_crke(self):
return [c for c in self.crke if c in self.geslo]
def stevilo_napak(self):
return len(self.napacne_crke())
def zmaga(self):
for crka in self.geslo:
if crka not in self.crke:
return False
return True
def poraz(self):
return self.stevilo_napak() > STEVILO_DOVOLJENIH_NAPAK
def pravilni_del_gesla(self):
delni = ""
for crka in self.geslo:
if crka in self.crke:
delni += crka + ' '
else:
delni += '_ '
return delni
def nepravilni_ugibi(self):
return ' '.join(self.napacne_crke())
def ugibaj(self, crka):
crka = crka.upper()
if crka in self.crke:
return PONOVLJENA_CRKA
else:
self.crke.append(crka)
if crka in self.geslo:
if self.zmaga():
return ZMAGA
else:
return PRAVILNA_CRKA
else:
if self.poraz():
return PORAZ
else:
return NAPACNA_CRKA
with open("u:\\repozitorij\\vislice\\besede.txt", "r", encoding = "utf-8") as datoteka_z_besedami:
bazen_besed = [ vrstica.strip().upper() for vrstica in datoteka_z_besedami]
def nova_igra():
return Igra(random.choice(bazen_besed))
class Vislice:
def __init__(self, datoteka_s_stanjem, datoteka_z_besedami):
self.igre = {}
self.datoteka_s_stanjem = datoteka_s_stanjem
self.datoteka_z_besedami = datoteka_z_besedami
def nalozi_igre_iz_datoteke(self):
with open(self.datoteka_s_stanjem, 'r', encoding ='utf-8') as f:
igre = json.load(f)
self.igre = { int(id_igre) : (Igra(igre[id_igre]['geslo'], igre[id_igre]['crke']), igre[id_igre]['poskus'])
for id_igre in igre
}
return
def zapisi_igre_v_datoteko(self):
with open(self.datoteka_s_stanjem, 'w', encoding = 'utf-8') as f:
igre = ({id_igre : {'geslo':igra.geslo, 'crke': igra.crke, 'poskus': poskus} for id_igre, (igra,poskus) in self.igre.items()})
json.dump(igre, f)
return
def prost_id_igre(self):
if len(self.igre) == 0:
return 0
else:
return max(self.igre.keys()) + 1
def nova_igra(self):
self.nalozi_igre_iz_datoteke()
id_igre = self.prost_id_igre()
with open(self.datoteka_z_besedami, "r", encoding = "utf-8") as f:
bazen_besed = [ vrstica.strip().upper() for vrstica in f]
igra = Igra(random.choice(bazen_besed))
self.igre[id_igre] = (igra, ZACETEK)
self.zapisi_igre_v_datoteko()
return id_igre
def ugibaj(self, id_igre, crka):
self.nalozi_igre_iz_datoteke()
igra = self.igre[id_igre][0]
novo_stanje = igra.ugibaj(crka)
self.igre[id_igre] = (igra, novo_stanje)
self.zapisi_igre_v_datoteko()
return
# vislice = Vislice()
# moj_id_igre = vislice.nova_igra()
# print(vislice.igre[moj_id_igre])
# vislice.ugibaj(moj_id_igre, 'A')
# print(vislice.igre[moj_id_igre])
# print(vislice.igre)
| 28.703125 | 138 | 0.577572 |
7953b987bb50782fea5d44c026883c934b5563f3 | 1,534 | py | Python | block_timestamp.py | javipus/defi-tracking | baa944b0c54cf76152f9c083758663bb38105f07 | [
"MIT"
] | 1 | 2022-01-14T20:25:20.000Z | 2022-01-14T20:25:20.000Z | block_timestamp.py | holocenecap/defi-tracking | baa944b0c54cf76152f9c083758663bb38105f07 | [
"MIT"
] | null | null | null | block_timestamp.py | holocenecap/defi-tracking | baa944b0c54cf76152f9c083758663bb38105f07 | [
"MIT"
] | 1 | 2022-01-14T20:25:37.000Z | 2022-01-14T20:25:37.000Z | #!/usr/bin/env python3
import time
import datetime
import argparse
from web3 import Web3
from dotenv import load_dotenv
import requests
import os
load_dotenv()
# etherscan.io API:
etherscan_api = "https://api.etherscan.io/api"
# Get API keys from .env file:
etherscan_key = os.environ.get("ETHERSCAN_KEY")
# ETH node API:
eth_node_api = os.environ.get("ETH_NODE_API")
def get_block(timestamp):
API_ENDPOINT = etherscan_api+"?module=block&action=getblocknobytime&closest=before×tamp="+str(timestamp)+"&apikey="+etherscan_key
r = requests.get(url = API_ENDPOINT)
response = r.json()
return int(response["result"])
parser = argparse.ArgumentParser()
parser.add_argument("-t", "--timestamp", type=int, help="get the latest block for this timestamp")
parser.add_argument("-b", "--block", type=int, help="get the block timestamp")
args = parser.parse_args()
# HTTPProvider:
w3 = Web3(Web3.HTTPProvider(eth_node_api))
if args.block:
block = args.block
timestamp = w3.eth.getBlock(block).timestamp
r_timestamp = timestamp
elif args.timestamp:
r_timestamp = args.timestamp
block = get_block(r_timestamp)
timestamp = w3.eth.getBlock(block).timestamp
else:
block = w3.eth.blockNumber
timestamp = w3.eth.getBlock(block).timestamp
r_timestamp = int(time.time())
print('Requested timestamp: %d is %s UTC' % (r_timestamp, datetime.datetime.utcfromtimestamp(r_timestamp)))
print('Block timestamp: %d is %s UTC' % (timestamp, datetime.datetime.utcfromtimestamp(timestamp)))
print('Block number: %d' % (block))
| 29.5 | 136 | 0.749674 |
7953bac3d887c17808593551f652635244a675e4 | 5,701 | py | Python | src/confocal_microscopy/plotting/gui.py | yngvem/zebrafish-bloodflow | 632186ed94c160795b3306d4d7360d88e369054a | [
"MIT"
] | 1 | 2020-10-27T17:30:49.000Z | 2020-10-27T17:30:49.000Z | src/confocal_microscopy/plotting/gui.py | yngvem/confocal-microscopy | 632186ed94c160795b3306d4d7360d88e369054a | [
"MIT"
] | null | null | null | src/confocal_microscopy/plotting/gui.py | yngvem/confocal-microscopy | 632186ed94c160795b3306d4d7360d88e369054a | [
"MIT"
] | 1 | 2021-11-18T13:49:28.000Z | 2021-11-18T13:49:28.000Z | import numexpr as ne
import numpy as np
from PyQt5 import QtWidgets
from PyQt5.QtCore import Qt
from .gui_components import FloatSlider, IntSlider, SliceViewer, SurfaceViewer
class ImageViewer(QtWidgets.QWidget):
def __init__(self, image, voxel_size=(1, 1, 1), parent=None, flags=Qt.WindowFlags()):
super().__init__(parent, flags)
self.button = QtWidgets.QPushButton(text="Hei")
self.button.clicked.connect(self.update_img)
self.image = np.asfortranarray(image)
self.mpl_views = [None]*3
self.mpl_views[0] = SliceViewer(self.image, voxel_size=voxel_size, axis=0, parent=self)
self.mpl_views[1] = SliceViewer(self.image, voxel_size=voxel_size, axis=1, parent=self)
self.mpl_views[2] = SliceViewer(self.image, voxel_size=voxel_size, axis=2, parent=self)
self.surface_viewer = SurfaceViewer(self.image, voxel_size=voxel_size, parent=self)
layout = QtWidgets.QVBoxLayout()
self.setLayout(layout)
self.inner_layout = None
self.set_grid_layout()
self.surface_viewer.mouseDoubleClickEvent = lambda x: ImageViewer.mouseDoubleClickEvent(self, x)
for view in self.mpl_views:
view.canvas.mouseDoubleClickEvent = lambda x: ImageViewer.mouseDoubleClickEvent(self, x)
self.single_view = False
def mouseDoubleClickEvent(self, event):
print(self.childAt(event.pos()))
if self.single_view:
self.set_grid_layout()
self.single_view = False
else:
self.set_central_layout(self.childAt(event.pos()))
self.single_view = True
def set_grid_layout(self):
if self.inner_layout is not None:
self.layout().removeItem(self.inner_layout)
self.inner_layout = QtWidgets.QGridLayout()
self.inner_layout.addWidget(self.mpl_views[0], 0, 0)
self.inner_layout.addWidget(self.mpl_views[1], 0, 1)
self.inner_layout.addWidget(self.mpl_views[2], 1, 1)
self.inner_layout.addWidget(self.surface_viewer, 1, 0)
self.inner_layout.addWidget(self.button, 2, 2)
self.layout().addLayout(self.inner_layout)
self.updateGeometry()
def set_central_layout(self, widget):
if self.inner_layout is not None:
self.layout().removeItem(self.inner_layout)
self.inner_layout = QtWidgets.QGridLayout()
self.inner_layout.addWidget(widget, 0, 0)
self.layout().addLayout(self.inner_layout)
self.updateGeometry()
def update_plots(self, *args):
for view in self.mpl_views:
view.update_plot()
def update_img(self, *args):
self.image *= 2
self.image[self.image > 1] = 1
#self.surface_viewer.image_mesh.point_arrays["Vasculature"] = self.image.flatten('F')
self.update_plots()
self.surface_viewer.isovalue_algorithm.Update()
self.surface_viewer.isovalue_actor.shallow_copy(self.surface_viewer.isovalue_algorithm.GetOutput())
for renderer in self.surface_viewer.renderers:
#renderer.RemoveAllViewProps()
renderer.Render()
#self.surface_viewer.add_scene()
print(len(self.surface_viewer.renderers))
print(np.mean(self.surface_viewer.image_mesh.point_arrays["Vasculature"]))
print(np.mean(self.image))
class Transformer(ImageViewer):
def __init__(self, image, voxel_size=(1, 1, 1), parent=None, flags=Qt.WindowFlags()):
super().__init__(image, voxel_size, parent, flags)
self.input_image = image.copy()
self._image = image
@property
def image(self):
return self._image
def transform(self) -> None:
"""Modify self.image_stack inplace.
"""
pass
class Histogram(Transformer):
def __init__(self, image, voxel_size=(1, 1, 1), parent=None, flags=Qt.WindowFlags()):
super().__init__(
image=image,
voxel_size=voxel_size,
parent=parent,
flags=flags
)
widget = QtWidgets.QWidget(parent=self)
layout = QtWidgets.QVBoxLayout()
self.min = FloatSlider(
0,
min=0,
max=1,
step=0.001,
description="Minimum value:",
parent=widget
)
self.max = FloatSlider(
1,
min=0,
max=1,
step=0.001,
description="Maximum value:",
parent=widget
)
self.min.observe(self.transform)
self.max.observe(self.transform)
self.min.observe(self.update_plots)
self.max.observe(self.update_plots)
layout.addWidget(self.min)
layout.addWidget(self.max)
widget.setLayout(layout)
self.layout().addWidget(widget, 1, 0)
def transform(self, *args):
image = self.input_image
min_ = self.min.value
max_ = self.max.value
out = self.image
ne.evaluate("(image - min_)/(max_ - min_)", out=out)
self.image[self.image < 0] = 0
self.image[self.image > 1] = 1
if __name__ == "__main__":
import sys
from pathlib import Path
from scipy import ndimage
from confocal_microscopy.files import ims
image_path = Path("/home/yngve/Documents/Fish 1 complete/Cancer region/Blood vessels 3d stack/fast_2020-09-02_Federico s_10.41.10_JFM9CC2.ims")
image = ims.load_image_stack(image_path, resolution_level=2).astype(float)
image -= image.min()
image /= image.max()
app = QtWidgets.QApplication(sys.argv)
main = ImageViewer(image, voxel_size=(1000, 408, 408))
main.show()
sys.exit(app.exec_()) | 35.855346 | 147 | 0.638835 |
7953bb081816d954201a69136fdf1a22590bdbab | 32,715 | py | Python | abs_templates_ec/resistor/base.py | boblinchuan/BAG2_TEMPLATES_EC | e0e4a41c1780edb035cd619b9cea2e27e3fc5f51 | [
"BSD-3-Clause"
] | 1 | 2019-11-06T17:58:37.000Z | 2019-11-06T17:58:37.000Z | abs_templates_ec/resistor/base.py | boblinchuan/BAG2_TEMPLATES_EC | e0e4a41c1780edb035cd619b9cea2e27e3fc5f51 | [
"BSD-3-Clause"
] | null | null | null | abs_templates_ec/resistor/base.py | boblinchuan/BAG2_TEMPLATES_EC | e0e4a41c1780edb035cd619b9cea2e27e3fc5f51 | [
"BSD-3-Clause"
] | 1 | 2019-06-27T04:23:28.000Z | 2019-06-27T04:23:28.000Z | # -*- coding: utf-8 -*-
"""This module defines abstract analog resistor array component classes.
"""
from typing import TYPE_CHECKING, Dict, Set, Tuple, Any, List, Optional, Union
import abc
from bag import float_to_si_string
from bag.math import lcm
from bag.util.search import BinaryIterator
from bag.layout.template import TemplateBase, TemplateDB
from bag.layout.routing import RoutingGrid
if TYPE_CHECKING:
from bag.layout.tech import TechInfoConfig
class ResTech(object, metaclass=abc.ABCMeta):
"""An abstract class for drawing resistor related layout.
This class defines various methods use to draw layouts used by ResArrayBase.
Parameters
----------
config : Dict[str, Any]
the technology configuration dictionary.
tech_info : TechInfo
the TechInfo object.
"""
def __init__(self, config, tech_info):
# type: (Dict[str, Any], TechInfoConfig) -> None
self.config = config
self.res_config = self.config['resistor']
self.res = self.config['resolution']
self.tech_info = tech_info
@abc.abstractmethod
def get_min_res_core_size(self, l, w, res_type, sub_type, threshold, options):
# type: (int, int, str, str, str, Dict[str, Any]) -> Tuple[int, int]
"""Calculate the minimum size of a resistor core based on DRC rules.
This function usually calculates the minimum size based on spacing rules and not density
rules. density rule calculations are usually handled in get_core_info().
Parameters
----------
l : int
resistor length in resolution units.
w : int
resistor width in resolution units
res_type : str
resistor type.
sub_type : str
substrate type.
threshold : str
threshold type.
options : Dict[str, Any]
optional parameter values.
Returns
-------
wcore : int
minimum width of resistor core from DRC rules.
hcore : int
minimum height of resistor core from DRC rules.
"""
return 1, 1
@abc.abstractmethod
def get_core_info(self,
grid, # type: RoutingGrid
width, # type: int
height, # type: int
l, # type: int
w, # type: int
res_type, # type: str
sub_type, # type: str
threshold, # type: str
track_widths, # type: List[int]
track_spaces, # type: List[Union[float, int]]
options, # type: Dict[str, Any]
):
# type: (...) -> Optional[Dict[str, Any]]
"""Returns a dictionary of core layout information.
If the given core size does not meet DRC rules, return None.
Parameters
----------
grid : RoutingGrid
the RoutingGrid object.
width : int
the width of core block in resolution units.
height : int
the height tof core block in resolution units.
l : int
resistor length in resolution units.
w : int
resistor width in resolution units
res_type : str
resistor type.
sub_type : str
substrate type.
threshold : str
threshold type.
track_widths : List[int]
the track widths on each layer to meet EM specs.
track_spaces : List[Union[float, int]]
the track spaces on each layer.
options : Dict[str, Any]
optional parameter values.
Returns
-------
layout_info : Optional[Dict[str, Any]]
the core layout information dictionary.
"""
return None
@abc.abstractmethod
def get_lr_edge_info(self,
grid, # type: RoutingGrid
core_info, # type: Dict[str, Any]
wedge, # type: int
l, # type: int
w, # type: int
res_type, # type: str
sub_type, # type: str
threshold, # type: str
track_widths, # type: List[int]
track_spaces, # type: List[Union[float, int]]
options, # type: Dict[str, Any]
):
# type: (...) -> Optional[Dict[str, Any]]
"""Returns a dictionary of LR edge layout information.
If the given edge size does not meet DRC rules, return None.
Parameters
----------
grid: RoutingGrid
the RoutingGrid object.
core_info : Dict[str, Any]
core layout information dictionary.
wedge : int
LR edge width in resolution units.
l : int
resistor length in resolution units.
w : int
resistor width in resolution units
res_type : str
resistor type.
sub_type : str
substrate type.
threshold : str
threshold type.
track_widths : List[int]
the track widths on each layer to meet EM specs.
track_spaces : List[Union[float, int]]
the track spaces on each layer.
options : Dict[str, Any]
optional parameter values.
Returns
-------
layout_info : Optional[Dict[str, Any]]
the edge layout information dictionary.
"""
return None
@abc.abstractmethod
def get_tb_edge_info(self,
grid, # type: RoutingGrid
core_info, # type: Dict[str, Any]
hedge, # type: int
l, # type: int
w, # type: int
res_type, # type: str
sub_type, # type: str
threshold, # type: str
track_widths, # type: List[int]
track_spaces, # type: List[Union[float, int]]
options, # type: Dict[str, Any]
):
# type: (...) -> Optional[Dict[str, Any]]
"""Returns a dictionary of TB edge layout information.
If the given edge size does not meet DRC rules, return None.
Parameters
----------
grid: RoutingGrid
the RoutingGrid object.
core_info : Dict[str, Any]
core layout information dictionary.
hedge : int
TB edge height in resolution units.
l : int
resistor length in resolution units.
w : int
resistor width in resolution units
res_type : str
resistor type.
sub_type : str
substrate type.
threshold : str
threshold type.
track_widths : List[int]
the track widths on each layer to meet EM specs.
track_spaces : List[Union[float, int]]
the track spaces on each layer.
options : Dict[str, Any]
optional parameter values.
Returns
-------
layout_info : Optional[Dict[str, Any]]
the edge layout information dictionary.
"""
return None
@abc.abstractmethod
def draw_res_core(self, template, layout_info):
# type: (TemplateBase, Dict[str, Any]) -> None
"""Draw the resistor core in the given template.
Parameters
----------
template : TemplateBase
the template to draw the resistor core in.
layout_info : Dict[str, Any]
the resistor layout information dictionary.
"""
pass
@abc.abstractmethod
def draw_res_boundary(self, template, boundary_type, layout_info, end_mode):
# type: (TemplateBase, str, Dict[str, Any]) -> None
"""Draw the resistor left/right edge in the given template.
Parameters
----------
template : TemplateBase
the template to draw the resistor edge in.
boundary_type : str
the resistor boundary type. One of 'lr', 'tb', or 'corner'.
layout_info : Dict[str, Any]
the resistor layout information dictionary.
end_mode : bool
True to extend well layers to bottom.
"""
pass
def get_res_imp_layers(self, res_type, sub_type, threshold):
# type: (str, str, str) -> List[Tuple[str, str]]
"""Returns a list of resistor implant layers.
Parameters
----------
res_type : str
the resistor type.
sub_type : str
the resistor substrate type.
threshold : str
the threshold flavor.
Returns
-------
imp_list : List[Tuple[str, str]]
a list of implant layers.
"""
imp_layers = self.tech_info.get_implant_layers(sub_type, res_type=res_type)
imp_layers.extend(self.res_config['res_layers'][res_type].keys())
imp_layers.extend(self.res_config['thres_layers'][sub_type][threshold].keys())
return imp_layers
def get_bot_layer(self):
# type: () -> int
"""Returns the layer ID of the bottom horizontal routing layer.
Returns
-------
layer_id : int
the bottom horizontal routing layer ID.
"""
return self.res_config['bot_layer']
def get_block_pitch(self):
# type: () -> Tuple[int, int]
"""Returns the horizontal/vertical block pitch of the resistor core in resolution units.
The vertical block pitch is usually the fin pitch.
Returns
-------
x_pitch : int
the horizontal block pitch, in resolution units.
y_pitch : int
the vertical block pitch, in resolution units.
"""
return self.res_config['block_pitch']
def get_core_track_info(self, # type: ResTech
grid, # type: RoutingGrid
min_tracks, # type: Tuple[int, ...]
em_specs, # type: Dict[str, Any]
connect_up=False, # type: bool
):
# type: (...) -> Tuple[List[int], List[Union[int, float]], Tuple[int, int], Tuple[int, int]]
"""Calculate resistor core size/track information based on given specs.
This method calculate the track width/spacing on each routing layer from EM specifications,
then compute minimum width/height and block pitch of resistor blocks from given
constraints.
Parameters
----------
grid : RoutingGrid
the RoutingGrid object.
min_tracks : Tuple[int, ...]
minimum number of tracks on each layer.
em_specs : Dict[str, Any]
EM specification dictionary.
connect_up : bool
True if the last used layer needs to be able to connect to the layer above.
This options will make sure that the width of the last track is wide enough to support
the inter-layer via.
Returns
-------
track_widths : List[int]
the track width on each layer that satisfies EM specs.
track_spaces : List[Union[int, float]]
the track space on each layer.
min_size : Tuple[int, int]
a tuple of minimum width and height of the core in resolution units.
blk_pitch : Tuple[int, int]
a tuple of width and height pitch of the core in resolution units.
"""
track_widths = []
track_spaces = []
prev_width = -1
min_w = min_h = 0
cur_layer = self.get_bot_layer()
for idx, min_num_tr in enumerate(min_tracks):
# make sure that current layer can connect to next layer
if idx < len(min_tracks) - 1 or connect_up:
top_tr_w = grid.get_min_track_width(cur_layer + 1, unit_mode=True, **em_specs)
top_w = grid.get_track_width(cur_layer + 1, top_tr_w, unit_mode=True)
else:
top_w = -1
tr_p = grid.get_track_pitch(cur_layer, unit_mode=True)
cur_width = grid.get_min_track_width(cur_layer, bot_w=prev_width, top_w=top_w,
unit_mode=True, **em_specs)
cur_space = grid.get_num_space_tracks(cur_layer, cur_width, half_space=True)
track_widths.append(cur_width)
track_spaces.append(cur_space)
cur_ntr = min_num_tr * (cur_width + cur_space)
if isinstance(cur_space, float):
cur_ntr += 0.5
min_dim = int(round(tr_p * cur_ntr))
if grid.get_direction(cur_layer) == 'x':
min_h = max(min_h, min_dim)
else:
min_w = max(min_w, min_dim)
prev_width = grid.get_track_width(cur_layer, cur_width, unit_mode=True)
cur_layer += 1
# get block size
wblk, hblk = grid.get_block_size(cur_layer - 1, unit_mode=True, include_private=True)
wblk_drc, hblk_drc = self.get_block_pitch()
wblk = lcm([wblk, wblk_drc])
hblk = lcm([hblk, hblk_drc])
min_w = -(-min_w // wblk) * wblk
min_h = -(-min_h // hblk) * hblk
return track_widths, track_spaces, (min_w, min_h), (wblk, hblk)
def find_core_size(self, # type: ResTech
grid, # type: RoutingGrid
params, # type: Dict[str, Any]
wres, # type: int
hres, # type: int
wblk, # type: int
hblk, # type: int
ext_dir, # type: str
max_blk_ext, # type: int
):
# type: (...) -> Tuple[int, int, Dict[str, Any]]
"""Compute resistor core size that meets DRC rules.
Given current resistor block size and the block pitch, increase the resistor block
size if necessary to meet DRC rules.
Parameters
----------
grid : RoutingGrid
the RoutingGrid object.
params : Dict[str, Any]
the resistor parameters dictionary.
wres : int
resistor core width, in resolution units.
hres : int
resistor core height, in resolution units.
wblk : int
the horizontal block pitch, in resolution units.
hblk : int
the vertical block pitch, in resolution units.
ext_dir : Optional[str]
if equal to 'x', then we will only stretch the resistor core horizontally. If equal
to 'y', we will only stretch the resistor core vertically. Otherwise, we will find
the resistor core with the minimum area that meets the density spec.
max_blk_ext : int
number of block pitches we can extend the resistor core size by. If we cannot
find a valid core size by extending this many block pitches, we declare failure.
Returns
-------
nxblk : int
width of the resistor core, in units of wblk.
nyblk : int
height of the resistor core, in units of hblk.
layout_info : Dict[str, Any]
the core layout information dictionary.
"""
nxblk = wres // wblk
nyblk = hres // hblk
ans = None
x_only = (ext_dir == 'x')
if x_only or (ext_dir == 'y'):
# only extend X or Y direction
if x_only:
bin_iter = BinaryIterator(nxblk, nxblk + max_blk_ext + 1)
else:
bin_iter = BinaryIterator(nyblk, nyblk + max_blk_ext + 1)
while bin_iter.has_next():
ncur = bin_iter.get_next()
if x_only:
wcur, hcur = ncur * wblk, hres
else:
wcur, hcur = wres, ncur * hblk
tmp = self.get_core_info(grid, wcur, hcur, **params)
if tmp is None:
bin_iter.up()
else:
ans = tmp
bin_iter.save()
bin_iter.down()
if ans is None:
raise ValueError('failed to find DRC clean core with maximum %d '
'additional block pitches.' % max_blk_ext)
if x_only:
nxblk = bin_iter.get_last_save()
else:
nyblk = bin_iter.get_last_save()
return nxblk, nyblk, ans
else:
# extend in both direction
opt_area = (nxblk + max_blk_ext + 1) * (nyblk + max_blk_ext + 1)
# linear search in height, binary search in width
# in this way, for same area, use height as tie breaker
nxopt, nyopt = nxblk, nyblk
for nycur in range(nyblk, nyblk + max_blk_ext + 1):
# check if we should terminate linear search
if nycur * nxblk >= opt_area:
break
bin_iter = BinaryIterator(nxblk, nxblk + max_blk_ext + 1)
hcur = nycur * hblk
while bin_iter.has_next():
nxcur = bin_iter.get_next()
if nxcur * nycur >= opt_area:
# this point can't beat current optimum
bin_iter.down()
else:
tmp = self.get_core_info(grid, nxcur * wblk, hcur, **params)
if tmp is None:
bin_iter.up()
else:
# found new optimum
ans, nxopt, nyopt = tmp, nxcur, nycur
opt_area = nxcur * nycur
bin_iter.down()
if ans is None:
raise ValueError('failed to find DRC clean core with maximum %d '
'additional block pitches.' % max_blk_ext)
return nxopt, nyopt, ans
def find_edge_size(self, # type: ResTech
grid, # type: RoutingGrid
core_info, # type: Dict[str, Any]
is_lr_edge, # type: bool
params, # type: Dict[str, Any]
blk1, # type: int
max_blk_ext, # type: int
):
# type: (...) -> Tuple[int, Dict[str, Any]]
"""Compute resistor edge size that meets DRC rules.
Calculate edge dimension (width for LR edge, height for TB edge) that meets DRC rules
Parameters
----------
grid : RoutingGrid
the RoutingGrid object.
core_info : Dict[str, Any]
core layout information dictionary.
is_lr_edge : bool
True if this is left/right edge, False if this is top/bottom edge.
params : Dict[str, Any]
the resistor parameters dictionary.
blk1 : int
dimension1 block size in resolution units.
max_blk_ext : int
maximum number of blocks we can extend by.
Returns
-------
n1 : int
edge length in dimension 1 as number of blocks.
layout_info : Dict[str, Any]
the edge layout information dictionary.
"""
bin_iter = BinaryIterator(1, max_blk_ext + 2)
ans = None
while bin_iter.has_next():
n1 = bin_iter.get_next()
if is_lr_edge:
tmp = self.get_lr_edge_info(grid, core_info, n1 * blk1, **params)
else:
tmp = self.get_tb_edge_info(grid, core_info, n1 * blk1, **params)
if tmp is None:
bin_iter.up()
else:
ans = tmp
bin_iter.save()
bin_iter.down()
if ans is None:
raise ValueError('failed to find DRC clean core with maximum %d '
'additional block pitches.' % max_blk_ext)
return bin_iter.get_last_save(), ans
def get_res_info(self,
grid, # type: RoutingGrid
l, # type: int
w, # type: int
res_type, # type: str
sub_type, # type: str
threshold, # type: str
min_tracks, # type: Tuple[int, ...]
em_specs, # type: Dict[str, Any]
ext_dir, # type: Optional[str]
max_blk_ext=100, # type: int
connect_up=False, # type: bool
options=None, # type: Optional[Dict[str, Any]]
):
# type: (...) -> Dict[str, Any]
"""Compute the resistor layout information dictionary.
This method compute the width/height of each resistor primitive block and also the
track width and space on each routing layer, then return the result as a dictionary.
Parameters
----------
grid : RoutingGrid
the RoutingGrid object.
l : int
length of the resistor, in resolution units.
w : int
width of the resistor, in resolution units.
res_type : str
the resistor type.
sub_type : str
the resistor substrate type.
threshold : str
the substrate threshold flavor.
min_tracks : Tuple[int, ...]
list of minimum number of tracks in each routing layer.
em_specs : Dict[str, Any]
the EM specification dictionary.
ext_dir : Optional[str]
if equal to 'x', then we will only stretch the resistor core horizontally. If equal
to 'y', we will only stretch the resistor core vertically. Otherwise, we will find
the resistor core with the minimum area that meets the density spec.
max_blk_ext : int
number of block pitches we can extend the resistor core/edge size by. If we cannot
find a valid core size by extending this many block pitches, we declare failure.
connect_up : bool
True if the last used layer needs to be able to connect to the layer above.
This options will make sure that the width of the last track is wide enough to support
the inter-layer via.
options : Optional[Dict[str, Any]]
dictionary of optional parameters.
Returns
-------
res_info : Dict[str, Any]
the resistor layout information dictionary.
"""
if options is None:
options = {}
else:
pass
# step 1: get track/size parameters
tmp = self.get_core_track_info(grid, min_tracks, em_specs, connect_up=connect_up)
track_widths, track_spaces, min_size, blk_pitch = tmp
params = dict(
l=l,
w=w,
res_type=res_type,
sub_type=sub_type,
threshold=threshold,
track_widths=track_widths,
track_spaces=track_spaces,
options=options,
)
# step 2: get minimum DRC core size, then update with minimum size and round to block size.
wres, hres = self.get_min_res_core_size(l, w, res_type, sub_type, threshold, options)
wres = max(wres, min_size[0])
hres = max(hres, min_size[1])
wblk, hblk = blk_pitch
wres = -(-wres // wblk) * wblk
hres = -(-hres // hblk) * hblk
# step 3: extend core until density rule is satisfied.
nxblk, nyblk, core_info = self.find_core_size(grid, params, wres, hres, wblk, hblk, ext_dir,
max_blk_ext)
wcore, hcore = nxblk * wblk, nyblk * hblk
# step 4: calculate edge size that satisfies density rule.
nxblk_lr, edge_lr_info = self.find_edge_size(grid, core_info, True, params, wblk,
max_blk_ext)
nyblk_tb, edge_tb_info = self.find_edge_size(grid, core_info, False, params, hblk,
max_blk_ext)
wedge, hedge = nxblk_lr * wblk, nyblk_tb * hblk
# step 6: calculate geometry information of each primitive block.
bot_layer = self.get_bot_layer()
num_tracks = []
num_corner_tracks = []
for lay in range(bot_layer, bot_layer + len(min_tracks)):
if grid.get_direction(lay) == 'y':
dim = wcore
dim_corner = wedge
else:
dim = hcore
dim_corner = hedge
pitch = grid.get_track_pitch(lay, unit_mode=True)
if dim % pitch == 0:
num_tracks.append(dim // pitch)
else:
num_tracks.append(dim / pitch)
if dim_corner % pitch == 0:
num_corner_tracks.append(dim_corner // pitch)
else:
num_corner_tracks.append(dim_corner / pitch)
res_info = dict(
l=l,
w=w,
res_type=res_type,
sub_type=sub_type,
threshold=threshold,
options=options,
w_core=wcore,
h_core=hcore,
w_edge=wedge,
h_edge=hedge,
track_widths=track_widths,
track_spaces=track_spaces,
num_tracks=num_tracks,
num_corner_tracks=num_corner_tracks,
core_info=core_info,
edge_lr_info=edge_lr_info,
edge_tb_info=edge_tb_info,
well_xl=edge_lr_info['well_xl'],
)
return res_info
class AnalogResCore(TemplateBase):
"""An abstract template for analog resistors array core.
Parameters
----------
temp_db : TemplateDB
the template database.
lib_name : str
the layout library name.
params : Dict[str, Any]
the parameter values.
used_names : Set[str]
a set of already used cell names.
**kwargs
dictionary of optional parameters. See documentation of
:class:`bag.layout.template.TemplateBase` for details.
"""
def __init__(self, temp_db, lib_name, params, used_names, **kwargs):
# type: (TemplateDB, str, Dict[str, Any], Set[str], **Any) -> None
self._layout_info = params['res_info']
self._num_tracks = self._layout_info['num_tracks']
self._track_widths = self._layout_info['track_widths']
TemplateBase.__init__(self, temp_db, lib_name, params, used_names, **kwargs)
self._tech_cls = self.grid.tech_info.tech_params['layout']['res_tech_class']
@classmethod
def get_params_info(cls):
# type: () -> Dict[str, str]
"""Returns a dictionary containing parameter descriptions.
Override this method to return a dictionary from parameter names to descriptions.
Returns
-------
param_info : Dict[str, str]
dictionary from parameter name to description.
"""
return dict(
res_info='resistor layout information dictionary.',
)
def get_num_tracks(self):
# type: () -> Tuple[Union[float, int], ...]
"""Returns a list of the number of tracks on each routing layer in this template.
Returns
-------
ntr_list : Tuple[Union[float, int], ...]
a list of number of tracks in this template on each layer.
index 0 is the bottom-most routing layer, and corresponds to
AnalogResCore.port_layer_id().
"""
return self._num_tracks
def get_track_widths(self):
# type: () -> Tuple[int, ...]
"""Returns a list of track widths on each routing layer.
Returns
-------
width_list : Tuple[int, ...]
a list of track widths in number of tracks on each layer.
index 0 is the bottom-most routing layer, and corresponds to
port_layer_id().
"""
return self._track_widths
def get_boundary_params(self, boundary_type, end_mode=False):
# type: (str, bool) -> Dict[str, Any]
"""Returns boundary parameters dictioanry."""
return dict(
boundary_type=boundary_type,
layout_id=self.get_name_id(),
layout_info=self._layout_info,
end_mode=end_mode,
)
def get_name_id(self):
# type: () -> str
"""Returns a string identifier representing this resistor core."""
l_str = float_to_si_string(self._layout_info['l'])
w_str = float_to_si_string(self._layout_info['w'])
res_type = self._layout_info['res_type']
sub_type = self._layout_info['sub_type']
threshold = self._layout_info['threshold']
main = '%s_%s_%s_l%s_w%s' % (res_type, sub_type, threshold, l_str, w_str)
return main
def get_layout_basename(self):
# type: () -> str
"""Returns the base name for this template.
Returns
-------
base_name : str
the base name of this template.
"""
return 'rescore_' + self.get_name_id()
def compute_unique_key(self):
flip_parity = self.grid.get_flip_parity()
return self.to_immutable_id((self.get_layout_basename(), self._layout_info, flip_parity))
def draw_layout(self):
self._tech_cls.draw_res_core(self, self._layout_info)
self.prim_top_layer = self._tech_cls.get_bot_layer()
class AnalogResBoundary(TemplateBase):
"""An abstract template for analog resistors array left/right edge.
Parameters
----------
temp_db : TemplateDB
the template database.
lib_name : str
the layout library name.
params : Dict[str, Any]
the parameter values.
used_names : Set[str]
a set of already used cell names.
**kwargs
dictionary of optional parameters. See documentation of
:class:`bag.layout.template.TemplateBase` for details.
"""
def __init__(self, temp_db, lib_name, params, used_names, **kwargs):
# type: (TemplateDB, str, Dict[str, Any], Set[str], **Any) -> None
TemplateBase.__init__(self, temp_db, lib_name, params, used_names, **kwargs)
self._tech_cls = self.grid.tech_info.tech_params['layout']['res_tech_class']
self._well_xl = self.params['layout_info']['well_xl']
@classmethod
def get_params_info(cls):
# type: () -> Dict[str, str]
"""Returns a dictionary containing parameter descriptions.
Override this method to return a dictionary from parameter names to descriptions.
Returns
-------
param_info : Dict[str, str]
dictionary from parameter name to description.
"""
return dict(
boundary_type='resistor boundary type.',
layout_id='the layout ID',
layout_info='the layout information dictionary.',
end_mode='integer flag indicating whether to extend well layers to bottom.',
)
def get_well_left(self, unit_mode=False):
if unit_mode:
return self._well_xl
return self._well_xl * self.grid.resolution
def get_layout_basename(self):
# type: () -> str
"""Returns the base name for this template.
Returns
-------
base_name : str
the base name of this template.
"""
bound_type = self.params['boundary_type']
if bound_type == 'lr':
prefix = 'resedgelr'
elif bound_type == 'tb':
prefix = 'resedgetb'
else:
prefix = 'rescorner'
base = '%s_%s' % (prefix, self.params['layout_id'])
if self.params['end_mode']:
base += '_end'
return base
def compute_unique_key(self):
basename = self.get_layout_basename()
return self.to_immutable_id((basename, self.params['layout_info']))
def draw_layout(self):
self._tech_cls.draw_res_boundary(self, self.params['boundary_type'],
self.params['layout_info'], self.params['end_mode'])
self.prim_top_layer = self._tech_cls.get_bot_layer()
| 37.091837 | 100 | 0.54608 |
7953bbbee5d1065fae66054563cf0e12a96e3b68 | 5,955 | py | Python | rezoirclogs/tests/test_utils.py | supelec-rezo/rezoirclogs | 2b84bfc80ba1f580d94b8bafb1a8abce8e3331ab | [
"0BSD"
] | 2 | 2015-03-28T02:44:11.000Z | 2018-07-09T13:32:09.000Z | rezoirclogs/tests/test_utils.py | supelec-rezo/rezoirclogs | 2b84bfc80ba1f580d94b8bafb1a8abce8e3331ab | [
"0BSD"
] | null | null | null | rezoirclogs/tests/test_utils.py | supelec-rezo/rezoirclogs | 2b84bfc80ba1f580d94b8bafb1a8abce8e3331ab | [
"0BSD"
] | null | null | null | # -*- coding: utf-8 -*-
import unittest2
class ConvertUnknowEncodingTests(unittest2.TestCase):
def setUp(self):
self.unicode = u'pâté'
self.utf = 'p\xc3\xa2t\xc3\xa9'
self.latin = 'p\xe2t\xe9'
def test_utf8(self):
from rezoirclogs.utils import convert_unknow_encoding
self.assertEqual(self.unicode, convert_unknow_encoding(self.utf))
def test_latin(self):
from rezoirclogs.utils import convert_unknow_encoding
self.assertEqual(self.unicode, convert_unknow_encoding(self.latin))
class ParseLogLineTests(unittest2.TestCase):
def _get_FUT(self, *args, **kwargs):
from rezoirclogs.utils import LogLine
return LogLine(*args, **kwargs)
def test_normal(self):
lines = [("02:16 <ciblout> je suis secretaire, c'est moi qui decide", "normal", "je suis secretaire, c'est moi qui decide", 'ciblout', '02:16'),
("02:16:45 <ciblout> je suis secretaire, c'est moi qui decide", "normal", "je suis secretaire, c'est moi qui decide", 'ciblout', '02:16:45')]
for line, expected_type, expected_message, expected_nick, expected_time in lines:
m = self._get_FUT(line)
self.assertEqual(m.type, expected_type)
self.assertEqual(m.message, expected_message)
self.assertEqual(m.user, expected_nick)
self.assertEqual(m.time, expected_time)
self.assertEqual(str(m), line)
def test_normal_empty(self):
lines = ["02:16 <ciblout>",
"02:16:45 <ciblout>"]
for line in lines:
m = self._get_FUT(line)
self.assertEqual(m.type, "normal")
self.assertEqual(m.message, "")
def test_me(self):
lines = [("02:16 * ciblout dit encore des conneries", "me", "dit encore des conneries", 'ciblout', '02:16'),
("02:16:45 * ciblout dit encore des conneries", "me", "dit encore des conneries", 'ciblout', '02:16:45')]
for line, expected_type, expected_message, expected_nick, expected_time in lines:
m = self._get_FUT(line)
self.assertEqual(m.type, expected_type)
self.assertEqual(m.message, expected_message)
self.assertEqual(m.user, expected_nick)
self.assertEqual(m.time, expected_time)
self.assertEqual(str(m), line)
def test_me_empty(self):
lines = ["02:16 * ciblout",
"02:16:45 * ciblout"]
for line in lines:
m = self._get_FUT(line)
self.assertEqual(m.type, "me")
self.assertEqual(m.message, "")
def test_status(self):
lines = [("01:56 -!- ciblout [cyprien@mauvaise.foi] has quit [Quit: Bon debaras.]", "status", "[cyprien@mauvaise.foi] has quit [Quit: Bon debaras.]", 'ciblout', '01:56'),
("01:56:09 -!- ciblout [cyprien@mauvaise.foi] has quit [Quit: Bon debaras.]", "status", "[cyprien@mauvaise.foi] has quit [Quit: Bon debaras.]", 'ciblout', '01:56:09')]
for line, expected_type, expected_message, expected_nick, expected_time in lines:
m = self._get_FUT(line)
self.assertEqual(m.type, expected_type)
self.assertEqual(m.message, expected_message)
self.assertEqual(m.user, expected_nick)
self.assertEqual(m.time, expected_time)
self.assertEqual(str(m), line)
def test_status_empty(self):
lines = ["02:16 -!- ciblout",
"02:16:45 -!- ciblout"]
for line in lines:
m = self._get_FUT(line)
self.assertEqual(m.type, "status")
self.assertEqual(m.message, "")
def test_service(self):
lines = [("01:53 -ChanServ(services@services.rezosup.org)- Informations pour le canal #linux:", "service", "Informations pour le canal #linux:", 'ChanServ(services@services.rezosup.org)', '01:53'),
("01:53:09 -ChanServ(services@services.rezosup.org)- Informations pour le canal #linux:", "service", "Informations pour le canal #linux:", 'ChanServ(services@services.rezosup.org)', '01:53:09')]
for line, expected_type, expected_message, expected_nick, expected_time in lines:
m = self._get_FUT(line)
self.assertEqual(m.type, expected_type)
self.assertEqual(m.message, expected_message)
self.assertEqual(m.user, expected_nick)
self.assertEqual(m.time, expected_time)
self.assertEqual(str(m), line)
def test_service_empty(self):
lines = ["12:11 -ChanServ(services@services.rezosup.org)-",
"12:11:10 -ChanServ(services@services.rezosup.org)-"]
for line in lines:
m = self._get_FUT(line)
self.assertEqual(m.type, "service")
self.assertEqual(m.message, "")
def test_unrecognized(self):
m = self._get_FUT("Ceci n'est pas une ligne de log")
self.assertEqual(m.type, "unrecognized")
self.assertEqual(str(m), "Ceci n'est pas une ligne de log")
def test_exotic_nicknames(self):
lines = [("20:26 <K-Yo> madjar, \o/", "K-Yo"),
("22:14 <+K-Yo> putain, j'ai la même!", "K-Yo"),
("22:14 <@DaLynX> merci remram", "DaLynX"),
("04:54 <@Zertr1> derns!", "Zertr1"),
("04:54:00 <@Zertr1> derns!", "Zertr1"),
("01:59 < kage> c'est moche les GUI en java", "kage"),
("11:59 <~kage> c'est moche les GUI en java", "kage"),
("11:59 <%zeroNounours> test", "zeroNounours"),
("01:59 <&kage> c'est moche les GUI en java", "kage")]
for line, nick in lines:
self.assertEqual(self._get_FUT(line).user, nick, line)
class ColorationTests(unittest2.TestCase):
def test_colored(self):
from jinja2 import Markup
from rezoirclogs.utils import colored
self.assertEqual(colored('madjar'), Markup(u'<span style="color:#3176B3">madjar</span>'))
| 47.261905 | 211 | 0.610076 |
7953bbde05dc228b343f61c04715c5a90c2ad275 | 662 | py | Python | sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/input_port.py | dubiety/azure-sdk-for-python | 62ffa839f5d753594cf0fe63668f454a9d87a346 | [
"MIT"
] | 1 | 2022-02-01T18:50:12.000Z | 2022-02-01T18:50:12.000Z | sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/input_port.py | ellhe-blaster/azure-sdk-for-python | 82193ba5e81cc5e5e5a5239bba58abe62e86f469 | [
"MIT"
] | null | null | null | sdk/ml/azure-ai-ml/azure/ai/ml/entities/_job/input_port.py | ellhe-blaster/azure-sdk-for-python | 82193ba5e81cc5e5e5a5239bba58abe62e86f469 | [
"MIT"
] | null | null | null | # ---------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# ---------------------------------------------------------
import logging
from typing import Optional, Union
module_logger = logging.getLogger(__name__)
class InputPort:
def __init__(self, *, type_string: str, default: Optional[str] = None, optional: Optional[bool] = False):
self.type_string = type_string
self.optional = optional
if self.type_string == "number" and default is not None:
self.default: Union[float, Optional[str]] = float(default)
else:
self.default = default
| 34.842105 | 109 | 0.558912 |
7953bc222e4d786d37d258e0ecdda4841be9cf1f | 4,596 | py | Python | backend/app/app/api/api_v1/endpoints/users.py | totalhack/zillion-web | e567c04d3564aec8105d54533d318b79d943c9c6 | [
"MIT"
] | 3 | 2020-10-01T11:28:02.000Z | 2020-10-31T15:35:51.000Z | backend/app/app/api/api_v1/endpoints/users.py | totalhack/zillion-web | e567c04d3564aec8105d54533d318b79d943c9c6 | [
"MIT"
] | 1 | 2022-02-09T04:19:20.000Z | 2022-02-09T13:56:40.000Z | backend/app/app/api/api_v1/endpoints/users.py | totalhack/zillion-web | e567c04d3564aec8105d54533d318b79d943c9c6 | [
"MIT"
] | null | null | null | from typing import Any, List
from fastapi import APIRouter, Body, Depends, HTTPException
from fastapi.encoders import jsonable_encoder
from pydantic.networks import EmailStr
from sqlalchemy.orm import Session
from zillion.core import ZillionException
from app import crud, models, schemas
from app.api import deps
from app.core.config import settings
from app.utils import send_new_account_email
router = APIRouter()
@router.get("/", response_model=List[schemas.User])
def read_users(
db: Session = Depends(deps.get_db),
skip: int = 0,
limit: int = 100,
current_user: models.User = Depends(deps.get_current_active_superuser),
) -> Any:
"""
Retrieve users.
"""
users = crud.user.get_multi(db, skip=skip, limit=limit)
return users
@router.post("/", response_model=schemas.User)
def create_user(
*,
db: Session = Depends(deps.get_db),
user_in: schemas.UserCreate,
current_user: models.User = Depends(deps.get_current_active_superuser),
) -> Any:
"""
Create new user.
"""
user = crud.user.get_by_email(db, email=user_in.email)
if user:
raise HTTPException(
status_code=400,
detail="The user with this username already exists in the system.",
)
user = crud.user.create(db, obj_in=user_in)
if settings.EMAILS_ENABLED and user_in.email:
send_new_account_email(
email_to=user_in.email, username=user_in.email, password=user_in.password
)
return user
@router.put("/me", response_model=schemas.User)
def update_user_me(
*,
db: Session = Depends(deps.get_db),
password: str = Body(None),
full_name: str = Body(None),
email: EmailStr = Body(None),
current_user: models.User = Depends(deps.get_current_active_user),
) -> Any:
"""
Update own user.
"""
current_user_data = jsonable_encoder(current_user)
user_in = schemas.UserUpdate(**current_user_data)
if user_in.email.lower() == "demouser@example.com" and not crud.user.is_superuser(
current_user
):
raise ZillionException("Demo user can't be edited, silly!")
if password is not None:
user_in.password = password
if full_name is not None:
user_in.full_name = full_name
if email is not None:
user_in.email = email
user = crud.user.update(db, db_obj=current_user, obj_in=user_in)
return user
@router.get("/me", response_model=schemas.User)
def read_user_me(
db: Session = Depends(deps.get_db),
current_user: models.User = Depends(deps.get_current_active_user),
) -> Any:
"""
Get current user.
"""
return current_user
@router.post("/open", response_model=schemas.User)
def create_user_open(
*,
db: Session = Depends(deps.get_db),
password: str = Body(...),
email: EmailStr = Body(...),
full_name: str = Body(None),
) -> Any:
"""
Create new user without the need to be logged in.
"""
if not settings.USERS_OPEN_REGISTRATION:
raise HTTPException(
status_code=403, detail="Open user registration is forbidden on this server"
)
user = crud.user.get_by_email(db, email=email)
if user:
raise HTTPException(
status_code=400,
detail="The user with this username already exists in the system",
)
user_in = schemas.UserCreate(password=password, email=email, full_name=full_name)
user = crud.user.create(db, obj_in=user_in)
return user
@router.get("/{user_id}", response_model=schemas.User)
def read_user_by_id(
user_id: int,
current_user: models.User = Depends(deps.get_current_active_user),
db: Session = Depends(deps.get_db),
) -> Any:
"""
Get a specific user by id.
"""
user = crud.user.get(db, id=user_id)
if user == current_user:
return user
if not crud.user.is_superuser(current_user):
raise HTTPException(
status_code=400, detail="The user doesn't have enough privileges"
)
return user
@router.put("/{user_id}", response_model=schemas.User)
def update_user(
*,
db: Session = Depends(deps.get_db),
user_id: int,
user_in: schemas.UserUpdate,
current_user: models.User = Depends(deps.get_current_active_superuser),
) -> Any:
"""
Update a user.
"""
user = crud.user.get(db, id=user_id)
if not user:
raise HTTPException(
status_code=404,
detail="The user with this username does not exist in the system",
)
user = crud.user.update(db, db_obj=user, obj_in=user_in)
return user
| 29.088608 | 88 | 0.666232 |
7953bcf96883a33493e63a660dc5f1bba756371d | 951 | py | Python | tests/test_parser.py | mcnanna/ugali | 2572915b82af5b25e8762013e6d5baabdaa24b21 | [
"MIT"
] | 12 | 2016-10-26T20:45:33.000Z | 2021-11-24T04:07:43.000Z | tests/test_parser.py | mcnanna/ugali | 2572915b82af5b25e8762013e6d5baabdaa24b21 | [
"MIT"
] | 64 | 2017-04-14T15:04:24.000Z | 2022-02-03T19:42:57.000Z | tests/test_parser.py | kadrlica/ugali | dcf53594658a2b577f4da271783b43ed0a79fec9 | [
"MIT"
] | 12 | 2016-06-23T21:42:46.000Z | 2021-06-19T05:29:49.000Z | #!/usr/bin/env python
"""
Generic python script.
"""
__author__ = "Alex Drlica-Wagner"
import os
import ugali.utils.parser
import numpy as np
def test_targets():
test_data = \
"""#name lon lat radius coord
object_1 354.36 -63.26 1.0 CEL
object_2 19.45 -17.46 1.0 CEL
#object_3 18.94 -41.05 1.0 CEL
"""
with open('targets.txt','w') as f:
f.write(test_data)
parser = ugali.utils.parser.Parser()
parser.add_coords(targets=True)
args = parser.parse_args(['-t','targets.txt'])
np.testing.assert_array_almost_equal(args.coords['lon'],[316.311,156.487],
decimal=3)
np.testing.assert_array_almost_equal(args.coords['lat'],[-51.903,-78.575],
decimal=3)
np.testing.assert_array_almost_equal(args.coords['radius'],[1.0,1.0],
decimal=3)
os.remove('targets.txt')
return args
| 28.818182 | 78 | 0.587802 |
7953bd27e6aebf68c650d855505173b03892fda8 | 2,467 | py | Python | ufff/metadata.py | fiwippi/ufff | cbf762cd5db8165e5ab008b43f09c60384dc6a25 | [
"MIT"
] | null | null | null | ufff/metadata.py | fiwippi/ufff | cbf762cd5db8165e5ab008b43f09c60384dc6a25 | [
"MIT"
] | null | null | null | ufff/metadata.py | fiwippi/ufff | cbf762cd5db8165e5ab008b43f09c60384dc6a25 | [
"MIT"
] | null | null | null | from utils import parse_year
def fix_index(item):
try:
if len(item) > 0:
return item[0]
except TypeError: # raised by TDRC
return item
def retrieve_metadata(mutagen_file, filename):
# Album artist
album_artist = mutagen_file.get("albumartist")
if album_artist == None:
album_artist = mutagen_file.get("TPE2")
if album_artist == None:
album_artist = mutagen_file.get('aART')
if album_artist == None:
album_artist = mutagen_file.get('ALBUM ARTIST')
album_artist = fix_index(album_artist)
# Year
date = mutagen_file.get("date", None)
if date == None:
date = mutagen_file.get("TDRC", None)
if date == None:
try:
date = mutagen_file.get("\xa9day", None)
except ValueError: # For Ogg Opus files
pass
if date == None:
date = mutagen_file.get('DATE') # TODO ensure discovery date exists
if date != None:
date = parse_year(str(fix_index(date)))
else:
print(f"No date loaded for: {filename}")
date = ""
# Codec
codec = type(mutagen_file).__name__
if codec == "MP4":
codec = "M4A"
if codec == "WAVE":
codec = "WAV"
if codec == "OggOpus":
codec = "OPUS"
# Album
album = mutagen_file.get("album")
if album == None:
album = mutagen_file.get("TALB")
if album == None:
album = mutagen_file.get("\xa9alb") # ©alb
if album == None:
album = mutagen_file.get("ALBUM") # ©alb
album = fix_index(album)
# Title
title = mutagen_file.get("title")
if title == None:
title = mutagen_file.get("TIT2")
if title == None:
title = mutagen_file.get("\xa9nam") # ©nam
if title == None:
title = mutagen_file.get("TITLE")
title = fix_index(title)
# Track Number
tracknum = mutagen_file.get("tracknumber")
if tracknum == None:
tracknum = mutagen_file.get("TRCK")
if tracknum == None:
tracknum = mutagen_file.get("trkn")
tracknum = fix_index(tracknum)
if tracknum != None:
if codec == "M4A":
tracknum = tracknum[0]
tracknum = str(tracknum).zfill(2)
else:
print(f"No track number loaded for: {filename}")
return album, album_artist, str(date), codec, title, tracknum | 30.45679 | 83 | 0.561411 |
7953bdd60f9a319ae5258cec4b0507c261ee990f | 2,772 | py | Python | sagas/tests/sinkers/test_descriptor.py | samlet/stack | 47db17fd4fdab264032f224dca31a4bb1d19b754 | [
"Apache-2.0"
] | 3 | 2020-01-11T13:55:38.000Z | 2020-08-25T22:34:15.000Z | sagas/tests/sinkers/test_descriptor.py | samlet/stack | 47db17fd4fdab264032f224dca31a4bb1d19b754 | [
"Apache-2.0"
] | null | null | null | sagas/tests/sinkers/test_descriptor.py | samlet/stack | 47db17fd4fdab264032f224dca31a4bb1d19b754 | [
"Apache-2.0"
] | 1 | 2021-01-01T05:21:44.000Z | 2021-01-01T05:21:44.000Z | """
$ pytest -s -v test_descriptor.py
"""
import logging
import pytest
from sagas.nlu.descriptor import Descriptor
def test_descriptor():
import sagas.nlu.descriptor
sagas.nlu.descriptor.logger.setLevel(logging.DEBUG)
# $ str 'Rezervasyonumu onaylamak istiyorum.'
results = [{'delivery': 'sentence',
'inspector': 'specs_of',
'part': 'verb:_',
'pattern': 'behave {verb.obj:cat} for {verb.obj.obj:cat}, modal '
'{verb._:cat}, personal {verb._:personal}',
'provider': 'default',
'value': {'category': 'request',
'pos': 'v',
'subs': [{'candidates': 'request',
'substitute': 'request',
'word': 'iste'}],
'words': ['istiyorum/iste']}},
{'delivery': 'slot',
'inspector': 'pipes',
'part': 'verb:obj/obj',
'pattern': 'behave {verb.obj:cat} for {verb.obj.obj:cat}, modal '
'{verb._:cat}, personal {verb._:personal}',
'provider': 'cat/cat_proc',
'value': [{'cat': 'reservation',
'path': '/obj/obj',
'pos': 'noun',
'trans': 'reservation',
'value': 'reservation',
'word': 'rezervasyon'}]},
{'delivery': 'sentence',
'inspector': 'kind_of',
'part': 'verb:obj',
'pattern': 'behave {verb.obj:cat} for {verb.obj.obj:cat}, modal '
'{verb._:cat}, personal {verb._:personal}',
'provider': 'default',
'value': {'category': 'approve', 'pos': '*', 'word': 'onaylamak/onayla'}},
{'delivery': 'slot',
'inspector': 'extract_comps',
'part': 'verb:_',
'pattern': 'behave {verb.obj:cat} for {verb.obj.obj:cat}, modal '
'{verb._:cat}, personal {verb._:personal}',
'provider': 'feats',
'value': [{'Aspect': 'Prog',
'Mood': 'Ind',
'Number': 'Sing',
'Person': '1',
'Polarity': 'Pos',
'Polite': 'Infm',
'Tense': 'Pres'}]}]
dsp=Descriptor()
patt='behave {verb.obj:cat} for {verb.obj.obj:cat},' \
' modal {verb._:cat}, personal {verb._:personal}'
assert dsp.render(patt, results)=='behave approve for reservation, modal request, personal 1_Sing'
| 42.646154 | 102 | 0.426407 |
7953bde9c4a76d07f9647e38085aa37988917db5 | 821 | py | Python | tests/python/twitter/common/concurrent/test_concurrent.py | zhouyijiaren/commons | 10df6fb63547baa9047782aa7ad4edf354914b10 | [
"Apache-2.0"
] | 1,143 | 2015-01-05T04:19:24.000Z | 2019-12-11T12:02:23.000Z | tests/python/twitter/common/concurrent/test_concurrent.py | zhouyijiaren/commons | 10df6fb63547baa9047782aa7ad4edf354914b10 | [
"Apache-2.0"
] | 144 | 2015-01-06T05:05:07.000Z | 2019-12-12T18:02:37.000Z | tests/python/twitter/common/concurrent/test_concurrent.py | zhouyijiaren/commons | 10df6fb63547baa9047782aa7ad4edf354914b10 | [
"Apache-2.0"
] | 426 | 2015-01-08T08:33:41.000Z | 2019-12-09T13:15:40.000Z | import time
from functools import partial
try:
from Queue import Queue
except ImportError:
from queue import Queue
import pytest
from twitter.common.concurrent import deadline, defer, Timeout
from twitter.common.contextutil import Timer
def test_deadline_default_timeout():
timeout = partial(time.sleep, 0.5)
with pytest.raises(Timeout):
deadline(timeout)
def test_deadline_custom_timeout():
timeout = partial(time.sleep, 0.2)
with pytest.raises(Timeout):
deadline(timeout, 0.1)
def test_deadline_no_timeout():
assert 'success' == deadline(lambda: 'success')
def test_defer():
DELAY = 0.5
results = Queue(maxsize=1)
def func():
results.put_nowait('success')
defer(func, delay=DELAY)
with Timer() as timer:
assert results.get() == 'success'
assert timer.elapsed >= DELAY
| 21.605263 | 62 | 0.735688 |
7953bdf6d4ba4d8a6d5b2fbc3caa1ea8192e4f63 | 6,110 | py | Python | salt/output/highstate.py | mimianddaniel/booksalt | 248c2349fd9a6edc30d48d11673ab72bed4583ce | [
"Apache-2.0"
] | 1 | 2015-10-06T22:25:22.000Z | 2015-10-06T22:25:22.000Z | salt/output/highstate.py | mika/salt-deb | 7a6933c751273f627259581cb80de66d289bc8c4 | [
"Apache-2.0"
] | null | null | null | salt/output/highstate.py | mika/salt-deb | 7a6933c751273f627259581cb80de66d289bc8c4 | [
"Apache-2.0"
] | null | null | null | '''
The return data from the Highstate command is a standard data structure
which is parsed by the highstate outputter to deliver a clean and readable
set of information about the HighState run on minions.
Two configurations can be set to modify the highstate outputter. These values
can be set in the master config to change the output of the ``salt`` command or
set in the minion config to change the output of the ``salt-call`` command.
state_verbose:
By default `state_verbose` is set to `True`, setting this to `False` will
instruct the highstate outputter to omit displaying anything in green, this
means that nothing with a result of True and no changes will not be printed
state_output:
The highstate outputter has two output modes, `full` and `terse`. The
default is set to full, which will display many lines of detailed
information for each executed chunk. If the `state_output` option is
set to `terse` then the output is greatly simplified and shown in only one
line
'''
# Import python libs
import pprint
# Import salt libs
import salt.utils
from salt._compat import string_types
def output(data):
'''
The HighState Outputter is only meant to
be used with the state.highstate function, or a function that returns
highstate return data.
'''
colors = salt.utils.get_colors(__opts__.get('color'))
for host in data:
hcolor = colors['GREEN']
hstrs = []
if isinstance(data[host], list):
# Errors have been detected, list them in RED!
hcolor = colors['RED_BOLD']
hstrs.append((' {0}Data failed to compile:{1[ENDC]}'
.format(hcolor, colors)))
for err in data[host]:
hstrs.append(('{0}----------\n {1}{2[ENDC]}'
.format(hcolor, err, colors)))
if isinstance(data[host], dict):
# Strip out the result: True, without changes returns if
# state_verbose is False
if not __opts__.get('state_verbose', False):
data[host] = _strip_clean(data[host])
# Verify that the needed data is present
for tname, info in data[host].items():
if not '__run_num__' in info:
err = ('The State execution failed to record the order '
'in which all states were executed. The state '
'return missing data is:')
hstrs.insert(0, pprint.pformat(info))
hstrs.insert(0, err)
# Everything rendered as it should display the output
for tname in sorted(
data[host],
key=lambda k: data[host][k].get('__run_num__', 0)):
ret = data[host][tname]
tcolor = colors['GREEN']
if ret['changes']:
tcolor = colors['CYAN']
if ret['result'] is False:
hcolor = colors['RED']
tcolor = colors['RED']
if ret['result'] is None:
hcolor = colors['YELLOW']
tcolor = colors['YELLOW']
comps = tname.split('_|-')
if __opts__.get('state_output', 'full').lower() == 'terse':
# Print this chunk in a terse way and continue in the
# loop
msg = (' {0}Name: {1} - Function: {2} - Result: {3}{4}'
).format(
tcolor,
comps[2],
comps[-1],
str(ret['result']),
colors['ENDC']
)
hstrs.append(msg)
continue
hstrs.append(('{0}----------\n State: - {1}{2[ENDC]}'
.format(tcolor, comps[0], colors)))
hstrs.append(' {0}Name: {1}{2[ENDC]}'.format(
tcolor,
comps[2],
colors
))
hstrs.append(' {0}Function: {1}{2[ENDC]}'.format(
tcolor,
comps[-1],
colors
))
hstrs.append(' {0}Result: {1}{2[ENDC]}'.format(
tcolor,
str(ret['result']),
colors
))
hstrs.append(' {0}Comment: {1}{2[ENDC]}'.format(
tcolor,
ret['comment'],
colors
))
changes = ' Changes: '
for key in ret['changes']:
if isinstance(ret['changes'][key], string_types):
changes += (key + ': ' + ret['changes'][key] +
'\n ')
elif isinstance(ret['changes'][key], dict):
changes += (key + ': ' +
pprint.pformat(ret['changes'][key]) +
'\n ')
else:
changes += (key + ': ' +
pprint.pformat(ret['changes'][key]) +
'\n ')
hstrs.append(('{0}{1}{2[ENDC]}'
.format(tcolor, changes, colors)))
hstrs.insert(0, ('{0}{1}:{2[ENDC]}'.format(hcolor, host, colors)))
return '\n'.join(hstrs)
def _strip_clean(returns):
'''
Check for the state_verbose option and strip out the result=True
and changes={} members of the state return list.
'''
rm_tags = []
for tag in returns:
if returns[tag]['result'] and not returns[tag]['changes']:
rm_tags.append(tag)
for tag in rm_tags:
returns.pop(tag)
return returns
| 42.430556 | 79 | 0.470213 |
7953bff17bc48695f53d399470fe8d6c06f18d89 | 3,992 | py | Python | var/spack/repos/builtin/packages/caffe/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 3 | 2021-09-29T02:14:40.000Z | 2022-01-27T20:50:36.000Z | var/spack/repos/builtin/packages/caffe/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | 4 | 2022-02-28T11:32:57.000Z | 2022-03-02T11:37:37.000Z | var/spack/repos/builtin/packages/caffe/package.py | player1537-forks/spack | 822b7632222ec5a91dc7b7cda5fc0e08715bd47c | [
"ECL-2.0",
"Apache-2.0",
"MIT-0",
"MIT"
] | null | null | null | # Copyright 2013-2022 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class Caffe(CMakePackage, CudaPackage):
"""Caffe is a deep learning framework made with expression, speed, and
modularity in mind. It is developed by the Berkeley Vision and Learning
Center (BVLC) and by community contributors."""
homepage = "https://caffe.berkeleyvision.org"
url = "https://github.com/BVLC/caffe/archive/1.0.tar.gz"
version('1.0', sha256='71d3c9eb8a183150f965a465824d01fe82826c22505f7aa314f700ace03fa77f')
version('rc5', sha256='06592aa8f5254335df3e244dafacc15765e2c60479b4bf2e7c887e8e023802fb')
version('rc4', sha256='018792411d75ee34b6107216550cca2a1d668d45cb366033ba3c647e6a3018df')
version('rc3', sha256='0884207bfba0fbc8b263b87d30f9304f7094eec3a48f975177d142f8c72b6e3b')
version('rc2', sha256='55c9c20870b30ce398e19e4f1a62ade1eff08fce51e28fa5604035b711978eec')
variant('cuda', default=False,
description='Builds with support for GPUs via CUDA and cuDNN')
variant('opencv', default=True,
description='Build with OpenCV support')
variant('leveldb', default=True,
description="Build with levelDB")
variant('lmdb', default=True,
description="Build with lmdb")
variant('python', default=False,
description='Build python wrapper and caffe python layer')
variant('matlab', default=False,
description='Build Matlab wrapper')
depends_on('boost')
depends_on('boost +python', when='+python')
depends_on('cuda', when='+cuda')
depends_on('blas')
depends_on('protobuf@:3.17')
depends_on('glog')
depends_on('gflags')
depends_on('hdf5 +hl +cxx')
# Optional dependencies
depends_on('opencv@:3+highgui+imgproc+imgcodecs', when='+opencv')
depends_on('leveldb', when='+leveldb')
depends_on('lmdb', when='+lmdb')
depends_on('python@2.7:', when='+python')
depends_on('py-numpy@1.7:', when='+python', type=('build', 'run'))
depends_on('matlab', when='+matlab')
extends('python', when='+python')
def cmake_args(self):
spec = self.spec
args = ['-DBLAS={0}'.format('open' if spec['blas'].name == 'openblas'
else spec['blas'].name),
'-DCPU_ONLY=%s' % ('~cuda' in spec),
'-DUSE_CUDNN=%s' % ('+cuda' in spec),
'-DBUILD_python=%s' % ('+python' in spec),
'-DBUILD_python_layer=%s' % ('+python' in spec),
'-DBUILD_matlab=%s' % ('+matlab' in spec),
'-DUSE_OPENCV=%s' % ('+opencv' in spec),
'-DUSE_LEVELDB=%s' % ('+leveldb' in spec),
'-DUSE_LMDB=%s' % ('+lmdb' in spec),
'-DGFLAGS_ROOT_DIR=%s' % spec['gflags'].prefix,
'-DGLOG_ROOT_DIR=%s' % spec['glog'].prefix,
]
if spec.satisfies('^openblas'):
env['OpenBLAS_HOME'] = spec['openblas'].prefix
if spec.satisfies('+lmdb'):
env['LMDB_DIR'] = spec['lmdb'].prefix
if spec.satisfies('+leveldb'):
env['LEVELDB_ROOT'] = spec['leveldb'].prefix
if spec.satisfies('+python'):
version = spec['python'].version.up_to(1)
args.append('-Dpython_version=%s' % version)
if spec['hdf5'].satisfies('+mpi'):
args.extend([
'-DCMAKE_C_COMPILER={0}'.format(self.spec['mpi'].mpicc),
'-DCMAKE_CXX_COMPILER={0}'.format(self.spec['mpi'].mpicxx)
])
if '+cuda' in spec:
if spec.variants['cuda_arch'].value[0] != 'none':
cuda_arch = spec.variants['cuda_arch'].value
args.append(self.define('CUDA_ARCH_NAME', 'Manual'))
args.append(self.define('CUDA_ARCH_BIN', ' '.join(cuda_arch)))
return args
| 41.154639 | 93 | 0.612475 |
7953c0fb5bca4023d397ceccfb6f54e0dc0d47db | 3,075 | py | Python | tests/bugs/gh_6788_test.py | FirebirdSQL/firebird-qa | 96af2def7f905a06f178e2a80a2c8be4a4b44782 | [
"MIT"
] | 1 | 2022-02-05T11:37:13.000Z | 2022-02-05T11:37:13.000Z | tests/bugs/gh_6788_test.py | FirebirdSQL/firebird-qa | 96af2def7f905a06f178e2a80a2c8be4a4b44782 | [
"MIT"
] | 1 | 2021-09-03T11:47:00.000Z | 2021-09-03T12:42:10.000Z | tests/bugs/gh_6788_test.py | FirebirdSQL/firebird-qa | 96af2def7f905a06f178e2a80a2c8be4a4b44782 | [
"MIT"
] | 1 | 2021-06-30T14:14:16.000Z | 2021-06-30T14:14:16.000Z | #coding:utf-8
#
# id: bugs.gh_6788
# title: Extend EXTRACT to extract time zone strings
# decription:
# https://github.com/FirebirdSQL/firebird/issues/6788
#
# Commit ('master' only; not 4.0!):
# https://github.com/FirebirdSQL/firebird/commit/a02f0dea8163de64caa13c9a8637fa28eea0e9d3
#
# Checked on intermediate build 4.0.0.2452 (timestamp: 03-may-2021 14:48).
#
# tracker_id:
# min_versions: ['5.0']
# versions: 5.0
# qmid: None
import pytest
from firebird.qa import db_factory, isql_act, Action
# version: 5.0
# resources: None
substitutions_1 = [('[ \t]+', ' ')]
init_script_1 = """"""
db_1 = db_factory(sql_dialect=3, init=init_script_1)
test_script_1 = """
set list on;
-- Examples from ticket:
select extract(timezone_name from timestamp '2021-05-03 10:00 America/Sao_Paulo') as tz_info1 from rdb$database; -- America/Sao_Paulo
select extract(timezone_name from timestamp '2021-05-03 10:00 -3:00') as tz_info2 from rdb$database; -- -03:00
--================================
-- Additional check.
-- Every record of RDB$TIME_ZONE table must have value in 'rdb$time_zone_name' column
-- that can be extracted correctly and result must be exactly this value.
-- Spaces between date/time and timezone_name are intentionally replaced with chr(9) sequences
-- (to make parser life more harder :)).
set term ^;
create or alter procedure sp_get_tz_name returns(tz_name rdb$time_zone_name ) as
declare v_stt varchar(255);
begin
for
select z.rdb$time_zone_name from rdb$time_zones z -- 4debug: where z.rdb$time_zone_name <> 'America/Sao_Paulo'
as cursor c
do begin
v_stt = 'extract(timezone_name from timestamp ''2021-05-03'|| lpad('',15,ascii_char(9)) || '10:00' || lpad('', 150, ascii_char(9)) || trim(c.rdb$time_zone_name) || ''')';
execute statement 'select ' || v_stt || ' from rdb$database' into tz_name;
suspend;
end
end
^
set term ;^
commit;
-- Following query must always return empty resultset (0 rows).
-- Otherwise we can conclude that EXTRACT(TIMEZONE_NAME ...) fails
-- for some argument from rdb$time_zones table:
select tz_name, iif(min(i)=1,1,null) as "found_in_rdb$time_zones", iif(max(i)=2, 1, null) as "correctly_extracted_in_sp"
from (
select z.rdb$time_zone_name as tz_name, 1 as i
from rdb$time_zones z
union all
select p.tz_name, 2 as i
from sp_get_tz_name p
)
group by tz_name
having min(i) is distinct from 1 or max(i) is distinct from 2;
"""
act_1 = isql_act('db_1', test_script_1, substitutions=substitutions_1)
expected_stdout_1 = """
TZ_INFO1 America/Sao_Paulo
TZ_INFO2 -03:00
"""
@pytest.mark.version('>=5.0')
def test_1(act_1: Action):
act_1.expected_stdout = expected_stdout_1
act_1.execute()
assert act_1.clean_stdout == act_1.clean_expected_stdout
| 35.755814 | 178 | 0.642276 |
7953c1854ed2fa897943f084a371ada2d7bc737e | 2,089 | py | Python | setup.py | elpatiostudio/wagtail-localize | 19820ecc914651d9041d4604e3d311dd75cf4e81 | [
"BSD-3-Clause"
] | null | null | null | setup.py | elpatiostudio/wagtail-localize | 19820ecc914651d9041d4604e3d311dd75cf4e81 | [
"BSD-3-Clause"
] | null | null | null | setup.py | elpatiostudio/wagtail-localize | 19820ecc914651d9041d4604e3d311dd75cf4e81 | [
"BSD-3-Clause"
] | null | null | null | #!/usr/bin/env python
from os import path
from setuptools import find_packages, setup
this_directory = path.abspath(path.dirname(__file__))
version = {}
with open(path.join(this_directory, "wagtail_localize", "version.py")) as f:
exec(f.read(), version)
with open(path.join(this_directory, "README.md"), encoding="utf-8") as f:
long_description = f.read()
setup(
name="wagtail-localize",
version=version["__version__"],
description="Translation plugin for Wagtail CMS",
long_description=long_description,
long_description_content_type="text/markdown",
author="Karl Hobley",
author_email="karl@torchbox.com",
url="https://www.wagtail-localize.org",
packages=find_packages(),
include_package_data=True,
license="BSD",
classifiers=[
"Development Status :: 4 - Beta",
"Intended Audience :: Developers",
"License :: OSI Approved :: BSD License",
"Operating System :: OS Independent",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Framework :: Django",
"Framework :: Django :: 2.2",
"Framework :: Django :: 3.2",
"Framework :: Django :: 4.0",
"Framework :: Wagtail",
"Framework :: Wagtail :: 2",
],
install_requires=[
"Django>=2.2,<4.1",
"Wagtail>=2.11,<2.17",
"polib>=1.1,<2.0",
"typing_extensions>=4.0",
],
extras_require={
"testing": [
"dj-database-url==0.5.0",
"freezegun==1.1.0",
"django-rq>=2.5,<3.0",
],
"documentation": [
"mkdocs==1.1.2",
"mkdocs-material==6.2.8",
"mkdocs-mermaid2-plugin==0.5.1",
"mkdocstrings==0.14.0",
"mkdocs-include-markdown-plugin==2.8.0",
"pygments==2.11.2",
],
},
zip_safe=False,
)
| 29.842857 | 76 | 0.571087 |
7953c26495ad52cf686e9b70a7a0af0394b3da28 | 6,772 | py | Python | config.py | php-tailors/docker-doctum | 29399b3b11e7afe2cdff9ca16374e6947428967e | [
"Unlicense"
] | null | null | null | config.py | php-tailors/docker-doctum | 29399b3b11e7afe2cdff9ca16374e6947428967e | [
"Unlicense"
] | 4 | 2020-12-09T16:50:13.000Z | 2020-12-30T17:52:08.000Z | config.py | php-tailors/docker-doctum | 29399b3b11e7afe2cdff9ca16374e6947428967e | [
"Unlicense"
] | null | null | null | import re
__version__ = '0.6.1'
def xrepr(arg):
if isinstance(arg, str):
return "'%s'" % arg
else:
return repr(arg)
def generated_warning():
return """\
#############################################################################
# NOTE: FILE GENERATED AUTOMATICALLY, DO NOT EDIT!!!
#############################################################################
"""
def doctum_params(ver, php):
"""Configuration parameters for doctum with their default values"""
return {'DOCTUM_WORKDIR': '/code',
'DOCTUM_CONFIG': '/etc/doctum/doctum.conf.php',
'DOCTUM_PROJECT_TITLE': 'API Documentation',
'DOCTUM_SOURCE_DIR': 'src',
'DOCTUM_BUILD_DIR': 'docs/build/html/api',
'DOCTUM_CACHE_DIR': 'docs/cache/html/api',
'DOCTUM_FLAGS': '-v --force --ignore-parse-errors',
'DOCTUM_SERVER_PORT': 8001,
'DOCTUM_SOURCE_REGEX': r'\.\(php\|txt\|rst\)$',
'DOCTUM_THEME': 'default',
'DOCTUM_PHAR_URL': doctum_phar_url(ver),
'DOCTUM_PHAR_SHA256_URL': doctum_phar_sha256_url(ver)}
def doctum_runtime_params(ver, php):
"""Configuration parameters that may be modified at runtime"""
items = doctum_params(ver, php).items()
exclude = set([
'DOCTUM_WORKDIR',
'DOCTUM_SERVER_PORT',
'DOCTUM_VERSION',
'DOCTUM_PHAR_URL',
'DOCTUM_PHAR_SHA256_URL',
])
return {k: v for (k, v) in items if k not in exclude}
def doctum_env_defaults_str(ver, php):
items = doctum_runtime_params(ver, php).items()
return '\n'.join(("DEFAULT_%s=%s" % (k, xrepr(v)) for k, v in items))
def doctum_env_settings_str(ver, php):
params = list(doctum_runtime_params(ver, php))
return '\n'.join(('export %s=${%s-$DEFAULT_%s}' % (k, k, k) for k in params))
def doctum_versions(php):
versions = [ ver for (ver, p) in matrix if p == php ]
return sorted(list(set(versions)))
def php_versions(ver):
versions = [ php for (v, php) in matrix if v == ver ]
return sorted(list(set(versions)))
def doctum_phar_url(ver):
return doctum_releases[ver]['downloads']['phar']
def doctum_phar_sha256_url(ver):
return doctum_releases[ver]['downloads']['phar_sha256']
def docker_doctum_args_str(ver, php):
items = doctum_params(ver, php).items()
return '\n'.join(('ARG %s=%s' % (k, xrepr(v)) for k, v in items))
def docker_doctum_env_str(ver, php):
params = list(doctum_runtime_params(ver, php))
return 'ENV ' + ' \\\n '.join(('%s=$%s' % (k, k) for k in params))
def tag_aliases(ver, php):
aliases = []
maj = make_tag(ver.split('.')[0])
if doctum_versions(php)[-1] == ver:
aliases.append(make_tag(maj, php))
aliases.append(make_tag('latest', php))
if php_versions(ver)[-1] == php:
aliases.append(make_tag(ver))
if doctum_versions(php)[-1] == ver:
aliases.append(make_tag(maj))
aliases.append(make_tag('latest'))
return aliases
def microbadges_str_for_tag(tag):
name = 'phptailors/doctum:%(tag)s' % locals()
url1 = 'https://images.microbadger.com/badges'
url2 = 'https://microbadger.com/images/%(name)s' % locals()
return "\n".join([
'[s/version/%(name)s.svg)](%(url2)s "%(name)s")' % locals(),
'[s/image/%(name)s.svg)](%(url2)s "Docker image size")' % locals(),
'[s/commit/%(name)s.svg)](%(url2)s "Source code")' % locals()
])
def microbadges_str_for_tags(tags):
return '- ' + "\n- ".join(reversed([microbadges_str_for_tag(tag) for tag in tags]))
def microbadges_str(matrix):
lines = []
for (ver, php) in reversed(matrix):
lines.append("")
lines.append("### %s" % make_tag(ver, php))
lines.append("")
tag = context_tag(ver, php)
lines.append(microbadges_str_for_tag(tag))
aliases = tag_aliases(ver, php)
if aliases:
lines.append("")
lines.append("- **aliases**: %s" % ', '.join(aliases))
lines.append("")
return "\n".join(lines)
def make_tag(ver=None, php=None, sep='-'):
if php is not None and not php.startswith('php'):
php = 'php%s' % php
return sep.join([x for x in (ver, php) if x is not None])
def context_tag(ver, php):
return make_tag(ver, php, '-')
def context_tags(ver, php):
return [context_tag(ver, php)] + tag_aliases(ver, php)
def context_dir(ver, php):
return make_tag(ver, php, '/')
def context_from_tag(php, os, sep='-'):
return sep.join((php, os))
def context_files(ver, php):
return {'Dockerfile.in': 'Dockerfile',
'etc/doctum/doctum.conf.php.in': 'etc/doctum/doctum.conf.php',
'bin/autobuild.in': 'bin/autobuild',
'bin/autoserve.in': 'bin/autoserve',
'bin/build.in': 'bin/build',
'bin/build_once.in': 'bin/build_once',
'bin/doctum-defaults.in': 'bin/doctum-defaults',
'bin/doctum-entrypoint.in': 'bin/doctum-entrypoint',
'bin/doctum-env.in': 'bin/doctum-env',
'bin/serve.in': 'bin/serve',
'hooks/build.in': 'hooks/build'}
def common_subst():
return {'GENERATED_WARNING': generated_warning(),
'VERSION': __version__}
def context_subst(ver, php):
return dict(common_subst(), **dict({
'DOCTUM_ENV_DEFAULTS': doctum_env_defaults_str(ver, php),
'DOCTUM_ENV_SETTINGS': doctum_env_settings_str(ver, php),
'DOCKER_FROM_TAG': context_from_tag(php, 'alpine'),
'DOCKER_DOCTUM_ARGS': docker_doctum_args_str(ver, php),
'DOCKER_DOCTUM_ENV': docker_doctum_env_str(ver, php),
}, **doctum_params(ver, php)))
def global_subst():
return dict(common_subst(), **dict({
'MICROBADGES': microbadges_str(matrix)
}))
def context(ver, php):
return {'dir': context_dir(ver, php),
'files': context_files(ver, php),
'subst': context_subst(ver, php)}
# each tuple in matrix is:
#
# ( doctum-version, php-version )
#
matrix = [
('5.3', '7.2'),
('5.3', '7.3'),
('5.3', '7.4'),
]
doctum_releases = {
'5.3': {
'downloads': {
'phar': 'https://github.com/code-lts/doctum/releases/download/v5.3.1/doctum.phar',
'phar_sha256': 'https://github.com/code-lts/doctum/releases/download/v5.3.1/doctum.phar.sha256',
'phar_asc': 'https://github.com/code-lts/doctum/releases/download/v5.3.1/doctum.phar.asc',
'phar_sha256_asc': 'https://github.com/code-lts/doctum/releases/download/v5.3.1/doctum.phar.sha256.asc',
}
}
}
contexts = [ context(ver, php) for (ver, php) in matrix ]
files = { 'README.md.in': 'README.md' }
subst = global_subst()
| 31.793427 | 116 | 0.591258 |
7953c35812ea942fed41ad3112f7e3abc06cfd45 | 2,768 | py | Python | test/mixins/test_delete_objects.py | newsgac/newsgac | 7503783521afd6fb755fef164ec7e8660955a783 | [
"Apache-2.0"
] | 3 | 2019-04-05T13:40:12.000Z | 2019-08-01T10:51:40.000Z | test/mixins/test_delete_objects.py | newsgac/newsgac | 7503783521afd6fb755fef164ec7e8660955a783 | [
"Apache-2.0"
] | 143 | 2018-12-18T10:38:16.000Z | 2022-03-21T19:02:48.000Z | test/mixins/test_delete_objects.py | Tommos0/newsgac | 7503783521afd6fb755fef164ec7e8660955a783 | [
"Apache-2.0"
] | 1 | 2020-01-23T09:19:49.000Z | 2020-01-23T09:19:49.000Z | import pytest
from pymodm import MongoModel, fields, EmbeddedMongoModel
from pymodm.connection import _get_db
from newsgac.common.fields import ObjectField
from newsgac.common.mixins import CreatedUpdated, DeleteObjectsMixin
@pytest.fixture(autouse=True)
def setup_db(db):
# drops whole db
for collection_name in db.list_collection_names():
db[collection_name].drop()
class EmbeddedModelWithObjectField(EmbeddedMongoModel):
data = ObjectField()
class ModelWithObjectField(CreatedUpdated, DeleteObjectsMixin, MongoModel):
data = ObjectField()
embed = fields.EmbeddedDocumentField(EmbeddedModelWithObjectField)
created = fields.DateTimeField()
updated = fields.DateTimeField()
def test_delete_objects():
m = ModelWithObjectField()
m.data = "some object"
m.embed = EmbeddedModelWithObjectField(data="some embedded object")
m.save()
db = _get_db()
if not db['fs.files'].count_documents({}) == 2: raise AssertionError()
if not db['fs.chunks'].count_documents({}) == 2: raise AssertionError()
if not ModelWithObjectField.objects.count() == 1: raise AssertionError()
m.delete()
if not db['fs.files'].count_documents({}) == 0: raise AssertionError()
if not db['fs.chunks'].count_documents({}) == 0: raise AssertionError()
if not ModelWithObjectField.objects.count() == 0: raise AssertionError()
def test_objects_are_cleaned_up_when_saved():
m = ModelWithObjectField()
m.data = "some object"
m.embed = EmbeddedModelWithObjectField(data="some embedded object")
m.save()
db = _get_db()
if not db['fs.files'].count_documents({}) == 2: raise AssertionError()
if not db['fs.chunks'].count_documents({}) == 2: raise AssertionError()
if not ModelWithObjectField.objects.count() == 1: raise AssertionError()
m.save()
if not db['fs.files'].count_documents({}) == 2: raise AssertionError()
if not db['fs.chunks'].count_documents({}) == 2: raise AssertionError()
if not ModelWithObjectField.objects.count() == 1: raise AssertionError()
def test_objects_are_not_cloned_up_when_model_gets_serialized():
m = ModelWithObjectField()
m.data = "some object"
m.embed = EmbeddedModelWithObjectField(data="some embedded object")
m.embed.data = "asdasd"
m.save()
m.data = "some object2"
m.embed.data = "asdasd"
m.save()
m.save()
m.embed.data = "asdasd"
m.to_son()
m.data = "some object3"
m.to_son()
m.embed.data = "asdasd1"
m.save()
m.delete()
db = _get_db()
if not 0 == db['fs.files'].count_documents({}): raise AssertionError()
if not 0 == db['fs.chunks'].count_documents({}): raise AssertionError()
if not 0 == ModelWithObjectField.objects.count(): raise AssertionError()
| 35.948052 | 76 | 0.699061 |
7953c476e8e42c20de0cc219494b8c2c5c79522f | 5,324 | py | Python | heat/tests/aws/test_network_interface.py | maestro-hybrid-cloud/heat | 91a4bb3170bd81b1c67a896706851e55709c9b5a | [
"Apache-2.0"
] | null | null | null | heat/tests/aws/test_network_interface.py | maestro-hybrid-cloud/heat | 91a4bb3170bd81b1c67a896706851e55709c9b5a | [
"Apache-2.0"
] | null | null | null | heat/tests/aws/test_network_interface.py | maestro-hybrid-cloud/heat | 91a4bb3170bd81b1c67a896706851e55709c9b5a | [
"Apache-2.0"
] | 1 | 2021-03-21T11:37:03.000Z | 2021-03-21T11:37:03.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.
import copy
from heat.engine import rsrc_defn
from heat.engine import scheduler
from heat.tests import common
from heat.tests import utils
try:
from neutronclient.v2_0 import client as neutronclient
except ImportError:
neutronclient = None
test_template = {
'heat_template_version': '2013-05-23',
'resources': {
'my_nic': {
'type': 'AWS::EC2::NetworkInterface',
'properties': {
'SubnetId': 'ssss'
}
}
}
}
class NetworkInterfaceTest(common.HeatTestCase):
def setUp(self):
super(NetworkInterfaceTest, self).setUp()
self.ctx = utils.dummy_context()
self.m.StubOutWithMock(neutronclient.Client, 'show_subnet')
self.m.StubOutWithMock(neutronclient.Client, 'create_port')
self.m.StubOutWithMock(neutronclient.Client, 'delete_port')
self.m.StubOutWithMock(neutronclient.Client, 'update_port')
def mock_show_subnet(self):
neutronclient.Client.show_subnet('ssss').AndReturn({
'subnet': {
'name': 'my_subnet',
'network_id': 'nnnn',
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f',
'allocation_pools': [{'start': '10.0.0.2',
'end': '10.0.0.254'}],
'gateway_ip': '10.0.0.1',
'ip_version': 4,
'cidr': '10.0.0.0/24',
'id': 'ssss',
'enable_dhcp': False,
}})
def mock_create_network_interface(self, stack_name='my_stack',
resource_name='my_nic',
security_groups=None):
self.nic_name = utils.PhysName(stack_name, resource_name)
port = {'network_id': 'nnnn',
'fixed_ips': [{
'subnet_id': u'ssss'
}],
'name': self.nic_name,
'admin_state_up': True}
port_info = {
'port': {
'admin_state_up': True,
'device_id': '',
'device_owner': '',
'fixed_ips': [
{
'ip_address': '10.0.0.100',
'subnet_id': 'ssss'
}
],
'id': 'pppp',
'mac_address': 'fa:16:3e:25:32:5d',
'name': self.nic_name,
'network_id': 'nnnn',
'status': 'ACTIVE',
'tenant_id': 'c1210485b2424d48804aad5d39c61b8f'
}
}
if security_groups is not None:
port['security_groups'] = security_groups
port_info['security_groups'] = security_groups
else:
port_info['security_groups'] = ['default']
neutronclient.Client.create_port({'port': port}).AndReturn(port_info)
def mock_update_network_interface(self, update_props, port_id='pppp'):
neutronclient.Client.update_port(
port_id,
{'port': update_props}).AndReturn(None)
def mock_delete_network_interface(self, port_id='pppp'):
neutronclient.Client.delete_port(port_id).AndReturn(None)
def test_network_interface_create_update_delete(self):
my_stack = utils.parse_stack(test_template,
stack_name='test_nif_cud_stack')
nic_rsrc = my_stack['my_nic']
self.mock_show_subnet()
self.stub_SubnetConstraint_validate()
self.mock_create_network_interface()
update_props = {}
update_sg_ids = ['0389f747-7785-4757-b7bb-2ab07e4b09c3']
update_props['security_groups'] = update_sg_ids
self.mock_update_network_interface(update_props)
self.mock_delete_network_interface()
self.m.ReplayAll()
# create the nic without GroupSet
self.assertIsNone(nic_rsrc.validate())
scheduler.TaskRunner(nic_rsrc.create)()
self.assertEqual((nic_rsrc.CREATE, my_stack.COMPLETE),
nic_rsrc.state)
# update the nic with GroupSet
props = copy.deepcopy(nic_rsrc.properties.data)
props['GroupSet'] = update_sg_ids
update_snippet = rsrc_defn.ResourceDefinition(nic_rsrc.name,
nic_rsrc.type(),
props)
scheduler.TaskRunner(nic_rsrc.update, update_snippet)()
self.assertEqual((nic_rsrc.UPDATE, nic_rsrc.COMPLETE), nic_rsrc.state)
# delete the nic
scheduler.TaskRunner(nic_rsrc.delete)()
self.assertEqual((nic_rsrc.DELETE, nic_rsrc.COMPLETE), nic_rsrc.state)
self.m.VerifyAll()
| 36.217687 | 78 | 0.572126 |
7953c524836f86084d44e777d9b26e7aea5f385d | 3,140 | py | Python | truvari/region_vcf_iter.py | spiralgenetics/truvari | 5962be4b4069e17298524362a83884dfcdfcec5a | [
"MIT"
] | 145 | 2018-04-16T19:11:11.000Z | 2022-02-11T04:19:04.000Z | truvari/region_vcf_iter.py | spiralgenetics/truvari | 5962be4b4069e17298524362a83884dfcdfcec5a | [
"MIT"
] | 79 | 2018-06-26T23:46:46.000Z | 2022-02-08T21:49:09.000Z | truvari/region_vcf_iter.py | spiralgenetics/truvari | 5962be4b4069e17298524362a83884dfcdfcec5a | [
"MIT"
] | 32 | 2018-08-08T06:35:16.000Z | 2022-02-11T04:20:03.000Z | """
Helper class to specify included regions of the genome when iterating events.
"""
import logging
from collections import defaultdict
from intervaltree import IntervalTree
import truvari.comparisons as tcomp
class RegionVCFIterator():
"""
Helper class to specify include regions of the genome when iterating a VCF
Subset to only events less than max_span.
Subset to only events on contigs listed in vcfA left-join vcfB
"""
def __init__(self, vcfA, vcfB=None, includebed=None, max_span=None):
""" init """
self.includebed = includebed
self.max_span = max_span
self.tree = self.__build_tree(vcfA, vcfB)
def __build_tree(self, vcfA, vcfB):
"""
Build the include regions
"""
contigA_set = set(vcfA.header.contigs.keys())
if vcfB is not None:
contigB_set = set(vcfB.header.contigs.keys())
else:
contigB_set = contigA_set
all_regions = defaultdict(IntervalTree)
if self.includebed is not None:
counter = 0
with open(self.includebed, 'r') as fh:
for line in fh:
if line.startswith("#"):
continue
data = line.strip().split('\t')
chrom = data[0]
start = int(data[1])
end = int(data[2])
all_regions[chrom].addi(start, end)
counter += 1
logging.info("Including %d bed regions", counter)
else:
excluding = contigB_set - contigA_set
if excluding:
logging.warning(
"Excluding %d contigs present in comparison calls header but not base calls.", len(excluding))
for contig in contigA_set:
name = vcfA.header.contigs[contig].name
length = vcfA.header.contigs[contig].length
all_regions[name].addi(0, length)
return all_regions
def iterate(self, vcf_file):
"""
Iterates a vcf and yields only the entries that overlap included regions
"""
for chrom in sorted(self.tree.keys()):
for intv in sorted(self.tree[chrom]):
for entry in vcf_file.fetch(chrom, intv.begin, intv.end):
if self.includebed is None or self.include(entry):
yield entry
def include(self, entry):
"""
Returns if this entry's start and end are within a region that is to be included
Here overlap means lies completely within the boundary of an include region
"""
astart, aend = tcomp.entry_boundaries(entry)
# Filter these early so we don't have to keep checking overlaps
if self.max_span is None or aend - astart > self.max_span:
return False
overlaps = self.tree[entry.chrom].overlaps(astart) \
and self.tree[entry.chrom].overlaps(aend)
if astart == aend:
return overlaps
return overlaps and len(self.tree[entry.chrom].overlap(astart, aend)) == 1
| 38.292683 | 114 | 0.584076 |
7953c552fc324dd714d55ae4dfaf310843a770f7 | 952 | py | Python | iam/google/cloud/iam_credentials_v1/__init__.py | nielm/google-cloud-python | fd126fdea34206109eb00d675374ff7dc4dcc5ef | [
"Apache-2.0"
] | 1 | 2019-01-23T21:54:51.000Z | 2019-01-23T21:54:51.000Z | iam/google/cloud/iam_credentials_v1/__init__.py | nielm/google-cloud-python | fd126fdea34206109eb00d675374ff7dc4dcc5ef | [
"Apache-2.0"
] | 1 | 2018-04-06T19:51:23.000Z | 2018-04-06T19:51:23.000Z | iam/google/cloud/iam_credentials_v1/__init__.py | nielm/google-cloud-python | fd126fdea34206109eb00d675374ff7dc4dcc5ef | [
"Apache-2.0"
] | null | null | null | # -*- coding: utf-8 -*-
#
# Copyright 2019 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.
from __future__ import absolute_import
from google.cloud.iam_credentials_v1 import types
from google.cloud.iam_credentials_v1.gapic import iam_credentials_client
class IAMCredentialsClient(iam_credentials_client.IAMCredentialsClient):
__doc__ = iam_credentials_client.IAMCredentialsClient.__doc__
__all__ = ("types", "IAMCredentialsClient")
| 34 | 74 | 0.786765 |
7953c64a2602ea81e497151c7efd3c54792fb0be | 670 | py | Python | Models/MinecraftWikiCrawler.py | JE-Chen/Python-WebCrawler-JE | 3d69ec5bd467c01a783e0281e18c01bb281bb1e8 | [
"MIT"
] | 1 | 2020-12-30T06:37:33.000Z | 2020-12-30T06:37:33.000Z | Models/MinecraftWikiCrawler.py | JE-Chen/Python-WebCrawler-JE | 3d69ec5bd467c01a783e0281e18c01bb281bb1e8 | [
"MIT"
] | null | null | null | Models/MinecraftWikiCrawler.py | JE-Chen/Python-WebCrawler-JE | 3d69ec5bd467c01a783e0281e18c01bb281bb1e8 | [
"MIT"
] | null | null | null | import requests
from bs4 import BeautifulSoup
class MinecraftWikiCrawler:
def __init__(self):
self.Prefix = 'https://minecraft-zh.gamepedia.com/'
def Search(self, Tag):
format_string = ''
url = self.Prefix + Tag
res = requests.get(url)
content = res.content
soup = BeautifulSoup(content, 'html.parser')
Total = ''
for index, data in enumerate(soup.select('#pageWrapper #bodyContent div.mw-parser-output p')):
format_string += str(data.text)
if data.has_attr('href'):
format_string += str(data['href'])
Total += format_string
return Total
| 29.130435 | 102 | 0.602985 |
7953c667283bb9692346613b1cbe8cdc30fda654 | 8,061 | py | Python | shopping/ebay.py | saisyam/scrapers | 1e34c2e3d9b052f0516c72210f0bcbdb8f631d89 | [
"Apache-2.0"
] | null | null | null | shopping/ebay.py | saisyam/scrapers | 1e34c2e3d9b052f0516c72210f0bcbdb8f631d89 | [
"Apache-2.0"
] | 5 | 2021-03-13T07:07:41.000Z | 2021-03-23T11:28:21.000Z | shopping/ebay.py | saisyam/scrapers | 1e34c2e3d9b052f0516c72210f0bcbdb8f631d89 | [
"Apache-2.0"
] | null | null | null | import sys
sys.path.append("../")
from bs4 import BeautifulSoup
import unicodedata
from utils import htmlutils
from utils.base import BaseScraper
class Ebay(BaseScraper):
name = "ebay"
def __init__(self, url, category):
self.url = url
self.category = category
super().__init__(url)
def scrape(self):
html = htmlutils.get_html(self.url)
soup = BeautifulSoup(html, "html5lib")
maincontent = soup.find("div", {'id':'mainContent'})
section = soup.find("section", {'class':'b-listing'})
ulist = section.find("ul", {'class':'b-list__items_nofooter'})
items = ulist.find_all("li")
for item in items:
url = item.find("div", {'class':'s-item__image'}).find("a")['href']
yield self.scrape_product(url)
def scrape_product(self, purl):
html = htmlutils.get_html(purl)
soup = BeautifulSoup(html, "html5lib")
msgpanel = soup.find('div', {'id','msgPanel'})
if msgpanel is not None:
if "listing was ended" in msgpanel.get_text().strip():
return
cpanel = soup.find("div", {'id':'CenterPanel'})
container = soup.find("div", {'id': 'vi-layout-container'})
if cpanel is not None:
return self.scrape_product_type_2(soup, purl)
elif container is not None:
return self.scrape_product_type_3(soup, purl)
else:
return self.scrape_product_type_1(soup, purl)
def scrape_product_type_1(self, soup, url):
title= soup.find("div", {'id':'mainContent'}).find("h1", {'class':'product-title'}).get_text().replace('Details about','').strip()
centerpanel = soup.find('div', {'id':'center-panel'})
img_wrapper = centerpanel.find('div', {'class':'item-image-wrapper'})
ebay_id = img_wrapper['data-listingid']
pic_panel = img_wrapper.find('div', {'class':'hero-picture-panel'}).find('div',{'class':'thumbPicturePanel'})
imgs = pic_panel.find_all("figure")
img_urls = []
for img in imgs:
img_urls.append(img.find('img')['src'].replace("s-l64","s-l640"))
item_desc = centerpanel.find("div", {'class':'item-desc'})
price = item_desc.find("div", {'class':'display-price'}).get_text()
shipping = item_desc.find("span", {'class':'logistics-cost'}).get_text().replace("+",'').replace('Shipping','').strip()
product_desc = soup.find("div", {'class':'btf-content'}).find("div", {'id':'ProductDetails'}).find('section',{'class':'product-spectification'})
rows = product_desc.find_all('div',{'class':'spec-row'})
metadata = {}
metadata['price'] = price
metadata['shipping'] = shipping
for row in rows:
items = row.find("ul").find_all("li")
for item in items:
divs = item.find_all("div")
if len(divs) > 0:
metadata[item.find("div",{'class':'s-name'}).get_text()] = item.find("div",{'class':'s-value'}).get_text()
else:
metadata[row.find("h2").get_text()] = item.get_text()
return {
'title': title,
'ebay_id': ebay_id,
'images': img_urls,
'metadata': metadata,
'url': url,
'category': self.category
}
def scrape_product_type_2(self, soup, url):
left_panel = soup.find("div", {'id': 'LeftSummaryPanel'})
title = left_panel.find("div",{'class':'vi-swc-lsp'}).find("h1", {'id':'itemTitle'}).get_text()
title = unicodedata.normalize("NFKD", title).replace('Details about','').strip()
mcontent = soup.find("div", {'id':'mainContent'})
price_span = mcontent.find("span", {'itemprop':'price'})
price = price_span.get_text().strip()
shipping_id = mcontent.find("span", {'id':'fshippingCost'})
shipping = ""
if shipping_id is not None: # sometime shipping need to be calculated
shipping = shipping_id.get_text().strip()
desc_section = soup.find("div", {'id':'BottomPanel'}).find("div", {'id':'viTabs_0_is'}).find("div",{'class':'section'})
metadata = {}
metadata['price'] = price
metadata['shipping'] = shipping
tables = desc_section.find_all('table')
desc_table = None
if len(tables) > 1:
seller_desc_table = desc_section.find('table',{'id':'itmSellerDesc'})
if seller_desc_table is not None:
rows = seller_desc_table.find_all("tr")
for row in rows:
key = row.find("th").get_text().strip().replace(":",'')
value = row.find("td").get_text().strip().replace("\t",'').replace("\n",'')
metadata[key] = value
desc_table = tables[1]
else:
desc_table = desc_section.find('table')
rows = desc_table.find_all("tr")
for row in rows:
td = row.find_all("td")
if len(td) > 0:
key = td[0].get_text().strip().replace(":",'')
spans = td[1].find_all('span')
if len(spans) > 0:
value = spans[0].get_text().strip().replace("\t",'').replace("\n",'')
else:
value = td[1].get_text().strip().replace("\t",'').replace("\n",'')
metadata[key] = value
if len(td) > 2:
key = td[2].get_text().strip().replace(":",'')
value = td[3].get_text().strip()
metadata[key] = value
img_div = soup.find("div", {'id':'vi_main_img_fs'})
img_urls = []
if img_div is not None:
images = img_div.find("ul").find_all("li")
for img in images:
img_urls.append(img.find("img")['src'].replace('s-l64', 's-l1600'))
else:
img_div = soup.find("div", {'id':'mainImgHldr'})
img_url = img_div.find("img", {'id':'icImg'})['src']
img_urls.append(img_url)
ebay_id = soup.find("div", {'id':'descItemNumber'}).get_text()
return {
'title': title,
'ebay_id': ebay_id,
'images': img_urls,
'metadata': metadata,
'url': url
}
def scrape_product_type_3(self, soup, url):
container = soup.find("div", {'id': 'vi-layout-container'})
center_panel = container.find("div", {'name':'wrapper-centerpanel'})
left_block = center_panel.find('div', {'class':'vi-wireframe__middle-block--to-left'})
title = left_block.find('h1',{'class':'vi-title__main'}).get_text().strip()
price = left_block.find('span', {'class':'main-price-with-shipping'}).get_text().strip()
shipping = left_block.find('span', {'class':'logistics-cost'}).get_text().replace('+', '').replace('Shipping','').strip()
container1 = container.find("div",{'id':'vi-frag-btfcontainer'})
meta_container = container1.find('div',{'class':'app-itemspecifics-mobile-wrapper'})
items = meta_container.find_all('dl')
metadata = {}
for item in items:
key = item.find('dt').get_text().strip()
value = item.find('dd').get_text().strip()
metadata[key] = value
pic_panel = container.find('div',{'class':'vi-wireframe__left-block'}).find('div',{'class':'thumbPicturePanel'})
imgs = pic_panel.find_all("figure")
img_urls = []
for img in imgs:
img_urls.append(img.find('img')['src'].replace("s-l64","s-l1600"))
return {
'title': title,
#'ebay_id': ebay_id,
'images': img_urls,
'metadata': metadata,
'url': url
}
arguments = len(sys.argv)
if arguments < 3:
print('Usage: python3 ebay.py <URL> <Category>')
exit()
else:
ebay = Ebay(sys.argv[1], sys.argv[2])
for i in ebay.scrape():
print(i) | 44.535912 | 152 | 0.546458 |
7953c7c13ca1aebb0f865d8f68bc4923f49e5300 | 1,739 | py | Python | category_builder.py | vvkishere/categorybuilder | 598fbb38d0043b7f90dcc3f30577511feeb1f1a9 | [
"Apache-2.0"
] | 1 | 2019-12-16T05:14:52.000Z | 2019-12-16T05:14:52.000Z | category_builder.py | vvkishere/categorybuilder | 598fbb38d0043b7f90dcc3f30577511feeb1f1a9 | [
"Apache-2.0"
] | null | null | null | category_builder.py | vvkishere/categorybuilder | 598fbb38d0043b7f90dcc3f30577511feeb1f1a9 | [
"Apache-2.0"
] | null | null | null | # Copyright 2018 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 argparse
import category_builder_util as util
def GetArgumentParser():
parser = argparse.ArgumentParser(description='Category Builder')
parser.add_argument('--rho', default=3.0, type=float, help="The rho param")
parser.add_argument('--n', default=100, type=int,
help="How many features to use")
parser.add_argument('--expansion_size', default=100, type=int,
help="How many items to expand to")
parser.add_argument('--cutpaste', dest='cutpaste', action='store_true',
help='Prints output in a formay easy to cut-paster')
parser.set_defaults(cutpaste=False)
parser.add_argument('seeds', nargs='+', help="Seeds to expand")
return parser
if __name__ == "__main__":
args = GetArgumentParser().parse_args()
CB = util.CategoryBuilder()
items = CB.ExpandCategory(seeds=args.seeds,
rho=args.rho,
n=args.n)
if args.cutpaste:
print ', '.join(item[0] for item in items[:args.expansion_size])
else:
for idx, item in enumerate(items[:args.expansion_size]):
print "[%d] %f\t%s" % (idx, item[1], item[0])
| 39.522727 | 77 | 0.679701 |
7953c89fa3e445cacc469b4d49ca0683515cfe90 | 8,129 | py | Python | scripts/brac/flow_evaluation_vis.py | Thibaud-Ardoin/d4rl | 631cdcbf93441384dcf96df39a70c287749ab2ad | [
"Apache-2.0"
] | null | null | null | scripts/brac/flow_evaluation_vis.py | Thibaud-Ardoin/d4rl | 631cdcbf93441384dcf96df39a70c287749ab2ad | [
"Apache-2.0"
] | null | null | null | scripts/brac/flow_evaluation_vis.py | Thibaud-Ardoin/d4rl | 631cdcbf93441384dcf96df39a70c287749ab2ad | [
"Apache-2.0"
] | null | null | null | # coding=utf-8
# Copyright 2020 The Google Research Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
"""Training and evaluation in the offline mode."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import collections
import os
import time
from absl import logging
import gin
import gym
import numpy as np
import tensorflow as tf0
import tensorflow.compat.v1 as tf
from behavior_regularized_offline_rl.brac import dataset
from behavior_regularized_offline_rl.brac import train_eval_utils
from behavior_regularized_offline_rl.brac import utils
from gym.wrappers import time_limit
from tf_agents.environments import tf_py_environment
from tf_agents.environments import gym_wrapper
def get_offline_data(tf_env):
gym_env = tf_env.pyenv.envs[0]
#offline_dataset = gym_env.unwrapped.get_dataset()
offline_dataset = gym_env.get_dataset()
dataset_size = len(offline_dataset['observations'])
tf_dataset = dataset.Dataset(
tf_env.observation_spec(),
tf_env.action_spec(),
size=dataset_size)
observation_dtype = tf_env.observation_spec().dtype
action_dtype = tf_env.action_spec().dtype
offline_dataset['terminals'] = np.squeeze(offline_dataset['terminals'])
offline_dataset['rewards'] = np.squeeze(offline_dataset['rewards'])
nonterminal_steps, = np.where(
np.logical_and(
np.logical_not(offline_dataset['terminals']),
np.arange(dataset_size) < dataset_size - 1))
logging.info('Found %d non-terminal steps out of a total of %d steps.' % (
len(nonterminal_steps), dataset_size))
s1 = tf.convert_to_tensor(offline_dataset['observations'][nonterminal_steps],
dtype=observation_dtype)
s2 = tf.convert_to_tensor(offline_dataset['observations'][nonterminal_steps + 1],
dtype=observation_dtype)
a1 = tf.convert_to_tensor(offline_dataset['actions'][nonterminal_steps],
dtype=action_dtype)
a2 = tf.convert_to_tensor(offline_dataset['actions'][nonterminal_steps + 1],
dtype=action_dtype)
discount = tf.convert_to_tensor(
1. - offline_dataset['terminals'][nonterminal_steps + 1],
dtype=tf.float32)
reward = tf.convert_to_tensor(offline_dataset['rewards'][nonterminal_steps],
dtype=tf.float32)
transitions = dataset.Transition(
s1, s2, a1, a2, discount, reward)
tf_dataset.add_transitions(transitions)
return tf_dataset
def env_factory(env_name):
gym_env = gym.make(env_name)
gym_spec = gym.spec(env_name)
if gym_spec.max_episode_steps in [0, None]: # Add TimeLimit wrapper.
gym_env = time_limit.TimeLimit(gym_env, max_episode_steps=1000)
tf_env = tf_py_environment.TFPyEnvironment(
gym_wrapper.GymWrapper(gym_env))
return tf_env
@gin.configurable
def train_eval_offline(
# Basic args.
log_dir,
data_file,
agent_module,
env_name='flow-ring-random-v0',
n_train=int(1e6),
shuffle_steps=0,
seed=0,
use_seed_for_data=False,
# Train and eval args.
total_train_steps=int(1e6),
summary_freq=100,
print_freq=1000,
save_freq=int(2e4),
eval_freq=5000,
n_eval_episodes=20,
# Agent args.
model_params=(((200, 200),), 2),
behavior_ckpt_file=None,
value_penalty=True,
#model_params=((200, 200),),
optimizers=(('adam', 0.001),),
batch_size=256,
weight_decays=(0.0,),
update_freq=1,
update_rate=0.005,
discount=0.99,
):
"""Training a policy with a fixed dataset."""
# Create tf_env to get specs.
print('[train_eval_offline.py] env_name=', env_name)
print('[train_eval_offline.py] data_file=', data_file)
print('[train_eval_offline.py] agent_module=', agent_module)
print('[train_eval_offline.py] model_params=', model_params)
print('[train_eval_offline.py] optimizers=', optimizers)
print('[train_eval_offline.py] bckpt_file=', behavior_ckpt_file)
print('[train_eval_offline.py] value_penalty=', value_penalty)
tf_env = env_factory(env_name)
observation_spec = tf_env.observation_spec()
action_spec = tf_env.action_spec()
# Prepare data.
full_data = get_offline_data(tf_env)
# Split data.
# n_train = min(n_train, full_data.size)
# logging.info('n_train %s.', n_train)
if use_seed_for_data:
rand = np.random.RandomState(seed)
else:
rand = np.random.RandomState(0)
shuffled_indices = utils.shuffle_indices_with_steps(
n=full_data.size, steps=shuffle_steps, rand=rand)
train_indices = shuffled_indices[:n_train]
train_data = full_data.create_view(train_indices)
# Create agent.
agent_flags = utils.Flags(
observation_spec=observation_spec,
action_spec=action_spec,
model_params=model_params,
optimizers=optimizers,
batch_size=batch_size,
weight_decays=weight_decays,
update_freq=update_freq,
update_rate=update_rate,
discount=discount,
train_data=train_data)
agent_args = agent_module.Config(agent_flags).agent_args
my_agent_arg_dict = {}
for k in vars(agent_args):
my_agent_arg_dict[k] = vars(agent_args)[k]
# my_agent_arg_dict['behavior_ckpt_file'] = behavior_ckpt_file
# my_agent_arg_dict['value_penalty'] = value_penalty
print('agent_args:', my_agent_arg_dict)
#agent = agent_module.Agent(**vars(agent_args))
agent = agent_module.Agent(**my_agent_arg_dict)
agent_ckpt_name = os.path.join(log_dir, 'agent')
# Restore agent from checkpoint if there exists one.
if tf.io.gfile.exists('{}.index'.format(agent_ckpt_name)):
logging.info('Checkpoint found at %s.', agent_ckpt_name)
agent.restore(agent_ckpt_name)
# Train agent.
# train_summary_dir = os.path.join(log_dir, 'train')
eval_summary_dir = os.path.join(log_dir, 'eval')
# train_summary_writer = tf0.compat.v2.summary.create_file_writer(
# train_summary_dir)
eval_summary_writers = collections.OrderedDict()
for policy_key in agent.test_policies.keys():
eval_summary_writer = tf0.compat.v2.summary.create_file_writer(
os.path.join(eval_summary_dir, policy_key))
eval_summary_writers[policy_key] = eval_summary_writer
eval_results = []
time_st_total = time.time()
time_st = time.time()
step = agent.global_step
timed_at_step = step
while step < total_train_steps:
# agent.train_step()
step = agent.global_step
# if step % summary_freq == 0 or step == total_train_steps:
# agent.write_train_summary(train_summary_writer)
# if step % print_freq == 0 or step == total_train_steps:
# agent.print_train_info()
# if step % eval_freq == 0 or step == total_train_steps:
time_ed = time.time()
time_cost = time_ed - time_st
logging.info(
'Training at %.4g steps/s.', (step - timed_at_step) / time_cost)
eval_result, eval_infos = train_eval_utils.eval_policies(
tf_env, agent.test_policies, n_eval_episodes)
eval_results.append([step] + eval_result)
logging.info('Testing at step %d:', step)
for policy_key, policy_info in eval_infos.items():
logging.info(utils.get_summary_str(
step=None, info=policy_info, prefix=policy_key+': '))
# utils.write_summary(eval_summary_writers[policy_key], step, policy_info)
time_st = time.time()
timed_at_step = step
# if step % save_freq == 0:
# agent.save(agent_ckpt_name)
# logging.info('Agent saved at %s.', agent_ckpt_name)
# agent.save(agent_ckpt_name)
time_cost = time.time() - time_st_total
logging.info('Training finished, time cost %.4gs.', time_cost)
return np.array(eval_results)
| 35.343478 | 83 | 0.723336 |
7953c8aa5c07bcc2ad1ed6be884e0893f6a1936b | 5,012 | py | Python | signaturit_sdk/tests/test_signature.py | ohduran-forks/python-sdk | c79a3a0d4a266cf2f1c716119ec74c7ae1add4c6 | [
"MIT"
] | 4 | 2017-02-16T13:37:00.000Z | 2020-10-07T09:58:35.000Z | signaturit_sdk/tests/test_signature.py | ohduran-forks/python-sdk | c79a3a0d4a266cf2f1c716119ec74c7ae1add4c6 | [
"MIT"
] | 1 | 2017-04-11T17:46:26.000Z | 2017-04-12T16:12:46.000Z | signaturit_sdk/tests/test_signature.py | ohduran-forks/python-sdk | c79a3a0d4a266cf2f1c716119ec74c7ae1add4c6 | [
"MIT"
] | 6 | 2015-11-16T15:16:24.000Z | 2020-03-26T09:50:22.000Z | import unittest
import os
from signaturit_sdk.signaturit_client import SignaturitClient
import httpretty
import warnings
class TestSignature(unittest.TestCase):
TEST_FILE_URL = '/tmp/test.pdf'
def setUp(self):
warnings.filterwarnings("ignore", category=ResourceWarning, message="unclosed.*")
def test_create_signature_with_invalid_params_should_raise_exception(self):
client = SignaturitClient('TOKEN')
self.assertRaises(Exception, client.create_signature, {'testing': 'some_value'})
@httpretty.activate
def test_cancel_signature(self):
httpretty.register_uri(httpretty.PATCH,
"https://api.sandbox.signaturit.com/v3/signatures/SIGNATURE_ID/cancel.json",
body='{'
'"id": "SIGNATURE_ID",'
'"recipients": [{"email": "test@test.com", "fullname": "Mr Test"}],'
'"subject": "Testing"'
'}',
content_type="application/json")
signaturit_client = SignaturitClient('SOME_TOKEN')
response = signaturit_client.cancel_signature('SIGNATURE_ID')
self.assertEqual('Testing', response['subject'])
self.assertEqual([{"email": "test@test.com", "fullname": "Mr Test"}], response['recipients'])
@httpretty.activate
def test_send_signature_reminder(self):
httpretty.register_uri(httpretty.POST,
"https://api.sandbox.signaturit.com/v3/signatures/SIGNATURE_ID/reminder.json",
body='{}',
content_type="application/json")
signaturit_client = SignaturitClient('SOME_TOKEN')
signaturit_client.send_signature_reminder('SIGNATURE_ID')
@httpretty.activate
def test_get_signatures(self):
httpretty.register_uri(httpretty.GET, "https://api.sandbox.signaturit.com/v3/signatures.json",
body='{'
'"recipients": [{"email": "test@test.com", "fullname": "Mr Test"}],'
'"subject": "Testing"'
'}',
content_type="application/json")
signaturit_client = SignaturitClient('SOME_TOKEN')
response = signaturit_client.get_signatures()
self.assertEqual('Testing', response['subject'])
self.assertEqual([{"email": "test@test.com", "fullname": "Mr Test"}], response['recipients'])
@httpretty.activate
def test_count_signatures(self):
httpretty.register_uri(httpretty.GET, "https://api.sandbox.signaturit.com/v3/signatures/count.json",
body='3',
content_type="application/json")
signaturit_client = SignaturitClient('SOME_TOKEN')
response = signaturit_client.count_signatures()
self.assertEqual(3, response)
@httpretty.activate
def test_get_signature(self):
httpretty.register_uri(httpretty.GET, "https://api.sandbox.signaturit.com/v3/signatures/SIGNATURE_ID.json",
body='{'
'"id": "SIGNATURE_ID", ' +
'"recipients": [{"email": "test@test.com", "fullname": "Mr Test"}], ' +
'"subject": "Testing"'
'}',
content_type="application/json")
signaturit_client = SignaturitClient('SOME_TOKEN')
response = signaturit_client.get_signature('SIGNATURE_ID')
self.assertEqual('Testing', response['subject'])
self.assertEqual('SIGNATURE_ID', response['id'])
self.assertEqual([{"email": "test@test.com", "fullname": "Mr Test"}], response['recipients'])
@httpretty.activate
def test_create_signature(self):
open(self.TEST_FILE_URL, 'a').close()
httpretty.register_uri(httpretty.POST, "https://api.sandbox.signaturit.com/v3/signatures.json",
body='{'
'"id": "SIGNATURE_ID", ' +
'"recipients": [{"email": "test@test.com", "fullname": "Mr Test"}],' +
'"subject": "Testing"'
'}')
signaturit_client = SignaturitClient('SOME_CLIENT')
response = signaturit_client.create_signature([self.TEST_FILE_URL],
[{"email": "test@test.com", "fullname": "Mr Test"}], {})
self.assertEqual('Testing', response['subject'])
self.assertEqual('SIGNATURE_ID', response['id'])
self.assertEqual([{"email": "test@test.com", "fullname": "Mr Test"}], response['recipients'])
os.unlink(self.TEST_FILE_URL)
if __name__ == '__main__':
unittest.main()
| 42.474576 | 115 | 0.55427 |
7953c9e06ea97241deaab4656d03a9910586926a | 7,637 | py | Python | sdtv3/SDT3PrintSDT4.py | Homegateway/SDTTool | 97e698ce3078595a6755ec0b599838dc903eaa3d | [
"Apache-2.0"
] | 2 | 2018-05-14T16:00:23.000Z | 2018-12-26T14:02:51.000Z | sdtv3/SDT3PrintSDT4.py | Homegateway/SDTTool | 97e698ce3078595a6755ec0b599838dc903eaa3d | [
"Apache-2.0"
] | null | null | null | sdtv3/SDT3PrintSDT4.py | Homegateway/SDTTool | 97e698ce3078595a6755ec0b599838dc903eaa3d | [
"Apache-2.0"
] | 2 | 2016-09-05T09:24:41.000Z | 2020-06-23T14:05:45.000Z | # SDT2PrintSDT4.py
#
# Print SDT4 to SDT4
from .SDT3Classes import *
from common.SDTHelper import decTab, incTab, newLine
#
# Print functions
#
def print2DomainSDT4(domain, options):
result = printXMLHeader(domain)
incTab()
result += r(printIncludes(domain.includes)) if len(domain.includes) > 0 else ''
result += r(printModuleClasses(domain.modules)) if len(domain.modules) > 0 else ''
result += r(printDevices(domain.devices)) if len(domain.devices) > 0 else ''
decTab()
result += r(printXMLFooter())
return result
def printXMLHeader(domain):
result = '<?xml version="1.0" encoding="iso-8859-1"?>'
result += r('<Domain xmlns="http://www.onem2m.org/xml/sdt/4.0"')
incTab()
result += r('xmlns:xi="http://www.w3.org/2001/XInclude"')
result += r('id="' + domain.id + '">')
decTab()
return result
def printXMLFooter():
return '</Domain>'
def printIncludes(includes):
return _printList(includes, 'Imports', lambda x: r('<xi:include href="' + x.href + '" parse="' + x.parse + '" />'))
#
# Devices, SubDevices
#
def printDevices(devices):
return _printList(devices, 'DeviceClasses', printDevice)
def printDevice(device):
result = r('<DeviceClass id="' + device.id + '">')
incTab()
result += r(printDoc(device.doc)) if device.doc else ''
result += printProperties(device.properties) if len(device.properties) > 0 else ''
result += printModuleClasses(device.modules) if len(device.modules) > 0 else ''
result += _printList(device.subDevices, 'SubDevices', printSubDevice)
decTab()
result += r('</DeviceClass>')
return result
def printSubDevice(subDevice):
result = r('<SubDevice id="' + subDevice.id + '">')
incTab()
result += r(printDoc(subDevice.doc)) if subDevice.doc else ''
result += printProperties(subDevice.properties) if len(subDevice.properties) > 0 else ''
result += printModuleClasses(subDevice.modules) if len(subDevice.modules) > 0 else ''
decTab()
result += r('</SubDevice>')
return result
#
# DeviceInfo
#
def printProperties(properties):
return _printList(properties, 'Properties', printProperty)
def printProperty(property):
result += r('<Property name="' + property.name + '"')
result += ' optional="true"' if property.optional is not None and property.optional == 'true' else ''
result += ' value="'+ property.value + '"' if property.value else ''
result += '>'
incTab()
result += r(printDoc(property.doc)) if property.doc else ''
result += r(printSimpleType(property.type))
decTab()
result += newLine() + '</Property>'
#
# ModuleClass
#
def printModuleClasses(moduleClasses):
return _printList(moduleClasses, 'ModuleClasses', printModuleClass)
def printModuleClass(moduleClass):
result = r('<ModuleClass name="' + moduleClass.name + '"')
result += ' optional="true"' if moduleClass.optional is not None and moduleClass.optional == 'true' else ''
result += '>'
incTab()
result += r(printDoc(moduleClass.doc)) if moduleClass.doc != None else ''
result += r('<Extend domain="' + moduleClass.extends.domain + '" entity="' + moduleClass.extends.clazz + '"/>') if moduleClass.extends != None else ''
result += _printList(moduleClass.actions, 'Actions', printAction)
result += _printList(moduleClass.data, 'Data', printDataPoint)
result += _printList(moduleClass.events, 'Events', printEvent)
decTab()
result += r('</ModuleClass>')
return result
#
# Action, Argument
#
def printAction(action):
result = r('<Action name="' + action.name + '"')
result += ' optional="true"' if action.optional is not None and action.optional == 'true' else ''
result += '>'
incTab()
result += r(printDoc(action.doc)) if action.doc != None else ''
result += r(printDataType(action.type)) if action.type != None else ''
result += _printList(action.args, 'Args', printArgument)
decTab()
result += r('</Action>')
return result
def printArgument(action):
result = r('<Arg name="' + action.name + '">')
incTab();
result += r(printDataType(action.type)) if (action.type) else ''
decTab()
result += r('</Arg>')
return result
#
# Event
#
def printEvent(event):
result = r('<Event name="' + event.name + '"')
result += ' optional="true"' if module.optional is not None and module.optional == 'true' else ''
result += '>'
incTab()
result += r(printDoc(event.doc)) if event.doc != None else ''
result += _printList(event.data, 'Data', printDataPoint)
decTab()
result += r('</Event>')
return result
#
# DataPoint
#
def printDataPoint(datapoint):
result = r('<DataPoint name="' + datapoint.name + '"')
result += ' optional="true"' if datapoint.optional is not None and datapoint.optional == 'true' else ''
result += ' writable="false"' if datapoint.writable is not None and datapoint.writable == 'false' else ''
result += ' readable="false"' if datapoint.readable is not None and datapoint.readable == 'false' else ''
result += ' eventable="true"' if datapoint.eventable is not None and datapoint.eventable == 'true' else ''
result += '>'
incTab()
result += r(printDoc(datapoint.doc)) if datapoint.doc != None else ''
result += r(printDataType(datapoint.type)) if datapoint.type != None else ''
decTab()
result += r('</DataPoint>')
return result
#
# Print the data types
#
def printDataType(dataType):
# special handling for oneM2M enum definitions up to v3
name = dataType.type.type if isinstance(dataType.type, SDT3SimpleType) and dataType.type.type.startswith('hd:') else dataType.name
result = '<DataType'
result += ' name="' + name + '"' if name is not None else ''
result += ' unitOfMeasure="' + dataType.unitOfMeasure + '"' if dataType.unitOfMeasure else ''
result += '>'
incTab()
result += r(printDoc(dataType.doc)) if dataType.doc != None else ''
if isinstance(dataType.type, SDT3SimpleType):
result += newLine() + printSimpleType(dataType.type)
elif isinstance(dataType.type, SDT3StructType):
result += newLine() + printStructType(dataType.type)
elif isinstance(dataType.type, SDT3ArrayType):
result += newLine() + printArrayType(dataType.type)
result += _printList(dataType.constraints, 'Constraints', printConstraint)
decTab()
result += r('</DataType>')
return result
def printSimpleType(dataType):
result = '<Simple type="' + dataType.type + '" />'
# hack for oneM2M enums
if dataType.type.startswith('hd:'):
result = '<Enum>'
incTab()
result += r('<!-- TODO: Add enum values -->')
result += r('<EnumValue name="name" value="1" />')
decTab()
result += r('</Enum>')
return result
def printStructType(dataType):
result = '<Struct>'
incTab()
for element in dataType.type.structElements:
result += newLine() + printDataType(element)
decTab()
result += '</Struct>'
return result
def printArrayType(dataType):
result = '<Array>'
incTab()
result += r(printDataType(dataType.arrayType))
decTab()
result += r('</Array>')
return result
def printConstraint(constraint):
result = r('<Constraint name="' + containt.name + '"')
result += ' type="' + constraint.type + '"' if constraint.type else ''
result += ' value="' + constraint.value + '"' if constraint.value is not None else ''
result += '>'
incTab()
result += r(printDoc(constraint.doc)) if constraint.doc != None else ''
decTab()
result += newLine() + '</Constraint>'
return result
#
# Doc
#
def printDoc(doc):
return '<Doc>' + doc.content.strip() + '</Doc>'
#
# misc functions to help printing results
#
def _printList(lst, element, func):
result = ''
if len(lst) > 0:
result += '%s<%s>' % (newLine(), element)
incTab()
for l in lst:
result += func(l)
decTab()
result += '%s</%s>' % (newLine(), element)
return result
def r(line):
return '%s%s' % (newLine(), line) | 27.872263 | 151 | 0.676836 |
7953ca32ad0475a22becfd8e7d5e4e549941bc27 | 75 | py | Python | hello.py | luis-ruiz-gonzalez/github-eii | e7af9e24615a356e23d0052e9def4e6c5ce70c13 | [
"Apache-2.0"
] | null | null | null | hello.py | luis-ruiz-gonzalez/github-eii | e7af9e24615a356e23d0052e9def4e6c5ce70c13 | [
"Apache-2.0"
] | 1 | 2022-03-10T17:50:34.000Z | 2022-03-10T17:50:34.000Z | hello.py | luis-ruiz-gonzalez/github-eii | e7af9e24615a356e23d0052e9def4e6c5ce70c13 | [
"Apache-2.0"
] | null | null | null | print("Hello World!")
print("Bye bye World!")
print("Nada más que añadir")
| 18.75 | 28 | 0.693333 |
7953cbfb6c632f734c5cee8324621d2a1e10fb0d | 19,387 | py | Python | src/mot_neural_solver/tracker/mpn_tracker.py | yongxinw/mot_neural_solver | 5dec429be531a56ce5720416cd6a2f00447a2950 | [
"MIT"
] | 1 | 2020-06-17T16:55:00.000Z | 2020-06-17T16:55:00.000Z | src/mot_neural_solver/tracker/mpn_tracker.py | yongxinw/mot_neural_solver | 5dec429be531a56ce5720416cd6a2f00447a2950 | [
"MIT"
] | null | null | null | src/mot_neural_solver/tracker/mpn_tracker.py | yongxinw/mot_neural_solver | 5dec429be531a56ce5720416cd6a2f00447a2950 | [
"MIT"
] | null | null | null | import numpy as np
import pandas as pd
import torch
from mot_neural_solver.data.mot_graph import Graph
from mot_neural_solver.tracker.projectors import GreedyProjector, ExactProjector
from mot_neural_solver.tracker.postprocessing import Postprocessor
from mot_neural_solver.utils.graph import get_knn_mask, to_undirected_graph, to_lightweight_graph
from scipy.sparse import csr_matrix
from scipy.sparse.csgraph import connected_components
VIDEO_COLUMNS = ['frame_path', 'frame', 'ped_id', 'bb_left', 'bb_top', 'bb_width', 'bb_height', 'bb_right', 'bb_bot']
TRACKING_OUT_COLS = ['frame', 'ped_id', 'bb_left', 'bb_top', 'bb_width', 'bb_height', 'conf', 'x', 'y', 'z']
class MPNTracker:
"""
Class used to track video sequences.
See 'track' method for an overview.
"""
def __init__(self, dataset, graph_model, use_gt, eval_params = None,
dataset_params=None, logger=None):
self.dataset = dataset
self.use_gt = use_gt
self.logger = logger
self.eval_params = eval_params
self.dataset_params = dataset_params
self.graph_model = graph_model
if self.graph_model is not None:
self.graph_model.eval()
def _estimate_frames_per_graph(self, seq_name):
"""
Determines the number of frames to be included in each batch of frames evaluated within a sequence
"""
num_frames = len(self.dataset.seq_det_dfs[seq_name].frame.unique())
num_detects = self.dataset.seq_det_dfs[seq_name].shape[0]
avg_detects_per_frame = num_detects / float(num_frames)
expected_frames_per_graph = round(self.dataset.dataset_params['max_detects'] / avg_detects_per_frame)
return min(expected_frames_per_graph, self.dataset.dataset_params['frames_per_graph'])
def _load_full_seq_graph_object(self, seq_name):
"""
Loads a MOTGraph (see data/mot_graph.py) object corresponding to the entire sequence.
"""
step_size = self.dataset.seq_info_dicts[seq_name]['step_size']
frames_per_graph = self._estimate_frames_per_graph(seq_name)
start_frame = self.dataset.seq_det_dfs[seq_name].frame.min()
end_frame = self.dataset.seq_det_dfs[seq_name].frame.max()
# TODO: Should use seconds as unit, and not number of frames
if self.dataset.dataset_params['max_frame_dist'] == 'max':
max_frame_dist = step_size * (frames_per_graph - 1)
else:
max_frame_dist = self.dataset.dataset_params['max_frame_dist']
full_graph = self.dataset.get_from_frame_and_seq(seq_name=seq_name,
start_frame=start_frame,
end_frame=end_frame,
return_full_object=True,
ensure_end_is_in=True,
max_frame_dist = max_frame_dist,
inference_mode=True)
full_graph.frames_per_graph = frames_per_graph
return full_graph
def _predict_edges(self, subgraph):
"""
Predicts edge values for a subgraph (i.e. batch of frames) from the entire sequence.
Args:
subgraph: Graph Object corresponding to a subset of frames
Returns:
tuple containing a torch.Tensor with the predicted value for every edge in the subgraph, and a binary mask
indicating which edges inside the subgraph where pruned with KNN
"""
# Prune graph edges
knn_mask = get_knn_mask(pwise_dist= subgraph.reid_emb_dists, edge_ixs = subgraph.edge_index,
num_nodes = subgraph.num_nodes, top_k_nns = self.dataset_params['top_k_nns'],
use_cuda = True, reciprocal_k_nns=self.dataset_params['reciprocal_k_nns'],
symmetric_edges=True)
subgraph.edge_index = subgraph.edge_index.T[knn_mask].T
subgraph.edge_attr = subgraph.edge_attr[knn_mask]
if hasattr(subgraph, 'edge_labels'):
subgraph.edge_labels = subgraph.edge_labels[knn_mask]
# Predict active edges
if self.use_gt: # For debugging purposes and obtaining oracle results
pruned_edge_preds = subgraph.edge_labels
else:
with torch.no_grad():
pruned_edge_preds = torch.sigmoid(self.graph_model(subgraph)['classified_edges'][-1].view(-1))
edge_preds = torch.zeros(knn_mask.shape[0]).to(pruned_edge_preds.device)
edge_preds[knn_mask] = pruned_edge_preds
if self.eval_params['set_pruned_edges_to_inactive']:
return edge_preds, torch.ones_like(knn_mask)
else:
return edge_preds, knn_mask # In this case, pruning an edge counts as not predicting a value for it at all
# However, if it is pruned for every batch, then it counts as inactive.
def _evaluate_graph_in_batches(self):
"""
Feeds the entire sequence though the MPN in batches. It does so by applying a 'sliding window' over the sequence,
where windows correspond consecutive pairs of start/end frame locations (e.g. frame 1 to 15, 5 to 20, 10 to 25,
etc.).
For every window, a subgraph is created by selecting all detections that fall inside it. Then this graph
is fed to the message passing network, and predictions are stored.
Since windows overlap, we end up with several predictions per edge. We simply average them overall all
windows.
"""
device = torch.device('cuda')
all_frames = np.array(self.full_graph.frames)
frame_num_per_node = torch.from_numpy(self.full_graph.graph_df.frame.values).to(device)
node_names = torch.arange(self.full_graph.graph_obj.x.shape[0])
# Iterate over overlapping windows of (starg_frame, end_frame)
overall_edge_preds = torch.zeros(self.full_graph.graph_obj.num_edges).to(device)
overall_num_preds = overall_edge_preds.clone()
for eval_round, (start_frame, end_frame) in enumerate(zip(all_frames, all_frames[self.full_graph.frames_per_graph - 1:])):
assert ((start_frame <= all_frames) & (all_frames <= end_frame)).sum() == self.full_graph.frames_per_graph
# Create and evaluate a a subgraph corresponding to a batch of frames
nodes_mask = (start_frame <= frame_num_per_node) & (frame_num_per_node <= end_frame)
edges_mask = nodes_mask[self.full_graph.graph_obj.edge_index[0]] & nodes_mask[
self.full_graph.graph_obj.edge_index[1]]
subgraph = Graph(x=self.full_graph.graph_obj.x[nodes_mask],
edge_attr=self.full_graph.graph_obj.edge_attr[edges_mask],
reid_emb_dists=self.full_graph.graph_obj.reid_emb_dists[edges_mask],
edge_index=self.full_graph.graph_obj.edge_index.T[edges_mask].T - node_names[nodes_mask][0])
if hasattr(self.full_graph.graph_obj, 'edge_labels'):
subgraph.edge_labels = self.full_graph.graph_obj.edge_labels[edges_mask]
# Predict edge values for the current batch
edge_preds, pred_mask = self._predict_edges(subgraph=subgraph)
# Store predictions
overall_edge_preds[edges_mask] += edge_preds
assert (overall_num_preds[torch.where(edges_mask)[0][pred_mask]] == overall_num_preds[edges_mask][pred_mask]).all()
overall_num_preds[torch.where(edges_mask)[0][pred_mask]] += 1
# Average edge predictions over all batches, and over each pair of directed edges
final_edge_preds = overall_edge_preds / overall_num_preds
final_edge_preds[torch.isnan(final_edge_preds)] = 0
self.full_graph.graph_obj.edge_preds = final_edge_preds
to_undirected_graph(self.full_graph, attrs_to_update=('edge_preds','edge_labels'))
to_lightweight_graph(self.full_graph)
#print(time() - t)
def _project_graph_model_output(self):
"""
Rounds MPN predictions either via Linear Programming or a greedy heuristic
"""
if self.eval_params['rounding_method'] == 'greedy':
projector = GreedyProjector(self.full_graph)
elif self.eval_params['rounding_method'] == 'exact':
projector = ExactProjector(self.full_graph, solver_backend=self.eval_params['solver_backend'])
else:
raise RuntimeError("Rounding type for projector not understood")
projector.project()
self.full_graph.graph_obj = self.full_graph.graph_obj.numpy()
self.full_graph.constr_satisf_rate = projector.constr_satisf_rate
def _assign_ped_ids(self):
"""
Assigns pedestrian Ids to each detection in the sequence, by determining all connected components in the graph
"""
# Only keep the non-zero edges and Express the result as a CSR matrix so that it can be fed to 'connected_components')
nonzero_mask = self.full_graph.graph_obj.edge_preds == 1
nonzero_edge_index = self.full_graph.graph_obj.edge_index.T[nonzero_mask].T
nonzero_edges = self.full_graph.graph_obj.edge_preds[nonzero_mask].astype(int)
graph_shape = (self.full_graph.graph_obj.num_nodes, self.full_graph.graph_obj.num_nodes)
csr_graph = csr_matrix((nonzero_edges, (tuple(nonzero_edge_index))), shape=graph_shape)
# Get the connected Components:
n_components, labels = connected_components(csgraph=csr_graph, directed=False, return_labels=True)
assert len(labels) == self.full_graph.graph_df.shape[0], "Ped Ids Label format is wrong"
# Each Connected Component is a Ped Id. Assign those values to our DataFrame:
self.final_projected_output = self.full_graph.graph_df.copy()
self.final_projected_output['ped_id'] = labels
self.final_projected_output = self.final_projected_output[VIDEO_COLUMNS + ['conf', 'detection_id']].copy()
def track(self, seq_name):
"""
Main method. Given a sequence name, it tracks all detections and produces an output DataFrame, where each
detection is assigned an ID.
It starts loading a the graph corresponding to an entire video sequence and detections, then uses an MPN to
sequentially evaluate batches of frames (i.e. subgraphs) and finally rounds predictions and applies
postprocessing.
"""
# Load the graph corresponding to the entire sequence
self.full_graph = self._load_full_seq_graph_object(seq_name)
# Feed graph through MPN in batches
self._evaluate_graph_in_batches()
# Round predictions and assign IDs to trajectories
self._project_graph_model_output()
self._assign_ped_ids()
# Postprocess trajectories
if self.eval_params['add_tracktor_detects']:
self.final_projected_output = self._add_tracktor_detects(seq_name)
postprocess = Postprocessor(self.final_projected_output.copy(),
seq_info_dict= self.dataset.seq_info_dicts[seq_name],
eval_params=self.eval_params)
self.tracking_out = postprocess.postprocess_trajectories()
return self.tracking_out
def save_results_to_file(self, output_file_path):
"""
Stores the tracking result to a txt file, in MOTChallenge format.
"""
self.tracking_out['conf'] = 1
self.tracking_out['x'] = -1
self.tracking_out['y'] = -1
self.tracking_out['z'] = -1
self.tracking_out['bb_left'] += 1 # Indexing is 1-based in the ground truth
self.tracking_out['bb_top'] += 1
final_out = self.tracking_out[TRACKING_OUT_COLS].sort_values(by=['frame', 'ped_id'])
final_out.to_csv(output_file_path, header=False, index=False)
########################################### Not revised below
def _add_tracktor_detects(self, seq_name):
def ensure_detects_can_be_used(start_end_per_ped_id):
"""
We make sure that there is no overlap between MPN trajectories. To do so, we make sure that the ending frame
for every trajectory is smaller than the starting frame than the next one.
"""
if start_end_per_ped_id.shape[0] == 1: # If there is a single detection there is nothing to check
return True
start_end_per_ped_id_ = start_end_per_ped_id.sort_values(by='min')
comparisons = start_end_per_ped_id_['min'].values.reshape(-1, 1) <= start_end_per_ped_id_[
'max'].values.reshape(1, -1)
triu_ixs, tril_ixs = np.triu_indices_from(comparisons), np.tril_indices_from(comparisons, k=-1)
return (comparisons[triu_ixs]).all() & (~comparisons[tril_ixs]).all()
# Retrieve the complete scene DataFrame
big_dets_df = self.dataset.seq_det_dfs[seq_name].copy()
complete_df = self.final_projected_output.merge(big_dets_df[
['detection_id', 'tracktor_id', 'frame', 'bb_left',
'bb_top', 'bb_width', 'bb_height', 'bb_right',
'bb_bot', 'frame_path']], how='outer')
assert complete_df.shape[0] == big_dets_df.shape[0], "Merging to add tracktor detects did not work properly"
unique_tracktor_ids = complete_df.tracktor_id.unique()
complete_df.sort_values(by=['tracktor_id', 'frame'], inplace=True)
complete_df.set_index('tracktor_id', inplace=True)
for tracktor_id in unique_tracktor_ids:
detects_per_tracktor_id = complete_df.loc[tracktor_id][['detection_id', 'ped_id', 'frame']]
if not isinstance(detects_per_tracktor_id,
pd.Series): # If there is a single detect, then there's nothing to do
initial_num_of_dets = detects_per_tracktor_id['ped_id'].isnull().sum()
# For each MPN id, determine which detections under this 'tracktor id
start_end_per_ped_id = \
detects_per_tracktor_id[detects_per_tracktor_id.ped_id.notnull()].groupby(['ped_id'])[
'frame'].agg(
['min', 'max'])
# Good ONe
# Make sure we will not mess up thnigs
if ensure_detects_can_be_used(start_end_per_ped_id):
# We will build an empty assignment array, to give tracktor detects their id
ped_ids = np.empty(detects_per_tracktor_id.shape[0])
ped_ids[...] = np.nan
for ped_id, (start_frame, end_frame) in start_end_per_ped_id.iterrows():
ixs = np.where(detects_per_tracktor_id['frame'].between(start_frame, end_frame))[0]
ped_ids[ixs] = ped_id
# We may want to complete our trajectories with beginning/end trajectories corresponding to tracktor.
# This can be crucial to save our isolated detections, and also can help compensate for using low target_fps's
if self.eval_params['use_tracktor_start_ends']:
assigned_ped_ids_ixs = np.where(~np.isnan(ped_ids))[0]
if len(assigned_ped_ids_ixs) > 0:
first_ped_id_ix, last_ped_id_ix = assigned_ped_ids_ixs.min(), assigned_ped_ids_ixs.max()
ped_ids[:first_ped_id_ix + 1] = ped_ids[first_ped_id_ix]
ped_ids[last_ped_id_ix + 1:] = ped_ids[last_ped_id_ix]
# print(f"Added {(~np.isnan(ped_ids)).sum()} detections to a set of {initial_num_of_dets}")
# Finally, assign the ped_ids to the given
complete_df.loc[tracktor_id, 'ped_id'] = ped_ids.reshape(-1, 1)
else:
# print_or_log(f"Found overlapping trajectories between tracktor and MPN. Lost {detects_per_tracktor_id.shape[0]} detects", self.logger)
# Here we need to be more careful, we interpolate the intervals between Id switches
# Determine which locations have ped ids assigned
assign_ped_ids_ixs = sorted(np.where(detects_per_tracktor_id.ped_id.notnull())[0])
assign_ped_ids = detects_per_tracktor_id.iloc[assign_ped_ids_ixs]['ped_id']
changes = np.where((assign_ped_ids[:-1] - assign_ped_ids[1:]) != 0)[0]
# build_intervals
# Iterate over id switches among them in order to determines which intervals can be safely interpolated
start_ix = assign_ped_ids_ixs[0]
# curr_ped_id = assign_ped_ids.iloc[start_ix]
curr_ped_id = assign_ped_ids.iloc[0]
# curr_ped_id = assign_ped_ids.iloc[0]
interv_dict = {ped_id: [] for ped_id in assign_ped_ids}
for change in changes:
interv_dict[curr_ped_id].append(np.arange(start_ix, assign_ped_ids_ixs[change] + 1))
start_ix = assign_ped_ids_ixs[change + 1] # Next ped id appearance
curr_ped_id = assign_ped_ids.iloc[change + 1]
# Append the last interval
end_ix = assign_ped_ids_ixs[-1]
interv_dict[curr_ped_id].append(np.arange(start_ix, end_ix + 1))
# Create the id assignment array
ped_ids = np.empty(detects_per_tracktor_id.shape[0])
ped_ids[...] = np.nan
for ped_id, ixs_list in interv_dict.items():
if len(ixs_list) > 0:
all_ixs = np.concatenate(ixs_list)
ped_ids[all_ixs] = ped_id
# TODO: Repeated code.
if self.eval_params['use_tracktor_start_ends']:
if len(assign_ped_ids_ixs) > 0:
first_ped_id_ix, last_ped_id_ix = assign_ped_ids_ixs[0], assign_ped_ids_ixs[-1]
ped_ids[:first_ped_id_ix + 1] = ped_ids[first_ped_id_ix]
ped_ids[last_ped_id_ix + 1:] = ped_ids[last_ped_id_ix]
complete_df.loc[tracktor_id, 'ped_id'] = ped_ids.reshape(-1, 1)
# print_or_log(f"Recovered {(~np.isnan(ped_ids)).sum()} detects", self.logger)
# Our final DataFrame is this one!!!!!!!!!!!!!!!!
final_out = complete_df[complete_df.ped_id.notnull()].reset_index()
final_out['conf'] = final_out['conf'].fillna(1)
# If some rare cases two dets in the same frame may get mapped to the same id, just average coordinates:
final_out = final_out.groupby(['frame', 'frame_path', 'ped_id']).mean().reset_index()
assert final_out[['frame', 'ped_id']].drop_duplicates().shape[0] == final_out.shape[0]
return final_out | 52.539295 | 156 | 0.631402 |
7953cc6bb3a8d10e80c1e6a8942c4ddc3ab9217b | 2,657 | py | Python | main.py | filipesouzacit/RL-with-MCTS | cca1a8a79e5973a30b423c45a090e2473975c189 | [
"MIT"
] | 1 | 2021-01-13T00:24:16.000Z | 2021-01-13T00:24:16.000Z | main.py | filipesouzacit/RL-with-MCTS | cca1a8a79e5973a30b423c45a090e2473975c189 | [
"MIT"
] | null | null | null | main.py | filipesouzacit/RL-with-MCTS | cca1a8a79e5973a30b423c45a090e2473975c189 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Thus Jan 07 14:44:12 2021
@author: Filipe Souza
Based on Josh Varty (https://github.com/JoshVarty/AlphaZeroSimple)
"""
import gym
import numpy as np
from model import CNNmodel
from trainer import Trainer
from tkinter import Tk,Label,mainloop
def getAction(action):
if isinstance(action, tuple) or isinstance(action, list) or isinstance(action, np.ndarray):
action = args['boardSize'] * action[0] + action[1]
elif action is None:
action = args['boardSize'] ** 2
return action
def alert_popup(title, message, path):
root = Tk()
root.title(title)
w = 200 # popup window width
h = 100 # popup window height
sw = root.winfo_screenwidth()
sh = root.winfo_screenheight()
x = (sw - w)/2
y = (sh - h)/2
root.geometry('%dx%d+%d+%d' % (w, h, x, y))
m = message
m += '\n'
m += path
w = Label(root, text=m, width=120, height=10)
w.pack()
mainloop()
args = {
'boardSize': 9,
1.0: 'BLACK',
-1.0: 'WHITE',
'batchSize': 64,
'numIters': 20, # Total number of training iterations
'num_simulations': 100, # Total number of MCTS simulations to run when deciding on a move to play
'numEps': 81, # Number of full games (episodes) to run during each iteration
'numItersForTrainExamplesHistory': 20,
'epochs': 2, # Number of epochs of training per iteration
'checkpointPath': 'model.hdf5' # location to save latest set of weights
}
game = None #gym.make('gym_go:go-v0', size=args['boardSize'], komi=0, reward_method='heuristic')
model = CNNmodel(args['boardSize'], (args['boardSize'] * args['boardSize'])+1, args)
trainer = Trainer(game, model, args)
trainer.learn()
game = gym.make('gym_go:go-v0', size=args['boardSize'], komi=0, reward_method='heuristic')
while not(game.done):
actions, value = model.predict(game.state())
valid_moves = game.valid_moves()
action_probs = actions * valid_moves # mask invalid moves
action_probs /= np.sum(action_probs)
action = (args['boardSize'] * args['boardSize'])
if np.argmax(action_probs[:-1]) > 0:
action = np.argmax(action_probs[:-1])
game.step(action)
if not(game.done):
validMove = game.valid_moves()
action = game.render('human')
while validMove[getAction(action)]==0:
action = game.render('human')
game.step(getAction(action))
alert_popup("!!!Winner!!!", "The winner is:", args[game.winner()])
| 32.802469 | 125 | 0.610463 |
7953cd8bcc3fa20c75a79dbabbf67e3afe39de66 | 7,031 | py | Python | app/models.py | robbi5/pulse | eefe4954ed15c3a3cf5cb19711a76a84198c8da3 | [
"CC0-1.0"
] | 12 | 2016-03-16T11:14:49.000Z | 2021-03-14T00:16:28.000Z | app/models.py | robbi5/pulse | eefe4954ed15c3a3cf5cb19711a76a84198c8da3 | [
"CC0-1.0"
] | 9 | 2016-03-16T11:18:24.000Z | 2021-04-02T15:54:46.000Z | app/models.py | robbi5/pulse | eefe4954ed15c3a3cf5cb19711a76a84198c8da3 | [
"CC0-1.0"
] | 2 | 2016-03-28T03:12:00.000Z | 2020-02-04T23:57:49.000Z | from tinydb import TinyDB, where, Query
import os
import io
import datetime
import csv
from app.data import CSV_FIELDS, FIELD_MAPPING, LABELS
this_dir = os.path.dirname(__file__)
try:
db = TinyDB(os.path.join(this_dir, '../data/db.json'))
except ValueError:
print("Couldn't load TinyDB. Things may not work as expected.")
# These functions are meant to be the only ones that access the db
# directly. If we ever decide to migrate from tinydb, that can all be
# coordinated here.
# Data loads should clear the entire database first.
def clear_database():
db.purge_tables()
# convenience
q = Query()
class Report:
# report_date (string, YYYY-MM-DD)
# report_type (string, all/federal/city)
# https.eligible (number)
# https.uses (number)
# https.enforces (number)
# https.hsts (number)
# https.bod (number)
# analytics.eligible (number)
# analytics.participates (number)
# Initialize a report with a given date.
def create(data):
db.table('reports').insert(data)
def report_time(report_date):
return datetime.datetime.strptime(report_date, "%Y-%m-%d")
# There's only ever one.
def latest():
reports = db.table('reports').all()
if len(reports) > 0:
return reports[0]
else:
return None
# There's only ever one.
def latest_for_type(type):
reports = db.table('reports').search(
Query()['report_type'] == type
)
if len(reports) > 0:
return reports[0]
else:
return None
class Domain:
# domain (string)
# domain_type (string, federal/city)
# agency_slug (string)
# is_parent (boolean)
#
# agency_name (string)
# branch (string, legislative/judicial/executive)
# state (string)
# parent_domain (string)
# sources (array of strings)
#
# live? (boolean)
# redirect? (boolean)
# canonical (string, URL)
#
# totals: {
# https: { ... }
# crypto: { ... }
# }
#
# https: { ... }
# analytics: { ... }
#
def create(data):
return db.table('domains').insert(data)
def create_all(iterable):
return db.table('domains').insert_multiple(iterable)
def update(domain_name, data):
return db.table('domains').update(
data,
where('domain') == domain_name
)
def add_report(domain_name, report_name, report):
return db.table('domains').update(
{
report_name: report
},
where('domain') == domain_name
)
def find(domain_name):
return db.table('domains').get(q.domain == domain_name)
# Useful when you want to pull in all domain entries as peers,
# such as reports which only look at parent domains, or
# a flat CSV of all hostnames that match a report.
def eligible(report_name):
return db.table('domains').search(
Query()[report_name]['eligible'] == True
)
# Useful when you have mixed parent/subdomain reporting,
# used for HTTPS but not yet others.
def eligible_parents(report_name):
return db.table('domains').search(
(Query()[report_name]['eligible_zone'] == True) &
(where("is_parent") == True)
)
# Useful when you want to pull down subdomains of a particular
# parent domain. Used for HTTPS expanded reports.
def eligible_for_domain(domain, report_name):
return db.table('domains').search(
(Query()[report_name]['eligible'] == True) &
(where("base_domain") == domain)
)
def eligible_for_agency_and_type(agency_slug, domain_type, report_name):
return db.table('domains').search(
(Query()[report_name].exists()) &
(where("agency_slug") == agency_slug) &
(where("domain_type") == domain_type)
)
def eligible_for_type(domain_type, report_name):
return db.table('domains').search(
(Query()[report_name].exists()) &
(where("domain_type") == domain_type)
)
def eligible_parents_for_type(domain_type, report_name):
return db.table('domains').search(
(Query()[report_name]['eligible_zone'] == True) &
(where("domain_type") == domain_type) &
(where("is_parent") == True)
)
def db():
return db
def all():
return db.table('domains').all()
def to_csv(domains, report_type):
output = io.StringIO()
writer = csv.writer(output, quoting=csv.QUOTE_NONNUMERIC)
def value_for(value):
# if it's a list, convert it to a list of strings and join
if type(value) is list:
value = [str(x) for x in value]
value = ", ".join(value)
elif type(value) is bool:
value = {True: 'Yes', False: 'No'}[value]
return value
# initialize with a header row
header = []
# Common fields, and report-specific fields
for category in ['common', report_type]:
for field in CSV_FIELDS[category]:
header.append(LABELS[category][field])
writer.writerow(header)
for domain in domains:
row = []
# Common fields, and report-specific fields
for category in ['common', report_type]:
# Currently, all report-specific fields use a mapping
for field in CSV_FIELDS[category]:
# common fields are top-level on Domain objects
if category == 'common':
value = domain.get(field)
else:
value = domain[report_type].get(field)
# If a mapping exists e.g. 1 -> "Yes", etc.
if (
FIELD_MAPPING.get(category) and
FIELD_MAPPING[category].get(field) and
(FIELD_MAPPING[category][field].get(value) is not None)
):
value = FIELD_MAPPING[category][field][value]
row.append(value_for(value))
writer.writerow(row)
return output.getvalue()
class Agency:
# agency_slug (string)
# agency_name (string)
# type (string, federal/city)
# branch (string)
# total_domains (number)
#
# https {
# eligible (number)
# uses (number)
# enforces (number)
# hsts (number)
# modern (number)
# preloaded (number)
# }
# analytics {
# eligible (number)
# participating (number)
# }
#
# An agency which had at least 1 eligible domain.
def eligible(report_name):
return db.table('agencies').search(
Query()[report_name]['eligible'] > 0
)
def eligible_for_type(type, report_name):
return db.table('agencies').search(
(Query()[report_name]['eligible'] > 0) &
(where("type") == type)
)
# Create a new Agency record with a given name, slug, and total domain count.
def create(data):
return db.table('agencies').insert(data)
def create_all(iterable):
return db.table('agencies').insert_multiple(iterable)
# For a given agency, add a report.
def add_report(slug, report_name, report):
return db.table('agencies').update(
{
report_name: report
},
where('slug') == slug
)
def find(slug):
agencies = db.table('agencies').search(where('slug') == slug)
if len(agencies) > 0:
return agencies[0]
else:
return None
def all():
return db.table('agencies').all()
| 25.944649 | 79 | 0.63348 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.