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
0499b16f0be9eca146bbacbe9fd290e5df88778d
7,658
py
Python
tests/sdk/test_service.py
testruction/databricks-cli
4e74b10ed3e3f017f1444fc1b7842c5b25f1fe7c
[ "Apache-2.0" ]
252
2017-06-03T06:08:02.000Z
2022-03-24T16:43:02.000Z
tests/sdk/test_service.py
testruction/databricks-cli
4e74b10ed3e3f017f1444fc1b7842c5b25f1fe7c
[ "Apache-2.0" ]
310
2017-06-28T06:00:07.000Z
2022-03-31T15:23:07.000Z
tests/sdk/test_service.py
testruction/databricks-cli
4e74b10ed3e3f017f1444fc1b7842c5b25f1fe7c
[ "Apache-2.0" ]
192
2017-07-31T01:00:43.000Z
2022-03-13T19:19:21.000Z
# Databricks CLI # Copyright 2017 Databricks, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"), except # that the use of services to which certain application programming # interfaces (each, an "API") connect requires that the user first obtain # a license for the use of the APIs from Databricks, Inc. ("Databricks"), # by creating an account at www.databricks.com and agreeing to either (a) # the Community Edition Terms of Service, (b) the Databricks Terms of # Service, or (c) another written agreement between Licensee and Databricks # for the use of the APIs. # # You may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pytest import mock from databricks_cli.sdk.service import JobsService from tests.utils import provide_conf @pytest.fixture() def jobs_service(): with mock.patch('databricks_cli.sdk.ApiClient') as api_client: yield JobsService(api_client) @provide_conf def test_delete_job(jobs_service): jobs_service.delete_job(None) jobs_service.client.perform_query.assert_called_with('POST', '/jobs/delete', data={}, headers=None, version=None) jobs_service.delete_job(1) jobs_service.client.perform_query.assert_called_with('POST', '/jobs/delete', data={'job_id': 1}, headers=None, version=None) jobs_service.delete_job(1, version='2.1') jobs_service.client.perform_query.assert_called_with('POST', '/jobs/delete', data={'job_id': 1}, headers=None, version='2.1') @provide_conf def test_get_job(jobs_service): jobs_service.get_job(None) jobs_service.client.perform_query.assert_called_with('GET', '/jobs/get', data={}, headers=None, version=None) jobs_service.get_job(1) jobs_service.client.perform_query.assert_called_with('GET', '/jobs/get', data={'job_id': 1}, headers=None, version=None) jobs_service.get_job(1, version='2.1') jobs_service.client.perform_query.assert_called_with('GET', '/jobs/get', data={'job_id': 1}, headers=None, version='2.1') @provide_conf def test_list_jobs(jobs_service): jobs_service.list_jobs() jobs_service.client.perform_query.assert_called_with('GET', '/jobs/list', data={}, headers=None, version=None) jobs_service.list_jobs(offset=1, limit=1) jobs_service.client.perform_query.assert_called_with('GET', '/jobs/list', data={'offset': 1, 'limit': 1}, headers=None, version=None) jobs_service.list_jobs(expand_tasks=True, version='2.1') jobs_service.client.perform_query.assert_called_with('GET', '/jobs/list', data={'expand_tasks': True}, headers=None, version='2.1') @provide_conf def test_get_run_output(jobs_service): jobs_service.get_run_output(None) jobs_service.client.perform_query.assert_called_with('GET', '/jobs/runs/get-output', data={}, headers=None, version=None) jobs_service.get_run_output(1) jobs_service.client.perform_query.assert_called_with('GET', '/jobs/runs/get-output', data={'run_id': 1}, headers=None, version=None) jobs_service.get_run_output(1, version='2.1') jobs_service.client.perform_query.assert_called_with('GET', '/jobs/runs/get-output', data={'run_id': 1}, headers=None, version='2.1') @provide_conf def test_get_run(jobs_service): jobs_service.get_run(None) jobs_service.client.perform_query.assert_called_with('GET', '/jobs/runs/get', data={}, headers=None, version=None) jobs_service.get_run(1) jobs_service.client.perform_query.assert_called_with('GET', '/jobs/runs/get', data={'run_id': 1}, headers=None, version=None) jobs_service.get_run(1, version='2.1') jobs_service.client.perform_query.assert_called_with('GET', '/jobs/runs/get', data={'run_id': 1}, headers=None, version='2.1') @provide_conf def test_delete_run(jobs_service): jobs_service.delete_run(None) jobs_service.client.perform_query.assert_called_with('POST', '/jobs/runs/delete', data={}, headers=None, version=None) jobs_service.delete_run(1) jobs_service.client.perform_query.assert_called_with('POST', '/jobs/runs/delete', data={'run_id': 1}, headers=None, version=None) jobs_service.delete_run(1, version='2.1') jobs_service.client.perform_query.assert_called_with('POST', '/jobs/runs/delete', data={'run_id': 1}, headers=None, version='2.1') @provide_conf def test_cancel_run(jobs_service): jobs_service.cancel_run(None) jobs_service.client.perform_query.assert_called_with('POST', '/jobs/runs/cancel', data={}, headers=None, version=None) jobs_service.cancel_run(1) jobs_service.client.perform_query.assert_called_with('POST', '/jobs/runs/cancel', data={'run_id': 1}, headers=None, version=None) jobs_service.cancel_run(1, version='2.1') jobs_service.client.perform_query.assert_called_with('POST', '/jobs/runs/cancel', data={'run_id': 1}, headers=None, version='2.1') @provide_conf def test_create_job(jobs_service): jobs_service.create_job(None) jobs_service.client.perform_query.assert_called_with('POST', '/jobs/create', data={}, headers=None, version=None) tasks = {'task_key': '123', 'notebook_task': {'notebook_path': '/test'}} jobs_service.create_job(tasks=tasks) jobs_service.client.perform_query.assert_called_with('POST', '/jobs/create', data={'tasks': tasks}, headers=None, version=None) tasks = {'task_key': '123', 'notebook_task': {'notebook_path': '/test'}} jobs_service.create_job(tasks=tasks, version='2.1') jobs_service.client.perform_query.assert_called_with('POST', '/jobs/create', data={'tasks': tasks}, headers=None, version='2.1') @provide_conf def test_create_job_invalid_types(jobs_service): with pytest.raises(TypeError, match='new_cluster'): jobs_service.create_job(new_cluster=[]) with pytest.raises(TypeError, match='email_notifications'): jobs_service.create_job(email_notifications=[]) with pytest.raises(TypeError, match='schedule'): jobs_service.create_job(schedule=[]) with pytest.raises(TypeError, match='notebook_task'): jobs_service.create_job(notebook_task=[]) with pytest.raises(TypeError, match='spark_jar_task'): jobs_service.create_job(spark_jar_task=[]) with pytest.raises(TypeError, match='spark_python_task'): jobs_service.create_job(spark_python_task=[]) with pytest.raises(TypeError, match='spark_submit_task'): jobs_service.create_job(spark_submit_task=[]) @provide_conf def test_submit_run_invalid_types(jobs_service): with pytest.raises(TypeError, match='new_cluster'): jobs_service.submit_run(new_cluster=[]) with pytest.raises(TypeError, match='email_notifications'): jobs_service.submit_run(email_notifications=[]) with pytest.raises(TypeError, match='schedule'): jobs_service.submit_run(schedule=[]) with pytest.raises(TypeError, match='notebook_task'): jobs_service.submit_run(notebook_task=[]) with pytest.raises(TypeError, match='spark_jar_task'): jobs_service.submit_run(spark_jar_task=[]) with pytest.raises(TypeError, match='spark_python_task'): jobs_service.submit_run(spark_python_task=[]) with pytest.raises(TypeError, match='spark_submit_task'): jobs_service.submit_run(spark_submit_task=[])
42.782123
137
0.735832
1,102
7,658
4.857532
0.139746
0.150009
0.076219
0.107603
0.776761
0.74108
0.712498
0.712311
0.696992
0.657762
0
0.01106
0.126273
7,658
178
138
43.022472
0.78897
0.133586
0
0.245283
0
0
0.133545
0.013763
0
0
0
0
0.226415
1
0.103774
false
0
0.037736
0
0.141509
0
0
0
0
null
0
0
0
0
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
0
0
0
0
0
0
4
04d7c3bbf541a3b5662eb9c5fd3b0b976c4a2592
223
py
Python
portalsite/portal/models/__init__.py
AntonSamojlow/authenticity-portal
d3a38096c9c6aaf688ed9783464396be3ebbe673
[ "MIT" ]
null
null
null
portalsite/portal/models/__init__.py
AntonSamojlow/authenticity-portal
d3a38096c9c6aaf688ed9783464396be3ebbe673
[ "MIT" ]
2
2021-11-06T14:31:24.000Z
2021-11-06T17:10:58.000Z
portalsite/portal/models/__init__.py
AntonSamojlow/authenticity-portal
d3a38096c9c6aaf688ed9783464396be3ebbe673
[ "MIT" ]
null
null
null
""" Contains all DJANGO database models """ from .group import Group from .measurement import Measurement from .model import Model from .scoring import Scoring from .source import Source from .prediction import Prediction
20.272727
36
0.802691
29
223
6.172414
0.448276
0
0
0
0
0
0
0
0
0
0
0
0.143498
223
10
37
22.3
0.937173
0.156951
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
1
0
0
null
0
0
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
0
1
0
1
0
0
4
04efd151e0421dd0409bb456bc7efac18722cb8f
223
py
Python
Part_1_beginner/19_Functions/Functions_solutions/exercise_1.py
Mikma03/InfoShareacademy_Python_Courses
3df1008c8c92831bebf1625f960f25b39d6987e6
[ "MIT" ]
null
null
null
Part_1_beginner/19_Functions/Functions_solutions/exercise_1.py
Mikma03/InfoShareacademy_Python_Courses
3df1008c8c92831bebf1625f960f25b39d6987e6
[ "MIT" ]
null
null
null
Part_1_beginner/19_Functions/Functions_solutions/exercise_1.py
Mikma03/InfoShareacademy_Python_Courses
3df1008c8c92831bebf1625f960f25b39d6987e6
[ "MIT" ]
null
null
null
# Napisz funkcję, która obliczy pole powierzchni prostokąta na podstawie długości jego boków. def rectangle_area(long, width): return long * width print(f"Pole prostokąta o bokach 5 i 18 to {rectangle_area(5, 18)}")
27.875
93
0.757848
34
223
4.911765
0.764706
0.155689
0
0
0
0
0
0
0
0
0
0.032258
0.165919
223
7
94
31.857143
0.865591
0.408072
0
0
0
0
0.453125
0
0
0
0
0
0
1
0.333333
false
0
0
0.333333
0.666667
0.333333
0
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
0
1
1
0
0
4
04fd4676538e82ed9f2dde8f06cd24561b680e6c
366
py
Python
dummy_object.py
Robinson04/inoft_vocal_framework
9659e0852604bc628b01e0440535add0ae5fc5d1
[ "MIT" ]
11
2020-04-15T07:47:34.000Z
2022-03-30T21:47:36.000Z
dummy_object.py
Robinson04/inoft_vocal_framework
9659e0852604bc628b01e0440535add0ae5fc5d1
[ "MIT" ]
20
2020-08-09T00:11:49.000Z
2021-09-11T11:34:02.000Z
dummy_object.py
Robinson04/inoft_vocal_framework
9659e0852604bc628b01e0440535add0ae5fc5d1
[ "MIT" ]
6
2020-02-21T04:45:19.000Z
2021-07-18T22:13:55.000Z
class DummyObject: # When we try to access any attribute of the # dummy object, it will return himself. def __getattr__(self, item): return self # And if dummy object is called, nothing is being done, # and error created if the function did not exist. def __call__(self, *args, **kwargs): pass dummy_object = DummyObject()
26.142857
59
0.669399
51
366
4.627451
0.745098
0.139831
0
0
0
0
0
0
0
0
0
0
0.262295
366
13
60
28.153846
0.874074
0.5
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0.166667
0
0.166667
0.666667
0
0
0
0
null
0
0
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
1
0
1
0
1
1
0
0
4
b6c736fbfedc24af0ee9152e5a0c8a823dacde1a
86
py
Python
gitgud/skills/custom/__init__.py
sahansk2/git-gud
882b704d9e6274ebfe73a3f402de18e4826efb00
[ "MIT" ]
null
null
null
gitgud/skills/custom/__init__.py
sahansk2/git-gud
882b704d9e6274ebfe73a3f402de18e4826efb00
[ "MIT" ]
1
2021-05-07T01:27:28.000Z
2021-05-07T01:27:28.000Z
gitgud/skills/custom/__init__.py
sahansk2/git-gud
882b704d9e6274ebfe73a3f402de18e4826efb00
[ "MIT" ]
null
null
null
""" Module containing levels packaged with Git Gud requiring unique functionality. """
28.666667
78
0.790698
10
86
6.8
1
0
0
0
0
0
0
0
0
0
0
0
0.127907
86
3
79
28.666667
0.906667
0.906977
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
b6fa7e1a595fba34471351b4abd695dbaf00c7ba
405
py
Python
Lib/site-packages/pylint_django/tests/input/func_model_does_not_use_unicode_py33.py
cristian-12/ProyectoDjango
bf1d1c6ca7f8a50bcbfbfe556d3d81dbdb5533d4
[ "bzip2-1.0.6" ]
1
2020-11-25T17:14:45.000Z
2020-11-25T17:14:45.000Z
Lib/site-packages/pylint_django/tests/input/func_model_does_not_use_unicode_py33.py
cristian-12/ProyectoDjango
bf1d1c6ca7f8a50bcbfbfe556d3d81dbdb5533d4
[ "bzip2-1.0.6" ]
7
2020-06-05T18:16:38.000Z
2022-03-11T23:20:31.000Z
env/lib/python3.9/site-packages/pylint_django/tests/input/func_model_does_not_use_unicode_py33.py
simotwo/AbileneParadox-ddd
c85961efb37aba43c0d99ed1c36d083507e2b2d3
[ "MIT" ]
7
2021-04-26T15:52:19.000Z
2021-05-04T02:18:56.000Z
""" Ensures that under PY3 django models with a __unicode__ method are flagged """ # pylint: disable=missing-docstring from django.db import models class SomeModel(models.Model): # [model-has-unicode] something = models.CharField(max_length=255) # no __str__ method something.something_else = 1 def lala(self): pass def __unicode__(self): return self.something
20.25
74
0.701235
51
405
5.294118
0.72549
0
0
0
0
0
0
0
0
0
0
0.015674
0.212346
405
19
75
21.315789
0.830721
0.365432
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0.125
0.125
0.125
0.75
0
0
0
0
null
0
0
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
1
0
1
0
1
1
0
0
4
b6fed9d0a84abf21b6bf43e723e9909d51d73bf4
640
py
Python
py_css_styleguide/exceptions.py
sveetch/py-css-styleguide
27aed5cf7e992e4a8e8d0f997c29af8063419657
[ "MIT" ]
null
null
null
py_css_styleguide/exceptions.py
sveetch/py-css-styleguide
27aed5cf7e992e4a8e8d0f997c29af8063419657
[ "MIT" ]
17
2018-04-14T15:10:29.000Z
2022-03-26T17:59:18.000Z
py_css_styleguide/exceptions.py
sveetch/py-css-styleguide
27aed5cf7e992e4a8e8d0f997c29af8063419657
[ "MIT" ]
null
null
null
# -*- coding: utf-8 -*- """ Exceptions ========== Specific application exceptions. """ class PyCssStyleguideException(Exception): """ Exception base. You should never use it directly except for test purpose. Instead make or use a dedicated exception related to the error context. """ pass class SerializerError(PyCssStyleguideException): """ Exception to raise when there is a syntax issue during serialization. """ pass class StyleguideValidationError(PyCssStyleguideException): """ Exception to raise when there is invalid naming in reference rules and properties. """ pass
20
86
0.692188
67
640
6.61194
0.716418
0.223476
0.158014
0.180587
0.230248
0.230248
0.230248
0
0
0
0
0.001996
0.217188
640
31
87
20.645161
0.882236
0.590625
0
0.5
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
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
0
1
1
0
0
0
0
0
4
8e1c1ec73c77a5bbb37379bd5170cdd7eecc2fab
151
py
Python
icbd/type_analyzer/tests/import_test/__init__.py
kmod/icbd
9636564eb3993afa07c6220d589bbd1991923d74
[ "MIT" ]
7
2015-04-06T15:17:13.000Z
2020-10-21T04:57:00.000Z
icbd/type_analyzer/tests/import_test/__init__.py
kmod/icbd
9636564eb3993afa07c6220d589bbd1991923d74
[ "MIT" ]
null
null
null
icbd/type_analyzer/tests/import_test/__init__.py
kmod/icbd
9636564eb3993afa07c6220d589bbd1991923d74
[ "MIT" ]
4
2016-05-16T17:53:08.000Z
2020-11-28T17:18:50.000Z
from . import b import c from .b import x from b import y from .c import x from c import y dup = 1 not_m = "not_m" __all__ = ['b', 'dup', 'not_m']
10.785714
31
0.635762
32
151
2.78125
0.34375
0.235955
0.247191
0
0
0
0
0
0
0
0
0.008772
0.245033
151
13
32
11.615385
0.77193
0
0
0
0
0
0.092715
0
0
0
0
0
0
1
0
false
0
0.666667
0
0.666667
0
0
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
0
0
1
0
1
0
0
4
8e1d2cc5ac7e723a2ea8024a77c16d380465c6f1
99
py
Python
test/test_files/test_dynamic/test_dynamic_import_alias.py
SoftwareUnderstanding/inspect4py
9c4d7252535082ad938b26baf281d93f3a27285e
[ "BSD-3-Clause" ]
2
2022-02-15T20:30:57.000Z
2022-03-17T00:50:37.000Z
test/test_files/test_dynamic/test_dynamic_import_alias.py
SoftwareUnderstanding/code_inspector
a820b5a7bb18f5df9c3e79346108d8280b20c39a
[ "BSD-3-Clause" ]
101
2021-06-09T14:19:59.000Z
2022-01-24T13:24:39.000Z
test/test_files/test_dynamic/test_dynamic_import_alias.py
SoftwareUnderstanding/inspect4py
9c4d7252535082ad938b26baf281d93f3a27285e
[ "BSD-3-Clause" ]
1
2021-09-22T06:59:32.000Z
2021-09-22T06:59:32.000Z
import test_dynamic_func as td def func_3(func): return func() a=func_3(td.func_1) print(a)
11
30
0.717172
20
99
3.3
0.6
0.151515
0
0
0
0
0
0
0
0
0
0.036585
0.171717
99
8
31
12.375
0.768293
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0.2
0.6
0.2
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
0
0
0
1
1
0
0
4
8e30b4c05be4ff74d36bf391862224e22ffe1deb
242
py
Python
djangolive/core/models.py
Tomvictor/djangolive
fbb482395e4b9be5b947480047868870bb77f344
[ "MIT" ]
1
2021-04-06T17:53:06.000Z
2021-04-06T17:53:06.000Z
djangolive/core/models.py
Tomvictor/djangolive
fbb482395e4b9be5b947480047868870bb77f344
[ "MIT" ]
6
2021-04-16T16:06:55.000Z
2021-04-24T07:13:07.000Z
djangolive/core/models.py
Tomvictor/djangolive
fbb482395e4b9be5b947480047868870bb77f344
[ "MIT" ]
null
null
null
from django.db import models # Create your models here. class CoreModel(models.Model): timestamp = models.DateTimeField(auto_now_add=True) last_updated = models.DateTimeField(auto_now=True) class Meta: abstract = True
20.166667
55
0.731405
31
242
5.580645
0.677419
0.219653
0.265896
0.300578
0
0
0
0
0
0
0
0
0.190083
242
11
56
22
0.882653
0.099174
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.166667
0
0.833333
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
0
0
0
0
1
0
0
4
8e3bcf7c63f15630dcb3ccc4d2fec40cfda81b3e
122
py
Python
mypythonpackage/__init__.py
pypyr/pypyr-example
1fb9379628da8c120d40d9aea0e71cdc2434f08a
[ "Apache-2.0" ]
13
2017-04-09T21:29:05.000Z
2022-02-10T18:39:47.000Z
mypythonpackage/__init__.py
pypyr/pypyr-example
1fb9379628da8c120d40d9aea0e71cdc2434f08a
[ "Apache-2.0" ]
1
2019-01-02T23:01:50.000Z
2019-01-02T23:01:50.000Z
mypythonpackage/__init__.py
pypyr/pypyr-example
1fb9379628da8c120d40d9aea0e71cdc2434f08a
[ "Apache-2.0" ]
null
null
null
"""init py module tells python this folder contains a package. You don't particularly need this file for python 3.6. """
24.4
62
0.745902
21
122
4.333333
0.904762
0
0
0
0
0
0
0
0
0
0
0.019802
0.172131
122
4
63
30.5
0.881188
0.934426
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
6d2b35fe36eef1f9bbdc595b24f63012ef94578d
132
py
Python
scripts/portal/market13.py
Snewmy/swordie
ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17
[ "MIT" ]
9
2021-04-26T11:59:29.000Z
2021-12-20T13:15:27.000Z
scripts/portal/market13.py
Snewmy/swordie
ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17
[ "MIT" ]
null
null
null
scripts/portal/market13.py
Snewmy/swordie
ae01ed4ec0eb20a18730e8cd209eea0b84a8dd17
[ "MIT" ]
6
2021-07-14T06:32:05.000Z
2022-02-06T02:32:56.000Z
# Magatia (261000000) / NLC Town Center (600000000) => Free Market sm.setReturnField() sm.setReturnPortal() sm.warp(910000000, 36)
26.4
67
0.742424
16
132
6.125
0.875
0
0
0
0
0
0
0
0
0
0
0.25
0.121212
132
4
68
33
0.594828
0.492424
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0
0
0
0
1
0
0
null
0
0
0
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
1
0
0
0
0
0
0
4
6d308564e55a194fe56c9329c76cdfcd63c0f2a1
23
py
Python
nixpkgs_review/tests/__init__.py
slekwati/nixpkgs-review
fb6143435e91756f7447c34653d96de4c7c1be21
[ "MIT" ]
null
null
null
nixpkgs_review/tests/__init__.py
slekwati/nixpkgs-review
fb6143435e91756f7447c34653d96de4c7c1be21
[ "MIT" ]
null
null
null
nixpkgs_review/tests/__init__.py
slekwati/nixpkgs-review
fb6143435e91756f7447c34653d96de4c7c1be21
[ "MIT" ]
null
null
null
""" The test suite """
5.75
14
0.521739
3
23
4
1
0
0
0
0
0
0
0
0
0
0
0
0.217391
23
3
15
7.666667
0.666667
0.608696
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
0
0
0
4
edba87910b8621d3935c2e7f2ea1d5bbc15641fc
321
py
Python
translator/auth.py
gsi-upm/eurosentiment-translator
565a70daafba9fc626589bb9a665f1d30890450a
[ "Apache-2.0" ]
1
2020-06-04T02:19:51.000Z
2020-06-04T02:19:51.000Z
translator/auth.py
gsi-upm/eurosentiment-translator
565a70daafba9fc626589bb9a665f1d30890450a
[ "Apache-2.0" ]
2
2021-03-22T17:14:34.000Z
2021-12-13T19:41:01.000Z
docon/auth.py
gsi-upm/docon
ca1ddd4731f46ad3194bf8ec85e433a7bc4f3b44
[ "Apache-2.0" ]
null
null
null
import os from flask.ext import login from .models import User # Initialize flask-login def init_login(app): login_manager = login.LoginManager() login_manager.init_app(app) # Create user loader function @login_manager.user_loader def load_user(user_id): return User.objects.get(pk=user_id)
22.928571
43
0.738318
47
321
4.851064
0.489362
0.157895
0
0
0
0
0
0
0
0
0
0
0.183801
321
13
44
24.692308
0.870229
0.155763
0
0
0
0
0
0
0
0
0
0
0
1
0.222222
false
0
0.333333
0.111111
0.666667
0
0
0
0
null
0
0
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
1
0
0
1
1
1
0
0
4
ede206e6bbefde0cc54f3f3ec37a072fb6b86856
134
py
Python
python-modules/twisted/twisted/application/test/__init__.py
stormtheh4ck3r/python-for-android
b9ea9161392f60566b81482b1e25cd77004d5c45
[ "Apache-2.0" ]
267
2015-03-22T15:23:48.000Z
2022-03-05T21:57:34.000Z
python-modules/twisted/twisted/application/test/__init__.py
stormtheh4ck3r/python-for-android
b9ea9161392f60566b81482b1e25cd77004d5c45
[ "Apache-2.0" ]
133
2015-03-21T15:13:43.000Z
2021-12-11T23:37:58.000Z
python-modules/twisted/twisted/application/test/__init__.py
stormtheh4ck3r/python-for-android
b9ea9161392f60566b81482b1e25cd77004d5c45
[ "Apache-2.0" ]
119
2015-04-28T16:07:10.000Z
2022-03-18T03:49:48.000Z
# Copyright (c) 2007-2010 Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.internet.application}. """
19.142857
54
0.731343
17
134
5.764706
0.882353
0
0
0
0
0
0
0
0
0
0
0.068966
0.134328
134
6
55
22.333333
0.775862
0.902985
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
ede83dabe0c021c5c4af4a0e48c4d259170384a0
66
py
Python
test/__init__.py
Lukeeeeee/FISDNN
49361770fe987337b16a296c00cfd6562a7e95ed
[ "MIT" ]
null
null
null
test/__init__.py
Lukeeeeee/FISDNN
49361770fe987337b16a296c00cfd6562a7e95ed
[ "MIT" ]
null
null
null
test/__init__.py
Lukeeeeee/FISDNN
49361770fe987337b16a296c00cfd6562a7e95ed
[ "MIT" ]
null
null
null
import os TEST_PATH = os.path.dirname(os.path.realpath(__file__))
22
55
0.787879
11
66
4.272727
0.636364
0.255319
0
0
0
0
0
0
0
0
0
0
0.075758
66
2
56
33
0.770492
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
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
0
0
1
0
0
0
0
4
edf1a276aafe7247da822e020faef8199efdd458
96
py
Python
frictionless/__main__.py
augusto-herrmann/frictionless-py
b4ff35f064141a2c04882edb592666ca6b066776
[ "MIT" ]
247
2020-08-04T16:42:09.000Z
2022-03-30T11:54:54.000Z
frictionless/__main__.py
augusto-herrmann/frictionless-py
b4ff35f064141a2c04882edb592666ca6b066776
[ "MIT" ]
444
2020-07-29T09:13:59.000Z
2022-03-31T14:54:57.000Z
frictionless/__main__.py
augusto-herrmann/frictionless-py
b4ff35f064141a2c04882edb592666ca6b066776
[ "MIT" ]
60
2020-09-04T11:39:34.000Z
2022-03-23T18:59:51.000Z
from .program import program if __name__ == "__main__": program(prog_name="frictionless")
16
37
0.729167
11
96
5.545455
0.727273
0
0
0
0
0
0
0
0
0
0
0
0.15625
96
5
38
19.2
0.753086
0
0
0
0
0
0.208333
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
1
0
0
0
0
4
b615453e9a3ecd183c211dc425622124a7d7eb85
2,068
py
Python
tests/data/networks/G_C.py
uw-ipd/privileged_residues
78078c22ba537651a1b6bd1404c05246ab73a3e3
[ "Apache-2.0" ]
null
null
null
tests/data/networks/G_C.py
uw-ipd/privileged_residues
78078c22ba537651a1b6bd1404c05246ab73a3e3
[ "Apache-2.0" ]
20
2018-08-13T22:50:46.000Z
2018-11-03T22:29:03.000Z
tests/data/networks/G_C.py
uw-ipd/privileged_residues
78078c22ba537651a1b6bd1404c05246ab73a3e3
[ "Apache-2.0" ]
1
2018-08-25T06:03:43.000Z
2018-08-25T06:03:43.000Z
from tests.util import pick_ray from pyrosetta import Pose from pyrosetta.rosetta.core.import_pose import pose_from_pdbstring name = "G_C" contents = """ HETNAM G__ A 1 G__ HETNAM C__ A 2 C__ HETATM 1 CV G__ A 1 11.103 -5.324 0.225 1.00 0.00 X HETATM 2 NE G__ A 1 11.107 -3.872 0.139 1.00 0.00 N HETATM 3 CZ G__ A 1 10.031 -3.121 -0.165 1.00 0.00 C HETATM 4 NH1 G__ A 1 8.875 -3.697 -0.409 1.00 0.00 N HETATM 5 NH2 G__ A 1 10.137 -1.811 -0.218 1.00 0.00 N HETATM 6 HE G__ A 1 11.979 -3.393 0.320 1.00 0.00 H HETATM 7 1HH1 G__ A 1 8.797 -4.706 -0.367 1.00 0.00 H HETATM 8 2HH1 G__ A 1 8.068 -3.133 -0.637 1.00 0.00 H HETATM 9 1HH2 G__ A 1 11.024 -1.368 -0.031 1.00 0.00 H HETATM 10 2HH2 G__ A 1 9.330 -1.249 -0.446 1.00 0.00 H HETATM 11 CV C__ A 2 9.842 -4.360 -4.397 1.00 0.00 X HETATM 12 CD C__ A 2 8.947 -4.296 -3.191 1.00 0.00 C HETATM 13 OE1 C__ A 2 8.358 -3.263 -2.964 1.00 0.00 O HETATM 14 OE2 C__ A 2 8.851 -5.281 -2.494 1.00 0.00 O TER CONECT 1 2 CONECT 2 1 3 6 CONECT 3 2 4 5 CONECT 4 3 7 8 CONECT 5 3 9 10 CONECT 6 2 CONECT 7 4 CONECT 8 4 CONECT 9 5 CONECT 10 5 CONECT 11 12 CONECT 12 11 13 14 CONECT 13 12 CONECT 14 12 """ pose = Pose() pose_from_pdbstring(pose, contents) sc_donor = { 1: [ pick_ray(pose.residue(1), "HE", "NE"), pick_ray(pose.residue(1), "1HH1", "NH1"), pick_ray(pose.residue(1), "2HH1", "NH1"), pick_ray(pose.residue(1), "1HH2", "NH2"), pick_ray(pose.residue(1), "2HH2", "NH2") ] } sc_acceptor = { 2: [ pick_ray(pose.residue(2), "OE1", "CD"), pick_ray(pose.residue(2), "OE2", "CD") ] }
33.901639
78
0.491779
387
2,068
2.49354
0.25323
0.043523
0.058031
0.087047
0.320207
0.207254
0
0
0
0
0
0.30832
0.407157
2,068
60
79
34.466667
0.478793
0
0
0
0
0.259259
0.723404
0
0
0
0
0
0
1
0
false
0
0.055556
0
0.055556
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
b61d4277ea096a6639f11fa5818b6d91b65fb58a
38
py
Python
tutorials/Strings/hello.py
sserperior/pythonstuff
6f80d005f3fdcf5047dd415beeb8b4603677d27d
[ "MIT" ]
null
null
null
tutorials/Strings/hello.py
sserperior/pythonstuff
6f80d005f3fdcf5047dd415beeb8b4603677d27d
[ "MIT" ]
null
null
null
tutorials/Strings/hello.py
sserperior/pythonstuff
6f80d005f3fdcf5047dd415beeb8b4603677d27d
[ "MIT" ]
null
null
null
message = 'Hello World' print(message)
19
23
0.763158
5
38
5.8
0.8
0
0
0
0
0
0
0
0
0
0
0
0.105263
38
2
24
19
0.852941
0
0
0
0
0
0.282051
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
0
0
0
0
0
1
0
4
b6730c9ecb019aecf7090fb721b4526478869061
112
py
Python
BCNF/__init__.py
jaantollander/BCNF
b3108733224f106af7070c360b2327b2022733e2
[ "MIT" ]
1
2019-12-16T14:34:31.000Z
2019-12-16T14:34:31.000Z
BCNF/__init__.py
jaantollander/BCNF
b3108733224f106af7070c360b2327b2022733e2
[ "MIT" ]
null
null
null
BCNF/__init__.py
jaantollander/BCNF
b3108733224f106af7070c360b2327b2022733e2
[ "MIT" ]
null
null
null
__version__ = '0.1' from ._version import get_versions __version__ = get_versions()['version'] del get_versions
22.4
39
0.785714
15
112
5.066667
0.533333
0.434211
0.473684
0
0
0
0
0
0
0
0
0.02
0.107143
112
4
40
28
0.74
0
0
0
0
0
0.089286
0
0
0
0
0
0
1
0
false
0
0.25
0
0.25
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
0
0
0
0
0
4
b6938376271932dca4490496609a4a2ff7f2f732
62
py
Python
cotidia/stripe/forms/public.py
guillaumepiot/cotidia-stripe
f23329e8363c3d8577acf9633966d6af61c090eb
[ "BSD-3-Clause" ]
null
null
null
cotidia/stripe/forms/public.py
guillaumepiot/cotidia-stripe
f23329e8363c3d8577acf9633966d6af61c090eb
[ "BSD-3-Clause" ]
null
null
null
cotidia/stripe/forms/public.py
guillaumepiot/cotidia-stripe
f23329e8363c3d8577acf9633966d6af61c090eb
[ "BSD-3-Clause" ]
null
null
null
from django import forms class StripeCardForm(forms.Form):
10.333333
33
0.790323
8
62
6.125
0.875
0
0
0
0
0
0
0
0
0
0
0
0.145161
62
5
34
12.4
0.924528
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.5
null
null
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
1
0
0
0
1
0
0
0
0
4
fcd4688ffcaf459e95ba4b08b5439ef0d5dc9220
73
py
Python
firewood/models/semantic_segmentation/__init__.py
kynk94/torch-firewood
8ecd03c166bcadaae22a6cb2c1457a82f2c644eb
[ "MIT" ]
1
2022-03-26T12:51:27.000Z
2022-03-26T12:51:27.000Z
firewood/models/semantic_segmentation/__init__.py
kynk94/torch-firewood
8ecd03c166bcadaae22a6cb2c1457a82f2c644eb
[ "MIT" ]
null
null
null
firewood/models/semantic_segmentation/__init__.py
kynk94/torch-firewood
8ecd03c166bcadaae22a6cb2c1457a82f2c644eb
[ "MIT" ]
null
null
null
from . import BiSeNetV1, BiSeNetV2 __all__ = ["BiSeNetV1", "BiSeNetV2"]
18.25
36
0.726027
7
73
7
0.714286
0.734694
0
0
0
0
0
0
0
0
0
0.063492
0.136986
73
3
37
24.333333
0.714286
0
0
0
0
0
0.246575
0
0
0
0
0
0
1
0
false
0
0.5
0
0.5
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
0
0
1
0
0
0
0
4
1e33bf1c8952e6bb22b466f115b75ed5bf39ccfe
143
py
Python
pyleecan/Methods/Elmer/Section/__reversed__.py
IrakozeFD/pyleecan
5a93bd98755d880176c1ce8ac90f36ca1b907055
[ "Apache-2.0" ]
95
2019-01-23T04:19:45.000Z
2022-03-17T18:22:10.000Z
pyleecan/Methods/Elmer/Section/__reversed__.py
IrakozeFD/pyleecan
5a93bd98755d880176c1ce8ac90f36ca1b907055
[ "Apache-2.0" ]
366
2019-02-20T07:15:08.000Z
2022-03-31T13:37:23.000Z
pyleecan/Methods/Elmer/Section/__reversed__.py
IrakozeFD/pyleecan
5a93bd98755d880176c1ce8ac90f36ca1b907055
[ "Apache-2.0" ]
74
2019-01-24T01:47:31.000Z
2022-02-25T05:44:42.000Z
# -*- coding: utf-8 -*- def __reversed__(self): """Built-in to implement reverse iteration""" return self._statements.__reversed__()
20.428571
49
0.671329
16
143
5.4375
0.875
0
0
0
0
0
0
0
0
0
0
0.008403
0.167832
143
6
50
23.833333
0.722689
0.433566
0
0
0
0
0
0
0
0
0
0
0
1
0.5
false
0
0
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
0
0
0
0
1
0
0
4
1e389155b9cecbaeb6c3f713bc4e9bfeef240eed
118
py
Python
Actividad6/main.py
Donluigimx/SeminarioSO
5042ef79580b817644d1acaf39e99df22c37bd24
[ "MIT" ]
null
null
null
Actividad6/main.py
Donluigimx/SeminarioSO
5042ef79580b817644d1acaf39e99df22c37bd24
[ "MIT" ]
null
null
null
Actividad6/main.py
Donluigimx/SeminarioSO
5042ef79580b817644d1acaf39e99df22c37bd24
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 from .pro_con import ProductorConsumidor if __name__ == '__main__': ProductorConsumidor()
19.666667
40
0.754237
13
118
6.153846
0.923077
0
0
0
0
0
0
0
0
0
0
0.009804
0.135593
118
5
41
23.6
0.77451
0.177966
0
0
0
0
0.083333
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
1
0
0
0
0
4
1e8e008471c3aa653c0cf3154ce9ecc93646c7c5
71
py
Python
modulo 3/exercicios/hello world.py
GabrielBrotas/Python
9441b6b86ff3cb7fa5921b508c484075adac08b3
[ "MIT" ]
null
null
null
modulo 3/exercicios/hello world.py
GabrielBrotas/Python
9441b6b86ff3cb7fa5921b508c484075adac08b3
[ "MIT" ]
null
null
null
modulo 3/exercicios/hello world.py
GabrielBrotas/Python
9441b6b86ff3cb7fa5921b508c484075adac08b3
[ "MIT" ]
null
null
null
import pyautogui as pag pag.typewrite('Hello World', interval=0.25)
11.833333
43
0.746479
11
71
4.818182
0.909091
0
0
0
0
0
0
0
0
0
0
0.04918
0.140845
71
5
44
14.2
0.819672
0
0
0
0
0
0.15942
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
0
1
0
0
0
0
4
1ea4c26d2d87e3f2f6fcce6b2e1d63eb51a45b1a
138
py
Python
modules/2.79/bpy/types/CyclesCurveSettings.py
cmbasnett/fake-bpy-module
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
[ "MIT" ]
null
null
null
modules/2.79/bpy/types/CyclesCurveSettings.py
cmbasnett/fake-bpy-module
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
[ "MIT" ]
null
null
null
modules/2.79/bpy/types/CyclesCurveSettings.py
cmbasnett/fake-bpy-module
acb8b0f102751a9563e5b5e5c7cd69a4e8aa2a55
[ "MIT" ]
null
null
null
class CyclesCurveSettings: radius_scale = None root_width = None shape = None tip_width = None use_closetip = None
13.8
26
0.666667
16
138
5.5
0.6875
0.204545
0
0
0
0
0
0
0
0
0
0
0.289855
138
9
27
15.333333
0.897959
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0
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
0
0
0
0
1
0
0
4
1eac3c9f1ee1ec801eff802ed1972306ffea358b
809
py
Python
Book.py
EvilKhaosKat/books_buying_optimizer
ef6a2f2537db3bf402de293f1db58ddec635535d
[ "Apache-2.0" ]
null
null
null
Book.py
EvilKhaosKat/books_buying_optimizer
ef6a2f2537db3bf402de293f1db58ddec635535d
[ "Apache-2.0" ]
null
null
null
Book.py
EvilKhaosKat/books_buying_optimizer
ef6a2f2537db3bf402de293f1db58ddec635535d
[ "Apache-2.0" ]
null
null
null
import unittest class Book: title = "No title" cost = 0 def __init__(self, title, cost): self.title = title self.cost = cost def __eq__(self, other): return self.title == other.title # TODO check strictly on title/cost? def __repr__(self): return "Book(title='{}', cost={})".format(self.title, self.cost) def __str__(self, *args, **kwargs): return self.__repr__() def __hash__(self): return hash(self.title) ^ hash(self.cost) class TestBook(unittest.TestCase): def test_equals(self): book_1 = Book(title='Book 1', cost=1) book_1_copy = Book(title='Book 1', cost=1) book_2 = Book(title='Book 2', cost=2) self.assertEqual(book_1, book_1_copy) self.assertNotEqual(book_1, book_2)
23.794118
78
0.611867
111
809
4.153153
0.297297
0.075922
0.058568
0.060738
0.099783
0.099783
0.099783
0
0
0
0
0.023256
0.255871
809
33
79
24.515152
0.742525
0.042027
0
0
0
0
0.065977
0
0
0
0
0.030303
0.090909
1
0.272727
false
0
0.045455
0.181818
0.681818
0
0
0
0
null
0
0
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
1
0
0
1
0
0
0
1
1
0
0
4
1eb316202f72cc6dbfbbd16fdd9c680af3767fc4
250
py
Python
src/cocoa/toga_cocoa/widgets/passwordinput.py
jrwdunham/toga
db343c99d0f174aea86c4656849ea25ffb7bfe7a
[ "BSD-3-Clause" ]
null
null
null
src/cocoa/toga_cocoa/widgets/passwordinput.py
jrwdunham/toga
db343c99d0f174aea86c4656849ea25ffb7bfe7a
[ "BSD-3-Clause" ]
null
null
null
src/cocoa/toga_cocoa/widgets/passwordinput.py
jrwdunham/toga
db343c99d0f174aea86c4656849ea25ffb7bfe7a
[ "BSD-3-Clause" ]
null
null
null
from ..libs import NSSecureTextField from .textinput import TextInput class PasswordInput(TextInput): _IMPL_CLASS = NSSecureTextField def __init__(self, id=None, style=None): super(PasswordInput, self).__init__(id=id, style=style)
25
63
0.752
29
250
6.137931
0.517241
0
0
0
0
0
0
0
0
0
0
0
0.156
250
9
64
27.777778
0.843602
0
0
0
0
0
0
0
0
0
0
0
0
1
0.166667
false
0.333333
0.333333
0
0.833333
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
0
1
1
0
0
0
0
4
94a56a4c64d8b56670dc35765aa0f482f4918bb8
141,568
py
Python
Kamael/beard_states.py
azeemba/invisibot
a172d285c5eae0628111e5b73f60fcd266de4592
[ "MIT" ]
null
null
null
Kamael/beard_states.py
azeemba/invisibot
a172d285c5eae0628111e5b73f60fcd266de4592
[ "MIT" ]
null
null
null
Kamael/beard_states.py
azeemba/invisibot
a172d285c5eae0628111e5b73f60fcd266de4592
[ "MIT" ]
null
null
null
from beard_utilities import * import math from rlbot.agents.base_agent import BaseAgent, SimpleControllerState from rlbot.utils.structures.game_data_struct import GameTickPacket from rlbot.utils.game_state_util import ( GameState, BallState, CarState, Physics, Vector3, Rotator, ) import random """ Right corner loc: (-2048, -2560), yaw: 0.25 pi loc: (2048, 2560), yaw: -0.75 pi Left corner loc: (2048, -2560), yaw: 0.75 pi loc: (-2048, 2560), yaw: -0.25 pi Back right loc: (-256.0, -3840), yaw: 0.5 pi loc: (256.0, 3840), yaw: -0.5 pi Back left loc: (256.0, -3840), yaw: 0.5 pi loc: (-256.0, 3840), yaw: -0.5 pi Far back center loc: (0.0, -4608), yaw: 0.5 pi loc: (0.0, 4608), yaw: -0.5 pi """ def locked_in(agent, agentType): if agentType == LeapOfFaith: if agent.activeState.active != False: return True if agentType == Divine_Mandate: if agent.activeState.active != False: return True if agentType == airLaunch: if agent.activeState.active != False: return True if agentType == BlessingOfDexterity: if agent.activeState.active != False: return True if agentType == Wings_Of_Justice: if agent.activeState.active != False: return True # if agentType == DivineGrace: # if agent.activeState.active != False: # return True if agentType == DivineGuidance: if agent.activeState.active != False: return True if agentType == RighteousVolley: if agent.activeState.active != False: return True return False def getKickoffPosition(vec): kickoff_locations = [[2048, 2560], [256, 3848], [0, 4608]] # 0 == wide diagonal, 1 == short disgonal, 2 == middle if abs(vec[0]) >= 350: return 0 elif abs(vec[0]) > 5: return 1 else: return 2 class baseState: def __init__(self, agent): self.agent = agent self.active = True def __repr__(self): return f"{type(self).__name__}" class Player_reporter(baseState): def update(self): if len(self.agent.allies) > 0: center = Vector([0, 5200 * -sign(self.agent.team), 200]) dummy = self.agent.allies[0] shotAngle = math.degrees(angle2(dummy.location, center)) correctedAngle = correctAngle(shotAngle + 90 * -sign(self.agent.team)) # agent.log.append( # f"natural angle: {shotAngle} || corrected angle: {correctedAngle}" # ) print(distance2D(self.agent.allies[0].location,self.agent.ball.location)) else: self.agent.log.append("waiting on player to join bot team") return SimpleControllerState() class State: RESET = 0 WAIT = 1 INITIALIZE = 2 RUNNING = 3 class Kickoff_boosties(baseState): def update(self): return kickoff_boost_grabber(self.agent) class airLaunch(baseState): def __init__(self, agent): baseState.__init__(self, agent) self.initiated = agent.time self.jumpTimer = agent.time self.firstJump = False self.secondJump = False self.firstJumpHold = 0.5 self.secondJumpHold = 0.4 self.active = True def update(self): stateController = SimpleControllerState() if not self.firstJump: self.firstJump = True stateController.jump = True self.jumpTimer = self.agent.time elif self.firstJump and not self.secondJump: if self.agent.time - self.jumpTimer < self.firstJumpHold: stateController.jump = True elif ( self.agent.time - self.jumpTimer > self.firstJumpHold and self.agent.time - self.jumpTimer < self.firstJumpHold + 0.05 ): stateController.boost = True stateController.jump = False else: self.secondJump = True stateController.boost = True self.jumpTimer = self.agent.time else: if self.agent.time - self.jumpTimer < self.secondJumpHold: stateController.jump = True stateController.boost = True else: self.active = False self.jump = False self.agent.activeState = DivineGrace(self.agent) if ( self.agent.time - self.jumpTimer > 0.15 and self.agent.time - self.jumpTimer < 0.35 ): stateController.pitch = 1 return stateController class Aerial_Charge: def __init__(self, agent, target: Vector): self.target = target self.agent = agent self.active = True self.anti_gravity_vec = Vector([0,0,1]) self.timer = 0 self.wallJump = self.agent.onWall def update(self): controls = SimpleControllerState() controls.throttle = 0 self.timer += self.agent.deltaTime #print(self.timer) delta_a = calculate_delta_acceleration(self.target - self.agent.me.location, self.agent.me.velocity, 0.01, self.agent.gravity) if not self.agent.onSurface: align_car_to(controls, self.agent.me.avelocity, delta_a, self.agent) aim_target = (delta_a.normalize()+self.anti_gravity_vec).normalize().scale(2300) if self.wallJump: if self.timer <= 0.2: controls.boost = self.agent._forward.dotProduct(delta_a.normalize()) > 0.6 and delta_a.magnitude() > 100 controls.jump = True return controls elif self.timer <= 0.2+self.agent.fakeDeltaTime*3: controls.jump = False controls.boost = self.agent._forward.dotProduct(delta_a.normalize()) > 0.6 and delta_a.magnitude() > 100 return controls elif self.timer > 0.2+self.agent.fakeDeltaTime*3: controls.steer,controls.roll,controls.yaw,controls.pitch = 0,0,0,0 controls.jump = True controls.boost = self.agent._forward.dotProduct(delta_a.normalize()) > 0.6 and delta_a.magnitude() > 100 if self.timer > 0.2 + self.agent.fakeDeltaTime * 6: #print("Launch complete") self.active = False return controls else: controls.boost = self.agent._forward.dotProduct(delta_a.normalize()) > 0.6 and delta_a.magnitude() > 100 if self.timer < 0.2: controls.jump = True elif self.timer < 0.2 + self.agent.fakeDeltaTime * 3: controls.jump = False elif self.timer < 0.2 + self.agent.fakeDeltaTime * 5: controls.steer,controls.roll,controls.yaw,controls.pitch = 0,0,0,0 controls.jump = True else: controls.jump = True self.active = False return controls print("error, launch condition out of range!") self.active = False return controls class Wings_Of_Justice: def __init__(self, agent, pred, target:Vector, time:float): self.active = False self.agent = agent self.time = clamp(10, 0.0001, time) self.airborne = False self.launcher = None self.pred = predictionStruct( convertStructLocationToVector(pred), pred.game_seconds ) self.target = target self.drive_controls = SimpleControllerState() self.launch_projection = None self.started = self.agent.time self.powershot = distance2D(target,Vector([0,5200*-sign(agent.team),0])) > 2000 # def validateExistingPred(self): # updatedPredAtTime = find_pred_at_time(self.agent, self.pred.time) # if self.pred.time <= self.agent.time: # return False # # if ( # findDistance( # convertStructLocationToVector(updatedPredAtTime), self.pred.location # ) # > 10 # ): # return False # return True def setup(self): #print(f"in setup {self.agent.time}") if self.agent.onSurface: launching = False dt = self.pred.time - self.agent.time delta_a = calculate_delta_acceleration(self.target - self.agent.me.location, self.agent.jumpPhysics.velocity, dt, self.agent.gravity) expedite = 1060 * (self.agent.me.boostLevel-10 / 33.333) > delta_a.scale(dt).magnitude() _direction = direction(self.agent.me.location,self.target) destination = self.target + _direction.scale(150) self.drive_controls = driveController(self.agent, destination, self.pred.time, expedite=expedite, flippant=False, maintainSpeed=False) #zoneInfo= takeoff_goldielox_zone(self.agent,self.target) if delta_a.magnitude() < 1000: if abs(self.drive_controls.steer) <= 0.15: #self.agent.currentSpd < 300 or if not self.agent.onWall: projection = self.agent.me.location + self.agent.jumpPhysics.velocity.scale(1.5) projected_delta_a = calculate_delta_acceleration(self.target - projection, self.agent.jumpPhysics.velocity, dt, self.agent.gravity) if projected_delta_a.magnitude() < 1000: launching = True #print(delta_a.magnitude(),projected_delta_a.magnitude()) self.launch_projection = projected_delta_a.magnitude() else: self.agent.log.append("Averting a bad launch") launching = False else: launching = True if not launching: self.active = False #print(f"required delta: {delta_a.magnitude()}") else: if distance2D(self.target,self.agent.me.location) <= 5000: if not self.agent.onWall: self.launcher = self.agent.createJumpChain(2, 400, jumpSim = None,set_state = False) else: self.launcher = Aerial_Charge(self.agent,self.target) self.active = True else: self.active = False else: self.active = True def update(self): controls = SimpleControllerState() controls.throttle = 0 dt = self.pred.time - self.agent.time if dt > 1 or not self.powershot: target = self.target else: target = self.pred.location delta_a = calculate_delta_acceleration(target-self.agent.me.location, self.agent.me.velocity,dt , self.agent.gravity) if self.agent.time - self.started > .5: if self.launch_projection != None: self.agent.log.append(f"Projected delta_a after launcher: {str(self.launch_projection)[:6]}, in reality: {str(delta_a.magnitude())[:6]}") self.launch_projection = None pred_valid = validateExistingPred(self.agent,self.pred) if self.agent.onSurface and self.launcher == None: self.setup() if self.launcher == None: return self.drive_controls if self.launcher != None: controls = self.launcher.update() if not self.launcher.active: self.launcher = None #print("killed launcher") return controls boost_req = 100 #if dt >1 or delta_a.magnitude() > boost_req: align_car_to(controls, self.agent.me.avelocity, delta_a, self.agent) aligned = self.agent._forward.dotProduct(delta_a.normalize()) > 0.7 controls.boost = aligned and delta_a.magnitude() > boost_req if delta_a.magnitude() > 50 and aligned: controls.throttle = 1 if delta_a.magnitude() > 1060 and dt > 1: self.active = False self.agent.log.append(f"required acceleration too high {delta_a.magnitude()}") # else: # controls.steer,controls.yaw,controls.pitch,controls.roll,angle_diff= point_at_position(self.agent, self.pred.location) if not pred_valid: if self.launch_projection != None: self.agent.log.append( f"Projected delta_a after launcher: {str(self.launch_projection)[:6]}, in reality: {str(delta_a.magnitude())[:6]}") self.launch_projection = None if self.launcher == None: self.active = False if dt <=0: self.active = False self.agent.log.append("Aerial timed out") if self.agent.onSurface: self.agent.log.append("canceling aerial since we're on surface") self.active = False return controls # class Wings_Of_Justice: # def __init__(self, agent, pred, target:Vector, time:float): # self.active = False # self.agent = agent # self.time = clamp(10, 0.0001, time) # self.airborne = False # self.launcher = None # self.pred = predictionStruct( # convertStructLocationToVector(pred), pred.game_seconds # ) # self.target = target # self.drive_controls = SimpleControllerState() # self.launch_projection = None # self.started = self.agent.time # #self.powershot = distance2D(target,Vector([0,5200*-sign(agent.team),0])) > 2000 # # def validateExistingPred(self): # updatedPredAtTime = find_pred_at_time(self.agent, self.pred.time) # if self.pred.time <= self.agent.time: # return False # # if ( # findDistance( # convertStructLocationToVector(updatedPredAtTime), self.pred.location # ) # > 10 # ): # return False # return True # # def setup(self): # #print(f"in setup {self.agent.time}") # if self.agent.onSurface: # launching = False # dt = self.pred.time - self.agent.time # delta_a = calculate_delta_acceleration(self.target - self.agent.me.location, self.agent.jumpPhysics.velocity, # dt, self.agent.gravity) # expedite = 1060 * (self.agent.me.boostLevel-10 / 33.333) > delta_a.scale(dt).magnitude() # # _direction = direction(self.agent.me.location,self.target) # destination = self.target + _direction.scale(150) # # self.drive_controls = driveController(self.agent, destination, # self.pred.time, # expedite=expedite, flippant=False, # maintainSpeed=False) # # #zoneInfo= takeoff_goldielox_zone(self.agent,self.target) # # # # if delta_a.magnitude() < 1000: # if abs(self.drive_controls.steer) <= 0.15: #or (self.agent.team == 0 and self.agent.currentSpd < (self.pred.time-self.agent.time)*100): # if not self.agent.onWall:# or self.agent.team == 0: # projection = self.agent.me.location + self.agent.jumpPhysics.velocity.scale(1.5) # projected_delta_a = calculate_delta_acceleration(self.target - projection, # self.agent.jumpPhysics.velocity, # dt, self.agent.gravity) # if projected_delta_a.magnitude() < 1000: # launching = True # #print(delta_a.magnitude(),projected_delta_a.magnitude()) # self.launch_projection = projected_delta_a.magnitude() # else: # self.agent.log.append("Averting a bad launch") # launching = False # else: # launching = True # # # # if not launching: # self.active = False # #print(f"required delta: {delta_a.magnitude()}") # # else: # if distance2D(self.target,self.agent.me.location) <= 5000: # if not self.agent.onWall: # self.launcher = self.agent.createJumpChain(2, 400, jumpSim = None,set_state = False) # else: # self.launcher = Aerial_Charge(self.agent,self.target) # self.active = True # else: # self.active = False # else: # self.active = True # # # # def update(self): # controls = SimpleControllerState() # controls.throttle = 0 # dt = self.pred.time - self.agent.time # if dt > 1: # target = self.target # else: # target = self.pred.location # # delta_a = calculate_delta_acceleration(target-self.agent.me.location, self.agent.me.velocity,dt , self.agent.gravity) # if self.agent.time - self.started > .5: # if self.launch_projection != None: # self.agent.log.append(f"Projected delta_a after launcher: {str(self.launch_projection)[:6]}, in reality: {str(delta_a.magnitude())[:6]}") # self.launch_projection = None # # pred_valid = self.validateExistingPred() # # if self.agent.onSurface and self.launcher == None: # self.setup() # if self.launcher == None: # return self.drive_controls # # if self.launcher != None: # controls = self.launcher.update() # if not self.launcher.active: # self.launcher = None # #print("killed launcher") # return controls # boost_req = 100 # # #if dt >1 or delta_a.magnitude() > boost_req: # align_car_to(controls, self.agent.me.avelocity, delta_a, self.agent) # aligned = self.agent._forward.dotProduct(delta_a.normalize()) > 0.6 # controls.boost = aligned and delta_a.magnitude() > boost_req # if delta_a.magnitude() > 50 and aligned: # controls.throttle = 1 # if delta_a.magnitude() > 1060 and dt > 1: # self.active = False # self.agent.log.append(f"required acceleration too high {delta_a.magnitude()}") # # else: # # controls.steer,controls.yaw,controls.pitch,controls.roll,angle_diff= point_at_position(self.agent, self.pred.location) # # if not pred_valid: # if self.launch_projection != None: # self.agent.log.append( # f"Projected delta_a after launcher: {str(self.launch_projection)[:6]}, in reality: {str(delta_a.magnitude())[:6]}") # self.launch_projection = None # if self.launcher == None: # self.active = False # # if dt <=0: # self.active = False # self.agent.log.append("Aerial timed out") # # if self.agent.onSurface: # self.agent.log.append("canceling aerial since we're on surface") # self.active = False # return controls # class Wings_Of_Justice: # def __init__(self, agent, pred, target, time): # self.active = False # self.agent = agent # self.time = clamp(10, 0.0001, time) # self.airborne = False # self.launcher = None # self.pred = predictionStruct( # convertStructLocationToVector(pred), pred.game_seconds # ) # # self.pred = pred # self.target = target # self.vel_target = Vector([0, 0, 0]) # self.driveController = SimpleControllerState() # self.setup() # # def create_copy(self): # return Wings_Of_Justice(self.agent, self.pred, self.target, self.time) # # def setup(self): # vel_target = self.agent.calcDeltaV(self.target, self.time) # if self.agent.deltaV >= vel_target.magnitude(): # # if vel_target.magnitude() < 2300: # # # if self.pred.game_seconds - self.agent.time > 0: # if self.pred.time - self.agent.time > 0: # self.vel_target = vel_target # self.active = True # if self.agent.onSurface: # # self.launcher = airLaunch(self.agent) # controls = [] # timers = [] # controls.append(SimpleControllerState(jump=True)) # timers.append(0.2) # controls.append(SimpleControllerState()) # timers.append(self.agent.fakeDeltaTime) # controls.append(SimpleControllerState(jump=False)) # timers.append(self.agent.fakeDeltaTime) # controls.append(SimpleControllerState(jump=True)) # # self.launcher = Divine_Mandate(self.agent, controls, timers) # # print(f"activated with dv_target of {dv_target}") # # def validateExistingPred(self): # updatedPredAtTime = find_pred_at_time(self.agent, self.pred.time) # # if self.pred.game_seconds <= self.agent.time: # if self.pred.time <= self.agent.time: # return False # # if ( # findDistance( # convertStructLocationToVector(updatedPredAtTime), self.pred.location # ) # > 10 # ): # return False # return True # # def update(self): # createBox(self.agent, self.target) # self.time = clamp(6, 0, self.pred.time - self.agent.time) # vel_target = self.agent.calcDeltaV(self.target, self.time) # vel_mag = vel_target.magnitude() # # vel_local = matrixDot(self.agent.me.matrix, vel_target) # self.controller = SimpleControllerState() # # ( # self.controller.steer, # self.controller.yaw, # self.controller.pitch, # self.controller.roll, # angle_diff, # ) = match_vel(self.agent, vel_local) # # acceptable_difference = 0.65 # # if self.launcher != None and self.launcher.active: # return self.launcher.update() # # else: # if self.agent.deltaV < vel_mag: # self.active = False # # if self.agent.onSurface: # self.active = False # # if vel_mag > 2300: # self.active = False # # if self.pred.time - self.agent.time <= 0: # self.active = False # # if not self.validateExistingPred(): # self.active = False # # if self.agent.onSurface: # self.active = False # if vel_mag > 10: # if angle_diff <= acceptable_difference: # self.controller.boost = True # else: # self.controller.boost = False # else: # if self.time <= 1: # ( # self.controller.steer, # self.controller.yaw, # self.controller.pitch, # self.controller.roll, # angle_diff, # ) = point_at_position(self.agent, self.pred.location) # # if self.time <= 0: # self.active = False # # print("timed out?") # return self.controller class Celestial_Arrest(baseState): def update(self): return catch_ball(self.agent) class LeapOfFaith(baseState): def __init__(self, agent, targetCode, target=None): self.agent = agent self.active = True self.targetCode = targetCode # 0 flip at ball , 1 flip forward, 2 double jump, 3 flip backwards, 4 flip left, 5 flip right, 6 flip at target ,7 left forward diagnal flip, 8 right forward diagnal flip self.flip_obj = FlipStatus(agent.time) self.target = target self.cancelTimerCap = 0.3 self.cancelStartTime = None self.jumped = False def update(self): controller_state = SimpleControllerState() jump = flipHandler(self.agent, self.flip_obj) if jump: if self.targetCode == 1: controller_state.pitch = -1 controller_state.steer = 0 controller_state.throttle = 1 elif self.targetCode == 0: # ball_local = toLocal( # self.agent.ball.location, self.agent.me # ).normalize() ball_local = self.agent.ball.local_location ball_angle = math.atan2(ball_local.data[1], ball_local.data[0]) controller_state.jump = True controller_state.yaw = math.sin(ball_angle) pitch = -math.cos(ball_angle) controller_state.pitch = pitch if pitch > 0: controller_state.throttle = -1 else: controller_state.throttle = 1 elif self.targetCode == 2: controller_state.pitch = 0 controller_state.steer = 0 controller_state.yaw = 0 elif self.targetCode == 3: controller_state.pitch = 1 controller_state.steer = 0 controller_state.throttle = -1 elif self.targetCode == -1: controller_state.pitch = 0 controller_state.steer = 0 controller_state.throttle = 0 elif self.targetCode == 4: controller_state.pitch = 0 controller_state.yaw = -1 controller_state.steer = -1 controller_state.throttle = 1 #print("in left side flip") elif self.targetCode == 5: controller_state.pitch = 0 controller_state.yaw = 1 controller_state.steer = 1 controller_state.throttle = 1 #print("in right side flip") elif self.targetCode == 6: target_local = toLocal(self.target, self.agent.me).normalize() target_angle = math.atan2(target_local.data[1], target_local.data[0]) controller_state.jump = True controller_state.yaw = math.sin(target_angle) pitch = -math.cos(target_angle) controller_state.pitch = pitch if pitch > 0: controller_state.throttle = -1 else: controller_state.throttle = 1 elif self.targetCode == 7: controller_state.pitch = -1 controller_state.yaw = -1 controller_state.steer = -1 controller_state.throttle = 1 elif self.targetCode == 8: controller_state.pitch = -1 controller_state.yaw = 1 controller_state.steer = 1 controller_state.throttle = 1 elif self.targetCode == 9: # diagnal flip cancel controller_state.pitch = -1 controller_state.roll = -1 # controller_state.steer = -1 controller_state.throttle = 1 elif self.targetCode == 10: # diagnal flip cancel controller_state.pitch = -1 controller_state.roll = 1 # controller_state.steer = -1 controller_state.throttle = 1 elif self.targetCode == -1: controller_state.pitch = 0 controller_state.steer = 0 controller_state.throttle = 0 controller_state.jump = jump controller_state.boost = False if self.targetCode == 7 or self.targetCode == 8: controller_state.boost = True if self.flip_obj.flipDone: if self.targetCode != 9 or self.targetCode != 10: self.active = False else: if not self.cancelStartTime: self.cancelStartTime = self.agent.time return controller_state if self.targetCode == 9: controller_state.pitch = 1 controller_state.roll = 1 controller_state.throttle = 1 else: controller_state.pitch = 1 controller_state.roll = -1 controller_state.throttle = 1 if self.agent.time - self.cancelStartTime >= self.cancelTimerCap: self.active = False # if self.agent.forward: # controller_state.throttle = 1 # else: # controller_state.throttle = -1 return controller_state class Divine_Mandate: # class for performing consecutive actions over a period of time. Example: Flipping forward def __init__(self, agent, controls_list: list, durations_list: list): self.controls = controls_list self.durations = durations_list self.complete = False self.index = 0 self.current_duration = 0 self.agent = agent # there should be a duration in the durations for every controller given in the list. This inserts 0 for any lacking if len(durations_list) < len(controls_list): self.durations += [0 * len(controls_list) - len(durations_list)] self.active = True def create_custom_controls(self, actionCode): # perform specialized actions if creating controlers at creation time wasn't feasible controller_state = SimpleControllerState() if actionCode == 0: ball_local = self.agent.ball.local_location ball_angle = math.atan2(ball_local.data[1], ball_local.data[0]) controller_state.jump = True controller_state.yaw = math.sin(ball_angle) pitch = -math.cos(ball_angle) controller_state.pitch = pitch if pitch > 0: controller_state.throttle = -1 else: controller_state.throttle = 1 # ball_local = toLocal(self.agent.ball.location, self.agent.me).normalize() # ball_angle = math.atan2(ball_local.data[1], ball_local.data[0]) # controller_state.jump = True # controller_state.yaw = clamp(1, -1, math.sin(ball_angle)) # controller_state.pitch = clamp(1, -1, -math.cos(ball_angle)) if actionCode == 1: controller_state.steer,controller_state.yaw,controller_state.pitch, controller_state.roll,_ = point_at_position(self.agent, self.agent.ball.location) controller_state.jump = False return controller_state def update( self, ): # call this once per frame with delta time to recieve updated controls self.current_duration += self.agent.deltaTime if self.current_duration > self.durations[self.index]: self.index += 1 self.current_duration = self.current_duration - self.agent.deltaTime # self.current_duration = 0 if self.index == len(self.controls): self.active = False return SimpleControllerState() if type(self.controls[self.index]) == SimpleControllerState: return self.controls[self.index] else: return self.create_custom_controls(self.controls[self.index]) class RighteousVolley(baseState): def __init__(self, agent, delay, target): baseState.__init__(self, agent) self.smartAngle = False self.target = target height = target[2] boomerDelay = 0.05 # if len(agent.allies) < 1: # boomerDelay = 0 delay = clamp(1.25, 0.3, delay + boomerDelay) if delay >= 0.3: if height <= 200: # print("tiny powershot") self.jumpTimerMax = 0.1 self.angleTimer = clamp(0.15, 0.05, self.jumpTimerMax / 2) else: # print("normal powershot") self.jumpTimerMax = delay - 0.2 self.angleTimer = clamp(0.15, 0.1, self.jumpTimerMax / 2) self.delay = delay if self.delay >= 0.5: self.smartAngle = True self.jumped = False self.jumpTimer = 0 # print("setting action to powershot") def update(self): controller_state = SimpleControllerState() controller_state.throttle = 0 controller_state.boost = False ball_local = toLocal(self.agent.ball.location, self.agent.me).normalize() # ball_local = toLocal(self.target, self.agent.me) ball_angle = math.atan2(ball_local.data[1], ball_local.data[0]) angle_degrees = correctAngle(math.degrees(ball_angle)) if not self.jumped: self.jumped = True controller_state.jump = True return controller_state else: self.jumpTimer += self.agent.deltaTime if self.jumpTimer < self.angleTimer: controller_state.pitch = 1 if self.jumpTimer < self.jumpTimerMax: controller_state.jump = True else: controller_state.jump = False if self.jumpTimer > self.jumpTimerMax: if ( self.jumpTimer >= self.delay - 0.2 and self.jumpTimer < self.delay - 0.15 ): controller_state.jump = False elif ( self.jumpTimer >= self.delay - 0.15 and self.jumpTimer < self.delay ): controller_state.yaw = math.sin(ball_angle) controller_state.pitch = -math.cos(ball_angle) controller_state.jump = True elif self.jumpTimer < self.delay + 0.1: controller_state.jump = False else: self.active = False controller_state.jump = False return controller_state class DivineRetribution: def __init__(self, agent, targetCar): self.agent = agent self.targetCar = targetCar self.active = True def update(self,): action = demoTarget(self.agent, self.targetCar) return action class DemolitionBot: def __init__(self, agent): self.agent = agent self.active = True def update(self): target = self.agent.closestEnemyToBall valid = False if target.location[2] <= 90: if ( target.location[1] > self.agent.ball.location[1] and target.location[1] < self.agent.me.location[1] ) or ( target.location[1] < self.agent.ball.location[1] and target.location[1] > self.agent.me.location[1] ): valid = True if valid: return demoEnemyCar(self.agent, target) else: self.active = False return ShellTime(self.agent) class GroundShot(baseState): def __init__(self, agent): self.agent = agent self.active = True def update(self): return lineupShot(self.agent, 3) class GroundAssault(baseState): def __init__(self, agent): self.agent = agent self.active = True def update(self): return lineupShot(self.agent, 1) class DivineGuidance(baseState): def __init__(self, agent, target): self.controller = SimpleControllerState() self.controller.jump = True self.agent = agent self.target = Vector([target[0],target[1],30]) self.start_time = agent.time self.active = True def update(self): temp_controller = SimpleControllerState(jump=True) if self.agent.time - self.start_time < self.agent.fakeDeltaTime * 10: temp_controller.jump = True elif self.agent.time - self.start_time > 0.1: temp_controller.jump = False else: temp_controller.jump = False ( temp_controller.steer, temp_controller.yaw, temp_controller.pitch, temp_controller.roll, _, ) = point_at_position(self.agent, self.target.flatten()) if self.agent.time - self.start_time > 1.2: self.active = False if self.agent.onSurface: if self.agent.time - self.start_time > 0.2: self.active = False return temp_controller class HolyGrenade(baseState): def __init__(self, agent): self.agent = agent self.active = True def update(self): return handleBounceShot(self.agent) class HolyProtector(baseState): def update(self): return ShellTime(self.agent) class AerialDefend(baseState): pass class TurnTowardsPosition(baseState): def __init__(self, agent, target, targetCode): # 0 = ball.location baseState.__init__(self, agent) self.target = target self.threshold = 1 self.targetCode = targetCode def update(self): if self.targetCode == 0: self.target = self.agent.ball.location localTarg = toLocal(self.target, self.agent.me) localAngle = correctAngle(math.degrees(math.atan2(localTarg[1], localTarg[0]))) controls = SimpleControllerState() if abs(localAngle) > self.threshold: if self.agent.forward: if localAngle > 0: controls.steer = 1 else: controls.steer = -1 controls.handbrake = True if self.agent.currentSpd < 300: controls.throttle = 0.5 else: if localAngle > 0: controls.steer = -0.5 else: controls.steer = 1 controls.handbrake = True if self.agent.currentSpd < 300: controls.throttle = -0.5 else: self.active = False return controls class Obstruct(baseState): def update(self): if not kickOffTest(self.agent): return turtleTime(self.agent) else: self.active = False self.agent.activeState = PreemptiveStrike(self.agent) return self.agent.activeState.update() """ def getKickoffPosition(vec): kickoff_locations = [[2048, 2560], [256, 3848], [0, 4608]] for i in range(len(kickoff_locations)): if kickoff_locations[i] == [abs(vec[0]),abs(vec[1])]: return i return -1 """ class Kickoff(baseState): def __init__(self, agent): self.agent = agent self.started = False self.firstFlip = False self.secondFlip = False # if agent.team == 1: # # self.finalFlipDistance = 500 # # else: self.finalFlipDistance = 750 self.active = True self.startTime = agent.time self.flipState = None def fakeKickOffChecker(self): closestToBall, bDist = findEnemyClosestToLocation( self.agent, self.agent.ball.location ) myDist = findDistance(self.agent.me.location, self.agent.ball.location) if bDist: if bDist <= myDist * 0.75: return True else: return False return False def retire(self): self.active = False self.agent.activeState = None self.flipState = None def update(self): spd = self.agent.currentSpd if self.flipState != None: if self.flipState.active: controller = self.flipState.update() if self.agent.time - self.flipState.flip_obj.flipStartedTimer <= 0.15: if spd < maxPossibleSpeed: controller.boost = True return controller if self.secondFlip: self.retire() jumping = False ballDistance = distance2D(self.agent.me.location, self.agent.ball.location) if not self.started: if not kickOffTest(self.agent): self.started = True self.startTime = self.agent.time if self.started and self.agent.time - self.startTime > 2.5: self.retire() if not self.firstFlip: if spd > 1100: self.flipState = LeapOfFaith( self.agent, 0, target=self.agent.ball.location ) self.firstFlip = True return self.flipState.update() if ballDistance > self.finalFlipDistance: destination = self.agent.ball.location if not self.firstFlip: if self.agent.me.location[0] > self.agent.ball.location[0]: destination.data[0] -= 200 else: destination.data[0] += 200 else: if self.agent.me.location[0] > self.agent.ball.location[0]: destination.data[0] -= 5 else: destination.data[0] += 5 return greedyMover(self.agent, destination) else: # if self.agent.onSurface: # if self.agent.team == 0: self.flipState = LeapOfFaith(self.agent, 0) self.secondFlip = True return self.flipState.update() # else: # ball_local = self.agent.ball.local_location # # 4 flip left, 5 flip right, # if ball_local[0] > 10: # self.flipState = LeapOfFaith(self.agent, 4) # print("flipping left") # # elif ball_local[0] < -10: # self.flipState = LeapOfFaith(self.agent, 5) # print("flipping right") # else: # self.flipState = LeapOfFaith(self.agent, 0) # print("flipping at ball") # # self.secondFlip = True # return self.flipState.update() # self.flipState = LeapOfFaith(self.agent, 0, self.agent.ball.location) # self.secondFlip = True # return self.flipState.update() class HeavenylyReprieve(baseState): def __init__(self, agent, boostloc): self.agent = agent self.boostLoc = boostloc self.active = True def update(self): result = inCornerWithBoost(self.agent) if result != False: return refuel(self.agent, result[0]) else: self.active = False return ShellTime(self.agent) # class PreemptiveStrike(baseState): # def __init__(self, agent): # self.agent = agent # self.started = False # self.firstFlip = None # self.secondFlip = None # self.active = True # self.startTime = agent.time # self.kickoff_type = getKickoffPosition(agent.me.location) # # 0 == wide diagonal, 1 == short disgonal, 2 == middle # agent.stubbornessTimer = 5 # self.onRight = True # self.short_offset = 75 # self.setup() # self.enemyGoal = Vector([0,5200 * -sign(self.agent.team),0]) # self.phase = 1 # # if agent.team == 0: # # self.KO_option = PreemptiveStrike_botpack(agent) # # else: # self.KO_option = None # # # def create_diagonal_speed_flip(self,left=False): # controls = [] # timers = [] # #jump start # first_controller = SimpleControllerState() # first_controller.jump = True # first_controller.boost = True # first_controller.throttle = 1 # controls.append(first_controller) # timers.append(0.1) # # #jump delay # second_controller = SimpleControllerState() # second_controller.jump = False # second_controller.boost = True # second_controller.throttle = 1 # if left: # yaw = -0.85 # else: # yaw = 0.85 # # pitch = -0.15 # # second_controller.yaw = yaw # second_controller.pitch = pitch # # controls.append(second_controller) # timers.append(self.agent.deltaTime*3) # # # #jump flip # third_controller = SimpleControllerState() # third_controller.jump = True # third_controller.boost = True # third_controller.throttle = 1 # # if left: # yaw = -0.85 # else: # yaw = 0.85 # # pitch = -0.15 # # third_controller.yaw = yaw # third_controller.pitch = pitch # controls.append(third_controller) # timers.append(0.5) # # action = Divine_Mandate(self.agent, controls, timers) # #print(type(action)) # return action # # # def setup(self): # #setup randomness like offsets to either side of the ball. Make sure it's slightly offset from middle so we can flip center # #setup flips # if self.kickoff_type == 0: # ball_local = localizeVector(Vector([0,0,0]),self.agent.me) # #print(ball_local) # if ball_local[1] > 0: # self.firstFlip = self.create_diagonal_speed_flip(left=True) # self.onRight = True # #print("flipping left") # else: # self.firstFlip = self.create_diagonal_speed_flip(left=False) # self.onRight = False # #print("flipping right") # # elif self.kickoff_type == 1: # if self.agent.ball.local_location[1] < 0: # self.firstFlip = self.create_diagonal_speed_flip(left=False) # self.onRight = True # self.short_offset = -50 *sign(self.agent.team) # else: # self.firstFlip = self.create_diagonal_speed_flip(left=True) # self.onRight = False # self.short_offset = 50 *sign(self.agent.team) # #print(f"on left and short offset == {self.short_offset}") # # else: # # middle kickoff defaulting to right # self.firstFlip = self.create_diagonal_speed_flip(left=True) # #self.onRight shouldn't matter # # def wide_handler(self): # #stage 1 - drive to boost pad # if self.phase == 1: # if distance2D(self.agent.me.location,self.agent.ball.location) > 2650: # return driveController(self.agent, self.agent.ball.location, # 0, # expedite=True, flippant=False, # maintainSpeed=False) # else: # self.phase = 2 # # #stage 2 - angle towards outside of ball # if self.phase == 2: # if distance2D(self.agent.me.location, self.agent.ball.location) > 2380: # return driveController(self.agent, self.enemyGoal, # 0, # expedite=True, flippant=False, # maintainSpeed=False) # else: # self.phase = 3 # #stage 3 - first flip # if self.phase == 3: # if self.firstFlip.active: # return self.firstFlip.update() # else: # self.phase = 4 # # #stage 4 - aim towards just offcenter of ball # if self.phase == 4: # if distance2D(self.agent.me.location,self.agent.ball.location) > 750: # if self.agent.me.location[0] > self.agent.ball.location[0]: # dummy_location = self.agent.ball.location + Vector([0,180*sign(self.agent.team),0]) # _direction = direction(self.enemyGoal,self.agent.ball.location) # drive_target = dummy_location + _direction.scale(distance2D(self.agent.me.location,dummy_location)*.5) # else: # dummy_location = self.agent.ball.location + Vector([0, 180 * sign(self.agent.team), 0]) # _direction = direction(self.enemyGoal, self.agent.ball.location) # drive_target = dummy_location + _direction.scale( # distance2D(self.agent.me.location, dummy_location) * .5) # # return driveController(self.agent, drive_target, # 0, # expedite=not self.agent.superSonic, flippant=False, # maintainSpeed=False) # else: # self.phase = 5 # # # #stage 5 - flip through center and end kickoff # # 4 flip left, 5 flip right # if self.phase == 5: # if self.secondFlip == None: # if self.onRight: # _code = 0 # else: # _code = 0 # # self.secondFlip = LeapOfFaith(self.agent, _code, target=None) # controls = self.secondFlip.update() # if not self.secondFlip.active: # self.retire() # return controls # # # def short_handler(self): # # stage 1 - drive to boost pad # if self.phase == 1: # drive_target = Vector([self.short_offset, sign(self.agent.team)*2850.0,0]) # if distance2D(self.agent.me.location, drive_target) > 200: # return driveController(self.agent, drive_target, # 0, # expedite=True, flippant=False, # maintainSpeed=False) # else: # self.phase = 2 # # # stage 2 - angle towards outside of ball # if self.phase == 2: # controls = SimpleControllerState() # if not self.agent.onSurface: # controls.steer, controls.yaw, controls.pitch, controls.roll, alignment_error = point_at_position( # self.agent, self.agent.ball.location) # return controls # else: # self.phase = 3 # # stage 3 - first flip # if self.phase == 3: # if self.firstFlip.active: # return self.firstFlip.update() # else: # self.phase = 4 # # # stage 4 - aim towards just offcenter of ball # if self.phase == 4: # if distance2D(self.agent.me.location, self.agent.ball.location) > 750: # if self.agent.me.location[0] > self.agent.ball.location[0]: # dummy_location = self.agent.ball.location + Vector([0, 180 * sign(self.agent.team), 0]) # _direction = direction(self.enemyGoal, self.agent.ball.location) # drive_target = dummy_location + _direction.scale( # distance2D(self.agent.me.location, dummy_location) * .5) # else: # dummy_location = self.agent.ball.location + Vector([0, 180 * sign(self.agent.team), 0]) # _direction = direction(self.enemyGoal, self.agent.ball.location) # drive_target = dummy_location + _direction.scale( # distance2D(self.agent.me.location, dummy_location) * .5) # # return driveController(self.agent, drive_target, # 0, # expedite=not self.agent.superSonic, flippant=False, # maintainSpeed=False) # else: # self.phase = 5 # # # stage 5 - flip through center and end kickoff # # 4 flip left, 5 flip right # if self.phase == 5: # if self.secondFlip == None: # if self.onRight: # _code = 0 # else: # _code = 0 # # self.secondFlip = LeapOfFaith(self.agent, _code, target=None) # controls = self.secondFlip.update() # if not self.secondFlip.active: # self.retire() # return controls # # def middle_handler(self): # # stage 1 - drive to boost pad # if self.phase == 1: # drive_target = Vector([0, sign(self.agent.team) * 4000, 0]) # if distance2D(self.agent.me.location, drive_target) > 75: # return driveController(self.agent, drive_target, # 0, # expedite=True, flippant=False, # maintainSpeed=False) # else: # self.phase = 2 # # # stage 2 - angle towards outside of ball # if self.phase == 2: # drive_target = Vector([4500*sign(self.agent.team), 0, 0]) # if distance2D(self.agent.me.location, self.agent.ball.location) > 3850: # return driveController(self.agent, drive_target, # 0, # expedite=True, flippant=False, # maintainSpeed=False) # else: # self.phase = 3 # # stage 3 - first flip # if self.phase == 3: # if self.firstFlip.active: # return self.firstFlip.update() # else: # self.phase = 4 # # # stage 4 - aim towards just offcenter of ball # if self.phase == 4: # if distance2D(self.agent.me.location, self.agent.ball.location) > 750: # if self.agent.me.location[0] > self.agent.ball.location[0]: # dummy_location = self.agent.ball.location + Vector([0, 180 * sign(self.agent.team), 0]) # _direction = direction(self.enemyGoal, self.agent.ball.location) # drive_target = dummy_location + _direction.scale( # distance2D(self.agent.me.location, dummy_location) * .5) # else: # dummy_location = self.agent.ball.location + Vector([0, 180 * sign(self.agent.team), 0]) # _direction = direction(self.enemyGoal, self.agent.ball.location) # drive_target = dummy_location + _direction.scale( # distance2D(self.agent.me.location, dummy_location) * .5) # # return driveController(self.agent, drive_target, # 0, # expedite=not self.agent.superSonic, flippant=False, # maintainSpeed=False) # else: # self.phase = 5 # # # stage 5 - flip through center and end kickoff # # 4 flip left, 5 flip right # if self.phase == 5: # if self.secondFlip == None: # if self.onRight: # _code = 0 # else: # _code = 0 # # self.secondFlip = LeapOfFaith(self.agent, _code, target=None) # controls = self.secondFlip.update() # if not self.secondFlip.active: # self.retire() # return controls # # # def retire(self): # self.active = False # self.agent.activeState = None # # def update(self): # if not self.agent.gameInfo.is_kickoff_pause: # self.retire() # # if self.KO_option != None: # if not self.KO_option.active: # self.retire() # return self.KO_option.update() # # # 0 == wide diagonal, 1 == short disgonal, 2 == middle # if self.kickoff_type == 0: # return self.wide_handler() # elif self.kickoff_type == 1: # return self.short_handler() # else: # return self.middle_handler() #class PreemptiveStrike_botpack(baseState): class PreemptiveStrike(baseState): def __init__(self, agent): self.agent = agent self.started = False self.firstFlip = False self.secondFlip = False # if agent.team == 1: # self.finalFlipDistance = 550 # else: self.finalFlipDistance = 850 # self.finalFlipDistance = 1400 self.active = True self.startTime = agent.time self.flipState = None self.kickoff_type = getKickoffPosition(agent.me.location) self.method = 0 self.setup() agent.stubbornessTimer = 5 agent.stubborness = agent.stubbornessMax agent.stubborness = agent.stubbornessMax self.maxOffset = 1300.0 self.minOffset = 900.0 self.xOffset = random.randrange(self.minOffset, self.maxOffset) def setup(self): if abs(self.agent.me.location[0]) < 257: self.method = 1 self.replacement = Kickoff(self.agent) def rightSelf(self): controller_state = SimpleControllerState() if self.agent.me.rotation[2] > 0: controller_state.roll = -1 elif self.agent.me.rotation[2] < 0: controller_state.roll = 1 if self.agent.me.rotation[0] > self.agent.velAngle: controller_state.yaw = -1 elif self.agent.me.rotation[0] < self.agent.velAngle: controller_state.yaw = 1 if self.agent.me.rotation[0] > 0: controller_state.pitch = -1 elif self.agent.me.rotation[0] < 0: controller_state.pitch = 1 controller_state.throttle = 1 return controller_state def fakeKickOffChecker(self): closestToBall, bDist = findEnemyClosestToLocation( self.agent, self.agent.ball.location ) myDist = findDistance(self.agent.me.location, self.agent.ball.location) if bDist: if bDist <= myDist * 0.75: return True else: return False return False def retire(self): self.active = False self.agent.activeState = None self.flipState = None def update(self): # print(self.agent.time - self.startTime) if self.method == 1: action = self.replacement.update() if not self.replacement.active: self.retire() return action else: spd = self.agent.currentSpd if self.flipState != None: if self.flipState.active: controller = self.flipState.update() controller.boost = True return controller if self.secondFlip: self.retire() jumping = False ballDistance = distance2D(self.agent.me.location, self.agent.ball.location) if ballDistance < 200: self.retire() if not self.started: if not kickOffTest(self.agent): self.started = True self.startTime = self.agent.time if self.started and self.agent.time - self.startTime > 2.5: self.retire() if not self.firstFlip: if spd > 1050: localBall = self.agent.ball.local_location angle = correctAngle( math.degrees(math.atan2(localBall[1], localBall[0])) ) # if self.agent.team == 0: if angle < 0: self.flipState = LeapOfFaith(self.agent, 9) else: self.flipState = LeapOfFaith(self.agent, 10) # else: # if angle > 0: # self.flipState = LeapOfFaith(self.agent, 9) # else: # self.flipState = LeapOfFaith(self.agent, 10) self.firstFlip = True controller = self.flipState.update() controller.boost = True return controller destination = self.agent.ball.location if ballDistance > self.finalFlipDistance: # destination.data[1] += -sign(self.agent.team)*100 if not self.firstFlip: # print(self.kickoff_type) if self.agent.team == 1: if self.kickoff_type == 0: if destination[0] > self.agent.me.location[0]: # print("greater than 0") destination.data[0] += self.xOffset # 1100 else: destination.data[0] -= self.xOffset # 1100 # print("less than 0") elif self.kickoff_type == 1: if destination[0] > self.agent.me.location[0]: # print("greater than 0") destination.data[0] += 900 else: destination.data[0] -= 900 # print("less than 0") elif self.kickoff_type == 2: destination.data[0] -= 750 else: if ( destination[0] > self.agent.me.location[0] or self.kickoff_type == -1 ): destination.data[0] += 1100 else: destination.data[0] -= 1100 else: if self.kickoff_type == 0: if destination[0] > self.agent.me.location[0]: # print("greater than 0") destination.data[0] += self.xOffset # 1100 else: destination.data[0] -= self.xOffset # 1100 # print("less than 0") elif self.kickoff_type == 1: if destination[0] > self.agent.me.location[0]: # print("greater than 0") destination.data[0] += 900 else: destination.data[0] -= 900 # print("less than 0") elif self.kickoff_type == 2: destination.data[0] += 750 else: if ( destination[0] > self.agent.me.location[0] or self.kickoff_type == -1 ): destination.data[0] -= 1100 else: destination.data[0] += 1100 else: if destination[0] > self.agent.me.location[0]: destination.data[0] -= 25 else: destination.data[0] += 25 controls = greedyMover(self.agent, destination) if self.firstFlip and not self.secondFlip: if self.flipState: if not self.flipState.active: if not self.agent.onSurface: controls = self.rightSelf() if spd < 2200: controls.boost = True else: controls.boost = False return controls else: if self.agent.onSurface: # if self.agent.team == 0: self.flipState = LeapOfFaith(self.agent, 0) self.secondFlip = True return self.flipState.update() # else: # ball_local = self.agent.ball.local_location # #4 flip left, 5 flip right, # if ball_local[0] > 10: # self.flipState = LeapOfFaith(self.agent, 4) # print("flipping left") # # elif ball_local[0] < -10: # self.flipState = LeapOfFaith(self.agent, 5) # print("flipping right") # else: # self.flipState = LeapOfFaith(self.agent, 0) # print("flipping at ball") # # self.secondFlip = True # return self.flipState.update() else: controls = self.rightSelf() if spd < maxPossibleSpeed: controls.boost = True if ballDistance < 150: self.retire() return controls class DivineGrace(baseState): def update(self): controller_state = SimpleControllerState() controller_state.throttle = 1 vel_local = matrixDot(self.agent.me.matrix, self.agent.me.velocity.flatten()) ( controller_state.steer, controller_state.yaw, controller_state.pitch, controller_state.roll, __, ) = match_vel(self.agent, vel_local) if self.agent.onSurface or self.agent.me.location[1] <= self.agent.recovery_height: self.active = False return controller_state class catchTesting(baseState): def update(self): return catch_ball(self.agent) # class WardAgainstEvil(baseState): # def __init__(self, agent): # self.agent = agent # self.active = True # self.timeCreated = self.agent.time # # def update(self): # # print(f"We're too scared! {self.agent.time}") # return scaredyCat(self.agent) class WardAgainstEvil(baseState): def __init__(self, agent): self.agent = agent self.active = True def update(self): if goalie_shot(self.agent,self.agent.currentHit): return ShellTime(self.agent) else: return gate(self.agent) class BlessingOfDexterity(baseState): def __init__(self, agent): self.agent = agent self.active = True self.firstJump = False self.secondJump = False self.jumpStart = 0 self.timeCreated = self.agent.time def update(self): controller_state = SimpleControllerState() controller_state.throttle = -1 if not self.firstJump: controller_state.jump = True controller_state.pitch = 1 self.firstJump = True self.jumpStart = self.agent.time return controller_state elif self.firstJump and not self.secondJump: jumpTimer = self.agent.time - self.jumpStart controller_state.pitch = 1 controller_state.jump = False if jumpTimer < 0.12: controller_state.jump = True if jumpTimer > 0.15: controller_state.jump = True self.jumpStart = self.agent.time self.secondJump = True return controller_state elif self.firstJump and self.secondJump: timer = self.agent.time - self.jumpStart if timer < 0.15: controller_state.pitch = 1 else: controller_state.pitch = -1 controller_state.roll = 1 if timer > 0.8: controller_state.roll = 0 if timer > 1.15: self.active = False return controller_state else: agent.log.append( "halfFlip else conditional called in update. This should not be happening" ) class Chase(baseState): def __init__(self, agent): self.agent = agent self.active = True def update(self): if not kickOffTest(self.agent): return efficientMover(self.agent, self.agent.ball, self.agent.maxSpd) else: self.active = False self.agent.activeState = PreemptiveStrike(self.agent) return self.agent.activeState.update() class HeetSeekerDefense(baseState): def update(self): return goFarPost(self.agent) class Goalie(baseState): def update(self): distMin = 2000 if self.agent.ignore_kickoffs: distMin = 3000 if ( distance2D( Vector([0, 5200 * sign(self.agent.team), 0]), self.agent.ball.location ) < distMin or distance2D( Vector([0, 5200 * sign(self.agent.team), 0]), self.agent.currentHit.pred_vector ) < distMin ): return ShellTime(self.agent) offensive = sign(self.agent.team) * self.agent.ball.location[1] < 0 if offensive and self.agent.me.boostLevel < self.agent.boostThreshold: return backmanBoostGrabber(self.agent) return gate(self.agent,hurry=False) class BlessingOfSafety(baseState): def update(self): distMin = 1500 offensive = sign(self.agent.team) * self.agent.ball.location[1] < 0 if self.agent.rotationNumber == 1: return ShellTime(self.agent) if ( distance2D( Vector([0, 5200 * sign(self.agent.team), 0]), self.agent.ball.location ) < distMin or distance2D( Vector([0, 5200 * sign(self.agent.team), 0]), self.agent.currentHit.pred_vector ) < distMin ): #return ShellTime(self.agent,retreat_enabled=self.agent.me.location == self.agent.lastMan) #retreat_enabled=self.agent.me.location != self.agent.lastMan return ShellTime(self.agent) else: if True: if (self.agent.rotationNumber == 2): if len(self.agent.allies) > 0: #if self.agent.team !=0 or self.agent.lastMan != self.agent.me.location: if self.agent.lastMan != self.agent.me.location: return secondManPositioning(self.agent) else: return thirdManPositioning(self.agent) return playBack(self.agent,buffer = 4000) else: return thirdManPositioning(self.agent) # def update(self): # if self.agent.team == 0: # return self.update_old() # # distMin = 2000 # # offensive = self.agent.ball.location[1] * -sign(self.agent.team) > 1000 # # if offensive: # if self.agent.rotationNumber == 2: # if self.agent.me.location[1] != self.agent.lastManY: # return secondManPositioning(self.agent) # else: # if len(self.agent.allies) >= 2: # return thirdManPositioning(self.agent) # else: # if self.agent.rotationNumber == 2: # if self.agent.me.location[1] != self.agent.lastManY: # return playBack(self.agent,buffer=2000) # else: # return playBack(self.agent, buffer=3500) # # return playBack(self.agent, buffer=3000) class DivineAssistance(baseState): def update(self): return secondManSupport(self.agent) def halfFlipStateManager(agent): if agent.activeState.active == False: agent.activeState = BlessingOfDexterity(agent) else: if type(agent.activeState) != BlessingOfDexterity: agent.activeState = BlessingOfDexterity(agent) class soloDefense(baseState): def update(self): if ( distance2D( Vector([0, 5200 * sign(self.agent.team), 200]), convertStructLocationToVector(self.agent.selectedBallPred), ) < 1500 ): return ShellTime(self.agent) else: return playBack(self.agent) class ScaleTheWalls(baseState): def update(self): return handleWallShot(self.agent) class AngelicEmbrace(baseState): def update(self): # return carry_flick(self.agent,cradled = True) return carry_flick_new(self.agent, cradled=True) # return newCarry(self.agent) class Holy_Shield(baseState): def update(self): return defensive_posture(self.agent) class emergencyDefend(baseState): def update(self): penetrationPosition = convertStructLocationToVector(self.agent.goalPred) penetrationPosition.data[1] = 5350 * sign(self.agent.team) if self.agent.goalPred.game_seconds - self.agent.gameInfo.seconds_elapsed > 0.1: if distance2D(self.agent.me.location, penetrationPosition) > 100: return testMover(self.agent, penetrationPosition, 2300) else: if penetrationPosition[2] > 300: self.activeState = LeapOfFaith(self.agent, -1) return self.activeState.update() else: self.activeState = LeapOfFaith(self.agent, 0) return self.activeState.update() def parseCarInfo(carList, index, _max=False): val = 0 best = None for each in carList: if _max: if each[index] > val: best = each val = each[index] else: if each[index] < val: best = each val = each[index] return best def aerialStateManager(agent): center = Vector([0, 5500 * -sign(agent.team), 200]) if agent.ball.location[2] < 110: car_state = CarState( physics=Physics( velocity=Vector3(z=0, x=0, y=0), location=Vector3(0, 0, 17.1) ) ) ball_state = BallState( physics=Physics( velocity=Vector3( z=1550, x=random.randrange(-1500, 1500), y=random.randrange(-1500, 1500), ), location=Vector3(0, 0, 350), ) ) game_state = GameState(cars={agent.index: car_state}, ball=ball_state) agent.set_game_state(game_state) agent.activeState = None if type(agent.activeState) != Wings_Of_Justice or not agent.activeState.active: pred = agent.ballPred.slices[0] for i in range(0, agent.ballPred.num_slices): if i > 60 and i % 3 != 0: continue pred = agent.ballPred.slices[i] tth = pred.game_seconds - agent.gameInfo.seconds_elapsed if tth <= 0: continue if agent.onSurface: if pred.physics.location.z < 300: continue pred_vec = convertStructLocationToVector(pred) if findDistance(agent.me.location, pred_vec) < 2300 * tth: _direction = direction(center, pred_vec).flatten() positioningOffset = 90 aim_loc = pred_vec - _direction.scale(90) tempAerial = Wings_Of_Justice(agent, pred, aim_loc, tth) if tempAerial.active: break if tempAerial.active: agent.activeState = tempAerial def demoTest(agent): targ = findEnemyClosestToLocation(agent, agent.ball.location)[0] return demoEnemyCar(agent, targ) def twos_manager(agent): agentType = type(agent.activeState) if agentType != PreemptiveStrike: if not kickOffTest(agent): myGoalLoc = Vector([0, 5200 * sign(agent.team), 200]) ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball) carDistanceFromGoal = distance2D(myGoalLoc, agent.me) if agentType == LeapOfFaith: if agent.activeState.active != False: return if agentType == Divine_Mandate: if agent.activeState.active != False: return if agentType == airLaunch: if agent.activeState.active != False: return if agentType == BlessingOfDexterity: if agent.activeState.active != False: return if agentType == Wings_Of_Justice: if agent.activeState.active != False: return if agentType == DivineGrace: if agent.activeState.active != False: return if agentType == RighteousVolley: if agent.activeState.active != False: return fastesthit = find_soonest_hit(agent) hit = fastesthit openNet = openGoalOpportunity(agent) agent.openGoal = openNet agent.timid = False scared = False tempDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed if tempDelay >= agent.enemyBallInterceptDelay - agent.contestedTimeLimit: if agent.enemyAttacking: agent.contested = True if ( distance2D(hit.pred_vector, myGoalLoc) <= 2000 or distance2D(agent.enemyTargetVec, myGoalLoc) <= 2000 or ballDistanceFromGoal <= 2000 ): if agent.enemyAttacking: agent.contested = True agent.timid = False scared = False if hit.hit_type == 5: if agentType != Wings_Of_Justice: agent.activeState = hit.aerialState return if not agent.onSurface: if agent.me.location[2] > agent.recovery_height: if agentType != DivineGrace: agent.activeState = DivineGrace(agent) return else: agent.activeState = PreemptiveStrike(agent) def team_synergy(agent): agentType = type(agent.activeState) if agentType != PreemptiveStrike: if not kickOffTest(agent): if locked_in(agent, agentType): return my_goal = Vector([0, 5200 * sign(agent.team), 200]) inclusive_team = agent.allies[:] inclusive_team.append(agent.me) inclusive_team = sorted(inclusive_team, key=lambda x: x.index) ballDistanceFromGoal = distance2D(my_goal, agent.ball.location) carDistanceFromGoal = distance2D(my_goal, agent.me.location) current_ball_position = agent.ball.location offensive = current_ball_position[1] * sign(agent.team) > 0 team_info = [] if agent.dribbling: if agentType != AngelicEmbrace: agent.activeState = AngelicEmbrace(agent) return for tm in inclusive_team: # if agent.team == 1: if tm.location[1] * sign(agent.team) > current_ball_position[1] * sign( agent.team ): dist = distance2D(tm.location, current_ball_position) # if offensive: # if player_retreat_status(tm,agent.team): # dist+=1500 # if agent.ball.location[0] > 1000: # if tm.location[0] >= agent.ball.location[0]: # dist = clamp(dist, 0, dist - 1000) # elif agent.ball.location[0] < -1000: # if tm.location[0] <= agent.ball.location[0]: # dist = clamp(dist, 0, dist - 1000) else: dist = distance2D(tm.location, my_goal) * 2 team_info.append((tm, dist)) rotations = sorted(team_info, key=lambda x: x[1]) if agent.me.location == rotations[0][0].location: agent.rotationNumber = 1 elif agent.me.location == rotations[1][0].location: agent.rotationNumber = 2 else: agent.rotationNumber = 3 # if agent.hits[4] != None: # print(f"agent {agent.index} found an aerial target! {agent.time}") if agent.rotationNumber != 1 and agent.rotationNumber != 2: if agent.hits[4] != None: agent.currentHit = agent.hits[4] agent.ballDelay = agent.currentHit.time_difference() if agentType != Wings_Of_Justice: agent.activeState = agent.hits[4].aerialState # .create_copy() # agent.log.append(f"Going for aerial! {agent.time}") return agent.currentHit = find_soonest_hit(agent) agent.ballDelay = agent.currentHit.time_difference() if agentType == DivineGrace: if agent.activeState.active != False: return if not agent.onSurface: if agent.me.location[2] > agent.recovery_height: if agentType != DivineGrace: agent.activeState = DivineGrace(agent) return if agentType != BlessingOfSafety: agent.activeState = BlessingOfSafety(agent) return boostOpportunity = inCornerWithBoost(agent) if boostOpportunity != False: if agent.me.boostLevel <= 50: getBoost = False if agent.team == 0: if boostOpportunity[1] == 0 or boostOpportunity[1] == 1: getBoost = True else: if boostOpportunity[1] == 2 or boostOpportunity[1] == 3: getBoost = True if getBoost: if agentType != HeavenylyReprieve: agent.activeState = HeavenylyReprieve( agent, boostOpportunity[0] ) return if agent.rotationNumber == 2: if agent.hits[4] != None: agent.currentHit = agent.hits[4] agent.ballDelay = agent.currentHit.time_difference() if agentType != Wings_Of_Justice: agent.activeState = agent.hits[4].aerialState # .create_copy() # agent.log.append(f"Going for aerial! {agent.time}") return else: agent.currentHit = find_soonest_hit(agent) agent.ballDelay = agent.currentHit.time_difference() if agentType == DivineGrace: if agent.activeState.active != False: return if not agent.onSurface: if agent.me.location[2] > agent.recovery_height: if agentType != DivineGrace: agent.activeState = DivineGrace(agent) return if agentType != BlessingOfSafety: agent.activeState = BlessingOfSafety(agent) return fastesthit = find_soonest_hit(agent) hit = fastesthit openNet = openGoalOpportunity(agent) agent.openGoal = openNet tempDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed if tempDelay >= agent.enemyBallInterceptDelay - agent.contestedTimeLimit: if agent.enemyAttacking: agent.contested = True if hit.hit_type == 5: # print(f"going for aerial {agent.time}") if agentType != Wings_Of_Justice: agent.activeState = hit.aerialState # .create_copy() # agent.log.append(f"Going for aerial! {agent.time}") return if agentType == DivineGrace: if agent.activeState.active != False: return if not agent.onSurface: if agent.me.location[2] > agent.recovery_height: if agentType != DivineGrace: agent.activeState = DivineGrace(agent) return if butterZone(hit.pred_vector): agent.contested = True agent.enemyAttacking = True if agent.goalPred != None: agent.contested = True agent.enemyAttacking = True goalward = ballHeadedTowardsMyGoal_testing(agent, hit) agent.goalward = goalward # if not agent.contested and not goalward: # if hit.hit_type == 4: # if agent.hits[1] != None: # if not butterZone(hit.pred_vector): # temptime = agent.hits[1].prediction_time - agent.time # if ( # temptime # < agent.enemyBallInterceptDelay # - agent.contestedTimeLimit # ): # hit = agent.hits[1] # # elif hit.hit_type == 1: # if agent.hits[0] != None: # if not butterZone(hit.pred_vector): # if agent.me.boostLevel > 30: # temptime = agent.hits[0].prediction_time - agent.time # if ( # temptime # < agent.enemyBallInterceptDelay # - agent.contestedTimeLimit # ): # hit = agent.hits[0] if not agent.contested: if hit.hit_type == 4: if agent.hits[1] != None: if hit.pred_vel[1] * -sign(agent.team) >= 1: if not butterZone(hit.pred_vector): temptime = agent.hits[1].prediction_time - agent.time if ( temptime < agent.enemyBallInterceptDelay - agent.contestedTimeLimit ): hit = agent.hits[1] if hit.hit_type == 1: if agent.hits[0] != None: if agent.hits[0].pred_vel[1] * -sign(agent.team) >= 1: if not butterZone(hit.pred_vector): if agent.me.boostLevel > 30: temptime = ( agent.hits[0].prediction_time - agent.time ) if ( temptime < agent.enemyBallInterceptDelay - agent.contestedTimeLimit ): hit = agent.hits[0] if hit.hit_type == 5: # print(f"going for aerial {agent.time}") if agentType != Wings_Of_Justice: agent.activeState = hit.aerialState # .create_copy() # agent.log.append(f"Going for aerial! {agent.time}") return if carDistanceFromGoal > ballDistanceFromGoal: if agentType != HolyProtector: agent.activeState = HolyProtector(agent) return agent.currentHit = hit agent.ballDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed # if agent.team == 1: # catchViable = ballCatchViable(agent) # else: catchViable = False if goalward: if hit.hit_type != 2: if agentType != HolyProtector: agent.activeState = HolyProtector(agent) return else: if agentType != ScaleTheWalls: agent.activeState = ScaleTheWalls(agent) return else: if catchViable: if not agent.dribbling: agent.currentHit = agent.hits[1] agent.ballDelay = agent.currentHit.time_difference() if agent.activeState != Celestial_Arrest: agent.activeState = Celestial_Arrest(agent) return if hit.hit_type == 0: # hit.pred_vector[2] <= agent.groundCutOff: if agentType != GroundAssault: agent.activeState = GroundAssault(agent) return elif hit.hit_type == 1: if agentType != HolyGrenade: agent.activeState = HolyGrenade(agent) return elif hit.hit_type == 4: if agentType != HolyGrenade: agent.activeState = HolyGrenade(agent) # print("would have been wallshot before") return elif hit.hit_type == 2: if agentType != ScaleTheWalls: agent.activeState = ScaleTheWalls(agent) return else: agent.log.append(f"condition leaked through! {hit.hit_type}") else: agent.activeState = PreemptiveStrike(agent) def newTeamStateManager(agent): agentType = type(agent.activeState) if agentType != PreemptiveStrike: if not kickOffTest(agent): myGoalLoc = Vector([0, 5200 * sign(agent.team), 200]) enemyGoalLoc = Vector([0, 5200 * -sign(agent.team), 200]) ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball.location) carDistanceFromGoal = distance2D(myGoalLoc, agent.me.location) if locked_in(agent, agentType): return fastesthit = agent.sorted_hits[0] #find_soonest_hit(agent) hit = fastesthit openNet = openGoalOpportunity(agent) agent.openGoal = openNet agent.timid = False scared = False tempDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed # if not agent.dribbling: # agent.enemyAttacking = True if tempDelay >= agent.enemyBallInterceptDelay - agent.contestedTimeLimit: if agent.enemyAttacking: agent.contested = True # agent.enemyAttacking = True if agent.goalPred != None: agent.contested = True agent.enemyAttacking = True if butterZone(hit.pred_vector): agent.contested = True agent.enemyAttacking = True if hit.hit_type == 5: # print(f"going for aerial {agent.time}") if not agent.onSurface: if agentType != Wings_Of_Justice: agent.activeState = hit.aerialState # .create_copy() # agent.log.append(f"Going for aerial! {agent.time}") return if agentType == DivineGrace: if agent.activeState.active != False: return if not agent.onSurface: if agent.me.location[2] > agent.recovery_height: if agentType != DivineGrace: agent.activeState = DivineGrace(agent) return lastMan = agent.lastMan #catchViable = ballCatchViable(agent) catchViable = False # if agent.team == 1: # catchViable = ballCatchViable(agent) inclusive_team = agent.allies[:] inclusive_team.append(agent.me) inclusive_team = sorted(inclusive_team, key=lambda x: x.index) offensive = agent.ball.location[1] * -sign(agent.team) > 0 if agent.team ==3: #if True: rotations = assign_rotations(inclusive_team, agent.ball.location, lastMan) if agent.me.location == rotations[0].location: man = 1 elif agent.me.location == rotations[1].location: man = 2 else: man = 3 #agent.rotationNumber=man else: man = 1 if agent.me.location[1] * sign(agent.team) < hit.pred_vector[1] * sign( agent.team ): if agent.me.location != lastMan: #if hit.pred_vector[1] * sign(agent.time) < 4000: man = len(agent.allies) + 1 if offensive: if retreating_tally(agent.allies) != len(agent.allies): if agent.me.retreating: if agent.me.location != lastMan: if distance2D(hit.pred_vector, myGoalLoc) > 2000: man = len(agent.allies) + 1 if man != len(agent.allies) + 1: myDist = distance2D(agent.me.location, agent.ball.location) for ally in agent.allies: if not ally.demolished: if ally.location[1] * sign(agent.team) > agent.ball.location[1] * sign(agent.team): allyDist = distance2D(ally.location, agent.ball.location) if allyDist < myDist: if not ally.retreating: man += 1 man = clamp(3, 1, man) if False: #if not agent.contested and agent.lastMan != agent.me.location and man == 1 and hit.hit_type != 0 and agent.goalPred == None and not ballHeadedTowardsMyGoal_testing(agent, hit) and not agent.ignore_kickoffs:# and agent.team == 1: chrono_hits = agent.sorted_hits prev_hit = hit for h in chrono_hits: # if h.time_difference() < 1: # break if h.hit_type == 5: continue if distance2D(h.pred_vector,enemyGoalLoc) >= distance2D(agent.me.location,enemyGoalLoc): break if h.pred_vel[1] * -sign(agent.team) >= 1: if not butterZone(prev_hit.pred_vector): temptime = h.time_difference() if ( temptime < agent.enemyBallInterceptDelay - agent.contestedTimeLimit ): hit = h else: break else: break prev_hit = h hit = prev_hit agent.ballDelay = hit.time_difference() if man == 2: if agent.lastMan != agent.me.location: if hit.pred_vector[1]* -sign(agent.team) > 4000 * -sign(agent.team): if butterZone(hit.pred_vector): if hit.time_difference() < agent.enemyBallInterceptDelay or (hit.time_difference() < 2 and agent.lastMan[1] * sign(agent.team) > 0 and agent.team == 0): man = 1 agent.log.append( f"risking it for the biscuit! {agent.time} {agent.team}" ) agent.rotationNumber = man goalward = ballHeadedTowardsMyGoal_testing(agent, hit) agent.goalward = goalward agent.currentHit = hit agent.ballDelay = hit.time_difference() agent.ballGrounded = False if hit.hit_type == 2: agent.wallShot = True agent.ballGrounded = False else: agent.wallShot = False if hit.hit_type == 1: if hit.pred_vector[2] <= agent.groundCutOff: agent.ballGrounded = True else: agent.ballGrounded = False createBox(agent, hit.pred_vector) if agent.dribbling: if agentType != AngelicEmbrace: agent.activeState = AngelicEmbrace(agent) return boostOpportunity = inCornerWithBoost(agent) if boostOpportunity != False: if agent.me.boostLevel <= 50: getBoost = False if agent.team == 0: if boostOpportunity[1] == 0 or boostOpportunity[1] == 1: getBoost = True else: if boostOpportunity[1] == 2 or boostOpportunity[1] == 3: getBoost = True if getBoost: if agentType != HeavenylyReprieve: agent.activeState = HeavenylyReprieve( agent, boostOpportunity[0] ) return if agent.ignore_kickoffs: if distance2D(hit.pred_vector, myGoalLoc) > 3000: if agent.activeState != HeetSeekerDefense: agent.activeState = HeetSeekerDefense(agent) return if agent.goalie: if agent.activeState != Goalie: agent.activeState = Goalie(agent) return if man == 1: if catchViable: if not agent.dribbling: #if agent.hits[1].pred_vel[1] * -sign(agent.team) >= 1: agent.currentHit = agent.hits[1] agent.ballDelay = agent.currentHit.time_difference() if agent.activeState != Celestial_Arrest: agent.activeState = Celestial_Arrest(agent) return if carDistanceFromGoal > ballDistanceFromGoal: if agentType != HolyProtector: agent.activeState = HolyProtector(agent) return # if agent.contested and agent.enemyBallInterceptDelay +.2 < hit.time_difference() and agent.goalPred == None: # if agent.team == 1: # if agentType != Holy_Shield: # agent.activeState = Holy_Shield(agent) # return if goalward: if hit.hit_type != 2: if agentType != HolyProtector: agent.activeState = HolyProtector(agent) return else: if agentType != ScaleTheWalls: agent.activeState = ScaleTheWalls(agent) return else: if hit.hit_type == 0: # hit.pred_vector[2] <= agent.groundCutOff: if agentType != GroundAssault: agent.activeState = GroundAssault(agent) return elif hit.hit_type == 1: if agentType != HolyGrenade: agent.activeState = HolyGrenade(agent) return elif hit.hit_type == 4: if agentType != HolyGrenade: agent.activeState = HolyGrenade(agent) # print("would have been wallshot before") return elif hit.hit_type == 2: if agentType != ScaleTheWalls: agent.activeState = ScaleTheWalls(agent) return elif hit.hit_type == 5: if agentType != Wings_Of_Justice: agent.activeState = hit.aerialState # .create_copy() # agent.log.append(f"Going for aerial! {agent.time}") return else: agent.log.append(f"condition leaked through! {hit.hit_type}") else: #if agent.team == 0: # if agent.ball.location[1] * sign(agent.team) >= 0: # if agent.lastMan == agent.me.location: # if agentType != WardAgainstEvil: # agent.activeState = WardAgainstEvil(agent) # return if agentType != BlessingOfSafety: agent.activeState = BlessingOfSafety(agent) return else: agent.activeState = PreemptiveStrike(agent) # def newTeamStateManager(agent): # agentType = type(agent.activeState) # if agentType != PreemptiveStrike: # # if not kickOffTest(agent): # myGoalLoc = Vector([0, 5200 * sign(agent.team), 200]) # enemyGoalLoc = Vector([0, 5200 * -sign(agent.team), 200]) # # ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball.location) # carDistanceFromGoal = distance2D(myGoalLoc, agent.me.location) # # if locked_in(agent, agentType): # return # # fastesthit = find_soonest_hit(agent) # hit = fastesthit # # openNet = openGoalOpportunity(agent) # agent.openGoal = openNet # agent.timid = False # scared = False # tempDelay = hit.prediction_time - agent.gameInfo.seconds_elapsed # # if not agent.dribbling: # # agent.enemyAttacking = True # # if tempDelay >= agent.enemyBallInterceptDelay - agent.contestedTimeLimit: # if agent.enemyAttacking: # agent.contested = True # # agent.enemyAttacking = True # # if agent.goalPred != None: # agent.contested = True # agent.enemyAttacking = True # # if butterZone(hit.pred_vector): # agent.contested = True # agent.enemyAttacking = True # # if hit.hit_type == 5: # # print(f"going for aerial {agent.time}") # if not agent.onSurface: # if agentType != Wings_Of_Justice: # agent.activeState = hit.aerialState # .create_copy() # # agent.log.append(f"Going for aerial! {agent.time}") # return # # if agentType == DivineGrace: # if agent.activeState.active != False: # return # # if not agent.onSurface: # if agent.me.location[2] > 220: # if agentType != DivineGrace: # agent.activeState = DivineGrace(agent) # return # # lastMan = agent.lastMan # # determine which man in rotation I am #1, #2, #3, forward # man = 1 # # if agent.me.location[1] * sign(agent.team) < agent.ball.location[1] * sign(agent.team): # if agent.me.location[1] * sign(agent.team) < hit.pred_vector[1] * sign( # agent.team # ): # if agent.me.location != lastMan: # man = len(agent.allies) + 1 # offensive = agent.ball.location[1] * -sign(agent.team) > 0 # if offensive: # if retreating_tally(agent.allies) != len(agent.allies): # if agent.me.retreating: # if agent.me.location != lastMan: # if distance2D(hit.pred_vector, myGoalLoc) > 2000: # man = len(agent.allies) + 1 # # if man != len(agent.allies) + 1: # # myDist = distance2D(agent.me.location, agent.ball.location) # for ally in agent.allies: # if not ally.demolished: # # if not offensive: # # if ally.location == lastMan: # # if agent.team == 0: # # continue # if ally.location[1] * sign(agent.team) > agent.ball.location[1] * sign(agent.team): # allyDist = distance2D(ally.location, agent.ball.location) # if allyDist < myDist: # #if ally.location != agent.lastMan and agent.ball.location[1] * sign(agent.team) < 0: # if not ally.retreating: # #if agent.ball.location[1] * -sign(agent.team) < 0: # man += 1 # # man = clamp(3, 1, man) # # # if man == 1 or man == 2: # # if hit.hit_type == 5: # # # print(f"going for aerial {agent.time}") # # if agentType != Wings_Of_Justice: # # agent.activeState = hit.aerialState # .create_copy() # # # agent.log.append(f"Going for aerial! {agent.time}") # # return # # # if agent.team == 1: # # print(agent.index,man) # catchViable = False # # if agent.team == 1: # # catchViable = False # # else: # # catchViable = ballCatchViable(agent) # #if agent.team == 0: # #if True: # if not agent.contested and agent.lastMan != agent.me.location and man == 1 and agent.team == 0: # chrono_hits = SortHits(agent.hits) # prev_hit = hit # for h in chrono_hits: # if h.time_difference() < 1: # break # # if distance2D(h.pred_vector,enemyGoalLoc) >= distance2D(agent.me.location,enemyGoalLoc): # break # if h.pred_vel[1] * -sign(agent.team) >= 1: # if not butterZone(prev_hit.pred_vector): # temptime = h.time_difference() # if ( # temptime # < agent.enemyBallInterceptDelay # - agent.contestedTimeLimit # ): # hit = h # else: # break # else: # break # prev_hit = h # # hit = prev_hit # agent.ballDelay = hit.time_difference() # # # print(f"bot: {agent.index} man: {man} {agent.time}") # # if man != 1: # if man < len(agent.allies): # if hit.pred_vector[1] < 4000 * -sign(agent.team): # if butterZone(hit.pred_vector): # if hit.time_difference() < agent.enemyBallInterceptDelay: # man = 1 # agent.log.append( # f"risking it for the biscuit! {agent.time} {agent.index}" # ) # # agent.rotationNumber = man # # goalward = ballHeadedTowardsMyGoal_testing(agent, hit) # agent.goalward = goalward # agent.currentHit = hit # agent.ballDelay = hit.time_difference() # agent.ballGrounded = False # # if hit.hit_type == 2: # agent.wallShot = True # agent.ballGrounded = False # else: # agent.wallShot = False # if hit.hit_type == 1: # if hit.pred_vector[2] <= agent.groundCutOff: # agent.ballGrounded = True # else: # agent.ballGrounded = False # # createBox(agent, hit.pred_vector) # # if agent.dribbling: # if agentType != AngelicEmbrace: # agent.activeState = AngelicEmbrace(agent) # return # # boostOpportunity = inCornerWithBoost(agent) # if boostOpportunity != False: # if agent.me.boostLevel <= 50: # getBoost = False # if agent.team == 0: # if boostOpportunity[1] == 0 or boostOpportunity[1] == 1: # getBoost = True # else: # if boostOpportunity[1] == 2 or boostOpportunity[1] == 3: # getBoost = True # if getBoost: # if agentType != HeavenylyReprieve: # agent.activeState = HeavenylyReprieve( # agent, boostOpportunity[0] # ) # return # # if agent.team == 0 and man == 1 or (agent.team == 1 and man == 1 and agent.ball.location[1] * sign(agent.team) < 0 and agent.lastMan != agent.me.location): # # if catchViable: # if not agent.dribbling: # if agent.hits[1].pred_vel[1] * -sign(agent.team) >= 1: # agent.currentHit = agent.hits[1] # agent.ballDelay = agent.currentHit.time_difference() # if agent.activeState != Celestial_Arrest: # agent.activeState = Celestial_Arrest(agent) # return # # if carDistanceFromGoal > ballDistanceFromGoal: # if agentType != HolyProtector: # agent.activeState = HolyProtector(agent) # return # # if goalward: # if hit.hit_type != 2: # if agentType != HolyProtector: # agent.activeState = HolyProtector(agent) # return # else: # if agentType != ScaleTheWalls: # agent.activeState = ScaleTheWalls(agent) # return # # else: # # if hit.hit_type == 0: # hit.pred_vector[2] <= agent.groundCutOff: # if agentType != GroundAssault: # agent.activeState = GroundAssault(agent) # return # # elif hit.hit_type == 1: # if agentType != HolyGrenade: # agent.activeState = HolyGrenade(agent) # return # # elif hit.hit_type == 4: # if agentType != HolyGrenade: # agent.activeState = HolyGrenade(agent) # # print("would have been wallshot before") # return # # elif hit.hit_type == 2: # if agentType != ScaleTheWalls: # agent.activeState = ScaleTheWalls(agent) # return # # elif hit.hit_type == 5: # if agentType != Wings_Of_Justice: # agent.activeState = hit.aerialState # .create_copy() # # agent.log.append(f"Going for aerial! {agent.time}") # return # # else: # agent.log.append(f"condition leaked through! {hit.hit_type}") # # else: # #if agent.team == 0: # # if agent.ball.location[1] * sign(agent.team) >= 0: # # if agent.lastMan == agent.me.location: # # if agentType != WardAgainstEvil: # # agent.activeState = WardAgainstEvil(agent) # # return # # # if agentType != BlessingOfSafety: # agent.activeState = BlessingOfSafety(agent) # return # # else: # agent.activeState = PreemptiveStrike(agent) def soloStateManager(agent): agentType = type(agent.activeState) if agentType != PreemptiveStrike: if not kickOffTest(agent): myGoalLoc = Vector([0, 5200 * sign(agent.team), 200]) ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball) carDistanceFromGoal = distance2D(myGoalLoc, agent.me) enemyGoalLoc = Vector([0, 5200 * -sign(agent.team), 200]) # agent.resetTimer += agent.deltaTime if agentType == LeapOfFaith: if agent.activeState.active != False: return if agentType == airLaunch: if agent.activeState.active != False: return if agentType == BlessingOfDexterity: if agent.activeState.active != False: return if agentType == DivineGrace: if agent.activeState.active != False: return if agentType == RighteousVolley: if agent.activeState.active != False: return hit = find_soonest_hit(agent) openNet = openGoalOpportunity(agent) agent.openGoal = openNet agent.timid = False scared = False tempDelay = hit.prediction_time - agent.time # print(tempDelay) if tempDelay >= agent.enemyBallInterceptDelay - 0.5: if agent.enemyAttacking: agent.contested = True if tempDelay >= agent.enemyBallInterceptDelay + 1: if not butterZone(hit.pred_vector): if ballDistanceFromGoal <= 5000: agent.timid = True else: scared = True # print(tempDelay,agent.enemyBallInterceptDelay) # pass if ( distance2D(hit.pred_vector, myGoalLoc) <= 2000 or distance2D(agent.enemyTargetVec, myGoalLoc) <= 2000 ): agent.contested = True agent.timid = False scared = False # if not agent.contested or not agent.enemyAttacking: # if agent.hits[0] != None: # temptime = ( # agent.hits[0].prediction_time - agent.gameInfo.seconds_elapsed # ) # # if temptime >=1: # if hit.hit_type != 2: # # if temptime < agent.enemyBallInterceptDelay - .5: # hit = agent.hits[0] #if False: if not agent.contested: chrono_hits = agent.sorted_hits prev_hit = hit for h in chrono_hits: if h.time_difference() < 1: break if h.hit_type == 5: continue if distance2D(h.pred_vector,enemyGoalLoc) >= distance2D(agent.me.location,enemyGoalLoc): break if h.pred_vel[1] * -sign(agent.team) >= 1: if not butterZone(prev_hit.pred_vector): temptime = h.time_difference() if ( temptime < agent.enemyBallInterceptDelay - agent.contestedTimeLimit ): hit = h else: break else: break prev_hit = h hit = prev_hit agent.ballDelay = hit.time_difference() goalward = ballHeadedTowardsMyGoal_testing(agent, hit) agent.goalward = goalward agent.currentHit = hit agent.ballDelay = hit.prediction_time - agent.time agent.ballGrounded = False # print(agent.ballDelay, agent.enemyBallInterceptDelay,agent.contested,agent.timid) if hit.hit_type == 2: agent.wallShot = True agent.ballGrounded = False else: agent.wallShot = False if hit.hit_type == 1: if hit.pred_vector[2] <= agent.groundCutOff: agent.ballGrounded = True else: agent.ballGrounded = False createBox(agent, hit.pred_vector) if agentType == Wings_Of_Justice: if agent.activeState.active != False: return if not agent.onSurface: if agent.me.location[2] > agent.recovery_height: if agentType != DivineGrace: agent.activeState = DivineGrace(agent) return if agent.dribbling: if not goalward: if agentType != AngelicEmbrace: agent.activeState = AngelicEmbrace(agent) return # else: # agent.resetTimer += agent.deltaTime # if agent.resetTimer >= 5: # agent.resetTimer = 0 # print("setting up dribble training") # #game_state = GameState() # #self.set_game_state(game_state) # ball_state = BallState(Physics(location=Vector3(agent.me.location[0], agent.me.location[1], agent.me.location[2]+160),velocity=Vector3(agent.me.velocity[0],agent.me.velocity[1],agent.me.velocity[2]))) # game_state = GameState(ball=ball_state) # agent.set_game_state(game_state) # if agentType != AngelicEmbrace: # agent.activeState = AngelicEmbrace(agent) # return # if agent.timid or scared: # #print(f"being timid {agent.time}") # if agentType != WardAgainstEvil: # agent.activeState = WardAgainstEvil(agent) # return # if scared or agent.timid: # if agentType != BlessingOfSafety: # agent.activeState = BlessingOfSafety(agent) # return if carDistanceFromGoal > ballDistanceFromGoal: if agentType != HolyProtector: agent.activeState = HolyProtector(agent) return elif goalward: if hit.hit_type != 2: if agentType != HolyProtector: agent.activeState = HolyProtector(agent) return else: if agentType != ScaleTheWalls: agent.activeState = ScaleTheWalls(agent) # print("scaling walls") # print(f"scale the walls defensive {agent.time}") return else: if hit.hit_type == 0: if agentType != GroundAssault: agent.activeState = GroundAssault(agent) return elif hit.hit_type == 1: if agentType != HolyGrenade: agent.activeState = HolyGrenade(agent) return elif hit.hit_type == 2: if agentType != ScaleTheWalls: agent.activeState = ScaleTheWalls(agent) return else: agent.log.append("we got an eroneous hit_type somehow") agent.log.append("rawr") else: agent.activeState = PreemptiveStrike(agent) def soloStateManager_testing(agent): agentType = type(agent.activeState) if agentType != PreemptiveStrike: if not kickOffTest(agent): myGoalLoc = Vector([0, 5200 * sign(agent.team), 200]) enemyGoalLoc = Vector([0, 5200 * -sign(agent.team), 200]) ballDistanceFromGoal = distance2D(myGoalLoc, agent.ball) carDistanceFromGoal = distance2D(myGoalLoc, agent.me) # agent.resetTimer += agent.deltaTime if locked_in(agent, agentType): return hit = agent.sorted_hits[0] #find_soonest_hit(agent) #print(hit) if agent.goalPred != None: agent.enemyAttacking = True openNet = openGoalOpportunity(agent) agent.openGoal = openNet agent.timid = False scared = False tempDelay = hit.time_difference() # print(tempDelay) # print(agent.enemyBallInterceptDelay) if tempDelay >= agent.enemyBallInterceptDelay - agent.contestedTimeLimit: if agent.enemyAttacking: # agent.enemyAttacking = True agent.contested = True # else: # print(f"{tempDelay} {agent.enemyBallInterceptDelay}") if ( distance2D(hit.pred_vector, myGoalLoc) <= 2000 or distance2D(agent.enemyTargetVec, myGoalLoc) <= 2000 or ballDistanceFromGoal <= 2000 ): if agent.enemyAttacking: agent.contested = True agent.timid = False scared = False # agent.enemyAttacking = True if agent.goalPred != None: agent.contested = True agent.enemyAttacking = True # if not agent.contested and not butterZone(hit.pred_vector) and not ballHeadedTowardsMyGoal_testing(agent, hit): # chrono_hits = SortHits(agent.hits) # prev_hit = hit # for h in chrono_hits: # # if h.time_difference() < 1: # # break # if ballHeadedTowardsMyGoal_testing(agent, h): # continue # # if h.hit_type == 5: # continue # # # if distance2D(h.pred_vector,enemyGoalLoc) >= distance2D(agent.me.location,enemyGoalLoc): # # break # if h.pred_vel[1] * -sign(agent.team) >= 1: # if not butterZone(prev_hit.pred_vector): # temptime = h.time_difference() # if ( # temptime # < agent.enemyBallInterceptDelay # - agent.contestedTimeLimit # ): # hit = h # else: # break # else: # break # prev_hit = h # # hit = prev_hit # agent.ballDelay = hit.time_difference() # if agent.team == 0: if not agent.contested and not agent.ignore_kickoffs: if hit.hit_type == 4: if agent.hits[1] != None: if not butterZone(hit.pred_vector): temptime = agent.hits[1].prediction_time - agent.time if ( temptime < agent.enemyBallInterceptDelay - agent.contestedTimeLimit # and hit.time_difference() > 1 ): hit = agent.hits[1] if hit.hit_type == 1: if agent.hits[0] != None: if not butterZone(hit.pred_vector): temptime = agent.hits[0].prediction_time - agent.time if ( temptime < agent.enemyBallInterceptDelay - agent.contestedTimeLimit # and hit.time_difference() > 1 ): # if not ballHeadedTowardsMyGoal_testing(agent, agent.hits[0]): hit = agent.hits[0] # if agent.hits[0] != None: # if hit.hit_type != 2: # temptime = agent.hits[0].prediction_time - agent.time # # if temptime >=1: # # if temptime < agent.enemyBallInterceptDelay - agent.contestedTimeLimit: # if not ballHeadedTowardsMyGoal_testing(agent, agent.hits[0]): # hit = agent.hits[0] # if agent.index == 1: # print(agent.gameInfo.is_kickoff_pause) # if agent.gameInfo.is_kickoff_pause and agent.ignore_kickoffs: # if agent.index == 1: # print("in here") # if distance2D(agent.me.location,agent.ball.location) < 5000: # agent.currentHit = agent.sorted_hits[0] # agent.ballDelay = agent.currentHit.time_difference() # if agent.activeState != HolyGrenade: # agent.activeState= HolyGrenade(agent) # return catchViable = False #ballCatchViable(agent) if hit.hit_type == 2: agent.wallShot = True else: agent.wallShot = False createBox(agent, hit.pred_vector) if hit.hit_type == 5: if agentType != Wings_Of_Justice: agent.activeState = hit.aerialState return if not agent.onSurface: if agent.me.location[2] > agent.recovery_height: if agentType != DivineGrace: agent.activeState = DivineGrace(agent) return if agent.dribbling: # if not goalward: if agentType != AngelicEmbrace: agent.activeState = AngelicEmbrace(agent) return goalward = ballHeadedTowardsMyGoal_testing(agent, hit) agent.goalward = goalward agent.currentHit = hit agent.ballDelay = hit.prediction_time - agent.time boostOpportunity = inCornerWithBoost(agent) if boostOpportunity != False: if agent.me.boostLevel <= 50: getBoost = False if agent.team == 0: if boostOpportunity[1] == 0 or boostOpportunity[1] == 1: getBoost = True else: if boostOpportunity[1] == 2 or boostOpportunity[1] == 3: getBoost = True if getBoost: if agentType != HeavenylyReprieve: agent.activeState = HeavenylyReprieve( agent, boostOpportunity[0] ) return if agent.goalie: if agent.activeState != Goalie: agent.activeState = Goalie(agent) return if agent.ignore_kickoffs: if distance2D(hit.pred_vector, myGoalLoc) > 3000: if agent.activeState != HeetSeekerDefense: agent.activeState = HeetSeekerDefense(agent) return if carDistanceFromGoal > ballDistanceFromGoal: if agentType != HolyProtector: agent.activeState = HolyProtector(agent) return if goalward: if hit.hit_type != 2: if agentType != HolyProtector: agent.activeState = HolyProtector(agent) return else: if agentType != ScaleTheWalls: agent.activeState = ScaleTheWalls(agent) return else: # if hit.hit_type == 0: #hit.pred_vector[2] <= agent.groundCutOff: # if agentType != GroundAssault: # agent.activeState = GroundAssault(agent) # return # # elif hit.hit_type == 1 or hit.hit_type == 4: # if agentType != HolyGrenade: # agent.activeState = HolyGrenade(agent) # return # # else: # if agentType != ScaleTheWalls: # agent.activeState = ScaleTheWalls(agent) # return if catchViable: # if agent.team == 1: hit = agent.hits[1] goalward = False agent.goalward = False agent.currentHit = hit agent.ballDelay = hit.prediction_time - agent.time agent.ballGrounded = False if agent.activeState != Celestial_Arrest: agent.activeState = Celestial_Arrest(agent) agent.log.append(f"catching? {agent.time}") return if hit.hit_type == 0: # hit.pred_vector[2] <= agent.groundCutOff: if agentType != GroundAssault: agent.activeState = GroundAssault(agent) return elif hit.hit_type == 1: if agentType != HolyGrenade: agent.activeState = HolyGrenade(agent) return elif hit.hit_type == 4: if agentType != HolyGrenade: agent.activeState = HolyGrenade(agent) # print("would have been wallshot before") return elif hit.hit_type == 2: if agentType != ScaleTheWalls: agent.activeState = ScaleTheWalls(agent) return else: agent.log.append(f"condition leaked through! {hit.hit_type}") else: agent.activeState = PreemptiveStrike(agent) def guidanceTesting(agent): # print("in guidance testing") if type(agent.activeState) != DivineGuidance: agent.activeState = DivineGuidance(agent, agent.ball.location) if agent.onSurface: if not agent.activeState.active: agent.activeState = DivineGuidance(agent, agent.ball.location) # def aerialTesting(agent): # if agent.activeState == None or not agent.activeState.active: # center = Vector([0, 5200 * -sign(agent.team), 0]) # _offset = agent.reachLength # # picked = agent.ballPred.slices[agent.ballPred.num_slices-1] # pred = agent.ballPred.slices[0] # selected = False # for i in range(0, agent.ballPred.num_slices): # if i > 60 and i % 3 != 0: # continue # # pred = agent.ballPred.slices[i] # tth = pred.game_seconds - agent.gameInfo.seconds_elapsed # # if tth <= 0: # continue # pred_vec = convertStructLocationToVector(pred) # pred_vel = convertStructVelocityToVector(pred) # # _direction = direction( # pred_vec, center.flatten() # ) # # target = pred_vec + _direction.scale(agent.reachLength * 0.9) # req_delta_a = calculate_delta_acceleration(target-agent.me.location, agent.me.velocity, # tth, agent.gravity) # req_delta_v = req_delta_a.magnitude()*tth # if req_delta_v < agent.available_delta_v and req_delta_a.magnitude() < 1060: # agent.activeState = Wings_Of_Justice(agent,pred, target, tth) # selected = True # break # if not selected: # agent.activeState = Wings_Of_Justice(agent, picked, convertStructLocationToVector(picked), 6) def reset_aerial_test(agent): ball_state = BallState( physics=Physics( velocity=Vector3( z=random.randrange(500, 1000), x=random.randrange(-100, 100), y=random.randrange(-100, 100), ), location=Vector3(random.randrange(-100, 100), random.randrange(-100, 100), random.randrange(1200, 1750)) ) ) car_state = CarState( physics=Physics(velocity=Vector3(z=0, x=0, y=0), location=Vector3(random.randrange(-1500, 1500), sign(agent.team) * random.randrange(1500,2500), 50),rotation=agent.defaultRotation)) game_state = GameState(ball=ball_state,cars={agent.index: car_state}) agent.set_game_state(game_state) agent.activeState = None def aerialTesting(agent): if agent.ball.location[2] < 110: reset_aerial_test(agent) if agent.activeState == None or not agent.activeState.active: center = Vector([0, 5200 * -sign(agent.team), 0]) _offset = agent.reachLength picked = agent.ballPred.slices[agent.ballPred.num_slices-1] pred = agent.ballPred.slices[0] selected = False for i in range(0, agent.ballPred.num_slices): if i > 60 and i % 3 != 0: continue pred = agent.ballPred.slices[i] tth = pred.game_seconds - agent.gameInfo.seconds_elapsed if tth <= 0: continue pred_vec = convertStructLocationToVector(pred) pred_vel = convertStructVelocityToVector(pred) if pred_vec[2] < 600: break _direction = direction( pred_vec, center.flatten() ) target = pred_vec + _direction.scale(agent.reachLength * 0.9) aerial_accepted = False if agent.onSurface: #if (inaccurateArrivalEstimator(agent, pred_vec, False, offset=_offset) + 1 < tth): delta_a = calculate_delta_acceleration(target - agent.me.location, agent.me.velocity + agent.up.scale(600), tth, agent.gravity) if delta_a.magnitude() <= 900: aerial_accepted = True else: approach_direction = direction(agent.me.location.flatten(), pred_vec.flatten()).normalize() pseudo_position = pred_vec.flatten() - approach_direction.scale(pred_vec[2]) req_delta_a = calculate_delta_acceleration(pseudo_position - agent.me.location, approach_direction.scale(1800) + agent.up.scale(500), tth, agent.gravity) req_delta_v = req_delta_a.magnitude() * tth if req_delta_v < agent.available_delta_v - 50 and req_delta_a.magnitude() < 1000: aerial_accepted = True else: delta_a = calculate_delta_acceleration(target - agent.me.location, agent.me.velocity, tth, agent.gravity) if delta_a.magnitude() < 950: req_delta_v = delta_a.magnitude() * tth if req_delta_v < agent.available_delta_v - 50: aerial_accepted = True if aerial_accepted: agent.activeState = Wings_Of_Justice(agent, pred, target, tth) selected = True break if not selected: #agent.activeState = Wings_Of_Justice(agent, picked, convertStructLocationToVector(picked), 6) agent.activeState = DivineGrace(agent) def dribbleTesting(agent): agent.activeState = AngelicEmbrace(agent) if agent.dribbling: return else: agent.resetTimer += agent.deltaTime if agent.resetTimer >= 5: agent.resetTimer = 0 agent.log.append("setting up dribble training") # game_state = GameState() # self.set_game_state(game_state) ball_state = BallState( Physics( location=Vector3( agent.me.location[0], agent.me.location[1], agent.me.location[2] + 160, ), velocity=Vector3( agent.me.velocity[0] * 0.8, agent.me.velocity[1] * 0.8, agent.me.velocity[2], ), ) ) game_state = GameState(ball=ball_state) agent.set_game_state(game_state) # if agentType != AngelicEmbrace: # agent.activeState = AngelicEmbrace(agent) return def orientationStateManager(agent): if agent.ball.location < 110: agent.log.append("resetting orientations") car_state = CarState( physics=Physics(velocity=Vector3(z=0, x=0, y=0), location=Vector3(0, 0, 20)) ) game_state = GameState(cars={agent.index: car_state}) agent.set_game_state(game_state) if agent.dribbling: if type(agent.activeState) != AngelicEmbrace: agent.activeState = AngelicEmbrace(agent) return else: agent.activeState # return agent.activeState def dummyState(agent): if type(agent.activeState) != Player_reporter: agent.activeState = Player_reporter(agent)
38.605945
241
0.500791
13,096
141,568
5.324068
0.052153
0.06312
0.021729
0.01417
0.801101
0.748724
0.715937
0.681315
0.665797
0.63846
0
0.024144
0.409888
141,568
3,666
242
38.616476
0.810464
0.346858
0
0.683965
0
0.001038
0.008812
0.00188
0
0
0
0
0
1
0.042034
false
0.000519
0.003114
0.006746
0.157239
0.001038
0
0
0
null
0
0
0
1
1
1
0
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
0
0
0
0
0
0
4
94b41e08465cde8ed5840760e1873e0d2346998f
219
py
Python
resources/__init__.py
Pedroglp/flask-login
d85de3450106f5ead3c15bcb91279dd55e25e936
[ "MIT" ]
null
null
null
resources/__init__.py
Pedroglp/flask-login
d85de3450106f5ead3c15bcb91279dd55e25e936
[ "MIT" ]
null
null
null
resources/__init__.py
Pedroglp/flask-login
d85de3450106f5ead3c15bcb91279dd55e25e936
[ "MIT" ]
null
null
null
from resources.ItemResource import ItemResource, ItemsListResource from resources.UserAPI import SignUpAPI from resources.ProtectedAPI import ProtectedAPI from resources.LoginAPI import getAuthToken __all__ = ['items']
36.5
66
0.863014
23
219
8.043478
0.521739
0.281081
0
0
0
0
0
0
0
0
0
0
0.091324
219
6
67
36.5
0.929648
0
0
0
0
0
0.022727
0
0
0
0
0
0
1
0
false
0
0.8
0
0.8
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
0
0
1
0
0
0
0
4
94fecd1817ed40c50fe93e711c1c59818118253e
66
py
Python
apps/app-docs/app-pandas-docs/src/installDocs/Running the test suite.py
reyou/Ggg.MachineLearning
47c40e98ad163ef5b5c6e83cfd41e09f2497522b
[ "Apache-2.0" ]
null
null
null
apps/app-docs/app-pandas-docs/src/installDocs/Running the test suite.py
reyou/Ggg.MachineLearning
47c40e98ad163ef5b5c6e83cfd41e09f2497522b
[ "Apache-2.0" ]
null
null
null
apps/app-docs/app-pandas-docs/src/installDocs/Running the test suite.py
reyou/Ggg.MachineLearning
47c40e98ad163ef5b5c6e83cfd41e09f2497522b
[ "Apache-2.0" ]
null
null
null
import sys print(sys.version_info) import pandas as pd pd.test()
11
23
0.772727
12
66
4.166667
0.75
0
0
0
0
0
0
0
0
0
0
0
0.136364
66
5
24
13.2
0.877193
0
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
0.25
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
0
1
0
0
0
0
4
94ff6239fdef4030ca1e7176584a3c940e06017d
161
py
Python
src/models/UserProfile/forms.py
yonathanF/bazaar-clone
b878cc818b7e86293256d2abfdbec040b125362d
[ "MIT" ]
null
null
null
src/models/UserProfile/forms.py
yonathanF/bazaar-clone
b878cc818b7e86293256d2abfdbec040b125362d
[ "MIT" ]
null
null
null
src/models/UserProfile/forms.py
yonathanF/bazaar-clone
b878cc818b7e86293256d2abfdbec040b125362d
[ "MIT" ]
null
null
null
from django.forms import ModelForm from .models import Profile class ProfileForm(ModelForm): class Meta: model = Profile fields = '__all__'
20.125
34
0.695652
18
161
6
0.722222
0
0
0
0
0
0
0
0
0
0
0
0.242236
161
8
35
20.125
0.885246
0
0
0
0
0
0.04321
0
0
0
0
0
0
1
0
false
0
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
0
0
1
0
1
0
0
4
bf98d18f3965385837e8d4cd4a0fdb92cda6b4bc
150
py
Python
netCDF4_enhancement/__init__.py
david-salac/NetCDF4-variable-streamer
c7b13a54936e5e1180b5c8f25193e6aa0347f0bf
[ "MIT" ]
20
2020-01-20T14:34:41.000Z
2021-10-01T14:19:44.000Z
netCDF4_enhancement/__init__.py
david-salac/NetCDF4-variable-streamer
c7b13a54936e5e1180b5c8f25193e6aa0347f0bf
[ "MIT" ]
1
2020-08-26T10:39:30.000Z
2020-08-26T10:39:30.000Z
netCDF4_enhancement/__init__.py
david-salac/NetCDF4-variable-streamer
c7b13a54936e5e1180b5c8f25193e6aa0347f0bf
[ "MIT" ]
1
2020-10-10T12:23:25.000Z
2020-10-10T12:23:25.000Z
from netCDF4_enhancement.netCDF4_enhancement import NetCDF4Streamer, NetCDF4StreamerVariable # noqa __version__ = "0.1.2" __status__ = "Production"
30
100
0.826667
15
150
7.6
0.866667
0.315789
0
0
0
0
0
0
0
0
0
0.051852
0.1
150
4
101
37.5
0.792593
0.026667
0
0
0
0
0.104167
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
0
0
1
0
0
0
0
4
bfcc6bf426b33ac3070b8c1f19549df81fb66502
27
py
Python
lib/__init__.py
TCSOSM-20/LW-UI
70c3331278f71d3b22fc3a090d526b4b8106d155
[ "Apache-2.0" ]
8
2017-03-13T16:34:28.000Z
2021-11-16T11:35:56.000Z
code/lib/__init__.py
superfluidity/osm-light-ui
d3189687009f23f32e877c36db1ebd206fca972f
[ "Apache-2.0" ]
1
2020-02-12T03:23:39.000Z
2020-02-12T03:23:39.000Z
code/lib/__init__.py
superfluidity/osm-light-ui
d3189687009f23f32e877c36db1ebd206fca972f
[ "Apache-2.0" ]
3
2017-03-28T09:26:40.000Z
2020-12-08T14:16:12.000Z
__all__ = ["Util", 'etsi']
13.5
26
0.555556
3
27
3.666667
1
0
0
0
0
0
0
0
0
0
0
0
0.148148
27
1
27
27
0.478261
0
0
0
0
0
0.296296
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
0
0
0
0
0
0
0
0
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
0
0
4
44f8ed5d7ebf0f5a9e3a363400a4d369e59e93d3
137
py
Python
Thonny/Lib/site-packages/thonny/shared/thonny/__init__.py
byache/thonny
197925d51be64bc1ff1f8488d3755697f5121025
[ "MIT" ]
null
null
null
Thonny/Lib/site-packages/thonny/shared/thonny/__init__.py
byache/thonny
197925d51be64bc1ff1f8488d3755697f5121025
[ "MIT" ]
null
null
null
Thonny/Lib/site-packages/thonny/shared/thonny/__init__.py
byache/thonny
197925d51be64bc1ff1f8488d3755697f5121025
[ "MIT" ]
null
null
null
# Frontend will interpret this folder as thonny.shared.thonny # For backend parent folder will be in path, so this will be package thonny
68.5
75
0.80292
23
137
4.782609
0.695652
0.109091
0
0
0
0
0
0
0
0
0
0
0.160584
137
2
75
68.5
0.956522
0.970803
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
7840f3f37ff8db94955eb0ba2e5d4410aadee57d
109
py
Python
helper.py
annettechun25/cs3240-labdemo
647e3b463d1b71ea1a3bd34d11e6a5855b4ea70d
[ "MIT" ]
null
null
null
helper.py
annettechun25/cs3240-labdemo
647e3b463d1b71ea1a3bd34d11e6a5855b4ea70d
[ "MIT" ]
null
null
null
helper.py
annettechun25/cs3240-labdemo
647e3b463d1b71ea1a3bd34d11e6a5855b4ea70d
[ "MIT" ]
null
null
null
# Annette Chun # amc4sq # 02/22/16 # helper.py __author__ = 'Annette Chun' def greeting(msg): print(msg)
10.9
27
0.678899
16
109
4.375
0.8125
0.314286
0
0
0
0
0
0
0
0
0
0.078652
0.183486
109
9
28
12.111111
0.707865
0.348624
0
0
0
0
0.181818
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.333333
0.333333
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
1
0
0
0
0
0
0
0
4
78804020dffa48360eb05d75f56a9c01b4bbd4dc
419
py
Python
wtf_helpers.py
spratiman/udenbrus
213d18db075ac515e2fba0737c67c8f873832e15
[ "MIT" ]
10
2015-01-11T22:22:39.000Z
2021-03-21T18:09:17.000Z
wtf_helpers.py
spratiman/udenbrus
213d18db075ac515e2fba0737c67c8f873832e15
[ "MIT" ]
null
null
null
wtf_helpers.py
spratiman/udenbrus
213d18db075ac515e2fba0737c67c8f873832e15
[ "MIT" ]
8
2015-02-10T01:02:30.000Z
2021-08-08T17:29:54.000Z
# Helpers for form generation from wtforms.fields import HiddenField, BooleanField def add_helpers(app): def is_hidden_field_filter(field): return isinstance(field, HiddenField) def is_boolean_field_filter(field): return isinstance(field, BooleanField) app.jinja_env.filters['is_hidden_field'] = is_hidden_field_filter app.jinja_env.filters['is_boolean_field'] = is_boolean_field_filter
41.9
71
0.78043
56
419
5.5
0.410714
0.142857
0.126623
0.123377
0.37013
0.24026
0
0
0
0
0
0
0.143198
419
9
72
46.555556
0.857939
0.064439
0
0
0
0
0.079487
0
0
0
0
0
0
1
0.375
false
0
0.125
0.25
0.75
0
0
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
0
1
1
0
0
4
78ba69fa0000d1e3d13e83e3df8be2f8dfee0fea
846
py
Python
tests/test_windows.py
Numerlor/taskipy
0d90a5204bf2eb50ee8c7513af1fae88a2f33e1b
[ "MIT" ]
208
2019-12-24T20:53:31.000Z
2022-03-29T23:37:25.000Z
tests/test_windows.py
Numerlor/taskipy
0d90a5204bf2eb50ee8c7513af1fae88a2f33e1b
[ "MIT" ]
40
2020-01-02T15:58:03.000Z
2022-03-02T21:38:33.000Z
tests/test_windows.py
Numerlor/taskipy
0d90a5204bf2eb50ee8c7513af1fae88a2f33e1b
[ "MIT" ]
18
2019-12-29T03:23:27.000Z
2022-02-15T14:51:30.000Z
import platform import unittest @unittest.skipIf(platform.system() != 'Windows', 'Windows only tests') class WindowsTestCase(unittest.TestCase): def test_windows_path_sanity(self): ''' This test case is a no-op, and exists only to ensure that windows paths work as part of the windows sanity ci test. ''' print('sanity passed - test was run') def test_mslex_install(self): '''Ensure that mslex is installed on Windows''' try: import mslex # type: ignore # pylint: disable=W0611,C0415 except ImportError: self.fail('Unable to import mslex') def test_mslex_import(self): '''Ensure that mslex is used as shlex''' from taskipy.task_runner import shlex # pylint: disable=C0415 self.assertEqual(shlex.__name__, 'mslex')
31.333333
84
0.650118
107
846
5.028037
0.570093
0.039033
0.04461
0.070632
0.078067
0
0
0
0
0
0
0.019139
0.258865
846
26
85
32.538462
0.838915
0.303783
0
0
0
0
0.146789
0
0
0
0
0
0.071429
1
0.214286
false
0.071429
0.5
0
0.785714
0.071429
0
0
0
null
0
0
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
1
0
1
1
0
1
0
0
4
78cada4c9f1012f64cd886f17d65eddc15afbb84
263
py
Python
tests/molecular/molecules/molecule/get_maximum_diameter/utilities.py
stevenbennett96/stk
6e5af87625b83e0bfc7243bc42d8c7a860cbeb76
[ "MIT" ]
21
2018-04-12T16:25:24.000Z
2022-02-14T23:05:43.000Z
tests/molecular/molecules/molecule/get_maximum_diameter/utilities.py
stevenbennett96/stk
6e5af87625b83e0bfc7243bc42d8c7a860cbeb76
[ "MIT" ]
8
2019-03-19T12:36:36.000Z
2020-11-11T12:46:00.000Z
tests/molecular/molecules/molecule/get_maximum_diameter/utilities.py
stevenbennett96/stk
6e5af87625b83e0bfc7243bc42d8c7a860cbeb76
[ "MIT" ]
5
2018-08-07T13:00:16.000Z
2021-11-01T00:55:10.000Z
from scipy.spatial.distance import euclidean def get_maximum_diameter(position_matrix, atom_ids): atomic_positions = position_matrix[atom_ids, :] return float(euclidean( atomic_positions.min(axis=0), atomic_positions.max(axis=0), ))
26.3
52
0.730038
33
263
5.545455
0.666667
0.245902
0.196721
0.229508
0
0
0
0
0
0
0
0.009217
0.174905
263
9
53
29.222222
0.834101
0
0
0
0
0
0
0
0
0
0
0
0
1
0.142857
false
0
0.142857
0
0.428571
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
0
0
0
0
0
0
0
4
153b53007b0c641c1382391e58fc84c0760d6032
799
py
Python
tests/taunts/aoe_test.py
Sidesplitter/Wololobot
4209a8bd7e2e7ed424dab41e5793d72756ba3980
[ "WTFPL" ]
null
null
null
tests/taunts/aoe_test.py
Sidesplitter/Wololobot
4209a8bd7e2e7ed424dab41e5793d72756ba3980
[ "WTFPL" ]
null
null
null
tests/taunts/aoe_test.py
Sidesplitter/Wololobot
4209a8bd7e2e7ed424dab41e5793d72756ba3980
[ "WTFPL" ]
null
null
null
import unittest from src.tauntpackfactory import TauntPackFactory class AoETest(unittest.TestCase): tauntPack = None def setUp(self): factory = TauntPackFactory() self.tauntPack = factory.create('taunts/aoe') def tearDown(self): self.tauntPack = None def test_amount(self): self.assertEqual(43, len(self.tauntPack.taunts)) def test_oh(self): self.assertIsNotNone(self.tauntPack.findMatch('Oh')) self.assertIsNotNone(self.tauntPack.findMatch('ooh')) self.assertIsNotNone(self.tauntPack.findMatch('ohh')) def test_ah(self): self.assertIsNotNone(self.tauntPack.findMatch('Ah')) self.assertIsNotNone(self.tauntPack.findMatch('aah')) self.assertIsNotNone(self.tauntPack.findMatch('ahh'))
24.96875
61
0.687109
85
799
6.423529
0.364706
0.214286
0.252747
0.351648
0.465201
0.164835
0
0
0
0
0
0.003101
0.192741
799
31
62
25.774194
0.843411
0
0
0
0
0
0.032581
0
0
0
0
0
0.368421
1
0.263158
false
0
0.105263
0
0.473684
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
0
0
0
0
4
15744d21556d871e7e491b6ce28bdf9cb512b756
65
py
Python
wagtail/api/v2/__init__.py
brownaa/wagtail
c97bc56c6822eb1b6589d5c33e07f71acfc48845
[ "BSD-3-Clause" ]
8,851
2016-12-09T19:01:45.000Z
2022-03-31T04:45:06.000Z
wagtail/api/v2/__init__.py
brownaa/wagtail
c97bc56c6822eb1b6589d5c33e07f71acfc48845
[ "BSD-3-Clause" ]
5,197
2016-12-09T19:24:37.000Z
2022-03-31T22:17:55.000Z
wagtail/api/v2/__init__.py
brownaa/wagtail
c97bc56c6822eb1b6589d5c33e07f71acfc48845
[ "BSD-3-Clause" ]
2,548
2016-12-09T18:16:55.000Z
2022-03-31T21:34:38.000Z
default_app_config = 'wagtail.api.v2.apps.WagtailAPIV2AppConfig'
32.5
64
0.846154
8
65
6.625
1
0
0
0
0
0
0
0
0
0
0
0.032258
0.046154
65
1
65
65
0.822581
0
0
0
0
0
0.630769
0.630769
0
0
0
0
0
1
0
false
0
0
0
0
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
1
1
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
157e8cf15b196e274a4d5f2b55e503c56301dfbe
572
py
Python
conjur/controller/__init__.py
mbjahnoon/conjur-api-python3
ec1f62bb1baf2bdcd34d2fb92c97db724f761020
[ "Apache-2.0" ]
16
2019-05-17T15:34:59.000Z
2021-11-08T10:30:21.000Z
conjur/controller/__init__.py
mbjahnoon/conjur-api-python3
ec1f62bb1baf2bdcd34d2fb92c97db724f761020
[ "Apache-2.0" ]
301
2019-05-07T18:27:10.000Z
2022-01-26T13:03:49.000Z
conjur/controller/__init__.py
cyberark/cyberark-conjur-cli
2507e8769808643d89efa7e2496cfc14f505bd7e
[ "Apache-2.0" ]
10
2019-07-30T17:00:13.000Z
2022-01-20T17:00:34.000Z
""" controller This package contains the controller classes """ from conjur.controller.host_controller import HostController from conjur.controller.init_controller import InitController from conjur.controller.list_controller import ListController from conjur.controller.login_controller import LoginController from conjur.controller.logout_controller import LogoutController from conjur.controller.policy_controller import PolicyController from conjur.controller.user_controller import UserController from conjur.controller.variable_controller import VariableController
38.133333
68
0.886364
63
572
7.920635
0.396825
0.160321
0.320641
0
0
0
0
0
0
0
0
0
0.075175
572
14
69
40.857143
0.943289
0.097902
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
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
0
1
0
1
0
0
4
159b04596de6f88a2f16b7927254279cc5b6f181
1,878
py
Python
test/test_analysis_api.py
ariadnext/IDCheckIO
62804f78e02b9ef42e10f1fe7b4b4f3abbf703fd
[ "Apache-2.0" ]
3
2016-03-24T11:08:57.000Z
2016-10-05T13:32:45.000Z
test/test_analysis_api.py
ariadnext/IDCheckIO
62804f78e02b9ef42e10f1fe7b4b4f3abbf703fd
[ "Apache-2.0" ]
null
null
null
test/test_analysis_api.py
ariadnext/IDCheckIO
62804f78e02b9ef42e10f1fe7b4b4f3abbf703fd
[ "Apache-2.0" ]
2
2019-10-18T14:25:08.000Z
2020-12-12T17:07:07.000Z
# coding: utf-8 """ IdCheck.IO API Check identity documents OpenAPI spec version: 0.0 Generated by: https://github.com/swagger-api/swagger-codegen.git Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. """ from __future__ import absolute_import import os import sys import unittest import idcheckio_python_client from idcheckio_python_client.rest import ApiException from idcheckio_python_client.apis.analysis_api import AnalysisApi class TestAnalysisApi(unittest.TestCase): """ AnalysisApi unit test stubs """ def setUp(self): self.api = idcheckio_python_client.apis.analysis_api.AnalysisApi() def tearDown(self): pass def test_get_report(self): """ Test case for get_report HTTP GET report (demo) """ pass def test_get_result(self): """ Test case for get_result HTTP GET result """ pass def test_get_task(self): """ Test case for get_task HTTP GET task """ pass def test_post_image(self): """ Test case for post_image HTTP POST task image """ pass def test_post_mrz(self): """ Test case for post_mrz HTTP POST task mrz """ pass if __name__ == '__main__': unittest.main()
21.340909
76
0.646432
243
1,878
4.839506
0.473251
0.05102
0.046769
0.063776
0.139456
0.061224
0
0
0
0
0
0.00522
0.285942
1,878
87
77
21.586207
0.871738
0.490415
0
0.25
1
0
0.010929
0
0
0
0
0
0
1
0.291667
false
0.25
0.291667
0
0.625
0
0
0
0
null
0
0
0
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
1
0
1
0
0
1
0
0
4
15ad69462a062e84e93651fdec8e6d2fdc1e8ef1
89
py
Python
Django-Book-WebSite-main/bookapp/apps.py
tenzinsparkss/Recommendation-system-on-python-django
5ecf8b2ff15d0b8f466d38f966ff1fce362fe0bf
[ "BSD-4-Clause-UC" ]
2
2020-10-18T16:59:22.000Z
2020-10-18T21:03:22.000Z
Django-Book-WebSite-main/bookapp/apps.py
tenzinsparkss/Recommendation-system-on-python-django
5ecf8b2ff15d0b8f466d38f966ff1fce362fe0bf
[ "BSD-4-Clause-UC" ]
101
2021-03-29T16:20:09.000Z
2021-06-12T08:53:20.000Z
Django-Book-WebSite-main/bookapp/apps.py
tenzinsparkss/Recommendation-system-on-python-django
5ecf8b2ff15d0b8f466d38f966ff1fce362fe0bf
[ "BSD-4-Clause-UC" ]
null
null
null
from django.apps import AppConfig class BookappConfig(AppConfig): name = 'bookapp'
14.833333
33
0.752809
10
89
6.7
0.9
0
0
0
0
0
0
0
0
0
0
0
0.168539
89
5
34
17.8
0.905405
0
0
0
0
0
0.078652
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
0
1
0
1
0
0
4
ec81ef3eee4a2af3461e91c361947042e025b27f
6,308
py
Python
Source/kb_layout.py
Aho-Senpai/InputDisplayPython
dbf778765821fc35d075892d6f8885ecbf0dd847
[ "MIT" ]
null
null
null
Source/kb_layout.py
Aho-Senpai/InputDisplayPython
dbf778765821fc35d075892d6f8885ecbf0dd847
[ "MIT" ]
null
null
null
Source/kb_layout.py
Aho-Senpai/InputDisplayPython
dbf778765821fc35d075892d6f8885ecbf0dd847
[ "MIT" ]
null
null
null
ANSI_TKL = [ {'Key': 'Key.esc', 'Pos': [0, 0], 'Size': [1, 1], }, {'Key': "SPACER", 'Pos': [0, 1], 'Size': [1, 1], }, # Spacer {'Key': 'Key.f1', 'Pos': [0, 2], 'Size': [1, 1], }, {'Key': 'Key.f2', 'Pos': [0, 3], 'Size': [1, 1], }, {'Key': 'Key.f3', 'Pos': [0, 4], 'Size': [1, 1], }, {'Key': 'Key.f4', 'Pos': [0, 5], 'Size': [1, 1], }, {'Key': "SPACER", 'Pos': [0, 6], 'Size': [1, 0.5], }, # Spacer {'Key': 'Key.f5', 'Pos': [0, 6.5], 'Size': [1, 1], }, {'Key': 'Key.f6', 'Pos': [0, 7.5], 'Size': [1, 1], }, {'Key': 'Key.f7', 'Pos': [0, 8.5], 'Size': [1, 1], }, {'Key': 'Key.f8', 'Pos': [0, 9.5], 'Size': [1, 1], }, {'Key': "SPACER", 'Pos': [0, 10.5], 'Size': [1, 0.5], }, # Spacer {'Key': 'Key.f9', 'Pos': [0, 11], 'Size': [1, 1], }, {'Key': 'Key.f10', 'Pos': [0, 12], 'Size': [1, 1], }, {'Key': 'Key.f11', 'Pos': [0, 13], 'Size': [1, 1], }, {'Key': 'Key.f12', 'Pos': [0, 14], 'Size': [1, 1], }, {'Key': "SPACER", 'Pos': [0, 15], 'Size': [1, 0.25], }, # Spacer {'Key': 'Key.print_screen', 'Pos': [0, 15.25], 'Size': [1, 1], }, {'Key': 'Key.scroll_lock', 'Pos': [0, 16.25], 'Size': [1, 1], }, {'Key': 'Key.pause', 'Pos': [0, 17.25], 'Size': [1, 1], }, {'Key': "SPACER", 'Pos': [1, 0], 'Size': [0.5, 18.25]}, {'Key': '`', 'Pos': [2, 0], 'Shift': '~', 'Size': [1, 1], }, {'Key': '1', 'Pos': [2, 1], 'Shift': '!', 'Size': [1, 1], }, {'Key': '2', 'Pos': [2, 2], 'Shift': '@', 'Size': [1, 1], }, {'Key': '3', 'Pos': [2, 3], 'Shift': '#', 'Size': [1, 1], }, {'Key': '4', 'Pos': [2, 4], 'Shift': '$', 'Size': [1, 1], }, {'Key': '5', 'Pos': [2, 5], 'Shift': '%', 'Size': [1, 1], }, {'Key': '6', 'Pos': [2, 6], 'Shift': '^', 'Size': [1, 1], }, {'Key': '7', 'Pos': [2, 7], 'Shift': '&', 'Size': [1, 1], }, {'Key': '8', 'Pos': [2, 8], 'Shift': '*', 'Size': [1, 1], }, {'Key': '9', 'Pos': [2, 9], 'Shift': '(', 'Size': [1, 1], }, {'Key': '0', 'Pos': [2, 10], 'Shift': ')', 'Size': [1, 1], }, {'Key': '-', 'Pos': [2, 11], 'Shift': '_', 'Size': [1, 1], }, {'Key': '=', 'Pos': [2, 12], 'Shift': '+', 'Size': [1, 1], }, {'Key': 'Key.backspace', 'Pos': [2, 13], 'Size': [1, 2], }, {'Key': "SPACER", 'Pos': [2, 15], 'Size': [1, 0.25], }, # Spacer {'Key': 'Key.insert', 'Pos': [2, 15.25], 'Size': [1, 1], }, {'Key': 'Key.home', 'Pos': [2, 16.25], 'Size': [1, 1], }, {'Key': 'Key.page_up', 'Pos': [2, 17.25], 'Size': [1, 1], }, {'Key': 'Key.tab', 'Pos': [3, 0], 'Size': [1, 1.5], }, {'Key': 'q', 'Pos': [3, 1.5], 'Shift': 'Q', 'Size': [1, 1], }, {'Key': 'w', 'Pos': [3, 2.5], 'Shift': 'W', 'Size': [1, 1], }, {'Key': 'e', 'Pos': [3, 3.5], 'Shift': 'E', 'Size': [1, 1], }, {'Key': 'r', 'Pos': [3, 4.5], 'Shift': 'R', 'Size': [1, 1], }, {'Key': 't', 'Pos': [3, 5.5], 'Shift': 'T', 'Size': [1, 1], }, {'Key': 'y', 'Pos': [3, 6.5], 'Shift': 'Y', 'Size': [1, 1], }, {'Key': 'u', 'Pos': [3, 7.5], 'Shift': 'U', 'Size': [1, 1], }, {'Key': 'i', 'Pos': [3, 8.5], 'Shift': 'I', 'Size': [1, 1], }, {'Key': 'o', 'Pos': [3, 9.5], 'Shift': 'O', 'Size': [1, 1], }, {'Key': 'p', 'Pos': [3, 10.5], 'Shift': 'P', 'Size': [1, 1], }, {'Key': '[', 'Pos': [3, 11.5], 'Shift': '{', 'Size': [1, 1], }, {'Key': ']', 'Pos': [3, 12.5], 'Shift': '}', 'Size': [1, 1], }, {'Key': '\\', 'Pos': [3, 13.5], 'Shift': '|', 'Size': [1, 1.5], }, {'Key': "SPACER", 'Pos': [3, 15], 'Size': [1, 0.25], }, # Spacer {'Key': 'Key.delete', 'Pos': [3, 15.25], 'Size': [1, 1], }, {'Key': 'Key.end', 'Pos': [3, 16.25], 'Size': [1, 1], }, {'Key': 'Key.page_down', 'Pos': [3, 17.25], 'Size': [1, 1], }, {'Key': 'Key.caps_lock', 'Pos': [4, 0], 'Size': [1, 1.75], }, {'Key': 'a', 'Pos': [4, 1.75], 'Shift': 'A', 'Size': [1, 1], }, {'Key': 's', 'Pos': [4, 2.75], 'Shift': 'S', 'Size': [1, 1], }, {'Key': 'd', 'Pos': [4, 3.75], 'Shift': 'D', 'Size': [1, 1], }, {'Key': 'f', 'Pos': [4, 4.75], 'Shift': 'F', 'Size': [1, 1], }, {'Key': 'g', 'Pos': [4, 5.75], 'Shift': 'G', 'Size': [1, 1], }, {'Key': 'h', 'Pos': [4, 6.75], 'Shift': 'H', 'Size': [1, 1], }, {'Key': 'j', 'Pos': [4, 7.75], 'Shift': 'J', 'Size': [1, 1], }, {'Key': 'k', 'Pos': [4, 8.75], 'Shift': 'K', 'Size': [1, 1], }, {'Key': 'l', 'Pos': [4, 9.75], 'Shift': 'L', 'Size': [1, 1], }, {'Key': ';', 'Pos': [4, 10.75], 'Shift': ':', 'Size': [1, 1], }, {'Key': "'", 'Pos': [4, 11.75], 'Shift': '"', 'Size': [1, 1], }, {'Key': 'Key.enter', 'Pos': [4, 12.75], 'Size': [1, 2.25], }, {'Key': 'Key.shift', 'Pos': [5, 0], 'Size': [1, 2.25], }, {'Key': 'z', 'Pos': [5, 2.25], 'Shift': 'Z', 'Size': [1, 1], }, {'Key': 'x', 'Pos': [5, 3.25], 'Shift': 'X', 'Size': [1, 1], }, {'Key': 'c', 'Pos': [5, 4.25], 'Shift': 'C', 'Size': [1, 1], }, {'Key': 'v', 'Pos': [5, 5.25], 'Shift': 'V', 'Size': [1, 1], }, {'Key': 'b', 'Pos': [5, 6.25], 'Shift': 'B', 'Size': [1, 1], }, {'Key': 'n', 'Pos': [5, 7.25], 'Shift': 'N', 'Size': [1, 1], }, {'Key': 'm', 'Pos': [5, 8.25], 'Shift': 'M', 'Size': [1, 1], }, {'Key': ',', 'Pos': [5, 9.25], 'Shift': '<', 'Size': [1, 1], }, {'Key': '.', 'Pos': [5, 10.25], 'Shift': '>', 'Size': [1, 1], }, {'Key': '/', 'Pos': [5, 11.25], 'Shift': '?', 'Size': [1, 1], }, {'Key': 'Key.shift_r', 'Pos': [5, 12.25], 'Size': [1, 2.75], }, {'Key': "SPACER", 'Pos': [5, 15], 'Size': [1, 1.25], }, # Spacer {'Key': 'Key.up', 'Pos': [5, 16.25], 'Size': [1, 1], }, {'Key': 'Key.ctrl_l', 'Pos': [6, 0], 'Size': [1, 1.25], }, {'Key': 'Key.cmd', 'Pos': [6, 1.25], 'Size': [1, 1.25], }, {'Key': 'Key.alt_l', 'Pos': [6, 2.5], 'Size': [1, 1.25], }, {'Key': 'Key.space', 'Pos': [6, 3.75], 'Size': [1, 6.25], }, {'Key': 'Key.alt_gr', 'Pos': [6, 10], 'Size': [1, 1.25], }, {'Key': 'Key.cmd_r', 'Pos': [6, 11.25], 'Size': [1, 1.25], }, {'Key': "SPACER", 'Pos': [6, 12.5], 'Size': [1, 1.25], }, # Spacer (Menu Key doesn't show?) {'Key': 'Key.ctrl_r', 'Pos': [6, 13.75], 'Size': [1, 1.25], }, {'Key': "SPACER", 'Pos': [6, 15.75], 'Size': [1, 0.25], }, # Spacer {'Key': 'Key.left', 'Pos': [6, 15.25], 'Size': [1, 1], }, {'Key': 'Key.down', 'Pos': [6, 16.25], 'Size': [1, 1], }, {'Key': 'Key.right', 'Pos': [6, 17.25], 'Size': [1, 1], }, ]
60.07619
96
0.359068
980
6,308
2.297959
0.094898
0.210924
0.223801
0.283748
0.48135
0.354352
0.255773
0.118117
0
0
0
0.120609
0.219245
6,308
104
97
60.653846
0.33665
0.013792
0
0
0
0
0.271776
0
0.010204
0
0
0
0
1
0
false
0
0
0
0
0.010204
0
0
0
null
1
1
1
0
0
0
0
0
0
0
0
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
4
ec8362c94078e10e84cf407902299abacd500aac
1,199
py
Python
authors/apps/articles/tests/test_share.py
andela/ah-backend-thanos
baf7f20a023cc3c3ecae0fcf91bb7d9165e79fc8
[ "BSD-3-Clause" ]
null
null
null
authors/apps/articles/tests/test_share.py
andela/ah-backend-thanos
baf7f20a023cc3c3ecae0fcf91bb7d9165e79fc8
[ "BSD-3-Clause" ]
42
2018-10-24T08:21:07.000Z
2021-06-10T20:54:39.000Z
authors/apps/articles/tests/test_share.py
andela/ah-backend-thanos
baf7f20a023cc3c3ecae0fcf91bb7d9165e79fc8
[ "BSD-3-Clause" ]
2
2018-11-05T08:56:42.000Z
2019-05-03T12:40:43.000Z
from rest_framework import status from .Basetest import BaseTest class ReportArticleTestCase(BaseTest): def test_share_email(self): """Test user can share an article by email""" self.client.post(self.url, self.comment_data, format='json') response = self.client.post( self.share_email_url, format='json') self.assertEqual(response.status_code, status.HTTP_200_OK) def test_share_facebook(self): """Test user can share an article by facebook""" self.client.post(self.url, self.comment_data, format='json') response = self.client.post( self.share_facebook_url, format='json') self.assertEqual(response.status_code, status.HTTP_200_OK) def test_share_twitter(self): """Test user can share an article by twitter""" self.client.post(self.url, self.comment_data, format='json') response = self.client.post( self.share_twitter_url, format='json') self.assertEqual(response.status_code, status.HTTP_200_OK)
35.264706
56
0.597998
138
1,199
5.014493
0.23913
0.086705
0.121387
0.156069
0.767341
0.767341
0.767341
0.767341
0.632948
0.632948
0
0.010856
0.30859
1,199
33
57
36.333333
0.823884
0.10342
0
0.625
0
0
0.022663
0
0
0
0
0
0.125
1
0.125
false
0
0.083333
0
0.25
0
0
0
0
null
0
0
0
0
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
0
0
0
0
0
0
4
ec8736eb3aacf9cebf7f256055bee08c64902f38
172
py
Python
ex14.py
eng-lenin/Python
6038f052b8343878760ed133dd43869927e39b3d
[ "MIT" ]
1
2021-01-30T14:50:55.000Z
2021-01-30T14:50:55.000Z
ex14.py
eng-lenin/Python
6038f052b8343878760ed133dd43869927e39b3d
[ "MIT" ]
null
null
null
ex14.py
eng-lenin/Python
6038f052b8343878760ed133dd43869927e39b3d
[ "MIT" ]
null
null
null
c=float(input('Insira a temperatura em graus celsius: ')) f=c*(9/5) + 32 print('A temperatura de {} graus celsius corresponde a {:.2f} graus farenheit.'.format(c,f) )
43
91
0.674419
28
172
4.142857
0.678571
0.206897
0
0
0
0
0
0
0
0
0
0.034483
0.156977
172
4
92
43
0.765517
0
0
0
0
0
0.635838
0
0
0
0
0
0
1
0
false
0
0
0
0
0.25
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
1
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
4
01a98f87b84c1d00d335404aeb0548baf37c8bc7
65
py
Python
project/test_utils.py
GWU-CS2021/CSCI6461
a0b276aa6ba294a1c28132334d64f6326dd2eace
[ "MIT" ]
null
null
null
project/test_utils.py
GWU-CS2021/CSCI6461
a0b276aa6ba294a1c28132334d64f6326dd2eace
[ "MIT" ]
null
null
null
project/test_utils.py
GWU-CS2021/CSCI6461
a0b276aa6ba294a1c28132334d64f6326dd2eace
[ "MIT" ]
null
null
null
from src.cpu import CPU instance = CPU() instance.trigger_mfr(1)
16.25
23
0.769231
11
65
4.454545
0.727273
0.44898
0
0
0
0
0
0
0
0
0
0.017544
0.123077
65
4
24
16.25
0.842105
0
0
0
0
0
0
0
0
0
0
0
0
1
0
false
0
0.333333
0
0.333333
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
0
0
1
0
0
0
0
4
01fe318cbb6c3773a83de7b5a0abcf5437a42010
4,212
py
Python
src/neuralNetwork.py
AmitNiz/NeuralNetwork
b8d85d5196c93ce813571af69361b0a0b3c56a18
[ "MIT" ]
1
2020-01-23T09:09:45.000Z
2020-01-23T09:09:45.000Z
src/neuralNetwork.py
AmitNiz/neuralNetwork
b8d85d5196c93ce813571af69361b0a0b3c56a18
[ "MIT" ]
null
null
null
src/neuralNetwork.py
AmitNiz/neuralNetwork
b8d85d5196c93ce813571af69361b0a0b3c56a18
[ "MIT" ]
null
null
null
import numpy import scipy.special import os.path as pf class createNeuralNetwork: def __init__(self,inputnodes,hiddennodes,outputnodes,learningrate): #Set num of nodes in each layer self.inodes = inputnodes self.hnodes = hiddennodes self.onodes = outputnodes #Learning rate self.lr = learningrate #Setting the Weights self.wih = numpy.random.normal(0.0,pow(self.hnodes,-0.5),(self.hnodes,self.inodes)) self.who = numpy.random.normal(0.0,pow(self.onodes,-0.5),(self.onodes,self.hnodes)) if(pf.isfile("../data/wih.npy")==1): self.wih = numpy.load("../data/wih.npy") if(pf.isfile("../data/who.npy")==1): self.who = numpy.load("../data/who.npy") #Sigmoid function self.activationFunction = lambda x: scipy.special.expit(x) def train(self,inputsList,targetsList): #Convert the inputs into an Array inputs = numpy.array(inputsList,ndmin=2).T targets = numpy.array(targetsList,ndmin=2).T #Calculate signals into hidden layer hiddenInputs = numpy.dot(self.wih,inputs) #Calculate the outputs of the hidden layer hiddenOutputs = self.activationFunction(hiddenInputs) #Calculate signals into the output layer finalInputs = numpy.dot(self.who,hiddenOutputs) #Calculate the final output finalOutputs = self.activationFunction(finalInputs) #Calculate the output errors outputErrors = targets - finalOutputs #Calculate the hidden layer errors hiddenErrors = numpy.dot(self.who.T,outputErrors) #Update the Weights between the hidden and the output layers self.who += self.lr * numpy.dot((outputErrors*finalOutputs*(1.0-finalOutputs)),numpy.transpose(hiddenOutputs)) #Update the weights between the input and the hidden layers self.wih += self.lr * numpy.dot((hiddenErrors*hiddenOutputs*(1.0-hiddenOutputs)),numpy.transpose(inputs)) #Save the new weights numpy.save('data/who.npy',self.who) numpy.save('data/wih.npy',self.wih) return numpy.argmax(finalOutputs) def train(self, inputsList): # Convert the inputs into an Array inputs = numpy.array(inputsList, ndmin=2).T targets = int(input("What is the Number?")) # Calculate signals into hidden layer hiddenInputs = numpy.dot(self.wih, inputs) # Calculate the outputs of the hidden layer hiddenOutputs = self.activationFunction(hiddenInputs) # Calculate signals into the output layer finalInputs = numpy.dot(self.who, hiddenOutputs) # Calculate the final output finalOutputs = self.activationFunction(finalInputs) # Calculate the output errors outputErrors = targets - finalOutputs # Calculate the hidden layer errors hiddenErrors = numpy.dot(self.who.T, outputErrors) # Update the Weights between the hidden and the output layers self.who += self.lr * numpy.dot((outputErrors * finalOutputs * (1.0 - finalOutputs)), numpy.transpose(hiddenOutputs)) # Update the weights between the input and the hidden layers self.wih += self.lr * numpy.dot((hiddenErrors * hiddenOutputs * (1.0 - hiddenOutputs)), numpy.transpose(inputs)) # Save the new weights numpy.save('../data/who.npy', self.who) numpy.save('../data/wih.npy', self.wih) return finalOutputs def query(self, inputsList): #Convert inputs into a 2D Array inputs = numpy.array(inputsList,ndmin=2).T #Calculate signals into hidden layer hiddenInputs = numpy.dot(self.wih, inputs) #Calculate the output of the hidden layer hiddenOutputs = self.activationFunction(hiddenInputs) #calculate signals into the output layer finalInputs = numpy.dot(self.who,hiddenOutputs) #Calculate the results finalOutputs = self.activationFunction(finalInputs) return finalOutputs
39.735849
121
0.640551
482
4,212
5.589212
0.19917
0.035635
0.035635
0.02784
0.727171
0.727171
0.727171
0.707869
0.696362
0.696362
0
0.007424
0.264482
4,212
105
122
40.114286
0.862169
0.235755
0
0.442308
0
0
0.043126
0
0
0
0
0
0
1
0.076923
false
0
0.057692
0
0.211538
0
0
0
0
null
0
0
0
0
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
0
0
0
0
0
0
4
bf09ecfcb4beb7385271c4898287fe0dd265c0de
145
py
Python
reddit2telegram/channels/r_tiktok_tits/app.py
mainyordle/reddit2telegram
1163e15aed3b6ff0fba65b222d3d9798f644c386
[ "MIT" ]
187
2016-09-20T09:15:54.000Z
2022-03-29T12:22:33.000Z
reddit2telegram/channels/r_tiktok_tits/app.py
mainyordle/reddit2telegram
1163e15aed3b6ff0fba65b222d3d9798f644c386
[ "MIT" ]
84
2016-09-22T14:25:07.000Z
2022-03-19T01:26:17.000Z
reddit2telegram/channels/r_tiktok_tits/app.py
mainyordle/reddit2telegram
1163e15aed3b6ff0fba65b222d3d9798f644c386
[ "MIT" ]
172
2016-09-21T15:39:39.000Z
2022-03-16T15:15:58.000Z
#encoding:utf-8 subreddit = 'TikTok_Tits' t_channel = '@r_TikTok_Tits' def send_post(submission, r2t): return r2t.send_simple(submission)
16.111111
38
0.751724
21
145
4.904762
0.761905
0.194175
0
0
0
0
0
0
0
0
0
0.02381
0.131034
145
8
39
18.125
0.793651
0.096552
0
0
0
0
0.192308
0
0
0
0
0
0
1
0.25
false
0
0
0.25
0.5
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
0
1
0
0
0
4
17111a7e7c8e456d0ce1828439ee40e36c5a274e
70
py
Python
tests/wasp1/AllAnswerSets/builtins_9__N_2.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
19
2015-12-03T08:53:45.000Z
2022-03-31T02:09:43.000Z
tests/wasp1/AllAnswerSets/builtins_9__N_2.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
80
2017-11-25T07:57:32.000Z
2018-06-10T19:03:30.000Z
tests/wasp1/AllAnswerSets/builtins_9__N_2.test.py
bernardocuteri/wasp
05c8f961776dbdbf7afbf905ee00fc262eba51ad
[ "Apache-2.0" ]
6
2015-01-15T07:51:48.000Z
2020-06-18T14:47:48.000Z
input = """ """ output = """ {-p(1), number(1), number(2), p(2)} """
10
35
0.414286
10
70
2.9
0.6
0.482759
0
0
0
0
0
0
0
0
0
0.070175
0.185714
70
6
36
11.666667
0.438596
0
0
0.4
0
0
0.542857
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
0
0
null
1
0
0
0
0
0
0
0
0
0
0
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
0
0
4
173892fd367b03715db93579415d459a7ab61aa5
266
py
Python
d2go/modeling/modeldef/__init__.py
tsubauaaa/d2go
9f746159ebf78ce79f644c405ca8695bc29d1075
[ "Apache-2.0" ]
null
null
null
d2go/modeling/modeldef/__init__.py
tsubauaaa/d2go
9f746159ebf78ce79f644c405ca8695bc29d1075
[ "Apache-2.0" ]
null
null
null
d2go/modeling/modeldef/__init__.py
tsubauaaa/d2go
9f746159ebf78ce79f644c405ca8695bc29d1075
[ "Apache-2.0" ]
null
null
null
#!/usr/bin/env python3 # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ This is the centralized place to define modeldef for all projects under D2Go. """ # @fb-only: from . import fb # isort:skip # noqa from . import modeldef # noqa
24.181818
77
0.703008
39
266
4.794872
0.846154
0.106952
0
0
0
0
0
0
0
0
0
0.009302
0.191729
266
10
78
26.6
0.860465
0.830827
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0
1
0
1
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
1762400608eddb787be2ae6189253513849bedfe
175
py
Python
app-django-demo/mysite/auction/forms.py
Xingkai98/AntiqueID-1
0daf9ebcdbc59182e5e11a845546f29a289a7c34
[ "MIT" ]
6
2018-09-20T03:39:15.000Z
2021-02-23T06:20:51.000Z
app-django-demo/mysite/auction/forms.py
Xingkai98/AntiqueID-1
0daf9ebcdbc59182e5e11a845546f29a289a7c34
[ "MIT" ]
3
2018-11-03T09:55:38.000Z
2018-12-16T13:34:05.000Z
app-django-demo/mysite/auction/forms.py
Xingkai98/AntiqueID-1
0daf9ebcdbc59182e5e11a845546f29a289a7c34
[ "MIT" ]
2
2018-09-20T03:39:16.000Z
2019-10-21T04:27:58.000Z
from django import forms class PirceForm(forms.Form): userpirce = forms.CharField(label="用户报价", max_length=128, widget=forms.TextInput(attrs={'class': 'form-control'}))
29.166667
118
0.742857
23
175
5.608696
0.782609
0
0
0
0
0
0
0
0
0
0
0.019108
0.102857
175
5
119
35
0.802548
0
0
0
0
0
0.12
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
0
1
0
1
0
0
4
176d5d27cf320f25a026bf6ecbf195abf5a91e38
236
py
Python
extensions.py
sambacha/spdx
b4141802a9e59745c3c330d15214237c7289d1d6
[ "MIT" ]
1
2021-03-19T04:53:16.000Z
2021-03-19T04:53:16.000Z
extensions.py
sambacha/spdx
b4141802a9e59745c3c330d15214237c7289d1d6
[ "MIT" ]
2
2020-08-17T01:14:58.000Z
2020-08-17T01:16:51.000Z
extensions.py
sambacha/spdx-runner
b4141802a9e59745c3c330d15214237c7289d1d6
[ "MIT" ]
null
null
null
# SPDX-License-Identifier: Apache-2.0 # @version 1.0.0 rules = { "sol": {"shebang": False, "comment": ["///", "/*", "//"],}, "rs": {"shebang": False, "comment": ["//", "/*"],}, "py": {"shebang": True, "comment": ["#"],}, }
26.222222
63
0.45339
23
236
4.652174
0.695652
0.224299
0.35514
0
0
0
0
0
0
0
0
0.025641
0.173729
236
8
64
29.5
0.523077
0.211864
0
0
0
0
0.333333
0
0
0
0
0
0
1
0
false
0
0
0
0
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
0
0
0
0
0
4
1799e65cdf9dfb66b909b308ca20e778801044de
313
py
Python
tests/schema/product/gql/fragments/fragment_product_relation_type_connection.py
simonsobs/acondbs
6ca11c2889d827ecdb2b54d0cf3b94b8cdd281e6
[ "MIT" ]
null
null
null
tests/schema/product/gql/fragments/fragment_product_relation_type_connection.py
simonsobs/acondbs
6ca11c2889d827ecdb2b54d0cf3b94b8cdd281e6
[ "MIT" ]
24
2020-04-02T19:29:07.000Z
2022-03-08T03:05:43.000Z
tests/schema/product/gql/fragments/fragment_product_relation_type_connection.py
simonsobs/acondbs
6ca11c2889d827ecdb2b54d0cf3b94b8cdd281e6
[ "MIT" ]
1
2020-04-08T15:48:28.000Z
2020-04-08T15:48:28.000Z
from .fragment_product_relation_type import FRAGMENT_PRODUCT_RELATION_TYPE FRAGMENT_PRODUCT_RELATION_TYPE_CONNECTION = ''' fragment fragmentProductRelationTypeConnection on ProductRelationTypeConnection { edges { node { ...fragmentProductRelationType } } } ''' + FRAGMENT_PRODUCT_RELATION_TYPE
26.083333
81
0.808307
26
313
9.230769
0.5
0.25
0.383333
0.45
0
0
0
0
0
0
0
0
0.134185
313
11
82
28.454545
0.885609
0
0
0
0
0
0.488818
0.306709
0
0
0
0
0
1
0
false
0
0.1
0
0.1
0
1
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
0
0
0
0
0
0
0
4
bd57bdc32754f8ef9f349378c01c700169d32018
215
py
Python
tests/test_projectname.py
agrc/health-index-indicators
4efb9639c878d090ac3f888391dec18ca38d6b16
[ "MIT" ]
1
2021-03-17T02:34:52.000Z
2021-03-17T02:34:52.000Z
tests/test_projectname.py
agrc/health-index-indicators
4efb9639c878d090ac3f888391dec18ca38d6b16
[ "MIT" ]
12
2020-05-18T23:30:34.000Z
2021-11-01T21:12:56.000Z
tests/test_projectname.py
agrc/health-index-indicators
4efb9639c878d090ac3f888391dec18ca38d6b16
[ "MIT" ]
5
2020-06-17T15:02:09.000Z
2021-03-12T17:17:41.000Z
#!/usr/bin/env python # * coding: utf8 * """ test_projectname.py A module that contains tests for the project module. """ from projectname import main def test_hello_returns_hi(): assert main.hello() == 'hi'
16.538462
52
0.706977
31
215
4.774194
0.806452
0
0
0
0
0
0
0
0
0
0
0.005587
0.167442
215
12
53
17.916667
0.821229
0.511628
0
0
0
0
0.020833
0
0
0
0
0
0.333333
1
0.333333
true
0
0.333333
0
0.666667
0
0
0
0
null
0
0
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
1
1
0
1
0
1
0
0
4
bd75a78611cb2c6c9faad044e4eb7ba83aa9e854
94
py
Python
__init__.py
Severson-Group/MachEval
dbb7999188133f8744636da53cab475ae538ce80
[ "BSD-3-Clause" ]
6
2021-11-02T20:12:32.000Z
2021-11-13T10:50:35.000Z
__init__.py
Severson-Group/MachEval
dbb7999188133f8744636da53cab475ae538ce80
[ "BSD-3-Clause" ]
18
2021-11-29T20:14:55.000Z
2022-03-02T07:17:37.000Z
__init__.py
Severson-Group/MachEval
dbb7999188133f8744636da53cab475ae538ce80
[ "BSD-3-Clause" ]
1
2022-01-29T00:52:38.000Z
2022-01-29T00:52:38.000Z
# -*- coding: utf-8 -*- """ Created on Mon May 30 18:27:14 2022 @author: Martin Johnson """
11.75
35
0.595745
15
94
3.733333
1
0
0
0
0
0
0
0
0
0
0
0.173333
0.202128
94
7
36
13.428571
0.573333
0.882979
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
bd7813b0880579a91bdf6fd6c2f80f92913de3ba
24
py
Python
variables/prodeu/pdfgeneration_spot.py
rohithasrk-bidgely/cloudformation-config-generation
d72d362c77b220169b3ccdd0b4a921910f7172ff
[ "MIT" ]
null
null
null
variables/prodeu/pdfgeneration_spot.py
rohithasrk-bidgely/cloudformation-config-generation
d72d362c77b220169b3ccdd0b4a921910f7172ff
[ "MIT" ]
9
2018-07-09T08:46:12.000Z
2018-07-18T09:13:03.000Z
variables/uat/pdfgeneration_spot.py
rohithasrk-bidgely/cloudformation-config-generation
d72d362c77b220169b3ccdd0b4a921910f7172ff
[ "MIT" ]
null
null
null
ami_id = "ami-e341c59b"
12
23
0.708333
4
24
4
0.75
0
0
0
0
0
0
0
0
0
0
0.238095
0.125
24
1
24
24
0.52381
0
0
0
0
0
0.5
0
0
0
0
0
0
1
0
false
0
0
0
0
0
1
1
0
null
0
0
0
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
4
bde049a5f5b93f23cb6b637fc340fa2816a27959
311
py
Python
Ex4.py
EduarTeixeira/Exercicios_LP_3B
dfbbd58e1a1c2033ee4f643cc5b60a86a7213f0a
[ "MIT" ]
null
null
null
Ex4.py
EduarTeixeira/Exercicios_LP_3B
dfbbd58e1a1c2033ee4f643cc5b60a86a7213f0a
[ "MIT" ]
null
null
null
Ex4.py
EduarTeixeira/Exercicios_LP_3B
dfbbd58e1a1c2033ee4f643cc5b60a86a7213f0a
[ "MIT" ]
null
null
null
n1 = int(input("Digite um número inteiro: ")) n2 = int(input("Digite um número inteiro: ")) n3 = int(input("Digite um número inteiro: ")) n4 = int(input("Digite um número inteiro: ")) n5 = int(input("Digite um número inteiro: ")) lista = [n1, n2, n3, n4, n5] print("A soma dos números da lista é: ", sum(lista))
44.428571
52
0.662379
51
311
4.039216
0.392157
0.194175
0.339806
0.38835
0.703884
0.703884
0
0
0
0
0
0.038314
0.160772
311
7
52
44.428571
0.750958
0
0
0
0
0
0.516026
0
0
0
0
0
0
1
0
false
0
0
0
0
0.142857
0
0
0
null
0
1
1
0
1
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
0
0
0
0
0
4
bde9629654eaed70d611f5b2f43f25f3a7a81337
86
py
Python
pymapillary/__init__.py
khmurakami/pymapillary
01412fc4470b0fd0fd9c4eb7540ed6d44fbd0877
[ "MIT" ]
3
2019-05-02T21:16:55.000Z
2020-10-30T05:07:27.000Z
pymapillary/__init__.py
khmurakami/pymapillary
01412fc4470b0fd0fd9c4eb7540ed6d44fbd0877
[ "MIT" ]
null
null
null
pymapillary/__init__.py
khmurakami/pymapillary
01412fc4470b0fd0fd9c4eb7540ed6d44fbd0877
[ "MIT" ]
1
2020-01-15T08:43:30.000Z
2020-01-15T08:43:30.000Z
from .pymapillary import Mapillary from .error_handling import * from .utils import *
21.5
34
0.802326
11
86
6.181818
0.636364
0
0
0
0
0
0
0
0
0
0
0
0.139535
86
3
35
28.666667
0.918919
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
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
0
0
4
da0bf05662c645dc00767830209590ee55777a4b
436
py
Python
code/backend/app/api/service/product_group_service.py
ndhngoc91/COMP90082_S1_TO_2021
91cc5d039df3b4d271b100a9afec99897a9501a2
[ "MIT" ]
2
2021-08-22T05:10:27.000Z
2021-11-08T12:57:27.000Z
code/backend/app/api/service/product_group_service.py
ndhngoc91/COMP90082_S1_TO_2021
91cc5d039df3b4d271b100a9afec99897a9501a2
[ "MIT" ]
null
null
null
code/backend/app/api/service/product_group_service.py
ndhngoc91/COMP90082_S1_TO_2021
91cc5d039df3b4d271b100a9afec99897a9501a2
[ "MIT" ]
1
2021-08-21T19:51:33.000Z
2021-08-21T19:51:33.000Z
from typing import Optional, List from sqlalchemy.orm import Session from app.api import models, schemas from app.api.repository import product_group_repo def get_all_product_groups(db: Session): return product_group_repo.get_all_product_groups(db=db) def get_product_groups_of_many_pacakges(package_ids: List[int], db: Session): return product_group_repo.get_product_groups_of_many_packages(package_ids=package_ids, db=db)
33.538462
97
0.837156
70
436
4.857143
0.414286
0.152941
0.141176
0.111765
0.429412
0.2
0.2
0
0
0
0
0
0.098624
436
12
98
36.333333
0.86514
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.5
0.25
1
0
0
0
0
null
0
0
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
1
0
0
1
1
1
0
0
4
da34ab3a2897bed596ca847819cc59538c9ad8ef
115
py
Python
python/testData/refactoring/pullup/fieldMove/Class.after.py
teddywest32/intellij-community
e0268d7a1da1d318b441001448cdd3e8929b2f29
[ "Apache-2.0" ]
null
null
null
python/testData/refactoring/pullup/fieldMove/Class.after.py
teddywest32/intellij-community
e0268d7a1da1d318b441001448cdd3e8929b2f29
[ "Apache-2.0" ]
null
null
null
python/testData/refactoring/pullup/fieldMove/Class.after.py
teddywest32/intellij-community
e0268d7a1da1d318b441001448cdd3e8929b2f29
[ "Apache-2.0" ]
1
2020-11-27T10:36:50.000Z
2020-11-27T10:36:50.000Z
from SuperClass import SuperClass class AnyClass(SuperClass): def __init__(self): super().__init__()
16.428571
33
0.704348
12
115
6.083333
0.75
0
0
0
0
0
0
0
0
0
0
0
0.2
115
6
34
19.166667
0.793478
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
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
0
0
0
0
1
0
0
4
da3c85053d535171d2ed14e1061c937653f66123
72
py
Python
code/tools/__init__.py
LordZagreus/LodeRunner
68aab36be47cabe31e52f3ee43520bdafcdf3c95
[ "MIT" ]
1
2017-10-31T22:26:22.000Z
2017-10-31T22:26:22.000Z
code/tools/__init__.py
team-sparrow/LodeRunner
68aab36be47cabe31e52f3ee43520bdafcdf3c95
[ "MIT" ]
2
2019-07-05T03:17:18.000Z
2019-07-08T16:15:29.000Z
code/tools/__init__.py
team-sparrow/LodeRunner
68aab36be47cabe31e52f3ee43520bdafcdf3c95
[ "MIT" ]
1
2020-10-15T09:03:20.000Z
2020-10-15T09:03:20.000Z
# This directory contains tool-type modules. # DO NOT REMOVE THIS FILE.
24
44
0.763889
11
72
5
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.166667
72
2
45
36
0.916667
0.930556
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
da3f591512cf71ae340d0c9cc4d376063566c847
535
py
Python
apps/common/baseResp.py
Iamnilaoba/pojian
5972233254c6852c8a6661c8327d5da2d2105530
[ "Apache-2.0" ]
2
2018-10-24T07:42:55.000Z
2018-10-24T07:43:02.000Z
apps/common/baseResp.py
Iamnilaoba/pojian
5972233254c6852c8a6661c8327d5da2d2105530
[ "Apache-2.0" ]
null
null
null
apps/common/baseResp.py
Iamnilaoba/pojian
5972233254c6852c8a6661c8327d5da2d2105530
[ "Apache-2.0" ]
null
null
null
#定义个返回response类,方便使用 class BaseResp: def __init__(self,code,msg,data=None): self.code=code self.msg=msg self.data=data class respCode: SUCCESS=200 UNAUTHERROR=401 PARAMERR=402 def respSuccess(msg,data=None): return BaseResp(code=respCode.SUCCESS,msg=msg,data=data).__dict__ def respParamErr(msg='参数错误',data=None): return BaseResp(code=respCode.PARAMERR,msg=msg,data=data).__dict__ def respUnAutherr(msg='没有访问权限'): return BaseResp(code=respCode.UNAUTHERROR,msg=msg).__dict__
20.576923
70
0.719626
71
535
5.197183
0.352113
0.075881
0.146341
0.211382
0.298103
0.298103
0
0
0
0
0
0.020045
0.160748
535
25
71
21.4
0.801782
0.035514
0
0
0
0
0.019608
0
0
0
0
0
0
1
0.266667
false
0
0
0.2
0.8
0
0
0
0
null
0
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
0
0
0
1
1
0
0
4
da5f2dc9aea7c1f6b66fc3bf31c01a66c0c8f00c
57
py
Python
nn/model/__init__.py
yuzuka4573/Dialog
8485e916458efcd21a414c4ecb09b79b2f439b99
[ "MIT" ]
61
2019-10-24T00:11:31.000Z
2022-02-27T15:21:40.000Z
nn/model/__init__.py
yuzuka4573/Dialog
8485e916458efcd21a414c4ecb09b79b2f439b99
[ "MIT" ]
10
2019-10-23T07:03:02.000Z
2021-07-29T06:54:27.000Z
nn/model/__init__.py
yuzuka4573/Dialog
8485e916458efcd21a414c4ecb09b79b2f439b99
[ "MIT" ]
27
2019-11-27T22:18:47.000Z
2022-03-01T15:35:37.000Z
from .encoder_decoder import EncoderDecoder, build_model
28.5
56
0.877193
7
57
6.857143
1
0
0
0
0
0
0
0
0
0
0
0
0.087719
57
1
57
57
0.923077
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
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
0
0
4
e515c8f20d4646fb9da983daa0f8c6005645f44f
10,642
py
Python
src/intelliflow/core/application/context/node/marshaling/nodes.py
amzn/rheoceros
5e8f79d97f8b21d693d3c869b0df70de3d5fd068
[ "Apache-2.0", "MIT-0" ]
4
2022-03-24T04:39:02.000Z
2022-03-31T16:41:50.000Z
src/intelliflow/core/application/context/node/marshaling/nodes.py
amzn/rheoceros
5e8f79d97f8b21d693d3c869b0df70de3d5fd068
[ "Apache-2.0", "MIT-0" ]
null
null
null
src/intelliflow/core/application/context/node/marshaling/nodes.py
amzn/rheoceros
5e8f79d97f8b21d693d3c869b0df70de3d5fd068
[ "Apache-2.0", "MIT-0" ]
null
null
null
# Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. # SPDX-License-Identifier: Apache-2.0 import copy import json from typing import Any, Dict, List, Optional, Sequence from intelliflow.core.application.context.node.filtered_views import FilteredView from intelliflow.core.platform.development import HostPlatform from intelliflow.core.signal_processing import DimensionFilter, Signal, Slot from intelliflow.core.signal_processing.dimension_constructs import Dimension, DimensionSpec, RawDimensionFilterInput from intelliflow.core.signal_processing.routing_runtime_constructs import Route from intelliflow.core.signal_processing.signal import SignalDimensionTuple, SignalDomainSpec, SignalLinkNode, SignalProvider from ..base import Node from ..internal import MonitoringConfig from ..internal.nodes import MonitoringView class MarshalerNode(Node, SignalProvider): """TODO refer doc Underlying node impls exposes themselves to user-level code via this node which provides a unified API across almost all of the high-level, generic operations in the framework. """ def __init__( self, bound: Node, desc: str # TODO extended marshaling support ) -> None: if bound is None: raise RuntimeError("'bound' is None. MarshalerNode should be bound to a Node") super().__init__(bound) self._bound = bound self._desc = desc @property def bound(self) -> Node: return self._bound # overrides @property def _id(self) -> str: return self.bound._id def __call__(self, *dimension_name: Sequence[str]) -> SignalDimensionTuple: """Convenience method wrapping `dimension()`""" return self.dimension(*dimension_name) def dimension(self, *dimensions: Sequence[str]) -> SignalDimensionTuple: signal: Signal = self._bound.signal().clone(None) dims: List[Dimension] = [] for dimension_name in dimensions: dim: Optional[Dimension] = signal.domain_spec.dimension_spec.find_dimension_by_name(dimension_name) if not dim: raise ValueError(f"Cannot find dimension {dimension_name} in {signal!r}") dims.append(dim) return SignalDimensionTuple(signal, *dims) def as_reference(self) -> "MarshalingView": return MarshalingView(self, self.signal(), None).as_reference() def reference(self) -> "MarshalingView": return self.as_reference() @property def ref(self) -> "MarshalingView": return self.as_reference() def range_check(self, enabled: Optional[bool] = True) -> "MarshalingView": return MarshalingView(self, self.signal(), None).range_check(enabled) def check_range(self) -> "MarshalingView": return self.range_check(True) def nearest(self) -> "MarshalingView": return MarshalingView(self, self.signal(), None).nearest() def latest(self) -> "MarshalingView": return self.nearest() def filter(self, new_filter: RawDimensionFilterInput, new_alias: str) -> Signal: """Build a new filtered version of the signal this node is tracking / bound to""" return self._bound.signal().chain(new_filter, new_alias) def __invert__(self) -> Any: """Overwrite bitwise not for high-level convenient operations between Signals.""" return ~self.signal() def __and__(self, other) -> Any: """Overwrite bitwise & for high-level operations operations between Signals.""" return self.signal() & other def __or__(self, other) -> Any: """Overwrite bitwise | for high-level operations operations between Signals.""" return self.signal() | other def __getitem__(self, slice_filter) -> "MarshalingView": """Convenience indexing method for high-level modules to build new filters for a Signal. Please see :class:`FilteredView` :: `__getitem__` for more details. This initiates the first level for the target filter and returns a FilteredView. After that, nested levels of the filter can be created by subsequent (cascaded) calls to FilterView chain. Parameters ---------- slice_filter: a single value or a slice (i.e [start:end] without step) or multiple slices (numpy style). Returns ------- :class:`FilteredView` : a new filtered view wrapping the same source `Signal` (copy semantics) """ if self.signal().domain_spec.dimension_filter_spec: dimension = next(iter(self.signal().domain_spec.dimension_spec.get_flattened_dimension_map().keys())) return MarshalingView(self, self.signal(), FilteredView.get_raw_filtering_input(slice_filter, dimension)) else: raise ValueError(f"Cannot create a filtered view on a Signal with no dimensions! Signal: {self.signal()!r}") # overrides def do_activate(self, platform: HostPlatform) -> None: """TODO post-MVP auto-generate marshaler/listener code to extract our metadata/marshalling info from the input data node. platform.connect_internal(Route(self._node_id, self._signal_link_node, self._output_signal, self._output_dim_matrix, self._slots(), self._auto_backfilling_enabled)) """ pass # overrides def signal(self) -> Optional[Signal]: return self._bound.signal() # overrides SignalProvider::get_signal def get_signal(self, alias: str = None) -> Signal: signal = self._bound.signal() return signal.clone(signal.alias if alias is None else alias) # overrides def _slots(self) -> Optional[List[Slot]]: pass def add_monitor(self, filter: DimensionFilter, config: MonitoringConfig): # TODO post-MVP create a child MonitoringNode. # - (?) append another MarshalerNode to it, and return that new marshaler. pass def describe(self) -> str: # TODO merge with FilteredView::stats. Move to a common node analyzer module. signal: Signal = self._bound.signal() stats = {"id/alias": signal.alias, "source_type": signal.resource_access_spec.source.value} if signal.type.is_metric(): stats.update({"metric_stats": signal.resource_access_spec.create_stats_from_filter(signal.domain_spec.dimension_filter_spec)}) else: stats.update( { "dimensions": [ (dim_name, dim.type, dim.params) for dim_name, dim in signal.domain_spec.dimension_spec.get_flattened_dimension_map().items() ], "current_filter_values": signal.domain_spec.dimension_filter_spec.pretty(), } ) return json.dumps(stats, indent=10, default=repr) def access_spec(self) -> Dict[str, Any]: signal: Signal = self._bound.signal() return { "id": self._bound._id, "source_type": signal.resource_access_spec.source.value, "path_format": signal.resource_access_spec.path_format, "attributes": copy.deepcopy(signal.resource_access_spec.attrs), } def attributes(self) -> Dict[Any, Any]: return self.access_spec()["attributes"] def metadata(self) -> str: return json.dumps(self.attributes(), indent=6, default=repr) ''' TODO enable this functionality once there is an workaround for calls onto this from serialization. def __getattr__(self, item) -> Any: """Enables convenient access into attributes/metadata. Gets called whenever an item is not found via __getattribute__ Example (based on user defined / custom metadata: my_data.CTI my_data.partition_keys my_data.columns """ attrs = self.attributes() for key, value in attrs.items(): if item.lower() == key.lower(): return value raise AttributeError(f"item {item!r} cannot be found in {json.dumps(attrs, indent=6)}") ''' def domain_spec(self) -> SignalDomainSpec: return copy.deepcopy(self._bound.signal().domain_spec) def dimension_spec(self) -> DimensionSpec: return copy.deepcopy(self._bound.signal().domain_spec.dimension_spec) def dimension_filter_spec(self) -> DimensionFilter: return copy.deepcopy(self._bound.signal().domain_spec.dimension_filter_spec) def paths(self) -> List[str]: return self._bound.signal().get_materialized_resource_paths() def path_format(self) -> str: return self._bound.signal().resource_access_spec.path_format def dimensions(self) -> str: """render human-readable dimension spec in name:type pairs and also render dimension filter.""" return json.dumps( { "dimensions": [ (dim_name, dim.type, dim.params) for dim_name, dim in self._bound.signal().domain_spec.dimension_spec.get_flattened_dimension_map().items() ], "current_filter_values": self._bound.signal().domain_spec.dimension_filter_spec.pretty(), }, indent=11, ) def partitions(self) -> str: return self.dimensions() def dimension_values(self) -> str: return json.dumps(self._bound.signal().domain_spec.dimension_filter_spec.pretty(), indent=10) def partition_values(self) -> str: return self.dimension_values() class MarshalingView(FilteredView): def __init__(self, marshaler_node: MarshalerNode, signal: Signal, filtering_levels: RawDimensionFilterInput) -> None: self._marshaler_node = marshaler_node super().__init__(signal, filtering_levels) @property def marshaler_node(self) -> MarshalerNode: return self._marshaler_node # overrides def _chain(self, signal: Signal, filtering_levels: RawDimensionFilterInput) -> "FilterView": return self.__class__(self._marshaler_node, signal, filtering_levels) def is_ready(self) -> bool: target_resource_range: Signal = self.get_signal() # TODO post-MVP # using the integrity check protocol from the signal # check each # target_resource_range.get_materialized_access_specs() pass def add_monitoring(self) -> MonitoringView: # TODO post-MVP # add pass
39.561338
138
0.65655
1,207
10,642
5.593206
0.25435
0.02533
0.031107
0.040735
0.278329
0.21419
0.159384
0.143682
0.10591
0.082654
0
0.001248
0.24704
10,642
268
139
39.708955
0.841258
0.205694
0
0.14094
0
0.006711
0.060308
0.005579
0
0
0
0.018657
0
1
0.268456
false
0.033557
0.080537
0.147651
0.583893
0
0
0
0
null
0
0
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
1
0
0
1
0
0
0
1
1
0
0
4
e51924b07a5072140d6a432d31fb946aa3093b51
8,141
py
Python
sales_analysis/data_pipeline/tests/test_data.py
jbmoorhouse/sales_analysis
229db8de3cd7e742142effd7fd8b74f0827bb5f7
[ "BSD-3-Clause" ]
null
null
null
sales_analysis/data_pipeline/tests/test_data.py
jbmoorhouse/sales_analysis
229db8de3cd7e742142effd7fd8b74f0827bb5f7
[ "BSD-3-Clause" ]
null
null
null
sales_analysis/data_pipeline/tests/test_data.py
jbmoorhouse/sales_analysis
229db8de3cd7e742142effd7fd8b74f0827bb5f7
[ "BSD-3-Clause" ]
null
null
null
from sales_analysis.data_pipeline import BASEPATH from sales_analysis.data_pipeline._pipeline import SalesPipeline import pytest import os import pandas as pd # -------------------------------------------------------------------------- # Fixtures @pytest.fixture def pipeline(): FILEPATH = os.path.join(BASEPATH, "data") DATA_FILES = [f for f in os.listdir(FILEPATH) if f.endswith('.csv')] DATA = {f : pd.read_csv(os.path.join(FILEPATH, f)) for f in DATA_FILES} return SalesPipeline(**DATA) # -------------------------------------------------------------------------- # Data data = {'customers': {pd.Timestamp('2019-08-01 00:00:00'): 9, pd.Timestamp('2019-08-02 00:00:00'): 10, pd.Timestamp('2019-08-03 00:00:00'): 10, pd.Timestamp('2019-08-04 00:00:00'): 10, pd.Timestamp('2019-08-05 00:00:00'): 9, pd.Timestamp('2019-08-06 00:00:00'): 9, pd.Timestamp('2019-08-07 00:00:00'): 10, pd.Timestamp('2019-08-08 00:00:00'): 8, pd.Timestamp('2019-08-09 00:00:00'): 5, pd.Timestamp('2019-08-10 00:00:00'): 5, pd.Timestamp('2019-08-11 00:00:00'): 10, pd.Timestamp('2019-08-12 00:00:00'): 10, pd.Timestamp('2019-08-13 00:00:00'): 6, pd.Timestamp('2019-08-14 00:00:00'): 7, pd.Timestamp('2019-08-15 00:00:00'): 10, pd.Timestamp('2019-08-16 00:00:00'): 8, pd.Timestamp('2019-08-17 00:00:00'): 7, pd.Timestamp('2019-08-18 00:00:00'): 9, pd.Timestamp('2019-08-19 00:00:00'): 5, pd.Timestamp('2019-08-20 00:00:00'): 5}, 'total_discount_amount': {pd.Timestamp('2019-08-01 00:00:00'): 15152814.736907512, pd.Timestamp('2019-08-02 00:00:00'): 20061245.64408109, pd.Timestamp('2019-08-03 00:00:00'): 26441693.751396574, pd.Timestamp('2019-08-04 00:00:00'): 25783015.567048658, pd.Timestamp('2019-08-05 00:00:00'): 16649773.993076814, pd.Timestamp('2019-08-06 00:00:00'): 24744027.428384878, pd.Timestamp('2019-08-07 00:00:00'): 21641181.771564845, pd.Timestamp('2019-08-08 00:00:00'): 27012160.85245146, pd.Timestamp('2019-08-09 00:00:00'): 13806814.237002019, pd.Timestamp('2019-08-10 00:00:00'): 9722459.599448118, pd.Timestamp('2019-08-11 00:00:00'): 20450260.26194652, pd.Timestamp('2019-08-12 00:00:00'): 22125711.151501, pd.Timestamp('2019-08-13 00:00:00'): 11444206.200090334, pd.Timestamp('2019-08-14 00:00:00'): 17677326.65707852, pd.Timestamp('2019-08-15 00:00:00'): 26968819.12338184, pd.Timestamp('2019-08-16 00:00:00'): 22592246.991756547, pd.Timestamp('2019-08-17 00:00:00'): 15997597.519811645, pd.Timestamp('2019-08-18 00:00:00'): 17731498.506244037, pd.Timestamp('2019-08-19 00:00:00'): 22127822.876592986, pd.Timestamp('2019-08-20 00:00:00'): 5550506.789972418}, 'items': {pd.Timestamp('2019-08-01 00:00:00'): 2895, pd.Timestamp('2019-08-02 00:00:00'): 3082, pd.Timestamp('2019-08-03 00:00:00'): 3559, pd.Timestamp('2019-08-04 00:00:00'): 3582, pd.Timestamp('2019-08-05 00:00:00'): 2768, pd.Timestamp('2019-08-06 00:00:00'): 3431, pd.Timestamp('2019-08-07 00:00:00'): 2767, pd.Timestamp('2019-08-08 00:00:00'): 2643, pd.Timestamp('2019-08-09 00:00:00'): 1506, pd.Timestamp('2019-08-10 00:00:00'): 1443, pd.Timestamp('2019-08-11 00:00:00'): 2466, pd.Timestamp('2019-08-12 00:00:00'): 3482, pd.Timestamp('2019-08-13 00:00:00'): 1940, pd.Timestamp('2019-08-14 00:00:00'): 1921, pd.Timestamp('2019-08-15 00:00:00'): 3479, pd.Timestamp('2019-08-16 00:00:00'): 3053, pd.Timestamp('2019-08-17 00:00:00'): 2519, pd.Timestamp('2019-08-18 00:00:00'): 2865, pd.Timestamp('2019-08-19 00:00:00'): 1735, pd.Timestamp('2019-08-20 00:00:00'): 1250}, 'order_total_avg': {pd.Timestamp('2019-08-01 00:00:00'): 1182286.0960463749, pd.Timestamp('2019-08-02 00:00:00'): 1341449.559055637, pd.Timestamp('2019-08-03 00:00:00'): 1270616.0372525519, pd.Timestamp('2019-08-04 00:00:00'): 1069011.1516039693, pd.Timestamp('2019-08-05 00:00:00'): 1355304.7342628485, pd.Timestamp('2019-08-06 00:00:00'): 1283968.435650978, pd.Timestamp('2019-08-07 00:00:00'): 1319110.4787216866, pd.Timestamp('2019-08-08 00:00:00'): 1027231.5196824896, pd.Timestamp('2019-08-09 00:00:00'): 1201471.0717715647, pd.Timestamp('2019-08-10 00:00:00'): 1314611.2300065856, pd.Timestamp('2019-08-11 00:00:00'): 1186152.4565363638, pd.Timestamp('2019-08-12 00:00:00'): 1155226.4552911327, pd.Timestamp('2019-08-13 00:00:00'): 1346981.8930212667, pd.Timestamp('2019-08-14 00:00:00'): 1019646.0386455443, pd.Timestamp('2019-08-15 00:00:00'): 1286793.278547962, pd.Timestamp('2019-08-16 00:00:00'): 1254721.8660029566, pd.Timestamp('2019-08-17 00:00:00'): 1419237.673786449, pd.Timestamp('2019-08-18 00:00:00'): 1173087.9508403398, pd.Timestamp('2019-08-19 00:00:00'): 1162434.8033358732, pd.Timestamp('2019-08-20 00:00:00'): 1046669.750923031}, 'discount_rate_avg': {pd.Timestamp('2019-08-01 00:00:00'): 0.1252497888814673, pd.Timestamp('2019-08-02 00:00:00'): 0.12950211356271726, pd.Timestamp('2019-08-03 00:00:00'): 0.1490744307031331, pd.Timestamp('2019-08-04 00:00:00'): 0.15162918618667656, pd.Timestamp('2019-08-05 00:00:00'): 0.13130630218741238, pd.Timestamp('2019-08-06 00:00:00'): 0.13373546744128126, pd.Timestamp('2019-08-07 00:00:00'): 0.15567735848995318, pd.Timestamp('2019-08-08 00:00:00'): 0.20265603603112725, pd.Timestamp('2019-08-09 00:00:00'): 0.17727372441724282, pd.Timestamp('2019-08-10 00:00:00'): 0.1420197829256685, pd.Timestamp('2019-08-11 00:00:00'): 0.15144502071841046, pd.Timestamp('2019-08-12 00:00:00'): 0.12961399577196853, pd.Timestamp('2019-08-13 00:00:00'): 0.12731849238164458, pd.Timestamp('2019-08-14 00:00:00'): 0.20101097686303473, pd.Timestamp('2019-08-15 00:00:00'): 0.14895723666327493, pd.Timestamp('2019-08-16 00:00:00'): 0.12871697115230343, pd.Timestamp('2019-08-17 00:00:00'): 0.14041300964840808, pd.Timestamp('2019-08-18 00:00:00'): 0.13535199553408908, pd.Timestamp('2019-08-19 00:00:00'): 0.21438859223995432, pd.Timestamp('2019-08-20 00:00:00'): 0.11914043920600781}} # -------------------------------------------------------------------------- # Tests @pytest.mark.parametrize( "attribute", [ ("orders"), ("commissions"), ("order_lines"), ("product_promotions"), ("products"), ("promotions") ] ) def test_instance(pipeline, attribute): assert hasattr(pipeline, attribute) @pytest.mark.parametrize("solution", [data]) def test_summary(pipeline, solution): summary = pipeline.summary() assert summary.iloc[:20].equals(pd.DataFrame.from_dict(data))
56.93007
83
0.531139
1,083
8,141
3.975069
0.190212
0.18583
0.348432
0.39489
0.601394
0.587921
0.587921
0.587921
0.013008
0
0
0.432059
0.280432
8,141
143
84
56.93007
0.302834
0.030095
0
0
0
0
0.260583
0.002662
0
0
0
0
0.015625
1
0.023438
false
0
0.039063
0
0.070313
0
0
0
0
null
0
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
4
e55ba7b6a5aff26fe575bdd5535fad045ffcbb3e
254
py
Python
test/test_import.py
jlubken/dsdk
ffd8a3ebab0488612396640578deb463ce0e8e74
[ "MIT" ]
6
2020-03-27T20:56:27.000Z
2022-01-11T16:10:22.000Z
test/test_import.py
jlubken/dsdk
ffd8a3ebab0488612396640578deb463ce0e8e74
[ "MIT" ]
37
2019-12-11T21:15:21.000Z
2021-12-22T14:57:38.000Z
test/test_import.py
jlubken/dsdk
ffd8a3ebab0488612396640578deb463ce0e8e74
[ "MIT" ]
5
2020-03-31T16:30:48.000Z
2022-02-10T20:50:34.000Z
# -*- coding: utf-8 -*- """Test import.""" def test_import(): """Test import.""" import dsdk # pylint: disable=import-outside-toplevel assert dsdk.Asset is not None assert dsdk.Interval is not None assert dsdk.Service is not None
21.166667
58
0.649606
35
254
4.685714
0.514286
0.182927
0.164634
0.182927
0.231707
0
0
0
0
0
0
0.005025
0.216535
254
11
59
23.090909
0.819095
0.346457
0
0
0
0
0
0
0
0
0
0
0.6
1
0.2
true
0
0.4
0
0.6
0
0
0
0
null
0
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
1
0
0
1
0
1
0
0
0
0
4
e564d44f352fd7ef3897146798ec9870c6b3d51e
7,502
py
Python
oidc/tests/conftest.py
didx-xyz/yoma-oidc-bridge
7e3ff6ab3ea4fed01cd7d4c113c7c3b3244356eb
[ "Apache-2.0" ]
4
2020-10-08T07:36:22.000Z
2022-02-04T12:31:31.000Z
oidc/tests/conftest.py
didx-xyz/yoma-oidc-bridge
7e3ff6ab3ea4fed01cd7d4c113c7c3b3244356eb
[ "Apache-2.0" ]
1
2021-04-10T08:32:42.000Z
2021-04-10T08:32:42.000Z
oidc/tests/conftest.py
didx-xyz/yoma-oidc-bridge
7e3ff6ab3ea4fed01cd7d4c113c7c3b3244356eb
[ "Apache-2.0" ]
7
2021-02-10T16:04:29.000Z
2022-03-16T08:04:48.000Z
import pytest from oidc.models import AuthSession, PresentationConfigurations, MappedUrl from django.utils import timezone from datetime import timedelta from oidc_provider.models import RSAKey @pytest.fixture def email_presentation_configuration(): return PresentationConfigurations.objects.create( id="verified-email", subject_identifier="email", configuration={ "name": "Basic Proof", "version": "1.0", "requested_attributes": [{"name": "email", "restrictions": []}], "requested_predicates": [], }, ) @pytest.fixture def name_presentation_configuration(): return PresentationConfigurations.objects.create( id="verified-email", subject_identifier="name", configuration={ "name": "Basic Proof", "version": "1.0", "requested_attributes": [{"name": "email", "restrictions": []}], "requested_predicates": [], }, ) @pytest.fixture def jwt_key(): # kid 3e3ee3f767a83d16f3cee02eb5e5eb92 return RSAKey.objects.create( key="""-----BEGIN RSA PRIVATE KEY----- MIIEpAIBAAKCAQEAtkoI5r2r+7SNcqBUTRNiVoVGwtBzvWZQqaGvL44vjLvkTBmH BkW1eLVMYH+V00b+lAoZ+Crynw3Nd7vGlP3tpTD2PIfOUFyrrL1ed8ghHbgeQflX uoLg3/8X3lFNYsj2DkTgDzHaJI9ZswpRHNF+gVCfKGqvSYLOlPKeAfxnJybvf4WQ 1FDjDYuVY2h8t/ZM6IMbzqgAYJZW4unsS3D8n0JtwxNT//K6GjgcJdF5bJiI5Vvh YjOTi45iMWvN9bWSPBCHR2YKjT7SbgihoCGVB0cq2ROOpEiU3IIZ6ZBY6IKVB5w8 frmsXBVyf8zmJeqHw+jF92xwCyljfNKkRTrW0QIDAQABAoIBAAjrU8bWflUb3yqT UGH6Z3627rYW36g4xWGcw6b0B2eUxKA574gNs8oVijMpNaTXfcVd6SoMupUFu96h QB+HfS/urAhc12ofNAHeZ4I84eyZAayrYpuBo+HR6Ce8mqi8Dy4LjgWwTsLTMMm4 i4IkI1MjJWZ43IggRQi3W6aFOcGJ6lP8IM0WFfNu1Cv3W7BanvmVmI2L+UnFvvA5 LkWSX0kkx/I2p6++UtdO7foInftcmRnak6TQWj73hqSFKhlk3APVOSf9lTlhCwre 1y6s71QuNApdLGwzRlIfOqH307iXv78BQf2W7kh04oLQPaOWXSWb8/oYBpE5EPq9 Xffn3PECgYEAy/xN8dNapDICQplnSAXJrOXYYZ6bHXTMQrQAHYxPVyCV+aG5sqVh 1sZj7tUAmWXAIPLAqmHbAaOM8tK4+WTdDvnYnWkuh2s0SM2mPqD++HllJq2Op+NQ UbipAAPytrun47qSJOmrlw5/qPO27l4wRx5SangU4Q7sB7UT8lnsZf8CgYEA5MVx W6I1Vnk5u/JHRi0KTAJNT5ktBPNRUEYb2bQdvvlK+DPFM2rnimwQNz6eocIWvu4p TkFHFONJeed+45VLCpnvxXkx4VAp57sO4F/HHy31zCJ7GU/XzuWqvMS9pR9FiUVL lSw9WtxJp7jJL1uvjKaQYFZBC77ZqB3iZ2md4y8CgYEAunvcnjoE4Zs+abhorXVt HH28RfKECHfgzRJWEK1XU2Xc9iyd4e5D9d/FOHDObW6SKQ0Eij+Pwn3Mu6ldpdJK LgjHuZCREwg08mHfm93/exUwHh4JDv9HTI6vIe56FAiWwiCsvsZJMn30w3abRGwj YsEbw24oWGAV9C3dIHCJJ+0CgYEAx1gxDgsLdT2PDHHyn3jR1yfOXET6UK0BNvTQ geSMYwPxytO5y7Mk7Z56htke+48XqOn4vkLtgIsJVJtfG0rVJ/i5URbpWw8yZMXA Ec4DweyXmXiWUZkcUSIZpAG/yymzuwjR8ruo/wqjd+3yCT1YfDQL7JZcebKlEPRx e3Ex7msCgYAWXjeXhOFkQNvmA8zTP+iC37iqOEsTc730P0cADbfumBsbGIE0oJuX AvOCVR9tdci/jh2DbSxdB27hHw7BU2DU8ji71Ee97TQ1Fudkc4jpgFTyb2MZTy0Z YHj3yqoO69+shd3fWFonlshgo1MIhArEn+IpP7aJJupMb3JG/RWEyQ== -----END RSA PRIVATE KEY-----""" ) @pytest.fixture def validated_session(): return AuthSession.objects.create( id="0942a7b2-015d-420a-ac13-242694bcbf6f", presentation_record_id="verified-email", presentation_request_id="e2e1b664-5fd9-401d-96bc-26a62c4777a8", presentation_request={ "@id": "e505dc2a-5320-478f-8c65-a68f04562a47", "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/present-proof/1.0/request-presentation", "comment": None, "~service": { "routingKeys": None, "recipientKeys": ["2BbGm6Mo9BVkXkn1YGjUoEUBB85Ba7XZW6qfgpMXD3XP"], "serviceEndpoint": "http://127.0.0.1:8090", }, "request_presentations~attach": [ { "@id": "libindy-request-presentation-0", "data": { "base64": "eyJuYW1lIjogIkJhc2ljIFByb29mIiwgInZlcnNpb24iOiAiMS4wIiwgInJlcXVlc3RlZF9hdHRyaWJ1dGVzIjogeyJlMmQwMjJiMi0xNDNiLTRiNDctYjI4OS1lMmJhNzYyNTUyZjQiOiB7Im5hbWUiOiAiZW1haWwiLCAicmVzdHJpY3Rpb25zIjogW119fSwgInJlcXVlc3RlZF9wcmVkaWNhdGVzIjoge30sICJub25jZSI6ICIyMDUwOTE3MDc1Mzk4NDk3MDk3MTQyODg0MDIzNjQ5MDQyNDIxMTUifQ==" }, "mime-type": "application/json", } ], }, presentation_request_satisfied=True, expired_timestamp=timezone.now() + timedelta(days=1), request_parameters={ "nonce": "vdoOCIrMvSRn2vYcgAV3vszUKb3ACJlD", "scope": "openid profile vc_authn", "state": "O8ALJmGFm5ByvYMyWhT7vkzdc3dc5Yds", "client_id": "770241", "redirect_uri": "http://127.0.0.1:8080/oidc/auth/cb/", "response_type": "code", "pres_req_conf_id": "verified-email", }, presentation={ "predicates": {}, "revealed_attrs": { "e2d022b2-143b-4b47-b289-e2ba762552f4": { "raw": "test@mail.org", "encoded": "69775574976209370463886362368455342215648530278529236721860183817752792728556", "sub_proof_index": 0, } }, "unrevealed_attrs": {}, "self_attested_attrs": {}, }, ) @pytest.fixture def non_validated_session(): return AuthSession.objects.create( id="0942a7b2-015d-420a-ac13-242694bcbf6f", presentation_record_id="verified-email", presentation_request_id="e2e1b664-5fd9-401d-96bc-26a62c4777a8", presentation_request={ "@id": "e505dc2a-5320-478f-8c65-a68f04562a47", "@type": "did:sov:BzCbsNYhMrjHiqZDTUASHg;spec/present-proof/1.0/request-presentation", "comment": None, "~service": { "routingKeys": None, "recipientKeys": ["2BbGm6Mo9BVkXkn1YGjUoEUBB85Ba7XZW6qfgpMXD3XP"], "serviceEndpoint": "http://127.0.0.1:8090", }, "request_presentations~attach": [ { "@id": "libindy-request-presentation-0", "data": { "base64": "eyJuYW1lIjogIkJhc2ljIFByb29mIiwgInZlcnNpb24iOiAiMS4wIiwgInJlcXVlc3RlZF9hdHRyaWJ1dGVzIjogeyJlMmQwMjJiMi0xNDNiLTRiNDctYjI4OS1lMmJhNzYyNTUyZjQiOiB7Im5hbWUiOiAiZW1haWwiLCAicmVzdHJpY3Rpb25zIjogW119fSwgInJlcXVlc3RlZF9wcmVkaWNhdGVzIjoge30sICJub25jZSI6ICIyMDUwOTE3MDc1Mzk4NDk3MDk3MTQyODg0MDIzNjQ5MDQyNDIxMTUifQ==" }, "mime-type": "application/json", } ], }, presentation_request_satisfied=False, expired_timestamp=timezone.now() + timedelta(days=1), request_parameters={ "nonce": "vdoOCIrMvSRn2vYcgAV3vszUKb3ACJlD", "scope": "openid profile vc_authn", "state": "O8ALJmGFm5ByvYMyWhT7vkzdc3dc5Yds", "client_id": "770241", "redirect_uri": "http://127.0.0.1:8080/oidc/auth/cb/", "response_type": "code", "pres_req_conf_id": "verified-email", }, presentation={ "predicates": {}, "revealed_attrs": { "e2d022b2-143b-4b47-b289-e2ba762552f4": { "raw": "test@mail.org", "encoded": "69775574976209370463886362368455342215648530278529236721860183817752792728556", "sub_proof_index": 0, } }, "unrevealed_attrs": {}, "self_attested_attrs": {}, }, ) @pytest.fixture def mapped_url(non_validated_session): return MappedUrl.objects.create(url="http://url.com", session=non_validated_session)
42.868571
340
0.675153
482
7,502
10.371369
0.429461
0.015603
0.019204
0.021604
0.605321
0.605321
0.605321
0.605321
0.605321
0.605321
0
0.133299
0.225007
7,502
174
341
43.114943
0.726522
0.004799
0
0.571429
0
0
0.561227
0.418274
0
1
0
0
0
1
0.037267
false
0
0.031056
0.037267
0.10559
0
0
0
1
null
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
null
1
0
0
0
0
0
0
0
0
0
0
0
0
4
e594290d2512b9d1f6fb0279b552a067dff1ff1d
157
py
Python
entities/status.py
MiKoronjoo/snappfood-database
d413e96f0063f971051ecb7b9ace6608c97e3017
[ "MIT" ]
2
2020-07-24T07:12:50.000Z
2020-08-11T09:13:14.000Z
entities/status.py
MiKoronjoo/snappfood-database
d413e96f0063f971051ecb7b9ace6608c97e3017
[ "MIT" ]
null
null
null
entities/status.py
MiKoronjoo/snappfood-database
d413e96f0063f971051ecb7b9ace6608c97e3017
[ "MIT" ]
null
null
null
from entities.entity import Entity class Status(Entity): def __init__(self, statusId, name): self.statusId = statusId self.name = name
19.625
39
0.675159
19
157
5.368421
0.578947
0.235294
0
0
0
0
0
0
0
0
0
0
0.242038
157
7
40
22.428571
0.857143
0
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0
0.2
0
0.6
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
0
0
0
0
1
0
0
4
e59ed03763f8f180fb491d37d97e9eb0dff2c878
62,809
py
Python
pacu/models/awsapi/autoscaling.py
RyanJarv/Pacu2
27df4bcf296fc8f467d3dc671a47bf9519ce7a24
[ "MIT" ]
1
2022-03-09T14:51:54.000Z
2022-03-09T14:51:54.000Z
pacu/models/awsapi/autoscaling.py
RyanJarv/Pacu2
27df4bcf296fc8f467d3dc671a47bf9519ce7a24
[ "MIT" ]
null
null
null
pacu/models/awsapi/autoscaling.py
RyanJarv/Pacu2
27df4bcf296fc8f467d3dc671a47bf9519ce7a24
[ "MIT" ]
null
null
null
# generated by datamodel-codegen: # filename: openapi.yaml # timestamp: 2021-12-31T02:45:28+00:00 from __future__ import annotations from datetime import datetime from enum import Enum from typing import Annotated, Any, List, Optional from pydantic import BaseModel, Field class XmlStringMaxLen19(BaseModel): __root__: Annotated[str, Field(max_length=19, min_length=1)] class ResourceContentionFault(BaseModel): __root__: Any class ServiceLinkedRoleFailure(ResourceContentionFault): pass class AttachLoadBalancerTargetGroupsResultType(BaseModel): pass class XmlStringMaxLen511(BaseModel): __root__: Annotated[str, Field(max_length=511, min_length=1)] class AttachLoadBalancersResultType(AttachLoadBalancerTargetGroupsResultType): pass class XmlStringMaxLen255(BaseModel): __root__: Annotated[str, Field(max_length=255, min_length=1)] class AlreadyExistsFault(ResourceContentionFault): pass class LimitExceededFault(ResourceContentionFault): pass class CancelInstanceRefreshAnswer(BaseModel): InstanceRefreshId: Optional[XmlStringMaxLen255] = None class ActiveInstanceRefreshNotFoundFault(ResourceContentionFault): pass class CompleteLifecycleActionAnswer(AttachLoadBalancerTargetGroupsResultType): pass class LaunchTemplateName(BaseModel): __root__: Annotated[ str, Field(max_length=128, min_length=3, regex='[a-zA-Z0-9\\(\\)\\.\\-/_]+') ] class XmlStringMaxLen1600(BaseModel): __root__: Annotated[str, Field(max_length=1600, min_length=1)] class XmlString(BaseModel): __root__: str class MonitoringEnabled(BaseModel): __root__: bool class InstanceMetadataHttpTokensState(Enum): optional = 'optional' required = 'required' class InstanceMetadataHttpPutResponseHopLimit(BaseModel): __root__: Annotated[int, Field(ge=1.0, le=64.0)] class InstanceMetadataEndpointState(Enum): disabled = 'disabled' enabled = 'enabled' class ResourceInUseFault(ResourceContentionFault): pass class ScalingActivityInProgressFault(ResourceContentionFault): pass class DeleteLifecycleHookAnswer(AttachLoadBalancerTargetGroupsResultType): pass class DeleteWarmPoolAnswer(AttachLoadBalancerTargetGroupsResultType): pass class InvalidNextToken(ResourceContentionFault): pass class AsciiStringMaxLen255(BaseModel): __root__: Annotated[ str, Field(max_length=255, min_length=1, regex='[A-Za-z0-9\\-_\\/]+') ] class ResourceName(XmlStringMaxLen1600): pass class XmlStringMaxLen64(BaseModel): __root__: Annotated[str, Field(max_length=64, min_length=1)] class DetachLoadBalancerTargetGroupsResultType( AttachLoadBalancerTargetGroupsResultType ): pass class DetachLoadBalancersResultType(AttachLoadBalancerTargetGroupsResultType): pass class PutLifecycleHookAnswer(AttachLoadBalancerTargetGroupsResultType): pass class MetricScale(BaseModel): __root__: float class DisableScaleIn(MonitoringEnabled): pass class PredictiveScalingMode(Enum): ForecastAndScale = 'ForecastAndScale' ForecastOnly = 'ForecastOnly' class PredictiveScalingSchedulingBufferTime(BaseModel): __root__: Annotated[int, Field(ge=0.0)] class PredictiveScalingMaxCapacityBreachBehavior(Enum): HonorMaxCapacity = 'HonorMaxCapacity' IncreaseMaxCapacity = 'IncreaseMaxCapacity' class PredictiveScalingMaxCapacityBuffer(BaseModel): __root__: Annotated[int, Field(ge=0.0, le=100.0)] class PutWarmPoolAnswer(AttachLoadBalancerTargetGroupsResultType): pass class RecordLifecycleActionHeartbeatAnswer(AttachLoadBalancerTargetGroupsResultType): pass class SetInstanceProtectionAnswer(AttachLoadBalancerTargetGroupsResultType): pass class StartInstanceRefreshAnswer(CancelInstanceRefreshAnswer): pass class LaunchTemplateSpecification(BaseModel): """ Describes the launch template and the version of the launch template that Amazon EC2 Auto Scaling uses to launch Amazon EC2 instances. For more information about launch templates, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/LaunchTemplates.html">Launch templates</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>. """ LaunchTemplateId: Optional[XmlStringMaxLen255] = None LaunchTemplateName: Optional[LaunchTemplateName] = None Version: Optional[XmlStringMaxLen255] = None class IntPercent(PredictiveScalingMaxCapacityBuffer): pass class RefreshInstanceWarmup(PredictiveScalingSchedulingBufferTime): pass class CheckpointDelay(BaseModel): __root__: Annotated[int, Field(ge=0.0, le=172800.0)] class SkipMatching(MonitoringEnabled): pass class InstanceRefreshInProgressFault(ResourceContentionFault): pass class XmlStringMaxLen1023(BaseModel): __root__: Annotated[str, Field(max_length=1023, min_length=1)] class TimestampType(BaseModel): __root__: datetime class ScalingActivityStatusCode(Enum): PendingSpotBidPlacement = 'PendingSpotBidPlacement' WaitingForSpotInstanceRequestId = 'WaitingForSpotInstanceRequestId' WaitingForSpotInstanceId = 'WaitingForSpotInstanceId' WaitingForInstanceId = 'WaitingForInstanceId' PreInService = 'PreInService' InProgress = 'InProgress' WaitingForELBConnectionDraining = 'WaitingForELBConnectionDraining' MidLifecycleAction = 'MidLifecycleAction' WaitingForInstanceWarmup = 'WaitingForInstanceWarmup' Successful = 'Successful' Failed = 'Failed' Cancelled = 'Cancelled' class Progress(BaseModel): __root__: int class AutoScalingGroupState(BaseModel): __root__: Annotated[str, Field(max_length=32, min_length=1)] class ActivityIds(BaseModel): __root__: List[XmlString] class AdjustmentType(BaseModel): """ Describes a policy adjustment type. """ AdjustmentType: Optional[XmlStringMaxLen255] = None class AdjustmentTypes(BaseModel): __root__: List[AdjustmentType] class Alarm(BaseModel): """ Describes an alarm. """ AlarmName: Optional[XmlStringMaxLen255] = None AlarmARN: Optional[ResourceName] = None class Alarms(BaseModel): __root__: List[Alarm] class AssociatePublicIpAddress(MonitoringEnabled): pass class InstanceIds(BaseModel): __root__: List[XmlStringMaxLen19] class AttachInstancesQuery(BaseModel): InstanceIds: Optional[InstanceIds] = None AutoScalingGroupName: XmlStringMaxLen255 class TargetGroupARNs(BaseModel): __root__: List[XmlStringMaxLen511] class AttachLoadBalancerTargetGroupsType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 TargetGroupARNs: TargetGroupARNs class LoadBalancerNames(BaseModel): __root__: List[XmlStringMaxLen255] class AttachLoadBalancersType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 LoadBalancerNames: LoadBalancerNames class AutoScalingGroupMinSize(Progress): pass class AutoScalingGroupMaxSize(Progress): pass class AutoScalingGroupDesiredCapacity(Progress): pass class AutoScalingGroupPredictedCapacity(Progress): pass class Cooldown(Progress): pass class AvailabilityZones(LoadBalancerNames): pass class XmlStringMaxLen32(AutoScalingGroupState): pass class HealthCheckGracePeriod(Progress): pass class XmlStringMaxLen2047(BaseModel): __root__: Annotated[str, Field(max_length=2047, min_length=1)] class TerminationPolicies(BaseModel): __root__: List[XmlStringMaxLen1600] class InstanceProtected(MonitoringEnabled): pass class MaxInstanceLifetime(Progress): pass class CapacityRebalanceEnabled(MonitoringEnabled): pass class WarmPoolSize(Progress): pass class Context(XmlString): pass class AutoScalingGroupNames(LoadBalancerNames): pass class MaxRecords(Progress): pass class AutoScalingGroupNamesType(BaseModel): AutoScalingGroupNames: Optional[AutoScalingGroupNames] = None NextToken: Optional[XmlString] = None MaxRecords: Optional[MaxRecords] = None class AutoScalingInstanceDetails(BaseModel): """ Describes an EC2 instance associated with an Auto Scaling group. """ InstanceId: XmlStringMaxLen19 InstanceType: Optional[XmlStringMaxLen255] = None AutoScalingGroupName: XmlStringMaxLen255 AvailabilityZone: XmlStringMaxLen255 LifecycleState: XmlStringMaxLen32 HealthStatus: XmlStringMaxLen32 LaunchConfigurationName: Optional[XmlStringMaxLen255] = None LaunchTemplate: Optional[LaunchTemplateSpecification] = None ProtectedFromScaleIn: InstanceProtected WeightedCapacity: Optional[XmlStringMaxLen32] = None class AutoScalingInstances(BaseModel): __root__: List[AutoScalingInstanceDetails] class AutoScalingNotificationTypes(LoadBalancerNames): pass class ScheduledActionNames(LoadBalancerNames): pass class BatchDeleteScheduledActionType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 ScheduledActionNames: ScheduledActionNames class BlockDeviceEbsDeleteOnTermination(MonitoringEnabled): pass class BlockDeviceEbsEncrypted(MonitoringEnabled): pass class BlockDeviceEbsIops(BaseModel): __root__: Annotated[int, Field(ge=100.0, le=20000.0)] class BlockDeviceEbsThroughput(BaseModel): __root__: Annotated[int, Field(ge=125.0, le=1000.0)] class BlockDeviceEbsVolumeSize(BaseModel): __root__: Annotated[int, Field(ge=1.0, le=16384.0)] class BlockDeviceEbsVolumeType(XmlStringMaxLen255): pass class Ebs(BaseModel): """ Describes information used to set up an Amazon EBS volume specified in a block device mapping. """ SnapshotId: Optional[XmlStringMaxLen255] = None VolumeSize: Optional[BlockDeviceEbsVolumeSize] = None VolumeType: Optional[BlockDeviceEbsVolumeType] = None DeleteOnTermination: Optional[BlockDeviceEbsDeleteOnTermination] = None Iops: Optional[BlockDeviceEbsIops] = None Encrypted: Optional[BlockDeviceEbsEncrypted] = None Throughput: Optional[BlockDeviceEbsThroughput] = None class NoDevice(MonitoringEnabled): pass class CancelInstanceRefreshType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 class PredictiveScalingForecastTimestamps(BaseModel): __root__: List[TimestampType] class PredictiveScalingForecastValues(BaseModel): __root__: List[MetricScale] class CapacityForecast(BaseModel): """ A <code>GetPredictiveScalingForecast</code> call returns the capacity forecast for a predictive scaling policy. This structure includes the data points for that capacity forecast, along with the timestamps of those data points. """ Timestamps: PredictiveScalingForecastTimestamps Values: PredictiveScalingForecastValues class NonZeroIntPercent(BaseModel): __root__: Annotated[int, Field(ge=1.0, le=100.0)] class ClassicLinkVPCSecurityGroups(LoadBalancerNames): pass class LifecycleActionToken(BaseModel): __root__: Annotated[str, Field(max_length=36, min_length=36)] class LifecycleActionResult(XmlString): pass class CompleteLifecycleActionType(BaseModel): LifecycleHookName: AsciiStringMaxLen255 AutoScalingGroupName: ResourceName LifecycleActionToken: Optional[LifecycleActionToken] = None LifecycleActionResult: LifecycleActionResult InstanceId: Optional[XmlStringMaxLen19] = None class SecurityGroups(ActivityIds): pass class XmlStringUserData(BaseModel): __root__: Annotated[str, Field(max_length=21847)] class InstanceMonitoring(BaseModel): """ Describes whether detailed monitoring is enabled for the Auto Scaling instances. """ Enabled: Optional[MonitoringEnabled] = None class SpotPrice(XmlStringMaxLen255): pass class EbsOptimized(MonitoringEnabled): pass class InstanceMetadataOptions(BaseModel): """ The metadata options for the instances. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/create-launch-config.html#launch-configurations-imds">Configuring the Instance Metadata Options</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>. """ HttpTokens: Optional[InstanceMetadataHttpTokensState] = None HttpPutResponseHopLimit: Optional[InstanceMetadataHttpPutResponseHopLimit] = None HttpEndpoint: Optional[InstanceMetadataEndpointState] = None class MetricName(XmlString): pass class MetricNamespace(XmlString): pass class MetricStatistic(Enum): Average = 'Average' Minimum = 'Minimum' Maximum = 'Maximum' SampleCount = 'SampleCount' Sum = 'Sum' class MetricUnit(XmlString): pass class ForceDelete(MonitoringEnabled): pass class DeleteAutoScalingGroupType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 ForceDelete: Optional[ForceDelete] = None class DeleteLifecycleHookType(BaseModel): LifecycleHookName: AsciiStringMaxLen255 AutoScalingGroupName: XmlStringMaxLen255 class DeleteNotificationConfigurationType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 TopicARN: XmlStringMaxLen255 class DeletePolicyType(BaseModel): AutoScalingGroupName: Optional[XmlStringMaxLen255] = None PolicyName: ResourceName class DeleteScheduledActionType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 ScheduledActionName: XmlStringMaxLen255 class DeleteWarmPoolType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 ForceDelete: Optional[ForceDelete] = None class MaxNumberOfAutoScalingGroups(Progress): pass class MaxNumberOfLaunchConfigurations(Progress): pass class NumberOfAutoScalingGroups(Progress): pass class NumberOfLaunchConfigurations(Progress): pass class DescribeAutoScalingInstancesType(BaseModel): InstanceIds: Optional[InstanceIds] = None MaxRecords: Optional[MaxRecords] = None NextToken: Optional[XmlString] = None class InstanceRefreshIds(LoadBalancerNames): pass class DescribeInstanceRefreshesType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 InstanceRefreshIds: Optional[InstanceRefreshIds] = None NextToken: Optional[XmlString] = None MaxRecords: Optional[MaxRecords] = None class LifecycleHookNames(BaseModel): __root__: Annotated[List[AsciiStringMaxLen255], Field(max_items=50)] class DescribeLifecycleHooksType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 LifecycleHookNames: Optional[LifecycleHookNames] = None class DescribeLoadBalancerTargetGroupsRequest(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 NextToken: Optional[XmlString] = None MaxRecords: Optional[MaxRecords] = None class DescribeLoadBalancersRequest(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 NextToken: Optional[XmlString] = None MaxRecords: Optional[MaxRecords] = None class DescribeNotificationConfigurationsType(BaseModel): AutoScalingGroupNames: Optional[AutoScalingGroupNames] = None NextToken: Optional[XmlString] = None MaxRecords: Optional[MaxRecords] = None class PolicyNames(BaseModel): __root__: List[ResourceName] class PolicyTypes(BaseModel): __root__: List[XmlStringMaxLen64] class DescribePoliciesType(BaseModel): AutoScalingGroupName: Optional[XmlStringMaxLen255] = None PolicyNames: Optional[PolicyNames] = None PolicyTypes: Optional[PolicyTypes] = None NextToken: Optional[XmlString] = None MaxRecords: Optional[MaxRecords] = None class IncludeDeletedGroups(MonitoringEnabled): pass class DescribeScalingActivitiesType(BaseModel): ActivityIds: Optional[ActivityIds] = None AutoScalingGroupName: Optional[XmlStringMaxLen255] = None IncludeDeletedGroups: Optional[IncludeDeletedGroups] = None MaxRecords: Optional[MaxRecords] = None NextToken: Optional[XmlString] = None class DescribeScheduledActionsType(BaseModel): AutoScalingGroupName: Optional[XmlStringMaxLen255] = None ScheduledActionNames: Optional[ScheduledActionNames] = None StartTime: Optional[TimestampType] = None EndTime: Optional[TimestampType] = None NextToken: Optional[XmlString] = None MaxRecords: Optional[MaxRecords] = None class DescribeWarmPoolType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 MaxRecords: Optional[MaxRecords] = None NextToken: Optional[XmlString] = None class ShouldDecrementDesiredCapacity(MonitoringEnabled): pass class DetachInstancesQuery(BaseModel): InstanceIds: Optional[InstanceIds] = None AutoScalingGroupName: XmlStringMaxLen255 ShouldDecrementDesiredCapacity: ShouldDecrementDesiredCapacity class DetachLoadBalancerTargetGroupsType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 TargetGroupARNs: TargetGroupARNs class DetachLoadBalancersType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 LoadBalancerNames: LoadBalancerNames class Metrics1(LoadBalancerNames): pass class DisableMetricsCollectionQuery(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 Metrics: Optional[Metrics1] = None class EnableMetricsCollectionQuery(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 Metrics: Optional[Metrics1] = None Granularity: XmlStringMaxLen255 class EnabledMetric(BaseModel): """ Describes an enabled metric. """ Metric: Optional[XmlStringMaxLen255] = None Granularity: Optional[XmlStringMaxLen255] = None class EnterStandbyQuery(BaseModel): InstanceIds: Optional[InstanceIds] = None AutoScalingGroupName: XmlStringMaxLen255 ShouldDecrementDesiredCapacity: ShouldDecrementDesiredCapacity class EstimatedInstanceWarmup(Progress): pass class HonorCooldown(MonitoringEnabled): pass class ExecutePolicyType(BaseModel): AutoScalingGroupName: Optional[XmlStringMaxLen255] = None PolicyName: ResourceName HonorCooldown: Optional[HonorCooldown] = None MetricValue: Optional[MetricScale] = None BreachThreshold: Optional[MetricScale] = None class ExitStandbyQuery(BaseModel): InstanceIds: Optional[InstanceIds] = None AutoScalingGroupName: XmlStringMaxLen255 class FailedScheduledUpdateGroupActionRequest(BaseModel): """ Describes a scheduled action that could not be created, updated, or deleted. """ ScheduledActionName: XmlStringMaxLen255 ErrorCode: Optional[XmlStringMaxLen64] = None ErrorMessage: Optional[XmlString] = None class Values(ActivityIds): pass class GetPredictiveScalingForecastType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 PolicyName: XmlStringMaxLen255 StartTime: TimestampType EndTime: TimestampType class GlobalTimeout(Progress): pass class HeartbeatTimeout(Progress): pass class LifecycleState1(Enum): Pending = 'Pending' Pending_Wait = 'Pending:Wait' Pending_Proceed = 'Pending:Proceed' Quarantined = 'Quarantined' InService = 'InService' Terminating = 'Terminating' Terminating_Wait = 'Terminating:Wait' Terminating_Proceed = 'Terminating:Proceed' Terminated = 'Terminated' Detaching = 'Detaching' Detached = 'Detached' EnteringStandby = 'EnteringStandby' Standby = 'Standby' Warmed_Pending = 'Warmed:Pending' Warmed_Pending_Wait = 'Warmed:Pending:Wait' Warmed_Pending_Proceed = 'Warmed:Pending:Proceed' Warmed_Terminating = 'Warmed:Terminating' Warmed_Terminating_Wait = 'Warmed:Terminating:Wait' Warmed_Terminating_Proceed = 'Warmed:Terminating:Proceed' Warmed_Terminated = 'Warmed:Terminated' Warmed_Stopped = 'Warmed:Stopped' Warmed_Running = 'Warmed:Running' class Instance(BaseModel): """ Describes an EC2 instance. """ InstanceId: XmlStringMaxLen19 InstanceType: Optional[XmlStringMaxLen255] = None AvailabilityZone: XmlStringMaxLen255 LifecycleState: LifecycleState1 HealthStatus: XmlStringMaxLen32 LaunchConfigurationName: Optional[XmlStringMaxLen255] = None LaunchTemplate: Optional[LaunchTemplateSpecification] = None ProtectedFromScaleIn: InstanceProtected WeightedCapacity: Optional[XmlStringMaxLen32] = None class InstanceRefreshStatus(Enum): Pending = 'Pending' InProgress = 'InProgress' Successful = 'Successful' Failed = 'Failed' Cancelling = 'Cancelling' Cancelled = 'Cancelled' class InstancesToUpdate(PredictiveScalingSchedulingBufferTime): pass class InstanceRefreshLivePoolProgress(BaseModel): """ Reports the progress of an instance refresh on instances that are in the Auto Scaling group. """ PercentageComplete: Optional[IntPercent] = None InstancesToUpdate: Optional[InstancesToUpdate] = None class InstanceRefreshWarmPoolProgress(InstanceRefreshLivePoolProgress): """ Reports the progress of an instance refresh on instances that are in the warm pool. """ pass class OnDemandBaseCapacity(Progress): pass class OnDemandPercentageAboveBaseCapacity(Progress): pass class SpotInstancePools(Progress): pass class MixedInstanceSpotPrice(BaseModel): __root__: Annotated[str, Field(max_length=255, min_length=0)] class LaunchConfigurationNameType(BaseModel): LaunchConfigurationName: XmlStringMaxLen255 class LaunchConfigurationNames(LoadBalancerNames): pass class LaunchConfigurationNamesType(BaseModel): LaunchConfigurationNames: Optional[LaunchConfigurationNames] = None NextToken: Optional[XmlString] = None MaxRecords: Optional[MaxRecords] = None class LaunchTemplateOverrides(BaseModel): """ Describes an override for a launch template. The maximum number of instance types that can be associated with an Auto Scaling group is 40. The maximum number of distinct launch templates you can define for an Auto Scaling group is 20. For more information about configuring overrides, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-override-options.html">Configuring overrides</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>. """ InstanceType: Optional[XmlStringMaxLen255] = None WeightedCapacity: Optional[XmlStringMaxLen32] = None LaunchTemplateSpecification: Optional[LaunchTemplateSpecification] = None class LifecycleTransition(XmlString): pass class NotificationTargetResourceName(MixedInstanceSpotPrice): pass class LifecycleHook(BaseModel): """ Describes a lifecycle hook, which tells Amazon EC2 Auto Scaling that you want to perform an action whenever it launches instances or terminates instances. """ LifecycleHookName: Optional[AsciiStringMaxLen255] = None AutoScalingGroupName: Optional[XmlStringMaxLen255] = None LifecycleTransition: Optional[LifecycleTransition] = None NotificationTargetARN: Optional[NotificationTargetResourceName] = None RoleARN: Optional[XmlStringMaxLen255] = None NotificationMetadata: Optional[XmlStringMaxLen1023] = None HeartbeatTimeout: Optional[HeartbeatTimeout] = None GlobalTimeout: Optional[GlobalTimeout] = None DefaultResult: Optional[LifecycleActionResult] = None class LoadBalancerState(BaseModel): """ Describes the state of a Classic Load Balancer. """ LoadBalancerName: Optional[XmlStringMaxLen255] = None State: Optional[XmlStringMaxLen255] = None class LoadBalancerTargetGroupState(BaseModel): """ Describes the state of a target group. """ LoadBalancerTargetGroupARN: Optional[XmlStringMaxLen511] = None State: Optional[XmlStringMaxLen255] = None class MaxGroupPreparedCapacity(BaseModel): __root__: Annotated[int, Field(ge=-1.0)] class MetricCollectionType(BaseModel): """ Describes a metric. """ Metric: Optional[XmlStringMaxLen255] = None class MetricDimensionName(XmlString): pass class MetricDimensionValue(XmlString): pass class MetricDimension(BaseModel): """ Describes the dimension of a metric. """ Name: MetricDimensionName Value: MetricDimensionValue class MetricGranularityType(BaseModel): """ Describes a granularity of a metric. """ Granularity: Optional[XmlStringMaxLen255] = None class MetricType(Enum): ASGAverageCPUUtilization = 'ASGAverageCPUUtilization' ASGAverageNetworkIn = 'ASGAverageNetworkIn' ASGAverageNetworkOut = 'ASGAverageNetworkOut' ALBRequestCountPerTarget = 'ALBRequestCountPerTarget' class MinAdjustmentMagnitude(Progress): pass class MinAdjustmentStep(Progress): pass class NotificationConfiguration(BaseModel): """ Describes a notification. """ AutoScalingGroupName: Optional[XmlStringMaxLen255] = None TopicARN: Optional[XmlStringMaxLen255] = None NotificationType: Optional[XmlStringMaxLen255] = None class PolicyIncrement(Progress): pass class PredefinedLoadMetricType(Enum): ASGTotalCPUUtilization = 'ASGTotalCPUUtilization' ASGTotalNetworkIn = 'ASGTotalNetworkIn' ASGTotalNetworkOut = 'ASGTotalNetworkOut' ALBTargetGroupRequestCount = 'ALBTargetGroupRequestCount' class PredefinedMetricPairType(Enum): ASGCPUUtilization = 'ASGCPUUtilization' ASGNetworkIn = 'ASGNetworkIn' ASGNetworkOut = 'ASGNetworkOut' ALBRequestCount = 'ALBRequestCount' class PredictiveScalingPredefinedMetricPair(BaseModel): """ Represents a metric pair for a predictive scaling policy. """ PredefinedMetricType: PredefinedMetricPairType ResourceLabel: Optional[XmlStringMaxLen1023] = None class PredictiveScalingPredefinedScalingMetric(BaseModel): """ <p>Describes a scaling metric for a predictive scaling policy.</p> <p>When returned in the output of <code>DescribePolicies</code>, it indicates that a predictive scaling policy uses individually specified load and scaling metrics instead of a metric pair.</p> """ PredefinedMetricType: MetricType ResourceLabel: Optional[XmlStringMaxLen1023] = None class PredictiveScalingPredefinedLoadMetric(BaseModel): """ <p>Describes a load metric for a predictive scaling policy.</p> <p>When returned in the output of <code>DescribePolicies</code>, it indicates that a predictive scaling policy uses individually specified load and scaling metrics instead of a metric pair.</p> """ PredefinedMetricType: PredefinedLoadMetricType ResourceLabel: Optional[XmlStringMaxLen1023] = None class ProcessNames(LoadBalancerNames): pass class ProcessType(BaseModel): """ <p>Describes a process type.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html#process-types">Scaling processes</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p> """ ProcessName: XmlStringMaxLen255 class Processes(BaseModel): __root__: List[ProcessType] class PropagateAtLaunch(MonitoringEnabled): pass class ProtectedFromScaleIn2(MonitoringEnabled): pass class PutLifecycleHookType(BaseModel): LifecycleHookName: AsciiStringMaxLen255 AutoScalingGroupName: XmlStringMaxLen255 LifecycleTransition: Optional[LifecycleTransition] = None RoleARN: Optional[XmlStringMaxLen255] = None NotificationTargetARN: Optional[NotificationTargetResourceName] = None NotificationMetadata: Optional[XmlStringMaxLen1023] = None HeartbeatTimeout: Optional[HeartbeatTimeout] = None DefaultResult: Optional[LifecycleActionResult] = None class PutNotificationConfigurationType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 TopicARN: XmlStringMaxLen255 NotificationTypes: AutoScalingNotificationTypes class ScalingPolicyEnabled(MonitoringEnabled): pass class PutScheduledUpdateGroupActionType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 ScheduledActionName: XmlStringMaxLen255 Time: Optional[TimestampType] = None StartTime: Optional[TimestampType] = None EndTime: Optional[TimestampType] = None Recurrence: Optional[XmlStringMaxLen255] = None MinSize: Optional[AutoScalingGroupMinSize] = None MaxSize: Optional[AutoScalingGroupMaxSize] = None DesiredCapacity: Optional[AutoScalingGroupDesiredCapacity] = None TimeZone: Optional[XmlStringMaxLen255] = None class WarmPoolMinSize(PredictiveScalingSchedulingBufferTime): pass class WarmPoolState(Enum): Stopped = 'Stopped' Running = 'Running' class PutWarmPoolType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 MaxGroupPreparedCapacity: Optional[MaxGroupPreparedCapacity] = None MinSize: Optional[WarmPoolMinSize] = None PoolState: Optional[WarmPoolState] = None class RecordLifecycleActionHeartbeatType(BaseModel): LifecycleHookName: AsciiStringMaxLen255 AutoScalingGroupName: ResourceName LifecycleActionToken: Optional[LifecycleActionToken] = None InstanceId: Optional[XmlStringMaxLen19] = None class RefreshStrategy(Enum): Rolling = 'Rolling' class ScalingProcessQuery(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 ScalingProcesses: Optional[ProcessNames] = None class ScheduledUpdateGroupAction(BaseModel): """ Describes a scheduled scaling action. """ AutoScalingGroupName: Optional[XmlStringMaxLen255] = None ScheduledActionName: Optional[XmlStringMaxLen255] = None ScheduledActionARN: Optional[ResourceName] = None Time: Optional[TimestampType] = None StartTime: Optional[TimestampType] = None EndTime: Optional[TimestampType] = None Recurrence: Optional[XmlStringMaxLen255] = None MinSize: Optional[AutoScalingGroupMinSize] = None MaxSize: Optional[AutoScalingGroupMaxSize] = None DesiredCapacity: Optional[AutoScalingGroupDesiredCapacity] = None TimeZone: Optional[XmlStringMaxLen255] = None class SetDesiredCapacityType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 DesiredCapacity: AutoScalingGroupDesiredCapacity HonorCooldown: Optional[HonorCooldown] = None class ShouldRespectGracePeriod(MonitoringEnabled): pass class SetInstanceHealthQuery(BaseModel): InstanceId: XmlStringMaxLen19 HealthStatus: XmlStringMaxLen32 ShouldRespectGracePeriod: Optional[ShouldRespectGracePeriod] = None class SetInstanceProtectionQuery(BaseModel): InstanceIds: InstanceIds AutoScalingGroupName: XmlStringMaxLen255 ProtectedFromScaleIn: ProtectedFromScaleIn2 class SuspendedProcess(BaseModel): """ <p>Describes an auto scaling process that has been suspended.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-suspend-resume-processes.html#process-types">Scaling processes</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p> """ ProcessName: Optional[XmlStringMaxLen255] = None SuspensionReason: Optional[XmlStringMaxLen255] = None class TagKey(BaseModel): __root__: Annotated[str, Field(max_length=128, min_length=1)] class TagValue(BaseModel): __root__: Annotated[str, Field(max_length=256, min_length=0)] class TagDescription(BaseModel): """ Describes a tag for an Auto Scaling group. """ ResourceId: Optional[XmlString] = None ResourceType: Optional[XmlString] = None Key: Optional[TagKey] = None Value: Optional[TagValue] = None PropagateAtLaunch: Optional[PropagateAtLaunch] = None class TerminateInstanceInAutoScalingGroupType(BaseModel): InstanceId: XmlStringMaxLen19 ShouldDecrementDesiredCapacity: ShouldDecrementDesiredCapacity class WarmPoolStatus(Enum): PendingDelete = 'PendingDelete' class ScheduledUpdateGroupActionRequest(BaseModel): """ Describes information used for one or more scheduled scaling action updates in a <a>BatchPutScheduledUpdateGroupAction</a> operation. """ ScheduledActionName: XmlStringMaxLen255 StartTime: Optional[TimestampType] = None EndTime: Optional[TimestampType] = None Recurrence: Optional[XmlStringMaxLen255] = None MinSize: Optional[AutoScalingGroupMinSize] = None MaxSize: Optional[AutoScalingGroupMaxSize] = None DesiredCapacity: Optional[AutoScalingGroupDesiredCapacity] = None TimeZone: Optional[XmlStringMaxLen255] = None class InstancesDistribution(BaseModel): """ <p>Describes an instances distribution for an Auto Scaling group with a <a>MixedInstancesPolicy</a>.</p> <p>The instances distribution specifies the distribution of On-Demand Instances and Spot Instances, the maximum price to pay for Spot Instances, and how the Auto Scaling group allocates instance types to fulfill On-Demand and Spot capacities.</p> <p>When you modify <code>SpotAllocationStrategy</code>, <code>SpotInstancePools</code>, or <code>SpotMaxPrice</code> in the <a>UpdateAutoScalingGroup</a> API call, this update action does not deploy any changes across the running Amazon EC2 instances in the group. Your existing Spot Instances continue to run as long as the maximum price for those instances is higher than the current Spot price. When scale out occurs, Amazon EC2 Auto Scaling launches instances based on the new settings. When scale in occurs, Amazon EC2 Auto Scaling terminates instances according to the group's termination policies.</p> """ OnDemandAllocationStrategy: Optional[XmlString] = None OnDemandBaseCapacity: Optional[OnDemandBaseCapacity] = None OnDemandPercentageAboveBaseCapacity: Optional[ OnDemandPercentageAboveBaseCapacity ] = None SpotAllocationStrategy: Optional[XmlString] = None SpotInstancePools: Optional[SpotInstancePools] = None SpotMaxPrice: Optional[MixedInstanceSpotPrice] = None class LifecycleHookSpecification(BaseModel): """ <p>Describes information used to specify a lifecycle hook for an Auto Scaling group.</p> <p>A lifecycle hook tells Amazon EC2 Auto Scaling to perform an action on an instance when the instance launches (before it is put into service) or as the instance terminates (before it is fully terminated).</p> <p>This step is a part of the procedure for creating a lifecycle hook for an Auto Scaling group:</p> <ol> <li> <p>(Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Amazon EC2 Auto Scaling launches or terminates instances.</p> </li> <li> <p>(Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Amazon EC2 Auto Scaling to publish lifecycle notifications to the target.</p> </li> <li> <p> <b>Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.</b> </p> </li> <li> <p>If you need more time, record the lifecycle action heartbeat to keep the instance in a pending state.</p> </li> <li> <p>If you finish before the timeout period ends, complete the lifecycle action.</p> </li> </ol> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html">Amazon EC2 Auto Scaling lifecycle hooks</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p> """ LifecycleHookName: AsciiStringMaxLen255 LifecycleTransition: LifecycleTransition NotificationMetadata: Optional[XmlStringMaxLen1023] = None HeartbeatTimeout: Optional[HeartbeatTimeout] = None DefaultResult: Optional[LifecycleActionResult] = None NotificationTargetARN: Optional[NotificationTargetResourceName] = None RoleARN: Optional[XmlStringMaxLen255] = None class Tag(BaseModel): """ Describes a tag for an Auto Scaling group. """ ResourceId: Optional[XmlString] = None ResourceType: Optional[XmlString] = None Key: TagKey Value: Optional[TagValue] = None PropagateAtLaunch: Optional[PropagateAtLaunch] = None class BlockDeviceMapping(BaseModel): """ Describes a block device mapping. """ VirtualName: Optional[XmlStringMaxLen255] = None DeviceName: XmlStringMaxLen255 Ebs: Optional[Ebs] = None NoDevice: Optional[NoDevice] = None class DescribeAccountLimitsAnswer(BaseModel): MaxNumberOfAutoScalingGroups: Optional[MaxNumberOfAutoScalingGroups] = None MaxNumberOfLaunchConfigurations: Optional[MaxNumberOfLaunchConfigurations] = None NumberOfAutoScalingGroups: Optional[NumberOfAutoScalingGroups] = None NumberOfLaunchConfigurations: Optional[NumberOfLaunchConfigurations] = None class DescribeAdjustmentTypesAnswer(BaseModel): AdjustmentTypes: Optional[AdjustmentTypes] = None class AutoScalingInstancesType(BaseModel): AutoScalingInstances: Optional[AutoScalingInstances] = None NextToken: Optional[XmlString] = None class DescribeAutoScalingNotificationTypesAnswer(BaseModel): AutoScalingNotificationTypes: Optional[AutoScalingNotificationTypes] = None class DescribeLifecycleHookTypesAnswer(BaseModel): LifecycleHookTypes: Optional[AutoScalingNotificationTypes] = None class ProcessesType(BaseModel): Processes: Optional[Processes] = None class Filter(BaseModel): """ <p>Describes a filter that is used to return a more specific list of results when describing tags.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html">Tagging Auto Scaling groups and instances</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p> """ Name: Optional[XmlString] = None Values: Optional[Values] = None class DescribeTerminationPolicyTypesAnswer(BaseModel): TerminationPolicyTypes: Optional[TerminationPolicies] = None class PolicyARNType(BaseModel): """ Contains the output of PutScalingPolicy. """ PolicyARN: Optional[ResourceName] = None Alarms: Optional[Alarms] = None class StepAdjustment(BaseModel): """ <p>Describes information used to create a step adjustment for a step scaling policy.</p> <p>For the following examples, suppose that you have an alarm with a breach threshold of 50:</p> <ul> <li> <p>To trigger the adjustment when the metric is greater than or equal to 50 and less than 60, specify a lower bound of 0 and an upper bound of 10.</p> </li> <li> <p>To trigger the adjustment when the metric is greater than 40 and less than or equal to 50, specify a lower bound of -10 and an upper bound of 0.</p> </li> </ul> <p>There are a few rules for the step adjustments for your step policy:</p> <ul> <li> <p>The ranges of your step adjustments can't overlap or have a gap.</p> </li> <li> <p>At most, one step adjustment can have a null lower bound. If one step adjustment has a negative lower bound, then there must be a step adjustment with a null lower bound.</p> </li> <li> <p>At most, one step adjustment can have a null upper bound. If one step adjustment has a positive upper bound, then there must be a step adjustment with a null upper bound.</p> </li> <li> <p>The upper and lower bound can't be null in the same step adjustment.</p> </li> </ul> <p>For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/as-scaling-simple-step.html#as-scaling-steps">Step adjustments</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>.</p> """ MetricIntervalLowerBound: Optional[MetricScale] = None MetricIntervalUpperBound: Optional[MetricScale] = None ScalingAdjustment: PolicyIncrement class PredefinedMetricSpecification(PredictiveScalingPredefinedScalingMetric): """ Represents a predefined metric for a target tracking scaling policy to use with Amazon EC2 Auto Scaling. """ pass class CheckpointPercentages(BaseModel): __root__: List[NonZeroIntPercent] class Activity(BaseModel): """ Describes scaling activity, which is a long-running process that represents a change to your Auto Scaling group, such as changing its size or replacing an instance. """ ActivityId: XmlString AutoScalingGroupName: XmlStringMaxLen255 Description: Optional[XmlString] = None Cause: XmlStringMaxLen1023 StartTime: TimestampType EndTime: Optional[TimestampType] = None StatusCode: ScalingActivityStatusCode StatusMessage: Optional[XmlStringMaxLen255] = None Progress: Optional[Progress] = None Details: Optional[XmlString] = None AutoScalingGroupState: Optional[AutoScalingGroupState] = None AutoScalingGroupARN: Optional[ResourceName] = None class Activities(BaseModel): __root__: List[Activity] class Instances(BaseModel): __root__: List[Instance] class SuspendedProcesses(BaseModel): __root__: List[SuspendedProcess] class EnabledMetrics(BaseModel): __root__: List[EnabledMetric] class TagDescriptionList(BaseModel): __root__: List[TagDescription] class WarmPoolConfiguration(BaseModel): """ Describes a warm pool configuration. """ MaxGroupPreparedCapacity: Optional[MaxGroupPreparedCapacity] = None MinSize: Optional[WarmPoolMinSize] = None PoolState: Optional[WarmPoolState] = None Status: Optional[WarmPoolStatus] = None class FailedScheduledUpdateGroupActionRequests(BaseModel): __root__: List[FailedScheduledUpdateGroupActionRequest] class ScheduledUpdateGroupActionRequests(BaseModel): __root__: List[ScheduledUpdateGroupActionRequest] class BatchPutScheduledUpdateGroupActionType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 ScheduledUpdateGroupActions: ScheduledUpdateGroupActionRequests class BlockDeviceMappings(BaseModel): __root__: List[BlockDeviceMapping] class LifecycleHookSpecifications(BaseModel): __root__: List[LifecycleHookSpecification] class Tags2(BaseModel): __root__: List[Tag] class CreateLaunchConfigurationType(BaseModel): LaunchConfigurationName: XmlStringMaxLen255 ImageId: Optional[XmlStringMaxLen255] = None KeyName: Optional[XmlStringMaxLen255] = None SecurityGroups: Optional[SecurityGroups] = None ClassicLinkVPCId: Optional[XmlStringMaxLen255] = None ClassicLinkVPCSecurityGroups: Optional[ClassicLinkVPCSecurityGroups] = None UserData: Optional[XmlStringUserData] = None InstanceId: Optional[XmlStringMaxLen19] = None InstanceType: Optional[XmlStringMaxLen255] = None KernelId: Optional[XmlStringMaxLen255] = None RamdiskId: Optional[XmlStringMaxLen255] = None BlockDeviceMappings: Optional[BlockDeviceMappings] = None InstanceMonitoring: Optional[InstanceMonitoring] = None SpotPrice: Optional[SpotPrice] = None IamInstanceProfile: Optional[XmlStringMaxLen1600] = None EbsOptimized: Optional[EbsOptimized] = None AssociatePublicIpAddress: Optional[AssociatePublicIpAddress] = None PlacementTenancy: Optional[XmlStringMaxLen64] = None MetadataOptions: Optional[InstanceMetadataOptions] = None class CreateOrUpdateTagsType(BaseModel): Tags: Tags2 class MetricDimensions(BaseModel): __root__: List[MetricDimension] class DeleteTagsType(BaseModel): Tags: Tags2 class LifecycleHooks(BaseModel): __root__: List[LifecycleHook] class LoadBalancerTargetGroupStates(BaseModel): __root__: List[LoadBalancerTargetGroupState] class LoadBalancerStates(BaseModel): __root__: List[LoadBalancerState] class MetricCollectionTypes(BaseModel): __root__: List[MetricCollectionType] class MetricGranularityTypes(BaseModel): __root__: List[MetricGranularityType] class NotificationConfigurations(BaseModel): __root__: List[NotificationConfiguration] class Filters(BaseModel): __root__: List[Filter] class DescribeTagsType(BaseModel): Filters: Optional[Filters] = None NextToken: Optional[XmlString] = None MaxRecords: Optional[MaxRecords] = None class InstanceRefreshProgressDetails(BaseModel): """ Reports the progress of an instance refresh on an Auto Scaling group that has a warm pool. This includes separate details for instances in the warm pool and instances in the Auto Scaling group (the live pool). """ LivePoolProgress: Optional[InstanceRefreshLivePoolProgress] = None WarmPoolProgress: Optional[InstanceRefreshWarmPoolProgress] = None class RefreshPreferences(BaseModel): """ Describes the preferences for an instance refresh. """ MinHealthyPercentage: Optional[IntPercent] = None InstanceWarmup: Optional[RefreshInstanceWarmup] = None CheckpointPercentages: Optional[CheckpointPercentages] = None CheckpointDelay: Optional[CheckpointDelay] = None SkipMatching: Optional[SkipMatching] = None class LaunchConfiguration(BaseModel): """ Describes a launch configuration. """ LaunchConfigurationName: XmlStringMaxLen255 LaunchConfigurationARN: Optional[ResourceName] = None ImageId: XmlStringMaxLen255 KeyName: Optional[XmlStringMaxLen255] = None SecurityGroups: Optional[SecurityGroups] = None ClassicLinkVPCId: Optional[XmlStringMaxLen255] = None ClassicLinkVPCSecurityGroups: Optional[ClassicLinkVPCSecurityGroups] = None UserData: Optional[XmlStringUserData] = None InstanceType: XmlStringMaxLen255 KernelId: Optional[XmlStringMaxLen255] = None RamdiskId: Optional[XmlStringMaxLen255] = None BlockDeviceMappings: Optional[BlockDeviceMappings] = None InstanceMonitoring: Optional[InstanceMonitoring] = None SpotPrice: Optional[SpotPrice] = None IamInstanceProfile: Optional[XmlStringMaxLen1600] = None CreatedTime: TimestampType EbsOptimized: Optional[EbsOptimized] = None AssociatePublicIpAddress: Optional[AssociatePublicIpAddress] = None PlacementTenancy: Optional[XmlStringMaxLen64] = None MetadataOptions: Optional[InstanceMetadataOptions] = None class LaunchConfigurations(BaseModel): __root__: List[LaunchConfiguration] class Overrides(BaseModel): __root__: List[LaunchTemplateOverrides] class PredictiveScalingMetricSpecification(BaseModel): """ <p>This structure specifies the metrics and target utilization settings for a predictive scaling policy. </p> <p>You must specify either a metric pair, or a load metric and a scaling metric individually. Specifying a metric pair instead of individual metrics provides a simpler way to configure metrics for a scaling policy. You choose the metric pair, and the policy automatically knows the correct sum and average statistics to use for the load metric and the scaling metric.</p> <p>Example</p> <ul> <li> <p>You create a predictive scaling policy and specify <code>ALBRequestCount</code> as the value for the metric pair and <code>1000.0</code> as the target value. For this type of metric, you must provide the metric dimension for the corresponding target group, so you also provide a resource label for the Application Load Balancer target group that is attached to your Auto Scaling group.</p> </li> <li> <p>The number of requests the target group receives per minute provides the load metric, and the request count averaged between the members of the target group provides the scaling metric. In CloudWatch, this refers to the <code>RequestCount</code> and <code>RequestCountPerTarget</code> metrics, respectively.</p> </li> <li> <p>For optimal use of predictive scaling, you adhere to the best practice of using a dynamic scaling policy to automatically scale between the minimum capacity and maximum capacity in response to real-time changes in resource utilization.</p> </li> <li> <p>Amazon EC2 Auto Scaling consumes data points for the load metric over the last 14 days and creates an hourly load forecast for predictive scaling. (A minimum of 24 hours of data is required.)</p> </li> <li> <p>After creating the load forecast, Amazon EC2 Auto Scaling determines when to reduce or increase the capacity of your Auto Scaling group in each hour of the forecast period so that the average number of requests received by each instance is as close to 1000 requests per minute as possible at all times.</p> </li> </ul> """ TargetValue: MetricScale PredefinedMetricPairSpecification: Optional[ PredictiveScalingPredefinedMetricPair ] = None PredefinedScalingMetricSpecification: Optional[ PredictiveScalingPredefinedScalingMetric ] = None PredefinedLoadMetricSpecification: Optional[ PredictiveScalingPredefinedLoadMetric ] = None class LoadForecast(BaseModel): """ A <code>GetPredictiveScalingForecast</code> call returns the load forecast for a predictive scaling policy. This structure includes the data points for that load forecast, along with the timestamps of those data points and the metric specification. """ Timestamps: PredictiveScalingForecastTimestamps Values: PredictiveScalingForecastValues MetricSpecification: PredictiveScalingMetricSpecification class StepAdjustments(BaseModel): __root__: List[StepAdjustment] class ScheduledUpdateGroupActions(BaseModel): __root__: List[ScheduledUpdateGroupAction] class BatchDeleteScheduledActionAnswer(BaseModel): FailedScheduledActions: Optional[FailedScheduledUpdateGroupActionRequests] = None class BatchPutScheduledUpdateGroupActionAnswer(BaseModel): FailedScheduledUpdateGroupActions: Optional[ FailedScheduledUpdateGroupActionRequests ] = None class LaunchTemplate(BaseModel): """ <p>Describes a launch template and overrides. </p> <p>You specify these properties as part of a mixed instances policy. </p> <p>When you update the launch template or overrides in the <a>UpdateAutoScalingGroup</a> API call, existing Amazon EC2 instances continue to run. When scale out occurs, Amazon EC2 Auto Scaling launches instances to match the new settings. When scale in occurs, Amazon EC2 Auto Scaling terminates instances according to the group's termination policies.</p> """ LaunchTemplateSpecification: Optional[LaunchTemplateSpecification] = None Overrides: Optional[Overrides] = None class LaunchConfigurationsType(BaseModel): LaunchConfigurations: LaunchConfigurations NextToken: Optional[XmlString] = None class DescribeLifecycleHooksAnswer(BaseModel): LifecycleHooks: Optional[LifecycleHooks] = None class DescribeLoadBalancerTargetGroupsResponse(BaseModel): LoadBalancerTargetGroups: Optional[LoadBalancerTargetGroupStates] = None NextToken: Optional[XmlString] = None class DescribeLoadBalancersResponse(BaseModel): LoadBalancers: Optional[LoadBalancerStates] = None NextToken: Optional[XmlString] = None class DescribeMetricCollectionTypesAnswer(BaseModel): Metrics: Optional[MetricCollectionTypes] = None Granularities: Optional[MetricGranularityTypes] = None class DescribeNotificationConfigurationsAnswer(BaseModel): NotificationConfigurations: NotificationConfigurations NextToken: Optional[XmlString] = None class ActivitiesType(BaseModel): Activities: Activities NextToken: Optional[XmlString] = None class ScheduledActionsType(BaseModel): ScheduledUpdateGroupActions: Optional[ScheduledUpdateGroupActions] = None NextToken: Optional[XmlString] = None class TagsType(BaseModel): Tags: Optional[TagDescriptionList] = None NextToken: Optional[XmlString] = None class DescribeWarmPoolAnswer(BaseModel): WarmPoolConfiguration: Optional[WarmPoolConfiguration] = None Instances: Optional[Instances] = None NextToken: Optional[XmlString] = None class DetachInstancesAnswer(BaseModel): Activities: Optional[Activities] = None class EnterStandbyAnswer(DetachInstancesAnswer): pass class ExitStandbyAnswer(DetachInstancesAnswer): pass class CustomizedMetricSpecification(BaseModel): """ <p>Represents a CloudWatch metric of your choosing for a target tracking scaling policy to use with Amazon EC2 Auto Scaling.</p> <p>To create your customized metric specification:</p> <ul> <li> <p>Add values for each required parameter from CloudWatch. You can use an existing metric, or a new metric that you create. To use your own metric, you must first publish the metric to CloudWatch. For more information, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/publishingMetrics.html">Publish Custom Metrics</a> in the <i>Amazon CloudWatch User Guide</i>.</p> </li> <li> <p>Choose a metric that changes proportionally with capacity. The value of the metric should increase or decrease in inverse proportion to the number of capacity units. That is, the value of the metric should decrease when capacity increases.</p> </li> </ul> <p>For more information about CloudWatch, see <a href="https://docs.aws.amazon.com/AmazonCloudWatch/latest/monitoring/cloudwatch_concepts.html">Amazon CloudWatch Concepts</a>.</p> """ MetricName: MetricName Namespace: MetricNamespace Dimensions: Optional[MetricDimensions] = None Statistic: MetricStatistic Unit: Optional[MetricUnit] = None class PredictiveScalingMetricSpecifications(BaseModel): __root__: List[PredictiveScalingMetricSpecification] class MixedInstancesPolicy(BaseModel): """ Describes a mixed instances policy. A mixed instances policy contains the instance types Amazon EC2 Auto Scaling can launch, and other information Amazon EC2 Auto Scaling can use to launch instances to help you optimize your costs. For more information, see <a href="https://docs.aws.amazon.com/autoscaling/ec2/userguide/asg-purchase-options.html">Auto Scaling groups with multiple instance types and purchase options</a> in the <i>Amazon EC2 Auto Scaling User Guide</i>. """ LaunchTemplate: Optional[LaunchTemplate] = None InstancesDistribution: Optional[InstancesDistribution] = None class ActivityType(BaseModel): Activity: Optional[Activity] = None class AutoScalingGroup(BaseModel): """ Describes an Auto Scaling group. """ AutoScalingGroupName: XmlStringMaxLen255 AutoScalingGroupARN: Optional[ResourceName] = None LaunchConfigurationName: Optional[XmlStringMaxLen255] = None LaunchTemplate: Optional[LaunchTemplateSpecification] = None MixedInstancesPolicy: Optional[MixedInstancesPolicy] = None MinSize: AutoScalingGroupMinSize MaxSize: AutoScalingGroupMaxSize DesiredCapacity: AutoScalingGroupDesiredCapacity PredictedCapacity: Optional[AutoScalingGroupPredictedCapacity] = None DefaultCooldown: Cooldown AvailabilityZones: AvailabilityZones LoadBalancerNames: Optional[LoadBalancerNames] = None TargetGroupARNs: Optional[TargetGroupARNs] = None HealthCheckType: XmlStringMaxLen32 HealthCheckGracePeriod: Optional[HealthCheckGracePeriod] = None Instances: Optional[Instances] = None CreatedTime: TimestampType SuspendedProcesses: Optional[SuspendedProcesses] = None PlacementGroup: Optional[XmlStringMaxLen255] = None VPCZoneIdentifier: Optional[XmlStringMaxLen2047] = None EnabledMetrics: Optional[EnabledMetrics] = None Status: Optional[XmlStringMaxLen255] = None Tags: Optional[TagDescriptionList] = None TerminationPolicies: Optional[TerminationPolicies] = None NewInstancesProtectedFromScaleIn: Optional[InstanceProtected] = None ServiceLinkedRoleARN: Optional[ResourceName] = None MaxInstanceLifetime: Optional[MaxInstanceLifetime] = None CapacityRebalance: Optional[CapacityRebalanceEnabled] = None WarmPoolConfiguration: Optional[WarmPoolConfiguration] = None WarmPoolSize: Optional[WarmPoolSize] = None Context: Optional[Context] = None class AutoScalingGroups(BaseModel): __root__: List[AutoScalingGroup] class CreateAutoScalingGroupType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 LaunchConfigurationName: Optional[XmlStringMaxLen255] = None LaunchTemplate: Optional[LaunchTemplateSpecification] = None MixedInstancesPolicy: Optional[MixedInstancesPolicy] = None InstanceId: Optional[XmlStringMaxLen19] = None MinSize: AutoScalingGroupMinSize MaxSize: AutoScalingGroupMaxSize DesiredCapacity: Optional[AutoScalingGroupDesiredCapacity] = None DefaultCooldown: Optional[Cooldown] = None AvailabilityZones: Optional[AvailabilityZones] = None LoadBalancerNames: Optional[LoadBalancerNames] = None TargetGroupARNs: Optional[TargetGroupARNs] = None HealthCheckType: Optional[XmlStringMaxLen32] = None HealthCheckGracePeriod: Optional[HealthCheckGracePeriod] = None PlacementGroup: Optional[XmlStringMaxLen255] = None VPCZoneIdentifier: Optional[XmlStringMaxLen2047] = None TerminationPolicies: Optional[TerminationPolicies] = None NewInstancesProtectedFromScaleIn: Optional[InstanceProtected] = None CapacityRebalance: Optional[CapacityRebalanceEnabled] = None LifecycleHookSpecificationList: Optional[LifecycleHookSpecifications] = None Tags: Optional[Tags2] = None ServiceLinkedRoleARN: Optional[ResourceName] = None MaxInstanceLifetime: Optional[MaxInstanceLifetime] = None Context: Optional[Context] = None class DesiredConfiguration(BaseModel): """ <p>Describes the desired configuration for an instance refresh. </p> <p>If you specify a desired configuration, you must specify either a <code>LaunchTemplate</code> or a <code>MixedInstancesPolicy</code>. </p> """ LaunchTemplate: Optional[LaunchTemplateSpecification] = None MixedInstancesPolicy: Optional[MixedInstancesPolicy] = None class LoadForecasts(BaseModel): __root__: List[LoadForecast] class InstanceRefresh(BaseModel): """ Describes an instance refresh for an Auto Scaling group. """ InstanceRefreshId: Optional[XmlStringMaxLen255] = None AutoScalingGroupName: Optional[XmlStringMaxLen255] = None Status: Optional[InstanceRefreshStatus] = None StatusReason: Optional[XmlStringMaxLen1023] = None StartTime: Optional[TimestampType] = None EndTime: Optional[TimestampType] = None PercentageComplete: Optional[IntPercent] = None InstancesToUpdate: Optional[InstancesToUpdate] = None ProgressDetails: Optional[InstanceRefreshProgressDetails] = None Preferences: Optional[RefreshPreferences] = None DesiredConfiguration: Optional[DesiredConfiguration] = None class PredictiveScalingConfiguration(BaseModel): """ Represents a predictive scaling policy configuration to use with Amazon EC2 Auto Scaling. """ MetricSpecifications: PredictiveScalingMetricSpecifications Mode: Optional[PredictiveScalingMode] = None SchedulingBufferTime: Optional[PredictiveScalingSchedulingBufferTime] = None MaxCapacityBreachBehavior: Optional[ PredictiveScalingMaxCapacityBreachBehavior ] = None MaxCapacityBuffer: Optional[PredictiveScalingMaxCapacityBuffer] = None class TargetTrackingConfiguration(BaseModel): """ Represents a target tracking scaling policy configuration to use with Amazon EC2 Auto Scaling. """ PredefinedMetricSpecification: Optional[PredefinedMetricSpecification] = None CustomizedMetricSpecification: Optional[CustomizedMetricSpecification] = None TargetValue: MetricScale DisableScaleIn: Optional[DisableScaleIn] = None class PutScalingPolicyType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 PolicyName: XmlStringMaxLen255 PolicyType: Optional[XmlStringMaxLen64] = None AdjustmentType: Optional[XmlStringMaxLen255] = None MinAdjustmentStep: Optional[MinAdjustmentStep] = None MinAdjustmentMagnitude: Optional[MinAdjustmentMagnitude] = None ScalingAdjustment: Optional[PolicyIncrement] = None Cooldown: Optional[Cooldown] = None MetricAggregationType: Optional[XmlStringMaxLen32] = None StepAdjustments: Optional[StepAdjustments] = None EstimatedInstanceWarmup: Optional[EstimatedInstanceWarmup] = None TargetTrackingConfiguration: Optional[TargetTrackingConfiguration] = None Enabled: Optional[ScalingPolicyEnabled] = None PredictiveScalingConfiguration: Optional[PredictiveScalingConfiguration] = None class ScalingPolicy(BaseModel): """ Describes a scaling policy. """ AutoScalingGroupName: Optional[XmlStringMaxLen255] = None PolicyName: Optional[XmlStringMaxLen255] = None PolicyARN: Optional[ResourceName] = None PolicyType: Optional[XmlStringMaxLen64] = None AdjustmentType: Optional[XmlStringMaxLen255] = None MinAdjustmentStep: Optional[MinAdjustmentStep] = None MinAdjustmentMagnitude: Optional[MinAdjustmentMagnitude] = None ScalingAdjustment: Optional[PolicyIncrement] = None Cooldown: Optional[Cooldown] = None StepAdjustments: Optional[StepAdjustments] = None MetricAggregationType: Optional[XmlStringMaxLen32] = None EstimatedInstanceWarmup: Optional[EstimatedInstanceWarmup] = None Alarms: Optional[Alarms] = None TargetTrackingConfiguration: Optional[TargetTrackingConfiguration] = None Enabled: Optional[ScalingPolicyEnabled] = None PredictiveScalingConfiguration: Optional[PredictiveScalingConfiguration] = None class StartInstanceRefreshType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 Strategy: Optional[RefreshStrategy] = None DesiredConfiguration: Optional[DesiredConfiguration] = None Preferences: Optional[RefreshPreferences] = None class UpdateAutoScalingGroupType(BaseModel): AutoScalingGroupName: XmlStringMaxLen255 LaunchConfigurationName: Optional[XmlStringMaxLen255] = None LaunchTemplate: Optional[LaunchTemplateSpecification] = None MixedInstancesPolicy: Optional[MixedInstancesPolicy] = None MinSize: Optional[AutoScalingGroupMinSize] = None MaxSize: Optional[AutoScalingGroupMaxSize] = None DesiredCapacity: Optional[AutoScalingGroupDesiredCapacity] = None DefaultCooldown: Optional[Cooldown] = None AvailabilityZones: Optional[AvailabilityZones] = None HealthCheckType: Optional[XmlStringMaxLen32] = None HealthCheckGracePeriod: Optional[HealthCheckGracePeriod] = None PlacementGroup: Optional[XmlStringMaxLen255] = None VPCZoneIdentifier: Optional[XmlStringMaxLen2047] = None TerminationPolicies: Optional[TerminationPolicies] = None NewInstancesProtectedFromScaleIn: Optional[InstanceProtected] = None ServiceLinkedRoleARN: Optional[ResourceName] = None MaxInstanceLifetime: Optional[MaxInstanceLifetime] = None CapacityRebalance: Optional[CapacityRebalanceEnabled] = None Context: Optional[Context] = None class AutoScalingGroupsType(BaseModel): AutoScalingGroups: AutoScalingGroups NextToken: Optional[XmlString] = None class GetPredictiveScalingForecastAnswer(BaseModel): LoadForecast: LoadForecasts CapacityForecast: CapacityForecast UpdateTime: TimestampType class InstanceRefreshes(BaseModel): __root__: List[InstanceRefresh] class ScalingPolicies(BaseModel): __root__: List[ScalingPolicy] class DescribeInstanceRefreshesAnswer(BaseModel): InstanceRefreshes: Optional[InstanceRefreshes] = None NextToken: Optional[XmlString] = None class PoliciesType(BaseModel): ScalingPolicies: Optional[ScalingPolicies] = None NextToken: Optional[XmlString] = None
32.661986
2,026
0.778232
5,610
62,809
8.65205
0.164528
0.018542
0.040175
0.011125
0.385554
0.319502
0.288887
0.270633
0.253966
0.218901
0
0.01436
0.149628
62,809
1,922
2,027
32.67898
0.894404
0.210655
0
0.438532
1
0
0.020931
0.006683
0
0
0
0
0
1
0
false
0.083486
0.004587
0
0.9
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
1
0
0
0
null
0
0
0
0
0
0
0
1
0
0
1
0
0
4
e5b29da3dababde5b2bd5133a5dc675c24fe8868
140
py
Python
drf_tweaks/settings.py
asudoma/drf_tweaks
0eef13015ab15bb2cf4f21ede2fb69d521456d3c
[ "MIT" ]
null
null
null
drf_tweaks/settings.py
asudoma/drf_tweaks
0eef13015ab15bb2cf4f21ede2fb69d521456d3c
[ "MIT" ]
null
null
null
drf_tweaks/settings.py
asudoma/drf_tweaks
0eef13015ab15bb2cf4f21ede2fb69d521456d3c
[ "MIT" ]
null
null
null
from django.conf import settings URL_PARSER = getattr(settings, 'DRF_TWEAKS_PARSER_CLASS', 'drf_tweaks.parsers.UnderlineQueryParamParser')
35
105
0.842857
17
140
6.647059
0.764706
0.159292
0
0
0
0
0
0
0
0
0
0
0.071429
140
3
106
46.666667
0.869231
0
0
0
0
0
0.478571
0.478571
0
0
0
0
0
1
0
false
0
0.5
0
0.5
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
1
null
0
0
0
0
0
0
0
0
1
0
0
0
0
4
e5f1091e3681e8b62c032e7b073b84e18d5012af
262
py
Python
ex019.py
almmessias/CursoPython
4cec6946f32002cbd5d3b802df11ea1ba74169f5
[ "MIT" ]
null
null
null
ex019.py
almmessias/CursoPython
4cec6946f32002cbd5d3b802df11ea1ba74169f5
[ "MIT" ]
null
null
null
ex019.py
almmessias/CursoPython
4cec6946f32002cbd5d3b802df11ea1ba74169f5
[ "MIT" ]
null
null
null
import random n1 = input ('Qual seu nome estudante1: ') n2 = input ('Qual seu nome estudante2: ') n3 = input ('Qual seu nome estudante3: ') n4 = input ('Qual seu nome estudante4: ') l = [n1, n2, n3, n4] e = random.choice(l) print ('O escolhido foi {}'.format(e))
32.75
41
0.656489
41
262
4.195122
0.536585
0.209302
0.27907
0.372093
0
0
0
0
0
0
0
0.055814
0.179389
262
8
42
32.75
0.744186
0
0
0
0
0
0.463878
0
0
0
0
0
0
1
0
false
0
0.125
0
0.125
0.125
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
0
0
0
0
0
0
0
4
e5f52d08053f57a78fc1476875008681966fd4be
101
py
Python
python/y2019/d19/__main__.py
luke-dixon/aoc
94851a5866a1ef29e3ba10098160cba883882683
[ "MIT" ]
1
2021-01-12T20:04:01.000Z
2021-01-12T20:04:01.000Z
python/y2019/d19/__main__.py
luke-dixon/aoc
94851a5866a1ef29e3ba10098160cba883882683
[ "MIT" ]
null
null
null
python/y2019/d19/__main__.py
luke-dixon/aoc
94851a5866a1ef29e3ba10098160cba883882683
[ "MIT" ]
null
null
null
import sys from .day19 import Day19 if __name__ == '__main__': Day19(args=sys.argv[1:]).main()
14.428571
35
0.673267
15
101
4
0.666667
0
0
0
0
0
0
0
0
0
0
0.083333
0.168317
101
6
36
16.833333
0.630952
0
0
0
0
0
0.079208
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
0
1
0
0
0
0
4
f92ba85dbc478399733e6b9f09792675486a371f
53
py
Python
tarea2.py
baudiramos/practicaGitHub-publico
68d2950bce273b46b5759137a143265409d6879d
[ "Unlicense" ]
null
null
null
tarea2.py
baudiramos/practicaGitHub-publico
68d2950bce273b46b5759137a143265409d6879d
[ "Unlicense" ]
null
null
null
tarea2.py
baudiramos/practicaGitHub-publico
68d2950bce273b46b5759137a143265409d6879d
[ "Unlicense" ]
null
null
null
""" Este es el comentario del archivo tarea2.py """
10.6
43
0.679245
8
53
4.5
1
0
0
0
0
0
0
0
0
0
0
0.023256
0.188679
53
5
44
10.6
0.813953
0.811321
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
1
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
0
0
0
0
0
4
005ee8dbc127a3960686b7b24db090fb97053538
83
py
Python
RaspberryPi/tests/cvtest1.py
FRC-Team-3242/IllumicatsVision
cc7370e1373832c42cc786174e97e11f8fb3f498
[ "MIT" ]
null
null
null
RaspberryPi/tests/cvtest1.py
FRC-Team-3242/IllumicatsVision
cc7370e1373832c42cc786174e97e11f8fb3f498
[ "MIT" ]
null
null
null
RaspberryPi/tests/cvtest1.py
FRC-Team-3242/IllumicatsVision
cc7370e1373832c42cc786174e97e11f8fb3f498
[ "MIT" ]
null
null
null
#!/usr/bin/env python import numpy as np import cv2 img = cv2.imread('tla.jpg',0)
13.833333
29
0.698795
16
83
3.625
0.875
0
0
0
0
0
0
0
0
0
0
0.042254
0.144578
83
5
30
16.6
0.774648
0.240964
0
0
0
0
0.112903
0
0
0
0
0
0
1
0
false
0
0.666667
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
0
0
1
0
1
0
0
4
007aad29d0eb094177bb4ff9b0f846626ca8e9d2
47
py
Python
cornac/models/cdl/__init__.py
Andrew-DungLe/cornac
199ab9181f8b6387cc8748ccf8ee3e5c9df087fb
[ "Apache-2.0" ]
null
null
null
cornac/models/cdl/__init__.py
Andrew-DungLe/cornac
199ab9181f8b6387cc8748ccf8ee3e5c9df087fb
[ "Apache-2.0" ]
null
null
null
cornac/models/cdl/__init__.py
Andrew-DungLe/cornac
199ab9181f8b6387cc8748ccf8ee3e5c9df087fb
[ "Apache-2.0" ]
null
null
null
from .recom_cdl import CDL __all__ = ['CDL']
9.4
26
0.680851
7
47
3.857143
0.714286
0
0
0
0
0
0
0
0
0
0
0
0.191489
47
5
27
9.4
0.710526
0
0
0
0
0
0.06383
0
0
0
0
0
0
1
0
false
0
0.5
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
0
0
0
1
0
0
0
0
4
009095e05e6f284d868feef3a58382ef96a007e4
35
py
Python
api/tests/opentrons/protocol_engine/__init__.py
faliester/opentrons
e945d0f72fed39b0f68c0b30b7afd1981644184f
[ "Apache-2.0" ]
235
2017-10-27T20:37:27.000Z
2022-03-30T14:09:49.000Z
api/tests/opentrons/protocol_engine/__init__.py
faliester/opentrons
e945d0f72fed39b0f68c0b30b7afd1981644184f
[ "Apache-2.0" ]
8,425
2017-10-26T15:25:43.000Z
2022-03-31T23:54:26.000Z
api/tests/opentrons/protocol_engine/__init__.py
faliester/opentrons
e945d0f72fed39b0f68c0b30b7afd1981644184f
[ "Apache-2.0" ]
130
2017-11-09T21:02:37.000Z
2022-03-15T18:01:24.000Z
"""ProtocolEngine tests module."""
17.5
34
0.714286
3
35
8.333333
1
0
0
0
0
0
0
0
0
0
0
0
0.085714
35
1
35
35
0.78125
0.8
0
null
0
null
0
0
null
0
0
0
null
1
null
true
0
0
null
null
null
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
0
0
0
0
0
4
00c98c7219500afc8cbecdd93ec1e4656504fd06
4,605
py
Python
midgard/data/sigma.py
annsilje/midgard
ffa81f6704f36dd86aea745fb24b7f7da4233828
[ "MIT" ]
14
2018-05-04T11:34:26.000Z
2021-11-16T20:52:00.000Z
midgard/data/sigma.py
annsilje/midgard
ffa81f6704f36dd86aea745fb24b7f7da4233828
[ "MIT" ]
2
2022-02-28T10:02:18.000Z
2022-03-04T14:47:59.000Z
midgard/data/sigma.py
annsilje/midgard
ffa81f6704f36dd86aea745fb24b7f7da4233828
[ "MIT" ]
9
2018-04-27T14:30:59.000Z
2021-08-25T08:17:00.000Z
"""Array with sigma values See https://docs.scipy.org/doc/numpy/user/basics.subclassing.html for information about subclassing Numpy arrays. SigmaArray is a regular Numpy array with an added field, sigma. """ # Third party imports import numpy as np class SigmaArray(np.ndarray): type = "sigma" def __new__(cls, values, sigma=None, unit=None): """Create a new SigmaArray""" obj = np.asarray(values, dtype=float).view(cls) sigma = np.array(sigma) if sigma is not None else np.full(values.shape, np.nan) if sigma.ndim == 0: sigma = sigma.item() obj._sigma = sigma obj._unit = unit return obj def __array_finalize__(self, obj): """Called automatically when a new SigmaArray is created""" if obj is None: return sigma_sliced = getattr(obj, "_sigma_sliced", None) if sigma_sliced is not None: self.sigma = sigma_sliced @property def sigma(self): """Sigma values""" return self._sigma @sigma.setter def sigma(self, value): """Set sigma values""" if value is None: self._sigma = np.full(self.shape, np.nan) else: self._sigma = np.asarray(value) * np.ones(self.shape) def unit(self, _): """Unit of SigmaArray The subfield sigma share the same unit as the SigmaArray itself""" return self._unit def set_unit(self, new_unit): """Update unit of SigmaArray""" self._unit = new_unit @classmethod def insert(cls, a, pos, b, memo): """ Insert b into a at position pos""" id_a = id(a) if id_a in memo: return memo[id_a][-1] id_b = id(b) if id_b in memo: return memo[id_b][-1] val = np.insert(np.asarray(a), pos, np.asarray(b)) sigma = np.insert(a.sigma, pos, b.sigma) new_sigma = cls(val, sigma) memo[id_a] = (a, new_sigma) memo[id_b] = (b, new_sigma) return new_sigma def fieldnames(self): return ["sigma"] def __add__(self, _): """self + other""" return NotImplemented def __radd__(self, _): """other + self""" return NotImplemented def __sub__(self, _): """self - other""" return NotImplemented def __rsub__(self, _): """other - self""" return NotImplemented def __iadd__(self, _): """self += other""" return NotImplemented def __isub__(self, _): """self -= other""" return NotImplemented def __matmul__(self, _): """self @ _""" return NotImplemented def __rmatmul__(self, _): """_ @ self""" return NotImplemented def __imatmul__(self, _): """self @= _""" return NotImplemented def __mul__(self, other): """self * other """ val = np.asarray(self) * other sigma = self.sigma * other return self.__class__(val, sigma) def __rmul__(self, other): """other * self""" return self.__mul__(other) def __imul__(self, _): """self *= _""" return NotImplemented def __truediv__(self, _): """self / _""" return NotImplemented def __rtruediv__(self, _): """_ / self""" return NotImplemented def __itruediv__(self, _): """self /= _""" return NotImplemented def __floordiv__(self, _): """self // _""" return NotImplemented def __rfloordiv__(self, _): """ _ // self""" return NotImplemented def __ifloordiv__(self, _): """self //= _""" return NotImplemented def __pow__(self, _): """ self ** _""" return NotImplemented def __rpow(self, _): """ _ ** self """ return NotImplemented def __ipow__(self, _): """ self **= _""" return NotImplemented def __deepcopy__(self, memo): new_sigma_array = self.__class__(np.asarray(self), self.sigma) memo[id(self)] = new_sigma_array return new_sigma_array def __setitem__(self, item, value): """TODO""" return super().__setitem__(item, value) def __getitem__(self, item): """Update _sigma_sliced with correct shape, used by __array_finalize__""" self._sigma_sliced = self.sigma[item] from_super = super().__getitem__(item) if isinstance(item, int): return self.__class__(from_super, self._sigma_sliced) return from_super
25.441989
113
0.567644
516
4,605
4.664729
0.238372
0.157873
0.181554
0.168259
0.272123
0.089738
0
0
0
0
0
0.000945
0.310749
4,605
180
114
25.583333
0.757404
0.170033
0
0.186275
0
0
0.006298
0
0
0
0
0.005556
0
1
0.313725
false
0
0.009804
0.009804
0.666667
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
0
0
0
0
null
0
0
0
0
0
1
0
0
0
0
1
0
0
4
00e5169dc2c8c9b71d15857afdd4d4b2bd652542
54
py
Python
folder1/f1a.py
redeye999/pyneta
96aebbf5f59a9abdbd9d21d29a0e80a988fcf45a
[ "Apache-2.0" ]
null
null
null
folder1/f1a.py
redeye999/pyneta
96aebbf5f59a9abdbd9d21d29a0e80a988fcf45a
[ "Apache-2.0" ]
null
null
null
folder1/f1a.py
redeye999/pyneta
96aebbf5f59a9abdbd9d21d29a0e80a988fcf45a
[ "Apache-2.0" ]
null
null
null
for i in range(10) print i print("editing file")
10.8
21
0.648148
10
54
3.5
0.8
0
0
0
0
0
0
0
0
0
0
0.04878
0.240741
54
4
22
13.5
0.804878
0
0
0
0
0
0.222222
0
0
0
0
0
0
0
null
null
0
0
null
null
0.666667
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
1
0
0
0
0
0
0
1
0
4
00f0dc5f82345fa2b5ac9b64dc1efa74948b2162
226
py
Python
webinterface/tests/unit_tests/test_model_ScheduleGroup.py
monoclecat/Cleaning-Schedule-generator
b12fa8a6f834a89b805bf062a0df45279a7a8796
[ "MIT" ]
2
2021-11-28T23:04:00.000Z
2022-01-13T19:47:45.000Z
webinterface/tests/unit_tests/test_model_ScheduleGroup.py
monoclecat/Cleaning-Schedule-generator
b12fa8a6f834a89b805bf062a0df45279a7a8796
[ "MIT" ]
25
2020-03-29T14:40:46.000Z
2021-09-22T17:37:15.000Z
webinterface/tests/unit_tests/test_model_ScheduleGroup.py
monoclecat/cleaning-schedule-management-system
b12fa8a6f834a89b805bf062a0df45279a7a8796
[ "MIT" ]
1
2020-07-04T11:42:17.000Z
2020-07-04T11:42:17.000Z
from django.test import TestCase from webinterface.models import * class ScheduleGroupTest(TestCase): def test__str(self): group = ScheduleGroup(name="test") self.assertEqual(group.__str__(), group.name)
25.111111
53
0.725664
26
226
6.076923
0.615385
0
0
0
0
0
0
0
0
0
0
0
0.172566
226
8
54
28.25
0.84492
0
0
0
0
0
0.017699
0
0
0
0
0
0.166667
1
0.166667
false
0
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
0
0
1
0
1
0
0
4
da9580f18b81e6a03aa3a4b6cd151fd10e961516
110
py
Python
Lib/fontParts/base/errors.py
sanjaymsh/fontParts
dda5b23336d0d04f2ba5ffa371813991de20635d
[ "MIT" ]
66
2019-01-17T13:50:12.000Z
2022-03-19T15:57:43.000Z
Lib/fontParts/base/errors.py
sanjaymsh/fontParts
dda5b23336d0d04f2ba5ffa371813991de20635d
[ "MIT" ]
311
2016-03-03T19:52:56.000Z
2019-01-15T12:44:59.000Z
Lib/fontParts/base/errors.py
sanjaymsh/fontParts
dda5b23336d0d04f2ba5ffa371813991de20635d
[ "MIT" ]
28
2019-02-21T01:54:19.000Z
2022-03-10T09:29:48.000Z
# ------------------- # Universal Exception # ------------------- class FontPartsError(Exception): pass
13.75
32
0.454545
6
110
8.333333
0.833333
0
0
0
0
0
0
0
0
0
0
0
0.145455
110
7
33
15.714286
0.531915
0.536364
0
0
0
0
0
0
0
0
0
0
0
1
0
true
0.5
0
0
0.5
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
0
0
0
0
0
4
da999767fe0c4c023b326df174e282f951e94c3b
185
py
Python
venv/bin/django-admin.py
brennangw/sms_to_internet
0f1d5c4765f27c6ec76781f641a1314f5fd8507b
[ "MIT" ]
null
null
null
venv/bin/django-admin.py
brennangw/sms_to_internet
0f1d5c4765f27c6ec76781f641a1314f5fd8507b
[ "MIT" ]
null
null
null
venv/bin/django-admin.py
brennangw/sms_to_internet
0f1d5c4765f27c6ec76781f641a1314f5fd8507b
[ "MIT" ]
null
null
null
#!/Users/Brennan/Downloads/server-notifications-django-master/venv/bin/python3 from django.core import management if __name__ == "__main__": management.execute_from_command_line()
30.833333
78
0.805405
23
185
6
0.869565
0
0
0
0
0
0
0
0
0
0
0.005882
0.081081
185
5
79
37
0.805882
0.416216
0
0
0
0
0.074766
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
1
0
0
0
0
4
dac9f56d1cf53ea24a37cb691031fe6278fe9a58
57
py
Python
ui_v2/first_time_setup.py
ranton256/cs510_ai_logo_generation
838855c047133368cab127ef3bbd60eef9e90ff4
[ "MIT" ]
1
2021-12-02T09:55:08.000Z
2021-12-02T09:55:08.000Z
ui_v2/first_time_setup.py
ranton256/cs510_ai_logo_generation
838855c047133368cab127ef3bbd60eef9e90ff4
[ "MIT" ]
null
null
null
ui_v2/first_time_setup.py
ranton256/cs510_ai_logo_generation
838855c047133368cab127ef3bbd60eef9e90ff4
[ "MIT" ]
1
2021-12-02T09:55:51.000Z
2021-12-02T09:55:51.000Z
#!/usr/bin/python import nltk nltk.download('wordnet')
9.5
24
0.719298
8
57
5.125
0.875
0
0
0
0
0
0
0
0
0
0
0
0.105263
57
5
25
11.4
0.803922
0.280702
0
0
0
0
0.179487
0
0
0
0
0
0
1
0
true
0
0.5
0
0.5
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
0
1
0
0
0
0
4
dad7288e2f4cb0b13f8c319b8394bd30dece3c72
694
py
Python
datatype_redis/types/numeric/float.py
Heiss/py-datatype-redis
db75b94c22a3c5fecb202e9138892c674a62d47f
[ "MIT" ]
null
null
null
datatype_redis/types/numeric/float.py
Heiss/py-datatype-redis
db75b94c22a3c5fecb202e9138892c674a62d47f
[ "MIT" ]
2
2020-07-22T08:01:42.000Z
2020-08-17T11:11:07.000Z
datatype_redis/types/numeric/float.py
Heiss/py-datatype-redis
db75b94c22a3c5fecb202e9138892c674a62d47f
[ "MIT" ]
null
null
null
from .numeric import Numeric from ..operator import inplace from ..pubsub import PubSub class Float(Numeric): """ Redis float <-> Python float. """ @property def value(self): return float(self.client.get(self.prefixer(self.key)) or 0) @value.setter def value(self, value): if value is not None: self.client.set(self.prefixer(self.key), value) def __isub__(self, f): self.client.incrbyfloat(self.prefixer(self.key), f * -1) return self def __iadd__(self, f): self.client.incrbyfloat(self.prefixer(self.key), f * 1) # this fixes conversion return self class PubSubFloat(Float, PubSub): pass
24.785714
87
0.636888
91
694
4.769231
0.406593
0.092166
0.147465
0.175115
0.21659
0.21659
0.21659
0.21659
0.21659
0.21659
0
0.005725
0.244957
694
28
88
24.785714
0.822519
0.074928
0
0.105263
0
0
0
0
0
0
0
0
0
1
0.210526
false
0.052632
0.157895
0.052632
0.631579
0
0
0
0
null
0
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
0
1
0
0
1
0
0
4
dae3c7fe2e144286cca41125f622f1c538aca990
930
py
Python
python/pylibcugraph/pylibcugraph/tests/conftest.py
BradReesWork/cugraph
9ddea03a724e9b32950ed6282120007c76482cbc
[ "Apache-2.0" ]
991
2018-12-05T22:07:52.000Z
2022-03-31T10:45:45.000Z
python/pylibcugraph/pylibcugraph/tests/conftest.py
BradReesWork/cugraph
9ddea03a724e9b32950ed6282120007c76482cbc
[ "Apache-2.0" ]
1,929
2018-12-06T14:06:18.000Z
2022-03-31T20:01:00.000Z
python/pylibcugraph/pylibcugraph/tests/conftest.py
BradReesWork/cugraph
9ddea03a724e9b32950ed6282120007c76482cbc
[ "Apache-2.0" ]
227
2018-12-06T18:10:15.000Z
2022-03-28T19:03:15.000Z
# Copyright (c) 2021, NVIDIA CORPORATION. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import pytest @pytest.fixture def package_under_test(): """ Create a fixture to import the package under test. This is useful since bugs that prevent the package under test from being imported will not prevent pytest from collecting, listing, running, etc. the tests. """ import pylibcugraph return pylibcugraph
35.769231
76
0.749462
137
930
5.072993
0.635037
0.086331
0.069065
0.046043
0
0
0
0
0
0
0
0.01061
0.189247
930
25
77
37.2
0.911141
0.829032
0
0
0
0
0
0
0
0
0
0
0
1
0.2
true
0
0.4
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
1
0
1
0
1
0
0
4
dafd8dcd94b6b72de7f643af9793e0d2d384d274
124
py
Python
run.py
chienius/anicolle
687fe1ddb8675b33f6f5f6fde4936fef7542f0f9
[ "MIT" ]
3
2015-10-15T11:05:23.000Z
2016-03-28T21:37:49.000Z
run.py
chienius/anicolle
687fe1ddb8675b33f6f5f6fde4936fef7542f0f9
[ "MIT" ]
4
2015-12-28T07:27:56.000Z
2017-12-24T07:34:45.000Z
run.py
chienius/anicolle
687fe1ddb8675b33f6f5f6fde4936fef7542f0f9
[ "MIT" ]
null
null
null
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from anicolle import command if __name__ == '__main__': command.main()
15.5
28
0.645161
16
124
4.5
0.875
0
0
0
0
0
0
0
0
0
0
0.019608
0.177419
124
7
29
17.714286
0.686275
0.346774
0
0
0
0
0.101266
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
1
0
0
0
0
4
970f3ed367260f3ae0f1b982bcde506cce2d1ebe
1,794
py
Python
Exscript/stdlib/crypt.py
saveshodhan/exscript
72718eee3e87b345d5a5255be9824e867e42927b
[ "MIT" ]
226
2015-01-20T19:59:06.000Z
2022-01-02T11:13:01.000Z
Exscript/stdlib/crypt.py
saveshodhan/exscript
72718eee3e87b345d5a5255be9824e867e42927b
[ "MIT" ]
155
2015-01-02T07:56:27.000Z
2022-01-09T20:56:19.000Z
Exscript/stdlib/crypt.py
saveshodhan/exscript
72718eee3e87b345d5a5255be9824e867e42927b
[ "MIT" ]
114
2015-01-03T11:48:17.000Z
2022-01-26T02:50:43.000Z
# # Copyright (C) 2010-2017 Samuel Abels # The MIT License (MIT) # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files # (the "Software"), to deal in the Software without restriction, # including without limitation the rights to use, copy, modify, merge, # publish, distribute, sublicense, and/or sell copies of the Software, # and to permit persons to whom the Software is furnished to do so, # subject to the following conditions: # # The above copyright notice and this permission notice shall be # included in all copies or substantial portions of the Software. # # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, # EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF # MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. # IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY # CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, # TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE # SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. from Exscript.util import crypt from Exscript.stdlib.util import secure_function @secure_function def otp(scope, password, seed, seqs): """ Calculates a one-time password hash using the given password, seed, and sequence number and returns it. Uses the md4/sixword algorithm as supported by TACACS+ servers. :type password: string :param password: A password. :type seed: string :param seed: A username. :type seqs: int :param seqs: A sequence number, or a list of sequence numbers. :rtype: string :return: A hash, or a list of hashes. """ return [crypt.otp(password[0], seed[0], int(seq)) for seq in seqs]
40.772727
75
0.743032
271
1,794
4.911439
0.520295
0.066116
0.019534
0.013524
0
0
0
0
0
0
0
0.007581
0.191193
1,794
43
76
41.72093
0.909717
0.82553
0
0
0
0
0
0
0
0
0
0
0
1
0.2
false
0.4
0.4
0
0.8
0
0
0
0
null
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
0
1
0
0
0
0
0
0
null
0
0
0
0
0
0
0
1
1
0
1
0
0
4
971cab3d727f8cdb84b56a56ab9c1cfae599c51f
409
py
Python
src/permission/logics/__init__.py
dkopitsa/django-permission
0319ea3bf0993ca1bd7232e4d60c4b8ec635787d
[ "MIT" ]
234
2015-01-05T17:09:08.000Z
2021-11-15T09:52:43.000Z
src/permission/logics/__init__.py
dkopitsa/django-permission
0319ea3bf0993ca1bd7232e4d60c4b8ec635787d
[ "MIT" ]
54
2015-02-13T08:06:32.000Z
2021-05-19T14:07:03.000Z
src/permission/logics/__init__.py
dkopitsa/django-permission
0319ea3bf0993ca1bd7232e4d60c4b8ec635787d
[ "MIT" ]
35
2015-04-13T09:10:38.000Z
2022-02-15T01:43:03.000Z
# coding=utf-8 """ Permission logic module """ from permission.logics.base import PermissionLogic from permission.logics.author import AuthorPermissionLogic from permission.logics.collaborators import CollaboratorsPermissionLogic from permission.logics.groupin import GroupInPermissionLogic from permission.logics.oneself import OneselfPermissionLogic from permission.logics.staff import StaffPermissionLogic
37.181818
72
0.872861
42
409
8.5
0.5
0.235294
0.336134
0
0
0
0
0
0
0
0
0.002646
0.075795
409
10
73
40.9
0.941799
0.090465
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
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
0
1
0
0
0
0
4
973b30d520c4f835b1d1c8d17242ebe04e5a6684
1,562
py
Python
marqeta/response_models/access_token_response.py
marqeta/marqeta-python
66fa690eb910825c510a391720b0fe717fac0234
[ "MIT" ]
21
2019-04-12T09:02:17.000Z
2022-02-18T11:39:06.000Z
marqeta/response_models/access_token_response.py
marqeta/marqeta-python
66fa690eb910825c510a391720b0fe717fac0234
[ "MIT" ]
1
2020-07-22T21:27:40.000Z
2020-07-23T17:38:43.000Z
marqeta/response_models/access_token_response.py
marqeta/marqeta-python
66fa690eb910825c510a391720b0fe717fac0234
[ "MIT" ]
10
2019-05-08T14:20:37.000Z
2021-09-20T18:09:26.000Z
from datetime import datetime, date from marqeta.response_models.application import Application from marqeta.response_models import datetime_object import json import re class AccessTokenResponse(object): def __init__(self, json_response): self.json_response = json_response def __str__(self): return json.dumps(self.json_response, default=self.json_serial) @staticmethod def json_serial(o): if isinstance(o, datetime) or isinstance(o, date): return o.__str__() @property def token(self): return self.json_response.get('token', None) @property def expires(self): if 'expires' in self.json_response: return datetime_object('expires', self.json_response) @property def application(self): if 'application' in self.json_response: return Application(self.json_response['application']) @property def tokenTypeMarqetaMaster(self): return self.json_response.get('tokenTypeMarqetaMaster', None) @property def user_token(self): return self.json_response.get('user_token', None) @property def master_roles(self): return self.json_response.get('master_roles', None) @property def token_type(self): return self.json_response.get('token_type', None) @property def one_time(self): return self.json_response.get('one_time', None) def __repr__(self): return '<Marqeta.response_models.access_token_response.AccessTokenResponse>' + self.__str__()
26.033333
102
0.691421
185
1,562
5.562162
0.221622
0.108844
0.202138
0.104956
0.23518
0.188533
0.103984
0
0
0
0
0
0.215109
1,562
59
103
26.474576
0.839315
0
0
0.190476
0
0
0.108835
0.056978
0
0
0
0
0
1
0.285714
false
0
0.119048
0.190476
0.690476
0
0
0
0
null
0
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
1
0
0
0
1
1
0
0
4
976d354e4b4d38f8b27c274706071c4b452b2bf6
174
py
Python
gym/vizdoomgym/vizdoomgym/envs/vizdoommywayhome_dense.py
utanashati/curiosity-recast
00c6efedb110eed8f37a1d1a152371d7a8707a92
[ "MIT" ]
null
null
null
gym/vizdoomgym/vizdoomgym/envs/vizdoommywayhome_dense.py
utanashati/curiosity-recast
00c6efedb110eed8f37a1d1a152371d7a8707a92
[ "MIT" ]
null
null
null
gym/vizdoomgym/vizdoomgym/envs/vizdoommywayhome_dense.py
utanashati/curiosity-recast
00c6efedb110eed8f37a1d1a152371d7a8707a92
[ "MIT" ]
1
2021-12-14T12:20:39.000Z
2021-12-14T12:20:39.000Z
from vizdoomgym.envs.vizdoomenv import VizdoomEnv class VizdoomMyWayHomeDense(VizdoomEnv): def __init__(self): super(VizdoomMyWayHomeDense, self).__init__(10)
21.75
55
0.775862
17
174
7.470588
0.705882
0
0
0
0
0
0
0
0
0
0
0.013423
0.143678
174
7
56
24.857143
0.838926
0
0
0
0
0
0
0
0
0
0
0
0
1
0.25
false
0
0.25
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
0
0
0
0
1
0
0
4
97738449d05b1dfbeb6ebeb4879958c3d8fca483
82
py
Python
wiki/apps.py
sjsafranek/django_wiki
f73723f6e9e17c9b9ace6519d9a3cd6e1e42bf7a
[ "MIT" ]
1
2020-05-12T05:39:03.000Z
2020-05-12T05:39:03.000Z
wiki/apps.py
sjsafranek/django_wiki
f73723f6e9e17c9b9ace6519d9a3cd6e1e42bf7a
[ "MIT" ]
8
2019-12-25T21:32:49.000Z
2022-02-11T19:28:33.000Z
wiki/apps.py
kalevhark/kroonika
a2d7a80666e742e62a3d2bcf72a597bf103ab9c7
[ "MIT" ]
null
null
null
from django.apps import AppConfig class WikiConfig(AppConfig): name = 'wiki'
16.4
33
0.743902
10
82
6.1
0.9
0
0
0
0
0
0
0
0
0
0
0
0.170732
82
4
34
20.5
0.897059
0
0
0
0
0
0.04878
0
0
0
0
0
0
1
0
false
0
0.333333
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
0
0
0
1
0
1
0
0
4
9782d689b3007f2f19d9216439cc231cff63a397
182
py
Python
FHIRPower/DataInterface/sqlinterface_test.py
NematiLab/Streaming-Sepsis-Prediction-System-for-Intensive-Care-Units
fb5ad260fb8d264d85aea9e6c895d1700eea4d11
[ "Apache-2.0" ]
2
2019-05-16T16:41:22.000Z
2021-04-22T22:06:49.000Z
FHIRPower/DataInterface/sqlinterface_test.py
NematiLab/Streaming-Sepsis-Prediction-System-for-Intensive-Care-Units
fb5ad260fb8d264d85aea9e6c895d1700eea4d11
[ "Apache-2.0" ]
null
null
null
FHIRPower/DataInterface/sqlinterface_test.py
NematiLab/Streaming-Sepsis-Prediction-System-for-Intensive-Care-Units
fb5ad260fb8d264d85aea9e6c895d1700eea4d11
[ "Apache-2.0" ]
3
2019-03-26T01:39:18.000Z
2020-02-02T19:06:33.000Z
from sqlinterface import SqlInterface a = SqlInterface() a.addObservationToDatabase(123,'Joel','2017-01-01T01:01:01',0.0,0.0,0.0,0.0,0.0,0.0,0.0) print a.retrieveLatestRecord('3')
26
88
0.741758
33
182
4.090909
0.424242
0.192593
0.266667
0.325926
0.103704
0.103704
0.103704
0.103704
0.103704
0.103704
0
0.188235
0.065934
182
6
89
30.333333
0.605882
0
0
0
0
0
0.131868
0
0
0
0
0
0
0
null
null
0
0.25
null
null
0.25
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
1
0
0
0
0
0
0
0
0
4
978f22e375467aa43164a00cf6d86426f674e41a
217
py
Python
Programming Languages/Python/Theory/100_Python_Challenges/Section_3_List/55. highest number in a list.py
jaswinder9051998/Resources
fd468af37bf24ca57555d153ee64693c018e822e
[ "MIT" ]
101
2021-12-20T11:57:11.000Z
2022-03-23T09:49:13.000Z
Programming Languages/Python/Theory/100_Python_Challenges/Section_3_List/55. highest number in a list.py
Sid-1164/Resources
3987dcaeddc8825f9bc79609ff26094282b8ece1
[ "MIT" ]
4
2022-01-12T11:55:56.000Z
2022-02-12T04:53:33.000Z
Programming Languages/Python/Theory/100_Python_Challenges/Section_3_List/55. highest number in a list.py
Sid-1164/Resources
3987dcaeddc8825f9bc79609ff26094282b8ece1
[ "MIT" ]
38
2022-01-12T11:56:16.000Z
2022-03-23T10:07:52.000Z
""" Write a Python function that returns the highest number in a list. input_list = [9,6,45,67,12] Expected output = 67 """ def high_num(input_list): input_list.sort() return input_list[-1]
14.466667
66
0.645161
34
217
3.970588
0.735294
0.266667
0.192593
0
0
0
0
0
0
0
0
0.067073
0.24424
217
14
67
15.5
0.756098
0.543779
0
0
0
0
0
0
0
0
0
0
0
1
0.333333
false
0
0
0
0.666667
0
0
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
1
0
0
0
0
1
0
0
4
9794c0a84c640c2c2e36fc6a853d13294258139f
87
py
Python
main.py
leonelcs/python_learning
f583cda1797e9b2e6658ac32659b79ccd29073fa
[ "MIT" ]
null
null
null
main.py
leonelcs/python_learning
f583cda1797e9b2e6658ac32659b79ccd29073fa
[ "MIT" ]
null
null
null
main.py
leonelcs/python_learning
f583cda1797e9b2e6658ac32659b79ccd29073fa
[ "MIT" ]
null
null
null
from learning.trees import traversals if __name__ == "__main__": traversals.main()
21.75
37
0.747126
10
87
5.7
0.8
0
0
0
0
0
0
0
0
0
0
0
0.149425
87
4
38
21.75
0.77027
0
0
0
0
0
0.090909
0
0
0
0
0
0
1
0
true
0
0.333333
0
0.333333
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
0
1
0
0
0
0
4
97b4882b83fa90e484f32190eda21b1fc5c11753
15,434
py
Python
tests/unit/modules/readers/test_WeightQcdEwk.py
shane-breeze/zinv-analysis
496abf9cb0e77831d580be417bcad7845c347704
[ "MIT" ]
1
2019-02-06T12:15:42.000Z
2019-02-06T12:15:42.000Z
tests/unit/modules/readers/test_WeightQcdEwk.py
shane-breeze/zinv-analysis
496abf9cb0e77831d580be417bcad7845c347704
[ "MIT" ]
12
2019-03-27T15:52:34.000Z
2020-02-06T12:09:37.000Z
tests/unit/modules/readers/test_WeightQcdEwk.py
shane-breeze/zinv-analysis
496abf9cb0e77831d580be417bcad7845c347704
[ "MIT" ]
1
2019-03-14T17:23:33.000Z
2019-03-14T17:23:33.000Z
import pytest import mock import os import numpy as np import awkward as awk from zinv.modules.readers import WeightQcdEwk class DummyEvent(object): def __init__(self): self.iblock = 0 self.source = '' self.nsig = 0. self.cache = {} self.config = mock.MagicMock() def register_function(self, event, name, function): self.__dict__[name] = function @pytest.fixture() def event(): return DummyEvent() @pytest.fixture() def module(): return WeightQcdEwk( input_paths = { "ZJetsToNuNu": ("http://www.hep.ph.ic.ac.uk/~sdb15/Analysis/ZinvWidth/data/qcd_ewk/vvj.dat", "vvj_pTV_{}"), "WJetsToLNu": ("http://www.hep.ph.ic.ac.uk/~sdb15/Analysis/ZinvWidth/data/qcd_ewk/evj.dat", "evj_pTV_{}"), "DYJetsToLL": ("http://www.hep.ph.ic.ac.uk/~sdb15/Analysis/ZinvWidth/data/qcd_ewk/eej.dat", "eej_pTV_{}"), }, underflow = True, overflow = True, formula = "((K_NNLO + d1k_qcd*d1K_NNLO + d2k_qcd*d2K_NNLO + d3k_qcd*d3K_NNLO)"\ "*(1 + kappa_EW + d1k_ew*d1kappa_EW + isz*(d2k_ew_z*d2kappa_EW + d3k_ew_z*d3kappa_EW)"\ "+ isw*(d2k_ew_w*d2kappa_EW + d3k_ew_w*d3kappa_EW))"\ "+ dk_mix*dK_NNLO_mix)"\ "/(K_NLO + d1k_qcd*d1K_NLO + d2k_qcd*d2K_NLO + d3k_qcd*d3K_NLO)", params = ["K_NLO", "d1K_NLO", "d2K_NLO", "d3K_NLO", "K_NNLO", "d1K_NNLO", "d2K_NNLO", "d3K_NNLO", "kappa_EW", "d1kappa_EW", "d2kappa_EW", "d3kappa_EW", "dK_NNLO_mix"], variation_names = ["d1k_qcd", "d2k_qcd", "d3k_qcd", "d1k_ew", "d2k_ew_z", "d2k_ew_w", "d3k_ew_z", "d3k_ew_w", "dk_mix"], ) def test_weightqcdewk_init(module): assert module.input_paths == { "ZJetsToNuNu": ("http://www.hep.ph.ic.ac.uk/~sdb15/Analysis/ZinvWidth/data/qcd_ewk/vvj.dat", "vvj_pTV_{}"), "WJetsToLNu": ("http://www.hep.ph.ic.ac.uk/~sdb15/Analysis/ZinvWidth/data/qcd_ewk/evj.dat", "evj_pTV_{}"), "DYJetsToLL": ("http://www.hep.ph.ic.ac.uk/~sdb15/Analysis/ZinvWidth/data/qcd_ewk/eej.dat", "eej_pTV_{}"), } assert module.underflow == True assert module.overflow == True assert module.formula == "((K_NNLO + d1k_qcd*d1K_NNLO + d2k_qcd*d2K_NNLO + d3k_qcd*d3K_NNLO)"\ "*(1 + kappa_EW + d1k_ew*d1kappa_EW + isz*(d2k_ew_z*d2kappa_EW + d3k_ew_z*d3kappa_EW)"\ "+ isw*(d2k_ew_w*d2kappa_EW + d3k_ew_w*d3kappa_EW))"\ "+ dk_mix*dK_NNLO_mix)"\ "/(K_NLO + d1k_qcd*d1K_NLO + d2k_qcd*d2K_NLO + d3k_qcd*d3K_NLO)" assert module.params == [ "K_NLO", "d1K_NLO", "d2K_NLO", "d3K_NLO", "K_NNLO", "d1K_NNLO", "d2K_NNLO", "d3K_NNLO", "kappa_EW", "d1kappa_EW", "d2kappa_EW", "d3kappa_EW", "dK_NNLO_mix", ] assert module.variation_names == [ "d1k_qcd", "d2k_qcd", "d3k_qcd", "d1k_ew", "d2k_ew_z", "d2k_ew_w", "d3k_ew_z", "d3k_ew_w", "dk_mix", ] @pytest.mark.parametrize( "inputs,outputs", ( [{ "parent": "ZJetsToNuNu", "underflow": True, "overflow": True, }, { "result": True, }], [{ "parent": "ZJetsToNuNu", "underflow": False, "overflow": False, }, { "result": True, }], [{ "parent": "WJetsToLNu", "underflow": True, "overflow": True, }, { "result": True, }], [{ "parent": "DYJetsToLL", "underflow": True, "overflow": True, }, { "result": True, }], [{ "parent": "Other", "underflow": True, "overflow": True, }, { "result": True, }], ) ) def test_weightqcdewk_begin(module, event, inputs, outputs): event.config.dataset.parent = inputs["parent"] module.underflow = inputs["underflow"] module.overflow = inputs["overflow"] module.begin(event) assert hasattr(module, "input_df") == outputs["result"] @pytest.mark.parametrize( "inputs,outputs", ( [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "", "nsig": 0., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.071991350069300, 1.085072600134150, 1.069131960784340, 1.030109454980090, 0.943911876078431, 0.864166469122489, 0.774704840108300, 0.721218007769897, 0.721218007769897], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d1k_qcd", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.030696018270610, 1.047052839720330, 1.028880006209720, 0.983430952350240, 0.893472013440240, 0.812196867984426, 0.724960805696453, 0.669169906367341, 0.669169906367341], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d1k_qcd", "nsig": -1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.118116532226270, 1.127671526399130, 1.114356625413100, 1.083723429282010, 1.003526722622880, 0.927100703776154, 0.837949066500746, 0.791748390727572, 0.791748390727572], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d2k_qcd", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.117909027020050, 1.127140552545750, 1.112142453111700, 1.073887137958910, 0.958234879552157, 0.841916736146612, 0.733627645604361, 0.673274194374568, 0.673274194374568], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d3k_qcd", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.082327160627540, 1.092411784236760, 1.073723566545470, 1.031150128579600, 0.942417841941239, 0.860581484315055, 0.768699259163798, 0.712640895377803, 0.712640895377803], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d1k_ew", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.071991749507280, 1.085073070394590, 1.069132821120370, 1.030186252380140, 0.945344716388350, 0.871445952688314, 0.801250740529584, 0.774453223619960, 0.774453223619960], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d2k_ew_z", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.072396129258980, 1.085415071405440, 1.069300713259830, 1.032380364575490, 0.951036728220107, 0.877034497455687, 0.795210818772591, 0.747938032557757, 0.747938032557757], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d2k_ew_w", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.071991350069300, 1.085072600134150, 1.069131960784340, 1.030109454980090, 0.943911876078431, 0.864166469122489, 0.774704840108300, 0.721218007769897, 0.721218007769897], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d3k_ew_z", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.072039280090420, 1.085161872164570, 1.069536581692570, 1.031869050982240, 0.950568389353791, 0.879032083520971, 0.801688322421896, 0.753732857417780, 0.753732857417780], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d3k_ew_w", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.071991350069300, 1.085072600134150, 1.069131960784340, 1.030109454980090, 0.943911876078431, 0.864166469122489, 0.774704840108300, 0.721218007769897, 0.721218007769897], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "dk_mix", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.071739594941190, 1.084841705104440, 1.069235891413690, 1.031720721296600, 0.948853206957072, 0.872806553702445, 0.788247086111982, 0.739514507629186, 0.739514507629186], }], [{ "parent": "Other", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "", "nsig": 0., }, { "weight": [1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.], }], [{ "parent": "ZJetsToNuNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "Other", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.071991350069300, 1.085072600134150, 1.069131960784340, 1.030109454980090, 0.943911876078431, 0.864166469122489, 0.774704840108300, 0.721218007769897, 0.721218007769897], }], [{ "parent": "WJetsToLNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "", "nsig": 0., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.023410820320550, 1.024130192347730, 1.020314922339990, 0.990417237421081, 0.903637981081761, 0.819501618321920, 0.712597842165201, 0.588238663003707, 0.588238663003707], }], [{ "parent": "WJetsToLNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d2k_ew_z", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.023410820320550, 1.024130192347730, 1.020314922339990, 0.990417237421081, 0.903637981081761, 0.819501618321920, 0.712597842165201, 0.588238663003707, 0.588238663003707], }], [{ "parent": "WJetsToLNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d2k_ew_w", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.023589821835780, 1.024624881588750, 1.021715924807730, 0.994258370841088, 0.912723304594549, 0.834961499333771, 0.737826329444925, 0.624669558858385, 0.624669558858385], }], [{ "parent": "WJetsToLNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d3k_ew_z", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.023410820320550, 1.024130192347730, 1.020314922339990, 0.990417237421081, 0.903637981081761, 0.819501618321920, 0.712597842165201, 0.588238663003707, 0.588238663003707], }], [{ "parent": "WJetsToLNu", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d3k_ew_w", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.023481240006130, 1.024178658506250, 1.020342371632680, 0.990579502649820, 0.905652659464953, 0.825173382215209, 0.710119702126497, 0.522045582148113, 0.522045582148113], }], [{ "parent": "DYJetsToLL", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "", "nsig": 0., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.057695056859910, 1.065163565548090, 1.040220306435990, 1.003716881754210, 0.929583009857246, 0.866283824910207, 0.798585450112642, 0.762354801796986, 0.762354801796986], }], [{ "parent": "DYJetsToLL", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d2k_ew_z", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.057893818386340, 1.065452466733380, 1.041603936377610, 1.007252710288180, 0.937512118447112, 0.879286702498615, 0.818381967026762, 0.787824254431365, 0.787824254431365], }], [{ "parent": "DYJetsToLL", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d2k_ew_w", "nsig": 0., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.057695056859910, 1.065163565548090, 1.040220306435990, 1.003716881754210, 0.929583009857246, 0.866283824910207, 0.798585450112642, 0.762354801796986, 0.762354801796986], }], [{ "parent": "DYJetsToLL", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d3k_ew_z", "nsig": 1., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.057765538281910, 1.065258256901350, 1.040269795465800, 1.004102021154720, 0.934022109645626, 0.880831209866396, 0.832310598300416, 0.810421192941440, 0.810421192941440], }], [{ "parent": "DYJetsToLL", "vpt": [0., 10., 20., 30., 50., 100., 200., 500., 1000., 2000., 5000., 10000.], "source": "d3k_ew_w", "nsig": 0., }, { "weight": [1.000000000000000, 1.000000000000000, 1.000000000000000, 1.057695056859910, 1.065163565548090, 1.040220306435990, 1.003716881754210, 0.929583009857246, 0.866283824910207, 0.798585450112642, 0.762354801796986, 0.762354801796986], }], ) ) def test_weightqcdewk_event(module, event, inputs, outputs): event.config.dataset.parent = inputs["parent"] event.source = inputs["source"] event.nsig = inputs["nsig"] event.size = len(inputs["vpt"]) module.begin(event) vpt = np.array(inputs["vpt"], dtype=np.float32) event.GenPartBoson = mock.Mock(side_effect=lambda ev, attr: vpt) weight = event.WeightQcdEwk(event, event.source, event.nsig) oweight = np.array(outputs["weight"], dtype=np.float32) print(inputs["parent"]) print(inputs["source"]) print(inputs["nsig"]) print(weight) print(oweight) assert np.allclose(weight, oweight, rtol=1e-6, equal_nan=True)
51.791946
251
0.57017
1,626
15,434
5.296433
0.153752
0.12262
0.130283
0.163493
0.670808
0.670808
0.666744
0.642592
0.642592
0.642592
0
0.449701
0.253531
15,434
297
252
51.96633
0.297804
0
0
0.690141
0
0.021127
0.176234
0.008941
0
0
0
0
0.028169
1
0.024648
false
0
0.021127
0.007042
0.056338
0.017606
0
0
0
null
0
0
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
4
97b667a9cedc4b60671ca68969e83be1afeb391d
595
py
Python
src/lib/mine/src_gen/document/markdown/complete.py
rdw20170120/workstation
ed19aa930a83885c2a8cb58eb0bb5afe58f95df3
[ "MIT" ]
null
null
null
src/lib/mine/src_gen/document/markdown/complete.py
rdw20170120/workstation
ed19aa930a83885c2a8cb58eb0bb5afe58f95df3
[ "MIT" ]
2
2021-04-06T18:07:32.000Z
2021-06-02T01:50:40.000Z
src/lib/mine/src_gen/document/markdown/complete.py
rdw20170120/workstation
ed19aa930a83885c2a8cb58eb0bb5afe58f95df3
[ "MIT" ]
null
null
null
#!/usr/bin/env false """TODO: Write """ # Internal packages (absolute references, distributed with Python) # External packages (absolute references, NOT distributed with Python) # Library modules (absolute references, NOT packaged, in project) from src_gen.document.markdown.source import generate from src_gen.document.markdown.structure import * # Project modules (relative references, NOT packaged, in project) def _document(): return [ h1("TODO"), ] def generate_document(directory, filename): generate(_document(), directory, filename) """DisabledContent """
23.8
70
0.737815
67
595
6.477612
0.537313
0.124424
0.119816
0.105991
0.258065
0
0
0
0
0
0
0.001992
0.156303
595
24
71
24.791667
0.86255
0.49916
0
0
0
0
0.015094
0
0
0
0
0.041667
0
1
0.25
false
0
0.25
0.125
0.625
0
0
0
0
null
0
0
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
1
0
0
1
0
0
0
1
1
0
0
4
97b99d04285bdc8f7182d65d897a9c477e4bc413
4,569
py
Python
django_pgpool/tests.py
tru-software/django_pgpool
a21082299dc4c89476b00e06826963fbcb1de85c
[ "MIT" ]
null
null
null
django_pgpool/tests.py
tru-software/django_pgpool
a21082299dc4c89476b00e06826963fbcb1de85c
[ "MIT" ]
null
null
null
django_pgpool/tests.py
tru-software/django_pgpool
a21082299dc4c89476b00e06826963fbcb1de85c
[ "MIT" ]
null
null
null
import sys import time import gevent import pytest import collections from psycopg2 import OperationalError from .psycopg2_pool import PostgresConnectionPool dsn = "dbname=template1" def test1(): """ Waiting for one slot - total 0.2s """ pool = PostgresConnectionPool(dsn, maxsize=3, maxwait=1) start = time.time() for _ in range(4): gevent.spawn(pool.execute, 'select pg_sleep(0.1);') gevent.wait() delay = time.time() - start assert int(delay * 10) == 2 pool.closeall() def test2(): """ Waiting for 4 slots - total 0.3s """ pool = PostgresConnectionPool(dsn, maxsize=2, maxwait=2) start = time.time() for _ in range(6): gevent.spawn(pool.execute, 'select pg_sleep(0.1);') gevent.wait() delay = time.time() - start assert int(delay * 10) == 3 pool.closeall() def test_overflow(): """ Running "select pg_sleep(0.1);" and reaching the overflow exception """ def exec_sleep(): try: pool.execute('select pg_sleep(0.1);') exec_sleep.passed += 1 except OperationalError: exec_sleep.raised += 1 exec_sleep.passed = 0 exec_sleep.raised = 0 pool = PostgresConnectionPool(dsn, maxsize=3, maxwait=0.15) for _ in range(8): gevent.spawn(exec_sleep) gevent.wait() assert exec_sleep.passed == 6 assert exec_sleep.raised == 2 def test_no_expires(): """ """ def exec_sleep(): with pool.cursor() as cursor: cursor.execute('select pg_backend_pid();') pid = cursor.fetchone()[0] exec_sleep.conns_pids[pid] += 1 cursor.execute('select pg_sleep(0.15);') exec_sleep.conns_pids = collections.defaultdict(int) pool = PostgresConnectionPool(dsn, maxsize=2, maxwait=0.5, expires=0.4) for _ in range(8): gevent.spawn(exec_sleep) gevent.wait() assert len(exec_sleep.conns_pids) == 2 gevent.sleep(0.4) pool.cleanup() assert pool._size == 0 def test_expires(): """ """ def exec_sleep(): with pool.cursor() as cursor: cursor.execute('select pg_backend_pid();') pid = cursor.fetchone()[0] exec_sleep.conns_pids[pid] += 1 cursor.execute('select pg_sleep(0.15);') exec_sleep.conns_pids = collections.defaultdict(int) pool = PostgresConnectionPool(dsn, maxsize=2, maxwait=0.5, expires=0.1) assert pool._size == 0 gevent.spawn(exec_sleep) gevent.wait() assert pool._size == 0 assert len(pool._pool) == 0 assert len(exec_sleep.conns_pids) == 1 # Old connection should expire and new one should be created gevent.spawn(exec_sleep) gevent.wait() assert pool._size == 0 assert len(pool._pool) == 0 assert len(exec_sleep.conns_pids) == 2 def test_cleanup(): """ """ def exec_sleep(): with pool.cursor() as cursor: cursor.execute('select pg_backend_pid();') pid = cursor.fetchone()[0] exec_sleep.conns_pids[pid] += 1 cursor.execute('select pg_sleep(0.15);') exec_sleep.conns_pids = collections.defaultdict(int) pool = PostgresConnectionPool(dsn, maxsize=4, maxwait=0.5, expires=2.0, cleanup=0.2) assert pool._size == 0 for _ in range(4): gevent.spawn(exec_sleep) gevent.wait() assert pool._size == 4 assert len(pool._pool) == 4 assert len(exec_sleep.conns_pids) == 4 gevent.spawn(exec_sleep) gevent.wait() # latest_use = 0, 0, 0, 0 gevent.spawn(exec_sleep) assert pool._size == 4 gevent.wait() # latest_use = 0, 0.15, 0.15, 0.15 gevent.spawn(exec_sleep) assert pool._size == 1 gevent.wait() # latest_use = 0, --> 0.30, 0.30, 0.30 <-- gevent.spawn(exec_sleep) assert pool._size == 1 gevent.wait() time.sleep(0.25) pool.cleanup() assert pool._size == 0 def test_overflow_and_cleanup(): """ """ def exec_sleep(): try: pool.execute('select pg_sleep(0.1);') exec_sleep.passed += 1 except OperationalError: exec_sleep.raised += 1 exec_sleep.passed = 0 exec_sleep.raised = 0 pool = PostgresConnectionPool(dsn, maxsize=3, maxwait=0.15, cleanup=0.0001) for _ in range(8): gevent.spawn(exec_sleep) gevent.wait() assert exec_sleep.passed == 6 assert exec_sleep.raised == 2 if __name__ == '__main__': print("usage: python -m pytest -v ./tests.py")
21.861244
88
0.609543
604
4,569
4.445364
0.162252
0.124022
0.055866
0.074488
0.788454
0.782123
0.702048
0.668901
0.64432
0.627933
0
0.041197
0.261545
4,569
208
89
21.966346
0.754594
0.068286
0
0.741935
0
0
0.067639
0
0
0
0
0
0.185484
1
0.096774
false
0.048387
0.056452
0
0.153226
0.008065
0
0
0
null
0
0
0
0
1
1
0
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
4
97ce769b15e130995f9da751d7e6dfd32cb2fff7
20
py
Python
11.py
Outman888/test
af8a903ddde6cf8506effe72914bb6099d3009a9
[ "MIT" ]
null
null
null
11.py
Outman888/test
af8a903ddde6cf8506effe72914bb6099d3009a9
[ "MIT" ]
null
null
null
11.py
Outman888/test
af8a903ddde6cf8506effe72914bb6099d3009a9
[ "MIT" ]
null
null
null
i='1' print(int(i))
6.666667
13
0.55
5
20
2.2
0.8
0
0
0
0
0
0
0
0
0
0
0.055556
0.1
20
2
14
10
0.555556
0
0
0
0
0
0.05
0
0
0
0
0
0
1
0
false
0
0
0
0
0.5
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
0
0
0
0
0
1
0
4
8ae2a366f172b8768cf21d84f7f450b4463ce210
110
py
Python
example_consumer_a.py
rihorn2/flask-env
6d3af9758947011aa5f4c79fe283aaa3543266da
[ "MIT" ]
null
null
null
example_consumer_a.py
rihorn2/flask-env
6d3af9758947011aa5f4c79fe283aaa3543266da
[ "MIT" ]
null
null
null
example_consumer_a.py
rihorn2/flask-env
6d3af9758947011aa5f4c79fe283aaa3543266da
[ "MIT" ]
null
null
null
from .shared_server_base import SharedServerBase class ExampleConsumerA(SharedServerBase): def __init__()
27.5
48
0.836364
11
110
7.818182
0.909091
0
0
0
0
0
0
0
0
0
0
0
0.109091
110
4
49
27.5
0.877551
0
0
0
0
0
0
0
0
0
0
0
0
0
null
null
0
0.333333
null
null
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
1
0
0
0
1
0
0
0
0
4