hexsha stringlengths 40 40 | size int64 5 2.06M | ext stringclasses 10 values | lang stringclasses 1 value | max_stars_repo_path stringlengths 3 248 | max_stars_repo_name stringlengths 5 125 | 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 248 | max_issues_repo_name stringlengths 5 125 | 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 248 | max_forks_repo_name stringlengths 5 125 | 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 5 2.06M | avg_line_length float64 1 1.02M | max_line_length int64 3 1.03M | alphanum_fraction float64 0 1 | count_classes int64 0 1.6M | score_classes float64 0 1 | count_generators int64 0 651k | score_generators float64 0 1 | count_decorators int64 0 990k | score_decorators float64 0 1 | count_async_functions int64 0 235k | score_async_functions float64 0 1 | count_documentation int64 0 1.04M | score_documentation float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
577c1794e9fcb7bdccc6a2a9158ce5b0867f7053 | 4,230 | py | Python | notebook/pandas_agg.py | vhn0912/python-snippets | 80b2e1d6b2b8f12ae30d6dbe86d25bb2b3a02038 | [
"MIT"
] | 174 | 2018-05-30T21:14:50.000Z | 2022-03-25T07:59:37.000Z | notebook/pandas_agg.py | vhn0912/python-snippets | 80b2e1d6b2b8f12ae30d6dbe86d25bb2b3a02038 | [
"MIT"
] | 5 | 2019-08-10T03:22:02.000Z | 2021-07-12T20:31:17.000Z | notebook/pandas_agg.py | vhn0912/python-snippets | 80b2e1d6b2b8f12ae30d6dbe86d25bb2b3a02038 | [
"MIT"
] | 53 | 2018-04-27T05:26:35.000Z | 2022-03-25T07:59:37.000Z | import pandas as pd
import numpy as np
print(pd.__version__)
# 1.0.0
print(pd.DataFrame.agg is pd.DataFrame.aggregate)
# True
df = pd.DataFrame({'A': [0, 1, 2], 'B': [3, 4, 5]})
print(df)
# A B
# 0 0 3
# 1 1 4
# 2 2 5
print(df.agg(['sum', 'mean', 'min', 'max']))
# A B
# sum 3.0 12.0
# mean 1.0 4.0
# min 0.0 3.0
# max 2.0 5.0
print(type(df.agg(['sum', 'mean', 'min', 'max'])))
# <class 'pandas.core.frame.DataFrame'>
print(df.agg(['sum']))
# A B
# sum 3 12
print(type(df.agg(['sum'])))
# <class 'pandas.core.frame.DataFrame'>
print(df.agg('sum'))
# A 3
# B 12
# dtype: int64
print(type(df.agg('sum')))
# <class 'pandas.core.series.Series'>
print(df.agg({'A': ['sum', 'min', 'max'],
'B': ['mean', 'min', 'max']}))
# A B
# max 2.0 5.0
# mean NaN 4.0
# min 0.0 3.0
# sum 3.0 NaN
print(df.agg({'A': 'sum', 'B': 'mean'}))
# A 3.0
# B 4.0
# dtype: float64
print(df.agg({'A': ['sum'], 'B': ['mean']}))
# A B
# mean NaN 4.0
# sum 3.0 NaN
print(df.agg({'A': ['min', 'max'], 'B': 'mean'}))
# A B
# max 2.0 NaN
# mean NaN 4.0
# min 0.0 NaN
print(df.agg(['sum', 'mean', 'min', 'max'], axis=1))
# sum mean min max
# 0 3.0 1.5 0.0 3.0
# 1 5.0 2.5 1.0 4.0
# 2 7.0 3.5 2.0 5.0
s = df['A']
print(s)
# 0 0
# 1 1
# 2 2
# Name: A, dtype: int64
print(s.agg(['sum', 'mean', 'min', 'max']))
# sum 3.0
# mean 1.0
# min 0.0
# max 2.0
# Name: A, dtype: float64
print(type(s.agg(['sum', 'mean', 'min', 'max'])))
# <class 'pandas.core.series.Series'>
print(s.agg(['sum']))
# sum 3
# Name: A, dtype: int64
print(type(s.agg(['sum'])))
# <class 'pandas.core.series.Series'>
print(s.agg('sum'))
# 3
print(type(s.agg('sum')))
# <class 'numpy.int64'>
print(s.agg({'Total': 'sum', 'Average': 'mean', 'Min': 'min', 'Max': 'max'}))
# Total 3.0
# Average 1.0
# Min 0.0
# Max 2.0
# Name: A, dtype: float64
# print(s.agg({'NewLabel_1': ['sum', 'max'], 'NewLabel_2': ['mean', 'min']}))
# SpecificationError: nested renamer is not supported
print(df.agg(['mad', 'amax', 'dtype']))
# A B
# mad 0.666667 0.666667
# amax 2 5
# dtype int64 int64
print(df['A'].mad())
# 0.6666666666666666
print(np.amax(df['A']))
# 2
print(df['A'].dtype)
# int64
# print(df.agg(['xxx']))
# AttributeError: 'xxx' is not a valid function for 'Series' object
# print(df.agg('xxx'))
# AttributeError: 'xxx' is not a valid function for 'DataFrame' object
print(hasattr(pd.DataFrame, '__array__'))
# True
print(hasattr(pd.core.groupby.GroupBy, '__array__'))
# False
print(df.agg([np.sum, max]))
# A B
# sum 3 12
# max 2 5
print(np.sum(df['A']))
# 3
print(max(df['A']))
# 2
print(np.abs(df['A']))
# 0 0
# 1 1
# 2 2
# Name: A, dtype: int64
print(df.agg([np.abs]))
# A B
# absolute absolute
# 0 0 3
# 1 1 4
# 2 2 5
# print(df.agg([np.abs, max]))
# ValueError: cannot combine transform and aggregation operations
def my_func(x):
return min(x) / max(x)
print(df.agg([my_func, lambda x: min(x) / max(x)]))
# A B
# my_func 0.0 0.6
# <lambda> 0.0 0.6
print(df['A'].std())
# 1.0
print(df['A'].std(ddof=0))
# 0.816496580927726
print(df.agg(['std', lambda x: x.std(ddof=0)]))
# A B
# std 1.000000 1.000000
# <lambda> 0.816497 0.816497
print(df.agg('std', ddof=0))
# A 0.816497
# B 0.816497
# dtype: float64
print(df.agg(['std'], ddof=0))
# A B
# std 1.0 1.0
df_str = df.assign(C=['X', 'Y', 'Z'])
print(df_str)
# A B C
# 0 0 3 X
# 1 1 4 Y
# 2 2 5 Z
# df_str['C'].mean()
# TypeError: Could not convert XYZ to numeric
print(df_str.agg(['sum', 'mean']))
# A B C
# sum 3.0 12.0 XYZ
# mean 1.0 4.0 NaN
print(df_str.agg(['mean', 'std']))
# A B
# mean 1.0 4.0
# std 1.0 1.0
print(df_str.agg(['sum', 'min', 'max']))
# A B C
# sum 3 12 XYZ
# min 0 3 X
# max 2 5 Z
print(df_str.select_dtypes(include='number').agg(['sum', 'mean']))
# A B
# sum 3.0 12.0
# mean 1.0 4.0
| 18.883929 | 77 | 0.513002 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,762 | 0.652955 |
577c3969fe84dd6102e296297a763c6f7d167111 | 4,016 | py | Python | boonai/model.py | Scapogo/boonai | ebc889cdc7a67e613c512f694ed8050e78b9b4e8 | [
"MIT"
] | null | null | null | boonai/model.py | Scapogo/boonai | ebc889cdc7a67e613c512f694ed8050e78b9b4e8 | [
"MIT"
] | null | null | null | boonai/model.py | Scapogo/boonai | ebc889cdc7a67e613c512f694ed8050e78b9b4e8 | [
"MIT"
] | null | null | null | from flask_sqlalchemy import SQLAlchemy
from flask_user import UserMixin
from itsdangerous import (TimedJSONWebSignatureSerializer as
Serializer, BadSignature, SignatureExpired)
db = SQLAlchemy()
class User(db.Model, UserMixin):
__tablename__ = 'user'
id = db.Column(db.Integer, primary_key=True)
active = db.Column('is_active', db.Boolean(), nullable=False, server_default='1')
username = db.Column(db.String(100), nullable=False, unique=True)
password = db.Column(db.String(255), nullable=False, server_default='')
email = db.Column(db.String(255))
email_confirmed_at = db.Column(db.DateTime())
# User information
first_name = db.Column(db.String(100), nullable=False, server_default='')
last_name = db.Column(db.String(100), nullable=False, server_default='')
# Define the relationships
roles = db.relationship('Role', secondary='user_role')
datasets = db.relationship('Dataset', secondary='user_dataset')
groups = db.relationship('Group', secondary='user_group')
def generate_auth_token(self, expiration = 600):
s = Serializer(db.app.config['SECRET_KEY'], expires_in=expiration)
return s.dumps({ 'id': self.id })
@staticmethod
def verify_auth_token(token):
s = Serializer(db.app.config['SECRET_KEY'])
try:
data = s.loads(token)
except SignatureExpired:
return None # valid token, but expired
except BadSignature:
return None # invalid token
user = User.query.get(data['id'])
return user
class Group(db.Model):
__tablename__ = 'group'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50), unique=True, nullable=False)
description = db.Column(db.String(50), nullable=False)
class Role(db.Model):
__tablename__ = 'role'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50), unique=True)
description = db.Column(db.String(50))
class Dataset(db.Model):
__tablename__ = 'dataset'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
description = db.Column(db.String(1000))
train = db.Column(db.Boolean)
test = db.Column(db.Boolean)
features_type = db.Column(db.String(20))
labels_type = db.Column(db.String(20))
label = db.Column(db.Boolean)
project_id = db.Column(db.Integer)
user_id = db.Column(db.Integer)
file_id = db.Column(db.Integer, db.ForeignKey('file.id', ondelete='CASCADE'))
class UserRole(db.Model):
__tablename__ = 'user_role'
id = db.Column(db.Integer(), primary_key=True)
user_id = db.Column(db.Integer(), db.ForeignKey('user.id', ondelete='CASCADE'))
role_id = db.Column(db.Integer(), db.ForeignKey('role.id', ondelete='CASCADE'))
class UserDataset(db.Model):
__tablename__ = 'user_dataset'
id = db.Column(db.Integer(), primary_key=True)
user_id = db.Column(db.Integer(), db.ForeignKey('user.id', ondelete='CASCADE'))
dataset_id = db.Column(db.Integer(), db.ForeignKey('dataset.id', ondelete='CASCADE'))
class UserDatasets(db.Model):
__tablename__ = 'user_group'
id = db.Column(db.Integer(), primary_key=True)
user_id = db.Column(db.Integer(), db.ForeignKey('user.id', ondelete='CASCADE'))
group_id = db.Column(db.Integer(), db.ForeignKey('group.id', ondelete='CASCADE'))
class TrainedModel(db.Model):
__tablename__ = 'trained_model'
id = db.Column(db.Integer, primary_key=True)
name = db.Column(db.String(50))
description = db.Column(db.String(1000))
project_id = db.Column(db.Integer)
user_id = db.Column(db.Integer)
algorithm_id = db.Column(db.Integer)
file_id = db.Column(db.Integer)
dataset_id = db.Column(
db.Integer(),
db.ForeignKey('dataset.id', ondelete='CASCADE')
)
class File(db.Model):
__tablename__ = 'file'
id = db.Column(db.Integer, primary_key=True)
content= db.Column(db.LargeBinary, nullable=False) | 35.539823 | 89 | 0.677042 | 3,768 | 0.938247 | 0 | 0 | 361 | 0.08989 | 0 | 0 | 433 | 0.107819 |
577d66ecbe1bdf71f6e1d9db706fc825c2daa640 | 6,324 | py | Python | botfw/bitflyer/api_web.py | Snufkin0866/btc_bot_framework | 164db3924ec2126e71cfac4be96acc65fb47d1d6 | [
"MIT"
] | 3 | 2020-10-17T14:08:57.000Z | 2021-07-08T03:30:52.000Z | botfw/bitflyer/api_web.py | Snufkin0866/btc_bot_framework | 164db3924ec2126e71cfac4be96acc65fb47d1d6 | [
"MIT"
] | null | null | null | botfw/bitflyer/api_web.py | Snufkin0866/btc_bot_framework | 164db3924ec2126e71cfac4be96acc65fb47d1d6 | [
"MIT"
] | 2 | 2021-01-07T15:12:38.000Z | 2021-04-01T19:11:50.000Z | import json
from urllib.parse import urlencode
import requests
from bs4 import BeautifulSoup
from .api import BitflyerApi
class BitflyerApiWithWebOrder(BitflyerApi):
def __init__(self, ccxt, login_id, password, account_id,
device_id=None, device_token=None):
super().__init__(ccxt)
self.api = BitFlyerWebAPI(
login_id, password, account_id, device_id, device_token)
self.api.login()
def create_order(self, symbol, type_, side, size, price=0,
minute_to_expire=43200, time_in_force='GTC'):
self.api.set_timeout(20)
res = self._exec(self.api.send_order,
symbol, type_.upper(), side.upper(), size, price,
minute_to_expire, time_in_force)
# {'status': 0,
# 'error_message': None,
# 'data': {'order_ref_id': 'JRF20180509-220225-476540'}}
#
# 0: success
# -501: session expired
# -153: minimum size >= 0.01
# ...
st, err = res['status'], res['error_message']
if st != 0:
if res['status'] == -501:
self.api.login()
raise Exception(f'create_order: {st}, {err}')
return {'id': res['data']['order_ref_id']}
class BitFlyerWebAPI:
def __init__(self, login_id, password, account_id,
device_id=None, device_token=None):
self.login_id = login_id
self.password = password
self.account_id = account_id
self.device_id = device_id
self.device_token = device_token
self.domain = 'lightning.bitflyer.jp'
self.url = 'https://lightning.bitflyer.jp/api/trade'
self.headers = {
'User-agent': 'Mozilla/5.0 (X11; Linux x86_64) \
AppleWebKit/537.36 (KHTML, like Gecko) \
Chrome/65.0.3325.181 Safari/537.36',
'Content-Type': 'application/json; charset=utf-8',
'X-Requested-With': 'XMLHttpRequest',
}
self.timeout = (10, 10)
self.session = None
def set_timeout(self, sec):
self.timeout = (sec, sec)
def login(self):
s = requests.Session()
if self.device_id and self.device_token:
s.cookies.set(
'device_id', self.device_id, domain=self.domain)
s.cookies.set(
'device_token', self.device_token, domain=self.domain)
r = s.get('https://' + self.domain)
params = {
'LoginId': self.login_id,
'password': self.password,
'__RequestVerificationToken':
BeautifulSoup(r.text, 'html.parser').find(
attrs={'name': '__RequestVerificationToken'}).get('value'),
}
s.post('https://' + self.domain, data=params)
self.session = s
def post(self, path, param):
url = self.url + path
param['account_id'] = self.account_id
param['lang'] = 'ja'
data = json.dumps(param).encode('utf-8')
res = self.session.post(url, data=data, headers=self.headers,
timeout=self.timeout)
return json.loads(res.text)
def get(self, path, param=None):
if not param:
param = {}
param['account_id'] = self.account_id
param['lang'] = 'ja'
param['v'] = '1'
url = self.url + path + '?' + urlencode(param)
res = self.session.get(url, headers=self.headers,
timeout=self.timeout)
return json.loads(res.text)
def param(self, symbol, ord_type, side, price=0, size=0,
minute_to_expire=43200, trigger=0, offset=0):
return {
'product_code': symbol,
'ord_type': ord_type,
'side': side,
'price': price,
'size': size,
'minuteToExpire': minute_to_expire,
'trigger': trigger,
'offset': offset,
}
def health(self, symbol):
param = {'product_code': symbol}
return self.get('/gethealth', param)
def ticker(self, symbol):
param = {
'product_code': symbol,
'offset_seconds': 300,
'v': 1,
}
return self.get('/ticker', param)
def all_tickers(self):
param = {'v': 1}
return self.get('/ticker/all', param)
def ticker_data(self, symbol):
param = {'product_code': symbol}
return self.get('/tickerdata', param)
def send_order(self, symbol, type_, side, size, price=0,
minute_to_expire=43200, time_in_force='GTC'):
param = {
'product_code': symbol,
'ord_type': type_,
'side': side,
'price': price,
'size': size,
'minuteToExpire': minute_to_expire,
'time_in_force': time_in_force,
'is_check': False,
}
return self.post('/sendorder', param)
def cancel_order(self, symbol, order_id, parent_order_id):
param = {
'product_code': symbol,
'order_id': order_id,
'parent_order_id': parent_order_id,
}
return self.post('/cancelorder', param)
def cancel_all_order(self, symbol):
param = {
'product_code': symbol,
}
return self.post('/cancelallorder', param)
def get_collateral(self, symbol):
param = {
'product_code': symbol,
}
return self.post('/getmyCollateral', param)
def my_board_orders(self, symbol):
param = {
'product_code': symbol,
}
return self.post('/getMyBoardOrders', param)
def my_child_order(self, symbol, order_id):
param = {
'product_code': symbol,
'order_id': order_id,
}
return self.post('/getMyChildOrder', param)
def my_executions(self, symbol, count):
param = {
'product_code': symbol,
'number_of_executions': count,
}
return self.post('/getmyexecutionhistory', param)
def send_chat(self, message):
param = {
'channel': 'MAIN_JP',
'nickname': '',
'message': message,
}
return self.post('/sendchat', param)
| 31.778894 | 79 | 0.542062 | 6,194 | 0.979443 | 0 | 0 | 0 | 0 | 0 | 0 | 1,345 | 0.212682 |
577f6cf385c7b053dbf2eea92626a248674a8677 | 2,969 | py | Python | codes/train.py | PowerLZY/malware_classification_bdci | 42058b076a06174d629cc759a1d0e81224baeb06 | [
"MIT"
] | 8 | 2022-02-14T07:10:14.000Z | 2022-03-23T05:18:43.000Z | codes/train.py | PowerLZY/malware_classification_bdci | 42058b076a06174d629cc759a1d0e81224baeb06 | [
"MIT"
] | null | null | null | codes/train.py | PowerLZY/malware_classification_bdci | 42058b076a06174d629cc759a1d0e81224baeb06 | [
"MIT"
] | 1 | 2022-02-17T06:21:23.000Z | 2022-02-17T06:21:23.000Z | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
'''
@File : train.py
@Contact : 3289218653@qq.com
@License : (C)Copyright 2021-2022 PowerLZY
@Modify Time @Author @Version @Desciption
------------ ------- -------- -----------
2021-10-04 15:03 PowerLZY&yuan_mes 1.0 保存训练模型,特征选择模型和单特征类别权重
'''
import warnings
import os
import sys
import joblib
import numpy as np
import pandas as pd
curPath = os.path.abspath(os.path.dirname("__file__"))
rootPath = os.path.split(curPath)[0]
sys.path.append(rootPath)
from sklearn.ensemble import ExtraTreesClassifier
from sklearn.feature_selection import SelectFromModel
from sklearn.utils import class_weight
from xgboost import XGBClassifier
from codes.utils import load_data
from codes.feature_engineering import feature_engineering
from codes.model import Model
warnings.filterwarnings('ignore')
def train_model(train_data_dict, train_labels, inter_path):
model_A = XGBClassifier(
objective='multi:softprob',
num_class=10,
max_depth=6,
n_estimators=90,
learning_rate=0.1,
eval_metric='mlogloss',
use_label_encoder=False
)
classes_weights = class_weight.compute_sample_weight(
class_weight='balanced',
y=train_labels
)
labels_loss = pd.DataFrame()
print(f"------------------------ 开始训练 ------------------------")
for name, train_data in train_data_dict.items():
if name in ['words_1000', 'words_300', 'ember_section_ins_words', 'ember_section_ins_semantic']:
# 使用了TF-IDF的特征做特征选择
selector = SelectFromModel(estimator=ExtraTreesClassifier(n_estimators=200)).fit(train_data, train_labels,
sample_weight=classes_weights)
joblib.dump(selector, open(f"{inter_path}/models/select_model_{name}.pth", "wb"))
train_data = selector.transform(train_data)
clf = Model(model_A, train_data, train_labels, name, inter_path, labels_loss)
clf.Fit()
labels_loss[name] = clf.get_class_weight()
labels_loss[np.isnan(labels_loss)] = 0
labels_loss[labels_loss < 0] = 0
labels_loss.to_csv(f"{inter_path}/feature/labels_loss.csv", index=False)
print(f"------------------------ 训练完成 ------------------------")
if __name__ == '__main__':
inter_path = '../data/user_data'
data_path = '../data/raw_data'
feature_list = ['ember', 'section', 'imports', 'exports', 'words_1000', 'semantic', 'ember_section_ins_words', 'ember_section_ins_semantic']
print(f"------------------------ 训练集特征工程 ------------------------")
feature_engineering("train", data_path, inter_path)
train_data_dict = load_data('train', feature_list, inter_path)
train_lab_path = f"{inter_path}/train_y.npy"
train_y = np.load(train_lab_path)
train_model(train_data_dict, train_y, inter_path)
| 33.359551 | 144 | 0.633883 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,057 | 0.345087 |
5782896b4d6e5c85e7c0c81d31dbd8cff1438078 | 453 | py | Python | crawlMp/enums.py | domarm-comat/crawlMp | 32b66573f351a2f28fcb7ce8627f8605975f76eb | [
"MIT"
] | 1 | 2021-12-03T15:14:36.000Z | 2021-12-03T15:14:36.000Z | crawlMp/enums.py | domarm-comat/crawlMp | 32b66573f351a2f28fcb7ce8627f8605975f76eb | [
"MIT"
] | 2 | 2021-12-03T16:10:14.000Z | 2021-12-03T18:09:33.000Z | crawlMp/enums.py | domarm-comat/crawlMp | 32b66573f351a2f28fcb7ce8627f8605975f76eb | [
"MIT"
] | null | null | null | from enum import Enum
from typing import Tuple, Type, Optional
class Mode(Enum):
SIMPLE = "s"
EXTENDED = "e"
def __str__(self) -> str:
return self.value
class Header(Enum):
PATH = "Path"
NAME = "Name"
SIZE = "Size"
MODIFIED = "Modified"
ACCESSED = "Accessed"
INPUT = "Input"
OUTPUT = "Output"
def __str__(self) -> str:
return self.value
Header_ref = Tuple[Header, Type, Optional[str]]
| 16.777778 | 47 | 0.602649 | 334 | 0.737307 | 0 | 0 | 0 | 0 | 0 | 0 | 59 | 0.130243 |
5782a0f511913dc91413d535eac081c7bb757a0f | 6,190 | py | Python | protocols.py | MartinKist/p2p | 046c6258f936789aff73b884235b9b202e7e7f7a | [
"MIT"
] | 2 | 2021-06-29T11:32:59.000Z | 2021-06-30T09:11:24.000Z | protocols.py | MartinKist/p2p | 046c6258f936789aff73b884235b9b202e7e7f7a | [
"MIT"
] | null | null | null | protocols.py | MartinKist/p2p | 046c6258f936789aff73b884235b9b202e7e7f7a | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# (c) 2021 Martin Kistler
from abc import ABC, abstractmethod
from enum import Enum
from os import linesep
from twisted.internet import reactor
from twisted.internet.error import ConnectionDone
from twisted.internet.protocol import Factory, Protocol
from twisted.logger import Logger
from twisted.protocols import basic
from twisted.python.failure import Failure
from models import Version, Message, VerAck, MessageError, GetAddr, NetworkAddress, Addr, Ping, Pong, ChatMessage
Factory.noisy = False
class States(Enum):
"""
Enum class representing possible states of the PeerProtocol.
"""
INIT = 0
WAIT_FOR_VERSION = 1
WAIT_FOR_VERACK = 2
CON_ESTABLISHED = 3
class PeerProtocol(Protocol, ABC):
log = Logger()
def __init__(self, client: 'P2PClient'):
self.client = client
self.state = States.INIT
self._peer = None
@property
def peer(self) -> NetworkAddress:
if self._peer is None:
peer = self.transport.getPeer()
return NetworkAddress(peer.host, peer.port)
else:
return self._peer
def connectionLost(self, reason: Failure = ConnectionDone):
self.log.debug(f'connection to Peer {self.peer} lost')
self.log.debug('reason:' + str(reason))
self.client.remove_connection(self)
def dataReceived(self, data: bytes):
try:
message = Message.from_bytes(data)
except MessageError:
self.log.failure(f'Invalid message received from {self.peer}.')
self.transport.loseConnection()
return
self.log.debug(f'Message received from {self.peer}')
if isinstance(message, Version):
self.handle_version(message)
elif isinstance(message, VerAck):
self.handle_verack(message)
elif isinstance(message, GetAddr):
self.handle_getadr(message)
elif isinstance(message, Addr):
self.handle_addr(message)
elif isinstance(message, Ping):
self.handle_ping(message)
elif isinstance(message, Pong):
self.handle_pong(message)
elif isinstance(message, ChatMessage):
self.handle_chat_message(message)
def handle_chat_message(self, chat_message: ChatMessage):
self.client.broadcast(chat_message, self.peer)
@abstractmethod
def connectionMade(self):
"""
What has to be done, when a new connection has been made depends on who initiated it.
Subclasses must implement this.
"""
self.log.debug(f'Connected to {self.peer}.')
def handle_getadr(self, getadr: GetAddr):
self.log.debug(f'Address request received from {self.peer}.')
addr_msg = Addr(list(self.client.known_participants.values()))
def handle_addr(self, addr: Addr):
self.log.debug(f'Address information received from {self.peer}.')
map(self.client.add_participant, addr.addresses)
self.client.broadcast(addr, self.peer)
def handle_ping(self, ping: Ping):
self.log.debug(f'Ping message received from {self.peer}.')
def handle_pong(self, pong: Pong):
self.log.debug(f'Pong message received from {self.peer}.')
def forward_message(self, message: Message):
self.log.debug(f'Forwarding message to {self.peer}')
self.transport.write(bytes(message))
@abstractmethod
def handle_version(self, version: Version):
if self.state == States.WAIT_FOR_VERSION:
if self.client.version_compatible(version.version) and self.client.nonce != version.nonce:
self.transport.write(bytes(VerAck()))
self.client.add_participant(version.addr_from)
self._peer = version.addr_from
self.client.add_connection(self)
return
self.transport.loseConnection()
@abstractmethod
def handle_verack(self, verack: VerAck):
if self.state == States.WAIT_FOR_VERACK:
self.log.debug(f'Version acknowledged by {self.peer}.')
return
self.transport.loseConnection()
class IncomingPeerProtocol(PeerProtocol):
def connectionMade(self):
super().connectionMade()
self.state = States.WAIT_FOR_VERSION
def handle_version(self, version: Version):
super().handle_version(version)
reactor.callLater(0.1, self.transport.write,
bytes(Version(self.client.version, version.addr_from, self.client.address, self.client.nonce)))
self.state = States.WAIT_FOR_VERACK
def handle_verack(self, verack: VerAck):
super().handle_verack(verack)
self.log.debug(f'Connection to {self.peer} established.')
self.state = States.CON_ESTABLISHED
class OutgoingPeerProtocol(PeerProtocol):
log = Logger()
def connectionMade(self):
super().connectionMade()
self.transport.write(bytes(Version(self.client.version, self.peer, self.client.address, self.client.nonce)))
self.state = States.WAIT_FOR_VERACK
def handle_version(self, version: Version):
super().handle_version(version)
self.log.debug(f'Connection to {self.peer} established.')
self.state = States.CON_ESTABLISHED
reactor.callLater(0.1, self.transport.write, bytes(GetAddr()))
def handle_verack(self, verack: VerAck):
super().handle_verack(verack)
self.state = States.WAIT_FOR_VERSION
class UserInput(basic.LineReceiver):
delimiter = linesep.encode('utf-8')
def __init__(self, client):
self.client = client
def lineReceived(self, line):
if line.startswith(b'!'):
self.client.handle_command(line[1:])
else:
self.client.send_chat(line)
class PeerFactory(Factory):
protocol = NotImplemented
def __init__(self, client: 'P2PClient'):
self.client = client
def buildProtocol(self, addr):
return self.protocol(self.client)
class IncomingPeerFactory(PeerFactory):
protocol = IncomingPeerProtocol
class OutgoingPeerFactory(PeerFactory):
protocol = OutgoingPeerProtocol
| 30.79602 | 121 | 0.664297 | 5,639 | 0.910985 | 0 | 0 | 1,208 | 0.195153 | 0 | 0 | 796 | 0.128595 |
5782dd6002965788cc0b91a4b76d21a40b2045ce | 279 | py | Python | airflow-materials/demo/mnt/dags/pipeline/process.py | reginold/airflow-handson | 2ac150955f3191f2acaa88643484bb0a7e4f10ea | [
"Apache-2.0"
] | null | null | null | airflow-materials/demo/mnt/dags/pipeline/process.py | reginold/airflow-handson | 2ac150955f3191f2acaa88643484bb0a7e4f10ea | [
"Apache-2.0"
] | null | null | null | airflow-materials/demo/mnt/dags/pipeline/process.py | reginold/airflow-handson | 2ac150955f3191f2acaa88643484bb0a7e4f10ea | [
"Apache-2.0"
] | null | null | null | def second_task(**context):
print("This is ----------- task 2")
return "hoge======"
def third_task(**context):
output = context["task_instance"].xcom_pull(task_ids="python_task_2")
print("This is ----------- task 3")
return "This is the result : " + output
| 27.9 | 73 | 0.594982 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 121 | 0.433692 |
578339eb7a9855dc70e1449145cbddebafa88983 | 1,803 | py | Python | 002-python-oop/code/021_oop_class_builtin_attributes.py | CHemaxi/python | 6544ea79be447bcd39488e7366685966bebd9964 | [
"MIT"
] | null | null | null | 002-python-oop/code/021_oop_class_builtin_attributes.py | CHemaxi/python | 6544ea79be447bcd39488e7366685966bebd9964 | [
"MIT"
] | null | null | null | 002-python-oop/code/021_oop_class_builtin_attributes.py | CHemaxi/python | 6544ea79be447bcd39488e7366685966bebd9964 | [
"MIT"
] | null | null | null | """ MARKDOWN
---
YamlDesc: CONTENT-ARTICLE
Title: python builtin class attributes
MetaDescription: python object oriented programming class builtin attributes __doc__, __name__, __module__, __bases__ example code, tutorials
MetaKeywords: python object oriented programming class builtin attributes __doc__, __name__, __module__, __bases__ example code, tutorials
Author: Hemaxi
ContentName: class-builtin-attributes
---
MARKDOWN """
""" MARKDOWN
# Python Class Built-in Attributes
* Object Oriented Programming, in PYTHON
* Classes in PYTHON have a set of built in attributes and functions
* Class built-in attributes
* `__doc__` Prints the CLASS Documentation string
* `__name__` prints the CLASS Name
* `__module__` module name where the class is defined
* `__bases__` base class list in case of Inheritance
MARKDOWN """
# MARKDOWN ```
# 1. Create a CLASS
###################
class Learnpython:
'This is a brief note about the class, This is the LEARNPYTHON Class'
# a class Variable
ti_var = 100
# a class list
ti_list = ["a","b","c"]
# a class tuple
ti_tuple = ("x","y","z")
# a class dictionary
ti_dictionary = {"1":"A", "2":"b", "3":"c"}
# a class function
def ti_function(self):
"This is a class function"
print("This is a message from the LEARNPYTHON Class ti_function")
# 2. Using the built-in attributes
##################################
# Create an Object of the Class
tiObject = Learnpython()
# __doc__ : Prints the CLASS Documentation string
print(Learnpython.__doc__)
#__name__ : prints the CLASS Name
print(Learnpython.__name__)
# __module__ : module name where the class is defined
print(Learnpython.__module__)
# __bases__: base class list in case of Inheritance
print(Learnpython.__bases__)
# MARKDOWN ```
| 30.05 | 141 | 0.709373 | 464 | 0.257349 | 0 | 0 | 0 | 0 | 0 | 0 | 1,452 | 0.805324 |
57844212fa28ebcdefb93bfed459606ee05dd39b | 2,950 | py | Python | Prototype_2/web/blueprints/index.py | amal66/Kawm | 3bf442ea1f4b572f4ec840e0ee6ec7d96ae23133 | [
"MIT"
] | null | null | null | Prototype_2/web/blueprints/index.py | amal66/Kawm | 3bf442ea1f4b572f4ec840e0ee6ec7d96ae23133 | [
"MIT"
] | null | null | null | Prototype_2/web/blueprints/index.py | amal66/Kawm | 3bf442ea1f4b572f4ec840e0ee6ec7d96ae23133 | [
"MIT"
] | null | null | null | from flask import Blueprint, render_template,redirect,url_for,request,flash,make_response
from flask import current_app as app
from flask_login import (
LoginManager,
current_user,
login_required,
login_user,
logout_user,
UserMixin,
)
from ..models import User, db
from ..security import hash_string
from datetime import datetime
index_template = Blueprint('index', __name__, template_folder='../templates',static_folder='../static')
# Display home page based on authentication status
@index_template.route('/', methods=["GET","POST"])
def index():
'''
Display home page based on authentication status.
'''
if current_user.is_authenticated:
return render_template('mainpage.html', name=current_user.name, email=current_user.email)
else:
if request.method == 'POST':
email = request.form.get('InputEmail')
password = request.form.get('InputPassword')
remember_me = request.form.get('Remember_me')
user_details = User.query.filter_by(email=email).first()
if user_details:
hashed_password = str(hash_string(password))
if hashed_password == user_details.password:
login_user(user_details)
resp = make_response(render_template('mainpage.html', name=user_details.name, email=user_details.email))
if remember_me == 'on':
COOKIE_TIME_OUT = 60*60*24*7
resp.set_cookie('email',email, max_age=COOKIE_TIME_OUT)
resp.set_cookie('password',password, max_age=COOKIE_TIME_OUT)
resp.set_cookie('rem', 'on', max_age=COOKIE_TIME_OUT)
else:
resp = make_response(redirect('/'))
resp.set_cookie('email', '', expires = datetime.now(), max_age = 0)
resp.set_cookie('password', '', expires = datetime.now(), max_age = 0)
resp.set_cookie('rem', 'off', expires = datetime.now(), max_age = 0)
return resp
else:
if user_details.password == str(hash_string('google')):
flash('Please login with Google login')
elif user_details.password == str(hash_string('facebook')):
flash('Please login with Facebook login')
else:
flash('Incorrect Password')
return redirect(url_for('index.index'))
else:
flash('User not found')
return redirect(url_for('index.index'))
#Tell them no such user found
else:
print(request.cookies)
return render_template('index.html')
| 43.382353 | 124 | 0.557288 | 0 | 0 | 0 | 0 | 2,439 | 0.82678 | 0 | 0 | 489 | 0.165763 |
57855a5d43bc96be7a4767d1b460ba7bd929c017 | 2,072 | py | Python | sensor/GY521_MPU6050.py | Smart4L/embedded-server | cf10ebb1ccc3002b45c20315ec521eaf1a9e7f10 | [
"MIT"
] | null | null | null | sensor/GY521_MPU6050.py | Smart4L/embedded-server | cf10ebb1ccc3002b45c20315ec521eaf1a9e7f10 | [
"MIT"
] | null | null | null | sensor/GY521_MPU6050.py | Smart4L/embedded-server | cf10ebb1ccc3002b45c20315ec521eaf1a9e7f10 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import time
from math import atan2, degrees
import board
import busio
import adafruit_mpu6050
class GY521_MPU6050():
def __init__(self, id=None, address=0x68) -> None:
self.id_sensor = id
self.i2c = busio.I2C(board.SCL, board.SDA)
self.mpu = adafruit_mpu6050.MPU6050(self.i2c, address=address)
self.fix_gyro = {'X':0, 'Y':0, 'Z': 0}
def reset_gyro(self):
angle_xz, angle_yz = self.get_inclination(self.mpu)
inclinaisons = "%.2f,%.2f,%.2f"%(self.mpu.acceleration)
inclinaisons = inclinaisons.split(',')
inclinaison = {
'X': float(inclinaisons[0]),
'Y': float(inclinaisons[1]),
'Z': float(inclinaisons[2])
}
self.fix_gyro = {'X':inclinaison['X'], 'Y':inclinaison['Y'], 'Z':inclinaison['Z']}
def vector_2_degrees(self, x, y):
angle = degrees(atan2(y, x))
if angle < 0:
angle += 360
return angle
# Given an accelerometer sensor object return the inclination angles of X/Z and Y/Z
# Returns: tuple containing the two angles in degrees
def get_inclination(self, _sensor):
x, y, z = _sensor.acceleration
return self.vector_2_degrees(x, z), self.vector_2_degrees(y, z)
def measure(self) -> dict:
angle_xz, angle_yz = self.get_inclination(self.mpu)
inclinaisons = "%.2f,%.2f,%.2f"%(self.mpu.acceleration)
inclinaisons = inclinaisons.split(',')
inclinaison = {
'X': float(inclinaisons[0])-self.fix_gyro['X'],
'Y': float(inclinaisons[1])-self.fix_gyro['Y'],
'Z': float(inclinaisons[2])-self.fix_gyro['Z']
}
return {'value':{'acceleration': "{:6.2f},{:6.2f}".format(angle_xz, angle_yz), 'gyroscope': inclinaison, 'temperature': "%.2f"%self.mpu.temperature}}
def stop(self) -> None:
pass
def __str__(self):
return f'Sensor:{self.id_sensor}'
def __repr__(self):
return str(self)
if __name__ == '__main__':
sensor = GY521_MPU6050("GY521_MPU6050")
try:
while True:
print(sensor.measure())
time.sleep(1)
except Exception as e:
print(e)
| 28 | 153 | 0.64527 | 1,744 | 0.841699 | 0 | 0 | 0 | 0 | 0 | 0 | 392 | 0.189189 |
5785a172941ebdf8c77fe0b87766c3f3223d087b | 1,832 | py | Python | sumo/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/TaxisPerEdge.py | iltempe/osmosi | c0f54ecdbb7c7b5602d587768617d0dc50f1d75d | [
"MIT"
] | null | null | null | sumo/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/TaxisPerEdge.py | iltempe/osmosi | c0f54ecdbb7c7b5602d587768617d0dc50f1d75d | [
"MIT"
] | null | null | null | sumo/tools/projects/TaxiFCD_Krieg/src/taxiQuantity/TaxisPerEdge.py | iltempe/osmosi | c0f54ecdbb7c7b5602d587768617d0dc50f1d75d | [
"MIT"
] | 2 | 2017-12-14T16:41:59.000Z | 2020-10-16T17:51:27.000Z | #!/usr/bin/env python
# -*- coding: Latin-1 -*-
"""
@file TaxisPerEdge.py
@author Sascha Krieg
@author Daniel Krajzewicz
@author Michael Behrisch
@date 2008-04-08
@version $Id$
Counts for every edge in the given FCD-file the number of Taxis which used this edge.
After that this information can be visualized with an script called mpl_dump_onNet from Daniel.
SUMO, Simulation of Urban MObility; see http://sumo.dlr.de/
Copyright (C) 2008-2017 DLR (http://www.dlr.de/) and contributors
This file is part of SUMO.
SUMO is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
"""
from __future__ import absolute_import
from __future__ import print_function
import util.Path as path
# global vars
edgeList = {}
def main():
print("start program")
countTaxisForEachEdge()
writeOutput()
print("end")
def countTaxisForEachEdge():
"""counts the frequency of each edge"""
inputFile = open(path.vls, 'r')
for line in inputFile:
words = line.split("\t")
edgeList.setdefault(words[1], set())
edgeList[words[1]].add(words[4])
for k in edgeList:
print(k)
print(len(edgeList[k]))
print(len(edgeList))
def writeOutput():
"""Writes an XML-File with the extracted results"""
outputFile = open(path.taxisPerEdge, 'w')
outputFile.write("<netstats>\n")
outputFile.write("\t<interval begin=\"0\" end=\"899\" id=\"dump_900\">\n")
for k in edgeList:
outputFile.write(
"\t\t<edge id=\"%s\" no=\"%s\" color=\"1.0\"/>\n" % (k, len(edgeList[k])))
outputFile.write("\t</interval>\n")
outputFile.write("</netstats>")
# start the program
main()
| 26.941176 | 95 | 0.674672 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,059 | 0.578057 |
5785e6a036807a5d9394d69f5f7eaf543965d731 | 879 | py | Python | Tree/maxDepth.py | konantian/LeetCode | f97609cfe139159bc000cac5b39a1d0c28517d24 | [
"MIT"
] | 2 | 2018-06-02T03:57:20.000Z | 2018-10-20T22:15:17.000Z | Tree/maxDepth.py | konantian/leetcode | f97609cfe139159bc000cac5b39a1d0c28517d24 | [
"MIT"
] | null | null | null | Tree/maxDepth.py | konantian/leetcode | f97609cfe139159bc000cac5b39a1d0c28517d24 | [
"MIT"
] | 1 | 2019-01-31T05:17:19.000Z | 2019-01-31T05:17:19.000Z | '''
Source : https://leetcode.com/problems/maximum-depth-of-binary-tree/
Author : Yuan Wang
Date : 2018-07-21
/**********************************************************************************
*Given a binary tree, find its maximum depth.
*
*The maximum depth is the number of nodes along the longest path from the root node
*down to the farthest leaf node.
*
*Note: A leaf is a node with no children.
*
*Example:
*
*Given binary tree [3,9,20,null,null,15,7],
*
* 3
* / \
* 9 20
* / \
* 15 7
*return its depth = 3.
**********************************************************************************/
'''
def maxDepth(self, root):
"""
:type root: TreeNode
:rtype: int
"""
depth=0
return self.calDepth(root,depth)
def calDepth(self,root,depth):
if root:
depth+=1
return max(self.calDepth(root.left,depth),self.calDepth(root.right,depth))
return depth | 21.975 | 84 | 0.544937 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 660 | 0.750853 |
57872eecc46c7a0d72ec8a778e7292de65dabc9e | 6,358 | py | Python | cli/mmt/mmtcli.py | Centaurioun/modernmt | 4dec42090088fdecf2d75c3e1ed9d41e603a7de1 | [
"Apache-2.0"
] | 154 | 2019-04-18T04:46:45.000Z | 2022-03-23T21:21:50.000Z | cli/mmt/mmtcli.py | Centaurioun/modernmt | 4dec42090088fdecf2d75c3e1ed9d41e603a7de1 | [
"Apache-2.0"
] | 406 | 2016-01-08T22:42:59.000Z | 2019-01-31T17:07:39.000Z | cli/mmt/mmtcli.py | Centaurioun/modernmt | 4dec42090088fdecf2d75c3e1ed9d41e603a7de1 | [
"Apache-2.0"
] | 38 | 2016-05-29T16:50:40.000Z | 2018-12-15T02:53:42.000Z | import os
import re
from cli.mmt import MMT_HOME_DIR, MMT_LIB_DIR, MMT_BIN_DIR, MMT_JAR, MMT_PLUGINS_JARS
from cli.utils import osutils
def __get_java_version():
try:
stdout, stderr = osutils.shell_exec(['java', '-version'])
java_output = stdout + '\n' + stderr
for line in java_output.split('\n'):
tokens = line.split()
if 'version' in tokens:
version = tokens[tokens.index('version') + 1]
version = version.strip('"')
if version.startswith('1.'):
version = version[2:]
version = re.match('^[0-9]+', version)
return int(version.group())
return None
except OSError:
return None
__java_version = __get_java_version()
assert __java_version is not None, 'missing Java executable, please check INSTALL.md'
assert __java_version > 7, 'wrong version of Java: required Java 8 or higher'
def mmt_env():
llp = (MMT_LIB_DIR + os.pathsep + os.environ['LD_LIBRARY_PATH']) if 'LD_LIBRARY_PATH' in os.environ else MMT_LIB_DIR
return dict(os.environ, LD_LIBRARY_PATH=llp, LC_ALL='C.UTF-8', LANG='C.UTF-8')
if 'MMT_HOME' not in os.environ:
os.environ['MMT_HOME'] = MMT_HOME_DIR
# - ModernMT CLI functions ---------------------------------------------------------------------------------------------
def mmt_java(main_class, args=None, *,
java_ops=None, remote_debug=False, max_heap_mb=None, server=False, logs_path=None):
java_ops = java_ops or []
if remote_debug:
java_ops.append('-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=5005')
if server:
java_ops.append('-server')
if max_heap_mb is not None:
java_ops.append('-Xms' + str(max_heap_mb) + 'm')
java_ops.append('-Xmx' + str(max_heap_mb) + 'm')
if logs_path is not None:
java_ops += ['-XX:ErrorFile=' + os.path.join(logs_path, 'hs_err_pid%p.log')]
java_ops += ['-XX:+PrintGCDateStamps', '-verbose:gc', '-XX:+PrintGCDetails',
'-Xloggc:' + os.path.join(logs_path, 'gc.log')]
java_ops += ['-XX:+HeapDumpOnOutOfMemoryError', '-XX:HeapDumpPath=' + logs_path]
java_ops += ['-XX:+CMSClassUnloadingEnabled', '-XX:+UseConcMarkSweepGC', '-XX:+CMSParallelRemarkEnabled',
'-XX:+UseCMSInitiatingOccupancyOnly', '-XX:CMSInitiatingOccupancyFraction=70',
'-XX:+ScavengeBeforeFullGC', '-XX:+CMSScavengeBeforeRemark', '-XX:+CMSClassUnloadingEnabled',
'-XX:+ExplicitGCInvokesConcurrentAndUnloadsClasses']
else:
if max_heap_mb is not None:
java_ops.append('-Xmx' + str(max_heap_mb) + 'm')
classpath = ':'.join([MMT_JAR] + MMT_PLUGINS_JARS)
java_cmd = ['java'] + java_ops + \
['-cp', classpath, '-Dmmt.home=' + MMT_HOME_DIR, '-Djava.library.path=' + MMT_LIB_DIR, main_class]
if args is not None:
java_cmd += args
return java_cmd
def mmt_tmsclean(src_lang, tgt_lang, in_path, out_path, out_format=None, filters=None):
args = ['-s', src_lang, '-t', tgt_lang, '--input', in_path, '--output', out_path]
if out_format is not None:
args += ['--output-format', out_format]
if filters is not None and len(filters) > 0:
args += ['--filters'] + filters
extended_heap_mb = int(osutils.mem_size() * 90 / 100)
java_ops = ['-DentityExpansionLimit=0', '-DtotalEntitySizeLimit=0', '-Djdk.xml.totalEntitySizeLimit=0']
command = mmt_java('eu.modernmt.cli.CleaningPipelineMain', args, max_heap_mb=extended_heap_mb, java_ops=java_ops)
osutils.shell_exec(command, env=mmt_env())
def mmt_preprocess(src_lang, tgt_lang, in_paths, out_path, dev_path=None, test_path=None,
partition_size=None, quiet=False):
args = ['-s', src_lang, '-t', tgt_lang, '--output', out_path, '--input']
if isinstance(in_paths, str):
in_paths = [in_paths]
args += in_paths
if partition_size is not None:
args += ['--size', str(partition_size)]
if dev_path is not None:
args += ['--dev', dev_path]
if test_path is not None:
args += ['--test', test_path]
if quiet:
args.append('--quiet')
command = mmt_java('eu.modernmt.cli.TrainingPipelineMain', args)
osutils.shell_exec(command, env=mmt_env())
def mmt_dedup(src_lang, tgt_lang, in_path, out_path, length_threshold=None, sort=None):
args = ['-s', src_lang, '-t', tgt_lang, '--input', in_path, '--output', out_path]
if length_threshold is not None and length_threshold > 0:
args += ['-l', length_threshold]
if sort is not None:
args += ['--sort'] + sort
command = mmt_java('eu.modernmt.cli.DeduplicationMain', args)
osutils.shell_exec(command, env=mmt_env())
# - Fastalign CLI functions --------------------------------------------------------------------------------------------
def fastalign_build(src_lang, tgt_lang, in_path, out_model, iterations=None,
case_sensitive=True, favor_diagonal=True, log=None):
os.makedirs(out_model, exist_ok=True)
out_model = os.path.join(out_model, '%s__%s.fam' % (src_lang, tgt_lang))
if log is None:
log = osutils.DEVNULL
command = [os.path.join(MMT_BIN_DIR, 'fa_build'), '-s', src_lang, '-t', tgt_lang, '-i', in_path, '-m', out_model]
if iterations is not None:
command.extend(['-I', str(iterations)])
if not case_sensitive:
command.append('--case-insensitive')
if not favor_diagonal:
command.append('--no-favor-diagonal')
osutils.shell_exec(command, stdout=log, stderr=log, env=mmt_env())
def fastalign_score(src_lang, tgt_lang, model_path, in_path, out_path=None):
model_path = os.path.join(model_path, '%s__%s.fam' % (src_lang, tgt_lang))
command = [os.path.join(MMT_BIN_DIR, 'fa_score'), '-s', src_lang, '-t', tgt_lang,
'-m', model_path, '-i', in_path, '-o', out_path or in_path]
stdout, _ = osutils.shell_exec(command, env=mmt_env())
result = dict()
for line in stdout.splitlines(keepends=False):
key, value = line.split('=', maxsplit=1)
result[key] = float(value)
return result['good_avg'], result['good_std_dev'], result['bad_avg'], result['bad_std_dev']
| 37.845238 | 120 | 0.617332 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,610 | 0.253224 |
57883f6ad7f708a53fa8b719d4d89b28c98e01a8 | 2,497 | py | Python | DocumentClassicifation.py | ValentineNauli/My_MachineLearning | 3c32253e5f1ef43dc94de14da47e4e456d5bfb3f | [
"Apache-2.0"
] | 1 | 2020-10-20T02:33:50.000Z | 2020-10-20T02:33:50.000Z | DocumentClassicifation.py | ValentineNauli/My_MachineLearning | 3c32253e5f1ef43dc94de14da47e4e456d5bfb3f | [
"Apache-2.0"
] | null | null | null | DocumentClassicifation.py | ValentineNauli/My_MachineLearning | 3c32253e5f1ef43dc94de14da47e4e456d5bfb3f | [
"Apache-2.0"
] | null | null | null | #AUTHOR : HAMORA HADI
"""
You have been given a stack of documents that have already been processed and some that have not.
Your task is to classify these documents into one of eight categories: [1,2,3,...8].
You look at the specifications on what a document must contain and are baffled by the jargon.
However, you notice that you already have a large amount of documents which have already been correctly categorize (training data).
You decide to use Machine Learning on this data in order to categorize the uncategorized documents.
Access the document from here -> https://s3.amazonaws.com/hr-testcases/597/assets/trainingdata.txt
The first line in the input file will contain T the number of documents.
T lines will follow each containing a series of space seperated words which represents the processed document.
For each document output a number between 1-8 which you believe this document should be categorized as.
->Sample input :
3
This is a document
this is another document
documents are seperated by newlines
->Output :
1
4
8
"""
import sys
from sklearn.feature_extraction import text
from sklearn import pipeline
from sklearn import linear_model
import numpy
def make_model():
clf = pipeline.Pipeline([
('vect',
text.TfidfVectorizer(stop_words='english', ngram_range=(1, 1),
strip_accents='ascii', lowercase=True)),
('clf',
linear_model.SGDClassifier(class_weight='balanced'))
])
return clf
def run():
known = [('Business means risk!', 1)]
xs, ys = load_data('trainingdata.txt')
mdl = make_model()
mdl.fit(xs, ys)
txs = list(line for line in sys.stdin)[1:]
for y, x in zip(mdl.predict(txs), txs):
for pattern, clazz in known:
if pattern in x:
print(clazz)
break
else:
print(y)
def load_data(filename):
with open(filename, 'r') as data_file:
sz = int(data_file.readline())
xs = numpy.zeros(sz, dtype=numpy.object)
ys = numpy.zeros(sz, dtype=numpy.int)
for i, line in enumerate(data_file):
idx = line.index(' ')
if idx == -1:
raise ValueError('invalid input file')
clazz = int(line[:idx])
words = line[idx+1:]
xs[i] = words
ys[i] = clazz
return xs, ys
if __name__ == '__main__':
run() | 31.607595 | 133 | 0.635162 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,188 | 0.475771 |
57885b1f14f79ac4171cf51a11ef29a2c3dc1503 | 4,232 | py | Python | utils/make_temporal_subsets.py | davidhwyllie/findNeighbour4 | d42e10711e59e93ebf0e798fbb1598929f662c9c | [
"MIT"
] | null | null | null | utils/make_temporal_subsets.py | davidhwyllie/findNeighbour4 | d42e10711e59e93ebf0e798fbb1598929f662c9c | [
"MIT"
] | 14 | 2021-11-26T14:43:25.000Z | 2022-03-22T00:39:17.000Z | utils/make_temporal_subsets.py | davidhwyllie/findNeighbour4 | d42e10711e59e93ebf0e798fbb1598929f662c9c | [
"MIT"
] | null | null | null | """ generates lists of SARS-CoV-2 samples which occurred before a particular date
Also generates a dictionary of reference compressed sequences
And a subset of these
Together, these can be passed to a ram_persistence object which
can be used instead of an fn3persistence object to test the performance of PCA, or for other
unit testing purposes.
Also useful for investigating how PCA detected the ingress of new strains over time.
Uses public cog metadata downloaded from COG-UK 7/4/2021, saved in
testdata/pca/cog_metadata.csv.gz, and requires access to an fn3persistence object containing the same data.
To run:
pipenv run python3 utils/make_temporal_subsets.py
"""
import os
import pandas as pd
import datetime
import gzip
import pickle
import progressbar
import random
from findn.mongoStore import fn3persistence
from findn.common_utils import ConfigManager
# open connection to existing covid datastore
config_file = os.path.join("demos", "covid", "covid_config_v3.json")
cfm = ConfigManager(config_file)
CONFIG = cfm.read_config()
PERSIST = fn3persistence(dbname=CONFIG["SERVERNAME"], connString=CONFIG["FNPERSISTENCE_CONNSTRING"], debug=CONFIG["DEBUGMODE"])
inputfile = "/data/software/fn4dev/testdata/pca/cog_metadata.csv.gz"
outputdir = "/data/data/pca/subsets" # or wherever
# get samples which are in server
extant_sample_ids = PERSIST.guids()
print("There are {0} samples in the server".format(len(extant_sample_ids)))
# read metadata file into pandas
with gzip.open(inputfile, "rt") as f:
df = pd.read_csv(f)
# we are using the middle part of the cog_id as the sample name as the sample_id; extract this.
sample_ids = df["sequence_name"].to_list()
df["sample_id"] = [x.split("/")[1] for x in sample_ids]
print("There are {0} samples in the COG-UK list".format(len(df.index)))
# what is in the server & not in the list?
server_sample_ids = set(extant_sample_ids)
inputfile_sample_ids = set(df['sample_id'])
missing = server_sample_ids - inputfile_sample_ids
print("Missing samples: n=", len(missing))
missing_df = pd.DataFrame({'missing': list(missing)})
print(missing_df)
missing_df.to_csv("/data/data/inputfasta/missing_meta.csv")
# load a small subset of the reference compressed sequences, for testing purposes
# load the reference compressed sequences
print("Dumping 5,000 sample test set")
storage_dict = {}
sampled = random.sample(df["sample_id"].to_list(), 5000)
bar = progressbar.ProgressBar(max_value=len(sampled))
print("Dumping all samples")
for i, sample_id in enumerate(sampled):
res = PERSIST.refcompressedsequence_read(sample_id)
bar.update(i)
storage_dict[sample_id] = res
bar.finish()
# write out the dictionary
outputfile = "/data/software/fn4dev/testdata/pca/seqs_5000test.pickle"
with open(outputfile, "wb") as f:
pickle.dump(storage_dict, f)
outputfile = "/data/software/fn4dev/testdata/pca/seqs_5000test_ids.pickle"
with open(outputfile, "wb") as f:
pickle.dump(sampled, f)
# load the reference compressed sequences
storage_dict = {}
bar = progressbar.ProgressBar(max_value=len(df.index))
for i, sample_id in enumerate(df["sample_id"]):
res = PERSIST.refcompressedsequence_read(sample_id)
bar.update(i)
storage_dict[sample_id] = res
bar.finish()
# write out the dictionary
outputfile = os.path.join(outputdir, "seqs_20210421.pickle")
with open(outputfile, "wb") as f:
pickle.dump(storage_dict, f)
# construct counts between 1 June 2020 and end March 2021
cnts = df.groupby(["sample_date"]).size()
cnts = cnts[cnts.index >= "2020-06-01"]
cnts = cnts[cnts.index < "2021-04-01"]
cnts = pd.DataFrame(cnts)
cnts.columns = ["count"]
cnts["dow"] = [datetime.date.fromisoformat(item).weekday() for item in cnts.index]
cnts["isodate"] = [datetime.date.fromisoformat(item) for item in cnts.index]
# write samples to consider in the PCA into a series of json files in the output directory
for cutoff_date in cnts.index:
dow = cnts.loc[cutoff_date, "dow"]
df_subset = df[df["sample_date"] < cutoff_date]
sample_ids = df_subset["sample_id"].to_list()
outputfile = os.path.join(outputdir, "{0}-{1}.pickle".format(dow, cutoff_date))
with open(outputfile, "wb") as f:
pickle.dump(sample_ids, f)
print(outputfile)
| 36.8 | 127 | 0.756144 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,987 | 0.469518 |
5788ff69ca8306377b664e4a0c3f2b102ca5c7c0 | 7,476 | py | Python | kiauhoku/dartmouth.py | zclaytor/kiauhoku | 5b3357dc2093577f97f80cc829c1ca785e4fae63 | [
"MIT"
] | 12 | 2019-10-12T03:10:17.000Z | 2021-05-05T04:18:49.000Z | kiauhoku/dartmouth.py | zclaytor/kiauhoku | 5b3357dc2093577f97f80cc829c1ca785e4fae63 | [
"MIT"
] | 1 | 2022-02-07T10:55:11.000Z | 2022-02-26T00:27:31.000Z | kiauhoku/dartmouth.py | zclaytor/kiauhoku | 5b3357dc2093577f97f80cc829c1ca785e4fae63 | [
"MIT"
] | 1 | 2019-10-18T21:50:32.000Z | 2019-10-18T21:50:32.000Z | import os
import re
import pickle
import numpy as np
import pandas as pd
from tqdm import tqdm
# Assign labels used in eep conversion
eep_params = dict(
age = 'Age (yrs)',
hydrogen_lum = 'L_H',
lum = 'Log L',
logg = 'Log g',
log_teff = 'Log T',
core_hydrogen_frac = 'X_core', # must be added
core_helium_frac = 'Y_core',
teff_scale = 20, # used in metric function
lum_scale = 1, # used in metric function
# `intervals` is a list containing the number of secondary Equivalent
# Evolutionary Phases (EEPs) between each pair of primary EEPs.
intervals = [200, # Between PreMS and ZAMS
50, # Between ZAMS and EAMS
100, # Between EAMS and IAMS
100, # IAMS-TAMS
150], # TAMS-RGBump
)
def my_PreMS(track, eep_params, i0=None):
'''
Dartmouth models do not have central temperature, which is necessary for
the default PreMS calculation. For now, let the first point be the PreMS.
'''
return 0
def my_TAMS(track, eep_params, i0, Xmin=1e-5):
'''
By default, the TAMS is defined as the first point in the track where Xcen
drops below 10^-12. But not all the DSEP tracks hit this value. To ensure
the TAMS is placed correctly, here I'm using Xcen = 10^-5 as the critical
value.
'''
core_hydrogen_frac = eep_params['core_hydrogen_frac']
Xc_tr = track.loc[i0:, core_hydrogen_frac]
below_crit = Xc_tr <= Xmin
if not below_crit.any():
return -1
return below_crit.idxmax()
def my_RGBump(track, eep_params, i0=None):
'''
Modified from eep.get_RGBump to make luminosity logarithmic
'''
lum = eep_params['lum']
log_teff = eep_params['log_teff']
N = len(track)
lum_tr = track.loc[i0:, lum]
logT_tr = track.loc[i0:, log_teff]
lum_greater = (lum_tr > 1)
if not lum_greater.any():
return -1
RGBump = lum_greater.idxmax() + 1
while logT_tr[RGBump] < logT_tr[RGBump-1] and RGBump < N-1:
RGBump += 1
# Two cases: 1) We didn't reach an extremum, in which case RGBump gets
# set as the final index of the track. In this case, return -1.
# 2) We found the extremum, in which case RGBump gets set
# as the index corresponding to the extremum.
if RGBump >= N-1:
return -1
return RGBump-1
def my_HRD(track, eep_params):
'''
Adapted from eep._HRD_distance to fix lum logarithm
'''
# Allow for scaling to make changes in Teff and L comparable
Tscale = eep_params['teff_scale']
Lscale = eep_params['lum_scale']
log_teff = eep_params['log_teff']
lum = eep_params['lum']
logTeff = track[log_teff]
logLum = track[lum]
N = len(track)
dist = np.zeros(N)
for i in range(1, N):
temp_dist = (((logTeff.iloc[i] - logTeff.iloc[i-1])*Tscale)**2
+ ((logLum.iloc[i] - logLum.iloc[i-1])*Lscale)**2)
dist[i] = dist[i-1] + np.sqrt(temp_dist)
return dist
def from_dartmouth(path):
fname = path.split('/')[-1]
file_str = fname.replace('.trk', '')
mass = int(file_str[1:4])/100
met_str = file_str[7:10]
met = int(met_str[1:])/10
if met_str[0] == 'm':
met *= -1
alpha_str = file_str[13:]
alpha = int(alpha_str[1:])/10
if alpha_str[0] == 'm':
alpha *= -1
with open(path, 'r') as f:
header = f.readline()
col_line = f.readline()
data_lines = f.readlines()
columns = re.split(r'\s{2,}', col_line.strip('# \n'))
data = np.genfromtxt(data_lines)
# Build multi-indexed DataFrame, dropping unwanted columns
multi_index = pd.MultiIndex.from_tuples(
[(mass, met, step) for step in range(len(data))],
names=['initial_mass', 'initial_met', 'step'])
df = pd.DataFrame(data, index=multi_index, columns=columns)
return df
def all_from_dartmouth(raw_grids_path, progress=True):
df_list = []
filelist = [f for f in os.listdir(raw_grids_path) if '.trk' in f]
if progress:
file_iter = tqdm(filelist)
else:
file_iter = filelist
for fname in file_iter:
fpath = os.path.join(raw_grids_path, fname)
df_list.append(from_dartmouth(fpath))
dfs = pd.concat(df_list).sort_index()
# Need X_core for EEP computation
dfs['X_core'] = 1 - dfs['Y_core'] - dfs['Z_core']
return dfs
def install(
raw_grids_path,
name=None,
eep_params=eep_params,
eep_functions={'prems': my_PreMS, 'tams': my_TAMS, 'rgbump': my_RGBump},
metric_function=my_HRD,
):
'''
The main method to install grids that are output of the `rotevol` rotational
evolution tracer code.
Parameters
----------
raw_grids_path (str): the path to the folder containing the raw model grids.
name (str, optional): the name of the grid you're installing. By default,
the basename of the `raw_grids_path` will be used.
eep_params (dict, optional): contains a mapping from your grid's specific
column names to the names used by kiauhoku's default EEP functions.
It also contains 'eep_intervals', the number of secondary EEPs
between each consecutive pair of primary EEPs. By default, the params
defined at the top of this script will be used, but users may specify
their own.
eep_functions (dict, optional): if the default EEP functions won't do the
job, you can specify your own and supply them in a dictionary.
EEP functions must have the call signature
function(track, eep_params), where `track` is a single track.
If none are supplied, the default functions will be used.
metric_function (callable, None): the metric function is how the EEP
interpolator spaces the secondary EEPs. By default, the path
length along the evolution track on the H-R diagram (luminosity vs.
Teff) is used, but you can specify your own if desired.
metric_function must have the call signature
function(track, eep_params), where `track` is a single track.
If no function is supplied, defaults to dartmouth.my_HRD.
Returns None
'''
from .stargrid import from_pandas
from .stargrid import grids_path as install_path
if name is None:
name = os.path.basename(raw_grids_path)
# Create cache directories
path = os.path.join(install_path, name)
if not os.path.exists(path):
os.makedirs(path)
# Cache eep parameters
with open(os.path.join(path, 'eep_params.pkl'), 'wb') as f:
pickle.dump(eep_params, f)
print('Reading and combining grid files')
grids = all_from_dartmouth(raw_grids_path)
grids = from_pandas(grids, name=name)
# Save full grid to file
full_save_path = os.path.join(path, 'full_grid.pqt')
print(f'Saving to {full_save_path}')
grids.to_parquet(full_save_path)
print(f'Converting to eep-based tracks')
eeps = grids.to_eep(eep_params, eep_functions, metric_function)
# Save EEP grid to file
eep_save_path = os.path.join(path, 'eep_grid.pqt')
print(f'Saving to {eep_save_path}')
eeps.to_parquet(eep_save_path)
# Create and save interpolator to file
interp = eeps.to_interpolator()
interp_save_path = os.path.join(path, 'interpolator.pkl')
print(f'Saving interpolator to {interp_save_path}')
interp.to_pickle(path=interp_save_path)
print(f'Model grid "{name}" installed.') | 32.224138 | 80 | 0.651284 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3,525 | 0.471509 |
57891dccfc7a6660f1ab82ce9811e218955d5cf9 | 685 | py | Python | geoscript/geom/io/wkt.py | jericks/geoscript-py | 8dc600343f42dd87b1981023522a1a8cf56006a9 | [
"MIT"
] | null | null | null | geoscript/geom/io/wkt.py | jericks/geoscript-py | 8dc600343f42dd87b1981023522a1a8cf56006a9 | [
"MIT"
] | null | null | null | geoscript/geom/io/wkt.py | jericks/geoscript-py | 8dc600343f42dd87b1981023522a1a8cf56006a9 | [
"MIT"
] | null | null | null | from com.vividsolutions.jts.io import WKTReader, WKTWriter
from geoscript.util import deprecated
def readWKT(wkt):
"""
Constructs a geometry from Well Known Text.
*wkt* is the Well Known Text string representing the geometry as described by http://en.wikipedia.org/wiki/Well-known_text.
>>> readWKT('POINT (1 2)')
POINT (1 2)
"""
return WKTReader().read(wkt)
@deprecated
def fromWKT(wkt):
"""Use :func:`readWKT`"""
return readWKT(wkt)
def writeWKT(g):
"""
Writes a geometry as Well Known Text.
*g* is the geometry to serialize.
>>> from geoscript.geom import Point
>>> str(writeWKT(Point(1,2)))
'POINT (1 2)'
"""
return WKTWriter().write(g)
| 20.757576 | 125 | 0.683212 | 0 | 0 | 0 | 0 | 80 | 0.116788 | 0 | 0 | 425 | 0.620438 |
578b06c44ad4120f5203622c4930a21961e766fa | 1,053 | py | Python | config/settings/production.py | maxelite1520/multi-vendor-e-commerce | 98dfe5533a7f7ce33ef8e43ecb8669614d7298c5 | [
"MIT"
] | null | null | null | config/settings/production.py | maxelite1520/multi-vendor-e-commerce | 98dfe5533a7f7ce33ef8e43ecb8669614d7298c5 | [
"MIT"
] | 1 | 2021-09-01T15:21:10.000Z | 2021-09-01T15:21:10.000Z | config/settings/production.py | maxelite1520/multi-vendor-e-commerce | 98dfe5533a7f7ce33ef8e43ecb8669614d7298c5 | [
"MIT"
] | null | null | null | import os
import dj_database_url
import dotenv
from .base import BASE_DIR
env = BASE_DIR / '.env'
dotenv.read_dotenv(env)
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = False
ALLOWED_HOSTS = ["multiple-vendor-e-commerce.herokuapp.com"]
# Database
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
}
db_from_env = dj_database_url.config()
DATABASES['default'].update(db_from_env)
# Stripe
STRIPE_PUBLIC_KEY = os.environ['STRIPE_PUBLIC_KEY']
STRIPE_SECRET_KEY = os.environ['STRIPE_SECRET_KEY']
# Handling Emails
EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'mugdhaarunimahmed2017@gmail.com'
EMAIL_HOST_PASSWORD = os.environ['EMAIL_HOST_PASSWORD']
EMAIL_PORT = 587
EMAIL_USE_LTS = True
DEFAULT_EMAIL_FROM = 'E-commerce <noreply@maxelitecoding.com>'
CONTACT_EMAIL = 'mugdhaarunimahmed2017@gmail.com'
| 19.5 | 65 | 0.750237 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 513 | 0.487179 |
578c743bedee8f67d9035661125837e42bfc1a81 | 638 | py | Python | webapp/starter/tracker/views.py | jersobh/docker-covidoff | a0d62f6f7c2bae5f1e6a567abdcbf59a90a5e03f | [
"MIT"
] | null | null | null | webapp/starter/tracker/views.py | jersobh/docker-covidoff | a0d62f6f7c2bae5f1e6a567abdcbf59a90a5e03f | [
"MIT"
] | 6 | 2020-03-19T20:13:44.000Z | 2021-06-10T18:42:30.000Z | webapp/starter/tracker/views.py | jersobh/docker-covidoff | a0d62f6f7c2bae5f1e6a567abdcbf59a90a5e03f | [
"MIT"
] | null | null | null | from django.views import View
from django.http import JsonResponse
from tracker.models import Match
from tracker.forms import MatchForm
import json
class MatchView(View):
def put(self, request):
try:
body = request.body.decode('utf-8')
body = json.loads(body)
except json.decoder.JSONDecodeError as ex:
return JsonResponse({ 'error': str(ex) }, status=400)
form = MatchForm(body)
if not form.is_valid():
return JsonResponse(dict(form.errors.items()), status=422)
Match.objects.create(**{
'matcher': form.cleaned_data['matcher'],
'matchee': form.cleaned_data['matchee']
})
return JsonResponse({})
| 21.266667 | 61 | 0.713166 | 487 | 0.763323 | 0 | 0 | 0 | 0 | 0 | 0 | 50 | 0.07837 |
57927aebea275b8a5baaf7a2a83d8d6768dd7f0a | 2,400 | py | Python | precise/covariance/ledoitwolf.py | iklasky/precise | dd0b772b0c15ce1e47e076a027bb1b26239ed16d | [
"MIT"
] | null | null | null | precise/covariance/ledoitwolf.py | iklasky/precise | dd0b772b0c15ce1e47e076a027bb1b26239ed16d | [
"MIT"
] | null | null | null | precise/covariance/ledoitwolf.py | iklasky/precise | dd0b772b0c15ce1e47e076a027bb1b26239ed16d | [
"MIT"
] | null | null | null | from precise.covariance.movingaverage import ema_scov
from precise.covariance.matrixfunctions import grand_mean, grand_shrink
from sklearn.covariance._shrunk_covariance import ledoit_wolf_shrinkage
import numpy as np
# Experimental estimator inspired by Ledoit-Wolf
# Keeps a buffer of last n_buffer observations
# Tracks quantities akin to a^2, d^2 in LW
def lw_ema_scov(s:dict, x=None, r=0.025)->dict:
if s.get('s_c') is None:
if isinstance(x,int):
return _lw_ema_scov_init(n_dim=x, r=r)
else:
s = _lw_ema_scov_init(n_dim=len(x), r=r)
if x is not None:
s = _lw_ema_scov_update(s=s, x=x, r=r)
return s
def _lw_ema_scov_init(n_dim, r):
sc = ema_scov({}, n_dim, r=r)
return {'s_c':sc,
'bn_bar':None,
'a2':0,
'mn':0,
'n_new':0,
'buffer':[]}
def _lw_ema_scov_update(s, x, r):
"""
Attempts to track quantities similar to those used to estimate LD shrinkage
"""
x = np.asarray(x)
s['s_c'] = ema_scov(s=s['s_c'], x=x, r=r)
s['buffer'].append(x)
if len(s['buffer'])>s['s_c']['n_emp']:
# Update running estimate of the LD shrinkage parameter
s['n_new'] = s['n_new']+1
xl = s['buffer'].pop(0)
xc = np.atleast_2d(xl-s['s_c']['mean']) # <--- Do we need this?
scov = s['s_c']['scov']
# Compute d^2
mn = grand_mean(scov)
s['mn'] = mn
n_dim = np.shape(scov)[0]
s['dn'] = np.linalg.norm(scov - mn * np.eye(n_dim))**2
# Update b^2
xc2 = xc
xl2 = np.dot(xc2.T,xc2) - scov
if s.get('bn_bar') is None:
s['bn_bar'] = s['lmbd']*s['dn']
s['lmbd_lw'] = 1.0 * s['lmbd']
r_shrink = r/2 # <--- Heuristic
bk = np.linalg.norm( xl2 )
s['bn_bar'] = (1-r_shrink)*s['bn_bar'] + r_shrink*bk # b^2
ratio = bk/s['dn']
# Imply new shrinkage
bn = min( s['bn_bar'], s['dn'] )
lmbd = bn/s['dn']
s['lmbd'] = lmbd
if 2< s['s_c']['n_samples']<2*s['s_c']['n_emp']:
# Override with traditional Ledoit-Shrinkage
X = np.asarray(s['buffer'])
s['lmbd'] = ledoit_wolf_shrinkage(X=X)
if s['s_c']['n_samples']>2:
scov = s['s_c']['scov']
s['scov'] = grand_shrink(a=scov, lmbd=s['lmbd'], copy=True)
return s
| 25.806452 | 83 | 0.544167 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 715 | 0.297917 |
57931e36703d83bfbb031c2fa680eb23f332ac35 | 704 | py | Python | setup.py | ProrokWielki/Text2CArray | db1fdd54dcbd3ab3d728e35ebfca6a05ac230e04 | [
"MIT"
] | null | null | null | setup.py | ProrokWielki/Text2CArray | db1fdd54dcbd3ab3d728e35ebfca6a05ac230e04 | [
"MIT"
] | null | null | null | setup.py | ProrokWielki/Text2CArray | db1fdd54dcbd3ab3d728e35ebfca6a05ac230e04 | [
"MIT"
] | null | null | null | from setuptools import setup, find_packages
with open('README.md') as f:
long_description = f.read()
setup(name='Text2CArray',
version='0.1.0',
description='Script for generating C arrays from text.',
long_description=long_description,
long_description_content_type='text/markdown', # This is important!
url='https://github.com/ProrokWielki/Text2CArray',
author='Pawel Warzecha',
author_email='pawel.warzecha@yahoo.com',
license='MIT',
packages=find_packages(),
include_package_data=True,
install_requires=[
'pyyaml',
'setuptools-git',
'gitpython',
'Pillow'
],
zip_safe=False)
| 29.333333 | 73 | 0.640625 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 244 | 0.346591 |
57944f7748440824b510084999250896fd1e4190 | 32 | py | Python | robotframework-ls/tests/robotframework_ls_tests/_resources/case_vars_file/robotvars.py | mardukbp/robotframework-lsp | 57b4b2b14b712c9bf90577924a920fb9b9e831c7 | [
"ECL-2.0",
"Apache-2.0"
] | 92 | 2020-01-22T22:15:29.000Z | 2022-03-31T05:19:16.000Z | robotframework-ls/tests/robotframework_ls_tests/_resources/case_vars_file/robotvars.py | mardukbp/robotframework-lsp | 57b4b2b14b712c9bf90577924a920fb9b9e831c7 | [
"ECL-2.0",
"Apache-2.0"
] | 604 | 2020-01-25T17:13:27.000Z | 2022-03-31T18:58:24.000Z | robotframework-ls/tests/robotframework_ls_tests/_resources/case_vars_file/robotvars.py | mardukbp/robotframework-lsp | 57b4b2b14b712c9bf90577924a920fb9b9e831c7 | [
"ECL-2.0",
"Apache-2.0"
] | 39 | 2020-02-06T00:38:06.000Z | 2022-03-15T06:14:19.000Z | VARIABLE_1 = 10
VARIABLE_2 = 20
| 10.666667 | 15 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
57963d19d43781ea87b371e11a9dd7e27acce2dd | 7,708 | py | Python | src/markovRecipe.py | schollz/parseingredient | 4953eb986375304e6eaab04e26d14b3450f62b90 | [
"MIT"
] | 1 | 2020-07-10T12:52:43.000Z | 2020-07-10T12:52:43.000Z | src/markovRecipe.py | schollz/parseingredient | 4953eb986375304e6eaab04e26d14b3450f62b90 | [
"MIT"
] | null | null | null | src/markovRecipe.py | schollz/parseingredient | 4953eb986375304e6eaab04e26d14b3450f62b90 | [
"MIT"
] | 1 | 2021-10-05T05:24:57.000Z | 2021-10-05T05:24:57.000Z | import json
import os.path
import operator
import time
from multiprocessing import Pool
import markovify
from tqdm import tqdm
removeWords = ['c', 'tsp', 'qt', 'lb', 'pkg', 'oz', 'med', 'tbsp', 'sm']
removeWords2 = [" recipes "," recipe "," mashed "," fat ",' c. ',' c ','grams','gram','chopped','tbsps','tbsp','cups','cup','tsps','tsp','ozs','oz','qts','qt','lbs','lb']
ingredientsJson = {}
if not os.path.exists("ingredients.json"):
print("Generating ingredient list...")
ingredientList = open("../finished/ingredientList.txt",
"r").read().split("\n")
for ingredient in ingredientList:
ingredient = " "+ingredient.lower()+" "
for removeWord in removeWords:
ingredient = ingredient.replace(removeWord + '. ', '')
for removeWord in removeWords2:
ingredient = ingredient.replace(removeWord, '')
ingredient = ingredient.replace(' *', '')
try:
num = int(ingredient[0])
ingredient = ' '.join(ingredient.split()[1:])
except:
pass
try:
num = int(ingredient[0])
ingredient = ' '.join(ingredient.split()[1:])
except:
pass
ingredient = ' '.join(ingredient.split())
if ingredient not in ingredientsJson:
ingredientsJson[ingredient] = 0
ingredientsJson[ingredient] += 1
with open("ingredients.json", "w") as f:
f.write(json.dumps(ingredientsJson, indent=2))
else:
print("Loading ingredient list...")
ingredientsJson = json.load(open("ingredients.json", "r"))
ingredientsPriority = []
for ingredient in ingredientsJson.keys():
if ingredientsJson[ingredient] > 1000 and len(ingredient) > 2:
ingredientsPriority.append(ingredient)
ingredientsPriority2 = []
for ingredient in ingredientsJson.keys():
if ingredientsJson[ingredient] > 50 and ingredientsJson[ingredient] <= 5000 and len(ingredient) > 2:
ingredientsPriority2.append(ingredient)
ingredientsPriority.sort(key=len, reverse=True) # sorts by descending length
ingredientsPriority2.sort(key=len, reverse=True) # sorts by descending length
ingredients = ingredientsPriority #+ ingredientsPriority2
print(ingredients[:100])
print(ingredients[-10:])
def hasIngredients(sentence):
sentence = " "+sentence.replace('.', '').replace(':', '').replace(',', '')+" "
recipeIngredients = []
sentenceSize = len(sentence.split())
for ingredient in ingredients:
if " "+ingredient+" " in sentence:
recipeIngredients.append(ingredient)
sentence = sentence.replace(ingredient,'')
sentenceSize = len(sentence.split())
if sentenceSize < 2:
break
return recipeIngredients
# sortedIngredients = sorted(
# ingredients.items(), key=operator.itemgetter(1), reverse=True)
# for i in range(1000):
# print(sortedIngredients[i])
if os.path.exists("instructions_model.json"):
print("Loading instructions model...")
chain_json = json.load(open("instructions_model.json", "r"))
stored_chain = markovify.Chain.from_json(chain_json)
instructions_model = markovify.Text.from_chain(chain_json)
else:
print("Generating instructions model...")
with open("../finished/instructions.txt") as f:
text = f.read()
instructions_model = markovify.NewlineText(text, state_size=3)
with open("instructions_model.json", "w") as f:
f.write(json.dumps(instructions_model.chain.to_json()))
# if os.path.exists("title_model.json"):
# print("Loading title model...")
# chain_json = json.load(open("title_model.json", "r"))
# stored_chain = markovify.Chain.from_json(chain_json)
# title_model = markovify.Text.from_chain(chain_json)
# else:
# print("Generaring title model...")
# with open("../finished/titles.txt") as f:
# text = f.read()
# title_model = markovify.NewlineText(text)
# with open("title_model.json", "w") as f:
# f.write(json.dumps(title_model.chain.to_json()))
# if os.path.exists("ingredients_model.json"):
# print("Loading ingredients model...")
# chain_json = json.load(open("ingredients_model.json", "r"))
# stored_chain = markovify.Chain.from_json(chain_json)
# ingredients_model = markovify.Text.from_chain(chain_json)
# else:
# print("Generaring ingredients model...")
# with open("../finished/ingredients.txt") as f:
# text = f.read()
# ingredients_model = markovify.NewlineText(text)
# with open("ingredients_model.json", "w") as f:
# f.write(json.dumps(ingredients_model.chain.to_json()))
def makeFiles(i):
with open("markov_instructions.%d.txt" % i,"w") as f:
while True:
try:
ing = getInstruction()
foods = hasIngredients(ing)
f.write(json.dumps({'text':ing,'ingredients':foods}) + "\n")
except:
pass
def getIngredient(ing=""):
sentence = ""
if ing == "":
sentence = ingredients_model.make_sentence(tries=1).lower()
else:
tries = 0
while ing not in sentence:
sentence = ingredients_model.make_sentence(tries=1).lower()
tries += 1
if tries > 100:
break
return sentence
def getInstruction(ing=""):
sentence = ""
if ing == "":
sentence = instructions_model.make_sentence(tries=1).lower()
else:
tries = 0
while ing not in sentence:
sentence = instructions_model.make_sentence(tries=1).lower()
tries += 1
if tries > 100:
break
return sentence
def getTitle(num):
sentence = title_model.make_sentence(tries=1).lower()
return sentence
# print("Generating titles...")
# t = time.time()
# with open("markov_titles.txt", "w") as f:
# for i in tqdm(range(100)):
# try:
# f.write(getTitle(i) + "\n")
# except:
# pass
# print((time.time() - t) / 100.0)
print("Making ingredients...")
makeFiles(0)
# p = Pool(8)
# p.map(makeFiles, range(8))
# print("Generating ingredients...")
# t = time.time()
# with open("markov_titles.txt", "w") as f:
# for i in tqdm(range(100)):
# f.write(getIngredient() + "\n")
# print((time.time() - t) / 100.0)
# print("Generating instrutions...")
# with open("markov_instructions.txt", "w") as f:
# for i in tqdm(range(1000000)):
# f.write(getInstruction() + "\n")
def generateRecipe():
recipe = {}
print("Generating recipe...")
recipe['ingredients'] = []
recipe['title'] = getTitle(1)
recipe['title_ingredients'] = hasIngredients(recipe['title'])
recipe['ingredients'] += recipe['title_ingredients']
recipe['directions'] = []
recipe['direction_ingredients'] = []
print("Getting directions")
for ingredient in recipe['title_ingredients']:
print(ingredient)
instruct = getInstruction(ing=ingredient)
ings = hasIngredients(instruct)
recipe['ingredients'] += ings
recipe['direction_ingredients'].append(ings)
recipe['directions'].append(instruct)
recipe['ingredients'] = list(set(recipe['ingredients']))
recipe['ingredientList'] = []
print("Getting ingredients")
for ingredient in recipe['ingredients']:
print(ingredient)
recipe['ingredientList'].append(getIngredient(ingredient))
print(json.dumps(recipe, indent=2))
print("\n\n" + recipe['title'] + "\n\n" + "\n".join(recipe['ingredientList']
) + "\n\n" + "\n".join(recipe['directions']))
# generateRecipe()
| 34.720721 | 170 | 0.61741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 3,052 | 0.395952 |
57978560a0242c56700cc234e8aab484133ef169 | 11,740 | py | Python | nanome/api/structure/complex.py | nanome-ai/nanome | 7777a782168fe4e68f58c42f01cff9e66f3675aa | [
"MIT"
] | 1 | 2020-04-10T09:47:54.000Z | 2020-04-10T09:47:54.000Z | nanome/api/structure/complex.py | nanome-ai/nanome | 7777a782168fe4e68f58c42f01cff9e66f3675aa | [
"MIT"
] | 10 | 2019-05-30T18:29:10.000Z | 2020-02-15T02:16:42.000Z | nanome/api/structure/complex.py | nanome-ai/nanome | 7777a782168fe4e68f58c42f01cff9e66f3675aa | [
"MIT"
] | 2 | 2020-02-04T02:56:21.000Z | 2020-04-25T20:05:16.000Z | from nanome._internal._structure._complex import _Complex
from nanome._internal import _PluginInstance
from nanome._internal._network import PluginNetwork
from nanome._internal._network._commands._callbacks import _Messages
from nanome.util import Matrix, Logs
from .io import ComplexIO
from . import Base
class Complex(_Complex, Base):
"""
| Represents a Complex that contains molecules.
"""
io = ComplexIO()
def __init__(self):
super(Complex, self).__init__()
self._rendering = Complex.Rendering(self)
self._molecular = Complex.Molecular(self)
self._transform = Complex.Transform(self)
self.io = ComplexIO(self)
def add_molecule(self, molecule):
"""
| Add a molecule to this complex
:param molecule: Molecule to add to the chain
:type molecule: :class:`~nanome.structure.Molecule`
"""
molecule.index = -1
self._add_molecule(molecule)
def remove_molecule(self, molecule):
"""
| Remove a molecule from this complex
:param molecule: Molecule to remove from the chain
:type molecule: :class:`~nanome.structure.Molecule`
"""
molecule.index = -1
self._remove_molecule(molecule)
# region Generators
@property
def molecules(self):
"""
| The list of molecules within this complex
"""
for molecule in self._molecules:
yield molecule
@molecules.setter
def molecules(self, molecule_list):
self._molecules = molecule_list
@property
def chains(self):
"""
| The list of chains within this complex
"""
for molecule in self.molecules:
for chain in molecule.chains:
yield chain
@property
def residues(self):
"""
| The list of residues within this complex
"""
for chain in self.chains:
for residue in chain.residues:
yield residue
@property
def atoms(self):
"""
| The list of atoms within this complex
"""
for residue in self.residues:
for atom in residue.atoms:
yield atom
@property
def bonds(self):
"""
| The list of bonds within this complex
"""
for residue in self.residues:
for bond in residue.bonds:
yield bond
# endregion
# region all fields
@property
def boxed(self):
"""
| Represents if this complex is boxed/bordered in Nanome.
:type: :class:`bool`
"""
return self._boxed
@boxed.setter
def boxed(self, value):
self._boxed = value
@property
def locked(self):
"""
| Represents if this complex is locked and unmovable in Nanome.
:type: :class:`bool`
"""
return self._locked
@locked.setter
def locked(self, value):
self._locked = value
if (value):
self._boxed = True
@property
def visible(self):
"""
| Represents if this complex is visible in Nanome.
:type: :class:`bool`
"""
return self._visible
@visible.setter
def visible(self, value):
self._visible = value
@property
def computing(self):
return self._computing
@computing.setter
def computing(self, value):
self._computing = value
@property
def current_frame(self):
"""
| Represents the current animation frame the complex is in.
:type: :class:`int`
"""
return self._current_frame
@current_frame.setter
def current_frame(self, value):
value = max(0, min(value, len(self._molecules) - 1))
self._current_frame = value
def set_current_frame(self, value):
self.current_frame = value
# returns true if the complex is selected on nanome.
def get_selected(self):
return self._selected
def get_all_selected(self):
for atom in self.atoms:
if not atom.selected:
return False
return True
def set_all_selected(self, value):
for atom in self.atoms:
atom.selected = value
def set_surface_needs_redraw(self):
self._surface_dirty = True
@property
def box_label(self):
"""
| Represents the label on the box surrounding the complex
:type: :class:`str`
"""
return self._box_label
@box_label.setter
def box_label(self, value):
self._box_label = value
@property
def name(self):
"""
| Represents the name of the complex
:type: :class:`str`
"""
return self._name
@name.setter
def name(self, value):
if type(value) is not str:
value = str(value)
self._name = value
@property
def index_tag(self):
return self._index_tag
@index_tag.setter
def index_tag(self, value):
self._index_tag = value
@property
def split_tag(self):
return self._split_tag
@split_tag.setter
def split_tag(self, value):
self._split_tag = value
@property
def full_name(self):
"""
| Represents the full name of the complex with its tags and name
:type: :class:`str`
"""
fullname = self._name
has_tag = False
if self._index_tag > 0:
fullname = fullname + " {" + str(self._index_tag)
has_tag = True
if self._split_tag is not None and len(self._split_tag) > 0:
if has_tag:
fullname = fullname + "-" + self._split_tag
else:
fullname = fullname + " {" + self._split_tag
has_tag = True
if has_tag:
fullname = fullname + "}"
return fullname
@full_name.setter
def full_name(self, value):
self._name = value
self._index_tag = 0
self._split_tag = ''
@property
def position(self):
"""
| Position of the complex
:type: :class:`~nanome.util.Vector3`
"""
return self._position
@position.setter
def position(self, value):
self._position = value
@property
def rotation(self):
"""
| Rotation of the complex
:type: :class:`~nanome.util.Quaternion`
"""
return self._rotation
@rotation.setter
def rotation(self, value):
self._rotation = value
@property
def remarks(self):
"""
| remarks section of the complex file
:type: :class: dict
"""
return self._remarks
@remarks.setter
def remarks(self, value):
self._remarks = value
def get_workspace_to_complex_matrix(self):
return self.get_complex_to_workspace_matrix().get_inverse()
def get_complex_to_workspace_matrix(self):
return Matrix.compose_transformation_matrix(self._position, self._rotation)
# endregion
def convert_to_conformers(self, force_conformers=None):
return self._convert_to_conformers(force_conformers)
def convert_to_frames(self):
return self._convert_to_frames()
def register_complex_updated_callback(self, callback):
self._complex_updated_callback = callback
_PluginInstance._hook_complex_updated(self.index, callback)
PluginNetwork._send(_Messages.hook_complex_updated, self.index, False)
def register_selection_changed_callback(self, callback):
self._selection_changed_callback = callback
_PluginInstance._hook_selection_changed(self.index, callback)
PluginNetwork._send(_Messages.hook_selection_changed, self.index, False)
@staticmethod
def align_origins(target_complex, *other_complexes):
for complex in other_complexes:
complex.position = target_complex.position.get_copy()
complex.rotation = target_complex.rotation.get_copy()
# region deprecated
@property
@Logs.deprecated()
def rendering(self):
return self._rendering
@property
@Logs.deprecated()
def molecular(self):
return self._molecular
@property
@Logs.deprecated()
def transform(self):
return self._transform
class Rendering(object):
def __init__(self, parent):
self.parent = parent
@property
def boxed(self):
return self.parent._boxed
@boxed.setter
def boxed(self, value):
self.parent.boxed = value
@property
def locked(self):
return self.parent.locked
@locked.setter
def locked(self, value):
self.parent.locked = value
if (value):
self.parent.boxed = True
@property
def visible(self):
return self.parent.visible
@visible.setter
def visible(self, value):
self.parent.visible = value
@property
def computing(self):
return self.parent.computing
@computing.setter
def computing(self, value):
self.parent.computing = value
@property
def current_frame(self):
return self.parent.current_frame
@current_frame.setter
def current_frame(self, value):
self.parent.current_frame = value
# returns true if the complex is selected on nanome.
def get_selected(self):
return self.parent.selected
def set_surface_needs_redraw(self):
self.parent.surface_dirty = True
@property
def box_label(self):
return self._box_label
@box_label.setter
def box_label(self, value):
self._box_label = value
class Molecular(object):
def __init__(self, parent):
self.parent = parent
@property
def name(self):
return self.parent.name
@name.setter
def name(self, value):
self.parent.name = value
@property
def index_tag(self):
return self.parent.index_tag
@index_tag.setter
def index_tag(self, value):
self.parent.index_tag = value
@property
def split_tag(self):
return self.parent.split_tag
@split_tag.setter
def split_tag(self, value):
self.parent.split_tag = value
class Transform(object):
def __init__(self, parent):
self.parent = parent
@property
def position(self):
return self.parent.position
@position.setter
def position(self, value):
self.parent.position = value
@property
def rotation(self):
return self.parent.rotation
@rotation.setter
def rotation(self, value):
self.parent.rotation = value
def get_workspace_to_complex_matrix(self):
rotation = Matrix.from_quaternion(self.parent.rotation)
rotation.transpose()
translation = Matrix.identity(4)
translation[0][3] = -self.parent.position.x
translation[1][3] = -self.parent.position.y
translation[2][3] = -self.parent.position.z
transformation = rotation * translation
return transformation
def get_complex_to_workspace_matrix(self):
result = self.parent.get_workspace_to_complex_matrix()
result = result.get_inverse()
return result
# endregion
Complex.io._setup_addon(Complex)
_Complex._create = Complex
| 25.139186 | 83 | 0.593782 | 11,371 | 0.968569 | 949 | 0.080835 | 7,210 | 0.61414 | 0 | 0 | 1,991 | 0.169591 |
579790343ca70d2a664becf8ebf185a247791ae7 | 1,862 | py | Python | neighbourhood/models.py | Mutembeijoe/hood_yetu | 5759bbf95a8dd0c7a62987773b71a1a7531ae074 | [
"MIT"
] | null | null | null | neighbourhood/models.py | Mutembeijoe/hood_yetu | 5759bbf95a8dd0c7a62987773b71a1a7531ae074 | [
"MIT"
] | 9 | 2020-02-12T03:06:29.000Z | 2022-03-12T00:11:25.000Z | neighbourhood/models.py | Mutembeijoe/hood_yetu | 5759bbf95a8dd0c7a62987773b71a1a7531ae074 | [
"MIT"
] | null | null | null | from django.db import models
from django.contrib.postgres.fields import ArrayField
from django.urls import reverse
# Create your models here.
class Neighbourhood(models.Model):
image = models.ImageField(upload_to='neighbourhood_avatars', default='dummy_neighbourhood.jpg')
name = models.CharField(max_length=200)
location = models.CharField(max_length=200)
police_hotline= ArrayField(models.CharField(max_length=13, blank=True),size=3, blank=True, null=True)
hospital_hotline= ArrayField(models.CharField(max_length=13, blank=True),size=3, blank=True, null=True)
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('home')
class Business(models.Model):
FOOD = 1
BEAUTY = 2
SOCIAL = 3
ENTERTAINMENT = 4
HOUSING = 5
BUSINESS_CATEGORIES = [
(FOOD, 'Food and Beverages'),
(BEAUTY, 'Beauty shops'),
(SOCIAL,'Social Amentity'),
(ENTERTAINMENT, 'Entertainment'),
(HOUSING, 'Housing'),
]
image = models.ImageField(upload_to='business_avatars', default='business.jpg')
name = models.CharField(max_length=200)
location = models.CharField(max_length=200)
description = models.TextField(blank=True, null=True)
category = models.PositiveSmallIntegerField(choices=BUSINESS_CATEGORIES)
neighbourhood = models.ForeignKey(Neighbourhood, on_delete=models.CASCADE, related_name='businesses')
def __str__(self):
return self.name
def get_absolute_url(self):
return reverse('neighbourhood', args=[self.neighbourhood.id])
@classmethod
def search_business(cls,search_term,hood):
return cls.objects.get(
models.Q(name__icontains = search_term),
models.Q(description__icontains =search_term),
models.Q(neighbourhood = hood)
) | 33.854545 | 107 | 0.697637 | 1,715 | 0.921053 | 0 | 0 | 260 | 0.139635 | 0 | 0 | 214 | 0.11493 |
5797c3e4c498f61ba0845553c24009ac9d25e7f2 | 1,932 | py | Python | WEEKS/CD_Sata-Structures/_MISC/misc-examples/text_buffer.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/text_buffer.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | WEEKS/CD_Sata-Structures/_MISC/misc-examples/text_buffer.py | webdevhub42/Lambda | b04b84fb5b82fe7c8b12680149e25ae0d27a0960 | [
"MIT"
] | null | null | null | from doubly_linked_list import DoublyLinkedList
class TextBuffer:
def __init__(self):
self.storage = DoublyLinkedList()
# return a string to the print function
def __str__(self):
# build a string
s = ""
current_node = self.storage.head
while current_node:
s += current_node.value
current_node = current_node.next
return s
# Add a character to the back of the text buffer
def append(self, string_to_add):
for char in string_to_add:
self.storage.add_to_tail(char)
# Add char to the front of the text buffer
def prepend(self, string_to_add):
for char in reversed(string_to_add):
self.storage.add_to_head(char)
# Remove a char from the front of the text buffer
def delete_front(self, chars_to_remove=1):
for _ in range(chars_to_remove):
self.storage.remove_from_head()
# Remove a char from the back of the text buffer
def delete_back(self, chars_to_remove=1):
for _ in range(chars_to_remove):
self.storage.remove_from_tail()
# concatenate another text buffer on to the end of this buffer
def join(self, other_buffer):
# join in the middle
# set the self storage tails next node to be the head of the other buffer
self.storage.tail.next = other_buffer.storage.head
# set the other buffers head to be the tail of this buffer
other_buffer.storage.head.prev = self.storage.tail
# join the ends to the correct refs
other_buffer.storage.head = self.storage.head
self.storage.tail = other_buffer.storage.tail
t = TextBuffer()
t.append("ook")
t.prepend("B")
t.append("'s are readable")
print(t)
t.delete_back(2)
print(t)
t.delete_front(6)
t.delete_front()
print(t)
t.append("le")
t.delete_front(4)
t2 = TextBuffer()
t2.append(" Hello")
print(t)
t.join(t2)
print(t)
| 28.411765 | 81 | 0.664079 | 1,624 | 0.84058 | 0 | 0 | 0 | 0 | 0 | 0 | 529 | 0.27381 |
579b07f7e2fa1f7d53a1230b84e41be5a5006de9 | 14,911 | py | Python | TWLight/users/models.py | Chinmay-Gurjar/TWLight | 94ff6e1bf0a8dd851e569c592608871de2ad3089 | [
"MIT"
] | null | null | null | TWLight/users/models.py | Chinmay-Gurjar/TWLight | 94ff6e1bf0a8dd851e569c592608871de2ad3089 | [
"MIT"
] | null | null | null | TWLight/users/models.py | Chinmay-Gurjar/TWLight | 94ff6e1bf0a8dd851e569c592608871de2ad3089 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""
This file holds user profile information. (The base User model is part of
Django; profiles extend that with locally useful information.)
TWLight has three user types:
* editors
* coordinators
* site administrators.
_Editors_ are Wikipedia editors who are applying for TWL resource access
grants. We track some of their data here to facilitate access grant
decisions.
_Coordinators_ are the Wikipedians who have responsibility for evaluating
and deciding on access grants. Site administrators should add editors to the
Coordinators group through the Django admin site.
_Site administrators_ have admin privileges for this site. They have no special
handling in this file; they are handled through the native Django is_admin
flag, and site administrators have responsibility for designating who has that
flag through the admin site.
New users who sign up via oauth will be created as editors. Site administrators
may promote them to coordinators manually in the Django admin site, by adding
them to the coordinators group. They can also directly create Django user
accounts without attached Editors in the admin site, if for some reason it's
useful to have account holders without attached Wikipedia data.
"""
from datetime import datetime, timedelta
import json
import logging
import urllib2
from django.conf import settings
from django.core.urlresolvers import reverse
from django.db import models
from django.utils.timezone import now
from django.utils.functional import cached_property
from django.utils.translation import ugettext_lazy as _
logger = logging.getLogger(__name__)
class UserProfile(models.Model):
"""
This is for storing data that relates only to accounts on TWLight, _not_ to
Wikipedia accounts. All TWLight users have user profiles.
"""
class Meta:
app_label = 'users'
# Translators: Gender unknown. This will probably only be displayed on admin-only pages.
verbose_name = 'user profile'
verbose_name_plural = 'user profiles'
# Related name for backwards queries defaults to "userprofile".
user = models.OneToOneField(settings.AUTH_USER_MODEL)
# Have they agreed to our terms?
terms_of_use = models.BooleanField(default=False,
# Translators: Users must agree to the website terms of use.
help_text=_("Has this user agreed with the terms of use?"))
terms_of_use_date = models.DateField(blank=True, null=True,
#Translators: This field records the date the user agreed to the website terms of use.
help_text=_("The date this user agreed to the terms of use."))
# Translators: An option to set whether users email is copied to their website account from Wikipedia when logging in.
use_wp_email = models.BooleanField(default=True, help_text=_('Should we '
'automatically update their email from their Wikipedia email when they '
'log in? Defaults to True.'))
lang = models.CharField(max_length=128, null=True, blank=True,
choices=settings.LANGUAGES,
# Translators: Users' detected or selected language.
help_text=_("Language"))
# Create user profiles automatically when users are created.
def create_user_profile(sender, instance, created, **kwargs):
if created:
UserProfile.objects.create(user=instance)
models.signals.post_save.connect(create_user_profile,
sender=settings.AUTH_USER_MODEL)
class Editor(models.Model):
"""
This model is for storing data related to people's accounts on Wikipedia.
It is possible for users to have TWLight accounts and not have associated
editors (if the account was created via manage.py createsuperuser),
although some site functions will not be accessible.
"""
class Meta:
app_label = 'users'
# Translators: Gender unknown. This will probably only be displayed on admin-only pages.
verbose_name = 'wikipedia editor'
verbose_name_plural = 'wikipedia editors'
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Internal data ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~#
# Database recordkeeping.
user = models.OneToOneField(settings.AUTH_USER_MODEL)
# Set as non-editable.
date_created = models.DateField(default=now,
editable=False,
# Translators: The date the user's profile was created on the website (not on Wikipedia).
help_text=_("When this profile was first created"))
# ~~~~~~~~~~~~~~~~~~~~~~~ Data from Wikimedia OAuth ~~~~~~~~~~~~~~~~~~~~~~~#
# Uses same field names as OAuth, but with wp_ prefixed.
# Data are current *as of the time of TWLight signup* but may get out of
# sync thereafter.
wp_username = models.CharField(max_length=235,
help_text=_("Username"))
# Translators: The total number of edits this user has made to all Wikipedia projects
wp_editcount = models.IntegerField(help_text=_("Wikipedia edit count"),
blank=True, null=True)
# Translators: The date this user registered their Wikipedia account
wp_registered = models.DateField(help_text=_("Date registered at Wikipedia"),
blank=True, null=True)
wp_sub = models.IntegerField(unique=True,
# Translators: The User ID for this user on Wikipedia
help_text=_("Wikipedia user ID")) # WP user id.
# Should we want to filter these to check for specific group membership or
# user rights in future:
# Editor.objects.filter(wp_groups__icontains=groupname) or similar.
# Translators: Lists the user groups (https://en.wikipedia.org/wiki/Wikipedia:User_access_levels) this editor has. e.g. Confirmed, Administrator, CheckUser
wp_groups = models.TextField(help_text=_("Wikipedia groups"),
blank=True)
# Translators: Lists the individual user rights permissions the editor has on Wikipedia. e.g. sendemail, createpage, move
wp_rights = models.TextField(help_text=_("Wikipedia user rights"),
blank=True)
wp_valid = models.BooleanField(default=False,
# Translators: Help text asking whether the user met the requirements for access (see https://wikipedialibrary.wmflabs.org/about/) the last time they logged in (when their information was last updated).
help_text=_('At their last login, did this user meet the criteria in '
'the terms of use?'))
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~ User-entered data ~~~~~~~~~~~~~~~~~~~~~~~~~~~
contributions = models.TextField(
# Translators: Describes information added by the user to describe their Wikipedia edits.
help_text=_("Wiki contributions, as entered by user"),
blank=True)
# Fields we may, or may not, have collected in the course of applications
# for resource grants.
# **** SENSITIVE USER DATA AHOY. ****
real_name = models.CharField(max_length=128, blank=True)
country_of_residence = models.CharField(max_length=128, blank=True)
occupation = models.CharField(max_length=128, blank=True)
affiliation = models.CharField(max_length=128, blank=True)
@cached_property
def wp_user_page_url(self):
url = u'{base_url}/User:{self.wp_username}'.format(
base_url=settings.TWLIGHT_OAUTH_PROVIDER_URL, self=self)
return url
@cached_property
def wp_talk_page_url(self):
url = u'{base_url}/User_talk:{self.wp_username}'.format(
base_url=settings.TWLIGHT_OAUTH_PROVIDER_URL, self=self)
return url
@cached_property
def wp_email_page_url(self):
url = u'{base_url}/Special:EmailUser/{self.wp_username}'.format(
base_url=settings.TWLIGHT_OAUTH_PROVIDER_URL, self=self)
return url
@cached_property
def wp_link_guc(self):
url = u'{base_url}?user={self.wp_username}'.format(
base_url='https://tools.wmflabs.org/guc/',
self=self
)
return url
@cached_property
def wp_link_central_auth(self):
url = u'{base_url}&target={self.wp_username}'.format(
base_url='https://meta.wikimedia.org/w/index.php?title=Special%3ACentralAuth',
self=self
)
return url
@property
def get_wp_rights_display(self):
"""
This should be used to display wp_rights in a template, or any time
we need to manipulate the rights as a list rather than a string.
Doesn't exist for batch loaded users.
"""
if self.wp_groups:
return json.loads(self.wp_rights)
else:
return None
@property
def get_wp_groups_display(self):
"""
As above, but for groups.
"""
if self.wp_groups:
return json.loads(self.wp_groups)
else:
return None
def _is_user_valid(self, identity, global_userinfo):
"""
Check for the eligibility criteria laid out in the terms of service.
To wit, users must:
* Have >= 500 edits
* Be active for >= 6 months
* Have Special:Email User enabled
* Not be blocked on any projects
Note that we won't prohibit signups or applications on this basis.
Coordinators have discretion to approve people who are near the cutoff.
Furthermore, editors who are active on multiple wikis may meet this
minimum when their account activity is aggregated even if they do not
meet it on their home wiki - but we can only check the home wiki.
"""
try:
# Check: >= 500 edits
assert int(global_userinfo['editcount']) >= 500
# Check: registered >= 6 months ago
# Try oauth registration date first. If it's not valid, try the global_userinfo date
try:
reg_date = datetime.strptime(identity['registered'], '%Y%m%d%H%M%S').date()
except:
reg_date = datetime.strptime(global_userinfo['registration'], '%Y-%m-%dT%H:%M:%SZ').date()
assert datetime.today().date() - timedelta(days=182) >= reg_date
# Check: not blocked
assert identity['blocked'] == False
return True
# Was assertion error, now we're catching any error in case we have
# an API communication or data problem.
except:
logger.exception('Editor was not valid.')
return False
def get_global_userinfo(self, identity):
"""
Grab global user information from the API, which we'll use to overlay
somme local wiki user info returned by OAuth. Returns a dict like:
global_userinfo:
home: "zhwikisource"
id: 27666025
registration: "2013-05-05T16:00:09Z"
name: "Example"
editcount: 10
"""
try:
endpoint = '{base}/w/api.php?action=query&meta=globaluserinfo&guiuser={username}&guiprop=editcount&format=json&formatversion=2'.format(base=identity['iss'],username=urllib2.quote(identity['username'].encode('utf8')))
results = json.loads(urllib2.urlopen(endpoint).read())
global_userinfo = results['query']['globaluserinfo']
try:
assert 'missing' not in global_userinfo
logger.info('Fetched global_userinfo for User.')
return global_userinfo
except AssertionError:
logger.exception('Could not fetch global_userinfo for User.')
return None
pass
except:
logger.exception('Could not fetch global_userinfo for User.')
return None
pass
def update_from_wikipedia(self, identity, lang):
"""
Given the dict returned from the Wikipedia OAuth /identify endpoint,
update the instance accordingly.
This assumes that we have used wp_sub to match the Editor and the
Wikipedia info.
Expected identity data:
{
'username': identity['username'], # wikipedia username
'sub': identity['sub'], # wikipedia ID
'rights': identity['rights'], # user rights on-wiki
'groups': identity['groups'], # user groups on-wiki
'editcount': identity['editcount'],
'email': identity['email'],
# Date registered: YYYYMMDDHHMMSS
'registered': identity['registered']
}
We could attempt to harvest real name, but we won't; we'll let
users enter it if required by partners, and avoid knowing the
data otherwise.
"""
try:
assert self.wp_sub == identity['sub']
except AssertionError:
logger.exception('Was asked to update Editor data, but the '
'WP sub in the identity passed in did not match the wp_sub on '
'the instance. Not updating.')
raise
global_userinfo = self.get_global_userinfo(identity)
self.wp_username = identity['username']
self.wp_rights = json.dumps(identity['rights'])
self.wp_groups = json.dumps(identity['groups'])
if global_userinfo:
self.wp_editcount = global_userinfo['editcount']
# Try oauth registration date first. If it's not valid, try the global_userinfo date
try:
reg_date = datetime.strptime(identity['registered'], '%Y%m%d%H%M%S').date()
except TypeError, ValueError:
try:
reg_date = datetime.strptime(global_userinfo['registration'], '%Y-%m-%dT%H:%M:%SZ').date()
except TypeError, ValueError:
reg_date = None
pass
self.wp_registered = reg_date
self.wp_valid = self._is_user_valid(identity, global_userinfo)
self.save()
# This will be True the first time the user logs in, since use_wp_email
# defaults to True. Therefore we will initialize the email field if
# they have an email at WP for us to initialize it with.
if self.user.userprofile.use_wp_email:
try:
self.user.email = identity['email']
except KeyError:
# Email isn't guaranteed to be present in identity - don't do
# anything if we can't find it.
logger.exception('Unable to get Editor email address from Wikipedia.')
pass
self.user.save()
# Add language if the user hasn't selected one
if not self.user.userprofile.lang:
self.user.userprofile.lang = lang
self.user.userprofile.save()
def __unicode__(self):
return _(u'{wp_username}').format(
# Translators: Do not translate.
wp_username=self.wp_username)
def get_absolute_url(self):
return reverse('users:editor_detail', kwargs={'pk': self.pk})
| 40.409214 | 228 | 0.652002 | 12,971 | 0.869895 | 0 | 0 | 1,663 | 0.111528 | 0 | 0 | 8,461 | 0.567433 |
579b5a9f70fd946f42041ba6173bffac11a64dcb | 14,694 | py | Python | src/reddit_baselines.py | mengelhard/cft | aaf24d4f59b581ef5ef1af17e3e23c5a7ee8245a | [
"MIT"
] | 2 | 2021-03-14T11:46:51.000Z | 2022-03-30T05:39:55.000Z | src/reddit_baselines.py | mengelhard/cft | aaf24d4f59b581ef5ef1af17e3e23c5a7ee8245a | [
"MIT"
] | 9 | 2020-03-24T18:16:46.000Z | 2022-02-10T00:39:49.000Z | src/reddit_baselines.py | mengelhard/cft | aaf24d4f59b581ef5ef1af17e3e23c5a7ee8245a | [
"MIT"
] | 1 | 2021-04-23T04:55:16.000Z | 2021-04-23T04:55:16.000Z | import numpy as np
import pandas as pd
import tensorflow as tf
import itertools
import datetime
import os
from sklearn.metrics import roc_auc_score
from model import mlp, lognormal_nlogpdf, lognormal_nlogsurvival
from model_reddit import load_batch
from train_reddit import get_files
from train_mimic import rae_over_samples, rae, ci
REDDIT_DIR = '/scratch/mme4/reddit'
#REDDIT_DIR = '/Users/mme/projects/cft/data/reddit_subset'
#REDDIT_DIR = '/home/rapiduser/dictionary_collection_2'
def main():
train_fns, val_fns, test_fns = get_files(REDDIT_DIR)
utc = datetime.datetime.utcnow().strftime('%s')
n_outputs = 9
results_fn = os.path.join(
os.path.split(os.getcwd())[0],
'results',
'reddit_baselines_' + utc + '.csv')
head = ['status', 'model_type', 'hidden_layer_size', 'censoring_factor',
'n_iter', 'final_train_nll', 'final_val_nll']
head += ['mean_auc'] + [('auc%i' % i) for i in range (n_outputs)]
head += ['mean_raem'] + [('raem%i' % i) for i in range(n_outputs)]
head += ['mean_raea'] + [('raea%i' % i) for i in range(n_outputs)]
head += ['mean_ci'] + [('ci%i' % i) for i in range(n_outputs)]
with open(results_fn, 'w+') as results_file:
print(', '.join(head), file=results_file)
for i in range(3 * 10 * 2):
hidden_layer_sizes = (750, )
model_type = ['survival', 'c_mlp', 's_mlp'][i % 3]
censoring_factor = [2., 3.][i // 30]
print('Running', model_type, 'with layers', hidden_layer_sizes)
#try:
n_iter, final_train_nll, final_val_nll, aucs, raes_median, raes_all, cis = train_baseline(
model_type, censoring_factor, hidden_layer_sizes,
train_fns, val_fns, test_fns)
status = 'complete'
# except:
# n_iter, final_train_nll, final_val_nll = [np.nan] * 3
# aucs = [np.nan] * n_outputs
# raes_median = [np.nan] * n_outputs
# raes_all = [np.nan] * n_outputs
# cis = [np.nan] * n_outputs
# status = 'failed'
results = [status, model_type, hidden_layer_sizes[0],
censoring_factor, n_iter, final_train_nll,
final_val_nll]
results += [np.nanmean(aucs)] + aucs
results += [np.nanmean(raes_median)] + raes_median
results += [np.nanmean(raes_all)] + raes_all
results += [np.nanmean(cis)] + cis
results = [str(r) for r in results]
with open(results_fn, 'a') as results_file:
print(', '.join(results), file=results_file)
print('Run complete with status:', status)
def train_baseline(model_type, censoring_factor, hidden_layer_sizes, train_fns, val_fns, test_fns):
tf.reset_default_graph()
if model_type is 'survival':
mdl = SurvivalModel(
decoder_layer_sizes=hidden_layer_sizes, dropout_pct=.5,
censoring_factor=censoring_factor)
else:
mdl = PosNegModel(
encoder_layer_sizes=hidden_layer_sizes, dropout_pct=.5,
censoring_factor=censoring_factor)
with tf.Session() as sess:
train_stats, val_stats = mdl.train(
sess, train_fns, val_fns,
100, train_type=model_type,
max_epochs_no_improve=3, learning_rate=3e-4,
verbose=False)
predictions, c_val, t_val, s_val = mdl.predict(
sess, test_fns)
train_stats = list(zip(*train_stats))
val_stats = list(zip(*val_stats))
n_iter = train_stats[0][-1]
final_train_nll = train_stats[1][-1]
final_val_nll = val_stats[1][-1]
n_out = np.shape(c_val)[1]
if model_type is 'survival':
c_prob_pred = t_to_prob(predictions)
raes = [rae_over_samples(t_val[:, i], s_val[:, i], predictions[..., i]) for i in range(n_out)]
cis = [ci(t_val[:, i], s_val[:, i], predictions[..., i]) for i in range(n_out)]
raes_median, raes_all = list(zip(*raes))
else:
c_prob_pred = predictions
raes_median = [np.nan] * n_out
raes_all = [np.nan] * n_out
cis = [np.nan] * n_out
aucs = [roc_auc_score(c_val[:, i], c_prob_pred[:, i]) for i in range(n_out)]
return n_iter, final_train_nll, final_val_nll, aucs, list(raes_median), list(raes_all), cis
def time_to_prob(x):
sorted_pos = {v: pos for pos, v in enumerate(sorted(x))}
return 1 - np.array([sorted_pos[v] / len(x) for v in x])
def t_to_prob(x):
return np.stack([time_to_prob(arr) for arr in x.T]).T
class SurvivalModel:
def __init__(self,
embedding_layer_sizes=(),
decoder_layer_sizes=(),
dropout_pct=0.,
censoring_factor=2.,
activation_fn=tf.nn.relu):
self.embedding_layer_sizes = embedding_layer_sizes
self.decoder_layer_sizes = decoder_layer_sizes
self.dropout_pct = dropout_pct
self.censoring_factor = censoring_factor
self.activation_fn = activation_fn
def train(self, sess,
train_files,
val_files,
max_epochs,
train_type='survival',
max_epochs_no_improve=0,
learning_rate=1e-3,
batch_size=300, batch_eval_freq=1,
verbose=False):
assert train_type is 'survival'
self.n_outputs = 9
self.opt = tf.train.AdamOptimizer(learning_rate)
self._build_placeholders()
self._build_x()
self._build_model()
sess.run(tf.global_variables_initializer())
train_stats = []
val_stats = []
best_val_nloglik = np.inf
n_epochs_no_improve = 0
batches_per_epoch = len(train_files)
for epoch_idx in range(max_epochs):
for batch_idx, batch_file in enumerate(train_files):
xvb, xfb, cb, tb, sb = load_batch(
batch_file, censoring_factor=self.censoring_factor)
lgnrm_nlogp_, lgnrm_nlogs_, _ = sess.run(
[self.lgnrm_nlogp, self.lgnrm_nlogs, self.train_op],
feed_dict={self.xv: xvb, self.xf: xfb, self.t: tb, self.s: sb, self.is_training: True})
if np.isnan(np.mean(lgnrm_nlogp_)):
print('Warning: lgnrm_nlogp is NaN')
if np.isnan(np.mean(lgnrm_nlogs_)):
print('Warning: lgnrm_nlogs is NaN')
if batch_idx % batch_eval_freq == 0:
idx = epoch_idx * batches_per_epoch + batch_idx
train_stats.append(
(idx, ) + self._get_train_stats(
sess, xvb, xfb, tb, sb))
idx = (epoch_idx + 1) * batches_per_epoch
current_val_stats = []
for val_batch_idx, batch_file in enumerate(val_files):
xvb, xfb, cb, tb, sb = load_batch(
batch_file, censoring_factor=self.censoring_factor)
current_val_stats.append(
self._get_train_stats(
sess, xvb, xfb, tb, sb))
print('current val stats are:', current_val_stats)
val_stats.append((idx, ) + tuple(np.mean(current_val_stats, axis=0)))
print('Completed Epoch %i' % epoch_idx)
if verbose:
self._summarize(
np.mean(train_stats[-batches_per_epoch:], axis=0),
val_stats[-1],
batches_per_epoch)
if val_stats[-1][1] < best_val_nloglik:
best_val_nloglik = val_stats[-1][1]
n_epochs_no_improve = 0
else:
n_epochs_no_improve += 1
if n_epochs_no_improve > max_epochs_no_improve:
break
return train_stats, val_stats
def _build_model(self):
self.t_mu, self.t_logvar = self._decoder(self.x)
nll = self._nloglik(self.t_mu, self.t_logvar)
self.nll = tf.reduce_mean(nll)
self.train_op = self.opt.minimize(self.nll)
def _nloglik(self, t_mu, t_logvar):
self.lgnrm_nlogp = lognormal_nlogpdf(self.t, self.t_mu, self.t_logvar)
self.lgnrm_nlogs = lognormal_nlogsurvival(self.t, self.t_mu, self.t_logvar)
nll = self.s * self.lgnrm_nlogp + (1 - self.s) * self.lgnrm_nlogs
return nll
def _build_placeholders(self):
self.xv = tf.placeholder(
shape=(None, 20, 512),
dtype=tf.float32)
self.xf = tf.placeholder(
shape=(None, 2),
dtype=tf.float32)
self.t = tf.placeholder(
shape=(None, self.n_outputs),
dtype=tf.float32)
self.s = tf.placeholder(
shape=(None, self.n_outputs),
dtype=tf.float32)
self.is_training = tf.placeholder(
shape=(),
dtype=tf.bool)
def _build_x(self):
with tf.variable_scope('embeddings'):
x_refined = mlp(
self.xv, self.embedding_layer_sizes,
dropout_pct=0.,
activation_fn=tf.nn.tanh)
x_max = tf.reduce_max(x_refined, axis=1)
x_mean = tf.reduce_mean(x_refined, axis=1)
self.x = tf.concat([x_max, x_mean, self.xf], axis=1)
def _decoder(self, h, reuse=False):
with tf.variable_scope('decoder', reuse=reuse):
hidden_layer = mlp(
h, self.decoder_layer_sizes,
dropout_pct=self.dropout_pct,
activation_fn=self.activation_fn,
training=self.is_training,
reuse=reuse)
mu = tf.layers.dense(
hidden_layer, self.n_outputs,
activation=None,
name='mu',
reuse=reuse)
logvar = tf.layers.dense(
hidden_layer, self.n_outputs,
activation=None,
name='logvar',
reuse=reuse)
self.t_pred = tf.exp(mu)
self.decoder_vars = tf.get_collection(
tf.GraphKeys.GLOBAL_VARIABLES,
scope='decoder')
return mu, logvar
def _get_train_stats(self, sess, xvs, xfs, ts, ss):
nloglik, mean, logvar = sess.run(
[self.nll,
self.t_mu,
self.t_logvar],
feed_dict={self.xv: xvs, self.xf: xfs, self.t: ts, self.s:ss, self.is_training: False})
return nloglik, np.mean(mean), np.mean(logvar)
def _summarize(self, train_stats, val_stats, batches_per_epoch):
print('nloglik (train) = %.2e' % train_stats[1])
print('t_mu: %.2e' % train_stats[2], 't_logvar: %.2e' % train_stats[3])
print('nloglik (val) = %.2e' % val_stats[1])
print('t_mu: %.2e' % val_stats[2], 't_logvar: %.2e\n' % val_stats[3])
def predict(self, sess, batch_files):
t_pred = []
c = []
t = []
s = []
for idx, batch_file in enumerate(batch_files):
xvb, xfb, cb, tb, sb = load_batch(
batch_file, censoring_factor=self.censoring_factor)
t_pred_ = sess.run(
self.t_pred,
feed_dict={self.xv: xvb, self.xf: xfb, self.is_training: False})
t_pred.append(t_pred_)
c.append(cb)
t.append(tb)
s.append(sb)
t_pred = np.concatenate(t_pred, axis=0)
c = np.concatenate(c, axis=0)
t = np.concatenate(t, axis=0)
s = np.concatenate(s, axis=0)
return t_pred, c, t, s
class PosNegModel: ## amend this to use c vs s
def __init__(self,
embedding_layer_sizes=(),
encoder_layer_sizes=(),
dropout_pct=0.,
censoring_factor=2.,
activation_fn=tf.nn.relu):
self.embedding_layer_sizes = embedding_layer_sizes
self.encoder_layer_sizes = encoder_layer_sizes
self.dropout_pct = dropout_pct
self.censoring_factor = censoring_factor
self.activation_fn = activation_fn
def train(self, sess,
train_files,
val_files,
max_epochs,
train_type='s_mlp', max_epochs_no_improve=1,
learning_rate=1e-3,
batch_size=300, batch_eval_freq=10,
verbose=False):
self.train_type = train_type
self.n_outputs = 9
self.opt = tf.train.AdamOptimizer(learning_rate)
self._build_placeholders()
self._build_x()
self._build_model()
sess.run(tf.global_variables_initializer())
train_stats = []
val_stats = []
best_val_nloglik = np.inf
n_epochs_no_improve = 0
batches_per_epoch = len(train_files)
for epoch_idx in range(max_epochs):
for batch_idx, batch_file in enumerate(train_files):
xvb, xfb, cb, tb, sb = load_batch(
batch_file, censoring_factor=self.censoring_factor)
if train_type is 's_mlp':
xvb, xfb, _, tb, sb = load_batch(
batch_file, censoring_factor=self.censoring_factor)
elif train_type is 'c_mlp':
xvb, xfb, sb, tb, _ = load_batch(
batch_file, censoring_factor=self.censoring_factor)
sess.run(
self.train_op,
feed_dict={self.xv: xvb, self.xf: xfb, self.s: sb, self.is_training: True})
if batch_idx % batch_eval_freq == 0:
idx = epoch_idx * batches_per_epoch + batch_idx
train_stats.append((idx, self._get_train_stats(sess, xvb, xfb, sb)))
idx = (epoch_idx + 1) * batches_per_epoch
current_val_stats = []
for val_batch_idx, batch_file in enumerate(val_files):
if train_type is 's_mlp':
xvb, xfb, _, tb, sb = load_batch(
batch_file, censoring_factor=self.censoring_factor)
elif train_type is 'c_mlp':
xvb, xfb, sb, tb, _ = load_batch(
batch_file, censoring_factor=self.censoring_factor)
current_val_stats.append(self._get_train_stats(sess, xvb, xfb, sb))
val_stats.append((idx, np.mean(current_val_stats)))
print('Completed Epoch %i' % epoch_idx)
if verbose:
self._summarize(
np.mean(train_stats[-batches_per_epoch:], axis=0),
val_stats[-1],
batches_per_epoch)
if val_stats[-1][1] < best_val_nloglik:
best_val_nloglik = val_stats[-1][1]
n_epochs_no_improve = 0
else:
n_epochs_no_improve += 1
if n_epochs_no_improve > max_epochs_no_improve:
break
return train_stats, val_stats
def _build_model(self):
self.s_logits, self.s_probs = self._encoder(self.x)
nll = tf.nn.sigmoid_cross_entropy_with_logits(
labels=self.s,
logits=self.s_logits)
self.nll = tf.reduce_mean(nll)
self.train_op = self.opt.minimize(self.nll)
def _build_placeholders(self):
self.xv = tf.placeholder(
shape=(None, 20, 512),
dtype=tf.float32)
self.xf = tf.placeholder(
shape=(None, 2),
dtype=tf.float32)
self.s = tf.placeholder(
shape=(None, self.n_outputs),
dtype=tf.float32)
self.is_training = tf.placeholder(
shape=(),
dtype=tf.bool)
def _build_x(self):
with tf.variable_scope('embeddings'):
x_refined = mlp(
self.xv, self.embedding_layer_sizes,
dropout_pct=0.,
activation_fn=tf.nn.tanh)
x_max = tf.reduce_max(x_refined, axis=1)
x_mean = tf.reduce_mean(x_refined, axis=1)
self.x = tf.concat([x_max, x_mean, self.xf], axis=1)
def _encoder(self, h):
with tf.variable_scope('encoder'):
hidden_layer = mlp(
h, self.encoder_layer_sizes,
dropout_pct=self.dropout_pct,
training=self.is_training,
activation_fn=self.activation_fn)
logits = tf.layers.dense(
hidden_layer, self.n_outputs,
activation=None, name='logit_weights')
probs = tf.nn.sigmoid(logits)
self.encoder_vars = tf.get_collection(
tf.GraphKeys.GLOBAL_VARIABLES,
scope='encoder')
return logits, probs
def _get_train_stats(self, sess, xvs, xfs, ss):
nloglik = sess.run(
self.nll,
feed_dict={self.xv: xvs, self.xf: xfs, self.s:ss, self.is_training: False})
return nloglik
def _summarize(self, train_stats, val_stats, batches_per_epoch):
print('nloglik (train) = %.2e' % train_stats)
print('nloglik (val) = %.2e' % val_stats)
def predict(self, sess, batch_files):
s_probs = []
c = []
t = []
s = []
for idx, batch_file in enumerate(batch_files):
xvb, xfb, cb, tb, sb = load_batch(
batch_file, censoring_factor=self.censoring_factor)
s_probs_ = sess.run(
self.s_probs,
feed_dict={self.xv: xvb, self.xf: xfb, self.is_training: False})
s_probs.append(s_probs_)
c.append(cb)
t.append(tb)
s.append(sb)
s_probs = np.concatenate(s_probs, axis=0)
c = np.concatenate(c, axis=0)
t = np.concatenate(t, axis=0)
s = np.concatenate(s, axis=0)
return s_probs, c, t, s
if __name__ == '__main__':
main()
| 24.49 | 99 | 0.689261 | 10,603 | 0.721587 | 0 | 0 | 0 | 0 | 0 | 0 | 1,129 | 0.076834 |
579bb2d5e8a709b1e23fdd92467609fdeb1606bf | 1,272 | py | Python | os_client_config/constructors.py | dtroyer/os-client-config | f0ce20703d2cb8dbf899b9768c3cbbd14ee60594 | [
"Apache-2.0"
] | 36 | 2015-04-17T12:05:54.000Z | 2019-10-15T20:44:34.000Z | os_client_config/constructors.py | dtroyer/os-client-config | f0ce20703d2cb8dbf899b9768c3cbbd14ee60594 | [
"Apache-2.0"
] | null | null | null | os_client_config/constructors.py | dtroyer/os-client-config | f0ce20703d2cb8dbf899b9768c3cbbd14ee60594 | [
"Apache-2.0"
] | 16 | 2015-05-11T22:59:51.000Z | 2020-12-07T16:42:37.000Z | # Copyright (c) 2014 Hewlett-Packard Development Company, L.P.
#
# 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 json
import os
import threading
_json_path = os.path.join(
os.path.dirname(os.path.realpath(__file__)), 'constructors.json')
_class_mapping = None
_class_mapping_lock = threading.Lock()
def get_constructor_mapping():
global _class_mapping
if _class_mapping is not None:
return _class_mapping.copy()
with _class_mapping_lock:
if _class_mapping is not None:
return _class_mapping.copy()
tmp_class_mapping = {}
with open(_json_path, 'r') as json_file:
tmp_class_mapping.update(json.load(json_file))
_class_mapping = tmp_class_mapping
return tmp_class_mapping.copy()
| 34.378378 | 75 | 0.731132 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 619 | 0.486635 |
579c287002d5865b908cece88e2dc77b99abf245 | 4,392 | py | Python | src/the_tale/the_tale/linguistics/migrations/0009_remove_quotes_from_diary.py | al-arz/the-tale | 542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5 | [
"BSD-3-Clause"
] | 85 | 2017-11-21T12:22:02.000Z | 2022-03-27T23:07:17.000Z | src/the_tale/the_tale/linguistics/migrations/0009_remove_quotes_from_diary.py | al-arz/the-tale | 542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5 | [
"BSD-3-Clause"
] | 545 | 2017-11-04T14:15:04.000Z | 2022-03-27T14:19:27.000Z | src/the_tale/the_tale/linguistics/migrations/0009_remove_quotes_from_diary.py | al-arz/the-tale | 542770257eb6ebd56a5ac44ea1ef93ff4ab19eb5 | [
"BSD-3-Clause"
] | 45 | 2017-11-11T12:36:30.000Z | 2022-02-25T06:10:44.000Z | # -*- coding: utf-8 -*-
import json
from django.db import models, migrations
DIARY_KEYS = (0,
3,
4,
17,
20001,
20002,
20003,
40000,
40001,
40002,
40003,
40004,
40005,
40006,
40007,
40008,
40009,
40010,
40011,
40012,
40013,
40014,
40015,
40016,
40017,
40018,
40019,
40020,
40021,
40022,
40023,
40024,
40025,
40026,
40027,
40028,
40029,
40030,
40031,
80001,
80002,
80003,
80004,
80005,
80006,
80007,
80008,
80009,
80010,
80011,
80012,
80013,
80014,
80015,
80016,
80017,
80018,
80019,
80020,
80021,
80022,
80023,
80024,
80027,
80028,
80034,
80035,
300000,
360019,
360020,
360021,
360022,
360023,
360024,
360025,
360026,
360027,
380013,
380014,
380015,
380016,
380017,
380018,
380019,
380020,
380021,
400017,
400018,
400019,
400020,
400021,
400022,
400023,
400024,
400025,
400026,
400027,
400028,
400029,
420004,
420005,
420006,
420007,
420008,
440004,
440005,
440006,
460007,
460008,
460009,
480006,
480007,
480008,
500004,
500005,
500006,
520004,
520005,
520006,
540002,
540003,
540004,
540005,
540006,
540007,
540008,
540009,
540010,
540011,
540012,
540013,
540014,
540015,
560019,
560020,
560021,
560022,
560023,
560024,
560025,
560026,
560027,
560028,
560029,
560030,
560031,
560032,
560033,
580000,
580001,
580002,
580005 )
def remove_quotes(apps, schema_editor):
Template = apps.get_model("linguistics", "Template")
for template in Template.objects.filter(key__in=DIARY_KEYS):
if template.raw_template[0] != '«':
continue
if template.raw_template[-1] == '»':
processor = lambda text: text[1:-1]
elif template.raw_template[-2:] == '».':
processor = lambda text: text[1:-2] + '.'
else:
continue
data = json.loads(template.data)
template.raw_template = processor(template.raw_template)
for verificator in data['verificators']:
verificator['text'] = processor(verificator['text'])
data['template']['template'] = processor(data['template']['template'])
template.data = json.dumps(data)
template.save()
class Migration(migrations.Migration):
dependencies = [
('linguistics', '0008_auto_20150727_1600'),
]
operations = [
migrations.RunPython(
remove_quotes,
),
]
| 21.742574 | 78 | 0.344035 | 212 | 0.048237 | 0 | 0 | 0 | 0 | 0 | 0 | 166 | 0.03777 |
579d327dd8fa1b155ce5d0aa4edd1cd1932f3add | 1,764 | py | Python | scripts/supp_fig_C_calc.py | dhbrookes/FitnessSparsity | ccaf35a4dbdbf175e5a6f6dcfd7c368b640f84f2 | [
"MIT"
] | 3 | 2021-09-20T04:51:55.000Z | 2022-02-02T13:37:31.000Z | scripts/supp_fig_C_calc.py | dhbrookes/FitnessSparsity | ccaf35a4dbdbf175e5a6f6dcfd7c368b640f84f2 | [
"MIT"
] | null | null | null | scripts/supp_fig_C_calc.py | dhbrookes/FitnessSparsity | ccaf35a4dbdbf175e5a6f6dcfd7c368b640f84f2 | [
"MIT"
] | null | null | null | import sys
sys.path.append("../src")
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
import C_calculation
plt.style.use(['seaborn-deep', '../paper.mplstyle'])
"""
This script produces Figure S3, which displays a detailed summary of the
calculations used to determine a suitable value for C. Run as:
$ python figure_s3.py
"""
C_recovery_dict = np.load("../results/C_recovery.npy", allow_pickle=True).item()
Cs = C_recovery_dict['Cs']
frac_recovered = C_recovery_dict['frac_recovered']
Lqs = [(10, 2), (11, 2), (12, 2), (13, 2),
(6, 3), (7, 3), (8, 3),
(5, 4), (6, 4), (7, 4)]
fig, axes = plt.subplots(2, 5, figsize=(10, 5))
axes_flat = axes.flatten()
colors = sns.color_palette('rocket_r', n_colors=5)
for j in range(len(Lqs)):
ax = axes_flat[j]
L, q = Lqs[j]
Ks = []
vals = []
for i in range(len(C_calculation.TESTED)):
L_, q_, K = C_calculation.TESTED[i]
if L == L_ and q == q_:
if j == 1:
lbl = '$K=%s$' % K
else:
lbl=None
vals = frac_recovered[i]
ax.plot(Cs, vals, c=colors[K-1], label=lbl)
if j == 1:
fig.legend(loc='lower center', bbox_to_anchor=(0.5, -0.05), ncol=5, fancybox=True)
ax.plot((2.62, 2.62), (0, 1), c='k', lw=1, ls='--')
ax.set_xlim([0, 3])
ax.set_ylim([-0.01, 1.01])
ax.set_xlabel("$C$")
ax.set_xticks([0, 0.5, 1, 1.5, 2, 2.5, 3])
ax.tick_params(axis='x', which='major', labelsize=8)
ax.set_ylabel("Fraction Recovered at $C \cdot S \log(q^L)$")
ax.set_title("$L=%s, \,q=%s$" % (L, q))
plt.tight_layout()
plt.savefig("plots/supp_fig_C_calc.png", dpi=300, bbox_inches='tight', facecolor='w', transparent=False)
plt.show() | 29.898305 | 104 | 0.584467 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 408 | 0.231293 |
579e371e955563dc8f4d6412367c0fd0a22213bb | 167 | py | Python | Exercicios Python/exlista01.py | oswaldo-spadari/Python-Exec | 3c3a237ed7c30af43f23a3619f6c6b92f6fcb12e | [
"MIT"
] | null | null | null | Exercicios Python/exlista01.py | oswaldo-spadari/Python-Exec | 3c3a237ed7c30af43f23a3619f6c6b92f6fcb12e | [
"MIT"
] | null | null | null | Exercicios Python/exlista01.py | oswaldo-spadari/Python-Exec | 3c3a237ed7c30af43f23a3619f6c6b92f6fcb12e | [
"MIT"
] | null | null | null | #Faça um Programa que leia um vetor de 5 números inteiros e mostre-os.
lista=[]
for i in range(1, 6):
lista.append(int(input('Digite um número: ')))
print(lista)
| 23.857143 | 70 | 0.694611 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 93 | 0.547059 |
579ed39e3894484e564f4d2f67bafed408849d23 | 169 | py | Python | seno/wallet/trading/trade_status.py | emilson0407/seno-blockchain | fa73fc06639faaacbb82504a6c8698c3bcab57c0 | [
"Apache-2.0"
] | 11,902 | 2019-12-05T00:14:29.000Z | 2022-03-31T23:25:37.000Z | seno/wallet/trading/trade_status.py | emilson0407/seno-blockchain | fa73fc06639faaacbb82504a6c8698c3bcab57c0 | [
"Apache-2.0"
] | 5,246 | 2019-12-05T04:00:03.000Z | 2022-03-31T21:33:30.000Z | seno/wallet/trading/trade_status.py | emilson0407/seno-blockchain | fa73fc06639faaacbb82504a6c8698c3bcab57c0 | [
"Apache-2.0"
] | 2,149 | 2019-12-05T11:12:53.000Z | 2022-03-31T06:08:34.000Z | from enum import Enum
class TradeStatus(Enum):
PENDING_ACCEPT = 0
PENDING_CONFIRM = 1
PENDING_CANCEL = 2
CANCELED = 3
CONFIRMED = 4
FAILED = 5
| 15.363636 | 24 | 0.650888 | 144 | 0.852071 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
579ee3e03e2bc4abaee046e7d30389e76953898b | 522 | py | Python | sbpy/spectroscopy/vega/sources.py | mkelley/sbpy | 40ff9a99f9b606fbf819e3b134f2b2d3b972c681 | [
"BSD-3-Clause"
] | 3 | 2018-10-25T01:55:31.000Z | 2020-03-31T16:11:08.000Z | sbpy/spectroscopy/vega/sources.py | mkelley/sbpy | 40ff9a99f9b606fbf819e3b134f2b2d3b972c681 | [
"BSD-3-Clause"
] | null | null | null | sbpy/spectroscopy/vega/sources.py | mkelley/sbpy | 40ff9a99f9b606fbf819e3b134f2b2d3b972c681 | [
"BSD-3-Clause"
] | null | null | null | # Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
========================
SBPy Vega Sources Module
========================
Descriptions of source Vega spectra.
"""
# Parameters passed to Vega.from_file. 'filename' is a URL. After
# adding spectra here update __init__.py docstring and
# docs/sbpy/spectroscopy.rst.
available = [
'Bohlin2014'
]
Bohlin2014 = {
'filename': 'alpha_lyr_stis_008-edit.fits',
'description': 'Spectrum of Bohlin 2014',
'bibcode': '2014AJ....147..127B'
}
| 21.75 | 66 | 0.637931 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 453 | 0.867816 |
579ef7f1b1338f3ddf37ec13a2ddb9beab318d6c | 3,455 | py | Python | api_server.py | ChristianKreuzberger/computer.vision.101 | 627db9414fd274905b79548cbe6462d96d9cea86 | [
"MIT"
] | null | null | null | api_server.py | ChristianKreuzberger/computer.vision.101 | 627db9414fd274905b79548cbe6462d96d9cea86 | [
"MIT"
] | null | null | null | api_server.py | ChristianKreuzberger/computer.vision.101 | 627db9414fd274905b79548cbe6462d96d9cea86 | [
"MIT"
] | 1 | 2018-09-17T09:06:52.000Z | 2018-09-17T09:06:52.000Z | import os
os.environ["KERAS_BACKEND"] = "tensorflow"
import numpy as np
import keras
from keras.applications import imagenet_utils
from keras.models import Sequential
from keras.layers import Dense, Dropout, Activation, Flatten
from keras.layers import Conv2D, MaxPooling2D
from keras.preprocessing import image
from keras.preprocessing.image import img_to_array
from keras.regularizers import l2
from PIL import Image
from flask import Flask
from flask_restful import Api, Resource, reqparse
import werkzeug
input_shape = (28, 28, 1)
num_classes = 10
def build_model():
model = Sequential()
model.add(Conv2D(32, (3, 3), padding='same', kernel_regularizer=l2(0.01), input_shape=input_shape))
model.add(Activation('relu'))
model.add(Conv2D(32, (5, 5), kernel_regularizer=l2(0.01)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
model.add(Conv2D(64, (3, 3), padding='same', kernel_regularizer=l2(0.01)))
model.add(Activation('relu'))
model.add(Conv2D(64, (5, 5), kernel_regularizer=l2(0.01)))
model.add(Activation('relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.25))
model.add(Flatten())
model.add(Dense(512))
model.add(Activation('relu'))
model.add(Dropout(0.5))
model.add(Dense(num_classes))
model.add(Activation('softmax'))
return model
model = build_model()
model.summary()
model.compile(loss='categorical_crossentropy',
optimizer='adam',
metrics=['accuracy'])
model.load_weights("fashion-mnist-90.h5")
model._make_predict_function()
mapping = {
0: "T-shirt/top",
1: "Trouser",
2: "Pullover",
3: "Dress",
4: "Coat",
5: "Sandal",
6: "Shirt",
7: "Sneaker",
8: "Bag",
9: "Ankle boot"
}
app = Flask(__name__)
api = Api(app)
@app.route('/')
def get_index():
return """
<html>
<head>
<title>Classify Image</title>
</head>
<body>
<form method="post" action="/classify" enctype="multipart/form-data">
File: <input type="file" name="image" /><br />
<input type="submit">
</form>
</body>
</html>
"""
@app.route('/classify', methods=['POST'])
def post_image():
parse = reqparse.RequestParser()
parse.add_argument('image', type=werkzeug.datastructures.FileStorage, location='files')
args = parse.parse_args()
if not 'image' in args or not args['image']:
return {
'message': "Please provide an image"
}, 400
img_stream = args['image'].stream
prepared_image = image.load_img(img_stream, target_size=(28, 28))
# convert input image to gray scale
prepared_image = prepared_image.convert('L')
# convert the image to a numpy array
prepared_image = image.img_to_array(prepared_image)
prepared_image = np.expand_dims(prepared_image, axis=0)
# and finally reshape the array
prepared_image = prepared_image.reshape(1, 28, 28, 1)
result = model.predict_classes(prepared_image)
classification = result[0]
import json
return json.dumps({
"classifications": result.tolist(),
"string": mapping[classification]
})
app.run(debug=True, host="0.0.0.0")
# Test with
# curl -F image=@`pwd`/fashion-mnist-handbag.png -X POST http://127.0.0.1:5000/classify
# curl -F image=@`pwd`/fashion-mnist-shoe.png -X POST http://127.0.0.1:5000/classify
| 25.592593 | 103 | 0.661071 | 0 | 0 | 0 | 0 | 1,366 | 0.395369 | 0 | 0 | 938 | 0.271491 |
57a027d5dd9201731891da0c2235f4c706336af9 | 506 | py | Python | Lesson2_Functions/8-return.py | StyvenSoft/degree-python | 644953608948f341f5a20ceb9a02976a128b472b | [
"MIT"
] | null | null | null | Lesson2_Functions/8-return.py | StyvenSoft/degree-python | 644953608948f341f5a20ceb9a02976a128b472b | [
"MIT"
] | null | null | null | Lesson2_Functions/8-return.py | StyvenSoft/degree-python | 644953608948f341f5a20ceb9a02976a128b472b | [
"MIT"
] | null | null | null | def divide_by_four(input_number):
return input_number/4
result = divide_by_four(16)
# result now holds 4
print("16 divided by 4 is " + str(result) + "!")
result2 = divide_by_four(result)
print(str(result) + " divided by 4 is " + str(result2) + "!")
def calculate_age(current_year, birth_year):
age = current_year - birth_year
return age
my_age = calculate_age(2049, 1993)
dads_age = calculate_age(2049, 1953)
print("I am "+str(my_age)+" years old and my dad is "+str(dads_age)+" years old") | 26.631579 | 81 | 0.70751 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 112 | 0.221344 |
57a3a8a709c11a11c55c20bbf889cce49b9d06df | 223 | py | Python | adjutant-plugin/mfa_views/models.py | catalyst-cloud/adjutant-mfa | d9e99dd006a895ca33b840e7d92bc5107ec4ba8d | [
"Apache-2.0"
] | 2 | 2018-02-15T12:56:05.000Z | 2018-03-10T09:45:08.000Z | adjutant-plugin/mfa_views/models.py | catalyst-cloud/adjutant-mfa | d9e99dd006a895ca33b840e7d92bc5107ec4ba8d | [
"Apache-2.0"
] | 1 | 2018-05-24T23:08:17.000Z | 2018-05-24T23:08:17.000Z | adjutant-plugin/mfa_views/models.py | catalyst-cloud/adjutant-mfa | d9e99dd006a895ca33b840e7d92bc5107ec4ba8d | [
"Apache-2.0"
] | 3 | 2018-02-09T03:27:43.000Z | 2018-07-02T10:45:35.000Z |
from adjutant.api.v1.models import register_taskview_class
from mfa_views import views
register_taskview_class(r'^openstack/edit-mfa/?$', views.EditMFA)
register_taskview_class(r'^openstack/users/?$', views.UserListMFA)
| 27.875 | 66 | 0.816143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 47 | 0.210762 |
57a3afc4218ffc2e5632ac9b4b9ef00acfd02961 | 3,194 | py | Python | src/toast/tod/applygain.py | ziotom78/toast | 66aef04c833a28f0928a0bbc221da45882aae475 | [
"BSD-2-Clause"
] | null | null | null | src/toast/tod/applygain.py | ziotom78/toast | 66aef04c833a28f0928a0bbc221da45882aae475 | [
"BSD-2-Clause"
] | null | null | null | src/toast/tod/applygain.py | ziotom78/toast | 66aef04c833a28f0928a0bbc221da45882aae475 | [
"BSD-2-Clause"
] | null | null | null | # Copyright (c) 2015-2019 by the parties listed in the AUTHORS file.
# All rights reserved. Use of this source code is governed by
# a BSD-style license that can be found in the LICENSE file.
import numpy as np
from astropy.io import fits
from ..op import Operator
from ..timing import function_timer
from .tod_math import calibrate
from ..utils import Logger
def write_calibration_file(filename, gain):
"""Write gains to a FITS file in the standard TOAST format
Args:
filename (string): output filename, overwritten by default
gain (dict): Dictionary, key "TIME" has the common timestamps,
other keys are channel names their values are the gains
"""
log = Logger.get()
detectors = list(gain.keys())
detectors.remove("TIME")
hdus = [
fits.PrimaryHDU(),
fits.BinTableHDU.from_columns(
[
fits.Column(
name="DETECTORS",
array=detectors,
unit="",
format="{0}A".format(max([len(x) for x in detectors])),
)
]
),
]
hdus[1].header["EXTNAME"] = "DETECTORS"
cur_hdu = fits.BinTableHDU.from_columns(
[fits.Column(name="TIME", array=gain["TIME"], unit="s", format="1D")]
)
cur_hdu.header["EXTNAME"] = "TIME"
hdus.append(cur_hdu)
gain_table = np.zeros(
(len(detectors), len(gain["TIME"])), dtype=gain[detectors[0]].dtype
)
for i_det, det in enumerate(detectors):
gain_table[i_det, :] = gain[det]
gainhdu = fits.ImageHDU(gain_table)
gainhdu.header["EXTNAME"] = "GAINS"
hdus.append(gainhdu)
fits.HDUList(hdus).writeto(filename, overwrite=True)
log.info("Gains written to file {}".format(filename))
return
class OpApplyGain(Operator):
"""Operator which applies gains to timelines.
Args:
gain (dict): Dictionary, key "TIME" has the common timestamps,
other keys are channel names their values are the gains
name (str): Name of the output signal cache object will be
<name_in>_<detector>. If the object exists, it is used as
input. Otherwise signal is read using the tod read method.
"""
def __init__(self, gain, name=None):
self._gain = gain
self._name = name
# Call the parent class constructor
super().__init__()
@function_timer
def exec(self, data):
"""Apply the gains.
Args:
data (toast.Data): The distributed data.
"""
for obs in data.obs:
tod = obs["tod"]
for det in tod.local_dets:
# Cache the output signal
ref = tod.local_signal(det, self._name)
obs_times = tod.read_times()
calibrate(
obs_times,
ref,
self._gain["TIME"],
self._gain[det],
order=0,
inplace=True,
)
assert np.isnan(ref).sum() == 0, "The signal timestream includes NaN"
del ref
return
| 27.067797 | 85 | 0.567001 | 1,383 | 0.432999 | 0 | 0 | 763 | 0.238885 | 0 | 0 | 1,225 | 0.383532 |
57a48b0dacbc22f4bad998cd06e891c64fb838c5 | 7,652 | py | Python | jans-linux-setup/jans_setup/static/extension/person_authentication/GoogleExternalAuthenticator.py | nikdavnik/jans | 5e9abc74cca766a066512eab2aca6563ce480bff | [
"Apache-2.0"
] | 18 | 2022-01-13T13:45:13.000Z | 2022-03-30T04:41:18.000Z | jans-linux-setup/jans_setup/static/extension/person_authentication/GoogleExternalAuthenticator.py | nikdavnik/jans | 5e9abc74cca766a066512eab2aca6563ce480bff | [
"Apache-2.0"
] | 604 | 2022-01-13T12:32:50.000Z | 2022-03-31T20:27:36.000Z | jans-linux-setup/jans_setup/static/extension/person_authentication/GoogleExternalAuthenticator.py | nikdavnik/jans | 5e9abc74cca766a066512eab2aca6563ce480bff | [
"Apache-2.0"
] | 8 | 2022-01-28T00:23:25.000Z | 2022-03-16T05:12:12.000Z | # Janssen Project software is available under the Apache 2.0 License (2004). See http://www.apache.org/licenses/ for full text.
# Copyright (c) 2020, Janssen Project
#
# Author: Madhumita Subramaniam
#
from io.jans.service.cdi.util import CdiUtil
from io.jans.as.server.security import Identity
from io.jans.model.custom.script.type.auth import PersonAuthenticationType
from io.jans.as.server.service import AuthenticationService, UserService
from io.jans.util import StringHelper
from io.jans.as.server.util import ServerUtil
from io.jans.as.common.model.common import User
from io.jans.orm import PersistenceEntryManager
from io.jans.as.persistence.model.configuration import GluuConfiguration
from java.math import BigInteger
from java.security import SecureRandom
import java
import sys
import json
from java.util import Collections, HashMap, HashSet, ArrayList, Arrays, Date
from com.google.api.client.googleapis.auth.oauth2 import GoogleIdToken
from com.google.api.client.googleapis.auth.oauth2.GoogleIdToken import Payload
from com.google.api.client.googleapis.auth.oauth2 import GoogleIdTokenVerifier
from com.google.api.client.http.javanet import NetHttpTransport;
from com.google.api.client.json.jackson2 import JacksonFactory;
class PersonAuthentication(PersonAuthenticationType):
def __init__(self, currentTimeMillis):
self.currentTimeMillis = currentTimeMillis
def init(self, customScript, configurationAttributes):
print "Google. Initialization"
google_creds_file = configurationAttributes.get("google_creds_file").getValue2()
# Load credentials from file
f = open(google_creds_file, 'r')
try:
data = json.loads(f.read())
print data
creds = data["web"]
print creds
except:
print "Google. Initialization. Failed to load creds from file:", google_creds_file
print "Exception: ", sys.exc_info()[1]
return False
finally:
f.close()
self.client_id = str(creds["client_id"])
self.project_id = str(creds["project_id"])
self.auth_uri = str(creds["auth_uri"])
self.token_uri = str(creds["token_uri"])
self.auth_provider_x509_cert_url = str(creds["auth_provider_x509_cert_url"])
self.redirect_uris = str(creds["redirect_uris"])
self.javascript_origins = str(creds["javascript_origins"])
print "Google. Initialized successfully"
return True
def destroy(self, configurationAttributes):
print "Google. Destroy"
print "Google. Destroyed successfully"
return True
def getAuthenticationMethodClaims(self, requestParameters):
return None
def getApiVersion(self):
return 11
def isValidAuthenticationMethod(self, usageType, configurationAttributes):
return True
def getAlternativeAuthenticationMethod(self, usageType, configurationAttributes):
return None
def authenticate(self, configurationAttributes, requestParameters, step):
authenticationService = CdiUtil.bean(AuthenticationService)
if (step == 1):
print "Google. Authenticate for step 1"
identity = CdiUtil.bean(Identity)
googleCred = ServerUtil.getFirstValue(requestParameters, "credential")
if googleCred is not None:
googleIdToken = ServerUtil.getFirstValue(requestParameters, "credential")
google_Id = self.verifyIDToken(googleIdToken)
# if user doesnt exist in persistence, add
foundUser = self.findUserByGoogleId(google_Id)
if foundUser is None:
foundUser = User()
foundUser.setAttribute("jansExtUid", "passport-google:"+google_Id)
foundUser.setAttribute(self.getLocalPrimaryKey(),google_Id)
userService = CdiUtil.bean(UserService)
result = userService.addUser(foundUser, True)
foundUser = self.findUserByGoogleId(google_Id)
logged_in = authenticationService.authenticate(foundUser.getUserId())
return logged_in
else:
credentials = identity.getCredentials()
user_name = credentials.getUsername()
user_password = credentials.getPassword()
logged_in = False
if (StringHelper.isNotEmptyString(user_name) and StringHelper.isNotEmptyString(user_password)):
logged_in = authenticationService.authenticate(user_name, user_password)
return logged_in
else:
print "Google. Authenticate Error"
return False
def verifyIDToken(self, googleIdToken):
verifier = GoogleIdTokenVerifier.Builder(NetHttpTransport(), JacksonFactory()).setAudience(Collections.singletonList(self.client_id)).build()
# the GoogleIdTokenVerifier.verify() method verifies the JWT signature, the aud claim, the iss claim, and the exp claim.
idToken = verifier.verify(googleIdToken)
if idToken is not None:
payload = idToken.getPayload()
userId = payload.getSubject()
print "User ID: %s" % userId
#email = payload.getEmail()
#emailVerified = Boolean.valueOf(payload.getEmailVerified())
#name = str( payload.get("name"))
#pictureUrl = str(payload.get("picture"))
#locale = str( payload.get("locale"))
#familyName = str( payload.get("family_name"))
#givenName = str( payload.get("given_name"))
return userId
else :
print "Invalid ID token."
return None
def findUserByGoogleId(self, googleId):
userService = CdiUtil.bean(UserService)
return userService.getUserByAttribute("jansExtUid", "passport-google:"+googleId)
def getLocalPrimaryKey(self):
entryManager = CdiUtil.bean(PersistenceEntryManager)
config = GluuConfiguration()
config = entryManager.find(config.getClass(), "ou=configuration,o=jans")
#Pick (one) attribute where user id is stored (e.g. uid/mail)
# primaryKey is the primary key on the backend AD / LDAP Server
# localPrimaryKey is the primary key on Gluu. This attr value has been mapped with the primary key attr of the backend AD / LDAP when configuring cache refresh
uid_attr = config.getIdpAuthn().get(0).getConfig().findValue("localPrimaryKey").asText()
print "Casa. init. uid attribute is '%s'" % uid_attr
return uid_attr
def prepareForStep(self, configurationAttributes, requestParameters, step):
if (step == 1):
print "Google. Prepare for Step 1"
identity = CdiUtil.bean(Identity)
identity.setWorkingParameter("gclient_id",self.client_id)
return True
else:
return False
def getExtraParametersForStep(self, configurationAttributes, step):
return None
def getCountAuthenticationSteps(self, configurationAttributes):
return 1
def getPageForStep(self, configurationAttributes, step):
if(step == 1):
return "/auth/google/login.xhtml"
return ""
def getNextStep(self, configurationAttributes, requestParameters, step):
return -1
def getLogoutExternalUrl(self, configurationAttributes, requestParameters):
print "Get external logout URL call"
return None
def logout(self, configurationAttributes, requestParameters):
return True
| 39.854167 | 167 | 0.673811 | 6,405 | 0.837036 | 0 | 0 | 0 | 0 | 0 | 0 | 1,622 | 0.211971 |
57a668358180b4bf197bc0f22a79ebe450b7df08 | 384 | py | Python | app/abbr/models.py | Tjorriemorrie/abbr | a4a3017a6694eacf6c11e95e76cec6d260750438 | [
"Apache-2.0"
] | null | null | null | app/abbr/models.py | Tjorriemorrie/abbr | a4a3017a6694eacf6c11e95e76cec6d260750438 | [
"Apache-2.0"
] | null | null | null | app/abbr/models.py | Tjorriemorrie/abbr | a4a3017a6694eacf6c11e95e76cec6d260750438 | [
"Apache-2.0"
] | null | null | null | from django.db import models
# classification value objects
CHOICES_CLASSIFICATION = [
(0, 'unrelated'),
(1, 'simple'),
(2, 'complex'),
(3, 'substring'),
]
class Abbreviation(models.Model):
long_form = models.TextField(blank=False)
abbreviation = models.CharField(max_length=100, blank=False)
classification = models.IntegerField(choices=CHOICES_CLASSIFICATION, null=True)
| 22.588235 | 80 | 0.75 | 219 | 0.570313 | 0 | 0 | 0 | 0 | 0 | 0 | 69 | 0.179688 |
57a71c30a72ab6617b2351c0866f4abcd021aacb | 1,709 | py | Python | example/sign up.py | Roblox-Thot/captchaCodeMakerV2 | 0d9e1a85b75e0c71f9c8b35d8330f704b1464685 | [
"Apache-2.0"
] | 7 | 2021-12-10T16:37:15.000Z | 2022-03-07T09:29:36.000Z | example/sign up.py | Roblox-Thot/captchaCodeMakerV2 | 0d9e1a85b75e0c71f9c8b35d8330f704b1464685 | [
"Apache-2.0"
] | null | null | null | example/sign up.py | Roblox-Thot/captchaCodeMakerV2 | 0d9e1a85b75e0c71f9c8b35d8330f704b1464685 | [
"Apache-2.0"
] | 9 | 2022-01-15T15:32:58.000Z | 2022-03-08T21:28:38.000Z | # This code could be improved but its just a example on how to use the code from the site
import requests, base64, random, string
token = input("Put code here:\n")
headers = {
'authority': 'auth.roblox.com',
'dnt': '1',
'x-csrf-token': requests.post("https://auth.roblox.com/v2/login").headers["x-csrf-token"],
'sec-ch-ua-mobile': '?0',
'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.82 Safari/537.36',
'content-type': 'application/json;charset=UTF-8',
'accept': 'application/json, text/plain, */*',
}
username = ''.join(random.choice(string.ascii_letters) for i in range(20))
tokens = base64.b64decode(token).decode('utf-8').split(',')
data = {
"username":username,
"password":username[::-1],
"birthday":"01 Oct 2003",
"gender":1,
"isTosAgreementBoxChecked":True,
"context":"MultiverseSignupForm",
"referralData":None,
"displayAvatarV2":False,
"displayContextV2":False,
"captchaId":tokens[0],
"captchaToken":tokens[1],
"captchaProvider":"PROVIDER_ARKOSE_LABS",
"agreementIds":["54d8a8f0-d9c8-4cf3-bd26-0cbf8af0bba3","848d8d8f-0e33-4176-bcd9-aa4e22ae7905"]
}
response = requests.post('https://auth.roblox.com/v2/signup', headers=headers, json=data)
# Debug
#print(response)
#print()
#print(response.text)
#print()
try:
cookie = response.cookies[".ROBLOSECURITY"]
print()
print(f'login: {username}:{username[::-1]}')
print(f'\nCookie:\n{cookie}')
try: #trys to copy the cookie if you have pyperclip installed
import pyperclip
pyperclip.copy(cookie)
except:
pass
except:
print("Failed to create")
pass
| 30.517857 | 135 | 0.664716 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,011 | 0.591574 |
57a76c0acd0cd0c7f74ee94b222ad2aad279c1a0 | 160 | py | Python | users/roles.py | Zimodra/yamdb_final | b6bb7e5b92a09604b441e9111bd52ecb459ffaba | [
"MIT"
] | null | null | null | users/roles.py | Zimodra/yamdb_final | b6bb7e5b92a09604b441e9111bd52ecb459ffaba | [
"MIT"
] | null | null | null | users/roles.py | Zimodra/yamdb_final | b6bb7e5b92a09604b441e9111bd52ecb459ffaba | [
"MIT"
] | null | null | null | from django.db import models
class Roles(models.TextChoices):
USER = 'user', 'User'
MODERATOR = 'moderator', 'Moderator'
ADMIN = 'admin', 'Admin'
| 20 | 40 | 0.65625 | 128 | 0.8 | 0 | 0 | 0 | 0 | 0 | 0 | 48 | 0.3 |
57a8299c7547a4ed17891ac37b6772a5f338d29e | 6,161 | py | Python | blyaml/validators.py | Brainlabs-Digital/Brainlabs-YAML-Generator | 6b22540cdbc29611dbe97facc71c51b0060528a9 | [
"MIT"
] | null | null | null | blyaml/validators.py | Brainlabs-Digital/Brainlabs-YAML-Generator | 6b22540cdbc29611dbe97facc71c51b0060528a9 | [
"MIT"
] | 8 | 2019-10-24T10:08:21.000Z | 2021-11-29T11:39:51.000Z | blyaml/validators.py | Brainlabs-Digital/Brainlabs-YAML-Generator | 6b22540cdbc29611dbe97facc71c51b0060528a9 | [
"MIT"
] | 3 | 2019-10-17T15:17:02.000Z | 2020-09-24T18:10:24.000Z | import re
from datetime import datetime
from PyInquirer import Validator, ValidationError
from prompt_toolkit.document import Document
# This file contains functions used for validation and Validator classes that use them.
# Validators are used by questions.
def non_empty(document: Document) -> bool:
if not document.text:
raise ValidationError(
message="Please enter a non-empty value.",
cursor_position=len(document.text),
)
return True
def valid_date(document: Document) -> bool:
try:
datetime.strptime(document.text, "%Y-%m-%d")
return True
except ValueError:
raise ValidationError(
message="Please enter a valid yyyy-mm-dd date.",
cursor_position=len(document.text),
)
email_regex = r"^(\w|\d|\.|\_|\-)+$"
def valid_email_prefix(document: Document) -> bool:
try:
assert re.match(email_regex, document.text)
return True
except AssertionError:
raise ValidationError(
message="Please enter a valid email prefix (e.g. james.f).",
cursor_position=len(document.text),
)
def valid_email_prefix_list(document: Document) -> bool:
try:
for prefix in document.text.split(","):
assert re.match(email_regex, prefix.strip())
return True
except AssertionError:
raise ValidationError(
message="Please enter a comma seperated list of valid email prefixes (e.g. james.f).",
cursor_position=len(document.text),
)
url_regex = (
r"^(?:http(s)?:\/\/)?[\w.-]+(?:\.[\w\.-]+)+[\w\-\._~:/?#[\]@!\$&'\(\)\*\+,;=.]+$"
)
def valid_url(document: Document) -> bool:
try:
assert re.match(url_regex, document.text.strip())
return True
except AssertionError:
raise ValidationError(
message="Please enter a valid url.", cursor_position=len(document.text)
)
def valid_url_list(document: Document) -> bool:
try:
for url in document.text.split(","):
assert re.match(url_regex, url.strip())
return True
except AssertionError:
raise ValidationError(
message="Please enter a comma seperated list of valid urls.",
cursor_position=len(document.text),
)
def valid_cron(document: Document) -> bool:
# Cron supports lots of advanced features such as ranges, so the regex is very long.
cron_regex = r"^(\*|([0-9]|0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])|\*\/([0-9]|0[0-9]|1[0-9]|2[0-9]|3[0-9]|4[0-9]|5[0-9])) (\*|([0-9]|0[0-9]|1[0-9]|2[0-3])|\*\/([0-9]|0[0-9]|1[0-9]|2[0-3])) (\*|([1-9]|0[0-9]|1[0-9]|2[0-9]|3[0-1])|\*\/([1-9]|0[0-9]|1[0-9]|2[0-9]|3[0-1])) (\*|([1-9]|0[0-9]|1[0-2])|\*\/([1-9]|0[0-9]|1[0-2])) (\*|([0-6])|\*\/([0-6]))$"
try:
if document.text.strip() != "null":
assert re.match(cron_regex, document.text.strip())
return True
except AssertionError:
raise ValidationError(
message="Please enter a valid cron or null.",
cursor_position=len(document.text),
)
def valid_directory(document: Document) -> bool:
directory_regex = r"^(/)?([^/\0]+(/)?)+$"
try:
assert re.match(directory_regex, document.text.strip())
return True
except AssertionError:
raise ValidationError(
message="Please enter a valid unix directory.",
cursor_position=len(document.text),
)
class ValidNonEmpty(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a non-empty value."""
return non_empty(document)
class ValidEmailPrefix(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a valid email prefix."""
return non_empty(document) and valid_email_prefix(document)
class ValidEmailPrefixList(Validator):
def validate(self, document: Document) -> bool:
return non_empty(document) and valid_email_prefix_list(document)
class ValidClientIds(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a syntaxtically valid client id list."""
# Checkboxes don't support validation yet.
# https://github.com/CITGuru/PyInquirer/issues/46
return True
class ValidDate(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a valid yyyy-mm-dd date."""
return non_empty(document) and valid_date(document)
class ValidOptionalUrl(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a syntaxtically valid url."""
return document.text == "" or valid_url(document)
class ValidUrl(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a syntaxtically valid url."""
return non_empty(document) and valid_url(document)
class ValidUrlList(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a syntaxtically valid url list."""
return non_empty(document) and valid_url_list(document)
class ValidOptionalUrlList(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a syntaxtically valid url list."""
return document.text == "" or valid_url_list(document)
class ValidCron(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a syntaxtically valid crontab style string."""
return non_empty(document) and valid_cron(document)
class ValidDirectory(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a syntaxtically valid unix path."""
return non_empty(document) and valid_directory(document)
class ValidOptionalDirectory(Validator):
def validate(self, document: Document) -> bool:
"""Return True with no errors for a syntaxtically valid unix path."""
return document.text == "" and valid_directory(document)
| 34.038674 | 356 | 0.637072 | 2,639 | 0.42834 | 0 | 0 | 0 | 0 | 0 | 0 | 1,871 | 0.303684 |
57a89bca360c730024572cf8e5039971a5a20578 | 7,113 | py | Python | src/git_profile_command/__init__.py | NiklasRosenstein/git-profile | 89696f2b6aee457a33674fdf930ba34e89f6239c | [
"MIT"
] | null | null | null | src/git_profile_command/__init__.py | NiklasRosenstein/git-profile | 89696f2b6aee457a33674fdf930ba34e89f6239c | [
"MIT"
] | 2 | 2019-07-15T11:29:47.000Z | 2021-11-26T04:01:14.000Z | src/git_profile_command/__init__.py | NiklasRosenstein/git-profile | 89696f2b6aee457a33674fdf930ba34e89f6239c | [
"MIT"
] | null | null | null | # The MIT License (MIT)
#
# Copyright (c) 2019 Niklas Rosenstein
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
"""
A command-line tool to switch between several Git profiles. Switching to a
profile will load configuration options from a Git configuration file and
write them to the current repository.
"""
import argparse
import base64
import configparser
import enum
import json
import os
import subprocess
import sys
import typing as t
from pathlib import Path
from shlex import quote
import nr.fs
from databind.core import datamodel, field
from databind.json import from_json, to_json
from ._vendor.gitconfigparser import GitConfigParser
__author__ = 'Niklas Rosenstein <rosensteinniklas@gmail.com>'
__version__ = '1.1.2'
def git(*args):
command = 'git ' + ' '.join(map(quote, args))
return subprocess.check_output(command, shell=True).decode().strip()
def find_git_dir():
directory = os.getcwd()
prev = None
while True:
path = os.path.join(directory, '.git')
if os.path.exists(path):
if os.path.isfile(path):
with open(path) as fp:
for line in fp:
if line.startswith('gitdir:'):
return line.replace('gitdir:', '').strip()
raise RuntimeError('unable to find gitdir in "{}"'.format(path))
return path
directory = os.path.dirname(directory)
if directory == prev:
return None
prev = directory
return os.path.join(directory, '.git')
@datamodel
class Change:
type: 'ChangeType'
section: str
key: t.Optional[str]
value: t.Optional[str]
class ChangeType(enum.Enum):
NEW = enum.auto()
SET = enum.auto()
DEL = enum.auto()
@datamodel
class Changeset:
changes: t.List[Change] = field(default_factory=list)
@classmethod
def from_b64(cls, data: bytes) -> 'Changeset':
return Changeset(from_json(t.List[Change], json.loads(base64.b64decode(data).decode('utf8'))))
def to_b64(self) -> bytes:
return base64.b64encode(json.dumps(to_json(self.changes, t.List[Change])).encode('utf8'))
def revert(self, config: configparser.RawConfigParser) -> None:
for change in reversed(self.changes):
if change.type == ChangeType.NEW:
if change.key is None:
config.remove_section(change.section)
else:
config.remove_option(change.section, change.key)
elif change.type == ChangeType.SET or change.type == ChangeType.DEL:
assert change.section and change.key and change.value, change
config.set(change.section, change.key, change.value)
else:
raise RuntimeError('unexpected Change.type: {!r}'.format(change))
def set(self, config: configparser.RawConfigParser, section: str, key: str, value: str) -> None:
if not config.has_section(section):
config.add_section(section)
self.changes.append(Change(ChangeType.NEW, section, None, None))
if not config.has_option(section, key):
self.changes.append(Change(ChangeType.NEW, section, key, None))
else:
self.changes.append(Change(ChangeType.SET, section, key, config.get(section, key)))
config.set(section, key, value)
class MergeReadConfig:
def __init__(self, configs):
self.configs = configs
def __getattr__(self, name):
return getattr(self.configs[0], name)
def get(self, section, option, **kwargs):
fallback = kwargs.pop('fallback', NotImplemented)
for cfg in self.configs:
try:
return cfg.get(section, option, **kwargs)
except configparser.NoOptionError:
pass
if fallback is not NotImplemented:
return fallback
raise configparser.NoOptionError((section, option))
def main(argv: t.Optional[t.List[str]] = None, prog: t.Optional[str] = None) -> int:
parser = argparse.ArgumentParser(prog=prog)
parser.add_argument('profile', nargs='?', help='The name of the profile to use.')
parser.add_argument('-d', '--diff', action='store_true', help='Print the config diff.')
args = parser.parse_args(argv)
global_config = GitConfigParser(os.path.expanduser('~/.gitconfig'))
profiles = set(x.split('.')[0] for x in global_config.sections() if '.' in x and ' ' not in x)
profiles.add('default')
git_dir = find_git_dir()
if not git_dir:
print('fatal: GIT_DIR not found', file=sys.stderr)
return 1
local_config_fn = os.path.join(git_dir, 'config')
assert os.path.isfile(local_config_fn), local_config_fn
local_config = GitConfigParser(local_config_fn, read_only=False)
current_profile = local_config.get_value('profile', 'current', 'default')
current_config_text = Path(local_config_fn).read_text()
if not args.profile:
for x in sorted(profiles, key=lambda x: x.lower()):
print('*' if x == current_profile else ' ', x)
return 0
else:
if args.profile not in profiles:
print('fatal: no such profile: "{}"'.format(args.profile), file=sys.stderr)
return 1
config = MergeReadConfig([local_config, global_config])
changeset: str = local_config.get_value('profile', 'changeset', '')
if changeset:
changes = Changeset.from_b64(changeset.encode('ascii'))
changes.revert(config) # type: ignore
if args.profile != 'default':
changes = Changeset()
for section in global_config.sections():
if section.startswith(args.profile + '.'):
key = section.split('.', 1)[1]
for opt in global_config.options(section):
changes.set(config, key, opt, global_config.get(section, opt)) # type: ignore
changes.set(local_config, 'profile', 'current', args.profile)
changes.set(local_config, 'profile', 'changeset', changes.to_b64().decode('ascii'))
local_config.write()
del local_config
if args.diff and Path(local_config_fn).read_text() != current_config_text:
with nr.fs.tempfile('_old', text=True) as a:
a.write(current_config_text)
a.close()
print()
subprocess.call(['git', 'diff', '--no-index', a.name, local_config_fn])
print()
print('Switched to profile "{}".'.format(args.profile))
return 0
if __name__ == '__main__':
sys.exit(main())
| 34.197115 | 98 | 0.696752 | 2,148 | 0.301982 | 0 | 0 | 1,567 | 0.220301 | 0 | 0 | 1,902 | 0.267398 |
57a8e223905afe0cac15558594f1c75596817567 | 15,208 | py | Python | src/test/rebaseline-p.py | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 226 | 2018-12-29T01:13:49.000Z | 2022-03-30T19:16:31.000Z | src/test/rebaseline-p.py | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 5,100 | 2019-01-14T18:19:25.000Z | 2022-03-31T23:08:36.000Z | src/test/rebaseline-p.py | visit-dav/vis | c08bc6e538ecd7d30ddc6399ec3022b9e062127e | [
"BSD-3-Clause"
] | 84 | 2019-01-24T17:41:50.000Z | 2022-03-10T10:01:46.000Z | import filecmp
import os
import sys
import shutil
import subprocess
import time
import unittest
if (sys.version_info > (3, 0)):
import urllib.request, urllib.parse, urllib.error
else:
import urllib
from optparse import OptionParser
from PyQt4 import QtCore,QtGui
parser = OptionParser()
parser.add_option("-r", "--root", dest="web_root",
default="http://portal.nersc.gov/project/visit/",
help="Root of web URL where baselines are")
parser.add_option("-d", "--date", dest="web_date",
help="Date of last good run, in YYMonDD form")
parser.add_option("-m", "--mode", dest="mode",
help="Mode to run in: serial, parallel, sr")
parser.add_option("-w", "--web-url", dest="web_url",
help="Manual URL specification; normally generated "
"automatically based on (-r, -d, -m)")
parser.add_option("-g", "--git", dest="git", action="store_true",
help="Use git to ignore images with local modifications")
parser.add_option("-s", "--svn", dest="svn", action="store_true",
help="Use svn to ignore images with local modifications")
(options, args) = parser.parse_args()
if options.web_url is not None:
uri = options.web_url
else:
uri = options.web_root + options.web_date + "/"
mode = ""
if options.mode == "sr" or options.mode == "scalable,parallel" or \
options.mode == "scalable_parallel":
mode="davinci_scalable_parallel_icet"
else:
mode="".join([ s for s in ("davinci_", options.mode) ])
uri += mode + "/"
parser.destroy()
print("uri:", uri)
class MW(QtGui.QMainWindow):
def __init__(self, parent=None):
QtGui.QMainWindow.__init__(self, parent)
def real_dirname(path):
"""Python's os.path.dirname is not dirname."""
return path.rsplit('/', 1)[0]
def real_basename(path):
"""Python's os.path.basename is not basename."""
if path.rsplit('/', 1)[1] is '': return None
return path.rsplit('/', 1)[1]
def baseline_current(serial_baseline):
"""Given the path to the serial baseline image, determine if there is a mode
specific baseline. Return a 2-tuple of the baseline image and the path to
the 'current' image."""
dname = real_dirname(serial_baseline)
bname = real_basename(serial_baseline)
baseline = serial_baseline
if options.mode is not None:
# Check for a mode specific baseline.
mode_spec = os.path.join(dname + "/", options.mode + "/", bname)
if os.path.exists(mode_spec):
baseline = mode_spec
# `Current' image never has a mode-specific path; filename/dir is always
# based on the serial baseline's directory.
no_baseline = serial_baseline.split('/', 1) # path without "baseline/"
current = os.path.join("current/", no_baseline[1])
return (baseline, current)
def mode_specific(baseline):
"""Given a baseline image path, return a path to the mode specific baseline,
even if said baseline does not exist (yet)."""
if options.mode is None or options.mode == "serial":
return baseline
dname = real_dirname(baseline)
bname = real_basename(baseline)
if options.mode == "parallel":
if baseline.find("/parallel") != -1:
# It's already got parallel in the path; this IS a mode specific
# baseline.
return baseline
return os.path.join(dname, options.mode, bname)
if options.mode.find("scalable") != -1:
if baseline.find("scalable_parallel") != -1:
# Already is mode-specific.
return baseline
return os.path.join(dname, "scalable_parallel", bname)
# Ruh roh. options.mode must be garbage.
raise NotImplementedError("Unknown mode '%s'" % options.mode)
def local_modifications_git(file):
vcs_diff = subprocess.call(["git", "diff", "--quiet", file])
if vcs_diff == 1:
return True
return False
def local_modifications_svn(file):
svnstat = subprocess.Popen("svn stat %s" % file, shell=True,
stdout=subprocess.PIPE)
diff = svnstat.communicate()[0]
if diff != '':
return True
return False
def local_modifications(filepath):
"""Returns true if the file has local modifications. Always false if the
user did not supply the appropriate VCS option."""
if options.git: return local_modifications_git(filepath)
if options.svn: return local_modifications_svn(filepath)
return False
def equivalent(baseline, image):
"""True if the files are the same."""
if not os.path.exists(image): return False
# Note this is `shallow' by default, but that's fine for our usage.
return filecmp.cmp(baseline, image)
def trivial_pass(baseline, image):
"""True if we can determine that this image is OK without querying the
network."""
return equivalent(baseline, image) or local_modifications(baseline)
class RebaselinePTests(unittest.TestCase):
def test_dirname(self):
input_and_results = [
("baseline/category/test/a.png", "baseline/category/test"),
("b/c/t/q.png", "b/c/t"),
("b/c/t/longfn.png", "b/c/t"),
("b/c/t/", "b/c/t")
]
for tst in input_and_results:
self.assertEqual(real_dirname(tst[0]), tst[1])
def test_basename(self):
input_and_results = [
("baseline/category/test/a.png", "a.png"),
("b/c/t/q.png", "q.png"),
("b/c/t/longfn.png", "longfn.png"),
("b/c/t/", None)
]
for tst in input_and_results:
self.assertEqual(real_basename(tst[0]), tst[1])
class Image(QtGui.QWidget):
def __init__(self, path, parent=None):
self._filename = path
self._parent = parent
self._display = QtGui.QLabel(self._parent)
self._load()
def _load(self):
pixmap = QtGui.QPixmap(300,300)
pixmap.load(self._filename)
self._display.resize(pixmap.size())
self._display.setPixmap(pixmap)
def widget(self): return self._display
def width(self): return self._display.width()
def height(self): return self._display.height()
def update(self, path):
self._filename = path
self._load()
class Layout(QtGui.QWidget):
def __init__(self, parent=None):
QtGui.QWidget.__init__(self, parent)
self._mainwin = parent
self._mainwin.statusBar().insertPermanentWidget(0,QtGui.QLabel())
self.status("Initializing...")
quit = QtGui.QPushButton('Quit', self)
quit.setMaximumWidth(80)
if parent is None: parent = self
parent.connect(quit, QtCore.SIGNAL('clicked()'), QtGui.qApp,
QtCore.SLOT('quit()'))
parent.connect(self, QtCore.SIGNAL('closeApp()'), self._die)
self._init_signals()
self._bugs = [] # list which keeps track of which images we think are bugs.
# guess an initial size; we don't know a real size until we've downloaded
# images.
self.resize_this_and_mainwin(600, 600)
self.setFocusPolicy(QtCore.Qt.StrongFocus)
self.setFocus()
self._baseline = None
self._current = None
self._diff = None
self._images = [None, None, None]
self._next_set_of_images()
self._images[0] = Image(self._baseline, self)
self._images[1] = Image(self._current, self)
self._images[2] = Image(self._diff, self)
grid = QtGui.QGridLayout()
label_baseline = QtGui.QLabel(grid.widget())
label_current = QtGui.QLabel(grid.widget())
label_diff = QtGui.QLabel(grid.widget())
label_baseline.setText("Baseline image:")
label_current.setText("Davinci's current:")
label_diff.setText("difference between them:")
label_baseline.setMaximumSize(QtCore.QSize(160,35))
label_current.setMaximumSize(QtCore.QSize(160,35))
label_diff.setMaximumSize(QtCore.QSize(200,35))
label_directions = QtGui.QLabel(grid.widget())
label_directions.setText("Keyboard shorcuts:\n\n"
"y: yes, rebaseline\n"
"n: no, current image is wrong\n"
"u: unknown, I can't/don't want to decide now\n"
"q: quit")
label_directions.setMaximumSize(QtCore.QSize(300,300))
grid.addWidget(label_baseline, 0,0)
grid.addWidget(label_current, 0,1)
grid.addWidget(self._images[0].widget(), 1,0)
grid.addWidget(self._images[1].widget(), 1,1)
grid.addWidget(label_diff, 2,0)
grid.addWidget(quit, 2,1)
grid.addWidget(self._images[2].widget(), 3,0)
grid.addWidget(label_directions, 3,1)
rows = (
(0, (label_baseline, label_current)),
(1, (self._images[0], self._images[1])),
(2, (label_diff, quit)),
(3, (self._images[2], label_directions))
)
cols = (
(0, (label_baseline, self._images[0], label_diff, self._images[2])),
(1, (label_current, self._images[1], quit, label_directions))
)
for r in rows:
grid.setRowMinimumHeight(r[0], max([x.height() for x in r[1]]))
for c in cols:
grid.setColumnMinimumWidth(c[0], max([x.height() for x in c[1]]))
self.setLayout(grid)
self.resize_this_and_mainwin(self.calc_width(), self.calc_height())
self.show()
self.setFocus()
def resize_this_and_mainwin(self, w, h):
self.resize(w,h)
# make sure it can't shrink too much
self._mainwin.setMinimumWidth(w)
self._mainwin.setMinimumHeight(h+30) # +30: for the status bar
# try not to resize the mainwin if we don't need to; it's annoying.
cur_w = self._mainwin.width()
cur_h = self._mainwin.height()
self._mainwin.resize(max(w,cur_w), max(h,cur_h))
self._mainwin.update()
def _die(self):
print("You thought these test results were bugs:")
for f in self._bugs:
print("\t", f)
self._mainwin.close()
def calc_width(self):
w = 0
for col in range(0,self.layout().columnCount()):
w += self.layout().columnMinimumWidth(col)
return w
def calc_height(self):
h = 0
for row in range(0,self.layout().rowCount()):
h += self.layout().rowMinimumHeight(row)
return h
def _update_images(self):
self._images[0].update(self._baseline)
self._images[1].update(self._current)
self._images[2].update(self._diff)
self.resize_this_and_mainwin(self.calc_width(), self.calc_height())
self.update()
def _rebaseline(self):
self.status("".join(["rebaselining ", self._current, "..."]))
baseline = mode_specific(self._baseline)
print("moving", self._current, "on top of", baseline)
# We might be creating the first mode specific baseline for that test. If
# so, it'll be missing the baseline specific dir.
if not os.path.exists(real_dirname(baseline)):
print(real_dirname(baseline), "does not exist, creating...")
os.mkdir(real_dirname(baseline))
shutil.move(self._current, baseline) # do the rebaseline!
self._next_set_of_images()
self._update_images()
def _ignore(self):
self.status("".join(["ignoring ", self._baseline, "..."]))
self._bugs.append(self._baseline)
self._next_set_of_images()
self._update_images()
def _unknown(self):
self.status("".join(["unknown ", self._baseline, "..."]))
self._next_set_of_images()
self._update_images()
def status(self, msg):
self._mainwin.statusBar().showMessage(msg)
self._mainwin.statusBar().update()
QtCore.QCoreApplication.processEvents() # we're single threaded
def _next_set_of_images(self):
"""Figures out the next set of images to display. Downloads 'current' and
'diff' results from davinci. Sets filenames corresponding to baseline,
current and diff images."""
if self._baseline is None: # first call, build list.
self._imagelist = []
print("Building initial file list... please wait.")
self.status("Building initial file list... please wait.")
for root, dirs, files in os.walk("baseline"):
for f in files:
fn, ext = os.path.splitext(f)
if ext == ".png":
# In some cases, we can trivially reject a file. Don't bother
# adding it to our list in that case.
serial_baseline_fn = os.path.join(root, f)
# Does this path contain "parallel" or "scalable_parallel"? Then
# we've got a mode specific baseline. We'll handle those based on
# the serial filenames, so ignore them for now.
if serial_baseline_fn.find("parallel") != -1: continue
baseline_fn, current_fn = baseline_current(serial_baseline_fn)
assert os.path.exists(baseline_fn)
if not trivial_pass(baseline_fn, current_fn):
self._imagelist.append(baseline_fn)
try:
while len(self._imagelist) > 0:
self._baseline = self._imagelist.pop()
# now derive other filenames based on that one.
filename = None
# os.path.split fails if there's no /
try:
filename = os.path.split(self._baseline)
filename = filename[1]
except AttributeError as e:
self.status("No slash!")
break
current_url = uri + "/c_" + filename
if (sys.version_info > (3, 0)):
f,info = urllib.request.urlretrieve(current_url, "local_current.png")
else:
f,info = urllib.urlretrieve(current_url, "local_current.png")
self.status("".join(["Checking ", current_url, "..."]))
if info.getheader("Content-Type").startswith("text/html"):
# then it's a 404 or other error; skip this image.
continue
else:
# We found the next image.
self._current = "local_current.png"
diff_url = uri + "/d_" + filename
if (sys.version_info > (3, 0)):
f,info = urllib.request.urlretrieve(diff_url, "local_diff.png")
else:
f,info = urllib.urlretrieve(diff_url, "local_diff.png")
if info.getheader("Content-Type").startswith("text/html"):
raise Exception("Could not download diff image.")
self._diff = "local_diff.png"
self.status("Waiting for input on " + filename)
break
except KeyError as e:
print(e)
print("No more images!")
self.emit(QtCore.SIGNAL('closeApp()'))
def _init_signals(self):
self.connect(self, QtCore.SIGNAL('rebaseline()'), self._rebaseline)
self.connect(self, QtCore.SIGNAL('ignore()'), self._ignore)
self.connect(self, QtCore.SIGNAL('unknown()'), self._unknown)
def keyPressEvent(self, event):
if event.key() == QtCore.Qt.Key_Q:
self.emit(QtCore.SIGNAL('closeApp()'))
if event.key() == QtCore.Qt.Key_Y:
self.emit(QtCore.SIGNAL('rebaseline()'))
if event.key() == QtCore.Qt.Key_N:
self.emit(QtCore.SIGNAL('ignore()'))
if event.key() == QtCore.Qt.Key_U:
self.emit(QtCore.SIGNAL('unknown()'))
QtCore.QCoreApplication.processEvents()
if __name__ == '__main__':
suite = unittest.TestLoader().loadTestsFromTestCase(RebaselinePTests)
results = unittest.TextTestRunner(verbosity=2).run(suite)
if not results.wasSuccessful():
print("Tests failed, bailing.")
sys.exit(1)
app = QtGui.QApplication(sys.argv)
mw = MW()
mw.show()
mw.setWindowTitle("visit rebaseline -p")
layout = Layout(mw)
layout.show()
sys.exit(app.exec_())
| 35.783529 | 81 | 0.647554 | 10,122 | 0.665571 | 0 | 0 | 0 | 0 | 0 | 0 | 4,020 | 0.264335 |
57a8e82c5a3eff8f6921f918c1e1cb15a9856eea | 2,174 | py | Python | src/pigs/bot.py | rcobanov/Examination2 | 15540554e1c9020320607a79cdf33c17045bd947 | [
"MIT"
] | null | null | null | src/pigs/bot.py | rcobanov/Examination2 | 15540554e1c9020320607a79cdf33c17045bd947 | [
"MIT"
] | null | null | null | src/pigs/bot.py | rcobanov/Examination2 | 15540554e1c9020320607a79cdf33c17045bd947 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Here is the class that controls the bot.
It also contains various value manipulation,
and one function that lets the bot play one round, from first roll until hold.
The intelligence is basically how many rolls the bot is going to do on one
round. The easier level on the bot rolls so many times that its statistically
is going to roll a one, the hardest level rolls lesser times to
statistically hold before they’re rolling a one.
"""
class Bot():
"""Bot class."""
def __init__(self, curr_round_score, total_score, level):
"""Initiate a bot object."""
self.curr_round_score = curr_round_score
self.total_score = total_score
self.level = level
self.is_holding = True
def get_number_of_rounds(self, bot_level):
"""Get how many rounds bot should run based on level."""
rounds_to_run = 0
if bot_level == 1:
rounds_to_run = 14
elif bot_level == 2:
rounds_to_run = 9
elif bot_level == 3:
rounds_to_run = 5
return rounds_to_run
def add_curr_to_total(self):
"""Add current score to total."""
self.total_score += self.curr_round_score
def reset_current_score(self):
"""Reset current score to zero."""
self.curr_round_score = 0
def bot_round(self, die):
"""One round for the bot."""
rounds_to_run = self.get_number_of_rounds(int(self.level))
for x in range(rounds_to_run):
self.curr_round_score += die.roll()
print(f"The bot dice shows {die.this_roll}")
if die.this_roll == 1:
self.reset_current_score()
self.is_holding = True
print("The bot rolled a 1!!")
print("--------------------")
break
self.add_curr_to_total()
self.reset_current_score()
print(f"Current bot round score {self.curr_round_score}")
print(f"Total bot score {self.total_score}")
def reset_scores(self):
"""Reset bot scores."""
self.curr_round_score = 0
self.total_score = 0
| 32.939394 | 78 | 0.614995 | 1,684 | 0.773897 | 0 | 0 | 0 | 0 | 0 | 0 | 871 | 0.400276 |
57a918303b705c991a3420d0d04d3d2d8b68608b | 2,068 | py | Python | enochecker3/logging.py | Sinitax/enochecker3 | 2c43177aa66e04ff6e9cde96354bd373fb81d743 | [
"MIT"
] | null | null | null | enochecker3/logging.py | Sinitax/enochecker3 | 2c43177aa66e04ff6e9cde96354bd373fb81d743 | [
"MIT"
] | 6 | 2021-07-02T09:57:38.000Z | 2021-07-23T12:42:07.000Z | enochecker3/logging.py | Sinitax/enochecker3 | 2c43177aa66e04ff6e9cde96354bd373fb81d743 | [
"MIT"
] | 1 | 2021-07-01T16:16:29.000Z | 2021-07-01T16:16:29.000Z | import datetime
import logging
from typing import Optional
from .types import CheckerTaskMessage, EnoLogMessage
LOGGING_PREFIX = "##ENOLOGMESSAGE "
class ELKFormatter(logging.Formatter):
def format(self, record: logging.LogRecord) -> str:
if type(record.args) is tuple and len(record.args) > 0:
record.msg = record.msg % record.args
return LOGGING_PREFIX + self.create_message(record).json(by_alias=True)
def to_level(self, levelname: str) -> int:
if levelname == "CRITICAL":
return 4
if levelname == "ERROR":
return 3
if levelname == "WARNING":
return 2
if levelname == "INFO":
return 1
if levelname == "DEBUG":
return 0
return 0
def create_message(self, record: logging.LogRecord) -> EnoLogMessage:
checker_task: Optional[CheckerTaskMessage] = getattr(
record, "checker_task", None
)
checker_name: Optional[str] = getattr(record, "checker_name", None)
return EnoLogMessage(
tool="enochecker3",
type="infrastructure",
severity=record.levelname,
severity_level=self.to_level(record.levelname),
timestamp=datetime.datetime.utcnow().strftime("%Y-%m-%dT%H:%M:%S.%fZ"),
message=record.msg,
module=record.module,
function=record.funcName,
service_name=checker_name,
task_id=getattr(checker_task, "task_id", None),
method=getattr(checker_task, "method", None),
team_id=getattr(checker_task, "team_id", None),
team_name=getattr(checker_task, "team_name", None),
current_round_id=getattr(checker_task, "current_round_id", None),
related_round_id=getattr(checker_task, "related_round_id", None),
flag=getattr(checker_task, "flag", None),
variant_id=getattr(checker_task, "variant_id", None),
task_chain_id=getattr(checker_task, "task_chain_id", None),
)
| 37.6 | 83 | 0.619439 | 1,915 | 0.926015 | 0 | 0 | 0 | 0 | 0 | 0 | 243 | 0.117505 |
57a95284d7934e75842077f077664e4ddceff207 | 3,191 | py | Python | examples/experimental/scala-parallel-recommendation-entitymap/data/import_eventserver.py | pferrel/incubator-predictionio | 4b2fb7c1b6a1cd1027a4c03e6ae1af223c8e634c | [
"Apache-2.0"
] | 2 | 2017-03-10T03:03:14.000Z | 2017-07-03T02:38:42.000Z | examples/experimental/scala-parallel-recommendation-entitymap/data/import_eventserver.py | michaelzzh/LF_PredictionIO | 98bfd4d75efaab7633697f12e31e791660dbd61a | [
"Apache-2.0"
] | null | null | null | examples/experimental/scala-parallel-recommendation-entitymap/data/import_eventserver.py | michaelzzh/LF_PredictionIO | 98bfd4d75efaab7633697f12e31e791660dbd61a | [
"Apache-2.0"
] | null | null | null | #
# 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.
#
"""
Import sample data for recommendation engine
"""
import predictionio
import argparse
import random
SEED = 3
def import_events(client):
random.seed(SEED)
count = 0
print "Importing data..."
# generate 10 users, with user uid1,2,....,10
# with some random attributes
user_ids = [ ("uid"+str(i)) for i in range(1, 11)]
for user_id in user_ids:
print "Set user", user_id
client.create_event(
event="$set",
entity_type="user",
entity_id=user_id,
properties={
"attr0" : float(random.randint(0, 4)),
"attr1" : random.randint(10, 14),
"attr2" : random.randint(20, 24)
}
)
count += 1
# generate 50 items, with iid1,2,....,50
# with some randome attributes
item_ids = [ ("iid"+str(i)) for i in range(1, 51)]
for item_id in item_ids:
print "Set item", item_id
client.create_event(
event="$set",
entity_type="item",
entity_id=item_id,
properties={
"attrA" : random.choice(["something1", "something2", "valueX"]),
"attrB" : random.randint(10, 30),
"attrC" : random.choice([True, False])
}
)
count += 1
# each user randomly rate or buy 10 items
for user_id in user_ids:
for viewed_item in random.sample(item_ids, 10):
if (random.randint(0, 1) == 1):
print "User", user_id ,"rates item", viewed_item
client.create_event(
event="rate",
entity_type="user",
entity_id=user_id,
target_entity_type="item",
target_entity_id=item_id,
properties= { "rating" : float(random.randint(1, 6)) }
)
else:
print "User", user_id ,"buys item", viewed_item
client.create_event(
event="buy",
entity_type="user",
entity_id=user_id,
target_entity_type="item",
target_entity_id=item_id
)
count += 1
print "%s events are imported." % count
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description="Import sample data for recommendation engine")
parser.add_argument('--access_key', default='invald_access_key')
parser.add_argument('--url', default="http://localhost:7070")
args = parser.parse_args()
print args
client = predictionio.EventClient(
access_key=args.access_key,
url=args.url,
threads=5,
qsize=500)
import_events(client)
| 29.546296 | 74 | 0.651833 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,374 | 0.430586 |
57a9b2141377677285fd56333b0647b258ef25b3 | 1,240 | py | Python | lib/ReadCsv.py | cxd/wave_weather_data_python | 3b50137f6f8b185dd5f5672feb9645e179bc1490 | [
"MIT"
] | null | null | null | lib/ReadCsv.py | cxd/wave_weather_data_python | 3b50137f6f8b185dd5f5672feb9645e179bc1490 | [
"MIT"
] | null | null | null | lib/ReadCsv.py | cxd/wave_weather_data_python | 3b50137f6f8b185dd5f5672feb9645e179bc1490 | [
"MIT"
] | null | null | null | import os as os
from pandas import pandas as p
from pandas.compat import StringIO, BytesIO
class ReadCsv:
def __init__(self, base_dir):
self.base_dir = base_dir
@staticmethod
def all_files(base_path):
all_files = []
for file in os.scandir(base_path):
if file.is_file():
all_files.append(file.name)
return all_files
def read_csv(self, file_path, skip_lines=0, colnames=[]):
if colnames.__len__() > 0:
temp = p.read_csv(file_path, skiprows=skip_lines, header=None, names=colnames)
else:
temp = p.read_csv(file_path, skiprows=skip_lines)
return temp
def process_directory(self, path="", skip_lines=0, colnames=[]):
base_path = self.base_dir
if path != "":
base_path = os.path.join(base_path, path)
files = ReadCsv.all_files(base_path)
data = None
all_paths = map(lambda file: os.path.join(base_path, file), files)
for file_path in all_paths:
temp = self.read_csv(file_path, skip_lines, colnames)
if data is None:
data = temp
else:
data = p.concat([data, temp])
return data
| 31 | 90 | 0.596774 | 1,146 | 0.924194 | 0 | 0 | 209 | 0.168548 | 0 | 0 | 4 | 0.003226 |
57aa9b57ce3b4678b56fb8cf872403039e20b2b9 | 1,364 | py | Python | 01.py | dataquanty/ArtWorkWaves | 0cc5c47bf4a0c9669a0721c313d96beb046c3134 | [
"MIT"
] | null | null | null | 01.py | dataquanty/ArtWorkWaves | 0cc5c47bf4a0c9669a0721c313d96beb046c3134 | [
"MIT"
] | null | null | null | 01.py | dataquanty/ArtWorkWaves | 0cc5c47bf4a0c9669a0721c313d96beb046c3134 | [
"MIT"
] | null | null | null | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Apr 30 15:28:09 2018
@author: dataquanty
"""
import numpy as np
from math import sqrt, pi, acos,cos
from matplotlib import pyplot as plt
from scipy.misc import imsave
from bisect import bisect_left
h , w = 1000, 1000
img = np.ones((h,w))
center = (500,500)
r = [20,80,200,300,400,500,600]
r = np.exp(range(1,8)).astype(int)
lagval = [0,pi,0,pi,0,pi,0]
maxd = 810
r = range(10,maxd,20)
lagval = [0,pi]*int(len(r)/2)
lagval = np.random.rand(len(r))*pi
lagval = [-pi/4,pi/3]*int(len(r)/2)
lagval = [0,0.05]*int(len(r)/2)
def dist(a,b):
return sqrt((a[0]-b[0])**2+(a[1]-b[1])**2)
for i in range(h):
for j in range(w):
if (i,j) == center:
img[i][j]=0
else:
d = dist((i,j),center)
k = bisect_left(list(r),d)
#dist((i,j),center)<= r1:
val = (j-center[1])/d
img[i][j] = cos(acos(val)-lagval[k])
"""
angle = acos((j-center[1])/dist((i,j),center))
if i > center[0]:
angle = 2*pi - angle
val = ((angle - lagrad)%(2*pi))/2*pi
img[i][j] = val
"""
#imsave('figLag_pi_s2.png',img)
plt.figure(figsize=(10,10))
plt.imshow(img,cmap='gray')
#interpolation='nearest'
plt.show() | 21.650794 | 58 | 0.519062 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 417 | 0.305718 |
57adf597c9133c7c09f33507918c2763c2027900 | 1,083 | py | Python | docs/conf.py | jrosser/mitogen | 898c06f1b9f1417b9f7c18465bee78eda7df2ec0 | [
"BSD-3-Clause"
] | null | null | null | docs/conf.py | jrosser/mitogen | 898c06f1b9f1417b9f7c18465bee78eda7df2ec0 | [
"BSD-3-Clause"
] | null | null | null | docs/conf.py | jrosser/mitogen | 898c06f1b9f1417b9f7c18465bee78eda7df2ec0 | [
"BSD-3-Clause"
] | null | null | null | import os
import sys
sys.path.append('..')
import mitogen
VERSION = '%s.%s.%s' % mitogen.__version__
author = u'David Wilson'
copyright = u'2018, David Wilson'
exclude_patterns = ['_build']
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.intersphinx', 'sphinxcontrib.programoutput']
html_show_sourcelink = False
html_show_sphinx = False
html_sidebars = {'**': ['globaltoc.html', 'github.html']}
html_static_path = ['_static']
html_theme = 'alabaster'
html_theme_options = {
'font_family': "Georgia, serif",
'head_font_family': "Georgia, serif",
}
htmlhelp_basename = 'mitogendoc'
intersphinx_mapping = {'python': ('https://docs.python.org/2', None)}
language = None
master_doc = 'toc'
project = u'Mitogen'
pygments_style = 'sphinx'
release = VERSION
source_suffix = '.rst'
templates_path = ['_templates']
todo_include_todos = False
version = VERSION
rst_epilog = """
.. |mitogen_version| replace:: %(VERSION)s
.. |mitogen_url| replace:: `mitogen-%(VERSION)s.tar.gz <https://files.pythonhosted.org/packages/source/m/mitogen/mitogen-%(VERSION)s.tar.gz>`__
""" % locals()
| 27.075 | 143 | 0.720222 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 532 | 0.491228 |
57af48c7c6ce730f18de8225a93c02bfa45f922d | 1,741 | py | Python | src/pkg/caendr/caendr/models/sql/wormbase_gene_summary.py | AndersenLab/CAENDR | ce4cdb74db736db8226ffc90988959b71b0d5ff5 | [
"MIT"
] | 3 | 2022-02-09T07:04:37.000Z | 2022-03-11T02:46:35.000Z | src/pkg/caendr/caendr/models/sql/wormbase_gene_summary.py | AndersenLab/CAENDR | ce4cdb74db736db8226ffc90988959b71b0d5ff5 | [
"MIT"
] | 4 | 2022-01-28T22:28:08.000Z | 2022-02-11T21:47:15.000Z | src/pkg/caendr/caendr/models/sql/wormbase_gene_summary.py | AndersenLab/CAENDR | ce4cdb74db736db8226ffc90988959b71b0d5ff5 | [
"MIT"
] | 1 | 2022-01-11T03:39:02.000Z | 2022-01-11T03:39:02.000Z | from caendr.services.cloud.postgresql import db
from caendr.models.sql.dict_serializable import DictSerializable
from sqlalchemy import func, or_
from sqlalchemy.ext.hybrid import hybrid_property
class WormbaseGeneSummary(DictSerializable, db.Model):
"""
This is a condensed version of the WormbaseGene model;
It is constructed out of convenience and only defines the genes
(not exons/introns/etc.)
"""
id = db.Column(db.Integer, primary_key=True)
chrom = db.Column(db.String(7), index=True)
chrom_num = db.Column(db.Integer(), index=True)
start = db.Column(db.Integer(), index=True)
end = db.Column(db.Integer(), index=True)
locus = db.Column(db.String(30), index=True)
gene_id = db.Column(db.String(25), unique=True, index=True)
gene_id_type = db.Column(db.String(15), index=False)
sequence_name = db.Column(db.String(30), index=True)
biotype = db.Column(db.String(30), nullable=True)
gene_symbol = db.column_property(func.coalesce(locus, sequence_name, gene_id))
# interval = db.column_property(func.format("%s:%s-%s", chrom, start, end))
arm_or_center = db.Column(db.String(12), index=True)
__tablename__ = "wormbase_gene_summary"
__gene_id_constraint__ = db.UniqueConstraint(gene_id)
@hybrid_property
def interval(self):
return f"{self.chrom}:{self.start}-{self.end}"
# TODO: move this somewhere else
@classmethod
def resolve_gene_id(cls, query):
"""
query - a locus name or transcript ID
output - a wormbase gene ID
Example:
WormbaseGene.resolve_gene_id('pot-2') --> WBGene00010195
"""
result = cls.query.filter(or_(cls.locus == query, cls.sequence_name == query)).first()
if result:
return result.gene_id
| 37.847826 | 90 | 0.711086 | 1,543 | 0.886272 | 0 | 0 | 451 | 0.259047 | 0 | 0 | 516 | 0.296381 |
57b0f06734d5293b4bc104ab02dc176064141a7e | 4,137 | py | Python | gunmel/models.py | zhenkai/xgunicorn | 33fc122fdc9435ba0b6562186d3c86d983eb992a | [
"Apache-2.0"
] | null | null | null | gunmel/models.py | zhenkai/xgunicorn | 33fc122fdc9435ba0b6562186d3c86d983eb992a | [
"Apache-2.0"
] | null | null | null | gunmel/models.py | zhenkai/xgunicorn | 33fc122fdc9435ba0b6562186d3c86d983eb992a | [
"Apache-2.0"
] | 1 | 2020-03-03T04:04:56.000Z | 2020-03-03T04:04:56.000Z | from django.core.exceptions import ValidationError
from django.db import models
from django.forms.models import model_to_dict
from decimal import Decimal
# Create your models here.
class ProductManager(models.Manager):
def top_drops(self, n):
return self.get_queryset().order_by('-price_drop')[:n]
def top_clicks(self, n):
return self.get_queryset().annotate(clicks=models.Count('clicklog')).order_by('-clicks')[:n]
class Product(models.Model):
pid = models.IntegerField(primary_key=True, verbose_name="Product ID") # generated using murmur3 on url
url = models.URLField(max_length=2000, verbose_name="Product URL")
img = models.URLField(max_length=2000, verbose_name="Product Image")
headline = models.CharField(max_length=256)
vendor = models.CharField(max_length=128)
price = models.DecimalField(max_digits=9, decimal_places=2, verbose_name="Product Price")
price_drop = models.IntegerField(verbose_name="Product Price Drop Percentage",
db_index=True, default=0)
oos = models.BooleanField(default=False, verbose_name="Product Out of Stock")
last_modified = models.DateTimeField(verbose_name="Last modified time")
objects = ProductManager()
def clean(self):
if self.price < 0.0:
raise ValidationError('Price cannot be negative')
if self.price_drop < 0 or self.price_drop > 100:
raise ValidationError('Price drop out of range of 0-100%')
def __str__(self):
return self.headline
# only save if price changes
def save(self, **kwargs):
if Product.objects.filter(pid=self.pid).exists():
current = Product.objects.get(pid=self.pid)
dict_new = model_to_dict(self)
dict_current = model_to_dict(current)
diff = filter(lambda (k, v): v != dict_new[k] and k != 'last_modified' and k != 'price', dict_current.items())
new_price = Decimal("%.2f" % self.price)
self.price = new_price
if current.price != new_price:
if current.price > new_price:
self.price_drop = int((current.price - new_price) / current.price * 100)
else:
self.price_drop = 0
diff.append('price')
if len(diff) > 0:
self.clean()
super(Product, self).save(**kwargs)
else:
self.price = Decimal("%.2f" % self.price)
self.clean()
super(Product, self).save(**kwargs)
class Meta:
verbose_name = "Product"
class PriceHistoryManager(models.Manager):
def price_history(self, product):
return self.get_queryset().filter(product__pid=product.pid).order_by('timestamp')
def min(self, product):
min_price = self.get_queryset().filter(product__pid=product.pid).aggregate(min_price=models.Min('price'))['min_price']
return self.get_queryset().filter(product__pid=product.pid).filter(price=min_price).order_by('-timestamp')[0]
def max(self, product):
max_price = self.get_queryset().filter(product__pid=product.pid).aggregate(max_price=models.Max('price'))['max_price']
return self.get_queryset().filter(product__pid=product.pid).filter(price=max_price).order_by('-timestamp')[0]
def last_n(self, product, n):
return self.get_queryset().filter(product__pid=product.pid).order_by('-timestamp')[:n]
class PriceHistory(models.Model):
product = models.ForeignKey(Product)
price = models.DecimalField(max_digits=9, decimal_places=2, verbose_name="Product Price")
timestamp = models.DateTimeField()
objects = PriceHistoryManager()
class Meta:
verbose_name = "Price History"
class ClickLogManager(models.Manager):
def expired(self, cutoff_time):
return self.get_queryset().filter(timestamp__lt = cutoff_time)
class ClickLog(models.Model):
product = models.ForeignKey(Product, db_index=False)
timestamp = models.DateTimeField()
objects = ClickLogManager()
class Meta:
verbose_name = "Price Check Log"
| 36.9375 | 126 | 0.664491 | 3,937 | 0.951656 | 0 | 0 | 0 | 0 | 0 | 0 | 487 | 0.117718 |
57b46ec2e0dade46c77d1fce41a387fa6b810a5f | 1,890 | py | Python | xos/api/utility/toscaapi.py | iecedge/xos | 566617f676fedcb2602266191c755d191b37018a | [
"Apache-2.0"
] | null | null | null | xos/api/utility/toscaapi.py | iecedge/xos | 566617f676fedcb2602266191c755d191b37018a | [
"Apache-2.0"
] | null | null | null | xos/api/utility/toscaapi.py | iecedge/xos | 566617f676fedcb2602266191c755d191b37018a | [
"Apache-2.0"
] | null | null | null | # Copyright 2017-present Open Networking Foundation
#
# 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 os
import sys
import traceback
# The Tosca engine expects to be run from /opt/xos/tosca/ or equivalent. It
# needs some sys.path fixing up.
import inspect
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe())))
toscadir = os.path.join(currentdir, "../../tosca")
class ToscaViewSet(XOSViewSet):
base_name = "tosca"
method_name = "tosca"
method_kind = "viewset"
@classmethod
def get_urlpatterns(self, api_path="^"):
patterns = []
patterns.append(self.list_url("run/$", {"post": "post_run"}, "tosca_run"))
return patterns
def post_run(self, request):
recipe = request.data.get("recipe", None)
sys_path_save = sys.path
try:
sys.path.append(toscadir)
from tosca.engine import XOSTosca
xt = XOSTosca(recipe, parent_dir=toscadir, log_to_console=False)
xt.execute(request.user)
except BaseException:
return Response({"error_text": traceback.format_exc()}, status=500)
finally:
sys.path = sys_path_save
<<<<<<< HEAD
return Response( {"log_msgs": xt.log_msgs} )
=======
return Response({"log_msgs": xt.log_msgs})
>>>>>>> 045b63d3a... [SEBA-412] Automated reformat of Python code
| 30.983607 | 86 | 0.679894 | 798 | 0.422222 | 0 | 0 | 188 | 0.099471 | 0 | 0 | 801 | 0.42381 |
57b55370970495146667677f66fe08fa5907770e | 952 | py | Python | tests/test_plugins/test_wiki.py | follower46/ashaw-notes | 036f213f032ff7a58cbcfe8c303e9553ec6b3106 | [
"MIT"
] | 4 | 2017-08-15T13:29:06.000Z | 2019-04-24T01:31:25.000Z | tests/test_plugins/test_wiki.py | follower46/ashaw-notes | 036f213f032ff7a58cbcfe8c303e9553ec6b3106 | [
"MIT"
] | 51 | 2017-08-13T03:58:41.000Z | 2018-01-29T21:21:57.000Z | tests/test_plugins/test_wiki.py | follower46/ashaw-notes | 036f213f032ff7a58cbcfe8c303e9553ec6b3106 | [
"MIT"
] | 5 | 2017-08-15T01:46:33.000Z | 2019-01-07T21:43:24.000Z | """ Testing Wiki Module
"""
import unittest
from ddt import ddt, data, unpack
from ashaw_notes.plugins.wiki import Plugin
@ddt
class PluginTests(unittest.TestCase):
"""Unit Testing Plugin"""
@unpack
@data(
(1373500800,
'today: derp note',
'today: derp note'),
(1373500800,
'today: wiki:unit_testing',
"today: <a style='color:#66D9B1;' " \
"href='http://en.wikipedia.org/wiki/unit_testing'>unit testing</a>"),
(1373500800,
'today: wiki:unit_testing#for_real',
"today: <a style='color:#66D9B1;' " \
"href='http://en.wikipedia.org/wiki/unit_testing#for_real'>unit testing - for real</a>"),
)
def test_format_note_line(self, timestamp, note, expectation):
"""Verifies format_note_line is properly functioning"""
self.assertEqual(
expectation,
Plugin().format_note_line(timestamp, note)
)
| 28.848485 | 98 | 0.609244 | 821 | 0.862395 | 0 | 0 | 826 | 0.867647 | 0 | 0 | 428 | 0.44958 |
57b6388ade74fa7db2072594bfcd80032ccdd8ef | 5,956 | py | Python | cppcheck_junit.py | PfannenHans/cppcheck-junit | 8f29ac91ea50c11d90a4a3c012aedb7687d835fb | [
"MIT"
] | 8 | 2016-03-19T12:32:11.000Z | 2021-12-06T18:36:10.000Z | cppcheck_junit.py | PfannenHans/cppcheck-junit | 8f29ac91ea50c11d90a4a3c012aedb7687d835fb | [
"MIT"
] | 16 | 2016-04-11T13:36:22.000Z | 2022-03-30T11:41:35.000Z | cppcheck_junit.py | PfannenHans/cppcheck-junit | 8f29ac91ea50c11d90a4a3c012aedb7687d835fb | [
"MIT"
] | 8 | 2015-11-20T16:27:07.000Z | 2022-03-28T12:46:17.000Z | #!/usr/bin/env python3
"""Converts Cppcheck XML version 2 output to JUnit XML format."""
import argparse
import collections
from datetime import datetime
import os
from socket import gethostname
import sys
from typing import Dict, List
from xml.etree import ElementTree
from exitstatus import ExitStatus
class CppcheckError:
def __init__(
self, file: str, line: int, message: str, severity: str, error_id: str, verbose: str
) -> None:
"""Constructor.
Args:
file: File error originated on.
line: Line error originated on.
message: Error message.
severity: Severity of the error.
error_id: Unique identifier for the error.
verbose: Verbose error message.
"""
self.file = file
self.line = line
self.message = message
self.severity = severity
self.error_id = error_id
self.verbose = verbose
def parse_arguments() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Converts Cppcheck XML version 2 to JUnit XML format.\n"
"Usage:\n"
"\t$ cppcheck --xml-version=2 --enable=all . 2> cppcheck-result.xml\n"
"\t$ cppcheck_junit cppcheck-result.xml cppcheck-junit.xml\n",
formatter_class=argparse.RawDescriptionHelpFormatter,
)
parser.add_argument("input_file", type=str, help="Cppcheck XML version 2 stderr file.")
parser.add_argument("output_file", type=str, help="JUnit XML output file.")
return parser.parse_args()
def parse_cppcheck(file_name: str) -> Dict[str, List[CppcheckError]]:
"""Parses a Cppcheck XML version 2 file.
Args:
file_name: Cppcheck XML file.
Returns:
Parsed errors grouped by file name.
Raises:
IOError: If file_name does not exist (More specifically, FileNotFoundError on Python 3).
xml.etree.ElementTree.ParseError: If file_name is not a valid XML file.
ValueError: If unsupported Cppcheck XML version.
"""
root: ElementTree.Element = ElementTree.parse(file_name).getroot()
if root.get("version") is None or int(root.get("version")) != 2:
raise ValueError("Parser only supports Cppcheck XML version 2. Use --xml-version=2.")
error_root = root.find("errors")
errors = collections.defaultdict(list)
for error_element in error_root:
location_element: ElementTree.Element = error_element.find("location")
if location_element is not None:
file = location_element.get("file")
line = int(location_element.get("line"))
else:
file = ""
line = 0
error = CppcheckError(
file=file,
line=line,
message=error_element.get("msg"),
severity=error_element.get("severity"),
error_id=error_element.get("id"),
verbose=error_element.get("verbose"),
)
errors[error.file].append(error)
return errors
def generate_test_suite(errors: Dict[str, List[CppcheckError]]) -> ElementTree.ElementTree:
"""Converts parsed Cppcheck errors into JUnit XML tree.
Args:
errors: Parsed cppcheck errors.
Returns:
XML test suite.
"""
test_suite = ElementTree.Element("testsuite")
test_suite.attrib["name"] = "Cppcheck errors"
test_suite.attrib["timestamp"] = datetime.isoformat(datetime.now())
test_suite.attrib["hostname"] = gethostname()
test_suite.attrib["tests"] = str(len(errors))
test_suite.attrib["failures"] = str(0)
test_suite.attrib["errors"] = str(len(errors))
test_suite.attrib["time"] = str(1)
for file_name, errors in errors.items():
test_case = ElementTree.SubElement(
test_suite,
"testcase",
name=os.path.relpath(file_name) if file_name else "Cppcheck error",
classname="Cppcheck error",
time=str(1),
)
for error in errors:
ElementTree.SubElement(
test_case,
"error",
type="",
file=os.path.relpath(error.file) if error.file else "",
line=str(error.line),
message="{}: ({}) {}".format(error.line, error.severity, error.message),
)
return ElementTree.ElementTree(test_suite)
def generate_single_success_test_suite() -> ElementTree.ElementTree:
"""Generates a single successful JUnit XML testcase."""
test_suite = ElementTree.Element("testsuite")
test_suite.attrib["name"] = "Cppcheck errors"
test_suite.attrib["timestamp"] = datetime.isoformat(datetime.now())
test_suite.attrib["hostname"] = gethostname()
test_suite.attrib["tests"] = str(1)
test_suite.attrib["failures"] = str(0)
test_suite.attrib["errors"] = str(0)
test_suite.attrib["time"] = str(1)
ElementTree.SubElement(
test_suite, "testcase", name="Cppcheck success", classname="Cppcheck success", time=str(1)
)
return ElementTree.ElementTree(test_suite)
def main() -> ExitStatus: # pragma: no cover
"""Main function.
Returns:
Exit code.
"""
args = parse_arguments()
try:
errors = parse_cppcheck(args.input_file)
except ValueError as e:
print(str(e))
return ExitStatus.failure
except IOError as e:
print(str(e))
return ExitStatus.failure
except ElementTree.ParseError as e:
print(
"{} is a malformed XML file. Did you use --xml-version=2?\n{}".format(
args.input_file, e
)
)
return ExitStatus.failure
if len(errors) > 0:
tree = generate_test_suite(errors)
else:
tree = generate_single_success_test_suite()
tree.write(args.output_file, encoding="utf-8", xml_declaration=True)
return ExitStatus.success
if __name__ == "__main__": # pragma: no cover
sys.exit(main())
| 32.021505 | 98 | 0.633647 | 643 | 0.107958 | 0 | 0 | 0 | 0 | 0 | 0 | 1,892 | 0.317663 |
57b7e56d2bb65164490572ca122f372afa976572 | 2,440 | py | Python | apps/core/tests/conftest.py | techlib/czechelib-stats | ca132e326af0924740a525710474870b1fb5fd37 | [
"MIT"
] | 1 | 2019-12-12T15:38:42.000Z | 2019-12-12T15:38:42.000Z | apps/core/tests/conftest.py | techlib/czechelib-stats | ca132e326af0924740a525710474870b1fb5fd37 | [
"MIT"
] | null | null | null | apps/core/tests/conftest.py | techlib/czechelib-stats | ca132e326af0924740a525710474870b1fb5fd37 | [
"MIT"
] | null | null | null | import pytest
from django.conf import settings
from django.contrib.auth import get_user_model
from django.contrib.sites.models import Site
from core.models import Identity
from organizations.models import Organization
@pytest.fixture
def valid_identity():
id_string = 'valid@user.test'
user = get_user_model().objects.create(username='test', email=id_string)
Identity.objects.create(user=user, identity=id_string)
yield id_string
@pytest.fixture
def invalid_identity():
yield 'invalid@user.test'
@pytest.fixture
def master_identity():
id_string = 'master@user.test'
user = get_user_model().objects.create(username='master')
Identity.objects.create(user=user, identity=id_string)
user.organizations.add(
Organization.objects.get_or_create(
internal_id=settings.MASTER_ORGANIZATIONS[0],
defaults=dict(
ext_id=1235711,
parent=None,
ico='12345',
name_cs='šéf',
name_en='boss',
short_name='master',
),
)[0]
)
yield id_string
@pytest.fixture
def admin_identity():
id_string = 'admin@user.test'
user = get_user_model().objects.create(username='admin', is_superuser=True)
Identity.objects.create(user=user, identity=id_string)
yield id_string
@pytest.fixture
def authenticated_client(client, valid_identity):
client.defaults[settings.EDUID_IDENTITY_HEADER] = valid_identity
client.user = Identity.objects.get(identity=valid_identity).user
yield client
@pytest.fixture
def master_client(client, master_identity):
client.defaults[settings.EDUID_IDENTITY_HEADER] = master_identity
yield client
@pytest.fixture
def unauthenticated_client(client, invalid_identity):
client.defaults[settings.EDUID_IDENTITY_HEADER] = invalid_identity
yield client
@pytest.fixture
def authentication_headers():
def fn(identity):
return {settings.EDUID_IDENTITY_HEADER: identity}
return fn
@pytest.fixture
def site():
return Site.objects.get_or_create(
id=settings.SITE_ID, defaults={'name': 'Celus test', 'domain': 'test.celus.net'}
)[0]
__all__ = [
'admin_identity',
'master_client',
'master_identity',
'authentication_headers',
'authentication_headers',
'authenticated_client',
'unauthenticated_client',
'valid_identity',
'invalid_identity',
]
| 25.154639 | 88 | 0.702459 | 0 | 0 | 1,534 | 0.628174 | 1,950 | 0.798526 | 0 | 0 | 338 | 0.138411 |
57b8a501dc93a41633bfea6eb1b0e55e7388ace2 | 4,041 | py | Python | tests/test_descriptor.py | OlivierBeq/ProDEC | b3723bc54a5a7ab4eedf2ab9a23a210e935b05fe | [
"MIT"
] | null | null | null | tests/test_descriptor.py | OlivierBeq/ProDEC | b3723bc54a5a7ab4eedf2ab9a23a210e935b05fe | [
"MIT"
] | null | null | null | tests/test_descriptor.py | OlivierBeq/ProDEC | b3723bc54a5a7ab4eedf2ab9a23a210e935b05fe | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
"""Tests for Descriptor."""
import unittest
import numpy as np
import orjson
from prodec import Descriptor
from prodec.utils import std_amino_acids
from tests.constants import *
class TestDescriptor(unittest.TestCase):
"""Tests for Descriptor."""
def setUp(self):
"""Create custom descriptor for testing"""
# Values below obtained at random
self.replacements = {'A': [6.0, 3.0, 12.1], 'C': [120.6, -12.2, -0.0001],
'D': [-3.8, 2.1, 0.9], 'E': [-91.24, -82.82, 77.79 ],
'F': [0.12, 3.0, 4.0], 'G': [-77.87, -75.44, 30.11 ],
'H': [47.73, -77.07, -34.83], 'I': [14.22, 97.13, -87.40 ],
'K': [ 64.98, 48.73, -62.02], 'L': [-13.98, -31.64, 5.04 ],
'M': [-78.57, -90.04, 17.60], 'N': [ -83.47, -58.43, -21.13 ],
'P': [-52.18, 52.58, 74.57], 'Q': [-36.21, -62.56, -56.08 ],
'R': [ 86.56, 26.16, 69.17], 'S': [34.89, -87.35, 37.82 ],
'T': [-13.67, -93.15, -2.88], 'V': [68.36, 67.60, -66.56 ],
'W': [-48.21, -42.47, -84.41], 'Y': [-90.24, 44.75, 2.18 ]}
self.definition = CSTM_DATA_NULL
for aa in std_amino_acids:
self.definition = self.definition.replace(f'{aa}_value', f'"{aa}" : {self.replacements[aa]}')
self.desc = Descriptor(orjson.loads(self.definition))
def test_descriptor_loaded_ID(self):
self.assertEqual(self.desc.ID, 'CSTM_TESTS')
def test_descriptor_loaded_Type(self):
self.assertEqual(self.desc.Type, 'Linear')
def test_descriptor_loaded_Name(self):
self.assertEqual(self.desc.Name, 'TEST')
def test_descriptor_summary(self):
self.assertEqual(self.desc.summary, {'Authors': None, 'Year':None,
'Journal':None, 'DOI':None,
'PMID':None, 'Patent':None})
def test_descriptor_loaded_Scales_Names_type(self):
self.assertIsInstance(self.desc.Scales_names, list)
def test_descriptor_loaded_Scales_Names(self):
self.assertListEqual(self.desc.Scales_names, [ 'v1', 'v2', 'v3' ])
def test_descriptor_definition(self):
self.assertEqual(self.desc.definition, self.replacements)
def test_descriptor_is_sequence_valid_default(self):
self.assertTrue(self.desc.is_sequence_valid(DFLT_SEQ))
def test_descriptor_is_sequence_valid_stupid(self):
self.assertFalse(self.desc.is_sequence_valid(STUPID_SEQ))
def test_descriptor_get_flattened_type(self):
result = self.desc.get(DFLT_SEQ, True, 0)
self.assertIsInstance(result, list)
def test_descriptor_get_not_flattened_type(self):
result = self.desc.get(DFLT_SEQ, False, 0)
self.assertIsInstance(result, list)
def test_descriptor_get_flattened_shape(self):
result = np.array(self.desc.get(DFLT_SEQ, True, 0)).shape
self.assertEqual(result[0], 3 * len(DFLT_SEQ))
def test_descriptor_get_not_flattened_type(self):
result = np.array(self.desc.get(DFLT_SEQ, False, 0)).shape
self.assertTrue(result[0] == len(DFLT_SEQ) and result[1] == 3)
def test_descriptor_get_flattened_value(self):
result = self.desc.get(DFLT_SEQ, True, 0)
self.assertAlmostEqual(np.mean(result), -9.968835, 6)
self.assertAlmostEqual(np.sum(result), -598.1301, 4)
self.assertAlmostEqual(np.std(result), 56.753686, 6)
def test_descriptor_get_not_flattened_value(self):
result = self.desc.get(DFLT_SEQ, True, 0)
self.assertAlmostEqual(np.mean(result), -9.968835, 6)
self.assertAlmostEqual(np.sum(result), -598.1301, 4)
self.assertAlmostEqual(np.std(result), 56.753686, 6)
def test_descriptor_get_empty_value(self):
result = self.desc.get('', True, 0)
self.assertListEqual(result, []) | 42.536842 | 105 | 0.59218 | 3,833 | 0.948528 | 0 | 0 | 0 | 0 | 0 | 0 | 343 | 0.08488 |
57ba16515c786535378110b8430cbadfa8476104 | 310 | py | Python | mmdet/apis/__init__.py | ar90n/ttfnet | 99dbfa888f90c8161c2c1666b2d17cdb144dbc30 | [
"Apache-2.0"
] | 36 | 2019-06-17T02:00:36.000Z | 2022-03-10T07:54:07.000Z | mmdet/apis/__init__.py | ar90n/ttfnet | 99dbfa888f90c8161c2c1666b2d17cdb144dbc30 | [
"Apache-2.0"
] | 6 | 2020-03-17T03:53:53.000Z | 2022-03-30T07:57:40.000Z | mmdet/apis/__init__.py | ar90n/ttfnet | 99dbfa888f90c8161c2c1666b2d17cdb144dbc30 | [
"Apache-2.0"
] | 4 | 2019-06-17T02:00:35.000Z | 2021-09-22T14:44:29.000Z | from .env import get_root_logger, init_dist, set_random_seed
from .inference import inference_detector, init_detector, show_result
from .train import train_detector
__all__ = [
'init_dist', 'get_root_logger', 'set_random_seed', 'train_detector',
'init_detector', 'inference_detector', 'show_result'
]
| 34.444444 | 72 | 0.787097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 109 | 0.351613 |
57ba713a68ba9ecdd9ab3196a36b1f0bcef50142 | 1,544 | py | Python | tree.py | joshedler/ct2ad | 39dfce6191c8993a43a0ebb12e5d0847c3e63e4c | [
"MIT"
] | null | null | null | tree.py | joshedler/ct2ad | 39dfce6191c8993a43a0ebb12e5d0847c3e63e4c | [
"MIT"
] | null | null | null | tree.py | joshedler/ct2ad | 39dfce6191c8993a43a0ebb12e5d0847c3e63e4c | [
"MIT"
] | null | null | null | #! /usr/bin/env python3
'''
Examine a CherryTree SQLite database and print out the tree in proper heirarchical form and sequence.
'''
import argparse
import colorama
from colorama import Fore, Back, Style
import sqlite3
from ct2ad import *
def print_xc_node(xc_node, level):
'''
Print the node information to the console in a nice format
'''
indent = '--' * level
s = get_expanded_child_seq(xc_node)
n = get_expanded_child_node(xc_node)
print(f'{Style.DIM}|{indent} {Style.NORMAL}{s:03}: {Style.BRIGHT+Fore.YELLOW}\'{get_node_name(n)}\' {Fore.RESET}{Style.DIM}: [node_id = {get_node_id(n)}]')
# setup argument parsing...
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('sqlite3_db', action='store')
args = parser.parse_args()
colorama.init(autoreset=True)
# load the database and party on!
con = sqlite3.connect(args.sqlite3_db)
sql_get_tables(con)
# all_nodes are a dict with each key being the unique node_id
all_nodes = sql_get_all_nodes(con)
# all_children are a list of tuples
all_children = sql_get_all_children(con)
xc_roots = []
for child in all_children:
xc_root = expand_child(child, all_nodes)
if get_expanded_child_father(xc_root) == None: xc_roots.append(xc_root)
print()
count = 0
for xc_root in sorted(xc_roots, key=sequence_order):
count = count + 1
print_xc_node(xc_root, 0)
for xc, level in dig(xc_root, all_children, all_nodes, 1):
print_xc_node(xc, level)
count = count + 1
print(f'\n{count} nodes iterated over')
| 24.507937 | 159 | 0.723446 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 565 | 0.365933 |
57bb5336b2ed0566151bd0a0cc733ef2af64f5fa | 2,559 | py | Python | sparse_entertainment.py | synergetics/nest_expermiments | 39c50fe7d4713b9d0a8e4618a829d94b4fe7456c | [
"MIT"
] | null | null | null | sparse_entertainment.py | synergetics/nest_expermiments | 39c50fe7d4713b9d0a8e4618a829d94b4fe7456c | [
"MIT"
] | null | null | null | sparse_entertainment.py | synergetics/nest_expermiments | 39c50fe7d4713b9d0a8e4618a829d94b4fe7456c | [
"MIT"
] | null | null | null | #!/usr/bin/env python
import sys
sys.path.append('/opt/lib/python2.7/site-packages/')
import math
import numpy as np
import pylab
import nest
import nest.raster_plot
import nest.voltage_trace
import nest.topology as tp
import ggplot
t_sim = 500
populations = [1, 100]
no_recurrent = True
neuron_model = 'iaf_psc_exp'
model_params = {
'tau_m': 10., # membrane time constant (ms)
'tau_syn_ex': 0.5, # excitatory synaptic time constant (ms)
'tau_syn_in': 0.5, # inhibitory synaptic time constant (ms)
't_ref': 2., # absolute refractory period (ms)
'E_L': -65., # resting membrane potential (mV)
'V_th': -50., # spike threshold (mV)
'C_m': 250., # membrane capacitance (pF)
'V_reset': -65. # reset potential (mV)
}
wt_e = 1.
extent = 1.
delay_max = 2.
delay_min = 1.
ac_amp = 3000.0
ac_freq = 4.0
nest.ResetKernel()
nest.SetKernelStatus({'local_num_threads': 8})
nest.CopyModel('iaf_psc_exp', 'exp_nrn', model_params)
layers = []
spike_detector = tp.CreateLayer({
'rows': 1,
'columns': 1,
'elements': 'spike_detector',
'extent': [extent, extent]
})
spike_detector_nrn = (spike_detector[0]+1,)
voltmeter = tp.CreateLayer({
'rows': 1,
'columns': 1,
'elements': 'voltmeter',
'extent': [extent, extent]
})
voltmeter_nrn = (voltmeter[0]+1,)
nest.CopyModel('ac_generator', 'ac', {'amplitude': ac_amp, 'frequency': ac_freq})
input = tp.CreateLayer({
'rows': 1,
'columns': 1,
'elements': 'ac',
'extent': [extent, extent]
})
for pop in populations:
rows = columns = int(math.sqrt(pop))
l = tp.CreateLayer({
'rows': rows,
'columns': columns,
'extent': [extent, extent],
'elements': 'exp_nrn',
# 'edge_wrap': False
})
layers.append(l)
conn = {
'connection_type': 'divergent',
'synapse_model': 'static_synapse',
'weights': {
'gaussian': {'p_center': wt_e, 'sigma': extent}
},
'delays': {
'uniform': { 'min': delay_min, 'max': delay_max }
}
}
for source in layers:
for target in layers:
if no_recurrent:
if source != target:
tp.ConnectLayers(source, target, conn)
else:
tp.ConnectLayers(source, target, conn)
for layer in layers:
tp.ConnectLayers(layer, spike_detector, {'connection_type': 'convergent'})
tp.ConnectLayers(voltmeter, layer, {'connection_type': 'divergent'})
tp.ConnectLayers(input, layers[0], {'connection_type': 'convergent'})
nest.Simulate(t_sim)
nest.raster_plot.from_device(spike_detector_nrn)
# nest.voltage_trace.from_device(voltmeter_nrn)
pylab.show()
| 20.804878 | 82 | 0.657288 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 906 | 0.354045 |
57bd452b6b5ced5e7d55432fe628cd4930c57a5d | 21,008 | py | Python | management/views.py | EsraelDawit-a/Drims-Fse-Project | a68d842e947450bc27711a6acab89ec8e3ba3b03 | [
"MIT"
] | null | null | null | management/views.py | EsraelDawit-a/Drims-Fse-Project | a68d842e947450bc27711a6acab89ec8e3ba3b03 | [
"MIT"
] | null | null | null | management/views.py | EsraelDawit-a/Drims-Fse-Project | a68d842e947450bc27711a6acab89ec8e3ba3b03 | [
"MIT"
] | null | null | null | from django.shortcuts import render,redirect,get_object_or_404
from .forms import *
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from .models import *
from django.views.generic import DetailView,DeleteView
from django.urls import reverse_lazy
from test2.notification import send_message
from django.core.paginator import Paginator
from real_price.models import *
from django.core.mail import send_mail
# Create your views here.
@login_required
def add_product(request):
md = ProductCatagory.objects.all()
catagory = AddCatagory()
if request.method == 'POST':
form= AddProducts(request.POST, request.FILES)
context ={'form':form,'cat':md}
if form.is_valid():
form.save()
context ={'form':form,'cat':md,'catagory':catagory}
messages.success(request, 'You Have Sucessfully Added new Product ')
return render(request,'product_add.html',context)
else:
print(form.errors)
context ={'form':form,'cat':md,'catagory':catagory}
print(request.user.username)
print(request.user.id)
return render(request,'product_add.html',context)
else:
form = AddProducts()
context ={'form':form,'cat':md,'catagory':catagory}
if request.user.role == 'Producer':
return render(request,'product_add.html',context)
else:
return redirect('homepage')
return render(request,'product_add.html',context)
@login_required
def delete_product(request,pk):
item = Products.objects.get(pk=pk)
item.delete()
messages.success(request, 'You Have Sucessfully Deleted A Product ')
return redirect ('user_products')
@login_required
def update_product(request,pk):
cat = ProductCatagory.objects.all()
pro = Products.objects.get(pk=pk)
if request.method == 'POST':
form1 = AddProducts(request.POST,request.FILES or None,instance = pro)
if form1.is_valid():
form1.save()
print('Product Updated')
return redirect('user_products')
else:
print(form1.errors)
form1 = AddProducts(instance = pro)
context = {'form1':form1,'product':pro,'cat':cat,'pk':pk}
return render(request,'product_update.html',context)
print(form1.errors)
else:
pro = Products.objects.get(pk=pk)
form1 = AddProducts(instance = pro)
context = {'form1':form1,'product':pro,'cat':cat,'pk':pk}
return render(request,'product_update.html',context)
@login_required
def update_transport(request,pk):
pro = Transports.objects.get(pk=pk)
if request.method == 'POST':
form1 = AddTransports(request.POST,request.FILES or None,instance = pro)
if form1.is_valid():
form1.save()
print('Transport Updated')
messages.success(request, 'Transport Updated Sucessfully !')
return redirect('user_products')
else:
print(form1.errors)
form1 = AddTransports(instance = pro)
context = {'form1':form1,'product':pro,'pk':pk}
return render(request,'transport_update.html',context)
print(form1.errors)
else:
pro = Transports.objects.get(pk=pk)
form1 = AddTransports(instance = pro)
context = {'form1':form1,'product':pro,'pk':pk}
return render(request,'transport_update.html',context)
def contactus(request):
if request.method == "POST":
form = MessageSend(request.POST)
if form.is_valid():
form.save()
print('saved')
messages.success(request, 'Your Message Have Been Sucssusfuly Sent ')
print(messages)
return redirect('contactus')
else:
print('notsaved')
print(form.errors)
messages.error(request, 'Your Message Have Not Been Sent ')
print(messages)
form = MessageSend()
context = {'form':form}
return render(request,'contact.html',context)
else:
form = MessageSend()
context = {'form':form}
return render(request,'contact.html',context)
@login_required
def delete_orders(request,pk):
order = ProductOrders.objects.get(pk=pk)
order.delete()
messages.success(request, 'Order Deleted Successfully ')
return redirect('user_products')
@login_required
def delete_transports(request,pk):
order = Transports.objects.get(pk=pk)
order.delete()
messages.success(request, 'Transport Deleted Successfully')
return redirect('user_products')
@login_required
def user_products(request):
my_orders = ProductOrders.objects.filter(ordered_by = request.user)
my_order = my_orders.count()
print(request.user.role)
if request.user.role == 'Producer':
orders = ProductOrders.objects.filter(prouct_owner = request.user)
order = orders.count()
print(orders)
print(request.user.role)
print(request.user.role)
man = request.user
v = Products.objects.filter(user=man)
context = {}
amount = v.count()
context ={'form':v,'amount':amount,'my_orders':my_orders,'my_order':my_order,'orders':orders,'order':order}
return render(request,'userproducts.html',context)
elif request.user.role == 'Transport-Provider':
t_orders = TransportOrders.objects.filter(transport_owner = request.user)
t_order = t_orders.count()
man = request.user
v = Transports.objects.filter(user=man)
amount = v.count()
context ={'transport':v,'amount':amount,'t_orders':t_orders,'t_order':t_order,'my_orders':my_orders,'my_order':my_order,}
return render(request,'userproducts.html',context)
elif request.user.role == 'Price_teller':
orders = ProductOrders.objects.filter(ordered_by = request.user)
price_teller = ProductPrice.objects.filter(user = request.user)
price_count = price_teller.count()
order = orders.count()
context = {'orders':orders,'order':order,'price_teller':price_teller,'price_count':price_count}
return render(request,'price_teller_orders.html',context)
elif request.user.role =='Buyer':
orders = ProductOrders.objects.filter(ordered_by = request.user)
order = orders.count()
context = {'orders':orders,'order':order}
return render(request,'buyer_orders.html',context)
else:
return redirect('homepage')
@login_required
def add_catagory(request):
if request.method == 'POST':
catagory = AddCatagory(request.POST)
if catagory.is_valid():
catagory.save()
messages.success(request, 'New Catagory Added ! ')
return redirect('create_product')
else:
messages.success(request, 'Invalid Catagory ! ')
return redirect('create_product')
else:
return redirect('create_product')
@login_required
def product_detail(request,pk):
form1 = CommentRev()
com = CustomUser.objects.all()
item = Products.objects.get(pk=pk)
print(pk)
if item.user.Adress:
m =item.user.Adress.split(',')
la = m[0]
lo = m[-2]
else:
la = '89.002'
lo = '42.442'
commentes = CommentReview.objects.filter(product_id=pk)
print(commentes)
if request.method =="POST":
form = CommentRev(request.POST)
if form.is_valid():
print('valid')
form.save()
print('saved')
messages.success(request, 'You Have Sucessfully Commented ')
return render(request,'product_detail_view.html',context={'item':item,'comment':commentes,'com ':com,'form':form1,'la':la,'lo':lo})
else:
messages.success(request, 'Unable To Comment! ')
return render(request,'product_detail_view.html',context={'item':item,'com ':com,'comment':commentes,'form':form1,'la':la,'lo':lo})
return render(request,'product_detail_view.html',context={'item':item,'com ':com,'comment':commentes,'form':form1,'la':la,'lo':lo})
@login_required
def change_status(request,pk):
item = ProductOrders.objects.get(pk=pk)
if item.accecpted:
item.accecpted = False
man = request.user.username
body1 = f'\nDear Customer Sorry Your Product Orderd From {man} is Declined Try another Options \n'\
f'Product_owener:{item.prouct_owner.username}\n' \
f'orderd_by :{item.ordered_by.username}\n' \
f'Ordered Date:{item.order_date}\n'\
f'Ordere Id:{item.pk}\n'\
f'Price:{item.ordered_item.price} birr {item.ordered_item.amount} \n'\
f'Delivery Adress:{request.user.optional_adress}\n'\
f'ordered_item :{item.ordered_item}\n\n' \
f'FROM DRIMS TEAM. \nTank You For Using Our Service'
if item.ordered_by.Email_Adress:
email = item.ordered_by.Email_Adress
send_mail("Hello From Drims Team",
body1,
'With Regards Drims Team',
[email],
fail_silently = False)
print('owener email')
item.save()
messages.success(request, 'Request Declined')
return redirect('user_products')
else:
item.accecpted = True
phone = item.ordered_by.phone
owners_phone = item. prouct_owner.phone
body1 = f'\nDear Customer You Have Sucsessfully Orderd A Product \n'\
f'Your Request is Accepted \n'\
f'Product_owener:{item.prouct_owner.username}\n' \
f'orderd_by :{item.ordered_by.username}\n' \
f'Ordered Date:{item.order_date}\n'\
f'Ordere Id:{item.pk}\n'\
f'Price:{item.ordered_item.price} birr {item.ordered_item.amount} \n'\
f'Delivery Adress:{request.user.optional_adress}\n'\
f'ordered_item :{item.ordered_item}\n\n' \
f'Product_owners Phone Number :{owners_phone}\n\n' \
f'FROM DRIMS TEAM. \nTank You For Using Our Service'
man = item.ordered_by.username
body2 = f'\nDear Customer You Have Sucsessfully Accepted Order from {man} \n'\
f'Your Accepted Order Request \n'\
f'Product_owener:{item.prouct_owner.username}\n' \
f'orderd_by :{item.ordered_by.username}\n' \
f'Ordered Date:{item.order_date}\n'\
f'Ordere Id:{item.pk}\n'\
f'Price:{item.ordered_item.price} birr {item.ordered_item.amount} \n'\
f'Delivery Adress:{request.user.optional_adress}\n'\
f'ordered_item :{item.ordered_item}\n\n' \
f'Orderers Phone Number :{phone}\n\n' \
f'FROM DRIMS TEAM. \nTank You For Using Our Service'
if item.ordered_by.Email_Adress:
email = item.ordered_by.Email_Adress
print('have orderer email')
send_mail("Hello From Drims Team",
body1,
'With Regards Drims Team',
[email],
fail_silently = False)
if item. prouct_owner.Email_Adress:
email = item. prouct_owner.Email_Adress
send_mail("Hello From Drims Team",
body2,
'With Regards Drims Team',
[email],
fail_silently = False)
print('owener email')
print(body1)
print(body2)
item.save()
messages.success(request, 'You Have Sucessfully Accepted A Product Request You will Get Message Notification Soon ')
return redirect('user_products')
return redirect('user_products')
@login_required
def change_status_transport(request,pk):
item = TransportOrders.objects.get(pk=pk)
if item.status:
item.status = False
man =request.user.username
body1 = f'\nDear {item.ordered_by} Sorry Your Request To Get Transport acess From {man} is Declined \n'\
f'Transport owener:{item.transport_owner.username}\n' \
f'orderd_by :{item.ordered_by.username}\n' \
f'Ordered Date:{item.order_date}\n'\
f'Ordere Id:{item.pk}\n'\
f'Try another Options\n'\
f'FROM DRIMS TEAM. \nTank You For Using Our Service'
if item.ordered_by.Email_Adress:
email = item.ordered_by.Email_Adress
send_mail("Hello From Drims Team",
body1,
'With Regards Drims Team',
[email],
fail_silently = False)
print('owener email')
item.save()
messages.success(request, 'Request Declined')
return redirect('user_products')
else:
item.status = True
owners_phone = item.transport_owner.phone
man = request.user.username
body1 = f'\nDear Your Request To Get Transport access From {man} is Accepted \n'\
f'Your Request is Accepted \n'\
f'Transport owener:{item.transport_owner.username}\n' \
f'orderd_by :{item.ordered_by.username}\n' \
f'Ordered Date:{item.order_date}\n'\
f'Ordere Id:{item.pk}\n'\
f'Transport_owners Phone Number :{owners_phone}\n\n' \
f'FROM DRIMS TEAM. \nTank You For Using Our Service'
if item.ordered_by.Email_Adress:
email = item.ordered_by.Email_Adress
send_mail("Hello From Drims Team",
body1,
'With Regards Drims Team',
[email],
)
print('owener email')
send_to = item.ordered_by.phone
print(body1)
item.save()
messages.success(request, 'You Have Sucessfully Accepted A Transport Access Request ')
return redirect('user_products')
@login_required
def order_product(request,pk):
pro = Products.objects.get(pk=pk)
obj = ProductOrders.objects.create(
ordered_by = request.user,
order_source_adress = Products.objects.get(pk=pk).user.Adress,
ordered_item=pro,
prouct_owner = Products.objects.get(pk=pk).user,
order_destination = request.user.Adress,
orderer_optional_adress = request.user.optional_adress
)
phone = request.user.phone
body = f'\nDear Customer You Have Sucsessfully Orderd A Product \n'\
f'Product_owener:{Products.objects.get(pk=pk).user}\n' \
f'orderd_by :{request.user}\n' \
f'Ordered Date:{obj.order_date}\n'\
f'Price:{pro.price}$ {pro.amount}\n'\
f'Delivery Adress:{request.user.optional_adress}\n'\
f'ordered_item :{pro.product_name}\n\n' \
f'Product_owners Phone Number :{pro.user.phone}\n\n' \
f'FROM DRIMS TEAM. \nTank You For Using Our Service'
messages.success(request, 'You Have Sucessfully Sent Order Request For Product Owner\n You will Get Message Notification Soon Wen Request Approved !\n Tank You ! ')
return redirect('product_detail', pk=pk)
@login_required
def search_transport(request):
query = request.GET['query']
filter_by = request.GET['filter_by']
if filter_by == 'description':
product = Transports.objects.filter(description__icontains = query)
paginator = Paginator(product,4)
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)
messages.success(request, 'Your Search Result Here .. ')
return render(request,'transport_search.html',context={'page_obj':page_obj})
if filter_by == 'specific_adress':
product = Transports.objects.filter(specific_adress__icontains = query)
paginator = Paginator(product,4)
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)
messages.success(request, 'Your Search Result Here .. ')
return render(request,'transport_search.html',context={'page_obj':page_obj})
if filter_by == 'transport_name':
product = Transports.objects.filter(transport_name__icontains = query)
paginator = Paginator(product,4)
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)
messages.success(request, 'Your Search Result Here .. ')
return render(request,'transport_search.html',context={'page_obj':page_obj})
if filter_by == 'price':
product = Transports.objects.filter(price__icontains = query)
paginator = Paginator(product,4)
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)
return render(request,'transport_search.html',context={'page_obj':page_obj})
@login_required
def wantedproductlist(request):
ob = WantedProducts.objects.all()
paginator = Paginator(ob,4)
print(paginator)
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)
return render(request,'wanted_products_list.html',context={'page_obj':page_obj})
@login_required
def wanted_product_detail(request,pk):
item = WantedProducts.objects.get(pk=pk)
if request.method == 'POST':
phone = item.user.phone
man =request.user.username
body = f'\nDear Customer Your Product Have Been Found By {man} \n'\
f'request id :{item.pk}\n' \
f'founded By :{request.user}\n' \
f'request Date:{item.post_date}\n'\
f'Specific Adress:{item.specific_adress}\n'\
f'requested_item :{item.product_name}\n\n' \
f'Founder Phone Number :{request.user.phone}\n\n' \
f'FROM DRIMS TEAM. \nTank You For Using Our Service'
messages.success(request, 'Your Request is Sent We Will Get To You Later ! Tankyou')
print(body)
return redirect ('wanted_product_detail' ,pk=pk)
else:
context ={'item':item}
return render(request,'wanted_list.html',context)
@login_required
def add_wanted_product(request):
if request.method == 'POST':
form= AddWantedProducts(request.POST, request.FILES)
context ={'form':form}
if form.is_valid():
form.save()
context ={'form':form}
messages.success(request, 'You Have Sucessfully Added Product To Wanted List ')
return render(request,'wanted_product.html',context)
else:
print(form.errors)
context ={'form':form}
print(request.user.username)
print(request.user.id)
return render(request,'wanted_product.html',context)
else:
form = AddWantedProducts()
context ={'form':form}
return render(request,'wanted_product.html',context)
@login_required
def transport_add(request):
form = AddTransports()
context = {'form':form}
if request.method == 'POST':
form = AddTransports(request.POST,request.FILES)
if form.is_valid():
form.save()
messages.success(request, 'You Have Sucessfully Added Transport Options')
return redirect('transport_add')
else:
messages.success(request, 'You Please Provide Valid Information !!!')
return redirect('transport_add')
else:
return render(request,'add_transports.html',context)
@login_required
def display_transports(request):
ob = Transports.objects.all()
paginator = Paginator(ob,4)
print(paginator)
page_number = request.GET.get('page')
page_obj = paginator.get_page(page_number)
return render(request,'transport_list.html',context={'page_obj':page_obj})
@login_required
def transport_product_detail(request,pk):
item = Transports.objects.get(pk=pk)
if request.method == 'POST':
print("Request Sent")
messages.success(request, 'Your Request is Sent We Will Get To You Later ! Tankyou')
return redirect ('transport_product_detail' ,pk=pk)
else:
context ={'item':item}
return render(request,'transport_details.html',context)
@login_required
def order_Transport(request,pk):
pro = Transports.objects.get(pk=pk)
obj = TransportOrders.objects.create(
ordered_by = request.user,
order_source_adress = Transports.objects.get(pk=pk).user.Adress,
transport_owner = Transports.objects.get(pk=pk).user,
orderer_optional_adress = request.user.optional_adress
)
messages.success(request, 'You Have Sucessfully Requested A Transport Acsess We Will Get \nTo You When Request Is Accpted Tankyou ! ')
return redirect('transport_product_detail', pk=pk)
| 34.839138 | 169 | 0.623048 | 0 | 0 | 0 | 0 | 19,694 | 0.937452 | 0 | 0 | 6,186 | 0.294459 |
57bd96ec29c38dc1f3e044540afbb8ecbffccd50 | 106 | py | Python | dogpile/__init__.py | dhellmann/dogpile.cache | 03cbee8b9a812a78a37fe1d54edafe848f696737 | [
"MIT"
] | null | null | null | dogpile/__init__.py | dhellmann/dogpile.cache | 03cbee8b9a812a78a37fe1d54edafe848f696737 | [
"MIT"
] | null | null | null | dogpile/__init__.py | dhellmann/dogpile.cache | 03cbee8b9a812a78a37fe1d54edafe848f696737 | [
"MIT"
] | null | null | null | __version__ = '0.9.3'
from .lock import Lock # noqa
from .lock import NeedRegenerationException # noqa
| 21.2 | 51 | 0.745283 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 19 | 0.179245 |
57bde5b7260543357976e429b49a59520729133b | 1,550 | py | Python | pyssian/tests/test_chemistryutils.py | maserasgroup-repo/pyssian | b80b216e24391db807a09518a237f94fa894a648 | [
"MIT"
] | 15 | 2021-07-07T16:25:26.000Z | 2022-03-19T11:58:23.000Z | pyssian/tests/test_chemistryutils.py | maserasgroup-repo/pyssian | b80b216e24391db807a09518a237f94fa894a648 | [
"MIT"
] | 9 | 2021-07-28T22:09:07.000Z | 2022-01-17T08:03:15.000Z | pyssian/tests/test_chemistryutils.py | maserasgroup-repo/pyssian | b80b216e24391db807a09518a237f94fa894a648 | [
"MIT"
] | null | null | null | from pyssian.chemistryutils import is_basis,is_method
import unittest
class ChemistryUtilsTest(unittest.TestCase):
def setUp(self):
self.Valid_Basis = '6-311+g(d,p) 6-31g* cc-pVTZ D95V* LanL2DZ SDD28 Def2SVP UGBS2P2++'.split()
self.Fake_Basis = '6-311g+(d,p) 6-31*g ccpVTZ D96V* LanL2TZ SDD Def2SP UGBS2++P2'.split()
self.Valid_Methods = 'ub3lyp mp2 casscf ccsd(t) rm062x WB97XD pbepbe'.split()
self.Fake_Methods = 'bu3lyp pm2 bw97xd m06-2x pbepbe0'.split()
self.Usual_Keywords = 'opt freq scrf scf #p calcfc empiricaldispersion'.split()
def test_valid_isbasis(self):
msg = 'Valid basis not properly recognized'
for valid in self.Valid_Basis:
self.assertTrue(is_basis(valid),msg)
def test_fake_isbasis(self):
msg = 'Fake basis recognized as valid'
for fake in self.Fake_Basis:
self.assertFalse(is_basis(fake),msg)
def test_valid_ismethod(self):
msg = 'Valid method not properly recognized'
for valid in self.Valid_Methods:
self.assertTrue(is_method(valid),msg)
def test_fake_ismethod(self):
msg = 'Fake method recognized as valid'
for fake in self.Fake_Methods:
self.assertFalse(is_method(fake),msg)
def test_usual_keywords(self):
msg1 = 'Keyword recognized as basis'
msg2 = 'Keyword recognized as method'
for keyword in self.Usual_Keywords:
self.assertFalse(is_basis(keyword),msg1)
self.assertFalse(is_method(keyword),msg2)
| 46.969697 | 102 | 0.674839 | 1,478 | 0.953548 | 0 | 0 | 0 | 0 | 0 | 0 | 460 | 0.296774 |
57bf94c1f54bb6b9683e423a8cf8f0e42b9b2cad | 4,415 | py | Python | custom_components/life360/life360.py | nicholas-sly/life360 | 5e537b0764ba06a9cfdde7e83fc0a742909df1d9 | [
"MIT"
] | null | null | null | custom_components/life360/life360.py | nicholas-sly/life360 | 5e537b0764ba06a9cfdde7e83fc0a742909df1d9 | [
"MIT"
] | null | null | null | custom_components/life360/life360.py | nicholas-sly/life360 | 5e537b0764ba06a9cfdde7e83fc0a742909df1d9 | [
"MIT"
] | null | null | null | # This is what requests does.
try:
import simplejson as json
except ImportError:
import json
import logging
import requests
from .exceptions import *
_PROTOCOL = 'https://'
_BASE_URL = '{}api.life360.com/v3/'.format(_PROTOCOL)
_TOKEN_URL = _BASE_URL + 'oauth2/token.json'
_CIRCLES_URL = _BASE_URL + 'circles.json'
_CIRCLE_URL = _BASE_URL + 'circles/{}'
_CIRCLE_MEMBERS_URL = _CIRCLE_URL + '/members'
_CIRCLE_PLACES_URL = _CIRCLE_URL + '/places'
_AUTH_ERRS = (401, 403)
_LOGGER = logging.getLogger(__name__)
DEFAULT_API_TOKEN = (
'cFJFcXVnYWJSZXRyZTRFc3RldGhlcnVmcmVQdW1hbUV4dWNyRU'
'h1YzptM2ZydXBSZXRSZXN3ZXJFQ2hBUHJFOTZxYWtFZHI0Vg=='
)
class Life360:
"""Life360 API"""
def __init__(self, timeout=None, max_retries=None, authorization=None):
self._timeout = timeout
self._max_retries = max_retries
self._authorization = authorization
self._session = None
def _get_session(self):
if not self._session:
self._session = requests.Session()
if self._max_retries:
self._session.mount(_PROTOCOL,
requests.adapters.HTTPAdapter(
max_retries=self._max_retries))
self._session.headers.update(
{'Accept': 'application/json', 'cache-control': 'no-cache'})
return self._session
def get_authorization(self, username, password,
api_token=DEFAULT_API_TOKEN):
"""Obtain Authorization header value."""
data = {
'grant_type': 'password',
'username': username,
'password': password,
}
try:
resp = self._get_session().post(
_TOKEN_URL, data=data, timeout=self._timeout,
headers={'Authorization': 'Basic ' + api_token})
resp.raise_for_status()
except requests.RequestException as error:
_LOGGER.debug(
'Error while getting authorization token: %s', error)
# Try to return a useful error message.
try:
err_msg = resp.json()['errorMessage']
except (json.JSONDecodeError, ValueError, KeyError):
raise CommError(error)
if resp.status_code in _AUTH_ERRS and 'login' in err_msg.lower():
raise LoginError(err_msg)
raise CommError(err_msg)
try:
resp = resp.json()
self._authorization = ' '.join(
[resp['token_type'], resp['access_token']])
except (json.JSONDecodeError, ValueError, KeyError):
raise Life360Error(
'Unexpected response while getting authorization token: '
'{}: {}'.format(resp.status_code, resp.text))
return self._authorization
def _get(self, url):
if not self._authorization:
raise Life360Error('No authorization. Call get_authorization')
try:
resp = self._get_session().get(url, timeout=self._timeout,
headers={'Authorization': self._authorization})
if resp.status_code in (401, 403):
_LOGGER.debug('Error %i %s. Reauthorize',
resp.status_code, resp.reason)
raise LoginError('Reauthorize')
resp.raise_for_status()
return resp.json()
except (requests.RequestException, json.JSONDecodeError) as error:
_LOGGER.debug('Error while getting: %s: %s', url, error)
if isinstance(error, requests.RequestException):
raise CommError(error)
raise Life360Error(
'Unexpected response to query: {}: {}'.format(
resp.status_code, resp.text))
def get_circles(self):
"""Get basic data about all Circles."""
return self._get(_CIRCLES_URL)['circles']
def get_circle(self, circle_id):
"""Get details for given Circle."""
return self._get(_CIRCLE_URL.format(circle_id))
def get_circle_members(self, circle_id):
"""Get details for Members in given Circle."""
return self._get(_CIRCLE_MEMBERS_URL.format(circle_id))['members']
def get_circle_places(self, circle_id):
"""Get details for Places in given Circle."""
return self._get(_CIRCLE_PLACES_URL.format(circle_id))['places']
| 37.735043 | 77 | 0.604757 | 3,754 | 0.850283 | 0 | 0 | 0 | 0 | 0 | 0 | 956 | 0.216535 |
57c14c8998061fad84c8b010eef9803262de092d | 328 | py | Python | pandas_selectable/tests/conftest.py | jseabold/pandas-select | 0dc5fac465db8348bf3d1cc69d9f7c4fe28896e1 | [
"BSD-3-Clause"
] | 28 | 2020-09-08T04:38:01.000Z | 2022-02-05T21:47:52.000Z | pandas_selectable/tests/conftest.py | jseabold/pandas-select | 0dc5fac465db8348bf3d1cc69d9f7c4fe28896e1 | [
"BSD-3-Clause"
] | 8 | 2020-09-04T21:29:57.000Z | 2021-11-17T16:44:42.000Z | pandas_selectable/tests/conftest.py | jseabold/pandas-select | 0dc5fac465db8348bf3d1cc69d9f7c4fe28896e1 | [
"BSD-3-Clause"
] | null | null | null | import numpy as np
import pandas as pd
import pytest
@pytest.fixture
def dta():
return pd.DataFrame.from_dict(
{
'A': np.arange(1, 16),
'B': pd.date_range('2020-01-01', periods=15),
'C': ['A', 'B', 'C'] * 5,
'D': pd.Categorical(['A', 'B', 'C'] * 5),
}
)
| 20.5 | 57 | 0.466463 | 0 | 0 | 0 | 0 | 272 | 0.829268 | 0 | 0 | 42 | 0.128049 |
57c2c77af5f13ed7cf14e66f21d8a57ff936dd88 | 2,976 | py | Python | xsoccer/analysis/management/commands/analysis4.py | awyrough/xsoccer | 5f3d5f73ede21f6ba3baa0089a821b0a8d151b8d | [
"MIT"
] | null | null | null | xsoccer/analysis/management/commands/analysis4.py | awyrough/xsoccer | 5f3d5f73ede21f6ba3baa0089a821b0a8d151b8d | [
"MIT"
] | null | null | null | xsoccer/analysis/management/commands/analysis4.py | awyrough/xsoccer | 5f3d5f73ede21f6ba3baa0089a821b0a8d151b8d | [
"MIT"
] | null | null | null | """
Objectives:
- Which players pass together the most?
- What types of position combintations are most frequent in pass-sequences?
"""
"""
Sample Run Script: python manage.py analysis3 --team_uuid="t1326"
--print_to_csv
python manage.py analysis4 --team_uuid="t1326" --start_date="2016-07-01"
python manage.py analysis4 --team_uuid="t1326" --start_date="2016-01-01" --end_date="2016-07-01"
"""
import datetime
import csv
import os
import time
from django.core.management.base import BaseCommand, CommandError
from eventstatistics.models import EventStatistic
from qualifiers.models import Qualifier
from games.models import Game
from lineups.models import Lineup
from players.models import Player
from playerstatistics.models import PlayerStatistic
from salaries.models import Salary
from statistictypes.models import StatisticType
from teams.models import Team
from teamstatistics.models import TeamStatistic
from venues.models import Venue
import utils.analysis as ua
import utils.f24_analysis as uf24
class Command(BaseCommand):
help = 'Pull the statistics of a team across a time-range; classify by outcome'
def add_arguments(self,parser):
# add optional print to csv flag
parser.add_argument(
"--team_uuid",
dest="team_uuid",
default="",
help="Desried Opta team ID",
)
parser.add_argument(
"--print_to_csv",
action="store_true",
dest="print_to_csv",
default=False,
help="save file?",
)
parser.add_argument(
"--start_date",
dest="start_date",
default='1900-01-01',
help="Example format: 1900-01-31",
)
parser.add_argument(
"--end_date",
dest="end_date",
default='2900-01-01',
help="Example format: 1900-01-31",
)
def handle(self,*args,**options):
#handle import parameters
if not options["team_uuid"]:
raise Exception("Opta team ID is needed")
is_print_to_csv = options["print_to_csv"]
arg_team_uuid = str(options["team_uuid"])
arg_start_date = str(options["start_date"])
arg_end_date = str(options["end_date"])
arg_start_date = datetime.datetime.strptime(arg_start_date, "%Y-%m-%d")
arg_end_date = datetime.datetime.strptime(arg_end_date, "%Y-%m-%d")
#load team
db_team = Team.objects.get(uuid=arg_team_uuid)
#pull list of games tied to the team
team_games = ua.team_list_games(db_team, arg_start_date, arg_end_date)
for game in team_games:
# print "\nAnalyzing Passes for %s in %s" % (db_team, str(game))
for item in uf24.identify_shots(game, db_team):
#print item
# print "\n"
# print "start: backtrack function"
backtracked = uf24.backtrack(item)
# for i in backtracked:
# print " " + str(i)
# print "end: backtrack function"
# print "start: parse backtrack"
uf24.parse_backtrack(item, backtracked)
# print "end: parse backtrack"
| 30.367347 | 102 | 0.685148 | 1,947 | 0.654234 | 0 | 0 | 0 | 0 | 0 | 0 | 1,182 | 0.397177 |
57c4c8bc27d5ede3ee5ab749d40ffd70c1be34a7 | 1,474 | py | Python | api/classes/portfolio.py | alexander-schilling/fintual_test | 3a8a3cd17dea4a7a1203eb1cd58a2af411700207 | [
"MIT"
] | null | null | null | api/classes/portfolio.py | alexander-schilling/fintual_test | 3a8a3cd17dea4a7a1203eb1cd58a2af411700207 | [
"MIT"
] | null | null | null | api/classes/portfolio.py | alexander-schilling/fintual_test | 3a8a3cd17dea4a7a1203eb1cd58a2af411700207 | [
"MIT"
] | null | null | null | from .stock import Stock
class Portfolio:
def __init__(self, assets):
self.stocks = []
self.__populate_stocks(assets)
def get_stock(self, stock_name):
for stock in self.stocks:
if stock.name == stock_name:
return stock
return None
def get_profit(self, start_date, end_date):
initial_value = 0
final_value = 0
for stock in self.stocks:
initial_value += stock.get_price_from_date(start_date)
final_value += stock.get_price_from_date(end_date)
return self.__calculate_annualized_return(initial_value, final_value)
def add_stock(self, stock_name, stock_id):
self.stocks.append(Stock(stock_name, stock_id))
def remove_stock(self, stock_name):
for stock in self.stocks:
if stock.name == stock_name:
self.stocks.remove(stock)
def toggle_stock(self, stock_name, stock_id):
stock = self.get_stock(stock_name)
if stock is not None:
self.remove_stock(stock_name)
else:
self.add_stock(stock_name, stock_id)
def __populate_stocks(self, assets):
for asset in assets:
self.stocks.append(Stock(asset["name"], asset["id"]))
def __calculate_annualized_return(self, initial_value, final_value):
try:
return (final_value - initial_value) / initial_value * 100
except:
return 0
| 28.901961 | 77 | 0.627544 | 1,447 | 0.981682 | 0 | 0 | 0 | 0 | 0 | 0 | 10 | 0.006784 |
57c64dbce81aa32c7cfedf4dddca84cc3b07269f | 4,694 | py | Python | examples/ConsumptionSaving/example_ConsMedModel.py | HsinYiHung/HARK_HY | 086c46af5bd037fe1ced6906c6ea917ed58b134f | [
"Apache-2.0"
] | null | null | null | examples/ConsumptionSaving/example_ConsMedModel.py | HsinYiHung/HARK_HY | 086c46af5bd037fe1ced6906c6ea917ed58b134f | [
"Apache-2.0"
] | null | null | null | examples/ConsumptionSaving/example_ConsMedModel.py | HsinYiHung/HARK_HY | 086c46af5bd037fe1ced6906c6ea917ed58b134f | [
"Apache-2.0"
] | null | null | null | # %%
from HARK.utilities import CRRAutility_inv
from time import time
import matplotlib.pyplot as plt
import numpy as np
from HARK.ConsumptionSaving.ConsMedModel import MedShockConsumerType
# %%
mystr = lambda number: "{:.4f}".format(number)
# %%
do_simulation = True
# %% [markdown]
# This module defines consumption-saving models in which an agent faces medical expenditures and the optimal spending is shared between consumption and medical care.
#
# In this model, the agent consumes two goods: an ordinary composite consumption and medical care, which yield CRRAutility, and the coefficients on the goods might be different. The agent expects to receive shocks to permanent and transitory income as well as multiplicative shocks to utility from medical care (medical need shocks).
# %% [markdown]
# The agent's problem can be written in Bellman form as:
#
# \begin{eqnarray*}
# v_t(M_t,p_t, medShk_t) &=& \max_{c_t, med_t} U(c_t, med_t) + \beta (1-\mathsf{D}_{t+1}) \mathbb{E} [v_{t+1}(M_{t+1}, p_{t+1}, medShk_{t+1})], \\
# a_t &=& M_t - c_t, \\
# a_t &\geq& \underline{a}, \\
# M_{t+1} &=& R a_t + \theta_{t+1}, \\
# p_{t+1} &=& \gimel_{t+1}(p_t)\psi_{t+1}, \\
# medShk_{t+1} &=& ,\\
# \psi_t \sim F_{\psi t} &\qquad& \theta_t \sim F_{\theta t}, \mathbb{E} [F_{\psi t}] = 1, \\
# U(c, med) &=& \frac{c^{1-\rho}}{1-\rho}\frac{med^{1-\rho_{med}}}{1-\rho_{med}}.
# \end{eqnarray*}
# %% [markdown]
# The one period problem for this model is solved by the function $\texttt{solveConsMedShock}$, which creates an instance of the class $\texttt{ConsMedShockSolver}$. The class $\texttt{MedShockConsumerType}$ extends $\texttt{PersistentShockConsumerType}$ from $\texttt{GenIncProcessModel}$ to represents agents in this model.
# %%
# Make and solve an example medical shocks consumer type
MedicalExample = MedShockConsumerType()
t_start = time()
MedicalExample.solve()
t_end = time()
print("Solving a medical shocks consumer took " + mystr(t_end - t_start) + " seconds.")
# %%
# Plot the consumption function
M = np.linspace(0, 30, 300)
pLvl = 1.0
P = pLvl * np.ones_like(M)
for j in range(MedicalExample.MedShkDstn[0].pmf.size):
MedShk = MedicalExample.MedShkDstn[0].X[j] * np.ones_like(M)
M_temp = M + MedicalExample.solution[0].mLvlMin(pLvl)
C = MedicalExample.solution[0].cFunc(M_temp, P, MedShk)
plt.plot(M_temp, C)
print("Consumption function by medical need shock (constant permanent income)")
plt.show()
# %%
# Plot the medical care function
for j in range(MedicalExample.MedShkDstn[0].pmf.size):
MedShk = MedicalExample.MedShkDstn[0].X[j] * np.ones_like(M)
Med = MedicalExample.solution[0].MedFunc(M_temp, P, MedShk)
plt.plot(M_temp, Med)
print("Medical care function by medical need shock (constant permanent income)")
plt.ylim([0, 20])
plt.show()
# %%
# Plot the savings function
for j in range(MedicalExample.MedShkDstn[0].pmf.size):
MedShk = MedicalExample.MedShkDstn[0].X[j] * np.ones_like(M)
Sav = (
M_temp
- MedicalExample.solution[0].cFunc(M_temp, P, MedShk)
- MedicalExample.MedPrice[0]
* MedicalExample.solution[0].MedFunc(M_temp, P, MedShk)
)
plt.plot(M_temp, Sav)
print("End of period savings by medical need shock (constant permanent income)")
plt.show()
# %%
# Plot the marginal value function
M = np.linspace(0.0, 30, 300)
for p in range(MedicalExample.pLvlGrid[0].size):
pLvl = MedicalExample.pLvlGrid[0][p]
M_temp = pLvl * M + MedicalExample.solution[0].mLvlMin(pLvl)
P = pLvl * np.ones_like(M)
vP = MedicalExample.solution[0].vPfunc(M_temp, P) ** (-1.0 / MedicalExample.CRRA)
plt.plot(M_temp, vP)
print("Marginal value function (pseudo inverse)")
plt.show()
# %%
if MedicalExample.vFuncBool:
# Plot the value function
M = np.linspace(0.0, 1, 300)
for p in range(MedicalExample.pLvlGrid[0].size):
pLvl = MedicalExample.pLvlGrid[0][p]
M_temp = pLvl * M + MedicalExample.solution[0].mLvlMin(pLvl)
P = pLvl * np.ones_like(M)
v = CRRAutility_inv(
MedicalExample.solution[0].vFunc(M_temp, P), gam=MedicalExample.CRRA
)
plt.plot(M_temp, v)
print("Value function (pseudo inverse)")
plt.show()
# %%
if do_simulation:
t_start = time()
MedicalExample.T_sim = 100
MedicalExample.track_vars = ["mLvlNow", "cLvlNow", "MedNow"]
MedicalExample.makeShockHistory()
MedicalExample.initializeSim()
MedicalExample.simulate()
t_end = time()
print(
"Simulating "
+ str(MedicalExample.AgentCount)
+ " agents for "
+ str(MedicalExample.T_sim)
+ " periods took "
+ mystr(t_end - t_start)
+ " seconds."
)
# %%
| 36.671875 | 333 | 0.679165 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,125 | 0.452706 |
57c8b90994148c8460b99ab3bc8d5a19736e8281 | 25,325 | py | Python | cogs/general.py | xthecoolboy/MizaBOT | fb8a449bde29fdf1d32b5a597e48e6b3463dd867 | [
"MIT"
] | null | null | null | cogs/general.py | xthecoolboy/MizaBOT | fb8a449bde29fdf1d32b5a597e48e6b3463dd867 | [
"MIT"
] | null | null | null | cogs/general.py | xthecoolboy/MizaBOT | fb8a449bde29fdf1d32b5a597e48e6b3463dd867 | [
"MIT"
] | null | null | null | import discord
from discord.ext import commands
import asyncio
import aiohttp
import random
from datetime import datetime, timedelta
import math
import json
# #####################################################################################
# math parser used by $calc
class MathParser:
def __init__(self):
self.expression = ""
self.index = 0
self.vars = {}
self.funcs = ['cos', 'sin', 'tan', 'acos', 'asin', 'atan', 'cosh', 'sinh', 'tanh', 'acosh', 'asinh', 'atanh', 'exp', 'ceil', 'abs', 'factorial', 'floor', 'round', 'trunc', 'log', 'log2', 'log10', 'sqrt', 'rad', 'deg']
def evaluate(self, expression = "", vars={}):
self.expression = expression.replace(' ', '').replace('\t', '').replace('\n', '').replace('\r', '')
self.index = 0
self.vars = {
'pi' : 3.141592653589793,
'e' : 2.718281828459045
}
self.vars = {**self.vars, **vars}
for func in self.funcs:
if func in self.vars: raise Exception("Variable name '{}' can't be used".format(func))
value = float(self.parse())
if self.isNotDone(): raise Exception("Unexpected character '{}' found at index {}".format(self.peek(), self.index))
epsilon = 0.0000000001
if int(value) == value: return int(value)
elif int(value + epsilon) != int(value):
return int(value + epsilon)
elif int(value - epsilon) != int(value):
return int(value)
return value
def isNotDone(self):
return self.index < len(self.expression)
def peek(self):
return self.expression[self.index:self.index + 1]
def parse(self):
values = [self.multiply()]
while True:
c = self.peek()
if c in ['+', '-']:
self.index += 1
if c == '-': values.append(- self.multiply())
else: values.append(self.multiply())
else:
break
return sum(values)
def multiply(self):
values = [self.parenthesis()]
while True:
c = self.peek()
if c in ['*', 'x']:
self.index += 1
values.append(self.parenthesis())
elif c in ['/', '%']:
div_index = self.index
self.index += 1
denominator = self.parenthesis()
if denominator == 0:
raise Exception("Division by 0 occured at index {}".format(div_index))
if c == '/': values.append(1.0 / denominator)
else: values.append(1.0 % denominator)
elif c == '^':
self.index += 1
exponent = self.parenthesis()
values[-1] = values[-1] ** exponent
elif c == '!':
self.index += 1
values[-1] = math.factorial(values[-1])
else:
break
value = 1.0
for factor in values: value *= factor
return value
def parenthesis(self):
if self.peek() == '(':
self.index += 1
value = self.parse()
if self.peek() != ')': raise Exception("No closing parenthesis found at character {}".format(self.index))
self.index += 1
return value
else:
return self.negative()
def negative(self):
if self.peek() == '-':
self.index += 1
return -1 * self.parenthesis()
else:
return self.value()
def value(self):
if self.peek() in '0123456789.':
return self.number()
else:
return self.variable_or_function()
def variable_or_function(self):
var = ''
while self.isNotDone():
c = self.peek()
if c.lower() in '_abcdefghijklmnopqrstuvwxyz0123456789':
var += c
self.index += 1
else:
break
value = self.vars.get(var, None)
if value == None:
if var not in self.funcs: raise Exception("Unrecognized variable '{}'".format(var))
else:
param = self.parenthesis()
if var == 'cos': value = math.cos(param)
elif var == 'sin': value = math.sin(param)
elif var == 'tan': value = math.tan(param)
elif var == 'acos': value = math.acos(param)
elif var == 'asin': value = math.asin(param)
elif var == 'atan': value = math.atan(param)
elif var == 'cosh': value = math.cosh(param)
elif var == 'sinh': value = math.sinh(param)
elif var == 'tanh': value = math.tanh(param)
elif var == 'acosh': value = math.acosh(param)
elif var == 'asinh': value = math.asinh(param)
elif var == 'atanh': value = math.atanh(param)
elif var == 'exp': value = math.exp(param)
elif var == 'ceil': value = math.ceil(param)
elif var == 'floor': value = math.floor(param)
elif var == 'round': value = math.floor(param)
elif var == 'factorial': value = math.factorial(param)
elif var == 'abs': value = math.fabs(param)
elif var == 'trunc': value = math.trunc(param)
elif var == 'log':
if param <= 0: raise Exception("Can't evaluate the logarithm of '{}'".format(param))
value = math.log(param)
elif var == 'log2':
if param <= 0: raise Exception("Can't evaluate the logarithm of '{}'".format(param))
value = math.log2(param)
elif var == 'log10':
if param <= 0: raise Exception("Can't evaluate the logarithm of '{}'".format(param))
value = math.log10(param)
elif var == 'sqrt': value = math.sqrt(param)
elif var == 'rad': value = math.radians(param)
elif var == 'deg': value = math.degrees(param)
else: raise Exception("Unrecognized function '{}'".format(var))
return float(value)
def number(self):
strValue = ''
decimal_found = False
c = ''
while self.isNotDone():
c = self.peek()
if c == '.':
if decimal_found:
raise Exception("Found an extra period in a number at character {}".format(self.index))
decimal_found = True
strValue += '.'
elif c in '0123456789':
strValue += c
else:
break
self.index += 1
if len(strValue) == 0:
if c == '': raise Exception("Unexpected end found")
else: raise Exception("A number was expected at character {} but instead '{}' was found".format(self.index, char))
return float(strValue)
# #####################################################################################
# Cogs
class General(commands.Cog):
"""General commands."""
def __init__(self, bot):
self.bot = bot
self.color = 0x8fe3e8
def startTasks(self):
self.bot.runTask('reminder', self.remindertask)
async def remindertask(self):
while True:
if self.bot.exit_flag: return
try:
c = self.bot.getJST() + timedelta(seconds=30)
for r in list(self.bot.reminders.keys()):
di = 0
u = self.bot.get_user(int(r))
if u is None: continue
while di < len(self.bot.reminders[r]):
if c > self.bot.reminders[r][di][0]:
try:
await u.send(embed=self.bot.buildEmbed(title="Reminder", description=self.bot.reminders[r][di][1]))
except Exception as e:
await self.bot.sendError('remindertask', "User: {}\nReminder: {}\nError: {}".format(u.name, self.bot.reminders[r][di][1], e))
self.bot.reminders[r].pop(di)
self.bot.savePending = True
else:
di += 1
if len(self.bot.reminders[r]) == 0:
self.bot.reminders.pop(r)
self.bot.savePending = True
except asyncio.CancelledError:
await self.bot.sendError('remindertask', 'cancelled')
return
except Exception as e:
await self.bot.sendError('remindertask', str(e))
await asyncio.sleep(200)
await asyncio.sleep(40)
def isDisabled(): # for decorators
async def predicate(ctx):
return False
return commands.check(predicate)
def isAuthorized(): # for decorators
async def predicate(ctx):
return ctx.bot.isAuthorized(ctx)
return commands.check(predicate)
# get a 4chan thread
async def get4chan(self, board : str, search : str): # be sure to not abuse it, you are not supposed to call the api more than once per second
try:
search = search.lower()
url = 'http://a.4cdn.org/{}/catalog.json'.format(board) # board catalog url
async with aiohttp.ClientSession() as session:
async with session.get(url) as r:
if r.status == 200:
data = await r.json()
threads = []
for p in data:
for t in p["threads"]:
try:
if t["sub"].lower().find(search) != -1 or t["com"].lower().find(search) != -1:
threads.append([t["no"], t["replies"]]) # store the thread ids matching our search word
except:
pass
threads.sort(reverse=True)
return threads
except:
return []
@commands.command(no_pm=True, cooldown_after_parsing=True)
@isAuthorized()
async def roll(self, ctx, dice : str = ""):
"""Rolls a dice in NdN format."""
try:
rolls, limit = map(int, dice.split('d'))
result = ", ".join(str(random.randint(1, limit)) for r in range(rolls))
await ctx.send(embed=self.bot.buildEmbed(title="{}'s dice Roll(s)".format(ctx.message.author.display_name), description=result, color=self.color))
except:
await ctx.send(embed=self.bot.buildEmbed(title="Format has to be in NdN", footer="example: roll 2d6", color=self.color))
@commands.command(no_pm=True, cooldown_after_parsing=True, aliases=['choice'])
@isAuthorized()
@commands.cooldown(2, 10, commands.BucketType.guild)
async def choose(self, ctx, *, choices : str ):
"""Chooses between multiple choices.
Use quotes if one of your choices contains spaces.
Example: $choose I'm Alice ; Bob"""
try:
possible = choices.split(";")
if len(possible) < 2: raise Exception()
await ctx.send(embed=self.bot.buildEmbed(title="{}, I choose".format(ctx.message.author.display_name), description=random.choice(possible), color=self.color))
except:
await ctx.send(embed=self.bot.buildEmbed(title="Give me a list of something to choose from 😔, separated by ';'", color=self.color))
@commands.command(no_pm=True, cooldown_after_parsing=True, aliases=['math'])
@commands.cooldown(2, 10, commands.BucketType.guild)
async def calc(self, ctx, *terms : str):
"""Process a mathematical expression
You can define a variable by separating using a comma.
Some functions are also available.
Example: cos(a + b) / c, a = 1, b=2,c = 3"""
try:
m = " ".join(terms).split(",")
d = {}
for i in range(1, len(m)): # process the variables if any
x = m[i].replace(" ", "").split("=")
if len(x) == 2: d[x[0]] = float(x[1])
else: raise Exception('')
msg = "{} = **{}**".format(m[0], MathParser().evaluate(m[0], d))
if len(d) > 0:
msg += "\nwith:\n"
for k in d:
msg += "{} = {}\n".format(k, d[k])
await ctx.send(embed=self.bot.buildEmbed(title="Calculator", description=msg, color=self.color))
except Exception as e:
await ctx.send(embed=self.bot.buildEmbed(title="Error", description=str(e), color=self.color))
@commands.command(no_pm=True, cooldown_after_parsing=True)
@commands.cooldown(1, 5, commands.BucketType.guild)
async def jst(self, ctx):
"""Post the current time, JST timezone"""
await ctx.send(embed=self.bot.buildEmbed(title="{} {:%Y/%m/%d %H:%M} JST".format(self.bot.getEmote('clock'), self.bot.getJST()), color=self.color))
@commands.command(no_pm=True, cooldown_after_parsing=True, alias=['inrole', 'rolestat'])
@isAuthorized()
async def roleStats(self, ctx, *name : str):
"""Search how many users have a matching role
use quotes if your match contain spaces
add 'exact' at the end to force an exact match"""
g = ctx.author.guild
i = 0
if len(name) > 0 and name[-1] == "exact":
exact = True
name = name[:-1]
else:
exact = False
name = ' '.join(name)
for member in g.members:
for r in member.roles:
if r.name == name or (exact == False and r.name.lower().find(name.lower()) != -1):
i += 1
if exact != "exact":
await ctx.send(embed=self.bot.buildEmbed(title="Roles containing: {}".format(name), description="{} user(s)".format(i), thumbnail=g.icon_url, footer="on server {}".format(g.name), color=self.color))
else:
await ctx.send(embed=self.bot.buildEmbed(title="Roles matching: {}".format(name), description="{} user(s)".format(i), thumbnail=g.icon_url, footer="on server {}".format(g.name), color=self.color))
@commands.command(no_pm=True, cooldown_after_parsing=True, aliases=['hgg2d'])
@commands.cooldown(1, 10, commands.BucketType.default)
async def hgg(self, ctx):
"""Post the latest /hgg2d/ threads"""
if not ctx.channel.is_nsfw():
await ctx.send(embed=self.bot.buildEmbed(title=':underage: NSFW channels only'))
return
threads = await self.get4chan('vg', '/hgg2d/')
if len(threads) > 0:
msg = ""
for t in threads:
msg += '🔞 https://boards.4channel.org/vg/thread/{} ▫️ *{} replies*\n'.format(t[0], t[1])
await ctx.send(embed=self.bot.buildEmbed(title="/hgg2d/ latest thread(s)", description=msg, footer="Good fap, fellow 4channeler", color=self.color))
else:
await ctx.send(embed=self.bot.buildEmbed(title="/hgg2d/ Error", description="I couldn't find a single /hgg2d/ thread 😔", color=self.color))
@commands.command(no_pm=True, cooldown_after_parsing=True, aliases=['thread'])
@commands.cooldown(1, 3, commands.BucketType.default)
async def gbfg(self, ctx):
"""Post the latest /gbfg/ threads"""
threads = await self.get4chan('vg', '/gbfg/')
if len(threads) > 0:
msg = ""
for t in threads:
msg += ':poop: https://boards.4channel.org/vg/thread/{} ▫️ *{} replies*\n'.format(t[0], t[1])
await ctx.send(embed=self.bot.buildEmbed(title="/gbfg/ latest thread(s)", description=msg, footer="Have fun, fellow 4channeler", color=self.color))
else:
await ctx.send(embed=self.bot.buildEmbed(title="/gbfg/ Error", description="I couldn't find a single /gbfg/ thread 😔", color=self.color))
@commands.command(no_pm=True, cooldown_after_parsing=True, name='4chan')
@commands.cooldown(1, 3, commands.BucketType.default)
async def _4chan(self, ctx, board : str, *, term : str):
"""Search 4chan threads"""
nsfw = ['b', 'r9k', 'pol', 'bant', 'soc', 's4s', 's', 'hc', 'hm', 'h', 'e', 'u', 'd', 'y', 't', 'hr', 'gif', 'aco', 'r']
board = board.lower()
if board in nsfw and not ctx.channel.is_nsfw():
await ctx.send(embed=self.bot.buildEmbed(title=":underage: The board `{}` is restricted to NSFW channels".format(board)))
return
threads = await self.get4chan(board, term)
if len(threads) > 0:
msg = ""
for t in threads:
msg += ':four_leaf_clover: https://boards.4channel.org/{}/thread/{} ▫️ *{} replies*\n'.format(board, t[0], t[1])
await ctx.send(embed=self.bot.buildEmbed(title="4chan Search result", description=msg, footer="Have fun, fellow 4channeler", color=self.color))
else:
await ctx.send(embed=self.bot.buildEmbed(title="4chan Search result", description="No matching threads found", color=self.color))
@commands.command(no_pm=True, cooldown_after_parsing=True, aliases=['reminder'])
@commands.cooldown(1, 3, commands.BucketType.user)
async def remind(self, ctx, duration : str, *, msg : str):
"""Remind you of something at the specified time (±30 seconds precision)
<duration> format: XdXhXmXs for day, hour, minute, second, each are optionals"""
id = str(ctx.author.id)
if id not in self.bot.reminders:
self.bot.reminders[id] = []
if len(self.bot.reminders[id]) >= 5 and ctx.author.id != self.bot.ids.get('owner', -1):
await ctx.send(embed=self.bot.buildEmbed(title="Reminder Error", description="Sorry, I'm limited to 5 reminders per user 🙇", color=self.color))
return
try:
d = self.bot.makeTimedelta(duration)
if d is None: raise Exception()
except:
await ctx.send(embed=self.bot.buildEmbed(title="Reminder Error", description="Invalid duration string `{}`, format is `NdNhNm`".format(duration), color=self.color))
return
if msg == "":
await ctx.send(embed=self.bot.buildEmbed(title="Reminder Error", description="Tell me what I'm supposed to remind you 🤔", color=self.color))
return
if len(msg) > 200:
await ctx.send(embed=self.bot.buildEmbed(title="Reminder Error", description="Reminders are limited to 200 characters", color=self.color))
return
try:
self.bot.reminders[id].append([datetime.utcnow().replace(microsecond=0) + timedelta(seconds=32400) + d, msg]) # keep JST
self.bot.savePending = True
await ctx.message.add_reaction('✅') # white check mark
except:
await ctx.send(embed=self.bot.buildEmbed(title="Reminder Error", footer="I have no clues about what went wrong", color=self.color))
@commands.command(no_pm=True, cooldown_after_parsing=True, aliases=['rl', 'reminderlist'])
@commands.cooldown(1, 6, commands.BucketType.user)
async def remindlist(self, ctx):
"""Post your current list of reminders"""
id = str(ctx.author.id)
if id not in self.bot.reminders or len(self.bot.reminders[id]) == 0:
await ctx.send(embed=self.bot.buildEmbed(title="Reminder Error", description="You don't have any reminders", color=self.color))
else:
embed = discord.Embed(title="{}'s Reminder List".format(ctx.author.display_name), color=random.randint(0, 16777216)) # random color
embed.set_thumbnail(url=ctx.author.avatar_url)
for i in range(0, len(self.bot.reminders[id])):
embed.add_field(name="#{} ▫️ {:%Y/%m/%d %H:%M} JST".format(i, self.bot.reminders[id][i][0]), value=self.bot.reminders[id][i][1], inline=False)
await ctx.send(embed=embed)
@commands.command(no_pm=True, cooldown_after_parsing=True, aliases=['rd', 'reminderdel'])
@commands.cooldown(2, 3, commands.BucketType.user)
async def reminddel(self, ctx, rid : int):
"""Delete one of your reminders"""
id = str(ctx.author.id)
if id not in self.bot.reminders or len(self.bot.reminders[id]) == 0:
await ctx.send(embed=self.bot.buildEmbed(title="Reminder Error", description="You don't have any reminders", color=self.color))
else:
if rid < 0 or rid >= len(self.bot.reminders[id]):
await ctx.send(embed=self.bot.buildEmbed(title="Reminder Error", description="Invalid id `{}`".format(rid), color=self.color))
else:
self.bot.reminders[id].pop(rid)
if len(self.bot.reminders[id]) == 0:
self.bot.reminders.pop(id)
self.bot.savePending = True
await ctx.message.add_reaction('✅') # white check mark
@commands.command(no_pm=True, cooldown_after_parsing=True)
@isAuthorized()
@commands.cooldown(1, 1, commands.BucketType.user)
async def iam(self, ctx, *, role_name : str):
"""Add a role to you that you choose. Role must be on a list of self-assignable roles."""
g = str(ctx.guild.id)
roles = self.bot.assignablerole.get(g, {})
if role_name.lower() not in roles:
await ctx.message.add_reaction('❎') # negative check mark
else:
id = roles[role_name.lower()]
r = ctx.guild.get_role(id)
if r is None: # role doesn't exist anymore
await ctx.message.add_reaction('❎') # negative check mark
self.bot.assignablerole[g].pop(role_name.lower())
if len(self.bot.assignablerole[g]) == 0:
self.bot.assignablerole.pop(g)
self.bot.savePending = True
else:
try:
await ctx.author.add_roles(r)
except:
pass
await ctx.message.add_reaction('✅') # white check mark
@commands.command(no_pm=True, cooldown_after_parsing=True, aliases=['iamn'])
@isAuthorized()
@commands.cooldown(1, 1, commands.BucketType.user)
async def iamnot(self, ctx, *, role_name : str):
"""Remove a role to you that you choose. Role must be on a list of self-assignable roles."""
g = str(ctx.guild.id)
roles = self.bot.assignablerole.get(g, {})
if role_name.lower() not in roles:
await ctx.message.add_reaction('❎') # negative check mark
else:
id = roles[role_name.lower()]
r = ctx.guild.get_role(id)
if r is None: # role doesn't exist anymore
await ctx.message.add_reaction('❎') # negative check mark
self.bot.assignablerole[g].pop(role_name.lower())
if len(self.bot.assignablerole[g]) == 0:
self.bot.assignablerole.pop(g)
self.bot.savePending = True
else:
try:
await ctx.author.remove_roles(r)
except:
pass
await ctx.message.add_reaction('✅') # white check mark
@commands.command(no_pm=True, cooldown_after_parsing=True)
@isAuthorized()
@commands.cooldown(1, 5, commands.BucketType.guild)
async def lsar(self, ctx, page : int = 1):
"""List the self-assignable roles available in this server"""
g = str(ctx.guild.id)
if page < 1: page = 1
roles = self.bot.assignablerole.get(str(ctx.guild.id), {})
if len(roles) == 0:
await ctx.send(embed=self.bot.buildEmbed(title="Error", description="No self assignable roles available on this server", color=self.color))
return
if (page -1) >= len(roles) // 20:
page = ((len(roles) - 1) // 20) + 1
fields = []
count = 0
for k in list(roles.keys()):
if count < (page - 1) * 20:
count += 1
continue
if count >= page * 20:
break
if count % 10 == 0:
fields.append({'name':'{} '.format(self.bot.getEmote(str(len(fields)+1))), 'value':'', 'inline':True})
r = ctx.guild.get_role(roles[k])
if r is not None:
fields[-1]['value'] += '{}\n'.format(k)
else:
self.bot.assignablerole[str(ctx.guild.id)].pop(k)
self.bot.savePending = True
count += 1
await ctx.send(embed=self.bot.buildEmbed(title="Self Assignable Roles", fields=fields, footer="Page {}/{}".format(page, 1+len(roles)//20), color=self.color)) | 48.701923 | 226 | 0.536387 | 24,989 | 0.984672 | 0 | 0 | 14,858 | 0.585468 | 15,556 | 0.612972 | 4,861 | 0.191544 |
57ca6b765a520ecf380512aee08b9a30756ae5fb | 1,481 | py | Python | 2019-2020/MATH_1301_Python/Zork/barriers.py | TSoGiants/Foundations | 4546c9ee7be802e4c48ab8b1bab60869ea89e6a6 | [
"Unlicense"
] | null | null | null | 2019-2020/MATH_1301_Python/Zork/barriers.py | TSoGiants/Foundations | 4546c9ee7be802e4c48ab8b1bab60869ea89e6a6 | [
"Unlicense"
] | null | null | null | 2019-2020/MATH_1301_Python/Zork/barriers.py | TSoGiants/Foundations | 4546c9ee7be802e4c48ab8b1bab60869ea89e6a6 | [
"Unlicense"
] | null | null | null | #####################
### Base classes. ###
#####################
class barrier:
synonyms = ["wall"]
m_description = "There is a barrier in the way."
def __init__(self, passable=False):
self.passable = passable
def __str__(self):
return self.m_description
def __repr__(self):
return self.synonyms[0]
class passage(barrier):
synonyms = ["clearing"]
m_description = "There is a clearing ahead."
def __init__(self, passable=True):
self.passable = passable
class door(barrier):
synonyms = ["door"]
m_description = "There is door ahead."
m_already_open = "The door is already opened."
m_on_open = "You opened the door."
m_already_closed = "The door is already closed."
m_on_close = "You closed the door."
def open(self):
if self.passable:
return self.m_already_open
else:
self.passable = True
return self.m_on_open
def close(self):
if not self.passable:
return self.m_already_closed
else:
self.passable = False
return self.m_on_close
def __str__(self):
if self.passable:
s = "opened"
else:
s = "closed"
s = f"{self.m_description} It is currently {s}."
return s
######################
### Child classes. ###
###################### | 25.101695 | 56 | 0.519919 | 1,311 | 0.885213 | 0 | 0 | 0 | 0 | 0 | 0 | 395 | 0.266712 |
57cc2589e042bfe3b9f204e55c44c76092d692cc | 1,171 | py | Python | etc/n_CR/Vmc_lo/load_Vsw.py | jimsrc/seatos | e775dba1a2a96ff44b837cf8d85101ccfef302b1 | [
"MIT"
] | null | null | null | etc/n_CR/Vmc_lo/load_Vsw.py | jimsrc/seatos | e775dba1a2a96ff44b837cf8d85101ccfef302b1 | [
"MIT"
] | null | null | null | etc/n_CR/Vmc_lo/load_Vsw.py | jimsrc/seatos | e775dba1a2a96ff44b837cf8d85101ccfef302b1 | [
"MIT"
] | 1 | 2018-10-02T17:51:57.000Z | 2018-10-02T17:51:57.000Z | #!/usr/bin/env ipython
import numpy as np
#++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
class gral():
def __init__(self):
self.name = ''
sh, mc = gral(), gral()
cr = gral()
cr.sh, cr.mc = gral(), gral()
vlo, vhi = 550.0, 3000.0 #550., 3000. #100.0, 450.0 #550.0, 3000.0
dir_inp_sh = '../../../sheaths/ascii/MCflag2/wShiftCorr/_test_Vmc_'
dir_inp_mc = '../../../mcs/ascii/MCflag2/wShiftCorr/_test_Vmc_'
fname_inp_part = 'MCflag2_2before.4after_fgap0.2_Wang90.0_vlo.%4.1f.vhi.%4.1f' % (vlo, vhi)
fname_sh = dir_inp_sh + '/%s_V.txt' % fname_inp_part
fname_mc = dir_inp_mc + '/%s_V.txt' % fname_inp_part
sh.data = np.loadtxt(fname_sh).T
mc.data = np.loadtxt(fname_mc).T
sh.t, sh.avr = sh.data[0], sh.data[2]
mc.t, mc.avr = mc.data[0], mc.data[2]
#++++++++++++++++++++++++++++++++++++++++++++++++++++
fname_sh = dir_inp_sh + '/%s_CRs.txt' % fname_inp_part
fname_mc = dir_inp_mc + '/%s_CRs.txt' % fname_inp_part
cr.sh.data = np.loadtxt(fname_sh).T
cr.mc.data = np.loadtxt(fname_mc).T
cr.sh.t, cr.sh.avr = cr.sh.data[0], cr.sh.data[2]
cr.mc.t, cr.mc.avr = cr.mc.data[0], cr.mc.data[2]
| 32.527778 | 92 | 0.562767 | 60 | 0.051238 | 0 | 0 | 0 | 0 | 0 | 0 | 392 | 0.334757 |
57cc2ecd156c278de2ca18c760107a89d6f9b534 | 3,090 | py | Python | tools/radar_img_per_sim.py | mgaggero/tdm-tools | 525dc643c2fe90e29c6cdde6568174ab396893b6 | [
"Apache-2.0"
] | null | null | null | tools/radar_img_per_sim.py | mgaggero/tdm-tools | 525dc643c2fe90e29c6cdde6568174ab396893b6 | [
"Apache-2.0"
] | 5 | 2018-11-28T11:02:58.000Z | 2019-02-07T09:55:26.000Z | tools/radar_img_per_sim.py | mgaggero/tdm-tools | 525dc643c2fe90e29c6cdde6568174ab396893b6 | [
"Apache-2.0"
] | 5 | 2018-10-23T08:07:53.000Z | 2019-08-07T07:08:20.000Z | # Copyright 2018-2019 CRS4
#
# 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.
"""\
Select radar images in the time range of each meteo sim.
Works on NetCDF datasets created with tdm grib2cf.
"""
import datetime
import argparse
import os
import sys
import tdm.radar.utils as utils
import cdo
basename = os.path.basename
join = os.path.join
strftime = datetime.datetime.strftime
strptime = datetime.datetime.strptime
FMT = "%Y-%m-%dT%H:%M:%S"
MODELS = frozenset(("bolam", "moloch"))
# E.g., bolam_2018073001_6155f56b-40b1-4b9f-bad7-e785940b2076.nc
def get_paths(nc_dir):
rval = {}
for name in os.listdir(nc_dir):
tag, ext = os.path.splitext(name)
if ext != ".nc":
continue
parts = tag.split("_")
if parts[0] not in MODELS:
continue
ts = parts[1]
if ts == "IFS":
ts = parts[2]
date = strptime(ts, "%Y%m%d%H").date()
date_str = datetime.date.strftime(date, "%Y-%m-%d")
rval.setdefault(date_str, []).append(join(nc_dir, name))
return rval
def get_dt_range(cdo_obj, nc):
out = cdo_obj.showtimestamp(input=nc)[0]
dts = [strptime(_, FMT) for _ in out.split()]
return min(dts), max(dts)
def main(args):
nc_paths = get_paths(args.sim_dir)
c = cdo.Cdo()
for date_str, nc_list in nc_paths.items():
print("%s IN:" % date_str)
start_list, stop_list = [], []
for nc in nc_list:
start, stop = get_dt_range(c, nc)
print(" %s (%s to %s)" % (basename(nc), start, stop))
start_list.append(start)
stop_list.append(stop)
start, stop = min(start_list), max(stop_list)
out_subd = join(args.out_dir, date_str)
print("%s OUT:" % date_str)
print(" %s (%s to %s)" % (date_str, start, stop))
sys.stdout.flush()
try:
os.makedirs(out_subd)
except FileExistsError:
pass
pairs = utils.get_images(args.radar_dir, after=start, before=stop)
for dt, src in pairs:
out_name = "%s.png" % strftime(dt, utils.FMT)
dst = join(out_subd, out_name)
with open(src, "rb") as fi, open(dst, "wb") as fo:
fo.write(fi.read())
print()
if __name__ == "__main__":
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("sim_dir", metavar="NETCDF_SIM_DIR")
parser.add_argument("radar_dir", metavar="PNG_RADAR_DIR")
parser.add_argument("-o", "--out-dir", metavar="DIR", default=os.getcwd())
main(parser.parse_args(sys.argv[1:]))
| 31.85567 | 78 | 0.630097 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 952 | 0.308091 |
57ccea073806c8789604eca66fcde66c4dcb3d14 | 2,598 | py | Python | server/base/views.py | arubdesu/zentral | ac0fe663f6e1c27f9a9f55a7500a87e6ac7d9190 | [
"Apache-2.0"
] | 634 | 2015-10-30T00:55:40.000Z | 2022-03-31T02:59:00.000Z | server/base/views.py | arubdesu/zentral | ac0fe663f6e1c27f9a9f55a7500a87e6ac7d9190 | [
"Apache-2.0"
] | 145 | 2015-11-06T00:17:33.000Z | 2022-03-16T13:30:31.000Z | server/base/views.py | arubdesu/zentral | ac0fe663f6e1c27f9a9f55a7500a87e6ac7d9190 | [
"Apache-2.0"
] | 103 | 2015-11-07T07:08:49.000Z | 2022-03-18T17:34:36.000Z | import logging
from django.apps import apps
from django.contrib.auth.mixins import LoginRequiredMixin
from django.http import Http404, HttpResponse, JsonResponse
from django.views.generic import TemplateView, View
from zentral.core.stores import frontend_store
logger = logging.getLogger("server.base.views")
class HealthCheckView(View):
def get(self, request, *args, **kwargs):
return HttpResponse('OK')
class IndexView(LoginRequiredMixin, TemplateView):
template_name = "base/index.html"
def get_context_data(self, **kwargs):
context = super(IndexView, self).get_context_data(**kwargs)
app_list = []
for app_name, app_config in apps.app_configs.items():
if getattr(app_config, "events_module", None) is not None:
app_list.append(app_name)
app_list.sort()
context["apps"] = app_list
return context
class AppHistogramDataView(LoginRequiredMixin, View):
INTERVAL_DATE_FORMAT = {
"hour": "%H:%M",
"day": "%d/%m",
"week": "%d/%m",
"month": "%m/%y",
}
def get(self, request, *args, **kwargs):
app = kwargs['app']
try:
zentral_app = apps.app_configs[app]
search_dict = getattr(zentral_app.events_module, "ALL_EVENTS_SEARCH_DICT")
except (KeyError, AttributeError):
raise Http404
interval = kwargs["interval"]
try:
date_format = self.INTERVAL_DATE_FORMAT[interval]
except KeyError:
raise Http404
labels = []
event_count_data = []
unique_msn_data = []
for dt, event_count, unique_msn in frontend_store.get_app_hist_data(interval, int(kwargs["bucket_number"]),
**search_dict):
labels.append(dt.strftime(date_format))
event_count_data.append(event_count)
unique_msn_data.append(unique_msn)
datasets = {"event_count": {
"label": "{} events".format(app),
"backgroundColor": "rgba(122, 182, 160, 0.7)",
"data": event_count_data
},
"unique_msn": {
"label": "{} machines".format(app),
"backgroundColor": "rgba(225, 100, 86, 0.7)",
"data": unique_msn_data
}}
return JsonResponse({"app": app,
"labels": labels,
"datasets": datasets})
| 36.083333 | 115 | 0.560046 | 2,278 | 0.876828 | 0 | 0 | 0 | 0 | 0 | 0 | 350 | 0.134719 |
57ccef5f4b39231aa2dfe0a1c954a8f2a2181361 | 176,775 | py | Python | map.py | zihoffman7/online-world-explorer-game | 9bf1d47491bf6175ec330e4e88eeb5e349c84a4a | [
"Apache-2.0"
] | null | null | null | map.py | zihoffman7/online-world-explorer-game | 9bf1d47491bf6175ec330e4e88eeb5e349c84a4a | [
"Apache-2.0"
] | null | null | null | map.py | zihoffman7/online-world-explorer-game | 9bf1d47491bf6175ec330e4e88eeb5e349c84a4a | [
"Apache-2.0"
] | null | null | null | g1 = "#5d9e6d"
g2 = "#549464"
g3 = "#498758"
g4 = "#3d784b"
b1 = "#5f7ab8"
b2 = "#5a70a3"
b3 = "#4d67a3"
r4 = "#262626"
w1 = "#f0f0f0"
w2 = "#d9d9d9"
w3 = "#e6e6e6"
r1 = "#707070"
r2 = "#595959"
r3 = "#404040"
r4 = "#262626"
l1 = "#d95757"
l2 = "#d99457"
l3 = "#d97857"
v1 = "#664f47"
v2 = "#4a3d39"
v3 = "#382f2c"
v4 = "#332c38"
p1 = "#2e5925"
p2 = "#2c4f24"
p3 = "#284722"
s1 = "#bebf7c"
s2 = "#bfb37c"
s3 = "#ccc481"
cc = "#456e41",
pp = ["rgb(165, 42, 42, 0.5)", "pink", "purple"]
sk = "#82d2e0"
i1 = "#c3e0dd"
i2 = "#8fdaeb"
i3 = "#71bfd1"
o1 = "#7996d9"
o2 = "#88a1db"
o3 = "#6d8bd1"
pa = "#443f45"
a1 = "#c474d4"
a2 = "#b97ec4"
a3 = "#a66fb0"
bl = "#000000"
zz = "zz"
bb = "bb"
ll = "ll"
rr = "rr"
ii = "ii"
gg = "gg"
ss = "ss"
ww = "ww"
oo = "oo"
aa = "aa"
tb = ["treasure", "d", 8, s1]
t1 = ["treasure", "l", 2.75, i1]
t2 = ["treasure", "d", 2.95, i1]
t3 = ["treasure", "r", 3.15, i1]
t4 = ["treasure", "u", 3.32, i1]
t5 = ["treasure", "l", 3.62, i1]
e0 = 6
e1 = 7
e2 = 8
e3 = 9
e4 = 10
e5 = 11
maps = {
"main": {
"players": {},
"background": "darkslategray",
"map": [
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
[r3, r2, r3, r2, r4, r1, r2, r2, r3, r4, r2, r1, r3, r4, r2, r3, r1, r4, r2, r2, r4, r2, r3, r1, r2, r4, r3, r2, r1, r2, r4, r3, r2, r1, r4, r3, r2, r1, r3, r2, r1, r2, r3, r2, r1, r2, r3, r2, r3, r1, r2, r3, r1, r2, r3, r1, r3, r1, r3, r2, r3, r2, r3, r2, r3, r2, r1, r3, w2, w1, w2, w2, w1],
[r2, r3, r2, r1, r3, r4, r2, r3, r2, r4, r1, r2, r2, r3, r4, r2, r1, r3, r4, r2, r3, r1, r4, r2, r2, r4, r2, r3, r1, r2, r4, r3, r2, r1, r2, r4, r3, r2, r1, r4, r3, r2, r1, r3, r2, r1, r2, r3, r2, r1, r2, r3, r2, r3, r1, r2, r3, r1, r2, r3, r1, r3, r1, r3, r2, r3, r2, r3, r2, w2, w1, w2, w2],
[r4, r2, r3, r4, r3, r2, pp, g3, g4, g4, r3, r1, r2, r3, r2, r4, g4, g2, g3, r4, r1, r2, r2, r4, r3, g4, g3, g4, r1, r2, r3, r4, r1, g4, g2, g3, r2, r1, r3, r4, r2, r3, g3, g4, g2, g3, g4, r1, r2, r3, r2, r4, r1, r4, pp, g4, g3, g4, g3, r3, r2, g3, g4, g4, r1, r3, r4, r1, r3, r4, w2, w1, w2],
[r1, r3, r4, g1, g1, g2, g3, g2, g2, g3, g2, g2, g1, g2, g1, g2, g3, g3, g2, g2, g3, g2, g2, g1, g2, g1, g1, g2, g1, g2, g2, g1, g1, g2, g2, g2, g1, g1, g2, g3, g2, g2, g2, g2, g1, g1, g1, g2, g2, g1, g1, g2, g2, g3, g2, g3, g2, g2, g3, g2, g2, g2, g3, g2, g2, g2, g1, g2, g3, r3, w1, w2, w1],
[r2, r1, r2, g2, g1, g2, g2, g1, g1, g2, g3, g3, g2, g1, g2, g1, g2, g2, g1, g1, g2, g1, g1, g2, g1, g2, g2, g1, g2, g1, g1, g2, g2, g1, g3, g2, g2, g2, g3, g2, g3, g3, g3, g2, g3, g2, g2, g1, g1, g2, g2, g3, g3, g2, g1, g2, g1, g1, g2, g1, g1, g1, g2, g1, g1, g1, g2, g3, r2, w1, w2, w1, w1],
[r3, r4, g2, g1, g2, g2, g1, g2, g1, g1, g2, g2, g1, g2, g1, g2, r2, r3, r1, g4, g3, g2, g2, g1, g2, g1, g1, g2, g1, g2, s2, s3, s2, g2, g2, g2, g1, g1, g2, g1, g2, g2, g3, g1, g2, g1, g1, g2, g2, g3, r3, r2, r1, r4, g3, g3, g2, g1, g2, g2, g2, g2, g1, g2, g2, r2, r3, r2, r1, w2, w1, w2, w1],
[r3, r2, g3, g2, g2, g1, g2, g1, g2, g2, g3, g2, g2, g3, g4, r4, r3, r1, r2, r3, g4, g3, g3, g2, g1, g2, g2, g1, g2, s1, b3, b2, b3, s1, g1, g1, g1, g2, g3, g2, g3, g2, g1, g2, g3, g2, g2, g2, g3, r2, r1, r3, r4, r3, r2, r1, g2, g1, g1, g2, g1, g1, g2, r2, r3, r1, w1, r3, w2, w1, w1, w2, w2],
[r2, r3, g3, g2, g1, g2, g1, g2, g1, g1, g2, g3, g3, g4, g4, r3, r4, r3, r4, r2, r1, g3, g2, g3, g2, g1, g1, g2, g1, b1, b2, b1, b2, b3, g2, g2, g2, g3, g2, g3, g2, g3, g2, g3, g2, g3, g2, g1, g2, g3, r3, r4, r2, r1, r3, g3, g4, g2, g2, g1, g2, r4, r2, r3, r2, w1, w2, w1, r4, w2, w2, w2, w1],
[r3, r4, g2, g1, g2, g1, g2, g3, g2, g2, g3, g2, g2, g3, g3, g4, r2, r4, r2, r1, g3, g2, g2, g2, g1, g2, g2, g1, s1, b2, b3, b2, b1, b2, s2, g2, g3, g2, g1, g2, g1, g2, g1, g2, g1, g2, g1, g2, g1, g2, g3, g3, r3, r2, g3, g2, g3, g2, g1, g2, r3, r2, r3, r2, w2, w2, r1, r4, r3, r2, w1, w1, w2],
[r2, r3, r2, g2, g2, g3, r3, r2, r3, g1, g2, g1, g1, g2, g2, g3, g2, g3, g4, g3, g2, g1, g1, g1, g2, g1, g1, g2, g2, s1, b1, b3, b2, s1, g2, g3, g2, g3, g2, g1, g2, g1, g2, g1, g2, g1, g2, g1, g2, g1, g2, g2, g3, g4, g2, g3, g2, r3, r2, r3, r2, r1, w1, w1, r3, r2, r3, p1, p3, pp, w2, w1, w2],
[r3, r4, r1, g2, g3, r3, r2, r3, r4, r2, g2, g2, g2, g3, g3, g2, g1, g2, g3, g2, g1, g2, g2, g2, g1, g2, g2, g3, g2, g2, s2, s2, g1, g2, g3, g2, g1, g2, g1, g2, g1, g2, g1, g2, g1, g2, g3, g2, g1, g2, g1, g3, g2, g3, g4, r2, r3, r4, r3, r4, r3, r2, r3, r2, r4, r1, p1, p3, p1, p3, w2, w2, w1],
[r2, r1, r3, g1, g2, r2, r3, r1, r2, r1, r2, r3, g3, g2, g2, g3, g2, g1, g2, g1, g2, g1, g1, g1, g2, g3, g3, g2, g1, g2, g3, g2, g2, g3, g2, g1, g2, g1, g2, g1, g2, g3, g3, g2, g2, g1, g2, g1, g2, g1, g2, g4, g3, g2, g3, g3, p1, p3, p1, p1, p3, p1, p3, p3, p1, p1, p3, p2, p3, p1, w1, w2, w1],
[r1, r2, r2, g2, g3, g3, r4, r3, r1, r2, r3, g4, g2, g1, g1, g2, g1, g2, g1, g2, g1, g2, g2, g3, g3, g2, g2, g1, g2, g3, g2, g1, g1, g2, g1, g2, g1, g2, g3, g2, g3, g2, g2, g1, g1, g2, g3, g2, g1, g2, g2, g3, g2, g2, g3, g2, g4, p2, p2, p2, p1, p2, p2, p1, p3, p1, p1, p3, p1, p3, w1, w2, w2],
[r2, r4, g2, g1, g1, g2, g3, g4, g3, g3, g2, g2, g1, g2, g1, g2, g3, s3, g2, g2, s1, s2, g2, g1, g2, g1, g1, g2, g1, g2, g2, g1, g1, g2, g2, g2, g1, g1, g2, g3, g2, g2, g2, g2, g1, g1, g1, g2, g2, g1, g1, g2, g2, g3, g2, g3, p2, p1, p3, p3, p2, p2, p3, p2, p2, p2, p2, p2, p3, p1, w2, w1, w2],
[r2, r3, g3, g2, g2, g3, g2, g3, g2, g2, g1, g1, g2, g3, g2, g3, s2, b3, b2, b1, b3, b2, s3, g2, g3, g2, g2, g3, g2, g3, g3, g2, g2, g1, g1, g3, g2, g2, g3, g2, g1, g1, g1, s3, g2, g2, g2, g2, g3, g2, g2, g3, g3, g2, g3, g4, r2, r3, r1, r4, r3, r1, r2, r3, r2, r4, p1, p3, p2, w1, w2, w1, w2],
[r1, r2, r4, g2, g1, g2, g2, g1, g1, g2, g3, g3, g2, g1, g2, g1, b2, b1, b3, b2, b2, b3, b2, b3, g2, g3, g2, g2, g1, g2, g2, g3, g3, g2, g2, g2, g3, g3, g2, g1, g2, s2, b2, b1, b2, s2, g3, g3, g2, g3, g2, g1, g2, g1, g2, r3, r4, r2, r3, r3, w1, w1, r3, w1, r3, r2, r3, p1, w1, w2, w2, w2, w1],
[r2, r1, r3, g1, g2, g1, g1, g2, g2, g1, g2, g2, g1, g2, g1, s3, b1, b2, b1, b2, b3, b2, b3, b2, s3, g2, g1, g1, g2, g1, g1, g2, g2, g3, g1, g1, g2, g2, g1, g2, s2, b3, b2, b3, r1, r2, r1, g2, g1, g2, g1, g2, g1, g2, g3, g2, r2, r3, r4, r3, r1, w2, w2, r3, r4, w2, r2, w1, w2, w1, w1, w2, w2],
[r3, r2, r1, g1, g1, g2, g2, g1, g2, g3, g3, g2, g2, g3, g2, b3, b2, b3, b2, b1, b2, b1, b2, g1, g2, g3, g2, g2, g3, g2, g2, g1, g1, g2, g2, g3, g2, g1, g2, g1, s1, b1, r3, r4, r2, r3, r2, r3, g2, g1, g2, g3, g2, g1, g2, g3, g4, g3, r3, r2, r4, r3, r2, r1, r3, r4, w1, r3, w1, w1, w2, w1, w2],
[r4, r2, r3, g1, g1, g1, g1, g2, g3, g2, g2, g1, g1, g2, s1, b2, b3, b2, b1, b2, b3, b2, s2, g2, g1, g2, g1, g1, g2, g1, g1, g2, g2, g1, g1, g2, g1, g2, g1, g2, g1, b2, b3, b1, r3, r4, r3, r4, g1, g2, g3, g3, g2, g2, g1, g2, g1, g2, g3, g4, g3, g4, r4, r3, r2, r1, r3, r4, r2, w2, w2, w1, w2],
[r3, r4, r2, g2, g2, g1, g2, g3, g2, g3, g3, g2, g2, g3, g2, s1, b2, b3, b2, b1, b2, s1, g2, g3, g2, g3, g2, g2, g3, g2, g2, g1, g2, g2, g3, g2, g2, g3, g2, g3, s3, s1, b1, b2, r1, r2, b1, s1, g2, g1, g2, g2, g3, g3, g2, g3, g2, g3, g2, g3, g2, g3, g3, g4, g2, g3, r2, r3, r4, r2, w1, w1, w1],
[r3, r2, r3, g1, g1, g2, g3, g2, g2, g3, g2, g2, g1, g2, g1, g2, g3, g3, s2, s3, g3, g2, g2, g1, g2, g2, g2, g2, g3, g2, g2, g1, g1, g2, g2, g2, g1, g1, g2, g3, g2, g2, s2, g2, g1, s3, s2, g2, g2, g1, g1, g2, g2, g3, g2, g3, g2, g2, g3, g2, g2, g2, g3, g2, g2, g2, g1, g2, g3, r3, r2, w2, w1],
[r2, r4, r1, g2, g2, g3, g2, v1, v2, g3, g3, g4, g3, g2, v2, v3, v4, g2, g3, g2, g1, g2, g3, g4, r1, r4, r2, r3, g4, g3, g1, g2, g2, g3, g2, g1, g3, g2, g1, g2, g1, g2, g2, g1, g2, g2, g1, g2, g3, g2, g3, g2, g1, g2, g3, g2, g1, g3, g2, g1, g2, g1, g2, g3, g3, g2, g2, g3, r4, r1, w2, w2, w1],
[v4, r3, g4, g3, g4, v3, v4, v2, v1, v3, g4, g3, g4, v4, v2, v3, v2, v1, v2, g1, g2, g3, g4, g3, g4, r3, r2, r3, r1, g4, g3, g1, g2, g1, g2, g3, g2, g3, g4, g3, g4, g3, g2, g1, g3, g2, g2, g3, g2, g3, g2, g1, g2, g1, g2, g1, g2, g2, g3, g2, g3, g2, g3, g2, g2, r3, r2, r4, r1, w2, w1, w1, w2],
[v1, v2, v3, v4, v2, v1, l1, v3, v2, v1, p1, g4, p2, v3, v1, l1, v3, v2, v4, v3, v2, g3, g3, g2, g1, g2, r1, r2, r4, g3, g2, g2, g3, g2, g1, g2, g3, g4, r4, r1, r3, r2, r1, g3, g2, g2, g1, g2, g3, g2, g1, g2, g1, g2, g1, g1, g1, g2, g2, g3, g4, p1, r3, r2, r4, r1, r2, w2, w2, w1, w2, w1, w1],
[v2, v1, v2, v2, v3, l2, l3, l1, v4, v2, p3, p2, p1, v1, v4, l3, l2, l1, v3, v2, v4, v1, v2, g4, g3, g2, g2, g2, g3, g2, g1, g1, g2, g3, g2, g3, r2, r3, r1, r4, r2, r1, r3, r2, g4, g3, g2, g3, g2, g1, g2, g3, g2, g1, g2, g2, g3, g1, g3, g4, p2, p3, p1, r4, r3, r2, w1, w2, w1, w2, w2, w1, w2],
[v1, v2, v4, v3, v1, l3, l1, l2, l3, v4, v3, p3, p1, p2, v2, v3, l1, l3, v1, v3, v1, v4, v3, v2, g4, g3, g2, g1, g2, g1, g2, g1, g1, g2, g3, g4, r3, r4, r1, r2, r3, r2, r1, r4, r2, g3, g1, g2, g3, g2, g3, g2, g1, g2, g3, g1, g2, g3, r4, p3, p1, p2, p3, p2, r3, r1, r2, w1, w2, w1, w2, w2, w1],
[v2, v3, v2, v1, v2, v3, v4, l3, l1, l2, v2, v4, p2, p3, p1, v2, v3, v4, p1, p3, p2, v3, v2, v1, v4, v3, g3, g2, g1, g1, s1, s2, g1, g2, g4, r1, r2, r4, r3, r1, r4, r2, r3, r1, g4, g2, g2, g3, g2, g1, g2, g1, g2, g3, g2, g2, r1, r2, r3, r2, p2, p3, p1, p2, p2, r2, w2, w2, w1, w1, w1, w2, w1],
[v4, v3, v1, v2, v3, v2, l2, l1, l2, v3, v4, p1, p3, p2, v2, v4, v1, p2, p3, p1, p3, p1, p2, v2, v3, g3, g2, g1, g2, s3, s2, s1, g2, g2, g3, r3, r2, r4, r1, r2, r3, r1, r4, r2, g3, g1, g1, g2, g3, g2, g2, g2, g3, g2, g3, r3, r2, r3, r4, r1, r2, p1, p2, p3, p2, r4, w1, w1, w2, w1, w2, w2, w1],
[v3, v2, v1, v3, v1, l3, l1, l2, v4, v2, p2, p3, p2, p1, p2, p3, p2, p1, p2, p3, p2, p2, p3, p2, p1, g4, g3, g2, g1, s3, s1, s2, g1, g2, g1, g4, r3, r2, r4, r1, r3, r2, g3, g2, g1, g2, g2, g1, g2, g3, g3, g2, g4, r4, r2, r3, r2, r1, r4, r2, r2, p2, p3, p1, p3, r3, r4, w2, w1, w2, w1, w1, w2],
[v2, v3, v2, l3, l2, l3, l1, v2, v3, p1, p3, p2, p1, p2, p3, p2, p1, p3, v4, v2, v3, p3, p2, p1, p2, g4, g2, g1, s2, s1, s3, s1, s2, g1, g2, g3, g4, r1, r2, r4, g4, g3, g2, g1, g2, g1, g1, g2, g3, g2, g2, g3, r2, r3, r2, r4, b1, b2, r3, r3, p1, p3, p2, p1, r3, r1, w1, w2, w2, w1, w2, w2, w2],
[v1, v2, l2, l1, l3, l2, l2, v4, p2, p3, p1, p3, p1, v1, p1, p2, p3, p1, v3, v1, v2, v2, p1, p2, p3, p2, g4, g2, s1, s2, s3, s2, s3, s2, g2, g1, g2, g3, g2, g1, g2, g3, g2, g1, g1, g2, g2, g3, g2, g1, g2, r4, r3, r1, b3, b2, b3, r1, r2, p3, p2, p1, p1, r1, r4, w2, w1, w1, w2, w2, w1, w1, w2],
[v4, l3, l1, l2, l1, l3, l1, v3, p1, p2, p3, p2, v4, v2, v3, v1, v2, v3, v1, v3, v2, v3, v1, v2, v1, v3, v4, s3, s2, s1, s2, s3, s2, s1, g1, g2, g1, g2, g3, g2, g1, g2, g3, g2, g1, g2, g1, g2, g1, g2, g1, r3, r2, b2, b1, b1, b2, r4, p1, p2, p3, p2, r4, r2, w1, w1, w2, w2, w2, w1, w1, w2, w1],
[v2, l2, l3, l1, l2, l1, l3, v4, v2, p1, p2, v3, v1, v2, v1, v2, v3, v1, v3, l2, l3, l2, v4, v1, v2, v3, s1, s2, s1, s3, s2, s1, s2, s3, g1, g2, g3, g1, g2, g3, g2, g1, g1, s3, s1, s2, s1, g1, g2, g3, g4, r2, r4, b1, b3, b2, r3, r2, p3, p1, p2, r2, r3, w2, w2, w1, w1, w2, w1, w2, w2, w1, w2],
[v4, v3, l2, v3, l2, l3, l2, l1, v4, v2, v1, v2, v3, v1, v4, v2, l2, l3, l1, l1, l2, l3, l2, v4, v3, s3, s2, s3, cc, s2, s3, s2, s3, s2, s3, g1, g1, g2, g3, g2, g1, s2, s1, s2, s2, s3, s1, s2, s3, s1, r2, r3, b2, b3, b2, r4, r1, r4, r3, p2, p3, pp, w1, w1, w2, w2, w2, w1, w2, w2, w1, w1, w2],
[v3, v2, v3, v4, v1, l1, l3, l2, l2, l1, v3, v1, l3, l2, l1, l3, l1, l2, l3, l2, l1, l1, v1, v2, v2, s2, s1, s2, s1, s3, s2, s1, s2, s1, s2, g1, g2, g1, g2, g1, s2, s3, s2, s1, s3, s1, s2, s3, s2, r3, r4, b3, b2, b1, b3, r3, r2, r1, r2, r3, r2, r3, w2, w2, w1, w1, w2, w2, w1, w2, w1, w1, w2],
[v2, v3, v4, v2, v3, v4, l1, l1, l3, l2, l1, l2, l2, l1, l2, l2, l3, l1, l2, v4, v1, v2, v3, s2, s1, s3, s2, s3, s2, s2, s3, s2, s3, s2, s3, g1, g1, g2, g1, s2, s1, s2, s3, s2, s1, s2, s3, b2, b2, b3, b1, b2, b1, b2, b1, b2, r1, r4, r3, r2, r4, w1, w1, w2, w2, w1, w2, w1, w2, w1, w2, w1, w1],
[v1, v4, v2, v1, v4, v3, v2, v1, l2, l1, l2, l3, l1, l2, l3, v4, v1, v3, v2, v3, v4, s3, s2, s1, s2, s1, s3, s2, s3, s1, cc, s1, s2, s3, s2, s1, g2, g1, s2, s1, s3, s1, s2, b3, b2, b1, b3, b3, b1, b2, b3, b2, b1, b3, b2, b3, r4, r3, r2, r1, w2, w2, w1, w2, w1, w1, w2, w2, w2, w1, w1, w1, w2],
[v2, v3, v4, v3, v1, v4, v2, v2, v1, v4, l3, l1, l3, v3, v1, v3, v2, v4, v1, s1, s2, s3, s2, s3, s2, s1, s1, s2, s1, s3, s1, s3, s1, s2, s1, s3, s2, s3, s1, s2, s3, b2, b2, b1, b3, b2, b1, b2, b2, b3, b1, b2, b1, b3, s2, b2, b2, r2, r1, r3, r2, w1, w2, w1, w1, w2, w1, w1, w2, w1, w2, w2, w1],
[v3, v4, v2, v4, v2, v1, v3, v2, v4, v1, v3, v2, v1, v4, v2, v1, s2, s3, s1, s3, s1, s2, cc, s1, s3, s2, cc, s3, s1, s2, s2, s1, s2, s3, s2, s2, s1, b2, b1, b3, b2, b3, b1, s2, s1, s2, b2, b3, b1, b2, b2, b3, b2, s1, g2, s3, b1, b3, b2, r4, r3, r2, r3, r1, r4, r2, r4, w2, w1, w2, w1, w1, w2],
[v1, v3, v4, v3, v1, v2, v2, v1, v3, v2, v2, v1, v4, v3, v1, s3, s1, s2, cc, s3, s2, s1, s2, s1, b1, b3, s2, s1, s3, s1, s2, s1, s3, s2, s1, s3, b3, b1, b2, b1, b3, b2, s1, s3, g2, s1, s1, b2, b1, b3, b2, b1, b2, s2, g3, s1, s3, b2, b1, b3, b2, r4, r1, r3, r2, r2, r3, r1, r2, r3, w2, w2, w1],
[v1, v2, v4, v2, v4, v3, v3, v2, v4, v3, v1, s3, s1, s2, s1, s3, s2, s2, s1, s3, s1, s2, b2, b3, b2, b1, b2, s3, s2, s1, s3, s2, s1, s2, s3, s2, b2, b2, b1, b2, b1, s2, s2, g2, r2, g1, s2, b2, b3, b2, b1, b3, b2, s1, r1, g4, s3, b1, b3, b1, b3, b1, b2, b1, b2, b2, r4, r3, r1, r2, r3, r1, w2],
[v3, v2, v1, v3, v2, v1, s3, s2, s1, s2, s3, s2, s2, cc, s1, s3, s2, s3, s1, s2, s3, s1, b1, b2, b1, b2, b3, s2, s1, s3, s2, cc, s2, s3, s1, b2, b1, b3, b3, b1, b2, s3, g1, r1, g1, r2, s3, b3, b1, b2, b3, b2, b1, b3, s2, s1, s2, b1, b3, b1, b1, b3, b3, b2, b3, b1, b2, b1, b3, b1, r2, r4, r2],
[v2, v3, v4, v4, s1, s2, cc, s3, s2, s1, cc, s3, s2, s1, s3, s2, cc, s2, s2, s3, cc, s3, s1, s3, b2, b3, s3, s1, s2, cc, s1, s2, s3, s2, s1, b3, b2, b2, b1, b2, b3, b2, s2, s3, g1, s1, s3, b2, b1, b3, b2, b1, b2, b3, b2, b3, b1, b2, b1, b3, b2, b2, s1, s2, s3, b2, b1, b3, b3, b2, b2, r3, r1],
[v3, v4, pp, s2, s2, s3, s1, s1, s2, s3, s3, s2, s3, s1, s2, s1, s3, s2, s1, s3, s3, s2, s2, s1, s3, s1, s1, s2, s1, s2, s3, s1, s2, s3, s2, b2, b1, b3, b2, b1, b2, b3, b2, b1, s1, s2, b3, b3, b2, b2, b1, b2, b3, b2, b1, b2, b3, b1, b3, b2, b2, s3, g1, r2, g3, s2, b2, b3, b1, b2, b3, b1, b2],
[v2, v3, v2, r2, r4, r1, r2, s2, s3, s1, s2, r1, r3, r4, s1, s2, s3, r4, r2, r2, r4, r2, s1, s3, s2, r4, r3, r2, r1, r2, s3, s2, s1, s3, s2, b3, b3, b1, b2, b1, b3, b1, b2, b3, b2, b3, b1, b2, b1, b3, b2, b3, b2, b1, b3, b2, b1, b2, b3, b1, b3, s2, g3, g4, r1, s1, b2, b1, b2, b3, b2, b2, b3],
[v3, v1, v3, v4, r3, r4, r2, r3, r2, r4, r1, r2, r2, r3, r4, r2, r1, r3, r4, r2, r3, r1, r4, r2, r2, r4, r2, r3, r1, r2, r4, r3, r2, r1, r2, r4, b1, b2, b3, b1, b2, b2, b3, b2, b2, b2, b3, b1, b3, b2, b1, b3, b2, b3, b2, b1, b3, b2, b1, b2, b3, b1, s1, s3, s2, b2, b1, b3, b2, b1, b2, b3, b1],
[v2, v3, v1, v3, v4, r3, r4, r2, r2, r3, r4, r2, r1, r3, r4, r2, r3, r1, r4, r2, r2, r4, r2, r3, r1, r3, r2, r4, r1, r2, r2, r4, r3, r2, r1, r2, r4, b1, b2, b2, b3, b2, b2, b2, b3, b1, b3, b2, b3, b1, b2, b1, b3, b2, b3, b2, b1, b3, b2, b1, b2, b3, b1, b3, b2, b3, b2, b1, b3, b2, b1, b2, b1]
],
"elevation": [
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", ""],
["", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", e4, e4, e4, "", "", ""],
["", "", "", e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", e4, e4, e4, e4, "", "", ""],
["", "", "", e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, e2, e2, e2, e3, e3, e3, e4, e4, e4, e4, e4, e4, "", "", ""],
["", "", "", e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, e2, e2, e3, e3, e3, e3, e4, e4, e4, e4, e4, e4, "", "", ""],
["", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, e2, e2, e2, e3, e3, e3, e4, e4, e4, e4, e4, e4, "", "", ""],
["", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, "", "", "", "", "", "", "", "", "", "", e4, e4, e4, "", "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", e4, "", "", "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e2, e2, e2, e2, e2, e2, e2, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", ""],
["", "", "", e1, e1, e1, e1, "", "", e2, e2, e2, e2, e2, "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", ""],
["", "", e1, e1, e1, "", "", "", "", "", e2, e2, e2, "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, e1, e2, e2, e2, e2, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e3, e2, e3, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, e2, e2, e3, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e3, e3, e3, "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, e2, e2, e3, e3, e3, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e3, e3, e3, "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, "", e3, e3, e3, e3, e3, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e4, e3, e3, "", "", "", e3, e3, e3, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, "", "", "", "", e3, e3, e3, e4, e3, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e4, e4, e4, "", "", "", e3, e3, e3, e3, e2, e2, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", e3, e3, e3, e3, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e4, e4, e4, e4, e4, e3, e3, e3, e3, e3, e2, e2, e2, e2, e2, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e4, e3, e3, e3, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e4, e4, e4, e4, e4, e4, e4, e3, e3, "", "", "", e2, e2, e2, e2, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e4, e4, e4, e3, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e4, e4, e4, e4, e4, "", e4, e4, e3, e3, "", "", "", "", e2, e2, e2, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e4, e4, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", e4, e4, e4, "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, "", e0, e0, e0, e0, e1, e1, e1, e1, e1, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", e4, e4, e4, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e1, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, "", e0, e0, e0, "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, "", e0, e0, e0, e0, e0, "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, "", e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", e0, e0, e0, e0, "", e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", e0, e0, "", e0, e0, e0, "", e0, e0, e0, e0, e0, "", e0, e0, e0, "", e0, e0, e0, "", "", e0, e0, e0, "", e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e0, e0, "", "", "", e0, e0, e0, "", "", "", "", "", e0, e0, e0, "", "", "", "", "", e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
]
},
"cloud": {
"players": {},
"background": sk,
"map": [
[sk, sk, sk, w1, w2, w1, w3, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, w2, w1, w2, sk, sk, sk],
[sk, w2, w3, w2, w1, w1, w2, w3, w2, sk, sk, sk, sk, sk, w2, w3, w1, w2, sk, sk, sk, sk, w2, w3, w1, w2, w3, sk, sk],
[sk, w1, w2, w3, w2, w3, w1, w2, w1, w2, w1, sk, sk, w3, w2, w2, w2, w3, w2, sk, sk, sk, w1, w2, w3, w1, w2, w3, sk],
[w3, w2, w3, w2, w1, w2, w2, w1, w2, w3, w2, w1, w2, w2, w3, w2, w1, w2, w1, w1, sk, w2, w2, w3, w2, w2, w2, w3, pp],
[w2, w2, w1, w2, w3, w3, w2, w1, w1, w2, w3, w2, w3, w3, w2, w3, w2, w1, w2, w3, w2, w1, w1, w2, w3, w1, w1, w2, w1],
[w1, w3, w3, w2, w1, w2, w1, w2, w3, w2, w3, w1, w2, w1, w2, w2, w1, w2, w1, w2, w1, sk, sk, w1, w2, w2, w2, w3, w2],
[w2, w1, w2, w3, w2, w3, w1, w2, w2, w1, w2, w3, w3, w2, w1, w1, w2, w3, w2, w1, w3, sk, sk, sk, sk, w1, w3, w2, sk],
[sk, w3, w1, w2, w3, w2, w2, w1, w1, w2, w1, w2, w2, w1, w2, w3, w3, w2, w1, w1, sk, sk, sk, sk, sk, sk, sk, sk, sk],
[sk, sk, w2, w3, w2, w1, w2, w3, sk, sk, w2, w3, w1, w2, w1, w2, w1, w2, w3, sk, sk, w3, w2, sk, sk, sk, sk, sk, sk],
[sk, sk, sk, sk, w1, w2, sk, sk, sk, sk, w2, w1, w2, w2, w3, w2, w2, w1, sk, sk, sk, w2, w1, w3, sk, w2, w3, sk, sk],
[sk, sk, sk, sk, sk, sk, sk, w3, w2, w1, w3, w2, sk, w3, w2, w1, sk, sk, sk, sk, sk, sk, w2, w2, sk, w2, w2, w1, sk],
[sk, w3, w1, sk, sk, sk, w2, w2, w1, w2, w2, w1, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, w1, w3, sk, sk],
[w2, w1, w2, w1, sk, sk, w1, w3, w2, w1, w2, w1, w2, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, w1, w2, sk],
[w3, w2, w3, sk, sk, w2, w1, w2, w1, w3, w1, w2, w3, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, w1, w2, sk, sk, sk, sk],
[sk, w1, w2, sk, w3, w2, w2, w1, w2, w1, w2, w1, w1, sk, sk, w2, w3, w2, sk, sk, sk, w3, w2, w2, w3, w1, sk, sk, sk],
[sk, sk, sk, sk, w2, w2, w1, w2, w3, w2, w3, w3, w2, w2, w1, w2, w2, w3, w1, sk, w2, w2, w3, w1, w2, w3, w1, sk, sk],
[sk, sk, sk, sk, w1, w2, w3, w1, w2, w1, w2, w2, w1, w2, w1, w2, w1, w2, w2, w2, w2, w1, w2, w2, w1, w2, sk, sk, sk],
[sk, sk, sk, sk, w2, w3, w2, w2, w1, w2, w1, w1, w2, w3, w2, w3, w2, w3, w2, w3, w1, w2, w1, w2, w1, w2, sk, sk, sk],
[sk, sk, sk, w1, w3, w1, w3, w3, w2, w1, w2, w1, w2, w2, w2, w2, w1, w2, w1, sk, sk, w1, w2, w3, pp, sk, sk, sk, sk],
[sk, sk, sk, pp, w1, w2, w1, w2, w1, w2, w2, w3, w1, w3, w1, w3, w2, w3, w2, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk],
[sk, sk, sk, sk, w3, w1, w2, w2, w2, w1, w1, w2, w2, w1, w2, w3, w1, w1, sk, sk, sk, sk, sk, sk, w1, w2, sk, sk, sk],
[sk, w1, sk, sk, sk, w2, w1, w2, w3, w2, w3, w2, w2, w1, sk, sk, sk, sk, sk, sk, sk, sk, sk, w2, w3, w2, w3, sk, sk],
[w1, w2, w3, sk, sk, sk, sk, sk, w2, w3, w2, w1, w2, w1, w1, w2, sk, sk, sk, w2, w2, w1, sk, sk, w1, w1, sk, sk, sk],
[w2, w1, w2, sk, sk, sk, sk, sk, sk, sk, sk, sk, w3, w2, w1, w3, w2, sk, w2, w3, w1, w2, w3, sk, sk, sk, sk, sk, sk],
[w1, w3, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, w3, w2, w1, w2, w3, w1, w1, w3, w1, w2, w2, sk, sk, sk, sk, sk],
[sk, sk, sk, sk, sk, w1, w2, sk, sk, sk, sk, sk, sk, w2, w1, w3, w1, w2, w2, w2, w1, w2, w3, w3, sk, sk, sk, sk, sk],
[sk, sk, sk, sk, w1, w2, w3, w2, sk, sk, sk, sk, sk, sk, w2, w2, w3, w2, w1, w1, w3, w2, w1, w2, sk, sk, sk, w1, sk],
[sk, sk, sk, sk, sk, w1, w2, w3, w1, sk, sk, sk, sk, w2, w1, w1, w2, w3, w2, w1, w3, w1, w2, w1, sk, sk, w1, w2, w1],
[sk, sk, sk, sk, sk, sk, sk, w1, sk, sk, sk, sk, w2, w1, w2, w3, sk, w2, w3, w2, w1, w2, w3, sk, sk, sk, w2, w1, w3],
[sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, w1, w1, w3, w2, sk, pp, w1, w1, w3, w2, w2, sk, sk, sk, sk, w3, w2],
[sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, sk, w2, w1, sk, sk, sk, w2, w1, w1, w3, sk, sk, sk, sk, sk, sk, sk]
],
"elevation": [
["", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", ""],
["", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, "", ""],
["", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, ""],
[e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1],
[e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1],
[e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1],
[e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, ""],
["", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", e1, e1, "", "", "", ""],
["", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, "", "", ""],
["", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, "", ""],
["", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", ""],
["", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, "", "", "", ""],
["", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", ""]
]
},
"volcano": {
"players": {},
"background": v2,
"map": [
[v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v2, v4, v2, v1, v1, v2, v3, v1, v1, v3, v2, v1, v4, v4, v3, v2, v1, v3, v2, v4, v3, v3, v4, v2, v1, v3, v4, v4, v2, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v2, v3, v4],
[v2, v3, v1, v1, v3, v2, v1, v4, v4, v3, v2, v1, v3, v2, v4, v3, v3, v4, v2, v1, v3, v4, v4, v2, v1, v3, v4, v2, v2, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v4, v3, v1, v1, v3, v4, v2, v1, v1, v3, v2, v3],
[v3, v4, v2, v1, v1, v3, v2, v2, v1, v1, v2, v3, v1, v1, v3, v2, v1, v4, v4, v3, v2, v1, v3, v2, v4, v3, v3, v4, v2, v1, v3, v4, v4, v2, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v4, v2, v1, v1, v1, v3, v2],
[v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v2, v4, v2, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v4, v4, v1, v1, v2, v3, v1, v4, l2, l3, v3, v1, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v1, v3],
[v2, v3, v1, v1, v3, v2, v1, v4, v4, v3, v2, v1, v3, v2, v4, v3, v3, v4, v2, v1, v3, v4, v4, v2, v1, v2, v3, v1, v1, v3, v2, v1, v4, l2, l3, l2, l3, l2, v2, v4, v3, v2, v4, v2, v1, v3, v4, v4, v2, v1, v4, v3, v4],
[v3, v4, v2, v3, v1, v3, v2, v2, v4, v1, v3, v3, v2, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v4, v2, v1, v1, v2, v4, l1, l1, l2, l3, l1, l1, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v2, v3],
[v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v4, v4, v2, v1, v1, p3, p2, p1, p2, v2, v3, l2, l3, l3, l3, l2, l3, l2, l2, v3, v4, v2, v1, v1, v2, v2, v1, v2, v2, v4, v1, v2, v3],
[v3, v4, v2, v1, v1, v4, v4, v2, v1, v1, v3, v4, v2, v1, v1, v2, v2, v1, v2, v2, v4, v1, v2, p3, p2, p1, p2, p3, p1, p2, v3, v4, l1, l2, l1, l1, l2, l3, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v3, v4],
[v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v4, v2, v1, v4, v3, v4, v2, v1, v1, v3, v3, p2, p1, p1, p2, p3, p2, p1, p2, p3, v3, v4, v2, l3, l2, l1, l2, v2, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v2, v3],
[v3, v4, v2, l2, l1, v1, v4, v3, v2, v1, v3, v4, v3, v1, v1, v3, v4, v2, v1, v1, v3, v3, p1, p3, p2, p1, p2, p3, p2, p3, p1, p2, p3, v2, v3, l3, l1, l1, v4, v3, v1, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1],
[v2, v3, v1, l3, l2, l3, v3, v1, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, p2, p1, p2, p3, p2, p3, p2, p1, p2, p1, p2, v3, p2, v3, v4, l1, v2, v1, v3, v4, v2, v1, v1, v2, v2, v1, v2, v2, v4, v1, v2, v3],
[v3, v4, v3, v1, l1, l2, l3, v2, v1, v1, v1, v3, v2, v3, v4, v4, v2, v2, v1, p2, p1, p2, p3, p2, p2, p1, p2, p1, p2, p1, p1, p2, p3, p3, p3, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v4, v2, v1, v1, v2, v3, v1],
[v3, v4, v2, v1, l2, l1, l3, l1, v2, v1, v3, v4, v2, v1, v1, v3, p3, p1, p2, p3, p2, p1, p2, p3, p3, v3, v3, p3, p2, p2, p3, p2, p1, p2, p2, v2, v3, v1, v4, v2, v4, v3, v1, v1, v3, v4, v2, v1, v1, v1, v4, v2, v3],
[v3, v3, v2, v1, v2, l1, l2, l3, v2, v1, v3, v3, p3, p2, p1, p2, p2, p3, p2, p1, p2, p3, p2, p1, v3, v4, v2, v1, v1, p1, p1, p2, p1, p2, p1, v3, v4, l2, l1, l3, v4, v4, v2, l1, l2, v3, v4, v2, v1, v1, v3, v4, v1],
[v2, v3, v1, v4, v2, v4, l3, v1, v1, v1, p1, p2, p1, p2, p2, p3, p3, p2, p3, p2, p1, p2, p3, p1, v3, v4, v2, v1, v1, p2, p1, p1, p2, p3, p3, p2, v2, l1, l1, l3, l3, v4, l1, l2, l3, l2, v3, p1, v3, v4, v2, v1, v1],
[v1, v3, v2, v3, v4, v4, l2, v4, v1, p2, p3, p3, p2, p3, p2, p1, p2, p3, p2, p1, p2, p3, p1, v3, v4, l2, l1, v1, v3, v3, p3, p3, p2, p1, p2, p1, v3, v4, v2, l2, l3, l2, l3, l2, l2, v1, p3, p2, pp, v3, v4, v2, v1],
[v2, v2, v1, v2, v2, l2, l2, v2, p1, p2, p3, p2, p2, p1, p3, p2, p1, p2, p2, p2, p1, v1, v3, v2, l1, l3, l2, l3, l1, v1, p1, p3, p2, p1, p1, p2, v2, v3, v1, l1, l1, l3, v3, v1, v1, v1, p2, p1, p2, p3, v4, v3, v3],
[v3, v4, v2, v1, l3, l1, l1, v3, p2, p1, p2, p1, v3, v3, v2, v3, p3, p2, p1, v2, v3, v1, v4, l3, l2, l1, v1, v4, l2, v3, p2, p3, p1, p2, p2, p3, v1, v3, v2, l3, l2, l1, l2, v2, v1, p2, p3, p2, p3, p2, v3, v2, v1],
[v2, v2, v1, v2, l2, l3, v1, v2, p3, p2, p1, p3, v2, l3, v1, v4, v2, v4, v3, v1, v1, v1, l3, l2, l2, l3, l2, l2, l3, v2, v1, p3, p3, p2, p1, p2, p2, v3, v4, v2, v1, v1, v3, p3, p2, p3, p2, p1, p1, p2, v1, v3, v3],
[v3, v4, v3, v1, v1, v3, v3, p2, p2, p3, p2, p2, v2, l2, l2, v4, v2, v4, v3, v1, l2, l1, l2, l1, v2, l2, l1, l1, v2, v2, v1, p2, p2, p1, p2, p1, p2, p3, v3, v3, v3, v3, p2, p3, p2, p1, p3, p2, p1, v2, v3, v2, v4],
[v4, v2, v2, v1, v1, v2, v4, p1, p3, p1, p3, v2, v3, l1, l1, l3, v4, v3, l3, l1, l2, l3, l1, v2, v3, v4, v4, v2, v2, v1, p3, p3, p3, p2, p3, p2, p1, p3, p3, p3, p2, p1, p3, p2, p1, p2, p1, p2, p3, v2, v4, v3, v3],
[v3, v4, v2, v1, v1, v3, p1, p2, p1, p2, p1, v2, l2, l2, l3, l2, l1, l1, l2, l3, l1, l2, v4, v2, v1, v2, v3, p1, p3, p2, p1, p2, p2, p1, p1, p2, p1, p2, p1, p2, p2, p1, p2, p3, p2, p3, p2, p1, v3, v4, v2, v1, v1],
[v2, v3, v2, v2, v4, v3, p2, p3, p1, p3, p2, v2, v3, l3, l2, l1, l2, l3, v1, l2, v1, v3, v4, v2, v4, v1, p2, p2, p1, p2, p2, p3, p3, p2, p3, p2, p1, p2, p1, p2, p3, p2, p3, p2, p1, p2, p1, p2, v3, v4, v2, v1, v1],
[v3, v4, v2, v2, v1, v4, p3, p1, p2, p1, p2, p1, v1, l2, l3, l1, l3, v4, v2, v2, v1, p2, p3, p1, p2, p1, p1, p3, p1, p2, p1, p2, p1, p1, p1, p1, p2, p3, p3, p2, p3, p2, p1, p2, p3, p1, p3, v3, v4, v2, v1, v1, v3],
[v3, v2, v4, v1, v1, v3, p2, p2, p1, p2, p3, p2, v1, v4, l1, l1, v1, v3, v3, p1, p2, p1, p2, p2, p2, p3, p2, p2, v3, v3, v3, p2, p2, v3, p2, p2, p3, p2, p1, p1, p1, p3, p1, p2, p1, p2, v3, v4, v2, v1, v1, v3, v4],
[v1, v4, v3, v3, v1, v2, v3, p3, p2, p3, p2, p3, v3, v4, v2, v1, v1, p3, p2, p3, p2, p2, p1, p2, p3, p2, p1, v1, v1, v2, v3, v4, v4, v2, v2, v1, p1, p3, p2, p3, p2, p1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3],
[v3, v1, v2, v1, v1, v3, v1, p1, p3, p1, p2, p3, v2, v3, v2, v3, p2, p2, p3, p2, p3, p2, p1, p2, p2, p3, v2, v3, v1, v1, v3, v2, v1, v4, v4, v3, v2, v1, v3, v2, v4, v3, v3, l3, l1, l1, v3, v4, v4, v2, v1, v3, v2],
[v3, v4, v2, v1, l1, v4, v3, p2, p2, p3, p2, p1, p3, v2, v3, v1, p1, p2, p1, p3, p2, p3, p3, p2, p1, v2, v3, v1, l1, l2, v2, l2, l1, l2, l3, v2, v1, v3, v2, v4, v3, l2, l1, l2, l3, l2, l3, v4, v2, v1, v3, v2, v3],
[v2, v2, l3, v2, l2, l3, v1, v2, p1, p2, p1, p2, p2, v3, v4, v3, v3, p3, p2, p1, p3, p1, v3, v4, v2, v1, v1, l1, l2, l3, l2, l2, l1, l3, l2, l3, v2, v4, v3, v1, l1, l3, l2, l1, l2, l3, l2, v4, l2, l3, v1, v1, v4],
[v3, v4, l2, v1, l1, l1, v3, v3, p2, p3, p2, p3, p1, v3, v4, l2, v2, v1, p3, p2, p2, v2, v3, v1, v1, v3, l2, l3, v4, l1, l1, v2, l1, l1, l3, l2, l3, v3, v4, v2, l1, l2, l2, v4, v2, l1, l2, l1, l3, l2, l1, v1, v3],
[v2, v2, l3, l2, l3, l1, l2, v2, p3, p2, p1, p2, p2, p3, v2, l3, l1, v2, v3, v2, v1, v4, l2, v3, v2, v1, l1, v2, v4, v3, v3, v4, v2, l1, l2, l3, l2, v2, l2, l3, l2, l3, v1, v1, v2, l2, l3, l1, l2, l3, l2, l3, l2],
[v3, v4, v2, l3, l2, v3, v3, v3, p2, p2, p3, p2, p3, p2, v2, v3, l2, l2, l3, v4, v3, l3, l1, l1, v3, v4, v2, v1, v4, v2, v3, v1, v4, v2, l1, l2, l1, l3, l1, l2, v4, l3, l2, v1, l2, l3, l1, l2, l1, l2, l2, l3, l2],
[v1, v3, v2, v3, v4, v4, v2, v2, v1, p1, p2, p3, p2, p1, p3, v2, v3, v1, l2, v2, l1, l2, l3, l2, v1, v3, p2, p1, p3, p2, v2, v3, v1, v4, v2, l3, l2, l1, l1, v1, v2, l2, l1, l3, l2, l2, l1, l3, l2, l1, l3, l1, l3],
[v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, p2, p3, p2, p1, p2, p2, p1, v2, v2, v1, v3, v2, v4, v1, v2, p1, p3, p2, p1, p3, p1, p2, v2, v3, v1, l2, l3, l2, l3, v1, v1, v1, l3, l2, l3, v4, v2, l2, l1, l1, l2, l2, l1],
[v3, v4, v2, v4, v1, v3, v4, l3, l1, v1, p1, p2, p1, p3, p2, p1, p2, p1, p2, p2, v3, v3, v3, p2, p2, p3, p2, p2, p3, p2, p3, p2, p3, p2, v2, v3, l1, l3, v2, v4, v3, v1, v1, v1, v2, v2, v1, v2, l2, l3, l2, l3, v3],
[v2, v3, v1, v4, v2, v4, l3, l2, v4, v1, p3, p3, p2, p2, p1, p2, p3, p2, p1, p2, p3, p2, p1, p3, p3, p2, p2, p1, p2, p3, p2, p1, p1, p2, p1, v3, v4, v2, v1, v1, v3, v3, p2, p1, p2, v3, v4, v2, v1, l2, l1, v3, v3],
[v3, v4, v2, v1, v1, v2, l2, l3, v1, v2, v3, p1, p3, p2, p1, p2, p1, p2, p3, p2, p2, p1, p2, p3, p2, p1, p3, p1, p2, p3, p2, p3, p2, p1, p3, p2, p3, v3, v3, v3, p1, p2, p3, p2, p3, p2, p1, v3, v4, v2, v1, v1, v3],
[v3, v4, v2, v1, l1, v3, v4, v1, v1, v2, v4, p2, p2, p1, p2, p3, p1, p3, p2, p2, p1, p2, p3, p2, p1, p1, p2, v3, v3, v3, p2, p1, p2, p3, p2, p3, p2, p1, p2, p1, p2, p3, p2, p1, p2, p1, p2, p1, v3, v4, v2, v1, v1],
[v2, v3, v1, v4, l1, l3, v3, v1, v3, v1, v2, v3, p3, p2, v3, v3, v3, p1, p3, p3, p2, p3, p2, p1, p2, p3, p1, v3, v3, v3, v3, p2, p1, p2, p1, p2, p1, p2, p3, p2, p3, p2, p3, p2, p1, p2, p1, p2, p1, v3, v3, v2, v3],
[v3, v4, v2, l1, l2, v2, v4, v2, v1, v1, v3, v4, v2, v1, v1, v3, v3, p2, p2, p1, p1, p2, p1, p2, p2, p3, v3, v4, v2, v1, v1, p3, p2, p3, p2, p2, p1, p2, p3, p3, p2, p3, p2, p1, p2, p3, p2, p3, p2, pp, v4, v3, v4],
[v3, v4, v2, l3, l2, l3, v4, v2, v4, v1, v2, v2, v1, l1, l2, l1, v1, v2, p1, p2, p3, p3, p2, p1, v2, v2, v1, v2, l3, l3, v1, v2, p3, p2, p3, p1, p2, p3, p1, p2, p3, p2, p1, p2, p3, p2, p1, p2, p1, v3, v3, v1, v3],
[v2, v3, v1, v1, l1, l2, l1, v4, v4, v3, v2, v1, l2, l3, l1, l3, v3, v4, v2, v1, v3, v4, v4, v2, v1, v2, l3, l2, v4, l2, l1, v3, v1, v1, v1, v3, v3, p2, p3, p2, p1, v3, v3, v3, p2, p3, p2, p3, v3, v4, v2, v1, v1],
[v2, v3, v1, v4, l3, l2, l3, v1, v1, v1, l3, l2, l1, l2, l3, l2, v4, v4, v1, v1, v2, v3, v1, v4, v2, l2, l1, v1, v1, v2, l1, l3, l2, l3, v1, v3, v4, v4, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v4, v3, v3],
[v2, v3, v1, v1, v3, l1, v1, v4, v4, v3, v2, l2, l2, l3, l2, l1, v3, v4, v2, v1, v3, v4, v4, v2, v1, l2, l3, v1, v1, l1, l1, l1, l1, l1, l2, v2, v1, v3, v2, v4, v3, v3, v4, v2, v1, v3, v4, v4, v2, v1, v3, v1, v2],
[v3, v4, v2, v1, v1, v3, v4, v2, v2, v1, v3, v4, l3, l2, v1, v3, v4, v2, v3, v1, v2, v3, v1, v4, v2, l1, l3, l1, l2, l3, l3, v4, l3, v1, v1, v1, v4, v2, v1, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v1, v2, v3],
[v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v3, v4, v2, v1, v1, v3, v4, v2, v2, v1, v2, v3, v1, v1, v3, v2, l1, l2, l1, v3, v2, v1, v3, v2, v4, v3, v3, v4, v2, v1, v3, v4, v4, v2, v1, v3, v4, v2, v1, v1, v3, v3, v2],
[v3, v3, v1, v1, v3, v2, v1, v4, v4, v3, v2, v1, v3, v2, v4, v3, v3, v4, v2, v1, v3, v4, v4, v2, v1, v2, v3, l3, v4, v2, v4, v3, v1, v1, v1, v3, v4, v3, v1, v1, v3, v4, v1, v1, v1, v3, v4, v2, v1, v1, v3, v1, v3],
[v4, v3, v1, v4, v2, v4, v3, v1, v1, v1, v2, v4, v2, v1, v1, v2, v3, v1, v1, v3, v2, v1, v4, v4, v3, v2, v1, v3, v2, v4, v3, v3, v4, v2, v1, v3, v4, v4, v2, v1, v2, v3, v1, v4, v2, v4, v3, v1, v1, v1, v1, v4, v3]
],
"elevation": [
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e1, e1, e1, "", "", e1, e1, e1, e1, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", e1, e1, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", e1, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", e1, "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", ""],
["", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", ""],
["", "", "", "", "", "", "", "", e1, e2, e2, e2, "", "", "", "", e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", e2, e1, e1, e1, e1, e1, e1, "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, "", "", "", "", e2, e2, e1, e1, e1, e1, e1, "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e1, e1, e1, e1, e1, "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e3, e3, e3, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e1, e1, e1, e1, "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e3, e3, e3, e3, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e1, e1, e1, "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", e5, e4, e4, e4, e4, e3, e3, e3, e3, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e1, e1, "", "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", e5, e5, e5, e4, e4, e4, e4, e3, e3, "", "", "", e2, e2, "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", e5, e5, e5, e5, e5, e4, e4, e4, e4, e3, "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", e5, e5, e5, e5, e5, e5, e5, e4, e4, e4, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", e5, e5, e5, e5, e5, e5, e5, e4, e4, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", e5, e5, e5, e5, e5, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", e5, e5, e5, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
]
},
"cave": {
"moveable": [s1, s2, s3, pp],
"players": {},
"background": r2,
"map": [
[r2, r3, r1, r3, r3, r3, r2, r1, r1, r1, r3, r2, r3, r1, r2, r3, r3, r1, r1, r2, r3, r3, r1, r3, r1, r2, r3, r3, r1, r1, r3, r1, r2, r3, r3, r2, r3, r3, r2, r3, r3, r3, r3, r2, r3, r3, r3, r3, r3, r2, r3, r2, r2, r3, r3, r1, r2],
[r2, r1, r3, r3, b2, b2, r1, r2, r3, r1, r1, r2, r2, r1, r2, r3, r1, r1, r2, r3, r2, r3, r2, r3, r3, r1, r3, r2, r1, r2, r3, r3, r3, r3, r3, r3, r3, r3, r3, r1, r1, r3, r3, l1, l1, l2, l1, r2, r3, r2, r3, r1, r1, r3, r1, r4, r3],
[r2, r2, r3, b2, b2, b3, b1, r3, r3, r3, r3, r1, r1, r3, r1, r3, r1, r2, r3, r3, r2, r1, r2, r1, r2, r3, r3, r2, r1, r3, r2, r3, r2, r2, r2, r3, r2, r3, r3, r2, l3, l3, l1, l3, l3, l2, l3, l3, l3, l2, l3, l3, r3, r2, r1, r3, r1],
[r4, r2, r1, b1, b2, b1, b1, r3, r3, r3, r3, r1, r1, r1, r3, r2, r1, r2, r1, r3, r3, r2, r3, r3, r1, r3, r1, r2, r2, r1, r3, r2, r2, r3, r3, r2, r3, r3, r3, r3, l2, l2, l2, l1, l3, l1, l2, l2, l2, l3, l1, l2, l3, r3, r1, r2, r4],
[r1, r2, r3, r3, b1, b1, r1, r3, r1, r2, r3, r1, r3, r1, r3, r3, r2, r1, r2, r1, r3, r1, r3, r1, r3, r1, r2, r1, r1, r2, b3, r1, r1, r2, r3, r3, r3, r1, r3, r1, r1, l2, l1, r1, r1, r3, r1, r1, r1, r1, l3, l2, l3, r1, r3, r1, r2],
[r2, r4, r3, r3, b1, b2, r1, r2, r1, r2, r3, r3, r3, r3, r1, r3, r3, r2, r3, r1, r2, r1, r1, r1, r3, r3, r3, r3, r1, b3, b3, b3, b1, r1, r3, r2, r1, r2, r3, r3, r3, r2, r1, r3, r2, s3, s3, s3, s1, r3, r3, l3, l1, l2, r3, r3, r1],
[r2, r1, r3, r3, r3, r3, r2, r3, r3, s2, s1, s2, s1, s3, s3, s2, s3, r3, r3, r3, r3, s2, s3, s1, s2, s3, r3, r2, b3, b3, b2, b1, b3, b1, r1, r2, r3, r3, r3, r3, r3, r2, s3, s1, s1, s3, s3, s3, s1, s1, r3, l1, l3, l2, r3, r4, r3],
[r3, r4, r3, r1, r1, r3, r3, r3, s1, s2, s1, s3, s3, s1, s1, s1, s2, s2, s2, s2, s2, s2, s2, s2, s2, s1, s3, r2, r3, b3, b1, r2, b3, b2, r1, r3, r3, r3, r2, r3, r2, s3, s2, s2, s1, s1, r1, r3, s2, s3, r2, l1, l2, l3, r1, r3, r1],
[r1, r2, r1, r3, r1, r1, r2, s1, s2, s2, s3, s1, s1, s3, r2, r3, r1, s3, s1, s1, s1, r3, r3, s1, s1, s3, s2, s3, r3, r3, r2, r3, r3, r1, r2, r1, s3, s3, s1, s3, s3, s2, s2, r3, r2, r1, r3, r2, s2, s2, r1, l3, l3, l1, l2, r4, r3],
[r4, r3, r3, r3, r1, r3, s3, s3, s1, s2, r1, r1, r3, r3, r2, r2, r2, r3, r1, r3, r3, r3, r2, r3, s1, s1, s3, s2, s3, r3, r3, r1, r3, r1, r2, s1, s1, s1, s3, s3, s3, s1, s3, r1, r3, r2, r3, r3, s3, s3, r3, r2, l1, l2, l2, r3, r1],
[r2, r1, r3, r3, r1, r2, s3, s3, s1, r2, r3, r3, r3, r3, b1, b2, b2, b3, r3, r2, b1, r1, r1, r3, r3, s2, s3, s1, s1, s2, r3, s1, s3, s3, s1, s2, s3, r3, r1, r3, s2, s3, r3, r2, r3, r3, r3, s1, s1, s3, r3, r2, l1, l1, l1, r1, r2],
[r3, r4, r2, r2, r1, r3, s3, s2, s2, r1, r3, r2, r3, r3, r3, b2, b2, b1, b3, b1, b2, r3, r1, r2, r3, r1, s2, s3, s3, s2, s3, s1, s1, s2, s1, s3, r1, r3, r2, r2, s3, s3, s2, r3, r1, s3, s2, s3, s1, r2, r3, l2, l3, l1, r3, r4, r3],
[r2, r1, r3, r1, r3, r3, s1, s1, s3, s3, r3, r3, r3, r3, r1, r2, r1, b2, b3, b3, r3, r3, r3, r3, r3, r3, r1, s1, s1, s3, s3, s3, s2, r2, r3, r3, r3, r2, r3, r1, r3, s3, s2, s3, s2, s3, s1, r3, r3, r1, l3, l1, l2, l2, r1, r2, r4],
[r4, r2, r2, r3, r1, r3, r2, s1, s2, s3, s2, r3, r3, s2, s3, s3, r1, r3, r1, r3, r3, r1, s1, s1, r1, r3, r3, r3, s3, s1, s3, r3, r3, r3, r3, l3, l3, l3, r3, r1, r1, s1, s3, s2, s1, s1, s3, r3, r3, l2, l2, l2, l3, r3, r2, r1, r2],
[r3, r4, r3, r3, r3, r3, r2, r1, s3, s3, s3, s3, s2, s1, s3, s2, s3, r2, r3, r3, s3, s3, s1, s3, s3, r2, r1, r3, r3, r3, r3, r3, r3, r2, r3, l1, l2, l1, l1, r3, r2, r3, r2, r3, r3, r3, r3, r1, r3, r3, l3, l3, r2, r3, r3, r3, r1],
[r2, r1, r3, r1, r1, r3, r3, r3, r3, s2, s2, s2, s3, s1, s3, s2, s3, s1, s2, s3, s1, s3, s1, s3, s3, s1, r1, r3, r1, r3, r3, r1, r3, r1, r2, r2, l1, l1, l1, r3, r1, r2, s2, s1, s1, r1, r1, r1, r3, r3, r1, r2, r3, r3, r3, r4, r3],
[r2, r4, r3, r1, r3, r1, r1, r3, r1, s3, s1, s1, r2, r3, r3, r2, s2, s1, s3, s2, s3, s3, s1, s1, s3, s1, s1, r3, r1, r3, r2, r1, r3, r3, r3, r2, r3, l2, r2, r1, r3, s1, s2, s3, s3, s1, s3, r1, r1, r3, r3, r1, r1, r3, r1, r1, r2],
[r3, r2, r1, b1, b2, r2, r3, r3, r1, s2, s2, r3, r2, r1, r3, r3, r3, s3, s2, s3, s1, s1, r1, r3, r1, s3, s1, s3, s3, r3, r3, r1, r3, r3, r1, r3, r3, r3, r2, r1, s3, s3, s1, s3, s1, s2, s1, s1, r3, r1, r3, r2, r3, r3, r1, r2, r4],
[r4, r1, b1, b1, b1, r3, r1, r1, s2, s1, s2, r2, r3, r3, r3, r1, r3, r1, r2, r2, r3, r3, r2, r3, r3, r3, s1, s3, s2, s1, s1, s1, s1, s3, s1, s3, s3, s1, s1, s3, s2, s2, r2, r3, r2, s3, s3, s2, r1, r2, r3, r3, r2, r3, r3, r3, r1],
[r3, b2, b3, b3, b2, r1, r1, r2, s3, s1, s2, s1, r3, r3, r3, r1, r1, r1, r3, r3, r3, b2, b1, b3, b1, r3, r3, s3, s2, s2, s3, s3, s1, s3, s2, s3, s3, s2, s2, s2, s2, r1, r1, r2, r3, s3, s2, s3, r3, r3, r2, r3, r3, r3, r2, r4, r3],
[r2, b3, b1, b1, b1, r1, r3, r1, s1, s3, s2, s3, r1, r1, r1, r2, r3, s2, s2, s3, r3, r2, b1, b2, b1, r3, r3, r1, r3, s3, s1, s3, s1, s2, s3, s3, s1, s3, s1, s1, r3, r2, r2, r3, r2, s1, s2, s3, r2, l2, l3, r3, r2, r3, r2, r2, r4],
[r4, r2, r1, b1, r3, r1, r3, r3, s3, s3, s1, s3, r1, r2, r3, r3, s1, s2, s2, s3, s2, r3, b3, b3, b3, b3, b3, r3, r2, r2, s2, s3, s1, s2, r3, r2, r1, r1, r3, r1, r2, r1, r1, r3, r3, s2, s2, s3, r3, l3, l1, l1, r3, r3, r2, r4, r3],
[r4, r2, r1, r3, r3, r2, r3, r1, s2, s2, s2, s1, r3, r1, s2, s3, s1, s3, s1, s3, s2, r3, r3, b2, b3, b3, b2, r1, r3, s1, s1, s3, s2, r2, r3, r3, r3, r3, r3, r3, r1, r2, r3, r3, r3, r3, s1, s1, r3, l3, l1, l3, r2, r2, r3, r3, r1],
[r3, r3, r1, r2, r3, r1, r3, r3, s3, s2, s3, s2, r1, s1, s3, s2, s1, s3, s1, s3, s3, s2, r1, b3, b3, r1, r3, r3, s3, s2, s2, s3, r2, r2, r2, r2, r3, r2, r3, r3, r3, r1, r3, r3, r3, r2, s3, s3, r2, r1, l1, l3, r1, r1, r2, r1, r2],
[r4, r2, r1, r1, r3, r3, r2, r3, r3, r3, s1, s2, s2, s3, s3, s3, r1, r2, s1, s2, s2, s3, r1, r1, r3, r3, r1, s3, s3, s3, s1, s2, s3, r1, r2, r2, r3, r3, r3, r1, r1, r3, r3, r3, r1, r3, s2, s2, r3, r3, l2, l2, r3, r1, r3, r2, r4],
[r1, r2, r1, r1, r3, r3, r1, r2, r3, r2, s1, s3, s3, s3, s3, r2, r1, r2, r2, s1, s2, s3, s2, r3, r3, r1, r1, s1, s1, s3, s1, s3, s1, s3, r2, r1, r2, r1, r2, r3, r3, r3, r1, r2, r2, r2, s2, s3, r3, r3, r3, r3, r1, r3, r2, r4, r3],
[r3, r2, r3, r3, r3, r2, r3, r3, r3, s1, s2, s2, s3, r1, r2, r2, r3, r3, r2, r2, s3, s3, s2, s3, r2, r3, r3, s2, s1, s3, s3, s2, s3, s1, s1, s3, r1, r1, r2, r2, r3, r3, r3, r2, r3, s3, s3, s1, r3, r3, r3, r1, r1, r3, r1, r3, r1],
[r2, r1, r1, r3, r1, r3, r2, r3, s3, s2, s1, s2, r2, r3, r3, r3, r3, r2, r3, r1, s3, s1, s2, s3, s1, r3, s2, s2, s3, s1, s2, s2, s3, s2, s1, s3, s3, s3, r3, r3, r3, r1, r3, r3, s2, s2, s2, s2, r1, r3, r3, r3, r3, r1, r3, r4, r3],
[r2, r4, r1, r3, r3, r3, r3, r3, s1, s3, s1, r3, r3, r1, r3, r3, r3, r2, r1, r2, r3, s2, s1, s1, s1, s1, s3, s2, s2, s1, s1, s1, r3, r1, s1, s2, s3, s1, r2, r1, r3, r1, r3, r2, s3, s1, s3, r2, r3, b2, b1, r3, r2, r2, r3, r2, r4],
[r4, r1, r2, r2, r2, r3, r3, s3, s3, s2, r2, r2, r3, r1, r3, r3, r3, r2, r2, r3, r1, r1, s1, s3, s3, s2, s2, s3, s3, s2, r1, r2, r3, r1, r2, s1, s3, s3, s1, s2, r1, r1, r1, s1, s3, s2, r1, r3, b2, b1, b1, b1, r3, r1, r2, r1, r2],
[r2, r2, r1, r2, r2, r2, r3, s2, s2, s1, r2, r3, r3, r3, r3, s1, s2, r3, r3, r2, r1, r1, s2, s2, s2, s2, s2, s1, r2, r2, r3, r1, r3, r2, r1, r3, s2, s1, s2, s3, s1, r3, r3, s1, s2, s3, r1, r3, b1, b2, b2, b1, b2, r2, r3, r2, r4],
[r4, r4, r3, r1, r2, r3, r1, s3, s1, s3, r2, r3, r3, r3, s1, s2, s1, r3, r2, r2, r3, r3, r1, s2, s1, s2, s1, r1, r3, r3, r3, r1, r2, r2, r2, r3, r3, r2, s3, s3, s1, s2, s3, s3, s1, r1, r2, r1, r3, b2, b1, b1, b3, r3, r3, r4, r3],
[r3, r1, r2, r2, r2, r2, r3, s1, s3, s2, s3, r3, r1, r3, s1, s2, s1, s3, r3, r3, r3, r3, r1, r3, s3, s2, s3, r2, r2, r1, r2, r2, r3, r3, r1, r3, r2, r2, r1, s3, s1, s3, s2, s1, r3, r3, r3, r1, r1, r3, b1, b1, b2, r3, r2, r3, r1],
[r3, r2, l2, r3, r1, r2, r1, s2, s2, s1, s3, s2, s1, s3, s1, s1, s1, s2, s2, r3, r3, r1, r2, s3, s1, s3, r2, r2, r3, r1, r1, r2, r1, r3, r3, r3, r3, r3, r2, s3, s2, s2, s2, r3, r3, r2, r2, r1, r3, r3, r3, r3, r1, r3, r2, r2, r4],
[r1, r2, l3, l1, r3, r2, r3, s1, s3, s3, s3, s2, s2, s2, s2, s1, s2, s1, s3, s3, r3, r2, s1, s2, s2, r3, r1, r2, r3, r1, r3, r3, r2, r3, r3, r3, r2, r2, r3, r3, s1, s2, s2, r3, r3, l2, l3, r3, r3, r1, r3, r1, r3, r1, r3, r1, r2],
[r2, r4, l1, l1, l2, r3, r3, s2, s3, s2, s2, s1, s1, s1, s1, r3, s3, s3, s3, s1, s2, s1, s1, s1, s2, r3, r2, r3, r1, r1, r2, r1, r3, r2, r3, r3, r1, r3, s2, s1, s2, s1, r3, r3, r3, l3, l1, l3, r2, r2, r2, r1, r3, r3, r3, r3, r1],
[r1, r3, r2, l3, l3, r3, r3, r3, s3, s2, s2, s3, s2, s1, r2, r1, s2, s2, s1, s1, s2, s1, s2, s2, s2, r2, r3, r1, r3, r2, r3, r3, r3, r3, r2, r3, r3, s3, s3, s3, s2, r3, r2, r3, r1, r3, l3, l3, l2, r3, r2, r1, r3, r1, r3, r1, r2],
[r4, r3, r3, r2, l2, r3, r3, r2, r3, s3, s1, s1, s2, r1, r2, r3, r3, s1, s3, s1, s2, s3, s1, s3, s1, s1, r2, r3, r3, r1, r3, r3, r3, r3, r3, r1, s2, s2, s1, s2, r2, r3, r3, r3, r2, r3, l3, l2, l2, l2, r2, r3, r3, r1, r3, r3, r1],
[r2, r1, r3, r3, r1, r2, r1, r2, r3, r2, s3, s2, s2, r3, r2, r2, r3, s3, s3, s2, s1, s3, r2, s1, s2, s1, s1, r3, r1, r3, s1, s2, s1, s1, s1, s2, s3, s1, r3, r2, r3, r2, r3, r2, r1, r3, r1, l3, l2, l1, r3, r3, r2, r3, r2, r4, r3],
[r3, r1, r1, r2, r3, r2, r2, r3, r1, r1, s3, s2, s1, r3, r2, r1, s2, s2, s1, s3, s2, s3, r2, r1, s3, s3, s3, s2, r2, s2, s2, s2, s3, s1, s2, s3, s2, r3, r1, r3, r3, r2, r2, r2, r1, r1, r1, r3, l1, l3, r2, r3, r1, r1, r3, r2, r4],
[r2, r4, r1, r1, r3, r3, r3, r1, r3, r1, s3, s3, s2, r3, s3, s2, s2, s1, s2, s2, s3, r3, r3, r1, r2, s1, s1, s3, s3, s3, s1, s1, s3, s2, s3, s1, r3, r1, r2, r3, s3, s2, s2, s3, r3, r1, r1, r3, r2, r3, r3, r1, r2, r1, r3, r3, r1],
[r1, r3, r3, r1, r1, r3, r3, r3, r1, s1, s3, s1, s2, s2, s2, s3, s1, s1, s3, s2, r1, r3, r3, r1, r1, r1, s2, s3, s3, s3, s3, s2, s3, r3, s1, s1, s2, r3, r1, s2, s2, s3, s1, s1, s2, r2, r3, r3, r3, r3, r3, r3, r1, r1, r3, r4, r3],
[r2, r3, r3, r1, r3, r3, r1, r2, s2, s3, s1, s3, s3, s3, s1, s3, r2, s2, s2, r2, r1, r1, r3, r3, r1, r2, r1, s3, s2, r3, r2, r2, r3, r3, s1, s2, s2, s3, s1, s1, s3, s3, s1, s2, s2, s3, s2, r3, r1, r1, r3, r2, r3, r3, r3, r2, r4],
[r4, r3, r1, r3, r1, r3, r1, s1, s1, s1, s1, s3, s2, s2, s2, r3, r2, r2, r3, r2, r3, r3, r3, r2, r2, r3, r3, r3, r1, r1, r1, r3, r3, r2, r3, s3, s2, s2, s3, s3, s2, s3, r2, r3, s2, s1, s1, s3, r2, r3, r3, r1, r1, r3, r1, r1, r2],
[r1, r2, r2, r3, r2, r1, r1, s1, s2, s1, s1, s3, r1, r2, r3, r2, b3, b1, b2, r2, r1, r1, r1, r1, r1, r2, r1, r3, r3, r3, b1, b2, r3, r1, r1, r3, s3, s3, s3, s1, s1, r3, r3, r2, r3, s3, s1, s2, s1, s3, r3, r1, r2, r3, r3, r2, r4],
[r4, r1, r3, r3, r3, r1, r3, s1, s1, s1, s3, s2, r2, r2, b3, b2, b3, b2, b2, b1, r3, r3, r3, r2, r1, r2, r2, r3, r2, b2, b1, b1, b1, b3, r3, r1, r2, r3, r2, r3, r2, r2, l1, r2, r2, r3, r3, r2, r3, s2, r1, r1, r1, r3, r2, r3, r1],
[r3, r1, r2, r3, r1, r3, r2, pp, s2, s3, s2, r1, r3, b2, b3, b1, b2, b1, b2, b2, r2, r3, r3, r3, r3, r1, r3, b3, b2, b2, b3, b1, b2, b2, r3, r2, r3, r3, r2, r2, r3, r2, l2, l2, r3, r1, r3, r3, r2, pp, r3, r1, r2, r1, r3, r4, r3],
[r1, r2, r3, l2, r1, r2, r1, r2, r3, r2, r2, r2, b2, b3, b2, b1, b3, b1, b2, b1, b3, r3, r1, r1, r3, r3, b1, b2, b2, b3, r2, b1, b1, b2, b2, r3, r3, r3, r3, r2, r1, l3, l1, l1, l1, r1, r3, r3, r3, r3, r2, r3, r3, r2, r1, r2, r4],
[r4, r2, r2, l2, l3, r3, r3, r3, r3, r3, r1, r2, b2, b2, b1, b2, b1, b3, b2, b3, b3, r2, r1, r3, r3, b1, b3, b3, b2, r3, r1, r1, b1, b2, b2, r3, r2, r3, r2, r1, l3, l2, r3, l2, l2, r1, r2, r2, r3, r1, r2, r2, r3, r3, r3, r3, r1],
[r1, r2, r1, l1, l2, l1, r1, r3, r1, r1, r1, b2, b1, b1, b1, b2, b3, b2, b1, b1, b3, b1, r3, r2, b1, b2, b3, r1, r2, r1, r2, r2, r3, r3, r1, r2, r2, r1, r3, r3, r1, r3, r3, r3, r3, r3, r3, r2, r2, r3, r1, r2, r3, r3, r1, r2, r4],
[r4, r1, r3, r3, l3, l3, r3, r2, r3, r2, r3, b2, b2, b2, b3, b3, b3, b3, b2, b1, b3, b1, b2, b2, b2, b3, r3, r3, r2, r3, r3, r2, r3, r1, r3, r2, r2, r1, r2, r2, r3, r2, r3, r1, r3, r3, r3, r3, r1, r3, r3, r2, r3, r3, r3, r1, r2],
[r3, r1, r2, r2, r2, r1, r3, r3, r2, r3, r3, r1, b2, b1, b2, b2, b2, b1, b2, b3, b2, b1, b1, b1, b2, r2, r1, r3, r3, r2, r3, r2, r3, r2, r3, r3, r3, r1, r2, r3, r2, r3, r3, r1, r3, r3, r3, r1, r2, r3, r3, r1, r2, r1, r3, r3, r1],
[r2, r3, r1, r3, r3, r3, r2, r1, r1, r1, r3, r2, b3, b2, b1, b1, b3, b2, b3, b2, b3, b2, b3, b3, r1, r2, r3, r3, r1, r1, r3, r1, r2, r3, r3, r2, r3, r3, r2, r3, r3, r3, r3, r2, r3, r3, r3, r3, r3, r2, r3, r2, r2, r3, r3, r4, r3],
],
"elevation": [
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, "", "", e1, e1, e1, "", "", "", "", "", "", e1, e1, "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
]
},
"snow": {
"players": {},
"background": r2,
"map": [
[r1, r1, r1, r2, r1, r1, r2, r1, r1, r1, r1, r1, r1, r3, r2, r3, r3, r2, r1, r1, r2, w1, r3, r1, r1, r1, r1, r3, r3, r2, r1, r1, r1, r1, r3, r1, r2, r1, w3, r1, r3, r2],
[r2, i2, i1, r1, r1, r4, r1, r3, r1, r1, r1, r1, r3, r1, r2, r1, r1, r1, r2, r1, w2, w1, r1, r2, r1, r1, r1, r2, r3, r2, r2, r1, r2, r3, r3, r3, r1, r2, w3, w2, r2, r3],
[i2, i1, i1, i2, r1, r1, r2, r1, w2, w3, r3, r2, i2, i2, i1, i1, r3, r3, r3, r3, r2, w2, w3, r2, r2, w1, w3, w2, r2, r3, r1, w3, w1, r3, r3, r1, r3, r1, r2, r1, r1, r3],
[i1, i2, i3, i2, i2, r3, r2, w1, w3, w1, r3, i2, i1, i1, i1, i1, i3, r1, r1, r1, w2, w3, r1, r3, w3, w3, w3, w2, w1, r1, r1, r1, w1, w1, r2, r3, r2, w2, w3, r2, r3, r1],
[i3, i3, i2, i1, i3, r3, r1, w3, w2, r3, r3, r3, i3, i2, i1, i1, i3, r2, r1, r2, r1, r2, r3, r3, w1, w3, r1, w1, w2, w1, r3, r3, r2, r2, r3, r3, w1, w3, w3, r1, r1, r3],
[r3, i3, i2, i1, i2, r1, r2, r2, r1, r2, r1, r2, r2, r1, r3, r2, r3, r3, r3, r2, r1, r1, r3, r2, r2, r3, r2, r1, w1, w2, w2, r1, r2, r3, r1, r1, r2, w1, r1, r1, r1, r2],
[r2, i2, i3, i1, i2, i3, r1, w3, r1, r2, r3, r2, r3, r3, w1, r3, w3, r1, r1, r2, r2, r1, r2, r2, r1, r1, r1, r3, r3, w2, w1, w2, r1, w1, w3, r2, r1, r3, r2, r1, r3, r2],
[r2, r1, r1, i1, i1, r1, r1, r1, r2, r3, r1, w3, w2, w2, r3, r3, r1, r1, r3, w2, w3, w3, w3, r1, r1, r1, w3, r1, r3, r1, w1, w1, r3, r3, r1, w1, r1, r1, r2, r2, r2, r3],
[r2, r3, r2, r1, r1, r1, r3, w3, w1, w1, r2, r1, r1, r2, r1, r3, w3, w3, w3, w2, w2, w2, w3, w1, w3, w2, w2, w2, r2, r3, r1, r1, r2, r2, r1, r3, r3, r2, w1, w3, r1, r1],
[r3, r3, w3, r3, r1, r1, r1, w1, w3, r1, r3, r1, r3, r3, pp, w3, w3, w3, w1, w1, w1, w1, w2, w1, w3, w1, w3, w2, r2, r2, r1, r1, r1, r2, w2, r2, r3, w2, w2, w2, r1, r3],
[r3, w3, w2, r3, r1, w3, w3, r1, r3, r2, r2, r1, w2, w1, w1, w1, w3, w1, w3, r2, r1, r1, w1, w3, w1, w2, r1, r1, r2, r1, r3, w3, w1, r1, r2, r1, r2, r2, w2, r1, r1, r1],
[r1, r1, r1, r3, w3, w2, w1, r3, w2, r2, r3, w2, w3, w2, w1, w1, w2, w2, w2, w2, r2, w1, w1, w1, w2, r1, r1, r2, r3, w1, w3, w3, w1, w2, r3, r2, w3, r3, r3, r2, r2, r3],
[r1, r2, w3, w3, r1, w2, r3, r2, r2, r2, w2, w2, w2, r2, r1, w1, w2, w3, w2, w1, w2, w1, w1, w2, r1, r1, r2, r1, r3, w3, w3, w3, w3, w2, r3, r2, w3, r1, r1, r1, r2, r2],
[r3, r3, r2, r1, r1, r3, r3, r1, r2, r1, w2, w1, r1, r1, r3, r2, w2, w1, w3, w1, w1, w1, w1, w3, w3, r1, r1, r2, w3, w2, w2, w3, w2, w3, r2, r2, w3, r3, r1, r1, r1, r1], [r1, r2, r2, r1, r2, r1, w2, r2, r2, w1, w3, r1, r3, r1, i1, i2, i3, i3, w3, w1, w2, w1, w2, w1, w1, w1, w2, w1, w3, w3, w2, w3, w2, w3, w3, r2, r2, r3, w3, w3, r2, r1],
[r3, r3, r1, r1, r3, r1, w1, r2, r3, w2, w3, r3, i2, i1, i2, i1, i1, i2, i1, w1, w2, w2, w1, w3, w2, w2, w3, w2, w3, w2, w3, w3, w1, w3, w2, r2, r3, w3, w1, w1, r3, r1],
[r2, r1, r3, r1, r1, w2, r1, r3, r1, w3, w1, w2, i1, i3, i1, i2, i3, i3, i2, w3, w1, w1, w1, w3, w2, w3, w2, w2, w2, w1, w2, w2, w1, w3, w2, r2, r3, r1, w3, w1, w1, r1],
[r1, r1, r3, r2, w2, r2, r3, r1, w3, w1, w2, i2, i1, i1, i2, i2, i2, i3, i2, i3, r2, r3, w3, w2, w3, w2, w2, w2, w1, w2, w2, w1, w1, w3, w1, r1, r3, r2, r1, r1, r1, r1],
[r2, r2, w1, r3, r2, r2, r2, r1, w2, w3, w3, i2, i1, i1, i1, i3, i3, i2, i1, i1, r3, r3, r2, w1, w2, w3, w1, w2, w3, w2, w2, w1, w1, w3, w2, r1, r1, r3, r3, r1, r1, r3],
[r2, w2, w3, r1, r1, r2, r3, r3, w1, w3, w1, i1, i2, i1, i2, i2, i1, i2, i1, i2, i1, r1, r2, r1, w1, w1, w3, w1, w1, r2, r1, w1, w1, w2, w2, r3, r3, w1, w3, r2, r3, r3],
[r2, r1, r1, r1, r3, r1, r1, w3, w3, w1, w3, i2, i1, i2, i1, i3, i3, i1, i2, i1, i3, i3, i3, i2, w1, w1, w2, w3, r3, r1, r2, w1, w3, w2, r1, r3, r2, w3, w3, r3, r1, r1],
[r2, r1, r1, r1, w3, r1, r1, w1, w1, w2, w3, w1, i3, i1, i1, i1, i3, i1, i3, i3, i1, i3, i3, i1, i2, w2, w3, w1, r3, r2, r1, r3, w2, w3, r1, r2, r3, w3, r1, r1, r2, r2],
[r1, r1, r1, w3, w3, r1, r3, w1, w2, w2, w2, w3, w3, w2, i1, i3, i1, i3, i3, i1, i3, i3, i1, i2, i3, i1, w2, w3, w2, r1, r1, r2, w3, w1, r2, r2, r1, r2, r2, r1, r3, r1],
[r1, r1, r2, r1, r3, w3, r1, r3, w3, w1, w3, w2, w3, w1, w3, r3, r1, i3, i1, i1, i2, i1, i2, i3, i2, i2, w2, w1, w3, w2, w2, w1, w1, r2, r2, r2, w2, r2, r1, r3, r1, r2],
[r3, r2, r1, r1, w2, w3, r1, r3, w2, w1, w2, w2, w2, w1, w1, w2, r1, r3, r3, i3, i3, i1, i3, i2, i1, i2, w2, w1, w1, w3, w1, w3, w1, r1, r1, r2, r2, w3, r3, w2, w1, r1],
[r3, r1, r3, r1, w1, r1, r1, r1, w1, w2, w2, w2, w3, w1, w2, w1, w1, r2, r1, i1, i3, i1, i2, i3, i3, w1, w2, w1, w1, w2, w1, w3, w2, r2, r1, r2, w3, w3, w1, r1, w1, r2],
[r3, r1, r1, w3, w2, r3, r1, w2, w3, w1, w1, w1, w1, w2, w3, w2, w1, w2, i2, i2, i2, i1, i1, i3, w1, w1, w1, w2, w1, w2, w2, w2, w1, w2, r1, r3, r3, w2, w2, r2, r2, r1],
[r1, r1, w3, w1, w2, r2, r2, w3, w3, w1, w2, w2, w2, w1, w1, w2, w3, w1, w3, i1, i3, i2, i3, w1, w3, w1, w2, w3, w2, w1, w1, w3, w2, w2, r3, r1, r1, r1, r1, r1, r1, r1],
[r1, r3, r3, w2, r3, r3, r2, w3, w3, w2, w1, w3, r2, w3, w1, w1, w3, w1, w1, w3, w3, w1, w2, w2, w1, w2, w1, w3, w2, r1, r1, w2, w1, w1, w1, r1, w2, w1, r1, r3, r2, r1],
[r1, w3, r3, r1, r1, r1, r3, w1, w3, w1, w2, w2, r3, r1, w1, w1, w2, w1, w2, w1, w3, w2, w3, w1, w3, w2, w2, w1, r3, r1, r1, w1, w2, w1, w1, r2, r2, w2, w3, r1, r1, r1],
[r1, w3, r1, r2, w1, r1, r1, r1, w2, w3, w2, w2, w1, w3, w1, w3, w1, w3, w3, w1, w3, w3, w3, w1, w3, w2, w1, w1, r1, r1, w2, w1, w1, w3, w1, r3, r2, r3, w1, w3, w1, r3],
[r1, r1, r1, w3, w3, w2, r2, r2, w1, w2, w1, w2, w1, w2, w2, w2, w1, w3, w3, w1, w3, w3, w3, w2, w2, w3, w1, w2, w3, w2, w2, w3, w3, w3, w1, r3, r1, w3, r3, w3, r1, r3],
[r1, r2, r3, r3, r2, r3, r1, r3, w3, w3, w3, w1, w2, w2, w2, w2, w2, w1, w3, w3, w1, w2, w1, w2, w3, w1, w1, w3, w3, w2, w3, w1, w2, w1, w2, r1, w2, w1, r1, r2, r1, r2],
[r2, r2, i2, i2, r3, r1, r2, r1, r3, w2, w2, w3, w3, w1, w1, w3, w3, w3, r2, r1, w3, w3, w1, w3, w1, w3, w3, w3, w2, w2, w1, w1, w2, w1, w2, r2, r1, i3, i1, w1, r1, r1],
[r2, i1, i3, i2, i2, i3, r1, r1, r3, w3, w1, w3, w2, w3, w2, w1, w3, r1, r3, r1, r3, w3, w1, w3, w1, w3, w2, w3, r1, r1, r1, r2, w1, w2, w3, r1, i3, i2, i2, i3, r1, r1],
[r1, i1, i3, i2, i1, i1, i3, r1, r1, w2, w1, w1, w2, w1, w2, w1, w3, r1, r2, r3, r3, r1, w2, w3, w3, w1, w2, r1, r3, i1, i2, r2, w2, w1, w1, r3, i2, i2, i2, i1, w2, r3],
[r1, i3, i3, i1, i1, i3, i2, r1, r1, r2, w3, w2, w3, w3, w1, w1, w3, w1, r2, r2, r1, r1, r1, w3, w2, w3, r2, r1, i3, i1, i1, r2, w3, w3, w2, r1, i2, i3, i3, i3, r2, r1],
[r1, i3, i3, i1, i1, i1, r3, r3, r1, r1, w3, w3, w2, w1, w2, w1, w2, w1, r3, r2, r1, r1, w1, w3, w3, w2, r3, i3, i3, i3, r2, r2, w1, w3, r1, r1, r1, i2, i3, i1, r1, r3],
[r1, r3, i1, i1, r1, r1, r2, r3, r1, r3, w3, w1, w3, r1, r1, w3, w2, w3, w1, w3, r2, w2, w2, w3, w3, w1, r1, i3, i3, r1, r2, w1, w1, r1, r1, r3, r1, r1, r1, r1, r2, r1],
[r1, r3, r1, r1, r1, w2, r1, r3, r1, w2, w1, w2, w3, r1, r2, r3, w2, w3, w2, w1, w3, w1, w2, w1, w1, w1, r2, r1, r2, r3, w2, w1, w1, r1, r1, w1, r2, w2, w2, w1, r3, r1],
[r1, r3, r2, r2, w3, w3, r2, r2, r3, w1, w1, w1, w1, w3, r3, w3, w1, w2, w2, w2, w3, w1, w2, w2, w3, w1, w1, w3, w3, w3, w1, w1, r1, r3, w1, w2, r3, r2, r2, w3, w2, r1],
[r2, w1, w1, w3, r2, r1, r3, r1, w1, w2, w1, w1, w1, w3, w2, w2, w1, w3, w3, w3, w3, w2, w1, w3, w1, w3, w1, w2, w3, w3, w3, w3, r1, r1, r1, r1, r1, w3, r2, w3, w2, r1],
[r1, r1, w2, r3, r1, r2, r1, pp, w2, w3, w3, w1, w3, w2, w2, w2, w1, w2, r1, r3, r1, w1, w3, w1, w1, w2, w2, w1, w2, r1, r1, r3, r2, w1, r1, r1, w3, w1, r3, w3, w1, r2],
[r1, r1, r2, r2, r2, r2, r3, r1, r1, w3, w2, w1, w2, w1, w3, w2, r1, r2, r1, r1, r2, r3, w2, w1, w2, pp, r3, r2, r1, r1, r2, r2, r2, w3, w2, r1, w2, w1, w2, r3, r2, r2],
[r1, r1, r2, r1, r1, r1, r1, r1, r2, r3, r1, r1, r3, r1, r2, r2, r1, r3, r1, r2, r2, r1, r3, r1, r3, r2, r1, r1, r1, r1, r1, r3, r1, w3, r1, r3, r2, w1, r1, r1, w2, r1],
[r2, r1, r2, r1, r3, w3, r2, r2, w2, r1, r1, r1, r3, r1, r3, r2, w2, r1, r3, r2, w2, w2, r3, r1, r1, r2, r2, r1, r1, r1, r1, r2, w1, w3, r1, r1, r1, w2, w2, r1, r2, r2],
[r2, r1, r1, r2, w3, w3, r1, r2, w2, r2, w3, r1, w1, w2, r2, w3, w2, r2, r2, r1, r1, w2, r1, r1, r3, r2, w2, w2, r1, r3, r2, w2, w1, r1, r1, w1, r1, r2, w2, w1, r1, r1],
[r1, r1, r2, r3, r1, r3, r2, r2, r1, r2, r1, w3, w2, w3, r3, w2, w2, w3, r3, r3, r1, r1, r2, r3, r1, r1, w1, w3, w1, r3, r1, w3, r1, r2, w1, w2, w3, r3, w1, w3, w3, r3],
[r3, w1, w3, r1, r3, w2, r1, r2, w2, r1, r3, r2, w1, r3, r3, r1, w1, r3, r3, r2, w2, w2, r3, w2, r1, r1, r2, w3, w2, r1, r1, r1, r3, r3, w1, w2, r1, r1, r1, w3, w2, r3],
[r1, r3, w3, r1, r2, r3, r2, r3, r1, r3, w1, r3, r3, r1, r1, r1, r3, r1, r1, w3, w1, w2, w3, w3, w1, r1, r3, r1, r1, r3, r1, r3, r1, r1, r2, r1, r3, r2, w3, w1, w2, w3],
[r1, r1, r2, r1, r2, r1, r2, r2, r1, r1, r1, r2, r2, r1, r1, r2, r3, r1, w3, w3, w2, r1, r1, w3, w1, r2, r1, r2, r1, r3, r1, r1, r2, r1, r3, r1, r1, r1, r2, w2, w3, r1]
],
"elevation": [
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", "", e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, e1, "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
]
},
"beach": {
"players": {},
"background": b3,
"map": [
[r1, r3, r2, r3, r2, r2, r4, r3, r3, r3, r1, r2, r2, r4, r3, r4, r2, r4, r3, r4, r2, r4, r4, w1, w1, w2, w1, w1, w1, r1, r3, r3, r4, r3, r4, r1, r3, r1, r2, r2, r2, r4, r4, r1, r2, r4, r2, r3, r4, r3, r4, r3, r4],
[r3, r2, r1, r1, r2, r2, r4, r3, r4, r4, r4, r1, r1, r4, r4, w1, r3, r4, r4, r2, r2, r4, r3, r1, w1, w1, w1, w2, r4, r3, r3, r4, r1, r1, r3, r2, r4, r2, r2, r3, r1, r1, r2, r1, r2, r2, r3, r3, r4, r2, r4, r4, r4],
[r2, r3, r4, r2, r1, r4, r4, r1, r2, r4, r3, r2, r4, r3, r4, w1, r2, r1, r3, r1, r2, r2, r3, r1, r3, r1, r4, r1, r3, r3, r2, r1, r1, r4, r2, r2, r2, r3, r4, r2, r3, w1, w1, w2, w2, r1, r3, r3, r2, r4, r2, r3, r4],
[r1, r3, r2, r4, r1, r2, r1, r2, r4, r1, r1, r3, r1, r2, w2, w1, r4, r3, r4, r3, r1, r2, r4, r3, r3, r4, r1, r3, r3, r2, r2, r2, r2, r3, r3, r2, r4, r2, r1, r2, r2, r4, w1, w2, w2, w1, r1, r1, r2, r1, r3, r1, r3],
[r1, r3, r3, r2, r4, r3, r1, r2, r3, r1, r3, r4, r4, r1, w1, w2, w2, r2, r1, r2, r4, r1, r1, r1, r2, r1, r1, r1, r3, r2, r4, r3, r2, r2, r3, r4, r1, r3, r4, r4, r1, r4, r2, w2, w1, w1, r2, r4, r3, r1, r3, r3, r4],
[r4, r3, r3, r2, r2, r2, w2, w1, w2, r3, r1, r1, r1, r3, r2, w2, w1, r3, r4, r3, r3, r2, r4, r3, r2, r2, r1, r4, r4, r1, r2, r2, r2, r4, r2, w2, w1, w2, r4, r2, r3, r4, r1, r3, w1, w1, w1, r3, r1, r1, r4, r4, r4],
[r4, r3, r3, r4, r3, w2, w2, w1, w1, w1, r4, r1, r1, r1, r3, w1, w1, r2, r3, r1, r1, r3, r3, r2, r2, r3, r3, r2, r4, r2, r3, r2, r1, r4, w2, w1, w1, w1, r4, r1, r1, r2, r3, r2, r1, w2, w1, r1, r3, r2, r3, r1, r1],
[r2, r2, r4, r4, w2, w2, w2, w2, w1, w2, r1, r1, r3, r4, r4, r2, w1, w2, w2, w1, r4, r2, r4, r4, r3, r3, r1, r1, r2, r3, r4, r2, r3, r2, w1, w2, r3, r4, r1, r1, r4, r3, r1, r4, r1, w2, w1, r1, r2, r3, r3, r4, r1],
[r3, r4, r3, w1, w1, w1, w1, r3, r1, r4, r4, r1, r3, r4, r2, r3, w2, w1, w1, w1, r1, r4, r1, r3, r3, w2, w1, w1, r1, r3, r2, r3, r2, r1, r3, r4, r3, r2, r3, r3, r3, r3, r2, r3, r2, r3, r2, r3, r1, r4, r2, r2, r2],
[r2, r4, r3, r3, w2, w1, r3, r3, r3, r2, r2, r3, r1, r2, r4, r2, r3, w1, w1, r1, r2, r2, r4, r1, w1, w2, w1, w1, w1, r1, r4, r2, r2, r3, r2, r1, r4, r3, r3, r1, r2, r1, pp, r3, r4, r1, r2, r4, r4, r1, r4, r3, r2],
[r1, r3, r1, r2, r2, r3, r3, r1, r4, r3, r1, r2, r4, r3, r4, r3, r4, r1, r4, r3, r2, r3, w1, w2, w1, w2, r1, r1, r2, r1, r2, r2, r2, r4, r2, r4, r4, r3, r4, p1, p2, p2, p3, r3, r1, r3, r4, r1, r4, r4, r2, r4, r2],
[r2, r3, r2, r4, r2, r4, r2, r1, r1, r3, r3, pp, p3, r1, r1, r1, r2, r1, r2, r4, r2, r1, r1, w1, r4, r1, r4, r1, r3, r1, r4, r1, r3, r3, r3, r1, r4, r3, p3, p3, p3, p2, p3, r2, r1, r2, r3, r1, r2, r2, r3, r3, r4],
[r1, r2, r2, r3, r3, r2, r2, r3, r4, r3, p2, p3, p2, p1, r3, r4, r1, r4, r2, r3, r4, r3, r1, r4, r1, r4, r2, r1, p3, p3, r3, r2, r2, p2, p2, p2, r4, p2, p2, p2, p2, p3, p3, r2, r3, r1, r1, r2, r4, r1, r4, r1, r4],
[r1, r1, r1, r3, r1, r3, r3, r2, r1, r4, p2, p1, p2, p3, r4, r2, r2, r1, r1, r3, r1, r4, r3, r2, r4, r2, p2, p3, p3, p1, p1, r3, p3, p3, p3, p2, p2, p2, p1, p1, p3, p2, p1, r2, r1, r1, r3, r4, r4, r1, r4, r2, r3],
[r1, r2, r1, r3, r1, r2, r4, r3, r1, r4, p3, p1, p3, p3, p1, r1, r1, r2, r3, r2, r2, r2, r4, r1, r2, p1, p2, p1, p1, p1, p1, p1, p1, p2, p1, p2, p3, p1, p2, p3, p2, r3, r4, r2, r3, r1, r2, r1, r2, r3, r3, r2, r1],
[r2, r4, r2, r4, r3, r4, r2, r1, r3, r4, p2, p1, p1, p1, p3, p2, r4, r1, r4, r2, r2, r3, r2, r4, r2, p3, p3, p1, p2, p2, p1, p3, p2, p1, p3, p3, p1, p1, p2, p2, r3, r1, r4, r4, r3, r4, r2, r4, r4, r1, r2, r1, r4],
[r4, r4, r3, r3, r3, r2, r4, r4, r4, r4, p1, p2, p1, p2, p2, p1, p3, p1, r4, r3, r3, r3, r1, r1, p2, p3, p2, p3, p1, p3, p3, p3, p2, p2, p1, p3, p1, p3, p3, r4, r1, r1, r2, r3, r3, r1, r3, r4, r4, r3, r2, r1, r4],
[r1, r4, r2, r1, r2, r3, r2, r3, r4, r3, r4, p1, p2, p1, p1, p1, p1, p1, p1, p3, r2, r2, r4, p3, p3, p2, p3, p1, r4, p3, p3, p1, p3, r2, p2, p2, p2, p1, r2, r2, r1, r1, r3, r4, r1, r2, r2, r1, r1, r3, r4, r2, r2],
[r4, r1, r4, r4, r1, r2, r4, r2, r2, r1, r2, p2, p1, p2, p3, p1, p2, p3, p3, p2, p3, p2, p3, p2, p3, p2, p3, r3, r3, r4, r3, r4, r1, r3, p3, p2, p2, p1, r3, r2, r4, r4, r3, r4, r3, r3, r3, r4, r3, r3, r4, r2, r2],
[r3, r1, r1, r3, r2, r3, r2, r2, r2, r1, r2, p1, p1, p1, p3, p2, p2, p3, p1, p3, p2, p2, p2, p3, p1, r1, r3, r4, r3, r4, r2, r4, r2, p2, p3, p2, p2, r3, r3, r1, r4, r3, r2, r4, r4, r1, r2, r1, r3, r3, r3, r2, r2],
[r4, r1, r4, r4, r1, r3, r1, r3, r3, r3, r1, r2, p3, p3, p1, p1, r1, r1, r3, p3, p3, p2, p1, p2, r1, r3, r3, r4, r3, r1, r4, r2, p2, p3, p3, p3, p2, r3, r3, r1, r1, r2, r1, r1, r4, r4, r3, r4, r3, r4, r4, r1, r3],
[r2, r2, r4, r4, r4, r4, r1, r1, r1, r1, r1, r4, p1, p2, p3, p3, p3, r3, r4, r1, r2, r3, r3, r2, r1, r1, r1, r2, r3, r1, r4, r2, g3, g4, p2, p3, r3, r1, r3, r2, r1, r1, r3, r2, r2, r3, r1, r2, r3, r3, r3, r3, r4],
[r2, r2, r3, r4, r4, r1, r2, r3, r4, r3, r2, r4, r2, p3, p2, p2, p3, r1, r1, r2, r2, r1, r3, r1, r2, r2, r2, r1, r2, g2, g1, g3, g4, g3, g4, p1, r2, r3, r1, r4, g1, r2, r4, r1, r4, r1, r3, r2, r2, r1, r2, r3, r2],
[r2, r2, r4, r1, r2, r2, r2, r1, r3, r4, g2, g2, r3, r2, g3, p3, g4, g3, g1, r4, r1, r3, r4, r1, r1, r3, g1, g2, g3, g3, g2, g1, g2, g2, g2, g3, g2, r2, r4, g2, g2, g3, g2, g3, r1, r1, r1, r1, r3, r4, r2, r1, r4],
[r4, r4, r3, r1, r2, r2, r2, r3, r3, g2, g3, g3, g2, g2, g4, g3, g2, g2, g2, g3, g3, g3, r3, r3, g1, g3, g3, g3, g3, g1, g2, g1, g3, g2, g1, g1, g2, g1, g2, g3, g1, g1, g1, g2, g1, g2, r4, r3, r2, r1, r1, r4, r1],
[r3, r1, r1, r4, r4, r4, r1, r3, r1, g2, g3, g1, g2, g2, g3, g1, g2, s1, g3, g3, g3, g2, g3, g1, g2, g3, g1, g3, s2, s3, s2, s1, g3, g3, g3, g2, g1, g3, g3, g2, g1, g1, g3, g2, g1, g1, s1, r2, r3, r1, r4, r3, r2],
[r4, r4, r4, r4, b2, b3, b3, s1, s2, s2, g2, g2, g1, g1, g3, g1, g1, s1, s3, s2, s2, g2, g2, g3, g2, s2, s1, s3, s2, s1, s3, s1, s2, s1, s3, s1, g1, g1, g2, g2, s2, s1, s2, s3, s3, s1, s1, r1, b1, b3, b1, r3, r2],
[b1, b2, b3, b3, b2, b2, b1, s1, s1, s3, s2, s3, s3, s2, s1, s3, s1, s1, s2, s3, s1, s3, s3, s1, s1, s3, s3, s2, s1, s3, s1, s2, s3, s1, s2, s2, s3, s2, s2, s2, s3, s1, s3, s2, s2, s1, s2, b1, b1, b1, b3, b3, b1],
[b2, b3, b3, b2, b1, b3, b2, b1, s2, s1, s2, s3, s2, s3, s1, s2, s1, s1, s2, s3, s2, s1, s3, s3, s1, s1, s3, s2, s1, s1, s1, s2, s3, s2, s2, s1, s1, s2, s3, s1, s1, s3, s3, s1, s3, s1, o1, b2, b1, b1, b2, b3, b2],
[b3, b3, b1, b2, b2, b2, b2, b3, b3, o1, s3, s1, s2, s3, s2, s2, s1, s2, s2, s3, s1, s3, s1, s3, s3, s1, s1, s2, s3, s3, s3, s2, s1, s1, s2, s1, s1, s1, s2, s2, s2, s3, o2, o3, o2, o1, o1, b1, b3, b1, b2, b1, b3],
[b1, b2, b1, b1, b3, b1, b3, b2, b3, b2, o2, o2, o2, o3, o2, o3, s2, s3, s1, o2, o1, s3, s3, s3, s3, o3, o2, o1, s3, s3, s2, s1, s1, s1, s2, s1, s3, s1, s3, s2, o3, o3, o2, o1, o3, o2, o3, b2, b3, b3, b3, b2, b2],
[b1, b1, b3, b2, b3, b3, b1, b3, b3, b2, b1, b1, b1, o2, o1, o1, o1, o3, o1, o2, o2, o3, o2, o2, o3, o1, b2, o3, o3, o1, o3, o3, s3, s1, s3, s1, s3, s3, o3, o2, o2, b3, b1, o2, o1, o3, b2, b2, b3, b3, b1, b3, b1],
[o1, o2, o2, o1, o2, o3, b3, b3, b2, b1, b1, b2, b3, o3, o3, o2, o1, b1, b2, b2, b3, b3, b3, b2, b1, b2, b1, b3, b2, b1, b1, o3, o3, o1, o2, o2, o1, o3, o1, b2, b1, b2, o1, o3, o2, o1, o2, b3, b1, b3, b3, b3, b3],
[o3, s2, s2, s2, s3, o1, o1, b2, b2, b2, b2, b2, o1, o3, o3, o1, b1, b1, b3, b3, b3, b1, b3, b3, b3, b2, b3, b1, b3, b1, b1, b1, b3, o1, o2, o3, b1, b2, b2, b2, b1, o2, o2, s1, s1, s2, o1, b2, b3, b3, b3, b1, b2],
[s1, s3, g1, g2, s3, s1, o1, b1, b1, b2, b2, b3, o2, o3, o1, o2, b3, b2, b1, b1, b1, b3, b1, b2, b2, b1, b3, b2, b2, b3, b2, b1, b1, b1, b3, b3, b1, b1, b1, b3, b3, o1, s2, s1, s2, s2, o3, b3, b1, b2, b1, b3, b3],
[g1, g2, g1, g2, g2, s3, o2, b1, b1, b2, b2, o3, o2, o1, o2, b2, b2, b2, b3, b1, b2, b2, b3, b2, b3, b1, b2, b2, o3, o1, o3, o2, o1, b3, b1, b1, b1, b1, b2, b3, b1, o1, s1, s1, g2, s2, o2, b1, b3, b3, b1, b2, b1],
[r4, r1, g1, g1, s2, s1, o3, b1, b1, b3, b2, o3, o1, o1, b1, b2, b3, b1, b2, b2, b3, b1, b1, b2, b3, b3, o1, o1, o2, s3, s1, s3, o2, o2, o3, b2, o1, o1, o3, b2, o3, s1, s1, g1, g1, s2, o1, b2, b3, b1, b1, b2, b1],
[r2, r2, g1, s3, s3, s3, o3, b1, b1, b2, b3, o1, o3, o3, b2, b2, b2, b1, b1, b1, b3, b3, b2, b2, b2, o1, o3, s1, s2, s1, s1, s1, s2, s1, s2, o2, o3, s3, s2, o1, o1, s1, s1, s3, s2, s2, o3, b3, b3, b1, b1, b2, b2],
[r2, s3, s3, s2, s3, o3, o3, b1, b2, b1, o2, o2, o2, o3, b2, b1, b1, b3, b1, b2, b3, b2, b1, b1, o3, o2, s2, s1, s2, s3, s2, s1, s2, s2, s3, s3, s2, s1, s2, s3, o2, o2, o2, o3, s3, s2, o1, b1, b1, b3, b3, b1, b2],
[s1, s3, o3, o2, o2, o1, b1, b1, o2, o1, s3, s2, s1, o1, o3, o1, o1, b2, b2, b2, b1, b3, b1, b1, o1, s3, s1, s3, s3, g2, g2, g3, g3, s2, s2, s1, s2, s1, s1, s2, o2, o2, o3, o1, o3, o1, o3, b2, b2, b2, b1, b1, b3],
[o3, o2, o2, b3, b3, b3, b3, o1, o1, s1, s1, s1, s3, s1, s2, s3, o1, o1, o2, b3, b2, b1, b3, b1, o2, s3, s3, s3, g2, g2, g1, g2, g2, g1, g3, g2, g2, g2, s1, s1, s2, o1, o3, b2, b3, b3, b3, b3, b3, b1, b1, b3, b2],
[b1, b1, b1, b3, b3, b1, b1, o2, s2, s2, s2, g3, g3, s3, s2, s3, s3, s3, o1, o1, b3, b1, b2, b3, o1, s2, s3, g1, g3, g2, r4, r2, r2, g3, g1, g2, g3, g1, g2, s1, s2, s2, o2, o3, b2, b2, b3, b1, b1, b3, b1, b2, b1],
[b3, b3, b3, b3, b1, b1, o2, o1, s2, s2, g3, g1, g3, s2, s1, s2, s2, s3, s3, o1, b3, b3, b2, b2, o2, s3, s3, g2, g2, r2, r4, r4, r2, r4, g2, r1, r3, g1, g2, g1, s1, s1, o1, o3, b3, b1, b2, b3, b2, b1, b1, b3, b1],
[b2, b1, b3, b2, b2, b1, b2, s2, s3, g3, g3, g3, g2, g1, g2, s2, s3, s3, s3, o3, o1, o3, o2, b2, o3, s2, s1, g2, g3, r3, r1, b2, b1, r2, r3, r1, r4, r1, g1, g3, s2, s1, s3, o1, b1, b2, b3, b3, b1, b1, b3, b2, b2],
[b2, b3, b3, b2, b1, b3, b3, s2, s1, g1, g3, r4, r2, g3, g3, g2, s3, s3, s3, s2, o1, o3, o2, o2, o1, s2, s2, g1, r4, r4, b2, b3, b2, b1, r2, g1, r1, r1, g2, g3, g2, s3, s3, o3, b2, b2, b3, b3, b2, b2, b1, b3, b2],
[b2, b1, b3, b1, b2, b1, b2, s2, s1, s2, g3, r1, r3, r4, g3, g2, g2, s1, s1, s1, o3, o2, o1, o3, o3, s1, s2, g2, r3, b1, b2, b1, b3, b2, b1, g1, g3, g3, g3, g1, g1, s3, s2, o2, b2, b1, b3, b1, b1, b2, b1, b2, b2],
[b3, b1, b1, b3, b1, b1, b3, s3, s1, s3, g2, r4, r1, r4, r4, g3, g2, s3, s3, s1, o1, o1, o2, o3, o1, s1, s1, s3, g1, b2, b3, g3, g3, b3, b2, g3, s2, s3, s3, s2, s3, s1, s1, o1, b1, b1, b3, b3, b1, b1, b1, b3, b1],
[b2, b3, b2, b2, b2, b3, b2, s3, s1, g1, g3, r1, r4, r4, r4, g2, g1, s3, s1, s3, o3, b2, b2, o2, o2, s2, s3, s3, g2, g1, g1, g3, g2, g1, g2, s2, s3, s2, s3, s1, s2, s3, s1, o1, b3, b3, b1, b3, b3, b1, b1, b2, b2],
[b1, b2, b2, b3, b3, b2, s2, s3, s2, g2, r3, r2, r2, r4, g1, g3, g3, s1, s1, s1, o2, b3, b3, b2, o1, o2, s3, s1, g2, g2, g2, g1, g2, g3, g2, s3, s1, o1, o3, o1, s2, s1, o3, b1, b2, b1, b2, b1, b3, b1, b1, b1, b2],
[b1, b1, b2, b3, b2, b1, s2, s1, g3, g2, r4, r2, g2, g2, g3, g2, g1, s1, s3, o2, b1, b3, b3, b1, b2, o3, s3, s1, s1, g3, g2, g1, g1, g3, s3, s2, o2, o3, b2, o2, o1, o3, b3, b3, b3, o1, o3, o3, o1, o1, o3, b3, b1],
[b2, b1, b1, b2, b1, b3, s2, s3, g3, g2, r3, r1, s2, s1, s3, g2, g2, s1, s2, o2, b2, b3, b2, b1, b3, o3, o2, s3, s3, s1, g2, g2, s1, s1, s3, s1, o3, b3, b3, b2, b2, b3, b1, b2, o3, o2, s1, s3, s1, s3, o1, o2, b1],
[b2, b2, b3, b3, b2, b2, s1, s2, g2, s2, s1, s3, s3, s3, s2, s1, s1, s2, s3, o3, b2, b2, b1, b1, b1, b3, o3, o3, s3, s2, s1, s2, s1, s2, s1, o1, b2, b1, b1, b3, b2, b1, b1, o1, o3, s2, s3, s2, s3, s3, s2, o3, o2],
[b1, b3, b2, b3, b2, b3, s1, s2, s1, s1, s1, s1, s2, s3, s3, s2, s1, s3, o1, b1, b2, b3, b1, b2, b1, b2, b3, o2, o2, s1, s3, s3, s2, o2, o2, o3, b2, b3, b2, b2, b2, b3, b3, o2, s1, s3, g1, g1, g3, s2, s3, s1, o3],
[b3, b3, b2, b3, b2, b1, b3, s3, s3, s1, o3, o3, o3, o3, s3, s2, b2, b3, b1, b3, b2, b2, b1, b2, b2, b3, b1, b3, o2, o1, o2, o1, o3, o2, b3, b1, b1, b2, b3, b2, b3, b3, b1, o2, s3, s3, g3, r2, r3, g1, g1, s1, s2],
[b2, b2, b3, b1, b1, b3, b1, b2, b1, b2, b1, b1, b2, b2, b1, b1, b2, b2, b2, b2, b2, b3, b3, b1, b1, b1, b3, b3, b3, b1, b2, b2, b3, b2, b1, b2, b1, b2, b1, b3, b3, b1, b2, o1, s3, s2, g2, r1, r1, r3, g2, g1, s2],
[b3, b3, b3, b1, b3, b3, b2, b3, b2, b3, b2, b2, b1, b3, b3, b3, b2, b2, b1, b1, b3, b3, b2, b2, b3, b2, b3, b1, b2, b3, b3, b3, b2, b2, b3, b1, b2, b2, b1, b1, b2, b1, b2, o2, s3, s1, s2, g3, r1, r3, r4, g2, g2],
[b1, b3, b1, b3, b1, b3, b2, b1, b2, b1, b2, b2, b3, b1, b3, b2, b2, b2, b3, b2, b2, b2, b3, b1, b3, b3, b1, b3, b3, b2, b2, b3, b2, b1, b1, b2, b1, b3, b2, b3, b3, b2, b1, b3, o3, s3, s3, g2, g2, r4, r3, r1, g2],
[b1, b2, b1, b1, b1, b3, b3, b3, b3, b3, b2, b2, b3, b3, b2, b3, b1, b2, b3, b2, b3, b3, b3, b2, b3, b2, b1, b2, b1, b1, b3, b3, b2, b2, b1, b2, b3, b2, b1, b2, b1, b2, b1, b1, o1, s1, s2, g2, g2, r3, r2, g3, s2],
[b3, b1, b1, b1, b3, b3, b1, b1, b3, b3, b2, b1, b1, b3, b2, b3, b3, b2, b3, b1, b1, b3, b1, b1, b3, b1, b2, b3, b1, b3, b2, b2, b3, b2, b2, b3, b1, b3, b2, b2, b2, b2, b3, b2, o2, s2, s2, s1, g1, g3, g1, s2, s3],
[b2, b1, b3, b2, b1, b2, b1, b3, b1, b1, b3, b1, b2, b3, b2, b2, b2, b3, b2, b2, b1, b2, b2, b3, b2, b3, b3, b2, b2, b1, b1, b2, b3, b2, b1, b2, b3, b2, b2, b1, b1, b3, b1, b1, b2, o1, s3, s1, g2, g2, s1, s2, b3]
],
"elevation": [
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e4, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e4, e4, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e4, e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", "", "", "", "", "", e3, e3, "", "", "", e3, e3, e3, "", e3, e4, e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, "", e3, e3, e3, e3, e3, e3, e4, e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e4, e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e4, "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e4, e4, e4, e4, e4, e4, "", "", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e4, e4, e4, e4, e3, e3, e3, e3, "", "", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e4, e3, e3, e3, e3, e3, e3, e3, e3, "", "", "", e3, e3, e3, e3, e3, "", e3, e3, e3, e3, "", e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, "", "", "", "", "", "", "", e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, "", "", "", "", "", "", "", "", e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e3, e2, e2, e2, "", "", "", e3, e3, e3, e3, e3, "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e2, "", "", "", "", e1, "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e1, e1, "", "", e2, e2, e1, e1, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e0, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e0, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", e0, e0, e0, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", e0, e0, e0, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, "", "", "", "", "", e0, e0, e0, e0, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", e0, e0, e0, e1, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, "", e0, e0, e0, "", e0, e0, e0, e1, e1, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e1, e1, e1, e1, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", e0, e0, e0, e0, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e0, e0, e1, e1, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", e0, e0, e0, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e0, e0, e0, e0, e1, e1, e1, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", e0, e0, e0, e1, e1, "", "", "", "", "", e1, "", "", e1, e1, e1, e0, e0, e0, e0, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e1, e1, e1, e1, e1, e1, e0, e0, e0, e0, e0, e0, e0, e0, "", e0, e0, e0, e1, e1, "", "", "", "", "", "", "", "", "", e1, e1, e0, e0, e0, e0, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e1, e1, "", "", e1, e1, e1, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e1, "", "", "", "", "", "", "", e1, "", "", e1, e1, e1, e0, e0, e0, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e0, e1, "", "", "", e1, e1, e1, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e1, "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e0, e0, e0, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e0, e1, "", "", "", "", e1, e1, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e1, "", "", e1, e1, "", "", e1, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e1, e1, "", "", "", "", e1, e1, e0, e0, e0, e0, "", "", e0, e0, e0, e0, e0, e1, e1, e1, e1, e1, e1, e1, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e0, e0, e0, e1, "", "", "", "", e1, e1, e1, e0, e0, e0, e0, "", "", "", e0, e0, e0, e0, e1, e1, e1, e1, e1, e1, e1, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e0, e0, e1, e1, "", "", e1, e1, e1, e1, e1, e0, e0, e0, "", "", "", "", "", e0, e0, e0, e0, e1, e1, e1, e1, e1, e0, e0, e0, e0, "", e0, e0, e0, "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e0, e0, e1, e1, "", "", e0, e0, e0, e1, e1, e0, e0, e0, "", "", "", "", "", e0, e0, e0, e0, e0, e1, e1, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e0, e0, e1, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", e0, e0, e0, e0, e0, e0, "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
]
},
"abyss": {
"hidden": True,
"score": 0.005,
"players": {},
"background": "black",
"map": [
[bl, bl, bl, bl, bl, bl, pa, pa, pa, pa, bl, bl, bl, pa, pa, pa, pa, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, pa, a1, a1, a2, a1, pa, bl, pa, a1, a3, a3, a2, pa, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, pa, a3, a2, a2, a3, a2, a1, pa, a1, a2, a2, a2, a1, a2, pa, bl, bl, bl, bl],
[bl, bl, bl, pa, a1, a3, a3, a3, a2, a3, a2, a3, a2, a1, a3, a3, a3, a2, a3, pa, bl, bl, bl],
[bl, bl, pa, a2, a1, a2, a2, pa, pa, a1, a3, a3, a1, a1, pa, pa, a1, a2, a1, a1, pa, bl, bl],
[bl, pa, a3, a1, a2, a1, pa, b1, b1, pa, a2, a1, a2, pa, l2, l1, pa, a2, a3, a1, a1, pa, bl],
[pa, a1, a3, a2, a3, a2, pa, b3, b1, pa, a2, a1, a1, pa, l1, l3, pa, a3, a3, a3, a2, a3, pa],
[pa, a1, a2, a3, a2, a2, pa, b1, b2, pa, a3, a3, a2, pa, l3, l2, pa, a2, a1, a2, a1, a1, pa],
[bl, pa, a2, a3, a1, a1, pa, b2, b3, pa, a2, a2, a2, pa, l1, l3, pa, a2, a2, a3, a3, pa, bl],
[bl, bl, pa, a3, a3, a2, a1, pa, pa, a1, a3, a2, a1, a2, pa, pa, a2, a2, a2, a2, pa, bl, bl],
[bl, bl, bl, pa, a2, a1, a2, a2, a1, a1, a1, a3, a1, a3, a1, a3, a3, a3, a1, pa, bl, bl, bl],
[bl, bl, bl, pa, a3, a2, a2, a2, a2, a3, a1, a2, a3, a2, a1, a2, a2, a2, a3, pa, bl, bl, bl],
[bl, bl, bl, bl, pa, a3, a1, a1, a2, a3, a3, a3, a2, a2, a2, a3, a1, a2, pa, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, pa, pa, pa, pa, a3, a3, a3, a1, a2, pa, pa, pa, pa, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, bl, bl, pa, a1, a2, a3, pa, bl, bl, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, bl, bl, pa, a2, a2, a3, pa, bl, bl, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, bl, bl, pa, a3, a3, a3, pa, bl, bl, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, bl, bl, pa, a3, a1, a2, pa, bl, bl, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, bl, pa, a1, a2, a1, a2, a2, pa, bl, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, pa, a3, a1, a1, a2, a3, a2, a1, pa, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, pa, a3, a2, a1, a2, a3, a2, a2, pa, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, pa, a1, a1, a1, pp, a2, a2, a3, pa, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, pa, a3, a3, a1, a1, a3, a2, a3, pa, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, bl, pa, a1, a2, a1, a3, a1, pa, bl, bl, bl, bl, bl, bl, bl, bl],
[bl, bl, bl, bl, bl, bl, bl, bl, bl, pa, pa, pa, pa, pa, bl, bl, bl, bl, bl, bl, bl, bl, bl]
],
"elevation": [
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", e3, e3, e3, e3, "", "", "", e3, e3, e3, e3, "", "", "", "", "", ""],
["", "", "", "", "", e3, e3, e3, e3, e3, e3, "", e3, e3, e3, e3, e3, e3, "", "", "", "", ""],
["", "", "", "", e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, "", "", "", ""],
["", "", "", e3, e3, e3, e3, "", "", e3, e3, e3, e3, e3, "", "", e3, e3, e3, e3, "", "", ""],
["", "", e3, e3, e3, e3, "", "", "", "", e3, e3, e3, "", "", "", "", e3, e3, e3, e3, "", ""],
["", e3, e3, e3, e3, e3, "", "", "", "", e3, e3, e3, "", "", "", "", e3, e3, e3, e3, e3, ""],
["", e3, e3, e3, e3, e3, "", "", "", "", e3, e3, e3, "", "", "", "", e3, e3, e3, e3, e3, ""],
["", "", e3, e3, e3, e3, "", "", "", "", e3, e3, e3, "", "", "", "", e3, e3, e3, e3, "", ""],
["", "", "", e3, e3, e3, e3, "", "", e3, e3, e3, e3, e3, "", "", e3, e3, e3, e3, "", "", ""],
["", "", "", "", e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, "", "", "", ""],
["", "", "", "", e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, "", "", "", ""],
["", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, e3, "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e3, e3, e3, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e3, e3, e3, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e3, e3, e3, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e3, e3, e3, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, e3, e3, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e3, e3, e3, e3, e3, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
]
},
"treasure": {
"hidden": True,
"score": 0.005,
"players": {},
"background": b3,
"map": [
[r1, r2, r2, r3, r2, r2, r2, r3, r1, r1, r3, r2, r1, r2, r2, r2, r3, r3, r3, r3, r1, r1, r2, r2, r1, r2, r3, r1, r3, r2, r1, r2, r2],
[i1, i2, i1, r1, r2, i2, i2, i1, r2, r3, i2, i2, i1, r1, r2, i2, i2, i1, r3, r1, i2, i2, i1, r2, r1, i2, i2, i2, r1, r1, i2, i1, i1],
[i2, t3, i2, r1, r1, i1, t5, i2, r3, r1, i2, t4, i1, r3, r2, i2, t3, i1, r1, r2, i2, t2, i1, r2, r1, i1, t5, i2, r2, r2, i2, t3, i1],
[i1, i1, i1, r3, r2, i2, i2, i1, r3, r2, i1, i1, i1, r1, r2, i1, i2, i2, r1, r1, i2, i1, i1, r3, r2, i1, i1, i1, r2, r2, i2, i1, i1],
[r1, r1, r1, r3, r3, r1, r2, r1, r2, r1, r3, r2, r3, r2, r2, r2, r1, r2, r1, r1, r1, r1, r3, r2, r2, r2, r3, r1, r1, r3, r2, r3, r2],
[r2, r2, r3, r2, r3, r2, r1, r2, r3, r1, r1, r1, r3, r3, r2, r1, r1, r3, r1, r3, r1, r3, r3, r1, r3, r3, r3, r2, r2, r3, r2, r1, r3],
[i2, i1, i2, r3, r2, i2, i1, i2, r1, r1, i2, i2, i1, r2, r1, i1, i2, i2, r2, r3, i2, i2, i2, r2, r1, i1, i1, i1, r2, r2, i1, i1, i1],
[i1, t1, i1, r1, r3, i1, t2, i2, r2, r1, i2, t3, i1, r2, r2, i2, t2, i1, r2, r1, i1, t4, i1, r3, r3, i1, t3, i1, r2, r2, i1, t1, i2],
[i2, i1, i2, r3, r3, i2, i2, i2, r1, r1, i2, i1, i1, r2, r3, i1, i1, i2, r1, r1, i2, i1, i2, r1, r2, i1, i1, i1, r2, r1, i2, i1, i2],
[r1, r2, r1, r2, r3, r3, r3, r2, r2, r2, r1, r1, r2, r1, r3, r1, r1, r3, r1, r1, r3, r1, r1, r1, r1, r1, r3, r2, r2, r3, r3, r1, r2],
[r1, r2, r2, r1, r2, r1, r1, r1, r1, r2, r2, r2, r3, r3, r3, s3, s2, s2, r1, r1, r3, r3, r3, r1, r1, r1, r3, r3, r1, r2, r3, r3, r3],
[i1, i2, i1, r2, r2, i1, i2, i2, r3, r3, i2, i1, i2, r1, s1, s1, s1, s1, s2, r1, i1, i1, i1, r3, r3, i2, i2, i2, r2, r1, i1, i1, i1],
[i2, t5, i1, r3, r1, i1, t1, i1, r3, r1, i1, t2, i2, r2, s2, s3, pp, s1, s1, r2, i2, t3, i1, r3, r1, i1, t2, i2, r1, r1, i1, t4, i2],
[i1, i2, i1, r1, r3, i1, i2, i2, r2, r2, i1, i2, i1, r1, s2, s2, s3, s1, s1, r3, i1, i1, i2, r2, r1, i1, i1, i1, r2, r3, i2, i1, i2],
[r2, r2, r3, r1, r3, r3, r2, r3, r2, r1, r3, r1, r3, r1, s1, s3, s1, s2, s1, r1, r3, r2, r1, r2, r1, r1, r2, r3, r3, r1, r1, r1, r3],
[r3, r2, r1, r3, r2, r3, r3, r1, r1, r3, r2, r3, r3, r1, s1, s1, s2, s1, s1, r2, r1, r1, r1, r3, r2, r1, r3, r2, r2, r3, r3, r2, r1],
[i2, i1, i2, r3, r1, i1, i1, i2, r3, r2, i1, i2, i1, r2, s3, s2, s3, s1, s3, r3, i1, i1, i1, r1, r3, i2, i1, i1, r3, r2, i1, i2, i2],
[i2, t2, i1, r2, r3, i1, t3, i2, r2, r2, i2, t4, i1, r3, s2, s3, s1, s1, s3, r3, i2, t2, i1, r2, r3, i1, t1, i2, r1, r1, i1, t2, i2],
[i2, i1, i2, r2, r2, i1, i2, i1, r1, r3, i1, i2, i1, r1, s1, s2, s3, s3, s2, r2, i1, i2, i2, r2, r2, i2, i1, i1, r3, r3, i1, i2, i2],
[r3, r2, r2, r2, r2, r3, r1, r1, r2, r2, r1, r1, r3, r3, s1, s2, s2, s2, s2, r2, r1, r3, r2, r2, r2, r1, r3, r3, r1, r2, r2, r3, r2],
[r3, r2, r3, r2, r2, r2, r3, r1, r2, r2, r3, r1, r3, r3, s1, s2, s2, s3, s3, r3, r3, r2, r2, r3, r3, r1, r2, r1, r3, r3, r1, r2, r3],
[i1, i2, i2, r3, r2, i1, i2, i2, r2, r3, i1, i2, i1, r2, s2, s3, s3, s1, s2, r1, i1, i2, i1, r3, r2, i1, i2, i2, r1, r1, i2, i1, i2],
[i1, t4, i1, r2, r1, i1, t5, i2, r2, r3, i1, t3, i1, r1, s2, s1, s1, s2, s3, r2, i2, t1, i2, r3, r1, i2, t4, i2, r2, r1, i1, t3, i2],
[i1, i1, i2, r2, r3, i2, i2, i1, r3, r1, i2, i2, i2, r2, s3, s1, s3, s1, s1, r2, i2, i2, i1, r2, r1, i1, i2, i1, r3, r3, i2, i1, i2],
[r3, r3, r1, r1, r1, r2, r2, r1, r1, r3, r3, r2, r1, r1, s3, s3, s3, s2, s1, r3, r1, r1, r3, r1, r3, r1, r2, r2, r3, r2, r1, r2, r2],
[r3, r2, r2, r1, r3, r2, r1, r2, r1, r3, s3, s2, s2, s1, s3, s3, s2, s3, s3, s1, s3, s3, s1, r2, r3, r1, r2, r3, r2, r2, r1, r3, r3],
[i1, i1, i2, r2, r1, i1, i1, i1, r1, s1, s3, s1, s3, s1, s3, s3, s1, s3, s1, s2, s1, s1, s1, s2, r1, i1, i2, i1, r1, r3, i1, i1, i1],
[i2, t2, i1, r2, r1, i1, t3, i2, r3, s1, s2, s3, s2, s3, s3, s3, s1, s2, s3, s2, s2, s3, s2, s2, r1, i1, t5, i1, r3, r1, i2, t2, i2],
[i1, i1, i1, r1, r1, i2, i2, i1, r3, s2, s1, s2, s3, s1, s2, s1, s1, s2, s2, s3, s3, s2, s2, s1, r2, i2, i1, i2, r3, r2, i2, i2, i1],
[r2, r1, r2, r3, r2, r2, r1, r2, r3, s1, s2, s2, s1, s1, s2, s1, tb, s2, s1, s2, s2, s1, s2, s3, r1, r2, r3, r1, r1, r1, r2, r2, r1],
[r2, r2, r1, r3, r2, r1, r1, r3, r1, s2, s3, s1, s1, s2, s2, s3, s3, s3, s2, s2, s3, s2, s1, s3, r2, r2, r1, r1, r2, r3, r2, r2, r1],
[i1, i1, i2, r2, r3, i2, i2, i2, r1, s2, s2, s2, s2, s3, s1, s2, s1, s1, s3, s3, s2, s2, s2, s1, r3, i1, i2, i2, r2, r3, i1, i2, i1],
[i2, t3, i1, r2, r1, i2, t4, i2, r2, s2, s3, s1, s1, s2, s3, s1, s1, s1, s3, s3, s2, s2, s3, s2, r1, i2, t3, i1, r1, r2, i1, t1, i2],
[i1, i2, i2, r1, r1, i1, i2, i1, r3, s2, s1, s1, s3, s1, s3, s1, s3, s3, s1, s1, s1, s3, s1, s3, r2, i1, i2, i2, r2, r2, i2, i2, i1],
[r2, r1, r2, r2, r1, r1, r2, r3, r3, r1, s1, s1, s3, s1, s3, s2, s2, s3, s1, s3, s2, s2, s3, r1, r2, r3, r3, r3, r2, r3, r1, r2, r2],
[r2, r1, r3, r2, r1, r3, r2, r1, r2, r3, r2, r1, r2, r1, s2, s3, s2, s1, s1, r1, r2, r3, r3, r2, r2, r2, r2, r2, r3, r3, r1, r3, r3],
[i1, i1, i2, r2, r2, i1, i1, i2, r1, r2, i2, i2, i2, r2, s2, s1, s3, s2, s3, r3, i1, i1, i2, r2, r1, i2, i1, i2, r2, r3, i1, i1, i2],
[i1, t4, i1, r1, r3, i2, t5, i1, r3, r1, i1, t1, i1, r1, s2, s3, s2, s2, s2, r2, i1, t5, i2, r1, r2, i2, t2, i2, r3, r2, i1, t5, i1],
[i2, i2, i1, r1, r1, i1, i2, i2, r1, r3, i2, i1, i1, r1, s3, s2, s1, s1, s1, r2, i2, i2, i1, r3, r1, i1, i1, i2, r1, r3, i1, i1, i2],
[r2, r1, r3, r2, r2, r2, r1, r3, r3, r1, r1, r3, r1, r3, s1, s1, s2, s2, s3, r3, r1, r3, r2, r2, r1, r2, r2, r1, r1, r1, r1, r1, r2],
[r3, r3, r2, r1, r3, r2, r2, r1, r3, r3, r1, r2, r2, r3, s3, s1, s1, s1, s2, r3, r2, r2, r3, r3, r3, r2, r2, r2, r1, r3, r2, r2, r1],
[i1, i2, i1, r2, r1, i2, i1, i1, r1, r3, i2, i1, i1, r3, r1, s3, s1, s2, r1, r1, i2, i2, i2, r1, r1, i1, i1, i2, r2, r2, i1, i1, i2],
[i1, t1, i2, r2, r1, i1, t3, i1, r3, r3, i1, t2, i1, r1, r1, r2, r1, r2, r1, r2, i1, t4, i1, r3, r2, i2, t1, i2, r3, r3, i2, t4, i1],
[i2, i2, i2, r2, r2, i2, i2, i2, r3, r1, i2, i2, i1, r3, r1, r1, r3, r3, r1, r3, i2, i2, i1, r3, r2, i1, i1, i2, r3, r3, i1, i1, i1],
[r2, r2, r3, r2, r2, r2, r2, r3, r2, r1, r1, r2, r1, r1, r3, r1, r2, r2, r2, r3, r3, r1, r1, r2, r1, r1, r3, r1, r3, r2, r1, r1, r1],
[r2, r3, r3, r2, r3, r2, r1, r1, r2, r3, r3, r1, r3, r2, r3, r1, r3, r1, r2, r2, r1, r3, r3, r3, r2, r2, r1, r2, r3, r2, r3, r3, r2],
[i1, i2, i2, r2, r2, i2, i1, i2, r1, r1, i2, i2, i2, r3, r1, i1, i2, i2, r3, r1, i1, i1, i2, r2, r1, i2, i1, i2, r2, r3, i2, i2, i1],
[i1, t4, i1, r2, r1, i2, t1, i1, r3, r3, i1, t5, i2, r2, r3, i2, t3, i2, r1, r1, i1, t2, i1, r2, r2, i2, t3, i1, r2, r3, i2, t2, i2],
[i1, i1, i1, r3, r3, i1, i2, i2, r1, r2, i1, i1, i1, r1, r2, i1, i2, i2, r3, r2, i2, i1, i2, r3, r2, i2, i1, i2, r2, r3, i2, i1, i1],
[r3, r1, r3, r1, r2, r3, r1, r3, r1, r2, r3, r1, r1, r1, r2, r3, r2, r1, r1, r2, r2, r1, r3, r1, r3, r3, r3, r2, r2, r3, r2, r1, r2]
],
"elevation": [
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, "", "", "", e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, "", "", "", e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", e2, e2, e2, "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
]
},
"mushroom": {
"hidden": True,
"score": 0.005,
"players": {},
"background": r3,
"map": [
[r2, r3, r3, r3, r1, r4, r2, r4, r3, r4, r4, r4, r4, r4, r4, r1, r3, r3, r3, r1, r3, r3, r3, r1, r3, r3, r3, r1, r4, r3, r3, r1, r1],
[r2, r1, r3, r3, r4, r1, r3, r1, r1, r1, r4, r1, r1, r4, r3, r3, r1, r1, r4, r4, r1, r2, r2, r2, r1, r1, r2, r1, r4, r3, r4, r2, r4],
[r1, r3, r2, r3, r4, r2, r2, r3, r2, r1, r2, r2, r2, r1, r2, r1, r2, r2, r1, r3, r3, r3, r2, r1, r3, r4, r2, r1, r4, r3, r4, r3, r2],
[r4, r3, r4, r4, r4, r3, r4, r1, r3, r3, r3, r1, r2, r2, r1, r1, r1, r2, r3, r2, r1, r1, r3, r4, r3, r4, r1, r4, r4, r3, r2, r1, r3],
[r4, r2, r3, r2, r1, r3, r1, r2, r4, r2, r4, r2, r2, r3, r2, r1, r4, r1, r4, r1, r3, r1, r4, r4, r2, r4, r3, r2, r2, r1, r2, r4, r2],
[r4, r2, r3, r4, r1, r3, r3, b3, b3, b2, b1, r1, r2, r2, r3, r3, r2, r1, r3, r3, r2, r1, r1, r3, r2, r2, r2, r3, r1, r1, r3, r1, r4],
[r1, r2, r3, r2, r2, r3, b2, b1, b3, b2, b3, b1, r4, r1, r4, r4, r3, r1, r4, r2, r4, r4, r1, r4, r4, r3, r3, r3, r3, r3, r4, r3, r3],
[r1, r2, r3, r3, r1, b3, b3, b1, b1, b2, b2, b1, p1, p1, p3, p1, p3, p3, p1, p1, p3, r1, r2, r2, r1, r1, r4, r1, r4, r4, r2, r4, r1],
[r4, r1, r3, r1, r4, b3, b1, b2, b2, b1, b3, b1, p2, p2, p2, p3, p1, p3, p2, p2, p2, p1, p1, r4, r1, r3, r4, r2, r2, r2, r2, r2, r4],
[r4, r4, r3, r1, r2, b3, b2, b2, b2, b1, b1, p3, p1, p2, p3, p2, p2, p1, p3, p2, p2, p3, p2, p2, p1, r1, r1, r4, r1, r4, r1, r3, r3],
[r3, r3, r4, r3, r3, r3, b1, b3, b1, p1, p1, p2, p1, p1, p2, p1, p1, p1, r1, r1, p1, p1, p3, p2, p3, pp, r1, r1, r1, r4, r3, r3, r3],
[r4, r3, r3, r1, r4, r2, r4, p1, p3, p2, p3, p2, p2, p3, p2, p1, p3, p2, r2, r2, r1, p3, p3, p2, p3, p2, r3, r1, r1, r1, r1, r3, r1],
[r1, r4, r1, r2, r2, r3, r4, p2, p1, p2, p2, p3, p1, p2, p2, p3, p3, p1, r4, r4, r2, r4, p2, p1, p2, p2, r4, r4, r3, r1, r2, r3, r4],
[r3, r1, r4, r2, r2, r4, r4, p3, p3, p3, p2, p3, p1, p2, p1, p2, p1, p3, p3, p2, r4, r1, p2, p2, p2, r3, r4, r4, r3, r1, r4, r4, r2],
[r3, r3, r4, r4, r2, r1, r3, p3, p1, p3, p2, p3, p3, p1, p2, p1, p1, p2, p1, p2, p3, p2, p2, p3, p3, r3, r2, r1, r2, r3, r1, r1, r4],
[r3, r4, r2, r1, r3, r1, r1, r1, p3, p2, p2, p3, p1, p3, p3, p2, p3, p1, p1, p2, p3, p1, p2, p2, p3, r2, r1, r1, r2, r2, r3, r4, r2],
[r3, r4, r2, r2, r2, r3, r1, r1, p1, p2, p2, r3, p2, p3, p2, p3, p2, p3, p3, p3, p2, p2, p2, p3, r2, r4, r3, r1, r4, r4, r4, r2, r2],
[r1, r2, r3, r4, r3, r1, r1, r2, p1, p2, r2, r2, r1, p1, p3, p2, p3, p1, p2, p1, p3, p1, p1, p3, r3, r4, r2, r3, r4, r2, r2, r2, r1],
[r2, r4, r2, r2, r2, r3, r1, r1, p3, p3, r2, r3, r2, p1, p3, p2, p2, p1, p3, p1, p2, p2, p3, p2, r3, r2, r1, r4, r1, r1, r1, r3, r2],
[r4, r1, r4, r1, r2, r1, r4, p3, p2, p3, r3, r1, p3, p1, p2, p1, p2, p2, p3, p2, p3, p1, p3, p3, p3, r1, r3, r1, r3, r2, r4, r3, r4],
[r4, r2, r3, r3, r3, r3, r4, p1, p2, p2, p3, p3, p1, p1, p1, p3, p1, p1, p1, p1, p3, p1, p3, p1, p2, p1, r4, r1, r2, r4, r3, r3, r1],
[r2, r2, r4, r2, r1, r4, r3, r3, p3, p2, p1, p2, p2, p3, p2, p1, p1, p3, p2, p3, p3, p2, p2, p1, p1, p2, r4, r3, r3, r4, r2, r1, r2],
[r4, r2, r2, r3, r1, r3, r4, r4, p2, p3, p2, p1, p2, p3, p1, p2, p3, p2, p3, p3, p3, p2, p1, p3, p2, p1, r1, r3, r3, r1, r4, r4, r4],
[r1, r2, r4, r3, r3, r3, r3, r3, r3, p3, p3, p3, p3, p3, b1, b3, b1, b3, p2, p1, p3, p2, p1, p2, p3, r1, r4, r4, r4, r1, r4, r1, r4],
[r1, r3, r1, r1, r4, r1, r3, r3, r1, r3, r3, p3, p2, b1, b3, b3, b2, b1, b2, b2, p2, p2, p1, r1, r4, r2, r1, r3, r1, r3, r4, r3, r1],
[r1, r4, r2, r2, r2, r3, r1, r3, r3, r2, r2, r3, r1, b2, b1, b3, b3, b3, b1, b1, b3, r2, r3, r1, r3, r4, r4, r3, r4, r3, r1, r2, r3],
[r4, r1, r1, r3, r4, r1, r4, r4, r3, r1, r1, r4, r3, r4, b1, b3, b2, b1, b3, b2, b1, r1, r2, r1, r3, r2, r2, r4, r4, r3, r4, r4, r4],
[r1, r3, r4, r1, r3, r2, r4, r3, r3, r4, r4, r3, r4, b3, b3, b3, b1, b2, b2, r2, r3, r3, r4, r2, r1, r2, r2, r3, r4, r3, r3, r3, r3],
[r4, r4, r3, r1, r2, r3, r3, r1, r3, r3, r2, r2, r2, b1, b1, b3, b3, b3, r1, r1, r1, r2, r2, r3, r4, r1, r4, r4, r3, r2, r1, r3, r3],
[r1, r2, r4, r3, r1, r1, r2, r4, r2, r3, r1, r1, r4, r2, b3, b2, b1, r4, r3, r1, r2, r3, r1, r4, r1, r4, r1, r2, r4, r1, r2, r1, r4],
[r1, r2, r1, r4, r4, r3, r1, r4, r3, r1, r1, r3, r3, r2, r4, r4, r4, r4, r2, r1, r1, r2, r3, r1, r2, r2, r4, r4, r3, r2, r2, r2, r3],
[r3, r1, r1, r1, r1, r4, r2, r3, r1, r4, r3, r2, r4, r1, r2, r2, r4, r3, r3, r3, r4, r4, r1, r1, r4, r1, r3, r4, r1, r3, r4, r2, r3]
],
"elevation": [
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", e1, e1, e1, e1, e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", e1, e1, "", "", "", "", "", "", "", e1, e1, e1, "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""],
["", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", ""]
]
},
"cursed": {
"hidden": True,
"score": 0.005,
"players": {},
"background": sk,
"map": [
[p3, v3, l3, l1, v4, l1, b3, v3, g1, sk, v3, r1, b1, l1, b1, g1, l2, sk, v2, l2, r4, b1, v1, v2, p2, v4, l3, r1, g3, l2, p1, r1, v2, r3, r2, l1, g4, w3, l3, l1, r3],
[sk, w2, b2, g3, sk, v4, r2, v2, g4, b3, l2, r4, v2, g4, b3, p1, v4, l2, w3, r1, v2, p2, w1, w2, l3, r1, w2, v3, l3, w1, sk, sk, v3, sk, sk, p1, g4, sk, l2, w1, g4],
[r4, p3, r4, b2, r4, v3, l2, g3, p1, l2, w3, r4, p3, v1, v1, p1, w3, w1, g3, r4, g2, l1, g2, p3, w3, l2, w1, v2, w1, r3, l1, r1, r3, l2, p1, b3, r3, r2, sk, sk, r4],
[r4, l2, p1, b3, b3, b1, p1, v1, l1, g4, sk, l3, p1, b1, w3, g3, g3, l1, g1, w1, r3, r3, l2, r1, p1, r3, sk, l2, sk, v2, p2, p1, v2, b1, l3, b2, l2, v4, r3, r4, b3],
[g4, v1, b1, sk, b3, r1, w3, p3, g4, sk, b2, r2, l1, v1, r1, b2, r1, sk, w1, l1, p1, r2, w1, p2, w2, g2, r3, l2, p2, r3, l1, r3, p1, l3, r3, g2, sk, l2, v4, v1, l3],
[r3, r1, v1, l2, r3, b3, v3, w1, sk, g1, g3, w2, b3, l3, w1, p3, w3, r1, g3, l3, g3, w3, v2, g4, p1, g3, sk, g4, l3, b2, v2, r3, g4, g2, r1, w3, p1, r4, p2, w3, p3],
[g1, v1, l2, b3, b3, w1, v2, b3, v4, l3, b1, l1, p1, r4, p2, l2, w1, p2, p1, l1, v4, sk, g2, v4, r2, v2, g2, v4, l3, b3, r3, p1, w2, r1, r1, g3, p3, r2, g4, r2, p3],
[r2, l1, b2, r4, g3, w2, r4, l1, w2, w3, w2, b3, b2, p1, p3, v1, sk, l2, v3, sk, r2, p3, g1, b3, v1, b3, w3, v3, v1, l2, p3, v3, w1, b1, w2, w1, sk, b3, r4, r4, g1],
[r1, b1, r4, l3, w1, v2, b2, v3, b2, g3, l2, p3, w1, g2, l1, w2, r1, v4, l3, g4, b1, p2, g4, g1, r3, g1, g3, l2, g3, l2, v4, v1, l1, r1, b1, r1, w2, v4, b3, w3, r2],
[v1, l2, r2, v1, b3, w3, w2, v1, w3, l2, w2, v3, r4, b2, g3, g2, p2, w1, r1, p2, l2, v1, v1, g1, v1, r4, sk, p3, w3, l3, b3, sk, r4, g3, sk, w1, p2, p1, v4, w1, b2],
[g1, v1, g3, w1, v4, g2, w1, v2, v4, r3, v2, g2, p1, l2, l2, l1, g4, g4, l3, g1, b2, p1, p1, b1, v4, b1, r2, p2, b3, w3, v3, sk, g2, v4, r2, l1, r4, b1, w3, v2, l3],
[p1, v1, g2, l1, b2, g3, r1, r4, v3, sk, p1, v4, v1, r4, v2, v4, sk, r1, p1, r4, g1, g2, w1, l2, l1, l2, r2, g3, w1, r2, g3, r2, g3, p1, r1, l2, b2, r4, g1, l2, w1],
[v4, b1, p3, w3, g1, g3, l1, g4, r3, p1, g4, p1, p2, sk, r3, l3, w1, r3, r4, r2, p1, v2, r1, v3, b3, v4, p2, g3, g3, r2, r3, l2, b2, b3, r1, l3, v3, g4, w2, b1, g4],
[b2, l3, w2, g2, g1, v2, l1, r2, l2, sk, r2, p3, g1, w3, p2, g4, b2, w2, p1, p1, g2, l2, l2, r4, r1, r3, g2, r1, b1, r2, v4, w3, b3, b2, g2, g2, w3, v2, l2, g1, l2],
[b2, p3, b3, r1, p1, v2, l3, p3, l2, r2, b2, v4, r3, w2, g2, v1, b2, v4, sk, g2, sk, p3, w2, l1, r2, b3, p3, w1, l3, p3, g3, r1, p3, g1, w2, r2, w2, g4, p3, l2, v3],
[b2, l3, g3, b3, p3, w1, l2, g2, g3, b2, v2, b2, v1, g3, v3, v3, w3, v1, g2, v4, r2, r3, g4, r1, v3, l2, v4, g3, l1, l2, p1, r1, p3, p1, p1, w1, sk, g1, sk, l1, b2],
[g1, g1, w2, l3, g2, b1, g3, l2, w3, b1, v1, r1, p3, r2, b3, r2, b2, v1, r2, w2, l2, v4, v3, r2, l2, g1, l1, l2, l2, v3, p1, p2, p1, v2, p1, l3, w1, b2, v1, r1, w1],
[b2, sk, v2, p1, g2, w3, g3, p1, v4, l2, l2, p1, g1, b2, r1, r4, l1, w3, g2, w3, g3, r3, l1, l1, p3, r3, r4, g3, l3, g4, b2, l2, p1, v4, v3, l2, r3, sk, w3, l2, r2],
[r3, l1, l2, g3, r2, l3, b2, l3, v1, l2, l1, p1, w3, v4, w1, b2, w3, p3, sk, r3, r3, l2, g2, g1, l1, b3, g2, p2, w3, b3, l2, l3, r1, w2, l1, l2, v4, l3, r3, w2, l2],
[r2, w2, b2, r4, w3, l1, v3, p1, l2, v3, r4, l3, g1, p3, w2, w1, g4, p1, w3, sk, l2, b1, w1, v4, p2, v1, b2, r3, p1, sk, l2, g3, g2, g2, v2, w1, g2, v3, g2, g4, r2],
[w2, w3, b2, v1, w1, r3, g4, b2, b3, v3, l2, v4, g4, b3, w2, v4, r1, r2, r3, v1, r1, sk, g4, r3, sk, b2, l3, r1, v1, r1, b2, g3, p1, g4, l2, r2, r4, g2, g4, p1, r4],
[w2, l2, r3, g1, l3, v4, g1, v4, g2, l2, g3, l2, g4, g2, v1, l3, g2, r1, r2, b3, w2, v3, p3, p2, w2, g2, w3, b2, w1, g4, g3, l1, b3, v3, g4, r2, sk, b2, g3, l3, w1],
[w1, r1, w2, g1, r2, p3, p3, v4, g2, r2, v3, r2, l2, r4, l3, l2, p1, b3, r3, b1, v2, w1, w3, l1, r4, w1, b2, p2, r1, v4, v1, b2, b1, g4, l1, v1, p3, w3, r1, p2, sk],
[l2, l2, v3, w3, w2, v2, v4, g4, g1, l1, v3, p3, l1, p2, p1, w3, r3, w3, w2, l3, b3, w2, v2, sk, r4, r1, l2, b1, g3, w2, v2, r2, l2, b2, sk, p3, l3, w3, w2, r2, g1],
[p2, l1, r3, sk, r4, b3, r4, v2, b2, b3, b1, v3, r1, r1, r4, w2, r4, w2, l3, l2, r4, v1, r1, w2, l2, g3, v4, g3, w2, g3, b2, w3, g1, w3, v1, w2, v3, r2, r4, b1, w3],
[sk, r1, r3, b3, r1, sk, v4, l2, r3, r1, l1, g2, g1, v4, b2, w3, w3, v4, l1, v4, p2, p1, p1, p2, w2, l1, p2, sk, b1, w1, w3, r1, p2, l1, v3, v3, r2, g2, w2, w1, p1],
[sk, l3, w3, r4, r1, v4, p3, r1, g3, p3, l2, v1, p2, v2, v2, w1, l2, r1, p2, b1, w2, l2, v1, l3, g4, v4, sk, g3, sk, v2, w3, b1, w1, l2, w2, r4, r1, l2, r1, v4, r3],
[g1, w1, p3, b1, g2, w3, r2, b3, r1, w3, v4, v3, l2, l2, v2, v1, r4, v2, l1, r4, b2, sk, w3, l1, l2, l1, w1, b3, g2, l2, v3, p1, r2, l3, g3, p2, w1, l1, w2, v4, v3],
[v1, g3, w2, b1, l3, v3, l2, g4, l2, b2, r4, g4, b3, g2, g2, p1, l2, r4, g1, g1, l3, r4, g4, p3, b2, v4, g4, p2, l1, l1, p2, l3, b3, b2, w1, l2, r1, r2, b1, w1, g4],
[v1, g3, g1, b3, p3, b1, w3, v2, b2, p1, g1, v2, l2, v2, v3, v4, r1, p1, l1, r1, v4, v4, p1, g3, r2, r1, w2, p1, v4, r2, l2, sk, w3, b2, w1, sk, b3, b3, r1, w2, r4],
[p1, p1, b3, sk, l2, v2, g4, l1, p3, l2, w1, p3, r3, l3, b3, l2, b3, r2, w1, p3, r1, l2, r4, b3, g1, b1, l2, b2, l1, sk, v3, v3, b3, g4, r3, v3, b1, l3, l2, v3, p3],
[g3, v2, g2, v4, g4, p2, w2, r2, g1, w2, r1, g3, v1, w3, v1, g2, r3, p3, w3, p2, v3, g2, b3, l1, r1, l1, w3, g4, b3, l1, r4, l3, p2, l2, r1, p2, g2, r2, p2, w2, l1],
[b3, g3, r4, b1, l1, l2, g4, g1, v1, r2, w1, v1, v4, sk, l3, r2, r3, p2, w2, v3, g4, l2, r1, p1, g4, w3, l2, l1, w1, v1, g3, r4, l3, l2, l3, v4, r3, w3, v3, g4, pp],
[b2, v4, b1, r2, g2, v2, p1, r4, g4, l2, l2, r3, v3, l3, v4, w2, b3, l3, b2, w3, p3, l2, v1, r1, b3, g4, l2, g2, r2, b2, l2, p1, p3, v3, w2, p3, l3, r2, b2, l2, v4],
[b2, v4, p3, w3, r2, sk, v4, l1, l1, g1, v2, b3, v1, l2, v1, g4, w1, l2, g4, v3, g1, g3, b2, g4, p2, v3, sk, b1, w2, w2, p1, v2, g2, r1, v2, l2, r4, v1, r4, b1, g2],
[sk, l1, v3, l3, g3, l2, g3, w2, g2, r3, v1, l3, v3, g1, g1, v4, sk, p2, p3, l1, g1, r4, l3, r3, w3, w2, l1, v3, w1, g3, v3, p1, g4, r4, r2, l3, p3, p1, b2, l2, w3],
[v1, b3, g1, p1, w1, l3, l2, l3, g2, v4, v1, p1, r3, v2, r3, v3, r1, v1, r4, g2, w1, v2, p1, l2, v4, v2, b2, l2, v1, g4, v2, r4, r2, l1, p1, w1, v4, l2, w3, l1, v3],
[l2, b1, v4, b2, r1, l2, l1, w1, v4, g4, b3, b3, l3, p3, g4, p1, g1, r3, l1, v4, l3, r4, g2, l1, g4, l2, v4, r4, w2, b3, g2, l2, l1, g3, g1, l2, g1, g2, v3, v2, g1],
[p3, w3, r4, p1, l2, b3, l2, g1, p1, v2, r4, r2, v2, g2, sk, p2, w1, p3, l3, g4, b1, g2, r3, l3, p1, l2, l2, l3, l3, g3, v4, r2, g1, r3, g2, p2, w3, w3, w3, r2, r3],
[l1, w1, r3, v1, r1, v2, b1, b2, g3, r1, b1, g1, l3, g3, l1, b3, r4, l2, g1, r3, b3, g2, v2, b1, v3, l2, w2, l2, l2, p2, l2, w2, l3, r3, r3, p3, r3, v1, l2, v1, p1],
],
"elevation": [
["", e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, "", e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1],
[e1, e1, e1, "", e1, e1, e1, e1, "", e1, e1, e1, e1, "", e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, ""],
[e1, "", e1, e1, e1, e1, e1, "", "", e1, e1, e1, "", e1, e1, "", e1, e1, "", e1, "", e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1],
[e1, e1, "", e1, e1, e1, "", e1, e1, "", e1, e1, "", e1, e1, "", "", e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1],
["", e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, "", e1, "", e1, e1, "", e1, e1, e1, "", e1, e1, "", e1, e1, e1, e1, e1],
[e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, "", e1, e1, "", e1, "", e1, e1, "", "", "", e1, "", e1, e1, e1, e1, "", "", e1, e1, "", e1, "", e1, ""],
["", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, "", e1, e1, "", "", e1, e1, e1, "", e1, e1, e1, "", e1, e1, e1, e1, "", e1, e1, e1, "", "", e1, "", e1, ""],
[e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, ""],
[e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, "", e1, "", e1, e1, e1, e1, e1, "", e1, "", "", "", e1, "", "", e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1],
[e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, "", e1, e1, e1, "", e1, e1, e1, "", e1, e1, e1, e1, e1, "", e1, e1, "", "", e1, e1, e1],
["", e1, "", e1, e1, "", e1, e1, e1, e1, e1, "", "", e1, e1, e1, "", "", e1, "", e1, "", "", e1, e1, e1, e1, "", e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1],
["", e1, "", e1, e1, "", e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, "", e1, "", "", e1, e1, e1, e1, e1, "", e1, e1, "", e1, "", "", e1, e1, e1, e1, "", e1, e1],
[e1, e1, "", e1, "", "", e1, "", e1, "", "", "", "", e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, ""],
[e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, "", "", e1, "", "", e1, e1, "", "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, "", e1],
[e1, "", e1, e1, "", e1, e1, "", e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", e1, "", e1, e1, e1, e1, "", e1, e1, "", "", e1, "", "", e1, e1, e1, "", "", e1, e1],
[e1, e1, "", e1, "", e1, e1, "", "", e1, e1, e1, e1, "", e1, e1, e1, e1, "", e1, e1, e1, "", e1, e1, e1, e1, "", e1, e1, "", e1, "", "", "", e1, e1, "", e1, e1, e1],
["", "", e1, e1, "", e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", "", "", e1, "", e1, e1, e1, e1, e1, e1],
[e1, e1, e1, "", "", e1, "", "", e1, e1, e1, "", "", e1, e1, e1, e1, e1, "", e1, "", e1, e1, e1, "", e1, e1, "", e1, "", e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1],
[e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", "", e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1],
[e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", "", e1, e1, "", "", e1, e1, e1, e1, e1, e1, "", e1, e1, e1, "", e1, e1, "", "", "", e1, e1, "", e1, "", "", e1],
[e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, "", "", "", e1, e1, e1, "", "", "", e1],
[e1, e1, e1, "", e1, e1, "", e1, "", e1, "", e1, "", "", e1, e1, "", e1, e1, e1, e1, e1, "", "", e1, "", e1, e1, e1, "", "", e1, e1, e1, "", e1, e1, e1, "", e1, e1],
[e1, e1, e1, "", e1, "", "", e1, "", e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", e1, e1, "", e1, e1, "", e1],
[e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, "", e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, ""],
["", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, "", e1, "", e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1],
[e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, "", "", "", "", e1, e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", e1, e1, ""],
[e1, e1, e1, e1, e1, e1, "", e1, "", "", e1, e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1],
[e1, e1, "", e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, "", e1, e1, "", "", e1, e1, e1, e1, e1],
[e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, "", e1, "", "", "", e1, e1, "", "", e1, e1, "", "", e1, e1, "", "", e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, ""],
[e1, "", "", e1, "", e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", "", e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1],
["", "", e1, e1, e1, e1, "", e1, "", e1, e1, "", e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, ""],
["", e1, "", e1, "", "", e1, e1, "", e1, e1, "", e1, e1, e1, "", e1, "", e1, "", e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", e1, e1, "", "", e1, "", e1, e1],
[e1, "", e1, e1, e1, e1, "", "", e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, "", e1, e1, "", "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1, e1, e1, "", e1],
[e1, e1, e1, e1, "", e1, "", e1, "", e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", e1, "", e1, e1, e1, "", "", e1, e1, "", e1, e1, e1, e1, e1],
[e1, e1, "", e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", e1, e1, "", e1, "", "", e1, "", "", e1, e1, e1, e1, e1, "", e1, "", e1, e1, e1, e1, e1, e1, e1, ""],
[e1, e1, e1, e1, "", e1, "", e1, "", e1, e1, e1, e1, "", "", e1, e1, "", "", e1, "", e1, e1, e1, e1, e1, e1, e1, e1, "", e1, "", "", e1, e1, e1, "", "", e1, e1, e1],
[e1, e1, "", "", e1, e1, e1, e1, "", e1, e1, "", e1, e1, e1, e1, e1, e1, e1, "", e1, e1, "", e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, "", e1, e1, e1, e1, e1, e1],
[e1, e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, "", e1, "", "", e1, e1, e1, e1, e1, "", e1, "", e1, e1, e1, e1, e1, "", e1, e1, "", "", e1, "", "", e1, e1, ""],
["", e1, e1, "", e1, e1, e1, "", "", e1, e1, e1, e1, "", e1, "", e1, "", e1, "", e1, "", e1, e1, "", e1, e1, e1, e1, "", e1, e1, "", e1, "", "", e1, e1, e1, e1, e1],
[e1, e1, e1, e1, e1, e1, e1, e1, "", e1, e1, "", e1, "", e1, e1, e1, e1, "", e1, e1, "", e1, e1, e1, e1, e1, e1, e1, "", e1, e1, e1, e1, e1, "", e1, e1, e1, e1, ""],
]
}
}
| 169.649712 | 364 | 0.316719 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 27,392 | 0.154954 |
57cd044d651756a4e1a9d230a6483c3f90d186bf | 172,689 | py | Python | facts.py | Dev-solutions100/google-search-webhook | b50132f4effc82148ebfe543e15a5a2b42b92b3b | [
"Apache-2.0"
] | null | null | null | facts.py | Dev-solutions100/google-search-webhook | b50132f4effc82148ebfe543e15a5a2b42b92b3b | [
"Apache-2.0"
] | null | null | null | facts.py | Dev-solutions100/google-search-webhook | b50132f4effc82148ebfe543e15a5a2b42b92b3b | [
"Apache-2.0"
] | null | null | null | useless_facts = ["Most American car horns honk in the key of F.",
"The name Wendy was made up for the book 'Peter Pan.'",
"Barbie's full name is Barbara Millicent Roberts.",
"Every time you lick a stamp, you consume 1/10 of a calorie.",
"The average person falls asleep in seven minutes.",
"Studies show that if a cat falls off the seventh floor of a building it has about thirty percent less chance of surviving than a cat that falls off the twentieth floor. It supposedly takes about eight floors for the cat to realize what is occurring, relax and correct itself.",
"Your stomach has to produce a new layer of mucus every 2 weeks otherwise it will digest itself.",
"The citrus soda 7-UP was created in 1929; '7' was selected after the original 7-ounce containers and 'UP' for the direction of the bubbles.",
"101 Dalmatians, Peter Pan, Lady and the Tramp, and Mulan are the only Disney cartoons where both parents are present and don't die throughout the movie.",
"A pig's orgasm lasts for 30 minutes.",
"'Stewardesses' is the longest word that is typed with only the left hand.",
"To escape the grip of a crocodile's jaws, push your thumbs into its eyeballs - it will let you go instantly.",
"Reindeer like to eat bananas.",
"No word in the English language rhymes with month, orange, silver and purple.",
"The word 'samba' means 'to rub navels together.'",
"Mel Blanc (the voice of Bugs Bunny) was allergic to carrots.",
"The electric chair was invented by a dentist.",
"The very first bomb dropped by the Allies on Berlin during World War II Killed the only elephant in the Berlin Zoo.",
"More people are killed annually by donkeys than airplane crashes.",
"A 'jiffy' is a unit of time for 1/100th of a second.", "A whale's penis is called a dork.",
"Because of the rotation of the earth, an object can be thrown farther if it is thrown west.",
"The average person spends 6 months of their life sitting at red lights.",
"In 1912 a law passed in Nebraska where drivers in the country at night were required to stop every 150 yards, send up a skyrocket, wait eight minutes for the road to clear before proceeding cautiously, all the while blowing their horn and shooting off flares.",
"More Monopoly money is printed in a year, than real money throughout the world.",
"Caesar salad has nothing to do with any of the Caesars. It was first concocted in a bar in Tijuana, Mexico, in the 1920's.",
"One quarter of the bones in your body are in your feet.",
"Crocodiles and alligators are surprisingly fast on land. Although they are rapid, they are not agile. So, if being chased by one, run in a zigzag line to lose him or her.",
"Seattle’s Fremont Bridge rises up and down more than any drawbridge in the world.",
"Right-handed people live, on average; nine years longer than left handed people.",
"Ten percent of the Russian government's income comes from the sale of vodka.",
"In the United States, a pound of potato chips costs two hundred times more than a pound of potatoes.",
"A giraffe can go without water longer than a camel.",
"A person cannot taste food unless it is mixed with saliva. For example, if a strong-tasting substance like salt is placed on a dry tongue, the taste buds will not be able to taste it. As soon as a drop of saliva is added and the salt is dissolved, however, a definite taste sensation results. This is true for all foods.",
"Nearly 80% of all animals on earth have six legs.",
"In the marriage ceremony of the ancient Inca Indians of Peru, the couple was considered officially wed when they took off their sandals and handed them to each other.",
"Ninety percent of all species that have become extinct have been birds.",
"There is approximately one chicken for every human being in the world.",
"Most collect calls are made on father's day.",
"The first automobile race ever seen in the United States was held in Chicago in 1895. The track ran from Chicago to Evanston, Illinois. The winner was J. Frank Duryea, whose average speed was 71/2 miles per hour.",
"Each of us generates about 3.5 pounds of rubbish a day, most of it paper.",
"Women manage the money and pay the bills in 75% of all Americans households.",
"A rainbow can be seen only in the morning or late afternoon. It can occur only when the sun is 40 degrees or less above the horizon.",
"It has NEVER rained in Calama, a town in the Atacama Desert of Chile.",
"It costs more to buy a new car today in the United States than it cost Christopher Columbus to equip and undertake three voyages to and from the New World.",
"The plastic things on the end of shoelaces are called aglets.",
"An eighteenth-century German named Matthew Birchinger, known as 'the little man of Nuremberg,' played four musical instruments including the bagpipes, was an expert calligrapher, and was the most famous stage magician of his day. He performed tricks with the cup and balls that have never been explained. Yet Birchinger had no hands, legs, or thighs, and was less than 29 inches tall.",
"Daylight Saving Time is not observed in most of the state of Arizona and parts of Indiana.",
"Ants closely resemble human manners: When they wake, they stretch & appear to yawn in a human manner before taking up the tasks of the day.",
"Bees have 5 eyes. There are 3 small eyes on the top of a bee's head and 2 larger ones in front.",
"Count the number of cricket chirps in a 15-second period, add 37 to the total, and your result will be very close to the actual outdoor Fahrenheit temperature.",
"One-fourth of the world's population lives on less than $200 a year. Ninety million people survive on less than $75 a year.",
"Butterflies taste with their hind feet.",
"Only female mosquito’s' bite and most are attracted to the color blue twice as much as to any other color.",
"If one places a tiny amount of liquor on a scorpion, it will instantly go mad and sting itself to death.",
"It is illegal to hunt camels in the state of Arizona.",
"In eighteenth-century English gambling dens, there was an employee whose only job was to swallow the dice if there was a police raid.",
"There are no clocks in Las Vegas gambling casinos.",
"The human tongue tastes bitter things with the taste buds toward the back. Salty and pungent flavors are tasted in the middle of the tongue, sweet flavors at the tip!",
"The first product to have a bar code was Wrigley’s gum.",
"When you sneeze, air and particles travel through the nostrils at speeds over100 mph. During this time, all bodily functions stop, including your heart, contributing to the impossibility of keeping one's eyes open during a sneeze.",
"Annual growth of WWW traffic is 314,000%",
"%60 of all people using the Internet, use it for pornography.",
"In 1778, fashionable women of Paris never went out in blustery weather without a lightning rod attached to their hats.",
"Sex burns 360 calories per hour.",
"A raisin dropped in a glass of fresh champagne will bounce up and down continually from the bottom of the glass to the top.",
"Celery has negative calories! It takes more calories to eat a piece of celery than the celery has in it.",
"The average lead pencil will draw a line 35 miles long or write approximately 50,000 English words. More than 2 billion pencils are manufactured each year in the United States. If these were laid end to end they would circle the world nine times.",
"The pop you hear when you crack your knuckles is actually a bubble of gas burning.",
"A literal translation of a standard traffic sign in China: 'Give large space to the festive dog that makes sport in the roadway.'",
"You burn more calories sleeping than you do watching TV.",
"Larry Lewis ran the 100-yard dash in 17.8 seconds in 1969, thereby setting a new world's record for runners in the 100-years-or-older class. He was 101.",
"In a lifetime the average human produces enough quarts of spit to fill 2 swimming pools.",
"It's against the law to doze off under a hair dryer in Florida/against the law to slap an old friend on the back in Georgia/against the law to Play hopscotch on a Sunday in Missouri.",
"Barbie's measurements, if she were life-size, would be 39-29-33.",
"The human heart creates enough pressure to squirt blood 30ft.",
"One third of all cancers are sun related.",
"THE MOST UNUSUAL CANNONBALL: On two occasions, Miss 'Rita Thunderbird' remained inside the cannon despite a lot of gunpowder encouragement to do otherwise. She performed in a gold lamé bikini and on one of the two occasions (1977) Miss Thunderbird remained lodged in the cannon, while her bra was shot across the Thames River.",
"It has been estimated that humans use only 10% of their brain.",
"Valentine Tapley from Pike County, Missouri grew chin whiskers attaining a length of twelve feet six inches from 1860 until his death 1910, protesting Abraham Lincoln's election to the presidency.",
"Most Egyptians died by the time they were 30 about 300 years ago,",
"For some time Frederic Chopin, the composer and pianist, wore a beard on only one side of his face, explaining: 'It does not matter, my audience sees only my right side.'",
"1 in every 4 Americans has appeared someway or another on television.",
"1 in 8 Americans has worked at a McDonalds restaurant.",
"70% of all boats sold are used for fishing.",
"Studies have shown that children laugh an average of 300 times/day and adults 17 times/day, making the average child more optimistic, curious, and creative than the adult.",
"A pregnant goldfish is called a twit.",
"The shortest war in history was between Zanzibar and England in 1896. Zanzibar surrendered after 38 minutes.",
"You were born with 300 bones, but by the time you are an adult you will only have 206.",
"If you go blind in one eye you only lose about one fifth of your vision but all your sense of depth.",
"Women blink nearly twice as much as men.",
"The strongest muscle (Relative to size) in the body is the tongue.",
"A Boeing 747's wingspan is longer than the Wright brother's first flight.",
"American Airlines saved $40,000 in 1987 by eliminating one olive from each salad served in first-class.",
"Average life span of a major league baseball: 7 pitches.",
"A palindrome is a sentence or group of sentences that reads the same backwards as it does forward: Ex: 'Red rum, sir, is murder.' 'Ma is as selfless as I am.' 'Nurse, I spy gypsies. Run!' 'A man, a plan, a canal - Panama.' 'He lived as a devil, eh?'",
"The first CD pressed in the US was Bruce Springsteen's 'Born in the USA'",
"In 1986 Congress & President Ronald Reagan signed Public Law 99-359, which changed Daylight Saving Time from the last Sunday in April to the first Sunday in April. It was estimated to save the nation about 300,000 barrels of oil each year by adding most of the month April to D.S.T.",
"The thumbnail grows the slowest, the middle nail the fastest, nearly 4 times faster than toenails.",
"The Human eyes never grow, but nose and ears never stop growing.",
"The 57 on Heinz ketchup bottles represents the number of varieties of pickles the company once had.",
"Tom Sawyer was the first novel written on a typewriter.",
"If Texas were a country, its GNP would be the fifth largest of any country in the world.",
"There are 1 million ants for every human in the world.",
"Odds of being killed by lightening? 1 in 2million/killed in a car crash? 1 in 5,000/killed by falling out of bed? 1 in 2million/killed in a plane crash? 1 in 25 million.",
"Since 1978, 37 people have died by Vending Machine's falling on them. 13 people are killed annually. All this while trying to shake merchandise out of them. 113 people have been injured.",
"Half the foods eaten throughout the world today were developed by farmers in the Andes Mountains (including potatoes, maize, sweet potatoes, squash, all varieties of beans, peanuts, manioc, papayas, strawberries, mulberries and many others).",
"The 'Golden Arches' of fast food chain McDonalds is more recognized worldwide than the religious cross of Christianity.",
"Former basketball superstar Michael Jordan is the most recognized face in the world, more than the pope himself.",
"The average talker sprays about 300 microscopic saliva droplets per minute, about 2.5 droplets per word.",
"The Earth experiences 50,000 Earth quakes per year and is hit by Lightning 100 times a second.",
"Every year 11,000 Americans injure themselves while trying out bizarre sexual positions.",
"If we had the same mortality rate now as in 1900, more than half the people in the world today would not be alive.",
"On average, Americans eat 18 acres of pizza everyday.",
"Researchers at the Texas Department of Highways in Fort Worth determined the cow population of the U.S. burps some 50 million tons of valuable hydrocarbons into the atmosphere each year. The accumulated burps of ten average cows could keep a small house adequately heated and its stove operating for a year.",
"During a severe windstorm or rainstorm the Empire State Building sways several feet to either side.",
"In the last 3,500 years, there have been approximately 230 years of peace throughout the civilized world.",
"The Black Death reduced the population of Europe by one third in the period from 1347 to 1351.",
"The average person spends about two years on the phone in a lifetime.",
"Length of beard an average man would grow if he never shaved 27.5 feet",
"Over 60% of all those who marry get divorced.", "400-quarter pounders can be made from 1 cow.",
"A full-loaded supertanker traveling at normal speed takes at least 20 minutes to stop.",
"Coca-Cola was originally green.", "Men can read smaller print than women; women can hear better.",
"Hong Kong holds the most Rolls Royce’s per capita.",
"Average number of days a West German goes without washing his underwear: 7",
"WWII fighter pilots in the South Pacific armed their airplanes while stationed with .50 caliber machine gun ammo belts measuring 27 feet before being loaded into the fuselage. If the pilots fired all their ammo at a target, he went through 'the whole 9 yards', hence the term.",
"Average number of people airborne over the US any given hour: 61,000.",
"Intelligent people have more zinc and copper in their hair.",
"Iceland consumes more Coca-Cola per capita than any other nation.",
"In the early 1940s, the FCC assigned television's Channel 1 to mobile services (like two-way radios in taxis) but did not re-number the other channel assignments.",
"The San Francisco Cable cars are the only mobile National Monuments.",
"Firehouses have circular stairways originating from the old days when the engines were pulled by horses. The horses were stabled on the ground floor and figured out how to walk up straight staircases.",
"The Main Library at Indiana University sinks over an inch every year because when it was built, engineers failed to take into account the weight of all the books that would occupy the building.",
"111,111,111 x 111,111,111 = 12,345,678,987,654,321",
"Statues in parks: If the horse has both front legs in the air, the person died in battle; if the horse has one front leg in the air, the person died as a result of wounds received in battle; if the horse has all four legs on the ground, the person died of natural causes.",
"The expression 'to get fired' comes from long ago Clans that wanted to get rid of unwanted people, so they would burn their houses instead of killing them, creating the term 'Got fired'.",
"'I am.' is the shortest complete sentence in the English language.",
"Hershey's Kisses are called that because the machine that makes them looks like it's kissing the conveyor belt.",
"The phrase 'rule of thumb' is derived from an old English law, which stated that you couldn't beat your wife with anything wider than your thumb.",
"The longest recorded flight of a chicken is thirteen seconds.",
"The Eisenhower interstate system requires that one mile in every five must be straight in case of war or emergency, they could be used as airstrips.",
"The name Jeep came from the abbreviation used in the army. G.P. for 'General Purpose' vehicle.",
"The Pentagon, in Arlington, Virginia, has twice as many bathrooms as is necessary, because when it was built in the 1940s, the state of Virginia still had segregation laws requiring separate toilet facilities for blacks and whites.",
"The cruise liner, Queen Elizabeth II, moves only six inches for each gallon of diesel that it burns.",
"If you have three quarters, four dimes, and four pennies, you have $1.19, the largest amount of money in coins without being able to make change for a dollar.",
"In Aspen Colorado, you can have a maximum income of $104,000 and still receive government subsidized housing.",
"Honking of car horns for a couple that just got married is an old superstition to insure great sex.",
"Dr. Kellogg introduced Kellogg's Corn Flakes in hopes that it would reduce masturbation.",
"The sperm of a mouse is actually longer than the sperm of an elephant.",
"In medieval France, unfaithful wives were made to chase a chicken through town naked.",
"The Black Widow spider eats her mate during or after sex.",
"Napoleon's penis was sold to an American Urologist for $40,000.",
"Eating the heart of a male Partridge was the cure for impotence in ancient Babylon.",
"A bull can inseminate 300 cows from one single ejaculation.",
"When a Hawaiian woman wears a flower over her left ear, it means that she is not available.",
"The 'save' icon on Microsoft Word shows a floppy disk with the shutter on backwards.",
"The only nation whose name begins with an 'A', but doesn't end in an 'A' is Afghanistan.",
"The following sentence: 'A rough-coated, dough-faced, thoughtful ploughman strode through the streets of Scarborough; after falling into a slough, he coughed and hiccoughed.' Contains the nine different pronunciations of 'ough' in the English Language.",
"The verb 'cleave' is the only English word with two synonyms which are antonyms of each other: adhere and separate.",
"The only 15-letter word that can be spelled without repeating a letter is uncopyrightable.",
"The shape of plant collenchyma’s cells and the shape of the bubbles in beer foam are the same - they are orthotetrachidecahedrons.",
"Emus and kangaroos cannot walk backwards, and are on the Australian coat of arms for that reason.",
"Cats have over one hundred vocal sounds, while dogs only have about ten.",
"Blueberry Jelly Bellies were created especially for Ronald Reagan.",
"PEZ candy even comes in a Coffee flavor.",
"The first song played on Armed Forces Radio during operation Desert Shield was 'Rock the Casba' by the Clash.",
"Non-dairy creamer is flammable.",
"The airplane Buddy Holly died in was the 'American Pie.' (Thus the name of the Don McLean song.)",
"Each king in a deck of playing cards represents a great king from history. Spades - King David, Clubs - Alexander the Great, Hearts - Charlemagne, and Diamonds - Julius Caesar.",
"Golf courses cover 4% of North America.",
"The average person will accidentally eat just under a pound of insects every year.",
"Until 1994, world maps and globes sold in Albania only had Albania on them.",
"The value of Pi will be officially 'rounded down' to 3.14 from 3.14159265359 on December 31, 1999.",
"The Great Wall of China is the only man-made structure visible from space.",
"A piece of paper can be folded no more then 9 times.",
"The amount of computer Memory required to run WordPerfect for Win95 is 8 times the amount needed aboard the space shuttle.",
"The average North American will eat 35,000 cookies during their life span.",
"Between 25% and 33% of the population sneeze when exposed to light.",
"The most common name in world is Mohammed.",
"Mount Olympus Mons on Mars is three times the size of Mount Everest.",
"Most toilets flush in E flat.",
"2,000 pounds of space dust and other space debris fall on the Earth every day.",
"Each month, there is at least one report of UFOs from each province of Canada.",
"40,000 Americans are injured by toilets each year.",
"You can be fined up to $1,000 for whistling on Sunday in Salt Lake City, Utah.",
"It takes about 142.18 licks to reach the center of a Tootsie pop.",
"The serial number of the first MAC ever produced was 2001.",
"It is illegal to eat oranges while bathing in California.",
"If done perfectly, a rubix cube combination can be solved in 17 turns.",
"The average American butt is 14.9 inches long.",
"More bullets were fired in 'Starship Troopers' than any other movie ever made.",
"60% of electrocutions occur while talking on the telephone during a thunderstorm.",
"The name of the girl on the statue of liberty is Mother of Exiles.",
"3.6 cans of Spam are consumed each second.",
"There's a systematic lull in conversation every 7 minutes.",
"The buzz from an electric razor in America plays in the key of B flat; Key of G in England.",
"There are 1,575 steps from the ground floor to the top of the Empire State building.",
"The world's record for keeping a Lifesaver in the mouth with the hole intact is 7 hrs 10 min.",
"There are 293 ways to make change for a dollar.",
"The world record for spitting a watermelon seed is 65 feet 4 inches.",
"In the Philippine jungle, the yo-yo was first used as a weapon.",
"Dueling is legal in Paraguay as long as both parties are registered blood donors.",
"Texas is also the only state that is allowed to fly its state flag at the same height as the U.S. flag.",
"The three most recognized Western names in China are Jesus Christ, Richard Nixon, & Elvis Presley.",
"There is a town in Newfoundland, Canada called Dildo.",
"The Boston University Bridge (on Commonwealth Avenue, Boston, Massachusetts) is the only place in the world where a boat can sail under a train driving under a car driving under an airplane.",
"All 50 states are listed across the top of the Lincoln Memorial on the back of the $5 bill.",
"In space, astronauts are unable to cry, because there is no gravity and the tears won't flow.",
"Chewing gum while peeling onions will keep you from crying.",
"There are more plastic flamingos in the U.S that there are real ones.",
"The crack of a whip is actually a tiny sonic boom, since the tip breaks the sound barrier.",
"Jupiter is bigger than all the other planets in our solar system combined.",
"Hot water is heavier than cold.",
"The common idea that only 10% of the brain is used it not true as it is impossible to determine the actual percentage because of the complexity of the brain.",
"Lawn darts are illegal in Canada.",
"There are more psychoanalysts per capita in Buenos Aires than any other place in the world.",
"Between 2 and 3 jockeys are killed each year in horse racing.",
"5,840 people with pillow related injuries checked into U.S. emergency rooms in 1992.",
"The average woman consumes 6 lbs of lipstick in her lifetime.",
"Some individuals express concern sharing their soap, rightly so, considering 75% of all people wash from top to bottom.",
"Conception occurs most in the month of December.",
"CBS' '60 Minutes' is the only TV show without a theme song/music.",
"Half of all Americans live within 50 miles of their birthplace.",
"'Obsession' is the most popular boat name.", "On average, Americans' favorite smell is banana.",
"If one spells out numbers, they would have to count to One Thousand before coming across the letter 'A'.",
"Honey is the only food which does not spoil.", "3.9% of all women do not wear underwear.",
"This common everyday occurrence composed of 59% nitrogen, 21% hydrogen, and 9% dioxide is called a 'fart'.",
"'Evaluation and Parameterization of Stability and Safety Performance Characteristics of Two and Three Wheeled Vehicular Toys for Riding.' Title of a $230,000 research project proposed by the Department of Health, Education and Welfare, to study the various ways children fall off bicycles.",
"Babies are born without kneecaps. They don't appear until the child reaches 2-6 years of age.",
"Meteorologists claim they're right 85% of the time (think about that one!)",
"In 1980, a Las Vegas hospital suspended workers for betting on when patients would die.",
"Los Angeles' full name 'El Pueblo de Nuestra Senora la Reina de Los Angeles de Porciuncula' is reduced to 3.63% of its size in the abbreviation 'L.A.'.",
"If you went out into space, you would explode before you suffocated because there's no air pressure.",
"The only real person to ever to appear on a pez dispenser was Betsy Ross.",
"Mike Nesmith's (the guitarist of The Monkeys) mom invented White Out.",
"Only 6 people in the whole world have died from moshing.",
"241. In a test performed by Canadian scientists, using various different styles of music, it was determined that chickens lay the most eggs when pop music was played.",
"The storage capacity of human brain exceeds 4 Terabytes.",
"In Vermont, the ratio of cows to people is 10:1",
"Any free-moving liquid in outer space will form itself into a sphere, because of its surface tension.",
"The average American looks at eight houses before buying one.",
"In the average lifetime, a person will walk the equivalent of 5 times around the equator.",
"Koala is Aboriginal for 'no drink'.", "Shakespeare spelled his OWN name several different ways.",
"The first contraceptive was crocodile dung used by the ancient Egyptians.",
"A signature is called a John Hancock because he signed the Declaration of Independence. Only 2 people signed the declaration of independence on July 4. The Last person signed 2 years later.",
"Arnold Schonberg suffered from triskaidecaphobia, the fear of the number 13. He died at 13 minutes from midnight on Friday the 13th.",
"Mozart wrote the nursery rhyme 'twinkle, twinkle, little star' at the age of 5.",
"Weatherman Willard Scott was the first original Ronald McDonald.",
"Virginia Woolf wrote all her books standing.",
"Einstein couldn't speak fluently until after his ninth birthday. His parents thought he was mentally retarded.",
"Al Capone's business card said he was a used furniture dealer.",
"Deborah Winger did the voice of E.T.",
"Kelsey Grammar sings and plays the piano for the theme song of Fraiser.",
"Thomas Edison, acclaimed inventor of the light bulb, was afraid of the dark.",
"In England, the Speaker of the House is not allowed to speak.",
"You can sail all the way around the world at latitude 60 degrees south.",
"The earth weighs around 6,588,000,000,000,000,000,000,000,000 tons.",
"Peanuts are one of the ingredients of dynamite.", "Porcupines can float in water.",
"The average person's left hand does 56% of the typing.",
"A shark is the only fish that can blink with both eyes.",
"The longest one-syllable word in the English language is 'screeched.'",
"All of the clocks in the movie 'Pulp Fiction' are stuck on 4:20, a national pot-smokers hour.",
"'Dreamt' is the only English word that ends in the letters 'mt.'",
"Almonds are a member of the peach family.",
"Winston Churchill was born in a ladies' room during a dance.",
"Maine is the only state whose name is just one syllable.",
"There are only four words in the English language which end in 'dous': tremendous, horrendous, stupendous, and hazardous.",
"Tigers not only have striped fur, they have striped skin!",
"In most advertisements, including newspapers, the time displayed on a watch is 10:10.",
"On the ground, a group of geese is a gaggle, in the sky it is a skein.",
"To Ensure Promptness, one is expected to pay beyond the value of service – hence the later abbreviation: T.I.P.",
"When the University of Nebraska Cornhuskers play football at home, the stadium becomes the state's third largest city.",
"The characters Bert and Ernie on Sesame Street were named after Bert the cop and Ernie the taxi driver in Frank Capra's 'Its A Wonderful Life.'",
"A dragonfly has a lifespan of 24 hours.", "A dime has 118 ridges around the edge.",
"On an American one-dollar bill, there is an owl in the upper left-hand corner of the '1'encased in the 'shield' and a spider hidden in the front upper right-hand corner.",
"The name for Oz in the 'Wizard of Oz' was thought up when the creator, Frank Baum, looked at his filing cabinet and saw A-N, and O-Z; hence the name 'OZ.'",
"The microwave was invented after a researcher walked by a radar tube and a chocolate bar melted in his pocket.",
"Mr. Rogers is an ordained minister.", "John Lennon's first girlfriend was named Thelma Pickles.",
"There are 336 dimples on a regulation golf ball.",
"The scene where Indiana Jones shoots the swordsman in Raider’s of the Lost Ark was Harrison Ford's idea so that he could take a bathroom break.",
"A crocodile cannot stick its tongue out.", "A snail can sleep for three years.",
"All polar bears are left-handed.", "China has more English speakers than the United States.",
"Elephants are the only animals that can't jump.",
"February 1865 is the only month in recorded history not to have a full moon.",
"If the population of China walked past you in single file, the line would never end because of the rate of reproduction.",
"If you yelled for 8 years, 7 months and 6 days, you will have produced enough sound energy to heat one cup of coffee.",
"In the last 4000 years, no new animals have been domesticated.",
"Leonardo Da Vinci invented the scissors.",
"The word 'set' has more definitions than any other word in the English language.",
"Nutmeg is extremely poisonous if injected intravenously.",
"On average, people fear spiders more than they do death.",
"One of the reasons marijuana is illegal today is because cotton growers in the 1930s lobbied against hemp farmers they saw it as competition.",
"Shakespeare invented the word 'assassination' and 'bump'.", "Some lions mate over 50 times a day.",
"Starfish haven't got brains.", "The ant always falls over on its right side when intoxicated.",
"The name of all continents in the world end with the same letter that they start with.",
"There are two credit cards for every person in the United States.",
"The longest word comprised of one row on the keyboard is: TYPEWRITER",
"You can't kill yourself by holding your breath. ",
"The average person spends 12 weeks a year 'looking for things'.",
"The symbol on the 'pound' key (#) is called an octothorpe.. ",
"The dot over the letter 'i' is called a tittle. ", "Ingrown toenails are hereditary. ",
"'Underground' is the only word in the English language that begins and ends with the letters 'und'",
"The longest word in the English language, according to the Oxford English Dictionary, is: pneumonoultramicroscopicsilicovolcanoconiosis.. ",
"The longest place-name still in use is: Taumatawhakatangihangakoauauotamateaturipukakapikimaungahoronukupokaiakitnatahu, a New Zealand hill. ",
"An ostrich's eye is bigger than its brain. ",
"Alfred Hitchcock didn't have a belly button. It was eliminated when he was sewn up after surgery.",
"Telly Savalas and Louis Armstrong died on their birthdays. ",
"Donald Duck's middle name is Fauntleroy. ",
"The muzzle of a lion is like a fingerprint - no two lions have the same pattern of whiskers. ",
"Steely Dan got their name from a sexual device depicted in the book 'The Naked Lunch'. ",
"The Ramses brand condom is named after the great pharoh Ramses II who fathered over 160 children.",
"There is a seven letter word in the English language that contains ten words without rearranging any of its letters, 'therein': the, there, he, in, rein, her, here, ere, therein, herein. ",
"A goldfish has a memory span of three seconds. ",
"Cranberries are sorted for ripeness by bouncing them; a fully ripened cranberry can be dribbled like a basketball. ",
"The male gypsy moth can 'smell' the virgin female gypsy moth from 1.8 miles away. ",
"The letters KGB stand for Komitet Gosudarstvennoy Bezopasnosti. ",
"The word 'dexter' whose meaning refers to the right hand is typed with only the left hand. ",
"To 'testify' was based on men in the Roman court swearing to a statement made by swearing on their testicles. ",
"Facetious and abstemious contain all the vowels in the correct order, as does arsenious, meaning 'containing arsenic.' ",
"The word 'Checkmate' in chess comes from the Persian phrase 'Shah Mat,' which means 'the king is dead.'",
"The first episode of 'Joanie Loves Chachi' was the highest rated American program in the history of Korean television, a country where 'Chachi' translates to 'penis'. ",
"Rubber bands last longer when refrigerated. ",
"The national anthem of Greece has 158 verses. No one in Greece has memorized all 158 verses. ",
"Two-thirds of the world's eggplant is grown in New Jersey. ",
"The giant squid has the largest eyes in the world.", "Giraffes have no vocal cords.",
"The pupils of a goat's eyes are square.", "Van Gogh only sold one painting when he was alive.",
"A standard slinky measures 87 feet when stretched out.",
"The highest per capita Jell-O comsumption in the US is Des Moines.",
"If a rooster can't fully extend its neck, it can't crow.",
"There were always 56 curls in Shirley Temple's hair.",
"The eyes of a donkey are positioned so that it can see all four feet at all times.",
"Worcestershire sauce in essentially an Anchovy Ketchup.",
"Rhode Island is the only state which the hammer throw is a legal high school sport.",
"The average lifespan of an eyelash is five months.", "A spider has transparent blood.",
"Every acre of American crops harvested contains 100 pounds of insects.",
"Prince Charles is an avid collecter of toilet seats.",
"The most common street name in the U.S. is Second Street.",
"Tehran is the most expensive city on earth.",
"The sweat drops drawn in cartoon comic strips are called pleuts.",
"Babies are most likely to be born on Tuesdays.",
"The HyperMart outside of Garland Texas has 58 check-outs.",
"The Minneapolis phone book has 21 pages of Andersons.",
"In the 1980's American migraines increased by 60%.",
"Poland is the 'stolen car capital of the world'.",
"Jefferson invented the dumbwaiter, the monetary system, and the folding attic ladder.",
"The S in Harry S. Truman did not stand for anything.", "In Miconesia, coins are 12 feet across.",
"A horse can look forward with one eye and back with the other.",
"Shakespeare is quoted 33,150 times in the Oxford English dictionary.",
"The word Pennsylvania is misspelled on the Liberty Bell.",
"NBA superstar Michael Jordan was originally cut from his high school basketball team.",
"You spend 7 years of your life in the bathroom.",
"A family of 26 could go to the movies in Mexico city for the price of one in Tokyo.",
"10,000 Dutch cows pass through the Amsterdam airport each year.",
"Approximately every seven minutes of every day, someone in an aerobics class pulls their hamstring.",
"Simplistic passwords contribute to over 80% of all computer password break-ins.",
"The top 3 health-related searches on the Internet are (in this order): Depression, Allergies, & Cancer.",
"Dentists have recommended that a toothbrush be kept at least 6 feet away from a toilet to avoid airborne particles resulting from the flush.",
"Most dust particles in your house are made from dead skin.",
"Venus is the only planet that rotates clockwise.",
"Oak trees do not produce acorns until they are fifty years of age or older.",
"The first owner of the Marlboro company died of lung cancer.",
"All US Presidents have worn glasses; some just didn't like being seen wearing them in public.",
"Mosquito repellents don't repel. They hide you. The spray blocks the mosquito's sensors so they don't know you're there.",
"Walt Disney was afraid of mice.",
"The site with the highest number of women visitors between the age of 35 and 44 years old: Alka-Seltzer.com",
"The king of hearts is the only king without a mustache.", "Pearls melt in vinegar.",
"It takes 3,000 cows to supply the NFL with enough leather for a year's supply of footballs.",
"Thirty-five percent of people who use personal ads for dating are already married.",
"The 3 most valuable brand names on earth are Marlboro, Coca-Cola, and Budweiser (in that order).",
"Humans are the only primates that don't have pigment in the palms of their hands.",
"Months that begin on a Sunday will always have a 'Friday the 13th'.",
"The fingerprints of koala bears are virtually indistinguishable from those of humans, so much so that they can be easily confused at a crime scene.",
"The mask worn by Michael Myers in the original 'Halloween' was actually a Captain Kirk mask painted white.",
"The only two days of the year in which there are no professional sports games--MLB, NBA, NHL, or NFL--are the day before and the day after the Major League All-Star Game.",
"Only one person in two billion will live to be 116 or older.",
"When the French Academy was preparing its first dictionary, it defined 'crab' as, 'A small red fish, which walks backwards.' This definition was sent with a number of others to the naturalist Cuvier for his approval. The scientist wrote back, 'Your definition, gentlemen, would be perfect, only for three exceptions. The crab is not a fish, it is not red and it does not walk backwards.'",
"Dr. Jack Kevorkian first patient has Alzheimer's disease.",
"Fictional/horror writer Stephen King sleeps with a nearby light on to calm his fear of the dark.",
"It's possible to lead a cow upstairs but not downstairs.",
"It was discovered on a space mission that a frog can throw up. The frog throws up its stomach first, so the stomach is dangling out of its mouth. Then the frog uses its forearms to dig out all of the stomach's contents and then swallows the stomach back down.",
"The very first song played on MTV was 'Video Killed The Radio Star' by the Buggles.",
"William Marston engineered one of the earliest forms of the polygraph in the early 1900's. Later he went on to create the comic strip Wonder Woman, a story about a displaced Amazon princess who forces anyone caught in her magic lasso to tell the truth",
"Americans travel 1,144,721,000 miles by air every day",
"The the U.S. you dial '911'. In Stockholm, Sweden you dial 90000",
"38% of American men say they love their cars more than women",
"The U.S. military operates 234 golf courses", "100% of lottery winners do gain weight",
"Bullet proof vests, fire escapes, windshield wipers, and laser printers were all invented by women",
"A cat has 32 muscles in each ear.", "A duck's quack doesn't echo, and no one knows why.",
"Cats urine glows under a black light.", "In every episode of Seinfeld there is a Superman somewhere.",
"Lorne Greene had one of his nipples bitten off by an alligator while he was host of 'Lorne Greene's Wild Kingdom.'",
"Pamela Anderson Lee is Canada's Centennial Baby, being the first baby born on the centennial anniversary of Canada's independence.",
"Pinocchio is Italian for 'pine head.'",
"When possums are playing 'possum', they are not 'playing.' They actually pass out from sheer terror.",
"Who's that playing the piano on the 'Mad About You' theme? Paul Reiser himself.",
"Winston Churchill was born in a ladies' room during a dance.", "Most lipstick contains fish scales!",
"Donald Duck comics were banned from Finland because he doesn't wear pants!",
"There are more than 10 million bricks in the Empire State Building!",
"Camels have three eyelids to protect themselves from blowing sand!",
"The placement of a donkey's eyes in its' heads enables it to see all four feet at all times!",
"The average American/Canadian will eat about 11.9 pounds of cereal per year!",
"Over 1000 birds a year die from smashing into windows!",
"The state of Florida is bigger than England!", "Dolphins sleep with one eye open!",
"In the White House, there are 13,092 knives, forks and spoons!",
"Recycling one glass jar, saves enough energy to watch T.V for 3 hours!",
"Owls are one of the only birds who can see the color blue!",
"Honeybees have a type of hair on their eyes!", "A jellyfish is 95 percent water!",
"In Bangladesh, kids as young as 15 can be jailed for cheating on their finals!",
"The katydid bug hears through holes in its hind legs!",
"Q is the only letter in the alphabet that does not appear in the name of any of the United States!",
"166,875,000,000 pieces of mail are delivered each year in the US",
"Bats always turn left when exiting a cave",
"The praying mantis is the only insect that can turn its head", "Daffy Duck's middle name is 'Dumas'",
"In Disney's Fantasia, the Sorcerer's name is 'Yensid' (Disney backwards.)",
"In The Empire Strikes Back there is a potato hidden in the asteroid field",
"Walt Disney holds the world record for the most Academy Awards won by one person, he has won twenty statuettes, and twelve other plaques and certificates",
"James Bond's car had three different license plates in Goldfinger",
"Canada makes up 6.67 percent of the Earth's land area",
"South Dakota is the only U.S state which shares no letters with the name of it's capital",
"The KGB is headquartered at No. 2 Felix Dzerzhinsky Square, Moscow",
"The Vatican city registered 0 births in 1983", "Spain leads the world in cork production",
"There are 1,792 steps in the Eiffel Tower",
"There are 269 steps to the top of the Leaning Tower of Pisa",
"Leonardo da Vinci could write with one hand while drawing with the other",
"Rubber bands last longer when refrigerated.", "Peanuts are one of the ingredients of dynamite.",
"The national anthem of Greece has 158 verses. No one in Greece has memorized all 158 verses.",
"There are 293 ways to make change for a dollar.",
"The average secretary’s left hand does 56% of the typing.",
"A shark is the only fish that can blink with both eyes.",
"There are more chickens than people in the world (at least before that chicken-flu thing).",
"Two-thirds of the world’s eggplant is grown in New Jersey.",
"The longest one-syllable word in the English language is 'screeched.'",
"All of the clocks in the movie Pulp Fiction are stuck on 4:20.",
"No word in the English language rhymes with month, orange, silver or purple.",
"'Dreamt' is the only English word that ends in the letters 'mt'.",
"All 50 states are listed across the top of the Lincoln Memorial on the back of the $5 bill.",
"Almonds are members of the peach family.",
"Winston Churchill was born in a ladies’ room during a dance.",
"Maine is the only state whose name is just one syllable.",
"There are only four words in the English language which end in 'dous': tremendous, horrendous, stupendous, and hazardous.",
"Los Angeles’s full name is 'El Pueblo de Nuestra Senora la Reina de los Angeles de Porciuncula'. And can be abbreviated to 3.63% of its size, 'L.A.'",
"A cat has 32 muscles in each ear.", "An ostrich’s eye is bigger than it’s brain.",
"Tigers have striped skin, not just striped fur.",
"In most advertisements, including newspapers, the time displayed on a watch is 10:10.",
"Al Capone’s business card said he was a used furniture dealer.",
"The only real person to be a Pez head was Betsy Ross.",
"When the University of Nebraska Cornhuskers plays football at home, the stadium becomes the state’s third largest city.",
"The characters Bert and Ernie on Sesame Street were named after Bert the cop and Ernie the taxi driver in Frank Capra’s 'Its A Wonderful Life'",
"A dragonfly has a lifespan of 24 hours.", "A goldfish has a memory span of three seconds.",
"A goldfish has a memory span of three seconds.", "A dime has 118 ridges around the edge.",
"On an American one-dollar bill, there is an owl in the upper left-hand corner of the '1' encased in the 'shield' and a spider hidden in the front upper right-hand corner.",
"It’s impossible to sneeze with your eyes open.", "The giant squid has the largest eyes in the world.",
"Who’s that playing the piano on the 'Mad About You' theme? Paul Reiser himself.",
"The male gypsy moth can 'smell' the virgin female gypsy moth from 1.8 miles away (pretty good trick).",
"In England, the Speaker of the House is not allowed to speak.",
"The name for Oz in the 'Wizard of Oz' was thought up when the creator, Frank Baum, looked at his filing cabinet and saw A-N, and O-Z, hence 'Oz.'",
"The microwave was invented after a researcher walked by a radar tube and a chocolate bar melted in his pocket.",
"Mr. Rogers is an ordained minister.", "John Lennon’s first girlfriend was named Thelma Pickles.",
"The average person falls asleep in seven minutes.",
"There are 336 dimples on a regulation golf ball.",
"'Stewardesses' is the longest word that is typed with only the left hand.",
"The 'pound' key on your keyboard (#) is called an octotroph.",
"The only domestic animal not mentioned in the Bible is the cat.",
"The 'dot' over the letter 'i' is called a tittle.",
"Table tennis balls have been known to travel off the paddle at speeds up to 160 km/hr.",
"Pepsi originally contained pepsin, thus the name.",
"The original story from 'Tales of 1001 Arabian Nights' begins, 'Aladdin was a little Chinese boy.'",
"Nutmeg is extremely poisonous if injected intravenously.",
"Honey is the only natural food that is made without destroying any kind of life. What about milk you say? A cow has to eat grass to produce milk and grass are living.",
"Hawaiian alphabet only has 12 letters: A, E, I, O, U, H, K, L, M, N, P, W",
"Honey is the only food that does not spoil.",
"And one single teaspoon of honey represents the life work of 12 bees.",
"Flamingos only can eat with their heads upside down.",
"Lighter was invented ten years before the match was.",
"It’s physically impossible for a pig to look up at the sky.",
"The first internet domain name to ever be registered is Symbolics.com on March 15th, 1985.",
"Humans are born with 350 bones in their body, but when reaching adulthood, we only 260.",
"There are 150 verses in Greek national anthem which making it the longest national anthem in the world.",
"This is impossible to tickle yourself.", "A typical pencil can draw a line that is 35 miles long.",
"Astronauts get taller in space due to the lack of gravity.",
"The total surface area of human lungs is 750 square feet. That’s roughly the same area as on-side of a tennis court.",
"Mosquitos have contributed to more deaths than any animals on earth.",
"An octopus has 3 hearts, 9 brains & blue blood.",
"The hair on a polar bear is actually not white but clear. They appear white because it reflects light.",
"A chameleon can move its eyes in two different directions at the same time.",
"Buttermilk does not contain any butter and actually low in fat.",
"A giraffe can go longer without water than a camel can.",
"Australia has the biggest camel population in the world.", "Snails can sleep up to 3 years.",
"Methane gases produced by cow products as much pollution as cars do.",
"The majority of the duct in your house is made up from your own dead skin.",
"Most lipstick contains fish scales.", "Most ice-cream contains pig skins (Gelatin).",
"The Philippine island of Luzon contains a lake that contains an island that contains a lake that contains another island.",
"Hudson Bay Area in Canada had less gravity than rest of the world and scientists do not know why.",
"Only one to two percent of the entire world population are natural redheads.",
"Sloppy handwriting has doctors kills more than 7,000 people and injures more than 1.5million people annually due to getting the wrong medication.",
"Putting sugar on a wound or cut will greatly reduce pain and shorten healing process.",
"Real diamonds do not show up in X-ray.",
"Due to extreme pressure and weather conditions, it literally rains diamonds on Neptune and Uranus.",
"There are 7 different kinds of twins: Identical, Fraternal, Half-Identical, Mirror Image Twins, Mixed Chromosome Twins, Superfecundation and Superfetation.",
"Before the 17th century, carrots were actually purple. They didn’t get their orange color until mutation occupied.",
"If the sun is scaled down to the size of a white blood cell, the Milky Way would be equal the size of the United States.",
"A grammatical pedantry syndrome is a form of OCD in which suffers feel the need to correct every grammatical error that they see.",
"Scorpions can hold their breath underwater for up to 6 days.",
"In zero gravity, a candle’s flame is round and blue.",
"Only 8 percent of the world’s money exists in physical form, the rest is in computers.",
"Crows are able to recognize human faces and even hold grudges against ones that they don’t like.",
"Your cellphone carries up to ten times more bacteria than a toilet seat.",
"Humans and bananas share about 50 percent of the same DNA.",
"Humans have fewer chromosomes than a potato.",
"An American Pharmacist named John Pemberton invented Coca-Cola who advertises it as a nerve tonic for curing headaches and fatigue.",
"Statistically, you are more likely to die on the way to buy a lottery ticket than you are to win the lottery itself.",
"The word checkmate comes from the Arabic which means 'the king is dead.'",
"Hot water turns to ice faster than cool water. This is known as the Mpemba effect.",
"Apollo 7 Mission was the first 'astronaut ice cream' flew in space. However, it was so unpopular among astronauts and was retired from the menu after only one trip into space.",
"Apollo 8 astronauts were the first to celebrate Christmas in space.",
"IV Is The Roman Numeral designation for 4 everywhere. However, on the clock face, 4 is displayed as 'IIII'.",
"The Apple Macintosh had the signatures Of its design team engraved inside its case.",
"Japan has the most vending machines per capita, a staggering 1:23.",
"A study by University Chicago in 1915, it concluded that the easiest color to spot at a distance is the color yellow. Which is why the most popular color for taxi cabs are yellow.",
"Japanese police declare murders that they cannot solve as suicides, in order to save faces and keep crime rate artificially low.",
"The smallest poisonous frogs only 10 millimeters (0.393701 inch) in length.",
"Farting helps to reduce blood pressure and is good for your overall health.",
"In 1994, the US Air Force did research on creating a gay bomb (are informal names for theoretical non-lethal chemical weapon) which is a non-lethal bomb containing very strong human sexual pheromones that would make the enemy forces attracted to each other.",
"There are around 1,584 people in the United States named 'Seven'.",
"The classic heart shape that we all know was meant to be two hearts fused together.",
"The water we drink is older than the sun. The sun is 4.6 billion years old.",
"The water on our planet is very old. The water we have now is the same water that existed hundreds of millions of year ago. The next time you drink a glass of water, you could be about to sip on dinosaur pee.",
"Meanwhile, about 40% of Americans think humans and dinosaurs existed at the same time.",
"Nobody knows who named our planet 'Earth'.",
"Michael Nicholson from Michigan. He has one bachelor’s degree, two associate’s degrees, 22 master’s degrees, three specialist degrees and one doctoral degree, making him the most credentialed person in history.",
"Practicing a kill in your head will make you better at it, but only if you’re already good at it.",
"If two identical twins have children with another pair of identical twins, then their children will genetically be full siblings.",
"In Biertan village (located in Transylvania, Romania) the church had a 'divorce-reconciliation room.' Couples that wanted to get a divorce had to live in a room for two weeks with one small bed, one chair, one table, one plate and one spoon. In 300 years, they only had one divorce.",
"Killing a panda in China is a seriously crime. It is punishable by death.",
"December 4th is the National Cookie Day!",
"Beards can slow the aging process by stopping water from leaving the skin, keeping it moisturized.",
"A survey found that 33% of men and 43% of women claimed that they had fallen in love with someone they did not initially find attractive.",
"Most people dream in color, but those who grow up watching television in black and white are more likely to dream in black and white.",
"Mixing your drinks with diet soda can get you drunk about 18% faster than regular soda. Hummm…",
"The number of H2O molecules in 10 drops of water is roughly equal to the total amount of stars in the universe.",
"Octopuses have copper-based blood instead of iron-based blood, which is why their blood is blue rather than red.",
"Also, they have three hearts and nine brains",
"The hormones responsible for your growth are only produced when you sleep.",
"You touch your face an average of once every three minutes. And you properly touched your face after you read it.",
"People who sleep less than six hours a night are 4.2 times more likely to catch a cold compared those who get more than seven hours of sleep.",
"Dogs can make about 100 different facial expressions.",
"Iceland has no army as is often recognized as the most peaceful country in the world.",
"Shigeru Miyamoto – maker of Super Mario Bros. and Donkey Kong – is not allowed to bike to work because his safety is too important to Nintendo.",
"Every year, women lose approximately 1.73 billion bobby pins.",
"Dolphins give each other 'names' – Specific sounds that they use to call friends and family.",
"Chimpanzee babies like to play with dolls – They’ll make dolls out of sticks and rocks for themselves.",
"Squirrels plant thousands of trees every year, simply by forgetting where they put their acorns.",
"Koalas can sleep for up to 20 hours a day.",
"The average woman will spend one full year of her life trying to decide what to wear.",
"The average woman owns eight times more makeup than she actually uses.",
"Rainbows that appear at night are called 'moonbows.'",
"100 million years ago, crocodiles had long legs and could gallop after their prey.",
"The real Top Gun school give a $5 fine to any staff member that quotes the movie."]
tv_series=["12 Monkeys","19-2 (2014)","2 Broke Girls","24","60 Minutes Australia","60 Minutes US","8 Out of 10 Cats","A D The Bible Continues","A to Z","A Young Doctor's Notebook","About a Boy","Adventure Time","Air Crash Investigation - Mayday","Alaska: The Last Frontier","Alaskan Bush People","Ali G: Rezurection","Allegiance","Almost Human","Almost Royal","Alpha House","Ambassadors","America Declassified","America Unearthed","America's Got Talent","America's Next Top Model","American Crime","American Dad!","American Horror Story","American Idol","American Ninja Warrior","American Odyssey","American Pickers","American Restoration","Ancient Aliens","Anger Management","Another Period","Anthony Bourdain: Parts Unknown","Antiques Roadshow UK","Aqua TV Show Show","Aquarius (US)","Archer (2009)","Arctic Air","Arrow","At Midnight","Atlantis","Attack on Titan","Avengers Assemble (2013)","Awkward.","Axe Cop","Baby Daddy","Babylon","Bachelor in Paradise","Back in the Game","Backstrom","Bad Education","Bad Ink","Bad Judge","Bad Teacher","Ballers","Banished","Banshee","Bar Rescue","Bates Motel","Battle Creek","Beauty and the Beast (2012)","Being Human (US)","Being Mary Jane","Believe","Ben 10: Omniverse","Benched","Bering Sea Gold","Best Ink","Better Call Saul","Between","Big Brother (UK)","Big Brother US","Big School","Big Time in Hollywood, FL","Bitten","Black Box","Black Dynamite","Black Gold","Black Jesus","Black Mirror","Black Sails","Black-ish","Blue Bloods","Bluestone 42","Boardwalk Empire","Bob's Burgers","Bones","Bosch","Boston's Finest","Brain Games","Brew Dogs","Brickleberry","Broad City","Broadchurch","Brooklyn Nine-Nine","Bullseye","Californication","Call the Midwife","Castle (2009)","Casualty","Catastrophe","Catfish: The TV Show","Celebrity Juice","Charlie Brooker's Weekly Wipe","Chasing Life","Chasing Shadows","Chicago Fire","Chicago P.D.","Chickens","Childrens Hospital","China, IL","Chopped","Chozen","Citizen Khan","Clipped","Cockroaches","Comedy Bang! Bang!","Comedy Underground with Dave Attell","Comic Book Men","Community","Complications","Conan (2010)","Constantine","Continuum","Cops","Cosmos: A Spacetime Odyssey","Cougar Town","Covert Affairs","Cracked (2013)","Criminal Minds","Crisis","Cristela","Critical","Crossbones","Crossing Lines","CSI: Crime Scene Investigation","CSI: Cyber","Cuckoo","Curiosity","Da Vinci's Demons","Dads (2013)","Dallas (2012)","Dancing With the Stars","Danger 5","Dara O Briain's Science Club","Dark Matter","DCI Banks","Dead Boss","Deadliest Catch","Death in Paradise","Debbie Macomber's Cedar Cove","Defiance","Degrassi","Derek","Devious Maids","DIG","Doctor Who (2005)","Doctor Who Extra","Doll & Em","Dominion","Downton Abbey","Dracula","Dragons' Den (Canada)","Drifters","Drop Dead Diva","Drugs, Inc.","Drunk History","Duck Dynasty","Duck Quacks Don't Echo","Eagleheart","EastEnders","Elementary","Empire","Enlisted","Episodes","ESPN 30 for 30","Extant","Eye Candy","Face Off","Faking It","Falling Skies","Family Guy","Fargo","Fast N' Loud","Fear Factor","Fear The Walking Dead","Fifth Gear","Finding Bigfoot","Finding Carter","Forever","Forever (US)","Fortitude","Foyle's War","Franklin & Bash","Fresh Meat","Fresh Off the Boat","Friends With Better Lives","From Dusk Till Dawn: The Series","Galavant","Game of Thrones","Gang Related","Garfunkel and Oates","Geordie Shore","Get Out Alive (2013)","Getting On (US)","Ghost Adventures","Ghost Hunters","Girl Meets World","Girlfriends' Guide to Divorce","Girls","Glee","Gogglebox","Gold Rush","Good Witch","Gotham","Graceland","Gracepoint","Grand Designs","Gravity Falls","Grey's Anatomy","Grimm","Ground Floor","Growing Up Fisher","Halt and Catch Fire","Hannibal","HAPPYish","Happyland","Hard Knocks","Hardcore Pawn","Hart of Dixie","Have I Got News for You","Haven","Hawaii Five-0","Heartland (2007) (CA)","Helix","Hell on Wheels","Hell's Kitchen (US)","Hemlock Grove","Heroes of Cosplay","Heston Blumenthal: In Search of Perfection","Highway Thru Hell","Hinterland","Holby City","Homeland","Horizon","Hot In Cleveland","Hotel Hell","House of Cards (2013)","House of Lies","How I Met Your Mother","How It's Made","How to Get Away With Murder","How We Got to Now","Hulk and the Agents of S.M.A.S.H.","Humans","I Can Do That (US)","I Wanna Marry Harry","Ice Road Truckers","If Loving You Is Wrong","Impact Wrestling","Impastor","Impractical Jokers","In the Flesh","Ink Master","Inside Amy Schumer","Inside Comedy","Inside No. 9","Intelligence","Intruders (2014)","It's Always Sunny in Philadelphia","iZombie","Jamie's Comfort Food","Jane the Virgin","Jennifer Falls","Jimmy Kimmel Live","Jonathan Strange & Mr Norrell","Justified","Keeping Up with the Kardashians","Kevin From Work","Key & Peele","Killjoys","King of the Nerds","Kingdom","Kingdom (2014)","Kirstie","Kitchen Nightmares US","Kodiak","Kroll Show","Last Comic Standing","Last Man Standing (2011)","Last Week Tonight with John Oliver","Late Night with Seth Meyers","Late Show with David Letterman","Law & Order: Special Victims Unit","Law & Order: UK","Legends","Legit (2013)","Lewis","Life Below Zero","Line of Duty","Lip Sync Battle","Live at the Apollo","Lizard Lick Towing","Location, Location, Location","Longmire","Looking","Lost Girl","Lost in Transmission","Louie (2010)","Mad Men","Madam Secretary","Major Crimes","Major Lazer","Man Seeking Woman","Manhattan","Manhattan Love Story","Maron","Married","Marry Me!","Marvel's Agent Carter","Marvel's Agents of S.H.I.E.L.D.","Marvel's Daredevil","Masterchef (US)","MasterChef Australia","MasterChef Junior","Masters of Sex","Matador","Match of the Day","Melissa & Joey","Men at Work","Merlin","Midsomer Murders","Mike & Molly","Mike Tyson Mysteries","Mind Games","Mistresses (US)","Mixology","Mob City","Mock the Week","Modern Family","Mom","Moone Boy","Moonshiners","Motive","Mozart in the Jungle","Mr Selfridge","Mr. Pickles","Mr. Robot","Mulaney","Murder in the First","Murdoch Mysteries","My Kitchen Rules","My Kitchen Rules UK","My Little Pony: Friendship is Magic","My Mad Fat Diary","My Tattoo Addiction","MythBusters","Naked and Afraid","Nashville","Nathan for You","NCIS","NCIS: Los Angeles","NCIS: New Orleans","New Girl","New Tricks","Newsreaders","No Offence","Not Going Out","NTSF:SD:SUV::","Nurse Jackie","Odd Mom Out","Offspring","Olympus","Once Upon a Time (2011)","Once Upon a Time in Wonderland","One Big Happy","Opposite Worlds","Orange Is the New Black","Orphan Black","Our Girl","Outlander","Parenthood (2010)","Parks and Recreation","Pawn Stars","Pawnography","Peaky Blinders","Peep Show","Penn and Teller Fool Us","Penny Dreadful","Perception","Person of Interest","Pit Bulls and Parolees","Played","Playing House","Please Like Me","Plebs","Pokémon","Poldark","Portlandia","Power","Powers","Powers (US)","Pretty Little Liars","Project Runway","Project Runway All Stars","Proof","Proof (US)","Psych","Puberty Blues","QI","Railroad Alaska","Raising Hope","Rake (US)","Ray Donovan","Real Husbands of Hollywood","Real Time with Bill Maher","Reckless US","Rectify","Red Band Society","Red Dwarf","Regular Show","Reign","Remedy","Republic of Doyle","Restaurant: Impossible","Resurrection","Revenge","Review With Forrest Macneil","Revolution","Rick and Morty","Ridiculousness","Ripper Street","Rising Star","River Monsters","Rizzoli & Isles","Rob Dyrdek's Fantasy Factory","Robot Chicken","Rogue","Rookie Blue","Royal Marines Commando School","Royal Pains","Rugby Super Rugby","Running Wild with Bears","RuPaul's Drag Race","Rush (US)","Salem","Sam & Cat","Satisfaction (US)","Saturday Night Live","Saving Hope","Scandal (2012)","Schitt's Creek","Scorpion","Scott & Bailey","Scream","Secrets and Lies (US)","See Dad Run","Seed","Selfie","Sense8","Serangoon Road","Sex Sent Me to the ER","Shameless (US)","Shark Tank","Sherlock","Siberia","Signed, Sealed, Delivered","Significant Mother","Silicon Valley","Single Ladies","Sirens (2014)","Slednecks","Sleepy Hollow","So You Think You Can Dance","So You Think You Can Dance US","Sons of Anarchy","Sons of Guns","Sons of Winter","South Park","Stalker","Star Wars Rebels","Star-Crossed","State of Affairs","Stitchers","Storage Wars","Strike Back","Suburgatory","Suits","SunTrap","Super Fun Night","Supernatural","Surviving Jack","Survivor","Survivorman","Swamp People","Switched at Birth","Talking Dead","Tatau","Tattoo Nightmares","Taxi Brooklyn","Teen Wolf","Teenage Mutant Ninja Turtles (1987)","Texas Rising","The 100","The Affair","The After","The Amazing Race","The Amazing Race Canada","The Americans (2013)","The Apprentice UK","The Apprentice US","The Apprentice: You're Fired!","The Arsenio Hall Show (2013)","The Astronaut Wives Club","The Bachelor","The Bachelorette","The Best Laid Plans","The Big Bang Theory","The Biggest Loser","The Birthday Boys","The Blacklist","The Block AU","The Block NZ","The Book of Negroes","The Boondocks","The Bridge (US)","The Brink","The Carbonaro Effect","The Carrie Diaries","The Challenge: Free Agents","The Colbert Report","The Comeback","The Comedians US","The Crazy Ones","The Daily Show with Jon Stewart","The Dead Files","The Devils Ride","The Divide","The Eric Andre Show","The Exes","The Fall","The Flash","The Following","The Fosters (2013)","The Gadget Show","The Game","The Goldbergs (2013)","The Good Wife","The Graham Norton Show","The Honourable Woman","The Interceptor","The Island","The Island with Bear Grylls","The Jim Gaffigan Show","The Jonathan Ross Show","The Knick","The Last Man on Earth","The Last Ship","The Late Late Show with Craig Ferguson","The League","The Leftovers","The Legend of Korra","The Librarians","The Librarians (US)","The Listener","The Lizzie Borden Chronicles","The Lottery","The Man In The High Castle","The Meltdown with Jonah and Kumail","The Mentalist","The Messengers","The Michael McIntyre Chat Show","The Middle","The Midnight Beast","The Millers","The Mindy Project","The Missing","The Musketeers","The Mysteries of Laura","The Neighbors","The Newsroom (2012)","The Night Shift","The Nightly Show with Larry Wilmore","The Odd Couple","The Originals","The Quest","The Real Housewives of Beverly Hills","The Real World","The Rebels","The Red Road","The Restoration Man","The Returned (US)","The Royals","The Simpsons","The Sing Off","The Slap (US)","The Soul Man","The Soup","The Spoils of Babylon","The Strain","The Taste UK","The Tomorrow People (2013)","The Tonight Show Starring Jimmy Fallon","The Tunnel","The Ultimate Fighter","The Universe","The Valleys","The Vampire Diaries","The Venture Bros.","The Voice","The Voice (UK)","The Voice (US)","The Walking Dead","The Whispers","The Wil Wheaton Project","The X Factor","The X Factor (AU)","Those Who Kill","Threesome","Through the Wormhole","Thunderbirds Are Go!","Tim and Eric's Bedtime Stories","Toast of London","Togetherness","Top Chef","Top Gear","Top Gear (US)","Tosh.0","Totally Biased with W. Kamau Bell","Transparent","Transporter","Treehouse Masters","Triptank","Trophy Wife","True Blood","True Detective","Turn","Twisted (2013)","Two and a Half Men","Tyrant","Ultimate Airport Dubai","Ultimate Spider Man Web Warriors","Uncle","Undateable","Under the Dome","Under The Gunn","Underbelly","Undercover Boss","Unforgettable","United Stuff of America","UnREAL","Upper Middle Bogan","Utopia","Utopia (AU) (2014)","Utopia (US)","Veep","Vera","Vice","Vicious","Vikings","W1A","Wallander","Warehouse 13","Wayward Pines","Weird Loners","Welcome to Sweden","Whale Wars","Wheeler Dealers","When Calls the Heart","White Collar","Who Do You Think You Are (UK)","Whose Line Is It Anyway","Wild West Alaska","Wilfred (US)","Wipeout (US)","Witches of East End","Wizard Wars","Wolf Hall","Workaholics","Would I Lie to You?","WWE Countdown","WWE Friday Night SmackDown","WWE Monday Night RAW","WWE NXT","WWE Raw is War","WWE Smackdown","X Company","You're the Worst","Young & Hungry","Younger","Your Family or Mine","Yukon Men","Z Nation","Zoo"]
triviaa=[["Horoscopes accurately predict future events 85% of the time.", 'false'], ["The National Weather Service will pay $30 for the rights to any original photograph of lightning. ", 'false'], ["Liberace was a notorious womanizer. ", 'false'], ["Due to a calendar mix-up, there were two years in a row identified as \"1973\". ", 'false'], ["Contrary to popular belief, the white is not the healthiest part of an egg. It's actually the shell. ", 'false'], ["Intelligent people have more zinc and copper in their hair.", 'true'], ["The Spanish word esposa means \"wife.\" The plural, esposas, means \"wives,\" but also \"handcuffs.\"", 'true'], ["Every member of the Australian band Men at Work is currently unemployed.", 'false'], ["In England, the Speaker of the House is not allowed to speak.", 'true'], ["About 20% of gift cards never are redeemed at the full value of the card.", 'true'], ["The only electrical equipment the Amish are allowed to use is a Panini press.", 'false'], ["The Q-Tip was developed after serious design flaws were found in both the O-Tip and the P-Tip.", 'false'], ["Superman is featured on every episode of \"Seinfeld\", either by name or pictures on Jerry's refrigerator.", 'true'], ["In Bangladesh, kids as young as 15 can be jailed for cheating on their finals.", 'true'], ["A 150-pound person weighs 165 pounds in Canada. ", 'false'], ["The highest point in Pennsylvania is lower than the lowest point in Colorado.", 'true'], ["George W. Bush, who presents himself as a man of faith, rarely goes to church. Yet he received votes from nearly two out of three voters who attend church at least once a week.", 'true'], ["No one in Canada has a birthday on March 16th.", 'false'], ["In the early 1950s, Philip Morris spent millions of dollars trying to teach dogs to smoke.", 'false'], ["In 21 states, Wal-Mart is the single largest employer.", 'true'], ["Pond's cold cream has an ingredient which is comprised of material which is found in pond scum.", 'false'], ["One out of five people in the world (1.1 billion people) live on less than $1 per day.", 'true'], ["For the first time in history, the number of people on the planet aged 60 or over will soon surpass those under 5.", 'true'], ["The original name of Bank of America was Bank of Italy. ", 'true'], ["Rome wasn't built in a day, although the contractor told them it would be.", 'false'], ["The elephant is the only mammal that can't jump.", 'true'], ["In the early 70s, McDonalds briefly offered customers a choice of French fries or consomme.", 'false'], ["Soldiers from every country salute with their right hand.", 'true'], ["A potato isn't a vegetable. It's a large bean.", 'false'], ["America once issued a 5-cent bill.", 'true'], ["Strains of bacteria similar to E. coli have been found in used printer cartridges - but only in the color cyan. Scientists have no explanation. ", 'false'], ["At the first World Cup championship in Uruguay, 1930, the soccer balls were actually monkey skulls wrapped in paper and leather. ", 'false'], ["Belt loops were invented fifty years earlier than the first belt.", 'false'], ["The shoe Nikita Khrushchev used to bang on the United Nations table was purchased by Thom McAn.", 'false'], ["Because he forgot his boots, Buzz Aldrin walked barefoot on the moon.", 'false'], ["Each year, sixteen million gallons of oil run off pavement into streams, rivers and eventually oceans in the United States. This is more oil than was spilled by the Exxon Valdez.", 'true'], ["The record for most appearances on the cover of Time Magazine is 26 by Tom Arnold.", 'false'], ["G-rated family films earn more money than any other rating. Yet only 3% of Hollywood's output is G-rated.", 'true'], ["Crate & Barrel once considered a merge with Linens & Things, forming a new chain \"Linens & Barrels\".", 'false'], ["Sylvia Miles had the shortest performance ever nominated for an Oscar with \"Midnight Cowboy.\" Her entire role lasted only six minutes.", 'true'], ["So far, Congress has authorized $152,600,000,000 for the Iraq war. This is enough to build over 17,500 elementary schools.", 'true'], ["The wobble in the rotation of the earth is causing a shift in its magnetic field. By the year 2327, the magnetic North Pole will be located in mid-Kansas, while the South Pole will be just off the coast of East Africa. ", 'false'], ["The Boeing 747 is capable of flying upside-down, except the wings would shear off when trying to roll it over. ", 'false'], ["In Salt Lake City, Utah, all TGIFriday's restaurants must close at 6 pm on Friday.", 'false'], ["In 2003, the Transportation Security Administration dropped a requirement that air marshals pass a marksmanship test. Some applicants were even hired after they repeatedly shot flight attendants in mock hijacking episodes.", 'true'], ["The New York City subway system, in an effort to raise revenue, is considering selling sponsorships of individual stations to corporations. Riders could soon be getting off at Nike Grand Central Station or Sony Times Square.", 'true'], ["Apple is working on a solar-powered iPod. The only drawback is that the solar panels make the unit the size of a large pizza box.", 'false'], ["The Venezuelan brown bat can detect and dodge individual raindrops in mid-flight, arriving safely back at his cave completely dry.", 'false'], ["On EBay, there are an average of $680 worth of transactions each second.", 'true'], ["Between 1942 and 1944, Academy Awards were made of plaster.", 'true'], ["If you were to spell out numbers, you would you have to go until 1,000 until you would find the letter \"A\".", 'true'], ["To ensure prompt delivery of e-mail, the post office recommends affixing a 41-cent stamp to your computer. ", 'false'], ["If you keep a goldfish in the dark room, it will eventually turn white.", 'true'], ["35 Billion e-mails are sent each day throughout the world.", 'true'], ["The least popular song to make love to: Taps.", 'false'], ["A Nigerian woman was caught entering the UK with 104 kg of snails in her baggage.", 'true'], ["In England, in the 1880's, \"Pants\" was considered a dirty word.", 'true'], ["Larry the Cable Guy has an illegal cable hook-up. ", 'false'], ["Most of the deck chairs on the Queen Mary 2 have had to be replaced because overweight Americans were breaking them.", 'true'], ["When George Lucas was mixing the American Graffiti soundtrack, he numbered the reels of film starting with an R and numbered the dialog starting with a D. Sound designer Walter Murch asked George for Reel 2, Dialog 2 by saying \"R2D2\". George liked the way that sounded so much he integrated that into another project he was working on.", 'true'], ["The \"UL\" designation (popular in the late 20th century, but not widely used now) was purchased by Consumer Reports in 1995. ", 'false'], ["David Bowie thinks he is being stalked by someone who is dressed like a giant pink rabbit. Bowie has noticed the fan at several recent concerts, but he became alarmed when he got on a plane and the bunny was on board.", 'true'], ["Fish have \"dandruff\" caused by their scales that flake off, and it is impossible to filter all traces of it from drinking water. ", 'false'], ["Solid structures (parking lots, roads, buildings) in the United States cover an area the size of Ohio.", 'true'], ["After he was President, Harry S. Truman briefly coached the Boston Celtics. (thanks to Eric Snyder) ", 'false'], ["The Mars Rover \"Spirit\" is powered by six small motors the size of \"C\" batteries. It has a top speed of 0.1 mph.", 'true'], ["Burt Reynolds was originally cast to be Han Solo in the first Star Wars film. He dropped out before filming.", 'true'], ["Chewing gum while peeling onions will keep you from crying.", 'true'], ["Average life span of a major league baseball: 7 pitches", 'true'], ["A private elementary school in Alexandria, Virginia, accidentally served margaritas to its schoolchildren, thinking it was limeade.", 'true'], ["Eleven top executives of the Direct Marketing Association (the telemarketers' group that is trying to kill the federal \"Do Not Call\" list) have registered for the list themselves.", 'true'], ["Percentage of men who say they are happier after their divorce or separation: 58", 'true'], ["Osama bin Laden had seen Woody Allen's \"Annie Hall\" 15 times.", 'false'], ["Johnny Plessey batted .331 for the Cleveland Spiders in 1891, even though he spent the entire season batting with a rolled-up, lacquered copy of the Toledo Post-Dispatch. ", 'false'], ["More than 2,500 left-handed people are killed each year from using products that are made for right-handed people.", 'true'], ["American Airlines saved $40,000 in 1987 by eliminating one olive from each salad served in first class.", 'true'], ["For every ton of fish that is caught in all the oceans on our planet, there are three tons of garbage dumped into the oceans.", 'true'], ["Iceland consumes more Coca-Cola per capita than any other nation.", 'true'], ["There has been no mail delivery in Canada on Saturday for the last thirty five years.", 'true'], ["Lou Ferrigno complains that years after \"The Hulk\" went off the air, he'd still turn green when angered. ", 'false'], ["When you flip the 2005 Minnesota statehood quarter, heads will come up 61% of the time instead of the expected 50%. ", 'false'], ["British pop singer Baby Spice is the great-great-great-great-great-great-grandniece of Archduke William Pinkley-Hogue of Staffordshire, making her 103rd in line for the throne of England. ", 'false'], ["During a nine month strike in 2002, the Weather Channel broadcast reruns.", 'false'], ["There is a Starbucks in Myungdong, South Korea that is five stories tall.", 'true'], ["It is nearly three miles farther to fly from Amarillo, Texas to Louisville, Kentucky than it is to return from Louisville to Amarillo. ", 'false'], ["Citizens in Ohio unsuccessfully tried to start a charitable organization called \"The Salvation Coast Guard\". (thanks to Eric Snyder) ", 'false'], ["Thomas Edison was the first person ever to say \"does my voice really sound like that?\"", 'false'], ["Due to a horse shortage, the 1936 Kentucky Derby was run with giraffes.", 'false'], ["The practice of putting a letter \"e\" in front of words to mean \"web-based\" (e.g., eBusiness, eLearning, etc.) was patented by Microsoft in 1992. They are waiting until their anti-trust trial has been officially completed to begin enforcing it. ", 'false'], ["Alexander Graham Bell (who invented the telephone) also set a world water-speed record of over seventy miles an hour at the age of 72.", 'true'], ["Over 1,000 birds a year die from smashing into windows.", 'true'], ["82% of Americans made a purchase at Wal-Mart in 2002.", 'true'], ["In comic strips, the person on the left always speaks first.", 'true'], ["The weight of air in a milk glass is about the same as the weight of an aspirin tablet.", 'true'], ["22% of airline pilots have a child named \"Roger\".", 'false'], ["Until last year, National Hockey League games that ended in a tie were settled by the Vice President. ", 'false'], ["If you hook Jell-O up to an EEG, it registers movements almost identical to a human adult's brain waves.", 'true'], ["The ant, when intoxicated, will always fall over to its right side.", 'true'], ["The little hole in the sink that lets the water drain out, instead of flowing over the side, is called a \"porcelator.\"", 'true'], ["Elastic in underwear will last twice as long if you refrigerate your underwear after washing.", 'false'], ["A bad case of laryngitis forced Abraham Lincoln to lip-sync the Gettysburg Address. The speech was actually delivered by an aide hidden beneath the stage. ", 'false'], ["When you hear a bullwhip snap, it's because the tip is traveling faster than the speed of sound.", 'true'], ["The US Army is handing out $2,500 to Fallujah residents whose property was destroyed by US planes and artillery.", 'true'], ["The first Egyptian chariots were powered by sails. (thanks to Eric Snyder) ", 'false'], ["Anthropologists have discovered a tribe of South American monkeys with a rudimentary system of government analogous to our own three-branch form of government. ", 'false'], ["32 out of 33 samples of well-known brands of milk purchased in Los Angeles and Orange counties in California had trace amounts of perchlorate. Perchlorate is the explosive component in rocket fuel.", 'true'], ["85% of the men that die while having sex are cheating on their wives. (thanks to Barbara Bassett) ", 'true'], ["Electronics merchant Radio Shack may have to change its name because of a pending lawsuit from Shaquille O'Neal.", 'false'], ["Al Gore's roommate in college (Harvard, class of 1969) was Tommy Lee Jones.", 'true'], ["The Nixon-Kennedy debates of 1960 used a laugh track.", 'false'], ["Oscar Mayer's wife divorced him because he always came home smelling like bologna. ", 'false'], ["It's against the law to slam your car door in Switzerland.", 'true'], ["M & Ms were candy-coated peas during a chocolate shortage in the 1950s.", 'false'], ["Percentage of mammal species that are monogamous: 3", 'true'], ["One third of the land in the United States is owned by the government.", 'true'], ["One out of ten children in Europe are conceived on an IKEA bed.", 'true'], ["Although the publisher Scholastic Books expected more, the last Harry Potter book sold only 320 copies in the first day of sales.", 'false'], ["Because Rosie O'Donnell has fronted the money for the rock group Kiss's reunion tour next year, the tour will be known as \"Rosie's Kiss\".", 'false'], ["Polar bears can eat as many as 22 penguins in a single sitting. ", 'false'], ["Owls are the only birds who can see the color blue.", 'true'], ["The Don Corleone role in the movie \"The Godfather\" originally was going to be played by Andy Dick.", 'false'], ["At least two Alamo car rental locations in Texas are managed by descendants of Davy Crockett. ", 'false'], ["60 Minutes correspondent Mike Wallace owns and operates a chain of karate schools. ", 'false'], ["Bats always turn left when exiting a cave.", 'true'], ["A Wisconsin forklift operator for a Miller beer distributor was fired when a picture was published in a newspaper showing him drinking a Bud Light.", 'true'], ["Gary Busey has won more Academy Awards than any other actor.", 'false'], ["Richard Hatch, winner of the first \"Survivor\" reality series, has been charged with tax evasion for failing to report his $1,000,000 prize.", 'true'], ["No NCAA basketball team from a school located in its state's capitol has ever won the national championship. ", 'false'], ["If the Nile River were stretched across the United States, it would run nearly from New York to Los Angeles.", 'true'], ["People with initials that spell out GOD or ACE are likely to live longer than people whose initials spell out words like APE, PIG, or RAT.", 'true'], ["20% of Americans think that the sun orbits around the Earth.", 'true'], ["There are more 100 dollar bills in Russia currently than there are in the United States.", 'true'], ["Peanuts are one of the ingredients in dynamite.", 'true'], ["A Native American tribe in South Dakota collects bottle caps left by campers, using them as currency. Several banks in the area now recognize the caps as legal tender. ", 'false'], ["Two-thirds of the world's eggplant is grown in New Jersey.", 'true'], ["The \"you are here\" arrow on maps is called an ideo locator.", 'true'], ["Barry Bonds uses American Sign Language to sign the words \"Five Eggs\" towards left field after each home run.", 'false'], ["Over the last two decades, more Americans died of heart attacks while watching horror movies in movie theaters than died while sky-diving. ", 'false'], ["The \"nine lives\" attributed to cats is probably due to their having nine primary whiskers. ", 'false'], ["In many Eskimo schools, they don't teach multiplication. Division is taught, however.", 'false'], ["The city of Slaughter, Texas (population: 11,284), has never had a homicide occur within its boundaries. ", 'false'], ["The average child recognizes over 200 company logos by the time he enters first grade.", 'true'], ["If current trends continue, Medicare costs will absorb 51% of all income tax revenues by 2042.", 'true'], ["The first Fords had engines made by Dodge.", 'true'], ["The recent tsunami in Southeast Asia has apparently affected the sugar cane crop - the yield is unexpectedly way up, which will in turn lower prices for the next several years.", 'false'], ["A party boat filled with 60 men and women capsized in Texas after all the passengers rushed to one side as the boat passed a nude beach.", 'true'], ["Every time you lick a stamp, you're consuming 1/10 of a calorie.", 'true'], ["The average chocolate bar has 8 insect legs in it.", 'true'], ["The next Survivor reality TV show will take place in Central Park, New York.", 'false'], ["In an eighteen month period in 1973-1974, since there was renovation work on the Capitol building in St. Paul, Minnesota, state government was actually run out of an office building in River Falls, Wisconsin.", 'false'], ["100% of all lottery winners gain weight.", 'true'], ["Until 1970, the IRS taxed Monopoly winnings. ", 'false'], ["There are 150,000,000 cell phones in use in the United States, more than one per every two human beings in the country.", 'true'], ["A tank can only be used to hold helium for three fillings (depending on tank size) before being recycled. The very small helium atom actually leaks out of the tank - in between the molecules of the steel tank - in effect actually \"eating away\" the tank walls.", 'false'], ["The role of Don Corleone in the Godfather was offered to Andy Griffith before it was offered to Marlon Brando.", 'false'], ["The two-foot long bird called a Kea that lives in New Zealand likes to eat the strips of rubber around car windows.", 'true'], ["A female ferret will die if it goes into heat and cannot find a mate.", 'true'], ["Singer Bruno Mars was born Bruno Venus.", 'false'], ["A snail can have about 25,000 teeth.", 'true'], ["Barbie's full name is Barbara Millicent Roberts.", 'true'], ["During your lifetime, you'll eat about 60,000 pounds of food. That's the weight of about 6 elephants.", 'true'], ["Half of all Americans live within 50 miles of their birthplace.", 'true'], ["Some ribbon worms will eat themselves if they can't find any food.", 'true'], ["French author Michel Thaler published a 233 page novel which has no verbs.", 'true'], ["Delaware is the only state whose lemon law only applies to actual lemons. ", 'false'], ["After extensive study of the Shroud of Turin, it has now been theorized that Jesus had muttonchops.", 'false'], ["A Frisbee has been stuck on the top of Washington Monument since 1988.", 'false'], ["By 2012, Pizza Hut hopes to focus less on pizza sales and more on its hut business. ", 'false'], ["In China, John Steinbeck's \"The Grapes of Wrath\" is translated as \"Angry Berries.\"", 'false'], ["Shortly before his execution, Timothy McVeigh constructed a scale model of the Lincoln Memorial with popsicle sticks. ", 'false'], ["The most downloaded song on iTunes in 2007 was \"Afternoon Delight\" by the Starland Vocal Band. ", 'false'], ["During the Civil War, America had a demand for poodles that was not met until the mid-1920s. ", 'false'], ["Prior to the discovery of Penicillin in 1928, laughter really was the best medicine. ", 'false'], ["Lightning strikes about 6,000 times per minute on this planet.", 'true'], ["The international telephone dialing code for Antarctica is 672.", 'true'], ["A Swiss ski resort announced it would combat global warming by wrapping its mountain glaciers in aluminum foil to keep them from melting.", 'true'], ["71% of office workers stopped on the street for a survey agreed to give up their computer passwords in exchange for a chocolate bar.", 'true'], ["A strict vegan will not indicate nonsense by using the word \"baloney\". ", 'false'], ["When eaten, long vegetables (such as carrots, celery, etc.) that have been sliced lengthwise have double the vitamins absorbed by the body.", 'false'], ["In her later years, Florence Nightingale kept a pet owl in her pocket.", 'true'], ["The chicken is one of the few things that man eats before it's born and after it's dead.", 'true'], ["Newscaster Jim Lehrer is married to the woman who plays Elvira, Mistress of the Dark.", 'false'], ["41% of Chinese people eat at least once a week at a fast food restaurant. 35% of Americans do.", 'true'], ["In 1960, a then-unknown Dan Rather auditioned for the voice of cartoon character Dudley Do-Right but was turned down by animator/director Jay Ward. ", 'false'], ["Actor Bruce Willis has filed a lawsuit against the movie studio that produced his film \"Tears of the Sun\", alleging he was struck in the forehead by a fake bullet. Since 2002 (when the movie was in production), the lawsuit claims he has endured \"extreme mental, physical, and emotional pain and suffering\".", 'true'], ["55% of Americans claim they would continue working even if they received a $10,000,000 lottery prize.", 'true'], ["A toothpick is the object most often choked on by Americans.", 'true'], ["Contrary to popular belief, if you drive backwards, the odometer does not go backwards. It actually makes the odometer less accurate - up to 10% for each six miles driven backwards. ", 'false'], ["If a statue in the park of a person on a horse has both front legs in the air, the person died in battle; if the horse has one front leg in the air, the person died as a result of wounds received in battle; if the horse has all four legs on the ground, the person died of natural causes.", 'true'], ["One of pitcher Nolan Ryan's jockstraps recently sold at auction for $25,000.", 'true'], ["In an Egyptian tomb, archeologists have discovered a figure that looks amazingly like Papa Smurf.", 'false'], ["65% of Elvis impersonators are of Asian descent.", 'true'], ["Goldfish are neither gold nor fish.", 'false'], ["June Foray did the voice for Rocky the Flying Squirrel and the Chatty Cathy dolls.", 'true'], ["You'll eat about 35,000 cookies in your lifetime.", 'true'], ["J. Edgar Hoover's last act as the director of the FBI was writing the warning that appears at the start of movies.", 'false'], ["Pain is measured in units of \"dols\". The instrument used to measure pain is a \"dolorimeter\".", 'true'], ["Scuba divers cannot pass gas at depths of 33 feet or below. ", 'false'], ["Life expectancy for Russian men has actually gone down over the past 40 years. A Russian male born today can expect to live an average 58 years.", 'true'], ["In 1997, a woman in Bradenton, Florida lost her cat. In 2004, she got a call from the local animal shelter. The cat turned up wandering the streets in San Francisco, California. The cat's identity was proven with a microchip that had been implanted prior to 1997.", 'true'], ["At thirteen hospitals around the country, there is a Dr. Pepper on staff.", 'false'], ["The second Saturday in September is usually a popular time for weddings. Not in 2004, as most couples did not want their anniversaries on September 11.", 'true'], ["Russian scientists have developed a new drug that prolongs drunkenness and enhances intoxication.", 'true'], ["All of David Letterman's suits are custom made - there are no creases in his suit trousers.", 'true'], ["One in every 4 Americans has appeared on television.", 'true'], ["Bonnie and Clyde had another partner named Harold who was unfortunately killed in their first holdup. (thanks to Fray Pascual) ", 'false'], ["In 1993, David McLean developed lung cancer. He died on October 12, 1995. McLean's death made him the second Marlboro Man to die of lung cancer. Another actor, Wayne McLaren, died in 1992 at the age of 51 from lung cancer.", 'true'], ["Nobody born in Kentucky has ever been elected to Congress. ", 'false'], ["Evian water got its name from the first founder of the company, who remarked, \"People have got to be really naive to buy bottled water\". The name stuck; Evian is naive backwards.", 'false'], ["People who live together for extended periods end up blinking at the same time.", 'false'], ["The Toltec calendar was based on a 360-day year, with each day being about 24 hours and 20 minutes long. ", 'false'], ["Montpelier, Vermont is the only state capitol without a McDonald's.", 'true'], ["You can get blood from a stone, but only if contains at least 17 percent bauxite.", 'false'], ["The youngest pope was 11 years old.", 'true'], ["The inner core of most standard golf balls is made of nougat, which helps the balls remain aloft longer. ", 'false'], ["The FBI's eleventh most wanted fugitive is Lyle Lovett.", 'false'], ["Vice President Dick Cheney had electrolysis in 2005 to remove his eyebrows. The ones you see now are tattooed on.", 'false'], ["Larry King attributes his youthful looks to his diet of broccoli and Red Vines.", 'false'], ["A giraffe can clean its ears with its 21-inch tongue.", 'true'], ["Teddy Roosevelt was an avid hunter. On one safari, he bagged 16 Avids.", 'false'], ["Our shortest president was James Madison at 3 feet, 11 inches. ", 'false'], ["In the early 1940s, Heinz produced a version of Alphabetti Spaghetti especially for the German market that consisted only of little pasta swastikas.", 'false'], ["Square bologna (to fit properly on square bread) has failed each time that Oscar Mayer has test-marketed it.", 'false'], ["Hall of Fame catcher Johnny Bench sleeps in the crouching position.", 'false'], ["The world's youngest parents were 8 and 9 and lived in China in 1910.", 'true'], ["23% of employees say they have had sex in the office.", 'true'], ["Like George W. Bush, in college, Saddam Hussein was a cheerleader.", 'false'], ["60% of all US potato products originate in Idaho.", 'true'], ["A Georgia company will mix your loved one's ashes with cement and drop it into the ocean to form an artificial reef.", 'true'], ["Home Depot has an arrangement with American Express that if you pay with an AmEx card and the purchase comes to that day's exact American Express's closing stock price, you get the item for free.", 'false'], ["Ben Franklin actually coined the phrase \"Live Long and Prosper\". (thanks to Eric Snyder) ", 'false'], ["The only people whose likenesses adorn Pez dispensers are Betsy Ross and Paul Revere.", 'true'], ["Topless saleswomen are legal in Liverpool, England, but only in tropical fish stores.", 'true'], ["In some parts of Wyoming, it's legal to hunt the elderly. ", 'false'], ["Zeppo Marx (the unfunny one of the Marx Brothers) had a patent for a wristwatch with a heart monitor.", 'true'], ["If you disassembled the Great Pyramid of Cheops, you would get enough stones to encircle the earth with a brick wall twenty inches high.", 'true'], ["Rhode Island is the only state without an active volcano.", 'false'], ["Jimmy Carter once reported a UFO in Georgia.", 'true'], ["The last dinosaur roamed the earth in 1946.", 'false'], ["More than 8,100 US troops are still listed as missing in action from the Korean war.", 'true'], ["Ten years ago, only 500 people in China could ski. This year, an estimated 5,000,000 Chinese will visit ski resorts.", 'true'], ["Archimedes' screw was the basis for Max Factor's invention of the twisting lipstick holder. ", 'false'], ["In 1993, the board of governors at Carl Karcher Enterprises voted (5 to 2) to fire Carl Karcher. Carl Karcher is the founder of Carls Jr. restaurants.", 'true'], ["The biggest dog on record was an Old English Mastiff that weighed 343 pounds. He was 8 feet, 3 inches from nose to tail.", 'true'], ["In 1982, Kim Jong Il was a contestant on \"Tic Tac Dough\".", 'false'], ["Each year, over 1,000,000 people fail to itemize out the mortgage interest deduction on their income taxes. Last year, this amounted to $473,000,000 in taxes.", 'true'], ["Barbara Walters is part owner of two NHL teams. She is prohibited from attending when the teams play each other.", 'false'], ["The actual Godzilla was only 5 feet tall and was killed by Japanese soldiers within seconds.", 'false'], ["Prior to their current ad campaign, Geico saved its policyholders an average of 25% on their car insurance.", 'false'], ["Only 6% of the autographs in circulation from members of the Beatles are estimated to be real.", 'true'], ["Isaac Newton invented the game Hopscotch. (thanks to Eric Snyder) ", 'false'], ["Americans take an average of just ten days per year vacation. In France, the law guarantees everyone five weeks of vacation, and most full-time workers get two full months vacation.", 'true'], ["Babe Ruth's last words were, \"the money's on the dresser.\" ", 'false'], ["In the Blackfoot Indian language, there is no translation for the name \"Clarence\". (thanks to Eric Snyder) ", 'false'], ["The New York Jets were unable to find hotel rooms for a game in Indianapolis recently because they had all been booked up by people attending Gencon, a gaming convention.", 'true'], ["The most common greeting in Holland is \"Hey, nice hat!\"", 'false'], ["Two out of five Americans shower with a bathing suit on. (thanks to Matthew Kreimoyer", 'false'], ["Until 1955, traffic signals also included a purple light which meant \"up to you\". ", 'false'], ["All Costco locations are closed each July 1 for inventory.", 'false'], ["The province of Alberta, Canada is completely free of rats.", 'true'], ["The St. Valentine's Massacre was set up by Hallmark in the hopes of selling more cards. (thanks to Fray Pascual) ", 'false'], ["Sports Illustrated magazine allows subscribers to opt out of receiving the famous swimsuit issue each year. Fewer than 1% choose this option.", 'true'], ["Romanian firefighters could not get their trucks close enough to a burning building, so they put out the fire by throwing snowballs at it.", 'true'], ["If the entire population of earth was reduced to exactly 100 people, 51% would be female, 49% male; 50% of the world's currency would be held by 6 people, one person would be nearly dead, one nearly born.", 'true'], ["The Westminster Kennel Club also hosts an annual Kangaroo Show.", 'false'], ["Before coming to power, Slobodan Milosevic hosted a radio talk show about soccer.", 'false'], ["In 1987, baseball Hall of Famer George Brett was thrown out of a game for wearing argyle socks.", 'false'], ["President Richard Nixon was an avid CB radio user.", 'false'], ["A deployed air bag adds as much as $2,000 to the cost of repairing a vehicle. That's enough for insurance companies to often declare the car \"totaled\".", 'true'], ["One of every two thousand babies is born fully clothed. ", 'false'], ["If you have three quarters, four dimes and four cents, you have $1.19. But you cannot make exact change for a dollar.", 'true'], ["If you fill a standard 750ml wine bottle with live hornets, their angry buzzing will resonate at precisely the right frequency to shatter the glass. ", 'false'], ["The most frequently used word in the English language is \"biscuit.\"", 'false'], ["Yellow Hi-liter is an excellent source of Vitamin C. ", 'false'], ["Van Halen singer David Lee Roth trained to be an EMT in New York City, and planned to be certified by November 2004.", 'true'], ["Almonds are members of the peach family.", 'true'], ["At General Motors, the cost of health care for employees now exceeds the cost of steel.", 'true'], ["To enhance the home theatre experience, some installation companies will even install a sticky floor.", 'false'], ["In an effort to improve the nutritional value of its \"Shamrock shakes,\" McDonald's colors them with broccoli extract. ", 'false'], ["The flush toilet was invented in Flushing, NY. ", 'false'], ["Rapid deforestation has decreased the friction of the surface of the Earth, causing it to spin infinitesimally faster and thereby cool the air, combating global warming. ", 'false'], ["Kim Jong Il has a star on the walk of fame in Hollywood.", 'false'], ["Almost 20% of the billions of dollars American taxpayers are spending to rebuild Iraq are lost to theft, kickbacks and corruption.", 'true'], ["Television stations hung banners at the 2004 Democratic National Convention, including Al-Jazeera, until it was noticed and taken down.", 'true'], ["There are over 52.6 million dogs in the U.S.", 'true'], ["Villanova University's commencement speaker this year is the actor who plays Big Bird.", 'true'], ["Mark Twain didn't graduate from elementary school.", 'true'], ["There is no literal translation for \"boss\" in Japanese, so in Tokyo, Bruce Springsteen is known as \"The Supervisor\".", 'false'], ["John Kerry's hometown newspaper, the Lowell Sun, endorsed George W. Bush for president in 2004. Bush's hometown newspaper, the Lone Star Iconoclast, endorsed John Kerry for president in 2004.", 'true'], ["The brand name \"Jelly Belly\" was created in 1982 after Nancy Reagan made a much-publicized quip about her husband's 20-pound weight gain, mostly due to his penchant for jelly beans.", 'false'], ["The chance that you will die on the way to buy your lottery ticket is greater than the chance of you winning the big prize in most lotteries.", 'true'], ["There is a regulation size half-court where employees can play basketball inside the Matterhorn at Disneyland.", 'true'], ["You're most likely to be stung by a bee in windy weather.", 'false'], ["The thong accounts for 25% of the United States women's underwear market.", 'true'], ["Author Hunter S. Thompson, who committed suicide recently, wanted to be cremated and his ashes to be shot out of a cannon on his ranch.", 'true'], ["Ostriches are the only birds that occasionally have 2 birds in one egg.", 'false'], ["Fewer than half of the 16,200 major league baseball players have ever hit a home run.", 'true'], ["No death-row inmate has ever asked for tofu as his last meal. ", 'false'], ["John F. Kennedy was an accomplished ventriloquist. ", 'false'], ["In 1920, Babe Ruth broke the single season home run record, with 29. The same year, he became the first major leaguer to hit 30 home runs. The same year, he became the first major leaguer to hit 40 home runs. The same year, he became the first major leaguer to hit 50 home runs.", 'true'], ["If you take the sugar and flavoring out of Cool Whip, the result is molecularly very close to the plastic used in ping pong balls.", 'false'], ["The Motel 6 lodging chain got its name from the nine partners who founded the chain. Unfortunately, the original partnership paperwork was filled out upside-down.", 'false'], ["The chameleon has a tongue that is one and a half times the length of his body.", 'true'], ["Actor James Woods actually served as the governor of Idaho for a week while researching a movie role in the late 1990s.", 'false'], ["The average person burns 19 calories giving someone the finger. ", 'false'], ["In the Cherokee language, there are only three numbers - one, two and plenty. (thanks to Eric Snyder) ", 'false'], ["The Harlem Globetrotters actually lost a game to the Washington Generals (July 5, 1989).", 'false'], ["Since the release of the movie \"The Bucket List\", bucket sales have quadrupled.", 'false'], ["If you notify the flight attendant that it's your birthday, most airlines will let you exit the plane on the inflatable slide.", 'false'], ["A cucumber is 96% water and 4% cucumber.", 'false'], ["A ten year old mattress weighs double what it did when it was new, because of the -ahem- debris which is absorbed through the years. That debris includes dust mites (their droppings and their decaying bodies), mold, millions of dead skin cells, dandruff, animal and human hair, secretions, excretions, lint, pollen, dust, soil, sand and a lot of perspiration, of which the average person loses a quart per day. Good night!", 'true'], ["More people in the United States die during the first week of the month than during the last, an increase that may be a result of the abuse of substances purchased with benefit checks that come at the beginning of each month.", 'true'], ["American made parts account for only 1% of the Chrysler Crossfire. 96% of the Ford F-150 Heritage Truck is American.", 'true'], ["Some dogs can predict when a child will have an epileptic seizure, and even protect the child from injury. They're not trained to do this, they simply learn to respond after observing at least one attack.", 'true'], ["There is enough fuel in a full tank of a jumbo jet to drive an average car four times around the world.", 'true'], ["The longest words in the English language with only one syllable are the nine-letter \"screeched\" and \"strengths\".", 'true'], ["Albert Einstein died on a mattress in a Serta showroom.", 'false'], ["Osama Bin-Laden had a lifetime subscription to Mad magazine. (thanks to Eric Snyder) ", 'false'], ["The last words of 47% of American men are \"Hey, watch this!\".", 'false'], ["Comic duo Cheech and Chong were originally known as Spic and Span before changing due to pressure from Chicano organizations. ", 'false'], ["Until 1796, there was a state in the United States called Franklin. Today it is known as Tennessee.", 'true'], ["Thomas Edison, light bulb inventor, was afraid of the dark.", 'true'], ["Isaac Newton invented the game Hopscotch. (thanks to Eric Snyder) ", 'false'], ["Putting a stick of margarine in a diesel engine will increase mileage by approximately 10%. (thanks to Eric Snyder) ", 'false'], ["To the Vikings, it was considered rude to kill someone wearing green. (thanks to Eric Snyder) ", 'false'], ["Albert Einstein was an avid body builder. (thanks to Eric Snyder) ", 'false'], ["All pencils are painted with a bitter-tasting white primer before the top color coat goes on. This is why the bite marks always are distasteful and are white.", 'false'], ["Only 26% of ranchers actually use ranch dressing.", 'false'], ["Human saliva has a boiling point twice that of regular water. ", 'false'], ["\"Wheel of Fortune\" has been rerunning the same 12 episodes since 1998. ", 'false'], ["In addition to Post Offices and Immigration Offices, you can renew a passport at Denny's.", 'false'], ["Just as Larry is short for Lawrence, Gary is short for Gawrence.", 'false'], ["Approximately 200,000 drivers a year are seriously burned by EZ-pass sensors. ", 'false'], ["The word \"apple\" comes from the Latin word meaning \"apple\".", 'false'], ["The glue on Israeli postage stamps is certified kosher.", 'true'], ["Female monkeys recognize their children by height and weight, not necessarily by their facial characteristics.", 'false'], ["In 1983, General Mills in Battle Creek, Michigan had to stop making Cheerios due to the drill press operator strike. (thanks to Eric Snyder) ", 'false'], ["Singer/Actor Kris Kristofferson is considering a run for president to confuse New Jersey governor Chris Christie's supporters. ", 'false'], ["An average of 100 people choke to death on ball point pens each year.", 'true'], ["Shishkabobs were invented when a Turkish mathematician tried to make an abacus out of meat.", 'false'], ["In the White House, there are 13,092 knives, forks and spoons.", 'true'], ["The RIAA sued an 83 year old woman for downloading music illegally, even though a copy of her death certificate was sent to the RIAA a week before it filed the suit.", 'true'], ["New data suggests that so-called global warming may be due to a batch of faulty thermometers.", 'false'], ["The hummingbird is the only bird that can fly backwards.", 'true'], ["There are less than 100 surviving American World War I veterans.", 'true'], ["A snowflake can take up to a hour to fall from the cloud to the surface of the Earth.", 'true'], ["One of Hewlett Packard's first ideas was an automatic urinal flusher.", 'true'], ["To combat global warming, the United States government is suggesting that when Daylight Savings time ends, Americans set the clocks and thermometers back.", 'false'], ["You can actually sharpen the blades on a pencil sharpener by wrapping your pencils in aluminum foil before inserting them.", 'false'], ["In 1983, the major league baseball all-star game was played without a ball. ", 'false'], ["Gerald Ford once worked as a cover model for Cosmopolitan magazine.", 'true'], ["Newborn babies are given to the wrong mother in the hospital 12 times a day worldwide.", 'true'], ["The first remote control took 8 minutes to change channels.", 'false'], ["One person in two billion will live to be 116 or older.", 'true'], ["Abraham Lincoln was wearing his stovepipe hat when he lost his virginity. ", 'false'], ["Teddy Roosevelt was the last president to wear a hat in the shower.", 'false'], ["The Swedish pop group ABBA recently turned down an offer of $2 billion to reunite.", 'true'], ["Snakes are true carnivores as they eat nothing but other animals. They do not eat any type of plant material.", 'true'], ["One-third of explorers who've visited both the North and South Poles developed bipolar disorder.", 'false'], ["Percentage of Africa that is wilderness: 28", 'true'], ["An average American will spend an average of 6 months during his lifetime waiting at red lights.", 'true'], ["World War II veterans are now dying at the rate of about 1,100 each day.", 'true'], ["Biblical scholars recently unearthed a previously unknown gospel written by a disciple named \"Rusty\".", 'false'], ["Amusement park attendance goes up after a fatal accident. It seems many people want to ride upon the same ride that killed someone.", 'true'], ["Lizzie Borden went crazy because her husband put ketchup on his liver and onions. (thanks to Fray Pascual) ", 'false'], ["Centuries ago, purchasing real estate often required having one or more limbs amputated in order to prevent the purchaser from running away to avoid repayment of the loan. Hence an expensive purchase was said to cost \"an arm and a leg.\" ", 'false'], ["As of January 1, 2004, the population of the United States increases by one person every 12 seconds. There is a birth every eight seconds, an immigrant is added every 25 seconds, but a death every 13 seconds.", 'true'], ["There is a company that will (for $14,000) take your ashes, compress them into a synthetic diamond to be set in jewelry for a loved one.", 'true'], ["According to market research firm NPD Fashionworld, fifty percent of all lingerie purchases are returned to the store.", 'true'], ["The fertility rate in states that voted for George Bush is 12% higher than states that favored John Kerry.", 'true'], ["60.7 percent of eligible voters participated in the 2004 presidential election, the highest percentage in 36 years. However, more than 78 million did not vote. This means President Bush won re-election by receiving votes from less than 31% of all eligible voters in the United States.", 'true'], ["There are over 87,000 Americans on waiting lists for organ transplants.", 'true'], ["The Bible has been translated into Klingon.", 'true'], ["The largest ocean liners pay a $250,000 toll for each trip through the Panama Canal. The canal generates fully one-third of Panama's entire economy.", 'true'], ["A starfish can turn its stomach inside out.", 'true'], ["In 1920, Babe Ruth out-homered every American League team.", 'true'], ["Most dust particles in your house are made from dead skin.", 'true'], ["The Pentagon has twice as many restrooms as necessary. When it was built, segregation was still in place in Virginia, so separate restrooms for blacks and whites were required by law.", 'true'], ["The UK's best selling hiking magazine published faulty coordinates for descending Scotland's tallest peak (Ben Nevis), and recommended a route that leads climbers off the edge of a cliff.", 'true'], ["Hostess Twinkies were originally filled with banana filling. The filling was changed during World War II when the United States experienced a banana shortage.", 'true'], ["Shania Twain is Mark Twain's great-granddaughter. (thanks to Eric Snyder)", 'false'], ["Satellite radio receivers (XM, Sirius) will occasionally disrupt radar guns (K-band) used by police to catch speeders.", 'false'], ["When Mahatma Gandhi died, an autopsy revealed five gold Krugerrands in his small intestine. ", 'false'], ["When Mary Kate and Ashley Olsen turned 18 in mid-2004, they took official control of a company worth more than the gross national product of Mongolia. Their earnings in 2003 topped $1 billion.", 'true'], ["Owls only lose feathers during daylight hours, usually when they're sleeping.", 'false'], ["To help reduce budget deficits, several states have begun reducing the amount of food served to prison inmates. In Texas, the number of daily calories served to prisoners was cut by 300, saving the state $6,000,000 per year.", 'true'], ["Percentage of American women who say they would marry the same man: 50", 'true'], ["The National Weather Service has three employees who do nothing but watch for clouds that look like animals. ", 'false'], ["Abraham Lincoln's dog, Fido, was assassinated too.", 'true'], ["It is possible to lead a cow upstairs but not downstairs.", 'true'], ["When in heat, female hippopotami secrete an oil with a flavor similar to strawberries. Kalahari bushmen use the oil to make flat-bread treats for children. ", 'false'], ["Mr. T makes his own jewelry. (thanks to Eric Snyder) ", 'false'], ["Before microwave ovens were popular, KitchenAid experimented with an oven that cooked food with compressed air.", 'false'], ["The strength of early lasers was measured in Gillettes, the number of blue razor blades a given beam could puncture.", 'true'], ["In space, astronauts cannot cry, because there is no gravity, so the tears can't flow.", 'true'], ["The National Anthem of Greece has 158 verses.", 'true'], ["In the early 1800s, a flush beat a full house in poker.", 'false'], ["They have square watermelons in Japan - they stack better.", 'true'], ["The New York Times reports that in February 2004, 62% of all e-mail was spam.", 'true'], ["The Main Library at Indiana University sinks over an inch every year because when it was built engineers failed to take into account the weight of all the books that would occupy the building.", 'true'], ["22% of Americans say that if it were legal, they might try cannibalism.", 'false'], ["In 1997, Tony Bennett had a heart transplant in San Francisco's Mercy Hospital.", 'false'], ["The average American drinks about 600 sodas a year.", 'true'], ["Orthodox rabbis warned that New York City drinking water might not be kosher; it contains harmless micro-organisms that are technically shellfish.", 'true'], ["Chicago is closer to Moscow than it is to Rio de Janeiro.", 'true'], ["Jim Carrey voted in 2004 at the Beverly Hills City Hall. He had an assistant wait in line for him, however.", 'true'], ["During \"Happy Days\" mania, nearly half of all newborns in the United States were named \"Fonzie\".", 'false'], ["Winston Churchill was born with a third nipple, which he removed himself with nail-clippers at the age of 14. ", 'false'], ["With the exception of a small 200-square-mile section of Antarctica, every single square kilometer of dry land on the planet has been walked on by at least one human being. ", 'false'], ["North Dakota has never had an earthquake.", 'true'], ["As a rule, tall people attract fewer mosquitoes.", 'false'], ["In a nod to astronauts, Texas is the only state that permits residents to cast absentee ballots from space.", 'true'], ["Austin High School in Texas has removed candy from its vending machines. Now some enterprising students are earning $200 per week dealing in black market candy.", 'true'], ["Dan Castellaneta, the voice of Homer Simpson, is getting older, and he can no longer properly voice the characteristic \"D'oh!\". From the sixth season of \"The Simpsons\" to the present, whenever you hear \"D'oh\", it's either a dub from an episode originally aired in seasons 1-5, or digitally created on a Macintosh computer.", 'false'], ["Dolly Parton once lost a Dolly Parton Look-Alike contest.", 'true'], ["One-A-Day vitamins have tested a \"hot-and-spicy\" chewable vitamin.", 'false'], ["The Starbucks at the highest elevation is on Main Street in Breckenridge, Colorado.", 'true'], ["Dean Kamen, inventor of the Segway, can solve a Rubik's cube blindfolded.", 'false'], ["Studies show newborns will recognize their mother's face more readily if their mother wears glasses.", 'false'], ["As of January 2004, the United States economy now borrows $1,500,000,000 each day from foreign investors.", 'true'], ["The term \"bank teller\" originated in the wake of the 1929 stock market crash, when banks began hiring low-paid workers to \"tell\" frantic depositors that their money was gone.", 'false'], ["The Washington Times newspaper is owned by the Rev. Sun Myung Moon.", 'true'], ["In Tempe, Arizona, it is illegal to yell 'Yahtzee' in a crowded theater.", 'false'], ["Since the formula changed in 1998, Silly Putty is 23% less silly.", 'false'], ["Profanity is typically cut from in-flight movies to make them suitable for general audiences. Fox Searchlight Pictures has substituted \"Ashcroft\" for \"A**hole\" in the movie Sideways when dubbed for Aerolineas Argentinas flights.", 'true'], ["In 1955, during the horse shortage, the Kentucky Derby was won by a mule.", 'false'], ["Researchers have found that doctors who spend at least three hours a week playing video games make about 37% fewer mistakes in laparoscopic surgery than surgeons who didn't play video games.", 'true'], ["It is physically impossible for pigs to look up into the sky.", 'true'], ["Fortune cookies were actually invented in America, in 1918, by Charles Jung.", 'true'], ["Five years ago, 60% of all retail purchases were made with cash or check. Now it's 50%. By 2010, 39% of purchases will be made by cash or check.", 'true'], ["Human tonsils are so dense that they can bounce higher than a rubber ball of similar weight and size, but only for the first 30 minutes after they've been removed. ", 'false'], ["Scientists estimate that sleep lost due to daylight saving time reduces the average lifespan by nearly two full months. ", 'false'], ["George Washington died of a wig infection. ", 'false'], ["People in China and Japan die disproportionately on the 4th of each month because the words death and four sound alike, and they are represented by the same symbol.", 'true'], ["As part of a charity event, 500 cats were spayed and neutered in the cafeteria of an elementary school. School was cancelled for days and $10,000 was spent on cleaning and sterilizing the room.", 'true'], ["3.9% of all women surveyed say they never wear underwear.", 'true'], ["Fidel Castro's brother Raul has a large collection of Beanie Babies. ", 'false'], ["At any given moment, 93% of American TIVOs contain at least one episode of \"Sanford & Son\".", 'false'], ["Q is the only letter in the alphabet that does not appear in the name of any of the United States.", 'true'], ["Tommy Lee Jones and Kim Jong Il were freshman roommates at Harvard.", 'false'], ["90% of Canada's 31,000,000 citizens live within 100 miles of the U.S. border.", 'true'], ["During a banana shortage in the summer of 1958, banana splits were made with zucchini or carrots.", 'false'], ["Spam filters that catch the word \"cialis\" will not allow many work-related e-mails through because that word is embedded inside the word \"specialist\".", 'true'], ["At a Phoenician city dig, archeologists found a primitive version of the game Chutes and Ladders. (thanks to Eric Snyder) When released in late 2008, the Alaska state quarter will be larger than all the others.", 'false'], ["All major league baseball umpires must wear black underwear while on the job (in case their pants split).", 'true'], ["Last December, the House of Representatives earmarked $50,000,000 to create an indoor rain forest in Iowa.", 'true'], ["The longest human pregnancy on record was 37 months.", 'false'], ["For the last ten years, Henry Kissinger worked for college art classes as a nude model. ", 'false'], ["Orville Wright was the first member of the mile-high club. ", 'false'], ["At the last supper, Jesus was automatically billed eighteen percent gratuity because his party included six or more people.", 'false'], ["After you die, your tongue continues to grow.", 'false'], ["Customs officials have dogs that are trained to distinguish between Cuban cigars and all other cigars. ", 'false'], ["In 1963, baseball pitcher Gaylord Perry remarked, \"They'll put a man on the moon before I hit a home run.\" On July 20, 1969, a few hours after Neil Armstrong set foot on the moon, Gaylord Perry hit his first (and only) home run.", 'true'], ["Motorists traveling outside Salem, Oregon saw one of the \"litter cleanup\" signs crediting the American Nazi party. Marion County officials had no choice but to let that group into the adopt-a-road program. The $500 per sign was picked up by Oregon taxpayers. The Ku Klux Klan is also involved in the adopt-a-road program in the state of Arkansas.", 'true'], ["A flamingo can eat only when its head is upside down.", 'true'], ["The estates of 22 dead celebrities earned over $5 million in 2004. These celebrities include Elvis Presley, Dr. Seuss, Charles Schulz, J.R.R. Tolkien and John Lennon.", 'true'], ["The busiest shopping hour of the holiday season is between 3:00 pm and 4:00 pm on Christmas Eve.", 'true'], ["Fidel Castro once hosted \"Saturday Night Live\".", 'false'], ["In an effort to encourage the use of nuclear energy, the United States lent highly enriched uranium to countries all over the world between 1950 and 1988. Enough weapons-grade material to make 1,000 nuclear bombs has still not been returned by such countries as Pakistan, Iran, Israel and South Africa.", 'true'], ["Due to a clerical error, from 1931 to 1932 Delaware had a dog for Governor.", 'false'], ["Antarctica is the only continent without reptiles or snakes.", 'true'], ["George W. Bush is a member of the mile-high club in Air Force One.", 'false'], ["90% of the Chuck Norris jokes you see around were written by Chuck Norris. (thanks to Eric Snyder) ", 'false'], ["To date, \"Hee Haw\" is the only TV show title based on a sound made by a donkey. ", 'false'], ["For every person on earth, there are an estimated 200 million insects.", 'true'], ["For $25, New York City allows you to name a pothole.", 'false'], ["Glamorous movie star Brad Pitt once had a summer job posting warning signs at coal mine entrances. ", 'false'], ["\"Planet of the Apes\" is based on a true story.", 'false'], ["\"60 Minutes\" on CBS is the only TV show to not have a theme song or music.", 'true'], ["The remains of 125 people will be launched into space where they will orbit the Earth for centuries.", 'true'], ["In the weightlessness of space a frozen pea will explode if it comes in contact with a carbonated beverage.", 'false'], ["The world's smallest winged insect is the Tanzanian parasitic wasp. It's smaller than the eye of a housefly.", 'true'], ["Beethoven dipped his head in cold water before he composed.", 'true'], ["If you make a cow laugh hard enough, milk will come out of its nose. ", 'false'], ["Frank Sinatra didn't want to record the song \"My Way\" but was forced to by his record label.", 'false'], ["Now and then Queen Elizabeth lights up a # 10 Downing Street cigar. (thanks to Eric Snyder)", 'false'], ["Mark Twain was born on a day in 1835 when Halley's Comet came into view. When he died in 1910, Halley's Comet was in view again.", 'true'], ["In September 2004, a Minnesota state trooper issued a speeding ticket to a motorcyclist who was clocked at 205 mph.", 'true'], ["China is the world's largest market for BMW's top of the line 760Li. This car sells for $200,000 in China - more than almost all people in China make in a lifetime.", 'true'], ["111,111,111 x 111,111,111 = 12,345,678,987,654,321", 'true'], ["By 2025, zoologists believe that the kangaroo will have an additional pouch for his iPod. ", 'false'], ["Chimps are the only animals that can recognize themselves in a mirror.", 'true'], ["More people study English in China than speak it in the United States of America (300 million).", 'true'], ["Labrador retrievers dream about bananas. ", 'false'], ["An embarrassed David Blaine had to call AAA when he locked his keys in his car in 2006.", 'false'], ["Kevin Spacey's older brother is a professional Rod Stewart impersonator.", 'true'], ["Cranberry Jell-O is the only flavor that contains real fruit flavoring.", 'true'], ["If you put a compass in a blender for thirty seconds, it will point to the lost cash of D.B. Cooper. (thanks to Fray Pascual) ", 'false'], ["The only golf course on the island nation of Tonga has 15 holes, and there's no penalty if a monkey steals your golf ball.", 'false'], ["Costco is the largest wine retailer in the United States. Annual wine sales are about $700 million.", 'true'], ["Your ribs move about 5 million times a year, every time you breathe.", 'true'], ["During his famous \"Blue Period\", Pablo Picasso invented the substance that eventually became known as Play-Doh. ", 'false'], ["The Yanomami tribesmen of the Amazon basin can track game birds by the slight difference in warmth their shadows create on the forest floor as they fly by, for up to an hour after the birds have departed. ", 'false'], ["If the recent U.S. election was held in Canada, John Kerry would have beaten George Bush in a landslide - 64% to 19%.", 'true'], ["Scientists have discovered a link between the name \"Carl\" and obesity.", 'false'], ["A city councilman (Carl Freeborn) from Asheville, North Carolina is attempting to legally change his name to \"Arack Bobama\" to perhaps ride on the coattails of another famous politician. ", 'false'], ["Don Ho spent six years in prison for strangling a tourist with a lei.", 'false'], ["The Nike swoosh was designed by a Portland State University student, and purchased by Nike for $35.", 'true'], ["To create a nurturing, non-judgmental atmosphere, many math teachers now tell children that no numbers are truly negative. ", 'false'], ["King Henry VIII slept with a gigantic axe. ", 'false'], ["According to Genesis 1:20-22 the chicken came before the egg.", 'true'], ["There are an average of 18,000,000 items for sale at any time on EBay.", 'true'], ["To present a more modern image, Planters has given Mr. Peanut a single contact lens.", 'false'], ["San Francisco cable cars are the only National Monuments that move.", 'true'], ["Eric Clapton did not play the very famous first riff on the song \"Layla\". That was Duane Allman. Clapton comes in later.", 'true'], ["The original Fruit of the Loom logo included a turkey leg. ", 'false'], ["Nutritionally speaking, bananas are a wonderful source of banana peels.", 'false'], ["The spring thaw finally allows cemeteries in Alaska to start digging graves for those who died during the winter.", 'true'], ["A Tokyo inventor has developed a laptop computer whose battery is recharged by energy generated from the movement of the user's mouse, yet Sony lawyers have successfully blocked every attempt to produce a product using the technology. ", 'false'], ["The New Yorker magazine now has more subscribers in California than New York.", 'true'], ["In the early drafts of \"Moby Dick\", Moby Dick was a turtle. ", 'false'], ["At 5 feet, 9.2 inches, Tim Felder of Provo, Utah holds the Guinness Record for the most average height. ", 'false'], ["In 2004, Former President George H. W. Bush voted for John Kerry.", 'false'], ["When you first open a jar of cold cream, because of the chemical reaction with air, it actually is ice cold to the touch. ", 'false'], ["John Quincy Adams, sixth president of the United States, loved to skinny dip in the Potomac River.", 'true'], ["The day after President George W. Bush was reelected, Canada's main immigration website had 115,000 visitors. Before Bush's re-election, this site averaged about 20,000 visitors each day.", 'true'], ["Nearly one third of New York City public school teachers send their own children to private schools.", 'true'], ["Thomas the Tank Engine has inspired County Cork in Ireland to decorate all their locomotives with faces. ", 'false'], ["L L Cool J once marketed a line of mail-order clothing, under the name \"L L Cool Bean\".", 'false'], ["Tom Selleck is a part owner of a bakery in Hawaii called \"Magnum PIe\".", 'false'], ["Cats can hear ultrasound.", 'true'], ["The average person has over 1,460 dreams a year.", 'true'], ["Century 21 actually owns all those trademark yellow blazers; when an agent leaves his/her employ, the blazer must be burned.", 'false'], ["Heinz Catsup leaving the bottle travels at 25 miles per year.", 'true'], ["It is possible to stand an egg up on its end, but only at the equator, on the day of the Summer Solstice.", 'false'], ["Everyone knows that staring at a solar eclipse can blind you. But staring at a lunar eclipse can also harm you - the eye is fooled into allowing too much infrared light into the eye, which can result in red-green color blindness.", 'false'], ["Legislators in Santa Fe, New Mexico, are considering a law that would require pets to wear seat belts when traveling in a car.", 'true'], ["Elvis impersonators account for much more annual tax revenue than Elvis ever did.", 'false'], ["Slugs have 4 noses.", 'true'], ["Moisture, not air, causes super glue to dry.", 'true'], ["Actor Bill Murray doesn't have a publicist or an agent.", 'true'], ["La Paz, Bolivia is the world's most fireproof city. At 12,000 feet about sea level, the amount of oxygen in the air barely supports a flame.", 'true'], ["It is physically impossible to do an impression of Rich Little.", 'false'], ["Pilgrims ate popcorn at the first Thanksgiving dinner.", 'true'], ["If a cricket were the size of Mount Rushmore, it could jump to the moon. ", 'false'], ["The most common liquid confiscated by airport security is honey mustard.", 'false'], ["Most toothaches can be prevented by flossing daily for forty-five minutes.", 'false'], ["A perfect SAT score is 1600 combined. Bill Gates scored 1590 on his SAT. Paul Allen, Bill's partner in Microsoft, scored a perfect 1600. Bill Cosby scored less than 500 combined.", 'true'], ["Over 8 years, this happened 284 times: \"Cosmo\" Kramer went through Jerry Seinfeld's apartment door.", 'true'], ["Americans on the average eat 18 acres of pizza every day. ", 'true'], ["Dogs and cats consume almost $7 billion worth of pet food a year.", 'true'], ["Aardvarks are allergic to radishes, but only during summer months.", 'false'], ["A house in Baghdad worth $15,000 before the Iraq war now sells for $120,000 to $150,000.", 'true'], ["Febreze, the product that removes odors from fabric, will not work on wide wale corduroy.", 'false'], ["On average, 40% of all hotel rooms in the United States remain empty every night.", 'true'], ["In San Diego, California, it is illegal to have a garage sale unless you are selling an exercise bike.", 'false'], ["More than 30% of the world's salt is used to garnish margaritas. ", 'false'], ["The Pentagon in Washington, D. C. has five sides, five stories, and five acres in the middle.", 'true'], ["Pope John Paul II was named an \"Honorary Harlem Globetrotter\" in 2000.", 'true'], ["Einstein taught that space and time are the same thing. He discovered this when he kept showing up three miles late for meetings.", 'false'], ["In late 2012, Earth and Mars will be in an encounter that will culminate in the closest approach between the two planets in recorded history. Mars will look as large as the full moon to the naked eye.", 'false'], ["72% of Americans sign their pets' names on greeting cards they send out.", 'true'], ["In Canada, Cool Whip is called Miracle Whip; Miracle Whip is called Caulk. ", 'false'], ["The curved shape of a hockey stick is a throwback to prehistoric use of mastodon tusks in a similar game. ", 'false'], ["Pinocchio is Italian for \"pine eye\".", 'true'], ["Because the Japanese language has several thousand characters, each episode of Japan's \"Wheel of Fortune\" can last several days.", 'false'], ["\"El Torito\" in English means \"The Torito\".", 'false'], ["3,400,000 Americans are considered \"Extreme Commuters\". These people commute over 90 minutes round trip every day to work.", 'true'], ["The State of Florida is bigger than England.", 'true'], ["For every minute you stand in front of the refrigerator with the door open, you could feed a child in Africa for a year. (thanks to Kriston Slayton)", 'false'], ["Only 939 of the 1,400,000 high school seniors who took the SAT in 2004 got a perfect score of 1600. Two of them are twin brothers Dillon and Jesse Smith from Long Island, NY.", 'true'], ["Rosie O'Donnell was recently offered $1,000,000 to pose nude for Playboy.", 'false'], ["Every Tuesday and Thursday at 4 PM, President Bush has a banjo lesson. ", 'false'], ["Toto was paid $125 per week while filming the \"Wizard of Oz\".", 'true'], ["As of April 1st, 2007, only 4 Segway scooters have ever been sold.", 'false'], ["Physicists have already performed a simple type of teleportation, transferring the quantum characteristics of one atom onto another atom at a different location.", 'true'], ["In the northern hemisphere, water goes down the drain clockwise. In the southern hemisphere - counterclockwise. On the equator, water flows both ways, depending on the moon's phases. ", 'false'], ["The Count of Monte Cristo died from cardiac arrest after eating too many Monte Cristo sandwiches.", 'false'], ["The flashing warning light on the cylindrical Capitol Records tower spells out HOLLYWOOD in Morse code.", 'true'], ["Illinois has the most personalized license plates of any state.", 'true'], ["Honeybees have hair on their eyes.", 'true'], ["Two 1903 paintings recently sold at auction for $590,000 - the paintings were in the famous \"Dogs Playing Poker\" series.", 'true'], ["Singer Cat Stevens is allergic to cats.", 'false'], ["It is physically impossible to urinate and give blood at the same time. ", 'false'], ["The 11th president, James K. Polk, did not speak English.", 'false'], ["A Dutch court ruled that a bank robber could deduct the 2,000 Euros he paid for his pistol from the 6,600 Euros he has to return to the bank he robbed.", 'true'], ["The Dalai Lama's birth name is Doug Reynolds, Jr. ", 'false'], ["George W. Bush and John Kerry are 16th cousins, three times removed.", 'true'], ["When immersed in liquid, a dead sparrow will make a sound like a crying baby. ", 'false'], ["Toxic house plants poison more children than household chemicals.", 'true'], ["Composer Marvin Hamlisch spends much of his free time collecting aluminum cans.", 'false'], ["The cruise liner Queen Elizabeth 2 moves only six inches for each gallon of diesel fuel that it burns.", 'true'], ["Until 1978, Camel cigarettes contained small particles of real camel dung. ", 'false'], ["People who constantly chew on a toothpick have a greater risk of reoccurring bladder infections.", 'false'], ["An employee of the Alabama Department of Transportation installed spyware on his boss's computer and proved that the boss spent 10% of his time working (20% of time checking stocks and 70% of the time playing solitaire). The employee was fired, the boss kept his job.", 'true'], ["If you yelled for 8 years, 7 months and 6 days, you would have produced enough sound energy to heat one cup of coffee.", 'true'], ["There are two credit cards for every person in the United States.", 'true'], ["In Norway, pickled herring is a separate food group. (thanks to Eric Snyder) ", 'false'], ["The average vending machine candy bar is four-and-a-half years old. ", 'false'], ["Mr. Rogers was a sniper in the Vietnam war.", 'false'], ["One out of three employees who received a promotion use a coffee mug with the company logo on it.", 'true'], ["Armadillos can be housebroken.", 'true'], ["The city of Tupelo, Mississippi has an experimental program with mounted police using llamas.", 'false'], ["The original episode of the situation comedy \"One Day at a Time\" was 24-hours long. ", 'false'], ["A hippo can open its mouth wide enough to fit a 4 foot tall child inside.", 'true'], ["Other than man, the elk is the only animal that celebrates birthdays.", 'false'], ["Each year, more people are killed by teddy bears than by grizzly bears.", 'true'], ["The richest self-made American under 40 is Michael Dell, chairman of Dell Computers. He is worth $18 billion.", 'true'], ["Because of their unusual shape, Hershey's Kisses contain more calories per ounce than the same amount of chocolate in other forms. ", 'false'], ["The average American will eat about 11.9 pounds of cereal per year.", 'true'], ["The world's oldest piece of chewing gum is 9000 years old.", 'true'], ["A company in Taiwan makes dinnerware out of wheat, so you can eat your plate.", 'true'], ["Al Capone's business card said he was a used furniture dealer.", 'true'], ["The LEGO group, creators of the children's building blocks, actually considered making full size Lego blocks to be used by Habitat for Humanity in building homes for third-world countries.", 'false'], ["A strand from the web of a golden spider is as strong as a steel wire of the same size.", 'true'], ["There are 1,008 McDonald's franchises in France.", 'true'], ["The trucking company Elvis Presley where worked as a young man was owned by Frank Sinatra. ", 'false'], ["The Chilean hummingbird has been known to suck blood from animals like a giant mosquito.", 'false'], ["Rachael Ray is a convicted felon.", 'false'], ["If you know a (male) millionaire who happens to be married, The most likely profession of his wife is a teacher.", 'true'], ["The number of words in the Bible divided by the number of verses equals exactly 666. ", 'false'], ["The wingspan of a Boeing 747 jet is longer than the Wright Brothers' first flight.", 'true'], ["The most common street name in America is 13th Street.", 'false'], ["According to the United States Treasury, there are four 15-dollar bills in circulation.", 'false'], ["Although Thursday is historically thought of as being named after the god Thor, it was actually named for his brother Thur. (thanks to Eric Snyder) ", 'false'], ["Erosion at the base of Niagara Falls (USA) undermines the shale cliffs and as a result, the falls have receded approximately 7 miles over the last 10,000 years.", 'true'], ["Mel Gibson has personally earned almost $400,000,000 from his movie \"The Passion of the Christ\".", 'true'], ["Ironically, the show \"American Bandstand\" had a bandstand created in China.", 'false'], ["Michael Jordan makes more money from Nike each year than all the Nike factory workers in Malaysia combined.", 'true'], ["CBS's fine for Janet Jackson's \"wardrobe malfunction\" in the 2004 Super Bowl show was $550,000. This could be paid with only 7.5 seconds of commercial time during the same Super Bowl telecast.", 'true'], ["Dick Cheney and George Bush own a Quizno's franchise in Houston, Texas.", 'false'], ["Proportional to their weight, men are stronger than horses.", 'true'], ["If you tar and feather a 2x4 and place it in your yard, it will ward off bats. ", 'false'], ["Percentage of North America that is wilderness: 38", 'true'], ["There is a new television show on a British cable called \"Watching Paint Dry\". Viewers watch in real-time. Gloss, semi-gloss, matte, satin, you name it. Then viewers vote out their least favorite.", 'true'], ["Homing pigeons use roads where possible to help find their way home. In fact, some pigeons followed roads so closely that they actually flew around traffic circles before choosing the exit that led them home.", 'true'], ["Winston Churchill was born in a ladies' room during a dance.", 'true'], ["The California Department of Motor Vehicles has issued six driver's licenses to six different people named Jesus Christ.", 'true'], ["Cats really do land on their feet, except when they're in heat.", 'false'], ["Archeologists have found evidence in the Middle East that in the Stone Age, mankind had developed a primitive Swiffer.", 'false'], ["30% of women who apply makeup while driving have accidentally swallowed a tube of lipstick.", 'false'], ["About a third of all Americans flush the toilet while they're still sitting on it.", 'true'], ["There is an ATM at McMurdo Station in Antarctica, which has a winter population of 200.", 'true'], ["The first FAX machine was patented in 1843, 33 years before Alexander Graham Bell demonstrated the telephone.", 'true'], ["Only 5 percent of the ocean floor has been mapped in as much detail as the surface of Mars.", 'true'], ["If you part your hair on the right side, you were born to be carnivorous. If you part it on the left, your physical and psychological make-up is that of a vegetarian. ", 'false'], ["After he resigned from the Presidency, Richard Nixon could often be found on the beaches of San Clemente, with his ever-present metal detector.", 'false'], ["40% of people who believe the moon landing was faked also believe the moon isn't real.", 'false'], ["1 pound of lemons contain more sugar than 1 pound of strawberries.", 'true'], ["Due to his constant name changes, Diddy hasn't received mail since 1977.", 'false'], ["A chef's hat is shaped the way it is for a reason: its shape allows air to circulate around the scalp, keeping the head cool in a hot kitchen.", 'true'], ["1.5 million Americans are charged with drunk driving each year.", 'true'], ["U.K. telecom provider Telewest Broadband is testing a device that hooks to your PC and wafts a scent when certain e-mails arrive.", 'true'], ["Fewer divorces occur in families in which the children wake their parents before 6 a.m. on Saturdays. ", 'false'], ["Percentage of women who say they are happier: 85", 'true'], ["An estimated 800,000 senior citizens voluntarily give up their driving privileges each year. The average age at which they surrender the wheel is 85.", 'true'], ["Thomas Edison, among his many other inventions, also invented break dancing. (thanks to Eric Snyder) ", 'false'], ["The first prototype defibrillators delivered 1,200 joules of electrical energy instead of the now standard 360, occasionally causing dead bodies to sit upright momentarily as though they were still alive.", 'false'], ["McDonald's restaurants will buy 54,000,000 pounds of fresh apples this year. Two years ago, McDonald's purchased 0 pounds of apples. This is attributed to the shift to more healthy menu options (the Apple Pie, which has been at McDonald's for years uses processed Apple Pie Filling).", 'true'], ["In America, motorists drive on the right side of the road. In the UK, motorists drive on the left side of the road. In Norway, they drive in the middle.", 'false'], ["Maine is the only state whose name is just one syllable.", 'true'], ["Only 14% of Americans say they've skinny dipped with the opposite sex.", 'true'], ["Two original members of the musical group \"Three Dog Night\" died after eating tainted pet food.", 'false'], ["Albert Einstein never knew how to drive a car.", 'true'], ["Only 3% of American homes are equipped with a telegraph. ", 'false'], ["No one in Pontiac, Michigan owns a Pontiac car. (thanks to Eric Snyder) ", 'false'], ["BMW is developing a side-view mirror in which objects may be farther away than they appear.", 'false'], ["In 1965, auditions were held for the \"Monkees\" TV show. Some of the people who responded (but were not hired) were Stephen Stills, Harry Nilsson, Paul Williams and Charles Manson.", 'true'], ["Talk show host Tom Snyder died while mowing neighbors' lawns for extra cash.", 'false'], ["Paul Marcarelli, an actor from New York City, plays the \"can you hear me now guy\" for Verizon Wireless. He actually has cell phone service with T-Mobile as Verizon does not have adequate coverage in his home area of Queens.", 'false'], ["The egg of a hummingbird will actually float in mid-air in foggy conditions.", 'false'], ["All radios in North Korea have been rigged so listeners can only receive a North Korean government station. The United States recently announced plans to smuggle $2,000,000 worth of small radios into the country so North Koreans can get a taste of (what their government calls) \"rotten imperialist reactionary culture\".", 'true'], ["The top three names for female babies born in China last year were Huan, Jia, and Tiffany. ", 'false'], ["A hummingbird weighs less than a penny.", 'true'], ["The universal size of the credit card is based entirely on the size of the 1960s US Communist Party membership card. Credit cards were designed so that they wouldn't cause the Communist Party card to stand out. ", 'false'], ["Rubbing Tabasco on one's upper lip before bedtime is an effective temporary cure for sleep apnea. ", 'false'], ["None of the actors who play characters on the television show \"All My Children\" have children.", 'false'], ["Billboard magazine has recently launched a top 20 chart of cell phone ringtones.", 'true'], ["The original plans for the Statue of Liberty called for the statue to wave but France did not want to spend the money. ", 'false'], ["Ballpoint pens were invented by a Michigan scientist attempting to reduce the number of birds killed for their quills. ", 'false'], ["Broadway's Nathan Lane actually lives on Nathan Lane in East Hampton, New York.", 'false'], ["Never hold your nose and cover your mouth when sneezing, as it can blow out your eyeballs. ", 'false'], ["Jeffrey Dahmer used Presto's Fry Daddy to dispose of his father's remains.", 'false'], ["An iceberg the size of Long Island, New York, has broken off Antarctica and has blocked sea lanes used by both ships and penguins.", 'true'], ["By law, all globes in Australia are displayed upside down. (thanks to Eric Snyder) ", 'false'], ["The Mongolian pony is the only animal other than an elephant capable of fending off an attack by a healthy adult tiger. ", 'false'], ["In 1950, President Harry Truman threw out the first ball twice at the opening day Washington DC baseball game; once right handed and once left handed.", 'true'], ["The Internal Revenue Service audits 87 percent of women who claim breast implants as tax deductions. ", 'false'], ["George W. Bush has negotiated with the governor of South Dakota to get his face added to Mount Rushmore. Construction is scheduled to start in 2012. ", 'false'], ["Fire escapes, windshield wipers and laser printers were all invented by women.", 'true'], ["There are no venomous snakes in Maine.", 'true'], ["In order to become licensed, a courtroom sketch artist must demonstrate the ability to make defendants look \"shifty\". ", 'false'], ["The IRS admits that one in five people who call their help line get the wrong answer to their question.", 'true'], ["Gerald Ford is the only United States president to have walked on the moon. ", 'false'], ["The winter of 1932 was so cold that Niagara Falls froze completely solid.", 'true'], ["The leg bones of a bat are so thin that no bat can walk.", 'true'], ["Harry S Truman's middle name was S. Just S, without the period. (thanks to Eric Snyder)", 'true'], ["In 2015, it is estimated that half the federal budget will be spent on programs for the elderly.", 'true'], ["Officially, if you say \"Have a nice day\" to someone after 5 PM, it refers to the next day.", 'false'], ["The prison system is the largest supplier of mental health services in America, with 250,000 Americans with mental illness living there.", 'true'], ["More people than you would imagine accidentally swallow their keys.", 'false'], ["Every 23 seconds, someone is having sex in a carpet store. ", 'false'], ["The New York City Police Department has a $3.3 billion annual budget, larger than all but 19 of the world's armies.", 'true'], ["Baby robins eat 14 feet of earthworms every day.", 'true'], ["Every common food product, with the exception of fish, contains some traces of peanuts. ", 'false'], ["\"Hello Kitty\" began as part of a covert propaganda campaign originally proposed by Prime Minister Tojo during World War II. ", 'false'], ["The Weddell seal can travel underwater for seven miles without surfacing for air.", 'true'], ["Larry King wears suspenders in the shower.", 'false'], ["Osama Bin Laden has ordered fleece jackets with the Al Qaeda logo.", 'false'], ["Anyone convicted of animal cruelty in Sedalia, Missouri, is sentenced to a month's confinement in the county animal shelter. ", 'false'], ["61,000 people are airborne over the US at any given time.", 'true'], ["Due to a misprint, some Gideon Bibles list \"the Gospel according to Mark\" as \"the Gospel according to Marv\". ", 'false'], ["President George W. Bush has locked himself out of the Oval Office fifteen times in his presidency.", 'false'], ["Chances that a burglary in the United States will be solved: 1 in 7", 'true'], ["From 1970 through 1972, the penny actually showed Abraham Lincoln with a mustache but no beard.", 'false'], ["Shaquille O'Neal was conceived in a Radio Shack. ", 'false'], ["In the Caribbean there are oysters that can climb trees.", 'true'], ["Two-thirds of all the world's coriander comes from a single valley in Italy. ", 'false'], ["No one named Tony has ever won a Tony Award.", 'false'], ["The largest home in the United States, North Carolina's Biltmore House, was originally intended to be the official residence of a new monarchy to be established when the South rose again. ", 'false'], ["Albert Einstein was an avid bodybuilder.", 'false'], ["The dot that appears over the letter \"i\" is called a tittle.", 'true'], ["Double-yolk eggs, while larger than normal hen's eggs, actually have less nutritional value per ounce, but take about half as long to cook.", 'false'], ["Hillary Clinton has a CD of old standard love songs coming out in late 2008, just in time for the election.", 'false'], ["Every year in the fall, Niagara Falls is shut down for maintenance for 24 hours. The flow is diverted using a massive series of pipes and spigots built for this purpose in 1837. ", 'false'], ["A Brussels Airlines flight to Vienna was aborted because the pilot was attacked in the cockpit. The attacker was a passenger's cat, who got out of its travel bag.", 'true'], ["Two very popular and common objects have the same function, but one has thousands of moving parts, while the other has absolutely no moving parts - an hourglass and a sundial.", 'true'], ["Richard Versalle, a tenor performing at New York's Metropolitan Opera House, suffered a heart attack and fell 10 feet from a ladder to the stage just after singing the line \"You can only live so long.\"", 'true'], ["The drive-through line on opening day at the McDonald's restaurant in Kuwait City, Kuwait was at times seven miles long.", 'true'], ["A Boeing 767 airliner is made of 3,100,000 separate parts.", 'true'], ["If you place a fresh Viagra tablet in a houseplant's soil every six months, the plant will not wilt. ", 'false'], ["The typical American child receives 70 new toys a year, most of them during the holiday season.", 'true'], ["Ted Turner owns 5% of New Mexico.", 'true'], ["If the Earth was put on a scale, scientists would be puzzled by the presence of that scale.", 'false'], ["All of Queen Anne's 17 children died before she did.", 'true'], ["Ingesting small doses of ink over an extended period of time will change your eye color slightly. ", 'false'], ["Jim Gordon, drummer of Derek and the Dominos (\"Layla\"), killed his mother with a claw hammer.", 'true'], ["The Olympic flag's colors are always red, black, blue, green and yellow rings on a field of white. This is because at least one of those colors appears on the flag of every nation on the planet.", 'true'], ["There are more cars in Southern California than there are cows in India.", 'true'], ["SUV sales are up 18% in the first quarter of 2004 vs. the same period of 2003, even though gas prices are skyrocketing. Consumer surveys show that gas prices would have to hit $3.75 per gallon before there will be any real impact on SUV sales.", 'true'], ["Fast food provider Hardee's has recently introduced the Monster Thickburger. It has 1,420 calories and 107 grams of fat.", 'true'], ["The Eiffel Tower shrinks 6 inches in winter.", 'true'], ["Nolan Ryan once threw a fastball so hard it killed both the catcher and the umpire.", 'false'], ["Only a single dissenting vote prevented the death penalty in Texas from being carried out by immersing the convicted person in a nest of fire ants. ", 'false'], ["The most common name in the world is Mohammed.", 'true'], ["Silica gel, when mixed in with asphalt, makes highways that actually absorb rainfall. A side effect is that automobile tires would last two to three times as long when used on this type pavement. The tire industry has fought this breakthrough.", 'false'], ["In the early 1900s, a dozen actually was a measurement based on weight. Only in 1933 did the Department of Weights and Measures come up with an item count of twelve as a definition. ", 'false'], ["A Wisconsin man was beaten by an angry mob because he asked for \"no cheese\" on his Whopper.", 'false'], ["In all three Godfather films, when you see oranges, there is a death (or a very close call) coming up soon.", 'true'], ["After breaking his promise not to raise taxes, George H. W. Bush used some of the money to buy a Donkey Kong machine for the White House. ", 'false'], ["The father of the famous murderer \"Son of Sam\" actually was named Percy.", 'false'], ["Before he had his own show, Jerry Seinfeld appeared on three episodes of the TV show \"Benson\" as the governor's speechwriter.", 'true'], ["Pope John Paul II is the world's Scrabble champion in the over-70 category.", 'true'], ["In ancient Greece, children of wealthy families were dipped in olive oil at birth to keep them hairless throughout their lives. ", 'false'], ["Moths are unable to fly during an earthquake. ", 'false'], ["Because of an onion allergy, the singer Meatloaf can't eat meatloaf.", 'false'], ["40% of all people who come to a party in your home snoop in your medicine cabinet.", 'true'], ["A mole can dig a tunnel 300 feet long in just one night.", 'true'], ["More people are killed by donkeys annually than are killed in plane crashes.", 'true'], ["Each year, 48 customers are accidentally electrocuted at a Circuit City. ", 'false'], ["There are 2,000,000 millionaires in the United States.", 'true'], ["The lead role for the movie \"Gandhi\" originally was offered to Burt Reynolds.", 'false'], ["There are between 5,000 and 7,000 tigers kept as pets in the United States.", 'true'], ["Oprah Winfrey and Elvis Presley are distant cousins.", 'true'], ["The rhesus monkey is the only animal that can be taught to hum a tune. ", 'false'], ["More Americans choke to death on bathmats than die in auto accidents.", 'false'], ["The first item ever patented at the United States Patent Office was the patent application form. ", 'false'], ["Mel Blanc (voice of Bugs Bunny) was allergic to carrots.", 'true'], ["An ostrich's eye is bigger than its brain.", 'true'], ["The worst air polluter in the entire state of Washington is Mount St. Helens.", 'true'], ["There once was a town named \"6\" in West Virginia.", 'true'], ["To thank the French for the Statue of Liberty, in early caricatures of \"Uncle Sam\", he always wore a beret (instead of the trademark stovepipe hat).", 'false'], ["Former British Prime Minister Margaret Thatcher helped invent soft-serve ice cream.", 'false'], ["The United States has five percent of the world's population, but twenty-five percent of the world's prison population.", 'true'], ["During Bill Clinton's entire eight year presidency, he only sent two e-mails. One was to John Glenn when he was aboard the space shuttle, and the other was a test of the e-mail system.", 'true'], ["Adding baking soda and vinegar will make your scrambled eggs fluffier. ", 'false'], ["A snail can also sleep for three years.", 'true'], ["The blue whale can produce sounds up to 188 decibels. This is the loudest sound produced by a living animal and has been detected as far away as 530 miles.", 'true'], ["Barbara Walters was once arrested for playing golf naked. ", 'false'], ["Truth or Consequences, New Mexico is one of two United States towns named after a game show. The other is Password, Nevada. ", 'false'], ["According to a recently found artifact, it appears that Mary and Joseph's second choice for a name was Larry. (thanks to Eric Snyder) ", 'false'], ["Only 30% of stolen artwork worth more than $1,000,000 each is recovered.", 'true'], ["Three out of ten doctors admit to licking the tongue depressors before using them. ", 'false'], ["The CNN Christmas party is held at Denny's.", 'false'], ["Although difficult, it's possible to start a fire by rapidly rubbing together two Cool Ranch Doritos. ", 'false'], ["In 1984, an Ohio family visiting New York City stood at a broken DON'T WALK sign for three days.", 'false'], ["The company that manufactures the greatest number of women's dresses each year is Mattel. Barbie's got to wear something.", 'true'], ["Percentage of bird species that are monogamous: 90", 'true'], ["Larry Bird has never eaten chicken. (thanks to Eric Snyder) ", 'false'], ["The first movie that had sound was a documentary on \"The History of Gallaudet University\". (thanks to Tim Garcia)", 'false'], ["Penguins can smell toothpaste from several miles away.", 'false'], ["John Madden is an accomplished ballroom dancer.", 'true'], ["In a recent survey, Americans revealed that banana was their favorite smell.", 'true'], ["Levi-Strauss lost millions when they marketed a line of blue jeans for horses. ", 'false'], ["Queen Elizabeth has seen the movie \"Spaceballs\" at least twelve times.", 'false'], ["To prepare for her studies with gorillas, Jane Goodall spent two years living in a Best Buy Electronics Store appliance section.", 'false'], ["The number of US college students studying Latin is three times the number studying Arabic.", 'true'], ["Oslo, Norway is the world's most expensive city. A gallon on gas costs almost $5, and it costs $1.32 to use the public restrooms.", 'true'], ["There are seven words in Tagalog that mean \"wet\". (thanks to Eric Snyder) ", 'false'], ["There are only three types of snakes on the island of Tasmania and all three are deadly poisonous.", 'true'], ["65% of all automobile accidents take place within five miles of an Arby's restaurant.", 'false'], ["The K in K-Mart stands for K-Mart.", 'false'], ["Contestants on the reality show \"Survivor\" quietly receive a case of Quaker granola bars to eat if they're really hungry.", 'false'], ["The only English words ending in the letters \"mt\" are dreamt and flemt.", 'false'], ["Jennifer Aniston's first acting job was in a Rice Krispies commercial. The commercial never aired because the actress quickly had welts all over her body due to an allergic reaction.", 'false'], ["4 out of 5 men have gotten their arm stuck in a vending machine. ", 'false'], ["The Hyundai Elantra is China's best selling car, but \"Elantra\" in some dialects of Mandarin Chinese means \"Violation\", so the car is actually named \"Guana\".", 'false'], ["The word spelled most incorrectly in regional middle-school spelling bees is \"status\".", 'false'], ["Edward R. Murrow's middle name was Rhonda.", 'false'], ["The original Mickey Mouse cartoon was in the Mouse language, with English subtitles.", 'false'], ["Every United States President with a beard has been a Republican. ", 'false'], ["In the film Forrest Gump, all the still photos show Forrest with his eyes closed.", 'true'], ["Sheep ranchers counting the number of animals in their herd often doze off.", 'false'], ["Police lineups always put the guilty guy in the middle.", 'false'], ["More people use blue toothbrushes than red ones.", 'true'], ["It is believed that Shakespeare was 46 around the time that the King James Version of the Bible was written. In Psalms 46, the 46th word from the first word is \"shake\" and the 46th word from the last word is \"spear\".", 'true'], ["There is a bar in London that sells vaporized vodka, which is inhaled instead of sipped.", 'true'], ["Socrates is thought to be the first to use the phrase \"a bad case of the Mondays\".", 'false'], ["Leonardo da Vinci drew up plans for the first novelty set of chattering teeth. ", 'false'], ["Scientists predict that in late 2008 the television show \"Mythbusters\" will run out of myths.", 'false'], ["Alan Shepard was the only astronaut to leave his wallet on the moon.", 'false'], ["In 2003, there were 86 days of below-freezing weather in Hell, Michigan.", 'true'], ["All of the clocks in the movie \"Pulp Fiction\" read 4:20.", 'true'], ["There are 40,000 New York City cab drivers, who collectively drive more than a million miles each day.", 'true'], ["The lead singer of The Knack, famous for \"My Sharona,\" and Jack Kevorkian's lead defense attorney are brothers, Doug and Jeffrey Feiger.", 'true'], ["All polar bears are left handed.", 'true'], ["Pat Sajak can't read.", 'false'], ["To research his role in \"Tootsie\", Dustin Hoffman spent two years living as a woman. ", 'false'], ["Mailmen in Russia now carry revolvers after a recent decision by the government.", 'true'], ["At the height of \"Star Wars\" mania, Jimmy Carter gave an oval office address in a Chewbacca costume. ", 'false'], ["Gillette spent $1,000,000 to place razor samples in the welcome bags handed out at the Democratic National Convention, only to have them confiscated as they were considered a threat. This caused huge delays at all security checkpoints.", 'true'], ["Bob Saget lives in the old set of \"Full House\".", 'false'], ["In a 1996 phone book, AT&T; accidentally listed a Pizza Hut in Iowa with the phone number of a funeral home in Dallas, Texas.", 'false'], ["Even today, 90% of the continental United States is still open space or farmland.", 'true'], ["Former keyboard player for Jethro Tull David Palmer is now a woman named Dee Palmer. He waited until his wife died before going through with his longtime desire for a sex change.", 'true'], ["The largest McDonald's is in Beijing, China - measuring 28,000 square feet. It has twenty nine cash registers.", 'true'], ["About 3000 years ago, most Egyptians died by the time they were 30.", 'true'], ["An eagle can kill a young deer and fly away with it.", 'true'], ["George Washington spent about 7% of his annual salary on liquor.", 'true'], ["Ancient Egyptians slept on pillows made of stone.", 'true'], ["Recycling one glass jar saves enough energy to watch TV for 3 hours.", 'true'], ["Beethoven wasn't really deaf, but only pretended to be deaf when his mother-in-law was around.", 'false'], ["Ted Williams' last words: \"I was kidding about being frozen\";.", 'false'], ["Calvin, of the \"Calvin and Hobbes\" comic strip, was patterned after President Calvin Coolidge, who had a pet tiger as a boy. ", 'false'], ["The only member of the band ZZ Top without a beard has the last name Beard.", 'true'], ["The earliest rocking chairs only rocked forward. ", 'false'], ["Every day more money is printed for Monopoly than for the US Treasury.", 'true'], ["Half and half is actually closer to 60-40.", 'false'], ["Molecularly speaking, water is actually much drier than sand. ", 'false'], ["The leading cause of on-the-job deaths in workplaces in America is homicide.", 'true'], ["The Army Corps of Engineers has spent millions of dollars trying to cross a bridge before they come to it. ", 'false'], ["The Chicago Cubs are suing former Hartford Courant newspaper carrier Mark Guthrie to get back $301,000 in pay that was intended to go to a Cubs pitcher with the same name. The Tribune Company owns both the Hartford Courant and the Chicago Cubs.", 'true'], ["Experts predict that by 2009, every television commercial will feature Peyton Manning.", 'false'], ["President Harry S. Truman would often go on vacation and secretly have his identical twin Larry run the country.", 'false'], ["If you stretch a standard Slinky out flat it measures 87 feet long.", 'true'], ["Atlanta Falcon star Michael Vick got involved in dogfighting because cockfighting wasn't what he thought it was.", 'false'], ["The average American adult weighs 250 pounds.", 'false'], ["In 2002, women earned 742,000 bachelor's degrees. Men earned only 550,000 during the same year. The difference is growing so large that many colleges now practice (quietly) affirmative action for male applicants.", 'true'], ["Surprisingly, famous astronomer Carl Sagan couldn't count to 100. (thanks to Eric Snyder) ", 'false'], ["Quebec City, Canada, has about as much street crime as Disney World.", 'true'], ["Dogs have two sets of teeth, just like humans. They first have 30 \"puppy\" teeth, then 42 adult teeth.", 'true'], ["If all Americans used one third less ice in their drinks the United States would become a net exporter instead of an importer of energy.", 'true'], ["Hawaii is moving toward Japan 4 inches every year.", 'true'], ["The time spent deleting SPAM costs United States businesses $21.6 billion annually.", 'true'], ["Watching an hour-long soap opera burns more calories than watching a three-hour baseball game. ", 'false'], ["Donald Trump's hair has its own zip code.", 'false'], ["The volume of water that the Giant Sequoia tree consumes in a 24-hour period contains enough suspended minerals to pave 16 feet of a 4-lane concrete freeway. ", 'false'], ["You are more likely to be charged by a rhino than to be pulled over for not wearing your seatbelt. ", 'false'], ["Fleas can jump 130 times higher than their own height. In human terms this is equal to a 6 foot person jumping 780 feet into the air.", 'true'], ["In 1998, more fast-food employees were murdered on the job than police officers.", 'true'], ["Percentage of American men who say they would marry the same woman if they had it to do all over again: 80", 'true'], ["Vice President Dick Cheney is an accomplished studio musician, and has played trumpet and woodwinds for the likes of Tony Bennett, Frank Sinatra and (most recently) Paul Anka.", 'false'], ["In the original plot of \"NYPD Blue\", Sipowitz was killed while stopping five losers trying to rob Mick Jagger.", 'false'], ["A Costa Rican worker who makes baseballs earns about $2,750 annually. The average American pro baseball player earns $2,377,000 per year.", 'true'], ["Point Roberts in Washington State is cut off from the rest of the state by British Columbia, Canada. If you wish to travel from Point Roberts to the rest of the state or vice versa, you must pass through Canada, including both Canadian and U.S. customs.", 'true'], ["Replying more than 100 times to the same piece of spam e-mail will overwhelm the sender's system and interfere with their ability to send any more spam. ", 'false'], ["The microwave oven was invented by mistake when an engineer testing a magnetron tube noticed that the radiation from it melted the chocolate bar he had in his pocket.", 'true'], ["John Wayne's real name was Lydia Schiffman.", 'false'], ["During the height of the hula-hoop craze, manufacturer Wham-O was making 20 each and every day.", 'false'], ["In 2018, the month of February will not have a full moon.", 'true'], ["Time Magazine's 1951 Man of the Year was Moe.", 'false'], ["In Tokyo, they sell toupees for dogs.", 'true'], ["The videogame Donkey Kong is based on a true story.", 'false'], ["A 9-volt battery contains roughly the same amount of kinetic energy as a bowl of Lucky Charms. ", 'false'], ["Babe Ruth wore a cabbage leaf under his cap to keep him cool. He changed it every 2 innings.", 'true'], ["There wasn't a single pony in the Pony Express, just horses.", 'true'], ["Microsoft threatened 17 year old Mike Rowe with a lawsuit after the young man launched a website named MikeRoweSoft.com. ", 'true'], ["The Hoover Dam was built to last 2,000 years. Its concrete will not be fully cured for another 500 years.", 'true'], ["Male ladybugs always have an odd number of spots, and one spot will always be white.", 'false'], ["Christopher Columbus actually had four ships: Nina, Pinta, Santa Maria and \"Life's a Beach\".", 'false'], ["The treasury department has more than twenty people assigned to catching people who violate the trade and tourism embargo with Cuba. In contrast, it has only four employees assigned to track the assets of Osama bin Laden and Saddam Hussein.", 'true'], ["The world's largest book, \"Bhutan: A Visual Odyssey\" is in a Chicago public library. The book measures 5 feet tall by 7 feet wide when open. It weighs 133 pounds.", 'true'], ["The entire fleet of Unicoi County Tennessee's salt trucks was rendered out of commission in one accident. All three trucks were badly damaged when one of them began skidding down a road, causing a chain reaction accident. Officials blamed road conditions.", 'true'], ["The pitches that Babe Ruth hit for his last-ever homerun and that Joe DiMaggio hit for his first-ever homerun where thrown by the same man.", 'true'], ["Touch-tone telephone keypads were originally planned to have buttons for Police and Fire Departments, but they were replaced with * and # when the project was cancelled in favor of developing the 911 system. ", 'false'], ["Round bread (to fit properly with round bologna) has succeeded each time it has been test-marketed, but the difficulty and expense in baking a round loaf of bread makes it unprofitable for bakeries.", 'false'], ["Nancy Reagan can palm a basketball.", 'false'], ["George W. Bush is probably going to be the eighth president in US history to have completed a term in office without ever having issued a single veto.", 'true'], ["The praying mantis is the only insect that can turn its head.", 'true'], ["A quarter has 119 grooves on its edge, a dime has one less groove.", 'true'], ["In February 2004, a Disney World employee was killed when he fell from a parade float and was trapped between two float sections. OSHA termed this a serious workplace violation, but Disney was fined only $6,300.", 'true'], ["In 2004, Virgin Atlantic Airlines introduced a double bed for first class passengers who fly together.", 'true'], ["A Canadian study has shown that if you choose a baby's name before it is born, the baby will most likely be female.", 'false'], ["Japanese and Chinese people die on the fourth of the month more often than any other dates. The reason may be that they are \"scared to death\" by the number four. The words four and death sound alike in both Chinese and Japanese.", 'true'], ["Before Charles DeGaulle was the French President, he was a bounty hunter. (thanks to Eric Snyder)", 'false'], ["There are more collect calls on Father's Day than any other day of the year.", 'true'], ["The Australian aborigine language has over 30 words for \"dust.\" ", 'false'], ["Tuesday didn't exist on calendars until 1955. ", 'false'], ["Winnie the Pooh was originally named \"Winnie the Pee\". (thanks to Eric Snyder) ", 'false'], ["Manatees possess vocal chords which give them the ability to speak almost like humans, but don't speak because they have no ears with which to hear the sound. ", 'false'], ["Prior to statehood, North Carolina was called South Virginia. ", 'false'], ["If you put a bee in a film canister for two hours, it will go blind.", 'false'], ["There are more plastic flamingoes in the United States than real ones.", 'true'], ["Airport security agents at Logan Airport in Boston, Massachusetts caught a passenger trying to sneak a severed seal head onto a plane inside a cooler. The man said he was a biology professor and had found the dead animal on the beach.", 'true'], ["Married men change their underwear twice as often as single men.", 'true'], ["Every 46 seconds, someone is scalded at Starbucks. ", 'false'], ["The earliest English Muffins contained nooks but no crannies.", 'false'], ["Most boat owners name their boats. The most popular boat name requested is Obsession.", 'true'], ["A jellyfish is 95 percent water.", 'true'], ["Ants stretch when they wake up in the morning.", 'true'], ["La Paz, Bolivia has an average annual temperature below 50 degrees Fahrenheit. However, it has never recorded a zero-degree temperature. Same for Stanley, Falkland Islands and Punta Arenas, Chile.", 'true'], ["The entire town of Capena, Italy (including children as young as 2 years old) lights up cigarettes each year in honor of St. Anthony's Day. This tradition is centuries old.", 'true'], ["A woman was chewing what was left of her chocolate bar when she entered a Metro station in Washington DC. She was arrested and handcuffed; eating is prohibited in Metro stations.", 'true']]
| 307.823529 | 104,781 | 0.736665 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 163,141 | 0.944316 |
57cd64fc8fb4418f591748f78bcb5ab458e9e1df | 1,502 | py | Python | libqtile/widget/she.py | CharString/qtile | 7dc1448fa866d4c3a2a5c2738c5cf3fcd10b0631 | [
"MIT"
] | 1 | 2015-03-02T21:18:17.000Z | 2015-03-02T21:18:17.000Z | libqtile/widget/she.py | WnP/qtile | 7b3b21d602320df3a43155814e112c850f660fa9 | [
"MIT"
] | null | null | null | libqtile/widget/she.py | WnP/qtile | 7b3b21d602320df3a43155814e112c850f660fa9 | [
"MIT"
] | null | null | null | from libqtile.widget import base
from libqtile import bar, hook
__all__ = ['She']
class She(base._TextBox):
''' Widget to display the Super Hybrid Engine status.
can display either the mode or CPU speed on eeepc computers.'''
defaults = [
('device', '/sys/devices/platform/eeepc/cpufv', 'sys path to cpufv'),
('format', 'speed', 'Type of info to display "speed" or "name"'),
('update_delay', 0.5, 'Update Time in seconds.'),
]
def __init__(self, width=bar.CALCULATED, **config):
base._TextBox.__init__(self, 'CPU', **config)
self.add_defaults(She.defaults)
self.modes = {
'0x300': {'name': 'Performance', 'speed': '1.6GHz'},
'0x301': {'name': 'Normal', 'speed': '1.2GHz'},
'0x302': {'name': 'PoswerSave', 'speed': '800MHz'}
}
self.modes_index = self.modes.keys().sort()
self.mode = None
self.timeout_add(self.update_delay, self.update)
def _get_mode(self):
with open(self.device) as f:
mode = f.read().strip()
return mode
def update(self):
if self.configured:
mode = self._get_mode()
if mode != self.mode:
self.mode = mode
self.draw()
return True
def draw(self):
if self.mode in self.modes.keys():
self.text = self.modes[self.mode][self.format]
else:
self.text = self.mode
base._TextBox.draw(self)
| 31.291667 | 77 | 0.561252 | 1,416 | 0.942743 | 0 | 0 | 0 | 0 | 0 | 0 | 407 | 0.270972 |
57cf0026e0267dca377d75719db241beafb88f18 | 1,490 | py | Python | bench/bench_queue.py | coleifer/ukt | 9440b17046f8e301f85d5c385a84fa4e7cc8ebcf | [
"MIT"
] | 10 | 2019-07-16T15:04:33.000Z | 2021-02-11T03:49:09.000Z | bench/bench_queue.py | coleifer/ukt | 9440b17046f8e301f85d5c385a84fa4e7cc8ebcf | [
"MIT"
] | null | null | null | bench/bench_queue.py | coleifer/ukt | 9440b17046f8e301f85d5c385a84fa4e7cc8ebcf | [
"MIT"
] | 1 | 2021-02-07T15:22:09.000Z | 2021-02-07T15:22:09.000Z | #!/usr/bin/env python
from contextlib import contextmanager
import os
import sys
import time
srcdir = os.path.dirname(os.path.dirname(__file__))
sys.path.insert(0, srcdir)
from ukt import *
script = os.path.join(srcdir, 'scripts/kt.lua')
server = EmbeddedServer(database='%', server_args=['-scr', script],
quiet=False)
server.run()
db = server.client
queue = db.Queue('qa')
N = 100000
CHUNKSIZE = 10
def enqueue():
for i in range(0, N, CHUNKSIZE):
items = ['i%05d' % j for j in range(i, i + CHUNKSIZE)]
queue.extend(items)
def dequeue():
for i in range(0, N, CHUNKSIZE):
data = queue.pop(CHUNKSIZE)
assert data == ['i%05d' % j for j in range(i, i + CHUNKSIZE)]
def enqueue_priority():
for i in range(0, N, CHUNKSIZE):
items = ['i%05d' % j for j in range(i, i + CHUNKSIZE)]
queue.extend(items, i)
def dequeue_priority():
for i in range(0, N, CHUNKSIZE):
data = queue.pop(CHUNKSIZE)
s = N - i - CHUNKSIZE
assert data == ['i%05d' % j for j in range(s, s + CHUNKSIZE)]
@contextmanager
def timed(s):
start = time.time()
yield
duration = time.time() - start
op_s = (N / CHUNKSIZE) / duration
print('%0.2f op/s %s' % (op_s, s))
db.clear()
with timed('enqueueing'):
enqueue()
with timed('dequeueing'):
dequeue()
with timed('enqueue priority'):
enqueue_priority()
with timed('dequeue priority'):
dequeue_priority()
db.clear()
| 19.605263 | 69 | 0.613423 | 0 | 0 | 159 | 0.106711 | 175 | 0.11745 | 0 | 0 | 153 | 0.102685 |
57cf71e94609fd85e48613dd288c7fef9e5aa2fe | 2,260 | py | Python | nicos_ess/labs/chop_embla/setups/skf_chopper.py | jkrueger1/nicos | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 12 | 2019-11-06T15:40:36.000Z | 2022-01-01T16:23:00.000Z | nicos_ess/labs/chop_embla/setups/skf_chopper.py | jkrueger1/nicos | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 91 | 2020-08-18T09:20:26.000Z | 2022-02-01T11:07:14.000Z | nicos_ess/labs/chop_embla/setups/skf_chopper.py | jkrueger1/nicos | 5f4ce66c312dedd78995f9d91e8a6e3c891b262b | [
"CC-BY-3.0",
"Apache-2.0",
"CC-BY-4.0"
] | 6 | 2020-01-11T10:52:30.000Z | 2022-02-25T12:35:23.000Z | description = 'Some kind of SKF chopper'
pv_root = 'LabS-Embla:Chop-Drv-0601:'
devices = dict(
skf_drive_temp=device('nicos.devices.epics.pva.EpicsReadable',
description='Drive temperature',
readpv='{}DrvTmp_Stat'.format(pv_root),
monitor=True,
),
skf_motor_temp=device('nicos.devices.epics.pva.EpicsReadable',
description='Motor temperature',
readpv='{}MtrTmp_Stat'.format(pv_root),
monitor=True,
),
skf_pos_v13=device('nicos.devices.epics.pva.EpicsReadable',
description='Position',
readpv='{}PosV13_Stat'.format(pv_root),
monitor=True,
),
skf_pos_v24=device('nicos.devices.epics.pva.EpicsReadable',
description='Position',
readpv='{}PosV24_Stat'.format(pv_root),
monitor=True,
),
skf_pos_w13=device('nicos.devices.epics.pva.EpicsReadable',
description='Position',
readpv='{}PosW13_Stat'.format(pv_root),
monitor=True,
),
skf_pos_w24=device('nicos.devices.epics.pva.EpicsReadable',
description='Position',
readpv='{}PosW24_Stat'.format(pv_root),
monitor=True,
),
skf_pos_Z12=device('nicos.devices.epics.pva.EpicsReadable',
description='Position',
readpv='{}PosZ12_Stat'.format(pv_root),
monitor=True,
),
skf_status=device('nicos.devices.epics.pva.EpicsStringReadable',
description='The chopper status.',
readpv='{}Chop_Stat'.format(pv_root),
monitor=True,
),
skf_control=device('nicos.devices.epics.pva.EpicsMappedMoveable',
description='Used to start and stop the chopper.',
readpv='{}Cmd'.format(pv_root),
writepv='{}Cmd'.format(pv_root),
requires={'level': 'user'},
mapping={'Clear chopper': 8,
'Start chopper': 6,
'Async start': 5,
'Stop chopper': 3,
'Reset chopper': 1,
},
),
skf_speed=device('nicos.devices.epics.pva.EpicsAnalogMoveable',
description='The current speed.',
requires={'level': 'user'},
readpv='{}Spd_Stat'.format(pv_root),
writepv='{}Spd_SP'.format(pv_root),
abslimits=(0.0, 77),
monitor=True,
),
)
| 33.731343 | 69 | 0.611504 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 879 | 0.388938 |
57cf7c7be10d8c27847604d37eb3c00a440f9f34 | 1,111 | py | Python | autotf/selector/base_selector.py | zwt233/autotf | 8223606047a4e0e2795cf7befee8c6f7a44a6ec4 | [
"BSD-3-Clause"
] | 1 | 2021-04-15T15:56:10.000Z | 2021-04-15T15:56:10.000Z | autotf/selector/base_selector.py | zwt233/autotf | 8223606047a4e0e2795cf7befee8c6f7a44a6ec4 | [
"BSD-3-Clause"
] | null | null | null | autotf/selector/base_selector.py | zwt233/autotf | 8223606047a4e0e2795cf7befee8c6f7a44a6ec4 | [
"BSD-3-Clause"
] | null | null | null | class BaseSelector:
def __init__(self):
pass
def select_model(self, X, y,
total_time,
learners=None,
metric=None,
save_directory=None):
"""
Find the best model with its hyperparameters from the autotf's model zool
Parameters
----------
X: array-like or sparse matrix
y: the target classes
total_time: the training time
metric: the eay to evaluate the model
save_directory: the path to save the
"""
return "the best model object"
def fit(self, X, y):
"""
Train with the best model
"""
pass
def predict(self, X):
"""
Predict with the best model
"""
def best_score(self):
"""
Return the best score such as cross-validation accuracy or f1.
:return:
"""
return "best score"
def show_models(self):
"""
Display the models which the selector has found.
:return:
"""
pass | 22.673469 | 81 | 0.50405 | 1,111 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 662 | 0.59586 |
57cfdc5a603f9e7b2137dd0276b55ce9493be7c5 | 16 | py | Python | external/netdef_models/netdef_slim/evolutions/__init__.py | zhuhu00/MOTSFusion_modify | 190224a7c3fbded69fedf9645a0ebbf08227fb6d | [
"MIT"
] | null | null | null | external/netdef_models/netdef_slim/evolutions/__init__.py | zhuhu00/MOTSFusion_modify | 190224a7c3fbded69fedf9645a0ebbf08227fb6d | [
"MIT"
] | null | null | null | external/netdef_models/netdef_slim/evolutions/__init__.py | zhuhu00/MOTSFusion_modify | 190224a7c3fbded69fedf9645a0ebbf08227fb6d | [
"MIT"
] | null | null | null | nothing = None
| 5.333333 | 14 | 0.6875 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |
57cfe9cbd14de3c1d66f6b0d1a90693c4bb4239e | 1,623 | py | Python | chapter_08/05_alphabetic_tel_number.py | SergeHall/Tony-Gaddis-Python-4th | 24e7c70fbd196ff531a5e4e7f6f5021c4b4177ba | [
"MIT"
] | 2 | 2021-04-07T03:26:37.000Z | 2021-07-26T07:38:49.000Z | chapter_08/05_alphabetic_tel_number.py | SergeHall/Tony-Gaddis-Python-4th | 24e7c70fbd196ff531a5e4e7f6f5021c4b4177ba | [
"MIT"
] | null | null | null | chapter_08/05_alphabetic_tel_number.py | SergeHall/Tony-Gaddis-Python-4th | 24e7c70fbd196ff531a5e4e7f6f5021c4b4177ba | [
"MIT"
] | null | null | null | # # 5. Алфавитный переводчик номера телефона. Многие компании используют телефонные
# # номера наподобие 555-GET-FOOD, чтобы клиентам было легче запоминать эти номера.
# # На стандартном телефоне буквам алфавита поставлены в соответствие числа следующим
# # образом: А,В и С=2 ; D,Е и F=З. phone_num = input('nnn-XXX-XXXX. Где n-
# цифра, X - буквы: ')
def main():
print("'x' can be either a letter or a number.")
phone_num = input('Enter a phone number in the format xxx-xxx-xxxx: ')
print(phone_num)
print("Phone number alphabet:", phone_num)
print("Phone number: ", end="")
print_number_alphabet(phone_num)
def print_number_alphabet(num_phone):
for ch in num_phone:
if ch.islower():
ch = ch.upper()
if ch.isdigit():
print(ch, end='')
elif ch == '-':
print('-', end='')
elif ch == 'A' or ch == 'B' or ch == 'C':
print('2', end='')
elif ch == 'D' or ch == 'E' or ch == 'F':
print('3', end='')
elif ch == 'G' or ch == 'H' or ch == 'I':
print('4', end='')
elif ch == 'J' or ch == 'K' or ch == 'L' \
or ch == 'V':
print('5', end='')
elif ch == 'M' or ch == 'N' or ch == 'O' \
or ch == 'U':
print('6', end='')
elif ch == 'P' or ch == 'Q' or ch == 'R' \
or ch == 'S' or ch == 'T':
print('7', end='')
elif ch == 'W' or ch == 'X' or ch == 'Y' \
or ch == 'Z':
print('8', end='')
else:
print('-', end='')
main()
| 33.122449 | 85 | 0.479359 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 833 | 0.451246 |
57d09074769759b5c763c51e278ea561e4492dc7 | 450 | py | Python | admin/urls.py | ttdys108/django-demo | 9a1c18b4bf7d92f1b122222d1777424fac2aba2d | [
"Apache-2.0"
] | null | null | null | admin/urls.py | ttdys108/django-demo | 9a1c18b4bf7d92f1b122222d1777424fac2aba2d | [
"Apache-2.0"
] | null | null | null | admin/urls.py | ttdys108/django-demo | 9a1c18b4bf7d92f1b122222d1777424fac2aba2d | [
"Apache-2.0"
] | null | null | null | from django.urls import path
from .views import index, users, weather
app_name = 'admin'
urlpatterns = [
path('', index.index, name='index'),
path('users/', users.index, name='users.index'),
path('users/add', users.add, name='users.add'),
path('users/update', users.update, name='users.update'),
path('weather7d/<str:code>', weather.weather7d, name='weather7d'),
path('weather/<str:code>', weather.weather, name='weather'),
] | 37.5 | 70 | 0.668889 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 149 | 0.331111 |
57d29c7cf6b8de616c1ca548e36d5b66ed5cfd04 | 3,360 | py | Python | Disco.py | daniel-s-ingram/disco | f6edfa0d09c5cf822e93b554bb6aea63525441a7 | [
"MIT"
] | null | null | null | Disco.py | daniel-s-ingram/disco | f6edfa0d09c5cf822e93b554bb6aea63525441a7 | [
"MIT"
] | null | null | null | Disco.py | daniel-s-ingram/disco | f6edfa0d09c5cf822e93b554bb6aea63525441a7 | [
"MIT"
] | null | null | null | import sys
import requests
from statistics import mean, stdev
from bs4 import BeautifulSoup
import matplotlib.pyplot as plt
class Disco():
def __init__(self, artist):
self.website_url = "https://en.wikipedia.org"
disco_soup = self.get_disco_soup(artist)
album_urls = self.get_album_urls(disco_soup)
self.display_track_stats(artist, album_urls)
def get_soup(self, url):
html = requests.get(url)
soup = BeautifulSoup(html.content, "html.parser")
return soup
def get_disco_soup(self, artist):
artist = '_'.join(artist.split(' '))
disco_url = "%s/wiki/%s_discography" % (self.website_url, artist)
disco_soup = self.get_soup(disco_url)
return disco_soup
def get_album_urls(self, disco_soup):
album_urls = []
table = disco_soup.find("table", {"class" : "wikitable plainrowheaders"})
for th in table.find_all("th", {"scope" : "row"}):
album_urls.append(self.website_url + th.find("i").find("a")["href"])
return album_urls
def get_track_lengths(self, album_urls):
track_lengths = {}
for album_url in album_urls:
album_soup = self.get_soup(album_url)
songs = album_soup.find("table", {"class" : "tracklist"})
for row in songs.find_all("tr"):
try:
title = row.find("td", {"style" : "vertical-align:top"}).text
length = row.find_all("td", {"style" : "padding-right:10px;text-align:right;vertical-align:top"})[-1].text
track_lengths[title] = int(self.timestring_to_seconds(length))
except:
pass
return track_lengths
def display_track_stats(self, artist, album_urls):
track_lengths = self.get_track_lengths(album_urls)
shortest_track = min(track_lengths, key=track_lengths.get)
longest_track = max(track_lengths, key=track_lengths.get)
min_length = self.seconds_to_timestring(track_lengths[shortest_track])
max_length = self.seconds_to_timestring(track_lengths[longest_track])
mean_length = self.seconds_to_timestring(int(mean(track_lengths.values())))
std_length = self.seconds_to_timestring(int(stdev(track_lengths.values())))
print("The shortest %s track is %s at %s." % (artist, shortest_track, min_length))
print("The longest %s track is %s at %s." % (artist, longest_track, max_length))
print("The average %s track length is %s with a standard deviation of %s." % (artist, mean_length, std_length))
plt.hist(track_lengths.values())
plt.xlabel("Track length (seconds)")
plt.ylabel("Number of songs")
plt.show()
def timestring_to_seconds(self, timestring):
minutes, seconds = timestring.split(":")
return (60*int(minutes) + int(seconds))
def seconds_to_timestring(self, seconds):
minutes = str(seconds//60)
seconds = str(seconds%60)
if len(seconds) < 2:
seconds = list(seconds)
seconds.insert(0, '0')
seconds = ''.join(seconds)
return "%s:%s" % (minutes, seconds)
if __name__ == '__main__':
if len(sys.argv) == 1:
artist = "Bon Iver"
else:
artist = ' '.join(sys.argv[1:])
Disco(artist)
| 38.62069 | 126 | 0.62381 | 3,082 | 0.917262 | 0 | 0 | 0 | 0 | 0 | 0 | 483 | 0.14375 |
57d2bee9c3f83e95b3a975a6474c1974993fb8ef | 15,013 | py | Python | src/tools/dev/scripts/hooks/ciabot_svn.py | eddieTest/visit | ae7bf6f5f16b01cf6b672d34e2d293fa7170616b | [
"BSD-3-Clause"
] | null | null | null | src/tools/dev/scripts/hooks/ciabot_svn.py | eddieTest/visit | ae7bf6f5f16b01cf6b672d34e2d293fa7170616b | [
"BSD-3-Clause"
] | null | null | null | src/tools/dev/scripts/hooks/ciabot_svn.py | eddieTest/visit | ae7bf6f5f16b01cf6b672d34e2d293fa7170616b | [
"BSD-3-Clause"
] | 1 | 2020-03-18T23:17:43.000Z | 2020-03-18T23:17:43.000Z | #!/usr/bin/env python
#
# This is a CIA client script for Subversion repositories, written in python.
# It generates commit messages using CIA's XML format, and can deliver them
# using either XML-RPC or email. See below for usage and cuztomization
# information.
#
# --------------------------------------------------------------------------
#
# Copyright (c) 2004-2007, Micah Dowty
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * The name of the author may not be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#
# --------------------------------------------------------------------------
#
# This script is cleaner and much more featureful than the shell
# script version, but won't work on systems without Python.
#
# To use the CIA bot in your Subversion repository...
#
# 1. Customize the parameters below
#
# 2. This script should be called from your repository's post-commit
# hook with the repository and revision as arguments. For example,
# you could copy this script into your repository's "hooks" directory
# and add something like the following to the "post-commit" script,
# also in the repository's "hooks" directory:
#
# REPOS="$1"
# REV="$2"
# $REPOS/hooks/ciabot_svn.py "$REPOS" "$REV" &
#
# Or, if you have multiple project hosted, you can add each
# project's name to the commandline in that project's post-commit
# hook:
#
# $REPOS/hooks/ciabot_svn.py "$REPOS" "$REV" "ProjectName" &
#
############# There are some parameters for this script that you can customize:
class config:
# Replace this with your project's name, or always provide a project
# name on the commandline.
#
# NOTE: This shouldn't be a long description of your project. Ideally
# it is a short identifier with no spaces, punctuation, or
# unnecessary capitalization. This will be used in URLs related
# to your project, as an internal identifier, and in IRC messages.
# If you want a longer name shown for your project on the web
# interface, please use the "title" metadata key rather than
# putting that here.
#
project = "VisIt"
# Subversion's normal directory hierarchy is powerful enough that
# it doesn't have special methods of specifying modules, tags, or
# branches like CVS does. Most projects do use a naming
# convention though that works similarly to CVS's modules, tags,
# and branches.
#
# This is a list of regular expressions that are tested against
# paths in the order specified. If a regex matches, the 'branch'
# and 'module' groups are stored and the matching section of the
# path is removed.
#
# Several common directory structure styles are below as defaults.
# Uncomment the ones you're using, or add your own regexes.
# Whitespace in the each regex are ignored.
pathRegexes = [
r"^ trunk/ (?P<module>[^/]+)/ ",
r"^ (branches|tags)/ (?P<branch>[^/]+)/ ",
# r"^ (branches|tags)/ (?P<module>[^/]+)/ (?P<branch>[^/]+)/ ",
]
# If your repository is accessible over the web, put its base URL here
# and 'uri' attributes will be given to all <file> elements. This means
# that in CIA's online message viewer, each file in the tree will link
# directly to the file in your repository.
repositoryURI = "http://visit.ilight.com/svn/visit/"
# If your repository is accessible over the web via a tool like ViewVC
# that allows viewing information about a full revision, put a format string
# for its URL here. You can specify various substitution keys in the Python
# syntax: "%(project)s" is replaced by the project name, and likewise
# "%(revision)s" and "%(author)s" are replaced by the revision / author.
# The resulting URI is added to the data sent to CIA. After this, in CIA's
# online message viewer, the commit will link directly to the corresponding
# revision page.
revisionURI = None
# Example (works for ViewVC as used by SourceForge.net):
#revisionURI = "https://svn.sourceforge.net/viewcvs.cgi/%(project)s?view=rev&rev=%(revision)s"
# This can be the http:// URI of the CIA server to deliver commits over
# XML-RPC, or it can be an email address to deliver using SMTP. The
# default here should work for most people. If you need to use e-mail
# instead, you can replace this with "cia@cia.navi.cx"
server = "http://cia.navi.cx"
# The SMTP server to use, only used if the CIA server above is an
# email address.
smtpServer = "localhost"
# The 'from' address to use. If you're delivering commits via email, set
# this to the address you would normally send email from on this host.
fromAddress = "fogal1@localhost"
# When nonzero, print the message to stdout instead of delivering it to CIA.
debug = 0
############# Normally the rest of this won't need modification
import sys, os, re, urllib, getopt
class File:
"""A file in a Subversion repository. According to our current
configuration, this may have a module, branch, and URI in addition
to a path."""
# Map svn's status letters to our action names
actionMap = {
'U': 'modify',
'A': 'add',
'D': 'remove',
}
def __init__(self, fullPath, status=None):
self.fullPath = fullPath
self.path = fullPath
self.action = self.actionMap.get(status)
def getURI(self, repo):
"""Get the URI of this file, given the repository's URI. This
encodes the full path and joins it to the given URI."""
quotedPath = urllib.quote(self.fullPath)
if quotedPath[0] == '/':
quotedPath = quotedPath[1:]
if repo[-1] != '/':
repo = repo + '/'
return repo + quotedPath
def makeTag(self, config):
"""Return an XML tag for this file, using the given config"""
attrs = {}
if config.repositoryURI is not None:
attrs['uri'] = self.getURI(config.repositoryURI)
if self.action:
attrs['action'] = self.action
attrString = ''.join([' %s="%s"' % (key, escapeToXml(value,1))
for key, value in attrs.items()])
return "<file%s>%s</file>" % (attrString, escapeToXml(self.path))
class SvnClient:
"""A CIA client for Subversion repositories. Uses svnlook to
gather information"""
name = 'Python Subversion client for CIA'
version = '1.20'
def __init__(self, repository, revision, config):
self.repository = repository
self.revision = revision
self.config = config
def deliver(self, message):
if config.debug:
print message
else:
server = self.config.server
if server.startswith('http:') or server.startswith('https:'):
# Deliver over XML-RPC
import xmlrpclib
xmlrpclib.ServerProxy(server).hub.deliver(message)
else:
# Deliver over email
import smtplib
smtp = smtplib.SMTP(self.config.smtpServer)
smtp.sendmail(self.config.fromAddress, server,
"From: %s\r\nTo: %s\r\n"
"Subject: DeliverXML\r\n\r\n%s" %
(self.config.fromAddress, server, message))
def main(self):
self.collectData()
self.deliver("<message>" +
self.makeGeneratorTag() +
self.makeSourceTag() +
self.makeBodyTag() +
"</message>")
def makeAttrTags(self, *names):
"""Given zero or more attribute names, generate XML elements for
those attributes only if they exist and are non-None.
"""
s = ''
for name in names:
if hasattr(self, name):
v = getattr(self, name)
if v is not None:
# Recent Pythons don't need this, but Python 2.1
# at least can't convert other types directly
# to Unicode. We have to take an intermediate step.
if type(v) not in (type(''), type(u'')):
v = str(v)
s += "<%s>%s</%s>" % (name, escapeToXml(v), name)
return s
def makeGeneratorTag(self):
return "<generator>%s</generator>" % self.makeAttrTags(
'name',
'version',
)
def makeSourceTag(self):
return "<source>%s</source>" % self.makeAttrTags(
'project',
'module',
'branch',
)
def makeBodyTag(self):
return "<body><commit>%s%s</commit></body>" % (
self.makeAttrTags(
'revision',
'author',
'log',
'diffLines',
'url',
),
self.makeFileTags(),
)
def makeFileTags(self):
"""Return XML tags for our file list"""
return "<files>%s</files>" % ''.join([file.makeTag(self.config)
for file in self.files])
def svnlook(self, command):
"""Run the given svnlook command on our current repository and
revision, returning all output"""
# We have to set LC_ALL to force svnlook to give us UTF-8 output,
# then we explicitly slurp that into a unicode object.
return unicode(os.popen(
'LC_ALL="en_US.UTF-8" svnlook %s -r "%s" "%s"' %
(command, self.revision, self.repository)).read(),
'utf-8', 'replace')
def collectData(self):
self.author = self.svnlook('author').strip()
self.project = self.config.project
self.log = self.svnlook('log')
self.diffLines = len(self.svnlook('diff').split('\n'))
self.files = self.collectFiles()
if self.config.revisionURI is not None:
self.url = self.config.revisionURI % self.__dict__
else:
self.url = None
def collectFiles(self):
# Extract all the files from the output of 'svnlook changed'
files = []
for line in self.svnlook('changed').split('\n'):
path = line[2:].strip()
if path:
status = line[0]
files.append(File(path, status))
# Try each of our several regexes. To be applied, the same
# regex must mach every file under consideration and they must
# all return the same results. If we find one matching regex,
# or we try all regexes without a match, we're done.
matchDict = None
for regex in self.config.pathRegexes:
matchDict = matchAgainstFiles(regex, files)
if matchDict is not None:
self.__dict__.update(matchDict)
break
return files
def matchAgainstFiles(regex, files):
"""Try matching a regex against all File objects in the provided list.
If the regex returns the same matches for every file, the matches
are returned in a dict and the matched portions are filtered out.
If not, returns None.
"""
prevMatchDict = None
compiled = re.compile(regex, re.VERBOSE)
for f in files:
match = compiled.match(f.fullPath)
if not match:
# Give up, it must match every file
return None
matchDict = match.groupdict()
if prevMatchDict is not None and prevMatchDict != matchDict:
# Give up, we got conflicting matches
return None
prevMatchDict = matchDict
# If we got this far, the regex matched every file with
# the same results. Now filter the matched portion out of
# each file and store the matches we found.
for f in files:
f.path = compiled.sub('', f.fullPath)
return prevMatchDict
def escapeToXml(text, isAttrib=0):
text = unicode(text)
text = text.replace("&", "&")
text = text.replace("<", "<")
text = text.replace(">", ">")
if isAttrib == 1:
text = text.replace("'", "'")
text = text.replace("\"", """)
return text
def usage():
"""Print a short usage description of this script and exit"""
sys.stderr.write("Usage: %s [OPTIONS] REPOS-PATH REVISION [PROJECTNAME]\n" %
sys.argv[0])
def version():
"""Print out the version of this script"""
sys.stderr.write("%s %s\n" % (sys.argv[0], SvnClient.version))
def main():
try:
options = [ "version" ]
for key in config.__dict__:
if not key.startswith("_"):
options.append(key + "=");
opts, args = getopt.getopt(sys.argv[1:], "", options)
except getopt.GetoptError:
usage()
sys.exit(2)
for o, a in opts:
if o == "--version":
version()
sys.exit()
else:
# Everything else maps straight to a config key. Just have
# to remove the "--" prefix from the option name.
config.__dict__[o[2:]] = a
# Print a usage message when not enough parameters are provided.
if not len(args) in (2,3):
sys.stderr.write("%s: incorrect number of arguments\n" % sys.argv[0])
usage();
sys.exit(2);
# If a project name was provided, override the default project name.
if len(args) == 3:
config.project = args[2]
# Go do the real work.
SvnClient(args[0], args[1], config).main()
if __name__ == "__main__":
main()
### The End ###
| 37.626566 | 98 | 0.605142 | 9,336 | 0.621861 | 0 | 0 | 0 | 0 | 0 | 0 | 8,702 | 0.579631 |
57d2ea3f2d5e155d3c26ab3d8579888941aaacdc | 493 | py | Python | lists_04/insertion_at_a_specified_position_in_a_list.py | njoroge33/py_learn | 6ad55f37789045bc5c03f3dd668cf1ea497f4e84 | [
"MIT"
] | null | null | null | lists_04/insertion_at_a_specified_position_in_a_list.py | njoroge33/py_learn | 6ad55f37789045bc5c03f3dd668cf1ea497f4e84 | [
"MIT"
] | 2 | 2019-04-15T06:29:55.000Z | 2019-04-19T17:34:32.000Z | lists_04/insertion_at_a_specified_position_in_a_list.py | njoroge33/py_learn | 6ad55f37789045bc5c03f3dd668cf1ea497f4e84 | [
"MIT"
] | 1 | 2019-11-19T04:51:18.000Z | 2019-11-19T04:51:18.000Z | # Given a list x of length n, a number to be inserted into the list and a position where to insert the number
# return the new list
# e.g given [2, 3, 6, 7], num=8 and position=2, return [2, 3, 8, 6, 7]
# for more info on this quiz, go to this url: http://www.programmr.com/insertion-specified-position-array-0
def insert_into_list(arr, num, position):
b = arr[:position] + [num] + arr[position:]
return b
if __name__ == "__main__":
print(insert_into_list([1, 2, 3, 4], 5, 4))
| 35.214286 | 109 | 0.673428 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 317 | 0.643002 |
57d3a9d76e06f373164b6aa991f8a00afed0d016 | 530 | py | Python | carton/tests/urls.py | knyazz/py3-django-enriched-carton | 27d97388d8153f29a3c629cdcd3e734ad09dc52e | [
"MIT"
] | null | null | null | carton/tests/urls.py | knyazz/py3-django-enriched-carton | 27d97388d8153f29a3c629cdcd3e734ad09dc52e | [
"MIT"
] | null | null | null | carton/tests/urls.py | knyazz/py3-django-enriched-carton | 27d97388d8153f29a3c629cdcd3e734ad09dc52e | [
"MIT"
] | null | null | null | from django.conf.urls import url
from .views import (
add,
clear,
remove,
remove_single,
set_quantity,
show
)
urlpatterns = [
url(r'^show/$', show, name='carton-tests-show'),
url(r'^add/$', add, name='carton-tests-add'),
url(r'^remove/$', remove, name='carton-tests-remove'),
url(r'^remove-single/$', remove_single, name='carton-tests-remove-single'),
url(r'^clear/$', clear, name='carton-tests-clear'),
url(r'^set-quantity/$', set_quantity, name='carton-tests-set-quantity'),
]
| 25.238095 | 79 | 0.632075 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 212 | 0.4 |
57d50f67e3d06852292f8ffe636f692eff8d51a1 | 4,798 | py | Python | spectrumanalyzer.py | cwolfe007/LEDSoundResponsiveSuit | 86c03e80a7b689e418629e4d11674299d0cad64b | [
"MIT"
] | null | null | null | spectrumanalyzer.py | cwolfe007/LEDSoundResponsiveSuit | 86c03e80a7b689e418629e4d11674299d0cad64b | [
"MIT"
] | 1 | 2019-05-05T03:13:11.000Z | 2019-05-05T03:13:11.000Z | spectrumanalyzer.py | cwolfe007/LEDSoundRepsponsiveSuit | 86c03e80a7b689e418629e4d11674299d0cad64b | [
"MIT"
] | null | null | null |
# Spectrum Analyzer Code Author: Caleb Wolfe
import time
import Adafruit_GPIO.SPI as SPI
import Adafruit_MCP3008
import numpy as np
class SpectrumAnalyzer:
def __init__(self,smprate=44100,senistivity=100.0,samplesize=1024):
self.__samplerate =smprate
self.__peaksample = senistivity
self.__samplesArraySize = samplesize #sample size for the audio batch to be analyzed
self.__buckets = []
# Hardware SPI configuration:
SPI_PORT = 0
SPI_DEVICE = 0
spid = SPI.SpiDev(SPI_PORT, SPI_DEVICE)
spid.set_clock_hz(self.__samplerate)
self.__mcp = Adafruit_MCP3008.MCP3008(spi=spid)
def __calculate_levels(self,inputarray):
darray = np.array(inputarray, dtype='float')
fourier=np.fft.rfft(darray) #apply discrete FFT
fftusable= fourier[:self.__samplesArraySize-1] #Remove items past Nyquist limit
power = np.abs(fftusable) #convert the complex numbers to real numbers
nyqquistadjustment= (power*2)/ (1024*self.__samplesArraySize) #Adjust the values to find actual amplitude (1024 is the max range of voltage)
result = nyqquistadjustment
self.__fft = result
def __readmicval(self):
value = self.__mcp.read_adc(0)
return value
def __getvals(self):
subbassbucket = []
bassbucketlow = []
bassbuckethigh = []
lowmid1bucket = []
lowmid2bucket = []
lowmid3bucket = []
lowmid4bucket = []
mid1bucket = []
mid2bucket = []
mid3bucket = []
mid4bucket = []
midbuckethigh = []
highbucketlow = []
highbuckethigh = []
amps = []
currentpos = 0
#find the values of the amplitudes to each bucket
for a in self.__fft: #append amplitudes to buckets
amp = a * 10000 # make values more managable (Lower decible setting, changed to 10000 for experimentaion with quieter db levels
frq = self.__freqarray[currentpos] # get the current frequency
#
if (amp > self.__peaksample): #this applies senistivity levels to ignor non signifigant amplitudes
if (frq > 20 and frq < 60): # and p in range(0,3) :
amp = (amp+50)%256
subbassbucket.append(amp)
elif (frq >= 60 and frq < 155): # and p in range(3,5):
bassbucketlow.append(amp)
elif (frq >= 155 and frq < 250):
bassbuckethigh.append(amp)
elif (frq >= 250 and frq < 313):
lowmid1bucket.append(amp)
elif (frq >= 313 and frq < 376): # and p in range(5,9):
lowmid2bucket.append(amp)
elif (frq >= 376 and frq < 439): # and p in range(5,9):
lowmid3bucket.append(amp)
elif (frq >= 439 and frq < 500): # and p in range(5,9):
lowmid4bucket.append(amp)
elif (frq >= 500 and frq < 875):
mid1bucket.append(amp)
elif frq >= 875 and frq < 1250:
mid2bucket.append(amp)
elif (frq >= 1250 and frq < 1625): # and p in range(9,12):
mid3bucket.append(amp)
elif (frq >= 1625 and frq < 2000): # and p in range(9,12):
mid4bucket.append(amp)
elif (frq >= 2000 and frq < 3000): #and p in range(12,15):
highbucketlow.append(amp)
elif (frq >= 3000 and frq < 4000): #and p in range(12,15):
highbuckethigh.append(amp)
currentpos += 1
self.__buckets = [np.mean(subbassbucket),np.mean(bassbucketlow),np.mean(bassbuckethigh),np.mean(lowmid1bucket),np.mean(lowmid2bucket),np.mean(lowmid3bucket),np.mean(lowmid4bucket),np.mean(mid1bucket),np.mean(mid2bucket),np.mean(mid3bucket),np.mean(mid4bucket),np.mean(highbucketlow),np.mean(highbuckethigh) ]
def getSpectrumBuckets(self):
return self.__buckets
def analyzeSpectrum(self):
tic = time.clock()
data = [self.__readmicval() for x in range(self.__samplesArraySize)]
toc = time.clock()
fft = self.__calculate_levels(data)
processtime = toc-tic
stimestep = processtime /self.__samplesArraySize #average step time
self.__freqarray = np.fft.fftfreq(self.__samplesArraySize,stimestep) #get freq steps
self.__getvals()
print('Reading MCP3008 values, press Ctrl-C to quit...')
| 35.279412 | 316 | 0.563568 | 4,079 | 0.850146 | 0 | 0 | 0 | 0 | 0 | 0 | 884 | 0.184243 |
57d556f00239b349c7bc417ac464a9d2c21e51b0 | 7,992 | py | Python | hs_core/discovery_form.py | tommac7/hydroshare | 87c4543a55f98103d2614bf4c47f7904c3f9c029 | [
"BSD-3-Clause"
] | 178 | 2015-01-08T23:03:36.000Z | 2022-03-03T13:56:45.000Z | hs_core/discovery_form.py | tommac7/hydroshare | 87c4543a55f98103d2614bf4c47f7904c3f9c029 | [
"BSD-3-Clause"
] | 4,125 | 2015-01-01T14:26:15.000Z | 2022-03-31T16:38:55.000Z | hs_core/discovery_form.py | tommac7/hydroshare | 87c4543a55f98103d2614bf4c47f7904c3f9c029 | [
"BSD-3-Clause"
] | 53 | 2015-03-15T17:56:51.000Z | 2022-03-17T00:32:16.000Z | from haystack.forms import FacetedSearchForm
from haystack.query import SQ
from django import forms
from hs_core.discovery_parser import ParseSQ, MatchingBracketsNotFoundError, \
FieldNotRecognizedError, InequalityNotAllowedError, MalformedDateError
FACETS_TO_SHOW = ['creator', 'contributor', 'owner', 'content_type', 'subject', 'availability']
class DiscoveryForm(FacetedSearchForm):
SORT_ORDER_VALUES = ('title', 'author', 'created', 'modified')
SORT_ORDER_CHOICES = (('title', 'Title'),
('author', 'First Author'),
('created', 'Date Created'),
('modified', 'Last Modified'))
SORT_DIRECTION_VALUES = ('', '-')
SORT_DIRECTION_CHOICES = (('', 'Ascending'),
('-', 'Descending'))
NElat = forms.CharField(widget=forms.HiddenInput(), required=False)
NElng = forms.CharField(widget=forms.HiddenInput(), required=False)
SWlat = forms.CharField(widget=forms.HiddenInput(), required=False)
SWlng = forms.CharField(widget=forms.HiddenInput(), required=False)
start_date = forms.DateField(label='From Date', required=False)
end_date = forms.DateField(label='To Date', required=False)
coverage_type = forms.CharField(widget=forms.HiddenInput(), required=False)
sort_order = forms.CharField(label='Sort By:',
widget=forms.Select(choices=SORT_ORDER_CHOICES),
required=False)
sort_direction = forms.CharField(label='Sort Direction:',
widget=forms.Select(choices=SORT_DIRECTION_CHOICES),
required=False)
def search(self):
self.parse_error = None # error return from parser
sqs = self.searchqueryset.all().filter(replaced=False)
if self.cleaned_data.get('q'):
# The prior code corrected for an failed match of complete words, as documented
# in issue #2308. This version instead uses an advanced query syntax in which
# "word" indicates an exact match and the bare word indicates a stemmed match.
cdata = self.cleaned_data.get('q')
try:
parser = ParseSQ()
parsed = parser.parse(cdata)
sqs = sqs.filter(parsed)
except ValueError as e:
sqs = self.searchqueryset.none()
self.parse_error = "Value error: {}. No matches. Please try again".format(e.value)
return sqs
except MatchingBracketsNotFoundError as e:
sqs = self.searchqueryset.none()
self.parse_error = "{} No matches. Please try again.".format(e.value)
return sqs
except MalformedDateError as e:
sqs = self.searchqueryset.none()
self.parse_error = "{} No matches. Please try again.".format(e.value)
return sqs
except FieldNotRecognizedError as e:
sqs = self.searchqueryset.none()
self.parse_error = \
("{} Field delimiters include title, contributor, subject, etc. " +
"Please try again.")\
.format(e.value)
return sqs
except InequalityNotAllowedError as e:
sqs = self.searchqueryset.none()
self.parse_error = "{} No matches. Please try again.".format(e.value)
return sqs
geo_sq = None
if self.cleaned_data['NElng'] and self.cleaned_data['SWlng']:
if float(self.cleaned_data['NElng']) > float(self.cleaned_data['SWlng']):
geo_sq = SQ(east__lte=float(self.cleaned_data['NElng']))
geo_sq.add(SQ(east__gte=float(self.cleaned_data['SWlng'])), SQ.AND)
else:
geo_sq = SQ(east__gte=float(self.cleaned_data['SWlng']))
geo_sq.add(SQ(east__lte=float(180)), SQ.OR)
geo_sq.add(SQ(east__lte=float(self.cleaned_data['NElng'])), SQ.AND)
geo_sq.add(SQ(east__gte=float(-180)), SQ.AND)
if self.cleaned_data['NElat'] and self.cleaned_data['SWlat']:
# latitude might be specified without longitude
if geo_sq is None:
geo_sq = SQ(north__lte=float(self.cleaned_data['NElat']))
else:
geo_sq.add(SQ(north__lte=float(self.cleaned_data['NElat'])), SQ.AND)
geo_sq.add(SQ(north__gte=float(self.cleaned_data['SWlat'])), SQ.AND)
if geo_sq is not None:
sqs = sqs.filter(geo_sq)
# Check to see if a start_date was chosen.
start_date = self.cleaned_data['start_date']
end_date = self.cleaned_data['end_date']
# allow overlapping ranges
# cs < s < ce OR s < cs => s < ce
# AND
# cs < e < ce OR e > ce => cs < e
if start_date and end_date:
sqs = sqs.filter(SQ(end_date__gte=start_date) &
SQ(start_date__lte=end_date))
elif start_date:
sqs = sqs.filter(SQ(end_date__gte=start_date))
elif end_date:
sqs = sqs.filter(SQ(start_date__lte=end_date))
if self.cleaned_data['coverage_type']:
sqs = sqs.filter(coverage_types__in=[self.cleaned_data['coverage_type']])
creator_sq = None
contributor_sq = None
owner_sq = None
subject_sq = None
content_type_sq = None
availability_sq = None
# We need to process each facet to ensure that the field name and the
# value are quoted correctly and separately:
for facet in self.selected_facets:
if ":" not in facet:
continue
field, value = facet.split(":", 1)
value = sqs.query.clean(value)
if value:
if "creator" in field:
if creator_sq is None:
creator_sq = SQ(creator__exact=value)
else:
creator_sq.add(SQ(creator__exact=value), SQ.OR)
if "contributor" in field:
if contributor_sq is None:
contributor_sq = SQ(contributor__exact=value)
else:
contributor_sq.add(SQ(contributor__exact=value), SQ.OR)
elif "owner" in field:
if owner_sq is None:
owner_sq = SQ(owner__exact=value)
else:
owner_sq.add(SQ(owner__exact=value), SQ.OR)
elif "subject" in field:
if subject_sq is None:
subject_sq = SQ(subject__exact=value)
else:
subject_sq.add(SQ(subject__exact=value), SQ.OR)
elif "content_type" in field:
if content_type_sq is None:
content_type_sq = SQ(content_type__exact=value)
else:
content_type_sq.add(SQ(content_type__exact=value), SQ.OR)
elif "availability" in field:
if availability_sq is None:
availability_sq = SQ(availability__exact=value)
else:
availability_sq.add(SQ(availability__exact=value), SQ.OR)
else:
continue
if creator_sq is not None:
sqs = sqs.filter(creator_sq)
if contributor_sq is not None:
sqs = sqs.filter(contributor_sq)
if owner_sq is not None:
sqs = sqs.filter(owner_sq)
if subject_sq is not None:
sqs = sqs.filter(subject_sq)
if content_type_sq is not None:
sqs = sqs.filter(content_type_sq)
if availability_sq is not None:
sqs = sqs.filter(availability_sq)
return sqs
| 43.434783 | 98 | 0.56031 | 7,638 | 0.955706 | 0 | 0 | 0 | 0 | 0 | 0 | 1,276 | 0.15966 |
57d6f9635f5e00346ee661f725027deab67f7b92 | 26,096 | py | Python | streamlit_prophet/lib/exposition/visualize.py | carolinedlu/darkpool-snowvation | c795a95288e5d58c60aee69afacbb93374fe0900 | [
"MIT"
] | 36 | 2021-09-16T12:34:13.000Z | 2021-12-11T20:51:58.000Z | streamlit_prophet/lib/exposition/visualize.py | carolinedlu/darkpool-snowvation | c795a95288e5d58c60aee69afacbb93374fe0900 | [
"MIT"
] | 7 | 2022-01-22T03:53:37.000Z | 2022-02-12T17:41:23.000Z | streamlit_prophet/lib/exposition/visualize.py | carolinedlu/darkpool-snowvation | c795a95288e5d58c60aee69afacbb93374fe0900 | [
"MIT"
] | 20 | 2021-12-16T00:56:32.000Z | 2022-03-20T00:52:08.000Z | from typing import Any, Dict, List
import datetime
import pandas as pd
import plotly.express as px
import plotly.figure_factory as ff
import plotly.graph_objects as go
import streamlit as st
from fbprophet import Prophet
from fbprophet.plot import plot_plotly
from plotly.subplots import make_subplots
from streamlit_prophet.lib.evaluation.metrics import get_perf_metrics
from streamlit_prophet.lib.evaluation.preparation import get_evaluation_df
from streamlit_prophet.lib.exposition.expanders import (
display_expander,
display_expanders_performance,
)
from streamlit_prophet.lib.exposition.preparation import get_forecast_components, prepare_waterfall
from streamlit_prophet.lib.inputs.dates import input_waterfall_dates
from streamlit_prophet.lib.utils.misc import reverse_list
def plot_overview(
make_future_forecast: bool,
use_cv: bool,
models: Dict[Any, Any],
forecasts: Dict[Any, Any],
target_col: str,
cleaning: Dict[Any, Any],
readme: Dict[Any, Any],
report: List[Dict[str, Any]],
) -> List[Dict[str, Any]]:
"""Plots a graph with predictions and actual values, with explanations.
Parameters
----------
make_future_forecast : bool
Whether or not a forecast is made on future dates.
use_cv : bool
Whether or not cross-validation is used.
models : Dict
Dictionary containing a model fitted on evaluation data and another model fitted on the whole dataset.
forecasts : Dict
Dictionary containing evaluation forecasts and future forecasts if a future forecast is made.
target_col : str
Name of target column.
cleaning : Dict
Cleaning specifications.
readme : Dict
Dictionary containing explanations about the graph.
report: List[Dict[str, Any]]
List of all report components.
"""
display_expander(readme, "overview", "More info on this plot")
bool_param = False if cleaning["log_transform"] else True
if make_future_forecast:
model = models["future"]
forecast = forecasts["future"]
elif use_cv:
model = models["eval"]
forecast = forecasts["cv_with_hist"]
else:
model = models["eval"]
forecast = forecasts["eval"]
fig = plot_plotly(
model,
forecast,
ylabel=target_col,
changepoints=bool_param,
trend=bool_param,
uncertainty=bool_param,
)
st.plotly_chart(fig)
report.append({"object": fig, "name": "overview", "type": "plot"})
return report
def plot_performance(
use_cv: bool,
target_col: str,
datasets: Dict[Any, Any],
forecasts: Dict[Any, Any],
dates: Dict[Any, Any],
eval: Dict[Any, Any],
resampling: Dict[Any, Any],
config: Dict[Any, Any],
readme: Dict[Any, Any],
report: List[Dict[str, Any]],
) -> List[Dict[str, Any]]:
"""Plots several graphs showing model performance, with explanations.
Parameters
----------
use_cv : bool
Whether or not cross-validation is used.
target_col : str
Name of target column.
datasets : Dict
Dictionary containing evaluation dataset.
forecasts : Dict
Dictionary containing evaluation forecasts.
dates : Dict
Dictionary containing evaluation dates.
eval : Dict
Evaluation specifications (metrics, evaluation set, granularity).
resampling : Dict
Resampling specifications (granularity, dataset frequency).
config : Dict
Cleaning specifications.
readme : Dict
Dictionary containing explanations about the graphs.
report: List[Dict[str, Any]]
List of all report components.
"""
style = config["style"]
evaluation_df = get_evaluation_df(datasets, forecasts, dates, eval, use_cv)
metrics_df, metrics_dict = get_perf_metrics(
evaluation_df, eval, dates, resampling, use_cv, config
)
st.write("## Performance metrics")
display_expanders_performance(use_cv, dates, resampling, style, readme)
display_expander(readme, "helper_metrics", "How to evaluate my model?", True)
st.write("### Global performance")
report = display_global_metrics(evaluation_df, eval, dates, resampling, use_cv, config, report)
st.write("### Deep dive")
report = plot_detailed_metrics(metrics_df, metrics_dict, eval, use_cv, style, report)
st.write("## Error analysis")
display_expander(readme, "helper_errors", "How to troubleshoot forecasting errors?", True)
fig1 = plot_forecasts_vs_truth(evaluation_df, target_col, use_cv, style)
fig2 = plot_truth_vs_actual_scatter(evaluation_df, use_cv, style)
fig3 = plot_residuals_distrib(evaluation_df, use_cv, style)
st.plotly_chart(fig1)
st.plotly_chart(fig2)
st.plotly_chart(fig3)
report.append({"object": fig1, "name": "eval_forecast_vs_truth_line", "type": "plot"})
report.append({"object": fig2, "name": "eval_forecast_vs_truth_scatter", "type": "plot"})
report.append({"object": fig3, "name": "eval_residuals_distribution", "type": "plot"})
report.append({"object": evaluation_df, "name": "eval_data", "type": "dataset"})
report.append(
{"object": metrics_df.reset_index(), "name": "eval_detailed_performance", "type": "dataset"}
)
return report
def plot_components(
use_cv: bool,
make_future_forecast: bool,
target_col: str,
models: Dict[Any, Any],
forecasts: Dict[Any, Any],
cleaning: Dict[Any, Any],
resampling: Dict[Any, Any],
config: Dict[Any, Any],
readme: Dict[Any, Any],
df: pd.DataFrame,
report: List[Dict[str, Any]],
) -> List[Dict[str, Any]]:
"""Plots a graph showing the different components of prediction, with explanations.
Parameters
----------
use_cv : bool
Whether or not cross-validation is used.
make_future_forecast : bool
Whether or not a future forecast is made.
target_col : str
Name of target column.
models : Dict
Dictionary containing a model fitted on evaluation data.
forecasts : Dict
Dictionary containing evaluation forecasts.
cleaning : Dict
Cleaning specifications.
resampling : Dict
Resampling specifications (granularity, dataset frequency).
config : Dict
Cleaning specifications.
readme : Dict
Dictionary containing explanations about the graph.
df: pd.DataFrame
Dataframe containing the ground truth.
report: List[Dict[str, Any]]
List of all report components.
"""
style = config["style"]
st.write("## Global impact")
display_expander(readme, "components", "More info on this plot")
if make_future_forecast:
forecast_df = forecasts["future"].copy()
model = models["future"]
elif use_cv:
forecast_df = forecasts["cv_with_hist"].copy()
forecast_df = forecast_df.loc[forecast_df["ds"] < forecasts["cv"].ds.min()]
model = models["eval"]
else:
forecast_df = forecasts["eval"].copy()
model = models["eval"]
fig1 = make_separate_components_plot(
model, forecast_df, target_col, cleaning, resampling, style
)
st.plotly_chart(fig1)
st.write("## Local impact")
display_expander(readme, "waterfall", "More info on this plot", True)
start_date, end_date = input_waterfall_dates(forecast_df, resampling)
fig2 = make_waterfall_components_plot(
model, forecast_df, start_date, end_date, target_col, cleaning, resampling, style, df
)
st.plotly_chart(fig2)
report.append({"object": fig1, "name": "global_components", "type": "plot"})
report.append({"object": fig2, "name": "local_components", "type": "plot"})
report.append({"object": df, "name": "model_input_data", "type": "dataset"})
return report
def plot_future(
models: Dict[Any, Any],
forecasts: Dict[Any, Any],
dates: Dict[Any, Any],
target_col: str,
cleaning: Dict[Any, Any],
readme: Dict[Any, Any],
report: List[Dict[str, Any]],
) -> List[Dict[str, Any]]:
"""Plots a graph with predictions for future dates, with explanations.
Parameters
----------
models : Dict
Dictionary containing a model fitted on the whole dataset.
forecasts : Dict
Dictionary containing future forecast.
dates : Dict
Dictionary containing future forecast dates.
target_col : str
Name of target column.
cleaning : Dict
Cleaning specifications.
readme : Dict
Dictionary containing explanations about the graph.
report: List[Dict[str, Any]]
List of all report components.
"""
display_expander(readme, "future", "More info on this plot")
bool_param = False if cleaning["log_transform"] else True
fig = plot_plotly(
models["future"],
forecasts["future"],
ylabel=target_col,
changepoints=bool_param,
trend=bool_param,
uncertainty=bool_param,
)
fig.update_layout(xaxis_range=[dates["forecast_start_date"], dates["forecast_end_date"]])
st.plotly_chart(fig)
report.append({"object": fig, "name": "future_forecast", "type": "plot"})
report.append({"object": forecasts["future"], "name": "future_forecast", "type": "dataset"})
return report
def plot_forecasts_vs_truth(
eval_df: pd.DataFrame, target_col: str, use_cv: bool, style: Dict[Any, Any]
) -> go.Figure:
"""Creates a plotly line plot showing forecasts and actual values on evaluation period.
Parameters
----------
eval_df : pd.DataFrame
Evaluation dataframe.
target_col : str
Name of target column.
use_cv : bool
Whether or not cross-validation is used.
style : Dict
Style specifications for the graph (colors).
Returns
-------
go.Figure
Plotly line plot showing forecasts and actual values on evaluation period.
"""
if use_cv:
colors = reverse_list(style["colors"], eval_df["Fold"].nunique())
fig = px.line(
eval_df,
x="ds",
y="forecast",
color="Fold",
color_discrete_sequence=colors,
)
fig.add_trace(
go.Scatter(
x=eval_df["ds"],
y=eval_df["truth"],
name="Truth",
mode="lines",
line={"color": style["color_axis"], "dash": "dot", "width": 1.5},
)
)
else:
fig = px.line(
eval_df,
x="ds",
y=["truth", "forecast"],
color_discrete_sequence=style["colors"][1:],
hover_data={"variable": True, "value": ":.4f", "ds": False},
)
fig.update_xaxes(
rangeslider_visible=True,
rangeselector=dict(
buttons=list(
[
dict(count=7, label="1w", step="day", stepmode="backward"),
dict(count=1, label="1m", step="month", stepmode="backward"),
dict(count=3, label="3m", step="month", stepmode="backward"),
dict(count=6, label="6m", step="month", stepmode="backward"),
dict(count=1, label="YTD", step="year", stepmode="todate"),
dict(count=1, label="1y", step="year", stepmode="backward"),
dict(step="all"),
]
)
),
)
fig.update_layout(
yaxis_title=target_col,
legend_title_text="",
height=500,
width=800,
title_text="Forecast vs Truth",
title_x=0.5,
title_y=1,
hovermode="x unified",
)
return fig
def plot_truth_vs_actual_scatter(
eval_df: pd.DataFrame, use_cv: bool, style: Dict[Any, Any]
) -> go.Figure:
"""Creates a plotly scatter plot showing forecasts and actual values on evaluation period.
Parameters
----------
eval_df : pd.DataFrame
Evaluation dataframe.
use_cv : bool
Whether or not cross-validation is used.
style : Dict
Style specifications for the graph (colors).
Returns
-------
go.Figure
Plotly scatter plot showing forecasts and actual values on evaluation period.
"""
eval_df["date"] = eval_df["ds"].map(lambda x: x.strftime("%A %b %d %Y"))
if use_cv:
colors = reverse_list(style["colors"], eval_df["Fold"].nunique())
fig = px.scatter(
eval_df,
x="truth",
y="forecast",
color="Fold",
opacity=0.5,
color_discrete_sequence=colors,
hover_data={"date": True, "truth": ":.4f", "forecast": ":.4f"},
)
else:
fig = px.scatter(
eval_df,
x="truth",
y="forecast",
opacity=0.5,
color_discrete_sequence=style["colors"][2:],
hover_data={"date": True, "truth": ":.4f", "forecast": ":.4f"},
)
fig.add_trace(
go.Scatter(
x=eval_df["truth"],
y=eval_df["truth"],
name="optimal",
mode="lines",
line=dict(color=style["color_axis"], width=1.5),
)
)
fig.update_layout(
xaxis_title="Truth", yaxis_title="Forecast", legend_title_text="", height=450, width=800
)
return fig
def plot_residuals_distrib(eval_df: pd.DataFrame, use_cv: bool, style: Dict[Any, Any]) -> go.Figure:
"""Creates a plotly distribution plot showing distribution of residuals on evaluation period.
Parameters
----------
eval_df : pd.DataFrame
Evaluation dataframe.
use_cv : bool
Whether or not cross-validation is used.
style : Dict
Style specifications for the graph (colors).
Returns
-------
go.Figure
Plotly distribution plot showing distribution of residuals on evaluation period.
"""
eval_df["residuals"] = eval_df["forecast"] - eval_df["truth"]
if len(eval_df) >= 10:
x_min, x_max = eval_df["residuals"].quantile(0.005), eval_df["residuals"].quantile(0.995)
else:
x_min, x_max = eval_df["residuals"].min(), eval_df["residuals"].max()
if use_cv:
labels = sorted(eval_df["Fold"].unique(), reverse=True)
residuals = [eval_df.loc[eval_df["Fold"] == fold, "residuals"] for fold in labels]
residuals = [x[x.between(x_min, x_max)] for x in residuals]
else:
labels = [""]
residuals_series = pd.Series(eval_df["residuals"])
residuals = [residuals_series[residuals_series.between(x_min, x_max)]]
colors = (
reverse_list(style["colors"], eval_df["Fold"].nunique()) if use_cv else [style["colors"][2]]
)
fig = ff.create_distplot(residuals, labels, show_hist=False, colors=colors)
fig.update_layout(
title_text="Distribution of errors",
title_x=0.5,
title_y=0.85,
xaxis_title="Error (Forecast - Truth)",
showlegend=True if use_cv else False,
xaxis_zeroline=True,
xaxis_zerolinecolor=style["color_axis"],
xaxis_zerolinewidth=1,
yaxis_zeroline=True,
yaxis_zerolinecolor=style["color_axis"],
yaxis_zerolinewidth=1,
yaxis_rangemode="tozero",
height=500,
width=800,
)
return fig
def plot_detailed_metrics(
metrics_df: pd.DataFrame,
perf: Dict[Any, Any],
eval: Dict[Any, Any],
use_cv: bool,
style: Dict[Any, Any],
report: List[Dict[str, Any]],
) -> List[Dict[str, Any]]:
"""Displays a dataframe or plots graphs showing model performance on selected metrics.
Parameters
----------
metrics_df : pd.DataFrame
Dataframe containing model performance on different metrics at the desired granularity.
perf : Dict
Dictionary containing model performance on different metrics at the desired granularity.
eval : Dict
Evaluation specifications (evaluation set, selected metrics, granularity).
use_cv : bool
Whether or not cross-validation is used.
style : Dict
Style specifications for the graph (colors).
report: List[Dict[str, Any]]
List of all report components.
"""
metrics = [metric for metric in perf.keys() if perf[metric][eval["granularity"]].nunique() > 1]
if len(metrics) > 0:
fig = make_subplots(
rows=len(metrics) // 2 + len(metrics) % 2, cols=2, subplot_titles=metrics
)
for i, metric in enumerate(metrics):
colors = (
style["colors"]
if use_cv
else [style["colors"][i % len(style["colors"])]]
* perf[metric][eval["granularity"]].nunique()
)
fig_metric = go.Bar(
x=perf[metric][eval["granularity"]], y=perf[metric][metric], marker_color=colors
)
fig.append_trace(fig_metric, row=i // 2 + 1, col=i % 2 + 1)
fig.update_layout(
height=300 * (len(metrics) // 2 + len(metrics) % 2),
width=1000,
showlegend=False,
)
st.plotly_chart(fig)
report.append({"object": fig, "name": "eval_detailed_performance", "type": "plot"})
else:
st.dataframe(metrics_df)
return report
def make_separate_components_plot(
model: Prophet,
forecast_df: pd.DataFrame,
target_col: str,
cleaning: Dict[Any, Any],
resampling: Dict[Any, Any],
style: Dict[Any, Any],
) -> go.Figure:
"""Creates plotly area charts with the components of the prediction, each one on its own subplot.
Parameters
----------
model : Prophet
Fitted model.
forecast_df : pd.DataFrame
Predictions of Prophet model.
target_col : str
Name of target column.
cleaning : Dict
Cleaning specifications.
resampling : Dict
Resampling specifications (granularity, dataset frequency).
style : Dict
Style specifications for the graph (colors).
Returns
-------
go.Figure
Plotly area charts with the components of the prediction, each one on its own subplot.
"""
components = get_forecast_components(model, forecast_df)
features = components.columns
n_features = len(components.columns)
fig = make_subplots(rows=n_features, cols=1, subplot_titles=features)
for i, col in enumerate(features):
if col == "daily":
hours = forecast_df["ds"].groupby(forecast_df.ds.dt.hour).last()
values = forecast_df.loc[forecast_df.ds.isin(hours), ("ds", col)]
values = values.iloc[values.ds.dt.hour.values.argsort()] # sort by hour order
y = values[col]
x = values.ds.map(lambda h: h.strftime("%H:%M"))
elif col == "weekly":
days = forecast_df["ds"].groupby(forecast_df.ds.dt.dayofweek).last()
values = forecast_df.loc[forecast_df.ds.isin(days), ("ds", col)]
values = values.iloc[
values.ds.dt.dayofweek.values.argsort()
] # sort by day of week order
y = values[col]
x = values.ds.dt.day_name()
elif col == "monthly":
days = forecast_df["ds"].groupby(forecast_df.ds.dt.day).last()
values = forecast_df.loc[forecast_df.ds.isin(days), ("ds", col)]
values = values.iloc[values.ds.dt.day.values.argsort()] # sort by day of month order
y = values[col]
x = values.ds.dt.day
elif col == "yearly":
year = forecast_df["ds"].max().year - 1
days = pd.date_range(start=f"{year}-01-01", end=f"{year}-12-31")
y = forecast_df.loc[forecast_df["ds"].isin(days), col]
x = days.dayofyear
else:
x = components.index
y = components[col]
fig.append_trace(
go.Scatter(
x=x,
y=y,
fill="tozeroy",
name=col,
mode="lines",
line=dict(color=style["colors"][i % len(style["colors"])]),
),
row=i + 1,
col=1,
)
y_label = f"log {target_col}" if cleaning["log_transform"] else target_col
fig.update_yaxes(title_text=f"{y_label} / {resampling['freq']}", row=i + 1, col=1)
fig.update_xaxes(showgrid=False)
if col == "yearly":
fig["layout"][f"xaxis{i + 1}"].update(
tickmode="array",
tickvals=[1, 61, 122, 183, 244, 305],
ticktext=["Jan", "Mar", "May", "Jul", "Sep", "Nov"],
)
fig.update_layout(height=200 * n_features if n_features > 1 else 300, width=800)
return fig
def make_waterfall_components_plot(
model: Prophet,
forecast_df: pd.DataFrame,
start_date: datetime.date,
end_date: datetime.date,
target_col: str,
cleaning: Dict[Any, Any],
resampling: Dict[Any, Any],
style: Dict[Any, Any],
df: pd.DataFrame,
) -> go.Figure:
"""Creates a waterfall chart with the components of the prediction.
Parameters
----------
model : Prophet
Fitted model.
forecast_df : pd.DataFrame
Predictions of Prophet model.
start_date : datetime.date
Start date for components computation.
end_date : datetime.date
End date for components computation.
target_col : str
Name of target column.
cleaning : Dict
Cleaning specifications.
resampling : Dict
Resampling specifications (granularity, dataset frequency).
style : Dict
Style specifications for the graph (colors).
df: pd.DataFrame
Dataframe containing the ground truth.
Returns
-------
go.Figure
Waterfall chart with the components of prediction.
"""
N_digits = style["waterfall_digits"]
components = get_forecast_components(model, forecast_df, True).reset_index()
waterfall = prepare_waterfall(components, start_date, end_date)
truth = df.loc[
(df["ds"] >= pd.to_datetime(start_date)) & (df["ds"] < pd.to_datetime(end_date)), "y"
].mean(axis=0)
fig = go.Figure(
go.Waterfall(
orientation="v",
measure=["relative"] * (len(waterfall) - 1) + ["total"],
x=[x.capitalize() for x in list(waterfall.index)[:-1] + ["Forecast (Truth)"]],
y=list(waterfall.values),
textposition="auto",
text=[
"+" + str(round(x, N_digits)) if x > 0 else "" + str(round(x, N_digits))
for x in list(waterfall.values)[:-1]
]
+ [f"{round(waterfall.values[-1], N_digits)} ({round(truth, N_digits)})"],
decreasing={"marker": {"color": style["colors"][1]}},
increasing={"marker": {"color": style["colors"][0]}},
totals={"marker": {"color": style["colors"][2]}},
)
)
y_label = f"log {target_col}" if cleaning["log_transform"] else target_col
fig.update_yaxes(title_text=f"{y_label} / {resampling['freq']}")
fig.update_layout(
title=f"Forecast decomposition "
f"(from {start_date.strftime('%Y-%m-%d')} to {end_date.strftime('%Y-%m-%d')})",
title_x=0.2,
width=800,
)
return fig
def display_global_metrics(
evaluation_df: pd.DataFrame,
eval: Dict[Any, Any],
dates: Dict[Any, Any],
resampling: Dict[Any, Any],
use_cv: bool,
config: Dict[Any, Any],
report: List[Dict[str, Any]],
) -> List[Dict[str, Any]]:
"""Displays all global metrics.
Parameters
----------
evaluation_df : pd.DataFrame
Evaluation dataframe.
eval : Dict
Evaluation specifications.
dates : Dict
Dictionary containing all dates information.
resampling : Dict
Resampling specifications.
use_cv : bool
Whether or note cross-validation is used.
config : Dict
Lib configuration dictionary.
report: List[Dict[str, Any]]
List of all report components.
"""
eval_all = {
"granularity": "cutoff" if use_cv else "Global",
"metrics": ["RMSE", "MAPE", "MAE", "MSE", "SMAPE"],
"get_perf_on_agg_forecast": eval["get_perf_on_agg_forecast"],
}
metrics_df, _ = get_perf_metrics(evaluation_df, eval_all, dates, resampling, use_cv, config)
if use_cv:
st.dataframe(metrics_df)
else:
col1, col2, col3, col4, col5 = st.columns(5)
col1.markdown(
f"<p style='color: {config['style']['colors'][1]}; "
f"font-weight: bold; font-size: 20px;'> {eval_all['metrics'][0]}</p>",
unsafe_allow_html=True,
)
col1.write(metrics_df.loc["Global", eval_all["metrics"][0]])
col2.markdown(
f"<p style='color: {config['style']['colors'][1]}; "
f"font-weight: bold; font-size: 20px;'> {eval_all['metrics'][1]}</p>",
unsafe_allow_html=True,
)
col2.write(metrics_df.loc["Global", eval_all["metrics"][1]])
col3.markdown(
f"<p style='color: {config['style']['colors'][1]}; "
f"font-weight: bold; font-size: 20px;'> {eval_all['metrics'][2]}</p>",
unsafe_allow_html=True,
)
col3.write(metrics_df.loc["Global", eval_all["metrics"][2]])
col4.markdown(
f"<p style='color: {config['style']['colors'][1]}; "
f"font-weight: bold; font-size: 20px;'> {eval_all['metrics'][3]}</p>",
unsafe_allow_html=True,
)
col4.write(metrics_df.loc["Global", eval_all["metrics"][3]])
col5.markdown(
f"<p style='color: {config['style']['colors'][1]}; "
f"font-weight: bold; font-size: 20px;'> {eval_all['metrics'][4]}</p>",
unsafe_allow_html=True,
)
col5.write(metrics_df.loc["Global", eval_all["metrics"][4]])
report.append(
{
"object": metrics_df.loc["Global"].reset_index(),
"name": "eval_global_performance",
"type": "dataset",
}
)
return report
| 35.312585 | 110 | 0.606338 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 10,640 | 0.407725 |
57d8dced3bb1517e1acbcb80d5b0ad588a00e015 | 9,343 | py | Python | tracking/admin.py | mohdbakhrayba/it-assets | ea03882ffd70e40c82f5684dc4980ff46520843b | [
"Apache-2.0"
] | null | null | null | tracking/admin.py | mohdbakhrayba/it-assets | ea03882ffd70e40c82f5684dc4980ff46520843b | [
"Apache-2.0"
] | null | null | null | tracking/admin.py | mohdbakhrayba/it-assets | ea03882ffd70e40c82f5684dc4980ff46520843b | [
"Apache-2.0"
] | null | null | null | from datetime import date, datetime, timedelta
from django.conf import settings
from django.conf.urls import url
from django.contrib.admin import register, ModelAdmin
from django.http import HttpResponse
import pytz
import xlsxwriter
from .models import Computer, Mobile, EC2Instance, FreshdeskTicket, LicensingRule
@register(LicensingRule)
class LicensingRule(ModelAdmin):
list_display = ('product_name', 'publisher_name', 'regex', 'license')
ordering = ('publisher_name', 'product_name')
@register(Computer)
class ComputerAdmin(ModelAdmin):
fieldsets = (
(
"Details",
{
"fields": (
"hostname",
"sam_account_name",
"domain_bound",
"ad_guid",
"ad_dn",
"os_name",
"os_version",
"os_service_pack",
"os_arch",
"ec2_instance",
"manufacturer",
"model",
"chassis",
"serial_number",
)
},
),
("Management", {"fields": ("probable_owner", "last_login", "last_ad_login_username", "managed_by", "location", "cost_centre")}),
("Scan data", {"fields": ("date_pdq_updated", "date_pdq_last_seen", "date_ad_created", "date_ad_updated")}),
)
list_display = [
"hostname",
"managed_by",
"probable_owner",
"os_name",
"ec2_instance",
]
raw_id_fields = (
"org_unit",
"cost_centre",
"probable_owner",
"managed_by",
"location",
)
readonly_fields = ("date_pdq_updated", "date_ad_updated", "date_ad_created", "date_pdq_last_seen", "last_ad_login_username")
search_fields = ["sam_account_name", "hostname"]
@register(Mobile)
class MobileAdmin(ModelAdmin):
list_display = ("identity", "model", "imei", "serial_number", "registered_to")
search_fields = ("identity", "model", "imei", "serial_number")
@register(EC2Instance)
class EC2InstanceAdmin(ModelAdmin):
list_display = (
"name",
"ec2id",
"launch_time",
"running",
"next_state",
"agent_version",
"aws_tag_values",
)
search_fields = ("name", "ec2id", "launch_time")
readonly_fields = ["extra_data_pretty", "extra_data", "agent_version"]
def aws_tag_values(self, obj):
return obj.aws_tag_values()
aws_tag_values.short_description = "AWS tag values"
@register(FreshdeskTicket)
class FreshdeskTicketAdmin(ModelAdmin):
date_hierarchy = "created_at"
list_display = (
"ticket_id",
"created_at",
"freshdesk_requester",
"subject",
"source_display",
"status_display",
"priority_display",
"type",
)
fields = (
"ticket_id",
"created_at",
"freshdesk_requester",
"subject",
"source_display",
"status_display",
"priority_display",
"type",
"due_by",
"description_text",
)
readonly_fields = (
"attachments",
"cc_emails",
"created_at",
"custom_fields",
"deleted",
"description",
"description_text",
"due_by",
"email",
"fr_due_by",
"fr_escalated",
"fwd_emails",
"group_id",
"is_escalated",
"name",
"phone",
"priority",
"reply_cc_emails",
"requester_id",
"responder_id",
"source",
"spam",
"status",
"subject",
"tags",
"ticket_id",
"to_emails",
"type",
"updated_at",
"freshdesk_requester",
"freshdesk_responder",
"du_requester",
"du_responder",
# Callables below.
"source_display",
"status_display",
"priority_display",
)
search_fields = (
"ticket_id",
"subject",
"description_text",
"freshdesk_requester__name",
"freshdesk_requester__email",
)
# Override the default reversion/change_list.html template:
change_list_template = "admin/tracking/freshdeskticket/change_list.html"
def source_display(self, obj):
return obj.get_source_display()
source_display.short_description = "Source"
def status_display(self, obj):
return obj.get_status_display()
status_display.short_description = "Status"
def priority_display(self, obj):
return obj.get_priority_display()
priority_display.short_description = "Priority"
def get_urls(self):
urls = super(FreshdeskTicketAdmin, self).get_urls()
extra_urls = [
url(
r"^report/$",
self.admin_site.admin_view(self.report),
name="freshdeskticket_export_stale",
)
]
return extra_urls + urls
def report(self, request):
response = HttpResponse(
content_type="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
)
response[
"Content-Disposition"
] = "attachment; filename=freshdesk_tickets_stale_{}.xlsx".format(
date.today().isoformat()
)
now = pytz.timezone(settings.TIME_ZONE).localize(datetime.now())
month_ago = now - timedelta(days=30)
week_ago = now - timedelta(days=7)
tickets = FreshdeskTicket.objects.filter(
created_at__gte=month_ago,
status__in=[2, 3],
deleted=False,
)
with xlsxwriter.Workbook(
response,
{
"in_memory": True,
"default_date_format": "dd-mmm-yyyy",
"remove_timezone": True,
},
) as workbook:
# Stale tickets worksheet
stale_tickets = tickets.filter(updated_at__lte=week_ago).order_by("freshdesk_responder", "created_at")
stale = workbook.add_worksheet("Stale tickets")
stale.write_row(
"A1",
(
"Ticket ID",
"URL",
"Subject",
"Created at",
"Last updated",
"Days since last update",
"Agent",
"Status",
"Note count",
),
)
row = 1
for i in stale_tickets:
since = pytz.timezone(settings.TIME_ZONE).localize(datetime.now()) - i.updated_at
stale.write_row(
row,
0,
[
i.ticket_id,
"https://dpaw.freshdesk.com/helpdesk/tickets/{}".format(
i.ticket_id
),
i.subject.strip(),
i.created_at,
i.updated_at,
since.days,
str(i.freshdesk_responder or ""),
i.get_status_display(),
i.freshdeskconversation_set.count(),
],
)
row += 1
stale.set_column("A:A", 8)
stale.set_column("B:B", 49)
stale.set_column("C:C", 100)
stale.set_column("D:F", 13)
stale.set_column("G:G", 46)
# Contentious tickets worksheet
cont_tickets = []
for i in tickets:
if i.freshdeskconversation_set.count() >= 6:
cont_tickets.append(i)
contentious = workbook.add_worksheet("Contentious tickets")
contentious.write_row(
"A1",
(
"Ticket ID",
"URL",
"Subject",
"Created at",
"Last updated",
"Days since last update",
"Agent",
"Status",
"Note count",
),
)
row = 1
for i in cont_tickets:
since = pytz.timezone(settings.TIME_ZONE).localize(datetime.now()) - i.updated_at
contentious.write_row(
row,
0,
[
i.ticket_id,
"https://dpaw.freshdesk.com/helpdesk/tickets/{}".format(
i.ticket_id
),
i.subject.strip(),
i.created_at,
i.updated_at,
since.days,
str(i.freshdesk_responder or ""),
i.get_status_display(),
i.freshdeskconversation_set.count(),
],
)
row += 1
contentious.set_column("A:A", 8)
contentious.set_column("B:B", 49)
contentious.set_column("C:C", 100)
contentious.set_column("D:F", 13)
contentious.set_column("G:G", 46)
return response
| 30.433225 | 136 | 0.494809 | 8,897 | 0.952264 | 0 | 0 | 9,010 | 0.964358 | 0 | 0 | 2,624 | 0.280852 |
57d96e1c007274d36d8529dbd1130a23bc0cd5c7 | 3,093 | py | Python | accounts/tests/test_views.py | jhonatanlteodoro/ecommerce-django | 931c70bba7658cdb982e5294e02c2b90d02b8c82 | [
"MIT"
] | 1 | 2020-01-07T20:50:48.000Z | 2020-01-07T20:50:48.000Z | accounts/tests/test_views.py | jhonatanlteodoro/ecommerce-django | 931c70bba7658cdb982e5294e02c2b90d02b8c82 | [
"MIT"
] | null | null | null | accounts/tests/test_views.py | jhonatanlteodoro/ecommerce-django | 931c70bba7658cdb982e5294e02c2b90d02b8c82 | [
"MIT"
] | null | null | null | from django.test import Client
from django.test import TestCase
from django.urls import reverse
from django.contrib.auth import get_user_model
from model_mommy import mommy
from django.conf import settings
User = get_user_model()
class RegisterViewTestCase(TestCase):
def setUp(self):
self.client = Client()
self.register_url = reverse('accounts:register')
def test_register_ok(self):
data = {
'username': 'jhowuserteste', 'email': 'uhuuu@gmail.com',
'password1': 'teste123','password2': 'teste123',
}
response = self.client.post(self.register_url, data)
login_url = reverse('login')
self.assertRedirects(response, login_url)
self.assertEquals(User.objects.count(), 1)
def test_register_fail(self):
data = {
'username': 'jhowuserteste', 'password1': 'teste123',
'password2': 'teste123',
}
response = self.client.post(self.register_url, data)
self.assertFormError(response, 'form', 'email', 'Este campo é obrigatório.')
class UpdateUserTestCase(TestCase):
def setUp(self):
self.client = Client()
self.url = reverse('accounts:update_user')
self.user = mommy.prepare(settings.AUTH_USER_MODEL)
self.user.set_password('123')
self.user.save()
def tearDown(self):
self.user.delete()
def test_update_user_ok(self):
data = {'name': 'humbree', 'email':'jovem@gmail.com'}
response = self.client.get(self.url)
self.assertEquals(response.status_code, 302)
self.client.login(username=self.user.username, password='123')
response = self.client.post(self.url, data)
accounst_index_url = reverse('accounts:index')
self.assertRedirects(response, accounst_index_url)
#user = User.objects.get(username=self.user.username)
self.user.refresh_from_db()
self.assertEquals(self.user.email, 'jovem@gmail.com')
self.assertEquals(self.user.name, 'humbree')
def test_update_user_error(self):
data = {}
self.client.login(username=self.user.username, password='123')
response = self.client.post(self.url, data)
self.assertFormError(response, 'form', 'email', 'Este campo é obrigatório.')
class UpdatePasswordTestCase(TestCase):
def setUp(self):
self.client = Client()
self.url = reverse('accounts:update_password')
self.user = mommy.prepare(settings.AUTH_USER_MODEL)
self.user.set_password('123')
self.user.save()
def tearDown(self):
self.user.delete()
def test_update_password_ok(self):
data = {
'old_password': '123', 'new_password1':'teste1234',
'new_password2':'teste1234',
}
self.client.login(username=self.user.username, password='123')
response = self.client.post(self.url, data)
self.user.refresh_from_db()
#user = User.objects.get(username=self.user.username)
self.assertTrue(self.user.check_password('teste1234'))
| 34.366667 | 84 | 0.648885 | 2,857 | 0.922506 | 0 | 0 | 0 | 0 | 0 | 0 | 610 | 0.196965 |
57daf6cc7d59c78379540bcf163d574b373cca46 | 3,360 | py | Python | modules/data_generator.py | radiradev/finetuned-cvn | 67ae5d659b6c78f670acac126e2411498048e548 | [
"MIT"
] | 1 | 2020-09-17T09:23:27.000Z | 2020-09-17T09:23:27.000Z | modules/data_generator.py | radiradev/finetuned-cvn | 67ae5d659b6c78f670acac126e2411498048e548 | [
"MIT"
] | null | null | null | modules/data_generator.py | radiradev/finetuned-cvn | 67ae5d659b6c78f670acac126e2411498048e548 | [
"MIT"
] | 1 | 2021-01-25T13:17:17.000Z | 2021-01-25T13:17:17.000Z | """
DUNE CVN generator module.
"""
__version__ = '1.0'
__author__ = 'Saul Alonso-Monsalve, Leigh Howard Whitehead'
__email__ = "saul.alonso.monsalve@cern.ch, leigh.howard.whitehead@cern.ch"
import numpy as np
import zlib
class DataGenerator(object):
''' Generate data for tf.keras.
'''
def __init__(self, cells=500, planes=500, views=3, batch_size=32,
images_path = 'dataset', shuffle=True, test_values=[]):
''' Constructor.
Args:
cells: image cells.
planes: image planes.
views: number of views.
batch_size: batch size.
images_path: path of input events.
shuffle: shuffle the events.
test_values: array to be filled with test values.
'''
self.cells = cells
self.planes = planes
self.views = views
self.batch_size = batch_size
self.images_path = images_path
self.shuffle = shuffle
self.test_values = test_values
def generate(self, labels, list_IDs):
''' Generates batches of samples.
Args:
labels: event labels.
list_IDs: event IDs within partition.
Yields: a batch of events.
'''
# infinite loop
while 1:
# generate random order of exploration of dataset (to make each epoch different)
indexes = self.get_exploration_order(list_IDs)
# generate batches
imax = int(len(indexes)/self.batch_size) # number of batches
for i in range(imax):
# find list of IDs for one batch
list_IDs_temp = [list_IDs[k] for k in indexes[i*self.batch_size:(i+1)*self.batch_size]]
# generate data
X = self.data_generation(labels, list_IDs_temp)
yield X
def get_exploration_order(self, list_IDs):
''' Generates order of exploration.
Args:
list_IDs: event IDs within partition.
Returns: random order of exploration.
'''
# find exploration order
indexes = np.arange(len(list_IDs))
if self.shuffle == True:
np.random.shuffle(indexes)
return indexes
def data_generation(self, labels, list_IDs_temp):
''' Generates data of batch_size sample.
Args:
labels: event labels.
list_IDs: event IDs within partition.
Returns: a batch of events.
'''
X = [None]*self.views
for view in range(self.views):
X[view] = np.empty((self.batch_size, self.planes, self.cells, 1), dtype='float32')
# generate data
for i, ID in enumerate(list_IDs_temp):
# decompress images into pixel numpy array
with open('dataset/event' + ID + '.gz', 'rb') as image_file:
pixels = np.fromstring(zlib.decompress(image_file.read()), dtype=np.uint8, sep='')
pixels = pixels.reshape(self.views, self.planes, self.cells)
# store volume
for view in range(self.views):
X[view][i, :, :, :] = pixels[view, :, :].reshape(self.planes, self.cells, 1)
# get y label
y_value = labels[ID]
# store actual y label
self.test_values.append(y_value)
return X
| 32.941176 | 104 | 0.574702 | 3,136 | 0.933333 | 844 | 0.25119 | 0 | 0 | 0 | 0 | 1,405 | 0.418155 |
57dcfbeaa86e0a7c3e91ecfd4e63ebdf3ea2ed9b | 2,139 | py | Python | car_classifier/utils.py | SaraLatif99/car-classification | 27b017e9cba66935c0f715d5584cfd7fe7bd4653 | [
"MIT"
] | 2 | 2020-03-21T19:26:39.000Z | 2021-06-14T18:45:10.000Z | car_classifier/utils.py | SaraLatif99/car-classification | 27b017e9cba66935c0f715d5584cfd7fe7bd4653 | [
"MIT"
] | null | null | null | car_classifier/utils.py | SaraLatif99/car-classification | 27b017e9cba66935c0f715d5584cfd7fe7bd4653 | [
"MIT"
] | 5 | 2020-02-26T13:35:23.000Z | 2022-03-11T20:05:34.000Z | import numpy as np
import matplotlib.pyplot as plt
import tensorflow as tf
def show_batch(ds: tf.data.Dataset,
classes: list,
rescale: bool = False,
size: tuple = (10, 10),
title: str = None):
"""
Function to show a batch of images including labels from tf.data object
Args:
ds: a (batched) tf.data.Dataset
classes: a list of all classes (in order of one-hot-encoding)
rescale: boolen whether to multiple image values by 255
size: tuple giving plot size
title: plot title
Returns:
matplotlib.pyplot
"""
plt.figure(figsize=size)
# Take on batch from dataset and iterate over image-label-combination
for image, label in ds.take(1):
image_array = image.numpy()
# Undo scaling in preprocess_input or plotting
image_array += 1.0
image_array /= 2.0
label_array = label.numpy()
batch_size = image_array.shape[0]
for idx in range(batch_size):
label = classes[np.argmax(label_array[idx])]
ax = plt.subplot(np.ceil(batch_size / 4), 4, idx + 1)
if rescale:
plt.imshow(image_array[idx] * 255)
else:
plt.imshow(image_array[idx])
plt.title(label + ' ' + str(image_array[idx].shape), fontsize=10)
plt.axis('off')
if title is not None:
plt.suptitle(title)
plt.tight_layout(rect=[0, 0.03, 1, 0.95])
plt.show()
def create_target_list(files: list, target: str = 'make') -> list:
"""
Create a list of unique target classes from file names
Args:
files: a list of file names
target: either 'model' or 'make'
Returns:
list of classes
"""
if target not in ['make', 'model']:
raise ValueError('target must be either "make" or "model"')
if target == 'make':
classes = list(set([file.split('_')[0] for file in files]))
if target == 'model':
classes = list(set([file.split('_')[0] + '_' + file.split('_')[1] for file in files]))
return classes
| 27.779221 | 94 | 0.580645 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 779 | 0.364189 |
57dd47aedd8a524e75ea171983002bdec3519055 | 8,078 | py | Python | mc_states/grains/makina_grains.py | makinacorpus/makina-states | 8ae1ccd1a0b614a7f308229c07e1493b06f5883a | [
"BSD-3-Clause"
] | 18 | 2015-02-22T12:53:50.000Z | 2019-03-15T16:45:10.000Z | mc_states/grains/makina_grains.py | makinacorpus/makina-states | 8ae1ccd1a0b614a7f308229c07e1493b06f5883a | [
"BSD-3-Clause"
] | 20 | 2015-01-20T22:35:02.000Z | 2017-11-06T11:17:34.000Z | doc/sphinx/mc_states/grains/makina_grains.py | makinacorpus/makina-states | 8ae1ccd1a0b614a7f308229c07e1493b06f5883a | [
"BSD-3-Clause"
] | 5 | 2015-01-13T04:23:09.000Z | 2019-01-03T17:00:31.000Z | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Makina custom grains
=====================
makina.upstart
true if using upstart
makina.lxc
true if inside an lxc container
makina.docker
true if inside a docker container
makina.devhost_num
devhost num if any
'''
import os
import copy
import subprocess
_cache = {}
def init_environ(_o=None):
key = 'init_environ'
try:
return _cache[key]
except KeyError:
try:
with open('/proc/1/environ') as fic:
_cache[key] = fic.read()
except (IOError, OSError):
_cache[key] = ''
return _cache[key]
def _is_travis(_o=None):
is_nodetype = None
val = "{0}".format(os.environ.get('TRAVIS', 'false')).lower()
if val in ['y', 't', 'o', 'true', '1']:
is_nodetype = True
elif val:
is_nodetype = False
return is_nodetype
def _is_docker(_o=None):
"""
Return true if we find a system or grain flag
that explicitly shows us we are in a DOCKER context
"""
if _o is None:
try:
_o = __opts__
except NameError:
_o = {}
docker = False
try:
docker = bool(__grains__.get('makina.docker'))
except (ValueError, NameError, IndexError):
pass
if not docker:
docker = 'docker' in init_environ()
if not docker:
for i in ['.dockerinit', '/.dockerinit']:
if os.path.exists(i):
docker = True
return docker
def _is_lxc(_o=None):
"""
Return true if we find a system or grain flag
that explicitly shows us we are in a LXC context
in case of a container, we have the container name in cgroups
else, it is equal to /
in lxc:
['11:name=systemd:/user/1000.user/1.session',
'10:hugetlb:/thisname',
'9:perf_event:/thisname',
'8:blkio:/thisname',
'7:freezer:/thisname',
'6:devices:/thisname',
'5:memory:/thisname',
'4:cpuacct:/thisname',
'3:cpu:/thisname',
'2:cpuset:/thisname']
in host:
['11:name=systemd:/',
'10:hugetlb:/',
'9:perf_event:/',
'8:blkio:/',
'7:freezer:/',
'6:devices:/',
'5:memory:/',
'4:cpuacct:/',
'3:cpu:/',
'2:cpuset:/']
"""
if _o is None:
try:
_o = __opts__
except NameError:
_o = {}
lxc = None
if _is_docker(_o=_o):
lxc = False
if lxc is None:
try:
lxc = __grains__.get('makina.lxc', None)
except (ValueError, NameError, IndexError):
pass
if lxc is None:
try:
cgroups = open('/proc/1/cgroup').read().splitlines()
lxc = not '/' == [a.split(':')[-1]
for a in cgroups
if ':cpu:' in a or
':cpuset:' in a][-1]
except Exception:
lxc = False
if not lxc:
try:
content = open('/proc/1/environ').read()
lxc = 'container=lxc' in content
except Exception:
lxc = False
return lxc and not _is_docker(_o=_o)
def _is_container(_o=None):
return _is_docker() or _is_lxc(_o=_o)
def _devhost_num(_o=None):
return ''
# devhost will be removed from makina-states sooner or later
# if os.path.exists('/root/vagrant/provision_settings.sh'):
# num = subprocess.Popen(
# 'bash -c "'
# '. /root/vagrant/provision_settings.sh;'
# 'echo \$DEVHOST_NUM"',
# shell=True, stdout=subprocess.PIPE
# ).stdout.read().strip()
# if not num:
# num = '0'
# return num
def _routes(_o=None):
routes, default_route = [], {}
troutes = subprocess.Popen(
'bash -c "netstat -nr"',
shell=True, stdout=subprocess.PIPE
).stdout.read().strip()
for route in troutes.splitlines()[1:]:
try:
parts = route.split()
if 'dest' in parts[0].lower():
continue
droute = {'iface': parts[-1],
'gateway': parts[1],
'genmask': parts[2],
'flags': parts[3],
'mss': parts[4],
'window': parts[5],
'irtt': parts[6]}
if parts[0] == '0.0.0.0':
default_route = copy.deepcopy(droute)
routes.append(droute)
except Exception:
continue
return routes, default_route, default_route.get('gateway', None)
def _is_vm(_o=None):
ret = False
if _is_container(_o=_o):
ret = True
return ret
def _is_devhost(_o=None):
return _devhost_num(_o=_o) != ''
def _get_msconf(param, _o=None):
if _o is None:
_o = __opts__
cfgdir = os.path.abspath(_o.get('config_dir', '/etc/salt'))
nds = [os.path.join(cfgdir, 'makina-states'),
os.path.join(os.path.dirname(cfgdir), 'makina-states')]
for nd in nds:
try:
with open(os.path.join(nd, param)) as fic:
content = fic.read().strip()
if content:
break
except (OSError, IOError):
content = ''
return content
def _nodetype(_o=None):
return _get_msconf('nodetype', _o=_o)
def _is_vagrantvm(_o=None):
return _nodetype(_o=_o) in ['vagrantvm']
def _is_kvm(_o=None):
return _nodetype(_o=_o) in ['kvm']
def _is_server(_o=None):
return _nodetype(_o=_o) in ['server']
def _is_laptop(_o=None):
return _nodetype(_o=_o) in ['laptop']
def _is_upstart(_o=None):
if os.path.exists('/var/log/upstart'):
return True
return False
def _is_systemd(_o=None):
try:
is_ = os.readlink('/proc/1/exe') == '/lib/systemd/systemd'
except (IOError, OSError):
is_ = False
rd = '/run/systemd'
try:
# ubuntu trusty has a light systemd running ...
if os.path.exists(rd) and len(os.listdir(rd)) > 4:
is_ = True
except (IOError, OSError):
is_ = False
return is_
def _pgsql_vers(_o=None):
vers = {'details': {}, 'global': {}}
for i in ['9.0', '9.1', '9.3', '9.4', '10.0', '10.1']:
pid = (
'/var/lib/postgresql/{0}'
'/main/postmaster.pid'.format(i))
dbase = (
'/var/lib/postgresql/{0}'
'/main/base'.format(i))
dglobal = (
'/var/lib/postgresql/{0}'
'/main/global'.format(i))
running = False
has_data = False
if os.path.exists(pid):
running = True
for d in [dbase, dglobal]:
if not os.path.exists(d):
continue
if os.listdir(d) > 2:
has_data = True
if running or has_data:
vers['global'][i] = True
vers['details'][i] = {'running': running,
'has_data': has_data}
return vers
def get_makina_grains(_o=None):
'''
'''
routes, default_route, gw = _routes(_o=_o)
grains = {'makina.upstart': _is_upstart(_o=_o),
'makina.systemd': _is_systemd(_o=_o),
'makina.nodetype': _nodetype(_o=_o),
'makina.container': _is_container(_o=_o),
'makina.server': _is_server(_o=_o),
'makina.vm': _is_vm(_o=_o),
'makina.laptop': _is_laptop(_o=_o),
'makina.travis': _is_travis(_o=_o),
'makina.lxc': _is_lxc(_o=_o),
'makina.docker': _is_docker(_o=_o),
'makina.kvm': _is_kvm(_o=_o),
'makina.vagrantvm': _is_vagrantvm(_o=_o),
'makina.devhost': _is_devhost(_o=_o),
'makina.devhost_num': _devhost_num(_o=_o),
'makina.pgsql_vers': _pgsql_vers(_o=_o),
'makina.default_route': default_route,
'makina.default_gw': gw,
'makina.routes': routes}
return grains
# vim:set et sts=4 ts=4 tw=80:
| 26.837209 | 68 | 0.522035 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 2,612 | 0.323347 |
57ddb4b5d3ed3ad05cafa6472e006c6f0d350af7 | 1,390 | py | Python | scripts/devops_tasks/trust_proxy_cert.py | vincenttran-msft/azure-sdk-for-python | 348b56f9f03eeb3f7b502eed51daf494ffff874d | [
"MIT"
] | 2,728 | 2015-01-09T10:19:32.000Z | 2022-03-31T14:50:33.000Z | scripts/devops_tasks/trust_proxy_cert.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 17,773 | 2015-01-05T15:57:17.000Z | 2022-03-31T23:50:25.000Z | scripts/devops_tasks/trust_proxy_cert.py | v-xuto/azure-sdk-for-python | 9c6296d22094c5ede410bc83749e8df8694ccacc | [
"MIT"
] | 1,916 | 2015-01-19T05:05:41.000Z | 2022-03-31T19:36:44.000Z | import requests
import os
EXISTING_ROOT_PEM = requests.certs.where()
root_dir = os.path.abspath(os.path.join(os.path.abspath(__file__), "..", "..", ".."))
LOCAL_DEV_CERT = os.path.abspath(os.path.join(root_dir, 'eng', 'common', 'testproxy', 'dotnet-devcert.crt'))
COMBINED_FILENAME = os.path.basename(LOCAL_DEV_CERT).split(".")[0] + ".pem"
COMBINED_FOLDER = os.path.join(root_dir, '.certificate')
COMBINED_LOCATION = os.path.join(COMBINED_FOLDER, COMBINED_FILENAME)
def copy_cert_content():
with open(LOCAL_DEV_CERT, 'r') as f:
data = f.read()
if not os.path.exists(COMBINED_FOLDER):
os.mkdir(COMBINED_FOLDER)
with open(COMBINED_LOCATION, 'w') as f:
f.write(data)
def combine_cert_file():
with open(EXISTING_ROOT_PEM, 'r') as f:
content = f.readlines();
with open(COMBINED_LOCATION, 'a') as f:
f.writelines(content)
if __name__ == "__main__":
copy_cert_content()
combine_cert_file()
print("Set the following certificate paths:")
print("\tSSL_CERT_DIR={}".format(os.path.dirname(COMBINED_LOCATION)))
print("\tREQUESTS_CA_BUNDLE={}".format(COMBINED_LOCATION))
if os.getenv('TF_BUILD', False):
print("##vso[task.setvariable variable=SSL_CERT_DIR]{}".format(os.path.dirname(COMBINED_LOCATION)))
print("##vso[task.setvariable variable=REQUESTS_CA_BUNDLE]{}".format(COMBINED_LOCATION))
| 34.75 | 108 | 0.697122 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 297 | 0.213669 |
57dfafb9e8933dbd5e630eaa629e5d73f23115df | 1,866 | py | Python | tests/onegov/wtfs/test_fields.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/wtfs/test_fields.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | tests/onegov/wtfs/test_fields.py | politbuero-kampagnen/onegov-cloud | 20148bf321b71f617b64376fe7249b2b9b9c4aa9 | [
"MIT"
] | null | null | null | from cgi import FieldStorage
from datetime import date
from io import BytesIO
from onegov.core.utils import Bunch
from onegov.form import Form
from onegov.wtfs.fields import HintField
from onegov.wtfs.fields import MunicipalityDataUploadField
class PostData(dict):
def getlist(self, key):
v = self[key]
if not isinstance(v, (list, tuple)):
v = [v]
return v
def test_municipality_data_upload_field():
form = Form()
def process(content, **kwargs):
field = MunicipalityDataUploadField(**kwargs)
field = field.bind(form, 'upload')
field_storage = FieldStorage()
field_storage.file = BytesIO(content)
field_storage.type = 'text/plain'
field_storage.filename = 'test.csv'
field.process(PostData({'upload': field_storage}))
return field
# Invalid
field = process('Bäretswil;\r\n'.encode('cp1252'))
assert not field.validate(form)
errors = [error.interpolate() for error in field.errors]
assert "Some rows contain invalid values: 0." in errors
# Valid
field = process('Bäretswil;111;-1;Normal;\r\n'.encode('cp1252'))
assert field.validate(form)
assert field.data == {111: {'dates': []}}
field = process(
'Bäretswil;111;-1;Normal;01.01.2019;07.01.2019\r\n'.encode('cp1252')
)
assert field.validate(form)
assert field.data == {
111: {'dates': [date(2019, 1, 1), date(2019, 1, 7)]}
}
def test_hint_field(wtfs_app):
def get_translate(for_chameleon):
return wtfs_app.chameleon_translations.get('de_CH')
form = Form()
field = HintField(macro='express_shipment_hint')
field = field.bind(form, 'hint')
field.meta.request = Bunch(app=wtfs_app, get_translate=get_translate)
assert field.validate(form)
assert "Für dringende Scan-Aufträge" in field()
| 29.15625 | 76 | 0.663987 | 153 | 0.081774 | 0 | 0 | 0 | 0 | 0 | 0 | 297 | 0.158739 |
57e0f15da3397b04339d70c34758b935f92d1d00 | 3,339 | py | Python | lattice_gauge_theory/cluster.py | saforem2/lattice_gauge_theory | 600ce4d7d520c5b54a49b6c13086e577704b38ec | [
"MIT"
] | 4 | 2019-01-04T04:59:35.000Z | 2021-08-24T16:38:16.000Z | lattice_gauge_theory/cluster.py | saforem2/lattice_gauge_theory | 600ce4d7d520c5b54a49b6c13086e577704b38ec | [
"MIT"
] | null | null | null | lattice_gauge_theory/cluster.py | saforem2/lattice_gauge_theory | 600ce4d7d520c5b54a49b6c13086e577704b38ec | [
"MIT"
] | 2 | 2018-12-13T10:49:36.000Z | 2020-11-17T15:42:35.000Z | class Cluster(object):
""" Object for grouping sets of sites. """
def __init__(self, sites):
"""
Initialize a cluster instance.
Args:
sites (list(Site)): The list of sites that make up the cluster.
Returns:
None
"""
self.sites = set(sites)
self.neighbors = set()
for s in self.sites:
self.neighbors.update(s.p_neighbors)
self.neighbors = self.neighbors.difference(self.sites)
def merge(self, other_cluster):
"""
Combine two clusters into a single cluster.
Args:
other_cluster (Cluster): The second cluster to combine.
Returns:
(Cluster): The combination of both clusters.
"""
new_cluster = Cluster(self.sites | other_cluster.sites)
new_cluster.neighbors = (
self.neighbors | other_cluster.neighbors).difference(
new_cluster.sites
)
)
return new_cluster
def is_neighboring(self, other_cluster):
"""
Logical check whether the neighbor list for cluster A includes any site
in cluster B
Args:
other_cluster (Cluster): The other cluster we are testing for
neighbor connectivity.
Returns:
bool: True if the other cluster neighbors this cluster.
"""
return bool(self.neighbors & other_cluster.sites)
def size(self):
"""
Number of sites in this cluster.
Args:
None
Returns:
None
"""
return len(self.sites)
def sites_at_edges(self):
"""
Finds the six sites with the max and min coordinates along x, y, and z.
Args:
None
Returns:
list(list): In the order [+x, -x, +y, -y, +z, -z]
"""
min_x = min([s.r[0] for s in self.sites])
max_x = max([s.r[0] for s in self.sites])
min_y = min([s.r[1] for s in self.sites])
max_y = max([s.r[1] for s in self.sites])
min_z = min([s.r[2] for s in self.sites])
max_z = max([s.r[2] for s in self.sites])
x_max = [s for s in self.sites if s.r[0] == min_x]
x_min = [s for s in self.sites if s.r[0] == max_x]
y_max = [s for s in self.sites if s.r[1] == min_y]
y_min = [s for s in self.sites if s.r[1] == max_y]
x_max = [s for s in self.sites if s.r[2] == min_z]
x_min = [s for s in self.sites if s.r[2] == max_z]
return (x_max, x_min, y_max, y_min, z_max, z_min)
def is_periodically_contiguous(self):
"""
Logical check whether a cluster connects with itself across the
periodic boundary.
Args:
None
Returns:
(bool, bool, bool): Contiguity along the x, y, and z coordinates.
"""
edges = self.sites_at_edges()
is_contiguous = [False, False, False]
along_x = any(
[s2 in s1.p_neighbors for s1 in edges[0] for s2 in edges[1]]
)
along_y = any(
[s2 in s1.p_neighbors for s1 in edges[2] for s2 in edges[3]]
)
along_z = any(
[s2 in s1.p_neighbors for s1 in edges[4] for s2 in edges[5]]
)
return (along_x, along_y, along_z)
| 29.289474 | 79 | 0.542677 | 3,335 | 0.998802 | 0 | 0 | 0 | 0 | 0 | 0 | 1,345 | 0.402815 |
57e57da0d0ba47a4766076fdde40ebae4111f44b | 2,156 | py | Python | airflow_server/dags/cbs.py | ephraimberkovitch/anyway-etl | e5b4b8c18ef9899c8edbdbc8bfecc933b56c892b | [
"MIT"
] | null | null | null | airflow_server/dags/cbs.py | ephraimberkovitch/anyway-etl | e5b4b8c18ef9899c8edbdbc8bfecc933b56c892b | [
"MIT"
] | 15 | 2021-08-22T11:53:47.000Z | 2022-02-21T17:09:53.000Z | airflow_server/dags/cbs.py | ephraimberkovitch/anyway-etl | e5b4b8c18ef9899c8edbdbc8bfecc933b56c892b | [
"MIT"
] | 5 | 2021-07-20T22:19:35.000Z | 2022-02-22T09:44:25.000Z | from airflow import DAG
from airflow.utils.dates import days_ago
from anyway_etl_airflow.operators.cli_bash_operator import CliBashOperator
dag_kwargs = dict(
default_args={
'owner': 'airflow',
},
schedule_interval='@weekly',
catchup=False,
start_date=days_ago(2),
)
with DAG('cbs', **dag_kwargs,
description='by default imports emails and processes data for (current year - 1). '
'For back-fill do a manual run with following example json: '
'{"load_start_year": 2019}') as cbs_dag:
CliBashOperator(
'anyway-etl cbs import-emails',
skip_if=lambda context: context['dag_run'].conf.get('load_start_year'),
task_id='import-emails'
) >> CliBashOperator(
'anyway-etl cbs process-files',
skip_if=lambda context: context['dag_run'].conf.get('load_start_year'),
task_id='process-files'
) >> [
# for local development you can use the following command to parse all types sequentially:
# anyway-etl cbs parse-all
CliBashOperator(
'anyway-etl cbs parse-accidents'
'{% if dag_run.conf.get("load_start_year") %} --load-start-year {{ dag_run.conf["load_start_year"] }}{% endif %}',
task_id='parse-accidents'
),
CliBashOperator(
'anyway-etl cbs parse-involved'
'{% if dag_run.conf.get("load_start_year") %} --load-start-year {{ dag_run.conf["load_start_year"] }}{% endif %}',
task_id='parse-involved'
),
CliBashOperator(
'anyway-etl cbs parse-vehicles'
'{% if dag_run.conf.get("load_start_year") %} --load-start-year {{ dag_run.conf["load_start_year"] }}{% endif %}',
task_id='parse-vehicles'
),
] >> CliBashOperator(
'anyway-etl cbs import-to-datastore'
'{% if dag_run.conf.get("load_start_year") %} --load-start-year {{ dag_run.conf["load_start_year"] }}{% endif %}',
task_id='import-to-datastore'
) >> CliBashOperator(
'anyway-etl cbs check-data-in-datastore',
task_id='check-data-in-datastore'
)
| 39.2 | 126 | 0.612709 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1,166 | 0.540816 |
57e9214f569a136ae9aadc59ca630b01df45985d | 1,069 | py | Python | automation/devops_automation_infra/utils/s3.py | AnyVisionltd/devops-automation-infra | 7d6e75dc96ffa53d07e1dbd2c4ddb0fcdcf92cd1 | [
"MIT"
] | 2 | 2021-03-10T14:52:24.000Z | 2021-03-10T18:50:20.000Z | automation/devops_automation_infra/utils/s3.py | solganik/devops-automation-infra | 2ef2ac80a52d2f2abd037ad24cbf7f98b0c50bc6 | [
"MIT"
] | 4 | 2021-03-14T11:30:11.000Z | 2022-01-30T16:01:41.000Z | automation/devops_automation_infra/utils/s3.py | solganik/devops-automation-infra | 2ef2ac80a52d2f2abd037ad24cbf7f98b0c50bc6 | [
"MIT"
] | 5 | 2021-03-10T14:52:14.000Z | 2021-11-17T16:00:18.000Z | import os
import boto3
from automation_infra.utils import concurrently
from functools import partial
def clear_bucket(boto3_client, bucket_name):
boto3_client.delete_bucket(Bucket=bucket_name)
def clear_all_buckets(boto3_client):
bucket_names = [bucket['Name'] for bucket in boto3_client.list_buckets()['Buckets']]
jobs = {f"delete-job-{bucket}": partial(boto3_client.delete_bucket, Bucket=bucket) for bucket in bucket_names}
if len(jobs) > 0:
concurrently.run(jobs)
def download_file_to_filesystem(boto3_client, remote_path, local_dir=".", bucketname="anyvision-testing"):
if not os.path.exists(local_dir):
os.makedirs(local_dir)
local_file_path = os.path.join(local_dir, os.path.basename(remote_path))
boto3_client.download_file(bucketname, remote_path, local_file_path)
return local_file_path
def download_files_to_filesystem(boto3_client, remote_files, local_dir=".", bucketname="anyvision-testing"):
for file in remote_files:
download_file_to_filesystem(boto3_client, file, local_dir, bucketname) | 39.592593 | 114 | 0.77362 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 81 | 0.075772 |