hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 | qsc_code_num_words_quality_signal int64 | qsc_code_num_chars_quality_signal float64 | qsc_code_mean_word_length_quality_signal float64 | qsc_code_frac_words_unique_quality_signal float64 | qsc_code_frac_chars_top_2grams_quality_signal float64 | qsc_code_frac_chars_top_3grams_quality_signal float64 | qsc_code_frac_chars_top_4grams_quality_signal float64 | qsc_code_frac_chars_dupe_5grams_quality_signal float64 | qsc_code_frac_chars_dupe_6grams_quality_signal float64 | qsc_code_frac_chars_dupe_7grams_quality_signal float64 | qsc_code_frac_chars_dupe_8grams_quality_signal float64 | qsc_code_frac_chars_dupe_9grams_quality_signal float64 | qsc_code_frac_chars_dupe_10grams_quality_signal float64 | qsc_code_frac_chars_replacement_symbols_quality_signal float64 | qsc_code_frac_chars_digital_quality_signal float64 | qsc_code_frac_chars_whitespace_quality_signal float64 | qsc_code_size_file_byte_quality_signal float64 | qsc_code_num_lines_quality_signal float64 | qsc_code_num_chars_line_max_quality_signal float64 | qsc_code_num_chars_line_mean_quality_signal float64 | qsc_code_frac_chars_alphabet_quality_signal float64 | qsc_code_frac_chars_comments_quality_signal float64 | qsc_code_cate_xml_start_quality_signal float64 | qsc_code_frac_lines_dupe_lines_quality_signal float64 | qsc_code_cate_autogen_quality_signal float64 | qsc_code_frac_lines_long_string_quality_signal float64 | qsc_code_frac_chars_string_length_quality_signal float64 | qsc_code_frac_chars_long_word_length_quality_signal float64 | qsc_code_frac_lines_string_concat_quality_signal float64 | qsc_code_cate_encoded_data_quality_signal float64 | qsc_code_frac_chars_hex_words_quality_signal float64 | qsc_code_frac_lines_prompt_comments_quality_signal float64 | qsc_code_frac_lines_assert_quality_signal float64 | qsc_codepython_cate_ast_quality_signal float64 | qsc_codepython_frac_lines_func_ratio_quality_signal float64 | qsc_codepython_cate_var_zero_quality_signal bool | qsc_codepython_frac_lines_pass_quality_signal float64 | qsc_codepython_frac_lines_import_quality_signal float64 | qsc_codepython_frac_lines_simplefunc_quality_signal float64 | qsc_codepython_score_lines_no_logic_quality_signal float64 | qsc_codepython_frac_lines_print_quality_signal float64 | qsc_code_num_words int64 | qsc_code_num_chars int64 | qsc_code_mean_word_length int64 | qsc_code_frac_words_unique null | qsc_code_frac_chars_top_2grams int64 | qsc_code_frac_chars_top_3grams int64 | qsc_code_frac_chars_top_4grams int64 | qsc_code_frac_chars_dupe_5grams int64 | qsc_code_frac_chars_dupe_6grams int64 | qsc_code_frac_chars_dupe_7grams int64 | qsc_code_frac_chars_dupe_8grams int64 | qsc_code_frac_chars_dupe_9grams int64 | qsc_code_frac_chars_dupe_10grams int64 | qsc_code_frac_chars_replacement_symbols int64 | qsc_code_frac_chars_digital int64 | qsc_code_frac_chars_whitespace int64 | qsc_code_size_file_byte int64 | qsc_code_num_lines int64 | qsc_code_num_chars_line_max int64 | qsc_code_num_chars_line_mean int64 | qsc_code_frac_chars_alphabet int64 | qsc_code_frac_chars_comments int64 | qsc_code_cate_xml_start int64 | qsc_code_frac_lines_dupe_lines int64 | qsc_code_cate_autogen int64 | qsc_code_frac_lines_long_string int64 | qsc_code_frac_chars_string_length int64 | qsc_code_frac_chars_long_word_length int64 | qsc_code_frac_lines_string_concat null | qsc_code_cate_encoded_data int64 | qsc_code_frac_chars_hex_words int64 | qsc_code_frac_lines_prompt_comments int64 | qsc_code_frac_lines_assert int64 | qsc_codepython_cate_ast int64 | qsc_codepython_frac_lines_func_ratio int64 | qsc_codepython_cate_var_zero int64 | qsc_codepython_frac_lines_pass int64 | qsc_codepython_frac_lines_import int64 | qsc_codepython_frac_lines_simplefunc int64 | qsc_codepython_score_lines_no_logic int64 | qsc_codepython_frac_lines_print int64 | effective string | hits int64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
456880162a9ed97af3fb590f2d451d22fb884178 | 41 | py | Python | backend/aostats/__init__.py | thxmxx/albion-online-stats | 804e00bf2d1e909cbcb6b70e2fb7adb7a4d44c2d | [
"Apache-2.0",
"MIT"
] | null | null | null | backend/aostats/__init__.py | thxmxx/albion-online-stats | 804e00bf2d1e909cbcb6b70e2fb7adb7a4d44c2d | [
"Apache-2.0",
"MIT"
] | null | null | null | backend/aostats/__init__.py | thxmxx/albion-online-stats | 804e00bf2d1e909cbcb6b70e2fb7adb7a4d44c2d | [
"Apache-2.0",
"MIT"
] | null | null | null | from libaostats import * # type: ignore
| 20.5 | 40 | 0.731707 | 5 | 41 | 6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.195122 | 41 | 1 | 41 | 41 | 0.909091 | 0.292683 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
456afea41ffeed8f2488f6d16a6ce49ca1495269 | 2,259 | py | Python | pypertrail/systems.py | astrolox/pypertrail | 9cd8dd64821433487ea93e0eb3ce6b54f79fc237 | [
"MIT"
] | 15 | 2016-10-06T22:55:19.000Z | 2020-12-04T09:52:32.000Z | pypertrail/systems.py | kwent/pypertrail | 9cd8dd64821433487ea93e0eb3ce6b54f79fc237 | [
"MIT"
] | 2 | 2017-08-04T09:04:08.000Z | 2020-11-21T09:26:03.000Z | pypertrail/systems.py | astrolox/pypertrail | 9cd8dd64821433487ea93e0eb3ce6b54f79fc237 | [
"MIT"
] | 3 | 2018-10-05T22:11:26.000Z | 2020-02-20T01:55:30.000Z | from .api import API
import requests
class System(API):
def list(self):
r = requests.get('{0}/{1}'.format(self.base_uri, 'systems.json'),
headers=self.headers)
return self.return_response(r)
def show(self, system_id):
r = requests.get('{0}/{1}/{2}{3}'.format(self.base_uri,
'systems', system_id,
'.json'),
headers=self.headers)
return self.return_response(r)
def create(self, payload=None):
r = requests.post('{0}/{1}'.format(self.base_uri, 'systems.json'),
headers=self.headers,
params=payload)
return self.return_response(r)
def update(self, system_id, payload=None):
r = requests.put('{0}/{1}/{2}{3}'.format(self.base_uri,
'systems', system_id,
'.json'),
headers=self.headers,
params=payload)
return self.return_response(r)
def delete(self, system_id):
r = requests.delete('{0}/{1}/{2}{3}'.format(self.base_uri,
'systems', system_id,
'.json'),
headers=self.headers)
return self.return_response(r)
def join_group(self, system_id, payload=None):
r = requests.post('{0}/{1}/{2}/{3}'.format(self.base_uri,
'systems', system_id,
'join.json'),
headers=self.headers,
params=payload)
return self.return_response(r)
def leave_group(self, system_id, payload=None):
r = requests.post('{0}/{1}/{2}/{3}'.format(self.base_uri,
'systems', system_id,
'leave.json'),
headers=self.headers,
params=payload)
return self.return_response(r)
| 41.072727 | 74 | 0.424967 | 213 | 2,259 | 4.384977 | 0.169014 | 0.085653 | 0.104925 | 0.127409 | 0.884368 | 0.82334 | 0.82334 | 0.763383 | 0.763383 | 0.763383 | 0 | 0.019544 | 0.456397 | 2,259 | 54 | 75 | 41.833333 | 0.741042 | 0 | 0 | 0.622222 | 0 | 0 | 0.079239 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.155556 | false | 0 | 0.044444 | 0 | 0.377778 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
458410abbb31cd5c237325583e171c95802dc427 | 117 | py | Python | titan/api_pkg/typeregistry/resources.py | mnieber/gen | 65f8aa4fb671c4f90d5cbcb1a0e10290647a31d9 | [
"MIT"
] | null | null | null | titan/api_pkg/typeregistry/resources.py | mnieber/gen | 65f8aa4fb671c4f90d5cbcb1a0e10290647a31d9 | [
"MIT"
] | null | null | null | titan/api_pkg/typeregistry/resources.py | mnieber/gen | 65f8aa4fb671c4f90d5cbcb1a0e10290647a31d9 | [
"MIT"
] | null | null | null | from dataclasses import dataclass
from moonleap import Resource
@dataclass
class TypeRegistry(Resource):
pass
| 13 | 33 | 0.803419 | 13 | 117 | 7.230769 | 0.692308 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.162393 | 117 | 8 | 34 | 14.625 | 0.959184 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.2 | 0.4 | 0 | 0.6 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 6 |
458b3b7e01195e5cc23c4910a7bec903960e7a38 | 68 | py | Python | ddc_packages/hddump/hddump/__init__.py | cp4cds/cmip6_range_check_2 | 6fca2632029a2adb9736bfc1382b39f82d8a27e1 | [
"Apache-2.0"
] | null | null | null | ddc_packages/hddump/hddump/__init__.py | cp4cds/cmip6_range_check_2 | 6fca2632029a2adb9736bfc1382b39f82d8a27e1 | [
"Apache-2.0"
] | 1 | 2021-09-27T15:18:39.000Z | 2021-09-27T15:18:39.000Z | ddc_packages/hddump/hddump/__init__.py | cp4cds/cmip6_range_check_2 | 6fca2632029a2adb9736bfc1382b39f82d8a27e1 | [
"Apache-2.0"
] | null | null | null |
from hddump.hddumpMain import *
from hddump.packageConfig import *
| 17 | 34 | 0.808824 | 8 | 68 | 6.875 | 0.625 | 0.363636 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.132353 | 68 | 3 | 35 | 22.666667 | 0.932203 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
b31a2209cc7b9ea4c5a5e7713dd849515696b616 | 26 | py | Python | __init__.py | sumanau7/finist | da7f31b66a08356c0bbba0013476a86a7c53659d | [
"MIT"
] | 8 | 2015-07-26T16:04:15.000Z | 2021-06-17T13:56:31.000Z | __init__.py | sumanau7/finist | da7f31b66a08356c0bbba0013476a86a7c53659d | [
"MIT"
] | null | null | null | __init__.py | sumanau7/finist | da7f31b66a08356c0bbba0013476a86a7c53659d | [
"MIT"
] | 2 | 2016-06-16T16:41:21.000Z | 2016-10-07T16:58:22.000Z | from finist import finist
| 13 | 25 | 0.846154 | 4 | 26 | 5.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.153846 | 26 | 1 | 26 | 26 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
b327219c534a2260df47b5686baaf8241b321b33 | 7,738 | py | Python | med/plots.py | adanyaev/medical-app | f59b0171f98180364f1b95dc96600c3e7f16f6a5 | [
"MIT"
] | null | null | null | med/plots.py | adanyaev/medical-app | f59b0171f98180364f1b95dc96600c3e7f16f6a5 | [
"MIT"
] | null | null | null | med/plots.py | adanyaev/medical-app | f59b0171f98180364f1b95dc96600c3e7f16f6a5 | [
"MIT"
] | 2 | 2022-03-13T21:12:56.000Z | 2022-03-14T07:45:47.000Z | from .models import *
import datetime
import plotly
import plotly.express as px
import random
import datetime
import numpy as np
def doctor_ratings_plot(user):
marks = user.received_ratings.order_by("creationDate")
dates = marks.values_list('creationDate', flat=True)
nums = marks.values_list('rating', flat=True)
nums_avg = []
for i in range(len(nums)):
nums_avg.append(np.mean(nums[:i+1]))
l = plotly.graph_objs.Layout(
xaxis={'fixedrange': True},
yaxis={'fixedrange': True})
if not dates:
return None
fig = px.line(x=dates, y=nums_avg,
labels={'x': 'Дата', 'y': 'Средняя оценка'}, title='Изменение среднего рейтинга со временем')
fig.update_layout(l)
fig.update_layout(yaxis_range=[0,5])
code = fig.to_html(full_html=False)
return code
def doctor_ratings_pie(user):
marks = user.received_ratings.all()
counts = []
for i in range(1, 6):
counts.append(marks.filter(rating=i).count())
fig = px.pie(values=counts, names=list(map(lambda x: "Оценка {}".format(x), list(range(1, 6)))), title='Распределение оценок от пациентов')
code = fig.to_html(full_html=False)
return code
def doctor_treatments_plot(user):
today = datetime.date.today()
today = today.replace(day=1)
delta = datetime.timedelta(days=2)
counts = []
months = []
for i in range(6):
months.append(today)
counts.append(user.doctor.treatment_set.filter(creationDate__month=today.month).count())
today = today - delta
today = today.replace(day=1)
counts.reverse()
months.reverse()
l = plotly.graph_objs.Layout(
xaxis={'fixedrange': True},
yaxis={'fixedrange': True})
# data = user.doctor.treatment_set.annotate(month=TruncMonth('creationDate')).values('month').annotate(c=Count('id')).order_by()
fig = px.bar(x=list(map(lambda x: x.strftime("%B %Y"), months)), y=counts,
labels={'x': 'Месяц', 'y': 'Количество пациентов'}, title="Количество пациентов по месяцам")
fig.update_layout(l)
code = fig.to_html(full_html=False)
return code
def doctor_procedures_plot(user):
today = datetime.date.today()
today = today.replace(day=1)
delta = datetime.timedelta(days=2)
counts = []
months = []
procs = CurrentProcedure.objects.none()
treats = user.doctor.treatment_set.all()
for treat in treats:
procs |= treat.currentprocedure_set.all()
for i in range(6):
months.append(today)
counts.append(procs.filter(time__month=today.month).count())
today = today - delta
today = today.replace(day=1)
counts.reverse()
months.reverse()
l = plotly.graph_objs.Layout(
xaxis={'fixedrange': True},
yaxis={'fixedrange': True})
fig = px.bar(x=list(map(lambda x: x.strftime("%B %Y"), months)), y=counts,
labels={'x': 'Месяц', 'y': 'Количество назначенных процедур'}, title='Количество назначенных процедур')
fig.update_layout(l)
code = fig.to_html(full_html=False)
return code
def patient_ratings_pie(user):
marks = user.sent_ratings.all()
counts = []
for i in range(1, 6):
counts.append(marks.filter(rating=i).count())
fig = px.pie(values=counts, names=list(map(lambda x: "Оценка {}".format(x), list(range(1, 6)))),
title='Доля выставленных оценок')
code = fig.to_html(full_html=False)
return code
def patient_treatments_plot(user):
today = datetime.date.today()
today = today.replace(day=1)
delta = datetime.timedelta(days=2)
counts = []
months = []
for i in range(6):
months.append(today)
counts.append(user.patient.treatment_set.filter(creationDate__month=today.month).count())
today = today - delta
today = today.replace(day=1)
counts.reverse()
months.reverse()
l = plotly.graph_objs.Layout(
xaxis={'fixedrange': True},
yaxis={'fixedrange': True})
fig = px.bar(x=list(map(lambda x: x.strftime("%B %Y"), months)), y=counts,
labels={'x': 'Месяц', 'y': 'Количество обращений в клиники'}, title="Количество обращений в клиники")
fig.update_layout(l)
code = fig.to_html(full_html=False)
return code
def patient_procedures_plot(user):
today = datetime.date.today()
today = today.replace(day=1)
delta = datetime.timedelta(days=2)
counts = []
months = []
procs = CurrentProcedure.objects.none()
treats = user.patient.treatment_set.all()
for treat in treats:
procs |= treat.currentprocedure_set.all()
for i in range(6):
months.append(today)
counts.append(procs.filter(time__month=today.month).count())
today = today - delta
today = today.replace(day=1)
counts.reverse()
months.reverse()
l = plotly.graph_objs.Layout(
xaxis={'fixedrange': True},
yaxis={'fixedrange': True})
fig = px.bar(x=list(map(lambda x: x.strftime("%B %Y"), months)), y=counts,
labels={'x': 'Месяц', 'y': 'Количество проведенных процедур'}, title='Количество проведенных процедур')
fig.update_layout(l)
code = fig.to_html(full_html=False)
return code
def clinic_treatment_plot(user):
today = datetime.date.today()
today = today.replace(day=1)
delta = datetime.timedelta(days=2)
counts = []
months = []
for i in range(6):
months.append(today)
counts.append(user.clinic.treatment_set.filter(creationDate__month=today.month).count())
today = today - delta
today = today.replace(day=1)
counts.reverse()
months.reverse()
l = plotly.graph_objs.Layout(
xaxis={'fixedrange': True},
yaxis={'fixedrange': True})
fig = px.bar(x=list(map(lambda x: x.strftime("%B %Y"), months)), y=counts,
labels={'x': 'Месяц', 'y': 'Количество обращений пациентов'}, title="Количество обращений пациентов")
fig.update_layout(l)
code = fig.to_html(full_html=False)
return code
def clinic_procedures_plot(user):
today = datetime.date.today()
today = today.replace(day=1)
delta = datetime.timedelta(days=2)
counts = []
months = []
procs = CurrentProcedure.objects.none()
treats = user.clinic.treatment_set.all()
for treat in treats:
procs |= treat.currentprocedure_set.all()
for i in range(6):
months.append(today)
counts.append(procs.filter(time__month=today.month).count())
today = today - delta
today = today.replace(day=1)
counts.reverse()
months.reverse()
l = plotly.graph_objs.Layout(
xaxis={'fixedrange': True},
yaxis={'fixedrange': True})
fig = px.bar(x=list(map(lambda x: x.strftime("%B %Y"), months)), y=counts,
labels={'x': 'Месяц', 'y': 'Количество проведенных процедур'}, title='Количество проведенных процедур')
fig.update_layout(l)
code = fig.to_html(full_html=False)
return code
def clinic_ratings_plot(user):
docs = user.clinic.doctor_set.all()
marks = {}
for doc in docs:
t = doc.getAverageRating()
if t in marks:
marks[t] += 1
else:
marks[t] = 1
if not marks:
return False
marks = sorted(marks.items(), key=lambda x: x[0])
l = plotly.graph_objs.Layout(
xaxis={'fixedrange': True},
yaxis={'fixedrange': True})
fig = px.bar(x=list(map(lambda x: x[0], marks)), y=list(map(lambda x: x[1], marks)),
labels={'x': 'Средняя оценка', 'y': 'Количество'}, title='Число средних оценок докторов клиники')
fig.update_layout(l)
code = fig.to_html(full_html=False)
return code
| 34.855856 | 143 | 0.630912 | 1,011 | 7,738 | 4.738872 | 0.137488 | 0.050094 | 0.04258 | 0.050094 | 0.788353 | 0.768107 | 0.768107 | 0.768107 | 0.768107 | 0.768107 | 0 | 0.00665 | 0.222667 | 7,738 | 221 | 144 | 35.013575 | 0.789859 | 0.016283 | 0 | 0.73 | 0 | 0 | 0.107227 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.05 | false | 0 | 0.035 | 0 | 0.145 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
b3421ade1ff12e4d3e71517940b6a0bcb7495aae | 27 | py | Python | src/euler_python_package/euler_python/medium/p394.py | wilsonify/euler | 5214b776175e6d76a7c6d8915d0e062d189d9b79 | [
"MIT"
] | null | null | null | src/euler_python_package/euler_python/medium/p394.py | wilsonify/euler | 5214b776175e6d76a7c6d8915d0e062d189d9b79 | [
"MIT"
] | null | null | null | src/euler_python_package/euler_python/medium/p394.py | wilsonify/euler | 5214b776175e6d76a7c6d8915d0e062d189d9b79 | [
"MIT"
] | null | null | null | def problem394():
pass
| 9 | 17 | 0.62963 | 3 | 27 | 5.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.15 | 0.259259 | 27 | 2 | 18 | 13.5 | 0.7 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0.5 | 0 | 0 | 0.5 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
b34a7a2b6f42413f938aa27d7894a8c779efa992 | 339 | py | Python | csv_manager/views.py | Apfirebolt/CSV-File-Manager-in-Django | e708038c1f9951ec593b37bee5dd329268643af0 | [
"MIT"
] | null | null | null | csv_manager/views.py | Apfirebolt/CSV-File-Manager-in-Django | e708038c1f9951ec593b37bee5dd329268643af0 | [
"MIT"
] | null | null | null | csv_manager/views.py | Apfirebolt/CSV-File-Manager-in-Django | e708038c1f9951ec593b37bee5dd329268643af0 | [
"MIT"
] | null | null | null | from django.shortcuts import render
def handler404(request, exception):
return render(request, '404.html')
def handler403(request, exception):
return render(request, '403.html')
def handler500(request, exception):
return render(request, '500.html')
def handler400(request, exception):
return render(request, '400.html') | 19.941176 | 37 | 0.740413 | 41 | 339 | 6.121951 | 0.439024 | 0.25498 | 0.350598 | 0.446215 | 0.557769 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082192 | 0.138643 | 339 | 17 | 38 | 19.941176 | 0.777397 | 0 | 0 | 0 | 0 | 0 | 0.094118 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.444444 | false | 0 | 0.111111 | 0.444444 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
b370c45e01e7bfb6e0491b4cd3e70c6f646c1667 | 77 | py | Python | openwisp_network_topology/management/commands/update_topology.py | DaffyTheDuck/openwisp-network-topology | a8c9212f0d9cca76f83b41af0e3fc89330f408bb | [
"BSD-3-Clause"
] | 105 | 2017-06-14T06:06:16.000Z | 2022-03-29T18:50:38.000Z | openwisp_network_topology/management/commands/update_topology.py | DaffyTheDuck/openwisp-network-topology | a8c9212f0d9cca76f83b41af0e3fc89330f408bb | [
"BSD-3-Clause"
] | 127 | 2017-06-02T08:19:13.000Z | 2022-03-18T00:26:13.000Z | openwisp_network_topology/management/commands/update_topology.py | ManishShah120/openwisp-network-topology | 0ed720eff1eb733a00cdbfc83292f16fe7d56e12 | [
"BSD-3-Clause"
] | 62 | 2017-06-21T10:28:10.000Z | 2022-03-31T22:06:09.000Z | from . import BaseUpdateCommand
class Command(BaseUpdateCommand):
pass
| 12.833333 | 33 | 0.779221 | 7 | 77 | 8.571429 | 0.857143 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.168831 | 77 | 5 | 34 | 15.4 | 0.9375 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 6 |
2faf495713c5404bd0a75f4056852da4b88250af | 109 | py | Python | stRT/plot/two_d_plot/__init__.py | Yao-14/stAnalysis | d08483ce581f5b03cfcad8be500aaa64b0293f74 | [
"BSD-3-Clause"
] | null | null | null | stRT/plot/two_d_plot/__init__.py | Yao-14/stAnalysis | d08483ce581f5b03cfcad8be500aaa64b0293f74 | [
"BSD-3-Clause"
] | null | null | null | stRT/plot/two_d_plot/__init__.py | Yao-14/stAnalysis | d08483ce581f5b03cfcad8be500aaa64b0293f74 | [
"BSD-3-Clause"
] | null | null | null | from .basic_plot import *
from .basic_stats import basic_stats_multi
from .spatial_points import space_multi
| 27.25 | 42 | 0.853211 | 17 | 109 | 5.117647 | 0.529412 | 0.206897 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.110092 | 109 | 3 | 43 | 36.333333 | 0.896907 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
64344de457c52b87a296c748366d122d859db9cb | 23 | py | Python | pcap_ioc/__init__.py | Nothing2Hide/pcap_ioc | 5d6b4951d8731734d42364353b4d08b5ecd85541 | [
"MIT"
] | 10 | 2019-04-11T05:13:01.000Z | 2021-11-28T08:34:43.000Z | pcap_ioc/__init__.py | Nothing2Hide/pcap_ioc | 5d6b4951d8731734d42364353b4d08b5ecd85541 | [
"MIT"
] | null | null | null | pcap_ioc/__init__.py | Nothing2Hide/pcap_ioc | 5d6b4951d8731734d42364353b4d08b5ecd85541 | [
"MIT"
] | 1 | 2019-04-06T11:43:28.000Z | 2019-04-06T11:43:28.000Z | from .pcap import Pcap
| 11.5 | 22 | 0.782609 | 4 | 23 | 4.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.173913 | 23 | 1 | 23 | 23 | 0.947368 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
ff589cf9ef9e765b8756fbb640f4c5813225b025 | 2,669 | py | Python | tests/test_region.py | Kromey/pynano | af1b8697d30c227c6ff4606ac341e3eff382fc74 | [
"MIT"
] | null | null | null | tests/test_region.py | Kromey/pynano | af1b8697d30c227c6ff4606ac341e3eff382fc74 | [
"MIT"
] | null | null | null | tests/test_region.py | Kromey/pynano | af1b8697d30c227c6ff4606ac341e3eff382fc74 | [
"MIT"
] | null | null | null | from decimal import Decimal
import responses
# flake8 doesn't think this one is part of our package
from pynano import Region # noqa
def test_region_wordcount(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.wordcount == 1675173
def test_region_name(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.name == 'USA :: Alaska :: Fairbanks'
def test_region_id(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.id == '4058792'
def test_region_writers(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.writers == 78
def test_region_min(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.min == 0
def test_region_max(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.max == 103293
def test_region_average(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.average == Decimal('21476.5769')
def test_region_stddev(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.stddev == Decimal('25294.652295124793')
def test_region_donations(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.donations == Decimal('235.0')
def test_region_donors(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.donors == 8
def test_region_instantiation(fbx_response):
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa-alaska-fairbanks')
assert fbx.name == 'USA :: Alaska :: Fairbanks'
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa alaska fairbanks')
assert fbx.name == 'USA :: Alaska :: Fairbanks'
with responses.RequestsMock() as rsps:
fbx_response(rsps)
fbx = Region('usa :: alaska :: fairbanks')
assert fbx.name == 'USA :: Alaska :: Fairbanks'
| 27.515464 | 58 | 0.662046 | 323 | 2,669 | 5.328173 | 0.160991 | 0.105752 | 0.177804 | 0.203951 | 0.740848 | 0.740848 | 0.740848 | 0.740848 | 0.740848 | 0.740848 | 0 | 0.026803 | 0.231173 | 2,669 | 96 | 59 | 27.802083 | 0.811891 | 0.021356 | 0 | 0.621212 | 0 | 0 | 0.157209 | 0 | 0 | 0 | 0 | 0 | 0.19697 | 1 | 0.166667 | false | 0 | 0.045455 | 0 | 0.212121 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ffac26365afdd0b4db910f3d081a9cb07a09e5f1 | 37,681 | py | Python | instances/passenger_demand/pas-20210421-2109-int1/2.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int1/2.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int1/2.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null |
"""
PASSENGERS
"""
numPassengers = 2280
passenger_arriving = (
(0, 6, 7, 4, 1, 0, 2, 9, 4, 1, 3, 0), # 0
(3, 3, 3, 0, 2, 0, 2, 8, 3, 0, 1, 0), # 1
(2, 2, 4, 4, 1, 0, 4, 5, 3, 6, 1, 0), # 2
(6, 5, 5, 3, 0, 0, 4, 11, 2, 3, 3, 0), # 3
(1, 5, 2, 2, 2, 0, 5, 7, 3, 5, 0, 0), # 4
(7, 2, 7, 4, 3, 0, 7, 5, 5, 1, 2, 0), # 5
(1, 11, 8, 5, 0, 0, 2, 6, 3, 3, 1, 0), # 6
(2, 11, 7, 4, 1, 0, 7, 5, 7, 0, 2, 0), # 7
(4, 7, 9, 3, 1, 0, 3, 3, 6, 4, 0, 0), # 8
(4, 4, 2, 4, 1, 0, 4, 11, 5, 4, 0, 0), # 9
(6, 7, 7, 1, 0, 0, 7, 5, 5, 1, 3, 0), # 10
(1, 12, 5, 3, 1, 0, 6, 4, 3, 4, 0, 0), # 11
(1, 8, 2, 3, 0, 0, 3, 7, 5, 3, 1, 0), # 12
(1, 5, 9, 1, 3, 0, 2, 7, 6, 4, 2, 0), # 13
(3, 2, 6, 2, 1, 0, 6, 11, 2, 3, 0, 0), # 14
(8, 5, 3, 0, 1, 0, 3, 4, 5, 6, 1, 0), # 15
(5, 8, 3, 2, 0, 0, 4, 3, 3, 4, 1, 0), # 16
(4, 8, 4, 2, 2, 0, 2, 5, 2, 4, 2, 0), # 17
(3, 9, 3, 2, 1, 0, 3, 6, 5, 4, 0, 0), # 18
(2, 4, 6, 1, 1, 0, 6, 9, 3, 2, 1, 0), # 19
(2, 4, 6, 5, 1, 0, 6, 5, 4, 3, 3, 0), # 20
(2, 7, 8, 1, 1, 0, 4, 6, 3, 1, 6, 0), # 21
(5, 6, 4, 3, 1, 0, 5, 15, 4, 2, 4, 0), # 22
(5, 4, 6, 0, 3, 0, 5, 3, 4, 3, 1, 0), # 23
(3, 4, 2, 2, 0, 0, 3, 3, 7, 3, 2, 0), # 24
(4, 11, 5, 2, 3, 0, 8, 6, 4, 2, 1, 0), # 25
(0, 7, 7, 2, 2, 0, 2, 9, 5, 5, 6, 0), # 26
(1, 8, 10, 1, 1, 0, 2, 8, 2, 1, 3, 0), # 27
(2, 5, 4, 5, 2, 0, 8, 10, 6, 6, 3, 0), # 28
(4, 9, 9, 2, 4, 0, 7, 7, 6, 5, 2, 0), # 29
(4, 6, 10, 4, 2, 0, 6, 5, 2, 3, 0, 0), # 30
(4, 7, 4, 3, 1, 0, 5, 5, 3, 4, 2, 0), # 31
(1, 10, 7, 1, 3, 0, 3, 5, 4, 6, 2, 0), # 32
(5, 4, 6, 2, 0, 0, 1, 9, 4, 4, 2, 0), # 33
(5, 5, 3, 1, 3, 0, 8, 6, 5, 3, 0, 0), # 34
(5, 5, 3, 4, 2, 0, 2, 7, 1, 0, 2, 0), # 35
(2, 5, 4, 4, 1, 0, 3, 6, 4, 8, 1, 0), # 36
(2, 6, 5, 0, 0, 0, 3, 4, 3, 3, 1, 0), # 37
(3, 9, 6, 1, 1, 0, 4, 4, 5, 4, 0, 0), # 38
(4, 5, 3, 1, 1, 0, 8, 9, 1, 2, 1, 0), # 39
(4, 7, 5, 5, 0, 0, 3, 8, 6, 3, 1, 0), # 40
(1, 10, 2, 3, 3, 0, 4, 3, 2, 2, 0, 0), # 41
(2, 6, 8, 1, 5, 0, 6, 3, 2, 0, 3, 0), # 42
(3, 6, 9, 1, 2, 0, 6, 10, 3, 3, 1, 0), # 43
(3, 8, 6, 5, 1, 0, 3, 6, 7, 5, 0, 0), # 44
(6, 8, 7, 2, 1, 0, 3, 5, 7, 4, 2, 0), # 45
(4, 10, 10, 2, 2, 0, 2, 6, 6, 3, 4, 0), # 46
(2, 9, 4, 2, 1, 0, 3, 8, 3, 4, 0, 0), # 47
(2, 9, 2, 2, 3, 0, 0, 7, 4, 2, 2, 0), # 48
(2, 7, 2, 2, 2, 0, 4, 6, 4, 2, 1, 0), # 49
(2, 12, 6, 4, 3, 0, 7, 6, 7, 7, 2, 0), # 50
(1, 5, 7, 4, 2, 0, 6, 1, 5, 7, 2, 0), # 51
(9, 5, 5, 3, 3, 0, 3, 10, 2, 1, 1, 0), # 52
(1, 7, 4, 5, 1, 0, 5, 8, 2, 4, 1, 0), # 53
(4, 1, 2, 2, 1, 0, 2, 7, 7, 7, 0, 0), # 54
(4, 7, 9, 3, 1, 0, 8, 3, 2, 6, 3, 0), # 55
(5, 7, 3, 1, 1, 0, 3, 2, 2, 2, 2, 0), # 56
(2, 7, 6, 4, 2, 0, 4, 6, 5, 3, 2, 0), # 57
(3, 7, 5, 2, 3, 0, 2, 5, 1, 3, 3, 0), # 58
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59
)
station_arriving_intensity = (
(2.649651558384548, 6.796460700757575, 7.9942360218509, 6.336277173913043, 7.143028846153846, 4.75679347826087), # 0
(2.6745220100478, 6.872041598712823, 8.037415537524994, 6.371564387077295, 7.196566506410256, 4.7551721391908215), # 1
(2.699108477221734, 6.946501402918069, 8.07957012282205, 6.406074879227053, 7.248974358974359, 4.753501207729468), # 2
(2.72339008999122, 7.019759765625, 8.120668982969152, 6.4397792119565205, 7.300204326923078, 4.7517809103260875), # 3
(2.747345978441128, 7.091736339085298, 8.160681323193373, 6.472647946859904, 7.350208333333334, 4.750011473429951), # 4
(2.7709552726563262, 7.162350775550646, 8.199576348721793, 6.504651645531401, 7.39893830128205, 4.748193123490338), # 5
(2.794197102721686, 7.231522727272727, 8.237323264781493, 6.535760869565218, 7.446346153846154, 4.746326086956522), # 6
(2.817050598722076, 7.299171846503226, 8.273891276599542, 6.565946180555556, 7.492383814102565, 4.744410590277778), # 7
(2.8394948907423667, 7.365217785493826, 8.309249589403029, 6.595178140096618, 7.537003205128205, 4.7424468599033816), # 8
(2.8615091088674274, 7.429580196496212, 8.343367408419024, 6.623427309782609, 7.580156249999999, 4.740435122282609), # 9
(2.8830723831821286, 7.492178731762065, 8.376213938874606, 6.65066425120773, 7.621794871794872, 4.738375603864734), # 10
(2.9041638437713395, 7.55293304354307, 8.407758385996857, 6.676859525966184, 7.661870993589743, 4.736268531099034), # 11
(2.92476262071993, 7.611762784090908, 8.437969955012854, 6.7019836956521734, 7.700336538461538, 4.734114130434782), # 12
(2.944847844112769, 7.668587605657268, 8.46681785114967, 6.726007321859903, 7.737143429487181, 4.731912628321256), # 13
(2.9643986440347283, 7.723327160493828, 8.494271279634388, 6.748900966183574, 7.772243589743589, 4.729664251207729), # 14
(2.9833941505706756, 7.775901100852272, 8.520299445694086, 6.770635190217391, 7.8055889423076925, 4.7273692255434785), # 15
(3.001813493805482, 7.826229078984287, 8.544871554555842, 6.791180555555555, 7.8371314102564105, 4.725027777777778), # 16
(3.019635803824017, 7.874230747141554, 8.567956811446729, 6.810507623792271, 7.866822916666667, 4.722640134359904), # 17
(3.03684021071115, 7.919825757575757, 8.589524421593831, 6.82858695652174, 7.894615384615387, 4.72020652173913), # 18
(3.053405844551751, 7.962933762538579, 8.609543590224222, 6.845389115338164, 7.9204607371794875, 4.717727166364734), # 19
(3.0693118354306894, 8.003474414281705, 8.62798352256498, 6.860884661835749, 7.944310897435898, 4.71520229468599), # 20
(3.084537313432836, 8.041367365056816, 8.644813423843189, 6.875044157608696, 7.9661177884615375, 4.712632133152174), # 21
(3.099061408643059, 8.076532267115601, 8.660002499285918, 6.887838164251208, 7.985833333333332, 4.710016908212561), # 22
(3.1128632511462295, 8.108888772709737, 8.673519954120252, 6.899237243357488, 8.003409455128205, 4.707356846316426), # 23
(3.125921971027217, 8.138356534090908, 8.685334993573264, 6.909211956521739, 8.018798076923076, 4.704652173913043), # 24
(3.1382166983708903, 8.164855203510802, 8.695416822872037, 6.917732865338165, 8.03195112179487, 4.701903117451691), # 25
(3.1497265632621207, 8.188304433221099, 8.703734647243644, 6.9247705314009655, 8.042820512820512, 4.699109903381642), # 26
(3.160430695785777, 8.208623875473483, 8.710257671915166, 6.930295516304349, 8.051358173076924, 4.696272758152174), # 27
(3.1703082260267292, 8.22573318251964, 8.714955102113683, 6.934278381642512, 8.057516025641025, 4.69339190821256), # 28
(3.1793382840698468, 8.239552006611252, 8.717796143066266, 6.936689689009662, 8.061245993589743, 4.690467580012077), # 29
(3.1875, 8.25, 8.71875, 6.9375, 8.0625, 4.6875), # 30
(3.1951370284526854, 8.258678799715907, 8.718034948671496, 6.937353656045752, 8.062043661347518, 4.683376259786773), # 31
(3.202609175191816, 8.267242897727273, 8.715910024154589, 6.93691748366013, 8.06068439716312, 4.677024758454107), # 32
(3.2099197969948845, 8.275691228693182, 8.712405570652175, 6.936195772058824, 8.058436835106383, 4.66850768365817), # 33
(3.217072250639386, 8.284022727272728, 8.70755193236715, 6.935192810457517, 8.05531560283688, 4.657887223055139), # 34
(3.224069892902813, 8.292236328124998, 8.701379453502415, 6.933912888071895, 8.051335328014185, 4.645225564301183), # 35
(3.23091608056266, 8.300330965909092, 8.69391847826087, 6.932360294117648, 8.046510638297873, 4.630584895052474), # 36
(3.2376141703964194, 8.308305575284091, 8.68519935084541, 6.9305393178104575, 8.040856161347516, 4.614027402965184), # 37
(3.2441675191815853, 8.31615909090909, 8.675252415458937, 6.9284542483660125, 8.034386524822695, 4.595615275695485), # 38
(3.250579483695652, 8.323890447443182, 8.664108016304347, 6.926109375, 8.027116356382978, 4.57541070089955), # 39
(3.2568534207161126, 8.331498579545455, 8.651796497584542, 6.923508986928105, 8.019060283687942, 4.5534758662335495), # 40
(3.26299268702046, 8.338982421874999, 8.638348203502416, 6.920657373366013, 8.010232934397163, 4.529872959353657), # 41
(3.269000639386189, 8.34634090909091, 8.62379347826087, 6.917558823529411, 8.000648936170213, 4.504664167916042), # 42
(3.2748806345907933, 8.353572975852272, 8.608162666062801, 6.914217626633987, 7.990322916666666, 4.477911679576878), # 43
(3.2806360294117645, 8.360677556818182, 8.591486111111111, 6.910638071895424, 7.979269503546099, 4.449677681992337), # 44
(3.286270180626598, 8.367653586647727, 8.573794157608697, 6.906824448529411, 7.967503324468085, 4.420024362818591), # 45
(3.291786445012788, 8.374500000000001, 8.555117149758455, 6.902781045751634, 7.955039007092199, 4.389013909711811), # 46
(3.297188179347826, 8.381215731534091, 8.535485431763284, 6.898512152777777, 7.941891179078015, 4.356708510328169), # 47
(3.3024787404092075, 8.387799715909091, 8.514929347826087, 6.894022058823529, 7.928074468085106, 4.323170352323839), # 48
(3.307661484974424, 8.39425088778409, 8.493479242149759, 6.889315053104576, 7.91360350177305, 4.288461623354989), # 49
(3.312739769820972, 8.40056818181818, 8.471165458937199, 6.884395424836602, 7.898492907801418, 4.252644511077794), # 50
(3.317716951726343, 8.406750532670454, 8.448018342391304, 6.879267463235294, 7.882757313829787, 4.215781203148426), # 51
(3.322596387468031, 8.412796875, 8.424068236714975, 6.87393545751634, 7.86641134751773, 4.177933887223055), # 52
(3.3273814338235295, 8.41870614346591, 8.39934548611111, 6.868403696895425, 7.849469636524823, 4.139164750957854), # 53
(3.332075447570333, 8.424477272727271, 8.373880434782608, 6.8626764705882355, 7.831946808510638, 4.099535982008995), # 54
(3.336681785485933, 8.430109197443182, 8.347703426932366, 6.856758067810458, 7.813857491134752, 4.05910976803265), # 55
(3.341203804347826, 8.435600852272726, 8.320844806763285, 6.8506527777777775, 7.795216312056738, 4.017948296684991), # 56
(3.345644860933504, 8.440951171875001, 8.29333491847826, 6.844364889705882, 7.77603789893617, 3.9761137556221886), # 57
(3.3500083120204605, 8.44615909090909, 8.265204106280192, 6.837898692810458, 7.756336879432624, 3.9336683325004165), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_arriving_acc = (
(0, 6, 7, 4, 1, 0, 2, 9, 4, 1, 3, 0), # 0
(3, 9, 10, 4, 3, 0, 4, 17, 7, 1, 4, 0), # 1
(5, 11, 14, 8, 4, 0, 8, 22, 10, 7, 5, 0), # 2
(11, 16, 19, 11, 4, 0, 12, 33, 12, 10, 8, 0), # 3
(12, 21, 21, 13, 6, 0, 17, 40, 15, 15, 8, 0), # 4
(19, 23, 28, 17, 9, 0, 24, 45, 20, 16, 10, 0), # 5
(20, 34, 36, 22, 9, 0, 26, 51, 23, 19, 11, 0), # 6
(22, 45, 43, 26, 10, 0, 33, 56, 30, 19, 13, 0), # 7
(26, 52, 52, 29, 11, 0, 36, 59, 36, 23, 13, 0), # 8
(30, 56, 54, 33, 12, 0, 40, 70, 41, 27, 13, 0), # 9
(36, 63, 61, 34, 12, 0, 47, 75, 46, 28, 16, 0), # 10
(37, 75, 66, 37, 13, 0, 53, 79, 49, 32, 16, 0), # 11
(38, 83, 68, 40, 13, 0, 56, 86, 54, 35, 17, 0), # 12
(39, 88, 77, 41, 16, 0, 58, 93, 60, 39, 19, 0), # 13
(42, 90, 83, 43, 17, 0, 64, 104, 62, 42, 19, 0), # 14
(50, 95, 86, 43, 18, 0, 67, 108, 67, 48, 20, 0), # 15
(55, 103, 89, 45, 18, 0, 71, 111, 70, 52, 21, 0), # 16
(59, 111, 93, 47, 20, 0, 73, 116, 72, 56, 23, 0), # 17
(62, 120, 96, 49, 21, 0, 76, 122, 77, 60, 23, 0), # 18
(64, 124, 102, 50, 22, 0, 82, 131, 80, 62, 24, 0), # 19
(66, 128, 108, 55, 23, 0, 88, 136, 84, 65, 27, 0), # 20
(68, 135, 116, 56, 24, 0, 92, 142, 87, 66, 33, 0), # 21
(73, 141, 120, 59, 25, 0, 97, 157, 91, 68, 37, 0), # 22
(78, 145, 126, 59, 28, 0, 102, 160, 95, 71, 38, 0), # 23
(81, 149, 128, 61, 28, 0, 105, 163, 102, 74, 40, 0), # 24
(85, 160, 133, 63, 31, 0, 113, 169, 106, 76, 41, 0), # 25
(85, 167, 140, 65, 33, 0, 115, 178, 111, 81, 47, 0), # 26
(86, 175, 150, 66, 34, 0, 117, 186, 113, 82, 50, 0), # 27
(88, 180, 154, 71, 36, 0, 125, 196, 119, 88, 53, 0), # 28
(92, 189, 163, 73, 40, 0, 132, 203, 125, 93, 55, 0), # 29
(96, 195, 173, 77, 42, 0, 138, 208, 127, 96, 55, 0), # 30
(100, 202, 177, 80, 43, 0, 143, 213, 130, 100, 57, 0), # 31
(101, 212, 184, 81, 46, 0, 146, 218, 134, 106, 59, 0), # 32
(106, 216, 190, 83, 46, 0, 147, 227, 138, 110, 61, 0), # 33
(111, 221, 193, 84, 49, 0, 155, 233, 143, 113, 61, 0), # 34
(116, 226, 196, 88, 51, 0, 157, 240, 144, 113, 63, 0), # 35
(118, 231, 200, 92, 52, 0, 160, 246, 148, 121, 64, 0), # 36
(120, 237, 205, 92, 52, 0, 163, 250, 151, 124, 65, 0), # 37
(123, 246, 211, 93, 53, 0, 167, 254, 156, 128, 65, 0), # 38
(127, 251, 214, 94, 54, 0, 175, 263, 157, 130, 66, 0), # 39
(131, 258, 219, 99, 54, 0, 178, 271, 163, 133, 67, 0), # 40
(132, 268, 221, 102, 57, 0, 182, 274, 165, 135, 67, 0), # 41
(134, 274, 229, 103, 62, 0, 188, 277, 167, 135, 70, 0), # 42
(137, 280, 238, 104, 64, 0, 194, 287, 170, 138, 71, 0), # 43
(140, 288, 244, 109, 65, 0, 197, 293, 177, 143, 71, 0), # 44
(146, 296, 251, 111, 66, 0, 200, 298, 184, 147, 73, 0), # 45
(150, 306, 261, 113, 68, 0, 202, 304, 190, 150, 77, 0), # 46
(152, 315, 265, 115, 69, 0, 205, 312, 193, 154, 77, 0), # 47
(154, 324, 267, 117, 72, 0, 205, 319, 197, 156, 79, 0), # 48
(156, 331, 269, 119, 74, 0, 209, 325, 201, 158, 80, 0), # 49
(158, 343, 275, 123, 77, 0, 216, 331, 208, 165, 82, 0), # 50
(159, 348, 282, 127, 79, 0, 222, 332, 213, 172, 84, 0), # 51
(168, 353, 287, 130, 82, 0, 225, 342, 215, 173, 85, 0), # 52
(169, 360, 291, 135, 83, 0, 230, 350, 217, 177, 86, 0), # 53
(173, 361, 293, 137, 84, 0, 232, 357, 224, 184, 86, 0), # 54
(177, 368, 302, 140, 85, 0, 240, 360, 226, 190, 89, 0), # 55
(182, 375, 305, 141, 86, 0, 243, 362, 228, 192, 91, 0), # 56
(184, 382, 311, 145, 88, 0, 247, 368, 233, 195, 93, 0), # 57
(187, 389, 316, 147, 91, 0, 249, 373, 234, 198, 96, 0), # 58
(187, 389, 316, 147, 91, 0, 249, 373, 234, 198, 96, 0), # 59
)
passenger_arriving_rate = (
(2.649651558384548, 5.43716856060606, 4.79654161311054, 2.534510869565217, 1.428605769230769, 0.0, 4.75679347826087, 5.714423076923076, 3.801766304347826, 3.1976944087403596, 1.359292140151515, 0.0), # 0
(2.6745220100478, 5.497633278970258, 4.822449322514997, 2.5486257548309177, 1.439313301282051, 0.0, 4.7551721391908215, 5.757253205128204, 3.8229386322463768, 3.2149662150099974, 1.3744083197425645, 0.0), # 1
(2.699108477221734, 5.557201122334455, 4.8477420736932295, 2.562429951690821, 1.4497948717948717, 0.0, 4.753501207729468, 5.799179487179487, 3.8436449275362317, 3.23182804912882, 1.3893002805836137, 0.0), # 2
(2.72339008999122, 5.6158078125, 4.872401389781491, 2.575911684782608, 1.4600408653846155, 0.0, 4.7517809103260875, 5.840163461538462, 3.863867527173912, 3.2482675931876606, 1.403951953125, 0.0), # 3
(2.747345978441128, 5.673389071268238, 4.896408793916024, 2.589059178743961, 1.4700416666666667, 0.0, 4.750011473429951, 5.880166666666667, 3.883588768115942, 3.2642725292773487, 1.4183472678170594, 0.0), # 4
(2.7709552726563262, 5.729880620440516, 4.919745809233076, 2.6018606582125603, 1.47978766025641, 0.0, 4.748193123490338, 5.91915064102564, 3.9027909873188404, 3.279830539488717, 1.432470155110129, 0.0), # 5
(2.794197102721686, 5.785218181818181, 4.942393958868895, 2.614304347826087, 1.4892692307692306, 0.0, 4.746326086956522, 5.957076923076922, 3.9214565217391306, 3.294929305912597, 1.4463045454545453, 0.0), # 6
(2.817050598722076, 5.83933747720258, 4.964334765959725, 2.626378472222222, 1.498476762820513, 0.0, 4.744410590277778, 5.993907051282052, 3.939567708333333, 3.309556510639817, 1.459834369300645, 0.0), # 7
(2.8394948907423667, 5.89217422839506, 4.985549753641817, 2.638071256038647, 1.5074006410256409, 0.0, 4.7424468599033816, 6.0296025641025635, 3.9571068840579704, 3.3236998357612113, 1.473043557098765, 0.0), # 8
(2.8615091088674274, 5.943664157196969, 5.006020445051414, 2.649370923913043, 1.5160312499999997, 0.0, 4.740435122282609, 6.064124999999999, 3.9740563858695652, 3.3373469633676094, 1.4859160392992423, 0.0), # 9
(2.8830723831821286, 5.993742985409652, 5.025728363324764, 2.660265700483092, 1.5243589743589743, 0.0, 4.738375603864734, 6.097435897435897, 3.990398550724638, 3.3504855755498424, 1.498435746352413, 0.0), # 10
(2.9041638437713395, 6.042346434834456, 5.044655031598114, 2.6707438103864733, 1.5323741987179484, 0.0, 4.736268531099034, 6.129496794871794, 4.0061157155797105, 3.3631033543987425, 1.510586608708614, 0.0), # 11
(2.92476262071993, 6.089410227272726, 5.062781973007712, 2.680793478260869, 1.5400673076923075, 0.0, 4.734114130434782, 6.16026923076923, 4.021190217391304, 3.375187982005141, 1.5223525568181815, 0.0), # 12
(2.944847844112769, 6.134870084525814, 5.080090710689802, 2.690402928743961, 1.547428685897436, 0.0, 4.731912628321256, 6.189714743589744, 4.035604393115942, 3.386727140459868, 1.5337175211314535, 0.0), # 13
(2.9643986440347283, 6.1786617283950624, 5.096562767780632, 2.699560386473429, 1.5544487179487176, 0.0, 4.729664251207729, 6.217794871794871, 4.049340579710144, 3.397708511853755, 1.5446654320987656, 0.0), # 14
(2.9833941505706756, 6.220720880681816, 5.112179667416451, 2.708254076086956, 1.5611177884615384, 0.0, 4.7273692255434785, 6.2444711538461535, 4.062381114130434, 3.408119778277634, 1.555180220170454, 0.0), # 15
(3.001813493805482, 6.26098326318743, 5.126922932733505, 2.716472222222222, 1.5674262820512819, 0.0, 4.725027777777778, 6.2697051282051275, 4.074708333333333, 3.4179486218223363, 1.5652458157968574, 0.0), # 16
(3.019635803824017, 6.299384597713242, 5.140774086868038, 2.724203049516908, 1.5733645833333332, 0.0, 4.722640134359904, 6.293458333333333, 4.0863045742753625, 3.4271827245786914, 1.5748461494283106, 0.0), # 17
(3.03684021071115, 6.3358606060606055, 5.153714652956299, 2.7314347826086958, 1.578923076923077, 0.0, 4.72020652173913, 6.315692307692308, 4.097152173913043, 3.435809768637532, 1.5839651515151514, 0.0), # 18
(3.053405844551751, 6.370347010030863, 5.165726154134533, 2.738155646135265, 1.5840921474358973, 0.0, 4.717727166364734, 6.336368589743589, 4.107233469202898, 3.4438174360896885, 1.5925867525077158, 0.0), # 19
(3.0693118354306894, 6.402779531425363, 5.1767901135389875, 2.7443538647342995, 1.5888621794871793, 0.0, 4.71520229468599, 6.355448717948717, 4.11653079710145, 3.4511934090259917, 1.6006948828563408, 0.0), # 20
(3.084537313432836, 6.433093892045452, 5.186888054305913, 2.750017663043478, 1.5932235576923073, 0.0, 4.712632133152174, 6.372894230769229, 4.125026494565217, 3.4579253695372754, 1.608273473011363, 0.0), # 21
(3.099061408643059, 6.46122581369248, 5.19600149957155, 2.7551352657004826, 1.5971666666666662, 0.0, 4.710016908212561, 6.388666666666665, 4.132702898550725, 3.464000999714367, 1.61530645342312, 0.0), # 22
(3.1128632511462295, 6.487111018167789, 5.204111972472151, 2.759694897342995, 1.6006818910256408, 0.0, 4.707356846316426, 6.402727564102563, 4.139542346014493, 3.4694079816481005, 1.6217777545419472, 0.0), # 23
(3.125921971027217, 6.5106852272727265, 5.211200996143958, 2.763684782608695, 1.6037596153846152, 0.0, 4.704652173913043, 6.415038461538461, 4.1455271739130435, 3.474133997429305, 1.6276713068181816, 0.0), # 24
(3.1382166983708903, 6.531884162808641, 5.217250093723222, 2.7670931461352657, 1.606390224358974, 0.0, 4.701903117451691, 6.425560897435896, 4.150639719202899, 3.4781667291488145, 1.6329710407021603, 0.0), # 25
(3.1497265632621207, 6.550643546576878, 5.222240788346187, 2.7699082125603858, 1.6085641025641022, 0.0, 4.699109903381642, 6.434256410256409, 4.154862318840579, 3.4814938588974575, 1.6376608866442195, 0.0), # 26
(3.160430695785777, 6.566899100378786, 5.226154603149099, 2.772118206521739, 1.6102716346153847, 0.0, 4.696272758152174, 6.441086538461539, 4.158177309782609, 3.484103068766066, 1.6417247750946966, 0.0), # 27
(3.1703082260267292, 6.580586546015712, 5.228973061268209, 2.7737113526570045, 1.6115032051282048, 0.0, 4.69339190821256, 6.446012820512819, 4.160567028985507, 3.4859820408454727, 1.645146636503928, 0.0), # 28
(3.1793382840698468, 6.591641605289001, 5.230677685839759, 2.7746758756038647, 1.6122491987179486, 0.0, 4.690467580012077, 6.448996794871794, 4.162013813405797, 3.487118457226506, 1.6479104013222503, 0.0), # 29
(3.1875, 6.6, 5.23125, 2.775, 1.6124999999999998, 0.0, 4.6875, 6.449999999999999, 4.1625, 3.4875, 1.65, 0.0), # 30
(3.1951370284526854, 6.606943039772726, 5.230820969202898, 2.7749414624183006, 1.6124087322695035, 0.0, 4.683376259786773, 6.449634929078014, 4.162412193627451, 3.4872139794685983, 1.6517357599431814, 0.0), # 31
(3.202609175191816, 6.613794318181818, 5.229546014492753, 2.7747669934640515, 1.6121368794326238, 0.0, 4.677024758454107, 6.448547517730495, 4.162150490196078, 3.4863640096618354, 1.6534485795454545, 0.0), # 32
(3.2099197969948845, 6.620552982954545, 5.227443342391305, 2.774478308823529, 1.6116873670212764, 0.0, 4.66850768365817, 6.446749468085105, 4.161717463235294, 3.4849622282608697, 1.6551382457386363, 0.0), # 33
(3.217072250639386, 6.627218181818182, 5.224531159420289, 2.7740771241830067, 1.6110631205673758, 0.0, 4.657887223055139, 6.444252482269503, 4.16111568627451, 3.4830207729468596, 1.6568045454545455, 0.0), # 34
(3.224069892902813, 6.633789062499998, 5.220827672101449, 2.773565155228758, 1.6102670656028368, 0.0, 4.645225564301183, 6.441068262411347, 4.160347732843137, 3.480551781400966, 1.6584472656249996, 0.0), # 35
(3.23091608056266, 6.6402647727272734, 5.2163510869565215, 2.7729441176470586, 1.6093021276595745, 0.0, 4.630584895052474, 6.437208510638298, 4.159416176470589, 3.477567391304347, 1.6600661931818184, 0.0), # 36
(3.2376141703964194, 6.6466444602272725, 5.211119610507246, 2.7722157271241827, 1.6081712322695032, 0.0, 4.614027402965184, 6.432684929078013, 4.158323590686274, 3.474079740338164, 1.6616611150568181, 0.0), # 37
(3.2441675191815853, 6.652927272727272, 5.205151449275362, 2.7713816993464047, 1.6068773049645388, 0.0, 4.595615275695485, 6.427509219858155, 4.157072549019607, 3.4701009661835744, 1.663231818181818, 0.0), # 38
(3.250579483695652, 6.659112357954545, 5.198464809782608, 2.7704437499999996, 1.6054232712765955, 0.0, 4.57541070089955, 6.421693085106382, 4.155665625, 3.4656432065217384, 1.6647780894886361, 0.0), # 39
(3.2568534207161126, 6.6651988636363635, 5.191077898550724, 2.7694035947712417, 1.6038120567375882, 0.0, 4.5534758662335495, 6.415248226950353, 4.154105392156863, 3.4607185990338163, 1.6662997159090909, 0.0), # 40
(3.26299268702046, 6.671185937499998, 5.1830089221014495, 2.768262949346405, 1.6020465868794325, 0.0, 4.529872959353657, 6.40818634751773, 4.152394424019608, 3.455339281400966, 1.6677964843749995, 0.0), # 41
(3.269000639386189, 6.677072727272728, 5.174276086956522, 2.767023529411764, 1.6001297872340425, 0.0, 4.504664167916042, 6.40051914893617, 4.150535294117646, 3.4495173913043478, 1.669268181818182, 0.0), # 42
(3.2748806345907933, 6.682858380681817, 5.164897599637681, 2.7656870506535944, 1.5980645833333331, 0.0, 4.477911679576878, 6.3922583333333325, 4.148530575980392, 3.4432650664251203, 1.6707145951704543, 0.0), # 43
(3.2806360294117645, 6.688542045454545, 5.154891666666667, 2.7642552287581696, 1.5958539007092198, 0.0, 4.449677681992337, 6.383415602836879, 4.146382843137254, 3.4365944444444443, 1.6721355113636363, 0.0), # 44
(3.286270180626598, 6.694122869318181, 5.144276494565218, 2.7627297794117642, 1.593500664893617, 0.0, 4.420024362818591, 6.374002659574468, 4.144094669117647, 3.4295176630434785, 1.6735307173295453, 0.0), # 45
(3.291786445012788, 6.6996, 5.133070289855073, 2.761112418300653, 1.5910078014184397, 0.0, 4.389013909711811, 6.364031205673759, 4.14166862745098, 3.4220468599033818, 1.6749, 0.0), # 46
(3.297188179347826, 6.704972585227273, 5.12129125905797, 2.759404861111111, 1.588378235815603, 0.0, 4.356708510328169, 6.353512943262412, 4.139107291666666, 3.4141941727053133, 1.6762431463068181, 0.0), # 47
(3.3024787404092075, 6.710239772727273, 5.108957608695651, 2.757608823529411, 1.5856148936170211, 0.0, 4.323170352323839, 6.3424595744680845, 4.136413235294117, 3.4059717391304343, 1.6775599431818182, 0.0), # 48
(3.307661484974424, 6.715400710227271, 5.096087545289855, 2.75572602124183, 1.5827207003546098, 0.0, 4.288461623354989, 6.330882801418439, 4.133589031862745, 3.3973916968599034, 1.6788501775568176, 0.0), # 49
(3.312739769820972, 6.720454545454543, 5.082699275362319, 2.7537581699346405, 1.5796985815602835, 0.0, 4.252644511077794, 6.318794326241134, 4.130637254901961, 3.388466183574879, 1.6801136363636358, 0.0), # 50
(3.317716951726343, 6.725400426136363, 5.068811005434783, 2.7517069852941174, 1.5765514627659571, 0.0, 4.215781203148426, 6.306205851063829, 4.127560477941176, 3.3792073369565214, 1.6813501065340908, 0.0), # 51
(3.322596387468031, 6.730237499999999, 5.054440942028985, 2.7495741830065357, 1.573282269503546, 0.0, 4.177933887223055, 6.293129078014184, 4.124361274509804, 3.3696272946859898, 1.6825593749999999, 0.0), # 52
(3.3273814338235295, 6.7349649147727275, 5.039607291666666, 2.7473614787581697, 1.5698939273049646, 0.0, 4.139164750957854, 6.279575709219858, 4.121042218137255, 3.359738194444444, 1.6837412286931819, 0.0), # 53
(3.332075447570333, 6.739581818181817, 5.024328260869565, 2.745070588235294, 1.5663893617021276, 0.0, 4.099535982008995, 6.2655574468085105, 4.117605882352941, 3.3495521739130427, 1.6848954545454542, 0.0), # 54
(3.336681785485933, 6.744087357954545, 5.008622056159419, 2.7427032271241827, 1.5627714982269503, 0.0, 4.05910976803265, 6.251085992907801, 4.114054840686275, 3.3390813707729463, 1.6860218394886362, 0.0), # 55
(3.341203804347826, 6.74848068181818, 4.9925068840579705, 2.740261111111111, 1.5590432624113475, 0.0, 4.017948296684991, 6.23617304964539, 4.110391666666667, 3.328337922705314, 1.687120170454545, 0.0), # 56
(3.345644860933504, 6.752760937500001, 4.976000951086956, 2.7377459558823527, 1.5552075797872338, 0.0, 3.9761137556221886, 6.220830319148935, 4.106618933823529, 3.317333967391304, 1.6881902343750002, 0.0), # 57
(3.3500083120204605, 6.756927272727271, 4.959122463768115, 2.7351594771241827, 1.5512673758865245, 0.0, 3.9336683325004165, 6.205069503546098, 4.102739215686275, 3.3060816425120767, 1.6892318181818178, 0.0), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_allighting_rate = (
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 258194110137029475889902652135037600173
#index for seed sequence child
child_seed_index = (
1, # 0
1, # 1
)
| 112.480597 | 215 | 0.727608 | 5,147 | 37,681 | 5.324655 | 0.217797 | 0.315259 | 0.24958 | 0.472889 | 0.333686 | 0.331533 | 0.33022 | 0.33022 | 0.33022 | 0.33022 | 0 | 0.817891 | 0.119795 | 37,681 | 334 | 216 | 112.817365 | 0.008412 | 0.032138 | 0 | 0.208861 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.015823 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ffaef1df8d757905e50318b99af6ce9aab766bd1 | 36,084 | py | Python | tests/core/test_Fader.py | gilbertohasnofb/auxjad | 553b7fe97221b6f378a93ade6262f024e3cbc678 | [
"MIT"
] | 6 | 2020-05-18T09:28:29.000Z | 2021-12-22T00:40:54.000Z | tests/core/test_Fader.py | gilbertohasnofb/auxjad | 553b7fe97221b6f378a93ade6262f024e3cbc678 | [
"MIT"
] | 1 | 2021-04-21T20:29:38.000Z | 2021-04-22T19:44:54.000Z | tests/core/test_Fader.py | gilbertohasnofb/auxjad | 553b7fe97221b6f378a93ade6262f024e3cbc678 | [
"MIT"
] | 1 | 2021-04-21T18:54:46.000Z | 2021-04-21T18:54:46.000Z | import random
import abjad
import pytest
import auxjad
def test_Fader_01():
random.seed(13987)
container = abjad.Container(r"c'4 ~ c'16 d'8. e'8 f'4.")
fader = auxjad.Fader(container)
assert abjad.lilypond(fader) == abjad.String.normalize(
r"""
{
%%% \time 4/4 %%%
c'4
~
c'16
d'8.
e'8
f'4.
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
~
c'16
d'8.
e'8
f'4.
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
~
c'16
r8.
e'8
f'4.
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r2
e'8
f'4.
}
"""
)
notes = fader.current_window
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r2
e'8
f'4.
}
"""
)
def test_Fader_02():
random.seed(98752)
container = abjad.Container(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(container)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
f'4
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
r4
e'4
f'4
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r2
e'4
f'4
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r2.
f'4
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
R1
}
"""
)
with pytest.raises(RuntimeError):
notes = fader() # noqa: F841
def test_Fader_03():
container = abjad.Container(r"c'4 d'2 e'4 f'2 ~ f'8 g'4.")
fader = auxjad.Fader(container,
mode='in',
max_steps=2,
repetition_chance=0.7,
disable_rewrite_meter=True,
omit_time_signatures=True,
use_multimeasure_rests=False,
mask=[1, 0, 1, 1, 0],
boundary_depth=0,
maximum_dot_count=1,
rewrite_tuplets=False,
process_on_first_call=True,
include_empty_measures=False,
)
assert fader.mode == 'in'
assert fader.max_steps == 2
assert fader.repetition_chance == 0.7
assert fader.disable_rewrite_meter
assert fader.omit_time_signatures
assert not fader.use_multimeasure_rests
assert fader.mask == [1, 0, 1, 1, 0]
assert fader.boundary_depth == 0
assert fader.maximum_dot_count == 1
assert not fader.rewrite_tuplets
assert fader.process_on_first_call
assert not fader.include_empty_measures
fader.mode = 'out'
fader.max_steps = 1
fader.repetition_chance = 0.23
fader.disable_rewrite_meter = False
fader.omit_time_signatures = False
fader.use_multimeasure_rests = True
fader.mask = [0, 1, 1, 0, 1]
fader.boundary_depth = 1
fader.maximum_dot_count = 2
fader.rewrite_tuplets = True
fader.process_on_first_call = False
fader.include_empty_measures = True
assert fader.mode == 'out'
assert fader.max_steps == 1
assert fader.repetition_chance == 0.23
assert not fader.disable_rewrite_meter
assert not fader.omit_time_signatures
assert fader.use_multimeasure_rests
assert fader.mask == [0, 1, 1, 0, 1]
assert fader.boundary_depth == 1
assert fader.maximum_dot_count == 2
assert fader.rewrite_tuplets
assert not fader.process_on_first_call
assert fader.include_empty_measures
def test_Fader_04():
random.seed(19962)
container = abjad.Container(r"c'4. d'8 e'2")
fader = auxjad.Fader(container)
notes = fader.output_all()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4.
d'8
e'2
r4.
d'8
e'2
r2
e'2
R1
}
"""
)
def test_Fader_05():
random.seed(98738)
container = abjad.Container(r"c'4. d'8 e'2")
fader = auxjad.Fader(container,
mode='in',
)
notes = fader.output_all()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
R1
r4.
d'8
r2
c'4.
d'8
r2
c'4.
d'8
e'2
}
"""
)
def test_Fader_06():
random.seed(13241)
container = abjad.Container(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(container)
notes = fader.__next__()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
f'4
}
"""
)
notes = fader.__next__()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
r4
f'4
}
"""
)
notes = fader.__next__()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
r2
}
"""
)
fader.mode = 'in'
notes = fader.__next__()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
r4
f'4
}
"""
)
notes = fader.__next__()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
f'4
}
"""
)
fader.mask = [0, 0, 1, 1]
notes = fader.__next__()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r2
e'4
f'4
}
"""
)
notes = fader.__next__()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r4
d'4
e'4
f'4
}
"""
)
def test_Fader_07():
random.seed(44126)
container = abjad.Container(r"\times 2/3 {c'8 d'8 e'8} d'2.")
fader = auxjad.Fader(container)
notes = fader.output_all()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\times 2/3
{
\time 4/4
c'8
d'8
e'8
}
d'2.
\times 2/3
{
r8
d'8
e'8
}
d'2.
\times 2/3
{
r8
d'8
r8
}
d'2.
r4
d'2.
R1
}
"""
)
def test_Fader_08():
random.seed(88111)
container = abjad.Container(r"c'4. d'8 e'16 f'16 g'4.")
fader = auxjad.Fader(container)
notes = fader.output_n(3)
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4.
d'8
e'16
f'16
g'4.
c'4.
r8
e'16
f'16
g'4.
c'4.
r8
e'16
f'16
r4.
}
"""
)
def test_Fader_09():
random.seed(14812)
container = abjad.Container(
r"\time 3/8 c'4. \time 2/4 d'2 \time 3/8 e'4."
)
fader = auxjad.Fader(container)
notes = fader.output_n(3)
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 3/8
c'4.
\time 2/4
d'2
\time 3/8
e'4.
c'4.
\time 2/4
R1 * 1/2
\time 3/8
e'4.
c'4.
\time 2/4
R1 * 1/2
\time 3/8
R1 * 3/8
}
"""
)
def test_Fader_10():
random.seed(29862)
container = abjad.Container(r"c'8 d'8 e'8 f'8 g'8 a'8 b'8 c''8")
fader = auxjad.Fader(container,
max_steps=3,
process_on_first_call=True,
)
notes = fader.output_n(3)
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'8
d'8
r8
f'8
g'8
a'8
b'8
c''8
r4.
f'8
g'8
a'8
b'8
c''8
r4.
f'8
r8
a'8
b'8
r8
}
"""
)
def test_Fader_11():
random.seed(18711)
container = abjad.Container(r"c'8 d'8 e'2.")
fader = auxjad.Fader(container,
disable_rewrite_meter=True,
use_multimeasure_rests=False,
)
notes = fader.output_all()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'8
d'8
e'2.
c'8
r8
e'2.
r8
r8
e'2.
r8
r8
r2.
}
"""
)
def test_Fader_12():
random.seed(87123)
container = abjad.Container(r"\time 2/4 c'4 d'4 \time 3/4 e'4 f'4 g'4")
fader = auxjad.Fader(container,
omit_time_signatures=True,
)
notes = fader.output_n(3)
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
c'4
d'4
e'4
f'4
g'4
c'4
d'4
e'4
f'4
r4
c'4
d'4
e'4
r2
}
"""
)
def test_Fader_13():
random.seed(47103)
container = abjad.Container(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(container,
process_on_first_call=True,
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
r4
}
"""
)
def test_Fader_14():
random.seed(19941)
container = abjad.Container(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(container,
mode='in',
mask=[0, 1, 1, 0]
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r4
d'4
e'4
r4
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
r4
}
"""
)
fader.reset_mask()
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
R1
}
"""
)
fader.mode = 'out'
fader.reset_mask()
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
f'4
}
"""
)
def test_Fader_15():
random.seed(71324)
container = abjad.Container(
r"\time 3/4 c'8->\f d'8\p ~ d'4 e'8..-- f'32-."
)
fader = auxjad.Fader(container)
notes = fader.output_all()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 3/4
c'8
\f
- \accent
d'4.
\p
e'8..
- \tenuto
f'32
- \staccato
c'8
\f
- \accent
d'4.
\p
r8..
f'32
- \staccato
c'8
\f
- \accent
d'4.
\p
r4
c'8
\f
- \accent
r8
r2
R1 * 3/4
}
"""
)
def test_Fader_16():
random.seed(91634)
container = abjad.Container(r"c'4 ~ c'16 d'8. e'8 f'4.")
fader = auxjad.Fader(container,
mode='in',
)
assert abjad.lilypond(fader) == abjad.String.normalize(
r"""
{
%%% \time 4/4 %%%
c'4
~
c'16
d'8.
e'8
f'4.
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
R1
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r2
r8
f'4.
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
~
c'16
r8.
r8
f'4.
}
"""
)
notes = fader.current_window
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
~
c'16
r8.
r8
f'4.
}
"""
)
def test_Fader_17():
container = abjad.Container(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(container)
assert len(fader) == 4
container = abjad.Container(r"c'4 ~ c'8 d'8 e'4 ~ e'8 f'8")
fader = auxjad.Fader(container)
assert len(fader) == 4
container = abjad.Container(r"c'4 ~ c'16 r16 d'8 e'4 ~ e'8 f'16 r16")
fader = auxjad.Fader(container)
assert len(fader) == 4
container = abjad.Container(r"<c' e' g'>2 <d' f'>2")
fader = auxjad.Fader(container)
assert len(fader) == 5
container = abjad.Container(r"<c' e' g'>4 ~ <c' e' g'>16 r8. <d' f'>2")
fader = auxjad.Fader(container)
assert len(fader) == 5
container = abjad.Container(r"<c' e' g'>4 d'4 <e' g' b'>4 r4")
fader = auxjad.Fader(container)
assert len(fader) == 7
def test_Fader_18():
random.seed(66501)
container = abjad.Container(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(container)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
f'4
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r4
d'4
e'4
f'4
}
"""
)
fader.contents = abjad.Container(r"c'16 d'16 e'16 f'16 g'2.")
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'16
d'16
e'16
f'16
g'2.
}
"""
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'16
d'16
r16
f'16
g'2.
}
"""
)
def test_Fader_19():
random.seed(48915)
container = abjad.Container(r"c'4 d'8 e'8 f'4 ~ f'8. g'16")
fader = auxjad.Fader(container)
assert fader.mask == [1, 1, 1, 1, 1]
fader = auxjad.Fader(container,
mode='in',
)
assert fader.mask == [0, 0, 0, 0, 0]
fader()
assert fader.mask == [0, 0, 0, 0, 0]
fader()
assert fader.mask == [0, 1, 0, 0, 0]
fader()
assert fader.mask == [0, 1, 1, 0, 0]
staff = abjad.Staff(fader.current_window)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r4
d'8
e'8
r2
}
"""
)
fader.mask = [1, 0, 1, 1, 0]
assert fader.mask == [1, 0, 1, 1, 0]
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
r8
e'8
f'4..
r16
}
"""
)
fader.reset_mask()
assert fader.mask == [0, 0, 0, 0, 0]
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
R1
}
"""
)
def test_Fader_20():
container = abjad.Container(r"c'4. d'8 e'2")
fader = auxjad.Fader(container)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4.
d'8
e'2
}
"""
)
fader = auxjad.Fader(container,
boundary_depth=1,
)
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
~
c'8
d'8
e'2
}
"""
)
def test_Fader_22():
random.seed(92114)
container = abjad.Container(r"c'8 d'8 e'8 f'8 g'8 a'8 b'8 c''8")
fader = auxjad.Fader(container)
fader.random_mask()
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r8
d'8
r4
g'8
a'8
r4
}
"""
)
fader.random_mask()
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r8
d'8
r4
g'8
a'8
b'8
r8
}
"""
)
def test_Fader_23():
random.seed(36017)
container = abjad.Container(r"c'8 d'8 e'8 f'8 g'8 a'8 b'8 c''8")
fader = auxjad.Fader(container,
mask=[0, 0, 1, 1, 1, 1, 1, 1],
)
fader.shuffle_mask()
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r8
d'8
e'8
f'8
g'8
a'8
b'8
r8
}
"""
)
fader.shuffle_mask()
notes = fader()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'8
d'8
e'8
r8
g'8
r8
b'8
c''8
}
"""
)
def test_Fader_24():
random.seed(83012)
container = abjad.Container(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(container)
staff = abjad.Staff()
for window in fader:
staff.append(window)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
f'4
\time 4/4
c'4
r4
e'4
f'4
\time 4/4
c'4
r4
e'4
r4
\time 4/4
c'4
r2.
\time 4/4
R1
}
"""
)
auxjad.mutate.remove_repeated_time_signatures(staff[:])
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
f'4
c'4
r4
e'4
f'4
c'4
r4
e'4
r4
c'4
r2.
R1
}
"""
)
def test_Fader_25():
random.seed(19873)
container = abjad.Container(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(container, max_steps=3)
staff = abjad.Staff()
for window in fader:
staff.append(window)
auxjad.mutate.remove_repeated_time_signatures(staff[:])
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'4
f'4
c'4
r2.
R1
}
"""
)
def test_Fader_26():
container = abjad.Container(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(container)
assert isinstance(fader(), abjad.Selection)
tuplet = abjad.Tuplet('3:2', r"c'2 d'2 e'2")
fader = auxjad.Fader(tuplet)
assert isinstance(fader(), abjad.Selection)
voice = abjad.Voice(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(voice)
assert isinstance(fader(), abjad.Selection)
staff = abjad.Staff(r"c'4 d'4 e'4 f'4")
fader = auxjad.Fader(staff)
assert isinstance(fader(), abjad.Selection)
score = abjad.Score([abjad.Staff(r"c'4 d'4 e'4 f'4")])
fader = auxjad.Fader(score)
assert isinstance(fader(), abjad.Selection)
voice = abjad.Voice(r"c'4 d'4 e'4 f'4")
staff = abjad.Staff([voice])
fader = auxjad.Fader(staff)
assert isinstance(fader(), abjad.Selection)
staff = abjad.Staff(r"c'4 d'4 e'4 f'4")
score = abjad.Score([staff])
fader = auxjad.Fader(score)
assert isinstance(fader(), abjad.Selection)
voice1 = abjad.Voice(r"c'4 d'4 e'4 f'4")
voice2 = abjad.Voice(r"g2 f2")
staff = abjad.Staff([voice1, voice2], simultaneous=True)
with pytest.raises(ValueError):
fader = auxjad.Fader(staff) # noqa: F841
staff1 = abjad.Staff(r"c'4 d'4 e'4 f'4")
staff2 = abjad.Staff(r"g2 f2")
score = abjad.Score([staff1, staff2])
with pytest.raises(ValueError):
fader = auxjad.Fader(score) # noqa: F841
def test_Fader_27():
random.seed(41888)
container = abjad.Container(
r"\times 2/3 {c'2(\p\< d'2 e'2\f} f'4\p\> g'2 a'4\pp)"
)
fader = auxjad.Fader(container)
notes = fader.output_n(5)
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\times 2/3
{
\time 4/4
c'2
\p
\<
(
d'2
e'2
\f
}
f'4
\p
\>
g'2
a'4
\pp
)
\times 2/3
{
c'2
\p
\<
(
d'2
e'2
\f
)
}
r4
g'2
\p
\>
(
a'4
\pp
)
\times 2/3
{
r2
d'2
\p
\<
(
e'2
\f
)
}
r4
g'2
\p
\>
(
a'4
\pp
)
\times 2/3
{
r2
d'2
\p
\<
r2
\f
}
r4
g'2
\p
\>
(
a'4
\pp
)
R1
r4
g'2
\p
\>
(
a'4
\pp
)
}
"""
)
def test_Fader_28():
random.seed(17613)
container = abjad.Container(
r"<c' e'>4 ~ <c' e'>16 d'8. <gs e'>8 <bf f' a'>8 ~ <bf f' a'>4"
)
fader = auxjad.Fader(container)
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
<c' e'>4
~
<c' e'>16
d'8.
<gs e'>8
<bf f' a'>4.
<c' e'>4
~
<c' e'>16
d'8.
gs8
<bf f' a'>4.
<c' e'>4
~
<c' e'>16
d'8.
gs8
<bf a'>4.
c'4
~
c'16
d'8.
gs8
<bf a'>4.
r4
r16
d'8.
gs8
<bf a'>4.
r4
r16
d'8.
gs8
bf4.
r2
gs8
bf4.
r2
r8
bf4.
R1
}
"""
)
def test_Fader_29():
container = abjad.Container(r"c'2 <d' e' f' g'>2")
fader = auxjad.Fader(container, mask=[1, 0, 1, 1, 0])
staff = abjad.Staff(fader())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'2
<e' f'>2
}
"""
)
def test_Fader_30():
random.seed(39761)
container = abjad.Container([
auxjad.ArtificialHarmonic(r"<c' f'>2"),
abjad.Chord(r"<c' f'>2"),
])
fader = auxjad.Fader(container, mode='out')
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
<
c'
\tweak style #'harmonic
f'
>2
<c' f'>2
<
c'
\tweak style #'harmonic
f'
>2
f'2
<
c'
\tweak style #'harmonic
f'
>2
r2
R1
}
"""
)
def test_Fader_31():
random.seed(76132)
container = abjad.Container(r"c'4 d'4 e'2")
fader = auxjad.Fader(container,
mode='out',
process_on_first_call=False,
include_empty_measures=True,
)
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'2
r4
d'4
e'2
r2
e'2
R1
}
"""
)
random.seed(76132)
container = abjad.Container(r"c'4 d'4 e'2")
fader = auxjad.Fader(container,
mode='out',
process_on_first_call=True,
include_empty_measures=True,
)
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r4
d'4
e'2
r2
e'2
R1
}
"""
)
random.seed(76132)
container = abjad.Container(r"c'4 d'4 e'2")
fader = auxjad.Fader(container,
mode='out',
process_on_first_call=False,
include_empty_measures=False,
)
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
d'4
e'2
r4
d'4
e'2
r2
e'2
}
"""
)
random.seed(76132)
container = abjad.Container(r"c'4 d'4 e'2")
fader = auxjad.Fader(container,
mode='out',
process_on_first_call=True,
include_empty_measures=False,
)
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
r4
d'4
e'2
r2
e'2
}
"""
)
def test_Fader_32():
random.seed(76132)
container = abjad.Container(r"c'4 d'4 e'2")
fader = auxjad.Fader(container,
mode='in',
process_on_first_call=False,
include_empty_measures=True,
)
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
R1
c'4
r2.
c'4
d'4
r2
c'4
d'4
e'2
}
"""
)
random.seed(76132)
container = abjad.Container(r"c'4 d'4 e'2")
fader = auxjad.Fader(container,
mode='in',
process_on_first_call=True,
include_empty_measures=True,
)
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
r2.
c'4
d'4
r2
c'4
d'4
e'2
}
"""
)
random.seed(76132)
container = abjad.Container(r"c'4 d'4 e'2")
fader = auxjad.Fader(container,
mode='in',
process_on_first_call=False,
include_empty_measures=False,
)
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
r2.
c'4
d'4
r2
c'4
d'4
e'2
}
"""
)
random.seed(76132)
container = abjad.Container(r"c'4 d'4 e'2")
fader = auxjad.Fader(container,
mode='in',
process_on_first_call=True,
include_empty_measures=False,
)
staff = abjad.Staff(fader.output_all())
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4
r2.
c'4
d'4
r2
c'4
d'4
e'2
}
"""
)
def test_Fader_33():
random.seed(85909)
container = abjad.Container(r"c'4. d'8 e'4.. f'16")
fader = auxjad.Fader(container,
repetition_chance=0.5,
)
notes = fader.output_n(5)
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
c'4.
d'8
e'4..
f'16
c'4.
d'8
e'4..
r16
c'4.
d'8
e'4..
r16
c'4.
d'8
r2
c'4.
d'8
r2
}
"""
)
def test_Fader_34():
random.seed(53234)
container = abjad.Container(r"\time 4/4 c'2( d'2 \time 3/4 e'2.)")
fader = auxjad.Fader(container, mode='in')
notes = fader.output_all()
staff = abjad.Staff(notes)
assert abjad.lilypond(staff) == abjad.String.normalize(
r"""
\new Staff
{
\time 4/4
R1
\time 3/4
R1 * 3/4
\time 4/4
c'2
r2
)
\time 3/4
R1 * 3/4
\time 4/4
c'2
(
d'2
)
\time 3/4
R1 * 3/4
\time 4/4
c'2
(
d'2
\time 3/4
e'2.
)
}
"""
)
| 21.803021 | 75 | 0.400676 | 4,039 | 36,084 | 3.516217 | 0.044318 | 0.092241 | 0.029996 | 0.097592 | 0.865301 | 0.809182 | 0.792142 | 0.755527 | 0.734756 | 0.704901 | 0 | 0.072504 | 0.486282 | 36,084 | 1,654 | 76 | 21.816203 | 0.69364 | 0.000887 | 0 | 0.522137 | 0 | 0.016794 | 0.056999 | 0 | 0 | 0 | 0 | 0 | 0.167939 | 1 | 0.050382 | false | 0 | 0.006107 | 0 | 0.056489 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
4402e4b94a45d73f6b950eaa033937f4894bda85 | 48 | py | Python | gradient/transaction/__init__.py | organizejs/gradient | 7a1da1ed768e767a6d6a797b71088ee9b8c828eb | [
"MIT"
] | 1 | 2017-07-19T15:02:24.000Z | 2017-07-19T15:02:24.000Z | gradient/transaction/__init__.py | organizejs/gradient | 7a1da1ed768e767a6d6a797b71088ee9b8c828eb | [
"MIT"
] | 15 | 2017-07-19T15:15:38.000Z | 2021-06-01T23:57:19.000Z | gradient/transaction/__init__.py | organizejs/gradient | 7a1da1ed768e767a6d6a797b71088ee9b8c828eb | [
"MIT"
] | null | null | null | from .models import Transaction, GradientPrice
| 16 | 46 | 0.833333 | 5 | 48 | 8 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 48 | 2 | 47 | 24 | 0.952381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
440c18e672c4e58504e21792057481076fca72ac | 33 | py | Python | vcardtool/__init__.py | jakeogh/vcardtool | e5b3b528e077b8872911a1f9e64031ef5a01d6b5 | [
"Unlicense"
] | null | null | null | vcardtool/__init__.py | jakeogh/vcardtool | e5b3b528e077b8872911a1f9e64031ef5a01d6b5 | [
"Unlicense"
] | null | null | null | vcardtool/__init__.py | jakeogh/vcardtool | e5b3b528e077b8872911a1f9e64031ef5a01d6b5 | [
"Unlicense"
] | null | null | null | from .vcardtool import vcf_split
| 16.5 | 32 | 0.848485 | 5 | 33 | 5.4 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 33 | 1 | 33 | 33 | 0.931034 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
445e139538562465a45b11659ee91f49f11d1a03 | 64 | py | Python | tests/test_bootstrap.py | onigiri-team/core | 27754e0379203e770dd6c9b998971c049b87608f | [
"Apache-2.0"
] | 9 | 2021-12-20T00:06:37.000Z | 2021-12-26T21:52:34.000Z | tests/test_bootstrap.py | onigiri-team/core | 27754e0379203e770dd6c9b998971c049b87608f | [
"Apache-2.0"
] | 1 | 2021-12-26T13:24:08.000Z | 2021-12-27T12:23:25.000Z | tests/test_bootstrap.py | onigiri-team/core | 27754e0379203e770dd6c9b998971c049b87608f | [
"Apache-2.0"
] | null | null | null | def test_pseudo_bootstrap():
from onigiri import app, loop
| 16 | 33 | 0.75 | 9 | 64 | 5.111111 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.1875 | 64 | 3 | 34 | 21.333333 | 0.884615 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | true | 0 | 0.5 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
44889fdef6d340473ea4f8c4d0318e4c76f32455 | 91 | py | Python | python_basics/count.py | alok8765/basic_python_practicse | 9bd61f0b03fc1e703a75df39862a24692bb3fdb7 | [
"MIT"
] | null | null | null | python_basics/count.py | alok8765/basic_python_practicse | 9bd61f0b03fc1e703a75df39862a24692bb3fdb7 | [
"MIT"
] | null | null | null | python_basics/count.py | alok8765/basic_python_practicse | 9bd61f0b03fc1e703a75df39862a24692bb3fdb7 | [
"MIT"
] | null | null | null | student_grade = [10.0, 8.8 , 9.0, 10.0, 1.5, 6, 10.0, 5.9]
print(student_grade.count(10.0)) | 45.5 | 58 | 0.626374 | 23 | 91 | 2.391304 | 0.478261 | 0.218182 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.2625 | 0.120879 | 91 | 2 | 59 | 45.5 | 0.425 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0.5 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 6 |
2b8fa0109c02aec234d37f6385e7dae802bd65cc | 192 | py | Python | pip_services3_rpc/test/__init__.py | pip-services-python/pip-services-rpc-python | 53454b7ac4197fb9cfe8676f0654cac1ca6d5722 | [
"MIT"
] | null | null | null | pip_services3_rpc/test/__init__.py | pip-services-python/pip-services-rpc-python | 53454b7ac4197fb9cfe8676f0654cac1ca6d5722 | [
"MIT"
] | null | null | null | pip_services3_rpc/test/__init__.py | pip-services-python/pip-services-rpc-python | 53454b7ac4197fb9cfe8676f0654cac1ca6d5722 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
__all__ = ['TestRestClient', 'TestCommandableHttpClient']
from .TestCommandableHttpClient import TestCommandableHttpClient
from .TestRestClient import TestRestClient
| 27.428571 | 64 | 0.802083 | 14 | 192 | 10.714286 | 0.571429 | 0.386667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.00578 | 0.098958 | 192 | 6 | 65 | 32 | 0.861272 | 0.109375 | 0 | 0 | 0 | 0 | 0.230769 | 0.147929 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0 | 1 | 0 | 1 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
2bbe7b528c21fc2d17521314811b8e4bcff9f758 | 4,329 | py | Python | test/api_rest/test_client.py | JohnnyPeng18/memsource-wrap | 5f7059be9555f77e515f0bec131809f034c71f3a | [
"MIT"
] | 9 | 2016-02-12T00:32:02.000Z | 2021-10-11T10:16:05.000Z | test/api_rest/test_client.py | JohnnyPeng18/memsource-wrap | 5f7059be9555f77e515f0bec131809f034c71f3a | [
"MIT"
] | 42 | 2015-01-07T07:31:14.000Z | 2019-12-10T05:32:51.000Z | test/api_rest/test_client.py | JohnnyPeng18/memsource-wrap | 5f7059be9555f77e515f0bec131809f034c71f3a | [
"MIT"
] | 9 | 2016-06-29T16:56:58.000Z | 2021-11-26T02:33:17.000Z | import requests
import unittest
from unittest.mock import patch
from memsource import models
from memsource.api_rest.client import Client
class TestClient(unittest.TestCase):
@patch.object(requests.Session, "request")
def test_create(self, mock_request: unittest.mock):
ms_response = unittest.mock.MagicMock(status_code=200)
ms_response.json.return_value = {
"id": "mock-id"
}
mock_request.return_value = ms_response
response = Client().create("mock-test")
self.assertEqual(response, "mock-id")
@patch.object(requests.Session, "request")
def test_get(self, mock_request: unittest.mock):
ms_response = unittest.mock.MagicMock(status_code=200)
ms_response.json.return_value = {
"name": "1",
"netRateScheme": None,
"priceList": None,
"displayNoteInProject": False,
"note": None,
"id": "1",
"externalId": None,
"createdBy": {
"email": "mock-tm@gengo.com",
"userName": "mock-tm",
"uid": "1234",
"lastName": "mock-last-name",
"id": "1",
"firstName": "mock-first-name",
"role": "ADMIN"
},
}
mock_request.return_value = ms_response
response = Client().get(1)
expected = {
"id": "1",
"note": None,
"priceList": None,
"displayNoteInProject": False,
"name": "1",
"createdBy": {
"id": "1",
"email": "mock-tm@gengo.com",
"uid": "1234",
"firstName": "mock-first-name",
"lastName": "mock-last-name",
"userName": "mock-tm", "role": "ADMIN"
},
"netRateScheme": None,
"externalId": None
}
self.assertEqual(response, expected)
self.assertIsInstance(response, models.Client)
@patch.object(requests.Session, "request")
def test_list(self, mock_request: unittest.mock):
ms_response = unittest.mock.MagicMock(status_code=200)
ms_response.json.return_value = {
"totalPages": 1,
"numberOfElements": 1,
"totalElements": 1,
"pageSize": 50,
"pageNumber": 0,
"content": [{
"name": "1",
"netRateScheme": None,
"priceList": None,
"displayNoteInProject": False,
"note": None,
"id": "1",
"externalId": None,
"createdBy": {
"email": "mock-tm@gengo.com",
"userName": "mock-tm",
"uid": "1234",
"lastName": "mock-last-name",
"id": "1",
"firstName": "mock-first-name",
"role": "ADMIN"
}
}]
}
mock_request.return_value = ms_response
response = Client(token="mock-token").list()
expected = [{
"id": "1",
"note": None,
"priceList": None,
"displayNoteInProject": False,
"name": "1",
"createdBy": {
"id": "1",
"email": "mock-tm@gengo.com",
"uid": "1234",
"firstName": "mock-first-name",
"lastName": "mock-last-name",
"userName": "mock-tm", "role": "ADMIN"
},
"netRateScheme": None,
"externalId": None
}]
self.assertListEqual(response, expected)
self.assertIsInstance(response[0], models.Client)
@patch.object(requests.Session, "request")
def test_list_none(self, mock_request: unittest.mock):
ms_response = unittest.mock.MagicMock(status_code=200)
ms_response.json.return_value = {
"totalPages": 0,
"numberOfElements": 0,
"totalElements": 0,
"pageSize": 50,
"pageNumber": 0,
"content": []
}
mock_request.return_value = ms_response
response = Client(token="mock-token").list()
self.assertListEqual(response, [])
| 33.3 | 62 | 0.487179 | 376 | 4,329 | 5.507979 | 0.183511 | 0.057943 | 0.036697 | 0.050217 | 0.838242 | 0.768711 | 0.768711 | 0.730082 | 0.707871 | 0.707871 | 0 | 0.019978 | 0.375606 | 4,329 | 129 | 63 | 33.55814 | 0.746208 | 0 | 0 | 0.683333 | 0 | 0 | 0.208131 | 0 | 0 | 0 | 0 | 0 | 0.05 | 1 | 0.033333 | false | 0 | 0.041667 | 0 | 0.083333 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
2bef622629fcebf524738691b35031de2f95848e | 24,529 | py | Python | code/data/casedata/case59_1.py | thanever/DID | 018d901ec8a4d47645c83ab1807ed2e345829ad7 | [
"MIT"
] | null | null | null | code/data/casedata/case59_1.py | thanever/DID | 018d901ec8a4d47645c83ab1807ed2e345829ad7 | [
"MIT"
] | null | null | null | code/data/casedata/case59_1.py | thanever/DID | 018d901ec8a4d47645c83ab1807ed2e345829ad7 | [
"MIT"
] | 1 | 2021-10-03T04:14:48.000Z | 2021-10-03T04:14:48.000Z | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Power flow data for IEEE 14 bus test case.
"""
from numpy import array
def case59_1():
"""Power flow data for IEEE 14 bus test case.
Please see L{caseformat} for details on the case file format.
This data was converted from IEEE Common Data Format
(ieee14cdf.txt) on 20-Sep-2004 by cdf2matp, rev. 1.11
Converted from IEEE CDF file from:
U{http://www.ee.washington.edu/research/pstca/}
08/19/93 UW ARCHIVE 100.0 1962 W IEEE 14 Bus Test Case
@return: Power flow data for IEEE 14 bus test case.
"""
ppc = {"version": '2'}
##----- Power Flow Data -----##
## system MVA base
ppc["baseMVA"] = 100.0
## bus data
# bus_i type Pd Qd Gs Bs area Vm Va baseKV zone Vmax Vmin
ppc["bus"] = array([
[1 , 3, 0, 0, 0, 0, 1, 1, 0, 15, 1, 1.1, 0.9, 0.01 , 0.01 ],
[2 , 1, 450, 45, 0, 0, 1, 1.03895, -1.4021, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[3 , 2, 0, 0, 0, 0, 2, 1, 48.9004, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[4 , 2, 0, 0, 0, 0, 2, 1, 37.8999, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[5 , 2, 0, 0, 0, 0, 2, 1, 32.241, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[6 , 2, 0, 0, 0, 0, 2, 1, 39.211, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[7 , 2, 390, 39+68.262, 0, 0, 2, 1.055, 44.0174, 330, 1, 1.1, 0.9, 0.01 , 0.01 ],
[8 , 1, 130, 13, 0, 0, 2, 1.0472, 41.4466, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[9 , 1, 1880, 188, 0, 0, 2, 1.0221, 27.6908, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[10 , 1, 210, 21, 0, 0, 2, 1.03244, 26.2505, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[11 , 1, 0, 0, 0, 0, 2, 1.03793, 30.4145, 330, 1, 1.1, 0.9, 0 , 0 ],
[12 , 1, 0, 0, 0, 0, 2, 1.05939, 26.6789, 500, 1, 1.1, 0.9, 0 , 0 ],
[13 , 1, 1700, 170, 0, 0, 2, 1.00806, 18.8693, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[14 , 1, 1660, 166, 0, 400, 2, 1.00839, 19.1254, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[15 , 1, 0, 0, 0, 0, 2, 1.04263, 22.6683, 500, 1, 1.1, 0.9, 0 , 0 ],
[16 , 1, 0, 0, 0, 0, 2, 1.02565, 18.7505, 330, 1, 1.1, 0.9, 0 , 0 ],
[17 , 1, 480, 48, 0, 0, 2, 1.04329, 33.114, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[18 , 1, 1840, 184, 0, 300, 2, 1.01299, 16.0964, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[19 , 1, 1260, 126, 0, 0, 2, 1.00207, 9.3905, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[20 , 2, 0, 0, 0, 0, 3, 1, -3.3932, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[21 , 2, 0, 0, 0, 0, 3, 1, -18.0204, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[22 , 1, 0, 0, 0, 0, 3, 1.0417, -10.8515, 500, 1, 1.1, 0.9, 0 , 0 ],
[23 , 1, 0, 0, 0, 0, 3, 1.00933, -21.7495, 500, 1, 1.1, 0.9, 0 , 0 ],
[24 , 1, 0, 0, 0, 0, 3, 1.0164, -22.7619, 500, 1, 1.1, 0.9, 0 , 0 ],
[25 , 1, 1230, 123, 0, 0, 3, 1.01598, -24.9219, 500, 1, 1.1, 0.9, 0 , 0.01 ],
[26 , 1, 650, 65, 0, 0, 3, 1.01823, -24.9732, 500, 1, 1.1, 0.9, 0 , 0.01 ],
[27 , 1, 655, 66, 0, 0, 3, 1.03586, -35.4136, 500, 1, 1.1, 0.9, 0 , 0.01 ],
[28 , 1, 195, 20, 0, 0, 3, 1.02913, -9.3431, 330, 1, 1.1, 0.9, 0 , 0.01 ],
[29 , 1, 0, 0, 0, 0, 3, 1.01981, -24.8071, 330, 1, 1.1, 0.9, 0 , 0 ],
[30 , 1, 0, 0, 0, 0, 3, 1.01358, -17.6649, 330, 1, 1.1, 0.9, 0 , 0 ],
[31 , 1, 115, 12, 0, 0, 3, 1.0383, -23.5946, 220, 1, 1.1, 0.9, 0 , 0.01 ],
[32 , 2, 2405, 240-71.399, 0, 0, 3, 1.015, -30.2295, 220, 1, 1.1, 0.9, 0.01 , 0.01 ],
[33 , 1, 250, 25, 0, 0, 3, 1.01578, -28.5167, 220, 1, 1.1, 0.9, 0 , 0.01 ],
[34 , 1, 0, 0, 0, 0, 3, 1.03763, -39.0132, 275, 1, 1.1, 0.9, 0 , 0 ],
[35 , 2, 0, 0, 0, 0, 4, 1, 74.3354, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[36 , 2, 0, 0, 0, 0, 4, 1, 107.9391, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[37 , 2, 0, 0, 0, 0, 4, 1, 113.3369, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[38 , 2, 0, 0, 0, 0, 4, 1, 106.526, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[39 , 1, 990, 99, 0, 0, 4, 1.03118, 99.5376, 275, 1, 1.1, 0.9, 0 , 0.01 ],
[40 , 1, 740, 74, 0, 0, 4, 1.03417, 104.7857, 275, 1, 1.1, 0.9, 0 , 0.01 ],
[41 , 1, 0, 0, 0, 0, 4, 1.03927, 107.1131, 275, 1, 1.1, 0.9, 0 , 0 ],
[42 , 1, 150, 15, 0, 0, 4, 1.03014, 100.3798, 275, 1, 1.1, 0.9, 0 , 0.01 ],
[43 , 1, 260, 26, 0, 60, 4, 0.98553, 76.613, 275, 1, 1.1, 0.9, 0 , 0.01 ],
[44 , 1, 530, 53, 0, 0, 4, 1.03012, 68.1448, 275, 1, 1.1, 0.9, 0 , 0.01 ],
[45 , 1, 575, 58, 0, 30, 4, 0.99305, 62.2465, 275, 1, 1.1, 0.9, 0 , 0.01 ],
[46 , 2, 1255, 126-58.162, 0, 0, 4, 1, 60.9735, 275, 1, 1.1, 0.9, 0.01 , 0.01 ],
[47 , 1, 0, 0, 0, 0, 4, 1.03981, 60.9511, 275, 1, 1.1, 0.9, 0 , 0 ],
[48 , 1, 0, 0, 0, -30, 4, 1.04183, 60.1987, 330, 1, 1.1, 0.9, 0 , 0 ],
[49 , 1, 0, 0, 0, -60, 4, 1.04738, 56.657, 330, 1, 1.1, 0.9, 0 , 0 ],
[50 , 1, 0, 0, 0, -60, 4, 1.05524, 50.2682, 330, 1, 1.1, 0.9, 0 , 0 ],
[51 , 2, 0, 0, 0, 0, 5, 1, -55.315, 20, 1, 1.1, 0.9, 0.01 , 0.01 ],
[52 , 2, 0, 0, 0, 0, 5, 1, -53.9517, 15, 1, 1.1, 0.9, 0.01 , 0.01 ],
[53 , 2, 0, 0, 0, 0, 5, 1, -56.283, 15, 1, 1.1, 0.9, 0.01 , 0.01 ],
[54 , 1, 300, 60, 0, 0, 5, 1.04785, -63.3086, 275, 1, 1.1, 0.9, 0 , 0.01 ],
[55 , 1, 0, 0, 0, 0, 5, 1.02206, -60.8729, 275, 1, 1.1, 0.9, 0 , 0 ],
[56 , 1, 0, 0, 0, 0, 5, 1.02043, -62.1823, 275, 1, 1.1, 0.9, 0 , 0 ],
[57 , 2, 1000, 200-22.648, 0, 0, 5, 1.015, -63.4538, 275, 1, 1.1, 0.9, 0.01 , 0.01 ],
[58 , 1, 800, 160, 0, 0, 5, 1.01043, -64.6602, 275, 1, 1.1, 0.9, 0 , 0.01 ],
[59 , 2, 200, 40-10.554, 0, 0, 5, 1.03, -45.7446, 275, 1, 1.1, 0.9, 0.01 , 0.01 ]
])
## generator data
# bus, Pg, Qg, Qmax, Qmin, Vg, mBase, status, Pmax, Pmin, Pc1, Pc2,
# Qc1min, Qc1max, Qc2min, Qc2max, ramp_agc, ramp_10, ramp_30, ramp_q, apf # p_g of 3 to 8 is all change from 0 to 40
ppc["gen"] = array([
[1 , 300.808, 311.463, 581.128, -581.128, 1, 1333.2, 1, 1200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[3 , 3600, 573.64, 1743.648, -1743.648, 1, 4000.2, 1, 3600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[4 , 2500, 663.381, 1210.9, -1210.9, 1, 2778, 1, 2500, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[5 , 1500, 531.183, 968.72, -968.72, 1, 2222.4, 1, 2000, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[6 , 2950.2, 734.155, 1743.648, -1743.648, 1, 4000.2, 1, 3600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[20, 4200, 996.438, 2034.256, -2034.256, 1, 4666.9, 1, 4200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[21, 939.9, 154.576, 581.127, -581.127, 1, 1333.2, 1, 1200, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[35, 1400, 514.88, 774.836, -774.836, 1, 1777.6, 1, 1600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[36, 837, 177.852, 435.846, -435.846, 1, 999.9, 1, 900, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[37, 1400, 209.191, 774.836, -774.836, 1, 1777.6, 1, 1600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[38, 1549.8, 326.804, 871.692, -871.692, 1, 1999.8, 1, 1800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[51, 600, 50.693, 290.564, -290.564, 1, 666.6, 1, 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[52, 800, 160.267, 600, -600, 1, 1000, 1, 800, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[53, 436, 100.855, 290.652, -290.652, 1, 666.8, 1, 600, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
])
## branch data
# fbus, tbus, r, x, b, rateA, rateB, rateC, ratio, angle, status, angmin, angmax
ppc["branch"] = array([
[2 , 19 , 0, 0.0667, 0.817, 0, 0, 0, 0, 0, 1, -360, 360],
[2 , 19 , 0, 0.0667, 0.817, 0, 0, 0, 0, 0, 1, -360, 360],
[2 , 19 , 0, 0.062, 0.76, 0, 0, 0, 0, 0, 1, -360, 360],
[2 , 19 , 0, 0.062, 0.76, 0, 0, 0, 0, 0, 1, -360, 360],
[2 , 28 , 0, 0.0356, 0.437, 0, 0, 0, 0, 0, 1, -360, 360],
[2 , 28 , 0, 0.0356, 0.437, 0, 0, 0, 0, 0, 1, -360, 360],
[2 , 28 , 0, 0.0868, 0.76, 0, 0, 0, 0, 0, 1, -360, 360],
[7 , 8 , 0, 0.076, 0.931, 0, 0, 0, 0, 0, 1, -360, 360],
[7 , 8 , 0, 0.076, 0.931, 0, 0, 0, 0, 0, 1, -360, 360],
[7 , 50 , 0, 0.046, 0.73, 0, 0, 0, 0, 0, 1, -360, 360],
[7 , 50 , 0, 0.046, 0.73, 0, 0, 0, 0, 0, 1, -360, 360],
[8 , 9 , 0, 0.0356, 0.437, 0, 0, 0, 0, 0, 1, -360, 360],
[8 , 9 , 0, 0.0356, 0.437, 0, 0, 0, 0, 0, 1, -360, 360],
[8 , 14 , 0, 0.0527, 0.646, 0, 0, 0, 0, 0, 1, -360, 360],
[8 , 14 , 0, 0.0527, 0.646, 0, 0, 0, 0, 0, 1, -360, 360],
[8 , 17 , 0, 0.0527, 0.646, 0, 0, 0, 0, 0, 1, -360, 360],
[8 , 17 , 0, 0.0527, 0.646, 0, 0, 0, 0, 0, 1, -360, 360],
[9 , 10 , 0, 0.014, 0.171, 0, 0, 0, 0, 0, 1, -360, 360],
[9 , 10 , 0, 0.014, 0.171, 0, 0, 0, 0, 0, 1, -360, 360],
[9 , 11 , 0, 0.0062, 0.076, 0, 0, 0, 0, 0, 1, -360, 360],
[10 , 13 , 0, 0.0248, 0.304, 0, 0, 0, 0, 0, 1, -360, 360],
[10 , 13 , 0, 0.0248, 0.304, 0, 0, 0, 0, 0, 1, -360, 360],
[10 , 13 , 0, 0.0248, 0.304, 0, 0, 0, 0, 0, 1, -360, 360],
[11 , 14 , 0, 0.0356, 0.437, 0, 0, 0, 0, 0, 1, -360, 360],
[12 , 15 , 0, 0.0145, 1.54, 0, 0, 0, 0, 0, 1, -360, 360],
[12 , 15 , 0, 0.0145, 1.54, 0, 0, 0, 0, 0, 1, -360, 360],
[13 , 14 , 0, 0.0108, 0.133, 0, 0, 0, 0, 0, 1, -360, 360],
[13 , 14 , 0, 0.0108, 0.133, 0, 0, 0, 0, 0, 1, -360, 360],
[13 , 16 , 0, 0.0155, 0.19, 0, 0, 0, 0, 0, 1, -360, 360],
[14 , 19 , 0, 0.0558, 0.684, 0, 0, 0, 0, 0, 1, -360, 360],
[16 , 18 , 0, 0.0077, 0.095, 0, 0, 0, 0, 0, 1, -360, 360],
[16 , 19 , 0, 0.0388, 0.475, 0, 0, 0, 0, 0, 1, -360, 360],
[17 , 18 , 0, 0.0403, 0.494, 0, 0, 0, 0, 0, 1, -360, 360],
[17 , 18 , 0, 0.0403, 0.494, 0, 0, 0, 0, 0, 1, -360, 360],
[17 , 19 , 0, 0.0574, 0.703, 0, 0, 0, 0, 0, 1, -360, 360],
[17 , 19 , 0, 0.0574, 0.703, 0, 0, 0, 0, 0, 1, -360, 360],
[18 , 19 , 0, 0.0403, 0.494, 0, 0, 0, 0, 0, 1, -360, 360],
[22 , 23 , 0, 0.028, 0.74, 0, 0, 0, 0, 0, 1, -360, 360],
[22 , 23 , 0, 0.028, 0.74, 0, 0, 0, 0, 0, 1, -360, 360],
[22 , 24 , 0, 0.016, 1.7, 0, 0, 0, 0, 0, 1, -360, 360],
[22 , 24 , 0, 0.016, 1.7, 0, 0, 0, 0, 0, 1, -360, 360],
[23 , 24 , 0, 0.004, 0.424, 0, 0, 0, 0, 0, 1, -360, 360],
[24 , 25 , 0, 0.003, 0.32, 0, 0, 0, 0, 0, 1, -360, 360],
[24 , 26 , 0, 0.0045, 0.447, 0, 0, 0, 0, 0, 1, -360, 360],
[24 , 26 , 0, 0.0045, 0.447, 0, 0, 0, 0, 0, 1, -360, 360],
[25 , 26 , 0, 0.0012, 0.127, 0, 0, 0, 0, 0, 1, -360, 360],
[26 , 27 , 0, 0.0325, 3.445, 0, 0, 0, 0, 0, 1, -360, 360],
[26 , 27 , 0, 0.0325, 3.445, 0, 0, 0, 0, 0, 1, -360, 360],
[28 , 29 , 0, 0.10695, 0.58267, 0, 0, 0, 0, 0, 1, -360, 360],
[28 , 29 , 0, 0.10695, 0.58267, 0, 0, 0, 0, 0, 1, -360, 360],
[28 , 29 , 0, 0.10695, 0.58267, 0, 0, 0, 0, 0, 1, -360, 360],
[29 , 30 , 0, -0.0337, 0, 0, 0, 0, 0, 0, 1, -360, 360],
[29 , 30 , 0, -0.0337, 0, 0, 0, 0, 0, 0, 1, -360, 360],
[31 , 32 , 0, 0.045, 0.3, 0, 0, 0, 0, 0, 1, -360, 360],
[31 , 32 , 0, 0.045, 0.3, 0, 0, 0, 0, 0, 1, -360, 360],
[31 , 32 , 0, 0.045, 0.3, 0, 0, 0, 0, 0, 1, -360, 360],
[32 , 33 , 0, 0.01, 0.26, 0, 0, 0, 0, 0, 1, -360, 360],
[32 , 33 , 0, 0.01, 0.26, 0, 0, 0, 0, 0, 1, -360, 360],
[34 , 59 , 0, 0.05, 0.19, 0, 0, 0, 0, 0, 1, -360, 360],
[34 , 59 , 0, 0.05, 0.19, 0, 0, 0, 0, 0, 1, -360, 360],
[39 , 40 , 0, 0.0475, 0.381, 0, 0, 0, 0, 0, 1, -360, 360],
[39 , 40 , 0, 0.0475, 0.381, 0, 0, 0, 0, 0, 1, -360, 360],
[39 , 42 , 0, 0.05, 0.189, 0, 0, 0, 0, 0, 1, -360, 360],
[39 , 43 , 0, 0.122, 0.79, 0, 0, 0, 0, 0, 1, -360, 360],
[39 , 43 , 0, 0.122, 0.79, 0, 0, 0, 0, 0, 1, -360, 360],
[39 , 43 , 0, 0.122, 0.79, 0, 0, 0, 0, 0, 1, -360, 360],
[40 , 41 , 0, 0.0076, 0.062, 0, 0, 0, 0, 0, 1, -360, 360],
[40 , 41 , 0, 0.0076, 0.062, 0, 0, 0, 0, 0, 1, -360, 360],
[41 , 42 , 0, 0.0513, 0.412, 0, 0, 0, 0, 0, 1, -360, 360],
[42 , 44 , 0, 0.192, 0.67333, 0, 0, 0, 0, 0, 1, -360, 360],
[42 , 44 , 0, 0.192, 0.67333, 0, 0, 0, 0, 0, 1, -360, 360],
[42 , 44 , 0, 0.192, 0.67333, 0, 0, 0, 0, 0, 1, -360, 360],
[43 , 45 , 0, 0.0709, 0.46, 0, 0, 0, 0, 0, 1, -360, 360],
[43 , 45 , 0, 0.0709, 0.46, 0, 0, 0, 0, 0, 1, -360, 360],
[44 , 45 , 0, 0.0532, 0.427, 0, 0, 0, 0, 0, 1, -360, 360],
[44 , 46 , 0, 0.0532, 0.427, 0, 0, 0, 0, 0, 1, -360, 360],
[44 , 46 , 0, 0.0532, 0.427, 0, 0, 0, 0, 0, 1, -360, 360],
[44 , 46 , 0, 0.0532, 0.427, 0, 0, 0, 0, 0, 1, -360, 360],
[44 , 46 , 0, 0.0532, 0.427, 0, 0, 0, 0, 0, 1, -360, 360],
[44 , 47 , 0, 0.0494, 0.4, 0, 0, 0, 0, 0, 1, -360, 360],
[44 , 47 , 0, 0.0494, 0.4, 0, 0, 0, 0, 0, 1, -360, 360],
[45 , 46 , 0, 0.0152, 0.122, 0, 0, 0, 0, 0, 1, -360, 360],
[45 , 46 , 0, 0.0152, 0.122, 0, 0, 0, 0, 0, 1, -360, 360],
[48 , 49 , 0, 0.025, 0.39, 0, 0, 0, 0, 0, 1, -360, 360],
[48 , 49 , 0, 0.025, 0.39, 0, 0, 0, 0, 0, 1, -360, 360],
[49 , 50 , 0, 0.046, 0.73, 0, 0, 0, 0, 0, 1, -360, 360],
[49 , 50 , 0, 0.046, 0.73, 0, 0, 0, 0, 0, 1, -360, 360],
[54 , 57 , 0, 0.15, 0.56, 0, 0, 0, 0, 0, 1, -360, 360],
[54 , 57 , 0, 0.15, 0.56, 0, 0, 0, 0, 0, 1, -360, 360],
[54 , 58 , 0, 0.019, 0.87, 0, 0, 0, 0, 0, 1, -360, 360],
[54 , 58 , 0, 0.019, 0.87, 0, 0, 0, 0, 0, 1, -360, 360],
[55 , 57 , 0, 0.017, 0.03, 0, 0, 0, 0, 0, 1, -360, 360],
[55 , 57 , 0, 0.017, 0.03, 0, 0, 0, 0, 0, 1, -360, 360],
[55 , 58 , 0, 0.028, 0.17, 0, 0, 0, 0, 0, 1, -360, 360],
[56 , 57 , 0, 0.017, 0.03, 0, 0, 0, 0, 0, 1, -360, 360],
[56 , 57 , 0, 0.017, 0.03, 0, 0, 0, 0, 0, 1, -360, 360],
[56 , 58 , 0, 0.028, 0.14, 0, 0, 0, 0, 0, 1, -360, 360],
[57 , 58 , 0, 0.019, 0.09, 0, 0, 0, 0, 0, 1, -360, 360],
[57 , 59 , 0, 0.66, 0.3, 0, 0, 0, 0, 0, 1, -360, 360],
[57 , 59 , 0, 0.66, 0.3, 0, 0, 0, 0, 0, 1, -360, 360],
[57 , 59 , 0, 0.66, 0.3, 0, 0, 0, 0, 0, 1, -360, 360],
[57 , 59 , 0, 0.66, 0.3, 0, 0, 0, 0, 0, 1, -360, 360],
[57 , 59 , 0, 0.66, 0.3, 0, 0, 0, 0, 0, 1, -360, 360],
[57 , 59 , 0, 0.66, 0.3, 0, 0, 0, 0, 0, 1, -360, 360],
[1 , 2 , 0, 0.009, 0, 0, 0, 0, 0.939, 0, 1, -360, 360],
[3 , 8 , 0, 0.004, 0, 0, 0, 0, 0.9434, 0, 1, -360, 360],
[4 , 11 , 0, 0.00576, 0, 0, 0, 0, 0.939, 0, 1, -360, 360],
[5 , 10 , 0, 0.00765, 0, 0, 0, 0, 0.939, 0, 1, -360, 360],
[6 , 17 , 0, 0.004, 0, 0, 0, 0, 0.939, 0, 1, -360, 360],
[11 , 12 , 0, 0.0272, 0, 0, 0, 0, 0.9756, 0, 1, -360, 360],
[11 , 12 , 0, 0.0272, 0, 0, 0, 0, 0.9756, 0, 1, -360, 360],
[11 , 12 , 0, 0.0272, 0, 0, 0, 0, 0.9756, 0, 1, -360, 360],
[11 , 12 , 0, 0.0272, 0, 0, 0, 0, 0.9756, 0, 1, -360, 360],
[15 , 16 , 0, 0.0272, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[15 , 16 , 0, 0.0272, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[15 , 16 , 0, 0.0272, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[15 , 16 , 0, 0.0272, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[20 , 22 , 0, 0.00343, 0, 0, 0, 0, 0.939, 0, 1, -360, 360],
[21 , 31 , 0, 0.01127, 0, 0, 0, 0, 0.9524, 0, 1, -360, 360],
[23 , 32 , 0, 0.032, 0, 0, 0, 0, 0.9615, 0, 1, -360, 360],
[23 , 32 , 0, 0.032, 0, 0, 0, 0, 0.9615, 0, 1, -360, 360],
[24 , 30 , 0, 0.036, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[24 , 30 , 0, 0.036, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[24 , 30 , 0, 0.036, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[24 , 33 , 0, 0.024, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[24 , 33 , 0, 0.024, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[27 , 34 , 0, 0.027, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[27 , 34 , 0, 0.027, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[35 , 44 , 0, 0.00845, 0, 0, 0, 0, 0.939, 0, 1, -360, 360],
[36 , 42 , 0, 0.017, 0, 0, 0, 0, 0.9524, 0, 1, -360, 360],
[37 , 41 , 0, 0.00845, 0, 0, 0, 0, 0.9524, 0, 1, -360, 360],
[38 , 39 , 0, 0.0085, 0, 0, 0, 0, 0.9524, 0, 1, -360, 360],
[47 , 48 , 0, 0.008, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[47 , 48 , 0, 0.008, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[47 , 48 , 0, 0.008, 0, 0, 0, 0, 1, 0, 1, -360, 360],
[51 , 54 , 0, 0.0255, 0, 0, 0, 0, 0.9524, 0, 1, -360, 360],
[52 , 55 , 0, 0.016, 0, 0, 0, 0, 0.9622, 0, 1, -360, 360],
[53 , 56 , 0, 0.025, 0, 0, 0, 0, 0.9622, 0, 1, -360, 360]
])
##----- Generator bus control data -----##
# type of generator or inverter, min_m, max_m, min_d, max_d, min_p (p.u.), max_p (p.u.)
# type of generator or inverter: 9 - conventional generator, 0 - inverter with no optimize, 1 - inverter optimizing d, 2 - inverter optimizing m, 3 - inverters optimizing d and m
ppc["gencontrol"] = array([
[ 1 , 3 , 0.00382 , 0.381972 , 0.038197 , 3.819719 , -36.0 , 36.0 ],
[ 3 , 3 , 0.011459 , 1.145916 , 0.114592 , 11.459156 , -108.0 , 108.0 ],
[ 4 , 3 , 0.007958 , 0.795775 , 0.079577 , 7.957747 , -75.0 , 75.0 ],
[ 5 , 3 , 0.006366 , 0.63662 , 0.063662 , 6.366198 , -60.0 , 60.0 ],
[ 6 , 3 , 0.011459 , 1.145916 , 0.114592 , 11.459156 , -108.0 , 108.0 ],
[ 20 , 3 , 0.013369 , 1.336902 , 0.13369 , 13.369015 , -126.0 , 126.0 ],
[ 21 , 3 , 0.00382 , 0.381972 , 0.038197 , 3.819719 , -36.0 , 36.0 ],
[ 35 , 3 , 0.005093 , 0.509296 , 0.05093 , 5.092958 , -48.0 , 48.0 ],
[ 36 , 3 , 0.002865 , 0.286479 , 0.028648 , 2.864789 , -27.0 , 27.0 ],
[ 37 , 3 , 0.005093 , 0.509296 , 0.05093 , 5.092958 , -48.0 , 48.0 ],
[ 38 , 3 , 0.00573 , 0.572958 , 0.057296 , 5.729578 , -54.0 , 54.0 ],
[ 51 , 3 , 0.00191 , 0.190986 , 0.019099 , 1.909859 , -18.0 , 18.0 ],
[ 52 , 3 , 0.002546 , 0.254648 , 0.025465 , 2.546479 , -24.0 , 24.0 ],
[ 53 , 3 , 0.00191 , 0.190986 , 0.019099 , 1.909859 , -18.0 , 18.0 ]
])
###----- disturbances data -----###
#1 - power-step: num, buses, start time, amplitude(\times p_0)
#2 - power ramp: num, buses, start time, duration time, height (\times p_0)
#3 - power fluctuation: num, buses, start time, time interval, date num
#4 - 3psc: num, branch-f_bus, branch-t_bus, nearest bus, short-circuit conductance (p.u.), start time, clearing time(\Delta t with second)
#9: uniform distribution date on [-0.2, 0.2]
ppc["disturbance"] = {
1: array([
[1, 5, 0, -0.5, 0.15],
[2, 2, 0, -0.5, 0.09]
]),
2: array([
[1, 21, 0, 5, -0.5, 0.09],
[2, 58, 0, 5, -0.5, 0.15]
]),
3: array([
[1, 38, 0, 0.5, 9, 0.6],
[2, 35, 0, 0.5, 9, 0.3]
]),
4: array([
[1, 44, 45, 999, 999, 0, 0.1, 0.01],
[2, 14, 19, 999, 999, 0, 0.1, 0.1]
]),
9: array([
-0.077752022,-0.049592684,-0.094386402,-0.027777255,0.106175442,0.07760974,0.010639525,0.145379902,-0.113145199,-0.173299214,0.027856593,-0.153232617,-0.123096728,-0.077041254,-0.152101278,-0.059589093,-0.06009897,-0.121105119,-0.017018885,0.072363903,0.170954442,-0.034889518,-0.060918945,0.037836957,0.170201299,-0.1546673,0.1972234,-0.071938968,-0.107488659,-0.088976472,-0.068018895,-0.06587186,-0.003419552,0.152372651,0.112508103,0.142640044,-0.049963844,-0.149540361,0.139890352,0.13228229,-0.075472623,0.055259011,-0.017222513,-0.13241881,0.012423058,-0.000117756,0.191749308,-0.080003032,-0.166717849,-0.149633579,-0.166748818,-0.179088528,0.199144351,-0.101607438,-0.105415065,0.149580196,-0.005620803,0.089868514,0.022076414,-0.094829629,0.111238813,0.133720447,0.121662029,0.141913883,-0.111726178,-0.14110605,0.032269891,0.120886645,0.009050625,-0.011489962,0.016302734,0.12436742,0.11313339,-0.092537767,0.147695992,0.174444751,0.15505781,-0.193334631,0.159925609,-0.099949322,0.099644356,0.079428698,-0.048152161,0.06028194,0.126261189,0.15150098,-0.147034132,-0.058805963,-0.094758118,0.051548502,0.020517378,-0.195080454,0.092211274,0.089238641,-0.091390137,-0.088318354,0.030346984,0.13823391,-0.160389818,-0.160731705
])
}
# parameters of discretization
# time_ele_d1 - number of time elements for disturbance 1;
# time_ele_d2_d - number of time element during the disturbance for disturbance 2;
# t_f - assume t_0 = 0 for all disturbances
# order - order of collocation
ppc["param_disc"] = {
'time_ele':{1: 20, 2: 20, 3: 20, 4: 20},
'time_ele_d':{2: 4, 4: 4},
'order':{1: 3, 2: 3, 3: 3, 4: 3},
't_f':{1: 30, 2: 30, 3: 30, 4: 30},
'colloc_point_radau': {1:(0, 1.0),2:(0, 0.333333, 1.0),3:(0, 0.155051, 0.644949, 1.0),4:(0, 0.088588, 0.409467, 0.787659, 1.0),5:(0, 0.057104, 0.276843, 0.583590, 0.860240, 1.0)}
}
ppc["freq_band"] = {
1:{(0, 15):(49.5, 50.5), (15, 300):(49.85, 50.15)},
2:{(0, 15):(49.5, 50.5), (15, 300):(49.85, 50.15)},
3:{(0, 300):(49.85, 50.15)},
4:{(0, 15):(49, 51), (15, 60):(49.5, 50.5), (60, 300):(49.85, 50.15)}
}
return ppc
#2039 | 74.330303 | 1,244 | 0.384361 | 4,572 | 24,529 | 2.055118 | 0.157699 | 0.212218 | 0.19189 | 0.177948 | 0.523095 | 0.506492 | 0.504364 | 0.481907 | 0.460728 | 0.412303 | 0 | 0.533211 | 0.400342 | 24,529 | 330 | 1,245 | 74.330303 | 0.105582 | 0.080191 | 0 | 0.426471 | 0 | 0 | 0.004939 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.003676 | false | 0 | 0.003676 | 0 | 0.011029 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
920ba23079f0f3d20e5a1592ef731f8004780f30 | 146 | py | Python | htmlx/geom/__init__.py | byteface/htmlx | 1d6b8b55dda4c42c818170515e05ac1b8c5f2274 | [
"MIT"
] | 3 | 2022-02-10T20:15:53.000Z | 2022-02-10T22:41:44.000Z | htmlx/geom/__init__.py | byteface/htmlx | 1d6b8b55dda4c42c818170515e05ac1b8c5f2274 | [
"MIT"
] | 5 | 2022-02-09T11:11:18.000Z | 2022-02-09T11:16:09.000Z | htmlx/geom/__init__.py | byteface/htmlx | 1d6b8b55dda4c42c818170515e05ac1b8c5f2274 | [
"MIT"
] | null | null | null | """
htmlx.geom
====================================
"""
import math
from htmlx.geom.vec2 import vec2
# from htmlx.geom.vec3 import vec3
| 14.6 | 40 | 0.5 | 16 | 146 | 4.5625 | 0.4375 | 0.369863 | 0.356164 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.033058 | 0.171233 | 146 | 9 | 41 | 16.222222 | 0.570248 | 0.554795 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
921ddf7a5c315bae069848b659889109b7187106 | 178 | py | Python | tests/test_utils/test_to_num.py | natanfeitosa/pyfunctools | b5354e0d737542b03049eb3e347d6ca1ccceb164 | [
"MIT"
] | 4 | 2021-11-17T15:26:11.000Z | 2022-03-12T01:30:55.000Z | tests/test_utils/test_to_num.py | natanfeitosa/pyfunctools | b5354e0d737542b03049eb3e347d6ca1ccceb164 | [
"MIT"
] | null | null | null | tests/test_utils/test_to_num.py | natanfeitosa/pyfunctools | b5354e0d737542b03049eb3e347d6ca1ccceb164 | [
"MIT"
] | null | null | null | from pyfunctools.utils import to_num
def test_to_num():
assert to_num('.2') == 0.2
assert to_num('0.2') == 0.2
assert to_num('2') == 2
assert to_num('-2') == -2
| 22.25 | 36 | 0.589888 | 33 | 178 | 2.969697 | 0.333333 | 0.306122 | 0.44898 | 0.367347 | 0.438776 | 0.438776 | 0 | 0 | 0 | 0 | 0 | 0.079137 | 0.219101 | 178 | 7 | 37 | 25.428571 | 0.625899 | 0 | 0 | 0 | 0 | 0 | 0.044944 | 0 | 0 | 0 | 0 | 0 | 0.666667 | 1 | 0.166667 | true | 0 | 0.166667 | 0 | 0.333333 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
a66407e6686112f208e657479cb8584b8d837226 | 15,018 | py | Python | webapp/tests/forms/steps/lotse/test_steuerminderungen.py | digitalservice4germany/steuerlotse | ef3e094e4d7d4768431a50ac4be60672cd03221d | [
"MIT"
] | 20 | 2021-07-02T07:49:08.000Z | 2022-03-18T22:26:10.000Z | webapp/tests/forms/steps/lotse/test_steuerminderungen.py | digitalservice4germany/steuerlotse | ef3e094e4d7d4768431a50ac4be60672cd03221d | [
"MIT"
] | 555 | 2021-06-28T15:35:15.000Z | 2022-03-31T11:51:55.000Z | webapp/tests/forms/steps/lotse/test_steuerminderungen.py | digitalservice4germany/steuerlotse | ef3e094e4d7d4768431a50ac4be60672cd03221d | [
"MIT"
] | 1 | 2021-07-04T20:34:12.000Z | 2021-07-04T20:34:12.000Z | from unittest.mock import patch
import pytest
from pydantic import ValidationError
from werkzeug.datastructures import MultiDict
from app.forms.steps.lotse.steuerminderungen import StepHaushaltsnaheHandwerker, StepGemeinsamerHaushalt, \
StepSelectStmind, ShowHandwerkerPrecondition, NotShowPersonBPrecondition, HandwerkerHaushaltsnaheSetPrecondition, \
StepVorsorge, StepAussergBela, StepReligion, StepSpenden, ShowReligionPrecondition, ShowSpendenPrecondition, \
ShowVorsorgePrecondition, ShowAussergBelaPrecondition
from app.forms.steps.lotse_multistep_flow_steps.personal_data_steps import StepFamilienstand
@pytest.fixture
def step_haushaltsnahe_handwerker():
step = StepHaushaltsnaheHandwerker(endpoint='lotse')
return step
@pytest.fixture
def step_gem_haushalt():
step = StepGemeinsamerHaushalt(endpoint='lotse')
return step
# PRECONDITIONS
class TestShowVorsorgePrecondition:
def test_if_vorsorge_not_set_then_raise_validation_error(self):
data = {}
with pytest.raises(ValidationError):
ShowVorsorgePrecondition.parse_obj(data)
def test_if_vorsorge_set_false_then_raise_validation_error(self):
data = {'stmind_select_vorsorge': False}
with pytest.raises(ValidationError):
ShowVorsorgePrecondition.parse_obj(data)
def test_if_vorsorge_set_true_then_do_not_raise_validation_error(self):
data = {'stmind_select_vorsorge': True}
try:
ShowVorsorgePrecondition.parse_obj(data)
except ValidationError:
pytest.fail("Should not raise a validation error")
class TestShowAussergBelaPrecondition:
def test_if_ausserg_bela_not_set_then_raise_validation_error(self):
data = {}
with pytest.raises(ValidationError):
ShowAussergBelaPrecondition.parse_obj(data)
def test_if_ausserg_bela_set_false_then_raise_validation_error(self):
data = {'stmind_select_ausserg_bela': False}
with pytest.raises(ValidationError):
ShowAussergBelaPrecondition.parse_obj(data)
def test_if_ausserg_bela_set_true_then_do_not_raise_validation_error(self):
data = {'stmind_select_ausserg_bela': True}
try:
ShowAussergBelaPrecondition.parse_obj(data)
except ValidationError:
pytest.fail("Should not raise a validation error")
class TestShowHandwerkerPrecondition:
def test_if_handwerker_not_set_then_raise_validation_error(self):
data = {}
with pytest.raises(ValidationError):
ShowHandwerkerPrecondition.parse_obj(data)
def test_if_handwerker_set_false_then_raise_validation_error(self):
data = {'stmind_select_handwerker': False}
with pytest.raises(ValidationError):
ShowHandwerkerPrecondition.parse_obj(data)
def test_if_handwerker_set_true_then_do_not_raise_validation_error(self):
data = {'stmind_select_handwerker': True}
try:
ShowHandwerkerPrecondition.parse_obj(data)
except ValidationError:
pytest.fail("Should not raise a validation error")
class TestShowSpendenPrecondition:
def test_if_spenden_not_set_then_raise_validation_error(self):
data = {}
with pytest.raises(ValidationError):
ShowSpendenPrecondition.parse_obj(data)
def test_if_spenden_set_false_then_raise_validation_error(self):
data = {'stmind_select_spenden': False}
with pytest.raises(ValidationError):
ShowSpendenPrecondition.parse_obj(data)
def test_if_spenden_set_true_then_do_not_raise_validation_error(self):
data = {'stmind_select_spenden': True}
try:
ShowSpendenPrecondition.parse_obj(data)
except ValidationError:
pytest.fail("Should not raise a validation error")
class TestShowReligionPrecondition:
def test_if_religion_not_set_then_raise_validation_error(self):
data = {}
with pytest.raises(ValidationError):
ShowReligionPrecondition.parse_obj(data)
def test_if_religion_set_false_then_raise_validation_error(self):
data = {'stmind_select_religion': False}
with pytest.raises(ValidationError):
ShowReligionPrecondition.parse_obj(data)
def test_if_religion_set_true_then_do_not_raise_validation_error(self):
data = {'stmind_select_religion': True}
try:
ShowReligionPrecondition.parse_obj(data)
except ValidationError:
pytest.fail("Should not raise a validation error")
class TestNotShowPersonBPrecondition:
def test_if_show_person_b_true_then_raise_validation_error(self):
with patch('app.model.form_data.JointTaxesModel.show_person_b', return_value=True), \
pytest.raises(ValidationError):
NotShowPersonBPrecondition.parse_obj({'familienstand': 'single'})
def test_if_show_person_b_false_then_do_not_raise_validation_error(self):
try:
with patch('app.model.form_data.JointTaxesModel.show_person_b', return_value=False):
NotShowPersonBPrecondition.parse_obj({'familienstand': 'single'})
except ValidationError:
pytest.fail("Should not raise a validation error")
class TestHandwerkerHaushaltsnaheSetPrecondition:
def test_if_haushaltsnahe_and_handwerker_not_set_then_raise_validation_error(self):
data = {}
with pytest.raises(ValidationError):
HandwerkerHaushaltsnaheSetPrecondition.parse_obj(data)
def test_if_haushaltsnahe_summe_set_then_do_not_raise_validation_error(self):
data = {'stmind_haushaltsnahe_summe': 30.0}
try:
HandwerkerHaushaltsnaheSetPrecondition.parse_obj(data)
except ValidationError:
pytest.fail("Should not raise a validation error")
def test_if_handwerker_summe_set_then_do_not_raise_validation_error(self):
data = {'stmind_handwerker_summe': 30.0}
try:
HandwerkerHaushaltsnaheSetPrecondition.parse_obj(data)
except ValidationError:
pytest.fail("Should not raise a validation error")
# STEPS
@pytest.mark.usefixtures('test_request_context')
class TestHaushaltsnaheStepHaushaltsnahe:
def test_if_no_fields_given_then_succ_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is True
def test_if_entries_but_no_summe_given_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_haushaltsnahe_entries': ['One']})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_summe_given_but_no_entries_given_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_haushaltsnahe_summe': "3"})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_summe_is_zero_then_entries_are_optional(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_haushaltsnahe_summe': "0"})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is True
def test_if_entries_are_empty_then_summe_is_optional(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_haushaltsnahe_entries': ['']})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is True
def test_if_entries_given_but_summe_zero_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_haushaltsnahe_entries': ['One'],
'stmind_haushaltsnahe_summe': "0"})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_summe_given_but_entries_empty_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_haushaltsnahe_entries': [''],
'stmind_haushaltsnahe_summe': "3"})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_entries_and_summe_given_then_succ_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_haushaltsnahe_entries': ['One'],
'stmind_haushaltsnahe_summe': "3"})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is True
@pytest.mark.usefixtures('test_request_context')
class TestHaushaltsnaheStepHandwerker:
def test_if_summe_zero_then_entries_and_lohn_etc_are_optional(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_summe': '0'})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is True
def test_if_no_entries_given_then_summe_and_lohn_etc_are_optional(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_entries': []})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is True
def test_if_lohn_etc_zero_then_entries_and_summe_are_optional(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_lohn_etc_summe': '0'})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is True
def test_if_summe_given_but_no_entries_and_no_lohn_etc_given_then_fail_validation(self,
step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_summe': '42'})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_entries_and_no_summe_and_no_lohn_etc_given_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_entries': ['One']})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_lohn_etc_and_no_entries_and_no_summe_given_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_lohn_etc_summe': '3'})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_entries_and_summe_and_no_lohn_etc_given_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_summe': '3',
'stmind_handwerker_entries': ['One']})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_summe_and_lohn_etc_given_but_no_entries_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_summe': '42',
'stmind_handwerker_lohn_etc_summe': '3'})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_lohn_etc_and_entries_and_no_summe_given_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_entries': ['Item'],
'stmind_handwerker_lohn_etc_summe': '3'})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_lohn_etc_and_entries_given_but_summe_zero_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_summe': '0',
'stmind_handwerker_entries': ['Item'],
'stmind_handwerker_lohn_etc_summe': '3'})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_lohn_etc_zero_and_entries_and_summe_given_then_fail_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_summe': '3',
'stmind_handwerker_entries': ['Item'],
'stmind_handwerker_lohn_etc_summe': '0'})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is False
def test_if_summe_and_entries_and_lohn_etc_given_then_succ_validation(self, step_haushaltsnahe_handwerker):
data = MultiDict({'stmind_handwerker_summe': '42',
'stmind_handwerker_entries': ['Item'],
'stmind_handwerker_lohn_etc_summe': '3'})
form = step_haushaltsnahe_handwerker.InputForm(formdata=data)
assert form.validate() is True
@pytest.mark.usefixtures('test_request_context')
class TestGemeinsamerHaushaltStep:
def test_if_no_fields_given_then_fields_are_optional(self, step_gem_haushalt):
data = MultiDict({})
form = step_gem_haushalt.InputForm(formdata=data)
assert form.validate() is True
def test_if_entries_empty_then_count_is_optional(self, step_gem_haushalt):
data = MultiDict({'stmind_gem_haushalt_entries': ['']})
form = step_gem_haushalt.InputForm(formdata=data)
assert form.validate() is True
def test_if_count_zero_then_entries_are_optional(self, step_gem_haushalt):
data = MultiDict({'stmind_gem_haushalt_count': '0'})
form = step_gem_haushalt.InputForm(formdata=data)
assert form.validate() is True
def test_if_count_and_no_entries_given_then_fail_validation(self, step_gem_haushalt):
data = MultiDict({'stmind_gem_haushalt_count': '3'})
form = step_gem_haushalt.InputForm(formdata=data)
assert form.validate() is False
def test_if_entries_and_no_count_given_then_fail_validation(self, step_gem_haushalt):
data = MultiDict({'stmind_gem_haushalt_entries': ['One']})
form = step_gem_haushalt.InputForm(formdata=data)
assert form.validate() is False
def test_if_entries_given_but_count_zero_then_fail_validation(self, step_gem_haushalt):
data = MultiDict({'stmind_gem_haushalt_entries': ['One'],
'stmind_gem_haushalt_count': '0'})
form = step_gem_haushalt.InputForm(formdata=data)
assert form.validate() is False
def test_if_count_given_but_entries_empty_then_fail_validation(self, step_gem_haushalt):
data = MultiDict({'stmind_gem_haushalt_entries': [''],
'stmind_gem_haushalt_count': '3'})
form = step_gem_haushalt.InputForm(formdata=data)
assert form.validate() is False
def test_if_entries_and_count_given_then_succ_validation(self, step_gem_haushalt):
data = MultiDict({'stmind_gem_haushalt_entries': ['One'],
'stmind_gem_haushalt_count': '3'})
form = step_gem_haushalt.InputForm(formdata=data)
assert form.validate() is True
| 46.639752 | 119 | 0.729525 | 1,689 | 15,018 | 6.044997 | 0.072824 | 0.032909 | 0.042311 | 0.074045 | 0.845544 | 0.822723 | 0.812831 | 0.798139 | 0.783252 | 0.76523 | 0 | 0.002723 | 0.193102 | 15,018 | 321 | 120 | 46.785047 | 0.839825 | 0.001265 | 0 | 0.570866 | 0 | 0 | 0.128168 | 0.097826 | 0 | 0 | 0 | 0 | 0.110236 | 1 | 0.19685 | false | 0 | 0.023622 | 0 | 0.267717 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
a697b1b160e69cb2c59aff79ac384edf932ed307 | 5,516 | py | Python | tests/test_views.py | MichielBijland/django-healthchecks | 8d709ce2451999bc61f742a850463f9228f80342 | [
"MIT"
] | null | null | null | tests/test_views.py | MichielBijland/django-healthchecks | 8d709ce2451999bc61f742a850463f9228f80342 | [
"MIT"
] | 76 | 2020-02-18T05:06:36.000Z | 2021-07-30T04:39:18.000Z | tests/test_views.py | MichielBijland/django-healthchecks | 8d709ce2451999bc61f742a850463f9228f80342 | [
"MIT"
] | null | null | null | import json
from collections import OrderedDict
import pytest
import requests_mock
from django.http import Http404
from django_healthchecks import views
def check_int():
return 2
def check_float():
return 1.5
def test_index_view(rf, settings):
settings.HEALTH_CHECKS = {
'database': 'django_healthchecks.contrib.check_dummy_true',
'redis': 'django_healthchecks.contrib.check_dummy_false',
}
request = rf.get('/')
view = views.HealthCheckView.as_view()
result = view(request)
data = json.loads(result.content.decode(result.charset))
assert data == {
'database': True,
'redis': False,
}
assert result.has_header('Etag')
request = rf.get('/', HTTP_IF_NONE_MATCH=result['ETag'])
result = view(request)
assert result.status_code == 304
def test_service_view_bool(rf, settings):
settings.HEALTH_CHECKS = OrderedDict([
('redis', 'django_healthchecks.contrib.check_dummy_false'),
('database', 'django_healthchecks.contrib.check_dummy_true'),
])
request = rf.get('/')
view = views.HealthCheckServiceView.as_view()
result = view(request, service='database')
assert result.status_code == 200
assert result.content == b'true'
assert result.has_header('Etag')
request = rf.get('/', HTTP_IF_NONE_MATCH=result['ETag'])
result = view(request, service='database')
assert result.status_code == 304
def test_service_view_bytes(rf, settings):
# This tests the serilization contraints
settings.HEALTH_CHECKS = OrderedDict([
('ip', 'django_healthchecks.contrib.check_remote_addr'),
])
request = rf.get('/')
view = views.HealthCheckServiceView.as_view()
result = view(request, service='ip')
assert result.status_code == 200
assert result.content == b'127.0.0.1'
assert result.has_header('Etag')
request = rf.get('/', HTTP_IF_NONE_MATCH=result['ETag'])
result = view(request, service='ip')
assert result.status_code == 304
def test_service_view_int(rf, settings):
# This tests the serilization contraints
settings.HEALTH_CHECKS = OrderedDict([
('val', check_int),
])
request = rf.get('/')
view = views.HealthCheckServiceView.as_view()
result = view(request, service='val')
assert result.status_code == 200
assert result['Content-Type'] == 'application/json'
assert result.content == b'2'
assert result.has_header('Etag')
def test_service_view_float(rf, settings):
# This tests the serilization contraints
settings.HEALTH_CHECKS = OrderedDict([
('val', check_float),
])
request = rf.get('/')
view = views.HealthCheckServiceView.as_view()
result = view(request, service='val')
assert result.status_code == 200
assert result['Content-Type'] == 'application/json'
assert result.content == b'1.5'
assert result.has_header('Etag')
def test_service_view_remote(rf, settings):
settings.HEALTH_CHECKS = {
'remote_service': 'https://test.com/api/healthchecks/',
}
with requests_mock.Mocker() as mock:
mock.get(
'https://test.com/api/healthchecks/',
json={"cache_default": True})
request = rf.get('/')
view = views.HealthCheckServiceView.as_view()
result = view(request, service='remote_service')
expected = {'cache_default': True}
data = json.loads(result.content.decode(result.charset))
assert result.status_code == 200
assert result['Content-Type'] == 'application/json'
assert data == expected
assert result.has_header('Etag')
def test_service_view_err(rf, settings):
settings.HEALTH_CHECKS = {
'database': 'django_healthchecks.contrib.check_dummy_false'
}
request = rf.get('/')
view = views.HealthCheckServiceView.as_view()
result = view(request, service='database')
assert result.status_code == 200
assert result.content == b'false'
assert result.has_header('Etag')
request = rf.get('/', HTTP_IF_NONE_MATCH=result['ETag'])
result = view(request, service='database')
assert result.status_code == 304
def test_service_view_err_custom_code(rf, settings):
settings.HEALTH_CHECKS_ERROR_CODE = 500
settings.HEALTH_CHECKS = {
'database': 'django_healthchecks.contrib.check_dummy_false'
}
request = rf.get('/')
view = views.HealthCheckServiceView.as_view()
result = view(request, service='database')
assert result.status_code == 500
assert result.content == b'false'
request = rf.get('/', HTTP_IF_NONE_MATCH=result['ETag'])
result = view(request, service='database')
assert result.status_code == 500
def test_service_view_404(rf):
request = rf.get('/')
view = views.HealthCheckServiceView.as_view()
with pytest.raises(Http404):
view(request, service='database')
def test_service_require_auth(rf, settings):
settings.HEALTH_CHECKS = {
'database': 'django_healthchecks.contrib.check_dummy_true'
}
settings.HEALTH_CHECKS_BASIC_AUTH = {
'*': [('user', 'password')],
}
request = rf.get('/')
view = views.HealthCheckServiceView.as_view()
result = view(request, service='database')
assert result.status_code == 401
assert result.has_header('Etag')
request = rf.get('/', HTTP_IF_NONE_MATCH=result['ETag'])
result = view(request, service='database')
assert result.status_code == 401
assert result.has_header('Etag')
| 27.858586 | 69 | 0.67422 | 657 | 5,516 | 5.459665 | 0.141553 | 0.107053 | 0.053527 | 0.085866 | 0.834681 | 0.779481 | 0.779481 | 0.753555 | 0.739894 | 0.639532 | 0 | 0.014858 | 0.194706 | 5,516 | 197 | 70 | 28 | 0.792661 | 0.02103 | 0 | 0.6 | 0 | 0 | 0.154217 | 0.066172 | 0 | 0 | 0 | 0 | 0.242857 | 1 | 0.085714 | false | 0.007143 | 0.042857 | 0.014286 | 0.142857 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
a69c25cd5550caa6f562124c5925313020b4e322 | 266 | py | Python | Darlington/phase1/python Basic 2/day 26 solution/qtn1.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 6 | 2020-05-23T19:53:25.000Z | 2021-05-08T20:21:30.000Z | Darlington/phase1/python Basic 2/day 26 solution/qtn1.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 8 | 2020-05-14T18:53:12.000Z | 2020-07-03T00:06:20.000Z | Darlington/phase1/python Basic 2/day 26 solution/qtn1.py | CodedLadiesInnovateTech/-python-challenge-solutions | 430cd3eb84a2905a286819eef384ee484d8eb9e7 | [
"MIT"
] | 39 | 2020-05-10T20:55:02.000Z | 2020-09-12T17:40:59.000Z | # program to count the number of arguments in a given function.
def num_of_args(*args):
return(len(args))
print(num_of_args())
print(num_of_args(1))
print(num_of_args(1, 2))
print(num_of_args(1, 2, 3))
print(num_of_args(1, 2, 3, 4))
print(num_of_args([1, 2, 3, 4])) | 29.555556 | 63 | 0.718045 | 57 | 266 | 3.105263 | 0.368421 | 0.19774 | 0.355932 | 0.474576 | 0.576271 | 0.389831 | 0.299435 | 0.20339 | 0 | 0 | 0 | 0.059322 | 0.112782 | 266 | 9 | 64 | 29.555556 | 0.690678 | 0.229323 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.125 | true | 0 | 0 | 0.125 | 0.125 | 0.75 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 1 | 0 | 6 |
a6afb1bf2b39e63636c97a69f8858f81abb59a6b | 84 | py | Python | h5Nastran/h5Nastran/post_process/composite/__init__.py | ACea15/pyNastran | 5ffc37d784b52c882ea207f832bceb6b5eb0e6d4 | [
"BSD-3-Clause"
] | 293 | 2015-03-22T20:22:01.000Z | 2022-03-14T20:28:24.000Z | h5Nastran/h5Nastran/post_process/composite/__init__.py | ACea15/pyNastran | 5ffc37d784b52c882ea207f832bceb6b5eb0e6d4 | [
"BSD-3-Clause"
] | 512 | 2015-03-14T18:39:27.000Z | 2022-03-31T16:15:43.000Z | h5Nastran/h5Nastran/post_process/composite/__init__.py | ACea15/pyNastran | 5ffc37d784b52c882ea207f832bceb6b5eb0e6d4 | [
"BSD-3-Clause"
] | 136 | 2015-03-19T03:26:06.000Z | 2022-03-25T22:14:54.000Z | from .orthotropic import OrthotropicMaterial, OrthotropicLaminate, OrthotropicLamina | 84 | 84 | 0.904762 | 6 | 84 | 12.666667 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.059524 | 84 | 1 | 84 | 84 | 0.962025 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 1 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
a6cb8ee8bf15b4cb763ea5e436eb017a96c978e5 | 8,820 | py | Python | tests/test_remove_long_range_hop.py | Z2PackDev/TBModels | 1b0f07aa16000d3436ec30cc9e8132637fbfa4e6 | [
"Apache-2.0"
] | 32 | 2016-08-18T22:12:25.000Z | 2022-01-31T12:34:20.000Z | tests/test_remove_long_range_hop.py | Z2PackDev/TBModels | 1b0f07aa16000d3436ec30cc9e8132637fbfa4e6 | [
"Apache-2.0"
] | 75 | 2016-07-19T13:38:25.000Z | 2022-02-23T22:38:02.000Z | tests/test_remove_long_range_hop.py | Z2PackDev/TBModels | 1b0f07aa16000d3436ec30cc9e8132637fbfa4e6 | [
"Apache-2.0"
] | 23 | 2016-08-16T09:36:52.000Z | 2022-02-16T10:37:22.000Z | #!/usr/bin/env python
"""Tests for the method of removing long-range hopping terms."""
import pytest
import numpy as np
def test_simple_model(get_model):
"""
Check that removing the long-range hopping in a simple model works
as expected.
"""
model = get_model(t1=1, t2=2, uc=np.eye(3))
# baseline -- check the initial state
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (0, 1, 0), [[False, True], [False, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
_check_zero(model, (1, 1, 0), [[True, True], [False, True]])
# check that using a long cut-off does not change anything
model.remove_long_range_hop(cutoff_distance_cartesian=1.1)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (0, 1, 0), [[False, True], [False, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
_check_zero(model, (1, 1, 0), [[True, True], [False, True]])
# remove next-nearest neighbor hoppings
model.remove_long_range_hop(cutoff_distance_cartesian=0.9)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (0, 1, 0), [[True, True], [False, True]])
_check_zero(model, (1, 0, 0), [[True, True], [False, True]])
_check_zero(model, (1, 1, 0), [[True, True], [False, True]])
# remove nearest neighbor hoppings
model.remove_long_range_hop(cutoff_distance_cartesian=0.5)
assert set(model.hop.keys()) == {(0, 0, 0)}
_check_zero(model, (0, 0, 0), [[False, True], [True, False]])
# remove everything
model.remove_long_range_hop(cutoff_distance_cartesian=-1)
assert set(model.hop.keys()) == set()
def test_model_skewed_uc(get_model):
"""
Check that removing the long-range hopping in a model with skewed
unit cell works as expected.
"""
model = get_model(t1=1, t2=2, uc=np.array([[2, 0, 0], [2, 2, 0], [0, 0, 1]]))
# baseline -- check the initial state
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (0, 1, 0), [[False, True], [False, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
_check_zero(model, (1, 1, 0), [[True, True], [False, True]])
# check that using a long cut-off does not change anything
model.remove_long_range_hop(cutoff_distance_cartesian=np.sqrt(8) + 0.1)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (0, 1, 0), [[False, True], [False, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
_check_zero(model, (1, 1, 0), [[True, True], [False, True]])
# remove next-nearest neighbor hoppings along a_2 (length sqrt(8))
model.remove_long_range_hop(cutoff_distance_cartesian=np.sqrt(5) + 0.1)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
_check_zero(model, (0, 1, 0), [[True, True], [False, True]])
_check_zero(model, (1, 1, 0), [[True, True], [False, True]])
# remove nearest neighbor hoppings along a_1 + a_2 (length sqrt(5))
model.remove_long_range_hop(cutoff_distance_cartesian=2.1)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0)}
_check_zero(model, (0, 0, 0), [[False, True], [True, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
_check_zero(model, (0, 1, 0), [[True, True], [False, True]])
# remove next-nearest neighbor hoppings along a_1 (length 2)
model.remove_long_range_hop(cutoff_distance_cartesian=1.5)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0)}
_check_zero(model, (0, 0, 0), [[False, True], [True, False]])
_check_zero(model, (1, 0, 0), [[True, True], [False, True]])
_check_zero(model, (0, 1, 0), [[True, True], [False, True]])
# remove short nearest-neighbor hopping along a_2 - a_1 (length 1)
model.remove_long_range_hop(cutoff_distance_cartesian=0.9)
assert set(model.hop.keys()) == {(0, 0, 0)}
_check_zero(model, (0, 0, 0), [[False, True], [True, False]])
# remove everything
model.remove_long_range_hop(cutoff_distance_cartesian=-1)
assert set(model.hop.keys()) == set()
def test_model_skewed_uc_and_pos(get_model):
"""
Check that removing the long-range hopping in a model with skewed
unit cell and positions works as expected.
"""
model = get_model(
t1=1,
t2=2,
uc=np.array([[4, 0, 0], [4, 4, 0], [0, 0, 1]]),
pos=[[0, 0, 0], [0.5, 0.25, 0]],
)
# baseline -- check the initial state
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (0, 1, 0), [[False, True], [False, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
_check_zero(model, (1, 1, 0), [[True, True], [False, True]])
# check that using a long cut-off does not change anything
model.remove_long_range_hop(cutoff_distance_cartesian=np.sqrt(34) + 0.1)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0), (1, 1, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (0, 1, 0), [[False, True], [False, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
_check_zero(model, (1, 1, 0), [[True, True], [False, True]])
# remove longest "nearest-neighbor" hopping - length sqrt(34)
model.remove_long_range_hop(cutoff_distance_cartesian=np.sqrt(34) - 0.1)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (0, 1, 0), [[False, True], [False, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
# remove same-orbital hoppings along a_2 - length sqrt(32)
model.remove_long_range_hop(cutoff_distance_cartesian=np.sqrt(32) - 0.1)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (1, 0, 0), [[False, True], [False, False]])
_check_zero(model, (0, 1, 0), [[True, True], [False, True]])
# remove same-orbital hoppings along a_1 - length 4
model.remove_long_range_hop(cutoff_distance_cartesian=3.9)
assert set(model.hop.keys()) == {(0, 0, 0), (0, 1, 0), (1, 0, 0)}
_check_zero(model, (0, 0, 0), [[False, False], [False, False]])
_check_zero(model, (1, 0, 0), [[True, True], [False, True]])
_check_zero(model, (0, 1, 0), [[True, True], [False, True]])
# remove two kinds of nearest-neighbor hopping - length sqrt(10)
model.remove_long_range_hop(cutoff_distance_cartesian=np.sqrt(10) - 0.1)
assert set(model.hop.keys()) == {(0, 0, 0), (1, 0, 0)}
_check_zero(model, (0, 0, 0), [[False, True], [True, False]])
_check_zero(model, (1, 0, 0), [[True, True], [False, True]])
# remove last nearest-neighbor hopping - length sqrt(2)
model.remove_long_range_hop(cutoff_distance_cartesian=np.sqrt(2) - 0.1)
assert set(model.hop.keys()) == {(0, 0, 0)}
_check_zero(model, (0, 0, 0), [[False, True], [True, False]])
# remove everything
model.remove_long_range_hop(cutoff_distance_cartesian=-1)
assert set(model.hop.keys()) == set()
def _check_zero(model, R, expected_zero):
"""
Helper function to check that the hopping matrix is zero at the
expected positions.
"""
assert np.all((np.array(model.hop[R]) == 0) == expected_zero), f"failed at R={R}"
def test_no_uc(get_model):
"""
Check that an error is raised if the unit cell is not given.
"""
model = get_model(t1=0.1, t2=0.2)
assert model.uc is None
assert model.pos is not None
with pytest.raises(ValueError):
model.remove_long_range_hop(cutoff_distance_cartesian=1.0)
def test_no_pos(get_model):
"""
Check that an error is raised if the unit cell is not given.
"""
model = get_model(t1=0.1, t2=0.2, uc=np.eye(3))
# Note: this is affected by issue #76
model.pos = None
assert model.uc is not None
with pytest.raises(ValueError):
model.remove_long_range_hop(cutoff_distance_cartesian=1.0)
| 45.230769 | 85 | 0.610431 | 1,422 | 8,820 | 3.620956 | 0.080872 | 0.045834 | 0.144106 | 0.087396 | 0.90134 | 0.876287 | 0.858419 | 0.858419 | 0.840552 | 0.830453 | 0 | 0.060972 | 0.192971 | 8,820 | 194 | 86 | 45.463918 | 0.662405 | 0.175397 | 0 | 0.689655 | 0 | 0 | 0.002101 | 0 | 0 | 0 | 0 | 0 | 0.206897 | 1 | 0.051724 | false | 0 | 0.017241 | 0 | 0.068966 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
a6de64766d77ce0913094dca3ddab02c09531f26 | 101 | py | Python | pub/forms/token.py | DASTUDIO/MyVHost | b9eda56a67c2df9236b7866087bc7f465542f951 | [
"MIT"
] | 2 | 2021-07-27T10:38:57.000Z | 2021-10-10T20:42:56.000Z | pub/forms/token.py | DASTUDIO/MyVHost | b9eda56a67c2df9236b7866087bc7f465542f951 | [
"MIT"
] | null | null | null | pub/forms/token.py | DASTUDIO/MyVHost | b9eda56a67c2df9236b7866087bc7f465542f951 | [
"MIT"
] | null | null | null | # coding=utf-8
from django import forms
class form_token(forms.Form):
token = forms.CharField() | 16.833333 | 29 | 0.732673 | 15 | 101 | 4.866667 | 0.733333 | 0.246575 | 0.383562 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.011765 | 0.158416 | 101 | 6 | 30 | 16.833333 | 0.847059 | 0.118812 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
471022f5e817f1aedf996a201b4769a9aeb0f29a | 3,483 | py | Python | pyflux/ssm/tests/dar_tests.py | ThomasHoppe/pyflux | 297f2afc2095acd97c12e827dd500e8ea5da0c0f | [
"BSD-3-Clause"
] | 2,091 | 2016-04-01T02:52:10.000Z | 2022-03-29T11:38:15.000Z | pyflux/ssm/tests/dar_tests.py | EricSchles/pyflux | 297f2afc2095acd97c12e827dd500e8ea5da0c0f | [
"BSD-3-Clause"
] | 160 | 2016-04-26T14:52:18.000Z | 2022-03-15T02:09:07.000Z | pyflux/ssm/tests/dar_tests.py | EricSchles/pyflux | 297f2afc2095acd97c12e827dd500e8ea5da0c0f | [
"BSD-3-Clause"
] | 264 | 2016-05-02T14:03:31.000Z | 2022-03-29T07:48:20.000Z | import numpy as np
import pyflux as pf
noise = np.random.normal(0,1,100)
data = np.zeros(100)
for i in range(1,len(data)):
data[i] = 0.9*data[i-1] + noise[i]
def test_couple_terms():
"""
Tests an DAR model with 1 AR and that
the latent variable list length is correct, and that the estimated
latent variables are not nan
"""
model = pf.DAR(data=data, ar=1)
x = model.fit()
assert(len(model.latent_variables.z_list) == 3)
lvs = np.array([i.value for i in model.latent_variables.z_list])
assert(len(lvs[np.isnan(lvs)]) == 0)
def test_couple_terms_integ():
"""
Tests an DAR model with 1 AR, integrated once, and that
the latent variable list length is correct, and that the estimated
latent variables are not nan
"""
model = pf.DAR(data=data, ar=1, integ=1)
x = model.fit()
assert(len(model.latent_variables.z_list) == 3)
lvs = np.array([i.value for i in model.latent_variables.z_list])
assert(len(lvs[np.isnan(lvs)]) == 0)
def test_bbvi():
"""
Tests an DAR model estimated with BBVI and that the length of the latent variable
list is correct, and that the estimated latent variables are not nan
"""
model = pf.DAR(data=data, ar=1)
x = model.fit('BBVI',iterations=100)
assert(len(model.latent_variables.z_list) == 3)
lvs = np.array([i.value for i in model.latent_variables.z_list])
assert(len(lvs[np.isnan(lvs)]) == 0)
def test_mh():
"""
Tests an DAR model estimated with Metropolis-Hastings and that the length of the
latent variable list is correct, and that the estimated latent variables are not nan
"""
model = pf.DAR(data=data, ar=1)
x = model.fit('M-H',nsims=300)
assert(len(model.latent_variables.z_list) == 3)
lvs = np.array([i.value for i in model.latent_variables.z_list])
assert(len(lvs[np.isnan(lvs)]) == 0)
def test_laplace():
"""
Tests an DAR model estimated with Laplace approximation and that the length of the
latent variable list is correct, and that the estimated latent variables are not nan
"""
model = pf.DAR(data=data, ar=1)
x = model.fit('Laplace')
assert(len(model.latent_variables.z_list) == 3)
lvs = np.array([i.value for i in model.latent_variables.z_list])
assert(len(lvs[np.isnan(lvs)]) == 0)
def test_pml():
"""
Tests a PML model estimated with Laplace approximation and that the length of the
latent variable list is correct, and that the estimated latent variables are not nan
"""
model = pf.DAR(data=data, ar=1)
x = model.fit('PML')
assert(len(model.latent_variables.z_list) == 3)
lvs = np.array([i.value for i in model.latent_variables.z_list])
assert(len(lvs[np.isnan(lvs)]) == 0)
def test_predict_length():
"""
Tests that the prediction dataframe length is equal to the number of steps h
"""
model = pf.DAR(data=data, ar=2)
x = model.fit()
x.summary()
assert(model.predict(h=5).shape[0] == 5)
def test_predict_is_length():
"""
Tests that the prediction IS dataframe length is equal to the number of steps h
"""
model = pf.DAR(data=data, ar=2)
x = model.fit()
assert(model.predict_is(h=5).shape[0] == 5)
def test_predict_nans():
"""
Tests that the predictions are not nans
"""
model = pf.DAR(data=data, ar=2)
x = model.fit()
x.summary()
assert(len(model.predict(h=5).values[np.isnan(model.predict(h=5).values)]) == 0)
def test_predict_is_nans():
"""
Tests that the in-sample predictions are not nans
"""
model = pf.DAR(data=data, ar=2)
x = model.fit()
x.summary()
assert(len(model.predict_is(h=5).values[np.isnan(model.predict_is(h=5).values)]) == 0) | 31.378378 | 87 | 0.705713 | 616 | 3,483 | 3.915584 | 0.137987 | 0.11194 | 0.049751 | 0.104478 | 0.862769 | 0.830431 | 0.798093 | 0.757463 | 0.738391 | 0.738391 | 0 | 0.018631 | 0.152455 | 3,483 | 111 | 87 | 31.378378 | 0.798442 | 0.340798 | 0 | 0.590164 | 0 | 0 | 0.007734 | 0 | 0 | 0 | 0 | 0 | 0.262295 | 1 | 0.163934 | false | 0 | 0.032787 | 0 | 0.196721 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
5b2b4cb4820bb16b6ed19034892a5e7da2252b42 | 28 | py | Python | gae_app/lib/fixture/test/test_loadable/__init__.py | dcifuen/gentlemeet | a1209247de7af5f09723323ab8925e0e3b50bbe1 | [
"Apache-2.0"
] | 1 | 2015-03-27T21:57:40.000Z | 2015-03-27T21:57:40.000Z | gae_app/lib/fixture/test/test_loadable/__init__.py | dcifuen/gentlemeet | a1209247de7af5f09723323ab8925e0e3b50bbe1 | [
"Apache-2.0"
] | null | null | null | gae_app/lib/fixture/test/test_loadable/__init__.py | dcifuen/gentlemeet | a1209247de7af5f09723323ab8925e0e3b50bbe1 | [
"Apache-2.0"
] | null | null | null |
from test_loadable import * | 14 | 27 | 0.821429 | 4 | 28 | 5.5 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 28 | 2 | 27 | 14 | 0.916667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
5b4335de4c93641f8d2002ce01586da854406b01 | 3,444 | py | Python | graphs/adversarial/AAE_graph.py | Jav1d/Generative_Models | b7578b5277488ebd212a50d1c22a5c9708f4c311 | [
"MIT"
] | null | null | null | graphs/adversarial/AAE_graph.py | Jav1d/Generative_Models | b7578b5277488ebd212a50d1c22a5c9708f4c311 | [
"MIT"
] | null | null | null | graphs/adversarial/AAE_graph.py | Jav1d/Generative_Models | b7578b5277488ebd212a50d1c22a5c9708f4c311 | [
"MIT"
] | null | null | null | import tensorflow as tf
from graphs.basics.AE_graph import encode_fn
def inference_discriminate_encode_fn(**kwargs):
# swapping the true by random
ae_encoded = encode_fn(**kwargs)
fake_latents = ae_encoded['z_latents']
real_latents = tf.random.normal(shape=tf.shape(fake_latents))
real_discriminator_predictions = kwargs['model']('inference_discriminator_real', [real_latents])
fake_discriminator_predictions = kwargs['model']('inference_discriminator_fake', [fake_latents])
fake_generator_predictions = kwargs['model']('inference_generator_fake', [fake_latents])
return {**ae_encoded, 'inference_discriminator_fake_predictions': fake_discriminator_predictions,
'inference_generator_fake_predictions': fake_generator_predictions,
'inference_discriminator_real_predictions': real_discriminator_predictions}
def generative_discriminate_encode_fn(**kwargs):
# swapping the true by random
fake_inputs = kwargs['inputs']['inputs']
ae_encoded = encode_fn(**kwargs)
real_inputs = tf.random.normal(shape=tf.shape(fake_inputs))
generative_discriminator_real_predictions = kwargs['model']('generative_discriminator_real', [real_inputs])
generative_discriminator_fake_predictions = kwargs['model']('generative_discriminator_fake', [fake_inputs])
generative_generator_fake_predictions = kwargs['model']('generative_generator_fake', [fake_inputs])
return {**ae_encoded, 'generative_discriminator_fake_predictions': generative_discriminator_fake_predictions,
'generative_generator_fake_predictions': generative_generator_fake_predictions,
'generative_discriminator_real_predictions': generative_discriminator_real_predictions}
def generative_inference_discriminate_encode_fn(**kwargs):
# swapping the true by random
fake_inputs = kwargs['inputs']['inputs']
ae_encoded = encode_fn(**kwargs)
real_inputs = tf.random.normal(shape=tf.shape(fake_inputs))
generative_discriminator_real_predictions = kwargs['model']('generative_discriminator_real', [real_inputs])
generative_discriminator_fake_predictions = kwargs['model']('generative_discriminator_fake', [fake_inputs])
generative_generator_fake_predictions = kwargs['model']('generative_generator_fake', [fake_inputs])
# swapping the true by random
fake_latents = ae_encoded['z_latents']
real_latents = tf.random.normal(shape=tf.shape(fake_latents))
real_discriminator_predictions = kwargs['model']('inference_discriminator_real', [real_latents])
fake_discriminator_predictions = kwargs['model']('inference_discriminator_fake', [fake_latents])
fake_generator_predictions = kwargs['model']('inference_generator_fake', [fake_latents])
return {**ae_encoded, 'generative_discriminator_fake_predictions': generative_discriminator_fake_predictions, \
'generative_generator_fake_predictions': generative_generator_fake_predictions,
'generative_discriminator_real_predictions': generative_discriminator_real_predictions,
'inference_discriminator_fake_predictions': fake_discriminator_predictions,
'inference_generator_fake_predictions': fake_generator_predictions,
'inference_discriminator_real_predictions': real_discriminator_predictions
}
| 64.981132 | 115 | 0.75813 | 353 | 3,444 | 6.917847 | 0.096317 | 0.09828 | 0.108108 | 0.076167 | 0.964783 | 0.955364 | 0.945946 | 0.945946 | 0.945946 | 0.945946 | 0 | 0 | 0.15331 | 3,444 | 52 | 116 | 66.230769 | 0.837449 | 0.03223 | 0 | 0.658537 | 0 | 0 | 0.269913 | 0.239255 | 0 | 0 | 0 | 0 | 0 | 1 | 0.073171 | false | 0 | 0.04878 | 0 | 0.195122 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
5b50d7cfb055899ada118f592796fcff1f79a919 | 28,450 | py | Python | src/test/anovos/data_transformer/test_transformers.py | anovos/anovos | 39b62a1b97a5ba7cc18edc2fbeeb332d9d5edae5 | [
"Apache-2.0"
] | 60 | 2021-11-15T22:30:57.000Z | 2022-03-31T08:13:27.000Z | src/test/anovos/data_transformer/test_transformers.py | anovos/anovos | 39b62a1b97a5ba7cc18edc2fbeeb332d9d5edae5 | [
"Apache-2.0"
] | 62 | 2021-11-15T17:27:56.000Z | 2022-03-28T20:12:56.000Z | src/test/anovos/data_transformer/test_transformers.py | anovos/anovos | 39b62a1b97a5ba7cc18edc2fbeeb332d9d5edae5 | [
"Apache-2.0"
] | 15 | 2021-11-17T19:39:47.000Z | 2022-03-30T18:20:33.000Z | import os
import pytest
from pyspark.sql import functions as F
from pytest import approx
from anovos.data_ingest.data_ingest import read_dataset
from anovos.data_transformer.transformers import (
IQR_standardization,
PCA_latentFeatures,
attribute_binning,
auto_imputation,
autoencoder_latentFeatures,
boxcox_transformation,
cat_to_num_supervised,
cat_to_num_unsupervised,
feature_transformation,
imputation_matrixFactorization,
imputation_MMM,
imputation_sklearn,
monotonic_binning,
normalization,
outlier_categories,
z_standardization,
)
sample_parquet = "./data/test_dataset/part-00001-3eb0f7bb-05c2-46ec-8913-23ba231d2734-c000.snappy.parquet"
# scaling
def test_z_standardization(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = z_standardization(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
model_path="unit_testing/models/",
)
assert len(odf.columns) == 17
odf_stddev_dict = (
odf.describe().where(F.col("summary") == "stddev").toPandas().to_dict("list")
)
assert round(float(odf_stddev_dict["age"][0])) == 1.0
assert round(float(odf_stddev_dict["fnlwgt"][0])) == 1.0
assert round(float(odf_stddev_dict["hours-per-week"][0])) == 1.0
try:
odf = z_standardization(
spark_session,
df,
list_of_cols=["education-num"],
pre_existing_model=True,
model_path="unit_testing/models/",
)
except Exception as error:
assert str(error) == "list index out of range"
odf = z_standardization(spark_session, df, list_of_cols=[])
odf_stddev_dict = (
odf.describe().where(F.col("summary") == "stddev").toPandas().to_dict("list")
)
assert round(float(odf_stddev_dict["age"][0])) != 1.0
assert round(float(odf_stddev_dict["fnlwgt"][0])) != 1.0
assert round(float(odf_stddev_dict["hours-per-week"][0])) != 1.0
odf = z_standardization(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
output_mode="append",
)
assert len(odf.columns) == 20
def test_IQR_standardization(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = IQR_standardization(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
model_path="unit_testing/models/",
)
assert len(odf.columns) == 17
odf_median_dict = (
odf.summary().where(F.col("summary") == "50%").toPandas().to_dict("list")
)
assert round(float(odf_median_dict["age"][0])) == 0.0
assert round(float(odf_median_dict["fnlwgt"][0])) == 0.0
assert round(float(odf_median_dict["hours-per-week"][0])) == 0.0
try:
odf = IQR_standardization(
spark_session,
df,
list_of_cols=["education-num"],
pre_existing_model=True,
model_path="unit_testing/models/",
)
except Exception as error:
assert str(error) == "list index out of range"
odf = IQR_standardization(spark_session, df, list_of_cols=[])
odf_median_dict = (
odf.summary().where(F.col("summary") == "50%").toPandas().to_dict("list")
)
assert round(float(odf_median_dict["age"][0])) != 0.0
assert round(float(odf_median_dict["fnlwgt"][0])) != 0.0
assert round(float(odf_median_dict["hours-per-week"][0])) != 0.0
odf = IQR_standardization(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
output_mode="append",
)
assert len(odf.columns) == 20
def test_normalization(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = normalization(
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
model_path="unit_testing/models/",
)
assert len(odf.columns) == 17
odf_min_dict = (
odf.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
assert round(float(odf_min_dict["age"][0])) == 0.0
assert round(float(odf_min_dict["fnlwgt"][0])) == 0.0
assert round(float(odf_min_dict["hours-per-week"][0])) == 0.0
odf_max_dict = (
odf.describe().where(F.col("summary") == "max").toPandas().to_dict("list")
)
assert round(float(odf_max_dict["age"][0])) == 1.0
assert round(float(odf_max_dict["fnlwgt"][0])) == 1.0
assert round(float(odf_max_dict["hours-per-week"][0])) == 1.0
try:
odf = normalization(
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
pre_existing_model=True,
model_path="unit_testing/models/",
)
except Exception as error:
assert str(error) == "list index out of range"
odf = normalization(df, list_of_cols=[])
odf_min_dict = (
odf.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
assert round(float(odf_min_dict["age"][0])) != 0.0
assert round(float(odf_min_dict["fnlwgt"][0])) != 0.0
assert round(float(odf_min_dict["hours-per-week"][0])) != 0.0
odf_max_dict = (
odf.describe().where(F.col("summary") == "max").toPandas().to_dict("list")
)
assert round(float(odf_max_dict["age"][0])) != 1.0
assert round(float(odf_max_dict["fnlwgt"][0])) != 1.0
assert round(float(odf_max_dict["hours-per-week"][0])) != 1.0
odf = normalization(
df, list_of_cols=["age", "fnlwgt", "hours-per-week"], output_mode="append"
)
assert len(odf.columns) == 20
# imputation
def test_imputation_sklearn(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = imputation_sklearn(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
method_type="KNN",
model_path="unit_testing/models/",
)
assert len(odf.columns) == 17
assert odf.where(F.col("age").isNull()).count() == 0
assert odf.where(F.col("fnlwgt").isNull()).count() == 0
assert odf.where(F.col("hours-per-week").isNull()).count() == 0
assert odf.where(F.col("logfnl").isNull()).count() == 10214
assert odf.where(F.col("education").isNull()).count() == 258
assert odf.where(F.col("race").isNull()).count() == 162
assert odf.where(F.col("relationship").isNull()).count() == 4
try:
odf = imputation_sklearn(
spark_session,
df,
list_of_cols=["education-num"],
method_type="KNN",
pre_existing_model=True,
model_path="unit_testing/models/",
)
except Exception as error:
assert str(error) == "list index out of range"
odf = imputation_sklearn(spark_session, df, list_of_cols=[], method_type="KNN")
assert odf.where(F.col("age").isNull()).count() == 30
assert odf.where(F.col("fnlwgt").isNull()).count() == 8
assert odf.where(F.col("hours-per-week").isNull()).count() == 59
odf = imputation_sklearn(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
method_type="regression",
output_mode="append",
)
assert len(odf.columns) == 20
def test_imputation_matrixFactorization(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = imputation_matrixFactorization(
spark_session,
df,
list_of_cols=["education-num", "hours-per-week"],
id_col="ifa",
)
assert len(odf.columns) == 17
assert odf.where(F.col("hours-per-week").isNull()).count() == 0
assert odf.where(F.col("education-num").isNull()).count() == 0
assert odf.where(F.col("education").isNull()).count() == 258
assert odf.where(F.col("race").isNull()).count() == 162
assert odf.where(F.col("relationship").isNull()).count() == 4
odf = imputation_matrixFactorization(
spark_session, df, list_of_cols=[], id_col="ifa"
)
assert odf.where(F.col("hours-per-week").isNull()).count() == 59
assert odf.where(F.col("education-num").isNull()).count() == 14
odf = imputation_matrixFactorization(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
id_col="ifa",
output_mode="append",
)
assert len(odf.columns) == 20
def test_imputation_MMM(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = imputation_MMM(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week", "relationship", "race"],
method_type="mode",
model_path="unit_testing/models/",
)
assert len(odf.columns) == 17
assert odf.where(F.col("age").isNull()).count() == 0
assert odf.where(F.col("fnlwgt").isNull()).count() == 0
assert odf.where(F.col("hours-per-week").isNull()).count() == 0
assert odf.where(F.col("race").isNull()).count() == 0
assert odf.where(F.col("relationship").isNull()).count() == 0
assert odf.where(F.col("logfnl").isNull()).count() == 10214
assert odf.where(F.col("education").isNull()).count() == 258
try:
odf = imputation_MMM(
spark_session,
df,
list_of_cols=["education-num"],
method_type="mode",
pre_existing_model=True,
model_path="unit_testing/models/",
)
except Exception as error:
assert str(error) == "list index out of range"
odf = imputation_MMM(spark_session, df, list_of_cols=[], method_type="mode")
assert odf.where(F.col("age").isNull()).count() == 30
assert odf.where(F.col("fnlwgt").isNull()).count() == 8
assert odf.where(F.col("hours-per-week").isNull()).count() == 59
assert odf.where(F.col("race").isNull()).count() == 162
assert odf.where(F.col("relationship").isNull()).count() == 4
odf = imputation_MMM(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week", "relationship", "race"],
method_type="mean",
output_mode="append",
)
assert len(odf.columns) == 22
def test_auto_imputation(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = auto_imputation(
spark_session,
df,
list_of_cols=["education-num", "relationship", "race"],
id_col="ifa",
)
assert len(odf.columns) == 18
assert odf.where(F.col("education-num").isNull()).count() == 0
assert odf.where(F.col("race").isNull()).count() == 0
assert odf.where(F.col("relationship").isNull()).count() == 0
assert odf.where(F.col("logfnl").isNull()).count() == 10207
assert odf.where(F.col("education").isNull()).count() == 254
odf = auto_imputation(spark_session, df, list_of_cols=[], id_col="ifa")
assert odf.where(F.col("age").isNull()).count() == 30
assert odf.where(F.col("fnlwgt").isNull()).count() == 8
assert odf.where(F.col("race").isNull()).count() == 162
assert odf.where(F.col("relationship").isNull()).count() == 4
odf = auto_imputation(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week", "relationship", "race"],
id_col="ifa",
output_mode="append",
)
assert len(odf.columns) == 21
# latent_features
def test_PCA_latentFeatures(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = PCA_latentFeatures(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "logfnl", "education-num", "hours-per-week"],
explained_variance_cutoff=0.3,
model_path="unit_testing/models/",
)
assert len(odf.columns) < len(df.columns)
assert len(odf.columns) == 13
try:
odf = PCA_latentFeatures(
spark_session,
df,
list_of_cols=["education-num"],
explained_variance_cutoff=0.3,
pre_existing_model=True,
model_path="unit_testing/models/",
)
except Exception as error:
assert str(error) == "list index out of range"
odf = PCA_latentFeatures(
spark_session, df, list_of_cols=[], explained_variance_cutoff=0.3
)
assert len(odf.columns) == len(df.columns)
assert len(odf.columns) == 17
odf = PCA_latentFeatures(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "logfnl", "education-num", "hours-per-week"],
explained_variance_cutoff=0.3,
output_mode="append",
)
assert len(odf.columns) > len(df.columns)
assert len(odf.columns) == 18
assert odf.where(F.col("education").isNull()).count() == 91
assert odf.where(F.col("race").isNull()).count() == 58
assert odf.where(F.col("latent_0").isNull()).count() == 0
def test_autoencoder_latentFeatures(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = autoencoder_latentFeatures(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "logfnl", "education-num", "hours-per-week"],
epochs=20,
reduction_params=0.5,
model_path="unit_testing/models/",
)
assert len(odf.columns) > len(df.columns)
assert len(odf.columns) == 19
try:
odf = autoencoder_latentFeatures(
spark_session,
df,
list_of_cols=["education-num"],
epochs=20,
reduction_params=0.5,
pre_existing_model=True,
model_path="unit_testing/models/",
)
except Exception as error:
assert str(error) == "list index out of range"
odf = autoencoder_latentFeatures(
spark_session, df, list_of_cols=[], epochs=20, reduction_params=0.5
)
assert len(odf.columns) == len(df.columns)
assert len(odf.columns) == 17
odf = autoencoder_latentFeatures(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "logfnl", "education-num", "hours-per-week"],
epochs=20,
reduction_params=0.5,
output_mode="append",
)
assert len(odf.columns) > len(df.columns)
assert len(odf.columns) == 24
assert odf.where(F.col("latent_0").isNull()).count() == 0
assert odf.where(F.col("latent_1").isNull()).count() == 0
# feature_transformation
def test_feature_transformation(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = feature_transformation(df, list_of_cols=["age", "fnlwgt", "hours-per-week"])
assert len(odf.columns) == 17
odf_pd = odf.where(F.col("ifa") == "27520a").toPandas()
assert approx(odf_pd["age"][0]) == 7.14142842854285
assert approx(odf_pd["fnlwgt"][0]) == 399.6936326738268
assert approx(odf_pd["hours-per-week"][0]) == 4.47213595499958
odf = feature_transformation(
df, list_of_cols=["age", "fnlwgt", "hours-per-week"], output_mode="append"
)
assert len(odf.columns) == 20
def test_boxcox_transformation(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = boxcox_transformation(
df, list_of_cols=["age", "fnlwgt", "hours-per-week"], boxcox_lambda=0.5
)
assert len(odf.columns) == 17
odf_pd = odf.where(F.col("ifa") == "27520a").toPandas()
assert approx(odf_pd["age"][0]) == 7.14142842854285
assert approx(odf_pd["fnlwgt"][0]) == 399.6936326738268
assert approx(odf_pd["hours-per-week"][0]) == 4.47213595499958
odf = boxcox_transformation(
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
boxcox_lambda=0.5,
output_mode="append",
)
assert len(odf.columns) == 20
def test_outlier_categories(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = outlier_categories(
spark_session,
df,
list_of_cols=[
"workclass",
"education",
"relationship",
"race",
"native-country",
],
max_category=12,
model_path="unit_testing/models/",
)
assert len(odf.columns) == 17
assert odf.select("workclass").distinct().count() == 10
assert odf.select("education").distinct().count() == 13
assert odf.select("relationship").distinct().count() == 9
assert odf.select("native-country").distinct().count() == 12
assert odf.select("race").distinct().count() == 10
assert odf.select("occupation").distinct().count() == 16
assert odf.select("sex").distinct().count() == 4
assert odf.select("marital-status").distinct().count() == 8
try:
odf = outlier_categories(
spark_session,
df,
list_of_cols=["occupation"],
max_category=12,
pre_existing_model=True,
model_path="unit_testing/models/",
)
except Exception as error:
assert str(error) == "list index out of range"
odf = outlier_categories(spark_session, df, list_of_cols=[], max_category=12)
assert (
odf.select("workclass").distinct().count()
== df.select("workclass").distinct().count()
)
assert (
odf.select("education").distinct().count()
== df.select("education").distinct().count()
)
assert (
odf.select("relationship").distinct().count()
== df.select("relationship").distinct().count()
)
assert (
odf.select("native-country").distinct().count()
== df.select("native-country").distinct().count()
)
assert odf.select("race").distinct().count() == df.select("race").distinct().count()
assert (
odf.select("occupation").distinct().count()
== df.select("occupation").distinct().count()
)
assert odf.select("sex").distinct().count() == df.select("sex").distinct().count()
assert (
odf.select("marital-status").distinct().count()
== df.select("marital-status").distinct().count()
)
odf = outlier_categories(
spark_session,
df,
list_of_cols=[
"workclass",
"education",
"relationship",
"race",
"native-country",
],
max_category=12,
output_mode="append",
)
assert len(odf.columns) == 22
# binning
def test_attribute_binning(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = attribute_binning(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
bin_size=20,
model_path="unit_testing/models/",
)
assert len(odf.columns) == 17
odf_min_dict = (
odf.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
odf_max_dict = (
odf.describe().where(F.col("summary") == "max").toPandas().to_dict("list")
)
assert round(float(odf_min_dict["age"][0])) == 1
assert round(float(odf_min_dict["fnlwgt"][0])) == 1
assert round(float(odf_min_dict["hours-per-week"][0])) == 1
assert round(float(odf_min_dict["logfnl"][0])) != 1
assert round(float(odf_max_dict["age"][0])) == 20
assert round(float(odf_max_dict["fnlwgt"][0])) == 20
assert round(float(odf_max_dict["hours-per-week"][0])) == 20
assert round(float(odf_max_dict["logfnl"][0])) != 20
try:
odf = attribute_binning(
spark_session,
df,
list_of_cols=["education-num"],
bin_size=20,
pre_existing_model=True,
model_path="unit_testing/models/",
)
except Exception as error:
assert str(error) == "list index out of range"
odf = attribute_binning(spark_session, df, list_of_cols=[], bin_size=20)
odf_min_dict = (
odf.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
odf_max_dict = (
odf.describe().where(F.col("summary") == "max").toPandas().to_dict("list")
)
df_min_dict = (
df.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
df_max_dict = (
df.describe().where(F.col("summary") == "max").toPandas().to_dict("list")
)
assert round(float(odf_min_dict["age"][0])) == round(float(df_min_dict["age"][0]))
assert round(float(odf_min_dict["fnlwgt"][0])) == round(
float(df_min_dict["fnlwgt"][0])
)
assert round(float(odf_max_dict["age"][0])) == round(float(df_max_dict["age"][0]))
assert round(float(odf_max_dict["fnlwgt"][0])) == round(
float(df_max_dict["fnlwgt"][0])
)
odf = attribute_binning(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
bin_size=20,
output_mode="append",
)
assert len(odf.columns) == 20
def test_monotonic_binning(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = monotonic_binning(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
label_col="income",
event_label="<=50K",
bin_method="equal_range",
bin_size=10,
)
assert len(odf.columns) == 17
odf_min_dict = (
odf.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
odf_max_dict = (
odf.describe().where(F.col("summary") == "max").toPandas().to_dict("list")
)
assert round(float(odf_min_dict["age"][0])) == 1
assert round(float(odf_min_dict["fnlwgt"][0])) == 1
assert round(float(odf_min_dict["hours-per-week"][0])) == 1
assert round(float(odf_min_dict["logfnl"][0])) != 1
assert round(float(odf_max_dict["age"][0])) == 10
assert round(float(odf_max_dict["fnlwgt"][0])) == 10
assert round(float(odf_max_dict["hours-per-week"][0])) == 10
assert round(float(odf_max_dict["logfnl"][0])) != 10
odf = monotonic_binning(
spark_session,
df,
list_of_cols=[],
label_col="income",
event_label="<=50K",
bin_method="equal_range",
bin_size=10,
)
odf_min_dict = (
odf.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
odf_max_dict = (
odf.describe().where(F.col("summary") == "max").toPandas().to_dict("list")
)
df_min_dict = (
df.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
df_max_dict = (
df.describe().where(F.col("summary") == "max").toPandas().to_dict("list")
)
assert round(float(odf_min_dict["age"][0])) == round(float(df_min_dict["age"][0]))
assert round(float(odf_min_dict["fnlwgt"][0])) == round(
float(df_min_dict["fnlwgt"][0])
)
assert round(float(odf_max_dict["age"][0])) == round(float(df_max_dict["age"][0]))
assert round(float(odf_max_dict["fnlwgt"][0])) == round(
float(df_max_dict["fnlwgt"][0])
)
odf = monotonic_binning(
spark_session,
df,
list_of_cols=["age", "fnlwgt", "hours-per-week"],
label_col="income",
event_label="<=50K",
bin_method="equal_range",
bin_size=10,
output_mode="append",
)
assert len(odf.columns) == 20
# categorical_to_numerical_transformation
def test_cat_to_num_unsupervised(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = cat_to_num_unsupervised(
spark_session,
df,
list_of_cols=["workclass", "relationship", "marital-status"],
drop_cols=["ifa"],
method_type=1,
index_order="frequencyDesc",
cardinality_threshold=100,
model_path="unit_testing/models/",
)
assert len(odf.columns) == 17
odf_min_dict = (
odf.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
assert round(float(odf_min_dict["workclass"][0])) == 0
assert round(float(odf_min_dict["marital-status"][0])) == 0
assert round(float(odf_min_dict["relationship"][0])) == 0
assert odf.select("workclass").dtypes[0][1] == "int"
assert odf.select("marital-status").dtypes[0][1] == "int"
assert odf.select("relationship").dtypes[0][1] == "int"
assert odf.select("education").dtypes[0][1] == "string"
odf = cat_to_num_unsupervised(
spark_session,
df,
list_of_cols=[],
drop_cols=["ifa"],
method_type=1,
index_order="frequencyDesc",
cardinality_threshold=100,
)
assert odf.select("workclass").dtypes[0][1] == "string"
assert odf.select("marital-status").dtypes[0][1] == "string"
assert odf.select("relationship").dtypes[0][1] == "string"
assert odf.select("education").dtypes[0][1] == "string"
odf = cat_to_num_unsupervised(
spark_session,
df,
list_of_cols=["workclass", "relationship", "marital-status"],
drop_cols=["ifa"],
method_type=1,
index_order="frequencyDesc",
cardinality_threshold=100,
output_mode="append",
)
assert len(odf.columns) == 20
odf = cat_to_num_unsupervised(
spark_session, df, drop_cols=["ifa"], method_type=0, cardinality_threshold=100
)
odf_min_dict = (
odf.describe().where(F.col("summary") == "min").toPandas().to_dict("list")
)
odf_max_dict = (
odf.describe().where(F.col("summary") == "max").toPandas().to_dict("list")
)
assert round(float(odf_min_dict["relationship_0"][0])) == 0
assert round(float(odf_min_dict["race_7"][0])) == 0
assert round(float(odf_min_dict["marital-status_1"][0])) == 0
assert round(float(odf_min_dict["sex_1"][0])) == 0
assert round(float(odf_min_dict["occupation_12"][0])) == 0
assert round(float(odf_max_dict["relationship_0"][0])) == 1
assert round(float(odf_max_dict["race_7"][0])) == 1
assert round(float(odf_max_dict["marital-status_1"][0])) == 1
assert round(float(odf_max_dict["sex_1"][0])) == 1
assert round(float(odf_max_dict["occupation_12"][0])) == 1
def test_cat_to_num_supervised(spark_session):
df = read_dataset(spark_session, sample_parquet, "parquet")
odf = cat_to_num_supervised(
spark_session,
df,
list_of_cols=["workclass", "relationship", "marital-status"],
drop_cols=["ifa"],
label_col="income",
event_label="<=50K",
model_path="unit_testing/models/",
)
assert len(odf.columns) == 17
assert odf.select("workclass").dtypes[0][1] == "double"
assert odf.select("marital-status").dtypes[0][1] == "double"
assert odf.select("relationship").dtypes[0][1] == "double"
assert odf.select("education").dtypes[0][1] == "string"
df_workclass_private = (
df.where(F.col("workclass") == "Private")
.select("income")
.toPandas()
.value_counts()
)
assert round(
odf.where(F.col("ifa") == "27520a").toPandas()["workclass"][0]
) == round(
df_workclass_private[0] / (df_workclass_private[0] + df_workclass_private[1])
)
df_workclass_local_gov = (
df.where(F.col("workclass") == "Local-gov")
.select("income")
.toPandas()
.value_counts()
)
assert round(
odf.where(F.col("ifa") == "6144a").toPandas()["workclass"][0]
) == round(
df_workclass_local_gov[0]
/ (df_workclass_local_gov[0] + df_workclass_local_gov[1])
)
df_workclass_federal_gov = (
df.where(F.col("workclass") == "Federal-gov")
.select("income")
.toPandas()
.value_counts()
)
assert round(
odf.where(F.col("ifa") == "23710a").toPandas()["workclass"][0]
) == round(
df_workclass_federal_gov[0]
/ (df_workclass_federal_gov[0] + df_workclass_federal_gov[1])
)
odf = cat_to_num_supervised(
spark_session,
df,
list_of_cols=[],
drop_cols=["ifa"],
label_col="income",
event_label="<=50K",
)
assert odf.select("workclass").dtypes[0][1] == "string"
assert odf.select("marital-status").dtypes[0][1] == "string"
assert odf.select("relationship").dtypes[0][1] == "string"
assert odf.select("education").dtypes[0][1] == "string"
odf = cat_to_num_supervised(
spark_session,
df,
list_of_cols=["workclass", "relationship", "marital-status"],
drop_cols=["ifa"],
label_col="income",
event_label="<=50K",
output_mode="append",
)
assert len(odf.columns) == 20
| 34.737485 | 106 | 0.60826 | 3,611 | 28,450 | 4.580449 | 0.054556 | 0.058041 | 0.040266 | 0.070073 | 0.931076 | 0.907981 | 0.87104 | 0.843712 | 0.801995 | 0.731983 | 0 | 0.02742 | 0.221898 | 28,450 | 818 | 107 | 34.779951 | 0.719745 | 0.003691 | 0 | 0.668022 | 0 | 0.001355 | 0.144012 | 0.00307 | 0 | 0 | 0 | 0 | 0.262873 | 1 | 0.02168 | false | 0 | 0.00813 | 0 | 0.02981 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
5b7fe26e1b2cf62669f3e7258a020bc4d3f7a49f | 32 | py | Python | hlrl/core/envs/unity/__init__.py | Chainso/HLRL | 584f4ed2fa4d8b311a21dbd862ec9434833dd7cd | [
"MIT"
] | null | null | null | hlrl/core/envs/unity/__init__.py | Chainso/HLRL | 584f4ed2fa4d8b311a21dbd862ec9434833dd7cd | [
"MIT"
] | null | null | null | hlrl/core/envs/unity/__init__.py | Chainso/HLRL | 584f4ed2fa4d8b311a21dbd862ec9434833dd7cd | [
"MIT"
] | null | null | null | from .unity_env import UnityEnv
| 16 | 31 | 0.84375 | 5 | 32 | 5.2 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.125 | 32 | 1 | 32 | 32 | 0.928571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
5ba0a3f6dcb3b293037c07d82e7b161a5953eaf1 | 16,032 | py | Python | Cogs/XpBlock.py | kazoeru/Acinonyx-v3 | 6d202ee22179567b132010aeec34d51cd316913c | [
"MIT"
] | null | null | null | Cogs/XpBlock.py | kazoeru/Acinonyx-v3 | 6d202ee22179567b132010aeec34d51cd316913c | [
"MIT"
] | null | null | null | Cogs/XpBlock.py | kazoeru/Acinonyx-v3 | 6d202ee22179567b132010aeec34d51cd316913c | [
"MIT"
] | null | null | null | import asyncio
import discord
import time
import random
import re
from operator import itemgetter
from discord.ext import commands
from Cogs import Message
from Cogs import Nullify
from Cogs import DisplayName
def setup(bot):
# Add the bot and deps
settings = bot.get_cog("Settings")
bot.add_cog(XpBlock(bot, settings))
class XpBlock(commands.Cog):
# Init with the bot reference, and a reference to the settings var and xp var
def __init__(self, bot, settings):
self.bot = bot
self.settings = settings
global Utils, DisplayName
Utils = self.bot.get_cog("Utils")
DisplayName = self.bot.get_cog("DisplayName")
@commands.command(pass_context=True)
async def xpblock(self, ctx, *, user_or_role : str = None):
"""Menambahkan user atau role kedalam xp block list (admin only)."""
em = discord.Embed(color = 0XFF8C00,description = "> Menambahkan user atau role kedalam xp block list\n> \n"
"> **Panduan**"
"> `{}xpblock [user/role]`"
.format(ctx.prefix))
em.set_footer(text = "Saat mengetik command, tanda [] tidak usah digunakan\n{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
# Check if we're suppressing @here and @everyone mentions
if self.settings.getServerStat(ctx.message.guild, "SuppressMentions"):
suppress = True
else:
suppress = False
isAdmin = ctx.message.author.permissions_in(ctx.message.channel).administrator
if not isAdmin:
checkAdmin = self.settings.getServerStat(ctx.message.guild, "AdminArray")
for role in ctx.message.author.roles:
for aRole in checkAdmin:
# Get the role that corresponds to the id
if str(aRole['ID']) == str(role.id):
isAdmin = True
# Only allow admins to change server stats
if not isAdmin:
msg = '┐( ̄ヘ ̄;)┌\nKamu tidak memiliki izin untuk menggunakan command ini.'
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.channel.send(embed = em)
return
if user_or_role == None:
await ctx.message.channel.send(embed=em)
return
roleName = user_or_role
is_user = True
if type(user_or_role) is str:
# Check user first
user_or_role = DisplayName.memberForName(roleName, ctx.guild)
if not user_or_role:
is_user = False
# Check role
if roleName.lower() == "everyone" or roleName.lower() == "@everyone":
user_or_role = ctx.guild.default_role
else:
user_or_role = DisplayName.roleForName(roleName, ctx.guild)
if not user_or_role:
msg = '┐( ̄ヘ ̄;)┌\nAku tidak dapat menemukan *{}*...'.format(roleName)
# Check for suppress
if suppress:
msg = Nullify.clean(msg)
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.message.channel.send(embed = em)
return
if is_user:
# Check if they're admin or bot admin
isAdmin = user_or_role.permissions_in(ctx.message.channel).administrator
if not isAdmin:
checkAdmin = self.settings.getServerStat(ctx.message.guild, "AdminArray")
for role in user_or_role.roles:
for aRole in checkAdmin:
# Get the role that corresponds to the id
if str(aRole['ID']) == str(role.id):
isAdmin = True
if isAdmin:
msg = "┐( ̄ヘ ̄;)┌\nKamu tidak dapat menggunakan command ini kepada admin lain."
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.send(embed = em)
return
ur_name = DisplayName.name(user_or_role)
else:
# Check if the role is admin or bot admin
isAdmin = user_or_role.permissions.administrator
if not isAdmin:
checkAdmin = self.settings.getServerStat(ctx.message.guild, "AdminArray")
for aRole in checkAdmin:
# Get the role that corresponds to the id
if str(aRole['ID']) == str(user_or_role.id):
isAdmin = True
if isAdmin:
msg = "┐( ̄ヘ ̄;)┌\nKamu tidak dapat menggunakan command ini kepada admin lain."
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.send(embed = em)
return
ur_name = user_or_role.name
# Now we see if we already have that role in our list
promoArray = self.settings.getServerStat(ctx.message.guild, "XpBlockArray")
for aRole in promoArray:
# Get the role that corresponds to the id
if str(aRole) == str(user_or_role.id):
# We found it - throw an error message and return
msg = '**{}** sudah didalam list.'.format(ur_name)
# Check for suppress
if suppress:
msg = Nullify.clean(msg)
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.message.channel.send(embed = em)
return
# If we made it this far - then we can add it
promoArray.append(user_or_role.id)
self.settings.setServerStat(ctx.message.guild, "XpBlockArray", promoArray)
msg = '**{}** ditambahkan kedalam list.'.format(ur_name)
# Check for suppress
if suppress:
msg = Nullify.clean(msg)
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.message.channel.send(embed = em)
return
@commands.command(pass_context=True)
async def xpunblockall(self, ctx):
"""Menghapus semua user dan role yang terdarfat dalam blocklist (admin only)."""
# Check if we're suppressing @here and @everyone mentions
if self.settings.getServerStat(ctx.message.guild, "SuppressMentions"):
suppress = True
else:
suppress = False
isAdmin = ctx.message.author.permissions_in(ctx.message.channel).administrator
if not isAdmin:
checkAdmin = self.settings.getServerStat(ctx.message.guild, "AdminArray")
for role in ctx.message.author.roles:
for aRole in checkAdmin:
# Get the role that corresponds to the id
if str(aRole['ID']) == str(role.id):
isAdmin = True
# Only allow admins to change server stats
if not isAdmin:
msg = '┐( ̄ヘ ̄;)┌\nKamu tidak memiliki hak untuk menggunakan command ini.'
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.channel.send(embed = em)
return
xparray = self.settings.getServerStat(ctx.message.guild, "XpBlockArray")
self.settings.setServerStat(ctx.message.guild, "XpBlockArray", [])
if len(xparray) == 1:
msg = "*1* user/role telah diunblock dari system xp."
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.send(embed = em)
else:
msg = "*{}* user/role telah diunblock dari system xp.".format(len(xparray))
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.send(embed = em)
@commands.command(pass_context=True)
async def xpunblock(self, ctx, *, user_or_role : str = None):
"""Menghapus user atau role dari list xp block (admin only)."""
em = discord.Embed(color = 0XFF8C00,description = "> Menghapus user atau role dari list xp block\n> \n"
"> **Panduan**"
"> `{}xpunblock [user/role]`"
.format(ctx.prefix))
em.set_footer(text = "Saat mengetik command, tanda [] tidak usah digunakan\nRequest by : {}".format(ctx.author.name), icon_url = "{}".format(ctx.author.avatar_url))
# Check if we're suppressing @here and @everyone mentions
if self.settings.getServerStat(ctx.message.guild, "SuppressMentions"):
suppress = True
else:
suppress = False
isAdmin = ctx.message.author.permissions_in(ctx.message.channel).administrator
if not isAdmin:
checkAdmin = self.settings.getServerStat(ctx.message.guild, "AdminArray")
for role in ctx.message.author.roles:
for aRole in checkAdmin:
# Get the role that corresponds to the id
if str(aRole['ID']) == str(role.id):
isAdmin = True
# Only allow admins to change server stats
if not isAdmin:
msg = '┐( ̄ヘ ̄;)┌\nKamu tidak memiliki izin untuk menggunakan command ini.'
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.channel.send(embed = em)
return
if user_or_role == None:
await ctx.message.channel.send(embed = em)
return
roleName = user_or_role
is_user = True
if type(user_or_role) is str:
# Check user first
user_or_role = DisplayName.memberForName(roleName, ctx.guild)
if not user_or_role:
is_user = False
# Check role
if roleName.lower() == "everyone" or roleName.lower() == "@everyone":
user_or_role = ctx.guild.default_role
else:
user_or_role = DisplayName.roleForName(roleName, ctx.guild)
if not user_or_role:
msg = '┐( ̄ヘ ̄;)┌\nAku tidak dapat menemukan *{}*...'.format(roleName)
# Check for suppress
if suppress:
msg = Nullify.clean(msg)
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.message.channel.send(embed = em)
return
if is_user:
ur_name = DisplayName.name(user_or_role)
else:
ur_name = user_or_role.name
# If we're here - then the role is a real one
promoArray = self.settings.getServerStat(ctx.message.guild, "XpBlockArray")
for aRole in promoArray:
# Check for Name
if str(aRole) == str(user_or_role.id):
# We found it - let's remove it
promoArray.remove(aRole)
self.settings.setServerStat(ctx.message.guild, "XpBlockArray", promoArray)
msg = '**{}** berhasil dihapus dari xp block list.'.format(ur_name)
# Check for suppress
if suppress:
msg = Nullify.clean(msg)
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.message.channel.send(embed = em)
return
# If we made it this far - then we didn't find it
msg = '┐( ̄ヘ ̄;)┌\n**{}** tidak ada dalam xp block list ku.'.format(ur_name)
# Check for suppress
if suppress:
msg = Nullify.clean(msg)
em = discord.Embed(color = 0XFF8C00, description = msg)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.message.channel.send(embed = em)
@commands.command(pass_context=True)
async def listxpblock(self, ctx):
"""Melihat semua user/role dari list xp block."""
# Check if we're suppressing @here and @everyone mentions
if self.settings.getServerStat(ctx.message.guild, "SuppressMentions"):
suppress = True
else:
suppress = False
promoArray = self.settings.getServerStat(ctx.message.guild, "XpBlockArray")
# rows_by_lfname = sorted(rows, key=itemgetter('lname','fname'))
#promoSorted = sorted(promoArray, key=itemgetter('Name'))
if not len(promoArray):
em = discord.Embed(color = 0XFF8C00, description = "> ┐( ̄ヘ ̄;)┌\n"
"> Tidak ada user atau role yang di blokir.\n"
"> Gunakan command `{}xpblock [user/role]` untuk menambahkan kedaftar list xp block")
em.set_author(name = "listxpblock command", url = "https://acinonyxesports.com", icon_url = "https://cdn.discordapp.com/attachments/518118753226063887/725569194304733435/photo.jpg")
em.set_thumbnail(url = "{}".format(ctx.message.guild.icon_url))
em.set_footer(text = "Saat mengetik command, tanda [] tidak usah digunakan\nRequest by : {}".format(ctx.author.name), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.channel.send(embed = em)
return
roleText = "__**Daftar blokir user dan role saat ini:**__\n\n"
for arole in promoArray:
test = DisplayName.memberForID(arole, ctx.guild)
if test:
# It's a user
roleText = roleText + "**{}**, ".format(DisplayName.name(test))
continue
test = DisplayName.roleForID(arole, ctx.guild)
if test:
# It's a role
roleText = roleText + "**{}** (Role), ".format(test.name)
continue
# Didn't find a role or person
roleText = roleText + "**{}** (dihapus dari server), ".format(arole)
roleText = roleText[:-2]
# Check for suppress
if suppress:
roleText = Nullify.clean(roleText)
em = discord.Embed(color = 0XFF8C00, description = roleText)
em.set_footer(text = "{}".format(ctx.author), icon_url = "{}".format(ctx.author.avatar_url))
await ctx.channel.send(embed = em) | 48.581818 | 194 | 0.548653 | 1,797 | 16,032 | 4.830829 | 0.125209 | 0.03836 | 0.058749 | 0.037208 | 0.803479 | 0.797604 | 0.784587 | 0.75049 | 0.698883 | 0.675268 | 0 | 0.010207 | 0.34612 | 16,032 | 330 | 195 | 48.581818 | 0.814462 | 0.087388 | 0 | 0.75 | 0 | 0 | 0.124339 | 0 | 0 | 0 | 0.009713 | 0 | 0 | 1 | 0.008197 | false | 0.016393 | 0.040984 | 0 | 0.106557 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
5be89c47a2c67c4d8e2b061154f891e30d7627ed | 1,127 | py | Python | databall/stats.py | emanuelef/databall | 4433b9b65201e66228c8a742a79c6c6e9c01ac42 | [
"MIT"
] | 78 | 2018-02-03T03:00:04.000Z | 2022-03-18T18:28:17.000Z | databall/stats.py | emanuelef/databall | 4433b9b65201e66228c8a742a79c6c6e9c01ac42 | [
"MIT"
] | 363 | 2018-10-24T02:08:40.000Z | 2022-03-03T21:53:52.000Z | databall/stats.py | emanuelef/databall | 4433b9b65201e66228c8a742a79c6c6e9c01ac42 | [
"MIT"
] | 18 | 2018-03-09T04:50:51.000Z | 2022-01-24T16:28:51.000Z | def eff_fg_pct(data, group=''):
return (data[group + 'FGM'] + 0.5 * data[group + 'FG3M']) / data[group + 'FGA']
def fg_pct(data, group=''):
return data[group + 'FGM'] / data[group + 'FGA']
def fg2a(data, group=''):
return data[group + 'FGA'] - data[group + 'FG3A']
def fg2m(data, group=''):
return data[group + 'FGM'] - data[group + 'FG3M']
def fg2_pct(data, group=''):
return fg2m(data, group) / fg2a(data, group)
def fg3_pct(data, group=''):
return data[group + 'FG3M'] / data[group + 'FG3A']
def fg3a_rate(data, group=''):
return data[group + 'FG3A'] / data[group + 'FGA']
def ft_pct(data, group=''):
return data[group + 'FTM'] / data[group + 'FTA']
def ft_per_fga(data, group=''):
return data[group + 'FTM'] / data[group + 'FGA']
def ft_rate(data, group=''):
return data[group + 'FTA'] / data[group + 'FGA']
def tov_pct(data, group=''):
return data[group + 'TOV'] / (data[group + 'FGA'] + 0.44 * data[group + 'FTA'] + data[group + 'TOV'])
def ts_pct(data, group=''):
return data[group + 'PTS'] / (2 * (data[group + 'FGA'] + 0.44 * data[group + 'FTA']))
| 23.978723 | 105 | 0.578527 | 163 | 1,127 | 3.92638 | 0.165644 | 0.5625 | 0.28125 | 0.326563 | 0.75 | 0.585938 | 0.367188 | 0.367188 | 0 | 0 | 0 | 0.024363 | 0.198758 | 1,127 | 46 | 106 | 24.5 | 0.684385 | 0 | 0 | 0 | 0 | 0 | 0.074534 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.5 | false | 0 | 0 | 0.5 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
5bf089888547a6e698745b53ecadc03295572f83 | 19,993 | py | Python | tests/test_collisions.py | lianwenzhao/pybullet_planning | ffb1ba1c2912712f31dce16188a33333d211bcd2 | [
"MIT"
] | null | null | null | tests/test_collisions.py | lianwenzhao/pybullet_planning | ffb1ba1c2912712f31dce16188a33333d211bcd2 | [
"MIT"
] | null | null | null | tests/test_collisions.py | lianwenzhao/pybullet_planning | ffb1ba1c2912712f31dce16188a33333d211bcd2 | [
"MIT"
] | null | null | null | import os
import sys
import pytest
import numpy as np
from pybullet_planning import BASE_LINK
from pybullet_planning import load_pybullet, connect, wait_for_user, LockRenderer, has_gui, WorldSaver, HideOutput, \
reset_simulation, disconnect, set_camera_pose, has_gui
from pybullet_planning import Pose, Point, Euler
from pybullet_planning import multiply, invert
from pybullet_planning import create_obj, create_attachment, Attachment
from pybullet_planning import link_from_name, get_link_pose, get_moving_links, get_link_name, get_disabled_collisions, \
get_body_body_disabled_collisions, has_link, are_links_adjacent
from pybullet_planning import get_num_joints, get_joint_names, get_movable_joints, set_joint_positions, joint_from_name
from pybullet_planning import dump_world, set_pose
from pybullet_planning import get_collision_fn, get_floating_body_collision_fn, expand_links
@pytest.fixture
def robot_path():
here = os.path.dirname(__file__)
return os.path.join(here, 'test_data', 'universal_robot', 'ur_description', 'urdf', 'ur5.urdf')
@pytest.fixture
def workspace_path():
here = os.path.dirname(__file__)
return os.path.join(here, 'test_data', 'mit_3-412_workspace', 'urdf', 'mit_3-412_workspace.urdf')
@pytest.fixture
def ee_path():
here = os.path.dirname(__file__)
return os.path.join(here, 'test_data', 'dms_bar_gripper.obj')
@pytest.fixture
def attach_obj_path():
here = os.path.dirname(__file__)
return os.path.join(here, 'test_data', 'bar_attachment.obj')
@pytest.fixture
def obstacle_obj_path():
here = os.path.dirname(__file__)
return os.path.join(here, 'test_data', 'box_obstacle.obj')
# @pytest.fixture
# def collision_diagnosis():
# return True
# # return False
def test_collision_fn(viewer, robot_path, ee_path, workspace_path, attach_obj_path, obstacle_obj_path):
client_id = connect(use_gui=viewer)
print('-' * 100)
print(client_id)
with HideOutput():
robot = load_pybullet(client_id, robot_path, fixed_base=True)
workspace = load_pybullet(client_id, workspace_path, fixed_base=True)
ee_body = create_obj(client_id, ee_path)
attached_bar_body = create_obj(client_id, attach_obj_path)
box_body = create_obj(client_id, obstacle_obj_path)
if sys.version_info[0] >= 3:
assert isinstance(robot, int) and isinstance(ee_body, int)
else:
assert isinstance(robot, (long, int)) and isinstance(ee_body, (long, int))
dump_world(client_id)
# * adjust camera pose (optional)
if has_gui(client_id):
camera_base_pt = (0,0,0)
camera_pt = np.array(camera_base_pt) + np.array([1, -0.5, 0.5])
set_camera_pose(client_id, tuple(camera_pt), camera_base_pt)
ik_joints = get_movable_joints(client_id, robot)
robot_start_conf = [0,-1.65715,1.71108,-1.62348,0,0]
set_joint_positions(client_id, robot, ik_joints, robot_start_conf)
tool_attach_link_name = 'ee_link'
tool_attach_link = link_from_name(client_id, robot, tool_attach_link_name)
assert isinstance(tool_attach_link, int)
robot_self_collision_disabled_link_names = [('base_link', 'shoulder_link'),
('ee_link', 'wrist_1_link'), ('ee_link', 'wrist_2_link'),
('ee_link', 'wrist_3_link'), ('forearm_link', 'upper_arm_link'),
('forearm_link', 'wrist_1_link'), ('shoulder_link', 'upper_arm_link'),
('wrist_1_link', 'wrist_2_link'), ('wrist_1_link', 'wrist_3_link'),
('wrist_2_link', 'wrist_3_link')]
self_collision_links = get_disabled_collisions(client_id, robot, robot_self_collision_disabled_link_names)
assert all(isinstance(lp, tuple) for lp in self_collision_links)
for lp in self_collision_links:
assert len(lp) == 2 and has_link(client_id, robot, get_link_name(client_id, robot, lp[0])) and has_link(client_id, robot, get_link_name(client_id, robot, lp[1]))
extra_disabled_link_names = [('base_link', 'MIT_3412_robot_base_plate'),
('shoulder_link', 'MIT_3412_robot_base_plate')]
extra_disabled_collisions = get_body_body_disabled_collisions(client_id, robot, workspace, extra_disabled_link_names)
for bbl in list(extra_disabled_collisions):
assert isinstance(bbl[0], tuple) and isinstance(bbl[1], tuple)
if bbl[0][0] == robot:
assert has_link(client_id, robot, get_link_name(client_id, robot, bbl[0][1]))
assert bbl[1][0] == workspace and has_link(client_id, workspace, get_link_name(client_id, workspace, bbl[1][1]))
else:
assert bbl[0][0] == workspace and has_link(client_id, workspace, get_link_name(client_id, workspace, bbl[0][1]))
assert bbl[1][0] == robot and has_link(client_id, robot, get_link_name(client_id, robot, bbl[1][1]))
assert are_links_adjacent(client_id, robot, link_from_name(client_id, robot, 'wrist_3_link'), tool_attach_link)
extra_disabled_collisions.add(((robot, link_from_name(client_id, robot, 'wrist_3_link')), (ee_body, BASE_LINK)))
print('extra diasabled: {}'.format(extra_disabled_collisions))
# * attach the end effector
ee_link_pose = get_link_pose(client_id, robot, tool_attach_link)
set_pose(client_id, ee_body, ee_link_pose)
ee_attach = create_attachment(client_id, robot, tool_attach_link, ee_body)
assert isinstance(ee_attach, Attachment)
ee_attach.assign()
# * attach the bar
ee_link_from_tcp = Pose(point=(0.094, 0, 0))
set_pose(client_id, attached_bar_body, multiply(ee_link_pose, ee_link_from_tcp))
bar_attach = create_attachment(client_id, robot, tool_attach_link, attached_bar_body)
assert isinstance(bar_attach, Attachment)
bar_attach.assign()
attachments = [ee_attach, bar_attach]
# * collision checks
print('#'*10)
print('robot links self-collision')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[],
attachments=attachments, self_collisions=True,
disabled_collisions=self_collision_links)
conf = [-1.029744, -1.623156, 2.844887, -0.977384, 1.58825, 0.314159]
with pytest.warns(UserWarning, match='moving body link - moving body link collision'):
assert collision_fn(conf, diagnosis=True)
print('#'*10)
print('robot links - holding attachment self-collision')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[],
attachments=attachments, self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions)
conf = [0.03500, -2.26900, 2.44300, 1.117, 1.6579, 0.105]
with pytest.warns(UserWarning, match='moving body link - attachement collision'):
assert collision_fn(conf, diagnosis=True)
print('\n')
print('#'*10)
print('robot links to obstacles (w/o links) collision')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[box_body],
attachments=attachments, self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions)
conf = [-0.105, -0.76800000000000002, 1.292, -0.61099999999999999, 1.484, 0.105]
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert collision_fn(conf, diagnosis=True)
print('\n')
print('#'*10)
print('robot links to multi-link obstacle collision')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[workspace],
attachments=[], self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions)
conf = [-0.17499999999999999, -3.194, 0.33200000000000002, -1.6579999999999999, 1.431, 0.105]
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert collision_fn(conf, diagnosis=True)
print('\n')
print('#'*10)
print('attachment to obstacles (w/o links) collision')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[workspace, box_body],
attachments=attachments, self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions)
conf = [-2.8100000000000001, -1.484, -1.9199999999999999, -1.6579999999999999, 1.431, 0.105]
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert collision_fn(conf, diagnosis=True)
print('\n')
print('#'*10)
print('attachment to multi-link obstacle collision')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[workspace],
attachments=attachments, self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions)
conf = [-0.17499999999999999, -2.4780000000000002, 0.33200000000000002, -1.6579999999999999, 1.431, 0.105]
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert collision_fn(conf, diagnosis=True)
print('\n')
# * collision checking exoneration
print('#'*10)
print('self-link collision disable')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[],
attachments=[], self_collisions=False)
conf = [-1.029744, -1.623156, 2.844887, -0.977384, 1.58825, 0.314159]
assert not collision_fn(conf, diagnosis=True)
print('\n')
print('#'*10)
print('robot links to obstacle collision exoneration')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[box_body],
attachments=[], self_collisions=True,
disabled_collisions=self_collision_links,
)
collision_fn_disable = get_collision_fn(client_id, robot, ik_joints, obstacles=[box_body],
attachments=[], self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions.union(
[((robot, link_from_name(client_id, robot, 'forearm_link')),
(box_body, BASE_LINK))]),
)
conf = [-3.2639999999999998, -2.6880000000000002, -0.85499999999999998, -1.536, 3.0369999999999999, -0.070000000000000007]
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert collision_fn(conf, diagnosis=True)
assert not collision_fn_disable(conf, diagnosis=True)
print('\n')
print('#'*10)
print('robot links to multi-links obstacles collision exoneration')
set_pose(client_id, workspace, Pose(point=(0,0,0.03)))
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[workspace],
attachments=[], self_collisions=True,
disabled_collisions=self_collision_links,
)
collision_fn_disable = get_collision_fn(client_id, robot, ik_joints, obstacles=[workspace],
attachments=[], self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions.union(
[((robot, link_from_name(client_id, robot, 'upper_arm_link')),
(workspace, link_from_name(client_id, workspace, 'MIT_3412_robot_base_plate')))]),
)
conf = [-3.0019999999999998, -1.8680000000000001, 0.33200000000000002, -1.6579999999999999, 1.431, 0.105]
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert collision_fn(conf, diagnosis=True)
assert not collision_fn_disable(conf, diagnosis=True)
set_pose(client_id, workspace, Pose(point=(0,0,0)))
print('\n')
print('#'*10)
print('attachment to obstacles collision exoneration')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[workspace, box_body],
attachments=[ee_attach], self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions)
collision_fn_disabled = get_collision_fn(client_id, robot, ik_joints, obstacles=[workspace, box_body],
attachments=[ee_attach], self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions.union(
[((ee_attach.child, BASE_LINK), (box_body, BASE_LINK))]),
)
conf = [-3.0369999999999999, -1.6060000000000001, -1.99, -0.92500000000000004, 1.78, 0.105]
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert collision_fn(conf, diagnosis=True)
assert not collision_fn_disable(conf, diagnosis=True)
print('\n')
print('#'*10)
print('attachment to multi-links obstacles collision exoneration')
collision_fn = get_collision_fn(client_id, robot, ik_joints, obstacles=[workspace],
attachments=[ee_attach], self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions)
collision_fn_disabled = get_collision_fn(client_id, robot, ik_joints, obstacles=[workspace],
attachments=[ee_attach], self_collisions=True,
disabled_collisions=self_collision_links,
extra_disabled_collisions=extra_disabled_collisions.union(
[((workspace, link_from_name(client_id, workspace, 'MIT_3412_fab_table')),
(ee_attach.child, BASE_LINK))]),
)
conf = [-2.8450000000000002, -2.1469999999999998, -1.99, -0.92500000000000004, 1.78, 0.105]
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert collision_fn(conf, diagnosis=True)
assert not collision_fn_disable(conf, diagnosis=True)
print('\n')
# * joint value overflow checking & exoneration
print('joint value overflow checking & exoneration')
def get_custom_limits_from_name(robot, joint_limits):
return {joint_from_name(client_id, robot, joint): limits
for joint, limits in joint_limits.items()}
custom_limits = get_custom_limits_from_name(robot, {'shoulder_pan_joint':(-7.9, 0), 'elbow_joint':(-8.0, 0)})
collision_fn = get_collision_fn(client_id, robot, ik_joints)
collision_fn_disable = get_collision_fn(client_id, robot, ik_joints, custom_limits=custom_limits)
conf = [-7.8450000000000002, -2.1469999999999998, -7.99, -0.92500000000000004, 1.78, 0.105]
with pytest.warns(UserWarning, match='joint limit violation!'):
assert collision_fn(conf, diagnosis=True)
assert not collision_fn_disable(conf, diagnosis=True)
print('\n')
@pytest.mark.wip
def test_floating_collsion_fn(viewer, robot_path, ee_path, workspace_path, attach_obj_path, obstacle_obj_path):
client_id = connect(use_gui=viewer)
with HideOutput():
robot = load_pybullet(client_id, robot_path, fixed_base=True)
workspace = load_pybullet(client_id, workspace_path, fixed_base=True)
ee_body = create_obj(client_id, ee_path)
attached_bar_body = create_obj(client_id, attach_obj_path)
box_body = create_obj(client_id, obstacle_obj_path)
dump_world(client_id)
# * adjust camera pose (optional)
if has_gui(client_id):
camera_base_pt = (0,0,0)
camera_pt = np.array(camera_base_pt) + np.array([1, -0.5, 0.5])
set_camera_pose(client_id, tuple(camera_pt), camera_base_pt)
ik_joints = get_movable_joints(client_id, robot)
robot_start_conf = [0,-1.65715,1.71108,-1.62348,0,0]
set_joint_positions(client_id, robot, ik_joints, robot_start_conf)
tool_attach_link_name = 'ee_link'
tool_attach_link = link_from_name(client_id, robot, tool_attach_link_name)
assert isinstance(tool_attach_link, int)
print('#'*10)
print('floating body to obstacles collision exoneration')
conf = [-3.0369999999999999, -1.6060000000000001, -1.99, -0.92500000000000004, 1.78, 0.105]
set_joint_positions(client_id, robot, ik_joints, conf)
world_from_tool0 = get_link_pose(client_id, robot, tool_attach_link)
fb_collision_fn = get_floating_body_collision_fn(client_id, ee_body, obstacles=[box_body],
attachments=[], disabled_collisions=[])
fb_collision_fn_disable = get_floating_body_collision_fn(client_id, ee_body, obstacles=[box_body],
attachments=[], disabled_collisions=
{((box_body, BASE_LINK), (ee_body, BASE_LINK))})
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert fb_collision_fn(world_from_tool0, diagnosis=True)
assert not fb_collision_fn_disable(world_from_tool0, diagnosis=True)
print('\n')
print('#'*10)
print('attachment to multi-links obstacles collision exoneration')
conf = [-2.8450000000000002, -2.1469999999999998, -1.99, -0.92500000000000004, 1.78, 0.105]
set_joint_positions(client_id, robot, ik_joints, conf)
world_from_tool0 = get_link_pose(client_id, robot, tool_attach_link)
fb_collision_fn = get_floating_body_collision_fn(client_id, ee_body, obstacles=[workspace],
attachments=[], disabled_collisions=[])
fb_collision_fn_disable = get_floating_body_collision_fn(client_id, ee_body, obstacles=[workspace],
attachments=[], disabled_collisions=
{((workspace, link_from_name(client_id, workspace, 'MIT_3412_fab_table')),
(ee_body, BASE_LINK))})
with pytest.warns(UserWarning, match='moving body - body collision!'):
assert fb_collision_fn(world_from_tool0, diagnosis=True)
assert not fb_collision_fn_disable(world_from_tool0, diagnosis=True)
print('\n')
if __name__ == '__main__':
here = os.path.dirname(__file__)
test_collision_fn(
True,
os.path.join(here, 'test_data', 'universal_robot', 'ur_description', 'urdf', 'ur5.urdf'),
os.path.join(here, 'test_data', 'dms_bar_gripper.obj'),
os.path.join(here, 'test_data', 'mit_3-412_workspace', 'urdf', 'mit_3-412_workspace.urdf'),
os.path.join(here, 'test_data', 'bar_attachment.obj'),
os.path.join(here, 'test_data', 'box_obstacle.obj')
)
| 56.637394 | 169 | 0.647777 | 2,407 | 19,993 | 5.039468 | 0.092646 | 0.052762 | 0.051443 | 0.025969 | 0.80033 | 0.762737 | 0.741303 | 0.724897 | 0.714427 | 0.687222 | 0 | 0.069108 | 0.250188 | 19,993 | 352 | 170 | 56.798295 | 0.740044 | 0.014055 | 0 | 0.559211 | 0 | 0 | 0.097518 | 0.006244 | 0 | 0 | 0 | 0 | 0.115132 | 1 | 0.026316 | false | 0 | 0.042763 | 0.003289 | 0.088816 | 0.141447 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
5bf616f1294b023798e92df2bd733591907ea66e | 1,792 | py | Python | hpc-historias-clinicas/antecedentes_personales/migrations/0002_auto_20150413_0001.py | btenaglia/hpc-historias-clinicas | 649d8660381381b1c591667760c122d73071d5ec | [
"BSD-3-Clause"
] | null | null | null | hpc-historias-clinicas/antecedentes_personales/migrations/0002_auto_20150413_0001.py | btenaglia/hpc-historias-clinicas | 649d8660381381b1c591667760c122d73071d5ec | [
"BSD-3-Clause"
] | null | null | null | hpc-historias-clinicas/antecedentes_personales/migrations/0002_auto_20150413_0001.py | btenaglia/hpc-historias-clinicas | 649d8660381381b1c591667760c122d73071d5ec | [
"BSD-3-Clause"
] | null | null | null | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('antecedentes_personales', '0001_initial'),
]
operations = [
migrations.AlterField(
model_name='antecedentespersonales',
name='alergia',
field=models.TextField(default='Niega', null=True, blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='antecedentespersonales',
name='antecedentes_quirurgicos',
field=models.TextField(default='Niega', null=True, verbose_name='Antecedentes Quir\xfargicos', blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='antecedentespersonales',
name='antecedentes_traumaticos',
field=models.TextField(default='Niega', null=True, verbose_name='Antecedentes Traum\xe1ticos', blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='antecedentespersonales',
name='enfermedad_adulto',
field=models.TextField(default='Niega', null=True, blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='antecedentespersonales',
name='enfermedad_infantil',
field=models.TextField(default='Niega', null=True, blank=True),
preserve_default=True,
),
migrations.AlterField(
model_name='antecedentespersonales',
name='internaciones_previas',
field=models.TextField(default='Niega', null=True, blank=True),
preserve_default=True,
),
]
| 35.137255 | 119 | 0.617188 | 153 | 1,792 | 7.058824 | 0.294118 | 0.111111 | 0.138889 | 0.161111 | 0.766667 | 0.766667 | 0.715741 | 0.715741 | 0.715741 | 0.715741 | 0 | 0.004612 | 0.273996 | 1,792 | 50 | 120 | 35.84 | 0.825519 | 0.011719 | 0 | 0.636364 | 0 | 0 | 0.205201 | 0.126625 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.045455 | 0 | 0.113636 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
5bff5daa15b768b412eb15e280e80e818274b5c8 | 18,690 | py | Python | layers/modules/multibox_loss.py | RobotBj/FERNet | 33d798f50b7c31229d5e5a1a9e7a5bcccf2fe55a | [
"Apache-2.0"
] | 2 | 2021-08-03T03:28:44.000Z | 2021-08-03T03:28:45.000Z | layers/modules/multibox_loss.py | RobotBj/FERNet | 33d798f50b7c31229d5e5a1a9e7a5bcccf2fe55a | [
"Apache-2.0"
] | null | null | null | layers/modules/multibox_loss.py | RobotBj/FERNet | 33d798f50b7c31229d5e5a1a9e7a5bcccf2fe55a | [
"Apache-2.0"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
from utils.box_utils import match, log_sum_exp, decode, encode
from focalloss import FocalLoss
GPU = False
if torch.cuda.is_available():
GPU = True
class MultiBoxLoss(nn.Module):
"""SSD Weighted Loss Function
Compute Targets:
1) Produce Confidence Target Indices by matching ground truth boxes
with (default) 'priorboxes' that have jaccard index > threshold parameter
(default threshold: 0.5).
2) Produce localization target by 'encoding' variance into offsets of ground
truth boxes and their matched 'priorboxes'.
3) Hard negative mining to filter the excessive number of negative examples
that comes with using a large number of default bounding boxes.
(default negative:positive ratio 3:1)
Objective Loss:
L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
Where, Lconf is the CrossEntropy Loss and Lloc is the SmoothL1 Loss
weighted by α which is set to 1 by cross val.
Args:
c: class confidences,
l: predicted boxes,
g: ground truth boxes
N: number of matched default boxes
See: https://arxiv.org/pdf/1512.02325.pdf for more details.
"""
def __init__(self, num_classes,overlap_thresh,prior_for_matching,bkg_label,neg_mining,neg_pos,neg_overlap,encode_target):
super(MultiBoxLoss, self).__init__()
self.num_classes = num_classes
self.threshold = overlap_thresh
self.background_label = bkg_label
self.encode_target = encode_target
self.use_prior_for_matching = prior_for_matching
self.do_neg_mining = neg_mining
self.negpos_ratio = neg_pos
self.neg_overlap = neg_overlap
self.variance = [0.1,0.2]
def forward(self, predictions, priors, targets):
"""Multibox Loss
Args:
predictions (tuple): A tuple containing loc preds, conf preds,
and prior boxes from SSD net.
conf shape: torch.size(batch_size,num_priors,num_classes)
loc shape: torch.size(batch_size,num_priors,4)
priors shape: torch.size(num_priors,4)
ground_truth (tensor): Ground truth boxes and labels for a batch,
shape: [batch_size,num_objs,5] (last idx is the label).
"""
loc_data, conf_data = predictions
priors = priors
num = loc_data.size(0)
num_priors = (priors.size(0))
num_classes = self.num_classes
# match priors (default boxes) and ground truth boxes
loc_t = torch.Tensor(num, num_priors, 4)
conf_t = torch.LongTensor(num, num_priors)
for idx in range(num):
truths = targets[idx][:,:-1].data
labels = targets[idx][:,-1].data
defaults = priors.data
match(self.threshold,truths,defaults,self.variance,labels,loc_t,conf_t,idx)
if GPU:
loc_t = loc_t.cuda()
conf_t = conf_t.cuda()
# wrap targets
loc_t = Variable(loc_t, requires_grad=False)
conf_t = Variable(conf_t,requires_grad=False)
pos = conf_t > 0
# Localization Loss (Smooth L1)
# Shape: [batch,num_priors,4]
pos_idx = pos.unsqueeze(pos.dim()).expand_as(loc_data)
loc_p = loc_data[pos_idx].view(-1,4)
loc_t = loc_t[pos_idx].view(-1,4)
loss_l = F.smooth_l1_loss(loc_p, loc_t,reduction='sum')
# Compute max conf across batch for hard negative mining
batch_conf = conf_data.view(-1,self.num_classes)
loss_c = log_sum_exp(batch_conf) - batch_conf.gather(1, conf_t.view(-1,1))
# Hard Negative Mining
loss_c[pos.view(-1,1)] = 0 # filter out pos boxes for now
loss_c = loss_c.view(num, -1)
_,loss_idx = loss_c.sort(1, descending=True) #loss_c降序排列
_,idx_rank = loss_idx.sort(1) #取出索引值
num_pos = pos.long().sum(1,keepdim=True)
num_neg = torch.clamp(self.negpos_ratio*num_pos, max=pos.size(1)-1)
neg = idx_rank < num_neg.expand_as(idx_rank)
# Confidence Loss Including Positive and Negative Examples
pos_idx = pos.unsqueeze(2).expand_as(conf_data)
neg_idx = neg.unsqueeze(2).expand_as(conf_data)
conf_p = conf_data[(pos_idx+neg_idx).gt(0)].view(-1,self.num_classes)
targets_weighted = conf_t[(pos+neg).gt(0)]
loss_c = F.cross_entropy(conf_p, targets_weighted, reduction='sum')
# Sum of losses: L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
N = max(num_pos.data.sum().float(), 1)
loss_l/=N
loss_c/=N
return loss_l,loss_c
# class GiouLoss(nn.Module):
# """
# This criterion is a implemenation of Giou Loss, which is proposed in
# Generalized Intersection over Union Loss for: A Metric and A Loss for Bounding Box Regression.
#
# Loss(loc_p, loc_t) = 1-GIoU
#
# The losses are summed across observations for each minibatch.
#
# Args:
# size_sum(bool): By default, the losses are summed over observations for each minibatch.
# However, if the field size_sum is set to False, the losses are
# instead averaged for each minibatch.
# predmodel(Corner,Center): By default, the loc_p is the Corner shape like (x1,y1,x2,y2)
# The shape is [num_prior,4],and it's (x_1,y_1,x_2,y_2)
# loc_p: the predict of loc
# loc_t: the truth of boxes, it's (x_1,y_1,x_2,y_2)
#
# """
#
# def __init__(self, pred_mode='Center', size_sum=True, variances=None):
# super(GiouLoss, self).__init__()
# self.size_sum = size_sum
# self.pred_mode = pred_mode
# self.variances = [0.1, 0.2]
#
# def forward(self, loc_p, loc_t, prior_data):
# num = loc_p.shape[0]
#
# if self.pred_mode == 'Center':
#
# decoded_boxes = decode(loc_p, prior_data, self.variances)
# else:
# decoded_boxes = loc_p
# # loss = torch.tensor([1.0])
#
# pregiou = bbox_overlaps_giou(decoded_boxes, loc_t)
# pregiou = torch.autograd.Variable(pregiou, requires_grad=True)
#
# gious = 1.0 - pregiou
#
#
#
# # loss = gious.sum()
# loss_giou = torch.sum(gious)
#
#
#
# if self.size_sum == True:
# loss_giou = loss_giou
# else:
# loss_giou = loss_giou / num
# return 5 * loss_giou
#
# class MultiBoxLoss(nn.Module):
# """SSD Weighted Loss Function
# Compute Targets:
# 1) Produce Confidence Target Indices by matching ground truth boxes
# with (default) 'priorboxes' that have jaccard index > threshold parameter
# (default threshold: 0.5).
# 2) Produce localization target by 'encoding' variance into offsets of ground
# truth boxes and their matched 'priorboxes'.
# 3) Hard negative mining to filter the excessive number of negative examples
# that comes with using a large number of default bounding boxes.
# (default negative:positive ratio 3:1)
# Objective Loss:
# L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
# Where, Lconf is the CrossEntropy Loss and Lloc is the SmoothL1 Loss
# weighted by α which is set to 1 by cross val.
# Args:
# c: class confidences,
# l: predicted boxes,
# g: ground truth boxes
# N: number of matched default boxes
# See: https://arxiv.org/pdf/1512.02325.pdf for more details.
# """
#
# def __init__(self, num_classes, overlap_thresh, prior_for_matching,
# bkg_label, neg_mining, neg_pos, neg_overlap, encode_target,
# loss_name='Giou'):
# super(MultiBoxLoss, self).__init__()
#
#
# self.num_classes = num_classes
# self.threshold = overlap_thresh
# self.background_label = bkg_label
# self.encode_target = encode_target
# self.use_prior_for_matching = prior_for_matching
# self.do_neg_mining = neg_mining
# self.negpos_ratio = neg_pos
# self.neg_overlap = neg_overlap
# self.variance = [0.1, 0.2]
# # self.focalloss = FocalLoss(self.num_classes, gamma=2, size_average=False)
# self.gious = GiouLoss(pred_mode='Center', size_sum=True, variances=self.variance)
# self.loss = loss_name
# if self.loss != 'SmoothL1' or self.loss != 'Giou':
# assert Exception("THe loss is Error, loss name must be SmoothL1 or Giou")
#
# # elif self.loss == 'Giou':
# # match_gious(self.threshold, truths, defaults, self.variance, labels,
# # loc_t, conf_t, idx)
#
#
#
# def forward(self, predictions, priors, targets):
# """Multibox Loss
# Args:
# predictions (tuple): A tuple containing loc preds, conf preds,
# and prior boxes from SSD net.
# conf shape: torch.size(batch_size,num_priors,num_classes)
# loc shape: torch.size(batch_size,num_priors,4)
# priors shape: torch.size(num_priors,4)
#
# targets (tensor): Ground truth boxes and labels for a batch,
# shape: [batch_size,num_objs,5] (last idx is the label).
# """
# loc_data, conf_data = predictions
# priors = priors
# # priors = priors[:loc_data.size(1), :]
# num = loc_data.size(0)
#
#
#
# num_priors = (priors.size(0))
# num_classes = self.num_classes
#
# # match priors (default boxes) and ground truth boxes
# loc_t = torch.Tensor(num, num_priors, 4)
#
# conf_t = torch.LongTensor(num, num_priors)
# for idx in range(num):
# truths = targets[idx][:, :-1].data
# labels = targets[idx][:, -1].data
# defaults = priors.data
# if self.loss == 'SmoothL1':
# match(self.threshold, truths, defaults, self.variance, labels,
# loc_t, conf_t, idx)
# if self.loss == 'Giou':
# match_gious(self.threshold, truths, defaults, self.variance, labels,
# loc_t, conf_t, idx)
#
# if GPU:
# loc_t = loc_t.cuda()
# conf_t = conf_t.cuda()
# # wrap targets
# # loc_t = Variable(loc_t, requires_grad=True)
# # conf_t = Variable(conf_t, requires_grad=True)
#
# pos = conf_t > 0
# # num_pos = pos.sum(dim=1, keepdim=True)
# # Localization Loss (Smooth L1)
# # Shape: [batch,num_priors,4]
# pos_idx = pos.unsqueeze(pos.dim()).expand_as(loc_data)
#
# loc_p = loc_data[pos_idx].view(-1, 4)
#
# loc_t = loc_t[pos_idx].view(-1, 4)
#
# if self.loss == 'SmoothL1':
# loss_l = F.smooth_l1_loss(loc_p, loc_t, reduction='sum')
# elif self.loss == 'Giou':
# giou_priors = priors.data.unsqueeze(0).expand_as(loc_data)
#
# loss_l = self.gious(loc_p, loc_t, giou_priors[pos_idx].view(-1, 4))
#
# # Compute max conf across batch for hard negative mining
# batch_conf = conf_data.view(-1, num_classes)
# loss_c = log_sum_exp(batch_conf) - batch_conf.gather(1, conf_t.view(-1, 1))
#
# # Hard Negative Mining
# # loss_c = loss_c.view(num, -1)
# # loss_c[pos] = 0
# loss_c[pos.view(-1, 1)] = 0 # filter out pos boxes for now
# loss_c = loss_c.view(num, -1)
# _, loss_idx = loss_c.sort(1, descending=True)
# _, idx_rank = loss_idx.sort(1)
# num_pos = pos.long().sum(1, keepdim=True)
# num_neg = torch.clamp(self.negpos_ratio * num_pos, max=pos.size(1) - 1)
# neg = idx_rank < num_neg.expand_as(idx_rank)
#
# # Confidence Loss Including Positive and Negative Examples
# pos_idx = pos.unsqueeze(2).expand_as(conf_data)
# neg_idx = neg.unsqueeze(2).expand_as(conf_data)
# conf_p = conf_data[(pos_idx + neg_idx).gt(0)].view(-1, num_classes)
# targets_weighted = conf_t[(pos + neg).gt(0)]
# loss_c = F.cross_entropy(conf_p, targets_weighted, reduction='sum')
#
# # Sum of losses: L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
# '''
# batch_conf = conf_data.view(-1, self.num_classes)
# loss_c = self.focalloss(batch_conf,conf_t)
# '''
# # N = num_pos.data.sum().double()
# # loss_l = loss_l.double()
# # loss_c = loss_c.double()
# # loss_l = loss_l /N
# # loss_c = loss_c /N
# N = max(num_pos.data.sum().float(), 1)
# loss_l = loss_l / N
# loss_c = loss_c / N
#
# return loss_l, loss_c
# class FocalL1Loss(nn.Module):
# """SSD Weighted Loss Function
# Compute Targets:
# 1) Produce Confidence Target Indices by matching ground truth boxes
# with (default) 'priorboxes' that have jaccard index > threshold parameter
# (default threshold: 0.5).
# 2) Produce localization target by 'encoding' variance into offsets of ground
# truth boxes and their matched 'priorboxes'.
# 3) Hard negative mining to filter the excessive number of negative examples
# that comes with using a large number of default bounding boxes.
# (default negative:positive ratio 3:1)
# Objective Loss:
# L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
# Where, Lconf is the CrossEntropy Loss and Lloc is the SmoothL1 Loss
# weighted by α which is set to 1 by cross val.
# Args:
# c: class confidences,
# l: predicted boxes,
# g: ground truth boxes
# N: number of matched default boxes
# See: https://arxiv.org/pdf/1512.02325.pdf for more details.
# """
#
# def __init__(self, num_classes, overlap_thresh, prior_for_matching, bkg_label, neg_mining, neg_pos, neg_overlap,
# encode_target):
# super(FocalL1Loss, self).__init__()
# self.num_classes = num_classes
# self.threshold = overlap_thresh
# self.background_label = bkg_label
# self.encode_target = encode_target
# self.use_prior_for_matching = prior_for_matching
# self.do_neg_mining = neg_mining
# self.negpos_ratio = neg_pos
# self.neg_overlap = neg_overlap
# self.variance = [0.1, 0.2]
#
# def forward(self, predictions, priors, targets):
# """Multibox Loss
# Args:
# predictions (tuple): A tuple containing loc preds, conf preds,
# and prior boxes from SSD net.
# conf shape: torch.size(batch_size,num_priors,num_classes)
# loc shape: torch.size(batch_size,num_priors,4)
# priors shape: torch.size(num_priors,4)
#
# ground_truth (tensor): Ground truth boxes and labels for a batch,
# shape: [batch_size,num_objs,5] (last idx is the label).
# """
#
# loc_data, conf_data = predictions
# priors = priors
# num = loc_data.size(0)
# num_priors = (priors.size(0))
# num_classes = self.num_classes
#
# # match priors (default boxes) and ground truth boxes
# loc_t = torch.Tensor(num, num_priors, 4)
# conf_t = torch.LongTensor(num, num_priors)
# for idx in range(num):
# truths = targets[idx][:, :-1].data
# labels = targets[idx][:, -1].data
# defaults = priors.data
# loc_t, conf_t, matches = match(self.threshold, truths, defaults, self.variance, labels, loc_t, conf_t, idx)
# if GPU:
# loc_t = loc_t.cuda()
# conf_t = conf_t.cuda()
# # wrap targets
# loc_t = Variable(loc_t, requires_grad=False)
# conf_t = Variable(conf_t, requires_grad=False)
#
# pos = conf_t > 0
#
# # Localization Loss (Smooth L1)
# # Shape: [batch,num_priors,4]
# pos_idx = pos.unsqueeze(pos.dim()).expand_as(loc_data)
# # a = loc_data[pos_idx]
# loc_p = loc_data[pos_idx].view(-1, 4)
# loc_t = loc_t[pos_idx].view(-1, 4)
# loss_l = F.smooth_l1_loss(loc_p, loc_t, reduction='sum')
#
#
#
#
#
#
#
#
#
#
# # loss_1 = F.smooth_l1_loss(loc_p, loc_t, reduction='sum')
#
# # # loc_pp = loc_p.unsqueeze(0)
# # # matches[pos_idx].view(-1,4)
# #
# # prebox = decode(matches, priors, variances=[0.1, 0.2])
# #
# # offset2 = encode(matches, prebox, variances=[0.1, 0.2])
# #
# #
# #
# #
# # #to be continue
# # # truths = truths[pos_idx]
# # # labels = labels[pos_idx]
# #
# #
# # offset2=offset2.expand_as(pos_idx)
# # # truths = truths.expand_as(pos_idx)
# #
# # offset2 = offset2[pos_idx].view(-1, 4)
# # secmatch(self.threshold, truths, offset2, self.variance, labels, loc_t, conf_t, pos_idx,prebox)
# #
# # loss_2 = F.smooth_l1_loss(offset2, loc_t, reduction='sum')
# # loss_l = loss_1+loss_2
#
#
#
#
#
#
#
#
#
#
#
#
# # Compute max conf across batch for hard negative mining
# batch_conf = conf_data.view(-1, self.num_classes)
# loss_c = log_sum_exp(batch_conf) - batch_conf.gather(1, conf_t.view(-1,1))
#
# # Hard Negative Mining
# loss_c[pos.view(-1, 1)] = 0 # filter out pos boxes for now
# loss_c = loss_c.view(num, -1)
# _,loss_idx = loss_c.sort(1, descending=True) #loss_c降序排列
# _,idx_rank = loss_idx.sort(1) #取出索引值
# num_pos = pos.long().sum(1, keepdim=True)
# num_neg = torch.clamp(self.negpos_ratio*num_pos, max=pos.size(1)-1)
# neg = idx_rank < num_neg.expand_as(idx_rank)
#
# # Confidence Loss Including Positive and Negative Examples
# pos_idx = pos.unsqueeze(2).expand_as(conf_data)
# neg_idx = neg.unsqueeze(2).expand_as(conf_data)
# conf_p = conf_data[(pos_idx+neg_idx).gt(0)].view(-1, self.num_classes)
# targets_weighted = conf_t[(pos+neg).gt(0)]
# # loss_c = F.cross_entropy(conf_p, targets_weighted, size_average=False)
#
#
#
# # Sum of losses: L(x,c,l,g) = (Lconf(x, c) + αLloc(x,l,g)) / N
#
# N = max(num_pos.data.sum().float(), 1)
# loss_l/=N
# loss_c/=N
# return loss_l, conf_p, targets_weighted, N
| 36.863905 | 125 | 0.588711 | 2,546 | 18,690 | 4.116261 | 0.097015 | 0.014504 | 0.022901 | 0.009447 | 0.814886 | 0.802576 | 0.800763 | 0.787118 | 0.785496 | 0.782538 | 0 | 0.017899 | 0.294543 | 18,690 | 506 | 126 | 36.936759 | 0.776944 | 0.794757 | 0 | 0 | 0 | 0 | 0.001862 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.032258 | false | 0 | 0.096774 | 0 | 0.16129 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
752a96ede8f2f11572cebf8c7f12d3502f4ca23b | 33 | py | Python | web/tests/apps/partner/test_filters.py | sidneijp/zedev | 75d6a83d08febb795f862627811925ea18f89fca | [
"BSD-3-Clause"
] | null | null | null | web/tests/apps/partner/test_filters.py | sidneijp/zedev | 75d6a83d08febb795f862627811925ea18f89fca | [
"BSD-3-Clause"
] | null | null | null | web/tests/apps/partner/test_filters.py | sidneijp/zedev | 75d6a83d08febb795f862627811925ea18f89fca | [
"BSD-3-Clause"
] | null | null | null | from apps.partner import filters
| 16.5 | 32 | 0.848485 | 5 | 33 | 5.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121212 | 33 | 1 | 33 | 33 | 0.965517 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
f395cdd25d61933fb26615d709178c3be9e52e06 | 191 | py | Python | phone_confirmation/signals.py | ricardosasilva/django_phone_confirmation | f67d4437d4f79962e70a32e06229cb6040c4f9db | [
"MIT"
] | 4 | 2017-09-06T19:51:10.000Z | 2021-12-30T07:49:51.000Z | phone_confirmation/signals.py | ricardosasilva/django_phone_confirmation | f67d4437d4f79962e70a32e06229cb6040c4f9db | [
"MIT"
] | null | null | null | phone_confirmation/signals.py | ricardosasilva/django_phone_confirmation | f67d4437d4f79962e70a32e06229cb6040c4f9db | [
"MIT"
] | 3 | 2017-09-06T22:00:07.000Z | 2020-07-02T13:56:24.000Z | from django.dispatch import Signal
confirmation_sms_sent = Signal(providing_args=['phone_number'])
activation_key_created = Signal(providing_args=['phone_number', 'activation_key', 'user'])
| 38.2 | 90 | 0.811518 | 24 | 191 | 6.083333 | 0.666667 | 0.205479 | 0.260274 | 0.328767 | 0.589041 | 0.589041 | 0.589041 | 0 | 0 | 0 | 0 | 0 | 0.068063 | 191 | 4 | 91 | 47.75 | 0.820225 | 0 | 0 | 0 | 0 | 0 | 0.219895 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.333333 | 0 | 0.333333 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
f39f7fda33fd4c0f398fa7bc211fba07c314494d | 147 | py | Python | batchout/columns/__init__.py | ilia-khaustov/batchout | e916a1b0bfac771e6c96d0ff2478dc3f44804a94 | [
"MIT"
] | 8 | 2019-11-05T06:54:30.000Z | 2021-12-14T14:52:24.000Z | batchout/columns/__init__.py | ilia-khaustov/batchout | e916a1b0bfac771e6c96d0ff2478dc3f44804a94 | [
"MIT"
] | null | null | null | batchout/columns/__init__.py | ilia-khaustov/batchout | e916a1b0bfac771e6c96d0ff2478dc3f44804a94 | [
"MIT"
] | 1 | 2020-05-05T09:31:14.000Z | 2020-05-05T09:31:14.000Z | from batchout.columns.base import Column
from batchout.columns.scalar import StringColumn, IntegerColumn, FloatColumn, DateColumn, TimestampColumn
| 49 | 105 | 0.863946 | 16 | 147 | 7.9375 | 0.75 | 0.188976 | 0.299213 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.081633 | 147 | 2 | 106 | 73.5 | 0.940741 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
34139306ecb45bbba3e8f71c1c1653eb32b1a45d | 44 | py | Python | examples/videostore/videostore/controllers/__init__.py | arjones6/elixir | b9c185dc03f087f9299a0f030e94eeafa1edd655 | [
"MIT"
] | 1 | 2015-08-25T14:23:17.000Z | 2015-08-25T14:23:17.000Z | examples/videostore/videostore/controllers/__init__.py | daqing15/elixir | 53fe515f76d31dc816e9ab99ddd0ceda1d9d574f | [
"MIT"
] | null | null | null | examples/videostore/videostore/controllers/__init__.py | daqing15/elixir | 53fe515f76d31dc816e9ab99ddd0ceda1d9d574f | [
"MIT"
] | null | null | null | from videostore.controllers.root import Root | 44 | 44 | 0.886364 | 6 | 44 | 6.5 | 0.833333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.068182 | 44 | 1 | 44 | 44 | 0.95122 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
3446bdb8ea4273507f5d0974affc8e2655177f5e | 14,320 | py | Python | proto/adabox_for_cuda_kernel_mode.py | jnfran92/adaptive-boxes | bcf03a91d48877b3a24125b74a233bda5bd8e044 | [
"MIT"
] | 7 | 2020-06-05T23:18:14.000Z | 2021-12-27T01:27:06.000Z | proto/adabox_for_cuda_kernel_mode.py | jnfran92/adaptive-boxes | bcf03a91d48877b3a24125b74a233bda5bd8e044 | [
"MIT"
] | 3 | 2019-09-15T15:43:29.000Z | 2020-11-19T16:27:22.000Z | proto/adabox_for_cuda_kernel_mode.py | jnfran92/adaptive-boxes | bcf03a91d48877b3a24125b74a233bda5bd8e044 | [
"MIT"
] | 1 | 2020-09-24T08:01:39.000Z | 2020-09-24T08:01:39.000Z |
import time
import matplotlib.pyplot as plt
import numpy as np
def get_right_bottom_rectangle(idx_i_arg, idx_j_arg, m_arg, n_arg, data_matrix_arg):
step_j = 0
first_step_i = 0
while True:
i_val = idx_i_arg
j_val = idx_j_arg + step_j
if j_val == n_arg:
break
temp_val = data_matrix_arg[i_val * n_arg + j_val]
if temp_val == 0:
break
step_i = 0
while True:
i_val = idx_i_arg + step_i
if i_val == m_arg:
break
temp_val = data_matrix_arg[i_val * n_arg + j_val]
if temp_val == 0:
break
step_i += 1
if step_j == 0:
first_step_i = step_i
else:
if step_i < first_step_i:
break
step_j += 1
x1_val = idx_j_arg
y1_val = idx_i_arg
x2_val = idx_j_arg + step_j - 1
y2_val = idx_i_arg + first_step_i - 1
return x1_val, x2_val, y1_val, y2_val
def get_left_bottom_rectangle(idx_i_arg, idx_j_arg, m_arg, n_arg, data_matrix_arg):
step_j = 0
first_step_i = 0
while True:
i_val = idx_i_arg
j_val = idx_j_arg - step_j
if j_val == -1:
break
temp_val = data_matrix_arg[i_val * n_arg + j_val]
if temp_val == 0:
break
step_i = 0
while True:
i_val = idx_i_arg + step_i
if i_val == m_arg:
break
temp_val = data_matrix_arg[i_val * n_arg + j_val]
if temp_val == 0:
break
step_i += 1
if step_j == 0:
first_step_i = step_i
else:
if step_i < first_step_i:
break
step_j += 1
x1_val = idx_j_arg
y1_val = idx_i_arg
x2_val = idx_j_arg - step_j + 1
y2_val = idx_i_arg + first_step_i - 1
return x1_val, x2_val, y1_val, y2_val
def get_left_top_rectangle(idx_i_arg, idx_j_arg, n_arg, data_matrix_arg):
step_j = 0
first_step_i = 0
while True:
i_val = idx_i_arg
j_val = idx_j_arg - step_j
if j_val == -1:
break
temp_val = data_matrix_arg[i_val * n_arg + j_val]
if temp_val == 0:
break
step_i = 0
while True:
i_val = idx_i_arg - step_i
if i_val == -1:
break
temp_val = data_matrix_arg[i_val * n_arg + j_val]
if temp_val == 0:
break
step_i += 1
if step_j == 0:
first_step_i = step_i
else:
if step_i < first_step_i:
break
step_j += 1
x1_val = idx_j_arg
y1_val = idx_i_arg
x2_val = idx_j_arg - step_j + 1
y2_val = idx_i_arg - first_step_i + 1
return x1_val, x2_val, y1_val, y2_val
def get_right_top_rectangle(idx_i_arg, idx_j_arg, n_arg, data_matrix_arg):
step_j = 0
first_step_i = 0
while True:
i_val = idx_i_arg
j_val = idx_j_arg + step_j
if j_val == n_arg:
break
temp_val = data_matrix_arg[i_val * n_arg + j_val]
if temp_val == 0:
break
step_i = 0
while True:
i_val = idx_i_arg - step_i
if i_val == -1:
break
temp_val = data_matrix_arg[i_val * n_arg + j_val]
if temp_val == 0:
break
step_i += 1
if step_j == 0:
first_step_i = step_i
else:
if step_i < first_step_i:
break
step_j += 1
x1_val = idx_j_arg
y1_val = idx_i_arg
x2_val = idx_j_arg + step_j - 1
y2_val = idx_i_arg - first_step_i + 1
return x1_val, x2_val, y1_val, y2_val
in_path = '/Users/Juan/django_projects/adaptive-boxes/data_binary/boston12.binary'
out_path = ''
start = time.time()
data_matrix = np.loadtxt(in_path, delimiter=",")
# Flatten Matrix
data_matrix_f = data_matrix.flatten()
# Kernel Data
dim3_grid_x = 1
dim3_grid_y = 1
dim3_block_x = 1 # fixed
dim3_block_y = 4 # fixed
block_dim_y = dim3_block_y
block_dim_x = dim3_block_x
grid_dim_y = dim3_grid_y
grid_dim_x = dim3_grid_x
# KERNEL
# Kernel editable
# Params
# 4 threads: [right-bottom right_top , left-bt, left-tp], 4 coords: [x1 x2 y1 y2]
coords_m = 5
coords_n = 4
coords = np.zeros(shape=[dim3_grid_y, dim3_grid_x, (coords_m * coords_n)]) # Could be stored in Shared Memory
# idx_i = 1 # y rand point
# idx_j = 1 # x rand point
m = data_matrix.shape[0] # for i
n = data_matrix.shape[1] # for j
# get random Point
whs_one = np.where(data_matrix == 1)
whs_one_len = whs_one[0].shape[0]
rand_num = int(np.random.rand() * whs_one_len)
idx_i = whs_one[0][rand_num] # y rand point
idx_j = whs_one[1][rand_num] # x rand point
# Kernel non-editable - they go in for-loop
block_idx_x = 0
block_idx_y = 0
thread_idx_x = 0
thread_idx_y = 0
# Run Kernel
for block_idx_y in range(grid_dim_y):
for block_idx_x in range(grid_dim_x):
print(' ---> running blockId.x: ' + str(block_idx_x) + ' threadId.y: ' + str(block_idx_y))
#
# idx_i = int(np.random.rand() * m) # y-i rand point
# idx_j = int(np.random.rand() * n) # x-j rand point
idx_i = 11
idx_j = 10
for thread_idx_y in range(block_dim_y):
for thread_idx_x in range(block_dim_x):
print(' ---> running threadId.x: ' + str(thread_idx_x) + ' threadId.y: ' + str(thread_idx_y))
i = thread_idx_y
j = thread_idx_x
g_i = block_dim_y * block_idx_y + i
g_j = block_dim_x * block_idx_x + j
if data_matrix_f[idx_i*n + idx_j] == 1:
x1 = 0
x2 = 0
y1 = 0
y2 = 0
if i == 0:
x1, x2, y1, y2 = get_right_bottom_rectangle(idx_i, idx_j, m, n, data_matrix_f)
if i == 1:
x1, x2, y1, y2 = get_right_top_rectangle(idx_i, idx_j, n, data_matrix_f)
if i == 2:
x1, x2, y1, y2 = get_left_bottom_rectangle(idx_i, idx_j, m, n, data_matrix_f)
if i == 3:
x1, x2, y1, y2 = get_left_top_rectangle(idx_i, idx_j, n, data_matrix_f)
coords[block_idx_y][block_idx_x][i * coords_n + 0] = x1
coords[block_idx_y][block_idx_x][i * coords_n + 1] = x2
coords[block_idx_y][block_idx_x][i * coords_n + 2] = y1
coords[block_idx_y][block_idx_x][i * coords_n + 3] = y2
else:
print(' disabled thread - rand value is zero')
# max and min in coords[], last row is the final x1 x2 y1 y2
for block_idx_y in range(grid_dim_y):
for block_idx_x in range(grid_dim_x):
print(' ---> running blockId.x: ' + str(block_idx_x) + ' threadId.y: ' + str(block_idx_y))
for thread_idx_y in range(block_dim_y):
for thread_idx_x in range(block_dim_x):
print(' ---> running threadId.x: ' + str(thread_idx_x) + ' threadId.y: ' + str(thread_idx_y))
i = thread_idx_y
j = thread_idx_x
g_i = block_dim_y * block_idx_y + i
g_j = block_dim_x * block_idx_x + j
x1 = 0
x2 = 0
y1 = 0
y2 = 0
if i == 0:
# pl = coords[[2, 3], 1].max()
a = coords[block_idx_y][block_idx_x][coords_n * 2 + 1]
b = coords[block_idx_y][block_idx_x][coords_n * 3 + 1]
pl = a
if b > a:
pl = b
coords[block_idx_y][block_idx_x][coords_n*4 + i] = pl
if i == 1:
# pr = coords[[0, 1], 1].min()
a = coords[block_idx_y][block_idx_x][coords_n * 0 + 1]
b = coords[block_idx_y][block_idx_x][coords_n * 1 + 1]
pr = a
if b < a:
pr = b
coords[block_idx_y][block_idx_x][coords_n * 4 + i] = pr
if i == 2:
# pt = coords[[1, 3], 3].max()
a = coords[block_idx_y][block_idx_x][block_dim_y * 1 + 3]
b = coords[block_idx_y][block_idx_x][block_dim_y * 3 + 3]
pt = a
if b > a:
pt = b
coords[block_idx_y][block_idx_x][coords_n * 4 + i] = pt
if i == 3:
# pb = coords[[0, 2], 3].min()
a = coords[block_idx_y][block_idx_x][coords_n * 0 + 3]
b = coords[block_idx_y][block_idx_x][coords_n * 2 + 3]
pb = a
if b < a:
pb = b
coords[block_idx_y][block_idx_x][coords_n * 4 + i] = pb
# get area, area value of each block in coord[0][0]
for block_idx_y in range(grid_dim_y):
for block_idx_x in range(grid_dim_x):
print(' ---> running blockId.x: ' + str(block_idx_x) + ' threadId.y: ' + str(block_idx_y))
for thread_idx_y in range(block_dim_y):
for thread_idx_x in range(block_dim_x):
print(' ---> running threadId.x: ' + str(thread_idx_x) + ' threadId.y: ' + str(thread_idx_y))
i = thread_idx_y
j = thread_idx_x
g_i = block_dim_y * block_idx_y + i
g_j = block_dim_x * block_idx_x + j
x1 = 0
x2 = 0
y1 = 0
y2 = 0
if i == 0:
# a*b
a = abs(coords[block_idx_y][block_idx_x][coords_n * 4 + 0] - coords[block_idx_y][block_idx_x][coords_n * 4 + 1])
b = abs(coords[block_idx_y][block_idx_x][coords_n * 4 + 2] - coords[block_idx_y][block_idx_x][coords_n * 4 + 3])
area = int(a*b)
coords[block_idx_y][block_idx_x][coords_n * 0 + 0] = area # write area in coord[0][0]
print('area ' + str(area))
# get the max area - should exist communication between blocks
for block_idx_y in range(grid_dim_y):
for block_idx_x in range(grid_dim_x):
print(' ---> running blockId.x: ' + str(block_idx_x) + ' threadId.y: ' + str(block_idx_y))
for thread_idx_y in range(block_dim_y):
for thread_idx_x in range(block_dim_x):
print(' ---> running threadId.x: ' + str(thread_idx_x) + ' threadId.y: ' + str(thread_idx_y))
i = thread_idx_y
j = thread_idx_x
g_i = block_dim_y * block_idx_y + i
g_j = block_dim_x * block_idx_x + j
x1 = 0
x2 = 0
y1 = 0
y2 = 0
if i == 0:
# a*b
area = coords[block_idx_y][block_idx_x][coords_n * 0 + 0]
print('area ' + str(area))
# recs = []
# # write data
# recs.append(Rectangle(x1, x2, y1, y2))
# data_matrix[y1:y2+1, x1:x2+1] = 0
pr = coords[[0, 1], 1].min()
pl = coords[[2, 3], 1].max()
pb = coords[[0, 2], 3].min()
pt = coords[[1, 3], 3].max()
# final x1x2 and y1y2
# Plot
fig = plt.figure(figsize=(6, 3.2))
ax = fig.add_subplot(111)
plt.imshow(data_matrix)
ax.set_aspect('equal')
x1 = int(coords[0][0][coords_n * 4 + 0])
x2 = int(coords[0][0][coords_n * 4 + 1])
y1 = int(coords[0][0][coords_n * 4 + 2])
y2 = int(coords[0][0][coords_n * 4 + 3])
p1 = np.array([x1, y1])
p2 = np.array([x1, y2])
p3 = np.array([x2, y1])
p4 = np.array([x2, y2])
ps = np.array([p1, p2, p4, p3, p1])
plt.plot(ps[:, 0], ps[:, 1], c='r')
#
for i in range(dim3_block_y):
x1 = coords[i * block_dim_y + 0]
x2 = coords[i * block_dim_y + 1]
y1 = coords[i * block_dim_y + 2]
y2 = coords[i * block_dim_y + 3]
p1 = np.array([x1, y1])
p2 = np.array([x1, y2])
p3 = np.array([x2, y1])
p4 = np.array([x2, y2])
ps = np.array([p1, p2, p4, p3, p1])
plt.plot(ps[:, 0], ps[:, 1], c='w')
#
#
# n = data_matrix.shape[1] # for j
# m = data_matrix.shape[0] # for i
#
# recs = []
# stop_flag = False
# print('Doing the Decomposition')
# while not stop_flag:
#
# ones_counter = (data_matrix == 1).sum()
# print(ones_counter)
# if ones_counter == 0:
# print("End!")
# break
#
# search_end_flag = False
# while not search_end_flag:
# idx_i = int(np.random.rand()*m) # y rand point
# idx_j = int(np.random.rand()*n) # x rand point
# if data_matrix[idx_i, idx_j] == 1:
# break
#
# x1, x2, y1, y2 = get_right_bottom_rectangle(idx_i, idx_j, n, m)
# coords[0, :] = np.array([x1, x2, y1, y2])
#
# x1, x2, y1, y2 = get_right_top_rectangle(idx_i, idx_j, n)
# coords[1, :] = np.array([x1, x2, y1, y2])
#
# x1, x2, y1, y2 = get_left_bottom_rectangle(idx_i, idx_j, m)
# coords[2, :] = np.array([x1, x2, y1, y2])
#
# x1, x2, y1, y2 = get_left_top_rectangle(idx_i, idx_j)
# coords[3, :] = np.array([x1, x2, y1, y2])
#
# # coords[]
# pr = coords[[0, 1], 1].min()
# pl = coords[[2, 3], 1].max()
#
# pb = coords[[0, 2], 3].min()
# pt = coords[[1, 3], 3].max()
#
# # final x1x2 and y1y2
# x1 = int(pl)
# x2 = int(pr)
# y1 = int(pt)
# y2 = int(pb)
#
# # write data
# recs.append(Rectangle(x1, x2, y1, y2))
# data_matrix[y1:y2+1, x1:x2+1] = 0
#
# end = time.time()
# print('Work Finished!!!')
# print('Elapsed time: ' + str(end - start))
#
#
# # Plot
# plot_rectangles(recs, 1)
# plt.show()
#
# #
# # fig = plt.figure()
# # ax = fig.add_subplot(111)
# # plt.imshow(data_matrix)
# # ax.set_aspect('equal')
# Plot
fig = plt.figure(figsize=(6, 3.2))
ax = fig.add_subplot(111)
plt.imshow(data_matrix)
ax.set_aspect('equal')
x1 = 40
x2 = 41
y1 = 58
y2 = 254
p1 = np.array([x1, y1])
p2 = np.array([x1, y2])
p3 = np.array([x2, y1])
p4 = np.array([x2, y2])
ps = np.array([p1, p2, p4, p3, p1])
plt.plot(ps[:, 0], ps[:, 1], c='r')
| 26.766355 | 132 | 0.517249 | 2,282 | 14,320 | 2.933392 | 0.07844 | 0.083657 | 0.047057 | 0.049298 | 0.77801 | 0.761279 | 0.744846 | 0.720944 | 0.71467 | 0.713176 | 0 | 0.049266 | 0.362151 | 14,320 | 534 | 133 | 26.816479 | 0.6836 | 0.168017 | 0 | 0.710098 | 0 | 0 | 0.039783 | 0.005938 | 0 | 0 | 0 | 0 | 0 | 1 | 0.013029 | false | 0 | 0.009772 | 0 | 0.035831 | 0.035831 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
344b4676cc1d2513e227bb65dd165adec0b69780 | 1,594 | py | Python | chess/pieces.py | eddiep24/reference | ae65c62ac11b5334f1842b0b805e8f0d72ad1621 | [
"MIT"
] | null | null | null | chess/pieces.py | eddiep24/reference | ae65c62ac11b5334f1842b0b805e8f0d72ad1621 | [
"MIT"
] | null | null | null | chess/pieces.py | eddiep24/reference | ae65c62ac11b5334f1842b0b805e8f0d72ad1621 | [
"MIT"
] | null | null | null | class Piece:
def __init__(self, string, color):
self.string = string
self.color = color
def getColor(self):
return "{}".format(self.color)
class Knight(Piece):
def __init__(self, string, color):
super().__init__(string, color)
def __str__(self):
return "{}".format(self.string)
class Pawn(Piece):
def __init__(self, string, color):
super().__init__(string, color)
def move(self, startrow, startcol, endrow, endcol):
pass
def __str__(self):
return "{}".format(self.string)
class King(Piece):
def __init__(self, string, color):
super().__init__(string, color)
def __str__(self):
return "{}".format(self.string)
class Queen(Piece):
def __init__(self, string, color):
super().__init__(string, color)
def __str__(self):
return "{}".format(self.string)
class Bishop(Piece):
def __init__(self, string, color):
super().__init__(string, color)
def __str__(self):
return "{}".format(self.string)
class Rook(Piece):
def __init__(self, string, color):
super().__init__(string, color)
def __str__(self):
return "{}".format(self.string)
class WhitePawn(Pawn):
def __init__(self, string, position):
super().__init__(string)
self.position = position
def move(self, startrow, startcol, endrow, endcol):
pass
# if startrow != endrow:
# if startrow
class BlackPawn(Pawn):
pass
| 23.791045 | 56 | 0.581556 | 173 | 1,594 | 4.872832 | 0.16185 | 0.177936 | 0.104389 | 0.161329 | 0.73191 | 0.73191 | 0.699881 | 0.699881 | 0.557533 | 0.557533 | 0 | 0 | 0.287955 | 1,594 | 66 | 57 | 24.151515 | 0.742731 | 0.023839 | 0 | 0.652174 | 0 | 0 | 0.009415 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.369565 | false | 0.065217 | 0 | 0.152174 | 0.717391 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 0 | 6 |
3454b4f3db1413b7a33a4a9c6539bb013b21455f | 37,884 | py | Python | instances/passenger_demand/pas-20210421-2109-int14000000000000001e/45.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int14000000000000001e/45.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null | instances/passenger_demand/pas-20210421-2109-int14000000000000001e/45.py | LHcau/scheduling-shared-passenger-and-freight-transport-on-a-fixed-infrastructure | bba1e6af5bc8d9deaa2dc3b83f6fe9ddf15d2a11 | [
"BSD-3-Clause"
] | null | null | null |
"""
PASSENGERS
"""
numPassengers = 3187
passenger_arriving = (
(3, 9, 6, 5, 0, 0, 10, 5, 4, 2, 1, 0), # 0
(4, 15, 5, 1, 0, 0, 6, 4, 2, 6, 4, 0), # 1
(5, 10, 10, 3, 3, 0, 6, 8, 7, 6, 1, 0), # 2
(2, 7, 6, 4, 1, 0, 7, 5, 5, 3, 2, 0), # 3
(3, 12, 9, 1, 2, 0, 7, 12, 6, 3, 5, 0), # 4
(5, 8, 4, 3, 2, 0, 7, 8, 2, 4, 2, 0), # 5
(4, 6, 5, 3, 2, 0, 7, 6, 3, 3, 2, 0), # 6
(3, 2, 7, 2, 0, 0, 4, 9, 7, 4, 4, 0), # 7
(8, 9, 7, 2, 0, 0, 8, 7, 10, 4, 2, 0), # 8
(5, 10, 9, 2, 2, 0, 5, 7, 7, 7, 0, 0), # 9
(2, 5, 11, 6, 1, 0, 12, 9, 5, 4, 2, 0), # 10
(6, 7, 7, 7, 2, 0, 9, 13, 4, 7, 2, 0), # 11
(6, 11, 4, 4, 1, 0, 8, 12, 6, 4, 2, 0), # 12
(5, 7, 7, 5, 2, 0, 4, 6, 4, 3, 1, 0), # 13
(3, 7, 7, 1, 3, 0, 6, 9, 8, 5, 3, 0), # 14
(2, 14, 12, 4, 7, 0, 7, 11, 5, 6, 2, 0), # 15
(3, 7, 10, 5, 1, 0, 2, 8, 7, 5, 2, 0), # 16
(3, 10, 10, 5, 2, 0, 6, 6, 5, 7, 3, 0), # 17
(4, 8, 7, 6, 4, 0, 9, 12, 5, 6, 3, 0), # 18
(5, 10, 8, 1, 6, 0, 13, 7, 4, 4, 2, 0), # 19
(5, 10, 6, 4, 1, 0, 4, 9, 8, 4, 3, 0), # 20
(1, 10, 8, 5, 2, 0, 7, 6, 8, 3, 1, 0), # 21
(1, 12, 6, 5, 0, 0, 5, 7, 4, 5, 1, 0), # 22
(2, 13, 10, 8, 3, 0, 7, 12, 1, 4, 2, 0), # 23
(3, 7, 7, 2, 4, 0, 12, 8, 4, 1, 3, 0), # 24
(7, 9, 12, 8, 2, 0, 10, 12, 4, 7, 1, 0), # 25
(3, 9, 5, 7, 1, 0, 6, 10, 6, 6, 2, 0), # 26
(4, 8, 8, 5, 3, 0, 7, 5, 3, 5, 1, 0), # 27
(6, 9, 10, 4, 5, 0, 3, 10, 5, 3, 2, 0), # 28
(6, 7, 5, 2, 4, 0, 7, 6, 5, 1, 2, 0), # 29
(4, 6, 9, 10, 1, 0, 9, 8, 2, 8, 3, 0), # 30
(7, 13, 6, 2, 3, 0, 7, 9, 12, 4, 5, 0), # 31
(4, 12, 5, 7, 3, 0, 8, 5, 8, 5, 1, 0), # 32
(1, 8, 10, 4, 4, 0, 9, 8, 10, 5, 1, 0), # 33
(5, 10, 5, 4, 1, 0, 7, 10, 2, 5, 6, 0), # 34
(6, 8, 10, 7, 2, 0, 5, 11, 8, 2, 3, 0), # 35
(4, 9, 6, 6, 0, 0, 2, 8, 5, 8, 2, 0), # 36
(2, 6, 9, 0, 1, 0, 8, 8, 8, 8, 0, 0), # 37
(8, 6, 8, 6, 2, 0, 5, 10, 7, 3, 2, 0), # 38
(3, 13, 7, 6, 4, 0, 5, 8, 4, 7, 2, 0), # 39
(4, 7, 13, 4, 3, 0, 2, 8, 6, 6, 2, 0), # 40
(2, 10, 5, 4, 1, 0, 10, 6, 4, 4, 1, 0), # 41
(3, 8, 3, 4, 1, 0, 2, 4, 7, 2, 3, 0), # 42
(6, 6, 7, 6, 2, 0, 7, 6, 9, 6, 1, 0), # 43
(0, 8, 9, 9, 1, 0, 0, 16, 4, 5, 2, 0), # 44
(1, 8, 8, 3, 1, 0, 5, 10, 7, 2, 4, 0), # 45
(2, 16, 6, 5, 2, 0, 6, 11, 4, 3, 1, 0), # 46
(0, 10, 8, 5, 2, 0, 5, 7, 8, 4, 2, 0), # 47
(3, 3, 8, 7, 3, 0, 9, 5, 7, 7, 0, 0), # 48
(5, 7, 4, 3, 2, 0, 9, 6, 7, 5, 2, 0), # 49
(6, 14, 7, 4, 2, 0, 5, 11, 2, 4, 2, 0), # 50
(4, 9, 5, 2, 2, 0, 7, 9, 6, 4, 2, 0), # 51
(7, 15, 5, 7, 2, 0, 7, 8, 5, 3, 1, 0), # 52
(4, 12, 8, 3, 0, 0, 7, 9, 11, 5, 0, 0), # 53
(6, 10, 6, 1, 2, 0, 6, 13, 5, 4, 2, 0), # 54
(5, 7, 6, 4, 2, 0, 5, 12, 4, 6, 5, 0), # 55
(5, 8, 5, 2, 0, 0, 2, 7, 12, 5, 2, 0), # 56
(4, 12, 10, 7, 4, 0, 6, 6, 5, 3, 2, 0), # 57
(5, 5, 3, 5, 4, 0, 3, 7, 8, 4, 3, 0), # 58
(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0), # 59
)
station_arriving_intensity = (
(3.7095121817383676, 9.515044981060607, 11.19193043059126, 8.87078804347826, 10.000240384615385, 6.659510869565219), # 0
(3.7443308140669203, 9.620858238197952, 11.252381752534994, 8.920190141908213, 10.075193108974359, 6.657240994867151), # 1
(3.7787518681104277, 9.725101964085297, 11.31139817195087, 8.968504830917876, 10.148564102564103, 6.654901690821256), # 2
(3.8127461259877085, 9.827663671875001, 11.368936576156813, 9.01569089673913, 10.22028605769231, 6.652493274456523), # 3
(3.8462843698175795, 9.928430874719417, 11.424953852470724, 9.061707125603865, 10.290291666666668, 6.6500160628019325), # 4
(3.879337381718857, 10.027291085770905, 11.479406888210512, 9.106512303743962, 10.358513621794872, 6.647470372886473), # 5
(3.9118759438103607, 10.12413181818182, 11.53225257069409, 9.150065217391306, 10.424884615384617, 6.644856521739131), # 6
(3.943870838210907, 10.218840585104518, 11.58344778723936, 9.19232465277778, 10.489337339743592, 6.64217482638889), # 7
(3.975292847039314, 10.311304899691358, 11.632949425164242, 9.233249396135266, 10.551804487179488, 6.639425603864735), # 8
(4.006112752414399, 10.401412275094698, 11.680714371786634, 9.272798233695653, 10.61221875, 6.636609171195653), # 9
(4.03630133645498, 10.489050224466892, 11.72669951442445, 9.310929951690824, 10.670512820512823, 6.633725845410628), # 10
(4.065829381279876, 10.5741062609603, 11.7708617403956, 9.347603336352659, 10.726619391025642, 6.630775943538648), # 11
(4.094667669007903, 10.656467897727273, 11.813157937017996, 9.382777173913043, 10.780471153846154, 6.627759782608695), # 12
(4.122786981757876, 10.736022647920176, 11.85354499160954, 9.416410250603866, 10.832000801282053, 6.624677679649759), # 13
(4.15015810164862, 10.81265802469136, 11.891979791488144, 9.448461352657004, 10.881141025641025, 6.621529951690821), # 14
(4.1767518107989465, 10.886261541193182, 11.928419223971721, 9.478889266304348, 10.92782451923077, 6.618316915760871), # 15
(4.202538891327675, 10.956720710578002, 11.96282017637818, 9.507652777777778, 10.971983974358976, 6.61503888888889), # 16
(4.227490125353625, 11.023923045998176, 11.995139536025421, 9.53471067330918, 11.013552083333336, 6.611696188103866), # 17
(4.25157629499561, 11.087756060606061, 12.025334190231364, 9.560021739130436, 11.052461538461543, 6.608289130434783), # 18
(4.274768182372451, 11.148107267554012, 12.053361026313912, 9.58354476147343, 11.088645032051284, 6.604818032910629), # 19
(4.297036569602966, 11.204864179994388, 12.079176931590974, 9.60523852657005, 11.122035256410259, 6.601283212560387), # 20
(4.318352238805971, 11.257914311079544, 12.102738793380466, 9.625061820652174, 11.152564903846153, 6.597684986413044), # 21
(4.338685972100283, 11.307145173961842, 12.124003499000287, 9.642973429951692, 11.180166666666667, 6.5940236714975855), # 22
(4.358008551604722, 11.352444281793632, 12.142927935768354, 9.658932140700484, 11.204773237179488, 6.590299584842997), # 23
(4.3762907594381035, 11.393699147727272, 12.159468991002571, 9.672896739130437, 11.226317307692307, 6.586513043478261), # 24
(4.393503377719247, 11.430797284915124, 12.173583552020853, 9.684826011473431, 11.244731570512819, 6.582664364432368), # 25
(4.409617188566969, 11.46362620650954, 12.185228506141103, 9.694678743961353, 11.259948717948719, 6.5787538647343), # 26
(4.424602974100088, 11.492073425662877, 12.194360740681233, 9.702413722826089, 11.271901442307694, 6.574781861413045), # 27
(4.438431516437421, 11.516026455527497, 12.200937142959157, 9.707989734299519, 11.280522435897437, 6.570748671497586), # 28
(4.4510735976977855, 11.535372809255753, 12.204914600292774, 9.711365564613528, 11.285744391025641, 6.566654612016909), # 29
(4.4625, 11.55, 12.20625, 9.7125, 11.287500000000001, 6.562500000000001), # 30
(4.47319183983376, 11.56215031960227, 12.205248928140096, 9.712295118464054, 11.286861125886526, 6.556726763701484), # 31
(4.4836528452685425, 11.574140056818184, 12.202274033816424, 9.711684477124184, 11.28495815602837, 6.547834661835751), # 32
(4.493887715792838, 11.585967720170455, 12.197367798913046, 9.710674080882354, 11.281811569148937, 6.535910757121439), # 33
(4.503901150895141, 11.597631818181819, 12.19057270531401, 9.709269934640524, 11.277441843971632, 6.521042112277196), # 34
(4.513697850063939, 11.609130859374998, 12.181931234903383, 9.707478043300654, 11.27186945921986, 6.503315790021656), # 35
(4.523282512787724, 11.62046335227273, 12.171485869565219, 9.705304411764708, 11.265114893617023, 6.482818853073463), # 36
(4.532659838554988, 11.631627805397729, 12.159279091183576, 9.70275504493464, 11.257198625886524, 6.4596383641512585), # 37
(4.5418345268542195, 11.642622727272729, 12.145353381642513, 9.699835947712419, 11.248141134751775, 6.433861385973679), # 38
(4.5508112771739135, 11.653446626420456, 12.129751222826087, 9.696553125000001, 11.23796289893617, 6.40557498125937), # 39
(4.559594789002558, 11.664098011363638, 12.11251509661836, 9.692912581699348, 11.22668439716312, 6.37486621272697), # 40
(4.568189761828645, 11.674575390625, 12.093687484903382, 9.68892032271242, 11.214326108156028, 6.34182214309512), # 41
(4.576600895140665, 11.684877272727276, 12.07331086956522, 9.684582352941177, 11.2009085106383, 6.3065298350824595), # 42
(4.584832888427111, 11.69500216619318, 12.051427732487923, 9.679904677287583, 11.186452083333334, 6.26907635140763), # 43
(4.592890441176471, 11.704948579545455, 12.028080555555556, 9.674893300653595, 11.17097730496454, 6.229548754789272), # 44
(4.600778252877237, 11.714715021306818, 12.003311820652177, 9.669554227941177, 11.15450465425532, 6.188034107946028), # 45
(4.6085010230179035, 11.724300000000003, 11.97716400966184, 9.663893464052288, 11.137054609929079, 6.144619473596536), # 46
(4.616063451086957, 11.733702024147728, 11.9496796044686, 9.65791701388889, 11.118647650709221, 6.099391914459438), # 47
(4.623470236572891, 11.742919602272728, 11.920901086956523, 9.651630882352942, 11.099304255319149, 6.052438493253375), # 48
(4.630726078964194, 11.751951242897727, 11.890870939009663, 9.645041074346407, 11.079044902482272, 6.003846272696985), # 49
(4.6378356777493615, 11.760795454545454, 11.85963164251208, 9.638153594771243, 11.057890070921987, 5.953702315508913), # 50
(4.6448037324168805, 11.769450745738636, 11.827225679347826, 9.630974448529413, 11.035860239361703, 5.902093684407797), # 51
(4.651634942455243, 11.777915625, 11.793695531400965, 9.623509640522876, 11.012975886524824, 5.849107442112278), # 52
(4.658334007352941, 11.786188600852274, 11.759083680555555, 9.615765175653596, 10.989257491134753, 5.794830651340996), # 53
(4.6649056265984665, 11.79426818181818, 11.723432608695653, 9.60774705882353, 10.964725531914894, 5.739350374812594), # 54
(4.671354499680307, 11.802152876420456, 11.686784797705313, 9.599461294934642, 10.939400487588653, 5.682753675245711), # 55
(4.677685326086957, 11.809841193181818, 11.649182729468599, 9.59091388888889, 10.913302836879433, 5.625127615358988), # 56
(4.683902805306906, 11.817331640625003, 11.610668885869565, 9.582110845588236, 10.886453058510638, 5.566559257871065), # 57
(4.690011636828645, 11.824622727272727, 11.57128574879227, 9.573058169934642, 10.858871631205675, 5.507135665500583), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_arriving_acc = (
(3, 9, 6, 5, 0, 0, 10, 5, 4, 2, 1, 0), # 0
(7, 24, 11, 6, 0, 0, 16, 9, 6, 8, 5, 0), # 1
(12, 34, 21, 9, 3, 0, 22, 17, 13, 14, 6, 0), # 2
(14, 41, 27, 13, 4, 0, 29, 22, 18, 17, 8, 0), # 3
(17, 53, 36, 14, 6, 0, 36, 34, 24, 20, 13, 0), # 4
(22, 61, 40, 17, 8, 0, 43, 42, 26, 24, 15, 0), # 5
(26, 67, 45, 20, 10, 0, 50, 48, 29, 27, 17, 0), # 6
(29, 69, 52, 22, 10, 0, 54, 57, 36, 31, 21, 0), # 7
(37, 78, 59, 24, 10, 0, 62, 64, 46, 35, 23, 0), # 8
(42, 88, 68, 26, 12, 0, 67, 71, 53, 42, 23, 0), # 9
(44, 93, 79, 32, 13, 0, 79, 80, 58, 46, 25, 0), # 10
(50, 100, 86, 39, 15, 0, 88, 93, 62, 53, 27, 0), # 11
(56, 111, 90, 43, 16, 0, 96, 105, 68, 57, 29, 0), # 12
(61, 118, 97, 48, 18, 0, 100, 111, 72, 60, 30, 0), # 13
(64, 125, 104, 49, 21, 0, 106, 120, 80, 65, 33, 0), # 14
(66, 139, 116, 53, 28, 0, 113, 131, 85, 71, 35, 0), # 15
(69, 146, 126, 58, 29, 0, 115, 139, 92, 76, 37, 0), # 16
(72, 156, 136, 63, 31, 0, 121, 145, 97, 83, 40, 0), # 17
(76, 164, 143, 69, 35, 0, 130, 157, 102, 89, 43, 0), # 18
(81, 174, 151, 70, 41, 0, 143, 164, 106, 93, 45, 0), # 19
(86, 184, 157, 74, 42, 0, 147, 173, 114, 97, 48, 0), # 20
(87, 194, 165, 79, 44, 0, 154, 179, 122, 100, 49, 0), # 21
(88, 206, 171, 84, 44, 0, 159, 186, 126, 105, 50, 0), # 22
(90, 219, 181, 92, 47, 0, 166, 198, 127, 109, 52, 0), # 23
(93, 226, 188, 94, 51, 0, 178, 206, 131, 110, 55, 0), # 24
(100, 235, 200, 102, 53, 0, 188, 218, 135, 117, 56, 0), # 25
(103, 244, 205, 109, 54, 0, 194, 228, 141, 123, 58, 0), # 26
(107, 252, 213, 114, 57, 0, 201, 233, 144, 128, 59, 0), # 27
(113, 261, 223, 118, 62, 0, 204, 243, 149, 131, 61, 0), # 28
(119, 268, 228, 120, 66, 0, 211, 249, 154, 132, 63, 0), # 29
(123, 274, 237, 130, 67, 0, 220, 257, 156, 140, 66, 0), # 30
(130, 287, 243, 132, 70, 0, 227, 266, 168, 144, 71, 0), # 31
(134, 299, 248, 139, 73, 0, 235, 271, 176, 149, 72, 0), # 32
(135, 307, 258, 143, 77, 0, 244, 279, 186, 154, 73, 0), # 33
(140, 317, 263, 147, 78, 0, 251, 289, 188, 159, 79, 0), # 34
(146, 325, 273, 154, 80, 0, 256, 300, 196, 161, 82, 0), # 35
(150, 334, 279, 160, 80, 0, 258, 308, 201, 169, 84, 0), # 36
(152, 340, 288, 160, 81, 0, 266, 316, 209, 177, 84, 0), # 37
(160, 346, 296, 166, 83, 0, 271, 326, 216, 180, 86, 0), # 38
(163, 359, 303, 172, 87, 0, 276, 334, 220, 187, 88, 0), # 39
(167, 366, 316, 176, 90, 0, 278, 342, 226, 193, 90, 0), # 40
(169, 376, 321, 180, 91, 0, 288, 348, 230, 197, 91, 0), # 41
(172, 384, 324, 184, 92, 0, 290, 352, 237, 199, 94, 0), # 42
(178, 390, 331, 190, 94, 0, 297, 358, 246, 205, 95, 0), # 43
(178, 398, 340, 199, 95, 0, 297, 374, 250, 210, 97, 0), # 44
(179, 406, 348, 202, 96, 0, 302, 384, 257, 212, 101, 0), # 45
(181, 422, 354, 207, 98, 0, 308, 395, 261, 215, 102, 0), # 46
(181, 432, 362, 212, 100, 0, 313, 402, 269, 219, 104, 0), # 47
(184, 435, 370, 219, 103, 0, 322, 407, 276, 226, 104, 0), # 48
(189, 442, 374, 222, 105, 0, 331, 413, 283, 231, 106, 0), # 49
(195, 456, 381, 226, 107, 0, 336, 424, 285, 235, 108, 0), # 50
(199, 465, 386, 228, 109, 0, 343, 433, 291, 239, 110, 0), # 51
(206, 480, 391, 235, 111, 0, 350, 441, 296, 242, 111, 0), # 52
(210, 492, 399, 238, 111, 0, 357, 450, 307, 247, 111, 0), # 53
(216, 502, 405, 239, 113, 0, 363, 463, 312, 251, 113, 0), # 54
(221, 509, 411, 243, 115, 0, 368, 475, 316, 257, 118, 0), # 55
(226, 517, 416, 245, 115, 0, 370, 482, 328, 262, 120, 0), # 56
(230, 529, 426, 252, 119, 0, 376, 488, 333, 265, 122, 0), # 57
(235, 534, 429, 257, 123, 0, 379, 495, 341, 269, 125, 0), # 58
(235, 534, 429, 257, 123, 0, 379, 495, 341, 269, 125, 0), # 59
)
passenger_arriving_rate = (
(3.7095121817383676, 7.612035984848484, 6.715158258354756, 3.5483152173913037, 2.000048076923077, 0.0, 6.659510869565219, 8.000192307692307, 5.322472826086956, 4.476772172236504, 1.903008996212121, 0.0), # 0
(3.7443308140669203, 7.696686590558361, 6.751429051520996, 3.5680760567632848, 2.0150386217948717, 0.0, 6.657240994867151, 8.060154487179487, 5.352114085144928, 4.500952701013997, 1.9241716476395903, 0.0), # 1
(3.7787518681104277, 7.780081571268237, 6.786838903170522, 3.58740193236715, 2.0297128205128203, 0.0, 6.654901690821256, 8.118851282051281, 5.381102898550726, 4.524559268780347, 1.9450203928170593, 0.0), # 2
(3.8127461259877085, 7.8621309375, 6.821361945694087, 3.6062763586956517, 2.044057211538462, 0.0, 6.652493274456523, 8.176228846153847, 5.409414538043478, 4.547574630462725, 1.965532734375, 0.0), # 3
(3.8462843698175795, 7.942744699775533, 6.854972311482434, 3.624682850241546, 2.0580583333333333, 0.0, 6.6500160628019325, 8.232233333333333, 5.437024275362319, 4.569981540988289, 1.9856861749438832, 0.0), # 4
(3.879337381718857, 8.021832868616723, 6.887644132926307, 3.6426049214975844, 2.0717027243589743, 0.0, 6.647470372886473, 8.286810897435897, 5.463907382246377, 4.591762755284204, 2.005458217154181, 0.0), # 5
(3.9118759438103607, 8.099305454545455, 6.919351542416455, 3.660026086956522, 2.084976923076923, 0.0, 6.644856521739131, 8.339907692307692, 5.490039130434783, 4.612901028277636, 2.0248263636363637, 0.0), # 6
(3.943870838210907, 8.175072468083613, 6.950068672343615, 3.6769298611111116, 2.0978674679487184, 0.0, 6.64217482638889, 8.391469871794873, 5.515394791666668, 4.633379114895743, 2.043768117020903, 0.0), # 7
(3.975292847039314, 8.249043919753085, 6.979769655098544, 3.693299758454106, 2.1103608974358976, 0.0, 6.639425603864735, 8.44144358974359, 5.5399496376811594, 4.653179770065696, 2.062260979938271, 0.0), # 8
(4.006112752414399, 8.321129820075758, 7.00842862307198, 3.709119293478261, 2.12244375, 0.0, 6.636609171195653, 8.489775, 5.563678940217391, 4.672285748714653, 2.0802824550189394, 0.0), # 9
(4.03630133645498, 8.391240179573513, 7.03601970865467, 3.724371980676329, 2.134102564102564, 0.0, 6.633725845410628, 8.536410256410257, 5.586557971014494, 4.690679805769779, 2.0978100448933783, 0.0), # 10
(4.065829381279876, 8.459285008768239, 7.06251704423736, 3.739041334541063, 2.145323878205128, 0.0, 6.630775943538648, 8.581295512820512, 5.608562001811595, 4.70834469615824, 2.1148212521920597, 0.0), # 11
(4.094667669007903, 8.525174318181818, 7.087894762210797, 3.7531108695652167, 2.156094230769231, 0.0, 6.627759782608695, 8.624376923076923, 5.6296663043478254, 4.725263174807198, 2.1312935795454546, 0.0), # 12
(4.122786981757876, 8.58881811833614, 7.112126994965724, 3.766564100241546, 2.1664001602564102, 0.0, 6.624677679649759, 8.665600641025641, 5.649846150362319, 4.741417996643816, 2.147204529584035, 0.0), # 13
(4.15015810164862, 8.650126419753088, 7.135187874892886, 3.779384541062801, 2.1762282051282047, 0.0, 6.621529951690821, 8.704912820512819, 5.669076811594202, 4.756791916595257, 2.162531604938272, 0.0), # 14
(4.1767518107989465, 8.709009232954545, 7.157051534383032, 3.7915557065217387, 2.1855649038461538, 0.0, 6.618316915760871, 8.742259615384615, 5.6873335597826085, 4.771367689588688, 2.177252308238636, 0.0), # 15
(4.202538891327675, 8.7653765684624, 7.177692105826908, 3.803061111111111, 2.194396794871795, 0.0, 6.61503888888889, 8.77758717948718, 5.7045916666666665, 4.785128070551272, 2.1913441421156, 0.0), # 16
(4.227490125353625, 8.81913843679854, 7.197083721615253, 3.8138842693236716, 2.202710416666667, 0.0, 6.611696188103866, 8.810841666666668, 5.720826403985508, 4.798055814410168, 2.204784609199635, 0.0), # 17
(4.25157629499561, 8.870204848484848, 7.215200514138818, 3.824008695652174, 2.2104923076923084, 0.0, 6.608289130434783, 8.841969230769234, 5.736013043478262, 4.810133676092545, 2.217551212121212, 0.0), # 18
(4.274768182372451, 8.918485814043208, 7.232016615788346, 3.8334179045893717, 2.2177290064102566, 0.0, 6.604818032910629, 8.870916025641026, 5.750126856884058, 4.8213444105255645, 2.229621453510802, 0.0), # 19
(4.297036569602966, 8.96389134399551, 7.247506158954584, 3.8420954106280196, 2.2244070512820517, 0.0, 6.601283212560387, 8.897628205128207, 5.76314311594203, 4.831670772636389, 2.2409728359988774, 0.0), # 20
(4.318352238805971, 9.006331448863634, 7.261643276028279, 3.8500247282608693, 2.2305129807692303, 0.0, 6.597684986413044, 8.922051923076921, 5.775037092391305, 4.841095517352186, 2.2515828622159084, 0.0), # 21
(4.338685972100283, 9.045716139169473, 7.274402099400172, 3.8571893719806765, 2.2360333333333333, 0.0, 6.5940236714975855, 8.944133333333333, 5.785784057971015, 4.849601399600115, 2.2614290347923682, 0.0), # 22
(4.358008551604722, 9.081955425434906, 7.285756761461012, 3.8635728562801934, 2.2409546474358972, 0.0, 6.590299584842997, 8.963818589743589, 5.79535928442029, 4.857171174307341, 2.2704888563587264, 0.0), # 23
(4.3762907594381035, 9.114959318181818, 7.295681394601543, 3.869158695652174, 2.2452634615384612, 0.0, 6.586513043478261, 8.981053846153845, 5.803738043478262, 4.863787596401028, 2.2787398295454544, 0.0), # 24
(4.393503377719247, 9.1446378279321, 7.304150131212511, 3.8739304045893723, 2.2489463141025636, 0.0, 6.582664364432368, 8.995785256410255, 5.810895606884059, 4.869433420808341, 2.286159456983025, 0.0), # 25
(4.409617188566969, 9.17090096520763, 7.311137103684661, 3.8778714975845405, 2.2519897435897436, 0.0, 6.5787538647343, 9.007958974358974, 5.816807246376811, 4.874091402456441, 2.2927252413019077, 0.0), # 26
(4.424602974100088, 9.193658740530301, 7.31661644440874, 3.880965489130435, 2.2543802884615385, 0.0, 6.574781861413045, 9.017521153846154, 5.821448233695653, 4.877744296272493, 2.2984146851325753, 0.0), # 27
(4.438431516437421, 9.212821164421996, 7.320562285775494, 3.8831958937198072, 2.256104487179487, 0.0, 6.570748671497586, 9.024417948717948, 5.824793840579711, 4.8803748571836625, 2.303205291105499, 0.0), # 28
(4.4510735976977855, 9.228298247404602, 7.322948760175664, 3.884546225845411, 2.257148878205128, 0.0, 6.566654612016909, 9.028595512820512, 5.826819338768117, 4.881965840117109, 2.3070745618511506, 0.0), # 29
(4.4625, 9.24, 7.32375, 3.885, 2.2575000000000003, 0.0, 6.562500000000001, 9.030000000000001, 5.8275, 4.8825, 2.31, 0.0), # 30
(4.47319183983376, 9.249720255681815, 7.323149356884057, 3.884918047385621, 2.257372225177305, 0.0, 6.556726763701484, 9.02948890070922, 5.827377071078432, 4.882099571256038, 2.312430063920454, 0.0), # 31
(4.4836528452685425, 9.259312045454546, 7.3213644202898545, 3.884673790849673, 2.2569916312056737, 0.0, 6.547834661835751, 9.027966524822695, 5.82701068627451, 4.880909613526569, 2.3148280113636366, 0.0), # 32
(4.493887715792838, 9.268774176136363, 7.3184206793478275, 3.8842696323529413, 2.2563623138297872, 0.0, 6.535910757121439, 9.025449255319149, 5.826404448529412, 4.878947119565218, 2.3171935440340907, 0.0), # 33
(4.503901150895141, 9.278105454545454, 7.314343623188405, 3.8837079738562093, 2.2554883687943263, 0.0, 6.521042112277196, 9.021953475177305, 5.825561960784314, 4.876229082125604, 2.3195263636363634, 0.0), # 34
(4.513697850063939, 9.287304687499997, 7.3091587409420296, 3.882991217320261, 2.2543738918439717, 0.0, 6.503315790021656, 9.017495567375887, 5.824486825980392, 4.872772493961353, 2.3218261718749993, 0.0), # 35
(4.523282512787724, 9.296370681818182, 7.302891521739131, 3.8821217647058828, 2.253022978723404, 0.0, 6.482818853073463, 9.012091914893617, 5.823182647058824, 4.868594347826087, 2.3240926704545455, 0.0), # 36
(4.532659838554988, 9.305302244318183, 7.295567454710145, 3.881102017973856, 2.2514397251773044, 0.0, 6.4596383641512585, 9.005758900709218, 5.821653026960784, 4.86371163647343, 2.3263255610795457, 0.0), # 37
(4.5418345268542195, 9.314098181818181, 7.287212028985508, 3.8799343790849674, 2.249628226950355, 0.0, 6.433861385973679, 8.99851290780142, 5.819901568627452, 4.858141352657005, 2.3285245454545453, 0.0), # 38
(4.5508112771739135, 9.322757301136363, 7.277850733695652, 3.87862125, 2.247592579787234, 0.0, 6.40557498125937, 8.990370319148935, 5.817931875, 4.8519004891304345, 2.330689325284091, 0.0), # 39
(4.559594789002558, 9.33127840909091, 7.267509057971015, 3.8771650326797387, 2.245336879432624, 0.0, 6.37486621272697, 8.981347517730496, 5.815747549019608, 4.845006038647344, 2.3328196022727274, 0.0), # 40
(4.568189761828645, 9.3396603125, 7.256212490942029, 3.8755681290849675, 2.2428652216312055, 0.0, 6.34182214309512, 8.971460886524822, 5.813352193627452, 4.837474993961353, 2.334915078125, 0.0), # 41
(4.576600895140665, 9.34790181818182, 7.2439865217391315, 3.8738329411764707, 2.2401817021276598, 0.0, 6.3065298350824595, 8.960726808510639, 5.810749411764706, 4.829324347826088, 2.336975454545455, 0.0), # 42
(4.584832888427111, 9.356001732954544, 7.230856639492753, 3.8719618709150327, 2.2372904166666667, 0.0, 6.26907635140763, 8.949161666666667, 5.80794280637255, 4.820571092995169, 2.339000433238636, 0.0), # 43
(4.592890441176471, 9.363958863636363, 7.216848333333333, 3.8699573202614377, 2.2341954609929076, 0.0, 6.229548754789272, 8.93678184397163, 5.804935980392157, 4.811232222222222, 2.3409897159090907, 0.0), # 44
(4.600778252877237, 9.371772017045453, 7.201987092391306, 3.8678216911764705, 2.230900930851064, 0.0, 6.188034107946028, 8.923603723404256, 5.801732536764706, 4.80132472826087, 2.3429430042613633, 0.0), # 45
(4.6085010230179035, 9.379440000000002, 7.186298405797103, 3.8655573856209147, 2.2274109219858156, 0.0, 6.144619473596536, 8.909643687943262, 5.798336078431372, 4.790865603864735, 2.3448600000000006, 0.0), # 46
(4.616063451086957, 9.386961619318182, 7.16980776268116, 3.8631668055555552, 2.223729530141844, 0.0, 6.099391914459438, 8.894918120567375, 5.794750208333333, 4.77987184178744, 2.3467404048295455, 0.0), # 47
(4.623470236572891, 9.394335681818182, 7.152540652173913, 3.8606523529411763, 2.21986085106383, 0.0, 6.052438493253375, 8.87944340425532, 5.790978529411765, 4.7683604347826085, 2.3485839204545456, 0.0), # 48
(4.630726078964194, 9.401560994318181, 7.134522563405797, 3.8580164297385626, 2.2158089804964543, 0.0, 6.003846272696985, 8.863235921985817, 5.787024644607844, 4.7563483756038645, 2.3503902485795454, 0.0), # 49
(4.6378356777493615, 9.408636363636361, 7.115778985507247, 3.8552614379084966, 2.211578014184397, 0.0, 5.953702315508913, 8.846312056737588, 5.782892156862745, 4.743852657004831, 2.3521590909090904, 0.0), # 50
(4.6448037324168805, 9.415560596590907, 7.096335407608696, 3.852389779411765, 2.2071720478723407, 0.0, 5.902093684407797, 8.828688191489363, 5.778584669117648, 4.73089027173913, 2.353890149147727, 0.0), # 51
(4.651634942455243, 9.4223325, 7.0762173188405795, 3.84940385620915, 2.2025951773049646, 0.0, 5.849107442112278, 8.810380709219858, 5.774105784313726, 4.717478212560386, 2.355583125, 0.0), # 52
(4.658334007352941, 9.428950880681818, 7.055450208333333, 3.8463060702614382, 2.1978514982269504, 0.0, 5.794830651340996, 8.791405992907801, 5.769459105392158, 4.703633472222222, 2.3572377201704544, 0.0), # 53
(4.6649056265984665, 9.435414545454544, 7.034059565217391, 3.843098823529412, 2.192945106382979, 0.0, 5.739350374812594, 8.771780425531915, 5.764648235294119, 4.689373043478261, 2.358853636363636, 0.0), # 54
(4.671354499680307, 9.441722301136364, 7.012070878623187, 3.8397845179738566, 2.1878800975177306, 0.0, 5.682753675245711, 8.751520390070922, 5.759676776960785, 4.674713919082125, 2.360430575284091, 0.0), # 55
(4.677685326086957, 9.447872954545453, 6.989509637681159, 3.8363655555555556, 2.1826605673758865, 0.0, 5.625127615358988, 8.730642269503546, 5.754548333333334, 4.65967309178744, 2.361968238636363, 0.0), # 56
(4.683902805306906, 9.453865312500001, 6.966401331521738, 3.832844338235294, 2.1772906117021273, 0.0, 5.566559257871065, 8.70916244680851, 5.749266507352941, 4.644267554347826, 2.3634663281250003, 0.0), # 57
(4.690011636828645, 9.459698181818181, 6.942771449275362, 3.8292232679738563, 2.1717743262411346, 0.0, 5.507135665500583, 8.687097304964539, 5.743834901960785, 4.628514299516908, 2.3649245454545453, 0.0), # 58
(0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0), # 59
)
passenger_allighting_rate = (
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 0
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 1
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 2
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 3
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 4
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 5
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 6
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 7
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 8
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 9
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 10
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 11
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 12
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 13
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 14
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 15
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 16
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 17
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 18
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 19
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 20
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 21
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 22
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 23
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 24
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 25
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 26
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 27
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 28
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 29
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 30
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 31
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 32
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 33
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 34
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 35
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 36
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 37
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 38
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 39
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 40
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 41
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 42
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 43
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 44
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 45
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 46
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 47
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 48
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 49
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 50
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 51
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 52
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 53
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 54
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 55
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 56
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 57
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 58
(0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1, 0, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 0.16666666666666666, 1), # 59
)
"""
parameters for reproducibiliy. More information: https://numpy.org/doc/stable/reference/random/parallel.html
"""
#initial entropy
entropy = 258194110137029475889902652135037600173
#index for seed sequence child
child_seed_index = (
1, # 0
44, # 1
)
| 113.086567 | 212 | 0.729068 | 5,147 | 37,884 | 5.364096 | 0.229065 | 0.312941 | 0.247745 | 0.469412 | 0.329168 | 0.327937 | 0.327937 | 0.327937 | 0.327937 | 0.327937 | 0 | 0.818999 | 0.119153 | 37,884 | 334 | 213 | 113.42515 | 0.008361 | 0.031966 | 0 | 0.202532 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0.015823 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
caa1ad539df01b421ece752fd21552fc0eeb5f7b | 73 | py | Python | testprojects/src/python/interpreter_selection/resolver_blacklist_testing/import_futures.py | AllClearID/pants | c4fdf00a3bdf9f26f876e85c46909d0729f7132c | [
"Apache-2.0"
] | 1 | 2018-12-10T21:31:02.000Z | 2018-12-10T21:31:02.000Z | testprojects/src/python/interpreter_selection/resolver_blacklist_testing/import_futures.py | AllClearID/pants | c4fdf00a3bdf9f26f876e85c46909d0729f7132c | [
"Apache-2.0"
] | 2 | 2016-10-13T21:37:42.000Z | 2018-07-20T20:14:33.000Z | testprojects/src/python/interpreter_selection/resolver_blacklist_testing/import_futures.py | AllClearID/pants | c4fdf00a3bdf9f26f876e85c46909d0729f7132c | [
"Apache-2.0"
] | 1 | 2018-03-08T22:21:44.000Z | 2018-03-08T22:21:44.000Z | from concurrent.futures import Future
print(Future)
print('Successful.')
| 18.25 | 37 | 0.808219 | 9 | 73 | 6.555556 | 0.777778 | 0.372881 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082192 | 73 | 3 | 38 | 24.333333 | 0.880597 | 0 | 0 | 0 | 0 | 0 | 0.150685 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.333333 | 0 | 0.333333 | 0.666667 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 1 | 0 | 6 |
cafc38bd378ffed9cf1e9ce7ffc701fc25742e7a | 89 | py | Python | app/main/__init__.py | louisenje/Blog-app | cb71c87f76d8af50c8f16d7937a0dd71cb0217fd | [
"Unlicense"
] | null | null | null | app/main/__init__.py | louisenje/Blog-app | cb71c87f76d8af50c8f16d7937a0dd71cb0217fd | [
"Unlicense"
] | null | null | null | app/main/__init__.py | louisenje/Blog-app | cb71c87f76d8af50c8f16d7937a0dd71cb0217fd | [
"Unlicense"
] | null | null | null | from flask import Blueprint
main=Blueprint('main',__name__)
from .import views,errors | 12.714286 | 31 | 0.786517 | 12 | 89 | 5.5 | 0.666667 | 0.393939 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.123596 | 89 | 7 | 32 | 12.714286 | 0.846154 | 0 | 0 | 0 | 0 | 0 | 0.044444 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.666667 | 0 | 0.666667 | 0.666667 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 1 | 0 | 6 |
1b7ecf108a88e562d02711af4289979fc0778ff2 | 37,536 | py | Python | plugins/get_url/unit_test/test_get_file.py | JaredAllen13/insightconnect-plugins | f68ce8c60ad20439284228dfcbcd9f8c1c0c7d31 | [
"MIT"
] | null | null | null | plugins/get_url/unit_test/test_get_file.py | JaredAllen13/insightconnect-plugins | f68ce8c60ad20439284228dfcbcd9f8c1c0c7d31 | [
"MIT"
] | null | null | null | plugins/get_url/unit_test/test_get_file.py | JaredAllen13/insightconnect-plugins | f68ce8c60ad20439284228dfcbcd9f8c1c0c7d31 | [
"MIT"
] | null | null | null | import os
import sys
from unit_test.util import Util
sys.path.append(os.path.abspath("../"))
from unittest import TestCase
from komand_get_url.actions.get_file import GetFile
from komand_get_url.actions.get_file.schema import Input
from unittest.mock import patch
from insightconnect_plugin_runtime.exceptions import PluginException
sys.path.append(os.path.abspath("../"))
@patch("urllib.request.urlopen", side_effect=Util.mocked_request)
@patch("insightconnect_plugin_runtime.helper.open_cachefile", side_effect=Util.mock_for_cache_creation)
@patch("komand_get_url.util.utils.Utils.create_url_meta_file")
class TestGetFile(TestCase):
@classmethod
def setUpClass(cls) -> None:
cls.action = Util.default_connector(GetFile())
def test_get_pdf_file(self, mock_get, mock_create_url, mock_cach):
actual = self.action.run({Input.URL: "https://test.com/v1/test.pdf", Input.IS_VERIFY: False})
expected = {
"bytes": "JVBERi0xLjUKJe+/ve+/ve+/ve+/vQozIDAgb2JqCjw8IC9MaW5lYXJpemVkIDEgL0wgMTUwMDcgL0ggWyA2NzggMTI1IF0gL08gNyAvRSAxNDQ3NyAvTiAxIC9UIDE0NzI2ID4+CmVuZG9iagogICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAo0IDAgb2JqCjw8IC9UeXBlIC9YUmVmIC9MZW5ndGggNTAgL0ZpbHRlciAvRmxhdGVEZWNvZGUgL0RlY29kZVBhcm1zIDw8IC9Db2x1bW5zIDQgL1ByZWRpY3RvciAxMiA+PiAvVyBbIDEgMiAxIF0gL0luZGV4IFsgMyAxNCBdIC9JbmZvIDEgMCBSIC9Sb290IDUgMCBSIC9TaXplIDE3IC9QcmV2IDE0NzI3ICAgICAgICAgICAgICAgICAvSUQgWzw0ZGFjMTgxZWIxMGU1NjljYjc5MzBhYmQzYmJkMzZlMT48ZjhmNGE2YjlmNzU2MmEzMzMzNzI2MTQzNjc5NjMxNDA+XSA+PgpzdHJlYW0KeO+/vWNiZO+/vWdgYmA4CSTvv73vv71YRkDvv73vv70W77+9Kgbvv73vv70BCT3vv70E77+9LgMT77+9dyAJBkY0AgDvv70GLgplbmRzdHJlYW0KZW5kb2JqCiAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgIAo1IDAgb2JqCjw8IC9QYWdlcyAxNCAwIFIgL1R5cGUgL0NhdGFsb2cgPj4KZW5kb2JqCjYgMCBvYmoKPDwgL0ZpbHRlciAvRmxhdGVEZWNvZGUgL1MgMzYgL0xlbmd0aCA0OCA+PgpzdHJlYW0KeO+/vWNgYGBlYGBa77+9AATvv71ZDHAAZTMDMQtCFO+/vRbvv70ZGO+/vRnvv73vv71S77+977+977+9du+/vX9hAADvv73vv70F77+9CmVuZHN0cmVhbQplbmRvYmoKNyAwIG9iago8PCAvQ29udGVudHMgOCAwIFIgL01lZGlhQm94IFsgMCAwIDU5NS4yNzYgODQxLjg5IF0gL1BhcmVudCAxNCAwIFIgL1Jlc291cmNlcyAxMiAwIFIgL1R5cGUgL1BhZ2UgPj4KZW5kb2JqCjggMCBvYmoKPDwgL0ZpbHRlciAvRmxhdGVEZWNvZGUgL0xlbmd0aCAxMTggPj4Kc3RyZWFtCnjvv71tzbsO77+9MAxG77+9PU/vv70ZYu+/vRvvv71pViQY77+977+9AUPvv73vv73vv73vv71Q77+977+977+9Uy4j77+9d++/ve+/vTHvv73aoVDvv73vv71LTzYTdO+/vQzvv70cM0MSWe+/vUN3GVvvv70ydE9/77+9PUUKAO+/ve+/ve+/ve+/ve+/vUJ1Du+/vQjvv71N77+977+977+9NO+/ve+/ve+/ve+/vSEkZRVQSO+/vV7vv73vv70Ab3Jbcy/vv73vv70i77+9CmVuZHN0cmVhbQplbmRvYmoKOSAwIG9iago8PCAvRmlsdGVyIC9GbGF0ZURlY29kZSAvTGVuZ3RoMSAxNTc4IC9MZW5ndGgyIDEwNzc4IC9MZW5ndGgzIDAgL0xlbmd0aCAxMTgxOCA+PgpzdHJlYW0KeO+/ve+/ve+/vQVU77+927ItDO+/vTXvv71LQ++/ve+/ve+/ve+/ve+/ve+/ve+/vUATaO+/vXEITgjvv70JEO+/vQLvv73vv73vv70dAu+/vV3vv73vv70je++/vXvvv70+77+977+977+9eG8wRu+/vc2qWe+/ve+/vWrvv71a77+9FO+/vRpMYu+/vQ7vv71AaQcw77+977+977+977+977+9HyDvv73vv73vv73vv70KYGXvv71gZmVlR++/ve+/ve+/vQRB77+977+9MiNTawPvv71dQA5g77+9fxAk77+977+9Zu+/vVfvv73vv70Z5JWn77+9AAbIu++/vQHvv704AGzvv73vv71sPO+/ve+/ve+/vQB2Vlbvv73vv70hOjjvv70DJO+/ve+/vUDvv70AJWbvv73vv70DGO+/vUwt77+977+977+977+9DO+/ve+/ve+/ve+/vR7vv70/77+9ADoLegAbHx8P77+9X++/vQAxe++/vTPvv73vv70MDFAy77+977+9AO+/vV9P77+9MO+/vQNoOFjvv73vv70Q77+977+9SkEnaAPvv7048rOwuO+/ve+/vTPvv73ZuzA7OFsL77+9MwLvv71BEBvvv70677+9Be+/ve+/vQbvv70E77+9aRjvv71sZg/vv73vv70zZmRq77+977+9De+/ve+/vW/vv73vv73vv70V77+977+977+9GQh4NdiBLO+/vWDvv73vv70IV++/vSXvv70Z77+9ejhAQ04R77+977+9CATvv71NVu+/ve+/ve+/vQjvv73vv71sAGzvv71s77+9Tu+/ve+/ve+/vT/vv71A4L+C77+9LCwc77+9He+/ve+/ve+/vSDvv70177+9CmQHBO+/vUgrMkM8IO+/vQAz77+977+9H++/ve+/ve+/ve+/ve+/vWvvv73vv73vv70Z77+977+977+977+977+977+9V++/vWYAaTE177+977+9a++/ve+/vWrvv73vv73vv70Z77+9CHFhdgHvv73vv71p77+977+9T++/ve+/vSlL77+9LSUc77+977+9YO+/vQvvv73vv70kQe+/vUDvv73XsXvvv73vv71977+9H++/vQ7vv71g77+9fwErEO+/ve+/ve+/vU8T77+977+977+9LFpg77+977+9K1BO77+9X++/vVcT77+9f2zvv71ACO+/ve+/ve+/ve+/ve+/ve+/ve+/vQMAdAIAPSxsWO+/ve+/ve+/ve+/vXQE77+977+9ZO+/vWN+77+977+977+977+977+977+9EWDvv73vv70E77+9F2QFfO+/ve+/ve+/ve+/vWLvv70GBEDvv71d77+977+977+977+9dO+/vTdCZmMDWO+/vSwgAHPvv701CO+/ve+/ve+/ve+/vWbvv73vv73vv73vv73vv73vv71BHgAD77+9V++/ve+/vQFY77+977+977+977+977+977+9VV7vv70OYDvvv73vv73vv73vv73vv71fFmkFOT0Zde+/ve+/vTvvv73vv71PXO+/ve+/vQPvv73vv73vv73vv70KYGLvv71iBe+/ve+/vREZ77+977+977+9f++/vVE1A++/ve+/ve+/vX/vv73Kge+/vRwAfH9X77+9Ou+/ve+/ve+/ve+/ve+/vV8C77+977+977+9cu+/vQPvv70777+977+9w6tq77+9AO+/ve+/ve+/vdyQ77+977+977+977+977+977+977+977+9We+/vX/vv73vv73vv70p77+9T++/ve+/ve+/ve+/ve+/vXdB0q52dn/vv73vv73vv73vv73vv71/77+9Zu+/vSA777+9fxFeRe+/vQp5XQAl77+977+9NQDvv71v77+9Du+/ve+/vVUCWu+/vVzvv73vv73vv71XDmLvv73vv70IYmBr77+9f++/vRHvv70iDe+/vQBa77+977+9IBY2f++/ve+/vW/vv73Wny3vv70D77+977+977+9Di7vv70/77+9Cu+/ve+/ve+/vWrvv73vv73vv71177+9LD7vv70+HS7vv73vv73vv73vv70FfN2c77+9PlIKbO+/vWDvv71n77+92Lnvv70BZu+/ve+/vWbvv73Ir++/ve+/ve+/ve+/vQDvv71s77+977+9aAnvv73vv71L77+9ABZm77+9A++/vTUE77+92p4v77+977+977+9Ge+/vc+N77+977+9AFjvv73vv73vv73vv71Cfypg77+977+9B2QD77+9AO+/vQHvv70BLFbvv73vv71/EO+/vR9eDgDvv73vv70/ICfvv73vv73vv73fkO+/ve+/vRV5Otq8Pibvv71h77+977+977+9Ge+/vQtg77+977+9D3zvv70w77+9f8icfADvv73vv71H77+9H++/ve+/ve+/vR3vv70BX09z77+9R2nvv73vv71777+9Be+/vWtaFu+/ve+/vc6vD++/vV96fh3vv73vv73vv71eJyDvv70DaO+/ve+/vTjvv71gIRBsWxPvv71yWyVG77+9zrQ9JjRN77+977+977+9Su+/ve+/ve+/ve+/ve+/vXrvv73vv73vv71EX++/vRnvv73vv718Le+/vTTYhe+/ve+/vSlFdyXvv71E77+977+9fe+/vVjvv73vv70pQe+/ve+/ve+/ve+/ve+/vSROfXLvv70ZeWEC77+9bzzvv71Q77+9ey8pEgnvv73vv73vv73Pk++/ve+/vXbvv70H77+9Ru+/vXZ577+9XCdXXnTvv70v2Lfvv709Mh7vv717S++/vUdC77+977+9dirvv70VUB5L77+977+977+977+9Ig0D77+977+9UO+/vWfvv70SUO+/vUPvv71IEe+/vWPvv71577+977+977+977+977+977+977+9GX8h77+977+9Y0Dvv70977+977+9KO+/ve+/vV9n77+977+977+977+9Wi3vv71kd++/vSDvv70i77+9JyDvv73vv73vv70a77+977+977+9Fu+/vUvvv73Hn++/vS4qWO+/vVvvv71oFCwg77+9QWNMWWHvv71g77+9Y8+oBO+/vUfvv73ru6vvv71GFu+/vdi2cu+/vQDvv73vv73vv71977+9Wwnvv73vv73vv704Js6UKu+/ve+/ve+/vSYR2JBq77+9D0DSvTYr77+91ZZr77+9Tivvv70U77+9Je+/ve+/ve+/vS/vv70ZND3vv71D77+977+9Tu+/vVrvv73vv73vv73vv70+77+977+90JTvv73vv73vv73vv73vv73vv71OX++/vW8i77+9IiTvv73vv71s77+9bAzvv71X77+977+9M0hT77+9SiDvv71vOnTvv71yOBjvv71Lbknvv73vv71wZiHvv73ege+/ve+/ve+/vURsG++/ve+/ve+/ve+/ve+/vXDvv73vv70jJCdc77+9Pu+/vdG+77+9dWfvv71t77+9M++/ve+/vXbvv71YRkEvQe+/ve+/vS/vv73vv70pZ2fvv73vv702HFLvv73vv73vv710eRlS77+977+977+9fu+/vdCqCe+/vQDvv71m77+9Sljvv73vv73vv73vv70l77+9Pe+/vRXvv70377+9Fu+/ve+/ve+/vQo477+9ZO+/ve+/ve+/vSsG77+9DQM9be+/ve+/ve+/vTLvv71o77+9azXvv71yfVXvv73vv70677+9YBrdqwsYEA8K77+94bu277+927guLRU377+977+9d9C+Oyt3DxMf77+977+977+977+9E++/ve+/ve+/vU3vv70/77+977+9RSVNRizvv71N77+977+977+9bDfvv73vv73vv71jTXE3Cu+/ve+/ve+/ve+/vTrvv71C77+977+977+9He+/ve+/ve+/vSVy77+91LQF77+9Su+/vQrvv73vv73vv718Fu+/vRYkC++/vQnvv73vv71F77+9Pl/vv73vv73vv73XtO+/ve+/ve+/vUHvv71mYu+/vUZTZ++/vSzDvDNpHe+/ve+/vT5/JhIn77+90Lzvv73vv73vv71rHe+/vXt+anTvv71ieHLvv73vv73bru+/ve+/vRtnTwNA77+9KzIN77+9Lu+/ve+/vWJ+77+9P++/vXJN77+9LjLvv73vv70q77+94aeW77+9WO+/vRJJde+/vUwfcO+/vWhgBFbvv70dQisHK++/ve+/vdiRLCDvv73vv70277+9YgED77+977+9XELvv73vv71X77+977+9PXlM77+9UO+/ve+/vWHvv71P77+9K++/ve+/vVIh77+9Dj1o77+9NUnvv70w77+9A++/ve+/ve+/vUfupJwpD++/vTw1cH8pcXo477+9Fu+/ve+/vXouMe+/vWJ+Elnvv70dCu+/ve+/vSA7He+/ve+/vWbvv70fPUXvv71V77+9biDvv73vv70eZgQi1Kbvv70sLe+/vUBNTO+/vTrvv70q77+9VB5FMBN/NSYt77+977+977+9GO+/ve+/ve+/vUpm77+9xZ4aCe+/vTEoeUgJFE3vv703D3wsdzXvv70A77+97omO77+977+9Oe+/vVnvv73vv70I77+977+9IXTvv715a3dKae+/ve+/vRjvv71z77+9MCrvv73KlwAHNe+/ve+/vd2xFBTvv71J048/BO+/ve+/ve+/vVjvv719EO+/vV4E77+977+977+9T2vvv73vv70WMn8O2pzvv73vv70NXivvv73vv71H77+977+977+977+977+9EBkkNBXvv73vv71JPu+/vUMxGcmFM0hq77+977+977+9UBXvv71k77+9Je+/vRTvv73vv73vv73vv71CLe+/vUUT77+9Tmts77+9dVZwZe+/ve+/vXhI15Lvv73vv70D77+977+977+977+9Qu+/vWsm77+9fe+/vT0J77+977+9P1rvv71RG++/vTnvv73vv70bNjXvv71w77+9cO+/vVEYZO+/ve+/ve+/vTV977+9Ou+/vV7vv73vv73bt2MRQcS6Rlp677+9JH/vv73vv73vv73vv71aNhLvv73vv73NvUbvv704Z3jvv70NeO+/ve+/vTTvv71O77+9QSh0A++/ve+/ve+/vTnvv73vv73vv73vv73vv71AcDBI77+9yYgvM++/ve+/vW0WJu+/vS8u77+93YpMRu+/vUzvv70e77+9QBvvv73Nru+/vTrvv73vv71S77+9Le+/vUpFZe+/ve+/vX9f77+977+977+977+977+9bu+/vUFwOAMcHe+/ve+/ve+/vSdCJFQY77+977+9Ye+/ve+/vU4077+977+977+9dCM/Qu+/ve+/ve+/ve+/ve+/vVHvv73vv73vv73vv73vv73vv71rfFrvv70Z77+977+977+977+977+9C++/vXrvv73vv71KJ1/vv73vv73Hiu+/vUR677+9KiTvv71Z77+9Ewzvv73vv73vv70yPO+/vc6B77+904gUb0bvv73vv73vv71+AO+/vWse77+977+9Ju+/vVDvv71aKhtKNGTvv70t77+9XM+N77+9Fu+/vXvvv73vv73vv706UShaTlVsEjscfu+/vWLvv71m77+9HBAXEu+/ve+/vX1/TO+/vRrfqe+/ve+/ve+/vXVHdXw3ce+/ve+/vU/vv71T77+9Pjnvv73vv73vv73vv73vv70vdiPvv73vv73vv701QO+/vcmT77+977+977+977+9W9e9PHHvv70TaXh877+9OjZ0xIVkS++/ve+/vQFP77+977+977+977+977+9AFJp77+977+9YAJFMO+/vcaFO00x77+977+9dFVl77+977+977+9bRHvv70B77+977+9AG3vv70W77+977+9U++/vdyj77+977+9fe+/ve+/ve+/vQoWAD3vv70NRu+/ve+/vWLvv70eFw5UV++/vUEzQO+/vXR0YO+/vSNa77+9MxtaTu+/vV9u77+9Yk7Nuu+/vQrvv73vv73vv70077+9EO+/vScvYS3vv73vv73vv707y67vv71aVe+/vT3vv73vv71MW++/vV5DXO+/vWVH77+9BO+/vQvvv71EIlvvv73vv73vv71N77+977+9QO+/ve+/vXAHCt2777+9BV0477+9NHw8JWIEVCpUMO+/ve+/ve+/ve+/vUM8Zmfvv70mPt2W77+977+977+9G3Pvv71nPwUfByUUE++/ve+/vRQdzLVn77+977+9VjTvv70t77+977+9F27vv73vv73vv71q77+977+9GzNINjnvv73vv70K77+9YR5LFu+/ve+/vTl577+9Dw5P77+9d2nvv70Wb++/ve+/ve+/vSdkeu+/ve+/vVYNYO+/ve+/vV7vv73vv73vv70j77+977+977+977+977+977+9Su+/vUop77+977+9K++/ve+/vQvvv73vv70xOu+/vSTvv73vv73vv73vv73vv73vv70rGgPvv70gQsa804Dvv73vv71O1bHvv70a77+9Clrvv73vv73vv73vv71hSlpV77+977+977+9WhVhJ++/vT1uYQsJTAzvv71077+977+9MO+/ve+/vS9/77+977+9Vu+/vWnvv73vv71c77+9Be+/ve+/vSED77+9GO+/vR3vv73vv73vv73vv73vv73vv71sEu+/vRsSXO+/ve+/vWPvv70jTRnsvIkQb++/vWo3c++/vSbvv71W77+977+9HETvv71r77+9Zm7vv71e77+9Wu+/ve+/vSZVOe+/vTh977+977+9bGTvv71L77+977+977+977+9KmPvv70Y77+977+9He+/vUMF77+9V0tG77+9Au+/ve+/vTjvv73vv73vv73vv70FFu+/vVpGw6bvv73RsCpU77+9Ve+/ve+/vUHvv70t77+977+977+9c2RBR92hIe+/vTlC77+9QuuilO+/ve+/ve+/vQrSt++/vXnvv70P77+9cW3vv70B77+9dnR277+9Fe+/vVlL77+9U++/vVHvv70UDXsl77+9ybPDhu+/ve+/ve+/ve+/vTjvv73vv73vv71GPgJK77+9Nu+/ve+/vQsa77+977+9FADvv71d77+9Pxx/ce+/ve+/ve+/vQDvv71777+9dSIi77+9f++/ve+/ve+/vSNR77+977+9IjTvv73vv708K3FGCS/vv71SEu+/vSzvv70W77+9JO+/ve+/vUcl77+9CHrvv71JEFvvv70m77+9Be+/ve+/ve+/ve+/ve+/vSTvv70UI++/vVJ3Ie+/ve+/ve+/vX3vv70677+977+9Ei0mRjDvv70W77+977+977+9c++/ve+/vQvvv71u3a3vv73vv718Le+/ve+/vRjvv73vv73vv73vv712EE3vv70X77+9AAXvv70zIW46CwgJ77+9OO+/vWTvv71N77+9Je+/ve+/ve+/ve+/ve+/vSUmWzDvv73vv70B77+977+977+9fGHvv73vv73RuO+/vQphE3MtL++/vUJ1FBtnNu+/ve+/ve+/ve+/ve+/vW7vv73vv71gAe+/vRTvv70oA++/vQhsSCRHalZReinvv70o77+9Pm7vv70KMO+/vTga77+9exBi77+9be+/vSAb77+9cklV77+977+977+9Je+/vWLvv73kmKw0Ju+/ve+/ve+/ve+/vTrvv73vv73vv70jE0Pvv73vv73HnjxhM13vv711Ze+/vXRlOO+/vVzvv73vv73vv70UFjhj77+977+9Gu+/ve+/ve+/vUZ2aO+/vVzvv73vv73vv70ZYE11CcScGyDvv73vv71h77+977+9GD/vv73vv71LWQNYP++/ve+/vUXvv715aHte77+9LWFOZlEa77+977+977+9SO+/ve+/ve+/ve+/ve+/ve+/vRMt77+9NDQu77+9eu+/ve+/ve+/ve+/vVnvv73vv70zFS7vv71BT++/vVzvv73vv73vv70HUmIp77+97qaIF2rvv73vv70I77+9Ku+/ve+/vWnvv73vv70dBzMJdgHvv73vv71077+9KAvvv73Kl++/ve+/vQLvv70KLO+/vcu6Hu+/ve+/ve+/ve+/vTEe77+93rfvv70L77+9Fe+/vSVt77+9Ygdj77+977+977+9dBTvv70J77+977+9xKBJSO+/ve+/vWjvv71/77+9WW8d77+977+9VUsY77+9LnBQbe+/vdmY77+9DO+/vSrvv71t77+977+977+977+9aO+/vVHvv73vv7070o9y77+977+9BE1r77+9WU7vv7125Lykc8ev77+9WHA077+9Mn3Vn1hPLgpvFe+/ve+/vWlM77+977+9GkLvv73vv73vv71VbOeFskM1w65z77+9Xe+/vRrvv71377+977+9Z++/ve+/vXXvv71S77+9MAd7aFTvv73vv73vv70077+977+9Kkvvv73vv71nSe+/vVo1Uu+/vWDvv73vv71aUhfvv73vv73vv73vv70V77+9Ju+/vXnUnu+/vTLvv73vv73vv73kq5JpUH7vv70G77+977+9d++/vSYF77+977+9SkQG77+977+977+9IwPngozvv70B77+977+9Xu+/vWM9J++/vW9L77+9AglqQe+/vc2C77+9J++/ve+/ve+/ve+/vWPvv73vv71aUl/vv70u77+9I8+mFe+/vTpm77+977+9Ru+/ve+/ve+/vQlD66uJ77+977+977+9W1zvv71Qf++/vXpJ77+977+9MCjvv73vv73vv71pe8y1GQNn77+9VhPvv73vv73vv73vv70s77+9de+/ve+/ve+/vT7vv73vv71177+977+9WUtjAe+/ve+/ve+/vWDvv70V77+977+9UBDvv71F77+9a3Zz77+9J9KR77+977+9Se+/vRXvv73vv73Wls+MP2Tvv73vv73vv70CH3zvv707NlXvv73vv71q77+977+9bO+/ve+/ve+/vQfvv73vv73vv73vv70Y77+977+9ce+/ve+/ve+/vdK077+9M++/vTdbKu+/vR/vv73vv73vv73vv73LiUsSTlfvv73vv70FWH8N77+9fVrvv71Q77+9zZDvv73VmUMG77+977+977+9d++/ve+/vRwKIu+/ve+/vQR577+9N++/vQUi77+977+977+977+977+977+9U++/vR1WfDDKuu+/vWPvv73vv73vv71q77+9JRXTpO+/vXXvv73vv71MBu+/ve+/ve+/vWM7LFbvv71bO2xU77+9xo8Z77+977+9e++/vcyDPe+/vT8Y77+977+977+977+9PO+/vdyC77+9f++/vdSIe1UMfe+/vQnvv73vv70u77+9NtOCCO+/ve+/ve+/ve+/vWrvv71T77+9Lu+/ve+/vVcKXu+/ve+/vXx777+977+977+9TwTvv73vv70UCMiI77+9PO+/ve+/vUh677+977+9GkYf77+9Q3LepO+/ve+/ve+/vTnvv73vv73vv70lIO+/vSdn77+9Ue+/ve+/ve+/vdWHSycG77+977+977+93Z8US++/ve+/vRnvv70FWt2qenDvv73Lhu+/ve+/ve+/vRwg77+9PO+/vQosy5Dvv73vv71g77+9YVNy77+977+977+9Wu+/vXzcue+/vSVrSDldagB/y5Y877+9dmzvv73vv71877+9V++/vSjvv73vv70j77+9LO+/vXRZ77+977+9AnMS77+9w5rvv71377+9B++/vRojOkTYoGLvv713NEHGpe+/vSHvv73vv71c77+977+9z4gb77+9Ju+/ve+/vd6z77+9HlRHGO+/vTbvv71v77+9de+/vVMU77+92KMubkzvv70ubmbvv71+77+977+977+9JHdeL++/ve+/ve+/vUvvv71bJe+/ve+/ve+/ve+/vTLvv71pOAJ2dHPvv73vv706Yu+/ve+/vQcW77+977+977+977+977+977+9PArfn++/ve+/vSfvv73vv700OiTvv70DJVtzau+/ve+/vVTvv71r77+9dt+OQO+/ve+/ve+/vVvvv73vv70GZu+/vRfvv71I77+9RRfvv73vv73vv73vv73vv70YJu+/ve+/ve+/vSsBXe+/vWhtKu+/ve+/vRAxZTgmRTRwckTvv70I77+977+9Tzxj77+977+9ZWvvv73vv73vv73vv73vv714fTECUe+/vWRVE++/vUUK77+9fu+/vXEDe35077+977+9V++/vTUgCyfvv73Zte+/vTnGhRLvv71+77+977+9CO+/ve+/vXVXV3Dvv70SJe+/ve+/vUFI77+9au+/vXjFvwXvv73vv73vv73vv70VPe+/ve+/vSjvv70eJEXvv70qMyQw1oTvv73vv73vv73vv70m77+977+9P++/vSZt77+9WTbvv71A77+9YO+/vRMxeGHvv701AGLvv70o77+977+977+977+9A++/vRolSkF277+977+977+9ce+/vSoIENmK77+977+9Yu+/ve+/vWDvv70g77+977+977+977+977+977+9DDjvv71G77+9fRTvv73vv71UPllpaSg4yY7vv71877+977+9Cu+/ve+/vQk477+977+977+9Yu+/vcyl77+9A++/ve+/vQQM77+977+977+9Xl7vv71pFi7vv71c77+977+977+9OF3vv73vv70a77+977+977+977+927Pvv73vv73vv70IHkcLMEkx77+977+977+9dHQAdUcxAy3vv70477+977+9XTTvv71D77+9QO+/vWdRIFXvv71wRO+/ve+/vSEk77+9OCJnRO+/vQHvv712A3h3Od2Eae+/vT5i77+9Fu+/vWhT77+9x7Qd77+9Ue+/ve+/ve+/vdOMC++/ve+/ve+/vSdTPDshQO+/vQcbRWIEWzzvv73vv70H77+9FxEi77+977+9H++/ve+/vTZJR++/vXzvv70ZJ++/ve+/ve+/vR1UPygpa++/ve+/vQvGpgvvv70zbu+/ve+/vUoy77+9DnPvv73vv73vv73vv71cZWXvv73vv73vv73vv73vv70l77+9HgHvv73vv73vv71377+977+9S++/vVUX77+9WHrvv73vv70tae+/vQzvv73vv73vv71677+9L++/vXIWUO+/vRrvv700yYIvcC3vv70n77+9QDcwFC92QO+/vXQg77+977+9dnUJR++/vVnvv70Y77+977+9Z++/vSbvv73vv700A07vv70F77+9V++/vTPvv73vv71A77+9ce+/ve+/vc+/WO+/vXw51pIzDu+/vQvvv703KWXvv73vv70x77+9d2nvv73vv71cJhFm77+9dXXvv73vv718H++/ve+/ve+/vRvvv7166qKMUe+/vWfvv71tR++/vSlk77+9TiNUZF8QB0fvv73vv71N77+9fkQI77+9fe+/vRnvv73vv73vv73bkG9w77+9Q++/vQkwWnnvv71M77+977+9UO+/vXbvv71W77+9RiTvv70rTTBY77+977+977+977+977+9eO+/ve+/ve+/vVw077+977+9IAsp3azvv73WnwknTe+/ve+/vSI8dO+/ve+/vUEH77+9Vu+/ve+/vSIG77+9Ge+/ve+/vdu7Ze+/ve+/vQnvv73vv73vv73vv73vv70p77+977+977+9Gzfvv70K77+9Jlo577+977+9J++/ve+/vWrvv73vv73vv73HvO+/vWnVru+/vSPvv73vv70v77+9Uu+/ve+/ve+/vUJj77+9Znvvv70oAQs277+9Kh9gTO+/ve+/vU8yNh1v77+9Ue+/vXldPVfvv73vv70v77+9Vy/vv71c77+977+9fC3vv73vv70Z77+9Oj0/Ujzvv70a77+9Zu+/vRPvv712HO+/vWsx77+9Q++/vUFy77+9d0Dvv73vv70X77+9bSohPe+/vXQVJkDvv73vv719Umnvv73vv71n77+9CXg877+9Mte977+9HiYZ77+977+9X++/vT1eQe+/vSEZ77+977+977+977+9MVrvv71uCx1QZGgTXu+/ve+/vQTvv73vv73vv71R77+977+977+9ypobDT8477+9CCp0D++/vUVa77+9ce+/ve+/vW/vv70577+9b0hB77+977+9K++/vQFW77+9QU8fGtSZDzPvv73vv73vv71o77+977+97ZmxaEc1Nu+/vSTvv71HFu+/vTwf77+9CXgS77+977+9Xe+/vUl8L++/vd+vM++/vVEp77+977+9ZSLvv73vv71wW++/ve+/vVbvv73vv70W77+9Ejnvv73vv70eNe+/vXHvv73vv73vv73vv73vv73vv73vv70cHGbvv70gKe+/ve+/vQjPsGNVYu+/vWdDRXpf77+9C20keu+/vXRn77+9YDzvv70o77+9cC3vv71VCu+/ve+/ve+/vX/vv70M77+9Je+/ve+/vXQqVu+/vWElFu+/ve+/ve+/vQlyLe+/ve+/vVrvv73vv71o77+9PD3vv73vv73vv71z77+977+9J++/ve+/ve+/veaPiVrvv70kQ1Av77+9WQUk77+9QTBRD++/vUpiGXHvv70377+977+9Su+/vQfvv71sNu+/ve+/vQxm77+977+977+9IGrvv70S77+9Ke+/vRMGY++/vWgqFO+/ve+/vVJt77+9Ww8m77+9UAky77+9eO+/vRFB77+977+9H++/ve+/vRNW77+9Lu+/ve+/ve+/vRbvv71L77+9W++/vVzvv71F77+977+977+9DVkHVe+/ve+/ve+/vQbvv73vv714V++/vXvvv71eFEPvv71T77+9Pu+/ve+/ve+/vW7vv714fm8mW++/vUXvv73vv73vv70i77+977+977+9H++/ve+/ve+/vVbvv70N77+9D2zvv70ROe+/ve+/vUrvv71ebXrvv73vv70SN++/vQlL77+977+95IOp77+9WR5W77+9AFrvv71B77+9WDjvv73vv71U24hU77+977+9Lnfvv71O77+9IzMyYu+/vTzvv70d0IXvv71ZMD7vv73vv73vv71Q77+977+977+977+977+977+9be+/vV4/77+977+9O++/vTo/77+9ENK277+977+9XO+/vVNZ77+977+90b3vv70r77+9RO+/vS4j77+977+977+9Iu+/vRt2ee+/ve+/vR3vv70UJ2kG77+9Pu+/ve+/vSrvv70KA0xr77+977+977+9TO+/ve+/ve+/ve+/ve+/vQ/vv73vv73vv70077+9DTfvv70ZGz5+fh/vv70777+977+9Nu+/ve+/vUjvv73vv70q77+9Ye+/ve+/ve+/vWdw77+9AyVS77+977+9Ny3vv70W77+977+9S++/vQPvv71R77+977+977+9WO+/vVrvv73vv73vv70077+9bmzvv71777+91Ybvv73vv73vv70377+977+9W++/vQxYX++/vXDvv73vv70bde+/vXIWyabvv71+yZjvv71IN++/vXBSBDrvv71k77+9ah1ffkTvv70p77+977+977+977+9ET7vv73vv73Lv0zvv70F77+9Zu+/vWkqKhfvv73vv73vv73vv70MVRdkYe+/vTwp77+977+977+977+9c++/vS7vv71/77+977+9J++/ve+/vTvvv73vv71rce+/vSTvv73vv73vv73vv73vv70DA++/vWLvv73vv73vv73Rt2Tvv70B77+9XxQdE92U77+977+9NXjvv70777+977+977+9KhFJ77+977+9Tm3vv73vv71Iae+/vRbvv73vv73vv71RGUp377+977+9G++/vRHvv73vv73vv73vv73vv73vv73vv73ztqm477+9ajTvv70077+9MD/vv71bJu+/vVBMee+/vRzvv71277+9K++/vQE1Tnt9dO+/vX3vv70n77+9b++/vS3vv70477+9yLDvv73vv71bJu+/vW7vv73vv71Q77+9VO+/vQ07eA1tE++/ve+/ve+/ve+/ve+/vU7vv73vv73vv70rWO+/vRgi77+977+9cQPvv71K77+977+977+9U1oQFe+/ve+/vRfUsTHvv71SagkTfu+/ve+/vTLvv73vv73vv70XcO+/vVhbUn7vv70n77+977+9Se+/ve+/ve+/ve+/vTcJ77+977+9Ae+/vT7vv70B77+977+9PRQr77+977+9N++/vV/vv70TVX0F77+977+9Ke+/vVsU77+977+9343vv71p77+91qNL77+977+9G++/vRI977+9GO+/vSTvv73vv70S77+977+9CO+/vSF177+9HO+/vQMkDXsC77+9ZF1n77+9X++/vXrvv70mUmnvv73vv704Bu+/vQU877+9NUTvv71zXO+/vWvvv73vv73YmmMeL1M3QO+/ve+/vRBY77+977+977+9VF5OMknvv73vv71/BnQRehhVNcK3CO+/vW/vv73vv71077+9Ge+/ve+/vWXvv73vv71wOe+/vWEY77+977+9TUgLYDAq77+9FO+/vWLvv73vv73vv70N77+977+977+9Ou+/vS5kZ0Z/T++/vXfvv71o77+9H++/vS5I77+977+977+9Ku+/ve+/vSBo77+9du+/ve+/vVYL77+977+9N9us77+977+977+9B++/vXJaNUpL77+977+977+9LDMvfO+/vXxDb++/vQE377+9RBYCdu+/vX1iRAnvv71Xbu+/vcKd77+977+977+9XXnvv73vv73vv70S77+9Dgfvv73vv73qmrk+77+9aO+/vTJE77+977+9ADl+fu+/ve+/ve+/vWUa77+9L++/ve+/vSTDozMqCEYr77+9J++/vVY377+977+977+9U++/ve+/ve+/vVvvv705DG45FEPvv73vv73dlWvvv71H77+9QW3vv73vv70377+9wrPvv71877+977+9WH3vv73vv70MKe+/vRdwEU8577+977+977+977+977+9B13vv73vv70z77+9YEYW77+9Q++/vVTXiu+/ve+/vWLvv71477+9Bj5qFWTeu++/vVfvv71ZY++/vQ/vv70677+977+9W9q+K2jvv71c77+9De+/vUFw77+9Rynvv71scXFAY2oU77+9R1bvv73vv73vv73ZpCzvv71R77+977+977+9Zu+/ve+/vX4b77+9f++/ve+/ve+/vRMS77+977+977+9R3Hvv71WAzvvv73vv73vv73fqmTWvu+/vVvvv70Y77+9ae+/vdyZBgp777+9EGHcnO+/vXfvv73vv73vv73vv71H77+9TMOV77+9eGTvv70kF3gWR0sE77+977+9d29977+977+9IW3vv71s77+9fRli77+977+977+977+9FR3vv70Vz4Qj77+9bl3vv70K77+9Pu+/vUgX77+9Ie+/vUnvv70/Y2Mz77+9Ux8z1IJrDVZ+Cmp177+977+977+9Bi4t77+9WDBcU++/vVcjHSs377+977+9a3Dvv73vv70GdX7vv73vv70qyabvv73vv73vv73vv71u77+977+977+937Lvv71lbF7vv73Tiwjvv71MV++/vQoQ77+9Dl9277+9R++/vRse77+977+9GWLvv73vv71M77+9XN6t77+9VSBYEErvv73vv70iIGYpJ0Fs77+9Ehbvv73vv73vv71kC++/ve+/ve+/vTIc77+977+9eDvvv70U77+977+977+9Se+/vX40QO+/ve+/vXB+Ve+/vUBjWzVi77+9Qu+/vUTvv70277+9B++/vWfvv70e77+977+977+91Ijvv70p77+9woTvv70qTyd+Jdmx3pbvv70gU++/ve+/vSDvv73vv71S3LxR77+977+977+977+9HCosKO+/vXN2akHvv73Gne+/ve+/vTswNsa/77+9Nu+/vUfvv73vv73vv73vv73vv73vv71b77+977+977+9LHR077+9DCbvv70C3YMO77+9HRDvv73vv70TRu+/ve+/ve+/vV7Dvu+/vRpG77+9Qu+/vSbvv73vv714Ae+/ve+/vTQBLWrvv73vv71qBe+/ve+/vQbvv73vv71vVBzvv710VO+/vUvvv70t77+9fu+/vRPvv71S77+9zqfvv70ZE1Xvv73vv70q77+9VO+/vUjvv70LUENWRu+/vULvv71Z77+9djQYGnQ677+9DBrvv73vv70AaO+/ve+/vR/vv71k77+935lP77+9Iu+/vX/vv73vv71D77+9Eu+/vS4hG0jvv71VTu+/ve+/vW7vv73vv73vv73vv71l77+9cHtn77+9K++/ve+/vQktUS/LoQbvv73vv71GHu+/ve+/vWIcQe+/vTHvv73vv73vv71BQ++/vdGbAwXvv73vv715fu+/vQTvv73Xughx77+9EEnvv73vv73vv70INDJYIu+/ve+/vX0a77+977+977+9Au+/ve+/vSXvv71SOAUnS2I8Y1E/YG/vv70Y77+9Ju+/vVRAC++/vQ3vv73vv71EX++/ve+/vVdr77+977+9WO+/vUrvv73vv73vv71n77+9R23vv70977+9Cu+/vVAFRA9FaApd77+9du+/ve+/vW3vv73st7Hvv73vv73vv73vv71l4qSK77+9cz7vv73vv710Au+/ve+/vSrvv71icu+/vSrvv70977+9WWjvv71QUe+/ve+/vRNt77+9QV8JV++/vRcp77+977+9YAHvv70fae+/ve+/vTwd3Kp4K10T77+9TS5q77+9H++/ve+/ve+/ve+/vTtZ77+9IXpDQ1Xvv70m77+977+9T03vv71eYe+/vUUU77+9He+/vVRN77+977+9BCpV77+9du+/vU7vv71SGUhMTe+/vXPvv70OdO+/vQBuBTwQNnzvv71u77+977+977+9TlUgFO+/ve+/vWtJRO+/ve+/vXgv77+977+9MSvvv73vv71WK++/ve+/ve+/vUTvv71gFe+/ve+/vWLvv73vv71u77+977+9du+/vSdPQH7vv70j77+9x4Tvv73vv71nXl3LmmHvv70177+977+977+9Tu+/vWl877+977+977+9KX7vv70i77+9ai7vv73vv73vv73vv73vv70vT++/ve+/ve+/vTfvv70CBAhoVGttF0Tvv73vv70EIkPvv70s77+977+9K1piXe+/ve+/vVZx77+977+977+9e++/ve+/ve+/vVvvv70sVFHvv71d77+9Lu+/vQoD77+977+9SO+/ve+/vUR177+9Bu+/vW3vv70iP++/vRnvv706bQvvv71U77+977+9LxF/77+9xLYT77+977+9fh9177+977+9L++/vW7vv73vv71b77+977+9WsSCZe+/vWPvv73vv70Y2bEL77+9O1Xvv73vv70kAO+/vduUFu+/ve+/vXPvv73vv73vv70M77+9Lu+/vUMq77+9Cz9HQe+/vVHvv70wVO+/vU1777+977+9Y9SyOVPvv70G77+977+9OQYc77+977+9Mu+/vTPvv73vv73vv70W77+9DQzvv71M77+977+977+9XO+/ve+/vV3EuO+/vT46zaHvv71G77+977+9We+/vWrvv73vv71p77+977+9Ae+/vc6Ub1dVfDbvv71CKWbvv70K77+977+977+977+977+9Vn05LMS677+977+977+9F++/vX5D77+9C07vv73vv73vv73vv73vv70M77+9IO+/vQTvv71w77+977+9am/vv71MBO+/vXNYEe+/ve+/ve+/ve+/vVvvv711d2Hvv73vv70FWu+/ve+/vQTvv73vv71O77+9EEbvv70477+977+9ITvvv71tHR8iPX7vv73vv70p77+9STc577+9D++/ve+/vQHvv70677+9DmsAXSk977+9PGvvv73vv73vv71V77+977+977+9Vu+/ve+/vVUWYO+/ve+/vU8777+9IsyBVUTvv73vv73vv71377+9Y++/vXV6Je+/ve+/vU3vv70/c34jDHzvv71+77+9ae+/ve+/vSdA77+977+9IO+/vUPvv73vv73vv70cOHrvv73Sl++/vTTUklY577+9cO+/ve+/vXLvv71Q77+9FTXvv71Z77+9fO+/ve+/ve+/vdSt77+9WSLvv70lRu+/vR8b77+977+9Ou+/ve+/vR7vv71s77+977+9IC5hL2Dvv73jmII577+977+977+977+9dFLvv73vv71o77+977+977+977+977+9Ce+/vSVEKh0Y77+977+977+9S++/ve+/ve+/ve+/vScGO++/ve+/vWM977+977+977+977+977+9Ve+/vRMUH2/vv73vv73KlO+/ve+/vc+Z77+9A++/vT/vv73vv73Su3nvv73vv73ilZDvv73vv71sXO+/vWHvv73vv73vv73vv70F77+9cO+/ve+/ve+/vdm3Ue+/vWDvv70Zbe+/vSTvv71XZ3Hvv73QoyhMNiBAMu+/vU3vv71bz4zvv73Ni++/vR3vv71+77+9PA/vv73vv73vv73WjkUuLu+/ve+/vUbvv71j77+977+9FE7vv73vv73vv701yLXvv73vv73sr5Z+Eu+/vT7Sre+/ve+/vVTvv73vv73Qje+/ve+/ve+/vTHvv71oKu+/vWUDfUBMUe+/vSPvv71S77+977+9ee+/vQ3vv73vv73vv71v77+9z65N77+9fsSY77+977+977+9PFnvv70QTO+/vRfvv73vv719SEXvv71ofgjvv71EKO+/vQfQsygP77+977+9G0zvv73vv73vv71pdyl077+977+9dm3vv70277+9HhPvv70YdO+/vUEz77+9KlTvv70x77+977+977+977+977+977+95YGe77+9Snfvv70877+977+977+977+9K27vv71AXDRR77+9dVheOu+/vU9E77+977+977+977+977+9PiN877+9bu+/vXF+77+9fu+/vRIk77+9ZtGcH++/ve+/vTnvv70j77+9QWTQje+/vUPvv71SVu+/ve+/ve+/vXTvv73vv73vv73vv73vv71ufB/vv73vv70377+9ee+/vW8K1qLvv73vv71cH++/vXHvv73vv71lRREx77+977+9Hu+/ve+/ve+/vd+777+9AmHvv73vv73vv71m77+977+9IVXvv73vv73vv71u77+9X3JE77+977+977+9RCM977+9O++/ve+/ve+/ve+/vQduGe+/vQYoJQDvv70c77+9XlZDee+/vVTvv73vv73vv73vv70tee+/ve+/ve+/vWjvv71j77+977+9D++/ve+/ve+/vQ8O77+9IAfvv70k77+9Jm0U77+977+9B2FtOe+/vSzvv73diO+/ve+/vdCQ77+9PO+/ve+/ve+/vcmMCknvv71w77+9eu+/vWPvv73ElDkY77+977+977+9PV1u77+977+9MT3vv73YnHnvv70V77+977+9aAYh77+9GSbvv70477+9SG7vv70VOu+/vcKYz4RS77+977+9U++/ve+/ve+/vRfvv70B77+977+9CDnvv714X++/vXE2BSbfqm/vv73vv73Zty/cvSbvv73vv71nVO+/vcS1AO+/vUnvv73vv73vv71QBjQ5JO+/ve+/vUlF77+977+926gb77+9YBppDhct77+9Zm/vv70d77+9fC3vv70aVBpSbnRDJEXvv70E77+9W++/ve+/ve+/vTDvv71eP++/vU5EShjvv73LtO+/ve+/vR5O77+92Kl977+9ae+/vQ0gO++/vUsgT1zvv707S14K77+977+977+977+977+977+977+9e20W77+9Y3o1M2Mh77+9Dz8q77+9MO+/ve+/vTXvv719JypSDR1I77+977+9M++/vVVg77+977+9Su+/vVvZoR7vv73vv73vv71gHe+/ve+/vTnvv73vv70/77+9Qhhq77+9Ru+/ve+/ve+/vQbvv73vv70wSHpCPVUv77+977+9BwTvv70sV2jvv71nUWrvv70F77+9WBXvv73apTxB77+977+9Cu+/vRx4Ilzvv73vv71z77+977+977+9OO+/vTYp77+9Ku+/vdqTfTQJ77+9y4Fj77+977+977+977+9Bzs+fO+/vQ/vv71VFjZc77+9EUoDNkrvv71q77+977+9TO+/vTQ1ZTILUe+/vSzvv70j77+9Ge+/vV0kHR3vv70Q77+977+977+9SFUhGu+/vTMtYu+/vWtK77+9DO+/vQ/vv73vv71VU++/vTzvv73vv73vv73vv70L77+977+977+977+977+9K3JaYPSHu5ZaI++/ve+/vQp877+9fe+/ve+/vXvvv71mKjHvv73vv71AFO+/vWnvv70f77+9SUR+H++/vULvv71VQe+/vcaQ77+9Yu+/ve+/vTzvv70pDu+/ve+/vWcG77+977+93L4yEe+/vSxa77+977+9OxVXSO+/ve+/ve+/vWJHaUnvv73vv71/LAbvv70TN++/vSbNphPvv71ZZHPvv71N77+977+977+9WO+/ve+/vSRGzK9xN2Pvv71+bzNz77+9NgLvv73WsNW6VGRi77+9X++/vUckZnhGWxIM77+977+9We+/vQnvv70GZnN4Cu+/ve+/vWs1Xu+/vT8gdjvvv73vv73vv73vv71j77+9Xe+/vXrvv73vv73vv73vv71v77+9XO+/ve+/ve+/vd+J77+977+9fBLvv70yKxjvv71JG++/vRZdSloK77+977+977+9zLXvv73vv70W77+9Ve+/vWHvv70I77+9DO+/ve+/vXzvv73vv73vv73vv73an++/ve+/ve+/vWnvv71X77+977+9VRfvv71yUu+/ve+/ve+/vVwWMO+/vULvv70v77+977+9Ak0L77+977+9QEjvv70s77+977+9QGrvv71Z77+9O3ZhBO+/ve+/ve+/vW4jai1z77+9KxBZfO+/vVDvv70d77+977+9A0vvv73vv709Q++/vWjvv73vv71W77+977+9D++/vdub77+977+9de+/vRll77+977+9xIFcVFMH5qSJDTU+LQFS77+9cxkY77+9Z9i077+977+977+9P1fHri3vv73vv71IYTlIECrvv73vv73vv70z77+977+9HndEHH/vv73vv70i77+9S++/ve+/vUvvv73Pg++/vRHvv73vv71f0pwpOWoAcHbvv71lRR3vv71qO1rvv71Kfj1A77+9xYnvv73vv71k77+977+9au+/vVgE77+977+977+9KO+/ve+/vSPvv73LrRtLYFTvv73Fnu+/vXjvv71GJu+/vSB6RO+/vQ/vv70ccEd6GO+/vSDvv70BTu+/vQHvv73vv73vv73vv73vv71kFO+/ve+/vcioYBTvv73vv71QWAXvv707xK4077+9LSd3GhBIK++/ve+/vUR0CUoD77+9YX9N77+977+9IWY3fzzvv73vv71bIO+/ve+/vVnvv73vv73vv70Vd++/vXfvv70WSCtEYwjvv71J77+9bH7vv73vv73vv71q77+9Dg3vv73vv70Z77+9Pe+/ve+/vX/vv71SEse1XO+/vQ9D77+9yKTvv70777+977+977+9OGjvv70BSO+/vUvvv73vv71bblbvv70VZlAp77+977+9XCdrSu+/vQ7vv71NY++/vQTvv73vv71T77+9cn1377+9fj54Zhvvv71G77+9NWPvv73vv73vv71hQ1zvv73vv73vv71077+9Ce+/vXHvv73vv71wBu+/vRVi77+977+977+977+9K++/vVNvNRTIuO+/ve+/ve+/vRnvv73vv73vv70dKyha77+91aQZ77+977+9Yu+/vU0b77+9G++/ve+/ve+/vWjvv71G77+9ADnvv73Oku+/ve+/vQDvv70177+977+9Ee+/vTrvv70g77+977+9MSnvv73Nj++/vdyI77+9SSLvv70fFhPvv70+77+9de+/vQ5LJQXvv73vv71mSO+/ve+/ve+/ve+/vWDvv71vVDjvv70477+9TQnvv71a77+977+9Zg9X77+9WH3vv71WZiwp77+91IwY77+9DjIHOyvvv719c++/ve+/vSoQXu+/vca7Fmvvv73KoEZdPElJYkTvv73vv70OCkvvv73vv73vv73vv73vv71dOu+/vSdYe281Z++/vUw9Qu+/ve+/vRBwSBdye2Lvv70YWmTvv70E77+9Pu+/ve+/vRZHKu+/ve+/ve+/ve+/vSXvv73vv73vv71g77+9Xe+/ve+/vU/vv70+77+9E++/vSPvv71E77+9Ku+/vVkm77+977+9V++/vX7vv71pD++/vXwk77+9NHAmCh8577+9KUsV77+9b++/ve+/vXAaBVoU77+9z4Lvv71y77+977+9DO+/vQJrVDvvv73vv71S77+977+9K++/ve+/vRtA77+9d++/ve+/vQ3vv73vv710F1Hvv70H77+9zZrvv71wxKLvv73vv73vv71F77+9D3Ub77+977+9Yu+/vW42LdSLEO+/ve+/vSBSa1l+77+9bxRCHO+/vW3vv73vv71R77+936VrRO+/ve+/ve+/ve+/vUTvv73vv73CtzQw77+9Eu+/ve+/vTtg77+977+9cGVOZ++/vWbvv73vv70sLhPvv71r77+977+9Re+/ve+/vVFn77+977+977+977+9el9eCtGv77+9cS3vv73vv73vv71Hae+/vX1y77+9DSvvv73vv73vv71T77+977+977+9V++/ve+/vSBc77+977+977+977+977+9bQrvv71g77+977+9Bu+/ve+/vVXvv73vv73vv71n77+977+9K29uQRTvv702UO+/vWIaQWhOMt21YkPvv73vv73vv70H77+9RyBXAXPvv71N77+977+977+9Ou+/vRPDn++/ve+/vULfr++/ve+/vXzvv71P77+9Fu+/vWbvv70R77+9O++/ve+/vVndslzvv70I77+977+9UO+/ve+/vcWcUDxRJHpv77+9PFrvv71X77+9R++/vTrvv71lFhXvv702AWXvv73vv73vv73vv702Ie+/ve+/ve+/vVwX77+9b9Gr0YYgOca3Q++/ve+/vWnvv73vv73vv70T77+92qbvv73vv73vv70EfRHvv73vv71YKO+/vShPNG4f77+977+977+9KO+/vVJ0N3ZN77+977+977+92Y7vv718FVo577+977+9UO+/vTdR77+977+9Rjjvv73vv70bejjvv73vv71nZO+/vQJUUULvv73vv71O77+9Ue+/ve+/vXvvv73vv73vv71G77+977+9Qu+/vRfvv71OI9eK77+9CSvvv73vv70kM++/vWPvv73vv70PCu+/vVRm77+9ehPWtO+/vRDvv70oX++/ve+/vR/vv70BWO+/vWXvv73vv71Z77+977+977+977+9x48D77+9fQhjciTvv73vv73vv71277+9NO+/vXPvv70QR++/vWwa77+9HAXvv73vv73vv73vv70AXe+/ve+/ve+/vVppO2Uw77+9PUVM77+9fw/vv73dhlpo77+977+977+9PVswSO+/vRJCOjnKkkdwd++/vUzPn++/vWLLnEdh77+9KRFe77+977+977+977+9dhUD77+977+9MO+/vXxJ77+977+977+9Ie+/vUfvv73vv71NPHjvv70qJUDvv73vv73vv70y77+9dnPvv70F77+9x6kCaVc577+977+9C1cLRBPvv73vv71e77+9LQVc77+977+9UCnvv710X1bvv708yY1377+9aGBk77+9ElJ277+9Z8ug77+9Su+/vcOQ77+977+977+9Ou+/vU4qyJg377+9PwNgMlfvv73vv73vv73vv73vv73vv70nEu+/vSnvv73vv73vv73vv71+Du+/vUFw77+9fltc77+9Cu+/vQhl77+977+977+977+9Z0Tvv73vv71S77+9G1pU77+9Y++/vU8n77+977+9MQPvv73vv73PgSrvv73vv73vv73vv71m77+9D3Hvv73vv70H77+9WnlHKu+/vTXvv73vv70N77+977+977+9Mjrvv73vv73vv71BLgN8Q++/ve+/vXM277+9Xu+/ve+/vTbvv73vv73vv71S77+977+9N++/vSINUXrvv706Du+/vXlLV++/vRPvv70c77+9RTnvv71h77+9b++/ve+/vX05M++/vSfvv70d77+9G++/vcW377+977+977+977+9WTw177+9TQfvv70wAhPvv73vv71v77+9Q3sr77+9ce+/vfClsKzvv73vv73vv719cWbvv71177+977+977+9S++/vU7vv73vv73vv71X77+977+9a++/vXZ277+977+9ZGTvv71R77+977+9IFnfij9/Iu+/vQnvv715aGrvv73vv71SDFrvv70n77+977+977+9V++/vVBAB3F+fjLvv71L77+9b++/vQ/vv70B77+9JTgp77+9R++/ve+/vXfvv73vv70QQO+/vWQqcXVCNXhuwp8Iwpfvv71p77+9e1bvv73vv70a77+9Z++/vRvvv73vv70G77+9au+/vUzvv71u77+9JO+/vUAV77+90KPvv71KLe+/vWMN77+977+9Be+/ve+/vQPvv71477+9Eu+/vXbvv73Si++/vXdY77+977+9R++/vRLvv70M77+9He+/ve+/ve+/vVDvv71EU++/vSrvv73vv71E77+9Rm9SCEU777+977+977+977+977+9YO+/ve+/vWbvv710We+/vSzvv73vv71pfHzvv73vv71VfRLvv73vv70t77+9AFsi77+977+977+977+977+977+9JO+/ve+/vWF577+9NBFAaGNQ77+92ZHvv73vv73YsB/vv73vv73vv73vv73vv73vv70GzbXvv73vv71v77+977+9XV12djvvv71WDzwHEGDvv73vv70CGnLvv70k77+9SBDvv71n77+9Tu+/ve+/vXsqBO+/vShJ77+9bGVdRiLvv71iHu+/vWXvv71SMO+/vRPvv73vv73vv73vv73vv70G14VNae+/vUHvv73Yqu+/vT/vv70aR++/vcu5HO+/ve+/vRjvv71O77+9RXDvv71PNO+/vTbvv71Y77+90Zfvv73vv70/Fe+/ve+/ve+/ve+/vXHRs8WXVXY4DHkPG35C77+977+9IH/vv73vv71l77+977+977+9L++/ve+/vWMoLBjvv73vv73vv714WH5O77+9xKnvv73vv73vv73vv70sDiXvv706FO+/vUNY77+9ElLvv700eHpTF++/vSnGuxbvv73vv73vv71BK++/vSBM77+977+977+9SO+/ve+/ve+/vTpH77+977+977+977+9cu+/vUMZ77+977+977+9D2ZoSe+/vXvvv73vv73vv73cpu+/ve+/ve+/vTZh77+91rcxUO+/ve+/vWLvv73vv70W77+9c1NS77+977+9wp9X5oKPD++/vWnvv73vv71i77+9EO+/vXnLu0rcl++/ve+/vX3vv73vv73vv70777+9JlJM77+9FO+/ve+/vUQ777+977+9cQ/vv70SUEzvv71G77+977+91pjvv73vv71c77+9M++/vXgw77+977+9P29hJe+/ve+/ve+/ve+/ve+/vS/vv715URnvv73vv73vv73vv73vv73vv73vv70QTB/ToO+/vTYi77+977+977+977+977+9Gzbvv719CO+/ve+/vX0DNu+/vWJpaEA477+977+977+9Y++/ve+/vSvvv73vv70O77+977+977+9fO+/vTrvv719Wg1d77+9Ne+/vdO0ZN6Q77+9ZVzVpwnvv73vv73vv713De+/vT/vv71UOFXvv73vv73vv73vv73vv70v77+9UWXvv73vv73vv703Vu+/vVdn77+9FO+/vQ8KT++/ve+/ve+/vVzvv71Tc++/ve+/vSzvv73vv73vv70377+977+9Vu+/vXoMYmgK77+9fe+/vUx8G++/vWkkfO+/vTfvv73vv70lIu+/vS9CKjlI77+977+9GFoR75OD77+977+9R9aN77+977+9UDnvv71677+9UO+/ve+/ve+/vR/vv70i77+9JDAC77+91L9/Q3Xvv73vv73vv73Hpu+/vVkcQxNCVFbvv71J370U77+9FQsX77+9VykgZO+/vRcr77+9Yu+/ve+/vX/vv73vv73vv73Tj25777+977+9ByzpurHvv73vv71p77+9dhtxde+/ve+/ve+/ve+/vWXvv70Q77+9x5BDRVLvv71KLu+/vdm51LckZe+/vQnvv73vv73vv73vv718V0Tvv71YYhzvv70be829f2vvv71777+9Pu+/vW0SHe+/vUvvv71H77+9RE5oCCzvv73vv71YGDFiCDTvv73vv70W77+9DO+/ve+/ve+/vRvvv70nVANmRe+/ve+/vXjvv700bATvv70k77+977+977+9b0vvv71zc++/ve+/ve+/vQNT77+977+977+977+9Qu+/ve+/vV1uLO+/ve+/vSl+Ee+/ve+/vV8Z77+977+9WzcXDu+/vUDvv73vv73vv73vv73vv73vv73vv73vv70t77+977+9G3vvv73vv71/GO+/ve+/ve+/vUbvv73Qq++/vXU9EO+/vXMDH++/vWh+77+9NO+/ve+/ve+/vTofYS3vv70tNe+/ve+/ve+/vQrvv70J77+9FUDvv73vv73vv71XXt+hKO+/ve+/vVHvv70lTe+/vUJSS2VM77+977+9PH/vv73vv73vv71Z77+9E++/vWElI++/ve+/ve+/vSxNbO+/ve+/vXPvv73vv73vv73ctcSR77+9R1Dvv73vv71YJO+/vVvvv73vv71T77+977+977+9Ne+/vUYjUDXvv70O77+977+977+9Fnfvv73vv73vv70+dgnvv73vv71iB2lUzLXvv73vv71yVi3vv73vv71ZM0Xvv70377+9D++/vWg677+9Tu+/vW/vv73vv73vv73vv70h77+977+977+977+977+977+9V++/vVDvv73vv73hmZsS77+9JAfvv73vv71ZQe+/vUrvv71JD++/ve+/vRted10BTwxP77+977+9I++/ve+/vTBGbe+/vQU777+977+9fGPvv71O77+9Ku+/vSnMtA/vv71L77+9ZGnvv71uXe+/ve+/vVbCgiLvv71BOj9A77+9DBPvv73vv73vv73vv73vv71QQ2QJ77+9Eu+/vSpweO+/ve+/ve+/ve+/vV/vv73vv73vv71N77+977+977+9ZeKBie+/vdmEOGfvv70T77+977+977+9KO+/vQjvv71kPAlBFSZF77+9F8W777+977+977+977+9aE/vv71T1b9nXO+/vWwM77+9chzvv73vv70b77+977+9F3QtSkdFMCzvv71O77+977+9D3rvv73vv73vv73vv73vv70P77+977+9IO+/vT9HMdebE++/vRVRQ++/vSvIvQxD77+9a++/vWs427Xvv70v77+9YyQe77+9I++/ve+/vUjvv73vv70OPe+/vUtO77+9Ru+/ve+/ve+/vRHJhHE4Xlzvv73vv73vv73vv70Y77+977+977+977+977+92b5k77+977+977+9T++/vdOzJWnvv73vv70977+977+977+9BCvvv703SO+/ve+/vcSo77+9WTHZlu+/vQ9Yx7Xvv70z77+9K++/vWbvv73vv71LQzrvv71977+9YVdN77+9FX1677+977+9HwPvv71O77+977+9Ve+/ve+/vUbvv71QIO+/vQ1k77+9Pu+/ve+/vVjvv71w77+977+977+977+9dO+/ve+/vXnvv71kJO+/vVwj77+946qr77+9c++/vQPvv73vv73vv73vv70W77+9KCoDV2VNb++/ve+/vXrvv71MZwXvv73vv71YHw/vv71FM++/ve+/vX/enu+/ve+/ve+/ve+/ve+/ve+/ve+/vRJN77+9HXXvv71xce+/ve+/vSXMh++/vTYXDnwMPAHGie+/ve+/vWBd77+977+977+977+977+977+977+977+977+9d++/ve+/ve+/ve+/vTXvv73vv73Vqe+/ve+/vUbvv73vv73Yu++/ve+/vdK677+9UO+/vV7vv70n77+9FmVeUF/vv73vv73vv73vv73vv70z77+9be+/vXQsQO+/ve+/ve+/vVDvv7174ZeX77+9WV3vv73vv73vv73vv73vv70Hzovvv73vv70fFkrvv71077+9zJIt77+9ZURnC03vv73vv73vv70Y77+9Hu+/ve+/vTldb3Fn77+9Kjnvv73vv70k77+9Hhvvv70P77+9b2tI77+977+977+9T++/vQjvv70077+9Ulp6Se+/ve+/vXRDVu+/ve+/vWzvv73vv73Npy1zdF9IZe+/ve+/vTgw77+977+9GDpnau+/ve+/vVtIyqXvv73vv70I77+9OExo77+9P11H77+9OgplbmRzdHJlYW0KZW5kb2JqCjEwIDAgb2JqCjw8IC9GaWx0ZXIgL0ZsYXRlRGVjb2RlIC9MZW5ndGggNzQwID4+CnN0cmVhbQp477+9bVXvv71u77+9MBTvv73vv70r77+977+9Su+/vWI7JO+/vQoh77+9Ce+/vTjvv70q77+9au+/ve+/ve+/vW4kSO+/vSQc77+977+977+977+9I++/vWx7AO+/ve+/ve+/ve+/vTPvv71g77+9fu+/vWwn77+9bO+/vWYSPnLvv71q77+977+977+9FWbvv73vv73cte+/ve+/vV3vv70U55Op77+9X8aU77+9HGfvv70n77+977+9Ne+/ve+/vQzvv70+77+9ZO+/ve+/vRoeLHlTF++/vXNpRu+/ve+/vSRt3qvvv71T77+9D++/vX8zfybFqRN877+9P1fHoe+/vScc3LdqOFrvv71377+977+977+977+9Te+/ve+/vSXvv71N77+9V03vv73vv73vv70j77+977+9Fu+/vXXvv702J3jvv73vv71FB++/ve+/ve+/vQ5VXXYXMWwPae+/ve+/ve+/ve+/ve+/ve+/vTJy77+977+977+9HgYWbz/vv73vv73vv70277+977+9Ce+/vUs2fe+/ve+/ve+/ve+/vX0477+9D++/ve+/ve+/vStNV++/ve+/ve+/ve+/vUbvv73vv73Znu+/ve+/vWjvv73vv73vv71g77+9Yu+/vTnYhu+/ve+/ve+/ve+/vcmw77+9dwbvv73vv73vv73vv73vv70w77+9xoJUFU1p77+9dlfvv71uV++/ve+/vWDvv73vv73vv70t77+9fBXvv73vv73vv71vLu+/vRXvv73vv71ITSzvv73vv73vv70V77+9aBUsZWjvv73vv71R77+9Fu+/vQImQ03vv73vv70t77+977+977+9ERUsDu+/ve+/ve+/vThR77+9YHHvv71MMO+/ve+/vWjvv70Feijvv71Q77+977+9LlbXqCDvv73vv73vv73vv73vv73vv73uop3vv70LLO+/vWgsJe+/ve+/vSXVoe+/ve+/ve+/vTXvv73vv73vv70aOO+/vR04cEzvv73vv73vv73vv73vv73vv71C77+9FO+/ve+/vSQTce+/vQ/GqR8vMO+/ve+/vTjvv71477+977+9P3Lvv73vv70aeO+/vXkQIe+/vULvv73vv70977+9BFgSF++/ve+/ve+/ve+/ve+/vQzvv71577+977+977+9OA8y77+9VkHXoHDvv70i77+977+9Au+/ve+/vVrvv71x77+9eO+/vTh0B2t4Ec6b77+977+9X++/ve+/ve+/ve+/ve+/vVPvv704a++/vUhg77+977+977+977+977+9bhvvv73vv73vv71rzIAT77+977+9HVJPBU5IPUNwQjojDT3vv70lAjjvv73vv704ETjRmu+/vUJD77+977+9L++/vTnvv70hyagOfkLvv70MfRLvv73vv73vv71ScdKJ77+9VO+/ve+/vUZJ77+9GxXvv73cqO+/vc+N77+9fG5U77+9c++/vRLvv70b77+9fG4UZUVB77+977+9eHfvv73vv73vv71Jfe+/vQfGn++/vQF/77+977+977+9Se+/ve+/vXnvv73vv71r77+9dO+/ve+/vWc+Tzrvv7150rHPk05877+977+977+977+9SS9877+977+977+9ee+/ve+/ve+/vUnvv70+Tzrvv71577+9a++/vSfvv73vv70877+977+977+9KRU+T++/ve+/vXlKZ++/vTtz77+9fO+/vUvvv73bhHfvv73vv73vv70V566zD++/vXts77+9Q++/vSfvv73vv73vv73vv709bu+/vRbvv73vv73vv70977+977+977+9Bkbvv71577+9D++/ve+/vVAKZW5kc3RyZWFtCmVuZG9iagoxMSAwIG9iago8PCAvVHlwZSAvT2JqU3RtIC9MZW5ndGggNTIyIC9GaWx0ZXIgL0ZsYXRlRGVjb2RlIC9OIDUgL0ZpcnN0IDMyID4+CnN0cmVhbQp477+9dVNZa++/vUAQfu+vmMeWYu+/vd6SIARiB++/vSFtCe+/vXsR77+977+977+9G0nvv71IRlIg77+977+977+977+9Ve+/vU3SgjTvv73vv73NsTNcAAMuQSvvv73vv73vv70G77+9Bu+/vUhnIO+/ve+/ve+/ve+/vRnvv71rR++/vQzPnS/vv70V77+977+9A++/ve+/vV3vv73vv70j77+9Envvv70E77+977+977+9Ee+/vWTvv71R77+9Yu+/vT4S77+977+9V++/vT/vv70+Lu+/ve+/vTgj77+977+9cVEXPXAR77+9L++/vVDvv73vv71h77+9eu+/vdWh77+977+92YcD77+9H++/ve+/vceD77+9DERJ77+9dO+/vdum77+9dhYI77+977+9b++/vTnvv73vv73vv73vv73vv716cH3vv71CfTXvv73vv71sFHvvv73vv70G77+9OO+/ve+/ve+/ve+/vcib77+977+977+977+9Be+/vXViJu+/vUnvv73Iie+/vTRNMu+/ve+/vVsZe/OnmoFSKlFBEiIR77+977+9GCfvv71MEO+/vRnvv71JPu+/vUVE77+9S0hz77+9Yi/vv71lFBfvv73vv73vv71tUXnvv70q77+9f++/vXhTRUBV77+9Kz3QoHHvv73vv70sczXvv73vv73vv73vv73vv71k77+9RmHvv71rLO+/vVTvv716P2l477+9QUd9Gu+/vSHvv71m77+9TzofO++/vUvvv70i77+977+9J3wd77+9yZl4Tk/vv73vv70O77+977+977+9ay4a77+9B++/vV4j77+977+977+977+9F28qThjvv71T77+977+977+9Q++/vVrvv73vv73vv70LDxJZQwPvv70PdO+/ve+/ve+/vWIoLS3vv73vv70V77+9YnHvv71s77+977+9JjHvv70k0p7vv70zeu+/vQXvv73vv73vv70d77+9NVhh77+977+977+9UO+/vRYb77+9Y++/vV1r77+9PR4/AO+/ve+/vXFoM++/ve+/ve+/ve+/ve+/vRpA77+977+977+9z7tHWu+/vRld77+9TO+/vRHvv73vv70Pbxvvv73vv71mbyEPR++/ve+/vW/FvX1977+9V2Pvv71vyovvv70iVxLXo++/ve+/vUHvv73vv71XFu+/vSzvv73vv73vv71R77+977+9C3oC77+977+977+9XwplbmRzdHJlYW0KZW5kb2JqCjEgMCBvYmoKPDwgL0NyZWF0aW9uRGF0ZSAoRDoyMDIxMTIxNjE0MzI1N1opIC9DcmVhdG9yIChUZVgpIC9Nb2REYXRlIChEOjIwMjExMjE2MTQzMjU3WikgL1BURVguRnVsbGJhbm5lciAoVGhpcyBpcyBwZGZUZVgsIFZlcnNpb24gMy4xNDE1OTI2NTMtMi42LTEuNDAuMjMgXChUZVggTGl2ZSAyMDIxXCkga3BhdGhzZWEgdmVyc2lvbiA2LjMuMykgL1Byb2R1Y2VyIChwZGZUZVgtMS40MC4yMykgL1RyYXBwZWQgL0ZhbHNlID4+CmVuZG9iagoyIDAgb2JqCjw8IC9UeXBlIC9YUmVmIC9MZW5ndGggMjEgL0ZpbHRlciAvRmxhdGVEZWNvZGUgL0RlY29kZVBhcm1zIDw8IC9Db2x1bW5zIDQgL1ByZWRpY3RvciAxMiA+PiAvVyBbIDEgMiAxIF0gL1NpemUgMyAvSUQgWzw0ZGFjMTgxZWIxMGU1NjljYjc5MzBhYmQzYmJkMzZlMT48ZjhmNGE2YjlmNzU2MmEzMzMzNzI2MTQzNjc5NjMxNDA+XSA+PgpzdHJlYW0KeO+/vWNiAAImRu+/vV4GJgbvv71fDAAH77+9Ae+/vQplbmRzdHJlYW0KZW5kb2JqCiAgICAgICAgICAgICAgIApzdGFydHhyZWYKMjE2CiUlRU9GCg==",
"status_code": 200,
}
self.assertEqual(actual, expected)
def test_get_txt_file(self, mock_get, mock_create_url, mock_cach):
actual = self.action.run({Input.URL: "https://test.com/v1/test.txt", Input.IS_VERIFY: False})
expected = {
"bytes": "dGVzdAp0ZXN0IGZpbGUKc29tZSB0ZXN0IGRhdGE=",
"status_code": 200,
}
self.assertEqual(actual, expected)
def test_get_txt_file_with_checksum(self, mock_get, mock_create_url, mock_cach):
actual = self.action.run(
{
Input.URL: "https://test.com/v1/test.txt",
Input.CHECKSUM: "5084335576ea9ec4e9d1dcd7536dec3713b3a57a",
Input.IS_VERIFY: False,
}
)
expected = {
"bytes": "dGVzdAp0ZXN0IGZpbGUKc29tZSB0ZXN0IGRhdGE=",
"status_code": 200,
}
self.assertEqual(actual, expected)
def test_get_txt_file_with_bad_checksum(self, mock_get, mock_create_url, mock_cach):
with self.assertRaises(PluginException) as context:
self.action.run(
{
Input.URL: "https://test.com/v1/test.txt",
Input.CHECKSUM: "5084335576ea9ec4e9d1dcd7536dec3713b3a57aa",
Input.IS_VERIFY: False,
}
)
self.assertEqual(
"Checksums between the downloaded file and provided checksum did not match.", context.exception.cause
)
self.assertEqual(
"Verify the file you meant to download and the checksum you provided are correct.",
context.exception.assistance,
)
@patch("insightconnect_plugin_runtime.helper.open_url", side_effect=Util.mocked_url_open)
def test_is_verify(self, mock_get, mock_request, mock_create_url_meta, mock_open_cache):
actual = self.action.run({Input.URL: "https://test.com/v1/test.txt", Input.IS_VERIFY: True})
self.assertTrue(mock_get.call_args_list[0][1].get("verify"))
| 487.480519 | 34,560 | 0.818121 | 4,136 | 37,536 | 7.404739 | 0.487186 | 0.061125 | 0.035852 | 0.021158 | 0.04408 | 0.036603 | 0.027689 | 0.02426 | 0.02426 | 0.022693 | 0 | 0.294336 | 0.018302 | 37,536 | 76 | 34,561 | 493.894737 | 0.536785 | 0 | 0 | 0.296875 | 0 | 0.015625 | 0.938326 | 0.928895 | 0 | 1 | 0 | 0 | 0.109375 | 1 | 0.09375 | false | 0 | 0.125 | 0 | 0.234375 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
59ee233558ffccf884839b4b401403cf00fea0f8 | 214 | py | Python | mipego/optimizer/__init__.py | Basvanstein/MIP-EGO | e1ed0b0ea020850c72c4de5efd5dda0a99de571f | [
"MIT"
] | 23 | 2018-07-20T17:22:28.000Z | 2022-02-23T15:41:30.000Z | mipego/optimizer/__init__.py | Basvanstein/MIP-EGO | e1ed0b0ea020850c72c4de5efd5dda0a99de571f | [
"MIT"
] | 5 | 2019-03-05T22:09:13.000Z | 2021-10-08T08:48:43.000Z | mipego/optimizer/__init__.py | Basvanstein/MIP-EGO | e1ed0b0ea020850c72c4de5efd5dda0a99de571f | [
"MIT"
] | 14 | 2018-05-15T21:47:57.000Z | 2021-12-07T02:04:38.000Z |
from .OnePlusOne_CMA import OnePlusOne_CMA, OnePlusOne_Cholesky_CMA
from .mies import MIES
from .utils import argmax_restart
__all__ = [
'OnePlusOne_CMA', 'OnePlusOne_Cholesky_CMA', 'MIES', 'argmax_restart'
] | 26.75 | 73 | 0.794393 | 27 | 214 | 5.814815 | 0.37037 | 0.248408 | 0.292994 | 0.394904 | 0.433121 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.121495 | 214 | 8 | 74 | 26.75 | 0.835106 | 0 | 0 | 0 | 0 | 0 | 0.257009 | 0.107477 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
59f14f0984dc2a984546df4ea8c6f92ac9d4d8f3 | 6,005 | py | Python | sdk/formrecognizer/azure-ai-formrecognizer/tests/test_samples_async.py | NVolcz/azure-sdk-for-python | 47b6db912ef561053163d00527abe891dd1de1e4 | [
"MIT"
] | null | null | null | sdk/formrecognizer/azure-ai-formrecognizer/tests/test_samples_async.py | NVolcz/azure-sdk-for-python | 47b6db912ef561053163d00527abe891dd1de1e4 | [
"MIT"
] | null | null | null | sdk/formrecognizer/azure-ai-formrecognizer/tests/test_samples_async.py | NVolcz/azure-sdk-for-python | 47b6db912ef561053163d00527abe891dd1de1e4 | [
"MIT"
] | 1 | 2020-07-05T21:13:37.000Z | 2020-07-05T21:13:37.000Z | # coding: utf-8
# -------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# --------------------------------------------------------------------------
"""
USAGE:
python test_samples.py
Set the environment variables with your own values before running the samples.
See independent sample files to check what env variables must be set.
"""
import subprocess
import functools
import sys
import os
import pytest
from azure.core.credentials import AzureKeyCredential
from azure.ai.formrecognizer.aio import FormTrainingClient
from testcase import FormRecognizerTest, GlobalFormRecognizerAccountPreparer
def run(cmd, my_env):
os.environ['PYTHONUNBUFFERED'] = "1"
proc = subprocess.Popen(cmd,
stdout = subprocess.PIPE,
stderr = subprocess.STDOUT,
env = my_env
)
stdout, stderr = proc.communicate()
return proc.returncode, stdout, stderr
def _test_file(file_name, account, key, root_dir='./samples/async_samples'):
os.environ['AZURE_FORM_RECOGNIZER_ENDPOINT'] = account
os.environ['AZURE_FORM_RECOGNIZER_KEY'] = key
code, out, err = run([sys.executable, root_dir + '/' + file_name], my_env=dict(os.environ))
try:
assert code == 0
assert err is None
except AssertionError as e:
e.args += (out, )
raise AssertionError(e)
class TestSamplesAsync(FormRecognizerTest):
# Async sample tests
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
def test_sample_authentication_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
_test_file('sample_authentication_async.py', form_recognizer_account, form_recognizer_account_key)
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
async def test_sample_get_bounding_boxes_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
os.environ['CONTAINER_SAS_URL'] = self.get_settings_value("FORM_RECOGNIZER_STORAGE_CONTAINER_SAS_URL")
ftc = FormTrainingClient(form_recognizer_account, AzureKeyCredential(form_recognizer_account_key))
container_sas_url = os.environ['CONTAINER_SAS_URL']
poller = await ftc.begin_training(container_sas_url, use_training_labels=False)
model = await poller.result()
os.environ['CUSTOM_TRAINED_MODEL_ID'] = model.model_id
_test_file('sample_get_bounding_boxes_async.py', form_recognizer_account, form_recognizer_account_key)
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
def test_sample_manage_custom_models_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
_test_file('sample_manage_custom_models_async.py', form_recognizer_account, form_recognizer_account_key)
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
def test_sample_recognize_content_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
_test_file('sample_recognize_content_async.py', form_recognizer_account, form_recognizer_account_key)
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
async def test_sample_recognize_custom_forms_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
os.environ['CONTAINER_SAS_URL'] = self.get_settings_value("FORM_RECOGNIZER_STORAGE_CONTAINER_SAS_URL")
ftc = FormTrainingClient(form_recognizer_account, AzureKeyCredential(form_recognizer_account_key))
container_sas_url = os.environ['CONTAINER_SAS_URL']
poller = await ftc.begin_training(container_sas_url, use_training_labels=False)
model = await poller.result()
os.environ['CUSTOM_TRAINED_MODEL_ID'] = model.model_id
_test_file('sample_recognize_custom_forms_async.py', form_recognizer_account, form_recognizer_account_key)
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
def test_sample_recognize_receipts_from_url_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
_test_file('sample_recognize_receipts_from_url_async.py', form_recognizer_account, form_recognizer_account_key)
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
def test_sample_recognize_receipts_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
_test_file('sample_recognize_receipts_async.py', form_recognizer_account, form_recognizer_account_key)
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
def test_sample_train_model_with_labels_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
os.environ['CONTAINER_SAS_URL'] = self.get_settings_value("FORM_RECOGNIZER_STORAGE_CONTAINER_SAS_URL")
_test_file('sample_train_model_with_labels_async.py', form_recognizer_account, form_recognizer_account_key)
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
def test_sample_train_model_without_labels_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
os.environ['CONTAINER_SAS_URL'] = self.get_settings_value("FORM_RECOGNIZER_STORAGE_CONTAINER_SAS_URL")
_test_file('sample_train_model_without_labels_async.py', form_recognizer_account, form_recognizer_account_key)
@pytest.mark.live_test_only
@GlobalFormRecognizerAccountPreparer()
def test_sample_strongly_typing_recognized_form_async(self, resource_group, location, form_recognizer_account, form_recognizer_account_key):
_test_file('sample_strongly_typing_recognized_form_async.py', form_recognizer_account, form_recognizer_account_key)
| 52.217391 | 144 | 0.777519 | 716 | 6,005 | 6.061453 | 0.205307 | 0.16129 | 0.212903 | 0.121659 | 0.770968 | 0.73318 | 0.711982 | 0.711982 | 0.711982 | 0.683871 | 0 | 0.000573 | 0.127394 | 6,005 | 114 | 145 | 52.675439 | 0.827672 | 0.087427 | 0 | 0.414634 | 0 | 0 | 0.143432 | 0.121478 | 0 | 0 | 0 | 0 | 0.04878 | 1 | 0.121951 | false | 0 | 0.097561 | 0 | 0.243902 | 0 | 0 | 0 | 0 | null | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
94536c5e66ef092720549c99d4fc3cbb13b15fb8 | 95 | py | Python | tests/test_intrange.py | MichiK/spans | 1bab1c5ee9f27b698b5b1e1f849dd61641d12cfd | [
"MIT"
] | 123 | 2015-09-15T18:59:50.000Z | 2021-11-27T18:42:09.000Z | tests/test_intrange.py | MichiK/spans | 1bab1c5ee9f27b698b5b1e1f849dd61641d12cfd | [
"MIT"
] | 18 | 2015-12-11T17:42:23.000Z | 2021-04-21T16:40:44.000Z | tests/test_intrange.py | MichiK/spans | 1bab1c5ee9f27b698b5b1e1f849dd61641d12cfd | [
"MIT"
] | 12 | 2015-12-02T11:17:21.000Z | 2021-04-14T09:28:00.000Z | import pytest
from spans import intrange
def test_len():
assert len(intrange(0, 5)) == 5
| 13.571429 | 35 | 0.694737 | 15 | 95 | 4.333333 | 0.733333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.039474 | 0.2 | 95 | 6 | 36 | 15.833333 | 0.815789 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.25 | 1 | 0.25 | true | 0 | 0.5 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
945b1d6b2965d8996f8d9ede6346faad90473da6 | 99 | py | Python | majestic-monolith-django/core/renderer.py | kokospapa8/majestic-monolith-django | a0879989a651ecef6761ee7fce619ab17738bb35 | [
"Apache-2.0"
] | 1 | 2022-03-12T09:55:36.000Z | 2022-03-12T09:55:36.000Z | majestic-monolith-django/core/renderer.py | kokospapa8/majestic-monolith-django | a0879989a651ecef6761ee7fce619ab17738bb35 | [
"Apache-2.0"
] | 6 | 2022-03-09T10:42:44.000Z | 2022-03-31T08:27:25.000Z | majestic-monolith-django/core/renderer.py | kokospapa8/majestic-monolith-django | a0879989a651ecef6761ee7fce619ab17738bb35 | [
"Apache-2.0"
] | null | null | null | from rest_framework.renderers import JSONRenderer
class GUIDJSONRenderer(JSONRenderer):
pass
| 16.5 | 49 | 0.828283 | 10 | 99 | 8.1 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.131313 | 99 | 5 | 50 | 19.8 | 0.94186 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.333333 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 6 |
8468b0072a4effe71a4cc09b1f9ee5632cfc3782 | 54 | py | Python | nilmtk/version.py | nilmtkMridul/nilmtk | b4eede4f2e8f55c0f072cc08da1b47d433c07445 | [
"Apache-2.0"
] | null | null | null | nilmtk/version.py | nilmtkMridul/nilmtk | b4eede4f2e8f55c0f072cc08da1b47d433c07445 | [
"Apache-2.0"
] | null | null | null | nilmtk/version.py | nilmtkMridul/nilmtk | b4eede4f2e8f55c0f072cc08da1b47d433c07445 | [
"Apache-2.0"
] | null | null | null | version = '0.2.0.dev-362a1d8'
short_version = '0.2.0'
| 18 | 29 | 0.666667 | 11 | 54 | 3.181818 | 0.545455 | 0.457143 | 0.514286 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.229167 | 0.111111 | 54 | 2 | 30 | 27 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0.407407 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
846ec655a4720693383892277b16b9c65c86ae91 | 6,850 | py | Python | tests/test_dataset_splitting.py | K-Mike/deep_ner | ffe1bcd64f7e38066866daa0cdd943300ba9ed4e | [
"Apache-2.0"
] | null | null | null | tests/test_dataset_splitting.py | K-Mike/deep_ner | ffe1bcd64f7e38066866daa0cdd943300ba9ed4e | [
"Apache-2.0"
] | null | null | null | tests/test_dataset_splitting.py | K-Mike/deep_ner | ffe1bcd64f7e38066866daa0cdd943300ba9ed4e | [
"Apache-2.0"
] | null | null | null | import os
import re
import sys
import unittest
import numpy as np
try:
from deep_ner.dataset_splitting import split_dataset
except:
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
from deep_ner.dataset_splitting import split_dataset
class TestDatasetSplitting(unittest.TestCase):
def test_positive01(self):
X = np.array(
['01abc', '02def', '03ghi', '04jkl', '05mno', '06pqr', '07stu', '08vwx', '09yza', '10bcd', '11efg',
'12hij'],
dtype=np.str
)
y_tokenized = np.array(
[
[0, 0, 2, 1, 1, 0, 0, 0, 2, 0, 4, 3, 0], # 0 1 2 3 4 # 0 2 3 4
[0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], # 0 2 6 # 0
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], # 0 # 0
[0, 0, 0, 4, 0, 0, 4, 3, 0, 0, 0, 0, 0], # 0 3 4 # 0 3 4
[4, 3, 0, 4, 3, 3, 0, 0, 0, 0, 0, 2, 1], # 0 1 2 3 4 # 0 2 3 4
[0, 0, 0, 2, 1, 0, 0, 0, 4, 0, 0, 0, 0], # 0 1 2 4 # 0 2 4
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], # 0 # 0
[0, 0, 0, 6, 5, 5, 0, 0, 0, 0, 0, 0, 0], # 0 5 6 # 0
[0, 0, 0, 0, 0, 0, 6, 5, 4, 3, 0, 0, 0], # 0 3 4 5 6 # 0 3 4
[0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 2, 0, 0], # 0 2 4 # 0 2 4
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 0], # 0 3 4 # 0 3 4
[0, 0, 0, 2, 0, 0, 0, 0, 4, 0, 2, 1, 1], # 0 1 2 4 # 0 2 4
],
dtype=np.int32
)
# 0: 120
# 1: 6
# 2: 7
# 3: 7
# 4: 11
# 5: 3
# 6: 3
true_indices_for_training = np.array([1, 4, 5, 6, 7, 8, 10, 11], dtype=np.int32)
true_indices_for_testing = np.array([0, 2, 3, 9], dtype=np.int32)
calc_indices_for_training, calc_indices_for_testing = split_dataset(X, y_tokenized, 0.3333,
n_restarts=4, random_seed=0)
self.assertIsInstance(calc_indices_for_training, np.ndarray)
self.assertIsInstance(calc_indices_for_testing, np.ndarray)
self.assertEqual(true_indices_for_training.tolist(), calc_indices_for_training.tolist())
self.assertEqual(true_indices_for_testing.tolist(), calc_indices_for_testing.tolist())
def test_negative01(self):
X = np.array(
['01abc',],
dtype=np.str
)
y_tokenized = np.array(
[
[0, 0, 2, 1, 1, 0, 0, 0, 2, 0, 4, 3, 0],
],
dtype=np.int32
)
true_err_msg = re.escape('There are too few samples in the data set! Minimal number of samples is 2.')
with self.assertRaisesRegex(ValueError, true_err_msg):
_, _ = split_dataset(X, y_tokenized, 0.3333, n_restarts=4, random_seed=0)
def test_negative02(self):
X = np.array(
['01abc', '02def', '03ghi', '04jkl', '05mno', '06pqr', '07stu', '08vwx', '09yza', '10bcd', '11efg',
'12hij'],
dtype=np.str
)
y_tokenized = np.array(
[
[0, 0, 2, 1, 1, 0, 0, 0, 2, 0, 4, 3, 0],
[2, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 4, 0, 0, 4, 3, 0, 0, 0, 0, 0],
[4, 3, 0, 4, 3, 3, 0, 0, 0, 0, 0, 2, 1],
[0, 0, 0, 2, 1, 0, 0, 0, 4, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 6, 5, 5, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 6, 5, 4, 3, 0, 0, 0],
[0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 2, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 0],
[0, 0, 0, 2, 0, 0, 0, 0, 4, 0, 2, 1, 1],
],
dtype=np.int32
)
true_err_msg = re.escape('{0} is too small value of the test part! '
'There are no samples for testing subset!'.format(0.01))
with self.assertRaisesRegex(ValueError, true_err_msg):
_, _ = split_dataset(X, y_tokenized, 0.01, n_restarts=4, random_seed=0)
def test_negative03(self):
X = np.array(
['01abc', '02def', '03ghi', '04jkl', '05mno', '06pqr', '07stu', '08vwx', '09yza', '10bcd', '11efg',
'12hij'],
dtype=np.str
)
y_tokenized = np.array(
[
[0, 0, 2, 1, 1, 0, 0, 0, 2, 0, 4, 3, 0],
[2, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 4, 0, 0, 4, 3, 0, 0, 0, 0, 0],
[4, 3, 0, 4, 3, 3, 0, 0, 0, 0, 0, 2, 1],
[0, 0, 0, 2, 1, 0, 0, 0, 4, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 6, 5, 5, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 6, 5, 4, 3, 0, 0, 0],
[0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 2, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 0],
[0, 0, 0, 2, 0, 0, 0, 0, 4, 0, 2, 1, 1],
],
dtype=np.int32
)
true_err_msg = re.escape('{0} is too large value of the test part! '
'There are no samples for training subset!'.format(0.99))
with self.assertRaisesRegex(ValueError, true_err_msg):
_, _ = split_dataset(X, y_tokenized, 0.99, n_restarts=4, random_seed=0)
def test_negative04(self):
X = np.array(
['01abc', '02def', '03ghi', '04jkl', '05mno', '06pqr', '07stu', '08vwx', '09yza', '10bcd', '11efg',
'12hij'],
dtype=np.str
)
y_tokenized = np.array(
[
[0, 0, 2, 1, 1, 0, 0, 0, 2, 0, 4, 3, 0],
[2, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 4, 0, 0, 4, 3, 0, 0, 0, 0, 0],
[4, 3, 0, 4, 3, 3, 0, 0, 0, 0, 0, 2, 1],
[0, 0, 0, 2, 1, 0, 0, 0, 4, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 6, 5, 5, 0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 6, 5, 4, 3, 0, 0, 0],
[0, 0, 0, 4, 4, 0, 0, 0, 0, 0, 2, 0, 0],
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 3, 0],
[0, 0, 0, 2, 0, 0, 0, 0, 4, 0, 2, 1, 1],
],
dtype=np.int32
)
true_err_msg = re.escape('1 is too small value of restarts number. It must be greater than 1.')
with self.assertRaisesRegex(ValueError, true_err_msg):
_, _ = split_dataset(X, y_tokenized, 0.3333, n_restarts=1, random_seed=0)
if __name__ == '__main__':
unittest.main(verbosity=2)
| 43.630573 | 111 | 0.409051 | 1,164 | 6,850 | 2.319588 | 0.099656 | 0.299259 | 0.371111 | 0.408889 | 0.746667 | 0.685556 | 0.683333 | 0.676667 | 0.608148 | 0.608148 | 0 | 0.223626 | 0.410511 | 6,850 | 156 | 112 | 43.910256 | 0.445022 | 0.033431 | 0 | 0.630435 | 0 | 0 | 0.084838 | 0 | 0 | 0 | 0 | 0 | 0.057971 | 1 | 0.036232 | false | 0 | 0.050725 | 0 | 0.094203 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
84d8d58134a0c451941fe22a94f6ef6e368dab0b | 3,373 | py | Python | tests/test_robot.py | darshikaf/toy-robot-simulator | 408d160033728d65e9bac376d3af7fc84c520f31 | [
"MIT"
] | null | null | null | tests/test_robot.py | darshikaf/toy-robot-simulator | 408d160033728d65e9bac376d3af7fc84c520f31 | [
"MIT"
] | null | null | null | tests/test_robot.py | darshikaf/toy-robot-simulator | 408d160033728d65e9bac376d3af7fc84c520f31 | [
"MIT"
] | null | null | null | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import pytest
from robot_simulator.grid.board import Board
from robot_simulator.errors import MoveOutOfBoundsError, MissingPlaceError
from robot_simulator.agent.direction import Direction
from robot_simulator.grid.positioning import Point
from robot_simulator.agent.robot import Robot
def test_place(board, robot):
robot.place(Point(0, 1), Direction("NORTH"))
assert robot.position == Point(0, 1)
assert robot.direction == Direction("NORTH")
def test_place_out_of_lower_bounds(board, robot):
with pytest.raises(MoveOutOfBoundsError):
robot.place(Point(4, 5), Direction("NORTH"))
def test_place_out_of_upper_bounds(board, robot):
with pytest.raises(MoveOutOfBoundsError):
robot.place(Point(-1, 3), Direction("EAST"))
def test_move(board, robot):
robot.place(Point(0, 1), Direction("NORTH"))
robot.move_by(1)
assert robot.position == Point(0, 2)
assert robot.direction == Direction("NORTH")
def test_move_without_place():
board = Board(5, 5)
robot = Robot(board)
with pytest.raises(
MissingPlaceError, match="Unable to turn Robot until placed."
):
robot.move_by(1)
def test_move_out_of_lower_bounds(board, robot):
with pytest.raises(MoveOutOfBoundsError):
robot.place(Point(0, 4), Direction("WEST"))
robot.move_by(1)
def test_move_out_of_upper_bounds(board, robot):
with pytest.raises(MoveOutOfBoundsError):
robot.place(Point(4, 0), Direction("SOUTH"))
robot.move_by(1)
def test_left(board, robot):
robot.place(Point(2, 4), Direction("NORTH"))
robot.turn_by(-1)
assert robot.position == Point(2, 4)
assert robot.direction == Direction("WEST")
robot.turn_by(-1)
assert robot.position == Point(2, 4)
assert robot.direction == Direction("SOUTH")
robot.turn_by(-1)
assert robot.position == Point(2, 4)
assert robot.direction == Direction("EAST")
robot.turn_by(-1)
assert robot.position == Point(2, 4)
assert robot.direction == Direction("NORTH")
def test_left_without_place():
board = Board(5, 5)
robot = Robot(board)
with pytest.raises(
MissingPlaceError, match="Unable to turn Robot until placed."
):
robot.turn_by(-1)
def test_right(board, robot):
robot.place(Point(2, 4), Direction("NORTH"))
robot.turn_by(1)
assert robot.position == Point(2, 4)
assert robot.direction == Direction("EAST")
robot.turn_by(1)
assert robot.position == Point(2, 4)
assert robot.direction == Direction("SOUTH")
robot.turn_by(1)
assert robot.position == Point(2, 4)
assert robot.direction == Direction("WEST")
robot.turn_by(1)
assert robot.position == Point(2, 4)
assert robot.direction == Direction("NORTH")
def test_right_without_place():
board = Board(5, 5)
robot = Robot(board)
with pytest.raises(
MissingPlaceError, match="Unable to turn Robot until placed."
):
robot.turn_by(1)
def test_report(board, robot):
robot.place(Point(2, 4), Direction("NORTH"))
assert robot.report() == "2,4,NORTH"
def test_report_without_place():
board = Board(5, 5)
robot = Robot(board)
with pytest.raises(
MissingPlaceError, match="Unable to turn Robot until placed."
):
robot.report()
| 24.092857 | 74 | 0.674177 | 450 | 3,373 | 4.928889 | 0.122222 | 0.104148 | 0.034716 | 0.108206 | 0.809288 | 0.797565 | 0.776826 | 0.725879 | 0.725879 | 0.651939 | 0 | 0.023204 | 0.195079 | 3,373 | 139 | 75 | 24.266187 | 0.793738 | 0.012452 | 0 | 0.693182 | 0 | 0 | 0.070291 | 0 | 0 | 0 | 0 | 0 | 0.238636 | 1 | 0.147727 | false | 0 | 0.068182 | 0 | 0.215909 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
1702f505a496223ae276143c349617c1a2fb04ca | 151 | py | Python | jaxrk/rkhs/__init__.py | zalandoresearch/JaxRK | 5ec59b2addf4de5cc843a6fefaf2e6888016c111 | [
"MIT"
] | 13 | 2020-04-02T14:49:16.000Z | 2022-03-16T18:10:13.000Z | jaxrk/rkhs/__init__.py | zalandoresearch/JaxRK | 5ec59b2addf4de5cc843a6fefaf2e6888016c111 | [
"MIT"
] | 12 | 2020-04-02T07:00:11.000Z | 2020-06-16T10:53:20.000Z | jaxrk/rkhs/__init__.py | zalandoresearch/JaxRK | 5ec59b2addf4de5cc843a6fefaf2e6888016c111 | [
"MIT"
] | 3 | 2020-04-08T10:08:43.000Z | 2021-01-06T09:44:13.000Z | from .base import Vec, LinOp
from .vector import FiniteVec, inner, CombVec
#from .sp_vector import SpVec, RolloutSp, RolloutIdx
from .operator import * | 37.75 | 52 | 0.794702 | 21 | 151 | 5.666667 | 0.666667 | 0.201681 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.13245 | 151 | 4 | 53 | 37.75 | 0.908397 | 0.337748 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
ca091bda8db82cf0262325e91f0f2228feccb3f3 | 331 | py | Python | tests/data/format/final_period/function_docstrings.py | DanielNoord/pydocstringformatter | a69302cee6bd32b9b5cc48912a47d0e8ad3f7abe | [
"MIT"
] | 4 | 2022-01-02T22:50:59.000Z | 2022-02-09T09:04:37.000Z | tests/data/format/final_period/function_docstrings.py | DanielNoord/pydocstringformatter | a69302cee6bd32b9b5cc48912a47d0e8ad3f7abe | [
"MIT"
] | 80 | 2022-01-02T09:02:50.000Z | 2022-03-30T13:34:10.000Z | tests/data/format/final_period/function_docstrings.py | DanielNoord/pydocstringformatter | a69302cee6bd32b9b5cc48912a47d0e8ad3f7abe | [
"MIT"
] | 2 | 2022-01-02T11:58:29.000Z | 2022-01-04T18:53:29.000Z | def func()
"""Docstring"""
def inner_func()
"""Docstring"""
def func()
"""A multi-line
docstring
"""
def inner_func()
"""A multi-line
docstring
"""
def func()
"""Summary
docstring
"""
def inner_func()
"""Summary
docstring
"""
| 11.033333 | 23 | 0.44713 | 29 | 331 | 5 | 0.275862 | 0.413793 | 0.351724 | 0.434483 | 0.358621 | 0.358621 | 0 | 0 | 0 | 0 | 0 | 0 | 0.401813 | 331 | 29 | 24 | 11.413793 | 0.732323 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ca235d4b8b1dacbdb1004f28720ce92c28311dc2 | 84 | py | Python | GasBotty/models/detection/__init__.py | GreenCUBIC/GasBotty | 158f5991201c80bf4cbbbb9deabc9954ff19bbb1 | [
"MIT"
] | 353 | 2020-12-10T10:47:17.000Z | 2022-03-31T23:08:29.000Z | GasBotty/models/detection/__init__.py | GreenCUBIC/GasBotty | 158f5991201c80bf4cbbbb9deabc9954ff19bbb1 | [
"MIT"
] | 80 | 2020-12-10T09:54:22.000Z | 2022-03-30T22:08:45.000Z | GasBotty/models/detection/__init__.py | GreenCUBIC/GasBotty | 158f5991201c80bf4cbbbb9deabc9954ff19bbb1 | [
"MIT"
] | 63 | 2020-12-10T17:10:34.000Z | 2022-03-28T16:27:07.000Z | from .faster_rcnn import *
from .mask_rcnn import *
from .keypoint_rcnn import *
| 21 | 29 | 0.75 | 12 | 84 | 5 | 0.5 | 0.5 | 0.466667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.178571 | 84 | 3 | 30 | 28 | 0.869565 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
ca3cdbfaef70b51a7b5f763af7a29f07f038d5ee | 26,697 | py | Python | test/test_md007.py | scop/pymarkdown | 562ba8f7857d99ba09e86e42de5a37ec6d9b2c30 | [
"MIT"
] | null | null | null | test/test_md007.py | scop/pymarkdown | 562ba8f7857d99ba09e86e42de5a37ec6d9b2c30 | [
"MIT"
] | null | null | null | test/test_md007.py | scop/pymarkdown | 562ba8f7857d99ba09e86e42de5a37ec6d9b2c30 | [
"MIT"
] | null | null | null | """
Module to provide tests related to the MD007 rule.
"""
from test.markdown_scanner import MarkdownScanner
import pytest
@pytest.mark.rules
def test_md007_bad_configuration_indent():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/md004 directory that has consistent asterisk usage on a single
level list.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"--set",
"plugins.md007.indent=bad",
"--strict-config",
"scan",
"test/resources/rules/md007/good_list_indentation.md",
]
expected_return_code = 1
expected_output = ""
expected_error = (
"BadPluginError encountered while configuring plugins:\n"
+ "The value for property 'plugins.md007.indent' must be of type 'int'."
)
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_configuration_indent_bad():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/md004 directory that has consistent asterisk usage on a single
level list.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"--set",
"plugins.md007.indent=$#5",
"--strict-config",
"scan",
"test/resources/rules/md007/good_list_indentation.md",
]
expected_return_code = 1
expected_output = ""
expected_error = (
"BadPluginError encountered while configuring plugins:\n"
+ "The value for property 'plugins.md007.indent' is not valid: Allowable values are between 2 and 4."
)
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_good_list_indentation_x():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/good_list_indentation.md",
]
expected_return_code = 0
expected_output = ""
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_indentation_level_0():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_indentation_level_0.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_indentation_level_0.md:3:2: "
+ "MD007: Unordered list indentation "
+ "[Expected: 0, Actual=1] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_indentation_level_1():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_indentation_level_1.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_indentation_level_1.md:4:4: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_indentation_level_2():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_indentation_level_2.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_indentation_level_2.md:5:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 4, Actual=5] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_good_list_indentation_in_block_quote():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"--stack-trace",
"scan",
"test/resources/rules/md007/good_list_indentation_in_block_quote.md",
]
expected_return_code = 0
expected_output = ""
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_good_list_indentation_in_double_block_quote():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/good_list_indentation_in_double_block_quote.md",
]
expected_return_code = 0
expected_output = ""
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_good_unordered_list_in_ordered_list():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/good_unordered_list_in_ordered_list.md",
]
expected_return_code = 0
expected_output = ""
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_unordered_list_in_ordered_list():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_unordered_list_in_ordered_list.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_unordered_list_in_ordered_list.md:2:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 5, Actual=6] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_level_1_unordered_list_in_ordered_list():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_level_1_unordered_list_in_ordered_list.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_level_1_unordered_list_in_ordered_list.md:3:8: "
+ "MD007: Unordered list indentation "
+ "[Expected: 7, Actual=8] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_good_unordered_list_in_double_ordered_list():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/good_unordered_list_in_double_ordered_list.md",
]
expected_return_code = 0
expected_output = ""
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_unordered_list_in_double_ordered_list():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_unordered_list_in_double_ordered_list.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_unordered_list_in_double_ordered_list.md:3:8: "
+ "MD007: Unordered list indentation "
+ "[Expected: 7, Actual=8] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_good_unordered_ordered_unordere_ordered_unordered():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/good_unordered_ordered_unordere_ordered_unordered.md",
]
expected_return_code = 0
expected_output = ""
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_unordered_bad_ordered_unordered_ordered_unordered():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_unordered_bad_ordered_unordered_ordered_unordered.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_unordered_bad_ordered_unordered_ordered_unordered.md:1:2: "
+ "MD007: Unordered list indentation "
+ "[Expected: 0, Actual=1] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_unordered_ordered_unordered_bad_ordered_unordered():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_unordered_ordered_unordered_bad_ordered_unordered.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_unordered_ordered_unordered_bad_ordered_unordered.md:3:7: "
+ "MD007: Unordered list indentation "
+ "[Expected: 6, Actual=7] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_unordered_ordered_unordered_ordered_unordered_bad():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_unordered_ordered_unordered_ordered_unordered_bad.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_unordered_ordered_unordered_ordered_unordered_bad.md:5:12: "
+ "MD007: Unordered list indentation "
+ "[Expected: 11, Actual=12] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_indentation_in_block_quote_level_0():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_indentation_in_block_quote_level_0.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_indentation_in_block_quote_level_0.md:3:4: "
+ "MD007: Unordered list indentation "
+ "[Expected: 0, Actual=1] (ul-indent)\n"
+ "test/resources/rules/md007/bad_list_indentation_in_block_quote_level_0.md:4:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_in_block_quote_after_text():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_in_block_quote_after_text.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_in_block_quote_after_text.md:4:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_in_block_quote_after_atx_heading():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_in_block_quote_after_atx_heading.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_in_block_quote_after_atx_heading.md:4:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_in_block_quote_after_thematic_break():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_in_block_quote_after_thematic_break.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_in_block_quote_after_thematic_break.md:6:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_in_block_quote_after_setext_heading():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_in_block_quote_after_setext_heading.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_in_block_quote_after_setext_heading.md:5:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_in_block_quote_after_html_block():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_in_block_quote_after_html_block.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_in_block_quote_after_html_block.md:6:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_in_block_quote_after_fenced_block():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_in_block_quote_after_fenced_block.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_in_block_quote_after_fenced_block.md:6:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_in_block_quote_after_indented_block():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_in_block_quote_after_indented_block.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_in_block_quote_after_indented_block.md:4:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_in_block_quote_after_link_reference_definition():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_in_block_quote_after_link_reference_definition.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_in_block_quote_after_link_reference_definition.md:4:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_bad_list_in_block_quote_after_other_list():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/bad_list_in_block_quote_after_other_list.md",
]
expected_return_code = 1
expected_output = (
"test/resources/rules/md007/bad_list_in_block_quote_after_other_list.md:4:6: "
+ "MD007: Unordered list indentation "
+ "[Expected: 2, Actual=3] (ul-indent)"
)
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_good_unordered_list_elements():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"scan",
"test/resources/rules/md007/good_unordered_list_elements.md",
]
expected_return_code = 0
expected_output = ""
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_good_list_indentation_by_four():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"--set",
"plugins.md007.indent=$#4",
"scan",
"test/resources/rules/md007/good_list_indentation_by_four.md",
]
expected_return_code = 0
expected_output = ""
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
@pytest.mark.rules
def test_md007_good_list_indentation_with_start():
"""
Test to make sure we get the expected behavior after scanning a good file from the
test/resources/rules/MD026 directory that has atx headings that do not end with
punctuation.
"""
# Arrange
scanner = MarkdownScanner()
supplied_arguments = [
"--set",
"plugins.md007.start_indented=$!True",
"scan",
"test/resources/rules/md007/good_list_indentation_with_start.md",
]
expected_return_code = 0
expected_output = ""
expected_error = ""
# Act
execute_results = scanner.invoke_main(arguments=supplied_arguments)
# Assert
execute_results.assert_results(
expected_output, expected_error, expected_return_code
)
| 28.31071 | 109 | 0.695958 | 3,267 | 26,697 | 5.401592 | 0.040404 | 0.058934 | 0.0816 | 0.065167 | 0.986967 | 0.981867 | 0.977787 | 0.97518 | 0.96464 | 0.954043 | 0 | 0.026185 | 0.221823 | 26,697 | 942 | 110 | 28.340764 | 0.823249 | 0.221261 | 0 | 0.667954 | 0 | 0.001931 | 0.277158 | 0.186272 | 0 | 0 | 0 | 0 | 0.057915 | 1 | 0.057915 | false | 0 | 0.003861 | 0 | 0.061776 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
ca53f98bb5f19ad42d7c378a3606412b9abf292d | 84 | py | Python | pinpayments/tests/__init__.py | neon-jungle/django-pinpayments | ad8ac853f043e7291f2251c7afdf0e7f1df36915 | [
"Unlicense"
] | 11 | 2015-02-01T08:22:47.000Z | 2021-04-15T03:52:17.000Z | pinpayments/tests/__init__.py | neon-jungle/django-pinpayments | ad8ac853f043e7291f2251c7afdf0e7f1df36915 | [
"Unlicense"
] | 18 | 2015-01-18T03:43:44.000Z | 2021-07-04T22:46:29.000Z | pinpayments/tests/__init__.py | neon-jungle/django-pinpayments | ad8ac853f043e7291f2251c7afdf0e7f1df36915 | [
"Unlicense"
] | 7 | 2015-05-30T08:41:06.000Z | 2020-03-09T07:09:39.000Z | from pinpayments.tests.models import *
from pinpayments.tests.templatetags import *
| 28 | 44 | 0.833333 | 10 | 84 | 7 | 0.6 | 0.428571 | 0.571429 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.095238 | 84 | 2 | 45 | 42 | 0.921053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
ca87503cdad09c41c11d6c1b128cd2da2cb31d0e | 428 | py | Python | json_fingerprint/tests/run.py | cobaltine/json-fingerprint | e264cc87f81fa0bb777698834c3b70429f9eeda7 | [
"MIT"
] | 2 | 2020-12-27T17:20:40.000Z | 2022-03-26T17:47:28.000Z | json_fingerprint/tests/run.py | cobaltine/json-fingerprint | e264cc87f81fa0bb777698834c3b70429f9eeda7 | [
"MIT"
] | null | null | null | json_fingerprint/tests/run.py | cobaltine/json-fingerprint | e264cc87f81fa0bb777698834c3b70429f9eeda7 | [
"MIT"
] | 2 | 2021-03-07T23:01:56.000Z | 2021-05-26T16:02:57.000Z | import unittest
from json_fingerprint.tests.test_create import TestCreate
from json_fingerprint.tests.test_decode import TestDecode
from json_fingerprint.tests.test_find_matches import TestFindMatches
from json_fingerprint.tests.test_jfpv1 import TestJfpv1
from json_fingerprint.tests.test_match import TestMatch
from json_fingerprint.tests.test_validators import TestValidators
if __name__ == '__main__':
unittest.main()
| 35.666667 | 68 | 0.866822 | 56 | 428 | 6.25 | 0.410714 | 0.137143 | 0.325714 | 0.411429 | 0.48 | 0 | 0 | 0 | 0 | 0 | 0 | 0.005115 | 0.086449 | 428 | 11 | 69 | 38.909091 | 0.890026 | 0 | 0 | 0 | 0 | 0 | 0.018692 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.777778 | 0 | 0.777778 | 0.666667 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | 6 |
04a71a50ad56f0ca48a31abf670b14cf225c3086 | 2,481 | py | Python | visualizers/visualizer.py | visinf/deblur-devil | 53cc4c72a4ddb9dcede5ee52dc53000c39ff5dab | [
"Apache-2.0"
] | 18 | 2019-11-02T05:45:48.000Z | 2021-09-12T10:03:08.000Z | visualizers/visualizer.py | visinf/deblur-devil | 53cc4c72a4ddb9dcede5ee52dc53000c39ff5dab | [
"Apache-2.0"
] | 3 | 2019-12-10T07:52:24.000Z | 2021-04-07T19:14:31.000Z | visualizers/visualizer.py | visinf/deblur-devil | 53cc4c72a4ddb9dcede5ee52dc53000c39ff5dab | [
"Apache-2.0"
] | 3 | 2020-05-26T08:02:05.000Z | 2020-09-26T21:25:10.000Z | # Author: Jochen Gast <jochen.gast@visinf.tu-darmstadt.de>
from torch import nn
# ------------------------------------------
# That is how a Visualizer looks like
# ------------------------------------------
class Visualizer(nn.Module):
# ------------------------------------------
# on epoch initialization
# ------------------------------------------
def on_train_epoch_init(self, lr, epoch, total_epochs):
pass
def on_valid_epoch_init(self, lr, epoch, total_epochs):
pass
def on_epoch_init(self, lr, train, epoch, total_epochs):
if train:
self.on_train_epoch_init(lr, epoch, total_epochs)
else:
self.on_valid_epoch_init(lr, epoch, total_epochs)
# ------------------------------------------
# on step initialization
# ------------------------------------------
def on_train_step_init(self, example_dict, step, total_steps):
pass
def on_valid_step_init(self, example_dict, step, total_steps):
pass
def on_step_init(self, example_dict, train, step, total_steps):
if train:
self.on_train_step_init(example_dict, step, total_steps)
else:
self.on_valid_step_init(example_dict, step, total_steps)
# ------------------------------------------
# on step finished
# ------------------------------------------
def on_train_step_finished(self, example_dict, model_dict, loss_dict, step, total_steps):
pass
def on_valid_step_finished(self, example_dict, model_dict, loss_dict, step, total_steps):
pass
def on_step_finished(self, example_dict, model_dict, loss_dict, train, step, total_steps):
if train:
self.on_train_step_finished(example_dict, model_dict, loss_dict, step, total_steps)
else:
self.on_valid_step_finished(example_dict, model_dict, loss_dict, step, total_steps)
# ------------------------------------------
# on epoch finished
# ------------------------------------------
def on_train_epoch_finished(self, avg_loss_dict, epoch, total_epochs):
pass
def on_valid_epoch_finished(self, avg_loss_dict, epoch, total_epochs):
pass
def on_epoch_finished(self, avg_loss_dict, train, epoch, total_epochs):
if train:
self.on_train_epoch_finished(avg_loss_dict, epoch, total_epochs)
else:
self.on_valid_epoch_finished(avg_loss_dict, epoch, total_epochs)
| 35.956522 | 95 | 0.561064 | 288 | 2,481 | 4.465278 | 0.145833 | 0.046656 | 0.124417 | 0.111975 | 0.821151 | 0.806376 | 0.766719 | 0.727838 | 0.618974 | 0.539658 | 0 | 0 | 0.204353 | 2,481 | 68 | 96 | 36.485294 | 0.651469 | 0.24345 | 0 | 0.421053 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.315789 | false | 0.210526 | 0.026316 | 0 | 0.368421 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
04ac7e644e73a6c32acedc1bed9b279337407d4c | 4,246 | py | Python | georiviere/tests/__init__.py | georiviere/Georiviere-admin | 4ac532f84a7a8fef3e01384fad63e8e288d397c0 | [
"BSD-2-Clause"
] | 7 | 2021-11-05T14:52:25.000Z | 2022-03-24T21:18:02.000Z | georiviere/tests/__init__.py | georiviere/Georiviere-admin | 4ac532f84a7a8fef3e01384fad63e8e288d397c0 | [
"BSD-2-Clause"
] | 57 | 2021-11-02T10:27:34.000Z | 2022-03-31T14:08:32.000Z | georiviere/tests/__init__.py | georiviere/Georiviere-admin | 4ac532f84a7a8fef3e01384fad63e8e288d397c0 | [
"BSD-2-Clause"
] | 1 | 2021-12-05T14:55:42.000Z | 2021-12-05T14:55:42.000Z | from django.contrib.auth.models import Permission
from mapentity.tests import MapEntityTest
from georiviere.tests.factories import UserAllPermsFactory
from geotrek.authent.tests.factories import StructureFactory
class CommonRiverTest(MapEntityTest):
userfactory = UserAllPermsFactory
# TODO: find a way to fix these tests
def test_api_geojson_list_for_model(self):
pass
def test_api_geojson_detail_for_model(self):
pass
def test_structure_is_set(self):
if not hasattr(self.model, 'structure'):
return
self.login()
self.user.user_permissions.remove(Permission.objects.get(codename='can_bypass_structure'))
response = self.client.post(self._get_add_url(), self.get_good_data())
self.assertEqual(response.status_code, 302)
obj = self.model.objects.last()
self.assertEqual(obj.structure, self.user.profile.structure)
def test_structure_is_not_changed_without_permission(self):
if not hasattr(self.model, 'structure'):
return
self.login()
structure = StructureFactory()
self.assertNotEqual(structure, self.user.profile.structure)
self.user.user_permissions.remove(Permission.objects.get(codename='can_bypass_structure'))
self.assertFalse(self.user.has_perm('authent.can_bypass_structure'))
obj = self.modelfactory.create(structure=structure)
result = self.client.post(obj.get_update_url(), self.get_good_data())
self.assertEqual(result.status_code, 302)
obj.refresh_from_db()
self.assertEqual(obj.structure, structure)
self.logout()
def test_structure_is_changed_with_permission(self):
if not self.model or 'structure' not in self.model._meta.get_fields():
return
self.login()
self.assertTrue(self.user.has_perm('authent.can_bypass_structure'))
structure = StructureFactory()
self.assertNotEqual(structure, self.user.profile.structure)
obj = self.modelfactory.create(structure=structure)
data = self.get_good_data()
data['structure'] = self.user.profile.structure.pk
result = self.client.post(obj.get_update_url(), data)
self.assertEqual(result.status_code, 302)
self.assertEqual(self.model.objects.first().structure, self.user.profile.structure)
self.logout()
def test_set_structure_with_permission(self):
if not hasattr(self.model, 'structure'):
return
self.login()
structure = StructureFactory()
self.assertNotEqual(structure, self.user.profile.structure)
data = self.get_good_data()
data['structure'] = self.user.profile.structure.pk
response = self.client.post(self._get_add_url(), data)
self.assertEqual(response.status_code, 302)
obj = self.model.objects.last()
self.assertEqual(obj.structure, self.user.profile.structure)
self.logout()
def test_delete_not_same_structure_no_permission(self):
if not hasattr(self.model, 'structure'):
return
self.login()
self.user.user_permissions.remove(Permission.objects.get(codename='can_bypass_structure'))
self.user.save()
self.assertFalse(self.user.has_perm('authent.can_bypass_structure'))
structure = StructureFactory()
self.assertNotEqual(structure, self.user.profile.structure)
obj = self.modelfactory(structure=structure)
response = self.client.get(obj.get_delete_url())
self.assertRedirects(response, obj.get_detail_url())
def test_update_not_same_structure_no_permission(self):
if not hasattr(self.model, 'structure'):
return
self.login()
self.user.user_permissions.remove(Permission.objects.get(codename='can_bypass_structure'))
self.user.save()
self.assertFalse(self.user.has_perm('authent.can_bypass_structure'))
structure = StructureFactory()
self.assertNotEqual(structure, self.user.profile.structure)
obj = self.modelfactory(structure=structure)
response = self.client.get(obj.get_update_url())
self.assertRedirects(response, obj.get_detail_url())
| 40.438095 | 98 | 0.696891 | 498 | 4,246 | 5.74498 | 0.184739 | 0.055925 | 0.077246 | 0.083887 | 0.79972 | 0.779098 | 0.76302 | 0.708494 | 0.628102 | 0.604684 | 0 | 0.003525 | 0.198304 | 4,246 | 104 | 99 | 40.826923 | 0.836957 | 0.008243 | 0 | 0.702381 | 0 | 0 | 0.062723 | 0.02661 | 0 | 0 | 0 | 0.009615 | 0.22619 | 1 | 0.095238 | false | 0.119048 | 0.047619 | 0 | 0.238095 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
04b09bc988a7d5a4fad3580694ab2dd26a528c4c | 316 | py | Python | pecan/lang/ir/__init__.py | ondrik-misc-code/Pecan | 4d7394ff9fc56445be3d8b30179b317d5ee80ff6 | [
"MIT"
] | 39 | 2019-09-16T14:20:14.000Z | 2022-03-11T10:42:20.000Z | pecan/lang/ir/__init__.py | ondrik-misc-code/Pecan | 4d7394ff9fc56445be3d8b30179b317d5ee80ff6 | [
"MIT"
] | 21 | 2019-10-29T23:37:31.000Z | 2021-09-22T23:32:40.000Z | pecan/lang/ir/__init__.py | ondrik-misc-code/Pecan | 4d7394ff9fc56445be3d8b30179b317d5ee80ff6 | [
"MIT"
] | 4 | 2020-05-08T21:32:03.000Z | 2021-10-20T22:04:15.000Z | from pecan.lang.ir.base import *
from pecan.lang.ir.prog import *
from pecan.lang.ir.bool import *
from pecan.lang.ir.directives import *
from pecan.lang.ir.quant import *
from pecan.lang.ir.arith import *
from pecan.lang.ir.words import *
from pecan.lang.ir.praline import *
from pecan.lang.ir.annotation import *
| 28.727273 | 38 | 0.768987 | 54 | 316 | 4.5 | 0.259259 | 0.333333 | 0.481481 | 0.555556 | 0.691358 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.117089 | 316 | 10 | 39 | 31.6 | 0.870968 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
04b4de326f593af2b5546fb6904e3b8ffa157590 | 33,922 | py | Python | pybind/slxos/v17s_1_02/ptp_state/clock/__init__.py | extremenetworks/pybind | 44c467e71b2b425be63867aba6e6fa28b2cfe7fb | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v17s_1_02/ptp_state/clock/__init__.py | extremenetworks/pybind | 44c467e71b2b425be63867aba6e6fa28b2cfe7fb | [
"Apache-2.0"
] | null | null | null | pybind/slxos/v17s_1_02/ptp_state/clock/__init__.py | extremenetworks/pybind | 44c467e71b2b425be63867aba6e6fa28b2cfe7fb | [
"Apache-2.0"
] | 1 | 2021-11-05T22:15:42.000Z | 2021-11-05T22:15:42.000Z |
from operator import attrgetter
import pyangbind.lib.xpathhelper as xpathhelper
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType, RestrictedClassType, TypedListType
from pyangbind.lib.yangtypes import YANGBool, YANGListType, YANGDynClass, ReferenceType
from pyangbind.lib.base import PybindBase
from decimal import Decimal
from bitarray import bitarray
import __builtin__
import quality
class clock(PybindBase):
"""
This class was auto-generated by the PythonClass plugin for PYANG
from YANG module brocade-ptp-operational - based on the path /ptp-state/clock. Each member element of
the container is represented as a class variable - with a specific
YANG type.
YANG Description:
"""
__slots__ = ('_pybind_generated_by', '_path_helper', '_yang_name', '_rest_name', '_extmethods', '__type','__identity','__domain','__clock_state','__ptp_port_count','__priority1','__priority2','__offset_from_master','__mpd','__steps_removed','__local_time','__quality',)
_yang_name = 'clock'
_rest_name = 'clock'
_pybind_generated_by = 'container'
def __init__(self, *args, **kwargs):
path_helper_ = kwargs.pop("path_helper", None)
if path_helper_ is False:
self._path_helper = False
elif path_helper_ is not None and isinstance(path_helper_, xpathhelper.YANGPathHelper):
self._path_helper = path_helper_
elif hasattr(self, "_parent"):
path_helper_ = getattr(self._parent, "_path_helper", False)
self._path_helper = path_helper_
else:
self._path_helper = False
extmethods = kwargs.pop("extmethods", None)
if extmethods is False:
self._extmethods = False
elif extmethods is not None and isinstance(extmethods, dict):
self._extmethods = extmethods
elif hasattr(self, "_parent"):
extmethods = getattr(self._parent, "_extmethods", None)
self._extmethods = extmethods
else:
self._extmethods = False
self.__steps_removed = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="steps-removed", rest_name="steps-removed", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)
self.__domain = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="domain", rest_name="domain", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)
self.__quality = YANGDynClass(base=quality.quality, is_container='container', presence=False, yang_name="quality", rest_name="quality", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'callpoint': u'ptp-clock-quality', u'cli-suppress-show-path': None}}, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='container', is_config=False)
self.__mpd = YANGDynClass(base=unicode, is_leaf=True, yang_name="mpd", rest_name="mpd", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
self.__clock_state = YANGDynClass(base=unicode, is_leaf=True, yang_name="clock-state", rest_name="clock-state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
self.__priority1 = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority1", rest_name="priority1", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint8', is_config=False)
self.__priority2 = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority2", rest_name="priority2", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint8', is_config=False)
self.__ptp_port_count = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="ptp-port-count", rest_name="ptp-port-count", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)
self.__local_time = YANGDynClass(base=unicode, is_leaf=True, yang_name="local-time", rest_name="local-time", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
self.__offset_from_master = YANGDynClass(base=unicode, is_leaf=True, yang_name="offset-from-master", rest_name="offset-from-master", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
self.__type = YANGDynClass(base=unicode, is_leaf=True, yang_name="type", rest_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
self.__identity = YANGDynClass(base=unicode, is_leaf=True, yang_name="identity", rest_name="identity", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
load = kwargs.pop("load", None)
if args:
if len(args) > 1:
raise TypeError("cannot create a YANG container with >1 argument")
all_attr = True
for e in self._pyangbind_elements:
if not hasattr(args[0], e):
all_attr = False
break
if not all_attr:
raise ValueError("Supplied object did not have the correct attributes")
for e in self._pyangbind_elements:
nobj = getattr(args[0], e)
if nobj._changed() is False:
continue
setmethod = getattr(self, "_set_%s" % e)
if load is None:
setmethod(getattr(args[0], e))
else:
setmethod(getattr(args[0], e), load=load)
def _path(self):
if hasattr(self, "_parent"):
return self._parent._path()+[self._yang_name]
else:
return [u'ptp-state', u'clock']
def _rest_path(self):
if hasattr(self, "_parent"):
if self._rest_name:
return self._parent._rest_path()+[self._rest_name]
else:
return self._parent._rest_path()
else:
return [u'ptp-state', u'clock']
def _get_type(self):
"""
Getter method for type, mapped from YANG variable /ptp_state/clock/type (string)
"""
return self.__type
def _set_type(self, v, load=False):
"""
Setter method for type, mapped from YANG variable /ptp_state/clock/type (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_type is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_type() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="type", rest_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """type must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="type", rest_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)""",
})
self.__type = t
if hasattr(self, '_set'):
self._set()
def _unset_type(self):
self.__type = YANGDynClass(base=unicode, is_leaf=True, yang_name="type", rest_name="type", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
def _get_identity(self):
"""
Getter method for identity, mapped from YANG variable /ptp_state/clock/identity (string)
"""
return self.__identity
def _set_identity(self, v, load=False):
"""
Setter method for identity, mapped from YANG variable /ptp_state/clock/identity (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_identity is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_identity() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="identity", rest_name="identity", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """identity must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="identity", rest_name="identity", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)""",
})
self.__identity = t
if hasattr(self, '_set'):
self._set()
def _unset_identity(self):
self.__identity = YANGDynClass(base=unicode, is_leaf=True, yang_name="identity", rest_name="identity", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
def _get_domain(self):
"""
Getter method for domain, mapped from YANG variable /ptp_state/clock/domain (uint32)
"""
return self.__domain
def _set_domain(self, v, load=False):
"""
Setter method for domain, mapped from YANG variable /ptp_state/clock/domain (uint32)
If this variable is read-only (config: false) in the
source YANG file, then _set_domain is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_domain() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="domain", rest_name="domain", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """domain must be of a type compatible with uint32""",
'defined-type': "uint32",
'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="domain", rest_name="domain", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)""",
})
self.__domain = t
if hasattr(self, '_set'):
self._set()
def _unset_domain(self):
self.__domain = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="domain", rest_name="domain", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)
def _get_clock_state(self):
"""
Getter method for clock_state, mapped from YANG variable /ptp_state/clock/clock_state (string)
"""
return self.__clock_state
def _set_clock_state(self, v, load=False):
"""
Setter method for clock_state, mapped from YANG variable /ptp_state/clock/clock_state (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_clock_state is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_clock_state() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="clock-state", rest_name="clock-state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """clock_state must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="clock-state", rest_name="clock-state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)""",
})
self.__clock_state = t
if hasattr(self, '_set'):
self._set()
def _unset_clock_state(self):
self.__clock_state = YANGDynClass(base=unicode, is_leaf=True, yang_name="clock-state", rest_name="clock-state", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
def _get_ptp_port_count(self):
"""
Getter method for ptp_port_count, mapped from YANG variable /ptp_state/clock/ptp_port_count (uint32)
"""
return self.__ptp_port_count
def _set_ptp_port_count(self, v, load=False):
"""
Setter method for ptp_port_count, mapped from YANG variable /ptp_state/clock/ptp_port_count (uint32)
If this variable is read-only (config: false) in the
source YANG file, then _set_ptp_port_count is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_ptp_port_count() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="ptp-port-count", rest_name="ptp-port-count", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """ptp_port_count must be of a type compatible with uint32""",
'defined-type': "uint32",
'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="ptp-port-count", rest_name="ptp-port-count", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)""",
})
self.__ptp_port_count = t
if hasattr(self, '_set'):
self._set()
def _unset_ptp_port_count(self):
self.__ptp_port_count = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="ptp-port-count", rest_name="ptp-port-count", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)
def _get_priority1(self):
"""
Getter method for priority1, mapped from YANG variable /ptp_state/clock/priority1 (uint8)
"""
return self.__priority1
def _set_priority1(self, v, load=False):
"""
Setter method for priority1, mapped from YANG variable /ptp_state/clock/priority1 (uint8)
If this variable is read-only (config: false) in the
source YANG file, then _set_priority1 is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_priority1() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority1", rest_name="priority1", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint8', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """priority1 must be of a type compatible with uint8""",
'defined-type': "uint8",
'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority1", rest_name="priority1", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint8', is_config=False)""",
})
self.__priority1 = t
if hasattr(self, '_set'):
self._set()
def _unset_priority1(self):
self.__priority1 = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority1", rest_name="priority1", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint8', is_config=False)
def _get_priority2(self):
"""
Getter method for priority2, mapped from YANG variable /ptp_state/clock/priority2 (uint8)
"""
return self.__priority2
def _set_priority2(self, v, load=False):
"""
Setter method for priority2, mapped from YANG variable /ptp_state/clock/priority2 (uint8)
If this variable is read-only (config: false) in the
source YANG file, then _set_priority2 is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_priority2() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority2", rest_name="priority2", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint8', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """priority2 must be of a type compatible with uint8""",
'defined-type': "uint8",
'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority2", rest_name="priority2", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint8', is_config=False)""",
})
self.__priority2 = t
if hasattr(self, '_set'):
self._set()
def _unset_priority2(self):
self.__priority2 = YANGDynClass(base=RestrictedClassType(base_type=int, restriction_dict={'range': ['0..255']}, int_size=8), is_leaf=True, yang_name="priority2", rest_name="priority2", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint8', is_config=False)
def _get_offset_from_master(self):
"""
Getter method for offset_from_master, mapped from YANG variable /ptp_state/clock/offset_from_master (string)
"""
return self.__offset_from_master
def _set_offset_from_master(self, v, load=False):
"""
Setter method for offset_from_master, mapped from YANG variable /ptp_state/clock/offset_from_master (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_offset_from_master is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_offset_from_master() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="offset-from-master", rest_name="offset-from-master", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """offset_from_master must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="offset-from-master", rest_name="offset-from-master", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)""",
})
self.__offset_from_master = t
if hasattr(self, '_set'):
self._set()
def _unset_offset_from_master(self):
self.__offset_from_master = YANGDynClass(base=unicode, is_leaf=True, yang_name="offset-from-master", rest_name="offset-from-master", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
def _get_mpd(self):
"""
Getter method for mpd, mapped from YANG variable /ptp_state/clock/mpd (string)
"""
return self.__mpd
def _set_mpd(self, v, load=False):
"""
Setter method for mpd, mapped from YANG variable /ptp_state/clock/mpd (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_mpd is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_mpd() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="mpd", rest_name="mpd", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """mpd must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="mpd", rest_name="mpd", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)""",
})
self.__mpd = t
if hasattr(self, '_set'):
self._set()
def _unset_mpd(self):
self.__mpd = YANGDynClass(base=unicode, is_leaf=True, yang_name="mpd", rest_name="mpd", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
def _get_steps_removed(self):
"""
Getter method for steps_removed, mapped from YANG variable /ptp_state/clock/steps_removed (uint32)
"""
return self.__steps_removed
def _set_steps_removed(self, v, load=False):
"""
Setter method for steps_removed, mapped from YANG variable /ptp_state/clock/steps_removed (uint32)
If this variable is read-only (config: false) in the
source YANG file, then _set_steps_removed is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_steps_removed() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="steps-removed", rest_name="steps-removed", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """steps_removed must be of a type compatible with uint32""",
'defined-type': "uint32",
'generated-type': """YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="steps-removed", rest_name="steps-removed", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)""",
})
self.__steps_removed = t
if hasattr(self, '_set'):
self._set()
def _unset_steps_removed(self):
self.__steps_removed = YANGDynClass(base=RestrictedClassType(base_type=long, restriction_dict={'range': ['0..4294967295']}, int_size=32), is_leaf=True, yang_name="steps-removed", rest_name="steps-removed", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='uint32', is_config=False)
def _get_local_time(self):
"""
Getter method for local_time, mapped from YANG variable /ptp_state/clock/local_time (string)
"""
return self.__local_time
def _set_local_time(self, v, load=False):
"""
Setter method for local_time, mapped from YANG variable /ptp_state/clock/local_time (string)
If this variable is read-only (config: false) in the
source YANG file, then _set_local_time is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_local_time() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=unicode, is_leaf=True, yang_name="local-time", rest_name="local-time", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """local_time must be of a type compatible with string""",
'defined-type': "string",
'generated-type': """YANGDynClass(base=unicode, is_leaf=True, yang_name="local-time", rest_name="local-time", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)""",
})
self.__local_time = t
if hasattr(self, '_set'):
self._set()
def _unset_local_time(self):
self.__local_time = YANGDynClass(base=unicode, is_leaf=True, yang_name="local-time", rest_name="local-time", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='string', is_config=False)
def _get_quality(self):
"""
Getter method for quality, mapped from YANG variable /ptp_state/clock/quality (container)
"""
return self.__quality
def _set_quality(self, v, load=False):
"""
Setter method for quality, mapped from YANG variable /ptp_state/clock/quality (container)
If this variable is read-only (config: false) in the
source YANG file, then _set_quality is considered as a private
method. Backends looking to populate this variable should
do so via calling thisObj._set_quality() directly.
"""
if hasattr(v, "_utype"):
v = v._utype(v)
try:
t = YANGDynClass(v,base=quality.quality, is_container='container', presence=False, yang_name="quality", rest_name="quality", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'callpoint': u'ptp-clock-quality', u'cli-suppress-show-path': None}}, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='container', is_config=False)
except (TypeError, ValueError):
raise ValueError({
'error-string': """quality must be of a type compatible with container""",
'defined-type': "container",
'generated-type': """YANGDynClass(base=quality.quality, is_container='container', presence=False, yang_name="quality", rest_name="quality", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'callpoint': u'ptp-clock-quality', u'cli-suppress-show-path': None}}, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='container', is_config=False)""",
})
self.__quality = t
if hasattr(self, '_set'):
self._set()
def _unset_quality(self):
self.__quality = YANGDynClass(base=quality.quality, is_container='container', presence=False, yang_name="quality", rest_name="quality", parent=self, path_helper=self._path_helper, extmethods=self._extmethods, register_paths=True, extensions={u'tailf-common': {u'callpoint': u'ptp-clock-quality', u'cli-suppress-show-path': None}}, namespace='urn:brocade.com:mgmt:brocade-ptp-operational', defining_module='brocade-ptp-operational', yang_type='container', is_config=False)
type = __builtin__.property(_get_type)
identity = __builtin__.property(_get_identity)
domain = __builtin__.property(_get_domain)
clock_state = __builtin__.property(_get_clock_state)
ptp_port_count = __builtin__.property(_get_ptp_port_count)
priority1 = __builtin__.property(_get_priority1)
priority2 = __builtin__.property(_get_priority2)
offset_from_master = __builtin__.property(_get_offset_from_master)
mpd = __builtin__.property(_get_mpd)
steps_removed = __builtin__.property(_get_steps_removed)
local_time = __builtin__.property(_get_local_time)
quality = __builtin__.property(_get_quality)
_pyangbind_elements = {'type': type, 'identity': identity, 'domain': domain, 'clock_state': clock_state, 'ptp_port_count': ptp_port_count, 'priority1': priority1, 'priority2': priority2, 'offset_from_master': offset_from_master, 'mpd': mpd, 'steps_removed': steps_removed, 'local_time': local_time, 'quality': quality, }
| 66.383562 | 489 | 0.737427 | 4,568 | 33,922 | 5.21366 | 0.041594 | 0.046187 | 0.058784 | 0.055551 | 0.861228 | 0.84733 | 0.842417 | 0.830702 | 0.828351 | 0.812227 | 0 | 0.010864 | 0.131714 | 33,922 | 510 | 490 | 66.513725 | 0.797718 | 0.153971 | 0 | 0.495146 | 0 | 0.038835 | 0.352546 | 0.194105 | 0 | 0 | 0 | 0 | 0 | 1 | 0.126214 | false | 0 | 0.029126 | 0 | 0.268608 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
04c8cc1dd10d60b7adeba4f1a4863bb24a3a1504 | 156 | py | Python | TorchUtils/Core/StrToClass.py | Akasan/TorchUtils | 93691addb1d8b3b603805fe1a46d867faf364e9d | [
"MIT"
] | null | null | null | TorchUtils/Core/StrToClass.py | Akasan/TorchUtils | 93691addb1d8b3b603805fe1a46d867faf364e9d | [
"MIT"
] | null | null | null | TorchUtils/Core/StrToClass.py | Akasan/TorchUtils | 93691addb1d8b3b603805fe1a46d867faf364e9d | [
"MIT"
] | null | null | null | import torch
import torch.nn as nn
import torch.nn.functional as F
ACTIVATION = {"relu": nn.ReLU(True), "sigmoid": nn.Sigmoid(), "softmax": nn.Softmax()}
| 22.285714 | 86 | 0.705128 | 24 | 156 | 4.583333 | 0.458333 | 0.3 | 0.236364 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128205 | 156 | 6 | 87 | 26 | 0.808824 | 0 | 0 | 0 | 0 | 0 | 0.115385 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.75 | 0 | 0.75 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
04f850ac4d9b137e59dd68992018f413e14dc9f0 | 50 | py | Python | jhubctl/hubs/__init__.py | awstown/jhubctl | 6eab5d07ed4086ded86ed2ac5aa0814c44d4750a | [
"MIT"
] | 4 | 2020-05-04T20:34:37.000Z | 2020-05-06T21:14:18.000Z | jhubctl/hubs/__init__.py | townsenddw/jhubctl | 6eab5d07ed4086ded86ed2ac5aa0814c44d4750a | [
"MIT"
] | 2 | 2018-09-21T05:01:57.000Z | 2018-10-25T21:59:53.000Z | jhubctl/hubs/__init__.py | awstown/jhubctl | 6eab5d07ed4086ded86ed2ac5aa0814c44d4750a | [
"MIT"
] | 1 | 2018-09-23T17:13:20.000Z | 2018-09-23T17:13:20.000Z | from .hub_list import HubList
from .hub import Hub | 25 | 29 | 0.82 | 9 | 50 | 4.444444 | 0.555556 | 0.35 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.14 | 50 | 2 | 30 | 25 | 0.930233 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
b6d3e5e584c6fae325a7ae8140fd50b65d582d4b | 1,729 | py | Python | custom_grids.py | jonasvandervennet/sudoku-generator | 44b13a7ccdb2d469eed69e61ef396a0fd37743d3 | [
"MIT"
] | null | null | null | custom_grids.py | jonasvandervennet/sudoku-generator | 44b13a7ccdb2d469eed69e61ef396a0fd37743d3 | [
"MIT"
] | null | null | null | custom_grids.py | jonasvandervennet/sudoku-generator | 44b13a7ccdb2d469eed69e61ef396a0fd37743d3 | [
"MIT"
] | null | null | null | custom_scoring = [
[3,7,0,0,0,9,0,0,6],
[8,0,0,1,0,3,0,7,0],
[0,0,0,0,0,0,0,0,8],
[0,2,0,0,8,0,0,0,5],
[1,8,7,0,0,0,6,4,2],
[5,0,0,0,2,0,0,1,0],
[7,0,0,0,0,0,0,0,0],
[0,5,0,6,0,2,0,0,7],
[2,0,0,3,0,0,0,6,1],
]
custom_easy = [
[0,0,0,8,0,4,0,5,0],
[8,0,7,0,5,6,4,0,1],
[0,6,0,1,0,0,2,0,0],
[0,0,0,7,6,3,0,0,0],
[0,7,0,0,0,0,0,4,0],
[0,0,0,2,4,1,0,0,0],
[0,0,6,0,0,5,0,2,0],
[9,0,5,4,7,0,6,0,8],
[0,8,0,6,0,9,0,0,0],
]
custom_expert = [
[0,0,1,3,0,6,4,0,0],
[0,0,0,1,0,0,0,0,3],
[0,6,0,0,5,0,0,0,9],
[9,0,6,0,0,2,0,7,0],
[0,4,0,0,7,0,0,0,6],
[2,0,0,0,0,0,0,0,4],
[0,0,7,0,0,0,0,1,0],
[0,5,0,0,9,0,0,0,0],
[0,0,0,0,0,8,6,0,0],
]
custom_16 = [
[3, 10, 12, 11, 5, 1, 6, 7, 2, 15, 8, 16, 13, 14, 9, 4],
[1, 8, 15, 16, 13, 14, 12, 9, 4, 6, 7, 11, 3, 5, 2, 10],
[13, 9, 6, 2, 4, 16, 15, 8, 3, 14, 5, 10, 1, 7, 11, 12],
[5, 4, 14, 7, 10, 2, 3, 11, 9, 1, 12, 13, 8, 6, 16, 15],
[10, 7, 11, 9, 2, 12, 14, 15, 16, 5, 3, 8, 6, 4, 1, 13],
[8, 2, 1, 3, 11, 9, 5, 4, 14, 12, 13, 6, 15, 10, 7, 16],
[6, 14, 4, 5, 1, 8, 13, 16, 11, 10, 15, 7, 12, 9, 3, 2],
[12, 15, 16, 13, 3, 6, 7, 10, 1, 4, 9, 2, 14, 8, 5, 11],
[9, 12, 7, 10, 16, 11, 4, 14, 13, 8, 2, 3, 5, 15, 6, 1],
[11, 5, 2, 1, 6, 7, 9, 12, 15, 16, 4, 14, 10, 13, 8, 3],
[15, 16, 13, 14, 8, 3, 10, 2, 5, 9, 6, 1, 11, 12, 4, 7],
[4, 3, 8, 6, 15, 5, 1, 13, 7, 11, 10, 12, 2, 16, 14, 9],
[16, 6, 3, 8, 12, 15, 11, 1, 10, 7, 14, 4, 9, 2, 13, 5],
[2, 11, 10, 4, 9, 13, 8, 6, 12, 3, 16, 5, 7, 1, 15, 14],
[7, 13, 5, 15, 14, 10, 16, 3, 6, 2, 1, 9, 4, 11, 12, 8],
[14, 1, 9, 12, 7, 4, 2, 5, 8, 13, 11, 15, 16, 3, 10, 6],
]
| 31.436364 | 60 | 0.380567 | 507 | 1,729 | 1.289941 | 0.04142 | 0.284404 | 0.252294 | 0.207951 | 0.221713 | 0.148318 | 0.119266 | 0.094801 | 0.077982 | 0.050459 | 0 | 0.488446 | 0.274147 | 1,729 | 54 | 61 | 32.018519 | 0.032669 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
8e08fb56bdc9d8e18bdb0fa5b953a56d2661f6d0 | 15,051 | py | Python | tests/v2/test_1447-jax-autodiff-slices-ufuncs.py | jpivarski/awkward-1.0 | 49a3ff13ef90b8778a80573211d58c544729eaa5 | [
"BSD-3-Clause"
] | 2 | 2019-09-12T03:07:23.000Z | 2019-09-27T05:32:07.000Z | tests/v2/test_1447-jax-autodiff-slices-ufuncs.py | jpivarski/awkward-1.0 | 49a3ff13ef90b8778a80573211d58c544729eaa5 | [
"BSD-3-Clause"
] | 1 | 2019-09-26T17:57:45.000Z | 2019-09-26T17:57:45.000Z | tests/v2/test_1447-jax-autodiff-slices-ufuncs.py | jpivarski/awkward-1.0 | 49a3ff13ef90b8778a80573211d58c544729eaa5 | [
"BSD-3-Clause"
] | null | null | null | # BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE
import awkward as ak
import numpy as np
import pytest
jax = pytest.importorskip("jax")
jax.config.update("jax_platform_name", "cpu")
jax.config.update("jax_enable_x64", True)
# #### ak.layout.NumpyArray ####
test_numpyarray = ak._v2.Array(np.arange(10, dtype=np.float64), backend="jax")
test_numpyarray_tangent = ak._v2.Array(np.arange(10, dtype=np.float64), backend="jax")
test_numpyarray_jax = jax.numpy.arange(10, dtype=np.float64)
test_numpyarray_tangent_jax = jax.numpy.arange(10, dtype=np.float64)
def test_numpyarray_grad_1():
def func_numpyarray_1(x):
return x[4] ** 2
value_jvp, jvp_grad = jax.jvp(
func_numpyarray_1, (test_numpyarray,), (test_numpyarray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_numpyarray_1, (test_numpyarray_jax,), (test_numpyarray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_numpyarray_1, test_numpyarray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_numpyarray_1, test_numpyarray_jax)
assert value_jvp == value_jvp_jax
assert value_vjp == value_vjp_jax
assert jvp_grad == jvp_grad_jax
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
def test_numpyarray_grad_2():
def func_numpyarray_2(x):
return x[2:5] ** 2 + x[1:4] ** 2
value_jvp, jvp_grad = jax.jvp(
func_numpyarray_2, (test_numpyarray,), (test_numpyarray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_numpyarray_2, (test_numpyarray_jax,), (test_numpyarray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_numpyarray_2, test_numpyarray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_numpyarray_2, test_numpyarray_jax)
assert ak._v2.to_list(value_jvp) == value_jvp_jax.tolist()
assert ak._v2.to_list(value_vjp) == value_vjp_jax.tolist()
assert ak._v2.to_list(jvp_grad) == jvp_grad_jax.tolist()
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
def test_numpyarray_grad_3():
def func_numpyarray_3(x):
return x[::-1]
value_jvp, jvp_grad = jax.jvp(
func_numpyarray_3, (test_numpyarray,), (test_numpyarray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_numpyarray_3, (test_numpyarray_jax,), (test_numpyarray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_numpyarray_3, test_numpyarray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_numpyarray_3, test_numpyarray_jax)
assert ak._v2.to_list(value_jvp) == value_jvp_jax.tolist()
assert ak._v2.to_list(value_vjp) == value_vjp_jax.tolist()
assert ak._v2.to_list(jvp_grad) == jvp_grad_jax.tolist()
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
def test_numpyarray_grad_4():
def func_numpyarray_4(x):
return x[2:5] ** 2 * x[1:4] ** 2
value_jvp, jvp_grad = jax.jvp(
func_numpyarray_4, (test_numpyarray,), (test_numpyarray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_numpyarray_4, (test_numpyarray_jax,), (test_numpyarray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_numpyarray_4, test_numpyarray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_numpyarray_4, test_numpyarray_jax)
assert ak._v2.to_list(value_jvp) == value_jvp_jax.tolist()
assert ak._v2.to_list(value_vjp) == value_vjp_jax.tolist()
assert ak._v2.to_list(jvp_grad) == jvp_grad_jax.tolist()
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
test_regulararray = ak._v2.Array(
[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], backend="jax"
)
test_regulararray_tangent = ak._v2.Array(
[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], backend="jax"
)
test_regulararray_jax = jax.numpy.array(
[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], dtype=np.float64
)
test_regulararray_tangent_jax = jax.numpy.array(
[[1.0, 2.0, 3.0], [4.0, 5.0, 6.0], [7.0, 8.0, 9.0]], dtype=np.float64
)
def test_regular_array_1():
def func_regulararray_1(x):
return x[2] * 2
value_jvp, jvp_grad = jax.jvp(
func_regulararray_1, (test_regulararray,), (test_regulararray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_regulararray_1, (test_regulararray_jax,), (test_regulararray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_regulararray_1, test_regulararray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_regulararray_1, test_regulararray_jax)
assert ak._v2.to_list(value_jvp) == value_jvp_jax.tolist()
assert ak._v2.to_list(value_vjp) == value_vjp_jax.tolist()
assert ak._v2.to_list(jvp_grad) == jvp_grad_jax.tolist()
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
def test_regular_array_2():
def func_regulararray_2(x):
return x * x
value_jvp, jvp_grad = jax.jvp(
func_regulararray_2, (test_regulararray,), (test_regulararray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_regulararray_2, (test_regulararray_jax,), (test_regulararray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_regulararray_2, test_regulararray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_regulararray_2, test_regulararray_jax)
assert ak._v2.to_list(value_jvp) == value_jvp_jax.tolist()
assert ak._v2.to_list(value_vjp) == value_vjp_jax.tolist()
assert ak._v2.to_list(jvp_grad) == jvp_grad_jax.tolist()
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
def test_regular_array_3():
def func_regular_array_3(x):
return x[0, 0] * x[2, 1]
value_jvp, jvp_grad = jax.jvp(
func_regular_array_3, (test_regulararray,), (test_regulararray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_regular_array_3, (test_regulararray_jax,), (test_regulararray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_regular_array_3, test_regulararray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_regular_array_3, test_regulararray_jax)
assert ak._v2.to_list(value_jvp) == value_jvp_jax.tolist()
assert ak._v2.to_list(value_vjp) == value_vjp_jax.tolist()
assert ak._v2.to_list(jvp_grad) == jvp_grad_jax.tolist()
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
def test_regular_array_4():
def func_regular_array_4(x):
return x[::-1] ** 2
value_jvp, jvp_grad = jax.jvp(
func_regular_array_4, (test_regulararray,), (test_regulararray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_regular_array_4, (test_regulararray_jax,), (test_regulararray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_regular_array_4, test_regulararray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_regular_array_4, test_regulararray_jax)
assert ak._v2.to_list(value_jvp) == value_jvp_jax.tolist()
assert ak._v2.to_list(value_vjp) == value_vjp_jax.tolist()
assert ak._v2.to_list(jvp_grad) == jvp_grad_jax.tolist()
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
def test_regular_array_5():
def func_regular_array_5(x):
return 2 * x[:-1]
value_jvp, jvp_grad = jax.jvp(
func_regular_array_5, (test_regulararray,), (test_regulararray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_regular_array_5, (test_regulararray_jax,), (test_regulararray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_regular_array_5, test_regulararray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_regular_array_5, test_regulararray_jax)
assert ak._v2.to_list(value_jvp) == value_jvp_jax.tolist()
assert ak._v2.to_list(value_vjp) == value_vjp_jax.tolist()
assert ak._v2.to_list(jvp_grad) == jvp_grad_jax.tolist()
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
def test_regular_array_6():
def func_regular_array_6(x):
return x[0][0] * x[2][1]
value_jvp, jvp_grad = jax.jvp(
func_regular_array_6, (test_regulararray,), (test_regulararray_tangent,)
)
value_jvp_jax, jvp_grad_jax = jax.jvp(
func_regular_array_6, (test_regulararray_jax,), (test_regulararray_tangent_jax,)
)
value_vjp, vjp_func = jax.vjp(func_regular_array_6, test_regulararray)
value_vjp_jax, vjp_func_jax = jax.vjp(func_regular_array_6, test_regulararray_jax)
assert ak._v2.to_list(value_jvp) == value_jvp_jax.tolist()
assert ak._v2.to_list(value_vjp) == value_vjp_jax.tolist()
assert ak._v2.to_list(jvp_grad) == jvp_grad_jax.tolist()
assert (
ak._v2.to_list(vjp_func(value_vjp)[0])
== (vjp_func_jax(value_vjp_jax)[0]).tolist()
)
test_recordarray = ak._v2.Array(
[
[{"x": 1.1, "y": [1.0]}, {"x": 2.2, "y": [1.0, 2.2]}],
[],
[{"x": 3.3, "y": [1.0, 2.0, 3.0]}],
],
backend="jax",
)
test_recordarray_tangent = ak._v2.Array(
[
[{"x": 0.0, "y": [1.0]}, {"x": 2.0, "y": [1.5, 0.0]}],
[],
[{"x": 1.5, "y": [2.0, 0.5, 1.0]}],
],
backend="jax",
)
def test_recordarray_1():
def func_recordarray_1(x):
return 2 * x.y[2][0][1] + 10
value_jvp, jvp_grad = jax.jvp(
func_recordarray_1, (test_recordarray,), (test_recordarray_tangent,)
)
value_vjp, vjp_func = jax.vjp(func_recordarray_1, test_recordarray)
assert ak._v2.to_list(value_jvp) == 14.0
assert ak._v2.to_list(value_vjp) == 14.0
assert ak._v2.to_list(jvp_grad) == 1.0
assert ak._v2.to_list(vjp_func(value_vjp)[0]) == [
[{"x": 0.0, "y": [0.0]}, {"x": 0.0, "y": [0.0, 0.0]}],
[],
[{"x": 0.0, "y": [0.0, 28.0, 0.0]}],
]
def test_recordarray_2():
def func_recordarray_2(x):
return 2 * x.y[2][0] + 10
value_jvp, jvp_grad = jax.jvp(
func_recordarray_2, (test_recordarray,), (test_recordarray_tangent,)
)
value_vjp, vjp_func = jax.vjp(func_recordarray_2, test_recordarray)
print(ak._v2.to_list(vjp_func(value_vjp)[0]))
assert ak._v2.to_list(value_jvp) == [12.0, 14.0, 16.0]
assert ak._v2.to_list(value_vjp) == [12.0, 14.0, 16.0]
assert ak._v2.to_list(jvp_grad) == [4.0, 1.0, 2.0]
assert ak._v2.to_list(vjp_func(value_vjp)[0]) == [
[{"x": 0.0, "y": [0.0]}, {"x": 0.0, "y": [0.0, 0.0]}],
[],
[{"x": 0.0, "y": [24.0, 28.0, 32.0]}],
]
def test_recordarray_3():
def test_recordarray_3(x):
return 2 * x.y[0][0] ** 2
value_jvp, jvp_grad = jax.jvp(
test_recordarray_3, (test_recordarray,), (test_recordarray_tangent,)
)
value_vjp, vjp_func = jax.vjp(test_recordarray_3, test_recordarray)
print(ak._v2.to_list(vjp_func(value_vjp)[0]))
assert ak._v2.to_list(value_jvp) == [2.0]
assert ak._v2.to_list(value_vjp) == [2.0]
assert ak._v2.to_list(jvp_grad) == [4.0]
assert ak._v2.to_list(vjp_func(value_vjp)[0]) == [
[{"x": 0.0, "y": [8.0]}, {"x": 0.0, "y": [0.0, 0.0]}],
[],
[{"x": 0.0, "y": [0.0, 0.0, 0.0]}],
]
def test_recordarray_4():
def test_recordarray_4(x):
return 2 * x.y[2] + 10
value_jvp, jvp_grad = jax.jvp(
test_recordarray_4, (test_recordarray,), (test_recordarray_tangent,)
)
value_vjp, vjp_func = jax.vjp(test_recordarray_4, test_recordarray)
print(ak._v2.to_list(vjp_func(value_vjp)[0]))
assert ak._v2.to_list(value_jvp) == [[12.0, 14.0, 16.0]]
assert ak._v2.to_list(value_vjp) == [[12.0, 14.0, 16.0]]
assert ak._v2.to_list(jvp_grad) == [[4.0, 1.0, 2.0]]
assert ak._v2.to_list(vjp_func(value_vjp)[0]) == [
[{"x": 0.0, "y": [0.0]}, {"x": 0.0, "y": [0.0, 0.0]}],
[],
[{"x": 0.0, "y": [24.0, 28.0, 32.0]}],
]
def test_recordarray_5():
def test_recordarray_5(x):
return 2 * x.y
value_jvp, jvp_grad = jax.jvp(
test_recordarray_5, (test_recordarray,), (test_recordarray_tangent,)
)
value_vjp, vjp_func = jax.vjp(test_recordarray_5, test_recordarray)
print(ak._v2.to_list(vjp_func(value_vjp)[0]))
assert ak._v2.to_list(value_jvp) == [[[2.0], [2.0, 4.4]], [], [[2.0, 4.0, 6.0]]]
assert ak._v2.to_list(value_vjp) == [[[2.0], [2.0, 4.4]], [], [[2.0, 4.0, 6.0]]]
assert ak._v2.to_list(jvp_grad) == [[[2.0], [3.0, 0.0]], [], [[4.0, 1.0, 2.0]]]
assert ak._v2.to_list(vjp_func(value_vjp)[0]) == [
[{"x": 0.0, "y": [4.0]}, {"x": 0.0, "y": [4.0, 8.8]}],
[],
[{"x": 0.0, "y": [4.0, 8.0, 12.0]}],
]
def test_recordarray_6():
def test_recordarray_6(x):
return 2 * x.y**2
value_jvp, jvp_grad = jax.jvp(
test_recordarray_6, (test_recordarray,), (test_recordarray_tangent,)
)
value_vjp, vjp_func = jax.vjp(test_recordarray_6, test_recordarray)
print(ak._v2.to_list(vjp_func(value_vjp)[0]))
assert ak._v2.to_list(value_jvp) == [
[[2.0], [2.0, 9.680000000000001]],
[],
[[2.0, 8.0, 18.0]],
]
assert ak._v2.to_list(value_vjp) == [
[[2.0], [2.0, 9.680000000000001]],
[],
[[2.0, 8.0, 18.0]],
]
assert ak._v2.to_list(jvp_grad) == [[[4.0], [6.0, 0.0]], [], [[8.0, 4.0, 12.0]]]
assert ak._v2.to_list(vjp_func(value_vjp)[0]) == [
[{"x": 0.0, "y": [8.0]}, {"x": 0.0, "y": [8.0, 85.18400000000003]}],
[],
[{"x": 0.0, "y": [8.0, 64.0, 216.0]}],
]
def test_recordarray_7():
def test_recordarray_7(x):
return 2 * x.y[2, 0, 1] + 10
value_jvp, jvp_grad = jax.jvp(
test_recordarray_7, (test_recordarray,), (test_recordarray_tangent,)
)
value_vjp, vjp_func = jax.vjp(test_recordarray_7, test_recordarray)
assert ak._v2.to_list(value_jvp) == 14.0
assert ak._v2.to_list(value_vjp) == 14.0
assert ak._v2.to_list(jvp_grad) == 1.0
assert ak._v2.to_list(vjp_func(value_vjp)[0]) == [
[{"x": 0.0, "y": [0.0]}, {"x": 0.0, "y": [0.0, 0.0]}],
[],
[{"x": 0.0, "y": [0.0, 28.0, 0.0]}],
]
def test_recordarray_8():
def func_recordarray_8(x):
return 2 * x.y[2, 0] + 10
value_jvp, jvp_grad = jax.jvp(
func_recordarray_8, (test_recordarray,), (test_recordarray_tangent,)
)
value_vjp, vjp_func = jax.vjp(func_recordarray_8, test_recordarray)
print(ak._v2.to_list(vjp_func(value_vjp)[0]))
assert ak._v2.to_list(value_jvp) == [12.0, 14.0, 16.0]
assert ak._v2.to_list(value_vjp) == [12.0, 14.0, 16.0]
assert ak._v2.to_list(jvp_grad) == [4.0, 1.0, 2.0]
assert ak._v2.to_list(vjp_func(value_vjp)[0]) == [
[{"x": 0.0, "y": [0.0]}, {"x": 0.0, "y": [0.0, 0.0]}],
[],
[{"x": 0.0, "y": [24.0, 28.0, 32.0]}],
]
| 34.206818 | 88 | 0.635838 | 2,471 | 15,051 | 3.513153 | 0.031566 | 0.08294 | 0.051837 | 0.086396 | 0.890566 | 0.876512 | 0.869715 | 0.863265 | 0.838959 | 0.815113 | 0 | 0.063675 | 0.194472 | 15,051 | 439 | 89 | 34.284738 | 0.652342 | 0.007109 | 0 | 0.411932 | 0 | 0 | 0.007702 | 0 | 0 | 0 | 0 | 0 | 0.204545 | 1 | 0.102273 | false | 0 | 0.011364 | 0.051136 | 0.164773 | 0.017045 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
8e44d03617310ef7e272dde1801ff95fc1094f7a | 2,341 | py | Python | tests/test_meta.py | kse201/nose-blacklist | 11eeb2c9d1850882d119f97cf29d6853f487010a | [
"MIT"
] | null | null | null | tests/test_meta.py | kse201/nose-blacklist | 11eeb2c9d1850882d119f97cf29d6853f487010a | [
"MIT"
] | 1 | 2019-09-18T03:40:26.000Z | 2019-09-23T05:46:09.000Z | tests/test_meta.py | kse201/nose-blacklist | 11eeb2c9d1850882d119f97cf29d6853f487010a | [
"MIT"
] | 1 | 2019-09-11T01:57:18.000Z | 2019-09-11T01:57:18.000Z | import unittest
from utils import run_cmd, Results, TEST_DIR
class TestResultsParsing(unittest.TestCase):
def test_collect_only(self):
out, err, ret = run_cmd('nosetests', '--collect-only', '-v', TEST_DIR)
results = Results(err)
self.assertEqual(results.test_status, 'OK')
self.assertEqual(results.n_skips, 0)
self.assertEqual(results.n_failures, 0)
self.assertEqual(results.n_errors, 0)
self.assertEqual(results.n_tests, 6)
self.assertGreaterEqual(results.test_time, 0)
short_results_status = set([r.status for r in results.shortresults])
short_results_names = set([r.name for r in results.shortresults])
self.assertEqual(short_results_status, set(['ok']))
expected_test_list = set([
"sampletests.v1.test_wumbo.WumboTest.test_set_to_mini",
"sampletests.v1.test_wumbo.WumboTest.test_set_to_wumbo",
"sampletests.test_mini.MiniTest.test_failure",
"sampletests.test_mini.MiniTest.test_set_to_mini",
"sampletests.test_mini.MiniTest.test_set_to_wumbo",
"sampletests.test_mini.test_unbound_function",
])
self.assertEqual(short_results_names, expected_test_list)
def test_nose_output_with_failures(self):
out, err, ret = run_cmd('nosetests', '-v', TEST_DIR)
results = Results(err)
self.assertEqual(results.n_skips, 0)
self.assertEqual(results.n_failures, 3)
self.assertEqual(results.n_errors, 0)
self.assertEqual(results.n_tests, 6)
short_results_status = [r.status for r in results.shortresults]
self.assertEqual(short_results_status.count('FAIL'), 3)
self.assertEqual(short_results_status.count('ok'), 3)
short_results_names = set([r.name for r in results.shortresults])
expected_test_list = set([
"sampletests.v1.test_wumbo.WumboTest.test_set_to_mini",
"sampletests.v1.test_wumbo.WumboTest.test_set_to_wumbo",
"sampletests.test_mini.MiniTest.test_failure",
"sampletests.test_mini.MiniTest.test_set_to_mini",
"sampletests.test_mini.MiniTest.test_set_to_wumbo",
"sampletests.test_mini.test_unbound_function",
])
self.assertEqual(short_results_names, expected_test_list)
| 43.351852 | 78 | 0.685604 | 294 | 2,341 | 5.153061 | 0.20068 | 0.138614 | 0.130693 | 0.121452 | 0.835644 | 0.834984 | 0.806601 | 0.743894 | 0.743894 | 0.69637 | 0 | 0.008104 | 0.209312 | 2,341 | 53 | 79 | 44.169811 | 0.810373 | 0 | 0 | 0.636364 | 0 | 0 | 0.26399 | 0.24434 | 0 | 0 | 0 | 0 | 0.340909 | 1 | 0.045455 | false | 0 | 0.045455 | 0 | 0.113636 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
f3f169718b1c0eb61a19778ed237f90b38dd7a2f | 83 | py | Python | DMRevenge/VIEW/__init__.py | u18-yuiha/DigestMaker | 1a7478a81d9024ae22f647bc82adca780e885a26 | [
"MIT",
"Unlicense"
] | null | null | null | DMRevenge/VIEW/__init__.py | u18-yuiha/DigestMaker | 1a7478a81d9024ae22f647bc82adca780e885a26 | [
"MIT",
"Unlicense"
] | null | null | null | DMRevenge/VIEW/__init__.py | u18-yuiha/DigestMaker | 1a7478a81d9024ae22f647bc82adca780e885a26 | [
"MIT",
"Unlicense"
] | null | null | null | import tkinter as tk
import CONTROLLER
import CONTROLLER.DigestMakerExecutor as DME | 27.666667 | 44 | 0.879518 | 11 | 83 | 6.636364 | 0.636364 | 0.438356 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.108434 | 83 | 3 | 44 | 27.666667 | 0.986486 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
6d1adb9a9324c4eb102ec04e5a08aaa01571aef4 | 1,462 | py | Python | kvdroid/jclass/android/provider.py | kengoon/PyAndroidKX | 53b72b51c7b9aec06bbc330e7bf0f2e3a89736e2 | [
"MIT"
] | 1 | 2021-11-22T17:22:53.000Z | 2021-11-22T17:22:53.000Z | kvdroid/jclass/android/provider.py | kengoon/PyAndroidKX | 53b72b51c7b9aec06bbc330e7bf0f2e3a89736e2 | [
"MIT"
] | null | null | null | kvdroid/jclass/android/provider.py | kengoon/PyAndroidKX | 53b72b51c7b9aec06bbc330e7bf0f2e3a89736e2 | [
"MIT"
] | null | null | null | from jnius import autoclass
from kvdroid.jclass import _class_call
def Settings(*args, instantiate: bool = False):
return _class_call(autoclass('android.provider.Settings'), args, instantiate)
def Contacts(*args, instantiate: bool = False):
return _class_call(autoclass('android.provider.ContactsContract$Contacts'), args, instantiate)
def Phone(*args, instantiate: bool = False):
return _class_call(
autoclass('android.provider.ContactsContract$CommonDataKinds$Phone'),
args, instantiate)
def MediaStoreFiles(*args, instantiate: bool = False):
return _class_call(autoclass('android.provider.MediaStore$Files'), args, instantiate)
def MediaStoreAudioMedia(*args, instantiate: bool = False):
return _class_call(autoclass('android.provider.MediaStore$Audio$Media'), args, instantiate)
def MediaStoreImagesMedia(*args, instantiate: bool = False):
return _class_call(autoclass('android.provider.MediaStore$Images$Media'), args, instantiate)
def MediaStoreVideoMedia(*args, instantiate: bool = False):
return _class_call(autoclass('android.provider.MediaStore$Video$Media'), args, instantiate)
def MediaStoreDownloads(*args, instantiate: bool = False):
return _class_call(autoclass('android.provider.MediaStore$Downloads'), args, instantiate)
def MediaStoreMediaColumns(*args, instantiate: bool = False):
return _class_call(autoclass('android.provider.MediaStore$MediaColumns'), args, instantiate) | 36.55 | 98 | 0.771546 | 157 | 1,462 | 7.057325 | 0.22293 | 0.243682 | 0.154332 | 0.194946 | 0.594765 | 0.594765 | 0.594765 | 0.594765 | 0.594765 | 0.594765 | 0 | 0 | 0.114911 | 1,462 | 40 | 99 | 36.55 | 0.85626 | 0 | 0 | 0 | 0 | 0 | 0.239234 | 0.239234 | 0 | 0 | 0 | 0 | 0 | 1 | 0.409091 | true | 0 | 0.090909 | 0.409091 | 0.909091 | 0 | 0 | 0 | 0 | null | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 1 | 0 | 0 | 6 |
6d216e4682cc7e5fc45a5feb5cf4b3dbbeaa9d0c | 147 | py | Python | db/__init__.py | mr-karan/FinalYearCSE | f361cddb2f7f84d67f170a20780af2add0550f5f | [
"MIT"
] | null | null | null | db/__init__.py | mr-karan/FinalYearCSE | f361cddb2f7f84d67f170a20780af2add0550f5f | [
"MIT"
] | null | null | null | db/__init__.py | mr-karan/FinalYearCSE | f361cddb2f7f84d67f170a20780af2add0550f5f | [
"MIT"
] | 1 | 2019-09-19T15:14:23.000Z | 2019-09-19T15:14:23.000Z | from basic import *
from music import *
from movies import *
from people import *
from country import *
from tvshows import *
from writers import * | 21 | 21 | 0.768707 | 21 | 147 | 5.380952 | 0.428571 | 0.530973 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.183673 | 147 | 7 | 22 | 21 | 0.941667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
6d2a0319d5eca1b12f8b2635fb5f660ce694aaa2 | 24,433 | py | Python | driftbase/tests/test_matchqueue.py | directivegames/drift-base | 5fc7d4686c56e93fc22178f3b1bb49239d7eee45 | [
"MIT"
] | 1 | 2021-09-04T01:45:44.000Z | 2021-09-04T01:45:44.000Z | driftbase/tests/test_matchqueue.py | directivegames/drift-base | 5fc7d4686c56e93fc22178f3b1bb49239d7eee45 | [
"MIT"
] | 30 | 2020-12-09T04:10:26.000Z | 2022-03-02T02:34:49.000Z | driftbase/tests/test_matchqueue.py | directivegames/drift-base | 5fc7d4686c56e93fc22178f3b1bb49239d7eee45 | [
"MIT"
] | null | null | null | import collections
import datetime
import http.client as http_client
from mock import patch
from drift.systesthelper import uuid_string
from driftbase.utils.test_utils import BaseMatchTest
class MatchQueueTest(BaseMatchTest):
"""
Tests for the /matchqueue player endpoints
"""
def clear_queue(self):
# cleanup after earlier tests
matchqueue_url = self.endpoints["matchqueue"]
matches_url = self.endpoints["matches"]
# The matchqueue may mutate during deletion so we requery after each delete
while True:
entries = self.get(matchqueue_url + "?status=waiting&status=matched") \
.json()
for entry in entries:
self.delete(entry["matchqueueplayer_url"] + "?force=true")
else:
break
entries = self.get(matches_url).json()
for entry in entries:
if entry["status"] == "idle":
self.put(entry["url"], data={"status": "completed"})
def test_matchqueue_nomatches(self):
# add two players to the queue
self.auth_service()
self.clear_queue()
self.make_player()
matchqueue_url = self.endpoints["matchqueue"]
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
r = self.get(matchqueue_url)
self.assertEqual(len(r.json()), 2)
self.assertIsNone(r.json()[0]["match_id"])
self.assertIsNone(r.json()[1]["match_id"])
def test_matchqueue_response(self):
# add two players to the queue
self.make_player()
matchqueue_url = self.endpoints["matchqueue"]
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
resp = r.json()
self.assertIn("match_id", resp)
self.assertIn("match_url", resp)
self.assertIn("player_id", resp)
self.assertIn("ue4_connection_url", resp)
self.assertIsNotNone(resp["player_url"])
def test_matchqueue_remove(self):
self.make_player()
matchqueue_url = self.endpoints["matchqueue"]
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
resp = r.json()
matchqueueplayer_url = resp["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url)
self.delete(matchqueueplayer_url)
self.get(matchqueueplayer_url, expected_status_code=http_client.NOT_FOUND)
def test_matchqueue_remove_matched(self):
self.auth_service()
self.clear_queue()
self._create_match()
self.make_player()
matchqueue_url = self.endpoints["matchqueue"]
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
resp = r.json()
other_matchqueueplayer_url = resp["matchqueueplayer_url"]
self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
resp = r.json()
matchqueueplayer_url = resp["matchqueueplayer_url"]
print(matchqueueplayer_url)
r = self.get(matchqueueplayer_url)
self.assertIsNotNone(r.json()["match_id"])
r = self.delete(matchqueueplayer_url, expected_status_code=http_client.BAD_REQUEST)
self.assertEqual(r.json()["error"]["code"], "player_already_matched")
# make sure the resource didn't get deleted anyway
r = self.get(matchqueueplayer_url)
self.assertIsNotNone(r.json()["match_id"])
r = self.get(other_matchqueueplayer_url)
self.assertIsNotNone(r.json()["match_id"])
def test_matchqueue_simplematchmaking(self):
# create a match
self.auth_service()
self.clear_queue()
match = self._create_match()
# add two players to the queue
self.make_player()
matchqueue_url = self.endpoints["matchqueue"]
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer1_url = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer1_url)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
self.assertIn('match_url', r.json())
self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer2_url = r.json()["matchqueueplayer_url"]
r = self.get(matchqueue_url + "?status=matched")
self.assertEqual(len(r.json()), 2)
self.assertEqual(r.json()[0]["match_id"], match["match_id"])
self.assertEqual(r.json()[1]["match_id"], match["match_id"])
r = self.get(matchqueueplayer2_url)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
self.assertIsNotNone(r.json()["ue4_connection_url"])
self.assertIn("player_id=%s" % self.player_id, r.json()["ue4_connection_url"])
# The player should not get a connection url for the other player's resource
r = self.get(matchqueueplayer1_url)
self.assertIsNone(r.json()["ue4_connection_url"])
def test_matchqueue_multiplematchmaking(self):
# create a match
self.auth_service()
self.clear_queue()
matchqueue_url = self.endpoints["matchqueue"]
for i in range(3):
self.auth_service()
self._create_match()
# make 2 players for each match
for j in range(2):
self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
r = self.get(matchqueue_url)
# make sure everyone found a match and that no match has more than 2 people in it
num_players_in_match = collections.defaultdict(int)
for entry in r.json():
self.assertIsNotNone(entry["match_id"])
num_players_in_match[entry["match_id"]] += 1
self.assertEqual(sum(num_players_in_match.values()), len(num_players_in_match) * 2)
def test_matchqueue_playeroffline(self):
# create a match
self.auth_service()
self.clear_queue()
self._create_match()
# add a players to the queue
self.make_player()
matchqueue_url = self.endpoints["matchqueue"]
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url = r.json()["matchqueueplayer_url"]
# make the player go offline
self.make_player()
# mock out the utcnow call so that we can put the players 'offline'
with patch("driftbase.matchqueue.utcnow") as mock_date:
mock_date.return_value = datetime.datetime.utcnow() + datetime.timedelta(minutes=5)
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
# Both players should be removed from the match queue
r = self.get(matchqueue_url)
self.assertEqual(len(r.json()), 0)
r = self.get(matchqueueplayer_url, expected_status_code=http_client.NOT_FOUND)
def test_matchqueue_lock_conflict(self):
# create a match
self.auth_service()
self.clear_queue()
self._create_match()
# add a player to the queue
self.make_player()
other_player_id = self.player_id
matchqueue_url = self.endpoints["matchqueue"]
# now we mock out the mutex so that it reports that a locking conflict exists
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
with patch("driftbase.matchqueue.lock", side_effect=Exception('cannot lock')):
self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.BAD_REQUEST)
# we should get a 400 error back and the only guy in the match queue should
# be the first one
self.assertIn("error processing the match queue", r.json()["error"]["description"])
r = self.get(matchqueue_url)
js = r.json()
self.assertEqual(len(js), 1)
self.assertNotIn(self.player_id, [d["player_id"] for d in js])
self.assertIn(other_player_id, [d["player_id"] for d in js])
def test_joining_match_queue_twice(self):
"""
This assumes there are registered battles expecting
two players on the tier you connect to
Join the queue with client A, status is waiting
Join the queue with client B, status is matched
A and B both get status matched on the next poll
Join the queue again (POST) with A, status is waiting
B will still show status matched
A will show status waiting
B must at this point leave the queue, and join again, or
simply join again, without first leaving
"""
# create a match
self.auth_service()
self.clear_queue()
match = self._create_match()
matchqueue_url = self.endpoints["matchqueue"]
# add two players to the queue
player_a = self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
self.assertIn('match_url', r.json())
player_b = self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_b = r.json()["matchqueueplayer_url"]
# A and B are now matched
r = self.get(matchqueue_url + "?status=matched")
self.assertEqual(len(r.json()), 2)
self.assertEqual(r.json()[0]["match_id"], match["match_id"])
self.assertEqual(r.json()[1]["match_id"], match["match_id"])
r = self.get(matchqueueplayer_url)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
# Add player C to the queue who is matched with no one
player_c = self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_c = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url_c)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
# Now A screws everything up by joining again
self.make_player(player_a)
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
self.assertIn('match_url', r.json())
# Make sure B is no longer waiting or matched in any match
self.make_player(player_b)
matchqueue_url = self.endpoints["matchqueue"]
r = self.get(matchqueueplayer_url_b, expected_status_code=http_client.NOT_FOUND)
# Make sure C is unaffected
r = self.get(matchqueueplayer_url_c)
self.assertEqual(r.json()['status'], 'waiting')
self.assertIsNone(r.json()["match_id"])
# Add player D to the queue who is matched with no one because he has a different ref
self.make_player()
data = {"player_id": self.player_id, "ref": "something/else"}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_d = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url_c)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
# Player C rejoins and is usurped but other players should be unaffected
self.make_player(player_c)
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
r = self.get(matchqueueplayer_url_d)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
def test_matchqueue_placement_emptystring(self):
self.auth_service()
self.clear_queue()
self._create_match()
# the machine has placement 'placement' by default
matchqueue_url = self.endpoints["matchqueue"]
# add two players, not caring about placement
self.make_player()
data = {"player_id": self.player_id, "placement": ""}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_a = r.json()["matchqueueplayer_url"]
self.make_player()
data = {"player_id": self.player_id, "placement": ""}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_b = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url_a)
self.assertEqual(r.json()["status"], "matched")
r = self.get(matchqueueplayer_url_b)
self.assertEqual(r.json()["status"], "matched")
def test_matchqueue_placement_notfound(self):
self.auth_service()
self.clear_queue()
match = self._create_match()
# the machine has placement 'placement' by default
matchqueue_url = self.endpoints["matchqueue"]
# add two players, one not caring about placement but
# the other one wanting another placement
self.make_player()
data = {"player_id": self.player_id, "placement": ""}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_a = r.json()["matchqueueplayer_url"]
self.make_player()
data = {"player_id": self.player_id, "placement": "somethingelse"}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_b = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url_a)
self.assertEqual(r.json()["status"], "waiting")
r = self.get(matchqueueplayer_url_b)
self.assertEqual(r.json()["status"], "waiting")
# add a third player choosing placement 'placement' and it should be
# matched up with player_a but player_b is still waiting
self.make_player()
data = {"player_id": self.player_id, "placement": "placement"}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_c = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url_a)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
r = self.get(matchqueueplayer_url_b)
self.assertEqual(r.json()["status"], "waiting")
r = self.get(matchqueueplayer_url_c)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
def test_matchqueue_ref(self):
self.auth_service()
self.clear_queue()
match = self._create_match()
# the machine has ref 'ref' by default
matchqueue_url = self.endpoints["matchqueue"]
# add two players, one not caring about ref but the other one wanting another ref
self.make_player()
data = {"player_id": self.player_id, "ref": ""}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_a = r.json()["matchqueueplayer_url"]
self.make_player()
data = {"player_id": self.player_id, "ref": "somethingelse"}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_b = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url_a)
self.assertEqual(r.json()["status"], "waiting")
r = self.get(matchqueueplayer_url_b)
self.assertEqual(r.json()["status"], "waiting")
# add a third player choosing ref 'ref' and it should be matched up with
# player_a but player_b is still waiting
self.make_player()
data = {"player_id": self.player_id, "ref": "test/testing"}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_c = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url_a)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
r = self.get(matchqueueplayer_url_b)
self.assertEqual(r.json()["status"], "waiting")
r = self.get(matchqueueplayer_url_c)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
def test_matchqueue_ref_and_placement(self):
self.auth_service()
self.clear_queue()
match = self._create_match()
# the machine has ref 'ref' by default
matchqueue_url = self.endpoints["matchqueue"]
# add two players, one not caring about ref but the other one wanting another ref
self.make_player()
data = {"player_id": self.player_id, "ref": "", "placement": ""}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_a = r.json()["matchqueueplayer_url"]
self.make_player()
data = {"player_id": self.player_id, "ref": "somethingelse", "placement": ""}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_b = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url_a)
self.assertEqual(r.json()["status"], "waiting")
r = self.get(matchqueueplayer_url_b)
self.assertEqual(r.json()["status"], "waiting")
# add a third player choosing ref 'ref' and it should be matched up with player_a
# but player_b is still waiting
self.make_player()
data = {"player_id": self.player_id, "ref": "test/testing", "placement": "placement"}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_url_c = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer_url_a)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
r = self.get(matchqueueplayer_url_b)
self.assertEqual(r.json()["status"], "waiting")
r = self.get(matchqueueplayer_url_c)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
def test_matchqueue_challenge(self):
# create a match
self.auth_service()
self.clear_queue()
match = self._create_match()
# add two players to the queue
self.make_player()
matchqueue_url = self.endpoints["matchqueue"]
token = uuid_string()
data = {"player_id": self.player_id, "token": token}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer1_url = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer1_url)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
self.assertIn('match_url', r.json())
# add a new player who is using a different token
self.make_player()
data = {"player_id": self.player_id, "token": uuid_string()}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_anothertoken_url = r.json()["matchqueueplayer_url"]
# add a new player who is using no token
self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer_notoken_url = r.json()["matchqueueplayer_url"]
self.make_player()
data = {"player_id": self.player_id, "token": token}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer2_url = r.json()["matchqueueplayer_url"]
r = self.get(matchqueue_url + "?status=matched")
self.assertEqual(len(r.json()), 2)
self.assertEqual(r.json()[0]["match_id"], match["match_id"])
self.assertEqual(r.json()[1]["match_id"], match["match_id"])
r = self.get(matchqueueplayer_anothertoken_url)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
r = self.get(matchqueueplayer_notoken_url)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
r = self.get(matchqueueplayer1_url)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
r = self.get(matchqueueplayer2_url)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
def test_matchqueue_matchafterqueue(self):
# Two people join the queue and don't find a match.
# Then we add a new match and the two players should get matched into it
# create a match
self.auth_service()
self.clear_queue()
# add two players to the queue
self.make_player()
matchqueue_url = self.endpoints["matchqueue"]
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer1_url = r.json()["matchqueueplayer_url"]
r = self.get(matchqueueplayer1_url)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
self.assertIn('match_url', r.json())
self.make_player()
data = {"player_id": self.player_id}
r = self.post(matchqueue_url, data=data, expected_status_code=http_client.CREATED)
matchqueueplayer2_url = r.json()["matchqueueplayer_url"]
# before we create the match both players should be 'waiting'
r = self.get(matchqueue_url + "?status=waiting")
self.assertEqual(len(r.json()), 2)
r = self.get(matchqueueplayer1_url)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
r = self.get(matchqueueplayer2_url)
self.assertEqual(r.json()["status"], "waiting")
self.assertIsNone(r.json()["match_id"])
# now create a match and ensure the players are matched into it
self.auth_service()
match = self._create_match()
r = self.get(matchqueue_url + "?status=matched")
self.assertEqual(len(r.json()), 2)
self.assertEqual(r.json()[0]["match_id"], match["match_id"])
self.assertEqual(r.json()[1]["match_id"], match["match_id"])
r = self.get(matchqueueplayer2_url)
self.assertEqual(r.json()["status"], "matched")
self.assertEqual(r.json()["match_id"], match["match_id"])
| 41.837329 | 98 | 0.647403 | 3,080 | 24,433 | 4.923052 | 0.078571 | 0.03957 | 0.058036 | 0.072545 | 0.795885 | 0.766207 | 0.750379 | 0.736464 | 0.724329 | 0.714239 | 0 | 0.002552 | 0.230058 | 24,433 | 583 | 99 | 41.909091 | 0.803477 | 0.121639 | 0 | 0.761307 | 0 | 0 | 0.12547 | 0.004884 | 0 | 0 | 0 | 0 | 0.248744 | 1 | 0.040201 | false | 0 | 0.015075 | 0 | 0.057789 | 0.002513 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
6d3f07796261988b451c3cfd14d3db3971080266 | 346 | py | Python | pydownsongs/__init__.py | loadofearth/pydownsongs | 39989746afbe110c8166f03520c5ce2c8fbfa139 | [
"MIT"
] | 1 | 2021-09-30T03:39:40.000Z | 2021-09-30T03:39:40.000Z | pydownsongs/__init__.py | loadofearth/pydownsongs | 39989746afbe110c8166f03520c5ce2c8fbfa139 | [
"MIT"
] | null | null | null | pydownsongs/__init__.py | loadofearth/pydownsongs | 39989746afbe110c8166f03520c5ce2c8fbfa139 | [
"MIT"
] | 1 | 2021-08-28T13:09:58.000Z | 2021-08-28T13:09:58.000Z | from pydownsongs.songs import download
from pydownsongs.songs import downloadarray
from pydownsongs.others import checkInternet
from pydownsongs.others import randomUsrAgent
from pydownsongs.meta import add_meta
from pydownsongs.meta import get_meta
from pydownsongs.others import createDirIfNotExists
from pydownsongs.spotlist import dl_spotlist | 43.25 | 51 | 0.887283 | 43 | 346 | 7.069767 | 0.348837 | 0.394737 | 0.207237 | 0.266447 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.089595 | 346 | 8 | 52 | 43.25 | 0.965079 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
ede26372bc980027df4f849ae07cd3b2d67c92c3 | 3,417 | py | Python | p8_test/test_local/test_eta5_execution/test_name_fail_ETA5_UIO1.py | crazynayan/tpf1 | c81a15d88d4d1f3ed2cf043c90782a4b8509ef14 | [
"MIT"
] | 1 | 2020-01-27T10:10:40.000Z | 2020-01-27T10:10:40.000Z | p8_test/test_local/test_eta5_execution/test_name_fail_ETA5_UIO1.py | crazynayan/tpf1 | c81a15d88d4d1f3ed2cf043c90782a4b8509ef14 | [
"MIT"
] | 4 | 2019-08-23T05:24:23.000Z | 2021-09-16T10:05:55.000Z | p8_test/test_local/test_eta5_execution/test_name_fail_ETA5_UIO1.py | crazynayan/tpf1 | c81a15d88d4d1f3ed2cf043c90782a4b8509ef14 | [
"MIT"
] | null | null | null | from p8_test.test_local.test_eta5_execution import NameGeneral
class NameFailETA5(NameGeneral):
def setUp(self) -> None:
super().setUp()
def test_no_name_ETA5420(self) -> None:
test_data = self.tpf_server.run("ETA5", self.test_data)
self.output = test_data.output
self.assertEqual("ETA5420.9", self.output.last_line)
self.assertIn("NEED NAME IN PNR TO COMPLETE TRANSACTION", self.output.messages)
def test_too_many_names_ETA5430(self) -> None:
self.test_data.add_pnr_element(["45ZAVERI", "55SHAH"], "name")
test_data = self.tpf_server.run("ETA5", self.test_data)
self.output = test_data.output
self.assertEqual("ETA5430", self.output.last_line)
self.assertIn("MAXIMUM NUMBER OF NAMES PER PNR IS 99 - CREATE NEW PNR", self.output.messages)
self.assertEqual(100, self.output.regs["R15"])
self.assertEqual(f"{self.ui2098:02X}", test_data.get_field("UI2CNN"))
def test_too_many_infants_ETA5430(self) -> None:
self.test_data.add_pnr_element(["45ZAVERI", "I/55ZAVERI"], "name")
test_data = self.tpf_server.run("ETA5", self.test_data)
self.output = test_data.output
self.assertEqual("ETA5430", self.output.last_line)
self.assertIn("MAXIMUM NUMBER OF NAMES PER PNR IS 99 - CREATE NEW PNR", self.output.messages)
self.assertEqual(100, self.output.regs["R15"])
self.assertEqual(f"{self.ui2098:02X}", test_data.get_field("UI2CNN"))
class NameFailUIO1(NameGeneral):
def setUp(self) -> None:
super().setUp()
def test_group_overbooking_UIO1(self):
self.test_data.add_pnr_element(["C/5TOURS", "11ZAVERI"], "name")
test_data = self.tpf_server.run("ETA5", self.test_data)
self.output = test_data.output
self.assertEqual("$$UIO1$$.2", self.output.last_line)
self.assertEqual("20", test_data.get_field("WA0ET4"))
self.assertEqual(bytes([self.ui2xui + self.ui2can, self.ui2nxt, self.ui2nxt]).hex().upper(),
test_data.get_field("UI2INC"))
# self.assertTrue(TD.state.vm.all_bits_off(TD.state.regs.R1 + self.wa0et5, 0x02))
self.assertEqual(f"{self.wa0any:02X}", test_data.get_field("WA0ET5"))
self.assertEqual(f"{self.ui2214:02X}", test_data.get_field("UI2CNN"))
self.assertEqual("60", test_data.get_field("EBRS01"))
def test_multiple_groups_CC_UIO1(self):
self.test_data.add_pnr_element(["C/25SABRE", "C/21TOURS", "1SHAH"], "name")
test_data = self.tpf_server.run("ETA5", self.test_data)
self.output = test_data.output
self.assertEqual("$$UIO1$$.2", self.output.last_line)
self.assertEqual(f"{self.wa0any:02X}", test_data.get_field("WA0ET5"))
self.assertEqual(f"{self.ui2097:02X}", test_data.get_field("UI2CNN"))
self.assertEqual("C3", test_data.get_field("EBW014"))
def test_multiple_groups_ZC_UIO1(self):
self.test_data.add_pnr_element(["Z/25SABRE", "C/21TOURS", "1SHAH"], "name")
test_data = self.tpf_server.run("ETA5", self.test_data)
self.output = test_data.output
self.assertEqual("$$UIO1$$.2", self.output.last_line)
self.assertEqual(f"{self.wa0any:02X}", test_data.get_field("WA0ET5"))
self.assertEqual(f"{self.ui2097:02X}", test_data.get_field("UI2CNN"))
self.assertEqual("E9", test_data.get_field("EBW014"))
| 49.521739 | 101 | 0.671642 | 471 | 3,417 | 4.66242 | 0.225053 | 0.131148 | 0.065118 | 0.094718 | 0.76867 | 0.748634 | 0.734973 | 0.734973 | 0.70173 | 0.630692 | 0 | 0.055398 | 0.175885 | 3,417 | 68 | 102 | 50.25 | 0.724432 | 0.02312 | 0 | 0.581818 | 0 | 0 | 0.169964 | 0 | 0 | 0 | 0 | 0 | 0.436364 | 1 | 0.145455 | false | 0 | 0.018182 | 0 | 0.2 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
edffecf410ec596ce9efb0d2c9d3d5650bee7fdd | 49 | py | Python | googlemail/__init__.py | orlandodiaz/gmail | 2a188e1b15140b64a65d114a91a3600b79bee929 | [
"MIT"
] | 1 | 2022-02-16T00:29:27.000Z | 2022-02-16T00:29:27.000Z | googlemail/__init__.py | orlandordiaz/gmail | 2a188e1b15140b64a65d114a91a3600b79bee929 | [
"MIT"
] | null | null | null | googlemail/__init__.py | orlandordiaz/gmail | 2a188e1b15140b64a65d114a91a3600b79bee929 | [
"MIT"
] | null | null | null | from .gmail import Gmail
from .login import login | 24.5 | 24 | 0.816327 | 8 | 49 | 5 | 0.5 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.142857 | 49 | 2 | 25 | 24.5 | 0.952381 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
61037d433c9738bc0af2eddbc96399cdc49bf9f5 | 3,292 | py | Python | libs/countrycodes/tests_countrycodes/test_iso_handler.py | hm-seclab/YAFRA-Mirror | cdad9966ab2aef495d0dca51a06cf567dd38a315 | [
"Apache-2.0"
] | 26 | 2021-06-30T07:49:37.000Z | 2022-02-22T12:35:51.000Z | libs/countrycodes/tests_countrycodes/test_iso_handler.py | hm-seclab/YAFRA-Mirror | cdad9966ab2aef495d0dca51a06cf567dd38a315 | [
"Apache-2.0"
] | 59 | 2021-06-30T09:48:05.000Z | 2021-08-16T09:07:04.000Z | libs/countrycodes/tests_countrycodes/test_iso_handler.py | hm-seclab/YAFRA-Mirror | cdad9966ab2aef495d0dca51a06cf567dd38a315 | [
"Apache-2.0"
] | 5 | 2021-06-30T12:30:17.000Z | 2022-03-13T16:59:57.000Z | '''
Tests for iso_handler.py
'''
from unittest import TestCase
from unittest.mock import patch
from libs.countrycodes.iso_handler import convert_alpha_2_to_alpha_3, convert_alpha_2_to_qualified_name
from libs.kafka.logging import LogMessage
class IsoHandlerTests(TestCase):
'''
Tests for iso_handler.
'''
def test_convert_alpha_2_to_alpha_3_returns_unknown_when_given_empty_string(self):
'''
Test to check if the function returns the string Unknown,
when an empty string has been given as a parameter.
'''
test_string = ""
output = convert_alpha_2_to_alpha_3(test_string, "TEST_SERVICENAME")
self.assertIsNotNone(output)
self.assertIsInstance(output, str)
self.assertEqual(output, "Unknown")
def test_convert_alpha_2_to_alpha_3_throws_exception_when_given_None_as_parameter(self):
'''
Test to check if the function throws an exception,
when None has been given as a parameter.
'''
with patch.object(LogMessage, "log", return_value="ERROR"):
self.assertRaises(Exception, convert_alpha_2_to_alpha_3(None, "TEST_SERVICENAME"))
def test_convert_alpha_2_to_alpha_3_calls_pycountry_countries_get_exactly_once_with_alpha_2_as_a_parameter(self):
'''
Test to check if the function calls the
pycountry.countries.get method exactly once
when alpha 2 has been given as a parameter.
'''
test_string = "111.111.111.111"
with patch('pycountry.countries.get') as mock_requests:
output = convert_alpha_2_to_alpha_3(test_string, "TEST_SERVICENAME")
mock_requests.assert_called_once()
self.assertIsNotNone(output)
self.assertNotEqual(output, "Unknown")
def test_convert_alpha_2_to_qualified_name_returns_unknown_when_given_empty_string(self):
'''
Test to check if the function returns the string Unknown,
when an empty string has been given as a parameter.
'''
test_string = ""
output = convert_alpha_2_to_qualified_name(test_string, "TEST_SERVICENAME")
self.assertIsNotNone(output)
self.assertIsInstance(output, str)
self.assertEqual(output, "Unknown")
def test_convert_alpha_2_to_qualified_name_throws_exception_when_given_None_as_parameter(self):
'''
Test to check if the function throws an exception,
when None has been given as a parameter.
'''
with patch.object(LogMessage, "log", return_value="ERROR"):
self.assertRaises(Exception, convert_alpha_2_to_qualified_name(None, "TEST_SERVICENAME"))
def test_convert_alpha_2_to_qualified_name_calls_pycountry_countries_get_exactly_once_with_alpha_2_as_a_parameter(self):
'''
Test to check if the function calls the
pycountry.countries.get method exactly once
when alpha 2 has been given as a parameter.
'''
test_string = "111.111.111.111"
with patch('pycountry.countries.get') as mock_requests:
output = convert_alpha_2_to_alpha_3(test_string, "TEST_SERVICENAME")
mock_requests.assert_called_once()
self.assertIsNotNone(output)
self.assertNotEqual(output, "Unknown") | 37.409091 | 124 | 0.705954 | 431 | 3,292 | 5.037123 | 0.167053 | 0.049747 | 0.083832 | 0.09673 | 0.912022 | 0.912022 | 0.874712 | 0.874712 | 0.850299 | 0.812529 | 0 | 0.019524 | 0.222053 | 3,292 | 88 | 125 | 37.409091 | 0.828192 | 0.214763 | 0 | 0.621622 | 0 | 0 | 0.091487 | 0.019483 | 0 | 0 | 0 | 0 | 0.378378 | 1 | 0.162162 | false | 0 | 0.108108 | 0 | 0.297297 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
61120f2d203d2f5c718e5412f4a20e4a2826a324 | 2,413 | py | Python | software/owh/backoffice/owh/etl/yrbs/yrbs_etl.py | HHS/owh-ds | d94d80661ef0d1c966f5bf87a2648dd0f19c3b8b | [
"Apache-2.0"
] | 2 | 2022-02-07T16:15:21.000Z | 2022-02-07T19:33:32.000Z | software/owh/backoffice/owh/etl/yrbs/yrbs_etl.py | HHS/owh-ds | d94d80661ef0d1c966f5bf87a2648dd0f19c3b8b | [
"Apache-2.0"
] | null | null | null | software/owh/backoffice/owh/etl/yrbs/yrbs_etl.py | HHS/owh-ds | d94d80661ef0d1c966f5bf87a2648dd0f19c3b8b | [
"Apache-2.0"
] | 2 | 2017-04-04T19:52:25.000Z | 2017-05-09T18:29:29.000Z | import os
from owh.etl.common.etl import ETL
import logging
logger = logging.getLogger('yrbs_etl')
class YrbsETL (ETL):
"""
Loads YRBS metadata into ES
"""
def __init__(self, configFile):
ETL.__init__(self, configFile)
def perform_etl(self):
"""Load yrbs metadata data"""
self.updateDsMetadata()
def updateDsMetadata(self):
self.loadDataSetMetaData('mental_health', '1991', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '1993', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '1995', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '1997', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '1999', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '2001', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '2003', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '2005', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '2007', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '2009', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '2011', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '2013', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_1991_2013.json'))
self.loadDataSetMetaData('mental_health', '2015', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_2015_2017.json'))
self.loadDataSetMetaData('mental_health', '2017', os.path.join(self.dataDirectory, 'data_mapping', 'yrbs_2015_2017.json'))
def validate_etl(self):
return True
if __name__ == "__main__":
# Perform ETL
etl = YrbsETL(file(os.path.join(os.path.dirname(__file__), "config.yaml"), 'r'))
etl.execute()
| 57.452381 | 130 | 0.716535 | 295 | 2,413 | 5.59322 | 0.19661 | 0.058182 | 0.090909 | 0.29697 | 0.733939 | 0.712727 | 0.712727 | 0.712727 | 0.712727 | 0.712727 | 0 | 0.080153 | 0.131372 | 2,413 | 41 | 131 | 58.853659 | 0.707061 | 0.026523 | 0 | 0 | 0 | 0 | 0.301205 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.137931 | false | 0 | 0.103448 | 0.034483 | 0.310345 | 0 | 0 | 0 | 0 | null | 0 | 0 | 1 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
612b52fc6f5d0697c272c10db82c7e556c62d3f6 | 22,414 | py | Python | test_pytest/test_unit/test_gui/test_server.py | hrvojekeserica/hat-core | 759def68620cf4f8c11e7bbbdbfd1e701dbafb09 | [
"MIT"
] | null | null | null | test_pytest/test_unit/test_gui/test_server.py | hrvojekeserica/hat-core | 759def68620cf4f8c11e7bbbdbfd1e701dbafb09 | [
"MIT"
] | null | null | null | test_pytest/test_unit/test_gui/test_server.py | hrvojekeserica/hat-core | 759def68620cf4f8c11e7bbbdbfd1e701dbafb09 | [
"MIT"
] | null | null | null | import asyncio
import contextlib
import hashlib
import pytest
import hat.gui.server
import hat.juggler
import test_unit.test_gui.mock
from test_unit.test_gui import common
def conf(ui_port, roles=[], users=[]):
return {'address': f'http://localhost:{ui_port}',
'initial_view': 'initial_view',
'roles': roles,
'users': users}
async def juggler_next_state(conn):
wait_future = asyncio.Future()
with conn.register_change_cb(lambda: wait_future.set_result(True)):
await asyncio.wait_for(wait_future, 2)
return conn.remote_data
def sha256_hexstr(password):
return hashlib.sha256(password.encode('utf-8')).hexdigest()
def user_conf(username, password, salt, roles):
salt = salt.encode('utf-8').hex()
m = hashlib.sha256(bytes.fromhex(salt))
m.update(sha256_hexstr(password).encode('utf-8'))
return {'name': username,
'password': {'hash': m.hexdigest(),
'salt': salt},
'roles': roles}
@pytest.fixture
def ui_static_files(tmp_path):
tmp_path.mkdir(exist_ok=True)
with open(tmp_path / 'index.html', 'w') as f:
f.write("""<!DOCTYPE html><head></head><body></body>""")
return tmp_path
@pytest.fixture
def default_view_descriptors():
return [
common.FileDescriptor(
relative_path='default.txt',
serialization_method=common.SerializationMethod.TEXT,
content='This is the default view')]
@pytest.fixture
def server_factory(view_factory, default_view_descriptors,
view_manager_factory, ui_static_files):
@contextlib.asynccontextmanager
async def factory(conf, adapters, view_manager=None):
if view_manager is None:
view_conf = [view_factory('initial_view',
default_view_descriptors)]
view_manager = await view_manager_factory(view_conf)
server = await hat.gui.server.create(conf, ui_static_files, adapters,
view_manager)
yield server
await server.async_close()
return factory
@pytest.mark.asyncio
async def test_login_success(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': []}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1'])])
async with server_factory(server_conf, {}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
# juggler initial message
await conn.receive()
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['user'] == 'user1'
@pytest.mark.asyncio
async def test_login_fail(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': []}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1'])])
async with server_factory(server_conf, {}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
# juggler initial message
await conn.receive()
await conn.send({'type': 'login',
'name': 'incorrect',
'password': sha256_hexstr('pass1')})
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['user'] is None
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('incorrect')})
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['user'] is None
@pytest.mark.asyncio
async def test_two_logins(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': []}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1']),
user_conf('user2', 'pass2', 'salt2', ['role1'])])
async with server_factory(server_conf, {}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
# juggler initial message
await conn.receive()
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
# login confirmation
await conn.receive()
await conn.send({'type': 'login',
'name': 'user2',
'password': sha256_hexstr('pass2')})
message = await conn.receive()
assert message['type'] == 'state'
assert message['user'] == 'user2'
@pytest.mark.asyncio
async def test_two_logins_second_fail(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': []}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1']),
user_conf('user2', 'pass2', 'salt2', ['role1'])])
async with server_factory(server_conf, {}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
# juggler initial message
await conn.receive()
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
# login confirmation
await conn.receive()
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('incorrect')})
message = await conn.receive()
assert message['type'] == 'state'
assert message['user'] is None
@pytest.mark.asyncio
async def test_logout(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': []}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1'])])
async with server_factory(server_conf, {}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
# juggler initial message
await conn.receive()
await conn.send({'type': 'logout'})
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['user'] is None
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
# login confirm message
await conn.receive()
await conn.send({'type': 'logout'})
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['user'] is None
@pytest.mark.asyncio
async def test_view(unused_tcp_port, view_factory, default_view_descriptors,
view_manager_factory, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'role1_view',
'adapters': []},
{'name': 'role2',
'view': 'role2_view',
'adapters': []}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1']),
user_conf('user2', 'pass2', 'salt2', ['role2'])])
role1_descriptors = [
common.FileDescriptor(
relative_path='user1.txt',
serialization_method=common.SerializationMethod.TEXT,
content='User1 view')]
role2_descriptors = [common.FileDescriptor(
relative_path='user2.txt',
serialization_method=common.SerializationMethod.TEXT,
content='User2 view')]
views_conf = [
view_factory('initial_view', default_view_descriptors),
view_factory('role1_view', role1_descriptors, conf={'key': 'value'}),
view_factory('role2_view', role2_descriptors, conf={'key': 'value'})]
view_manager = await view_manager_factory(views_conf)
async with server_factory(server_conf, {}, view_manager):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['conf'] is None
view_state = state_message['view']
for descriptor in default_view_descriptors:
assert descriptor.relative_path in view_state
assert descriptor.content == view_state[descriptor.relative_path]
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['conf'] == {'key': 'value'}
view_state = state_message['view']
for descriptor in role1_descriptors:
assert descriptor.relative_path in view_state
assert descriptor.content == view_state[descriptor.relative_path]
for descriptor in role2_descriptors:
assert descriptor.relative_path not in view_state
await conn.send({'type': 'login',
'name': 'user2',
'password': sha256_hexstr('pass2')})
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['conf'] == {'key': 'value'}
view_state = state_message['view']
for descriptor in role2_descriptors:
assert descriptor.relative_path in view_state
assert descriptor.content == view_state[descriptor.relative_path]
for descriptor in role1_descriptors:
assert descriptor.relative_path not in view_state
await conn.send({'type': 'logout'})
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['conf'] is None
view_state = state_message['view']
for descriptor in default_view_descriptors:
assert descriptor.relative_path in view_state
assert descriptor.content == view_state[descriptor.relative_path]
@pytest.mark.asyncio
async def test_user_noroles(unused_tcp_port, server_factory,
default_view_descriptors):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[],
users=[user_conf('user1', 'pass1', 'salt1', [])])
async with server_factory(server_conf, {}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
# juggler initial message
await conn.receive()
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
while conn.remote_data != {}:
await asyncio.sleep(0.1)
state_message = await conn.receive()
assert state_message['type'] == 'state'
assert state_message['user'] is None
assert state_message['conf'] is None
view_state = state_message['view']
for descriptor in default_view_descriptors:
assert descriptor.relative_path in view_state
assert descriptor.content == view_state[descriptor.relative_path]
@pytest.mark.asyncio
async def test_adapter_session_created(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
user1_roles = [{'name': 'role1',
'view': 'initial_view',
'adapters': ['mock']}]
server_conf = conf(ui_port,
roles=user1_roles,
users=[user_conf('user1', 'pass1', 'salt1', ['role1'])])
adapter = await test_unit.test_gui.mock.create(None, None)
async with server_factory(server_conf, {'mock': adapter}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
state_message = await conn.receive()
assert state_message['user'] is None
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn.receive()
assert state_message['user'] == 'user1'
while len(adapter.sessions) != 1:
await asyncio.sleep(0.1)
client = adapter.sessions[0].session_client
assert client.user == 'user1'
assert client.roles == user1_roles
conn2 = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
state_message = await conn2.receive()
assert state_message['user'] is None
await conn2.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn2.receive()
assert state_message['user'] == 'user1'
while len(adapter.sessions) != 2:
await asyncio.sleep(0.1)
@pytest.mark.asyncio
async def test_adapter_session_adapter_msg(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': ['mock']}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1'])])
adapter = await test_unit.test_gui.mock.create(None, None)
async with server_factory(server_conf, {'mock': adapter}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
state_message = await conn.receive()
assert state_message['user'] is None
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn.receive()
assert state_message['user'] == 'user1'
while len(adapter.sessions) != 1:
await asyncio.sleep(0.1)
client = adapter.sessions[0].session_client
msg_data = {'key': 'value'}
await conn.send({'type': 'adapter',
'name': 'mock',
'data': msg_data})
received = await client.receive()
assert received == msg_data
msg_data = 'JSON serializable data'
await client.send(msg_data)
received = await conn.receive()
assert received == {'type': 'adapter',
'name': 'mock',
'data': msg_data}
@pytest.mark.asyncio
async def test_close_juggler(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': ['mock']}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1'])])
adapter = await test_unit.test_gui.mock.create(None, None)
async with server_factory(server_conf, {'mock': adapter}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
state_message = await conn.receive()
assert state_message['user'] is None
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn.receive()
assert state_message['user'] == 'user1'
while len(adapter.sessions) != 1:
await asyncio.sleep(0.1)
await conn.async_close()
await adapter.sessions[0].closed
@pytest.mark.asyncio
async def test_adapter_session_juggler_data(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': ['mock']}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1'])])
adapter = await test_unit.test_gui.mock.create(None, None)
async with server_factory(server_conf, {'mock': adapter}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
assert conn.remote_data is None
state_message = await conn.receive()
assert state_message['user'] is None
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn.receive()
assert state_message['user'] == 'user1'
while len(adapter.sessions) != 1:
await asyncio.sleep(0.1)
client = adapter.sessions[0].session_client
assert conn.remote_data == {}
assert client.local_data is None
wait_remote = asyncio.Future()
with conn.register_change_cb(lambda: wait_remote.set_result(True)):
client.set_local_data(0)
await wait_remote
assert client.local_data == 0
assert conn.remote_data == {'mock': 0}
wait_remote = asyncio.Future()
with client.register_change_cb(lambda: wait_remote.set_result(True)):
conn.set_local_data({'mock': 1})
await wait_remote
assert client.remote_data == 1
wait_remote = asyncio.Future()
with conn.register_change_cb(lambda: wait_remote.set_result(True)):
client.set_local_data(False)
await wait_remote
assert conn.remote_data == {'mock': False}
@pytest.mark.asyncio
async def test_notify_called_when_relevant(unused_tcp_port, server_factory):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': ['mock1', 'mock2']}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1'])])
adapter1 = await test_unit.test_gui.mock.create(None, None)
adapter2 = await test_unit.test_gui.mock.create(None, None)
async with server_factory(server_conf, {'mock1': adapter1,
'mock2': adapter2}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
assert conn.remote_data is None
state_message = await conn.receive()
assert state_message['user'] is None
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn.receive()
assert state_message['user'] == 'user1'
while len(adapter1.sessions) != 1:
await asyncio.sleep(0.1)
client1 = adapter1.sessions[0].session_client
assert conn.remote_data == {}
while len(adapter2.sessions) != 1:
await asyncio.sleep(0.1)
client2 = adapter2.sessions[0].session_client
assert conn.remote_data == {}
wait_mock1 = asyncio.Future()
wait_mock2 = asyncio.Future()
with client2.register_change_cb(lambda: wait_mock2.set_result(True)):
with client1.register_change_cb(
lambda: wait_mock1.set_result(True)):
conn.set_local_data({'mock1': 1})
await wait_mock1
assert client1.remote_data == 1
assert not wait_mock2.done()
@pytest.mark.asyncio
async def test_server_shutdown(unused_tcp_port, server_factory, monkeypatch):
ui_port = unused_tcp_port
server_conf = conf(ui_port,
roles=[{'name': 'role1',
'view': 'initial_view',
'adapters': ['mock']}],
users=[user_conf('user1', 'pass1', 'salt1', ['role1'])])
adapter = await test_unit.test_gui.mock.create(None, None)
sessions = []
create_session_default = hat.gui.server.create_session
async def create_session_wrap(*args):
session = await create_session_default(*args)
sessions.append(session)
return session
with monkeypatch.context() as ctx:
ctx.setattr(hat.gui.server, 'create_session', create_session_wrap)
async with server_factory(server_conf, {'mock': adapter}):
conn = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
state_message = await conn.receive()
assert state_message['user'] is None
await conn.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn.receive()
assert state_message['user'] == 'user1'
while len(adapter.sessions) != 1:
await asyncio.sleep(0.1)
conn2 = await hat.juggler.connect(f'ws://127.0.0.1:{ui_port}/ws')
state_message = await conn2.receive()
assert state_message['user'] is None
await conn2.send({'type': 'login',
'name': 'user1',
'password': sha256_hexstr('pass1')})
state_message = await conn2.receive()
assert state_message['user'] == 'user1'
while len(adapter.sessions) != 2:
await asyncio.sleep(0.1)
await conn.closed
await conn2.closed
await asyncio.wait([session.closed for session in sessions])
await asyncio.wait([session.closed for session in adapter.sessions])
assert not adapter.closed.done()
| 38.445969 | 79 | 0.564959 | 2,449 | 22,414 | 4.964067 | 0.071458 | 0.067122 | 0.054783 | 0.058649 | 0.815415 | 0.775767 | 0.758658 | 0.718598 | 0.679937 | 0.659044 | 0 | 0.024456 | 0.308602 | 22,414 | 582 | 80 | 38.512027 | 0.760018 | 0.009057 | 0 | 0.686825 | 0 | 0 | 0.11486 | 0.019639 | 0 | 0 | 0 | 0 | 0.151188 | 1 | 0.012959 | false | 0.086393 | 0.017279 | 0.006479 | 0.047516 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 6 |
b6712c383ff226e7507eff0a7e63210f0913b7e9 | 29 | py | Python | twtlib/__init__.py | ribeiro-daniel/Twtlib | c8d6377f4d338cea737cb18857941ff4859a12a9 | [
"MIT"
] | null | null | null | twtlib/__init__.py | ribeiro-daniel/Twtlib | c8d6377f4d338cea737cb18857941ff4859a12a9 | [
"MIT"
] | null | null | null | twtlib/__init__.py | ribeiro-daniel/Twtlib | c8d6377f4d338cea737cb18857941ff4859a12a9 | [
"MIT"
] | null | null | null | from .twtlib import Twtlib
| 7.25 | 26 | 0.758621 | 4 | 29 | 5.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.206897 | 29 | 3 | 27 | 9.666667 | 0.956522 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
fcc7f8ffad38cc7be3b71be1aea1f7cec7043ba0 | 92 | py | Python | ckanext/aafc/tests/test_plugin.py | GabeGabeT/ckanext-aafc | cb359508fb90a6a33f1d79a74c0f14ad77f48e1e | [
"MIT"
] | null | null | null | ckanext/aafc/tests/test_plugin.py | GabeGabeT/ckanext-aafc | cb359508fb90a6a33f1d79a74c0f14ad77f48e1e | [
"MIT"
] | null | null | null | ckanext/aafc/tests/test_plugin.py | GabeGabeT/ckanext-aafc | cb359508fb90a6a33f1d79a74c0f14ad77f48e1e | [
"MIT"
] | null | null | null | """Tests for plugin.py."""
import ckanext.aafc.plugin as plugin
def test_plugin():
pass | 18.4 | 36 | 0.706522 | 14 | 92 | 4.571429 | 0.785714 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.152174 | 92 | 5 | 37 | 18.4 | 0.820513 | 0.217391 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.333333 | true | 0.333333 | 0.333333 | 0 | 0.666667 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 6 |
fcd933c1af60e8a33a30c34b7988d6e6fe1e9bec | 153 | py | Python | apps/marketing/models.py | gvizquel/pyerp | c859f7293cabd1003f79112463cee93ac89fccba | [
"MIT"
] | null | null | null | apps/marketing/models.py | gvizquel/pyerp | c859f7293cabd1003f79112463cee93ac89fccba | [
"MIT"
] | 11 | 2020-06-05T22:50:37.000Z | 2022-02-10T09:05:56.000Z | apps/marketing/models.py | gvizquel/pyerp | c859f7293cabd1003f79112463cee93ac89fccba | [
"MIT"
] | null | null | null | # Librerias en carpetas locales
from .submodels.campaign import PyCampaign
from .submodels.channel import PyChannel
from .submodels.mform import PyMform
| 30.6 | 42 | 0.843137 | 19 | 153 | 6.789474 | 0.684211 | 0.302326 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.111111 | 153 | 4 | 43 | 38.25 | 0.948529 | 0.189542 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
1e11ef3cf9d5a29ac964a1702fe519cb16bcec70 | 47 | py | Python | hisitter/users/serializers/__init__.py | babysitter-finder/backend | 5c37c6876ca13b5794ac44e0342b810426acbc76 | [
"MIT"
] | 1 | 2021-02-25T01:02:40.000Z | 2021-02-25T01:02:40.000Z | hisitter/users/serializers/__init__.py | babysitter-finder/backend | 5c37c6876ca13b5794ac44e0342b810426acbc76 | [
"MIT"
] | null | null | null | hisitter/users/serializers/__init__.py | babysitter-finder/backend | 5c37c6876ca13b5794ac44e0342b810426acbc76 | [
"MIT"
] | 1 | 2020-11-23T20:57:47.000Z | 2020-11-23T20:57:47.000Z | from .users import *
from .babysitters import * | 23.5 | 26 | 0.765957 | 6 | 47 | 6 | 0.666667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.148936 | 47 | 2 | 26 | 23.5 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
1e408cc7ece065a959062b3432bc159737373c22 | 186 | py | Python | downloadbot_common/messaging/consuming/exceptions.py | dnguyen0304/downloadbot.common | 25b3ef3d09764e9f8d7969c692b1e6bb87ff24d5 | [
"MIT"
] | null | null | null | downloadbot_common/messaging/consuming/exceptions.py | dnguyen0304/downloadbot.common | 25b3ef3d09764e9f8d7969c692b1e6bb87ff24d5 | [
"MIT"
] | null | null | null | downloadbot_common/messaging/consuming/exceptions.py | dnguyen0304/downloadbot.common | 25b3ef3d09764e9f8d7969c692b1e6bb87ff24d5 | [
"MIT"
] | null | null | null | # -*- coding: utf-8 -*-
from .. import exceptions
class DeleteError(Exception):
pass
class HandleError(Exception):
pass
class ReceiveTimeout(exceptions.Timeout):
pass
| 11.625 | 41 | 0.688172 | 19 | 186 | 6.736842 | 0.684211 | 0.203125 | 0.28125 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.006711 | 0.198925 | 186 | 15 | 42 | 12.4 | 0.852349 | 0.112903 | 0 | 0.428571 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0.428571 | 0.142857 | 0 | 0.571429 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 | 0 | 0 | 1 | 0 | 0 | 6 |
1e7b87d13929444848ea7a3c04295326dbd02daf | 281 | py | Python | psychsim/pwl/__init__.py | pynadath/psychsim | c7b2b92e6ff8b83b2e832acda02c4baafabdf06f | [
"MIT"
] | 23 | 2016-04-08T08:21:12.000Z | 2022-03-15T02:49:12.000Z | psychsim/pwl/__init__.py | pynadath/psychsim | c7b2b92e6ff8b83b2e832acda02c4baafabdf06f | [
"MIT"
] | 3 | 2019-07-22T16:29:07.000Z | 2020-11-06T07:00:16.000Z | psychsim/pwl/__init__.py | pynadath/psychsim | c7b2b92e6ff8b83b2e832acda02c4baafabdf06f | [
"MIT"
] | 12 | 2015-06-07T00:41:31.000Z | 2020-01-10T15:04:43.000Z | """
Class and function definitions for PieceWise Linear (PWL) representations
"""
from psychsim.pwl.keys import *
from psychsim.pwl.vector import *
from psychsim.pwl.matrix import *
from psychsim.pwl.plane import *
from psychsim.pwl.tree import *
from psychsim.pwl.state import *
| 25.545455 | 73 | 0.779359 | 39 | 281 | 5.615385 | 0.461538 | 0.328767 | 0.410959 | 0.479452 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.128114 | 281 | 10 | 74 | 28.1 | 0.893878 | 0.259786 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
1eb3cc7bbcaa5e54636e675a690ec3c9cf000fe8 | 526 | py | Python | linora/image/__init__.py | Hourout/linora | 4269516c9227a18bd1a65e1c6a59e73c74e874d0 | [
"Apache-2.0"
] | 10 | 2018-11-22T03:30:39.000Z | 2020-08-20T04:39:35.000Z | linora/image/__init__.py | Hourout/linora | 4269516c9227a18bd1a65e1c6a59e73c74e874d0 | [
"Apache-2.0"
] | null | null | null | linora/image/__init__.py | Hourout/linora | 4269516c9227a18bd1a65e1c6a59e73c74e874d0 | [
"Apache-2.0"
] | 3 | 2019-04-09T12:17:34.000Z | 2020-08-20T04:33:31.000Z | from linora.image._image_aug import *
from linora.image._image_color import *
from linora.image._image_crop import *
from linora.image._image_io import *
from linora.image._image_noise import *
from linora.image._image_position import *
from linora.image._image_resize import *
from linora.image._image_rescale import *
from linora.image._image_util import *
from linora.image._image_filter import *
from linora.image._image_combination import *
from linora.image._image_feature import *
from linora.image._image_draw import * | 40.461538 | 45 | 0.828897 | 78 | 526 | 5.25641 | 0.217949 | 0.317073 | 0.47561 | 0.634146 | 0.760976 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.096958 | 526 | 13 | 46 | 40.461538 | 0.863158 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
1ec162852dbdf3b86ec4b9c3730ed948ae615d0e | 64 | py | Python | NiLBS/mesh/__init__.py | joemarch010/NILBS | c6568818ec8acdb0fe4bd8d197278f0abb361d0b | [
"MIT"
] | 2 | 2021-04-01T07:55:11.000Z | 2021-12-10T02:57:59.000Z | NiLBS/mesh/__init__.py | joemarch010/NILBS | c6568818ec8acdb0fe4bd8d197278f0abb361d0b | [
"MIT"
] | null | null | null | NiLBS/mesh/__init__.py | joemarch010/NILBS | c6568818ec8acdb0fe4bd8d197278f0abb361d0b | [
"MIT"
] | null | null | null |
import NiLBS.mesh.mesh_occupancy
import NiLBS.mesh.voxel_matrix | 21.333333 | 32 | 0.875 | 10 | 64 | 5.4 | 0.6 | 0.407407 | 0.555556 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.0625 | 64 | 3 | 33 | 21.333333 | 0.9 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
1ecddd35392f26b509e458ac4fb8b45ec87587aa | 170 | py | Python | apps/course/views.py | Jiafauser/News_blog | a3fec19c5e58c50c40268144e2f52820b24cc5d6 | [
"Unlicense"
] | null | null | null | apps/course/views.py | Jiafauser/News_blog | a3fec19c5e58c50c40268144e2f52820b24cc5d6 | [
"Unlicense"
] | null | null | null | apps/course/views.py | Jiafauser/News_blog | a3fec19c5e58c50c40268144e2f52820b24cc5d6 | [
"Unlicense"
] | null | null | null | from django.shortcuts import render
from django.views import View
# Create your views here.
def course_list(request):
return render(request, 'course/course.html')
| 18.888889 | 48 | 0.770588 | 24 | 170 | 5.416667 | 0.666667 | 0.153846 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.147059 | 170 | 8 | 49 | 21.25 | 0.896552 | 0.135294 | 0 | 0 | 0 | 0 | 0.124138 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0.25 | false | 0 | 0.5 | 0.25 | 1 | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 1 | 1 | 0 | 0 | 6 |
1ed442534c9fb2a39c9cb519133f46a6831586ab | 3,498 | py | Python | IoT_Serwer/migrations/0001_initial.py | michalkrawczyk/IoT_Serwer | 4a02540a68f5e5fb4e2b4902fc517a64389ad557 | [
"MIT"
] | null | null | null | IoT_Serwer/migrations/0001_initial.py | michalkrawczyk/IoT_Serwer | 4a02540a68f5e5fb4e2b4902fc517a64389ad557 | [
"MIT"
] | null | null | null | IoT_Serwer/migrations/0001_initial.py | michalkrawczyk/IoT_Serwer | 4a02540a68f5e5fb4e2b4902fc517a64389ad557 | [
"MIT"
] | null | null | null | # Generated by Django 2.2.1 on 2019-06-01 08:37
import django.core.validators
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='Color',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=100)),
('red', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])),
('blue', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])),
('green', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])),
],
),
migrations.CreateModel(
name='CurrentStateData',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('red', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])),
('green', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])),
('blue', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(255)])),
('temperature', models.IntegerField(default=20, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(100)])),
('shutterState', models.IntegerField(default=2, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(2)])),
('manualControl', models.BooleanField(default=False)),
],
),
migrations.CreateModel(
name='Device',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('group', models.IntegerField(default=0, validators=[django.core.validators.MinValueValidator(0), django.core.validators.MaxValueValidator(31)])),
('name', models.TextField(max_length=100)),
],
),
migrations.CreateModel(
name='Sensor',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField()),
('measure', models.FloatField()),
('error_flag', models.BooleanField()),
('deviceID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IoT_Serwer.Device')),
],
),
migrations.CreateModel(
name='ErrorData',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('date', models.DateTimeField()),
('deviceID', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='IoT_Serwer.Device')),
],
),
]
| 53.815385 | 170 | 0.63036 | 332 | 3,498 | 6.575301 | 0.228916 | 0.087036 | 0.174072 | 0.123683 | 0.726523 | 0.726523 | 0.726523 | 0.726523 | 0.726523 | 0.726523 | 0 | 0.023634 | 0.225843 | 3,498 | 64 | 171 | 54.65625 | 0.782496 | 0.012864 | 0 | 0.614035 | 1 | 0 | 0.060852 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.052632 | 0 | 0.122807 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
1ed5cd82ea7fcff17f5683bea949ed7dd3065658 | 1,044 | py | Python | swagger_client/models/__init__.py | blarz/heiko | c99da90709a7a21498257a2922f7663a8d5547a9 | [
"MIT"
] | 3 | 2018-05-19T13:10:07.000Z | 2019-01-08T17:50:53.000Z | swagger_client/models/__init__.py | blarz/heiko | c99da90709a7a21498257a2922f7663a8d5547a9 | [
"MIT"
] | 44 | 2019-01-07T09:06:41.000Z | 2019-11-07T22:04:30.000Z | swagger_client/models/__init__.py | blarz/heiko | c99da90709a7a21498257a2922f7663a8d5547a9 | [
"MIT"
] | 3 | 2019-06-13T19:23:06.000Z | 2019-08-08T18:55:13.000Z | # coding: utf-8
# flake8: noqa
"""
MaaS
MaaS (Matomat as a Service) API definition # noqa: E501
OpenAPI spec version: 0.5.2
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from __future__ import absolute_import
# import models into model package
from swagger_client.models.auth_success import AuthSuccess
from swagger_client.models.error import Error
from swagger_client.models.item import Item
from swagger_client.models.item_stats import ItemStats
from swagger_client.models.service_stats import ServiceStats
from swagger_client.models.service_stats_items import ServiceStatsItems
from swagger_client.models.service_stats_items_cost import ServiceStatsItemsCost
from swagger_client.models.service_stats_users import ServiceStatsUsers
from swagger_client.models.service_stats_users_credits import ServiceStatsUsersCredits
from swagger_client.models.transferred_credits import TransferredCredits
from swagger_client.models.user import User
from swagger_client.models.user_stats import UserStats
| 34.8 | 86 | 0.841954 | 140 | 1,044 | 6.05 | 0.4 | 0.155844 | 0.24085 | 0.325856 | 0.357733 | 0.230224 | 0.188902 | 0 | 0 | 0 | 0 | 0.008584 | 0.10728 | 1,044 | 29 | 87 | 36 | 0.900215 | 0.208812 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
94b681733b9c494caa120d0f155543b256975f38 | 96 | py | Python | venv/lib/python3.8/site-packages/virtualenv/app_data/na.py | Retraces/UkraineBot | 3d5d7f8aaa58fa0cb8b98733b8808e5dfbdb8b71 | [
"MIT"
] | 2 | 2022-03-13T01:58:52.000Z | 2022-03-31T06:07:54.000Z | venv/lib/python3.8/site-packages/virtualenv/app_data/na.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | 19 | 2021-11-20T04:09:18.000Z | 2022-03-23T15:05:55.000Z | venv/lib/python3.8/site-packages/virtualenv/app_data/na.py | DesmoSearch/Desmobot | b70b45df3485351f471080deb5c785c4bc5c4beb | [
"MIT"
] | null | null | null | /home/runner/.cache/pip/pool/37/69/51/e555787283382f29bf13e9d6ffc321df1e7e53a26cabdc78c099f7c013 | 96 | 96 | 0.895833 | 9 | 96 | 9.555556 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.4375 | 0 | 96 | 1 | 96 | 96 | 0.458333 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | null | null | 0 | 0 | null | null | 0 | 1 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 1 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
94cc73b59f8796a10bd26a1b00c8cda37b827f80 | 1,220 | py | Python | data/dbsnp/VCF/json/loadjson.py | chunjie-sam-liu/miRNASNP-v3 | 41fab95b496b639674010863895547db0fc108bc | [
"MIT"
] | 1 | 2020-07-02T08:51:37.000Z | 2020-07-02T08:51:37.000Z | data/dbsnp/VCF/json/loadjson.py | chunjie-sam-liu/miRNASNP-v3 | 41fab95b496b639674010863895547db0fc108bc | [
"MIT"
] | null | null | null | data/dbsnp/VCF/json/loadjson.py | chunjie-sam-liu/miRNASNP-v3 | 41fab95b496b639674010863895547db0fc108bc | [
"MIT"
] | null | null | null | import json,os,re
for root,dirs,files in os.walk("/home/fux/fux/miRNASNP3/data/dbsnp/VCF/json"):
for fi in files:
if fi.endswith('.pvcf.json'):
with open(fi) as fjson:
chr_dict = json.load(fjson)
chrRegex = re.compile(r'NC_0*([1-9]*0?)')
chrid = chrRegex.search(fi).group(1)
with open("/home/fux/fux/miRNASNP3/map_utr3_snp/vcf_b/snp_in_utr3.chr"+chrid+".vcf","a") as out:
with open("/home/fux/fux/miRNASNP3/map_utr3_snp/snp_in_utr3.chr"+chrid) as snp:
line = snp.readline().strip()
while(line):
snpid = line.split('\t')[3]
out.write(chr_dict[snpid])
out.write("\n")
line = snp.readline().strip()
#with open("NC_000022.11.pvcf.json") as fjson:
# chr_dict = json.load(fjson)
# chrRegex = re.compile(r'NC_0*([1-9]*0?)')
# chrid = chrRegex.search("NC_000022.11.pvcf.json").group(1)
# with open("/home/fux/fux/miRNASNP3/map_utr3_snp/vcf_b/snp_in_utr3.chr"+chrid+".vcf","a") as out:
# with open("/home/fux/fux/miRNASNP3/map_utr3_snp/snp_in_utr3.chr"+chrid) as snp:
# line = snp.readline().strip()
# while(line):
# snpid = line.split('\t')[3]
# out.write(chr_dict[snpid])
# out.write("\n")
# line = snp.readline().strip()
| 36.969697 | 100 | 0.638525 | 204 | 1,220 | 3.691176 | 0.269608 | 0.063745 | 0.066401 | 0.126162 | 0.833997 | 0.786189 | 0.786189 | 0.786189 | 0.786189 | 0.786189 | 0 | 0.039961 | 0.159016 | 1,220 | 32 | 101 | 38.125 | 0.693957 | 0.421311 | 0 | 0.125 | 0 | 0 | 0.269452 | 0.220461 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | false | 0 | 0.0625 | 0 | 0.0625 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
a214d29fe031af459fc7e7a12ade7e7d4714ce87 | 30 | py | Python | assemblyline/alsvc_metapeek/__init__.py | dendisuhubdy/grokmachine | 120a21a25c2730ed356739231ec8b99fc0575c8b | [
"BSD-3-Clause"
] | 46 | 2017-05-15T11:15:08.000Z | 2018-07-02T03:32:52.000Z | assemblyline/alsvc_metapeek/__init__.py | dendisuhubdy/grokmachine | 120a21a25c2730ed356739231ec8b99fc0575c8b | [
"BSD-3-Clause"
] | null | null | null | assemblyline/alsvc_metapeek/__init__.py | dendisuhubdy/grokmachine | 120a21a25c2730ed356739231ec8b99fc0575c8b | [
"BSD-3-Clause"
] | 24 | 2017-05-17T03:26:17.000Z | 2018-07-09T07:00:50.000Z | from metapeek import MetaPeek
| 15 | 29 | 0.866667 | 4 | 30 | 6.5 | 0.75 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 30 | 1 | 30 | 30 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
bf729c1a9a547e815a05e635b99e26ea7aa8f285 | 30 | py | Python | pyintuition/__init__.py | trobertsca/intuition | 5ef5d03b0856f2b95a9d0b81b3831a0c12e7208e | [
"MIT"
] | null | null | null | pyintuition/__init__.py | trobertsca/intuition | 5ef5d03b0856f2b95a9d0b81b3831a0c12e7208e | [
"MIT"
] | 1 | 2018-03-24T22:42:17.000Z | 2018-03-25T03:17:19.000Z | pyintuition/__init__.py | trobertsca/intuition | 5ef5d03b0856f2b95a9d0b81b3831a0c12e7208e | [
"MIT"
] | null | null | null | from .client import Intuition
| 15 | 29 | 0.833333 | 4 | 30 | 6.25 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.133333 | 30 | 1 | 30 | 30 | 0.961538 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
bfc8c892f318962e12e05b22a198043f509d3792 | 97 | py | Python | myproject/__init__.py | EthanYan6/forum_project | ec07dc3b6004b38f3fce36f559ac512af6fb2a46 | [
"MIT"
] | 3 | 2019-06-17T06:15:12.000Z | 2020-10-19T09:05:49.000Z | myproject/__init__.py | EthanYan6/forum_project | ec07dc3b6004b38f3fce36f559ac512af6fb2a46 | [
"MIT"
] | null | null | null | myproject/__init__.py | EthanYan6/forum_project | ec07dc3b6004b38f3fce36f559ac512af6fb2a46 | [
"MIT"
] | null | null | null | from pymysql import install_as_MySQLdb
# 让Django的ORM能以mysqldb的方式来调用PyMySQL
install_as_MySQLdb() | 19.4 | 38 | 0.886598 | 10 | 97 | 8.2 | 0.7 | 0.219512 | 0.390244 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.082474 | 97 | 5 | 39 | 19.4 | 0.921348 | 0.340206 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
bfd7768968abb2fcab328df605998c370b656bac | 29 | py | Python | magic_vnet/blocks/skunit/__init__.py | Damseh/Magic-VNet | d7b43742e374d43785960bb57961582270ec0d8f | [
"MIT"
] | null | null | null | magic_vnet/blocks/skunit/__init__.py | Damseh/Magic-VNet | d7b43742e374d43785960bb57961582270ec0d8f | [
"MIT"
] | null | null | null | magic_vnet/blocks/skunit/__init__.py | Damseh/Magic-VNet | d7b43742e374d43785960bb57961582270ec0d8f | [
"MIT"
] | null | null | null | from .skunit import SK_Block
| 14.5 | 28 | 0.827586 | 5 | 29 | 4.6 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.137931 | 29 | 1 | 29 | 29 | 0.92 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 1 | 0 | 1 | 0 | 1 | 1 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 1 | 0 | 0 | 6 |
44aec5364ad47d6e0c6213ca2c274c1ba2130f34 | 150 | py | Python | contrib/scripts/reset_node.py | electrumsv/simple-indexer | be4897808b0e46ba4f9b7cfc9970e9d85f6e4cb4 | [
"OML"
] | null | null | null | contrib/scripts/reset_node.py | electrumsv/simple-indexer | be4897808b0e46ba4f9b7cfc9970e9d85f6e4cb4 | [
"OML"
] | 2 | 2021-10-14T01:45:47.000Z | 2021-11-16T02:34:14.000Z | contrib/scripts/reset_node.py | electrumsv/simple-indexer | be4897808b0e46ba4f9b7cfc9970e9d85f6e4cb4 | [
"OML"
] | null | null | null | from electrumsv_sdk import commands
commands.stop(component_type='node')
commands.reset(component_type='node')
commands.start(component_type='node')
| 25 | 37 | 0.826667 | 20 | 150 | 6 | 0.55 | 0.325 | 0.425 | 0.416667 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.053333 | 150 | 5 | 38 | 30 | 0.84507 | 0 | 0 | 0 | 0 | 0 | 0.08 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.25 | 0 | 0.25 | 0 | 1 | 0 | 0 | null | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 6 |
44ce1ec1d4eae1d53dd3b20a7f20d2f7b3c5ffab | 132 | py | Python | tools/py/writer.py | zepheira/versa | a33558c8bcff11eed0ef212fe9ec7e3d97047732 | [
"Apache-2.0"
] | 7 | 2015-03-12T19:13:34.000Z | 2021-07-31T10:10:46.000Z | tools/py/writer.py | zepheira/versa | a33558c8bcff11eed0ef212fe9ec7e3d97047732 | [
"Apache-2.0"
] | 14 | 2019-04-18T16:26:55.000Z | 2022-03-31T16:58:46.000Z | tools/py/writer.py | zepheira/versa | a33558c8bcff11eed0ef212fe9ec7e3d97047732 | [
"Apache-2.0"
] | 2 | 2015-11-09T04:14:10.000Z | 2019-07-24T06:03:36.000Z | # versa.writer
raise DeprecationWarning('Please use versa.serial instead.')
raise ImportError('Please use versa.serial instead.')
| 22 | 60 | 0.787879 | 16 | 132 | 6.5 | 0.5625 | 0.173077 | 0.269231 | 0.384615 | 0.519231 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0.106061 | 132 | 5 | 61 | 26.4 | 0.881356 | 0.090909 | 0 | 0 | 0 | 0 | 0.547009 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | true | 0 | 0.5 | 0 | 0.5 | 0 | 1 | 0 | 0 | null | 0 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | null | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 6 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.